@earendil-works/pi-coding-agent 1.0.3 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +75 -0
- package/dist/bundle/chunks/{anthropic-messages-Y22YDKSW.js → anthropic-messages-KT2ID7DZ.js} +1 -1
- package/dist/bundle/chunks/anthropic.js +1 -1
- package/dist/bundle/chunks/{azure-openai-responses-YJDJIIDQ.js → azure-openai-responses-6A4PNZTH.js} +1 -1
- package/dist/bundle/chunks/bedrock-converse-stream.js +2 -2
- package/dist/bundle/chunks/chunk-33CRHCAK.js +2 -0
- package/dist/bundle/chunks/{chunk-UBHCV62G.js → chunk-BK6FEHYX.js} +3 -3
- package/dist/bundle/chunks/chunk-CH4ZBH45.js +11 -0
- package/dist/bundle/chunks/{chunk-6DBOMCBS.js → chunk-GXLAGZ3Z.js} +1 -1
- package/dist/bundle/chunks/{chunk-J52J6TFP.js → chunk-HKYL362W.js} +1 -1
- package/dist/bundle/chunks/chunk-LPXNMA2W.js +2 -0
- package/dist/bundle/chunks/{chunk-TAOL3JFA.js → chunk-LTSARG5Q.js} +1 -1
- package/dist/bundle/chunks/{chunk-ZSQEXT6X.js → chunk-MXTZIDYW.js} +4 -4
- package/dist/bundle/chunks/chunk-O7YIWAPD.js +2 -0
- package/dist/bundle/chunks/{chunk-BFNE7BHG.js → chunk-OIM2DMFI.js} +83 -72
- package/dist/bundle/chunks/{chunk-AXOERKKW.js → chunk-OTL6MGLJ.js} +6 -4
- package/dist/bundle/chunks/{chunk-LD2P6SFZ.js → chunk-PMRZO46Y.js} +1 -1
- package/dist/bundle/chunks/{chunk-7TP2J6F2.js → chunk-SYCGMWFH.js} +1 -1
- package/dist/bundle/chunks/{chunk-2VBQLN7Y.js → chunk-UH5J7I7X.js} +9 -6
- package/dist/bundle/chunks/{chunk-WE4MXUQS.js → chunk-VLRCF7MR.js} +1 -1
- package/dist/bundle/chunks/chunk-W5MPVSHA.js +82 -0
- package/dist/bundle/chunks/chunk-Y4NYF362.js +2 -0
- package/dist/bundle/chunks/{cli-HTJP6F6Z.js → cli-OQYLWLA3.js} +2 -2
- package/dist/bundle/chunks/cloudflare-workers-ai-system-one-U3AH4ODQ.js +2 -0
- package/dist/bundle/chunks/codemode-worker.js +101 -5
- package/dist/bundle/chunks/{easter-egg-3d-6YCNESG3.js → easter-egg-3d-TQFQS342.js} +1 -1
- package/dist/bundle/chunks/{execute-JRUOLYDA.js → execute-7IRB5TUX.js} +110 -8
- package/dist/bundle/chunks/github-copilot.js +1 -1
- package/dist/bundle/chunks/{google-generative-ai-XMFHGQC5.js → google-generative-ai-X2VFFS4I.js} +1 -1
- package/dist/bundle/chunks/{google-vertex-4XRRNP74.js → google-vertex-KMGHFTSP.js} +1 -1
- package/dist/bundle/chunks/image-resize-worker.js +1 -1
- package/dist/bundle/chunks/{llama-cpp-classify-XT44PI3C.js → llama-cpp-classify-FYN623RH.js} +2 -2
- package/dist/bundle/chunks/{mistral-conversations-Q22M3IBG.js → mistral-conversations-PRZLM26U.js} +2 -2
- package/dist/bundle/chunks/openai-chatgpt.js +1 -1
- package/dist/bundle/chunks/{openai-codex-responses-4MYQSO5E.js → openai-codex-responses-ZSLJZYOE.js} +2 -2
- package/dist/bundle/chunks/openai-codex.js +1 -1
- package/dist/bundle/chunks/{openai-completions-OSRCWAAA.js → openai-completions-WWQW7S3V.js} +1 -1
- package/dist/bundle/chunks/openai-decisions-QLZKZLAK.js +5 -0
- package/dist/bundle/chunks/{openai-responses-UHF3DHNG.js → openai-responses-KV7QHJY6.js} +1 -1
- package/dist/bundle/chunks/{openrouter-images-ZVXWCSIM.js → openrouter-images-DUPG5DZO.js} +1 -1
- package/dist/bundle/chunks/{pi-messages-TM5SOOIW.js → pi-messages-YHKPQIHC.js} +1 -1
- package/dist/bundle/chunks/{runtime-NW7GPWKS.js → runtime-ROGZ2EXI.js} +1 -1
- package/dist/bundle/chunks/typesafe-system-one-B4NNEG67.js +2 -0
- package/dist/bundle/chunks/{virtual-modules-CFHJO5SY.js → virtual-modules-4YN2GNVW.js} +1 -1
- package/dist/bundle/cli-runtime.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/cli/args.d.ts +2 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +24 -5
- package/dist/cli/args.js.map +1 -1
- package/dist/core/agent-session.d.ts +33 -4
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +59 -21
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +40 -45
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
- package/dist/core/export-html/tool-renderer.js +2 -0
- package/dist/core/export-html/tool-renderer.js.map +1 -1
- package/dist/core/extensions/types.d.ts +13 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/mcp-servers.d.ts +8 -0
- package/dist/core/mcp-servers.d.ts.map +1 -1
- package/dist/core/mcp-servers.js +30 -7
- package/dist/core/mcp-servers.js.map +1 -1
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +2 -1
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/nested-tool-calls.d.ts +1 -0
- package/dist/core/nested-tool-calls.d.ts.map +1 -1
- package/dist/core/nested-tool-calls.js +1 -0
- package/dist/core/nested-tool-calls.js.map +1 -1
- package/dist/core/resource-loader.d.ts +3 -0
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +4 -3
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sdk.d.ts +13 -4
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +19 -6
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/settings-manager.d.ts +13 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +37 -13
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills.d.ts +4 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +6 -1
- package/dist/core/skills.js.map +1 -1
- package/dist/core/system-prompt.d.ts +6 -0
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +9 -4
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/read.d.ts +13 -0
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +18 -1
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/renderers/bash.d.ts.map +1 -1
- package/dist/core/tools/renderers/bash.js +8 -3
- package/dist/core/tools/renderers/bash.js.map +1 -1
- package/dist/core/tools/renderers/edit.d.ts.map +1 -1
- package/dist/core/tools/renderers/edit.js +5 -4
- package/dist/core/tools/renderers/edit.js.map +1 -1
- package/dist/extensions/codemode/execute.d.ts.map +1 -1
- package/dist/extensions/codemode/execute.js +65 -8
- package/dist/extensions/codemode/execute.js.map +1 -1
- package/dist/extensions/codemode/index.d.ts.map +1 -1
- package/dist/extensions/codemode/index.js +1 -0
- package/dist/extensions/codemode/index.js.map +1 -1
- package/dist/extensions/codemode/tool.d.ts +9 -2
- package/dist/extensions/codemode/tool.d.ts.map +1 -1
- package/dist/extensions/codemode/tool.js +14 -6
- package/dist/extensions/codemode/tool.js.map +1 -1
- package/dist/extensions/llama/provider.d.ts.map +1 -1
- package/dist/extensions/llama/provider.js +34 -11
- package/dist/extensions/llama/provider.js.map +1 -1
- package/dist/extensions/mcp/cli.js +17 -23
- package/dist/extensions/mcp/cli.js.map +1 -1
- package/dist/extensions/mcp/index.d.ts.map +1 -1
- package/dist/extensions/mcp/index.js +165 -64
- package/dist/extensions/mcp/index.js.map +1 -1
- package/dist/extensions/mcp/oauth.d.ts +5 -3
- package/dist/extensions/mcp/oauth.d.ts.map +1 -1
- package/dist/extensions/mcp/oauth.js +36 -10
- package/dist/extensions/mcp/oauth.js.map +1 -1
- package/dist/extensions/mcp/resources.d.ts +3 -4
- package/dist/extensions/mcp/resources.d.ts.map +1 -1
- package/dist/extensions/mcp/resources.js +3 -4
- package/dist/extensions/mcp/resources.js.map +1 -1
- package/dist/extensions/mcp/runtime.d.ts +4 -1
- package/dist/extensions/mcp/runtime.d.ts.map +1 -1
- package/dist/extensions/mcp/runtime.js +22 -5
- package/dist/extensions/mcp/runtime.js.map +1 -1
- package/dist/extensions/mcp/tools.d.ts +2 -1
- package/dist/extensions/mcp/tools.d.ts.map +1 -1
- package/dist/extensions/mcp/tools.js +2 -1
- package/dist/extensions/mcp/tools.js.map +1 -1
- package/dist/extensions/mcp/ui.d.ts +3 -3
- package/dist/extensions/mcp/ui.d.ts.map +1 -1
- package/dist/extensions/mcp/ui.js +10 -2
- package/dist/extensions/mcp/ui.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +1 -0
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts +5 -1
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +17 -14
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts +2 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js +5 -2
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +2 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.js +5 -2
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/custom-entry.d.ts +3 -1
- package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-entry.js +8 -2
- package/dist/modes/interactive/components/custom-entry.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +1 -0
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +1 -1
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +2 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +5 -2
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +5 -0
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +10 -0
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +2 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +50 -29
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/program-status-reporter.d.ts +34 -0
- package/dist/modes/interactive/program-status-reporter.d.ts.map +1 -0
- package/dist/modes/interactive/program-status-reporter.js +110 -0
- package/dist/modes/interactive/program-status-reporter.js.map +1 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +1 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +24 -0
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/utils/ansi.d.ts +8 -0
- package/dist/utils/ansi.d.ts.map +1 -1
- package/dist/utils/ansi.js +30 -11
- package/dist/utils/ansi.js.map +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +12 -11
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/image-resize-core.d.ts +12 -0
- package/dist/utils/image-resize-core.d.ts.map +1 -1
- package/dist/utils/image-resize-core.js +5 -0
- package/dist/utils/image-resize-core.js.map +1 -1
- package/dist/utils/image-resize-worker.js +3 -2
- package/dist/utils/image-resize-worker.js.map +1 -1
- package/dist/utils/image-resize.d.ts.map +1 -1
- package/dist/utils/image-resize.js +9 -10
- package/dist/utils/image-resize.js.map +1 -1
- package/dist/utils/syntax-highlight.d.ts.map +1 -1
- package/dist/utils/syntax-highlight.js +6 -1
- package/dist/utils/syntax-highlight.js.map +1 -1
- package/docs/cli.md +18 -6
- package/docs/codemode.md +26 -5
- package/docs/environment-variables.md +1 -0
- package/docs/extensions.md +1 -1
- package/docs/json.md +3 -3
- package/docs/llama-cpp.md +8 -1
- package/docs/mcp.md +3 -1
- package/docs/message-types.md +22 -4
- package/docs/models.md +4 -1
- package/docs/providers.md +27 -0
- package/docs/settings.md +3 -3
- package/docs/terminal-setup.md +14 -0
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/package.json +12 -12
- package/dist/bundle/chunks/chunk-A3JYRWB6.js +0 -2
- package/dist/bundle/chunks/chunk-C47CLQZK.js +0 -2
- package/dist/bundle/chunks/chunk-HQHD6PZI.js +0 -2
- package/dist/bundle/chunks/chunk-KJUDFE6Y.js +0 -11
- package/dist/bundle/chunks/chunk-PSQJVYXD.js +0 -82
- package/dist/bundle/chunks/cloudflare-workers-ai-system-one-NM3JRRWQ.js +0 -2
- package/dist/bundle/chunks/typesafe-system-one-PRR5K6CI.js +0 -2
|
@@ -5,6 +5,7 @@ export type { ToolRenderers };
|
|
|
5
5
|
export interface ToolExecutionOptions {
|
|
6
6
|
showImages?: boolean;
|
|
7
7
|
imageWidthCells?: number;
|
|
8
|
+
outputPad?: number;
|
|
8
9
|
}
|
|
9
10
|
export declare class ToolExecutionComponent extends Container {
|
|
10
11
|
private contentBox;
|
|
@@ -25,6 +26,7 @@ export declare class ToolExecutionComponent extends Container {
|
|
|
25
26
|
private expanded;
|
|
26
27
|
private showImages;
|
|
27
28
|
private imageWidthCells;
|
|
29
|
+
private outputPad;
|
|
28
30
|
private isPartial;
|
|
29
31
|
private toolDefinition?;
|
|
30
32
|
private ui;
|
|
@@ -54,8 +56,11 @@ export declare class ToolExecutionComponent extends Container {
|
|
|
54
56
|
}>;
|
|
55
57
|
details?: any;
|
|
56
58
|
isError: boolean;
|
|
59
|
+
/** Execution time of a final result. */
|
|
60
|
+
durationMs?: number;
|
|
57
61
|
}, isPartial?: boolean): void;
|
|
58
62
|
setExpanded(expanded: boolean): void;
|
|
63
|
+
setOutputPad(outputPad: number): void;
|
|
59
64
|
setShowImages(show: boolean): void;
|
|
60
65
|
setImageWidthCells(width: number): void;
|
|
61
66
|
invalidate(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-execution.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/tool-execution.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,SAAS,EAMT,KAAK,GAAG,EACR,KAAK,aAAa,EAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,cAAc,EAAqB,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAE1G,mFAAmF;AACnF,YAAY,EAAE,aAAa,EAAE,CAAC;AAS9B,MAAM,WAAW,oBAAoB;IACpC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"tool-execution.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/tool-execution.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,SAAS,EAMT,KAAK,GAAG,EACR,KAAK,a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AAW,CAAC,KAAK,EAAE,aAAa,GAAG,UAAU,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAQ/E;IAED,OAAO,CAAC,aAAa;IA0HrB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,mBAAmB;CAY3B"}
|
|
@@ -23,6 +23,7 @@ export class ToolExecutionComponent extends Container {
|
|
|
23
23
|
expanded = false;
|
|
24
24
|
showImages;
|
|
25
25
|
imageWidthCells;
|
|
26
|
+
outputPad;
|
|
26
27
|
isPartial = true;
|
|
27
28
|
toolDefinition;
|
|
28
29
|
ui;
|
|
@@ -39,6 +40,7 @@ export class ToolExecutionComponent extends Container {
|
|
|
39
40
|
this.toolDefinition = toolDefinition;
|
|
40
41
|
this.showImages = options.showImages ?? true;
|
|
41
42
|
this.imageWidthCells = options.imageWidthCells ?? 60;
|
|
43
|
+
this.outputPad = options.outputPad ?? 1;
|
|
42
44
|
this.ui = ui;
|
|
43
45
|
this.cwd = cwd;
|
|
44
46
|
this.addChild(new Spacer(1));
|
|
@@ -86,6 +88,8 @@ export class ToolExecutionComponent extends Container {
|
|
|
86
88
|
expanded: this.expanded,
|
|
87
89
|
showImages: this.showImages,
|
|
88
90
|
isError: this.result?.isError ?? false,
|
|
91
|
+
durationMs: this.isPartial ? undefined : this.result?.durationMs,
|
|
92
|
+
outputPad: this.outputPad,
|
|
89
93
|
};
|
|
90
94
|
}
|
|
91
95
|
createCallFallback() {
|
|
@@ -136,6 +140,10 @@ export class ToolExecutionComponent extends Container {
|
|
|
136
140
|
this.expanded = expanded;
|
|
137
141
|
this.updateDisplay();
|
|
138
142
|
}
|
|
143
|
+
setOutputPad(outputPad) {
|
|
144
|
+
this.outputPad = outputPad;
|
|
145
|
+
this.updateDisplay();
|
|
146
|
+
}
|
|
139
147
|
setShowImages(show) {
|
|
140
148
|
this.showImages = show;
|
|
141
149
|
this.updateDisplay();
|
|
@@ -200,6 +208,7 @@ export class ToolExecutionComponent extends Container {
|
|
|
200
208
|
const renderContainer = this.getRenderShell() === "self" ? this.selfRenderContainer : this.contentBox;
|
|
201
209
|
if (renderContainer instanceof Box) {
|
|
202
210
|
renderContainer.setBgFn(bgFn);
|
|
211
|
+
renderContainer.setPaddingX(this.outputPad);
|
|
203
212
|
}
|
|
204
213
|
renderContainer.clear();
|
|
205
214
|
const callRenderer = this.getCallRenderer();
|
|
@@ -249,6 +258,7 @@ export class ToolExecutionComponent extends Container {
|
|
|
249
258
|
}
|
|
250
259
|
else {
|
|
251
260
|
this.contentText.setCustomBgFn(bgFn);
|
|
261
|
+
this.contentText.setPaddingX(this.outputPad);
|
|
252
262
|
this.contentText.setText(this.formatToolExecution());
|
|
253
263
|
hasContent = true;
|
|
254
264
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-execution.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/tool-execution.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,GAAG,EAEH,SAAS,EACT,eAAe,EACf,KAAK,EACL,WAAW,EACX,MAAM,EACN,IAAI,GAGJ,MAAM,wBAAwB,CAAC;AAMhC,OAAO,EAAE,sBAAsB,EAAE,aAAa,IAAI,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AACrH,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAOlC,MAAM,OAAO,sBAAuB,SAAQ,SAAS;IAC5C,UAAU,CAAM;IAChB,WAAW,CAAO;IAClB,iBAAiB,CAAc;IAC/B,mBAAmB,CAAY;IAC/B,gBAAgB,GAAG,CAAC,CAAC;IACrB,qBAAqB,CAAa;IAClC,uBAAuB,CAAa;IACpC,aAAa,GAAQ,EAAE,CAAC;IACxB,eAAe,GAAY,EAAE,CAAC;IACtC,sGAAsG;IAC9F,YAAY,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ACF,CAAC;QACF,CAAC;QAED,IAAI,IAAI,CAAC,qBAAqB,EAAE,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtF,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC3B,CAAC;IACF,CAAC;IAEO,aAAa;QACpB,OAAO,qBAAqB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IAC5D,CAAC;IAEO,mBAAmB;QAC1B,IAAI,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC5D,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACnD,IAAI,OAAO,EAAE,CAAC;YACb,IAAI,IAAI,OAAO,OAAO,EAAE,CAAC;QAC1B,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QACpC,IAAI,MAAM,EAAE,CAAC;YACZ,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;QACvB,CAAC;QACD,OAAO,IAAI,CAAC;IACb,CAAC;CACD","sourcesContent":["import {\n\tBox,\n\ttype Component,\n\tContainer,\n\tgetCapabilities,\n\tImage,\n\tMouseRegion,\n\tSpacer,\n\tText,\n\ttype TUI,\n\ttype TuiMouseEvent,\n} from \"@earendil-works/pi-tui\";\nimport type { ToolDefinition, ToolRenderContext, ToolRenderers } from \"../../../core/extensions/types.ts\";\n\n/** What this component needs from a tool: how to draw it, without executing it. */\nexport type { ToolRenderers };\n\nimport { formatToolCallWithArgs, getTextOutput as getRenderedTextOutput } from \"../../../core/tools/render-utils.ts\";\nimport { ensurePngTranscoder } from \"../../../utils/image-convert.ts\";\nimport { theme } from \"../theme/theme.ts\";\nimport { keyHint } from \"./keybinding-hints.ts\";\n\nconst FALLBACK_PREVIEW_LINES = 10;\n\nexport interface ToolExecutionOptions {\n\tshowImages?: boolean;\n\timageWidthCells?: number;\n}\n\nexport class ToolExecutionComponent extends Container {\n\tprivate contentBox: Box;\n\tprivate contentText: Text;\n\tprivate contentTextRegion: MouseRegion;\n\tprivate selfRenderContainer: Container;\n\tprivate selfRenderHeight = 0;\n\tprivate callRendererComponent?: Component;\n\tprivate resultRendererComponent?: Component;\n\tprivate rendererState: any = {};\n\tprivate imageComponents: Image[] = [];\n\t/** Inputs of imageComponents, so updateDisplay can reuse images and keep their converted PNG data. */\n\tprivate imageSources: Array<{ data: string; mimeType: string; widthCells: number }> = [];\n\tprivate imageSpacers: Spacer[] = [];\n\tprivate toolName: string;\n\tprivate toolCallId: string;\n\tprivate args: any;\n\tprivate expanded = false;\n\tprivate showImages: boolean;\n\tprivate imageWidthCells: number;\n\tprivate isPartial = true;\n\tprivate toolDefinition?: ToolRenderers;\n\tprivate ui: TUI;\n\tprivate cwd: string;\n\tprivate executionStarted = false;\n\tprivate argsComplete = false;\n\tprivate result?: {\n\t\tcontent: Array<{ type: string; text?: string; data?: string; mimeType?: string }>;\n\t\tisError: boolean;\n\t\tdetails?: any;\n\t};\n\tprivate hideComponent = false;\n\n\tconstructor(\n\t\ttoolName: string,\n\t\ttoolCallId: string,\n\t\targs: any,\n\t\toptions: ToolExecutionOptions = {},\n\t\ttoolDefinition: ToolRenderers | ToolDefinition<any, any, any> | undefined,\n\t\tui: TUI,\n\t\tcwd: string,\n\t) {\n\t\tsuper();\n\t\tthis.toolName = toolName;\n\t\tthis.toolCallId = toolCallId;\n\t\tthis.args = args;\n\t\tthis.toolDefinition = toolDefinition;\n\t\tthis.showImages = options.showImages ?? true;\n\t\tthis.imageWidthCells = options.imageWidthCells ?? 60;\n\t\tthis.ui = ui;\n\t\tthis.cwd = cwd;\n\n\t\tthis.addChild(new Spacer(1));\n\n\t\t// Always create all shell variants. contentBox is used for default renderer-based composition.\n\t\t// selfRenderContainer is used when the tool renders its own framing.\n\t\t// contentText is reserved for generic fallback rendering when no tool definition exists.\n\t\tthis.contentBox = new Box(1, 1, (text: string) => theme.bg(\"toolPendingBg\", text));\n\t\tthis.contentText = new Text(\"\", 1, 1, (text: string) => theme.bg(\"toolPendingBg\", text));\n\t\tthis.contentTextRegion = this.createResultRegion(this.contentText);\n\t\tthis.selfRenderContainer = new Container();\n\n\t\tif (this.hasRendererDefinition()) {\n\t\t\tthis.addChild(this.getRenderShell() === \"self\" ? this.selfRenderContainer : this.contentBox);\n\t\t} else {\n\t\t\tthis.addChild(this.contentTextRegion);\n\t\t}\n\n\t\tthis.updateDisplay();\n\t}\n\n\tprivate getCallRenderer(): ToolDefinition<any, any>[\"renderCall\"] | undefined {\n\t\treturn this.toolDefinition?.renderCall;\n\t}\n\n\tprivate getResultRenderer(): ToolDefinition<any, any>[\"renderResult\"] | undefined {\n\t\treturn this.toolDefinition?.renderResult;\n\t}\n\n\tprivate hasRendererDefinition(): boolean {\n\t\treturn this.toolDefinition !== undefined;\n\t}\n\n\tprivate getRenderShell(): \"default\" | \"self\" {\n\t\treturn this.toolDefinition?.renderShell ?? \"default\";\n\t}\n\n\tprivate getRenderContext(lastComponent: Component | undefined): ToolRenderContext {\n\t\treturn {\n\t\t\targs: this.args,\n\t\t\ttoolCallId: this.toolCallId,\n\t\t\tinvalidate: () => {\n\t\t\t\tthis.invalidate();\n\t\t\t\tthis.ui.requestRender();\n\t\t\t},\n\t\t\tlastComponent,\n\t\t\tstate: this.rendererState,\n\t\t\tcwd: this.cwd,\n\t\t\texecutionStarted: this.executionStarted,\n\t\t\targsComplete: this.argsComplete,\n\t\t\tisPartial: this.isPartial,\n\t\t\texpanded: this.expanded,\n\t\t\tshowImages: this.showImages,\n\t\t\tisError: this.result?.isError ?? false,\n\t\t};\n\t}\n\n\tprivate createCallFallback(): Component {\n\t\treturn new Text(formatToolCallWithArgs(this.toolName, this.args, theme, this.expanded), 0, 0);\n\t}\n\n\tprivate createResultFallback(): Component | undefined {\n\t\tconst output = this.getTextOutput();\n\t\tif (!output) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst lines = output.split(\"\\n\");\n\t\tconst displayLines = this.expanded ? lines : lines.slice(0, FALLBACK_PREVIEW_LINES);\n\t\tconst remaining = lines.length - displayLines.length;\n\t\tlet text = displayLines.map((line) => theme.fg(\"toolOutput\", line)).join(\"\\n\");\n\t\tif (remaining > 0) {\n\t\t\ttext += `${theme.fg(\"muted\", `\\n... (${remaining} more lines,`)} ${keyHint(\"app.tools.expand\", \"to expand\")}${theme.fg(\"muted\", \")\")}`;\n\t\t}\n\t\treturn new Text(text, 0, 0);\n\t}\n\n\tprivate createResultRegion(component: Component): MouseRegion {\n\t\treturn new MouseRegion(component, (event) => {\n\t\t\tif (!this.result || event.type !== \"click\" || event.button !== \"left\") return undefined;\n\t\t\tthis.setExpanded(!this.expanded);\n\t\t\treturn { handled: true };\n\t\t});\n\t}\n\n\tupdateArgs(args: any): void {\n\t\tthis.args = args;\n\t\tthis.updateDisplay();\n\t}\n\n\tmarkExecutionStarted(): void {\n\t\tthis.executionStarted = true;\n\t\tthis.updateDisplay();\n\t\tthis.ui.requestRender();\n\t}\n\n\tsetArgsComplete(): void {\n\t\tthis.argsComplete = true;\n\t\tthis.updateDisplay();\n\t\tthis.ui.requestRender();\n\t}\n\n\tupdateResult(\n\t\tresult: {\n\t\t\tcontent: Array<{ type: string; text?: string; data?: string; mimeType?: string }>;\n\t\t\tdetails?: any;\n\t\t\tisError: boolean;\n\t\t},\n\t\tisPartial = false,\n\t): void {\n\t\tthis.result = result;\n\t\tthis.isPartial = isPartial;\n\t\tthis.updateDisplay();\n\t}\n\n\tsetExpanded(expanded: boolean): void {\n\t\tthis.expanded = expanded;\n\t\tthis.updateDisplay();\n\t}\n\n\tsetShowImages(show: boolean): void {\n\t\tthis.showImages = show;\n\t\tthis.updateDisplay();\n\t}\n\n\tsetImageWidthCells(width: number): void {\n\t\tthis.imageWidthCells = Math.max(1, Math.floor(width));\n\t\tthis.updateDisplay();\n\t}\n\n\toverride invalidate(): void {\n\t\tsuper.invalidate();\n\t\tthis.updateDisplay();\n\t}\n\n\toverride render(width: number): string[] {\n\t\tif (this.hideComponent) {\n\t\t\treturn [];\n\t\t}\n\n\t\tif (this.hasRendererDefinition() && this.getRenderShell() === \"self\") {\n\t\t\tconst contentLines = this.selfRenderContainer.render(width);\n\t\t\tthis.selfRenderHeight = contentLines.length;\n\t\t\tif (contentLines.length === 0 && this.imageComponents.length === 0) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tconst lines: string[] = [];\n\t\t\tif (contentLines.length > 0) {\n\t\t\t\tlines.push(\"\");\n\t\t\t\tlines.push(...contentLines);\n\t\t\t}\n\t\t\tfor (let i = 0; i < this.imageComponents.length; i++) {\n\t\t\t\tconst spacer = this.imageSpacers[i];\n\t\t\t\tif (spacer) {\n\t\t\t\t\tlines.push(...spacer.render(width));\n\t\t\t\t}\n\t\t\t\tconst imageComponent = this.imageComponents[i];\n\t\t\t\tif (imageComponent) {\n\t\t\t\t\tlines.push(...imageComponent.render(width));\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn lines;\n\t\t}\n\n\t\treturn super.render(width);\n\t}\n\n\toverride handleMouse(event: TuiMouseEvent): ReturnType<Container[\"handleMouse\"]> {\n\t\tif (!this.hasRendererDefinition() || this.getRenderShell() !== \"self\") return super.handleMouse(event);\n\t\tif (event.y <= 0 || event.y > this.selfRenderHeight) return undefined;\n\t\treturn this.selfRenderContainer.handleMouse({\n\t\t\t...event,\n\t\t\ty: event.y - 1,\n\t\t\theight: this.selfRenderHeight,\n\t\t});\n\t}\n\n\tprivate updateDisplay(): void {\n\t\tconst bgFn = this.isPartial\n\t\t\t? (text: string) => theme.bg(\"toolPendingBg\", text)\n\t\t\t: this.result?.isError\n\t\t\t\t? (text: string) => theme.bg(\"toolErrorBg\", text)\n\t\t\t\t: (text: string) => theme.bg(\"toolSuccessBg\", text);\n\n\t\tlet hasContent = false;\n\t\tthis.hideComponent = false;\n\t\tif (this.hasRendererDefinition()) {\n\t\t\tconst renderContainer = this.getRenderShell() === \"self\" ? this.selfRenderContainer : this.contentBox;\n\t\t\tif (renderContainer instanceof Box) {\n\t\t\t\trenderContainer.setBgFn(bgFn);\n\t\t\t}\n\t\t\trenderContainer.clear();\n\n\t\t\tconst callRenderer = this.getCallRenderer();\n\t\t\tif (!callRenderer) {\n\t\t\t\trenderContainer.addChild(this.createResultRegion(this.createCallFallback()));\n\t\t\t\thasContent = true;\n\t\t\t} else {\n\t\t\t\ttry {\n\t\t\t\t\tconst component = callRenderer(this.args, theme, this.getRenderContext(this.callRendererComponent));\n\t\t\t\t\tthis.callRendererComponent = component;\n\t\t\t\t\trenderContainer.addChild(this.createResultRegion(component));\n\t\t\t\t\thasContent = true;\n\t\t\t\t} catch {\n\t\t\t\t\tthis.callRendererComponent = undefined;\n\t\t\t\t\trenderContainer.addChild(this.createResultRegion(this.createCallFallback()));\n\t\t\t\t\thasContent = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.result) {\n\t\t\t\tconst resultRenderer = this.getResultRenderer();\n\t\t\t\tif (!resultRenderer) {\n\t\t\t\t\tconst component = this.createResultFallback();\n\t\t\t\t\tif (component) {\n\t\t\t\t\t\trenderContainer.addChild(this.createResultRegion(component));\n\t\t\t\t\t\thasContent = true;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst component = resultRenderer(\n\t\t\t\t\t\t\t{ content: this.result.content as any, details: this.result.details },\n\t\t\t\t\t\t\t{ expanded: this.expanded, isPartial: this.isPartial },\n\t\t\t\t\t\t\ttheme,\n\t\t\t\t\t\t\tthis.getRenderContext(this.resultRendererComponent),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.resultRendererComponent = component;\n\t\t\t\t\t\trenderContainer.addChild(this.createResultRegion(component));\n\t\t\t\t\t\thasContent = true;\n\t\t\t\t\t} catch {\n\t\t\t\t\t\tthis.resultRendererComponent = undefined;\n\t\t\t\t\t\tconst component = this.createResultFallback();\n\t\t\t\t\t\tif (component) {\n\t\t\t\t\t\t\trenderContainer.addChild(this.createResultRegion(component));\n\t\t\t\t\t\t\thasContent = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tthis.contentText.setCustomBgFn(bgFn);\n\t\t\tthis.contentText.setText(this.formatToolExecution());\n\t\t\thasContent = true;\n\t\t}\n\n\t\tconst previousImages = this.imageComponents;\n\t\tconst previousSources = this.imageSources;\n\t\tfor (const img of this.imageComponents) {\n\t\t\tthis.removeChild(img);\n\t\t}\n\t\tthis.imageComponents = [];\n\t\tthis.imageSources = [];\n\t\tfor (const spacer of this.imageSpacers) {\n\t\t\tthis.removeChild(spacer);\n\t\t}\n\t\tthis.imageSpacers = [];\n\n\t\tif (this.result) {\n\t\t\tconst imageBlocks = this.result.content.filter((c) => c.type === \"image\");\n\t\t\tconst caps = getCapabilities();\n\t\t\tfor (const img of imageBlocks) {\n\t\t\t\tif (caps.images && this.showImages && img.data && img.mimeType) {\n\t\t\t\t\tconst spacer = new Spacer(1);\n\t\t\t\t\tthis.addChild(spacer);\n\t\t\t\t\tthis.imageSpacers.push(spacer);\n\t\t\t\t\tconst source = { data: img.data, mimeType: img.mimeType, widthCells: this.imageWidthCells };\n\t\t\t\t\tconst index = this.imageComponents.length;\n\t\t\t\t\tconst previous = previousSources[index];\n\t\t\t\t\tconst imageComponent =\n\t\t\t\t\t\tprevious?.data === source.data &&\n\t\t\t\t\t\tprevious.mimeType === source.mimeType &&\n\t\t\t\t\t\tprevious.widthCells === source.widthCells\n\t\t\t\t\t\t\t? previousImages[index]\n\t\t\t\t\t\t\t: new Image(\n\t\t\t\t\t\t\t\t\tsource.data,\n\t\t\t\t\t\t\t\t\tsource.mimeType,\n\t\t\t\t\t\t\t\t\t{ fallbackColor: (s: string) => theme.fg(\"toolOutput\", s) },\n\t\t\t\t\t\t\t\t\t{ maxWidthCells: source.widthCells },\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\tif (source.mimeType !== \"image/png\") {\n\t\t\t\t\t\tensurePngTranscoder(() => {\n\t\t\t\t\t\t\tthis.invalidate();\n\t\t\t\t\t\t\tthis.ui.requestRender();\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tthis.imageComponents.push(imageComponent);\n\t\t\t\t\tthis.imageSources.push(source);\n\t\t\t\t\tthis.addChild(imageComponent);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (this.hasRendererDefinition() && !hasContent && this.imageComponents.length === 0) {\n\t\t\tthis.hideComponent = true;\n\t\t}\n\t}\n\n\tprivate getTextOutput(): string {\n\t\treturn getRenderedTextOutput(this.result, this.showImages);\n\t}\n\n\tprivate formatToolExecution(): string {\n\t\tlet text = theme.fg(\"toolTitle\", theme.bold(this.toolName));\n\t\tconst content = JSON.stringify(this.args, null, 2);\n\t\tif (content) {\n\t\t\ttext += `\\n\\n${content}`;\n\t\t}\n\t\tconst output = this.getTextOutput();\n\t\tif (output) {\n\t\t\ttext += `\\n${output}`;\n\t\t}\n\t\treturn text;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tool-execution.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/tool-execution.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,GAAG,EAEH,SAAS,EACT,eAAe,EACf,KAAK,EACL,WAAW,EACX,MAAM,EACN,IAAI,GAGJ,MAAM,wBAAwB,CAAC;AAMhC,OAAO,EAAE,sBAAsB,EAAE,aAAa,IAAI,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AACrH,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,MAAM,sBAAsB,GAAG,EAAE,CA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,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACnD,IAAI,OAAO,EAAE,CAAC;YACb,IAAI,IAAI,OAAO,OAAO,EAAE,CAAC;QAC1B,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QACpC,IAAI,MAAM,EAAE,CAAC;YACZ,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;QACvB,CAAC;QACD,OAAO,IAAI,CAAC;IACb,CAAC;CACD","sourcesContent":["import {\n\tBox,\n\ttype Component,\n\tContainer,\n\tgetCapabilities,\n\tImage,\n\tMouseRegion,\n\tSpacer,\n\tText,\n\ttype TUI,\n\ttype TuiMouseEvent,\n} from \"@earendil-works/pi-tui\";\nimport type { ToolDefinition, ToolRenderContext, ToolRenderers } from \"../../../core/extensions/types.ts\";\n\n/** What this component needs from a tool: how to draw it, without executing it. */\nexport type { ToolRenderers };\n\nimport { formatToolCallWithArgs, getTextOutput as getRenderedTextOutput } from \"../../../core/tools/render-utils.ts\";\nimport { ensurePngTranscoder } from \"../../../utils/image-convert.ts\";\nimport { theme } from \"../theme/theme.ts\";\nimport { keyHint } from \"./keybinding-hints.ts\";\n\nconst FALLBACK_PREVIEW_LINES = 10;\n\nexport interface ToolExecutionOptions {\n\tshowImages?: boolean;\n\timageWidthCells?: number;\n\toutputPad?: number;\n}\n\nexport class ToolExecutionComponent extends Container {\n\tprivate contentBox: Box;\n\tprivate contentText: Text;\n\tprivate contentTextRegion: MouseRegion;\n\tprivate selfRenderContainer: Container;\n\tprivate selfRenderHeight = 0;\n\tprivate callRendererComponent?: Component;\n\tprivate resultRendererComponent?: Component;\n\tprivate rendererState: any = {};\n\tprivate imageComponents: Image[] = [];\n\t/** Inputs of imageComponents, so updateDisplay can reuse images and keep their converted PNG data. */\n\tprivate imageSources: Array<{ data: string; mimeType: string; widthCells: number }> = [];\n\tprivate imageSpacers: Spacer[] = [];\n\tprivate toolName: string;\n\tprivate toolCallId: string;\n\tprivate args: any;\n\tprivate expanded = false;\n\tprivate showImages: boolean;\n\tprivate imageWidthCells: number;\n\tprivate outputPad: number;\n\tprivate isPartial = true;\n\tprivate toolDefinition?: ToolRenderers;\n\tprivate ui: TUI;\n\tprivate cwd: string;\n\tprivate executionStarted = false;\n\tprivate argsComplete = false;\n\tprivate result?: {\n\t\tcontent: Array<{ type: string; text?: string; data?: string; mimeType?: string }>;\n\t\tisError: boolean;\n\t\tdetails?: any;\n\t\tdurationMs?: number;\n\t};\n\tprivate hideComponent = false;\n\n\tconstructor(\n\t\ttoolName: string,\n\t\ttoolCallId: string,\n\t\targs: any,\n\t\toptions: ToolExecutionOptions = {},\n\t\ttoolDefinition: ToolRenderers | ToolDefinition<any, any, any> | undefined,\n\t\tui: TUI,\n\t\tcwd: string,\n\t) {\n\t\tsuper();\n\t\tthis.toolName = toolName;\n\t\tthis.toolCallId = toolCallId;\n\t\tthis.args = args;\n\t\tthis.toolDefinition = toolDefinition;\n\t\tthis.showImages = options.showImages ?? true;\n\t\tthis.imageWidthCells = options.imageWidthCells ?? 60;\n\t\tthis.outputPad = options.outputPad ?? 1;\n\t\tthis.ui = ui;\n\t\tthis.cwd = cwd;\n\n\t\tthis.addChild(new Spacer(1));\n\n\t\t// Always create all shell variants. contentBox is used for default renderer-based composition.\n\t\t// selfRenderContainer is used when the tool renders its own framing.\n\t\t// contentText is reserved for generic fallback rendering when no tool definition exists.\n\t\tthis.contentBox = new Box(1, 1, (text: string) => theme.bg(\"toolPendingBg\", text));\n\t\tthis.contentText = new Text(\"\", 1, 1, (text: string) => theme.bg(\"toolPendingBg\", text));\n\t\tthis.contentTextRegion = this.createResultRegion(this.contentText);\n\t\tthis.selfRenderContainer = new Container();\n\n\t\tif (this.hasRendererDefinition()) {\n\t\t\tthis.addChild(this.getRenderShell() === \"self\" ? this.selfRenderContainer : this.contentBox);\n\t\t} else {\n\t\t\tthis.addChild(this.contentTextRegion);\n\t\t}\n\n\t\tthis.updateDisplay();\n\t}\n\n\tprivate getCallRenderer(): ToolDefinition<any, any>[\"renderCall\"] | undefined {\n\t\treturn this.toolDefinition?.renderCall;\n\t}\n\n\tprivate getResultRenderer(): ToolDefinition<any, any>[\"renderResult\"] | undefined {\n\t\treturn this.toolDefinition?.renderResult;\n\t}\n\n\tprivate hasRendererDefinition(): boolean {\n\t\treturn this.toolDefinition !== undefined;\n\t}\n\n\tprivate getRenderShell(): \"default\" | \"self\" {\n\t\treturn this.toolDefinition?.renderShell ?? \"default\";\n\t}\n\n\tprivate getRenderContext(lastComponent: Component | undefined): ToolRenderContext {\n\t\treturn {\n\t\t\targs: this.args,\n\t\t\ttoolCallId: this.toolCallId,\n\t\t\tinvalidate: () => {\n\t\t\t\tthis.invalidate();\n\t\t\t\tthis.ui.requestRender();\n\t\t\t},\n\t\t\tlastComponent,\n\t\t\tstate: this.rendererState,\n\t\t\tcwd: this.cwd,\n\t\t\texecutionStarted: this.executionStarted,\n\t\t\targsComplete: this.argsComplete,\n\t\t\tisPartial: this.isPartial,\n\t\t\texpanded: this.expanded,\n\t\t\tshowImages: this.showImages,\n\t\t\tisError: this.result?.isError ?? false,\n\t\t\tdurationMs: this.isPartial ? undefined : this.result?.durationMs,\n\t\t\toutputPad: this.outputPad,\n\t\t};\n\t}\n\n\tprivate createCallFallback(): Component {\n\t\treturn new Text(formatToolCallWithArgs(this.toolName, this.args, theme, this.expanded), 0, 0);\n\t}\n\n\tprivate createResultFallback(): Component | undefined {\n\t\tconst output = this.getTextOutput();\n\t\tif (!output) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst lines = output.split(\"\\n\");\n\t\tconst displayLines = this.expanded ? lines : lines.slice(0, FALLBACK_PREVIEW_LINES);\n\t\tconst remaining = lines.length - displayLines.length;\n\t\tlet text = displayLines.map((line) => theme.fg(\"toolOutput\", line)).join(\"\\n\");\n\t\tif (remaining > 0) {\n\t\t\ttext += `${theme.fg(\"muted\", `\\n... (${remaining} more lines,`)} ${keyHint(\"app.tools.expand\", \"to expand\")}${theme.fg(\"muted\", \")\")}`;\n\t\t}\n\t\treturn new Text(text, 0, 0);\n\t}\n\n\tprivate createResultRegion(component: Component): MouseRegion {\n\t\treturn new MouseRegion(component, (event) => {\n\t\t\tif (!this.result || event.type !== \"click\" || event.button !== \"left\") return undefined;\n\t\t\tthis.setExpanded(!this.expanded);\n\t\t\treturn { handled: true };\n\t\t});\n\t}\n\n\tupdateArgs(args: any): void {\n\t\tthis.args = args;\n\t\tthis.updateDisplay();\n\t}\n\n\tmarkExecutionStarted(): void {\n\t\tthis.executionStarted = true;\n\t\tthis.updateDisplay();\n\t\tthis.ui.requestRender();\n\t}\n\n\tsetArgsComplete(): void {\n\t\tthis.argsComplete = true;\n\t\tthis.updateDisplay();\n\t\tthis.ui.requestRender();\n\t}\n\n\tupdateResult(\n\t\tresult: {\n\t\t\tcontent: Array<{ type: string; text?: string; data?: string; mimeType?: string }>;\n\t\t\tdetails?: any;\n\t\t\tisError: boolean;\n\t\t\t/** Execution time of a final result. */\n\t\t\tdurationMs?: number;\n\t\t},\n\t\tisPartial = false,\n\t): void {\n\t\tthis.result = result;\n\t\tthis.isPartial = isPartial;\n\t\tthis.updateDisplay();\n\t}\n\n\tsetExpanded(expanded: boolean): void {\n\t\tthis.expanded = expanded;\n\t\tthis.updateDisplay();\n\t}\n\n\tsetOutputPad(outputPad: number): void {\n\t\tthis.outputPad = outputPad;\n\t\tthis.updateDisplay();\n\t}\n\n\tsetShowImages(show: boolean): void {\n\t\tthis.showImages = show;\n\t\tthis.updateDisplay();\n\t}\n\n\tsetImageWidthCells(width: number): void {\n\t\tthis.imageWidthCells = Math.max(1, Math.floor(width));\n\t\tthis.updateDisplay();\n\t}\n\n\toverride invalidate(): void {\n\t\tsuper.invalidate();\n\t\tthis.updateDisplay();\n\t}\n\n\toverride render(width: number): string[] {\n\t\tif (this.hideComponent) {\n\t\t\treturn [];\n\t\t}\n\n\t\tif (this.hasRendererDefinition() && this.getRenderShell() === \"self\") {\n\t\t\tconst contentLines = this.selfRenderContainer.render(width);\n\t\t\tthis.selfRenderHeight = contentLines.length;\n\t\t\tif (contentLines.length === 0 && this.imageComponents.length === 0) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tconst lines: string[] = [];\n\t\t\tif (contentLines.length > 0) {\n\t\t\t\tlines.push(\"\");\n\t\t\t\tlines.push(...contentLines);\n\t\t\t}\n\t\t\tfor (let i = 0; i < this.imageComponents.length; i++) {\n\t\t\t\tconst spacer = this.imageSpacers[i];\n\t\t\t\tif (spacer) {\n\t\t\t\t\tlines.push(...spacer.render(width));\n\t\t\t\t}\n\t\t\t\tconst imageComponent = this.imageComponents[i];\n\t\t\t\tif (imageComponent) {\n\t\t\t\t\tlines.push(...imageComponent.render(width));\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn lines;\n\t\t}\n\n\t\treturn super.render(width);\n\t}\n\n\toverride handleMouse(event: TuiMouseEvent): ReturnType<Container[\"handleMouse\"]> {\n\t\tif (!this.hasRendererDefinition() || this.getRenderShell() !== \"self\") return super.handleMouse(event);\n\t\tif (event.y <= 0 || event.y > this.selfRenderHeight) return undefined;\n\t\treturn this.selfRenderContainer.handleMouse({\n\t\t\t...event,\n\t\t\ty: event.y - 1,\n\t\t\theight: this.selfRenderHeight,\n\t\t});\n\t}\n\n\tprivate updateDisplay(): void {\n\t\tconst bgFn = this.isPartial\n\t\t\t? (text: string) => theme.bg(\"toolPendingBg\", text)\n\t\t\t: this.result?.isError\n\t\t\t\t? (text: string) => theme.bg(\"toolErrorBg\", text)\n\t\t\t\t: (text: string) => theme.bg(\"toolSuccessBg\", text);\n\n\t\tlet hasContent = false;\n\t\tthis.hideComponent = false;\n\t\tif (this.hasRendererDefinition()) {\n\t\t\tconst renderContainer = this.getRenderShell() === \"self\" ? this.selfRenderContainer : this.contentBox;\n\t\t\tif (renderContainer instanceof Box) {\n\t\t\t\trenderContainer.setBgFn(bgFn);\n\t\t\t\trenderContainer.setPaddingX(this.outputPad);\n\t\t\t}\n\t\t\trenderContainer.clear();\n\n\t\t\tconst callRenderer = this.getCallRenderer();\n\t\t\tif (!callRenderer) {\n\t\t\t\trenderContainer.addChild(this.createResultRegion(this.createCallFallback()));\n\t\t\t\thasContent = true;\n\t\t\t} else {\n\t\t\t\ttry {\n\t\t\t\t\tconst component = callRenderer(this.args, theme, this.getRenderContext(this.callRendererComponent));\n\t\t\t\t\tthis.callRendererComponent = component;\n\t\t\t\t\trenderContainer.addChild(this.createResultRegion(component));\n\t\t\t\t\thasContent = true;\n\t\t\t\t} catch {\n\t\t\t\t\tthis.callRendererComponent = undefined;\n\t\t\t\t\trenderContainer.addChild(this.createResultRegion(this.createCallFallback()));\n\t\t\t\t\thasContent = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.result) {\n\t\t\t\tconst resultRenderer = this.getResultRenderer();\n\t\t\t\tif (!resultRenderer) {\n\t\t\t\t\tconst component = this.createResultFallback();\n\t\t\t\t\tif (component) {\n\t\t\t\t\t\trenderContainer.addChild(this.createResultRegion(component));\n\t\t\t\t\t\thasContent = true;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst component = resultRenderer(\n\t\t\t\t\t\t\t{ content: this.result.content as any, details: this.result.details },\n\t\t\t\t\t\t\t{ expanded: this.expanded, isPartial: this.isPartial },\n\t\t\t\t\t\t\ttheme,\n\t\t\t\t\t\t\tthis.getRenderContext(this.resultRendererComponent),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.resultRendererComponent = component;\n\t\t\t\t\t\trenderContainer.addChild(this.createResultRegion(component));\n\t\t\t\t\t\thasContent = true;\n\t\t\t\t\t} catch {\n\t\t\t\t\t\tthis.resultRendererComponent = undefined;\n\t\t\t\t\t\tconst component = this.createResultFallback();\n\t\t\t\t\t\tif (component) {\n\t\t\t\t\t\t\trenderContainer.addChild(this.createResultRegion(component));\n\t\t\t\t\t\t\thasContent = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tthis.contentText.setCustomBgFn(bgFn);\n\t\t\tthis.contentText.setPaddingX(this.outputPad);\n\t\t\tthis.contentText.setText(this.formatToolExecution());\n\t\t\thasContent = true;\n\t\t}\n\n\t\tconst previousImages = this.imageComponents;\n\t\tconst previousSources = this.imageSources;\n\t\tfor (const img of this.imageComponents) {\n\t\t\tthis.removeChild(img);\n\t\t}\n\t\tthis.imageComponents = [];\n\t\tthis.imageSources = [];\n\t\tfor (const spacer of this.imageSpacers) {\n\t\t\tthis.removeChild(spacer);\n\t\t}\n\t\tthis.imageSpacers = [];\n\n\t\tif (this.result) {\n\t\t\tconst imageBlocks = this.result.content.filter((c) => c.type === \"image\");\n\t\t\tconst caps = getCapabilities();\n\t\t\tfor (const img of imageBlocks) {\n\t\t\t\tif (caps.images && this.showImages && img.data && img.mimeType) {\n\t\t\t\t\tconst spacer = new Spacer(1);\n\t\t\t\t\tthis.addChild(spacer);\n\t\t\t\t\tthis.imageSpacers.push(spacer);\n\t\t\t\t\tconst source = { data: img.data, mimeType: img.mimeType, widthCells: this.imageWidthCells };\n\t\t\t\t\tconst index = this.imageComponents.length;\n\t\t\t\t\tconst previous = previousSources[index];\n\t\t\t\t\tconst imageComponent =\n\t\t\t\t\t\tprevious?.data === source.data &&\n\t\t\t\t\t\tprevious.mimeType === source.mimeType &&\n\t\t\t\t\t\tprevious.widthCells === source.widthCells\n\t\t\t\t\t\t\t? previousImages[index]\n\t\t\t\t\t\t\t: new Image(\n\t\t\t\t\t\t\t\t\tsource.data,\n\t\t\t\t\t\t\t\t\tsource.mimeType,\n\t\t\t\t\t\t\t\t\t{ fallbackColor: (s: string) => theme.fg(\"toolOutput\", s) },\n\t\t\t\t\t\t\t\t\t{ maxWidthCells: source.widthCells },\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\tif (source.mimeType !== \"image/png\") {\n\t\t\t\t\t\tensurePngTranscoder(() => {\n\t\t\t\t\t\t\tthis.invalidate();\n\t\t\t\t\t\t\tthis.ui.requestRender();\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tthis.imageComponents.push(imageComponent);\n\t\t\t\t\tthis.imageSources.push(source);\n\t\t\t\t\tthis.addChild(imageComponent);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (this.hasRendererDefinition() && !hasContent && this.imageComponents.length === 0) {\n\t\t\tthis.hideComponent = true;\n\t\t}\n\t}\n\n\tprivate getTextOutput(): string {\n\t\treturn getRenderedTextOutput(this.result, this.showImages);\n\t}\n\n\tprivate formatToolExecution(): string {\n\t\tlet text = theme.fg(\"toolTitle\", theme.bold(this.toolName));\n\t\tconst content = JSON.stringify(this.args, null, 2);\n\t\tif (content) {\n\t\t\ttext += `\\n\\n${content}`;\n\t\t}\n\t\tconst output = this.getTextOutput();\n\t\tif (output) {\n\t\t\ttext += `\\n${output}`;\n\t\t}\n\t\treturn text;\n\t}\n}\n"]}
|
|
@@ -104,6 +104,8 @@ export declare class InteractiveMode {
|
|
|
104
104
|
private retryEscapeHandler?;
|
|
105
105
|
private compactionQueuedMessages;
|
|
106
106
|
private shutdownRequested;
|
|
107
|
+
/** Reports working, blocked, done, and error states to terminals that support OSC 7501. */
|
|
108
|
+
private readonly programStatus;
|
|
107
109
|
/** The `/bug` hint is shown at most once per session so error output stays readable. */
|
|
108
110
|
private bugReportHintShown;
|
|
109
111
|
private installChangeWarningShown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-mode.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-mode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAEN,KAAK,YAAY,EAKjB,MAAM,8BAA8B,CAAC;AActC,OAAO,EAYN,KAAK,QAAQ,EASb,MAAM,wBAAwB,CAAC;AAehC,OAAO,EAAE,KAAK,mBAAmB,EAAkC,MAAM,qCAAqC,CAAC;AAC/G,O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gB;IAqJxB,OAAO,CAAC,mBAAmB;YA2Cb,mBAAmB;IAqCjC,OAAO,CAAC,uBAAuB;YAmCjB,wBAAwB;IAetC,OAAO,CAAC,wBAAwB;YAalB,kBAAkB;IAuBhC,yFAAyF;YAC3E,kBAAkB;IAUhC,OAAO,CAAC,yBAAyB;IA4EjC,OAAO,CAAC,yBAAyB;YA6CnB,iBAAiB;YA4DjB,8BAA8B;IAgG5C,OAAO,CAAC,qBAAqB;YA8Bf,qBAAqB;IAmDnC,OAAO,CAAC,cAAc;YAmCR,cAAc;IAwB5B,OAAO,CAAC,gBAAgB;YAaV,aAAa;YAuBb,eAAe;IAmC7B;;;OAGG;IACH,OAAO,CAAC,oBAAoB;YAqDd,mBAAmB;YA0FnB,mBAAmB;IAkBjC,OAAO,CAAC,sBAAsB;YA6BhB,mBAAmB;YA4CnB,kBAAkB;YAWlB,gBAAgB;YAehB,iBAAiB;IA+B/B,OAAO,CAAC,iBAAiB;IAyBzB,OAAO,CAAC,oBAAoB;IAiF5B,OAAO,CAAC,sBAAsB;IAqB9B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAIxB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,oBAAoB;YAqHd,kBAAkB;IAehC,OAAO,CAAC,kBAAkB;IAiC1B,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,oBAAoB;YAMd,iBAAiB;YA6FjB,oBAAoB;IAUlC,IAAI,CAAC,oBAAoB,uBAAiD,GAAG,IAAI,CAkBhF;CACD"}
|
|
@@ -84,6 +84,7 @@ import { UserMessageSelectorComponent } from "./components/user-message-selector
|
|
|
84
84
|
import { editInExternalEditor } from "./external-editor.js";
|
|
85
85
|
import { refreshModelCatalogs } from "./model-catalog-refresh.js";
|
|
86
86
|
import { getModelSearchText } from "./model-search.js";
|
|
87
|
+
import { ProgramStatusReporter } from "./program-status-reporter.js";
|
|
87
88
|
import { shareSession } from "./session-share.js";
|
|
88
89
|
import { getAvailableThemes, getAvailableThemesWithPaths, getEditorTheme, getMarkdownTheme, getThemeByName, onThemeChange, SYSTEM_THEME_NAME, setRegisteredThemes, stopThemeWatcher, Theme, theme, } from "./theme/theme.js";
|
|
89
90
|
import { InteractiveThemeController } from "./theme/theme-controller.js";
|
|
@@ -314,6 +315,8 @@ export class InteractiveMode {
|
|
|
314
315
|
compactionQueuedMessages = [];
|
|
315
316
|
// Shutdown state
|
|
316
317
|
shutdownRequested = false;
|
|
318
|
+
/** Reports working, blocked, done, and error states to terminals that support OSC 7501. */
|
|
319
|
+
programStatus = new ProgramStatusReporter(() => this.ui.terminal, () => this.sessionManager.getSessionName());
|
|
317
320
|
/** The `/bug` hint is shown at most once per session so error output stays readable. */
|
|
318
321
|
bugReportHintShown = false;
|
|
319
322
|
installChangeWarningShown = false;
|
|
@@ -702,6 +705,7 @@ export class InteractiveMode {
|
|
|
702
705
|
// Start the UI before initializing extensions so session_start handlers can use interactive dialogs
|
|
703
706
|
this.ui.start();
|
|
704
707
|
this.isInitialized = true;
|
|
708
|
+
this.programStatus.report();
|
|
705
709
|
this.ensurePngTranscoder();
|
|
706
710
|
this.themeController.applyFromSettings();
|
|
707
711
|
// The header and startup notices bake theme colors into their text, so build them once the terminal
|
|
@@ -1585,6 +1589,7 @@ export class InteractiveMode {
|
|
|
1585
1589
|
const session = this.session;
|
|
1586
1590
|
this.unsubscribe?.();
|
|
1587
1591
|
this.unsubscribe = undefined;
|
|
1592
|
+
this.programStatus.reset();
|
|
1588
1593
|
this.applyRuntimeSettings();
|
|
1589
1594
|
if (options.renderBeforeBind) {
|
|
1590
1595
|
this.renderCurrentSessionState();
|
|
@@ -2101,7 +2106,7 @@ export class InteractiveMode {
|
|
|
2101
2106
|
/**
|
|
2102
2107
|
* Show a selector for extensions.
|
|
2103
2108
|
*/
|
|
2104
|
-
showExtensionSelector(title, options, opts) {
|
|
2109
|
+
showExtensionSelector(title, options, opts, blocked = { kind: "question", message: title }) {
|
|
2105
2110
|
return new Promise((resolve) => {
|
|
2106
2111
|
if (opts?.signal?.aborted) {
|
|
2107
2112
|
resolve(undefined);
|
|
@@ -2125,6 +2130,8 @@ export class InteractiveMode {
|
|
|
2125
2130
|
this.editorContainer.clear();
|
|
2126
2131
|
this.editorContainer.addChild(this.extensionSelector);
|
|
2127
2132
|
this.ui.setFocus(this.extensionSelector);
|
|
2133
|
+
// Extension dialogs share the editor slot: opening one replaces the status of a displaced one.
|
|
2134
|
+
this.programStatus.setBlocked("extension-dialog", blocked);
|
|
2128
2135
|
this.ui.requestRender();
|
|
2129
2136
|
});
|
|
2130
2137
|
}
|
|
@@ -2136,6 +2143,7 @@ export class InteractiveMode {
|
|
|
2136
2143
|
this.editorContainer.clear();
|
|
2137
2144
|
this.editorContainer.addChild(this.editor);
|
|
2138
2145
|
this.extensionSelector = undefined;
|
|
2146
|
+
this.programStatus.setBlocked("extension-dialog", undefined);
|
|
2139
2147
|
this.ui.setFocus(this.editor);
|
|
2140
2148
|
this.ui.requestRender();
|
|
2141
2149
|
}
|
|
@@ -2143,7 +2151,10 @@ export class InteractiveMode {
|
|
|
2143
2151
|
* Show a confirmation dialog for extensions.
|
|
2144
2152
|
*/
|
|
2145
2153
|
async showExtensionConfirm(title, message, opts) {
|
|
2146
|
-
const result = await this.showExtensionSelector(`${title}\n${message}`, ["Yes", "No"], opts
|
|
2154
|
+
const result = await this.showExtensionSelector(`${title}\n${message}`, ["Yes", "No"], opts, {
|
|
2155
|
+
kind: "permission",
|
|
2156
|
+
message: title,
|
|
2157
|
+
});
|
|
2147
2158
|
return result === "Yes";
|
|
2148
2159
|
}
|
|
2149
2160
|
async promptForMissingSessionCwd(error) {
|
|
@@ -2177,6 +2188,7 @@ export class InteractiveMode {
|
|
|
2177
2188
|
this.editorContainer.clear();
|
|
2178
2189
|
this.editorContainer.addChild(this.extensionInput);
|
|
2179
2190
|
this.ui.setFocus(this.extensionInput);
|
|
2191
|
+
this.programStatus.setBlocked("extension-dialog", { kind: "question", message: title });
|
|
2180
2192
|
this.ui.requestRender();
|
|
2181
2193
|
});
|
|
2182
2194
|
}
|
|
@@ -2188,6 +2200,7 @@ export class InteractiveMode {
|
|
|
2188
2200
|
this.editorContainer.clear();
|
|
2189
2201
|
this.editorContainer.addChild(this.editor);
|
|
2190
2202
|
this.extensionInput = undefined;
|
|
2203
|
+
this.programStatus.setBlocked("extension-dialog", undefined);
|
|
2191
2204
|
this.ui.setFocus(this.editor);
|
|
2192
2205
|
this.ui.requestRender();
|
|
2193
2206
|
}
|
|
@@ -2207,6 +2220,7 @@ export class InteractiveMode {
|
|
|
2207
2220
|
this.editorContainer.clear();
|
|
2208
2221
|
this.editorContainer.addChild(this.extensionEditor);
|
|
2209
2222
|
this.ui.setFocus(this.extensionEditor);
|
|
2223
|
+
this.programStatus.setBlocked("extension-dialog", { kind: "question", message: title });
|
|
2210
2224
|
this.ui.requestRender();
|
|
2211
2225
|
});
|
|
2212
2226
|
}
|
|
@@ -2217,6 +2231,7 @@ export class InteractiveMode {
|
|
|
2217
2231
|
this.editorContainer.clear();
|
|
2218
2232
|
this.editorContainer.addChild(this.editor);
|
|
2219
2233
|
this.extensionEditor = undefined;
|
|
2234
|
+
this.programStatus.setBlocked("extension-dialog", undefined);
|
|
2220
2235
|
this.ui.setFocus(this.editor);
|
|
2221
2236
|
this.ui.requestRender();
|
|
2222
2237
|
}
|
|
@@ -2729,6 +2744,7 @@ export class InteractiveMode {
|
|
|
2729
2744
|
await this.init();
|
|
2730
2745
|
}
|
|
2731
2746
|
this.footer.invalidate();
|
|
2747
|
+
this.programStatus.handleEvent(event);
|
|
2732
2748
|
switch (event.type) {
|
|
2733
2749
|
case "agent_start":
|
|
2734
2750
|
this.pendingTools.clear();
|
|
@@ -2834,6 +2850,7 @@ export class InteractiveMode {
|
|
|
2834
2850
|
const component = new ToolExecutionComponent(content.name, content.id, content.arguments, {
|
|
2835
2851
|
showImages: this.settingsManager.getShowImages(),
|
|
2836
2852
|
imageWidthCells: this.settingsManager.getImageWidthCells(),
|
|
2853
|
+
outputPad: this.outputPad,
|
|
2837
2854
|
}, this.getRegisteredToolDefinition(content.name), this.ui, this.sessionManager.getCwd());
|
|
2838
2855
|
component.setExpanded(this.toolOutputExpanded);
|
|
2839
2856
|
this.chatContainer.addChild(component);
|
|
@@ -2904,6 +2921,7 @@ export class InteractiveMode {
|
|
|
2904
2921
|
component = new ToolExecutionComponent(event.toolName, event.toolCallId, event.args, {
|
|
2905
2922
|
showImages: this.settingsManager.getShowImages(),
|
|
2906
2923
|
imageWidthCells: this.settingsManager.getImageWidthCells(),
|
|
2924
|
+
outputPad: this.outputPad,
|
|
2907
2925
|
}, this.getRegisteredToolDefinition(event.toolName), this.ui, this.sessionManager.getCwd());
|
|
2908
2926
|
component.setExpanded(this.toolOutputExpanded);
|
|
2909
2927
|
this.chatContainer.addChild(component);
|
|
@@ -2926,7 +2944,7 @@ export class InteractiveMode {
|
|
|
2926
2944
|
this.maybeShowInstallChangeWarning();
|
|
2927
2945
|
const component = this.pendingTools.get(event.toolCallId);
|
|
2928
2946
|
if (component) {
|
|
2929
|
-
component.updateResult({ ...event.result, isError: event.isError });
|
|
2947
|
+
component.updateResult({ ...event.result, isError: event.isError, durationMs: event.durationMs });
|
|
2930
2948
|
this.pendingTools.delete(event.toolCallId);
|
|
2931
2949
|
this.ui.requestRender();
|
|
2932
2950
|
}
|
|
@@ -3110,7 +3128,7 @@ export class InteractiveMode {
|
|
|
3110
3128
|
if (!renderer) {
|
|
3111
3129
|
return;
|
|
3112
3130
|
}
|
|
3113
|
-
const component = new CustomEntryComponent(entry, renderer);
|
|
3131
|
+
const component = new CustomEntryComponent(entry, renderer, this.outputPad);
|
|
3114
3132
|
component.setExpanded(this.toolOutputExpanded);
|
|
3115
3133
|
if (!component.hasContent()) {
|
|
3116
3134
|
return;
|
|
@@ -3127,7 +3145,7 @@ export class InteractiveMode {
|
|
|
3127
3145
|
addMessageToChat(message, options) {
|
|
3128
3146
|
switch (message.role) {
|
|
3129
3147
|
case "bashExecution": {
|
|
3130
|
-
const component = new BashExecutionComponent(message.command, this.ui, message.excludeFromContext);
|
|
3148
|
+
const component = new BashExecutionComponent(message.command, this.ui, message.excludeFromContext, this.outputPad);
|
|
3131
3149
|
if (message.output) {
|
|
3132
3150
|
component.appendOutput(message.output);
|
|
3133
3151
|
}
|
|
@@ -3146,14 +3164,14 @@ export class InteractiveMode {
|
|
|
3146
3164
|
}
|
|
3147
3165
|
case "compactionSummary": {
|
|
3148
3166
|
this.chatContainer.addChild(new Spacer(1));
|
|
3149
|
-
const component = new CompactionSummaryMessageComponent(message, this.getMarkdownThemeWithSettings());
|
|
3167
|
+
const component = new CompactionSummaryMessageComponent(message, this.getMarkdownThemeWithSettings(), this.outputPad);
|
|
3150
3168
|
component.setExpanded(this.toolOutputExpanded);
|
|
3151
3169
|
this.chatContainer.addChild(component);
|
|
3152
3170
|
break;
|
|
3153
3171
|
}
|
|
3154
3172
|
case "branchSummary": {
|
|
3155
3173
|
this.chatContainer.addChild(new Spacer(1));
|
|
3156
|
-
const component = new BranchSummaryMessageComponent(message, this.getMarkdownThemeWithSettings());
|
|
3174
|
+
const component = new BranchSummaryMessageComponent(message, this.getMarkdownThemeWithSettings(), this.outputPad);
|
|
3157
3175
|
component.setExpanded(this.toolOutputExpanded);
|
|
3158
3176
|
this.chatContainer.addChild(component);
|
|
3159
3177
|
break;
|
|
@@ -3169,7 +3187,7 @@ export class InteractiveMode {
|
|
|
3169
3187
|
const skillBlock = parseSkillBlock(textContent);
|
|
3170
3188
|
if (skillBlock) {
|
|
3171
3189
|
// Render skill block (collapsible)
|
|
3172
|
-
const component = new SkillInvocationMessageComponent(skillBlock, this.getMarkdownThemeWithSettings());
|
|
3190
|
+
const component = new SkillInvocationMessageComponent(skillBlock, this.getMarkdownThemeWithSettings(), this.outputPad);
|
|
3173
3191
|
component.setExpanded(this.toolOutputExpanded);
|
|
3174
3192
|
this.chatContainer.addChild(component);
|
|
3175
3193
|
// Render user message separately if present
|
|
@@ -3238,6 +3256,7 @@ export class InteractiveMode {
|
|
|
3238
3256
|
const component = new ToolExecutionComponent(content.name, content.id, content.arguments, {
|
|
3239
3257
|
showImages: this.settingsManager.getShowImages(),
|
|
3240
3258
|
imageWidthCells: this.settingsManager.getImageWidthCells(),
|
|
3259
|
+
outputPad: this.outputPad,
|
|
3241
3260
|
}, this.getRegisteredToolDefinition(content.name), this.ui, this.sessionManager.getCwd());
|
|
3242
3261
|
component.setExpanded(this.toolOutputExpanded);
|
|
3243
3262
|
this.chatContainer.addChild(component);
|
|
@@ -3291,6 +3310,9 @@ export class InteractiveMode {
|
|
|
3291
3310
|
* @param options.populateHistory Add user messages to editor history
|
|
3292
3311
|
*/
|
|
3293
3312
|
renderSessionEntries(entries, options = {}) {
|
|
3313
|
+
// Selection coordinates point into the transcript being replaced (#9311).
|
|
3314
|
+
if (this.renderer instanceof TuiAltScreen)
|
|
3315
|
+
this.renderer.resetTextSelection();
|
|
3294
3316
|
const items = entries.flatMap((entry) => {
|
|
3295
3317
|
if (entry.type === "custom" || (entry.type === "usage" && entry.kind === "cache_warm")) {
|
|
3296
3318
|
return [entry];
|
|
@@ -4180,21 +4202,14 @@ export class InteractiveMode {
|
|
|
4180
4202
|
onOutputPadChange: (padding) => {
|
|
4181
4203
|
this.settingsManager.setOutputPad(padding);
|
|
4182
4204
|
this.outputPad = padding;
|
|
4183
|
-
|
|
4184
|
-
for (const child of
|
|
4185
|
-
if (child
|
|
4186
|
-
child instanceof CustomMessageComponent ||
|
|
4187
|
-
child instanceof UserMessageComponent) {
|
|
4205
|
+
for (const container of [this.chatContainer, this.pendingMessagesContainer]) {
|
|
4206
|
+
for (const child of container.children) {
|
|
4207
|
+
if ("setOutputPad" in child && typeof child.setOutputPad === "function") {
|
|
4188
4208
|
child.setOutputPad(padding);
|
|
4189
4209
|
}
|
|
4190
4210
|
}
|
|
4191
|
-
if (this.streamingComponent) {
|
|
4192
|
-
this.streamingComponent.setOutputPad(padding);
|
|
4193
|
-
}
|
|
4194
|
-
this.ui.requestRender();
|
|
4195
|
-
return;
|
|
4196
4211
|
}
|
|
4197
|
-
this.
|
|
4212
|
+
this.ui.requestRender();
|
|
4198
4213
|
},
|
|
4199
4214
|
onAutocompleteMaxVisibleChange: (maxVisible) => {
|
|
4200
4215
|
this.settingsManager.setAutocompleteMaxVisible(maxVisible);
|
|
@@ -5157,7 +5172,7 @@ export class InteractiveMode {
|
|
|
5157
5172
|
this.ui.requestRender();
|
|
5158
5173
|
};
|
|
5159
5174
|
try {
|
|
5160
|
-
await this.loginProvider(dialog, providerId, "api_key");
|
|
5175
|
+
await this.loginProvider(dialog, providerId, providerName, "api_key");
|
|
5161
5176
|
restoreEditor();
|
|
5162
5177
|
await this.completeProviderAuthentication(providerId, providerName, "api_key", previousModel);
|
|
5163
5178
|
}
|
|
@@ -5245,12 +5260,18 @@ export class InteractiveMode {
|
|
|
5245
5260
|
dialog.showProgress(event.message);
|
|
5246
5261
|
}
|
|
5247
5262
|
}
|
|
5248
|
-
async loginProvider(dialog, providerId, method) {
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5263
|
+
async loginProvider(dialog, providerId, providerName, method) {
|
|
5264
|
+
this.programStatus.setBlocked("login", { kind: "auth", message: `Log in to ${providerName}` });
|
|
5265
|
+
try {
|
|
5266
|
+
await this.session.modelRuntime.login(providerId, method, {
|
|
5267
|
+
signal: dialog.signal,
|
|
5268
|
+
prompt: (prompt) => this.showAuthPrompt(dialog, prompt, providerId),
|
|
5269
|
+
notify: (event) => this.notifyAuthDialog(dialog, event),
|
|
5270
|
+
}, { getDeviceId: () => this.settingsManager.getOrCreateDeviceId() });
|
|
5271
|
+
}
|
|
5272
|
+
finally {
|
|
5273
|
+
this.programStatus.setBlocked("login", undefined);
|
|
5274
|
+
}
|
|
5254
5275
|
}
|
|
5255
5276
|
async showLoginDialog(providerId, providerName, onBack) {
|
|
5256
5277
|
const previousModel = this.session.model;
|
|
@@ -5266,7 +5287,7 @@ export class InteractiveMode {
|
|
|
5266
5287
|
this.ui.requestRender();
|
|
5267
5288
|
};
|
|
5268
5289
|
try {
|
|
5269
|
-
await this.loginProvider(dialog, providerId, "oauth");
|
|
5290
|
+
await this.loginProvider(dialog, providerId, providerName, "oauth");
|
|
5270
5291
|
restoreEditor();
|
|
5271
5292
|
await this.completeProviderAuthentication(providerId, providerName, "oauth", previousModel);
|
|
5272
5293
|
if (providerId === RADIUS_PROVIDER_ID)
|
|
@@ -5853,7 +5874,7 @@ export class InteractiveMode {
|
|
|
5853
5874
|
if (eventResult?.result) {
|
|
5854
5875
|
const result = eventResult.result;
|
|
5855
5876
|
// Create UI component for display
|
|
5856
|
-
this.bashComponent = new BashExecutionComponent(command, this.ui, excludeFromContext);
|
|
5877
|
+
this.bashComponent = new BashExecutionComponent(command, this.ui, excludeFromContext, this.outputPad);
|
|
5857
5878
|
if (this.session.isStreaming) {
|
|
5858
5879
|
this.pendingMessagesContainer.addChild(this.bashComponent);
|
|
5859
5880
|
this.pendingBashComponents.push(this.bashComponent);
|
|
@@ -5874,7 +5895,7 @@ export class InteractiveMode {
|
|
|
5874
5895
|
}
|
|
5875
5896
|
// Normal execution path (possibly with custom operations)
|
|
5876
5897
|
const isDeferred = this.session.isStreaming;
|
|
5877
|
-
this.bashComponent = new BashExecutionComponent(command, this.ui, excludeFromContext);
|
|
5898
|
+
this.bashComponent = new BashExecutionComponent(command, this.ui, excludeFromContext, this.outputPad);
|
|
5878
5899
|
if (isDeferred) {
|
|
5879
5900
|
// Show in pending area when agent is streaming
|
|
5880
5901
|
this.pendingMessagesContainer.addChild(this.bashComponent);
|