@ai-agent-forge/agent-forge 0.88.1 → 0.88.3
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 +71 -0
- package/README.md +1 -1
- package/bundled-plugins/agent-loop-policy/agent-forge.json +1 -1
- package/bundled-plugins/agent-loop-policy/plugin.json +1 -1
- package/bundled-plugins/coding-tools/agent-forge.json +1 -1
- package/bundled-plugins/coding-tools/plugin.json +1 -1
- package/bundled-plugins/compaction-policy/agent-forge.json +1 -1
- package/bundled-plugins/compaction-policy/plugin.json +1 -1
- package/bundled-plugins/overflow-policy/agent-forge.json +1 -1
- package/bundled-plugins/overflow-policy/plugin.json +1 -1
- package/bundled-plugins/provider-failover/agent-forge.json +1 -1
- package/bundled-plugins/provider-failover/plugin.json +1 -1
- package/bundled-plugins/retry-policy/agent-forge.json +1 -1
- package/bundled-plugins/retry-policy/plugin.json +1 -1
- package/dist/artifacts/paged-read.d.ts +6 -1
- package/dist/artifacts/paged-read.d.ts.map +1 -1
- package/dist/artifacts/paged-read.js.map +1 -1
- package/dist/bundle/.build-manifest.json +283 -263
- package/dist/bundle/chunks/{anthropic-messages-PLAKXR73.js → anthropic-messages-3FJHRAJL.js} +2 -2
- package/dist/bundle/chunks/anthropic.js +1 -1
- package/dist/bundle/chunks/{azure-openai-responses-OUWQ2AZD.js → azure-openai-responses-GCL47IDS.js} +1 -1
- package/dist/bundle/chunks/bedrock-converse-stream.js +1 -1
- package/dist/bundle/chunks/{chunk-Z72JWUZ4.js → chunk-32YDZI4J.js} +1 -1
- package/dist/bundle/chunks/{chunk-AQLNTW2B.js → chunk-755VNWIF.js} +17 -16
- package/dist/bundle/chunks/{chunk-LZOEQITZ.js → chunk-B42Y2VME.js} +120 -104
- package/dist/bundle/chunks/{chunk-DRQDKNXA.js → chunk-BVVSHK6W.js} +1 -1
- package/dist/bundle/chunks/{chunk-6R7UI4IY.js → chunk-QDLOMKF6.js} +1 -1
- package/dist/bundle/chunks/{chunk-D3ARGZFR.js → chunk-V3ACW7VD.js} +3 -3
- package/dist/bundle/chunks/{google-generative-ai-DLII6DAT.js → google-generative-ai-6BMXWA44.js} +1 -1
- package/dist/bundle/chunks/{google-vertex-G7BZL7GM.js → google-vertex-6H7NLRTK.js} +1 -1
- package/dist/bundle/chunks/image-resize-worker.js +3 -3
- package/dist/bundle/chunks/{mistral-conversations-JXUK24ID.js → mistral-conversations-IXUHSFSJ.js} +1 -1
- package/dist/bundle/chunks/{openai-codex-responses-5GSGFIPG.js → openai-codex-responses-YHUAEVCM.js} +1 -1
- package/dist/bundle/chunks/openai-codex.js +1 -1
- package/dist/bundle/chunks/{openai-completions-EI2I6DTG.js → openai-completions-ULQCFC72.js} +1 -1
- package/dist/bundle/chunks/openai-responses-NLLAJDPS.js +2 -0
- package/dist/bundle/chunks/{openrouter-images-G4GQRUSG.js → openrouter-images-GZZQZXMS.js} +1 -1
- package/dist/bundle/chunks/openrouter.js +1 -1
- package/dist/bundle/chunks/{pi-messages-PWU2VJMR.js → pi-messages-EJTI2EJ3.js} +1 -1
- package/dist/bundle/chunks/virtual-modules-TQWEGNNZ.js +5 -0
- package/dist/bundle/cli.js +1 -1
- package/dist/bundle/client.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/cli/args.d.ts +0 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +1 -4
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js +1 -1
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/experimental/cli.d.ts +3 -3
- package/dist/cli/experimental/cli.d.ts.map +1 -1
- package/dist/cli/experimental/cli.js +2 -2
- package/dist/cli/experimental/cli.js.map +1 -1
- package/dist/cli/experimental/commands/agent-forge.d.ts +15 -0
- package/dist/cli/experimental/commands/agent-forge.d.ts.map +1 -0
- package/dist/cli/experimental/commands/{pi.js → agent-forge.js} +4 -4
- package/dist/cli/experimental/commands/agent-forge.js.map +1 -0
- package/dist/cli/plugin-command.d.ts.map +1 -1
- package/dist/cli/plugin-command.js +8 -2
- package/dist/cli/plugin-command.js.map +1 -1
- package/dist/cli/startup-ui.d.ts.map +1 -1
- package/dist/cli/startup-ui.js +1 -1
- package/dist/cli/startup-ui.js.map +1 -1
- package/dist/config.d.ts +4 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +7 -7
- package/dist/config.js.map +1 -1
- package/dist/core/agent-forge-manifest.d.ts +7 -0
- package/dist/core/agent-forge-manifest.d.ts.map +1 -0
- package/dist/core/{pi-manifest.js → agent-forge-manifest.js} +4 -4
- package/dist/core/agent-forge-manifest.js.map +1 -0
- package/dist/core/agent-session-compaction.d.ts +1 -1
- package/dist/core/agent-session-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-compaction.js +3 -3
- package/dist/core/agent-session-compaction.js.map +1 -1
- package/dist/core/agent-session-internal.d.ts +2 -0
- package/dist/core/agent-session-internal.d.ts.map +1 -1
- package/dist/core/agent-session-internal.js.map +1 -1
- package/dist/core/agent-session-lifecycle.d.ts.map +1 -1
- package/dist/core/agent-session-lifecycle.js +12 -1
- package/dist/core/agent-session-lifecycle.js.map +1 -1
- package/dist/core/agent-session-projection.d.ts.map +1 -1
- package/dist/core/agent-session-projection.js +3 -3
- package/dist/core/agent-session-projection.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +3 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +2 -1
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session-store.d.ts.map +1 -1
- package/dist/core/agent-session-store.js +6 -1
- package/dist/core/agent-session-store.js.map +1 -1
- package/dist/core/agent-session-tools.d.ts.map +1 -1
- package/dist/core/agent-session-tools.js +13 -0
- package/dist/core/agent-session-tools.js.map +1 -1
- package/dist/core/agent-session.d.ts +24 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +58 -4
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +1 -1
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/experimental.d.ts.map +1 -1
- package/dist/core/experimental.js +1 -3
- package/dist/core/experimental.js.map +1 -1
- package/dist/core/extensions/capability-runtime-store.d.ts +20 -1
- package/dist/core/extensions/capability-runtime-store.d.ts.map +1 -1
- package/dist/core/extensions/capability-runtime-store.js +67 -0
- package/dist/core/extensions/capability-runtime-store.js.map +1 -1
- package/dist/core/extensions/capability-runtime-types.d.ts +14 -0
- package/dist/core/extensions/capability-runtime-types.d.ts.map +1 -1
- package/dist/core/extensions/capability-runtime-types.js +7 -1
- package/dist/core/extensions/capability-runtime-types.js.map +1 -1
- package/dist/core/extensions/capability-runtime.d.ts.map +1 -1
- package/dist/core/extensions/capability-runtime.js +144 -42
- package/dist/core/extensions/capability-runtime.js.map +1 -1
- package/dist/core/extensions/virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/virtual-modules.js +6 -1
- package/dist/core/extensions/virtual-modules.js.map +1 -1
- package/dist/core/facade/coding-agent-facade.d.ts +1 -1
- package/dist/core/facade/coding-agent-facade.d.ts.map +1 -1
- package/dist/core/facade/coding-agent-facade.js +1 -1
- package/dist/core/facade/coding-agent-facade.js.map +1 -1
- package/dist/core/i18n/locales/zh-cn/cli.d.ts.map +1 -1
- package/dist/core/i18n/locales/zh-cn/cli.js +2 -0
- package/dist/core/i18n/locales/zh-cn/cli.js.map +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-final.d.ts +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-final.d.ts.map +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-final.js +3 -3
- package/dist/core/i18n/locales/zh-cn/core-contract-final.js.map +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-plugins.d.ts.map +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-plugins.js +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-plugins.js.map +1 -1
- package/dist/core/i18n/locales/zh-cn/core-errors.d.ts.map +1 -1
- package/dist/core/i18n/locales/zh-cn/core-errors.js +1 -1
- package/dist/core/i18n/locales/zh-cn/core-errors.js.map +1 -1
- package/dist/core/i18n/locales/zh-cn/index.d.ts.map +1 -1
- package/dist/core/i18n/locales/zh-cn/index.js +2 -0
- package/dist/core/i18n/locales/zh-cn/index.js.map +1 -1
- package/dist/core/i18n/locales/zh-cn/interactive-mode.d.ts.map +1 -1
- package/dist/core/i18n/locales/zh-cn/interactive-mode.js +5 -0
- package/dist/core/i18n/locales/zh-cn/interactive-mode.js.map +1 -1
- package/dist/core/i18n/locales/zh-cn/session-cleanup.d.ts +7 -0
- package/dist/core/i18n/locales/zh-cn/session-cleanup.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/session-cleanup.js +15 -0
- package/dist/core/i18n/locales/zh-cn/session-cleanup.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/slash-commands.d.ts.map +1 -1
- package/dist/core/i18n/locales/zh-cn/slash-commands.js +1 -0
- package/dist/core/i18n/locales/zh-cn/slash-commands.js.map +1 -1
- package/dist/core/i18n/locales/zh-cn/tui-components-misc.d.ts.map +1 -1
- package/dist/core/i18n/locales/zh-cn/tui-components-misc.js +2 -0
- package/dist/core/i18n/locales/zh-cn/tui-components-misc.js.map +1 -1
- package/dist/core/model-resolver.d.ts +2 -0
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +4 -1
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/package-resource-collection.d.ts.map +1 -1
- package/dist/core/package-resource-collection.js +5 -5
- package/dist/core/package-resource-collection.js.map +1 -1
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +3 -3
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +1 -1
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sdk.d.ts +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +30 -8
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-cleanup.d.ts +49 -0
- package/dist/core/session-cleanup.d.ts.map +1 -0
- package/dist/core/session-cleanup.js +159 -0
- package/dist/core/session-cleanup.js.map +1 -0
- package/dist/core/session-index.d.ts +75 -0
- package/dist/core/session-index.d.ts.map +1 -0
- package/dist/core/session-index.js +455 -0
- package/dist/core/session-index.js.map +1 -0
- package/dist/core/session-manager.d.ts +9 -0
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +206 -51
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +5 -10
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +5 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +12 -1
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/timings.d.ts.map +1 -1
- package/dist/core/timings.js +1 -3
- package/dist/core/timings.js.map +1 -1
- package/dist/core/tools/capability-mount.d.ts +40 -0
- package/dist/core/tools/capability-mount.d.ts.map +1 -0
- package/dist/core/tools/capability-mount.js +112 -0
- package/dist/core/tools/capability-mount.js.map +1 -0
- package/dist/core/tools/render-utils.d.ts +1 -1
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/tool-definition.d.ts +1 -1
- package/dist/core/tools/tool-definition.d.ts.map +1 -1
- package/dist/core/tools/tool-definition.js.map +1 -1
- package/dist/core/trace-retention.d.ts +16 -1
- package/dist/core/trace-retention.d.ts.map +1 -1
- package/dist/core/trace-retention.js +43 -20
- package/dist/core/trace-retention.js.map +1 -1
- package/dist/export-html/ansi-to-html.d.ts.map +1 -0
- package/dist/export-html/ansi-to-html.js.map +1 -0
- package/dist/{core/export-html → export-html}/index.d.ts +1 -1
- package/dist/export-html/index.d.ts.map +1 -0
- package/dist/{core/export-html → export-html}/index.js +5 -5
- package/dist/export-html/index.js.map +1 -0
- package/dist/{core/export-html → export-html}/tool-renderer.d.ts +2 -2
- package/dist/export-html/tool-renderer.d.ts.map +1 -0
- package/dist/export-html/tool-renderer.js.map +1 -0
- package/dist/{modes/interactive → host}/model-catalog-refresh.d.ts +1 -1
- package/dist/host/model-catalog-refresh.d.ts.map +1 -0
- package/dist/{modes/interactive → host}/model-catalog-refresh.js +1 -1
- package/dist/host/model-catalog-refresh.js.map +1 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -12
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +26 -14
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/agents-view.d.ts.map +1 -1
- package/dist/modes/interactive/components/agents-view.js +1 -1
- package/dist/modes/interactive/components/agents-view.js.map +1 -1
- package/dist/modes/interactive/components/armin.d.ts.map +1 -1
- package/dist/modes/interactive/components/armin.js +1 -1
- package/dist/modes/interactive/components/armin.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +6 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +108 -27
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +1 -1
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.d.ts +1 -1
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.js.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.js +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +1 -1
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-entry.js +1 -1
- 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 -1
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/daxnuts.d.ts.map +1 -1
- package/dist/modes/interactive/components/daxnuts.js +1 -1
- package/dist/modes/interactive/components/daxnuts.js.map +1 -1
- package/dist/modes/interactive/components/dialog-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/dialog-editor.js +1 -1
- package/dist/modes/interactive/components/dialog-editor.js.map +1 -1
- package/dist/modes/interactive/components/dialog-input.d.ts.map +1 -1
- package/dist/modes/interactive/components/dialog-input.js +1 -1
- package/dist/modes/interactive/components/dialog-input.js.map +1 -1
- package/dist/modes/interactive/components/dialog-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/dialog-selector.js +1 -1
- package/dist/modes/interactive/components/dialog-selector.js.map +1 -1
- package/dist/modes/interactive/components/diff.d.ts.map +1 -1
- package/dist/modes/interactive/components/diff.js +1 -1
- package/dist/modes/interactive/components/diff.js.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.js +1 -1
- package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.d.ts +1 -1
- package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.js +1 -1
- package/dist/modes/interactive/components/first-time-setup.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +1 -1
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.js +1 -1
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +1 -1
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/mermaid.d.ts +1 -1
- package/dist/modes/interactive/components/mermaid.d.ts.map +1 -1
- package/dist/modes/interactive/components/mermaid.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +2 -2
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +1 -1
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/plugin-manager-entry.d.ts.map +1 -1
- package/dist/modes/interactive/components/plugin-manager-entry.js +1 -1
- package/dist/modes/interactive/components/plugin-manager-entry.js.map +1 -1
- package/dist/modes/interactive/components/plugin-selection-entry.d.ts.map +1 -1
- package/dist/modes/interactive/components/plugin-selection-entry.js +1 -1
- package/dist/modes/interactive/components/plugin-selection-entry.js.map +1 -1
- package/dist/modes/interactive/components/queue-manager-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/queue-manager-selector.js +1 -1
- package/dist/modes/interactive/components/queue-manager-selector.js.map +1 -1
- package/dist/modes/interactive/components/render-types.d.ts +1 -1
- package/dist/modes/interactive/components/render-types.d.ts.map +1 -1
- package/dist/modes/interactive/components/render-types.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-search.js +5 -1
- package/dist/modes/interactive/components/session-selector-search.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +11 -2
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.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/settings-submenu.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-submenu.js +1 -1
- package/dist/modes/interactive/components/settings-submenu.js.map +1 -1
- package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/show-images-selector.js +1 -1
- package/dist/modes/interactive/components/show-images-selector.js.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
- package/dist/modes/interactive/components/status-indicator.js +1 -1
- package/dist/modes/interactive/components/status-indicator.js.map +1 -1
- package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/theme-selector.js +1 -1
- package/dist/modes/interactive/components/theme-selector.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +1 -1
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +19 -0
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +139 -4
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tool-run-group.d.ts +44 -0
- package/dist/modes/interactive/components/tool-run-group.d.ts.map +1 -0
- package/dist/modes/interactive/components/tool-run-group.js +121 -0
- package/dist/modes/interactive/components/tool-run-group.js.map +1 -0
- package/dist/modes/interactive/components/tree-list.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-list.js +1 -1
- package/dist/modes/interactive/components/tree-list.js.map +1 -1
- package/dist/modes/interactive/components/tree-render.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-render.js +1 -1
- package/dist/modes/interactive/components/tree-render.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +1 -1
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.js +1 -1
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js +1 -1
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/components/workflow-view.d.ts.map +1 -1
- package/dist/modes/interactive/components/workflow-view.js +1 -1
- package/dist/modes/interactive/components/workflow-view.js.map +1 -1
- package/dist/modes/interactive/interactive-auth.d.ts +1 -1
- package/dist/modes/interactive/interactive-auth.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-auth.js +1 -1
- package/dist/modes/interactive/interactive-auth.js.map +1 -1
- package/dist/modes/interactive/interactive-commands.d.ts +125 -6
- package/dist/modes/interactive/interactive-commands.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-commands.js +698 -4
- package/dist/modes/interactive/interactive-commands.js.map +1 -1
- package/dist/modes/interactive/interactive-events.d.ts +174 -0
- package/dist/modes/interactive/interactive-events.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-events.js +704 -0
- package/dist/modes/interactive/interactive-events.js.map +1 -0
- package/dist/modes/interactive/interactive-format.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-format.js +1 -1
- package/dist/modes/interactive/interactive-format.js.map +1 -1
- package/dist/modes/interactive/interactive-lifecycle.d.ts +94 -0
- package/dist/modes/interactive/interactive-lifecycle.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-lifecycle.js +177 -0
- package/dist/modes/interactive/interactive-lifecycle.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +254 -129
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +275 -2101
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/interactive-queues.d.ts +96 -0
- package/dist/modes/interactive/interactive-queues.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-queues.js +183 -0
- package/dist/modes/interactive/interactive-queues.js.map +1 -0
- package/dist/modes/interactive/interactive-selectors.d.ts +95 -5
- package/dist/modes/interactive/interactive-selectors.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-selectors.js +517 -6
- package/dist/modes/interactive/interactive-selectors.js.map +1 -1
- package/dist/modes/interactive/startup-services.d.ts +31 -0
- package/dist/modes/interactive/startup-services.d.ts.map +1 -0
- package/dist/modes/interactive/startup-services.js +123 -0
- package/dist/modes/interactive/startup-services.js.map +1 -0
- package/dist/modes/memory-preheat.d.ts +11 -0
- package/dist/modes/memory-preheat.d.ts.map +1 -0
- package/dist/modes/memory-preheat.js +20 -0
- package/dist/modes/memory-preheat.js.map +1 -0
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +3 -1
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/plugins/ecosystem/cli.d.ts.map +1 -1
- package/dist/plugins/ecosystem/cli.js +6 -3
- package/dist/plugins/ecosystem/cli.js.map +1 -1
- package/dist/plugins/ecosystem/node-plugin-bootstrap.d.ts +7 -1
- package/dist/plugins/ecosystem/node-plugin-bootstrap.d.ts.map +1 -1
- package/dist/plugins/ecosystem/node-plugin-bootstrap.js +50 -3
- package/dist/plugins/ecosystem/node-plugin-bootstrap.js.map +1 -1
- package/dist/plugins/ecosystem/plugin-bootstrap.d.ts +28 -16
- package/dist/plugins/ecosystem/plugin-bootstrap.d.ts.map +1 -1
- package/dist/plugins/ecosystem/plugin-bootstrap.js +35 -33
- package/dist/plugins/ecosystem/plugin-bootstrap.js.map +1 -1
- package/dist/profile/plugin-profiles.d.ts +1 -1
- package/dist/profile/plugin-profiles.d.ts.map +1 -1
- package/dist/profile/plugin-profiles.js +18 -0
- package/dist/profile/plugin-profiles.js.map +1 -1
- package/dist/remote/server-assembly.d.ts.map +1 -1
- package/dist/remote/server-assembly.js +7 -2
- package/dist/remote/server-assembly.js.map +1 -1
- package/dist/{profiles → suites}/builtin-suites.d.ts +14 -4
- package/dist/suites/builtin-suites.d.ts.map +1 -0
- package/dist/{profiles → suites}/builtin-suites.js +20 -5
- package/dist/suites/builtin-suites.js.map +1 -0
- package/dist/suites/resolved-agent-profile.d.ts.map +1 -0
- package/dist/suites/resolved-agent-profile.js.map +1 -0
- package/dist/suites/suite-lifecycle.d.ts.map +1 -0
- package/dist/suites/suite-lifecycle.js.map +1 -0
- package/dist/suites/suite-loader.d.ts.map +1 -0
- package/dist/suites/suite-loader.js.map +1 -0
- package/dist/{modes/interactive/theme → theme}/dark.json +1 -1
- package/dist/{modes/interactive/theme → theme}/light.json +1 -1
- package/dist/{modes/interactive/theme → theme}/theme-controller.d.ts +1 -1
- package/dist/theme/theme-controller.d.ts.map +1 -0
- package/dist/{modes/interactive/theme → theme}/theme-controller.js +1 -1
- package/dist/theme/theme-controller.js.map +1 -0
- package/dist/{modes/interactive/theme → theme}/theme.d.ts +1 -1
- package/dist/theme/theme.d.ts.map +1 -0
- package/dist/{modes/interactive/theme → theme}/theme.js +5 -5
- package/dist/theme/theme.js.map +1 -0
- package/docs/compaction.md +7 -7
- package/docs/environment-variables.md +10 -4
- package/docs/keybindings.md +3 -3
- package/docs/models.md +17 -17
- package/docs/packages.md +1 -1
- package/docs/prompt-templates.md +1 -1
- package/docs/rpc.md +2 -2
- package/docs/sdk.md +5 -5
- package/docs/session-format.md +3 -3
- package/docs/settings.md +368 -354
- package/docs/shell-aliases.md +1 -1
- package/docs/skills.md +1 -1
- package/docs/terminal-setup.md +17 -17
- package/docs/themes.md +5 -5
- package/docs/tmux.md +4 -4
- package/docs/tui.md +1 -1
- package/docs/windows.md +1 -1
- package/examples/extensions/bash-spawn-hook/index.ts +1 -1
- package/examples/extensions/dynamic-resources/dynamic.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -6
- package/examples/extensions/with-deps/plugin.json +1 -1
- package/package.json +2 -2
- package/dist/bundle/chunks/openai-responses-AUJQ3NWT.js +0 -2
- package/dist/bundle/chunks/virtual-modules-WF6WRHP7.js +0 -5
- package/dist/cli/experimental/commands/pi.d.ts +0 -15
- package/dist/cli/experimental/commands/pi.d.ts.map +0 -1
- package/dist/cli/experimental/commands/pi.js.map +0 -1
- package/dist/core/export-html/ansi-to-html.d.ts.map +0 -1
- package/dist/core/export-html/ansi-to-html.js.map +0 -1
- package/dist/core/export-html/index.d.ts.map +0 -1
- package/dist/core/export-html/index.js.map +0 -1
- package/dist/core/export-html/tool-renderer.d.ts.map +0 -1
- package/dist/core/export-html/tool-renderer.js.map +0 -1
- package/dist/core/pi-manifest.d.ts +0 -7
- package/dist/core/pi-manifest.d.ts.map +0 -1
- package/dist/core/pi-manifest.js.map +0 -1
- package/dist/modes/interactive/model-catalog-refresh.d.ts.map +0 -1
- package/dist/modes/interactive/model-catalog-refresh.js.map +0 -1
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +0 -1
- package/dist/modes/interactive/theme/theme-controller.js.map +0 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +0 -1
- package/dist/modes/interactive/theme/theme.js.map +0 -1
- package/dist/profiles/builtin-suites.d.ts.map +0 -1
- package/dist/profiles/builtin-suites.js.map +0 -1
- package/dist/profiles/resolved-agent-profile.d.ts.map +0 -1
- package/dist/profiles/resolved-agent-profile.js.map +0 -1
- package/dist/profiles/suite-lifecycle.d.ts.map +0 -1
- package/dist/profiles/suite-lifecycle.js.map +0 -1
- package/dist/profiles/suite-loader.d.ts.map +0 -1
- package/dist/profiles/suite-loader.js.map +0 -1
- package/dist/utils/deprecation.d.ts +0 -4
- package/dist/utils/deprecation.d.ts.map +0 -1
- package/dist/utils/deprecation.js +0 -13
- package/dist/utils/deprecation.js.map +0 -1
- /package/dist/{core/export-html → export-html}/ansi-to-html.d.ts +0 -0
- /package/dist/{core/export-html → export-html}/ansi-to-html.js +0 -0
- /package/dist/{core/export-html → export-html}/template.css +0 -0
- /package/dist/{core/export-html → export-html}/template.html +0 -0
- /package/dist/{core/export-html → export-html}/template.js +0 -0
- /package/dist/{core/export-html → export-html}/tool-renderer.js +0 -0
- /package/dist/{core/export-html → export-html}/vendor/highlight.min.js +0 -0
- /package/dist/{core/export-html → export-html}/vendor/marked.min.js +0 -0
- /package/dist/{profiles → suites}/resolved-agent-profile.d.ts +0 -0
- /package/dist/{profiles → suites}/resolved-agent-profile.js +0 -0
- /package/dist/{profiles → suites}/suite-lifecycle.d.ts +0 -0
- /package/dist/{profiles → suites}/suite-lifecycle.js +0 -0
- /package/dist/{profiles → suites}/suite-loader.d.ts +0 -0
- /package/dist/{profiles → suites}/suite-loader.js +0 -0
- /package/dist/{modes/interactive/theme → theme}/theme-schema.json +0 -0
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
import { Box, Container, getCapabilities, Image, Spacer, Text, truncateToWidth, } from "@agent-forge/tui";
|
|
2
2
|
import { t } from "../../../core/i18n/index.js";
|
|
3
3
|
import { formatToolCallWithArgs, getTextOutput as getRenderedTextOutput } from "../../../core/tools/render-utils.js";
|
|
4
|
+
import { theme } from "../../../theme/theme.js";
|
|
4
5
|
import { convertToPng } from "../../../utils/image-convert.js";
|
|
5
|
-
import { theme } from "../theme/theme.js";
|
|
6
6
|
import { keyText } from "./keybinding-hints.js";
|
|
7
7
|
/** Visual (wrapped) result lines shown before fallback output is expanded. */
|
|
8
8
|
const FALLBACK_PREVIEW_LINES = 10;
|
|
9
|
+
/**
|
|
10
|
+
* 单条工具结果展示预算 (M2, 终端输出模式设计 §3.2「展开仍复用统一的输出截断」):
|
|
11
|
+
* 任何渲染器 (含第三方插件) 的结果输出在视觉行上超过预算时, 保留 head+tail、
|
|
12
|
+
* 中间以一行截断说明替代 (截断原因 + 总量 + 完整输出引用, 引用存在时)。这是
|
|
13
|
+
* compact 预览之上的兜底——折叠态有自己的小预览, detail 态 (ctrl+o) 的全文
|
|
14
|
+
* 渲染由此封顶。错误结果豁免 (错误可见性优先, 与 collapsedPreviewText 同惯例)。
|
|
15
|
+
*/
|
|
16
|
+
const TOOL_OUTPUT_MAX_LINES = 400;
|
|
17
|
+
/** 预算超出时保留完整输出的末尾视觉行数 (错误摘要与结论常聚在输出末尾)。 */
|
|
18
|
+
const TOOL_OUTPUT_TAIL_LINES = 100;
|
|
9
19
|
/**
|
|
10
20
|
* Pretty-printed JSON up to this length is collapsed to its compact single-line
|
|
11
21
|
* form; longer compact forms are cut here so a short tool-result ticket shows
|
|
@@ -74,6 +84,69 @@ class VisualLinePreview {
|
|
|
74
84
|
this.cachedLines = undefined;
|
|
75
85
|
}
|
|
76
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* bash 系工具在 details 携带的全量输出文件引用 (截断说明行的"完整输出"引用;
|
|
89
|
+
* 终端输出模式设计 §3.2 的引用要求在通用层的最大努力形态)。
|
|
90
|
+
*/
|
|
91
|
+
function resultFullOutputRef(details) {
|
|
92
|
+
if (details === null || typeof details !== "object" || Array.isArray(details))
|
|
93
|
+
return undefined;
|
|
94
|
+
const ref = details.fullOutputPath;
|
|
95
|
+
return typeof ref === "string" && ref.trim() !== "" ? ref : undefined;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* 结果渲染器输出的展示预算兜底 (M2): 包装 renderResult/fallback 产出的子组件,
|
|
99
|
+
* render(width) 时对视觉行超预算的输出做 head+截断说明+tail。渲染器契约不变
|
|
100
|
+
* (renderResult 仍收 expanded 原值, lastComponent 仍传裸子组件); 缓存按宽度,
|
|
101
|
+
* invalidate 透传子组件 (流式增量渲染依赖它)。
|
|
102
|
+
*/
|
|
103
|
+
class BoundedResultView {
|
|
104
|
+
child;
|
|
105
|
+
maxLines;
|
|
106
|
+
tailLines;
|
|
107
|
+
isError;
|
|
108
|
+
fullOutputRef;
|
|
109
|
+
cachedWidth;
|
|
110
|
+
cachedLines;
|
|
111
|
+
constructor(child, maxLines, tailLines, isError, fullOutputRef) {
|
|
112
|
+
this.child = child;
|
|
113
|
+
this.maxLines = maxLines;
|
|
114
|
+
this.tailLines = tailLines;
|
|
115
|
+
this.isError = isError;
|
|
116
|
+
this.fullOutputRef = fullOutputRef;
|
|
117
|
+
}
|
|
118
|
+
render(width) {
|
|
119
|
+
if (this.cachedLines === undefined || this.cachedWidth !== width) {
|
|
120
|
+
const lines = this.child.render(width);
|
|
121
|
+
if (this.isError || lines.length <= this.maxLines) {
|
|
122
|
+
this.cachedLines = lines;
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
const headLines = this.maxLines - this.tailLines - 1;
|
|
126
|
+
const hidden = lines.length - headLines - this.tailLines;
|
|
127
|
+
const hint = this.fullOutputRef === undefined
|
|
128
|
+
? t("... ({count} lines truncated)", { count: hidden })
|
|
129
|
+
: t("... ({count} lines truncated; full output: {path})", {
|
|
130
|
+
count: hidden,
|
|
131
|
+
path: this.fullOutputRef,
|
|
132
|
+
});
|
|
133
|
+
this.cachedLines = [
|
|
134
|
+
...lines.slice(0, headLines),
|
|
135
|
+
truncateToWidth(theme.fg("muted", hint), width, "..."),
|
|
136
|
+
...lines.slice(lines.length - this.tailLines),
|
|
137
|
+
];
|
|
138
|
+
}
|
|
139
|
+
this.cachedWidth = width;
|
|
140
|
+
return this.cachedLines;
|
|
141
|
+
}
|
|
142
|
+
return this.cachedLines;
|
|
143
|
+
}
|
|
144
|
+
invalidate() {
|
|
145
|
+
this.child.invalidate();
|
|
146
|
+
this.cachedWidth = undefined;
|
|
147
|
+
this.cachedLines = undefined;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
77
150
|
export class ToolExecutionComponent extends Container {
|
|
78
151
|
contentBox;
|
|
79
152
|
contentText;
|
|
@@ -190,6 +263,49 @@ export class ToolExecutionComponent extends Container {
|
|
|
190
263
|
key: keyText("app.tools.expand"),
|
|
191
264
|
})));
|
|
192
265
|
}
|
|
266
|
+
/** Failure fact for the enclosing ToolRunGroupComponent (D-083 quiet marker). */
|
|
267
|
+
get isError() {
|
|
268
|
+
return this.result?.isError ?? false;
|
|
269
|
+
}
|
|
270
|
+
/** Tool name for the group marker's sole-tool form (restore path has no setActiveTool). */
|
|
271
|
+
get name() {
|
|
272
|
+
return this.toolName;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* First non-empty line of a failed result's text output — the quiet group
|
|
276
|
+
* marker's failure summary (D-083 增补:失败首行摘要). Successes and
|
|
277
|
+
* result-less calls return undefined.
|
|
278
|
+
*/
|
|
279
|
+
get errorSummary() {
|
|
280
|
+
if (!this.result?.isError)
|
|
281
|
+
return undefined;
|
|
282
|
+
return this.getTextOutput()
|
|
283
|
+
.split("\n")
|
|
284
|
+
.map((line) => line.trim())
|
|
285
|
+
.find((line) => line !== "");
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Quiet-transcript image lines (D-083 增补:图片是用户可见的结论): the
|
|
289
|
+
* collapsed group marker hides the text card but still renders result
|
|
290
|
+
* images (desktop/browser screenshots). Empty when the result has no
|
|
291
|
+
* renderable images.
|
|
292
|
+
*/
|
|
293
|
+
renderQuietImages(width) {
|
|
294
|
+
const lines = [];
|
|
295
|
+
for (let i = 0; i < this.imageComponents.length; i++) {
|
|
296
|
+
const spacer = this.imageSpacers[i];
|
|
297
|
+
// v8 ignore next -- spacers and image components are always pushed in pairs
|
|
298
|
+
if (spacer) {
|
|
299
|
+
lines.push(...spacer.render(width));
|
|
300
|
+
}
|
|
301
|
+
const imageComponent = this.imageComponents[i];
|
|
302
|
+
// v8 ignore next -- spacers and image components are always pushed in pairs
|
|
303
|
+
if (imageComponent) {
|
|
304
|
+
lines.push(...imageComponent.render(width));
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
return lines;
|
|
308
|
+
}
|
|
193
309
|
updateArgs(args) {
|
|
194
310
|
this.args = args;
|
|
195
311
|
this.updateDisplay();
|
|
@@ -290,6 +406,10 @@ export class ToolExecutionComponent extends Container {
|
|
|
290
406
|
}
|
|
291
407
|
return super.render(width);
|
|
292
408
|
}
|
|
409
|
+
/** M2 展示预算: 结果子组件统一过有界视图 (错误豁免), 见 BoundedResultView。 */
|
|
410
|
+
boundedResult(component) {
|
|
411
|
+
return new BoundedResultView(component, TOOL_OUTPUT_MAX_LINES, TOOL_OUTPUT_TAIL_LINES, this.result?.isError ?? false, resultFullOutputRef(this.result?.details));
|
|
412
|
+
}
|
|
293
413
|
updateDisplay() {
|
|
294
414
|
const bgFn = this.isPartial
|
|
295
415
|
? (text) => theme.bg("toolPendingBg", text)
|
|
@@ -331,7 +451,7 @@ export class ToolExecutionComponent extends Container {
|
|
|
331
451
|
if (!resultRenderer) {
|
|
332
452
|
const component = this.createResultFallback();
|
|
333
453
|
if (component) {
|
|
334
|
-
renderContainer.addChild(component);
|
|
454
|
+
renderContainer.addChild(this.boundedResult(component));
|
|
335
455
|
hasContent = true;
|
|
336
456
|
}
|
|
337
457
|
}
|
|
@@ -340,7 +460,7 @@ export class ToolExecutionComponent extends Container {
|
|
|
340
460
|
const component = resultRenderer({ content: this.result.content, details: this.result.details }, { expanded: this.expanded, isPartial: this.isPartial }, theme, this.getRenderContext(this.resultRendererComponent));
|
|
341
461
|
if (component) {
|
|
342
462
|
this.resultRendererComponent = component;
|
|
343
|
-
renderContainer.addChild(component);
|
|
463
|
+
renderContainer.addChild(this.boundedResult(component));
|
|
344
464
|
hasContent = true;
|
|
345
465
|
}
|
|
346
466
|
}
|
|
@@ -404,7 +524,22 @@ export class ToolExecutionComponent extends Container {
|
|
|
404
524
|
}
|
|
405
525
|
const output = this.getTextOutput();
|
|
406
526
|
if (output) {
|
|
407
|
-
|
|
527
|
+
// 无定义工具的通用回退同样封顶 (M2, 逻辑行粒度): 超预算 head+说明+tail。
|
|
528
|
+
const lines = output.split("\n");
|
|
529
|
+
if (lines.length <= TOOL_OUTPUT_MAX_LINES) {
|
|
530
|
+
text += `\n${output}`;
|
|
531
|
+
}
|
|
532
|
+
else {
|
|
533
|
+
const headLines = TOOL_OUTPUT_MAX_LINES - TOOL_OUTPUT_TAIL_LINES - 1;
|
|
534
|
+
const hint = t("... ({count} lines truncated)", {
|
|
535
|
+
count: lines.length - headLines - TOOL_OUTPUT_TAIL_LINES,
|
|
536
|
+
});
|
|
537
|
+
text += `\n${[
|
|
538
|
+
...lines.slice(0, headLines),
|
|
539
|
+
hint,
|
|
540
|
+
...lines.slice(lines.length - TOOL_OUTPUT_TAIL_LINES),
|
|
541
|
+
].join("\n")}`;
|
|
542
|
+
}
|
|
408
543
|
}
|
|
409
544
|
return text;
|
|
410
545
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-execution.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/tool-execution.ts"],"names":[],"mappings":"AACA,OAAO,EACN,GAAG,EAEH,SAAS,EACT,eAAe,EACf,KAAK,EACL,MAAM,EACN,IAAI,EAEJ,eAAe,GACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,CAAC,EAAE,MAAM,6BAA6B,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,aAAa,IAAI,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAErH,OAAO,EAAE,YAAY,EAAE,MAA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AI,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;IAAA,CACZ;CACD","sourcesContent":["import type { ImageContent, TextContent } from \"@agent-forge/ai\";\nimport {\n\tBox,\n\ttype Component,\n\tContainer,\n\tgetCapabilities,\n\tImage,\n\tSpacer,\n\tText,\n\ttype TUI,\n\ttruncateToWidth,\n} from \"@agent-forge/tui\";\nimport { t } from \"../../../core/i18n/index.ts\";\nimport { formatToolCallWithArgs, getTextOutput as getRenderedTextOutput } from \"../../../core/tools/render-utils.ts\";\nimport type { ToolDefinition, ToolRenderContext } from \"../../../core/tools/tool-definition.ts\";\nimport { convertToPng } from \"../../../utils/image-convert.ts\";\nimport { theme } from \"../theme/theme.ts\";\nimport { keyText } from \"./keybinding-hints.ts\";\n\n/** Visual (wrapped) result lines shown before fallback output is expanded. */\nconst FALLBACK_PREVIEW_LINES = 10;\n\n/**\n * Pretty-printed JSON up to this length is collapsed to its compact single-line\n * form; longer compact forms are cut here so a short tool-result ticket shows\n * as one preview line instead of sprawling across the chat. Expansion always\n * shows the original text.\n */\nconst COLLAPSED_JSON_PREVIEW_CHARS = 220;\n\n/**\n * Collapsed preview text for fallback results: pretty-printed JSON (the default\n * serialization for capability-tool results) becomes one compact line, and any\n * other text previews verbatim. Unparseable JSON-like text stays verbatim too.\n * Error results never compact — error visibility beats compactness, so they\n * keep the (threshold-limited) full form with the error background.\n */\nfunction collapsedPreviewText(output: string, isError: boolean): string {\n\tif (isError) {\n\t\treturn output;\n\t}\n\tconst trimmed = output.trimStart();\n\tif (!trimmed.startsWith(\"{\") && !trimmed.startsWith(\"[\")) {\n\t\treturn output;\n\t}\n\ttry {\n\t\tconst compact = JSON.stringify(JSON.parse(output));\n\t\treturn compact.length > COLLAPSED_JSON_PREVIEW_CHARS\n\t\t\t? `${compact.slice(0, COLLAPSED_JSON_PREVIEW_CHARS - 1)}…`\n\t\t\t: compact;\n\t} catch {\n\t\treturn output;\n\t}\n}\n\n/**\n * Collapsed fallback output limited to a number of visual (wrapped) lines. Limiting logical\n * lines instead lets a single long line (such as minified JSON) wrap across the whole screen.\n * Caches its lines per width, since it renders on every frame for every result in the transcript.\n */\nclass VisualLinePreview implements Component {\n\tprivate text: string;\n\tprivate maxVisualLines: number;\n\tprivate formatHint: (hidden: number) => string;\n\tprivate cachedWidth: number | undefined;\n\tprivate cachedLines: string[] | undefined;\n\n\tconstructor(text: string, maxVisualLines: number, formatHint: (hidden: number) => string) {\n\t\tthis.text = text;\n\t\tthis.maxVisualLines = maxVisualLines;\n\t\tthis.formatHint = formatHint;\n\t}\n\n\trender(width: number): string[] {\n\t\tif (this.cachedLines === undefined || this.cachedWidth !== width) {\n\t\t\tconst allVisualLines = new Text(this.text, 0, 0).render(width);\n\t\t\tconst lines =\n\t\t\t\tallVisualLines.length > this.maxVisualLines\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t...allVisualLines.slice(0, this.maxVisualLines),\n\t\t\t\t\t\t\ttruncateToWidth(this.formatHint(allVisualLines.length - this.maxVisualLines), width, \"...\"),\n\t\t\t\t\t\t]\n\t\t\t\t\t: allVisualLines;\n\t\t\tthis.cachedLines = lines;\n\t\t\tthis.cachedWidth = width;\n\t\t\treturn lines;\n\t\t}\n\t\treturn this.cachedLines;\n\t}\n\n\tinvalidate(): void {\n\t\tthis.cachedWidth = undefined;\n\t\tthis.cachedLines = undefined;\n\t}\n}\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 selfRenderContainer: Container;\n\tprivate callRendererComponent?: Component;\n\tprivate resultRendererComponent?: Component;\n\tprivate rendererState: Record<string, unknown> = {};\n\tprivate imageComponents: Image[] = [];\n\tprivate imageSpacers: Spacer[] = [];\n\tprivate toolName: string;\n\tprivate toolCallId: string;\n\tprivate args: unknown;\n\tprivate expanded = false;\n\tprivate showImages: boolean;\n\tprivate imageWidthCells: number;\n\tprivate isPartial = true;\n\tprivate toolDefinition?: ToolDefinition;\n\tprivate ui: TUI;\n\tprivate cwd: string;\n\tprivate executionStarted = false;\n\tprivate argsComplete = false;\n\tprivate result?: {\n\t\tcontent: (TextContent | ImageContent)[];\n\t\tisError: boolean;\n\t\tdetails?: unknown;\n\t};\n\tprivate convertedImages: Map<\n\t\tnumber,\n\t\t{ sourceData: string; sourceMimeType: string; data: string; mimeType: string }\n\t> = new Map();\n\tprivate hideComponent = false;\n\n\tconstructor(\n\t\ttoolName: string,\n\t\ttoolCallId: string,\n\t\targs: unknown,\n\t\toptions: ToolExecutionOptions = {},\n\t\ttoolDefinition: ToolDefinition | 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\t// The caller passes the session registry's definition\n\t\t// (interactive-mode getRegisteredToolDefinition → facade.getToolDefinition).\n\t\t// Since D-082 批 1 the default coding tool definitions live in the\n\t\t// coding-tools plugin, so the registry is the only definition source;\n\t\t// names missing from the registry render through the generic fallback.\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.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.contentText);\n\t\t}\n\n\t\tthis.updateDisplay();\n\t}\n\n\tprivate getCallRenderer(): ToolDefinition[\"renderCall\"] | undefined {\n\t\treturn this.toolDefinition?.renderCall;\n\t}\n\n\tprivate getResultRenderer(): ToolDefinition[\"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\tif (this.expanded) {\n\t\t\treturn new Text(\n\t\t\t\toutput\n\t\t\t\t\t.split(\"\\n\")\n\t\t\t\t\t.map((line) => theme.fg(\"toolOutput\", line))\n\t\t\t\t\t.join(\"\\n\"),\n\t\t\t\t0,\n\t\t\t\t0,\n\t\t\t);\n\t\t}\n\t\tconst previewText = collapsedPreviewText(output, this.result?.isError ?? false);\n\t\t// A compacted JSON preview is one line by construction, so it never\n\t\t// reaches the preview-line threshold — append the expand hint directly.\n\t\tif (previewText !== output) {\n\t\t\t// i18n: 原三段样式拼接合并为整句单 key,键位片段的 dim 样式损失按批次④特殊裁决 1 接受\n\t\t\tconst hint = theme.fg(\"muted\", t(\"({key} to expand)\", { key: keyText(\"app.tools.expand\") }));\n\t\t\treturn new Text(`${theme.fg(\"toolOutput\", previewText)} ${hint}`, 0, 0);\n\t\t}\n\t\tconst styled = previewText\n\t\t\t.split(\"\\n\")\n\t\t\t.map((line) => theme.fg(\"toolOutput\", line))\n\t\t\t.join(\"\\n\");\n\t\treturn new VisualLinePreview(styled, FALLBACK_PREVIEW_LINES, (hidden) =>\n\t\t\ttheme.fg(\n\t\t\t\t\"muted\",\n\t\t\t\tt(\"... ({count} more lines, {key} to expand)\", {\n\t\t\t\t\tcount: hidden,\n\t\t\t\t\tkey: keyText(\"app.tools.expand\"),\n\t\t\t\t}),\n\t\t\t),\n\t\t);\n\t}\n\n\tupdateArgs(args: unknown): 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: (TextContent | ImageContent)[];\n\t\t\tdetails?: unknown;\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\tthis.maybeConvertImagesForKitty();\n\t}\n\n\tprivate maybeConvertImagesForKitty(): void {\n\t\tconst caps = getCapabilities();\n\t\tif (caps.images !== \"kitty\") return;\n\t\t// v8 ignore next -- sole caller updateResult always assigns this.result first\n\t\tif (!this.result) return;\n\n\t\tconst imageBlocks = this.result.content.filter((c) => c.type === \"image\");\n\t\tfor (let i = 0; i < imageBlocks.length; i++) {\n\t\t\tconst img = imageBlocks[i];\n\t\t\tif (!img.data || !img.mimeType) continue;\n\t\t\tconst sourceData = img.data;\n\t\t\tconst sourceMimeType = img.mimeType;\n\t\t\tif (sourceMimeType === \"image/png\") continue;\n\t\t\tconst cached = this.convertedImages.get(i);\n\t\t\tif (cached?.sourceData === sourceData && cached.sourceMimeType === sourceMimeType) continue;\n\n\t\t\tconst index = i;\n\t\t\tconvertToPng(sourceData, sourceMimeType).then((converted) => {\n\t\t\t\tconst currentImage = this.result?.content.filter((content) => content.type === \"image\")[index];\n\t\t\t\tif (!converted || currentImage?.data !== sourceData || currentImage.mimeType !== sourceMimeType) return;\n\t\t\t\tthis.convertedImages.set(index, {\n\t\t\t\t\tsourceData,\n\t\t\t\t\tsourceMimeType,\n\t\t\t\t\t...converted,\n\t\t\t\t});\n\t\t\t\tthis.updateDisplay();\n\t\t\t\tthis.ui.requestRender();\n\t\t\t});\n\t\t}\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\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\t// v8 ignore next -- spacers and image components are always pushed in pairs\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\t// v8 ignore next -- spacers and image components are always pushed in pairs\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\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.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\t// 渲染器可能返回 undefined(选择不渲染);此时交给无内容隐藏\n\t\t\t\t\t// 逻辑,不能把 undefined 塞进 Box.children(invalidate 会崩溃)。\n\t\t\t\t\tif (component) {\n\t\t\t\t\t\tthis.callRendererComponent = component;\n\t\t\t\t\t\trenderContainer.addChild(component);\n\t\t\t\t\t\thasContent = true;\n\t\t\t\t\t}\n\t\t\t\t} catch {\n\t\t\t\t\tthis.callRendererComponent = undefined;\n\t\t\t\t\trenderContainer.addChild(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(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, 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\tif (component) {\n\t\t\t\t\t\t\tthis.resultRendererComponent = component;\n\t\t\t\t\t\t\trenderContainer.addChild(component);\n\t\t\t\t\t\t\thasContent = true;\n\t\t\t\t\t\t}\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(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\tfor (const img of this.imageComponents) {\n\t\t\tthis.removeChild(img);\n\t\t}\n\t\tthis.imageComponents = [];\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 (let i = 0; i < imageBlocks.length; i++) {\n\t\t\t\tconst img = imageBlocks[i];\n\t\t\t\tif (caps.images && this.showImages && img.data && img.mimeType) {\n\t\t\t\t\tconst cached = this.convertedImages.get(i);\n\t\t\t\t\tconst converted =\n\t\t\t\t\t\tcached?.sourceData === img.data && cached.sourceMimeType === img.mimeType ? cached : undefined;\n\t\t\t\t\tconst imageData = converted?.data ?? img.data;\n\t\t\t\t\tconst imageMimeType = converted?.mimeType ?? img.mimeType;\n\t\t\t\t\tif (caps.images === \"kitty\" && imageMimeType !== \"image/png\") continue;\n\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 imageComponent = new Image(\n\t\t\t\t\t\timageData,\n\t\t\t\t\t\timageMimeType,\n\t\t\t\t\t\t{ fallbackColor: (s: string) => theme.fg(\"toolOutput\", s) },\n\t\t\t\t\t\t{ maxWidthCells: this.imageWidthCells },\n\t\t\t\t\t);\n\t\t\t\t\tthis.imageComponents.push(imageComponent);\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":"AACA,OAAO,EACN,GAAG,EAEH,SAAS,EACT,eAAe,EACf,KAAK,EACL,MAAM,EACN,IAAI,EAEJ,eAAe,GACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,CAAC,EAAE,MAAM,6BAA6B,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,aAAa,IAAI,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAErH,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,8EAA8E;AAC9E,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAElC;;;;;;GAMG;AACH,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAElC,6GAA2C;AAC3C,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,4BAA4B,GAAG,GAAG,CAAC;AAEzC;;;;;;GAMG;AACH,SAAS,oBAAoB,CAAC,MAAc,EAAE,OAAgB,EAAU;IACvE,IAAI,OAAO,EAAE,CAAC;QACb,OAAO,MAAM,CAAC;IACf,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;IACnC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1D,OAAO,MAAM,CAAC;IACf,CAAC;IACD,IAAI,CA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/C,KAAK,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,GAAG,sBAAsB;iBACxD,CAAC,CAAC;gBACH,IAAI,IAAI,KAAK;oBACZ,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC;oBAC5B,IAAI;oBACJ,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,sBAAsB,CAAC;iBACrD,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAChB,CAAC;QACF,CAAC;QACD,OAAO,IAAI,CAAC;IAAA,CACZ;CACD","sourcesContent":["import type { ImageContent, TextContent } from \"@agent-forge/ai\";\nimport {\n\tBox,\n\ttype Component,\n\tContainer,\n\tgetCapabilities,\n\tImage,\n\tSpacer,\n\tText,\n\ttype TUI,\n\ttruncateToWidth,\n} from \"@agent-forge/tui\";\nimport { t } from \"../../../core/i18n/index.ts\";\nimport { formatToolCallWithArgs, getTextOutput as getRenderedTextOutput } from \"../../../core/tools/render-utils.ts\";\nimport type { ToolDefinition, ToolRenderContext } from \"../../../core/tools/tool-definition.ts\";\nimport { theme } from \"../../../theme/theme.ts\";\nimport { convertToPng } from \"../../../utils/image-convert.ts\";\nimport { keyText } from \"./keybinding-hints.ts\";\n\n/** Visual (wrapped) result lines shown before fallback output is expanded. */\nconst FALLBACK_PREVIEW_LINES = 10;\n\n/**\n * 单条工具结果展示预算 (M2, 终端输出模式设计 §3.2「展开仍复用统一的输出截断」):\n * 任何渲染器 (含第三方插件) 的结果输出在视觉行上超过预算时, 保留 head+tail、\n * 中间以一行截断说明替代 (截断原因 + 总量 + 完整输出引用, 引用存在时)。这是\n * compact 预览之上的兜底——折叠态有自己的小预览, detail 态 (ctrl+o) 的全文\n * 渲染由此封顶。错误结果豁免 (错误可见性优先, 与 collapsedPreviewText 同惯例)。\n */\nconst TOOL_OUTPUT_MAX_LINES = 400;\n\n/** 预算超出时保留完整输出的末尾视觉行数 (错误摘要与结论常聚在输出末尾)。 */\nconst TOOL_OUTPUT_TAIL_LINES = 100;\n\n/**\n * Pretty-printed JSON up to this length is collapsed to its compact single-line\n * form; longer compact forms are cut here so a short tool-result ticket shows\n * as one preview line instead of sprawling across the chat. Expansion always\n * shows the original text.\n */\nconst COLLAPSED_JSON_PREVIEW_CHARS = 220;\n\n/**\n * Collapsed preview text for fallback results: pretty-printed JSON (the default\n * serialization for capability-tool results) becomes one compact line, and any\n * other text previews verbatim. Unparseable JSON-like text stays verbatim too.\n * Error results never compact — error visibility beats compactness, so they\n * keep the (threshold-limited) full form with the error background.\n */\nfunction collapsedPreviewText(output: string, isError: boolean): string {\n\tif (isError) {\n\t\treturn output;\n\t}\n\tconst trimmed = output.trimStart();\n\tif (!trimmed.startsWith(\"{\") && !trimmed.startsWith(\"[\")) {\n\t\treturn output;\n\t}\n\ttry {\n\t\tconst compact = JSON.stringify(JSON.parse(output));\n\t\treturn compact.length > COLLAPSED_JSON_PREVIEW_CHARS\n\t\t\t? `${compact.slice(0, COLLAPSED_JSON_PREVIEW_CHARS - 1)}…`\n\t\t\t: compact;\n\t} catch {\n\t\treturn output;\n\t}\n}\n\n/**\n * Collapsed fallback output limited to a number of visual (wrapped) lines. Limiting logical\n * lines instead lets a single long line (such as minified JSON) wrap across the whole screen.\n * Caches its lines per width, since it renders on every frame for every result in the transcript.\n */\nclass VisualLinePreview implements Component {\n\tprivate text: string;\n\tprivate maxVisualLines: number;\n\tprivate formatHint: (hidden: number) => string;\n\tprivate cachedWidth: number | undefined;\n\tprivate cachedLines: string[] | undefined;\n\n\tconstructor(text: string, maxVisualLines: number, formatHint: (hidden: number) => string) {\n\t\tthis.text = text;\n\t\tthis.maxVisualLines = maxVisualLines;\n\t\tthis.formatHint = formatHint;\n\t}\n\n\trender(width: number): string[] {\n\t\tif (this.cachedLines === undefined || this.cachedWidth !== width) {\n\t\t\tconst allVisualLines = new Text(this.text, 0, 0).render(width);\n\t\t\tconst lines =\n\t\t\t\tallVisualLines.length > this.maxVisualLines\n\t\t\t\t\t? [\n\t\t\t\t\t\t\t...allVisualLines.slice(0, this.maxVisualLines),\n\t\t\t\t\t\t\ttruncateToWidth(this.formatHint(allVisualLines.length - this.maxVisualLines), width, \"...\"),\n\t\t\t\t\t\t]\n\t\t\t\t\t: allVisualLines;\n\t\t\tthis.cachedLines = lines;\n\t\t\tthis.cachedWidth = width;\n\t\t\treturn lines;\n\t\t}\n\t\treturn this.cachedLines;\n\t}\n\n\tinvalidate(): void {\n\t\tthis.cachedWidth = undefined;\n\t\tthis.cachedLines = undefined;\n\t}\n}\n\n/**\n * bash 系工具在 details 携带的全量输出文件引用 (截断说明行的\"完整输出\"引用;\n * 终端输出模式设计 §3.2 的引用要求在通用层的最大努力形态)。\n */\nfunction resultFullOutputRef(details: unknown): string | undefined {\n\tif (details === null || typeof details !== \"object\" || Array.isArray(details)) return undefined;\n\tconst ref = (details as { fullOutputPath?: unknown }).fullOutputPath;\n\treturn typeof ref === \"string\" && ref.trim() !== \"\" ? ref : undefined;\n}\n\n/**\n * 结果渲染器输出的展示预算兜底 (M2): 包装 renderResult/fallback 产出的子组件,\n * render(width) 时对视觉行超预算的输出做 head+截断说明+tail。渲染器契约不变\n * (renderResult 仍收 expanded 原值, lastComponent 仍传裸子组件); 缓存按宽度,\n * invalidate 透传子组件 (流式增量渲染依赖它)。\n */\nclass BoundedResultView implements Component {\n\tprivate child: Component;\n\tprivate maxLines: number;\n\tprivate tailLines: number;\n\tprivate isError: boolean;\n\tprivate fullOutputRef: string | undefined;\n\tprivate cachedWidth: number | undefined;\n\tprivate cachedLines: string[] | undefined;\n\n\tconstructor(\n\t\tchild: Component,\n\t\tmaxLines: number,\n\t\ttailLines: number,\n\t\tisError: boolean,\n\t\tfullOutputRef: string | undefined,\n\t) {\n\t\tthis.child = child;\n\t\tthis.maxLines = maxLines;\n\t\tthis.tailLines = tailLines;\n\t\tthis.isError = isError;\n\t\tthis.fullOutputRef = fullOutputRef;\n\t}\n\n\trender(width: number): string[] {\n\t\tif (this.cachedLines === undefined || this.cachedWidth !== width) {\n\t\t\tconst lines = this.child.render(width);\n\t\t\tif (this.isError || lines.length <= this.maxLines) {\n\t\t\t\tthis.cachedLines = lines;\n\t\t\t} else {\n\t\t\t\tconst headLines = this.maxLines - this.tailLines - 1;\n\t\t\t\tconst hidden = lines.length - headLines - this.tailLines;\n\t\t\t\tconst hint =\n\t\t\t\t\tthis.fullOutputRef === undefined\n\t\t\t\t\t\t? t(\"... ({count} lines truncated)\", { count: hidden })\n\t\t\t\t\t\t: t(\"... ({count} lines truncated; full output: {path})\", {\n\t\t\t\t\t\t\t\tcount: hidden,\n\t\t\t\t\t\t\t\tpath: this.fullOutputRef,\n\t\t\t\t\t\t\t});\n\t\t\t\tthis.cachedLines = [\n\t\t\t\t\t...lines.slice(0, headLines),\n\t\t\t\t\ttruncateToWidth(theme.fg(\"muted\", hint), width, \"...\"),\n\t\t\t\t\t...lines.slice(lines.length - this.tailLines),\n\t\t\t\t];\n\t\t\t}\n\t\t\tthis.cachedWidth = width;\n\t\t\treturn this.cachedLines;\n\t\t}\n\t\treturn this.cachedLines;\n\t}\n\n\tinvalidate(): void {\n\t\tthis.child.invalidate();\n\t\tthis.cachedWidth = undefined;\n\t\tthis.cachedLines = undefined;\n\t}\n}\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 selfRenderContainer: Container;\n\tprivate callRendererComponent?: Component;\n\tprivate resultRendererComponent?: Component;\n\tprivate rendererState: Record<string, unknown> = {};\n\tprivate imageComponents: Image[] = [];\n\tprivate imageSpacers: Spacer[] = [];\n\tprivate toolName: string;\n\tprivate toolCallId: string;\n\tprivate args: unknown;\n\tprivate expanded = false;\n\tprivate showImages: boolean;\n\tprivate imageWidthCells: number;\n\tprivate isPartial = true;\n\tprivate toolDefinition?: ToolDefinition;\n\tprivate ui: TUI;\n\tprivate cwd: string;\n\tprivate executionStarted = false;\n\tprivate argsComplete = false;\n\tprivate result?: {\n\t\tcontent: (TextContent | ImageContent)[];\n\t\tisError: boolean;\n\t\tdetails?: unknown;\n\t};\n\tprivate convertedImages: Map<\n\t\tnumber,\n\t\t{ sourceData: string; sourceMimeType: string; data: string; mimeType: string }\n\t> = new Map();\n\tprivate hideComponent = false;\n\n\tconstructor(\n\t\ttoolName: string,\n\t\ttoolCallId: string,\n\t\targs: unknown,\n\t\toptions: ToolExecutionOptions = {},\n\t\ttoolDefinition: ToolDefinition | 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\t// The caller passes the session registry's definition\n\t\t// (interactive-mode getRegisteredToolDefinition → facade.getToolDefinition).\n\t\t// Since D-082 批 1 the default coding tool definitions live in the\n\t\t// coding-tools plugin, so the registry is the only definition source;\n\t\t// names missing from the registry render through the generic fallback.\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.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.contentText);\n\t\t}\n\n\t\tthis.updateDisplay();\n\t}\n\n\tprivate getCallRenderer(): ToolDefinition[\"renderCall\"] | undefined {\n\t\treturn this.toolDefinition?.renderCall;\n\t}\n\n\tprivate getResultRenderer(): ToolDefinition[\"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\tif (this.expanded) {\n\t\t\treturn new Text(\n\t\t\t\toutput\n\t\t\t\t\t.split(\"\\n\")\n\t\t\t\t\t.map((line) => theme.fg(\"toolOutput\", line))\n\t\t\t\t\t.join(\"\\n\"),\n\t\t\t\t0,\n\t\t\t\t0,\n\t\t\t);\n\t\t}\n\t\tconst previewText = collapsedPreviewText(output, this.result?.isError ?? false);\n\t\t// A compacted JSON preview is one line by construction, so it never\n\t\t// reaches the preview-line threshold — append the expand hint directly.\n\t\tif (previewText !== output) {\n\t\t\t// i18n: 原三段样式拼接合并为整句单 key,键位片段的 dim 样式损失按批次④特殊裁决 1 接受\n\t\t\tconst hint = theme.fg(\"muted\", t(\"({key} to expand)\", { key: keyText(\"app.tools.expand\") }));\n\t\t\treturn new Text(`${theme.fg(\"toolOutput\", previewText)} ${hint}`, 0, 0);\n\t\t}\n\t\tconst styled = previewText\n\t\t\t.split(\"\\n\")\n\t\t\t.map((line) => theme.fg(\"toolOutput\", line))\n\t\t\t.join(\"\\n\");\n\t\treturn new VisualLinePreview(styled, FALLBACK_PREVIEW_LINES, (hidden) =>\n\t\t\ttheme.fg(\n\t\t\t\t\"muted\",\n\t\t\t\tt(\"... ({count} more lines, {key} to expand)\", {\n\t\t\t\t\tcount: hidden,\n\t\t\t\t\tkey: keyText(\"app.tools.expand\"),\n\t\t\t\t}),\n\t\t\t),\n\t\t);\n\t}\n\n\t/** Failure fact for the enclosing ToolRunGroupComponent (D-083 quiet marker). */\n\tget isError(): boolean {\n\t\treturn this.result?.isError ?? false;\n\t}\n\n\t/** Tool name for the group marker's sole-tool form (restore path has no setActiveTool). */\n\tget name(): string {\n\t\treturn this.toolName;\n\t}\n\n\t/**\n\t * First non-empty line of a failed result's text output — the quiet group\n\t * marker's failure summary (D-083 增补:失败首行摘要). Successes and\n\t * result-less calls return undefined.\n\t */\n\tget errorSummary(): string | undefined {\n\t\tif (!this.result?.isError) return undefined;\n\t\treturn this.getTextOutput()\n\t\t\t.split(\"\\n\")\n\t\t\t.map((line) => line.trim())\n\t\t\t.find((line) => line !== \"\");\n\t}\n\n\t/**\n\t * Quiet-transcript image lines (D-083 增补:图片是用户可见的结论): the\n\t * collapsed group marker hides the text card but still renders result\n\t * images (desktop/browser screenshots). Empty when the result has no\n\t * renderable images.\n\t */\n\trenderQuietImages(width: number): string[] {\n\t\tconst lines: string[] = [];\n\t\tfor (let i = 0; i < this.imageComponents.length; i++) {\n\t\t\tconst spacer = this.imageSpacers[i];\n\t\t\t// v8 ignore next -- spacers and image components are always pushed in pairs\n\t\t\tif (spacer) {\n\t\t\t\tlines.push(...spacer.render(width));\n\t\t\t}\n\t\t\tconst imageComponent = this.imageComponents[i];\n\t\t\t// v8 ignore next -- spacers and image components are always pushed in pairs\n\t\t\tif (imageComponent) {\n\t\t\t\tlines.push(...imageComponent.render(width));\n\t\t\t}\n\t\t}\n\t\treturn lines;\n\t}\n\n\tupdateArgs(args: unknown): 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: (TextContent | ImageContent)[];\n\t\t\tdetails?: unknown;\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\tthis.maybeConvertImagesForKitty();\n\t}\n\n\tprivate maybeConvertImagesForKitty(): void {\n\t\tconst caps = getCapabilities();\n\t\tif (caps.images !== \"kitty\") return;\n\t\t// v8 ignore next -- sole caller updateResult always assigns this.result first\n\t\tif (!this.result) return;\n\n\t\tconst imageBlocks = this.result.content.filter((c) => c.type === \"image\");\n\t\tfor (let i = 0; i < imageBlocks.length; i++) {\n\t\t\tconst img = imageBlocks[i];\n\t\t\tif (!img.data || !img.mimeType) continue;\n\t\t\tconst sourceData = img.data;\n\t\t\tconst sourceMimeType = img.mimeType;\n\t\t\tif (sourceMimeType === \"image/png\") continue;\n\t\t\tconst cached = this.convertedImages.get(i);\n\t\t\tif (cached?.sourceData === sourceData && cached.sourceMimeType === sourceMimeType) continue;\n\n\t\t\tconst index = i;\n\t\t\tconvertToPng(sourceData, sourceMimeType).then((converted) => {\n\t\t\t\tconst currentImage = this.result?.content.filter((content) => content.type === \"image\")[index];\n\t\t\t\tif (!converted || currentImage?.data !== sourceData || currentImage.mimeType !== sourceMimeType) return;\n\t\t\t\tthis.convertedImages.set(index, {\n\t\t\t\t\tsourceData,\n\t\t\t\t\tsourceMimeType,\n\t\t\t\t\t...converted,\n\t\t\t\t});\n\t\t\t\tthis.updateDisplay();\n\t\t\t\tthis.ui.requestRender();\n\t\t\t});\n\t\t}\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\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\t// v8 ignore next -- spacers and image components are always pushed in pairs\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\t// v8 ignore next -- spacers and image components are always pushed in pairs\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\t/** M2 展示预算: 结果子组件统一过有界视图 (错误豁免), 见 BoundedResultView。 */\n\tprivate boundedResult(component: Component): Component {\n\t\treturn new BoundedResultView(\n\t\t\tcomponent,\n\t\t\tTOOL_OUTPUT_MAX_LINES,\n\t\t\tTOOL_OUTPUT_TAIL_LINES,\n\t\t\tthis.result?.isError ?? false,\n\t\t\tresultFullOutputRef(this.result?.details),\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.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\t// 渲染器可能返回 undefined(选择不渲染);此时交给无内容隐藏\n\t\t\t\t\t// 逻辑,不能把 undefined 塞进 Box.children(invalidate 会崩溃)。\n\t\t\t\t\tif (component) {\n\t\t\t\t\t\tthis.callRendererComponent = component;\n\t\t\t\t\t\trenderContainer.addChild(component);\n\t\t\t\t\t\thasContent = true;\n\t\t\t\t\t}\n\t\t\t\t} catch {\n\t\t\t\t\tthis.callRendererComponent = undefined;\n\t\t\t\t\trenderContainer.addChild(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.boundedResult(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, 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\tif (component) {\n\t\t\t\t\t\t\tthis.resultRendererComponent = component;\n\t\t\t\t\t\t\trenderContainer.addChild(this.boundedResult(component));\n\t\t\t\t\t\t\thasContent = true;\n\t\t\t\t\t\t}\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(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\tfor (const img of this.imageComponents) {\n\t\t\tthis.removeChild(img);\n\t\t}\n\t\tthis.imageComponents = [];\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 (let i = 0; i < imageBlocks.length; i++) {\n\t\t\t\tconst img = imageBlocks[i];\n\t\t\t\tif (caps.images && this.showImages && img.data && img.mimeType) {\n\t\t\t\t\tconst cached = this.convertedImages.get(i);\n\t\t\t\t\tconst converted =\n\t\t\t\t\t\tcached?.sourceData === img.data && cached.sourceMimeType === img.mimeType ? cached : undefined;\n\t\t\t\t\tconst imageData = converted?.data ?? img.data;\n\t\t\t\t\tconst imageMimeType = converted?.mimeType ?? img.mimeType;\n\t\t\t\t\tif (caps.images === \"kitty\" && imageMimeType !== \"image/png\") continue;\n\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 imageComponent = new Image(\n\t\t\t\t\t\timageData,\n\t\t\t\t\t\timageMimeType,\n\t\t\t\t\t\t{ fallbackColor: (s: string) => theme.fg(\"toolOutput\", s) },\n\t\t\t\t\t\t{ maxWidthCells: this.imageWidthCells },\n\t\t\t\t\t);\n\t\t\t\t\tthis.imageComponents.push(imageComponent);\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\t// 无定义工具的通用回退同样封顶 (M2, 逻辑行粒度): 超预算 head+说明+tail。\n\t\t\tconst lines = output.split(\"\\n\");\n\t\t\tif (lines.length <= TOOL_OUTPUT_MAX_LINES) {\n\t\t\t\ttext += `\\n${output}`;\n\t\t\t} else {\n\t\t\t\tconst headLines = TOOL_OUTPUT_MAX_LINES - TOOL_OUTPUT_TAIL_LINES - 1;\n\t\t\t\tconst hint = t(\"... ({count} lines truncated)\", {\n\t\t\t\t\tcount: lines.length - headLines - TOOL_OUTPUT_TAIL_LINES,\n\t\t\t\t});\n\t\t\t\ttext += `\\n${[\n\t\t\t\t\t...lines.slice(0, headLines),\n\t\t\t\t\thint,\n\t\t\t\t\t...lines.slice(lines.length - TOOL_OUTPUT_TAIL_LINES),\n\t\t\t\t].join(\"\\n\")}`;\n\t\t\t}\n\t\t}\n\t\treturn text;\n\t}\n}\n"]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Container } from "@agent-forge/tui";
|
|
2
|
+
import type { ToolExecutionComponent } from "./tool-execution.ts";
|
|
3
|
+
/**
|
|
4
|
+
* Quiet-transcript group for one assistant turn's tool calls (D-083,
|
|
5
|
+
* docs/design/终端输出模式设计.md §3). Collapsed (quiet, the default) it
|
|
6
|
+
* renders a single dim marker line — running tool name while executing, the
|
|
7
|
+
* tool count (or the sole tool's name) once complete, plus an error-colored
|
|
8
|
+
* failure count that never goes silent — followed by the first failing
|
|
9
|
+
* result's first output line and every result image (D-083 增补: the error
|
|
10
|
+
* text and screenshots are user-visible conclusions, not process noise).
|
|
11
|
+
* Expanded (detail, ctrl+o) it renders every child tool component in its
|
|
12
|
+
* expanded form.
|
|
13
|
+
*
|
|
14
|
+
* Collapsed render never renders the child text cards, so no per-tool card,
|
|
15
|
+
* kv arg line, or result preview leaks into the quiet transcript.
|
|
16
|
+
*/
|
|
17
|
+
export declare class ToolRunGroupComponent extends Container {
|
|
18
|
+
private tools;
|
|
19
|
+
private spacer;
|
|
20
|
+
private expanded;
|
|
21
|
+
private activeToolName;
|
|
22
|
+
private lastToolName;
|
|
23
|
+
private failedCount;
|
|
24
|
+
private runComplete;
|
|
25
|
+
constructor();
|
|
26
|
+
addTool(component: ToolExecutionComponent): void;
|
|
27
|
+
/** Current executing tool name (tool_execution_start); clears on completion. */
|
|
28
|
+
setActiveTool(name: string | undefined): void;
|
|
29
|
+
/** Count a finished tool result; errors keep the failure count visible. */
|
|
30
|
+
noteResult(isError: boolean): void;
|
|
31
|
+
/** The turn's tool run finished; the marker switches to its final form. */
|
|
32
|
+
markRunComplete(): void;
|
|
33
|
+
setExpanded(expanded: boolean): void;
|
|
34
|
+
invalidate(): void;
|
|
35
|
+
render(width: number): string[];
|
|
36
|
+
/**
|
|
37
|
+
* First failing tool's first output line, indented under the marker and
|
|
38
|
+
* cut to width (D-083 增补:失败内容可见,不用全局展开找一条错误).
|
|
39
|
+
*/
|
|
40
|
+
private firstErrorSummary;
|
|
41
|
+
private markerLine;
|
|
42
|
+
private markerLabel;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=tool-run-group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-run-group.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/tool-run-group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA2B,MAAM,kBAAkB,CAAC;AAGtE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAElE;;;;;;;;;;;;;GAaG;AACH,qBAAa,qBAAsB,SAAQ,SAAS;IACnD,OAAO,CAAC,KAAK,CAAgC;IAC7C,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,cAAc,CAAqB;IAC3C,OAAO,CAAC,YAAY,CAAqB;IACzC,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,WAAW,CAAS;IAE5B,cAMC;IAED,OAAO,CAAC,SAAS,EAAE,sBAAsB,GAAG,IAAI,CAM/C;IAED,gFAAgF;IAChF,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAK5C;IAED,2EAA2E;IAC3E,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAIjC;IAED,2EAA2E;IAC3E,eAAe,IAAI,IAAI,CAGtB;IAID,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAWnC;IAEQ,UAAU,IAAI,IAAI,CAE1B;IAEQ,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAavC;IAED;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAUzB,OAAO,CAAC,UAAU;IASlB,OAAO,CAAC,WAAW;CAUnB","sourcesContent":["import { Container, Spacer, truncateToWidth } from \"@agent-forge/tui\";\nimport { t } from \"../../../core/i18n/index.ts\";\nimport { theme } from \"../../../theme/theme.ts\";\nimport type { ToolExecutionComponent } from \"./tool-execution.ts\";\n\n/**\n * Quiet-transcript group for one assistant turn's tool calls (D-083,\n * docs/design/终端输出模式设计.md §3). Collapsed (quiet, the default) it\n * renders a single dim marker line — running tool name while executing, the\n * tool count (or the sole tool's name) once complete, plus an error-colored\n * failure count that never goes silent — followed by the first failing\n * result's first output line and every result image (D-083 增补: the error\n * text and screenshots are user-visible conclusions, not process noise).\n * Expanded (detail, ctrl+o) it renders every child tool component in its\n * expanded form.\n *\n * Collapsed render never renders the child text cards, so no per-tool card,\n * kv arg line, or result preview leaks into the quiet transcript.\n */\nexport class ToolRunGroupComponent extends Container {\n\tprivate tools: ToolExecutionComponent[] = [];\n\tprivate spacer = new Spacer(1);\n\tprivate expanded = false;\n\tprivate activeToolName: string | undefined;\n\tprivate lastToolName: string | undefined;\n\tprivate failedCount = 0;\n\tprivate runComplete = false;\n\n\tconstructor() {\n\t\tsuper();\n\t\t// Same transcript rhythm as a directly-mounted ToolExecutionComponent\n\t\t// (which leads with its own Spacer(1)): one blank line before the\n\t\t// marker line in quiet mode, before the child cards in detail mode.\n\t\tthis.addChild(this.spacer);\n\t}\n\n\taddTool(component: ToolExecutionComponent): void {\n\t\tthis.tools.push(component);\n\t\t// Seed the name so the sole-tool marker form survives the restore path,\n\t\t// which never sees a tool_execution_start (no setActiveTool call).\n\t\tthis.lastToolName = component.name;\n\t\tthis.addChild(component);\n\t}\n\n\t/** Current executing tool name (tool_execution_start); clears on completion. */\n\tsetActiveTool(name: string | undefined): void {\n\t\tthis.activeToolName = name;\n\t\tif (name !== undefined) {\n\t\t\tthis.lastToolName = name;\n\t\t}\n\t}\n\n\t/** Count a finished tool result; errors keep the failure count visible. */\n\tnoteResult(isError: boolean): void {\n\t\tif (isError) {\n\t\t\tthis.failedCount += 1;\n\t\t}\n\t}\n\n\t/** The turn's tool run finished; the marker switches to its final form. */\n\tmarkRunComplete(): void {\n\t\tthis.runComplete = true;\n\t\tthis.activeToolName = undefined;\n\t}\n\n\t// Not an override: Container declares no setExpanded; the Expandable\n\t// interface (interactive-dialog-ui.ts) matches structurally.\n\tsetExpanded(expanded: boolean): void {\n\t\tif (expanded === this.expanded) {\n\t\t\treturn;\n\t\t}\n\t\tthis.expanded = expanded;\n\t\t// Detail mode renders the children as full cards: propagate to every\n\t\t// child so an entire group flips with one ctrl+o press (the\n\t\t// setToolsExpanded loop only reaches this group component).\n\t\tfor (const tool of this.tools) {\n\t\t\ttool.setExpanded(expanded);\n\t\t}\n\t}\n\n\toverride invalidate(): void {\n\t\tsuper.invalidate();\n\t}\n\n\toverride render(width: number): string[] {\n\t\tif (this.expanded) {\n\t\t\treturn super.render(width);\n\t\t}\n\t\tconst lines = [...this.spacer.render(width), this.markerLine()];\n\t\tconst failure = this.firstErrorSummary(width);\n\t\tif (failure) {\n\t\t\tlines.push(failure);\n\t\t}\n\t\tfor (const tool of this.tools) {\n\t\t\tlines.push(...tool.renderQuietImages(width));\n\t\t}\n\t\treturn lines;\n\t}\n\n\t/**\n\t * First failing tool's first output line, indented under the marker and\n\t * cut to width (D-083 增补:失败内容可见,不用全局展开找一条错误).\n\t */\n\tprivate firstErrorSummary(width: number): string | undefined {\n\t\tfor (const tool of this.tools) {\n\t\t\tconst summary = tool.errorSummary;\n\t\t\tif (summary !== undefined) {\n\t\t\t\treturn ` ${theme.fg(\"error\", truncateToWidth(summary, Math.max(width - 1, 1), \"...\"))}`;\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate markerLine(): string {\n\t\tconst label = this.markerLabel();\n\t\tlet line = theme.fg(\"muted\", `⏺ ${label}`);\n\t\tif (this.failedCount > 0) {\n\t\t\tline += ` ${theme.fg(\"error\", `· ${t(\"{count} failed\", { count: this.failedCount })}`)}`;\n\t\t}\n\t\treturn line;\n\t}\n\n\tprivate markerLabel(): string {\n\t\tif (!this.runComplete && this.activeToolName !== undefined) {\n\t\t\treturn this.activeToolName;\n\t\t}\n\t\tif (this.runComplete && this.tools.length === 1 && this.lastToolName !== undefined) {\n\t\t\treturn this.lastToolName;\n\t\t}\n\t\tconst count = this.tools.length;\n\t\treturn t(count === 1 ? \"{count} tool\" : \"{count} tools\", { count });\n\t}\n}\n"]}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { Container, Spacer, truncateToWidth } from "@agent-forge/tui";
|
|
2
|
+
import { t } from "../../../core/i18n/index.js";
|
|
3
|
+
import { theme } from "../../../theme/theme.js";
|
|
4
|
+
/**
|
|
5
|
+
* Quiet-transcript group for one assistant turn's tool calls (D-083,
|
|
6
|
+
* docs/design/终端输出模式设计.md §3). Collapsed (quiet, the default) it
|
|
7
|
+
* renders a single dim marker line — running tool name while executing, the
|
|
8
|
+
* tool count (or the sole tool's name) once complete, plus an error-colored
|
|
9
|
+
* failure count that never goes silent — followed by the first failing
|
|
10
|
+
* result's first output line and every result image (D-083 增补: the error
|
|
11
|
+
* text and screenshots are user-visible conclusions, not process noise).
|
|
12
|
+
* Expanded (detail, ctrl+o) it renders every child tool component in its
|
|
13
|
+
* expanded form.
|
|
14
|
+
*
|
|
15
|
+
* Collapsed render never renders the child text cards, so no per-tool card,
|
|
16
|
+
* kv arg line, or result preview leaks into the quiet transcript.
|
|
17
|
+
*/
|
|
18
|
+
export class ToolRunGroupComponent extends Container {
|
|
19
|
+
tools = [];
|
|
20
|
+
spacer = new Spacer(1);
|
|
21
|
+
expanded = false;
|
|
22
|
+
activeToolName;
|
|
23
|
+
lastToolName;
|
|
24
|
+
failedCount = 0;
|
|
25
|
+
runComplete = false;
|
|
26
|
+
constructor() {
|
|
27
|
+
super();
|
|
28
|
+
// Same transcript rhythm as a directly-mounted ToolExecutionComponent
|
|
29
|
+
// (which leads with its own Spacer(1)): one blank line before the
|
|
30
|
+
// marker line in quiet mode, before the child cards in detail mode.
|
|
31
|
+
this.addChild(this.spacer);
|
|
32
|
+
}
|
|
33
|
+
addTool(component) {
|
|
34
|
+
this.tools.push(component);
|
|
35
|
+
// Seed the name so the sole-tool marker form survives the restore path,
|
|
36
|
+
// which never sees a tool_execution_start (no setActiveTool call).
|
|
37
|
+
this.lastToolName = component.name;
|
|
38
|
+
this.addChild(component);
|
|
39
|
+
}
|
|
40
|
+
/** Current executing tool name (tool_execution_start); clears on completion. */
|
|
41
|
+
setActiveTool(name) {
|
|
42
|
+
this.activeToolName = name;
|
|
43
|
+
if (name !== undefined) {
|
|
44
|
+
this.lastToolName = name;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/** Count a finished tool result; errors keep the failure count visible. */
|
|
48
|
+
noteResult(isError) {
|
|
49
|
+
if (isError) {
|
|
50
|
+
this.failedCount += 1;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/** The turn's tool run finished; the marker switches to its final form. */
|
|
54
|
+
markRunComplete() {
|
|
55
|
+
this.runComplete = true;
|
|
56
|
+
this.activeToolName = undefined;
|
|
57
|
+
}
|
|
58
|
+
// Not an override: Container declares no setExpanded; the Expandable
|
|
59
|
+
// interface (interactive-dialog-ui.ts) matches structurally.
|
|
60
|
+
setExpanded(expanded) {
|
|
61
|
+
if (expanded === this.expanded) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
this.expanded = expanded;
|
|
65
|
+
// Detail mode renders the children as full cards: propagate to every
|
|
66
|
+
// child so an entire group flips with one ctrl+o press (the
|
|
67
|
+
// setToolsExpanded loop only reaches this group component).
|
|
68
|
+
for (const tool of this.tools) {
|
|
69
|
+
tool.setExpanded(expanded);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
invalidate() {
|
|
73
|
+
super.invalidate();
|
|
74
|
+
}
|
|
75
|
+
render(width) {
|
|
76
|
+
if (this.expanded) {
|
|
77
|
+
return super.render(width);
|
|
78
|
+
}
|
|
79
|
+
const lines = [...this.spacer.render(width), this.markerLine()];
|
|
80
|
+
const failure = this.firstErrorSummary(width);
|
|
81
|
+
if (failure) {
|
|
82
|
+
lines.push(failure);
|
|
83
|
+
}
|
|
84
|
+
for (const tool of this.tools) {
|
|
85
|
+
lines.push(...tool.renderQuietImages(width));
|
|
86
|
+
}
|
|
87
|
+
return lines;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* First failing tool's first output line, indented under the marker and
|
|
91
|
+
* cut to width (D-083 增补:失败内容可见,不用全局展开找一条错误).
|
|
92
|
+
*/
|
|
93
|
+
firstErrorSummary(width) {
|
|
94
|
+
for (const tool of this.tools) {
|
|
95
|
+
const summary = tool.errorSummary;
|
|
96
|
+
if (summary !== undefined) {
|
|
97
|
+
return ` ${theme.fg("error", truncateToWidth(summary, Math.max(width - 1, 1), "..."))}`;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
markerLine() {
|
|
103
|
+
const label = this.markerLabel();
|
|
104
|
+
let line = theme.fg("muted", `⏺ ${label}`);
|
|
105
|
+
if (this.failedCount > 0) {
|
|
106
|
+
line += ` ${theme.fg("error", `· ${t("{count} failed", { count: this.failedCount })}`)}`;
|
|
107
|
+
}
|
|
108
|
+
return line;
|
|
109
|
+
}
|
|
110
|
+
markerLabel() {
|
|
111
|
+
if (!this.runComplete && this.activeToolName !== undefined) {
|
|
112
|
+
return this.activeToolName;
|
|
113
|
+
}
|
|
114
|
+
if (this.runComplete && this.tools.length === 1 && this.lastToolName !== undefined) {
|
|
115
|
+
return this.lastToolName;
|
|
116
|
+
}
|
|
117
|
+
const count = this.tools.length;
|
|
118
|
+
return t(count === 1 ? "{count} tool" : "{count} tools", { count });
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=tool-run-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-run-group.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/tool-run-group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,CAAC,EAAE,MAAM,6BAA6B,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAGhD;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,qBAAsB,SAAQ,SAAS;IAC3C,KAAK,GAA6B,EAAE,CAAC;IACrC,MAAM,GAAG,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC;IACvB,QAAQ,GAAG,KAAK,CAAC;IACjB,cAAc,CAAqB;IACnC,YAAY,CAAqB;IACjC,WAAW,GAAG,CAAC,CAAC;IAChB,WAAW,GAAG,KAAK,CAAC;IAE5B,cAAc;QACb,KAAK,EAAE,CAAC;QACR,sEAAsE;QACtE,kEAAkE;QAClE,oEAAoE;QACpE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAAA,CAC3B;IAED,OAAO,CAAC,SAAiC,EAAQ;QAChD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC3B,wEAAwE;QACxE,mEAAmE;QACnE,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC,IAAI,CAAC;QACnC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAAA,CACzB;IAED,gFAAgF;IAChF,aAAa,CAAC,IAAwB,EAAQ;QAC7C,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC3B,IAAI,IAAI,KAAK,SAAS,EAAE,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AK,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;YACpF,OAAO,IAAI,CAAC,YAAY,CAAC;QAC1B,CAAC;QACD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;QAChC,OAAO,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,eAAe,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IAAA,CACpE;CACD","sourcesContent":["import { Container, Spacer, truncateToWidth } from \"@agent-forge/tui\";\nimport { t } from \"../../../core/i18n/index.ts\";\nimport { theme } from \"../../../theme/theme.ts\";\nimport type { ToolExecutionComponent } from \"./tool-execution.ts\";\n\n/**\n * Quiet-transcript group for one assistant turn's tool calls (D-083,\n * docs/design/终端输出模式设计.md §3). Collapsed (quiet, the default) it\n * renders a single dim marker line — running tool name while executing, the\n * tool count (or the sole tool's name) once complete, plus an error-colored\n * failure count that never goes silent — followed by the first failing\n * result's first output line and every result image (D-083 增补: the error\n * text and screenshots are user-visible conclusions, not process noise).\n * Expanded (detail, ctrl+o) it renders every child tool component in its\n * expanded form.\n *\n * Collapsed render never renders the child text cards, so no per-tool card,\n * kv arg line, or result preview leaks into the quiet transcript.\n */\nexport class ToolRunGroupComponent extends Container {\n\tprivate tools: ToolExecutionComponent[] = [];\n\tprivate spacer = new Spacer(1);\n\tprivate expanded = false;\n\tprivate activeToolName: string | undefined;\n\tprivate lastToolName: string | undefined;\n\tprivate failedCount = 0;\n\tprivate runComplete = false;\n\n\tconstructor() {\n\t\tsuper();\n\t\t// Same transcript rhythm as a directly-mounted ToolExecutionComponent\n\t\t// (which leads with its own Spacer(1)): one blank line before the\n\t\t// marker line in quiet mode, before the child cards in detail mode.\n\t\tthis.addChild(this.spacer);\n\t}\n\n\taddTool(component: ToolExecutionComponent): void {\n\t\tthis.tools.push(component);\n\t\t// Seed the name so the sole-tool marker form survives the restore path,\n\t\t// which never sees a tool_execution_start (no setActiveTool call).\n\t\tthis.lastToolName = component.name;\n\t\tthis.addChild(component);\n\t}\n\n\t/** Current executing tool name (tool_execution_start); clears on completion. */\n\tsetActiveTool(name: string | undefined): void {\n\t\tthis.activeToolName = name;\n\t\tif (name !== undefined) {\n\t\t\tthis.lastToolName = name;\n\t\t}\n\t}\n\n\t/** Count a finished tool result; errors keep the failure count visible. */\n\tnoteResult(isError: boolean): void {\n\t\tif (isError) {\n\t\t\tthis.failedCount += 1;\n\t\t}\n\t}\n\n\t/** The turn's tool run finished; the marker switches to its final form. */\n\tmarkRunComplete(): void {\n\t\tthis.runComplete = true;\n\t\tthis.activeToolName = undefined;\n\t}\n\n\t// Not an override: Container declares no setExpanded; the Expandable\n\t// interface (interactive-dialog-ui.ts) matches structurally.\n\tsetExpanded(expanded: boolean): void {\n\t\tif (expanded === this.expanded) {\n\t\t\treturn;\n\t\t}\n\t\tthis.expanded = expanded;\n\t\t// Detail mode renders the children as full cards: propagate to every\n\t\t// child so an entire group flips with one ctrl+o press (the\n\t\t// setToolsExpanded loop only reaches this group component).\n\t\tfor (const tool of this.tools) {\n\t\t\ttool.setExpanded(expanded);\n\t\t}\n\t}\n\n\toverride invalidate(): void {\n\t\tsuper.invalidate();\n\t}\n\n\toverride render(width: number): string[] {\n\t\tif (this.expanded) {\n\t\t\treturn super.render(width);\n\t\t}\n\t\tconst lines = [...this.spacer.render(width), this.markerLine()];\n\t\tconst failure = this.firstErrorSummary(width);\n\t\tif (failure) {\n\t\t\tlines.push(failure);\n\t\t}\n\t\tfor (const tool of this.tools) {\n\t\t\tlines.push(...tool.renderQuietImages(width));\n\t\t}\n\t\treturn lines;\n\t}\n\n\t/**\n\t * First failing tool's first output line, indented under the marker and\n\t * cut to width (D-083 增补:失败内容可见,不用全局展开找一条错误).\n\t */\n\tprivate firstErrorSummary(width: number): string | undefined {\n\t\tfor (const tool of this.tools) {\n\t\t\tconst summary = tool.errorSummary;\n\t\t\tif (summary !== undefined) {\n\t\t\t\treturn ` ${theme.fg(\"error\", truncateToWidth(summary, Math.max(width - 1, 1), \"...\"))}`;\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tprivate markerLine(): string {\n\t\tconst label = this.markerLabel();\n\t\tlet line = theme.fg(\"muted\", `⏺ ${label}`);\n\t\tif (this.failedCount > 0) {\n\t\t\tline += ` ${theme.fg(\"error\", `· ${t(\"{count} failed\", { count: this.failedCount })}`)}`;\n\t\t}\n\t\treturn line;\n\t}\n\n\tprivate markerLabel(): string {\n\t\tif (!this.runComplete && this.activeToolName !== undefined) {\n\t\t\treturn this.activeToolName;\n\t\t}\n\t\tif (this.runComplete && this.tools.length === 1 && this.lastToolName !== undefined) {\n\t\t\treturn this.lastToolName;\n\t\t}\n\t\tconst count = this.tools.length;\n\t\treturn t(count === 1 ? \"{count} tool\" : \"{count} tools\", { count });\n\t}\n}\n"]}
|