dal-code 1.0.50 → 1.0.51
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 +1039 -5
- package/dist/bundle/chunks/anthropic-messages-2P3UGLIO.js +5 -0
- package/dist/bundle/chunks/anthropic.js +74 -0
- package/dist/bundle/chunks/azure-openai-responses-S4GNH2XC.js +1 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +88 -0
- package/dist/bundle/chunks/chunk-2KOJ4RNS.js +43 -0
- package/dist/bundle/chunks/chunk-3YGHTGYM.js +7 -0
- package/dist/bundle/chunks/chunk-4LDEEFCY.js +1 -0
- package/dist/bundle/chunks/chunk-4UTLMBZZ.js +13 -0
- package/dist/bundle/chunks/chunk-567OJLS7.js +1 -0
- package/dist/bundle/chunks/chunk-5AGIVGSV.js +5 -0
- package/dist/bundle/chunks/chunk-6QGV3IWD.js +5 -0
- package/dist/bundle/chunks/chunk-723ZGEZ2.js +1 -0
- package/dist/bundle/chunks/chunk-7DDKXS2Q.js +1 -0
- package/dist/bundle/chunks/chunk-7ZC4UXSL.js +1 -0
- package/dist/bundle/chunks/chunk-AL7NZVPP.js +1 -0
- package/dist/bundle/chunks/chunk-ATQJO2OE.js +3 -0
- package/dist/bundle/chunks/chunk-B7NRFMLU.js +8 -0
- package/dist/bundle/chunks/chunk-BEDAM2M7.js +81 -0
- package/dist/bundle/chunks/chunk-CF5GWZHW.js +30 -0
- package/dist/bundle/chunks/chunk-CFPQOC7P.js +1 -0
- package/dist/bundle/chunks/chunk-D2WTLI2T.js +19 -0
- package/dist/bundle/chunks/chunk-EH7SFF47.js +129 -0
- package/dist/bundle/chunks/chunk-FCKLBLA4.js +1 -0
- package/dist/bundle/chunks/chunk-FFMDRXC4.js +9 -0
- package/dist/bundle/chunks/chunk-GSGE3ULF.js +15 -0
- package/dist/bundle/chunks/chunk-H5FHS6BV.js +1 -0
- package/dist/bundle/chunks/chunk-HXK5EFBE.js +1172 -0
- package/dist/bundle/chunks/chunk-IEBK4HQA.js +1 -0
- package/dist/bundle/chunks/chunk-JE6UXK35.js +30 -0
- package/dist/bundle/chunks/chunk-JXWJOIH4.js +1 -0
- package/dist/bundle/chunks/chunk-K7VBBYTT.js +1 -0
- package/dist/bundle/chunks/chunk-L2ZPNLYD.js +1 -0
- package/dist/bundle/chunks/chunk-LVVZS2NO.js +11 -0
- package/dist/bundle/chunks/chunk-ML5DIOWR.js +1 -0
- package/dist/bundle/chunks/chunk-NUIR7PPD.js +25 -0
- package/dist/bundle/chunks/chunk-P7FPUEYA.js +1 -0
- package/dist/bundle/chunks/chunk-PGXDEOVV.js +1 -0
- package/dist/bundle/chunks/chunk-PJACZCIR.js +1 -0
- package/dist/bundle/chunks/chunk-PRRNXB7S.js +1 -0
- package/dist/bundle/chunks/chunk-PWZRJWNP.js +17 -0
- package/dist/bundle/chunks/chunk-R44HF4S5.js +9 -0
- package/dist/bundle/chunks/chunk-R47JBGS3.js +1 -0
- package/dist/bundle/chunks/chunk-RCVVRHMF.js +9 -0
- package/dist/bundle/chunks/chunk-RDZVAGPR.js +1 -0
- package/dist/bundle/chunks/chunk-RR3ZP63P.js +56 -0
- package/dist/bundle/chunks/chunk-SE42OS3U.js +21 -0
- package/dist/bundle/chunks/chunk-TMTOQ7H7.js +1 -0
- package/dist/bundle/chunks/chunk-UTB4DTYQ.js +1 -0
- package/dist/bundle/chunks/chunk-VNHNHA4V.js +1 -0
- package/dist/bundle/chunks/chunk-XJFQKN3N.js +2 -0
- package/dist/bundle/chunks/chunk-ZG74NES2.js +1 -0
- package/dist/bundle/chunks/cli-FWMQKBFA.js +30 -0
- package/dist/bundle/chunks/cli-ZEDY5U67.js +52 -0
- package/dist/bundle/chunks/cloudflare-workers-ai-system-one-E6TEENDO.js +1 -0
- package/dist/bundle/chunks/codemode-worker.js +480 -0
- package/dist/bundle/chunks/dist-D3WIBXB5.js +10 -0
- package/dist/bundle/chunks/easter-egg-3d-5TFBCTIS.js +1 -0
- package/dist/bundle/chunks/execute-62LDYHXA.js +506 -0
- package/dist/bundle/chunks/github-copilot.js +1 -0
- package/dist/bundle/chunks/google-generative-ai-V5DLXTF7.js +1 -0
- package/dist/bundle/chunks/google-vertex-K3KYGGLI.js +1 -0
- package/dist/bundle/chunks/http-proxy-KF35JLJN.js +1 -0
- package/dist/bundle/chunks/https-proxy-agent-LVOO5TPL.js +12 -0
- package/dist/bundle/chunks/image-resize-worker.js +1 -0
- package/dist/bundle/chunks/jiti-loader-GL4HJFAD.js +20 -0
- package/dist/bundle/chunks/jiti-static-loader-2RCDI6B4.js +1 -0
- package/dist/bundle/chunks/kimi-coding.js +1 -0
- package/dist/bundle/chunks/lib-4AVRLBHM.js +8 -0
- package/dist/bundle/chunks/llama-cpp-classify-JCTIEHTL.js +21 -0
- package/dist/bundle/chunks/mcp-VF7EY5WC.js +10 -0
- package/dist/bundle/chunks/meta.js +1 -0
- package/dist/bundle/chunks/mistral-conversations-LVBXTF6R.js +4 -0
- package/dist/bundle/chunks/multipart-parser-FMGQ7342.js +2 -0
- package/dist/bundle/chunks/node-AUOGOBCN.js +1 -0
- package/dist/bundle/chunks/node-ZTHARAQV.js +15 -0
- package/dist/bundle/chunks/office-PONBADQP.js +419 -0
- package/dist/bundle/chunks/openai-chatgpt.js +74 -0
- package/dist/bundle/chunks/openai-codex-responses-WBZKNYLX.js +9 -0
- package/dist/bundle/chunks/openai-codex.js +74 -0
- package/dist/bundle/chunks/openai-completions-HMHQRGX4.js +6 -0
- package/dist/bundle/chunks/openai-decisions-R7OFRKLL.js +4 -0
- package/dist/bundle/chunks/openai-responses-BHXRQFCI.js +3 -0
- package/dist/bundle/chunks/openrouter-images-BIMNIXQZ.js +1 -0
- package/dist/bundle/chunks/openrouter.js +74 -0
- package/dist/bundle/chunks/pi-messages-X5YTLXQJ.js +7 -0
- package/dist/bundle/chunks/radius.js +74 -0
- package/dist/bundle/chunks/review-WCGIBVLM.js +80 -0
- package/dist/bundle/chunks/rewind-2OYLDDHH.js +8 -0
- package/dist/bundle/chunks/router-7E5LU7US.js +3 -0
- package/dist/bundle/chunks/runtime-5PTUOEM2.js +1 -0
- package/dist/bundle/chunks/sdk-ZUFIGPSS.js +1 -0
- package/dist/bundle/chunks/src-QKGKDFSU.js +3 -0
- package/dist/bundle/chunks/sync-LOX6TIM6.js +4 -0
- package/dist/bundle/chunks/typesafe-system-one-KOIOG3HP.js +1 -0
- package/dist/bundle/chunks/usage-2EVEFGNI.js +1 -0
- package/dist/bundle/chunks/virtual-modules-MYMONT3Y.js +1 -0
- package/dist/bundle/chunks/xai.js +1 -0
- package/dist/bundle/cli-runtime.js +2 -0
- package/dist/bundle/cli.js +2 -0
- package/dist/bundle/index.js +1 -0
- package/dist/bundle/rpc-entry.js +2 -0
- package/dist/cli/args.js +1 -1
- package/dist/cli/auth-command.js +9 -6
- package/dist/cli/auth-login.js +2 -0
- package/dist/cli/auth-logout.js +1 -0
- package/dist/cli/auth-terminal.js +5 -0
- package/dist/cli/config-selector.js +1 -1
- package/dist/config.d.ts +5 -0
- package/dist/config.js +1 -1
- package/dist/core/agent-session-runtime.js +1 -1
- package/dist/core/agent-session-services.js +1 -1
- package/dist/core/agent-session.d.ts +8 -1
- package/dist/core/agent-session.js +12 -9
- package/dist/core/auth-storage.js +1 -1
- package/dist/core/bash-executor.js +1 -1
- package/dist/core/bug-report.js +3 -3
- package/dist/core/cache-warmer.d.ts +3 -15
- package/dist/core/cache-warmer.js +1 -1
- package/dist/core/compaction/branch-summarization.d.ts +3 -2
- package/dist/core/compaction/branch-summarization.js +5 -5
- package/dist/core/compaction/compaction.d.ts +1 -0
- package/dist/core/compaction/compaction.js +14 -14
- package/dist/core/compaction/tool-output-pruning.js +1 -1
- package/dist/core/compaction/utils.d.ts +0 -1
- package/dist/core/compaction/utils.js +8 -8
- package/dist/core/exec.d.ts +2 -0
- package/dist/core/exec.js +1 -1
- package/dist/core/export-html/template.css +9 -0
- package/dist/core/export-html/template.js +46 -39
- package/dist/core/export-html/tool-renderer.js +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/loader.js +1 -1
- package/dist/core/extensions/pi-ai-extension-view.js +1 -0
- package/dist/core/extensions/runner.js +1 -1
- package/dist/core/extensions/types.d.ts +25 -7
- package/dist/core/extensions/virtual-modules.js +1 -1
- package/dist/core/keybindings.d.ts +1 -1
- package/dist/core/keybindings.js +1 -1
- package/dist/core/mcp-servers.d.ts +6 -17
- package/dist/core/mcp-servers.js +1 -1
- package/dist/core/model-config.d.ts +1912 -2211
- package/dist/core/model-config.js +4 -4
- package/dist/core/model-resolver.js +1 -1
- package/dist/core/model-runtime.d.ts +1 -0
- package/dist/core/model-runtime.js +1 -1
- package/dist/core/package-manager.d.ts +10 -1
- package/dist/core/package-manager.js +2 -2
- package/dist/core/pi-ai-schemas.js +1 -0
- package/dist/core/pi-manifest.js +1 -1
- package/dist/core/preferred-providers.js +1 -0
- package/dist/core/project-trust.js +2 -2
- package/dist/core/prompt-templates.js +2 -2
- package/dist/core/provider-composer.js +1 -1
- package/dist/core/provider-matching.js +1 -0
- package/dist/core/radius-mcp.js +1 -0
- package/dist/core/remote-catalog-provider.js +1 -1
- package/dist/core/resource-loader.d.ts +3 -1
- package/dist/core/resource-loader.js +1 -1
- package/dist/core/runtime-credentials.js +1 -1
- package/dist/core/sdk.js +1 -1
- package/dist/core/session-cwd.js +3 -7
- package/dist/core/session-manager.d.ts +1 -0
- package/dist/core/session-manager.js +12 -12
- package/dist/core/settings-defaults.js +1 -1
- package/dist/core/settings-manager.d.ts +4 -0
- package/dist/core/settings-manager.js +1 -1
- package/dist/core/settings-schema.d.ts +4 -2
- package/dist/core/settings-schema.js +1 -1
- package/dist/core/skills.js +3 -3
- package/dist/core/slash-commands.js +1 -1
- package/dist/core/source-info.d.ts +8 -0
- package/dist/core/source-info.js +1 -1
- package/dist/core/system-prompt.js +3 -3
- package/dist/core/tools/bash.d.ts +2 -2
- package/dist/core/tools/bash.js +15 -15
- package/dist/core/tools/edit-diff.d.ts +9 -4
- package/dist/core/tools/edit-diff.js +22 -15
- package/dist/core/tools/edit.d.ts +3 -3
- package/dist/core/tools/edit.js +3 -3
- package/dist/core/tools/find.d.ts +2 -2
- package/dist/core/tools/find.js +10 -11
- package/dist/core/tools/grep.d.ts +3 -3
- package/dist/core/tools/grep.js +8 -12
- package/dist/core/tools/ls.d.ts +2 -2
- package/dist/core/tools/ls.js +4 -4
- package/dist/core/tools/powershell.js +6 -2
- package/dist/core/tools/read.d.ts +5 -2
- package/dist/core/tools/read.js +20 -19
- package/dist/core/tools/render-utils.js +5 -5
- package/dist/core/tools/renderers/write.js +10 -10
- package/dist/core/tools/tool-definition-wrapper.d.ts +11 -0
- package/dist/core/tools/truncate.d.ts +2 -8
- package/dist/core/tools/truncate.js +10 -10
- package/dist/core/tools/write.d.ts +2 -2
- package/dist/core/trust-manager.js +2 -2
- package/dist/core/usage-totals.js +1 -1
- package/dist/extensions/codemode/execute.js +12 -12
- package/dist/extensions/codemode/renderer.js +6 -6
- package/dist/extensions/codemode/tool.d.ts +2 -1
- package/dist/extensions/codemode/tool.js +11 -10
- package/dist/extensions/llama/client.js +5 -5
- package/dist/extensions/llama/ui.js +2 -2
- package/dist/extensions/mcp/cli.js +21 -19
- package/dist/extensions/mcp/config.js +2 -2
- package/dist/extensions/mcp/index.js +7 -7
- package/dist/extensions/mcp/oauth.d.ts +3 -22
- package/dist/extensions/mcp/oauth.js +2 -2
- package/dist/extensions/mcp/resources.d.ts +1 -1
- package/dist/extensions/mcp/resources.js +1 -1
- package/dist/extensions/mcp/runtime.d.ts +2 -2
- package/dist/extensions/mcp/runtime.js +3 -3
- package/dist/extensions/mcp/tools.d.ts +1 -8
- package/dist/extensions/mcp/tools.js +4 -9
- package/dist/extensions/mcp/ui.js +1 -1
- package/dist/extensions/tool-search/tool.js +4 -4
- package/dist/index.d.ts +2 -2
- package/dist/main.js +4 -4
- package/dist/modes/interactive/components/assistant-message.d.ts +4 -1
- package/dist/modes/interactive/components/assistant-message.js +2 -2
- package/dist/modes/interactive/components/branch-summary-message.d.ts +5 -1
- package/dist/modes/interactive/components/branch-summary-message.js +2 -2
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +5 -1
- package/dist/modes/interactive/components/compaction-summary-message.js +2 -2
- package/dist/modes/interactive/components/config-selector.js +1 -1
- package/dist/modes/interactive/components/custom-editor.js +1 -1
- package/dist/modes/interactive/components/custom-entry.js +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts +5 -2
- package/dist/modes/interactive/components/custom-message.js +3 -3
- package/dist/modes/interactive/components/diff.js +3 -3
- package/dist/modes/interactive/components/extension-editor.d.ts +1 -0
- package/dist/modes/interactive/components/extension-editor.js +1 -1
- package/dist/modes/interactive/components/extension-selector.js +2 -2
- package/dist/modes/interactive/components/login-dialog.d.ts +5 -0
- package/dist/modes/interactive/components/login-dialog.js +1 -1
- package/dist/modes/interactive/components/markdown-transform.js +1 -1
- package/dist/modes/interactive/components/mermaid.js +4 -4
- package/dist/modes/interactive/components/model-selector.d.ts +1 -0
- package/dist/modes/interactive/components/model-selector.js +2 -2
- package/dist/modes/interactive/components/oauth-selector.d.ts +2 -1
- package/dist/modes/interactive/components/oauth-selector.js +1 -1
- package/dist/modes/interactive/components/provider-brand.js +1 -0
- package/dist/modes/interactive/components/radius-login-selector.js +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.js +1 -1
- package/dist/modes/interactive/components/session-selector-search.js +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts +2 -1
- package/dist/modes/interactive/components/session-selector.js +2 -2
- package/dist/modes/interactive/components/settings-submenu.js +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +5 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +2 -2
- package/dist/modes/interactive/components/tool-execution.d.ts +1 -0
- package/dist/modes/interactive/components/tool-execution.js +3 -3
- package/dist/modes/interactive/components/tree-selector.d.ts +2 -0
- package/dist/modes/interactive/components/tree-selector.js +1 -1
- package/dist/modes/interactive/components/user-message-selector.d.ts +1 -0
- package/dist/modes/interactive/components/user-message-selector.js +1 -1
- package/dist/modes/interactive/components/user-message.d.ts +2 -1
- package/dist/modes/interactive/components/user-message.js +1 -1
- package/dist/modes/interactive/external-editor.js +3 -3
- package/dist/modes/interactive/interactive-mode.d.ts +10 -1
- package/dist/modes/interactive/interactive-mode.js +45 -40
- package/dist/modes/interactive/model-search.js +1 -1
- package/dist/modes/interactive/theme/theme.d.ts +4 -0
- package/dist/modes/interactive/theme/theme.js +3 -6
- package/dist/modes/print-mode.js +7 -7
- package/dist/modes/rpc/rpc-mode.js +1 -1
- package/dist/node_modules/@dalcode/dal-advisor/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-awake/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-bridge/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-capabilities/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-codeindex/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-compat/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-dap/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-gateway/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-goal/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-guard/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-halo/package.json +1 -1
- package/dist/node_modules/@dalcode/dal-interactive/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-lang/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-learn/package.json +3 -2
- package/dist/node_modules/@dalcode/dal-learn/src/index.js +16 -16
- package/dist/node_modules/@dalcode/dal-learn/src/lesson-events.js +1 -0
- package/dist/node_modules/@dalcode/dal-lsp/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-mcp/package.json +6 -6
- package/dist/node_modules/@dalcode/dal-office/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js +3 -2
- package/dist/node_modules/@dalcode/dal-pi-kit/package.json +1 -1
- package/dist/node_modules/@dalcode/dal-pi-kit/src/i18n.js +4 -3
- package/dist/node_modules/@dalcode/dal-plugins/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-recall/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-remote/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-review/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-rewind/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-router/package.json +6 -6
- package/dist/node_modules/@dalcode/dal-rtk/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-skills/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-statusline/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-structured/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-subagent/package.json +5 -5
- package/dist/node_modules/@dalcode/dal-sync/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-telemetry/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-terminal/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-tool-catalog/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-usage/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-web/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-workflow/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-workflow/src/todo-snapshot.js +2 -2
- package/dist/node_modules/@dalcode/dal-workflow/src/todo.js +3 -3
- package/dist/node_modules/@dalcode/deepailab/package.json +3 -3
- package/dist/node_modules/@earendil-works/pi-agent-core/README.md +8 -6
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts +1 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/proxy.js +2 -2
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +8 -5
- package/dist/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
- package/dist/node_modules/@earendil-works/pi-ai/README.md +58 -39
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +5 -5
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.lazy.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.lazy.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/constrained-sampling.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-shared.js +2 -2
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/lazy.d.ts +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/lazy.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +4 -4
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts +2 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +5 -5
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js +9 -9
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +3 -3
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js +3 -3
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/strict-tool-limits.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/kimi-coding.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/load.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/meta.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/radius.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/trusted-url.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/auth/types.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/cache-warming.d.ts +21 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/cache-warming.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/cli.js +5 -5
- package/dist/node_modules/@earendil-works/pi-ai/dist/compat/extension-oauth-types.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/index.d.ts +3 -3
- package/dist/node_modules/@earendil-works/pi-ai/dist/index.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/lazy-bedrock-provider.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/lazy-oauth.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/models.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +4 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/models.generated.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/models.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/all.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/compat-schema.d.ts +485 -498
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/compat-schema.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/anthropic.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/azure.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/baseten.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-workers-ai.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/google-vertex.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/google.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/kimi-coding.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/meta.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/mistral.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/moonshotai-cn.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/moonshotai.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openai-codex.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openai.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-cn.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-individual-cn.json +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-individual.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/radius.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/together.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/xai.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-ams.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-cn.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-sgp.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/zai-coding-cn.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/zai.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/faux.js +5 -5
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/model-schema.d.ts +65 -65
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/model-schema.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual-cn.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual-cn.models.d.ts +5 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual-cn.models.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/radius-config.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/schema-builders.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/telemetry.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/types.d.ts +4 -3
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/error-body.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/openrouter-cost.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/retry.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/streaming-json.d.ts +26 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/streaming-json.js +4 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/{typebox-helpers.d.ts → string-enum.d.ts} +2 -2
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/string-enum.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/text.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/text.js +2 -2
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/validation.js +4 -4
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/version.d.ts +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/version.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/package.json +12 -5
- package/dist/node_modules/@earendil-works/pi-codemode/README.md +2 -2
- package/dist/node_modules/@earendil-works/pi-codemode/dist/declarations.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-codemode/dist/declarations.js +4 -4
- package/dist/node_modules/@earendil-works/pi-codemode/dist/index.d.ts +1 -1
- package/dist/node_modules/@earendil-works/pi-codemode/dist/index.js +1 -1
- package/dist/node_modules/@earendil-works/pi-codemode/dist/runtime/prelude-source.js +2 -0
- package/dist/node_modules/@earendil-works/pi-codemode/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-coding-agent/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-mcp/CHANGELOG.md +32 -0
- package/dist/node_modules/@earendil-works/pi-mcp/README.md +60 -5
- package/dist/node_modules/@earendil-works/pi-mcp/dist/config.d.ts +45 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/config.js +1 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/index.d.ts +5 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/index.js +1 -1
- package/dist/node_modules/@earendil-works/pi-mcp/dist/input-schema.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/input-schema.js +1 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/naming.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/naming.js +1 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/auth-provider.d.ts +18 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/auth-provider.js +1 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/callback.js +1 -1
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/client-settings.d.ts +42 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/client-settings.js +1 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/errors.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/errors.js +1 -1
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/flow.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/flow.js +1 -1
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/index.d.ts +5 -1
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/index.js +1 -1
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/loopback.d.ts +22 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/loopback.js +1 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/sign-in.d.ts +28 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/sign-in.js +1 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/types.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/oauth/types.js +1 -1
- package/dist/node_modules/@earendil-works/pi-mcp/dist/output-limit.d.ts +8 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/output-limit.js +11 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/transports/lines.js +1 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/transports/pipe.d.ts +34 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/transports/pipe.js +2 -0
- package/dist/node_modules/@earendil-works/pi-mcp/dist/transports/stdio.d.ts +1 -4
- package/dist/node_modules/@earendil-works/pi-mcp/dist/transports/stdio.js +2 -2
- package/dist/node_modules/@earendil-works/pi-mcp/dist/transports/streamable-http.js +6 -4
- package/dist/node_modules/@earendil-works/pi-mcp/package.json +2 -2
- package/dist/node_modules/@earendil-works/pi-schema/CHANGELOG.md +37 -0
- package/dist/node_modules/@earendil-works/pi-schema/LICENSE +21 -0
- package/dist/node_modules/@earendil-works/pi-schema/README.md +319 -0
- package/dist/node_modules/@earendil-works/pi-schema/THIRD_PARTY_NOTICES/typebox-LICENSE +23 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/annotations.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/builders.d.ts +89 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/builders.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/checks.d.ts +51 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/checks.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/coerce.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/compiler.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/explain.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/index.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/date.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/date_time.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/duration.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/email.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/hostname.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idn_email.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idn_hostname.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/format/bidi.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/format/puny.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/hostname.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/idn-hostname.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/index.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/label/ascii.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/label/puny.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/label/unicode.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/idna/pattern/pattern.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/ipv4.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/ipv6.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/iri.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/iri_reference.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/json_pointer.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/json_pointer_uri_fragment.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/regex.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/relative_json_pointer.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/time.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/uri.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/uri_reference.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/uri_template.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/url.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/formats/typebox/uuid.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/index.d.ts +4 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/index.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/resolver.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/shared.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/typebox-static.d.ts +54 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/typebox-static.js +0 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/types.d.ts +25 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/types.js +0 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/validator.d.ts +20 -0
- package/dist/node_modules/@earendil-works/pi-schema/dist/validator.js +1 -0
- package/dist/node_modules/@earendil-works/pi-schema/package.json +43 -0
- package/dist/node_modules/@earendil-works/pi-telemetry/dist/index.d.ts +1 -1
- package/dist/node_modules/@earendil-works/pi-telemetry/dist/index.js +1 -1
- package/dist/node_modules/@earendil-works/pi-telemetry/dist/memory.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-telemetry/dist/memory.js +1 -1
- package/dist/node_modules/@earendil-works/pi-telemetry/dist/render.js +2 -2
- package/dist/node_modules/@earendil-works/pi-telemetry/package.json +3 -1
- package/dist/node_modules/@earendil-works/pi-tui/README.md +2 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/editor.js +3 -3
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts +4 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/markdown.js +11 -10
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/select-list.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/text.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/fuzzy.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/index.d.ts +2 -2
- package/dist/node_modules/@earendil-works/pi-tui/dist/index.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/keybindings.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/keys.js +5 -5
- package/dist/node_modules/@earendil-works/pi-tui/dist/layout.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/program-status.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/terminal.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js +4 -4
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui-main-screen.js +13 -13
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui.js +2 -2
- package/dist/node_modules/@earendil-works/pi-tui/dist/utils.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/utils.js +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/dist/package-manager-cli.js +17 -16
- package/dist/utils/ansi.js +1 -1
- package/dist/utils/changelog.js +3 -3
- package/dist/utils/clipboard-command.js +1 -1
- package/dist/utils/image-resize-core.js +1 -1
- package/dist/utils/image-resize.js +1 -1
- package/dist/utils/open-browser.js +1 -1
- package/dist/utils/paths.js +1 -1
- package/dist/utils/shell.js +3 -3
- package/dist/utils/syntax-highlight.js +4 -4
- package/dist/utils/terminal-question.js +1 -0
- package/dist/utils/tools-manager.js +1 -1
- package/dist/utils/web-url.js +1 -0
- package/examples/extensions/README.md +2 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +14 -14
- package/examples/extensions/debug-provider.ts +2 -2
- package/examples/extensions/gondolin/package-lock.json +19 -29
- package/examples/extensions/gondolin/package.json +2 -2
- package/examples/extensions/plan-mode/index.ts +20 -9
- package/examples/extensions/plan-mode/utils.ts +42 -16
- package/examples/extensions/preset.ts +2 -0
- package/examples/extensions/reload-runtime.ts +17 -5
- package/examples/extensions/subagent/README.md +14 -11
- package/examples/extensions/subagent/index.ts +392 -171
- package/examples/extensions/todo.ts +7 -0
- package/examples/extensions/tools.ts +2 -0
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +20 -20
- package/examples/tsconfig.json +208 -0
- package/npm-shrinkwrap.json +407 -383
- package/package.json +6 -7
- package/examples/extensions/sandbox/index.ts +0 -327
- package/examples/extensions/sandbox/package-lock.json +0 -92
- package/examples/extensions/sandbox/package.json +0 -19
- /package/dist/node_modules/@earendil-works/pi-mcp/{LICENSES → THIRD_PARTY_NOTICES}/modelcontextprotocol-typescript-sdk.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
1
|
+
var E=Object.defineProperty;var u=(o,t)=>E(o,"name",{value:t,configurable:!0});import{Box as R,Container as T,getCapabilities as O,Image as M,Spacer as A,Text as c,truncateToWidth as y}from"@earendil-works/pi-tui";import{createAllToolDefinitions as B}from"../../../core/tools/index.js";import{compactToolArgHint as D,countOutputLines as P,formatCollapsedSummary as S,formatToolCallWithArgs as L,getTextOutput as W,prettyToolLabel as k}from"../../../core/tools/render-utils.js";import{fill as b,t as m}from"../../../dal/i18n.js";import{stripAnsi as v}from"../../../utils/ansi.js";import{ensurePngTranscoder as N}from"../../../utils/image-convert.js";import{theme as l}from"../theme/theme.js";import{keyHint as I,keyText as _}from"./keybinding-hints.js";import{PulseLabel as q}from"./status-indicator.js";const Q=0,C=" ";class H{static{u(this,"CollapsedToolRow")}call;result;marker;constructor(t,e,i=""){this.call=t,this.result=e,this.marker=i}invalidate(){this.call.invalidate?.(),this.result?.invalidate?.()}render(t){const e=this.marker?"":C,i=Math.max(1,t-C.length),n=(this.call.render(i)[0]??"").replace(/\s+$/,""),s=v((this.result?.render(i)??[]).map(h=>h.trim()).filter(h=>h.length>0).join(" \xB7 "));if(!n.trim()&&!s)return[];const r=s?`${n} ${l.fg("dim",s)}`:n,a=`${e}${this.marker}${r}`;return[y(a,Math.max(1,t),l.fg("dim","..."))]}}class j{static{u(this,"FocusMarkerRow")}inner;marker;constructor(t,e){this.inner=t,this.marker=e}invalidate(){this.inner.invalidate?.()}render(t){const e=v(this.marker).length,i=this.inner.render(Math.max(1,t-e));if(i.length===0)return i;const n=" ".repeat(e);return[`${this.marker}${i[0]}`,...i.slice(1).map(s=>`${n}${s}`)]}}class f extends T{static{u(this,"ToolExecutionComponent")}contentBox;contentText;selfRenderContainer;callRendererComponent;resultRendererComponent;rendererState={};imageComponents=[];imageSources=[];imageSpacers=[];toolName;toolCallId;args;expanded=!1;showImages;imageWidthCells;outputPad;isPartial=!0;toolDefinition;builtInToolDefinition;ui;cwd;executionStarted=!1;argsComplete=!1;argsPending=!1;result;hideComponent=!1;activityPulse;collapsedAway=!1;focused=!1;leadingStreak=0;constructor(t,e,i,n={},s,r,a){super(),this.toolName=t,this.toolCallId=e,this.args=i,this.toolDefinition=s,this.builtInToolDefinition=B(a)[t],this.showImages=n.showImages??!0,this.imageWidthCells=n.imageWidthCells??60,this.outputPad=n.outputPad??1,this.ui=r,this.cwd=a,this.contentBox=new R(0,0),this.contentText=new c("",0,0),this.selfRenderContainer=new T,this.hasRendererDefinition()?this.addChild(this.getRenderShell()==="self"?this.selfRenderContainer:this.contentBox):this.addChild(this.contentText),this.updateDisplay()}dispose(){this.activityPulse?.dispose(),this.activityPulse=void 0}isQuietFoldable(){return!this.expanded&&!!this.result&&!this.result.isError&&!this.isPartial}focusMarker(){return this.focused?l.fg("accent",this.expanded?"\u25BE ":"\u25B8 "):""}setFocused(t){this.focused!==t&&(this.focused=t,this.invalidate())}setStreakPresentation(t,e=0){this.collapsedAway=t,this.leadingStreak=t?0:e}getCallRenderer(){return this.builtInToolDefinition?this.toolDefinition?this.toolDefinition.renderCall??this.builtInToolDefinition.renderCall:this.builtInToolDefinition.renderCall:this.toolDefinition?.renderCall}getResultRenderer(){return this.builtInToolDefinition?this.toolDefinition?this.toolDefinition.renderResult??this.builtInToolDefinition.renderResult:this.builtInToolDefinition.renderResult:this.toolDefinition?.renderResult}hasRendererDefinition(){return this.builtInToolDefinition!==void 0||this.toolDefinition!==void 0}getRenderShell(){return this.builtInToolDefinition?this.toolDefinition?this.toolDefinition.renderShell??this.builtInToolDefinition.renderShell??"default":this.builtInToolDefinition.renderShell??"default":this.toolDefinition?.renderShell??"default"}getRenderContext(t){return{args:this.args,toolCallId:this.toolCallId,invalidate:u(()=>{this.invalidate(),this.ui.requestRender()},"invalidate"),lastComponent:t,state:this.rendererState,keyText:u(e=>_(e),"keyText"),keyHint:u((e,i)=>I(e,i),"keyHint"),cwd:this.cwd,executionStarted:this.executionStarted,argsComplete:this.argsComplete,isPartial:this.isPartial,expanded:this.expanded,showImages:this.showImages,isError:this.result?.isError??!1,durationMs:this.isPartial?void 0:this.result?.durationMs,outputPad:this.outputPad}}createCallFallback(){const t=k(this.toolName);if(this.expanded)return new c(L(t,this.args,l,!0),0,0);const e=D(this.args),i=l.fg("toolTitle",l.bold(t));return new c(e?`${i} ${l.fg("dim",e)}`:i,0,0)}createResultFallback(){const t=this.getTextOutput();if(!t)return;if(!this.expanded&&!this.result?.isError){const r=P(t),a=S(l,r>0?[b(m("{count} \u884C"),{count:r})]:[]);return a?new c(a,0,0):void 0}const e=t.split(`
|
|
2
2
|
`),i=this.expanded?e:e.slice(0,Math.max(Q,0)),n=e.length-i.length;let s=i.map(r=>l.fg("toolOutput",r)).join(`
|
|
3
3
|
`);return n>0&&(s+=`${l.fg("muted",`
|
|
4
|
-
${
|
|
4
|
+
${b(m("... (\u8FD8\u6709 {count} \u884C,"),{count:n})}`)} ${I("app.tools.expand",m("\u5C55\u5F00\u67E5\u770B"))}${l.fg("muted",")")}`),s?new c(s,0,0):void 0}updateArgs(t){this.args=t,this.argsPending=!0,this.ui.requestRender()}markExecutionStarted(){this.executionStarted=!0,this.updateDisplay(),this.ui.requestRender()}setArgsComplete(){this.argsComplete=!0,this.updateDisplay(),this.ui.requestRender()}updateResult(t,e=!1){this.result=t,this.isPartial=e,this.updateDisplay()}setExpanded(t){this.expanded=t,this.updateDisplay()}setOutputPad(t){this.outputPad=t,this.updateDisplay()}setShowImages(t){this.showImages=t,this.updateDisplay()}setImageWidthCells(t){this.imageWidthCells=Math.max(1,Math.floor(t)),this.updateDisplay()}invalidate(){super.invalidate(),this.updateDisplay()}render(t){if(this.argsPending&&this.updateDisplay(),this.hideComponent||this.collapsedAway)return[];let e;if(this.hasRendererDefinition()&&this.getRenderShell()==="self"){const i=this.selfRenderContainer.render(t);if(this.imageComponents.length===0&&i.every(n=>n.trim()===""))return[];e=[],i.length>0&&e.push(...i);for(let n=0;n<this.imageComponents.length;n++){const s=this.imageSpacers[n];s&&e.push(...s.render(t));const r=this.imageComponents[n];r&&e.push(...r.render(t))}}else e=super.render(t);if(this.activityPulse&&e.length>0){const i=this.activityPulse.render(2)[0]??"";e[0]=y(`${i} ${e[0]}`,Math.max(1,t),l.fg("dim","..."))}return this.leadingStreak>0?[l.fg("dim",`${this.leadingStreak} ${m("\u4E2A\u5DE5\u5177")}`),...e]:e}updateDisplay(){this.argsPending=!1;const t=this.result?.isError&&!this.isPartial?s=>l.bg("toolErrorBg",s):void 0;let e=!1;if(this.hideComponent=!1,this.hasRendererDefinition()){const s=this.getRenderShell()==="self"?this.selfRenderContainer:this.contentBox;s instanceof R&&(s.setBgFn(t),s.setPaddingX(this.outputPad)),s.clear();let r;const a=this.getCallRenderer();if(!a)r=this.createCallFallback();else try{r=a(this.args,l,this.getRenderContext(this.callRendererComponent)),this.callRendererComponent=r}catch{this.callRendererComponent=void 0,r=this.createCallFallback()}let h;if(this.result){const p=this.getResultRenderer();if(!p)h=this.createResultFallback();else try{h=p({content:this.result.content,details:this.result.details},{expanded:this.expanded,isPartial:this.isPartial},l,this.getRenderContext(this.resultRendererComponent)),this.resultRendererComponent=h}catch{this.resultRendererComponent=void 0,h=this.createResultFallback()}h&&this.isBlankComponent(h)&&(h=void 0)}!this.expanded&&!this.result?.isError&&!!r&&r.render(240).length<=1&&r?(s.addChild(new H(r,h,this.focusMarker())),e=!0):(r&&(s.addChild(new j(r,this.focusMarker()||C)),e=!0),h&&(s.addChild(h),e=!0))}else this.contentText.setCustomBgFn(t),this.contentText.setPaddingX(this.outputPad),this.contentText.setText(this.formatToolExecution()),e=!0;const i=this.imageComponents,n=this.imageSources;for(const s of this.imageComponents)this.removeChild(s);this.imageComponents=[],this.imageSources=[];for(const s of this.imageSpacers)this.removeChild(s);if(this.imageSpacers=[],this.result){const s=this.result.content.filter(a=>a.type==="image"),r=O();for(const a of s)if(r.images&&this.showImages&&a.data&&a.mimeType){const h=new A(1);this.addChild(h),this.imageSpacers.push(h);const d={data:a.data,mimeType:a.mimeType,widthCells:this.imageWidthCells},p=this.imageComponents.length,g=n[p],x=g?.data===d.data&&g.mimeType===d.mimeType&&g.widthCells===d.widthCells?i[p]:new M(d.data,d.mimeType,{fallbackColor:u(F=>l.fg("toolOutput",F),"fallbackColor")},{maxWidthCells:d.widthCells});d.mimeType!=="image/png"&&N(()=>{this.invalidate(),this.ui.requestRender()}),this.imageComponents.push(x),this.imageSources.push(d),this.addChild(x)}}this.hasRendererDefinition()&&!e&&this.imageComponents.length===0&&(this.hideComponent=!0),this.syncActivityPulse()}syncActivityPulse(){if((!this.result||this.isPartial)&&!this.hideComponent){this.activityPulse||(this.activityPulse=new q(void 0,""));return}this.activityPulse?.dispose(),this.activityPulse=void 0}getTextOutput(){return W(this.result,this.showImages)}isBlankComponent(t){return t instanceof c?t.render(120).every(i=>i.trim()===""):!1}formatToolExecution(){const t=k(this.toolName),e=D(this.args);let i=l.fg("toolTitle",l.bold(t));e&&(i+=` ${l.fg("dim",e)}`);const n=this.getTextOutput();if(this.expanded||this.result?.isError)this.args&&this.expanded&&(i+=`
|
|
5
5
|
${l.fg("dim",JSON.stringify(this.args))}`),n&&(i+=`
|
|
6
|
-
${l.fg("toolOutput",n)}`);else if(n){const s=
|
|
6
|
+
${l.fg("toolOutput",n)}`);else if(n){const s=P(n);s>0&&(i+=S(l,[`${s} lines`]))}return i}}const K=3;function w(o){const t=o.isBlank;if(typeof t!="function")return!1;try{return t.call(o)===!0}catch{return!1}}u(w,"rendersNothing");function nt(o,t="tail"){if(t==="all"){for(const n of o)n instanceof f&&n.setStreakPresentation(!1,0);let i=0;for(;i<o.length;){const n=X(o,i);if(n===null){i++;continue}$(n.members),i=Math.max(n.end,i+1)}return}const e=J(o);e.length>0&&$(e)}u(nt,"foldQuietToolStreak");function $(o){if(!(o.length<K)){for(let t=0;t<o.length-1;t++)o[t].setStreakPresentation(!0,0);o[o.length-1].setStreakPresentation(!1,o.length-1)}}u($,"applyRun");function X(o,t){const e=o[t];if(!(e instanceof f)||!e.isQuietFoldable())return null;const i=[e];let n=t+1,s=t+1;for(;s<o.length;){const r=o[s];if(r instanceof f&&r.isQuietFoldable()){i.push(r),s++,n=s;continue}if(!(r instanceof f)&&w(r)){s++;continue}break}return{members:i,end:n}}u(X,"collectRunFrom");function J(o){const t=[];for(let e=o.length-1;e>=0;e--){const i=o[e];if(i instanceof f&&i.isQuietFoldable()){t.unshift(i);continue}if(!(!(i instanceof f)&&w(i)))break}return t}u(J,"collectTrailingRun");export{f as ToolExecutionComponent,nt as foldQuietToolStreak};
|
|
@@ -48,6 +48,7 @@ declare class TreeList implements Component {
|
|
|
48
48
|
}
|
|
49
49
|
export declare class TreeSelectorComponent extends Container implements Focusable {
|
|
50
50
|
private treeList;
|
|
51
|
+
private searchLine;
|
|
51
52
|
private labelInput;
|
|
52
53
|
private labelInputContainer;
|
|
53
54
|
private treeContainer;
|
|
@@ -59,6 +60,7 @@ export declare class TreeSelectorComponent extends Container implements Focusabl
|
|
|
59
60
|
constructor(tree: SessionTreeNode[], currentLeafId: string | null, terminalHeight: number, onSelect: (entryId: string) => void, onCancel: () => void, onLabelChange?: (entryId: string, label: string | undefined) => void, initialSelectedId?: string, initialFilterMode?: FilterMode);
|
|
60
61
|
private showLabelInput;
|
|
61
62
|
private hideLabelInput;
|
|
63
|
+
get capturesViewportInput(): boolean;
|
|
62
64
|
handleInput(keyData: string): void;
|
|
63
65
|
getTreeList(): TreeList;
|
|
64
66
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var z=Object.defineProperty;var b=(u,s)=>z(u,"name",{value:s,configurable:!0});import{Container as B,getKeybindings as P,Input as K,Spacer as W,sliceByColumn as Y,Text as X,truncateToWidth as w,visibleWidth as v,wrapTextWithAnsi as Q}from"@earendil-works/pi-tui";import{formatReadLineRange as G}from"../../../core/tools/render-utils.js";import{fill as S,t as h}from"../../../dal/i18n.js";import{theme as d}from"../theme/theme.js";import{chromeBottom as J,chromeTop as q,DynamicBorder as Z}from"./dynamic-border.js";import{formatKeyText as D,keyHint as U}from"./keybinding-hints.js";const ee=2,te=4,se=20,ne=2,ie=12;function le(u,s){const t=Math.max(0,s-ee),e=u.reduce((l,o)=>Math.max(l,o.bodyWidth),0),n=Math.max(0,e-t),i=u.find(l=>l.isSelected);let a=0;if(i&&n>0){const l=Math.min(se,Math.max(te,Math.floor(t/3)));if(i.anchorCol>t-l){const o=Math.min(ie,Math.max(ne,Math.floor(t/4)));a=Math.min(n,i.anchorCol-o)}}return u.map(l=>{const o=a>0?`${l.gutter}${Y(l.body,a,t,!0)}\x1B[0m`:l.gutter+l.body;return w(o,s,"")})}b(le,"renderHorizontalViewport");class oe{static{b(this,"TreeList")}flatNodes=[];filteredNodes=[];selectedIndex=0;currentLeafId;maxVisibleLines;filterMode="default";searchQuery="";toolCallMap=new Map;multipleRoots=!1;showLabelTimestamps=!1;activePathIds=new Set;visibleParentMap=new Map;visibleChildrenMap=new Map;lastSelectedId=null;foldedNodes=new Set;onSelect;onCancel;onCopy;onLabelEdit;constructor(s,t,e,n,i){this.currentLeafId=t,this.maxVisibleLines=e,this.filterMode=i??"default",this.multipleRoots=s.length>1,this.flatNodes=this.flattenTree(s),this.buildActivePath(),this.applyFilter();const a=n??t;this.selectedIndex=this.findNearestVisibleIndex(a),this.lastSelectedId=this.filteredNodes[this.selectedIndex]?.node.entry.id??null}findNearestVisibleIndex(s){if(this.filteredNodes.length===0)return 0;const t=new Map;for(const i of this.flatNodes)t.set(i.node.entry.id,i);const e=new Map(this.filteredNodes.map((i,a)=>[i.node.entry.id,a]));let n=s;for(;n!==null;){const i=e.get(n);if(i!==void 0)return i;const a=t.get(n);if(!a)break;n=a.node.entry.parentId??null}return this.filteredNodes.length-1}buildActivePath(){if(this.activePathIds.clear(),!this.currentLeafId)return;const s=new Map;for(const e of this.flatNodes)s.set(e.node.entry.id,e);let t=this.currentLeafId;for(;t;){this.activePathIds.add(t);const e=s.get(t);if(!e)break;t=e.node.entry.parentId??null}}flattenTree(s){const t=[];this.toolCallMap.clear();const e=[],n=new Map,i=this.currentLeafId;{const o=[],r=[...s];for(;r.length>0;){const c=r.pop();o.push(c);for(let f=c.children.length-1;f>=0;f--)r.push(c.children[f])}for(let c=o.length-1;c>=0;c--){const f=o[c];let I=i!==null&&f.entry.id===i;for(const C of f.children)n.get(C)&&(I=!0);n.set(f,I)}}const a=s.length>1,l=[...s].sort((o,r)=>Number(n.get(r))-Number(n.get(o)));for(let o=l.length-1;o>=0;o--){const r=o===l.length-1;e.push([l[o],a?1:0,a,a,r,[],a])}for(;e.length>0;){const[o,r,c,f,I,C,$]=e.pop(),g=o.entry;if(g.type==="message"&&g.message.role==="assistant"){const p=g.message.content;if(Array.isArray(p)){for(const m of p)if(typeof m=="object"&&m!==null&&"type"in m&&m.type==="toolCall"){const L=m;this.toolCallMap.set(L.id,{name:L.name,arguments:L.arguments})}}}t.push({node:o,indent:r,showConnector:f,isLast:I,gutters:C,isVirtualRootChild:$});const y=o.children,M=y.length>1,N=(()=>{const p=[],m=[];for(const L of y)n.get(L)?p.push(L):m.push(L);return[...p,...m]})();let x;M||c&&r>0?x=r+1:x=r;const R=f&&!$,T=this.multipleRoots?Math.max(0,r-1):r,_=Math.max(0,T-1),k=R?[...C,{position:_,show:!I}]:C;for(let p=N.length-1;p>=0;p--){const m=p===N.length-1;e.push([N[p],x,M,M,m,k,!1])}}return t}applyFilter(){this.filteredNodes.length>0&&(this.lastSelectedId=this.filteredNodes[this.selectedIndex]?.node.entry.id??this.lastSelectedId);const s=this.searchQuery.toLowerCase().split(/\s+/).filter(Boolean);if(this.filteredNodes=this.flatNodes.filter(t=>{const e=t.node.entry;if(e.type==="usage")return!1;const n=e.id===this.currentLeafId;if(e.type==="message"&&e.message.role==="assistant"&&!n){const l=e.message,o=this.hasTextContent(l.content),r=l.stopReason&&l.stopReason!=="stop"&&l.stopReason!=="toolUse";if(!o&&!r)return!1}let i=!0;const a=e.type==="label"||e.type==="context_edit"||e.type==="custom"||e.type==="model_change"||e.type==="thinking_level_change"||e.type==="session_info";switch(this.filterMode){case"user-only":i=e.type==="message"&&e.message.role==="user";break;case"no-tools":i=!a&&!(e.type==="message"&&e.message.role==="toolResult");break;case"labeled-only":i=t.node.label!==void 0;break;case"all":i=!0;break;default:i=!a;break}if(!i)return!1;if(s.length>0){const l=this.getSearchableText(t.node).toLowerCase();return s.every(o=>l.includes(o))}return!0}),this.foldedNodes.size>0){const t=new Set;for(const e of this.flatNodes){const{id:n,parentId:i}=e.node.entry;i!=null&&(this.foldedNodes.has(i)||t.has(i))&&t.add(n)}this.filteredNodes=this.filteredNodes.filter(e=>!t.has(e.node.entry.id))}this.recalculateVisualStructure(),this.lastSelectedId?this.selectedIndex=this.findNearestVisibleIndex(this.lastSelectedId):this.selectedIndex>=this.filteredNodes.length&&(this.selectedIndex=Math.max(0,this.filteredNodes.length-1)),this.filteredNodes.length>0&&(this.lastSelectedId=this.filteredNodes[this.selectedIndex]?.node.entry.id??this.lastSelectedId)}recalculateVisualStructure(){if(this.filteredNodes.length===0)return;const s=new Set(this.filteredNodes.map(r=>r.node.entry.id)),t=new Map;for(const r of this.flatNodes)t.set(r.node.entry.id,r);const e=b(r=>{let c=t.get(r)?.node.entry.parentId??null;for(;c!==null;){if(s.has(c))return c;c=t.get(c)?.node.entry.parentId??null}return null},"findVisibleAncestor"),n=new Map,i=new Map;i.set(null,[]);for(const r of this.filteredNodes){const c=r.node.entry.id,f=e(c);n.set(c,f),i.has(f)||i.set(f,[]),i.get(f).push(c)}const a=i.get(null);this.multipleRoots=a.length>1;const l=new Map;for(const r of this.filteredNodes)l.set(r.node.entry.id,r);const o=[];for(let r=a.length-1;r>=0;r--){const c=r===a.length-1;o.push([a[r],this.multipleRoots?1:0,this.multipleRoots,this.multipleRoots,c,[],this.multipleRoots])}for(;o.length>0;){const[r,c,f,I,C,$,g]=o.pop(),y=l.get(r);if(!y)continue;y.indent=c,y.showConnector=I,y.isLast=C,y.gutters=$,y.isVirtualRootChild=g;const M=i.get(r)||[],N=M.length>1;let x;N||f&&c>0?x=c+1:x=c;const R=I&&!g,T=this.multipleRoots?Math.max(0,c-1):c,_=Math.max(0,T-1),k=R?[...$,{position:_,show:!C}]:$;for(let p=M.length-1;p>=0;p--){const m=p===M.length-1;o.push([M[p],x,N,N,m,k,!1])}}this.visibleParentMap=n,this.visibleChildrenMap=i}getSearchableText(s){const t=s.entry,e=[];switch(s.label&&e.push(s.label),t.type){case"message":{const n=t.message;if(e.push(n.role),"content"in n&&n.content&&e.push(this.extractContent(n.content)),n.role==="bashExecution"){const i=n;i.command&&e.push(i.command)}break}case"custom_message":{e.push(t.customType),typeof t.content=="string"?e.push(t.content):e.push(this.extractContent(t.content));break}case"compaction":e.push("compaction");break;case"branch_summary":e.push("branch summary",t.summary);break;case"session_info":e.push("title"),t.name&&e.push(t.name);break;case"model_change":e.push("model",t.modelId);break;case"thinking_level_change":e.push("thinking",t.thinkingLevel);break;case"custom":e.push("custom",t.customType);break;case"context_edit":e.push("context edit",t.replacement===null?"omit":"replace",t.targetId);break;case"label":e.push("label",t.label??"");break}return e.join(" ")}invalidate(){}getSearchQuery(){return this.searchQuery}getSelectedNode(){return this.filteredNodes[this.selectedIndex]?.node}copySelected(){const s=this.getSelectedNode();this.onCopy?.(s?this.getEntryCopyText(s):void 0)}updateNodeLabel(s,t,e){for(const n of this.flatNodes)if(n.node.entry.id===s){n.node.label=t,n.node.labelTimestamp=t?e??new Date().toISOString():void 0;break}}getStatusLabels(){let s="";switch(this.filterMode){case"no-tools":s+=" [no-tools]";break;case"user-only":s+=" [user]";break;case"labeled-only":s+=" [labeled]";break;case"all":s+=" [all]";break}return this.showLabelTimestamps&&(s+=` [+${h("\u6807\u7B7E\u65F6\u95F4")}]`),s}render(s){const t=[];if(this.filteredNodes.length===0)return t.push(w(d.fg("muted",` ${h("\u6CA1\u6709\u627E\u5230\u6761\u76EE")}`),s)),t.push(w(d.fg("muted",` (0/0)${this.getStatusLabels()}`),s)),t;const e=Math.max(0,Math.min(this.selectedIndex-Math.floor(this.maxVisibleLines/2),this.filteredNodes.length-this.maxVisibleLines)),n=Math.min(e+this.maxVisibleLines,this.filteredNodes.length),i=[];for(let a=e;a<n;a++){const l=this.filteredNodes[a],o=l.node.entry,r=a===this.selectedIndex,c=r?d.fg("accent","\u203A "):" ",f=this.multipleRoots?Math.max(0,l.indent-1):l.indent,I=l.showConnector&&!l.isVirtualRootChild?l.isLast?"\u2514\u2500 ":"\u251C\u2500 ":"",C=I?f-1:-1,$=f*3,g=[],y=this.foldedNodes.has(o.id);for(let E=0;E<$;E++){const H=Math.floor(E/3),A=E%3,j=l.gutters.find(V=>V.position===H);if(j)A===0?g.push(j.show?"\u2502":" "):g.push(" ");else if(I&&H===C)if(A===0)g.push(l.isLast?"\u2514":"\u251C");else if(A===1){const V=this.isFoldable(o.id);g.push(y?"\u229E":V?"\u229F":"\u2500")}else g.push(" ");else g.push(" ")}const M=g.join(""),N=l.showConnector&&!l.isVirtualRootChild,x=y&&!N?d.fg("accent","\u229E "):"",T=this.activePathIds.has(o.id)?d.fg("accent","\u2022 "):"",_=l.node.label?d.fg("warning",`[${l.node.label}] `):"",k=this.showLabelTimestamps&&l.node.label&&l.node.labelTimestamp?d.fg("muted",`${this.formatLabelTimestamp(l.node.labelTimestamp)} `):"",p=this.getEntryDisplayText(l.node,r),m=d.fg("dim",M)+x+T,L=v(m);let O=c,F=m+_+k+p;r&&(O=d.bg("selectedBg",O),F=d.bg("selectedBg",F)),i.push({gutter:O,body:F,anchorCol:L,bodyWidth:v(F),isSelected:r})}return t.push(...le(i,s)),t.push(w(d.fg("muted",` (${this.selectedIndex+1}/${this.filteredNodes.length})${this.getStatusLabels()}`),s)),t}getEntryDisplayText(s,t){const e=s.entry;let n;const i=b(a=>a.replace(/[\n\t]/g," ").trim(),"normalize");switch(e.type){case"message":{const a=e.message,l=a.role;if(l==="user"){const o=a,r=i(this.extractContent(o.content));n=d.fg("accent",h("\u7528\u6237\u6D88\u606F\uFF1A"))+r}else if(l==="assistant"){const o=a,r=i(this.extractContent(o.content));if(r)n=d.fg("success",h("AI\uFF1A"))+r;else if(o.stopReason==="aborted")n=d.fg("success",h("AI\uFF1A"))+d.fg("muted",h("\uFF08\u5DF2\u4E2D\u65AD\uFF09"));else if(o.errorMessage){const c=i(o.errorMessage).slice(0,80);n=d.fg("success",h("AI\uFF1A"))+d.fg("error",c)}else n=d.fg("success",h("AI\uFF1A"))+d.fg("muted",h("\uFF08\u65E0\u5185\u5BB9\uFF09"))}else if(l==="toolResult"){const o=a,r=o.toolCallId?this.toolCallMap.get(o.toolCallId):void 0;r?n=d.fg("muted",this.formatToolCall(r.name,r.arguments)):n=d.fg("muted",`[${o.toolName??"tool"}]`)}else if(l==="bashExecution"){const o=a;n=d.fg("dim",`[bash]: ${i(o.command??"")}`)}else n=d.fg("dim",`[${l}]`);break}case"custom_message":{const a=typeof e.content=="string"?e.content:e.content.filter(l=>l.type==="text").map(l=>l.text).join("");n=d.fg("customMessageLabel",`[${e.customType}]: `)+i(a);break}case"compaction":{const a=Math.round(e.tokensBefore/1e3);n=d.fg("borderAccent",`[${S(h("\u538B\u7F29\uFF1A{tokens}k tokens"),{tokens:a})}]`);break}case"branch_summary":n=d.fg("warning",`[${h("\u5206\u652F\u6458\u8981\u8BB0\u5F55")}]: `)+i(e.summary);break;case"model_change":n=d.fg("dim",`[${S(h("\u6A21\u578B\uFF1A{model}"),{model:e.modelId})}]`);break;case"thinking_level_change":n=d.fg("dim",`[${S(h("\u601D\u8003\uFF1A{level}"),{level:e.thinkingLevel})}]`);break;case"custom":n=d.fg("dim",`[${S(h("\u81EA\u5B9A\u4E49\uFF1A{type}"),{type:e.customType})}]`);break;case"context_edit":n=d.fg("dim",`[${S(e.replacement===null?h("\u4E0A\u4E0B\u6587\u7701\u7565\uFF1A{target}"):h("\u4E0A\u4E0B\u6587\u66FF\u6362\uFF1A{target}"),{target:e.targetId})}]`);break;case"label":n=d.fg("dim",`[${S(h("\u6807\u7B7E\uFF1A{label}"),{label:e.label??h("\uFF08\u5DF2\u6E05\u9664\uFF09")})}]`);break;case"session_info":n=e.name?[d.fg("dim","[title: "),d.fg("dim",e.name),d.fg("dim","]")].join(""):[d.fg("dim","[title: "),d.italic(d.fg("dim","empty")),d.fg("dim","]")].join("");break;default:n=""}return t?d.bold(n):n}formatLabelTimestamp(s){const t=new Date(s),e=new Date,n=t.getHours().toString().padStart(2,"0"),i=t.getMinutes().toString().padStart(2,"0"),a=`${n}:${i}`;if(t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate())return a;const l=t.getMonth()+1,o=t.getDate();return t.getFullYear()===e.getFullYear()?`${l}/${o} ${a}`:`${t.getFullYear().toString().slice(-2)}/${l}/${o} ${a}`}extractContent(s){return this.extractFullContent(s).slice(0,200)}extractFullContent(s){if(typeof s=="string")return s;if(!Array.isArray(s))return"";let t="";for(const e of s)typeof e=="object"&&e!==null&&"type"in e&&e.type==="text"&&(t+=e.text);return t}getEntryCopyText(s){const t=s.entry;let e;switch(t.type){case"message":t.message.role==="bashExecution"?e=t.message.command:"content"in t.message&&(e=this.extractFullContent(t.message.content),!e&&t.message.role==="assistant"&&(e=t.message.errorMessage));break;case"custom_message":e=this.extractFullContent(t.content);break;case"compaction":e=t.summary;break;case"branch_summary":e=t.summary;break}return e?.trim()?e:void 0}hasTextContent(s){if(typeof s=="string")return s.trim().length>0;if(Array.isArray(s)){for(const t of s)if(typeof t=="object"&&t!==null&&"type"in t&&t.type==="text"){const e=t.text;if(e&&e.trim().length>0)return!0}}return!1}formatToolCall(s,t){const e=b(n=>{const i=process.env.HOME||process.env.USERPROFILE||"";return i&&n.startsWith(i)?`~${n.slice(i.length)}`:n},"shortenPath");switch(s){case"read":return`[read: ${e(String(t.path||t.file_path||""))}${G(t.offset,t.limit)}]`;case"write":return`[write: ${e(String(t.path||t.file_path||""))}]`;case"edit":return`[edit: ${e(String(t.path||t.file_path||""))}]`;case"bash":{const n=String(t.command||"");return`[bash: ${n.replace(/[\n\t]/g," ").trim().slice(0,50)}${n.length>50?"...":""}]`}case"grep":{const n=String(t.pattern||""),i=e(String(t.path||"."));return`[grep: /${n}/ in ${i}]`}case"find":{const n=String(t.pattern||""),i=e(String(t.path||"."));return`[find: ${n} in ${i}]`}case"ls":return`[ls: ${e(String(t.path||"."))}]`;default:{const n=JSON.stringify(t).slice(0,40);return`[${s}: ${n}${JSON.stringify(t).length>40?"...":""}]`}}}handleInput(s){const t=P();if(t.matches(s,"tui.select.up"))this.selectedIndex=this.selectedIndex===0?this.filteredNodes.length-1:this.selectedIndex-1;else if(t.matches(s,"tui.select.down"))this.selectedIndex=this.selectedIndex===this.filteredNodes.length-1?0:this.selectedIndex+1;else if(t.matches(s,"app.tree.foldOrUp")){const e=this.filteredNodes[this.selectedIndex]?.node.entry.id;e&&this.isFoldable(e)&&!this.foldedNodes.has(e)?(this.foldedNodes.add(e),this.applyFilter()):this.selectedIndex=this.findBranchSegmentStart("up")}else if(t.matches(s,"app.tree.unfoldOrDown")){const e=this.filteredNodes[this.selectedIndex]?.node.entry.id;e&&this.foldedNodes.has(e)?(this.foldedNodes.delete(e),this.applyFilter()):this.selectedIndex=this.findBranchSegmentStart("down")}else if(t.matches(s,"tui.editor.cursorLeft")||t.matches(s,"tui.select.pageUp"))this.selectedIndex=Math.max(0,this.selectedIndex-this.maxVisibleLines);else if(t.matches(s,"tui.editor.cursorRight")||t.matches(s,"tui.select.pageDown"))this.selectedIndex=Math.min(this.filteredNodes.length-1,this.selectedIndex+this.maxVisibleLines);else if(t.matches(s,"tui.select.confirm")){const e=this.filteredNodes[this.selectedIndex];e&&this.onSelect&&this.onSelect(e.node.entry.id)}else if(t.matches(s,"app.message.copy"))this.copySelected();else if(t.matches(s,"tui.select.cancel"))this.searchQuery?(this.searchQuery="",this.foldedNodes.clear(),this.applyFilter()):this.onCancel?.();else if(t.matches(s,"app.tree.filter.default"))this.filterMode="default",this.foldedNodes.clear(),this.applyFilter();else if(t.matches(s,"app.tree.filter.noTools"))this.filterMode=this.filterMode==="no-tools"?"default":"no-tools",this.foldedNodes.clear(),this.applyFilter();else if(t.matches(s,"app.tree.filter.userOnly"))this.filterMode=this.filterMode==="user-only"?"default":"user-only",this.foldedNodes.clear(),this.applyFilter();else if(t.matches(s,"app.tree.filter.labeledOnly"))this.filterMode=this.filterMode==="labeled-only"?"default":"labeled-only",this.foldedNodes.clear(),this.applyFilter();else if(t.matches(s,"app.tree.filter.all"))this.filterMode=this.filterMode==="all"?"default":"all",this.foldedNodes.clear(),this.applyFilter();else if(t.matches(s,"app.tree.filter.cycleBackward")){const e=["default","no-tools","user-only","labeled-only","all"],n=e.indexOf(this.filterMode);this.filterMode=e[(n-1+e.length)%e.length],this.foldedNodes.clear(),this.applyFilter()}else if(t.matches(s,"app.tree.filter.cycleForward")){const e=["default","no-tools","user-only","labeled-only","all"],n=e.indexOf(this.filterMode);this.filterMode=e[(n+1)%e.length],this.foldedNodes.clear(),this.applyFilter()}else if(t.matches(s,"tui.editor.deleteCharBackward"))this.searchQuery.length>0&&(this.searchQuery=this.searchQuery.slice(0,-1),this.foldedNodes.clear(),this.applyFilter());else if(t.matches(s,"app.tree.editLabel")){const e=this.filteredNodes[this.selectedIndex];e&&this.onLabelEdit&&this.onLabelEdit(e.node.entry.id,e.node.label)}else t.matches(s,"app.tree.toggleLabelTimestamp")?this.showLabelTimestamps=!this.showLabelTimestamps:![...s].some(n=>{const i=n.charCodeAt(0);return i<32||i===127||i>=128&&i<=159})&&s.length>0&&(this.searchQuery+=s,this.foldedNodes.clear(),this.applyFilter())}isFoldable(s){const t=this.visibleChildrenMap.get(s);if(!t||t.length===0)return!1;const e=this.visibleParentMap.get(s);if(e==null)return!0;const n=this.visibleChildrenMap.get(e);return n!==void 0&&n.length>1}findBranchSegmentStart(s){const t=this.filteredNodes[this.selectedIndex]?.node.entry.id;if(!t)return this.selectedIndex;const e=new Map(this.filteredNodes.map((i,a)=>[i.node.entry.id,a]));let n=t;if(s==="down")for(;;){const i=this.visibleChildrenMap.get(n)??[];if(i.length===0)return e.get(n);if(i.length>1)return e.get(i[0]);n=i[0]}for(;;){const i=this.visibleParentMap.get(n)??null;if(i===null)return e.get(n);if((this.visibleChildrenMap.get(i)??[]).length>1){const l=e.get(n);if(l<this.selectedIndex)return l}n=i}}}class re{static{b(this,"SearchLine")}treeList;constructor(s){this.treeList=s}invalidate(){}render(s){const t=this.treeList.getSearchQuery();return t?[w(` ${d.fg("muted",h("\u8F93\u5165\u6587\u5B57\u641C\u7D22\uFF1A"))} ${d.fg("accent",t)}`,s)]:[w(` ${d.fg("muted",h("\u8F93\u5165\u6587\u5B57\u641C\u7D22\uFF1A"))}`,s)]}handleInput(s){}}class ae{static{b(this,"TreeHelp")}invalidate(){}render(s){const t=de().map(({keys:o,label:r,labelFirst:c})=>{const f=ce(o);return f?c?`${r} ${f}`:`${f} ${r}`:r}),e=Math.max(1,s),n=" ",i=" \xB7 ",a=[];let l="";for(const o of t){const r=l?`${l}${i}${o}`:v(`${n}${o}`)<=e?`${n}${o}`:o;if(!l||v(r)<=e){l=r;continue}a.push(...Q(l.trimEnd(),e)),l=v(`${n}${o}`)<=e?`${n}${o}`:o}return l&&a.push(...Q(l.trimEnd(),e)),a.map(o=>d.fg("muted",o))}}const de=b(()=>[{keys:["tui.select.up","tui.select.down"],label:h("\u79FB\u52A8")},{keys:["tui.editor.cursorLeft","tui.editor.cursorRight"],label:h("\u7FFB\u9875")},{keys:["app.tree.foldOrUp","app.tree.unfoldOrDown"],label:h("\u5206\u652F")},{keys:["app.message.copy"],label:h("\u590D\u5236")},{keys:["app.tree.editLabel"],label:h("\u6807\u7B7E")},{keys:["app.tree.toggleLabelTimestamp"],label:h("\u6807\u7B7E\u65F6\u95F4")},{keys:["app.tree.filter.default","app.tree.filter.noTools","app.tree.filter.userOnly","app.tree.filter.labeledOnly","app.tree.filter.all"],label:h("\u7B5B\u9009"),labelFirst:!0},{keys:["app.tree.filter.cycleForward","app.tree.filter.cycleBackward"],label:h("\u8F6E\u6362"),labelFirst:!0}],"treeHelpItems");function ce(u){const s=[];for(const t of u){const e=P().getKeys(t)[0];e!==void 0&&s.push(e)}return s.length===0?"":D(he(s)).replace(/\bpageUp\b/g,"pgup").replace(/\bpageDown\b/g,"pgdn").replace(/\bup\b/g,"\u2191").replace(/\bdown\b/g,"\u2193").replace(/\bleft\b/g,"\u2190").replace(/\bright\b/g,"\u2192")}b(ce,"formatHelpKeys");function he(u){if(u.length===1)return u[0];const s=u.map(e=>{const n=e.lastIndexOf("+");return n===-1?{prefix:"",suffix:e}:{prefix:e.slice(0,n+1),suffix:e.slice(n+1)}}),t=s[0].prefix;return t&&s.every(e=>e.prefix===t)?`${t}${s.map(e=>e.suffix).join("/")}`:u.join("/")}b(he,"compactRawKeys");class fe{static{b(this,"LabelInput")}input;entryId;onSubmit;onCancel;_focused=!1;get focused(){return this._focused}set focused(s){this._focused=s,this.input.focused=s}constructor(s,t){this.entryId=s,this.input=new K,t&&this.input.setValue(t)}invalidate(){}render(s){const t=[],n=s-2;return t.push(w(` ${d.fg("muted",h("\u6807\u7B7E\uFF08\u7559\u7A7A\u5373\u5220\u9664\uFF09\uFF1A"))}`,s)),t.push(...this.input.render(n).map(i=>w(` ${i}`,s))),t.push(w(` ${U("tui.select.confirm",h("\u4FDD\u5B58"))} ${U("tui.select.cancel",h("\u53D6\u6D88\u7F16\u8F91"))}`,s)),t}handleInput(s){const t=P();if(t.matches(s,"tui.select.confirm")){const e=this.input.getValue().trim();this.onSubmit?.(this.entryId,e||void 0)}else t.matches(s,"tui.select.cancel")?this.onCancel?.():this.input.handleInput(s)}}class xe extends B{static{b(this,"TreeSelectorComponent")}treeList;labelInput=null;labelInputContainer;treeContainer;onLabelChangeCallback;onCopy;_focused=!1;get focused(){return this._focused}set focused(s){this._focused=s,this.labelInput&&(this.labelInput.focused=s)}constructor(s,t,e,n,i,a,l,o){super(),this.onLabelChangeCallback=a;const r=Math.max(5,Math.floor(e/2));this.treeList=new oe(s,t,r,l,o),this.treeList.onSelect=n,this.treeList.onCancel=i,this.treeList.onCopy=c=>this.onCopy?.(c),this.treeList.onLabelEdit=(c,f)=>this.showLabelInput(c,f),this.treeContainer=new B,this.treeContainer.addChild(this.treeList),this.labelInputContainer=new B,this.addChild(new W(1)),this.addChild(q(h("\u4F1A\u8BDD\u6811"))),this.addChild(new X(d.bold(` ${h("\u6D4F\u89C8\u4F1A\u8BDD\u6811")}`),1,0)),this.addChild(new ae),this.addChild(new re(this.treeList)),this.addChild(new Z),this.addChild(new W(1)),this.addChild(this.treeContainer),this.addChild(this.labelInputContainer),this.addChild(new W(1)),this.addChild(J()),s.length===0&&setTimeout(()=>i(),100)}showLabelInput(s,t){this.labelInput=new fe(s,t),this.labelInput.onSubmit=(e,n)=>{this.treeList.updateNodeLabel(e,n),this.onLabelChangeCallback?.(e,n),this.hideLabelInput()},this.labelInput.onCancel=()=>this.hideLabelInput(),this.labelInput.focused=this._focused,this.treeContainer.clear(),this.labelInputContainer.clear(),this.labelInputContainer.addChild(this.labelInput)}hideLabelInput(){this.labelInput=null,this.labelInputContainer.clear(),this.treeContainer.clear(),this.treeContainer.addChild(this.treeList)}handleInput(s){this.labelInput?this.labelInput.handleInput(s):this.treeList.handleInput(s)}getTreeList(){return this.treeList}}export{xe as TreeSelectorComponent};
|
|
1
|
+
var z=Object.defineProperty;var b=(u,s)=>z(u,"name",{value:s,configurable:!0});import{Container as P,CURSOR_MARKER as K,getKeybindings as B,Input as Y,Spacer as H,sliceByColumn as X,Text as G,truncateToWidth as w,visibleWidth as v,wrapTextWithAnsi as Q}from"@earendil-works/pi-tui";import{formatReadLineRange as J}from"../../../core/tools/render-utils.js";import{fill as S,t as h}from"../../../dal/i18n.js";import{shortenHomePath as q}from"../../../utils/paths.js";import{theme as d}from"../theme/theme.js";import{chromeBottom as Z,chromeTop as D,DynamicBorder as ee}from"./dynamic-border.js";import{formatKeyText as te,keyHint as U}from"./keybinding-hints.js";const se=2,ne=4,ie=20,le=2,oe=12;function re(u,s){const t=Math.max(0,s-se),e=u.reduce((l,o)=>Math.max(l,o.bodyWidth),0),n=Math.max(0,e-t),i=u.find(l=>l.isSelected);let a=0;if(i&&n>0){const l=Math.min(ie,Math.max(ne,Math.floor(t/3)));if(i.anchorCol>t-l){const o=Math.min(oe,Math.max(le,Math.floor(t/4)));a=Math.min(n,i.anchorCol-o)}}return u.map(l=>{const o=a>0?`${l.gutter}${X(l.body,a,t,!0)}\x1B[0m`:l.gutter+l.body;return w(o,s,"")})}b(re,"renderHorizontalViewport");class ae{static{b(this,"TreeList")}flatNodes=[];filteredNodes=[];selectedIndex=0;currentLeafId;maxVisibleLines;filterMode="default";searchQuery="";toolCallMap=new Map;multipleRoots=!1;showLabelTimestamps=!1;activePathIds=new Set;visibleParentMap=new Map;visibleChildrenMap=new Map;lastSelectedId=null;foldedNodes=new Set;onSelect;onCancel;onCopy;onLabelEdit;constructor(s,t,e,n,i){this.currentLeafId=t,this.maxVisibleLines=e,this.filterMode=i??"default",this.multipleRoots=s.length>1,this.flatNodes=this.flattenTree(s),this.buildActivePath(),this.applyFilter();const a=n??t;this.selectedIndex=this.findNearestVisibleIndex(a),this.lastSelectedId=this.filteredNodes[this.selectedIndex]?.node.entry.id??null}findNearestVisibleIndex(s){if(this.filteredNodes.length===0)return 0;const t=new Map;for(const i of this.flatNodes)t.set(i.node.entry.id,i);const e=new Map(this.filteredNodes.map((i,a)=>[i.node.entry.id,a]));let n=s;for(;n!==null;){const i=e.get(n);if(i!==void 0)return i;const a=t.get(n);if(!a)break;n=a.node.entry.parentId??null}return this.filteredNodes.length-1}buildActivePath(){if(this.activePathIds.clear(),!this.currentLeafId)return;const s=new Map;for(const e of this.flatNodes)s.set(e.node.entry.id,e);let t=this.currentLeafId;for(;t;){this.activePathIds.add(t);const e=s.get(t);if(!e)break;t=e.node.entry.parentId??null}}flattenTree(s){const t=[];this.toolCallMap.clear();const e=[],n=new Map,i=this.currentLeafId;{const o=[],r=[...s];for(;r.length>0;){const c=r.pop();o.push(c);for(let f=c.children.length-1;f>=0;f--)r.push(c.children[f])}for(let c=o.length-1;c>=0;c--){const f=o[c];let I=i!==null&&f.entry.id===i;for(const C of f.children)n.get(C)&&(I=!0);n.set(f,I)}}const a=s.length>1,l=[...s].sort((o,r)=>Number(n.get(r))-Number(n.get(o)));for(let o=l.length-1;o>=0;o--){const r=o===l.length-1;e.push([l[o],a?1:0,a,a,r,[],a])}for(;e.length>0;){const[o,r,c,f,I,C,$]=e.pop(),g=o.entry;if(g.type==="message"&&g.message.role==="assistant"){const p=g.message.content;if(Array.isArray(p)){for(const m of p)if(typeof m=="object"&&m!==null&&"type"in m&&m.type==="toolCall"){const L=m;this.toolCallMap.set(L.id,{name:L.name,arguments:L.arguments})}}}t.push({node:o,indent:r,showConnector:f,isLast:I,gutters:C,isVirtualRootChild:$});const y=o.children,M=y.length>1,N=(()=>{const p=[],m=[];for(const L of y)n.get(L)?p.push(L):m.push(L);return[...p,...m]})();let x;M||c&&r>0?x=r+1:x=r;const R=f&&!$,T=this.multipleRoots?Math.max(0,r-1):r,_=Math.max(0,T-1),k=R?[...C,{position:_,show:!I}]:C;for(let p=N.length-1;p>=0;p--){const m=p===N.length-1;e.push([N[p],x,M,M,m,k,!1])}}return t}applyFilter(){this.filteredNodes.length>0&&(this.lastSelectedId=this.filteredNodes[this.selectedIndex]?.node.entry.id??this.lastSelectedId);const s=this.searchQuery.toLowerCase().split(/\s+/).filter(Boolean);if(this.filteredNodes=this.flatNodes.filter(t=>{const e=t.node.entry;if(e.type==="usage")return!1;const n=e.id===this.currentLeafId;if(e.type==="message"&&e.message.role==="assistant"&&!n){const l=e.message,o=this.hasTextContent(l.content),r=l.stopReason&&l.stopReason!=="stop"&&l.stopReason!=="toolUse";if(!o&&!r)return!1}let i=!0;const a=e.type==="label"||e.type==="context_edit"||e.type==="custom"||e.type==="model_change"||e.type==="thinking_level_change"||e.type==="session_info";switch(this.filterMode){case"user-only":i=e.type==="message"&&e.message.role==="user";break;case"no-tools":i=!a&&!(e.type==="message"&&e.message.role==="toolResult");break;case"labeled-only":i=t.node.label!==void 0;break;case"all":i=!0;break;default:i=!a;break}if(!i)return!1;if(s.length>0){const l=this.getSearchableText(t.node).toLowerCase();return s.every(o=>l.includes(o))}return!0}),this.foldedNodes.size>0){const t=new Set;for(const e of this.flatNodes){const{id:n,parentId:i}=e.node.entry;i!=null&&(this.foldedNodes.has(i)||t.has(i))&&t.add(n)}this.filteredNodes=this.filteredNodes.filter(e=>!t.has(e.node.entry.id))}this.recalculateVisualStructure(),this.lastSelectedId?this.selectedIndex=this.findNearestVisibleIndex(this.lastSelectedId):this.selectedIndex>=this.filteredNodes.length&&(this.selectedIndex=Math.max(0,this.filteredNodes.length-1)),this.filteredNodes.length>0&&(this.lastSelectedId=this.filteredNodes[this.selectedIndex]?.node.entry.id??this.lastSelectedId)}recalculateVisualStructure(){if(this.filteredNodes.length===0)return;const s=new Set(this.filteredNodes.map(r=>r.node.entry.id)),t=new Map;for(const r of this.flatNodes)t.set(r.node.entry.id,r);const e=b(r=>{let c=t.get(r)?.node.entry.parentId??null;for(;c!==null;){if(s.has(c))return c;c=t.get(c)?.node.entry.parentId??null}return null},"findVisibleAncestor"),n=new Map,i=new Map;i.set(null,[]);for(const r of this.filteredNodes){const c=r.node.entry.id,f=e(c);n.set(c,f),i.has(f)||i.set(f,[]),i.get(f).push(c)}const a=i.get(null);this.multipleRoots=a.length>1;const l=new Map;for(const r of this.filteredNodes)l.set(r.node.entry.id,r);const o=[];for(let r=a.length-1;r>=0;r--){const c=r===a.length-1;o.push([a[r],this.multipleRoots?1:0,this.multipleRoots,this.multipleRoots,c,[],this.multipleRoots])}for(;o.length>0;){const[r,c,f,I,C,$,g]=o.pop(),y=l.get(r);if(!y)continue;y.indent=c,y.showConnector=I,y.isLast=C,y.gutters=$,y.isVirtualRootChild=g;const M=i.get(r)||[],N=M.length>1;let x;N||f&&c>0?x=c+1:x=c;const R=I&&!g,T=this.multipleRoots?Math.max(0,c-1):c,_=Math.max(0,T-1),k=R?[...$,{position:_,show:!C}]:$;for(let p=M.length-1;p>=0;p--){const m=p===M.length-1;o.push([M[p],x,N,N,m,k,!1])}}this.visibleParentMap=n,this.visibleChildrenMap=i}getSearchableText(s){const t=s.entry,e=[];switch(s.label&&e.push(s.label),t.type){case"message":{const n=t.message;if(e.push(n.role),"content"in n&&n.content&&e.push(this.extractContent(n.content)),n.role==="bashExecution"){const i=n;i.command&&e.push(i.command)}break}case"custom_message":{e.push(t.customType),typeof t.content=="string"?e.push(t.content):e.push(this.extractContent(t.content));break}case"compaction":e.push("compaction");break;case"branch_summary":e.push("branch summary",t.summary);break;case"session_info":e.push("title"),t.name&&e.push(t.name);break;case"model_change":e.push("model",t.modelId);break;case"thinking_level_change":e.push("thinking",t.thinkingLevel);break;case"custom":e.push("custom",t.customType);break;case"context_edit":e.push("context edit",t.replacement===null?"omit":"replace",t.targetId);break;case"label":e.push("label",t.label??"");break}return e.join(" ")}invalidate(){}getSearchQuery(){return this.searchQuery}getSelectedNode(){return this.filteredNodes[this.selectedIndex]?.node}copySelected(){const s=this.getSelectedNode();this.onCopy?.(s?this.getEntryCopyText(s):void 0)}updateNodeLabel(s,t,e){for(const n of this.flatNodes)if(n.node.entry.id===s){n.node.label=t,n.node.labelTimestamp=t?e??new Date().toISOString():void 0;break}}getStatusLabels(){let s="";switch(this.filterMode){case"no-tools":s+=" [no-tools]";break;case"user-only":s+=" [user]";break;case"labeled-only":s+=" [labeled]";break;case"all":s+=" [all]";break}return this.showLabelTimestamps&&(s+=` [+${h("\u6807\u7B7E\u65F6\u95F4")}]`),s}render(s){const t=[];if(this.filteredNodes.length===0)return t.push(w(d.fg("muted",` ${h("\u6CA1\u6709\u627E\u5230\u6761\u76EE")}`),s)),t.push(w(d.fg("muted",` (0/0)${this.getStatusLabels()}`),s)),t;const e=Math.max(0,Math.min(this.selectedIndex-Math.floor(this.maxVisibleLines/2),this.filteredNodes.length-this.maxVisibleLines)),n=Math.min(e+this.maxVisibleLines,this.filteredNodes.length),i=[];for(let a=e;a<n;a++){const l=this.filteredNodes[a],o=l.node.entry,r=a===this.selectedIndex,c=r?d.fg("accent","\u203A "):" ",f=this.multipleRoots?Math.max(0,l.indent-1):l.indent,I=l.showConnector&&!l.isVirtualRootChild?l.isLast?"\u2514\u2500 ":"\u251C\u2500 ":"",C=I?f-1:-1,$=f*3,g=[],y=this.foldedNodes.has(o.id);for(let E=0;E<$;E++){const W=Math.floor(E/3),A=E%3,j=l.gutters.find(V=>V.position===W);if(j)A===0?g.push(j.show?"\u2502":" "):g.push(" ");else if(I&&W===C)if(A===0)g.push(l.isLast?"\u2514":"\u251C");else if(A===1){const V=this.isFoldable(o.id);g.push(y?"\u229E":V?"\u229F":"\u2500")}else g.push(" ");else g.push(" ")}const M=g.join(""),N=l.showConnector&&!l.isVirtualRootChild,x=y&&!N?d.fg("accent","\u229E "):"",T=this.activePathIds.has(o.id)?d.fg("accent","\u2022 "):"",_=l.node.label?d.fg("warning",`[${l.node.label}] `):"",k=this.showLabelTimestamps&&l.node.label&&l.node.labelTimestamp?d.fg("muted",`${this.formatLabelTimestamp(l.node.labelTimestamp)} `):"",p=this.getEntryDisplayText(l.node,r),m=d.fg("dim",M)+x+T,L=v(m);let O=c,F=m+_+k+p;r&&(O=d.bg("selectedBg",O),F=d.bg("selectedBg",F)),i.push({gutter:O,body:F,anchorCol:L,bodyWidth:v(F),isSelected:r})}return t.push(...re(i,s)),t.push(w(d.fg("muted",` (${this.selectedIndex+1}/${this.filteredNodes.length})${this.getStatusLabels()}`),s)),t}getEntryDisplayText(s,t){const e=s.entry;let n;const i=b(a=>a.replace(/[\n\t]/g," ").trim(),"normalize");switch(e.type){case"message":{const a=e.message,l=a.role;if(l==="user"){const o=a,r=i(this.extractContent(o.content));n=d.fg("accent",h("\u7528\u6237\u6D88\u606F\uFF1A"))+r}else if(l==="assistant"){const o=a,r=i(this.extractContent(o.content));if(r)n=d.fg("success",h("AI\uFF1A"))+r;else if(o.stopReason==="aborted")n=d.fg("success",h("AI\uFF1A"))+d.fg("muted",h("\uFF08\u5DF2\u4E2D\u65AD\uFF09"));else if(o.errorMessage){const c=i(o.errorMessage).slice(0,80);n=d.fg("success",h("AI\uFF1A"))+d.fg("error",c)}else n=d.fg("success",h("AI\uFF1A"))+d.fg("muted",h("\uFF08\u65E0\u5185\u5BB9\uFF09"))}else if(l==="toolResult"){const o=a,r=o.toolCallId?this.toolCallMap.get(o.toolCallId):void 0;r?n=d.fg("muted",this.formatToolCall(r.name,r.arguments)):n=d.fg("muted",`[${o.toolName??"tool"}]`)}else if(l==="bashExecution"){const o=a;n=d.fg("dim",`[bash]: ${i(o.command??"")}`)}else n=d.fg("dim",`[${l}]`);break}case"custom_message":{const a=typeof e.content=="string"?e.content:e.content.filter(l=>l.type==="text").map(l=>l.text).join("");n=d.fg("customMessageLabel",`[${e.customType}]: `)+i(a);break}case"compaction":{const a=Math.round(e.tokensBefore/1e3);n=d.fg("borderAccent",`[${S(h("\u538B\u7F29\uFF1A{tokens}k tokens"),{tokens:a})}]`);break}case"branch_summary":n=d.fg("warning",`[${h("\u5206\u652F\u6458\u8981\u8BB0\u5F55")}]: `)+i(e.summary);break;case"model_change":n=d.fg("dim",`[${S(h("\u6A21\u578B\uFF1A{model}"),{model:e.modelId})}]`);break;case"thinking_level_change":n=d.fg("dim",`[${S(h("\u601D\u8003\uFF1A{level}"),{level:e.thinkingLevel})}]`);break;case"custom":n=d.fg("dim",`[${S(h("\u81EA\u5B9A\u4E49\uFF1A{type}"),{type:e.customType})}]`);break;case"context_edit":n=d.fg("dim",`[${S(e.replacement===null?h("\u4E0A\u4E0B\u6587\u7701\u7565\uFF1A{target}"):h("\u4E0A\u4E0B\u6587\u66FF\u6362\uFF1A{target}"),{target:e.targetId})}]`);break;case"label":n=d.fg("dim",`[${S(h("\u6807\u7B7E\uFF1A{label}"),{label:e.label??h("\uFF08\u5DF2\u6E05\u9664\uFF09")})}]`);break;case"session_info":n=e.name?[d.fg("dim","[title: "),d.fg("dim",e.name),d.fg("dim","]")].join(""):[d.fg("dim","[title: "),d.italic(d.fg("dim","empty")),d.fg("dim","]")].join("");break;default:n=""}return t?d.bold(n):n}formatLabelTimestamp(s){const t=new Date(s),e=new Date,n=t.getHours().toString().padStart(2,"0"),i=t.getMinutes().toString().padStart(2,"0"),a=`${n}:${i}`;if(t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate())return a;const l=t.getMonth()+1,o=t.getDate();return t.getFullYear()===e.getFullYear()?`${l}/${o} ${a}`:`${t.getFullYear().toString().slice(-2)}/${l}/${o} ${a}`}extractContent(s){return this.extractFullContent(s).slice(0,200)}extractFullContent(s){if(typeof s=="string")return s;if(!Array.isArray(s))return"";let t="";for(const e of s)typeof e=="object"&&e!==null&&"type"in e&&e.type==="text"&&(t+=e.text);return t}getEntryCopyText(s){const t=s.entry;let e;switch(t.type){case"message":t.message.role==="bashExecution"?e=t.message.command:"content"in t.message&&(e=this.extractFullContent(t.message.content),!e&&t.message.role==="assistant"&&(e=t.message.errorMessage));break;case"custom_message":e=this.extractFullContent(t.content);break;case"compaction":e=t.summary;break;case"branch_summary":e=t.summary;break}return e?.trim()?e:void 0}hasTextContent(s){if(typeof s=="string")return s.trim().length>0;if(Array.isArray(s)){for(const t of s)if(typeof t=="object"&&t!==null&&"type"in t&&t.type==="text"){const e=t.text;if(e&&e.trim().length>0)return!0}}return!1}formatToolCall(s,t){const e=b(n=>q(n,process.env.HOME||process.env.USERPROFILE||""),"shortenPath");switch(s){case"read":return`[read: ${e(String(t.path||t.file_path||""))}${J(t.offset,t.limit)}]`;case"write":return`[write: ${e(String(t.path||t.file_path||""))}]`;case"edit":return`[edit: ${e(String(t.path||t.file_path||""))}]`;case"bash":{const n=String(t.command||"");return`[bash: ${n.replace(/[\n\t]/g," ").trim().slice(0,50)}${n.length>50?"...":""}]`}case"grep":{const n=String(t.pattern||""),i=e(String(t.path||"."));return`[grep: /${n}/ in ${i}]`}case"find":{const n=String(t.pattern||""),i=e(String(t.path||"."));return`[find: ${n} in ${i}]`}case"ls":return`[ls: ${e(String(t.path||"."))}]`;default:{const n=JSON.stringify(t).slice(0,40);return`[${s}: ${n}${JSON.stringify(t).length>40?"...":""}]`}}}handleInput(s){const t=B();if(t.matches(s,"tui.select.up"))this.selectedIndex=this.selectedIndex===0?this.filteredNodes.length-1:this.selectedIndex-1;else if(t.matches(s,"tui.select.down"))this.selectedIndex=this.selectedIndex===this.filteredNodes.length-1?0:this.selectedIndex+1;else if(t.matches(s,"app.tree.foldOrUp")){const e=this.filteredNodes[this.selectedIndex]?.node.entry.id;e&&this.isFoldable(e)&&!this.foldedNodes.has(e)?(this.foldedNodes.add(e),this.applyFilter()):this.selectedIndex=this.findBranchSegmentStart("up")}else if(t.matches(s,"app.tree.unfoldOrDown")){const e=this.filteredNodes[this.selectedIndex]?.node.entry.id;e&&this.foldedNodes.has(e)?(this.foldedNodes.delete(e),this.applyFilter()):this.selectedIndex=this.findBranchSegmentStart("down")}else if(t.matches(s,"tui.editor.cursorLeft")||t.matches(s,"tui.select.pageUp"))this.selectedIndex=Math.max(0,this.selectedIndex-this.maxVisibleLines);else if(t.matches(s,"tui.editor.cursorRight")||t.matches(s,"tui.select.pageDown"))this.selectedIndex=Math.min(this.filteredNodes.length-1,this.selectedIndex+this.maxVisibleLines);else if(t.matches(s,"tui.select.confirm")){const e=this.filteredNodes[this.selectedIndex];e&&this.onSelect&&this.onSelect(e.node.entry.id)}else if(t.matches(s,"app.message.copy"))this.copySelected();else if(t.matches(s,"tui.select.cancel"))this.searchQuery?(this.searchQuery="",this.foldedNodes.clear(),this.applyFilter()):this.onCancel?.();else if(t.matches(s,"app.tree.filter.default"))this.filterMode="default",this.foldedNodes.clear(),this.applyFilter();else if(t.matches(s,"app.tree.filter.noTools"))this.filterMode=this.filterMode==="no-tools"?"default":"no-tools",this.foldedNodes.clear(),this.applyFilter();else if(t.matches(s,"app.tree.filter.userOnly"))this.filterMode=this.filterMode==="user-only"?"default":"user-only",this.foldedNodes.clear(),this.applyFilter();else if(t.matches(s,"app.tree.filter.labeledOnly"))this.filterMode=this.filterMode==="labeled-only"?"default":"labeled-only",this.foldedNodes.clear(),this.applyFilter();else if(t.matches(s,"app.tree.filter.all"))this.filterMode=this.filterMode==="all"?"default":"all",this.foldedNodes.clear(),this.applyFilter();else if(t.matches(s,"app.tree.filter.cycleBackward")){const e=["default","no-tools","user-only","labeled-only","all"],n=e.indexOf(this.filterMode);this.filterMode=e[(n-1+e.length)%e.length],this.foldedNodes.clear(),this.applyFilter()}else if(t.matches(s,"app.tree.filter.cycleForward")){const e=["default","no-tools","user-only","labeled-only","all"],n=e.indexOf(this.filterMode);this.filterMode=e[(n+1)%e.length],this.foldedNodes.clear(),this.applyFilter()}else if(t.matches(s,"tui.editor.deleteCharBackward"))this.searchQuery.length>0&&(this.searchQuery=this.searchQuery.slice(0,-1),this.foldedNodes.clear(),this.applyFilter());else if(t.matches(s,"app.tree.editLabel")){const e=this.filteredNodes[this.selectedIndex];e&&this.onLabelEdit&&this.onLabelEdit(e.node.entry.id,e.node.label)}else t.matches(s,"app.tree.toggleLabelTimestamp")?this.showLabelTimestamps=!this.showLabelTimestamps:![...s].some(n=>{const i=n.charCodeAt(0);return i<32||i===127||i>=128&&i<=159})&&s.length>0&&(this.searchQuery+=s,this.foldedNodes.clear(),this.applyFilter())}isFoldable(s){const t=this.visibleChildrenMap.get(s);if(!t||t.length===0)return!1;const e=this.visibleParentMap.get(s);if(e==null)return!0;const n=this.visibleChildrenMap.get(e);return n!==void 0&&n.length>1}findBranchSegmentStart(s){const t=this.filteredNodes[this.selectedIndex]?.node.entry.id;if(!t)return this.selectedIndex;const e=new Map(this.filteredNodes.map((i,a)=>[i.node.entry.id,a]));let n=t;if(s==="down")for(;;){const i=this.visibleChildrenMap.get(n)??[];if(i.length===0)return e.get(n);if(i.length>1)return e.get(i[0]);n=i[0]}for(;;){const i=this.visibleParentMap.get(n)??null;if(i===null)return e.get(n);if((this.visibleChildrenMap.get(i)??[]).length>1){const l=e.get(n);if(l<this.selectedIndex)return l}n=i}}}class de{static{b(this,"SearchLine")}focused=!1;treeList;constructor(s){this.treeList=s}invalidate(){}render(s){if(s<=0)return[""];const t=this.treeList.getSearchQuery(),e=t?` ${d.fg("muted",h("\u8F93\u5165\u6587\u5B57\u641C\u7D22\uFF1A"))} ${d.fg("accent",t)}`:` ${d.fg("muted",h("\u8F93\u5165\u6587\u5B57\u641C\u7D22\uFF1A"))} `;return this.focused?[`${w(e,Math.max(0,s-1))}${K}\x1B[7m \x1B[27m`]:[w(e,s)]}handleInput(s){}}class ce{static{b(this,"TreeHelp")}invalidate(){}render(s){const t=he().map(({keys:o,label:r,labelFirst:c})=>{const f=fe(o);return f?c?`${r} ${f}`:`${f} ${r}`:r}),e=Math.max(1,s),n=" ",i=" \xB7 ",a=[];let l="";for(const o of t){const r=l?`${l}${i}${o}`:v(`${n}${o}`)<=e?`${n}${o}`:o;if(!l||v(r)<=e){l=r;continue}a.push(...Q(l.trimEnd(),e)),l=v(`${n}${o}`)<=e?`${n}${o}`:o}return l&&a.push(...Q(l.trimEnd(),e)),a.map(o=>d.fg("muted",o))}}const he=b(()=>[{keys:["tui.select.up","tui.select.down"],label:h("\u79FB\u52A8")},{keys:["tui.editor.cursorLeft","tui.editor.cursorRight"],label:h("\u7FFB\u9875")},{keys:["app.tree.foldOrUp","app.tree.unfoldOrDown"],label:h("\u5206\u652F")},{keys:["app.message.copy"],label:h("\u590D\u5236")},{keys:["app.tree.editLabel"],label:h("\u6807\u7B7E")},{keys:["app.tree.toggleLabelTimestamp"],label:h("\u6807\u7B7E\u65F6\u95F4")},{keys:["app.tree.filter.default","app.tree.filter.noTools","app.tree.filter.userOnly","app.tree.filter.labeledOnly","app.tree.filter.all"],label:h("\u7B5B\u9009"),labelFirst:!0},{keys:["app.tree.filter.cycleForward","app.tree.filter.cycleBackward"],label:h("\u8F6E\u6362"),labelFirst:!0}],"treeHelpItems");function fe(u){const s=[];for(const t of u){const e=B().getKeys(t)[0];e!==void 0&&s.push(e)}return s.length===0?"":te(ue(s)).replace(/\bpageUp\b/g,"pgup").replace(/\bpageDown\b/g,"pgdn").replace(/\bup\b/g,"\u2191").replace(/\bdown\b/g,"\u2193").replace(/\bleft\b/g,"\u2190").replace(/\bright\b/g,"\u2192")}b(fe,"formatHelpKeys");function ue(u){if(u.length===1)return u[0];const s=u.map(e=>{const n=e.lastIndexOf("+");return n===-1?{prefix:"",suffix:e}:{prefix:e.slice(0,n+1),suffix:e.slice(n+1)}}),t=s[0].prefix;return t&&s.every(e=>e.prefix===t)?`${t}${s.map(e=>e.suffix).join("/")}`:u.join("/")}b(ue,"compactRawKeys");class pe{static{b(this,"LabelInput")}input;entryId;onSubmit;onCancel;_focused=!1;get focused(){return this._focused}set focused(s){this._focused=s,this.input.focused=s}constructor(s,t){this.entryId=s,this.input=new Y,t&&this.input.setValue(t)}invalidate(){}render(s){const t=[],n=s-2;return t.push(w(` ${d.fg("muted",h("\u6807\u7B7E\uFF08\u7559\u7A7A\u5373\u5220\u9664\uFF09\uFF1A"))}`,s)),t.push(...this.input.render(n).map(i=>w(` ${i}`,s))),t.push(w(` ${U("tui.select.confirm",h("\u4FDD\u5B58"))} ${U("tui.select.cancel",h("\u53D6\u6D88\u7F16\u8F91"))}`,s)),t}handleInput(s){const t=B();if(t.matches(s,"tui.select.confirm")){const e=this.input.getValue().trim();this.onSubmit?.(this.entryId,e||void 0)}else t.matches(s,"tui.select.cancel")?this.onCancel?.():this.input.handleInput(s)}}class Ne extends P{static{b(this,"TreeSelectorComponent")}treeList;searchLine;labelInput=null;labelInputContainer;treeContainer;onLabelChangeCallback;onCopy;_focused=!1;get focused(){return this._focused}set focused(s){this._focused=s,this.searchLine.focused=s&&this.labelInput===null,this.labelInput&&(this.labelInput.focused=s)}constructor(s,t,e,n,i,a,l,o){super(),this.onLabelChangeCallback=a;const r=Math.max(5,Math.floor(e/2));this.treeList=new ae(s,t,r,l,o),this.treeList.onSelect=n,this.treeList.onCancel=i,this.treeList.onCopy=c=>this.onCopy?.(c),this.treeList.onLabelEdit=(c,f)=>this.showLabelInput(c,f),this.searchLine=new de(this.treeList),this.treeContainer=new P,this.treeContainer.addChild(this.treeList),this.labelInputContainer=new P,this.addChild(new H(1)),this.addChild(D(h("\u4F1A\u8BDD\u6811"))),this.addChild(new G(d.bold(` ${h("\u6D4F\u89C8\u4F1A\u8BDD\u6811")}`),1,0)),this.addChild(new ce),this.addChild(this.searchLine),this.addChild(new ee),this.addChild(new H(1)),this.addChild(this.treeContainer),this.addChild(this.labelInputContainer),this.addChild(new H(1)),this.addChild(Z()),s.length===0&&setTimeout(()=>i(),100)}showLabelInput(s,t){this.labelInput=new pe(s,t),this.labelInput.onSubmit=(e,n)=>{this.treeList.updateNodeLabel(e,n),this.onLabelChangeCallback?.(e,n),this.hideLabelInput()},this.labelInput.onCancel=()=>this.hideLabelInput(),this.focused=this._focused,this.treeContainer.clear(),this.labelInputContainer.clear(),this.labelInputContainer.addChild(this.labelInput)}hideLabelInput(){this.labelInput=null,this.focused=this._focused,this.labelInputContainer.clear(),this.treeContainer.clear(),this.treeContainer.addChild(this.treeList)}get capturesViewportInput(){return this.labelInput===null}handleInput(s){this.labelInput?this.labelInput.handleInput(s):this.treeList.handleInput(s)}getTreeList(){return this.treeList}}export{Ne as TreeSelectorComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var M=Object.defineProperty;var a=(
|
|
1
|
+
var M=Object.defineProperty;var a=(c,s)=>M(c,"name",{value:s,configurable:!0});import{Container as L,getKeybindings as b,getSelectPageIndex as w,Spacer as d,Text as g,truncateToWidth as S}from"@earendil-works/pi-tui";import{t as l}from"../../../dal/i18n.js";import{theme as h}from"../theme/theme.js";import{chromeBottom as V,chromeTop as $}from"./dynamic-border.js";class T{static{a(this,"UserMessageList")}capturesViewportInput=!0;messages=[];selectedIndex=0;onSelect;onCancel;maxVisible=10;constructor(s,e){this.messages=s;const t=e?s.findIndex(i=>i.id===e):-1;this.selectedIndex=t>=0?t:Math.max(0,s.length-1)}invalidate(){}render(s){const e=[];if(this.messages.length===0)return e.push(h.fg("muted",` ${l("\u6CA1\u6709\u627E\u5230\u4F60\u53D1\u8FC7\u7684\u6D88\u606F")}`)),e;const t=Math.max(0,Math.min(this.selectedIndex-Math.floor(this.maxVisible/2),this.messages.length-this.maxVisible)),i=Math.min(t+this.maxVisible,this.messages.length);for(let n=t;n<i;n++){const r=this.messages[n],o=n===this.selectedIndex,x=r.text.replace(/\n/g," ").trim(),u=o?h.fg("accent","\u203A "):" ",f=s-2,m=S(x,f),p=u+(o?h.bold(m):m);e.push(p);const I=` Message ${n+1} of ${this.messages.length}`,C=h.fg("muted",I);e.push(C),e.push("")}if(t>0||i<this.messages.length){const n=h.fg("muted",` (${this.selectedIndex+1}/${this.messages.length})`);e.push(n)}return e}handleInput(s){const e=b(),t=w(e,s,this.selectedIndex,this.messages.length,this.maxVisible);if(e.matches(s,"tui.select.up"))this.selectedIndex=this.selectedIndex===0?this.messages.length-1:this.selectedIndex-1;else if(e.matches(s,"tui.select.down"))this.selectedIndex=this.selectedIndex===this.messages.length-1?0:this.selectedIndex+1;else if(t!==void 0){if(this.messages.length===0)return;this.selectedIndex=t}else if(e.matches(s,"tui.select.confirm")){const i=this.messages[this.selectedIndex];i&&this.onSelect&&this.onSelect(i.id)}else e.matches(s,"tui.select.cancel")&&this.onCancel&&this.onCancel()}}class P extends L{static{a(this,"UserMessageSelectorComponent")}messageList;constructor(s,e,t,i){super(),this.addChild(new d(1)),this.addChild(new g(h.bold(l("\u4ECE\u6D88\u606F\u5206\u53C9")),1,0)),this.addChild(new g(h.fg("muted",l("\u9009\u62E9\u4E00\u6761\u4F60\u53D1\u8FC7\u7684\u6D88\u606F\uFF0C\u628A\u622A\u81F3\u8FD9\u6761\u6D88\u606F\u7684\u5BF9\u8BDD\u590D\u5236\u5230\u65B0\u4F1A\u8BDD")),1,0)),this.addChild(new d(1)),this.addChild($(l("\u9009\u62E9\u6D88\u606F"))),this.addChild(new d(1)),this.messageList=new T(s,i),this.messageList.onSelect=e,this.messageList.onCancel=t,this.addChild(this.messageList),this.addChild(new d(1)),this.addChild(V()),s.length===0&&setTimeout(()=>t(),100)}getMessageList(){return this.messageList}}export{P as UserMessageSelectorComponent};
|
|
@@ -6,8 +6,9 @@ export declare class UserMessageComponent extends Container {
|
|
|
6
6
|
private markdownTheme;
|
|
7
7
|
private outputPad;
|
|
8
8
|
private markdownTransformers;
|
|
9
|
+
private messageId;
|
|
9
10
|
private timestamp;
|
|
10
|
-
constructor(text: string, markdownTheme?: MarkdownTheme, outputPad?: number, markdownTransformers?: readonly MarkdownTransformer[], timestamp?:
|
|
11
|
+
constructor(text: string, markdownTheme?: MarkdownTheme, outputPad?: number, markdownTransformers?: readonly MarkdownTransformer[], messageId?: string, timestamp?: string);
|
|
11
12
|
setOutputPad(padding: number): void;
|
|
12
13
|
private rebuild;
|
|
13
14
|
render(width: number): string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var h=Object.defineProperty;var
|
|
1
|
+
var h=Object.defineProperty;var m=(n,t)=>h(n,"name",{value:t,configurable:!0});import{Container as g,Markdown as c}from"@earendil-works/pi-tui";import{getMarkdownTheme as l,theme as u}from"../theme/theme.js";import{createMarkdownTransform as p}from"./markdown-transform.js";const f="\x1B]133;A\x07",x="\x1B]133;B\x07",T="\x1B]133;C\x07";function k(n,t=new Date){if(!Number.isFinite(n)||n<=0)return;const r=new Date(n);if(Number.isNaN(r.getTime()))return;const a=r.getHours().toString().padStart(2,"0"),i=r.getMinutes().toString().padStart(2,"0"),s=`${a}:${i}`;if(r.getFullYear()===t.getFullYear()&&r.getMonth()===t.getMonth()&&r.getDate()===t.getDate())return s;const e=r.getMonth()+1,o=r.getDate();return r.getFullYear()===t.getFullYear()?`${e}/${o} ${s}`:`${r.getFullYear().toString().slice(-2)}/${e}/${o} ${s}`}m(k,"formatTurnTime");class S extends g{static{m(this,"UserMessageComponent")}text;markdownTheme;outputPad;markdownTransformers;messageId;timestamp;constructor(t,r=l(),a=1,i=[],s,e){super(),this.text=t,this.markdownTheme=r,this.outputPad=a,this.markdownTransformers=i,this.messageId=s,this.timestamp=e,this.rebuild()}setOutputPad(t){this.outputPad=t,this.rebuild()}rebuild(){this.clear(),this.addChild(new c(this.text,0,0,this.markdownTheme,{color:m(t=>u.fg("userMessageText",t),"color")},{preserveOrderedListMarkers:!0,preserveBackslashEscapes:!0,transform:p("user",()=>!1,this.markdownTransformers,this.messageId,this.timestamp)}))}render(t){const a=Math.max(1,t-2),i=super.render(a),s=u.fg("accent","\u258D "),e=(i.length===0?[""]:i).map(d=>`${s}${d}`),o=k(this.timestamp?Date.parse(this.timestamp):0);return o&&e.unshift(u.fg("dim",o)),this.outputPad>0&&e.push(""),e[0]=f+e[0],e[e.length-1]=x+T+e[e.length-1],e}}export{S as UserMessageComponent,k as formatTurnTime};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
2
|
-
${
|
|
3
|
-
`)
|
|
1
|
+
var w=Object.defineProperty;var d=(t,o)=>w(t,"name",{value:o,configurable:!0});import{spawn as h}from"node:child_process";import{mkdtempSync as g,readFileSync as S,rmSync as $,writeFileSync as x}from"node:fs";import{tmpdir as A}from"node:os";import{join as l}from"node:path";import{fill as m,t as e}from"../../dal/i18n.js";import{stripBom as E}from"../../utils/text.js";async function D(t){const o=g(l(A(),"dal-editor-")),c=l(o,"prompt.md");try{x(c,t.content,"utf-8");const i=t.command.match(/(?:[^\s"]+|"[^"]*")+/g)?.map(n=>n.replaceAll('"',""))??[],s=i[0]??"",f=i.slice(1),p=process.platform==="win32"&&s.includes(" ")?`"${s}"`:s;process.stdout.write(`${m(e("\u6B63\u5728\u6253\u5F00\u5916\u90E8\u7F16\u8F91\u5668\uFF1A{command}"),{command:t.command})}
|
|
2
|
+
${e("\u5173\u95ED\u7F16\u8F91\u5668\u540E\u4F1A\u56DE\u5230 DAL\u3002")}
|
|
3
|
+
`);const r=await new Promise(n=>{const a=h(p,[...f,c],{stdio:"inherit",shell:process.platform==="win32"});a.on("error",()=>n(null)),a.on("close",(u,y)=>n(u??y))});return r===null?{status:"failed",message:m(e("\u65E0\u6CD5\u542F\u52A8\u5916\u90E8\u7F16\u8F91\u5668\uFF1A{command}"),{command:t.command})}:r!==0?{status:"failed",message:m(e("\u5916\u90E8\u7F16\u8F91\u5668\u4EE5 {status} \u9000\u51FA\uFF1B\u8F93\u5165\u5185\u5BB9\u672A\u6539\u52A8"),{status:typeof r=="number"?m(e("\u9000\u51FA\u7801 {code}"),{code:r}):r})}:{status:"complete",content:E(S(c,"utf-8")).replace(/\n$/,"")}}finally{try{$(o,{recursive:!0,force:!0})}catch{}}}d(D,"editInExternalEditor");export{D as editInExternalEditor};
|
|
@@ -64,7 +64,9 @@ export declare class InteractiveMode {
|
|
|
64
64
|
private lastSigintTime;
|
|
65
65
|
private lastEscapeTime;
|
|
66
66
|
private changelogMarkdown;
|
|
67
|
+
private extensionChangelogUpdates;
|
|
67
68
|
private startupNoticesShown;
|
|
69
|
+
private cacheWarmingNotice;
|
|
68
70
|
private anthropicSubscriptionWarningShown;
|
|
69
71
|
private lastStatusSpacer;
|
|
70
72
|
private lastStatusText;
|
|
@@ -98,6 +100,8 @@ export declare class InteractiveMode {
|
|
|
98
100
|
private bugReportHintShown;
|
|
99
101
|
private installChangeWarningShown;
|
|
100
102
|
private extensionDialogs;
|
|
103
|
+
private nextBlockingOverlayId;
|
|
104
|
+
private readonly extensionOverlays;
|
|
101
105
|
private extensionTerminalInputSubscriptions;
|
|
102
106
|
private extensionWidgetsAbove;
|
|
103
107
|
private extensionWidgetsBelow;
|
|
@@ -132,12 +136,16 @@ export declare class InteractiveMode {
|
|
|
132
136
|
private checkForPackageUpdates;
|
|
133
137
|
private checkTmuxKeyboardSetup;
|
|
134
138
|
private getChangelogForDisplay;
|
|
139
|
+
private getExtensionChangelogUpdates;
|
|
140
|
+
private readPackageJson;
|
|
135
141
|
private reportInstallTelemetry;
|
|
136
142
|
private getMarkdownThemeWithSettings;
|
|
137
143
|
private formatDisplayPath;
|
|
138
144
|
private formatExtensionDisplayPath;
|
|
139
145
|
private formatContextPath;
|
|
140
146
|
private getStartupExpansionState;
|
|
147
|
+
private getModelScopeNotice;
|
|
148
|
+
private showFullscreenModelScopeNotice;
|
|
141
149
|
private shouldShowStartupDetails;
|
|
142
150
|
private getShortPath;
|
|
143
151
|
private getCompactPathLabel;
|
|
@@ -170,6 +178,7 @@ export declare class InteractiveMode {
|
|
|
170
178
|
private renderCurrentSessionState;
|
|
171
179
|
private getRegisteredToolDefinition;
|
|
172
180
|
private getMarkdownTransformers;
|
|
181
|
+
private createChangelogMarkdown;
|
|
173
182
|
private setupExtensionShortcuts;
|
|
174
183
|
private setExtensionStatus;
|
|
175
184
|
private setExtensionPanel;
|
|
@@ -296,9 +305,9 @@ export declare class InteractiveMode {
|
|
|
296
305
|
private showTreeSelector;
|
|
297
306
|
private showSessionSelector;
|
|
298
307
|
private handleResumeSession;
|
|
308
|
+
private switchToForkedSession;
|
|
299
309
|
private getLoginProviderOptions;
|
|
300
310
|
private getLogoutProviderOptions;
|
|
301
|
-
private findLoginProviderOptions;
|
|
302
311
|
private handleLoginCommand;
|
|
303
312
|
private startProviderLogin;
|
|
304
313
|
private showLoginAuthTypeSelector;
|