4968c44f2c
Seven loose root-level .ts files were the dark-mechanicus theme bundle: indicator, banner, footer, status-line, session-names, thinking-label, and markdown-body-color. They share visual language with themes/dark-mechanicus.json and only make sense together. Moved them under dark-mechanicus/ as a multi-file extension. The pi-coding-agent loader auto-discovers <subdir>/index.ts as a single extension entry, so dark-mechanicus/index.ts now sequences each sub-module's default registrar. File renames also drop the redundant 'mechanicus-' / 'dark-mechanicus-' prefix since the directory name carries it. Symbol names, command names, and external behavior are unchanged — disabling each piece still works via its own /<name>-off command. Imports inside each moved file: ./shared/ → ../shared/. local-llama.ts stays at the root — separate stub provider, not part of the theme. .gitignore updated: 8 individual !/<file>.ts allowlist entries replaced with a single !/dark-mechanicus/. README.md: theme entries collapsed into one row pointing at the folder; tree diagram updated. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
45 lines
1.4 KiB
TypeScript
45 lines
1.4 KiB
TypeScript
/**
|
|
* mechanicus-thinking-label — replace pi's "Thinking..." label with a
|
|
* dark-mechanicum one when assistant reasoning blocks are folded.
|
|
*
|
|
* pi's AssistantMessageComponent stores the label as an instance field
|
|
* initialised from the constructor default. pi-coding-agent never
|
|
* overrides it in its own code paths, so we can monkey-patch
|
|
* updateContent() to swap the default before rendering.
|
|
*
|
|
* Override via env var: PI_THINKING_LABEL="Cogitating…"
|
|
*/
|
|
|
|
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
import { AssistantMessageComponent } from "@mariozechner/pi-coding-agent";
|
|
|
|
const DEFAULT_LABEL = "Thinking...";
|
|
const LABEL = process.env.PI_THINKING_LABEL ?? "Cogitating...";
|
|
|
|
let patched = false;
|
|
|
|
export default function (_pi: ExtensionAPI) {
|
|
if (patched) return;
|
|
patched = true;
|
|
|
|
const proto = AssistantMessageComponent.prototype as Record<string, unknown>;
|
|
const origUpdate = proto.updateContent as ((m: unknown) => void) | undefined;
|
|
if (typeof origUpdate !== "function") {
|
|
console.warn(
|
|
"[mechanicus-thinking-label] AssistantMessageComponent.updateContent is missing; skipping patch.",
|
|
);
|
|
return;
|
|
}
|
|
|
|
proto.updateContent = function (this: any, message: unknown) {
|
|
if (this.hiddenThinkingLabel === DEFAULT_LABEL) {
|
|
this.hiddenThinkingLabel = LABEL;
|
|
}
|
|
return origUpdate.call(this, message);
|
|
};
|
|
|
|
if (process.env.PI_DEBUG) {
|
|
console.log(`[mechanicus-thinking-label] "${DEFAULT_LABEL}" -> "${LABEL}"`);
|
|
}
|
|
}
|