@humain/terminal 0.0.17 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/dist/bun/cli.d.ts +3 -1
- package/dist/bun/cli.d.ts.map +1 -1
- package/dist/bun/cli.js +3 -8
- package/dist/bun/cli.js.map +1 -1
- package/dist/bun/runtime-setup.d.ts +2 -0
- package/dist/bun/runtime-setup.d.ts.map +1 -0
- package/dist/bun/runtime-setup.js +9 -0
- package/dist/bun/runtime-setup.js.map +1 -0
- package/dist/bun/sandbox-env-setup.d.ts +2 -0
- package/dist/bun/sandbox-env-setup.d.ts.map +1 -0
- package/dist/bun/sandbox-env-setup.js +4 -0
- package/dist/bun/sandbox-env-setup.js.map +1 -0
- package/dist/bundle/chunks/anthropic-messages-XULXUBIG.js +6 -0
- package/dist/bundle/chunks/{azure-openai-responses-ZN52D6YC.js → azure-openai-responses-JEG2XOYC.js} +1 -1
- package/dist/bundle/chunks/bedrock-converse-stream.js +6 -6
- package/dist/bundle/chunks/{chunk-ARF4OE6X.js → chunk-2LC3S3VV.js} +8 -8
- package/dist/bundle/chunks/chunk-43O5DDAH.js +31 -0
- package/dist/bundle/chunks/{chunk-H2O6VOXT.js → chunk-46DC2JD6.js} +2 -2
- package/dist/bundle/chunks/chunk-7ZC4UXSL.js +2 -0
- package/dist/bundle/chunks/{chunk-WJZ4KLGL.js → chunk-E6KP6V7F.js} +1 -1
- package/dist/bundle/chunks/{chunk-PSKDLDLZ.js → chunk-HPPQHK3J.js} +3 -3
- package/dist/bundle/chunks/chunk-JUPSJTFQ.js +42 -0
- package/dist/bundle/chunks/chunk-PL7O7J4J.js +133 -0
- package/dist/bundle/chunks/{chunk-PFVS5ZYL.js → chunk-RM336IEI.js} +378 -369
- package/dist/bundle/chunks/chunk-USJZMAIR.js +2 -0
- package/dist/bundle/chunks/{extract-2L7ZVN7F.js → extract-TRW5FBY6.js} +2 -2
- package/dist/bundle/chunks/github-copilot.js +1 -1
- package/dist/bundle/chunks/{google-generative-ai-FF7M7XHT.js → google-generative-ai-OX6VSCA6.js} +1 -1
- package/dist/bundle/chunks/{google-vertex-YMUBFRBA.js → google-vertex-GW76GSS2.js} +1 -1
- package/dist/bundle/chunks/image-resize-worker.js +1 -1
- package/dist/bundle/chunks/{mistral-conversations-O4M7IQML.js → mistral-conversations-WXGXZOFJ.js} +1 -1
- package/dist/bundle/chunks/node-AUOGOBCN.js +2 -0
- package/dist/bundle/chunks/node-KOIP55YZ.js +16 -0
- package/dist/bundle/chunks/openai-codex-responses-NPLWP6ZC.js +10 -0
- package/dist/bundle/chunks/{openai-completions-L4AHDQ5D.js → openai-completions-OT2GTJKC.js} +3 -3
- package/dist/bundle/chunks/openai-responses-5A6CR7GI.js +2 -0
- package/dist/bundle/chunks/{openrouter-images-Y2PCWAQH.js → openrouter-images-YLQ4RJ2F.js} +1 -1
- package/dist/bundle/chunks/{pi-messages-57K43J6J.js → pi-messages-OJF77SY3.js} +1 -1
- package/dist/bundle/chunks/{undici-D6ABF53Q.js → undici-KA2LJNVT.js} +1 -1
- package/dist/bundle/chunks/webapi-RFAXLI2D.js +5 -0
- package/dist/bundle/cli.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js +2 -1
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/setup.d.ts +2 -0
- package/dist/cli/setup.d.ts.map +1 -0
- package/dist/cli/setup.js +13 -0
- package/dist/cli/setup.js.map +1 -0
- package/dist/cli.js +2 -14
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -0
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +15 -7
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session.d.ts +2 -6
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +14 -6
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts +1 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +2 -1
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +1 -2
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/types.d.ts +8 -2
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js +2 -0
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/keybindings.d.ts +5 -0
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +4 -0
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/messages.d.ts +1 -1
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js.map +1 -1
- package/dist/core/model-config.d.ts +15 -0
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +3 -0
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-runtime.d.ts +1 -0
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +5 -2
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +8 -2
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/session-manager.d.ts +3 -2
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +40 -13
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills.d.ts +1 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +4 -2
- package/dist/core/skills.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +8 -9
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +3 -120
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit.d.ts +1 -12
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +5 -163
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +4 -55
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +4 -60
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +4 -49
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +4 -120
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/renderers/bash.d.ts +12 -0
- package/dist/core/tools/renderers/bash.d.ts.map +1 -0
- package/dist/core/tools/renderers/bash.js +133 -0
- package/dist/core/tools/renderers/bash.js.map +1 -0
- package/dist/core/tools/renderers/edit.d.ts +23 -0
- package/dist/core/tools/renderers/edit.d.ts.map +1 -0
- package/dist/core/tools/renderers/edit.js +167 -0
- package/dist/core/tools/renderers/edit.js.map +1 -0
- package/dist/core/tools/renderers/find.d.ts +10 -0
- package/dist/core/tools/renderers/find.d.ts.map +1 -0
- package/dist/core/tools/renderers/find.js +64 -0
- package/dist/core/tools/renderers/find.js.map +1 -0
- package/dist/core/tools/renderers/grep.d.ts +10 -0
- package/dist/core/tools/renderers/grep.d.ts.map +1 -0
- package/dist/core/tools/renderers/grep.js +69 -0
- package/dist/core/tools/renderers/grep.js.map +1 -0
- package/dist/core/tools/renderers/index.d.ts +22 -0
- package/dist/core/tools/renderers/index.d.ts.map +1 -0
- package/dist/core/tools/renderers/index.js +48 -0
- package/dist/core/tools/renderers/index.js.map +1 -0
- package/dist/core/tools/renderers/ls.d.ts +10 -0
- package/dist/core/tools/renderers/ls.d.ts.map +1 -0
- package/dist/core/tools/renderers/ls.js +58 -0
- package/dist/core/tools/renderers/ls.js.map +1 -0
- package/dist/core/tools/renderers/read.d.ts +11 -0
- package/dist/core/tools/renderers/read.d.ts.map +1 -0
- package/dist/core/tools/renderers/read.js +129 -0
- package/dist/core/tools/renderers/read.js.map +1 -0
- package/dist/core/tools/renderers/write.d.ts +10 -0
- package/dist/core/tools/renderers/write.d.ts.map +1 -0
- package/dist/core/tools/renderers/write.js +152 -0
- package/dist/core/tools/renderers/write.js.map +1 -0
- package/dist/core/tools/subagent-worktree.d.ts +1 -0
- package/dist/core/tools/subagent-worktree.d.ts.map +1 -1
- package/dist/core/tools/subagent-worktree.js +25 -1
- package/dist/core/tools/subagent-worktree.js.map +1 -1
- package/dist/core/tools/subagent.d.ts.map +1 -1
- package/dist/core/tools/subagent.js +5 -2
- package/dist/core/tools/subagent.js.map +1 -1
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +5 -145
- package/dist/core/tools/write.js.map +1 -1
- package/dist/humain/bedrock-provider/vendor/index.bundle.mjs +51 -12
- package/dist/humain/mcp-adapter/vendor/package.json +2 -2
- package/dist/humain/web-access/vendor/curator-page.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/curator-page.js +3 -1
- package/dist/humain/web-access/vendor/curator-page.js.map +1 -1
- package/dist/humain/web-access/vendor/curator-server.d.ts +2 -0
- package/dist/humain/web-access/vendor/curator-server.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/curator-server.js +4 -2
- package/dist/humain/web-access/vendor/curator-server.js.map +1 -1
- package/dist/humain/web-access/vendor/gemini-search.d.ts +2 -2
- package/dist/humain/web-access/vendor/gemini-search.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/gemini-search.js +11 -4
- package/dist/humain/web-access/vendor/gemini-search.js.map +1 -1
- package/dist/humain/web-access/vendor/github-extract.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/github-extract.js +238 -1
- package/dist/humain/web-access/vendor/github-extract.js.map +1 -1
- package/dist/humain/web-access/vendor/index.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/index.js +118 -64
- package/dist/humain/web-access/vendor/index.js.map +1 -1
- package/dist/humain/web-access/vendor/mistral-search.d.ts +4 -0
- package/dist/humain/web-access/vendor/mistral-search.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/mistral-search.js +274 -0
- package/dist/humain/web-access/vendor/mistral-search.js.map +1 -0
- package/dist/humain/web-access/vendor/perplexity.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/perplexity.js +12 -1
- package/dist/humain/web-access/vendor/perplexity.js.map +1 -1
- package/dist/humain/web-access/vendor/utils.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/utils.js +1 -2
- package/dist/humain/web-access/vendor/utils.js.map +1 -1
- package/dist/humain/web-access/vendor/xai-search.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/xai-search.js +92 -35
- package/dist/humain/web-access/vendor/xai-search.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +4 -1
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/chat-viewport.d.ts +20 -0
- package/dist/modes/interactive/chat-viewport.d.ts.map +1 -0
- package/dist/modes/interactive/chat-viewport.js +28 -0
- package/dist/modes/interactive/chat-viewport.js.map +1 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +1 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +18 -10
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +10 -1
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +37 -1
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts +1 -1
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +8 -17
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +21 -23
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +14 -10
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/status-indicator.d.ts +3 -1
- package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
- package/dist/modes/interactive/components/status-indicator.js +10 -3
- package/dist/modes/interactive/components/status-indicator.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +4 -4
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +21 -4
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +34 -32
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/trust-selector.js +2 -2
- package/dist/modes/interactive/components/trust-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +8 -15
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +96 -81
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/session-share.d.ts.map +1 -1
- package/dist/modes/interactive/session-share.js +8 -12
- package/dist/modes/interactive/session-share.js.map +1 -1
- package/dist/modes/interactive/theme/dark.json +2 -1
- package/dist/modes/interactive/theme/light.json +2 -1
- package/dist/modes/interactive/theme/theme-controller.d.ts +1 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.js +5 -0
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
- package/dist/modes/interactive/theme/theme-json.d.ts +84 -0
- package/dist/modes/interactive/theme/theme-json.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-json.js +130 -0
- package/dist/modes/interactive/theme/theme-json.js.map +1 -0
- package/dist/modes/interactive/theme/theme-schema.json +6 -2
- package/dist/modes/interactive/theme/theme.d.ts +14 -5
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +18 -119
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/interactive/tui-renderer.d.ts +21 -0
- package/dist/modes/interactive/tui-renderer.d.ts.map +1 -0
- package/dist/modes/interactive/tui-renderer.js +66 -0
- package/dist/modes/interactive/tui-renderer.js.map +1 -0
- package/dist/utils/exif-orientation.d.ts.map +1 -1
- package/dist/utils/exif-orientation.js +2 -3
- package/dist/utils/exif-orientation.js.map +1 -1
- package/dist/utils/tools-manager.d.ts +1 -0
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +41 -19
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/containerization.md +45 -0
- package/docs/development.md +19 -0
- package/docs/environment-variables.md +2 -0
- package/docs/extensions.md +5 -2
- package/docs/keybindings.md +5 -2
- package/docs/models.md +4 -1
- package/docs/rpc.md +1 -1
- package/docs/sdk.md +5 -0
- package/docs/settings.md +3 -3
- package/docs/skills.md +1 -1
- package/docs/terminal-setup.md +15 -0
- package/docs/themes.md +8 -6
- package/docs/tui.md +19 -0
- package/examples/README.md +3 -0
- package/examples/extensions/custom-provider-anthropic/package-lock.json +84 -84
- package/examples/extensions/custom-provider-anthropic/package.json +17 -17
- package/examples/extensions/custom-provider-gitlab-duo/package.json +14 -14
- package/examples/extensions/dynamic-resources/dynamic.json +2 -0
- package/examples/extensions/gondolin/package-lock.json +8 -8
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +6 -6
- package/examples/extensions/sandbox/package.json +2 -2
- package/examples/extensions/with-deps/package-lock.json +29 -29
- package/examples/extensions/with-deps/package.json +20 -20
- package/examples/plugins/pi-example-plugin/README.md +38 -0
- package/examples/plugins/pi-example-plugin/package.json +10 -0
- package/examples/plugins/pi-example-plugin/src/contract.ts +13 -0
- package/examples/plugins/pi-example-plugin/src/session.ts +23 -0
- package/examples/plugins/pi-example-plugin/src/tui.ts +31 -0
- package/npm-shrinkwrap.json +772 -205
- package/package.json +31 -24
- package/src/humain/web-access/UPSTREAM.md +12 -1
- package/src/humain/web-access/upstream.json +4 -4
- package/dist/bundle/chunks/anthropic-messages-M4LCS3KH.js +0 -6
- package/dist/bundle/chunks/chunk-3VI4HD7D.js +0 -31
- package/dist/bundle/chunks/chunk-BOW22LW6.js +0 -42
- package/dist/bundle/chunks/chunk-CBHC6EL7.js +0 -133
- package/dist/bundle/chunks/chunk-JUUC5AZY.js +0 -2
- package/dist/bundle/chunks/node-ZHY4LHC7.js +0 -15
- package/dist/bundle/chunks/openai-codex-responses-HRVCDY54.js +0 -8
- package/dist/bundle/chunks/openai-responses-4MWLJHIK.js +0 -2
- package/dist/bundle/chunks/webapi-AFS5FDJJ.js +0 -5
- package/dist/bundle/client.js +0 -2
- package/dist/cli/experimental/auth.d.ts +0 -16
- package/dist/cli/experimental/auth.d.ts.map +0 -1
- package/dist/cli/experimental/auth.js +0 -13
- package/dist/cli/experimental/auth.js.map +0 -1
- package/dist/cli/experimental/cli.d.ts +0 -6
- package/dist/cli/experimental/cli.d.ts.map +0 -1
- package/dist/cli/experimental/cli.js +0 -5
- package/dist/cli/experimental/cli.js.map +0 -1
- package/dist/cli/experimental/command-options.d.ts +0 -17
- package/dist/cli/experimental/command-options.d.ts.map +0 -1
- package/dist/cli/experimental/command-options.js +0 -35
- package/dist/cli/experimental/command-options.js.map +0 -1
- package/dist/cli/experimental/command.d.ts +0 -63
- package/dist/cli/experimental/command.d.ts.map +0 -1
- package/dist/cli/experimental/command.js +0 -127
- package/dist/cli/experimental/command.js.map +0 -1
- package/dist/cli/experimental/commands/client.d.ts +0 -13
- package/dist/cli/experimental/commands/client.d.ts.map +0 -1
- package/dist/cli/experimental/commands/client.js +0 -25
- package/dist/cli/experimental/commands/client.js.map +0 -1
- package/dist/cli/experimental/commands/pi.d.ts +0 -15
- package/dist/cli/experimental/commands/pi.d.ts.map +0 -1
- package/dist/cli/experimental/commands/pi.js +0 -28
- package/dist/cli/experimental/commands/pi.js.map +0 -1
- package/dist/cli/experimental/commands/server.d.ts +0 -13
- package/dist/cli/experimental/commands/server.d.ts.map +0 -1
- package/dist/cli/experimental/commands/server.js +0 -25
- package/dist/cli/experimental/commands/server.js.map +0 -1
- package/dist/cli/experimental/transport-address.d.ts +0 -10
- package/dist/cli/experimental/transport-address.d.ts.map +0 -1
- package/dist/cli/experimental/transport-address.js +0 -38
- package/dist/cli/experimental/transport-address.js.map +0 -1
- package/dist/client/index.d.ts +0 -3
- package/dist/client/index.d.ts.map +0 -1
- package/dist/client/index.js +0 -3
- package/dist/client/index.js.map +0 -1
- package/dist/client/remote-session.d.ts +0 -53
- package/dist/client/remote-session.d.ts.map +0 -1
- package/dist/client/remote-session.js +0 -340
- package/dist/client/remote-session.js.map +0 -1
- package/dist/client/transcript.d.ts +0 -12
- package/dist/client/transcript.d.ts.map +0 -1
- package/dist/client/transcript.js +0 -98
- package/dist/client/transcript.js.map +0 -1
- package/dist/server/create-harness.d.ts +0 -26
- package/dist/server/create-harness.d.ts.map +0 -1
- package/dist/server/create-harness.js +0 -106
- package/dist/server/create-harness.js.map +0 -1
|
@@ -7,7 +7,7 @@ import * as fs from "node:fs";
|
|
|
7
7
|
import * as os from "node:os";
|
|
8
8
|
import * as path from "node:path";
|
|
9
9
|
import * as TuiLayouts from "@earendil-works/pi-tui";
|
|
10
|
-
import { CombinedAutocompleteProvider, Container, fuzzyFilter, getCapabilities, hyperlink, Markdown, matchesKey,
|
|
10
|
+
import { CombinedAutocompleteProvider, Container, fuzzyFilter, getCapabilities, hyperlink, Markdown, matchesKey, Spacer, setCapabilityOverrides, setKeybindings, Text, TruncatedText, TuiAltScreen, TuiMainScreen, visibleWidth, } from "@earendil-works/pi-tui";
|
|
11
11
|
import chalk from "chalk";
|
|
12
12
|
import { spawn } from "child_process";
|
|
13
13
|
import { APP_NAME, APP_TITLE, CONFIG_DIR_NAME, getAgentDir, getAuthPath, getDebugLogPath, getDocsPath, VERSION, } from "../../config.js";
|
|
@@ -26,19 +26,20 @@ import { formatMissingSessionCwdPrompt, MissingSessionCwdError } from "../../cor
|
|
|
26
26
|
import { SessionManager, sessionEntryToContextMessages } from "../../core/session-manager.js";
|
|
27
27
|
import { BUILTIN_SLASH_COMMANDS } from "../../core/slash-commands.js";
|
|
28
28
|
import { isInstallTelemetryEnabled } from "../../core/telemetry.js";
|
|
29
|
+
import { withBuiltInRenderers } from "../../core/tools/renderers/index.js";
|
|
29
30
|
import { hasTrustRequiringProjectResources, ProjectTrustStore } from "../../core/trust-manager.js";
|
|
30
31
|
import { getUsageCostBreakdown } from "../../core/usage-totals.js";
|
|
31
32
|
import { getChangelogPath, getNewEntries, normalizeChangelogLinks, parseChangelog } from "../../utils/changelog.js";
|
|
32
33
|
import { copyToClipboard, readClipboardText } from "../../utils/clipboard.js";
|
|
33
34
|
import { extensionForImageMimeType, readClipboardImage } from "../../utils/clipboard-image.js";
|
|
34
35
|
import { parseGitUrl } from "../../utils/git.js";
|
|
35
|
-
import { openBrowser } from "../../utils/open-browser.js";
|
|
36
36
|
import { getCwdRelativePath } from "../../utils/paths.js";
|
|
37
37
|
import { getPiUserAgent } from "../../utils/pi-user-agent.js";
|
|
38
38
|
import { killTrackedDetachedChildren } from "../../utils/shell.js";
|
|
39
39
|
import { loadAllHighlightLanguages } from "../../utils/syntax-highlight.js";
|
|
40
40
|
import { ensureTool } from "../../utils/tools-manager.js";
|
|
41
41
|
import { checkForNewPiVersion } from "../../utils/version-check.js";
|
|
42
|
+
import { createChatViewport } from "./chat-viewport.js";
|
|
42
43
|
import { ArminComponent } from "./components/armin.js";
|
|
43
44
|
import { AssistantMessageComponent } from "./components/assistant-message.js";
|
|
44
45
|
import { BashExecutionComponent } from "./components/bash-execution.js";
|
|
@@ -76,6 +77,14 @@ import { getModelSearchText } from "./model-search.js";
|
|
|
76
77
|
import { shareSession } from "./session-share.js";
|
|
77
78
|
import { getAvailableThemes, getAvailableThemesWithPaths, getEditorTheme, getMarkdownTheme, getThemeByName, onThemeChange, setRegisteredThemes, stopThemeWatcher, Theme, theme, } from "./theme/theme.js";
|
|
78
79
|
import { InteractiveThemeController } from "./theme/theme-controller.js";
|
|
80
|
+
import { createInteractiveTui, createInteractiveTuiReference } from "./tui-renderer.js";
|
|
81
|
+
export { createInteractiveTui, createInteractiveTuiReference } from "./tui-renderer.js";
|
|
82
|
+
function isWorkingStatusEditor(editor) {
|
|
83
|
+
return ("embedWorkingStatus" in editor &&
|
|
84
|
+
editor.embedWorkingStatus === true &&
|
|
85
|
+
"setWorkingStatusIndicator" in editor &&
|
|
86
|
+
typeof editor.setWorkingStatusIndicator === "function");
|
|
87
|
+
}
|
|
79
88
|
function isExpandable(obj) {
|
|
80
89
|
return typeof obj === "object" && obj !== null && "setExpanded" in obj && typeof obj.setExpanded === "function";
|
|
81
90
|
}
|
|
@@ -175,61 +184,6 @@ function formatLoginProviderCompletionDescription(provider) {
|
|
|
175
184
|
const authTypes = provider.authTypes.map(formatAuthSelectorProviderType).join("/");
|
|
176
185
|
return provider.name === provider.id ? authTypes : `${provider.name} · ${authTypes}`;
|
|
177
186
|
}
|
|
178
|
-
/** Composition root for selecting the interactive terminal renderer. */
|
|
179
|
-
export function createInteractiveTui(options) {
|
|
180
|
-
const terminal = options.terminal ?? new ProcessTerminal();
|
|
181
|
-
if (options.tuiMode === "fullscreen") {
|
|
182
|
-
const styleSearchMatch = (text) => theme.bg("searchMatchBg", theme.fg("searchMatchText", text));
|
|
183
|
-
return new TuiAltScreen(terminal, options.showHardwareCursor, options.logDirectory, {
|
|
184
|
-
searchMatchStyle: (text) => theme.underline(styleSearchMatch(text)),
|
|
185
|
-
searchCurrentMatchStyle: (text) => theme.bold(theme.inverse(styleSearchMatch(text))),
|
|
186
|
-
openUrl: openBrowser,
|
|
187
|
-
onRightClickPaste: options.onRightClickPaste,
|
|
188
|
-
copyOnSelect: options.fullscreenCopyOnSelect,
|
|
189
|
-
copySelection: async (text) => {
|
|
190
|
-
try {
|
|
191
|
-
await copyToClipboard(text);
|
|
192
|
-
return true;
|
|
193
|
-
}
|
|
194
|
-
catch {
|
|
195
|
-
return false;
|
|
196
|
-
}
|
|
197
|
-
},
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
return new TuiMainScreen(terminal, options.showHardwareCursor, options.logDirectory);
|
|
201
|
-
}
|
|
202
|
-
/** Stable reference for components while InteractiveMode replaces the active renderer. */
|
|
203
|
-
export function createInteractiveTuiReference(getTui) {
|
|
204
|
-
return new Proxy({}, {
|
|
205
|
-
get: (_target, property) => {
|
|
206
|
-
const tui = getTui();
|
|
207
|
-
const value = Reflect.get(tui, property, tui);
|
|
208
|
-
if (typeof value !== "function")
|
|
209
|
-
return value;
|
|
210
|
-
let methodTui = tui;
|
|
211
|
-
let method = value;
|
|
212
|
-
return (...args) => {
|
|
213
|
-
const currentTui = getTui();
|
|
214
|
-
if (currentTui !== methodTui) {
|
|
215
|
-
const currentMethod = Reflect.get(currentTui, property, currentTui);
|
|
216
|
-
if (typeof currentMethod !== "function") {
|
|
217
|
-
throw new TypeError(`TUI property ${String(property)} is not callable`);
|
|
218
|
-
}
|
|
219
|
-
methodTui = currentTui;
|
|
220
|
-
method = currentMethod;
|
|
221
|
-
}
|
|
222
|
-
return Reflect.apply(method, methodTui, args);
|
|
223
|
-
};
|
|
224
|
-
},
|
|
225
|
-
set: (_target, property, value) => {
|
|
226
|
-
const tui = getTui();
|
|
227
|
-
return Reflect.set(tui, property, value, tui);
|
|
228
|
-
},
|
|
229
|
-
has: (_target, property) => Reflect.has(getTui(), property),
|
|
230
|
-
getPrototypeOf: () => Reflect.getPrototypeOf(getTui()),
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
187
|
export class InteractiveMode {
|
|
234
188
|
// Convenience accessors
|
|
235
189
|
get session() {
|
|
@@ -249,11 +203,12 @@ export class InteractiveMode {
|
|
|
249
203
|
this.isInitialized = false;
|
|
250
204
|
this.pendingUserInputs = [];
|
|
251
205
|
this.activeStatusIndicator = undefined;
|
|
206
|
+
this.activeWorkingIndicatorEmbedded = false;
|
|
252
207
|
this.idleStatus = new IdleStatus();
|
|
253
208
|
this.workingMessage = undefined;
|
|
254
209
|
this.workingVisible = true;
|
|
255
210
|
this.workingIndicatorOptions = undefined;
|
|
256
|
-
this.defaultWorkingMessage = "Working
|
|
211
|
+
this.defaultWorkingMessage = "Working";
|
|
257
212
|
this.defaultHiddenThinkingLabel = "Thinking...";
|
|
258
213
|
this.hiddenThinkingLabel = this.defaultHiddenThinkingLabel;
|
|
259
214
|
this.lastSigintTime = 0;
|
|
@@ -355,6 +310,7 @@ export class InteractiveMode {
|
|
|
355
310
|
this.defaultEditor = new CustomEditor(this.ui, getEditorTheme(), this.keybindings, {
|
|
356
311
|
paddingX: editorPaddingX,
|
|
357
312
|
autocompleteMaxVisible,
|
|
313
|
+
embedWorkingStatus: true,
|
|
358
314
|
});
|
|
359
315
|
this.editor = this.defaultEditor;
|
|
360
316
|
this.editorContainer = new Container();
|
|
@@ -626,25 +582,20 @@ export class InteractiveMode {
|
|
|
626
582
|
}
|
|
627
583
|
// Keep one component tree and remount it when changing renderers.
|
|
628
584
|
this.renderWidgets(); // Initialize with default spacer
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
585
|
+
const viewport = createChatViewport({
|
|
586
|
+
document: this.documentContainer,
|
|
587
|
+
pendingMessages: this.pendingMessagesContainer,
|
|
588
|
+
status: this.statusContainer,
|
|
589
|
+
widgetsAbove: this.widgetContainerAbove,
|
|
590
|
+
editor: this.editorContainer,
|
|
591
|
+
widgetsBelow: this.widgetContainerBelow,
|
|
592
|
+
footer: this.footerContainer,
|
|
633
593
|
scrollbar: this.settingsManager.getFullscreenScrollbar(),
|
|
634
|
-
|
|
594
|
+
scrollbarTrackStyle: (text) => theme.fg("scrollbarTrack", text),
|
|
595
|
+
scrollbarThumbStyle: (text) => theme.fg("scrollbarThumb", text),
|
|
635
596
|
});
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
{ component: this.statusContainer, shrink: 1, minSize: 0 },
|
|
639
|
-
{ component: this.widgetContainerAbove, shrink: 1, minSize: 0 },
|
|
640
|
-
{ component: this.editorContainer, shrink: 1, minSize: 3 },
|
|
641
|
-
{ component: this.widgetContainerBelow, shrink: 1, minSize: 0 },
|
|
642
|
-
{ component: this.footerContainer, shrink: 1, minSize: 1 },
|
|
643
|
-
]);
|
|
644
|
-
this.fullscreenLayoutRoot = new TuiLayouts.VStack([
|
|
645
|
-
{ component: this.transcriptScrollView, basis: 0, grow: 1, shrink: 1, minSize: 1 },
|
|
646
|
-
{ component: dock, basis: "auto", grow: 0, shrink: 1, minSize: 1 },
|
|
647
|
-
]);
|
|
597
|
+
this.transcriptScrollView = viewport.transcript;
|
|
598
|
+
this.fullscreenLayoutRoot = viewport.root;
|
|
648
599
|
this.mountInteractiveTui(this.renderer, [
|
|
649
600
|
this.documentContainer,
|
|
650
601
|
this.pendingMessagesContainer,
|
|
@@ -697,7 +648,7 @@ export class InteractiveMode {
|
|
|
697
648
|
hint("app.tools.expand", "more"),
|
|
698
649
|
].join(theme.fg("muted", " · "));
|
|
699
650
|
const compactOnboarding = theme.fg("dim", `Press ${keyText("app.tools.expand")} to show full startup help and loaded resources.`);
|
|
700
|
-
const onboarding = theme.fg("dim",
|
|
651
|
+
const onboarding = theme.fg("dim", `${APP_NAME} can explain its own features and look up its docs. Ask it how to use or extend ${APP_NAME}.`);
|
|
701
652
|
this.builtInHeader = new ExpandableText(() => `${logo}\n${compactInstructions}\n${compactOnboarding}\n\n${onboarding}`, () => `${logo}\n${expandedInstructions}\n\n${onboarding}`, this.getStartupExpansionState(), 1, 0);
|
|
702
653
|
// Setup UI layout
|
|
703
654
|
this.headerContainer.addChild(new Spacer(1));
|
|
@@ -1556,8 +1507,12 @@ export class InteractiveMode {
|
|
|
1556
1507
|
/**
|
|
1557
1508
|
* Get a registered tool definition by name (for custom rendering).
|
|
1558
1509
|
*/
|
|
1510
|
+
/**
|
|
1511
|
+
* Extension-registered definition, falling back to the built-in one. The renderer components take
|
|
1512
|
+
* whatever this returns, so they never reach into the tool registry themselves.
|
|
1513
|
+
*/
|
|
1559
1514
|
getRegisteredToolDefinition(toolName) {
|
|
1560
|
-
return this.session.getToolDefinition(toolName);
|
|
1515
|
+
return withBuiltInRenderers(toolName, this.session.getToolDefinition(toolName));
|
|
1561
1516
|
}
|
|
1562
1517
|
getMarkdownTransformers() {
|
|
1563
1518
|
return [this.mermaidMarkdownTransformer, ...this.session.extensionRunner.getMarkdownTransformers()];
|
|
@@ -1627,26 +1582,48 @@ export class InteractiveMode {
|
|
|
1627
1582
|
this.footerDataProvider.setExtensionStatus(key, text);
|
|
1628
1583
|
this.ui.requestRender();
|
|
1629
1584
|
}
|
|
1585
|
+
setEditorWorkingStatusIndicator(indicator) {
|
|
1586
|
+
this.defaultEditor.setWorkingStatusIndicator(undefined);
|
|
1587
|
+
if (!isWorkingStatusEditor(this.editor))
|
|
1588
|
+
return false;
|
|
1589
|
+
this.editor.setWorkingStatusIndicator(indicator);
|
|
1590
|
+
return true;
|
|
1591
|
+
}
|
|
1630
1592
|
showStatusIndicator(indicator) {
|
|
1631
1593
|
this.activeStatusIndicator?.dispose();
|
|
1632
1594
|
this.activeStatusIndicator = indicator;
|
|
1595
|
+
this.activeWorkingIndicatorEmbedded = false;
|
|
1633
1596
|
this.statusContainer.clear();
|
|
1597
|
+
this.setEditorWorkingStatusIndicator(undefined);
|
|
1598
|
+
if (indicator instanceof WorkingStatusIndicator && this.setEditorWorkingStatusIndicator(indicator)) {
|
|
1599
|
+
this.activeWorkingIndicatorEmbedded = true;
|
|
1600
|
+
return;
|
|
1601
|
+
}
|
|
1634
1602
|
this.statusContainer.addChild(indicator);
|
|
1635
1603
|
}
|
|
1636
1604
|
clearStatusIndicator(kind) {
|
|
1637
1605
|
if (kind && this.activeStatusIndicator?.kind !== kind) {
|
|
1638
1606
|
return;
|
|
1639
1607
|
}
|
|
1640
|
-
const
|
|
1641
|
-
this.
|
|
1608
|
+
const clearedIndicator = this.activeStatusIndicator;
|
|
1609
|
+
const clearedIndicatorWasEmbedded = clearedIndicator?.kind === "working" && this.activeWorkingIndicatorEmbedded;
|
|
1610
|
+
clearedIndicator?.dispose();
|
|
1642
1611
|
this.activeStatusIndicator = undefined;
|
|
1612
|
+
this.activeWorkingIndicatorEmbedded = false;
|
|
1643
1613
|
this.statusContainer.clear();
|
|
1644
|
-
|
|
1614
|
+
this.setEditorWorkingStatusIndicator(undefined);
|
|
1615
|
+
if (clearedIndicator &&
|
|
1616
|
+
!clearedIndicatorWasEmbedded &&
|
|
1617
|
+
this.options.tuiMode === "regular" &&
|
|
1618
|
+
this.ui.getClearOnShrink()) {
|
|
1645
1619
|
this.statusContainer.addChild(this.idleStatus);
|
|
1646
1620
|
}
|
|
1647
1621
|
}
|
|
1648
1622
|
showWorkingStatusIndicator() {
|
|
1649
|
-
|
|
1623
|
+
const colorFn = isWorkingStatusEditor(this.editor)
|
|
1624
|
+
? (text) => (this.editor.borderColor ?? theme.getThinkingBorderColor(this.session.thinkingLevel || "off"))(text)
|
|
1625
|
+
: undefined;
|
|
1626
|
+
this.showStatusIndicator(new WorkingStatusIndicator(this.ui, this.workingMessage ?? this.defaultWorkingMessage, this.workingIndicatorOptions, colorFn));
|
|
1650
1627
|
}
|
|
1651
1628
|
setWorkingVisible(visible) {
|
|
1652
1629
|
this.workingVisible = visible;
|
|
@@ -2118,6 +2095,13 @@ export class InteractiveMode {
|
|
|
2118
2095
|
this.editor = this.defaultEditor;
|
|
2119
2096
|
}
|
|
2120
2097
|
this.editorContainer.addChild(this.editor);
|
|
2098
|
+
if (this.activeStatusIndicator instanceof WorkingStatusIndicator) {
|
|
2099
|
+
this.statusContainer.clear();
|
|
2100
|
+
this.activeWorkingIndicatorEmbedded = this.setEditorWorkingStatusIndicator(this.activeStatusIndicator);
|
|
2101
|
+
if (!this.activeWorkingIndicatorEmbedded) {
|
|
2102
|
+
this.statusContainer.addChild(this.activeStatusIndicator);
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2121
2105
|
this.ui.setFocus(this.editor);
|
|
2122
2106
|
this.ui.requestRender();
|
|
2123
2107
|
}
|
|
@@ -2659,6 +2643,7 @@ export class InteractiveMode {
|
|
|
2659
2643
|
for (const [, component] of this.pendingTools.entries()) {
|
|
2660
2644
|
component.setArgsComplete();
|
|
2661
2645
|
}
|
|
2646
|
+
this.maybeShowAssistantDiagnostics(this.streamingMessage);
|
|
2662
2647
|
this.maybeShowCacheMissNotice(this.streamingMessage);
|
|
2663
2648
|
}
|
|
2664
2649
|
this.streamingComponent = undefined;
|
|
@@ -3022,6 +3007,7 @@ export class InteractiveMode {
|
|
|
3022
3007
|
}
|
|
3023
3008
|
}
|
|
3024
3009
|
if (message.stopReason !== "aborted" && message.stopReason !== "error") {
|
|
3010
|
+
this.maybeShowAssistantDiagnostics(message);
|
|
3025
3011
|
const miss = cacheMisses.get(message);
|
|
3026
3012
|
if (miss)
|
|
3027
3013
|
this.addCacheMissNotice(miss);
|
|
@@ -3078,6 +3064,32 @@ export class InteractiveMode {
|
|
|
3078
3064
|
this.chatContainer.addChild(new Spacer(1));
|
|
3079
3065
|
this.chatContainer.addChild(new Text(theme.fg("warning", `${label}: ${formatTokens(tokens)} tokens billed${cost}`), 1, 0));
|
|
3080
3066
|
}
|
|
3067
|
+
maybeShowAssistantDiagnostics(message) {
|
|
3068
|
+
if (!this.settingsManager.getShowCacheMissNotices())
|
|
3069
|
+
return;
|
|
3070
|
+
for (const diagnostic of message.diagnostics ?? []) {
|
|
3071
|
+
if (diagnostic.type !== "anthropic_input_transformations")
|
|
3072
|
+
continue;
|
|
3073
|
+
const transformations = diagnostic.details?.transformations;
|
|
3074
|
+
if (!Array.isArray(transformations))
|
|
3075
|
+
continue;
|
|
3076
|
+
const dropped = transformations.flatMap((transformation) => {
|
|
3077
|
+
if (typeof transformation !== "object" || transformation === null)
|
|
3078
|
+
return [];
|
|
3079
|
+
const details = transformation;
|
|
3080
|
+
if (details.type !== "thinking_dropped")
|
|
3081
|
+
return [];
|
|
3082
|
+
const reason = typeof details.reason === "string" ? details.reason : "unknown reason";
|
|
3083
|
+
const location = typeof details.path === "string" ? ` at ${details.path}` : "";
|
|
3084
|
+
return [`${reason}${location}`];
|
|
3085
|
+
});
|
|
3086
|
+
if (dropped.length === 0)
|
|
3087
|
+
continue;
|
|
3088
|
+
const noun = dropped.length === 1 ? "thinking block" : `${dropped.length} thinking blocks`;
|
|
3089
|
+
this.chatContainer.addChild(new Spacer(1));
|
|
3090
|
+
this.chatContainer.addChild(new Text(theme.fg("warning", `Anthropic dropped ${noun}: ${dropped.join("; ")}`), 1, 0));
|
|
3091
|
+
}
|
|
3092
|
+
}
|
|
3081
3093
|
/**
|
|
3082
3094
|
* Show a transcript notice when a completed assistant message paid for a
|
|
3083
3095
|
* significant cache miss. Only states observable facts: the miss itself,
|
|
@@ -3369,6 +3381,9 @@ export class InteractiveMode {
|
|
|
3369
3381
|
const level = this.session.thinkingLevel || "off";
|
|
3370
3382
|
this.editor.borderColor = theme.getThinkingBorderColor(level);
|
|
3371
3383
|
}
|
|
3384
|
+
if (this.activeStatusIndicator?.kind === "working") {
|
|
3385
|
+
this.activeStatusIndicator.invalidate();
|
|
3386
|
+
}
|
|
3372
3387
|
this.ui.requestRender();
|
|
3373
3388
|
}
|
|
3374
3389
|
cycleThinkingLevel() {
|