@humain/terminal 0.0.6 → 0.0.8
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 +62 -0
- package/README.md +17 -10
- package/dist/bundle/chunks/anthropic-messages-GDMGYAZB.js +6 -0
- package/dist/bundle/chunks/anthropic.js +75 -0
- package/dist/bundle/chunks/azure-openai-responses-ZN52D6YC.js +2 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +77 -0
- package/dist/bundle/chunks/chunk-3VI4HD7D.js +31 -0
- package/dist/bundle/chunks/chunk-6R7UI4IY.js +2 -0
- package/dist/bundle/chunks/chunk-72KO4OMP.js +2 -0
- package/dist/bundle/chunks/chunk-74NVHVNZ.js +16 -0
- package/dist/bundle/chunks/chunk-7DDKXS2Q.js +2 -0
- package/dist/bundle/chunks/chunk-ARF4OE6X.js +105 -0
- package/dist/bundle/chunks/chunk-BOW22LW6.js +42 -0
- package/dist/bundle/chunks/chunk-BZQ53VGE.js +70 -0
- package/dist/bundle/chunks/chunk-CBHC6EL7.js +133 -0
- package/dist/bundle/chunks/chunk-D7XAASZM.js +4 -0
- package/dist/bundle/chunks/chunk-ECWELYBH.js +17 -0
- package/dist/bundle/chunks/chunk-GMWCTUPB.js +2 -0
- package/dist/bundle/chunks/chunk-H2O6VOXT.js +11 -0
- package/dist/bundle/chunks/chunk-JUUC5AZY.js +2 -0
- package/dist/bundle/chunks/chunk-JXWJOIH4.js +2 -0
- package/dist/bundle/chunks/chunk-L2ZPNLYD.js +2 -0
- package/dist/bundle/chunks/chunk-LVVZS2NO.js +12 -0
- package/dist/bundle/chunks/chunk-MA4UUCYX.js +18 -0
- package/dist/bundle/chunks/chunk-MMFBCF6F.js +5986 -0
- package/dist/bundle/chunks/chunk-PGXDEOVV.js +2 -0
- package/dist/bundle/chunks/chunk-PJACZCIR.js +2 -0
- package/dist/bundle/chunks/chunk-PRRNXB7S.js +2 -0
- package/dist/bundle/chunks/chunk-PSKDLDLZ.js +44 -0
- package/dist/bundle/chunks/chunk-SGTGQNNP.js +4 -0
- package/dist/bundle/chunks/chunk-TEPMHNKQ.js +2 -0
- package/dist/bundle/chunks/chunk-TXBQIIIO.js +2 -0
- package/dist/bundle/chunks/chunk-WJZ4KLGL.js +2 -0
- package/dist/bundle/chunks/chunk-XNGRGP62.js +2 -0
- package/dist/bundle/chunks/dist-BXEVYJIO.js +7 -0
- package/dist/bundle/chunks/es-P2KNSZYR.js +9 -0
- package/dist/bundle/chunks/es5-FGTJ7ZFW.js +2 -0
- package/dist/bundle/chunks/event-streams-JOSQQSII.js +2 -0
- package/dist/bundle/chunks/extract-2L7ZVN7F.js +106 -0
- package/dist/bundle/chunks/github-copilot.js +2 -0
- package/dist/bundle/chunks/google-generative-ai-FF7M7XHT.js +2 -0
- package/dist/bundle/chunks/google-vertex-YMUBFRBA.js +2 -0
- package/dist/bundle/chunks/https-proxy-agent-562J2I52.js +2 -0
- package/dist/bundle/chunks/image-resize-worker.js +2 -0
- package/dist/bundle/chunks/kimi-coding.js +2 -0
- package/dist/bundle/chunks/mistral-conversations-O4M7IQML.js +5 -0
- package/dist/bundle/chunks/multipart-parser-FMGQ7342.js +3 -0
- package/dist/bundle/chunks/node-XY3CBY3C.js +294 -0
- package/dist/bundle/chunks/node-ZHY4LHC7.js +15 -0
- package/dist/bundle/chunks/openai-codex-responses-HRVCDY54.js +8 -0
- package/dist/bundle/chunks/openai-codex.js +75 -0
- package/dist/bundle/chunks/openai-completions-L4AHDQ5D.js +7 -0
- package/dist/bundle/chunks/openai-responses-4MWLJHIK.js +2 -0
- package/dist/bundle/chunks/openrouter-images-Y2PCWAQH.js +2 -0
- package/dist/bundle/chunks/openrouter.js +75 -0
- package/dist/bundle/chunks/pdfjs-UKQT3OWY.js +107 -0
- package/dist/bundle/chunks/pi-messages-57K43J6J.js +8 -0
- package/dist/bundle/chunks/promise-J5TGSM32.js +2 -0
- package/dist/bundle/chunks/radius.js +75 -0
- package/dist/bundle/chunks/src-QKGKDFSU.js +4 -0
- package/dist/bundle/chunks/undici-D6ABF53Q.js +2 -0
- package/dist/bundle/chunks/webapi-AFS5FDJJ.js +5 -0
- package/dist/bundle/chunks/xai.js +2 -0
- package/dist/bundle/cli.js +3 -0
- package/dist/bundle/client.js +2 -0
- package/dist/bundle/index.js +2 -0
- package/dist/bundle/rpc-entry.js +3 -0
- package/dist/cli/args.d.ts +1 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +29 -9
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/file-processor.d.ts.map +1 -1
- package/dist/cli/file-processor.js +2 -1
- package/dist/cli/file-processor.js.map +1 -1
- package/dist/cli/startup-ui.d.ts.map +1 -1
- package/dist/cli/startup-ui.js +2 -1
- package/dist/cli/startup-ui.js.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +19 -11
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session.d.ts +62 -15
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +240 -104
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +6 -7
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +7 -3
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +9 -3
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +59 -36
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/defaults.d.ts +1 -0
- package/dist/core/defaults.d.ts.map +1 -1
- package/dist/core/defaults.js +9 -0
- package/dist/core/defaults.js.map +1 -1
- package/dist/core/extensions/index.d.ts +2 -2
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +115 -48
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +5 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +44 -1
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +56 -10
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js +3 -0
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts +1 -1
- package/dist/core/footer-data-provider.js +1 -1
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/keybindings.d.ts +20 -19
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +26 -5
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/model-config.d.ts +5 -0
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +3 -1
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-resolver.d.ts +1 -0
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +14 -8
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/models-store.d.ts.map +1 -1
- package/dist/core/models-store.js +2 -1
- package/dist/core/models-store.js.map +1 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +22 -14
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/pi-manifest.d.ts.map +1 -1
- package/dist/core/pi-manifest.js +2 -1
- package/dist/core/pi-manifest.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +2 -1
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +3 -2
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sdk.d.ts +2 -2
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +10 -3
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-export.d.ts +4 -0
- package/dist/core/session-export.d.ts.map +1 -0
- package/dist/core/session-export.js +32 -0
- package/dist/core/session-export.js.map +1 -0
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +6 -3
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-diagnostics.d.ts +9 -0
- package/dist/core/settings-diagnostics.d.ts.map +1 -0
- package/dist/core/settings-diagnostics.js +21 -0
- package/dist/core/settings-diagnostics.js.map +1 -0
- package/dist/core/settings-manager.d.ts +17 -1
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +68 -10
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +51 -33
- package/dist/core/skills.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +2 -1
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +11 -2
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/bash.d.ts +16 -3
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +62 -29
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts +0 -5
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js +2 -5
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +20 -4
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/index.d.ts +4 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +19 -1
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/powershell.d.ts +16 -0
- package/dist/core/tools/powershell.d.ts.map +1 -0
- package/dist/core/tools/powershell.js +39 -0
- package/dist/core/tools/powershell.js.map +1 -0
- package/dist/core/tools/subagent.d.ts.map +1 -1
- package/dist/core/tools/subagent.js +4 -1
- package/dist/core/tools/subagent.js.map +1 -1
- package/dist/core/trust-manager.d.ts.map +1 -1
- package/dist/core/trust-manager.js +2 -1
- package/dist/core/trust-manager.js.map +1 -1
- package/dist/extensions/llama/client.d.ts +6 -0
- package/dist/extensions/llama/client.d.ts.map +1 -1
- package/dist/extensions/llama/client.js +7 -0
- package/dist/extensions/llama/client.js.map +1 -1
- package/dist/extensions/llama/index.d.ts.map +1 -1
- package/dist/extensions/llama/index.js +2 -0
- package/dist/extensions/llama/index.js.map +1 -1
- package/dist/extensions/llama/provider.d.ts +3 -1
- package/dist/extensions/llama/provider.d.ts.map +1 -1
- package/dist/extensions/llama/provider.js +29 -4
- package/dist/extensions/llama/provider.js.map +1 -1
- package/dist/humain/agent-execution-protocol.d.ts +1 -217
- package/dist/humain/agent-execution-protocol.d.ts.map +1 -1
- package/dist/humain/agent-execution-protocol.js +1 -203
- package/dist/humain/agent-execution-protocol.js.map +1 -1
- package/dist/humain/bedrock-provider/vendor/index.bundle.mjs +107 -16
- package/dist/humain/mcp-adapter/vendor/CHANGELOG.md +82 -0
- package/dist/humain/mcp-adapter/vendor/README.md +47 -15
- package/dist/humain/mcp-adapter/vendor/cli.js +4 -4
- package/dist/humain/mcp-adapter/vendor/commands.ts +5 -3
- package/dist/humain/mcp-adapter/vendor/config.ts +46 -5
- package/dist/humain/mcp-adapter/vendor/direct-tools.ts +103 -92
- package/dist/humain/mcp-adapter/vendor/dist/agent-dir.d.ts +10 -0
- package/dist/humain/mcp-adapter/vendor/dist/agent-dir.js +63 -0
- package/dist/humain/mcp-adapter/vendor/dist/agent-dir.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/agent-plugin-loader.d.ts +8 -0
- package/dist/humain/mcp-adapter/vendor/dist/agent-plugin-loader.js +356 -0
- package/dist/humain/mcp-adapter/vendor/dist/agent-plugin-loader.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/config.d.ts +123 -0
- package/dist/humain/mcp-adapter/vendor/dist/config.js +1088 -0
- package/dist/humain/mcp-adapter/vendor/dist/config.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/mcp-bearer-store.d.ts +24 -0
- package/dist/humain/mcp-adapter/vendor/dist/mcp-bearer-store.js +336 -0
- package/dist/humain/mcp-adapter/vendor/dist/mcp-bearer-store.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/metadata-cache.d.ts +19 -0
- package/dist/humain/mcp-adapter/vendor/dist/metadata-cache.js +319 -0
- package/dist/humain/mcp-adapter/vendor/dist/metadata-cache.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/package-mcp-loader.d.ts +2 -0
- package/dist/humain/mcp-adapter/vendor/dist/package-mcp-loader.js +156 -0
- package/dist/humain/mcp-adapter/vendor/dist/package-mcp-loader.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/resource-tools.d.ts +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/resource-tools.js +15 -0
- package/dist/humain/mcp-adapter/vendor/dist/resource-tools.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/types.d.ts +566 -0
- package/dist/humain/mcp-adapter/vendor/dist/types.js +287 -0
- package/dist/humain/mcp-adapter/vendor/dist/types.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/ui-app-bridge-helpers.d.ts +6 -0
- package/dist/humain/mcp-adapter/vendor/dist/ui-app-bridge-helpers.js +37 -0
- package/dist/humain/mcp-adapter/vendor/dist/ui-app-bridge-helpers.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/ui-stream-types.d.ts +104 -0
- package/dist/humain/mcp-adapter/vendor/dist/ui-stream-types.js +59 -0
- package/dist/humain/mcp-adapter/vendor/dist/ui-stream-types.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/ui-tool-visibility.d.ts +4 -0
- package/dist/humain/mcp-adapter/vendor/dist/ui-tool-visibility.js +27 -0
- package/dist/humain/mcp-adapter/vendor/dist/ui-tool-visibility.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/utils.d.ts +32 -0
- package/dist/humain/mcp-adapter/vendor/dist/utils.js +338 -0
- package/dist/humain/mcp-adapter/vendor/dist/utils.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/failure-backoff.ts +23 -0
- package/dist/humain/mcp-adapter/vendor/index.bundle.mjs +4870 -3878
- package/dist/humain/mcp-adapter/vendor/index.ts +294 -88
- package/dist/humain/mcp-adapter/vendor/init.ts +41 -30
- package/dist/humain/mcp-adapter/vendor/lifecycle.ts +16 -8
- package/dist/humain/mcp-adapter/vendor/mcp-auth-flow.ts +124 -32
- package/dist/humain/mcp-adapter/vendor/mcp-bearer-store.ts +0 -2
- package/dist/humain/mcp-adapter/vendor/mcp-code.ts +2 -0
- package/dist/humain/mcp-adapter/vendor/mcp-oauth-provider.ts +155 -16
- package/dist/humain/mcp-adapter/vendor/mcp-output-guard.ts +95 -7
- package/dist/humain/mcp-adapter/vendor/mcp-probe.ts +18 -4
- package/dist/humain/mcp-adapter/vendor/mcp-references.ts +376 -0
- package/dist/humain/mcp-adapter/vendor/mcp-status.ts +8 -19
- package/dist/humain/mcp-adapter/vendor/metadata-cache.ts +20 -12
- package/dist/humain/mcp-adapter/vendor/namespace-tools.ts +276 -0
- package/dist/humain/mcp-adapter/vendor/package.json +26 -8
- package/dist/humain/mcp-adapter/vendor/proxy-modes.ts +128 -32
- package/dist/humain/mcp-adapter/vendor/request-headers-command.ts +1 -1
- package/dist/humain/mcp-adapter/vendor/search-ranking.ts +2 -0
- package/dist/humain/mcp-adapter/vendor/server-manager.ts +69 -12
- package/dist/humain/mcp-adapter/vendor/state.ts +1 -3
- package/dist/humain/mcp-adapter/vendor/tool-result-renderer.ts +16 -2
- package/dist/humain/mcp-adapter/vendor/types.ts +51 -2
- package/dist/humain/mcp-adapter/vendor/ui-server.ts +3 -19
- package/dist/humain/mcp-adapter/vendor/ui-session.ts +2 -1
- package/dist/humain/mcp-adapter/vendor/utils.ts +21 -19
- package/dist/humain/mcp-adapter.d.ts.map +1 -1
- package/dist/humain/mcp-adapter.js +4 -0
- package/dist/humain/mcp-adapter.js.map +1 -1
- package/dist/humain/web-access/vendor/chrome-cookies.d.ts +14 -0
- package/dist/humain/web-access/vendor/chrome-cookies.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/chrome-cookies.js +85 -33
- package/dist/humain/web-access/vendor/chrome-cookies.js.map +1 -1
- package/dist/humain/web-access/vendor/credential-source.d.ts +1 -1
- package/dist/humain/web-access/vendor/credential-source.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/credential-source.js +3 -1
- package/dist/humain/web-access/vendor/credential-source.js.map +1 -1
- package/dist/humain/web-access/vendor/curator-page.d.ts +2 -29
- package/dist/humain/web-access/vendor/curator-page.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/curator-page.js +10 -1
- package/dist/humain/web-access/vendor/curator-page.js.map +1 -1
- package/dist/humain/web-access/vendor/curator-server.d.ts +2 -29
- package/dist/humain/web-access/vendor/curator-server.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/curator-server.js +4 -0
- package/dist/humain/web-access/vendor/curator-server.js.map +1 -1
- package/dist/humain/web-access/vendor/extract.d.ts +11 -0
- package/dist/humain/web-access/vendor/extract.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/extract.js +163 -20
- package/dist/humain/web-access/vendor/extract.js.map +1 -1
- package/dist/humain/web-access/vendor/fetch-params.d.ts +2 -0
- package/dist/humain/web-access/vendor/fetch-params.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/fetch-params.js +11 -0
- package/dist/humain/web-access/vendor/fetch-params.js.map +1 -1
- package/dist/humain/web-access/vendor/gemini-adc.d.ts +10 -0
- package/dist/humain/web-access/vendor/gemini-adc.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/gemini-adc.js +268 -0
- package/dist/humain/web-access/vendor/gemini-adc.js.map +1 -0
- package/dist/humain/web-access/vendor/gemini-api.d.ts +7 -1
- package/dist/humain/web-access/vendor/gemini-api.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/gemini-api.js +51 -15
- package/dist/humain/web-access/vendor/gemini-api.js.map +1 -1
- package/dist/humain/web-access/vendor/gemini-search.d.ts +9 -4
- package/dist/humain/web-access/vendor/gemini-search.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/gemini-search.js +63 -21
- package/dist/humain/web-access/vendor/gemini-search.js.map +1 -1
- package/dist/humain/web-access/vendor/gemini-url-context.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/gemini-url-context.js +3 -2
- package/dist/humain/web-access/vendor/gemini-url-context.js.map +1 -1
- package/dist/humain/web-access/vendor/gemini-web-config.d.ts +8 -1
- package/dist/humain/web-access/vendor/gemini-web-config.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/gemini-web-config.js +49 -4
- package/dist/humain/web-access/vendor/gemini-web-config.js.map +1 -1
- package/dist/humain/web-access/vendor/gemini-web.d.ts +2 -1
- package/dist/humain/web-access/vendor/gemini-web.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/gemini-web.js +8 -3
- package/dist/humain/web-access/vendor/gemini-web.js.map +1 -1
- package/dist/humain/web-access/vendor/github-api.d.ts +1 -1
- package/dist/humain/web-access/vendor/github-api.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/github-api.js +6 -4
- package/dist/humain/web-access/vendor/github-api.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 +50 -3
- package/dist/humain/web-access/vendor/github-extract.js.map +1 -1
- package/dist/humain/web-access/vendor/github-issue-pr.d.ts +27 -0
- package/dist/humain/web-access/vendor/github-issue-pr.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/github-issue-pr.js +701 -0
- package/dist/humain/web-access/vendor/github-issue-pr.js.map +1 -0
- package/dist/humain/web-access/vendor/index.d.ts +3 -31
- package/dist/humain/web-access/vendor/index.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/index.js +643 -530
- package/dist/humain/web-access/vendor/index.js.map +1 -1
- package/dist/humain/web-access/vendor/kimi-search.d.ts +5 -0
- package/dist/humain/web-access/vendor/kimi-search.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/kimi-search.js +228 -0
- package/dist/humain/web-access/vendor/kimi-search.js.map +1 -0
- package/dist/humain/web-access/vendor/openai-search.d.ts +3 -0
- package/dist/humain/web-access/vendor/openai-search.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/openai-search.js +89 -16
- package/dist/humain/web-access/vendor/openai-search.js.map +1 -1
- package/dist/humain/web-access/vendor/page-query.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/page-query.js +56 -8
- package/dist/humain/web-access/vendor/page-query.js.map +1 -1
- package/dist/humain/web-access/vendor/ssrf-protection.js +6 -1
- package/dist/humain/web-access/vendor/ssrf-protection.js.map +1 -1
- package/dist/humain/web-access/vendor/utils.d.ts +12 -0
- package/dist/humain/web-access/vendor/utils.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/utils.js +343 -1
- package/dist/humain/web-access/vendor/utils.js.map +1 -1
- package/dist/humain/web-access/vendor/xcrawl.d.ts +4 -0
- package/dist/humain/web-access/vendor/xcrawl.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/xcrawl.js +251 -0
- package/dist/humain/web-access/vendor/xcrawl.js.map +1 -0
- package/dist/humain/web-access/vendor/youtube-extract.js +2 -2
- package/dist/humain/web-access/vendor/youtube-extract.js.map +1 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts +3 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +19 -14
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +4 -3
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts +9 -3
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +53 -10
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +9 -2
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +128 -55
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-submenu.d.ts +72 -0
- package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -0
- package/dist/modes/interactive/components/settings-submenu.js +151 -0
- package/dist/modes/interactive/components/settings-submenu.js.map +1 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts +15 -3
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +68 -17
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/external-editor.d.ts.map +1 -1
- package/dist/modes/interactive/external-editor.js +2 -1
- package/dist/modes/interactive/external-editor.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +15 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +224 -130
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/session-share.d.ts +16 -0
- package/dist/modes/interactive/session-share.d.ts.map +1 -0
- package/dist/modes/interactive/session-share.js +188 -0
- package/dist/modes/interactive/session-share.js.map +1 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +6 -5
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/json-event.d.ts +16 -13
- package/dist/modes/json-event.d.ts.map +1 -1
- package/dist/modes/json-event.js +20 -6
- package/dist/modes/json-event.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +7 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +10 -2
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +3 -0
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +14 -7
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/package-manager-cli.d.ts +1 -0
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +189 -3
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/utils/changelog.d.ts +1 -1
- package/dist/utils/changelog.d.ts.map +1 -1
- package/dist/utils/changelog.js +12 -2
- package/dist/utils/changelog.js.map +1 -1
- package/dist/utils/frontmatter.d.ts.map +1 -1
- package/dist/utils/frontmatter.js +2 -1
- package/dist/utils/frontmatter.js.map +1 -1
- package/dist/utils/management-http.d.ts +5 -3
- package/dist/utils/management-http.d.ts.map +1 -1
- package/dist/utils/management-http.js +14 -10
- package/dist/utils/management-http.js.map +1 -1
- package/dist/utils/shell.d.ts +3 -0
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +23 -9
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/syntax-highlight.d.ts +1 -0
- package/dist/utils/syntax-highlight.d.ts.map +1 -1
- package/dist/utils/syntax-highlight.js +64 -1
- package/dist/utils/syntax-highlight.js.map +1 -1
- package/dist/utils/text.d.ts +8 -0
- package/dist/utils/text.d.ts.map +1 -0
- package/dist/utils/text.js +9 -0
- package/dist/utils/text.js.map +1 -0
- package/dist/utils/version-check.js +4 -4
- package/dist/utils/version-check.js.map +1 -1
- package/docs/compaction.md +17 -0
- package/docs/custom-provider.md +12 -9
- package/docs/environment-variables.md +11 -8
- package/docs/extensions.md +35 -7
- package/docs/json.md +7 -2
- package/docs/keybindings.md +9 -9
- package/docs/llama-cpp.md +2 -0
- package/docs/models.md +8 -2
- package/docs/packages.md +2 -2
- package/docs/quickstart.md +1 -1
- package/docs/rpc.md +32 -3
- package/docs/sdk.md +7 -2
- package/docs/settings.md +23 -7
- package/docs/skills.md +3 -2
- package/docs/terminal-setup.md +20 -0
- package/docs/usage.md +14 -10
- package/docs/windows.md +15 -1
- package/examples/extensions/border-status-editor.ts +1 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +70 -8
- package/examples/extensions/custom-provider-anthropic/package.json +2 -2
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/git-checkpoint.ts +2 -2
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/notify.ts +3 -1
- package/examples/extensions/sandbox/package-lock.json +14 -40
- package/examples/extensions/sandbox/package.json +2 -2
- package/examples/extensions/titlebar-spinner.ts +1 -1
- package/examples/extensions/with-deps/package-lock.json +4 -4
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/rpc-extension-ui.ts +1 -1
- package/examples/sdk/06-extensions.ts +1 -1
- package/examples/sdk/README.md +1 -1
- package/npm-shrinkwrap.json +293 -221
- package/package.json +21 -18
- package/src/humain/mcp-adapter/UPSTREAM.md +15 -5
- package/src/humain/mcp-adapter/upstream.json +4 -3
- package/src/humain/mcp-adapter/vendor/CHANGELOG.md +82 -0
- package/src/humain/web-access/UPSTREAM.md +1 -1
- package/src/humain/web-access/upstream.json +6 -4
|
@@ -7,13 +7,14 @@ 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, ProcessTerminal, Spacer, setKeybindings, Text, TruncatedText, TuiAltScreen, TuiMainScreen, visibleWidth, } from "@earendil-works/pi-tui";
|
|
10
|
+
import { CombinedAutocompleteProvider, Container, fuzzyFilter, getCapabilities, hyperlink, Markdown, matchesKey, ProcessTerminal, Spacer, setCapabilityOverrides, setKeybindings, Text, TruncatedText, TuiAltScreen, TuiMainScreen, visibleWidth, } from "@earendil-works/pi-tui";
|
|
11
11
|
import chalk from "chalk";
|
|
12
|
-
import { spawn
|
|
13
|
-
import { APP_NAME, APP_TITLE, CONFIG_DIR_NAME, getAgentDir, getAuthPath, getDebugLogPath, getDocsPath,
|
|
12
|
+
import { spawn } from "child_process";
|
|
13
|
+
import { APP_NAME, APP_TITLE, CONFIG_DIR_NAME, getAgentDir, getAuthPath, getDebugLogPath, getDocsPath, VERSION, } from "../../config.js";
|
|
14
14
|
import { parseSkillBlock } from "../../core/agent-session.js";
|
|
15
15
|
import { SessionImportFileNotFoundError } from "../../core/agent-session-runtime.js";
|
|
16
16
|
import { CACHE_TTL_MS, collectCacheMisses, computeCacheWaste, detectCacheMiss, } from "../../core/cache-stats.js";
|
|
17
|
+
import { DEFAULT_THINKING_LEVEL, THINKING_LEVEL_OPTIONS } from "../../core/defaults.js";
|
|
17
18
|
import { FooterDataProvider } from "../../core/footer-data-provider.js";
|
|
18
19
|
import { configureHttpDispatcher, formatHttpIdleTimeoutMs } from "../../core/http-dispatcher.js";
|
|
19
20
|
import { KeybindingsManager } from "../../core/keybindings.js";
|
|
@@ -35,12 +36,12 @@ import { openBrowser } from "../../utils/open-browser.js";
|
|
|
35
36
|
import { getCwdRelativePath } from "../../utils/paths.js";
|
|
36
37
|
import { getPiUserAgent } from "../../utils/pi-user-agent.js";
|
|
37
38
|
import { killTrackedDetachedChildren } from "../../utils/shell.js";
|
|
39
|
+
import { loadAllHighlightLanguages } from "../../utils/syntax-highlight.js";
|
|
38
40
|
import { ensureTool } from "../../utils/tools-manager.js";
|
|
39
41
|
import { checkForNewPiVersion } from "../../utils/version-check.js";
|
|
40
42
|
import { ArminComponent } from "./components/armin.js";
|
|
41
43
|
import { AssistantMessageComponent } from "./components/assistant-message.js";
|
|
42
44
|
import { BashExecutionComponent } from "./components/bash-execution.js";
|
|
43
|
-
import { BorderedLoader } from "./components/bordered-loader.js";
|
|
44
45
|
import { BranchSummaryMessageComponent } from "./components/branch-summary-message.js";
|
|
45
46
|
import { CompactionSummaryMessageComponent } from "./components/compaction-summary-message.js";
|
|
46
47
|
import { CustomEditor } from "./components/custom-editor.js";
|
|
@@ -63,6 +64,7 @@ import { SessionSelectorComponent } from "./components/session-selector.js";
|
|
|
63
64
|
import { SettingsSelectorComponent } from "./components/settings-selector.js";
|
|
64
65
|
import { SkillInvocationMessageComponent } from "./components/skill-invocation-message.js";
|
|
65
66
|
import { BranchSummaryStatusIndicator, CompactionStatusIndicator, IdleStatus, RetryStatusIndicator, WorkingStatusIndicator, } from "./components/status-indicator.js";
|
|
67
|
+
import { ThinkingSelectorComponent } from "./components/thinking-selector.js";
|
|
66
68
|
import { ToolExecutionComponent } from "./components/tool-execution.js";
|
|
67
69
|
import { TreeSelectorComponent } from "./components/tree-selector.js";
|
|
68
70
|
import { TrustSelectorComponent } from "./components/trust-selector.js";
|
|
@@ -71,6 +73,7 @@ import { UserMessageSelectorComponent } from "./components/user-message-selector
|
|
|
71
73
|
import { editInExternalEditor } from "./external-editor.js";
|
|
72
74
|
import { refreshModelCatalogs } from "./model-catalog-refresh.js";
|
|
73
75
|
import { getModelSearchText } from "./model-search.js";
|
|
76
|
+
import { shareSession } from "./session-share.js";
|
|
74
77
|
import { getAvailableThemes, getAvailableThemesWithPaths, getEditorTheme, getMarkdownTheme, getThemeByName, onThemeChange, setRegisteredThemes, stopThemeWatcher, Theme, theme, } from "./theme/theme.js";
|
|
75
78
|
import { InteractiveThemeController } from "./theme/theme-controller.js";
|
|
76
79
|
function isExpandable(obj) {
|
|
@@ -89,6 +92,9 @@ class ExpandableText extends Text {
|
|
|
89
92
|
function isCustomSessionEntry(item) {
|
|
90
93
|
return "type" in item && item.type === "custom";
|
|
91
94
|
}
|
|
95
|
+
function isCompactionCostNotice(item) {
|
|
96
|
+
return "type" in item && item.type === "compaction_cost";
|
|
97
|
+
}
|
|
92
98
|
const DEAD_TERMINAL_ERROR_CODES = new Set(["EIO", "EPIPE", "ENOTCONN"]);
|
|
93
99
|
function isDeadTerminalError(error) {
|
|
94
100
|
if (!error || typeof error !== "object" || !("code" in error)) {
|
|
@@ -128,6 +134,11 @@ export function formatResumeCommand(sessionManager) {
|
|
|
128
134
|
function hasDefaultModelProvider(providerId) {
|
|
129
135
|
return providerId in defaultModelPerProvider;
|
|
130
136
|
}
|
|
137
|
+
function llamaCppPostLoginGuidance(actionLabel, loadedModelCount) {
|
|
138
|
+
return loadedModelCount === 0
|
|
139
|
+
? `${actionLabel}. No llama.cpp models are loaded. Use /llama to load a model, then /model to select it.`
|
|
140
|
+
: `${actionLabel}. Use /model to select a loaded llama.cpp model, or /llama to manage models.`;
|
|
141
|
+
}
|
|
131
142
|
const AUTH_TYPE_ORDER = { oauth: 0, api_key: 1 };
|
|
132
143
|
function createFuzzyAutocompleteItems(items, prefix, getSearchText, toAutocompleteItem) {
|
|
133
144
|
const filtered = fuzzyFilter(items, prefix, getSearchText);
|
|
@@ -174,6 +185,7 @@ export function createInteractiveTui(options) {
|
|
|
174
185
|
searchCurrentMatchStyle: (text) => theme.bold(theme.inverse(styleSearchMatch(text))),
|
|
175
186
|
openUrl: openBrowser,
|
|
176
187
|
onRightClickPaste: options.onRightClickPaste,
|
|
188
|
+
copyOnSelect: options.fullscreenCopyOnSelect,
|
|
177
189
|
copySelection: async (text) => {
|
|
178
190
|
try {
|
|
179
191
|
await copyToClipboard(text);
|
|
@@ -304,6 +316,7 @@ export class InteractiveMode {
|
|
|
304
316
|
*/
|
|
305
317
|
this.isShuttingDown = false;
|
|
306
318
|
this.runtimeHost = runtimeHost;
|
|
319
|
+
setCapabilityOverrides(this.settingsManager.getTerminalCapabilityOverrides());
|
|
307
320
|
const tuiMode = options.tuiMode ?? this.settingsManager.getTuiMode();
|
|
308
321
|
this.options = { ...options, tuiMode };
|
|
309
322
|
this.autoTrustOnReloadCwd = options.autoTrustOnReloadCwd;
|
|
@@ -320,6 +333,7 @@ export class InteractiveMode {
|
|
|
320
333
|
showHardwareCursor: this.settingsManager.getShowHardwareCursor(),
|
|
321
334
|
logDirectory: getAgentDir(),
|
|
322
335
|
onRightClickPaste: this.onRightClickPaste,
|
|
336
|
+
fullscreenCopyOnSelect: this.settingsManager.getFullscreenCopyOnSelect(),
|
|
323
337
|
});
|
|
324
338
|
this.ui = createInteractiveTuiReference(() => this.renderer);
|
|
325
339
|
this.ui.setClearOnShrink(this.settingsManager.getClearOnShrink());
|
|
@@ -430,6 +444,15 @@ export class InteractiveMode {
|
|
|
430
444
|
}));
|
|
431
445
|
};
|
|
432
446
|
}
|
|
447
|
+
const thinkingCommand = slashCommands.find((command) => command.name === "thinking");
|
|
448
|
+
if (thinkingCommand) {
|
|
449
|
+
thinkingCommand.getArgumentCompletions = (prefix) => {
|
|
450
|
+
return createFuzzyAutocompleteItems(this.session.getAvailableThinkingLevels(), prefix, (level) => level, (level) => ({
|
|
451
|
+
value: level,
|
|
452
|
+
label: level,
|
|
453
|
+
}));
|
|
454
|
+
};
|
|
455
|
+
}
|
|
433
456
|
const loginCommand = slashCommands.find((command) => command.name === "login");
|
|
434
457
|
if (loginCommand) {
|
|
435
458
|
loginCommand.getArgumentCompletions = (prefix) => {
|
|
@@ -558,6 +581,7 @@ export class InteractiveMode {
|
|
|
558
581
|
logDirectory: getAgentDir(),
|
|
559
582
|
terminal,
|
|
560
583
|
onRightClickPaste: this.onRightClickPaste,
|
|
584
|
+
fullscreenCopyOnSelect: this.settingsManager.getFullscreenCopyOnSelect(),
|
|
561
585
|
});
|
|
562
586
|
nextUi.setClearOnShrink(clearOnShrink);
|
|
563
587
|
nextUi.onDebug = onDebug;
|
|
@@ -714,6 +738,14 @@ export class InteractiveMode {
|
|
|
714
738
|
});
|
|
715
739
|
// Initialize available provider count for footer display
|
|
716
740
|
await this.updateAvailableProviderCount();
|
|
741
|
+
// Flush the completed startup state before loading the remaining syntax grammars.
|
|
742
|
+
this.ui.renderNow();
|
|
743
|
+
void loadAllHighlightLanguages().then(() => {
|
|
744
|
+
if (!this.isInitialized)
|
|
745
|
+
return;
|
|
746
|
+
this.ui.invalidate();
|
|
747
|
+
this.ui.requestRender();
|
|
748
|
+
});
|
|
717
749
|
}
|
|
718
750
|
/**
|
|
719
751
|
* Update terminal title with session name and cwd.
|
|
@@ -769,7 +801,18 @@ export class InteractiveMode {
|
|
|
769
801
|
}
|
|
770
802
|
});
|
|
771
803
|
// Show startup warnings
|
|
772
|
-
const { migratedProviders, modelFallbackMessage, initialMessage, initialImages, initialMessages } = this.options;
|
|
804
|
+
const { migratedProviders, startupDiagnostics, modelFallbackMessage, initialMessage, initialImages, initialMessages, } = this.options;
|
|
805
|
+
for (const diagnostic of startupDiagnostics ?? []) {
|
|
806
|
+
if (diagnostic.type === "error") {
|
|
807
|
+
this.showError(diagnostic.message);
|
|
808
|
+
}
|
|
809
|
+
else if (diagnostic.type === "warning") {
|
|
810
|
+
this.showWarning(diagnostic.message);
|
|
811
|
+
}
|
|
812
|
+
else {
|
|
813
|
+
this.showStatus(diagnostic.message);
|
|
814
|
+
}
|
|
815
|
+
}
|
|
773
816
|
if (migratedProviders && migratedProviders.length > 0) {
|
|
774
817
|
this.showWarning(`Migrated credentials to auth.json: ${migratedProviders.join(", ")}`);
|
|
775
818
|
}
|
|
@@ -890,7 +933,7 @@ export class InteractiveMode {
|
|
|
890
933
|
this.reportInstallTelemetry(VERSION);
|
|
891
934
|
return undefined;
|
|
892
935
|
}
|
|
893
|
-
const newEntries = getNewEntries(entries, lastVersion);
|
|
936
|
+
const newEntries = getNewEntries(entries, lastVersion, VERSION);
|
|
894
937
|
if (newEntries.length > 0) {
|
|
895
938
|
this.settingsManager.setLastChangelogVersion(VERSION);
|
|
896
939
|
this.reportInstallTelemetry(VERSION);
|
|
@@ -1447,8 +1490,12 @@ export class InteractiveMode {
|
|
|
1447
1490
|
this.transcriptScrollView?.setScrollbar(this.settingsManager.getFullscreenScrollbar());
|
|
1448
1491
|
}
|
|
1449
1492
|
applyRuntimeSettings() {
|
|
1493
|
+
setCapabilityOverrides(this.settingsManager.getTerminalCapabilityOverrides());
|
|
1450
1494
|
configureHttpDispatcher(this.settingsManager.getHttpIdleTimeoutMs());
|
|
1451
1495
|
this.applyFullscreenScrollbarSetting();
|
|
1496
|
+
if (this.renderer instanceof TuiAltScreen) {
|
|
1497
|
+
this.renderer.setCopyOnSelect(this.settingsManager.getFullscreenCopyOnSelect());
|
|
1498
|
+
}
|
|
1452
1499
|
this.footer.setSession(this.session);
|
|
1453
1500
|
this.footer.setAutoCompactEnabled(this.session.autoCompactionEnabled);
|
|
1454
1501
|
this.footerDataProvider.setCwd(this.sessionManager.getCwd());
|
|
@@ -1598,6 +1645,9 @@ export class InteractiveMode {
|
|
|
1598
1645
|
this.statusContainer.addChild(this.idleStatus);
|
|
1599
1646
|
}
|
|
1600
1647
|
}
|
|
1648
|
+
showWorkingStatusIndicator() {
|
|
1649
|
+
this.showStatusIndicator(new WorkingStatusIndicator(this.ui, this.workingMessage ?? this.defaultWorkingMessage, this.workingIndicatorOptions));
|
|
1650
|
+
}
|
|
1601
1651
|
setWorkingVisible(visible) {
|
|
1602
1652
|
this.workingVisible = visible;
|
|
1603
1653
|
if (!visible) {
|
|
@@ -1606,7 +1656,7 @@ export class InteractiveMode {
|
|
|
1606
1656
|
return;
|
|
1607
1657
|
}
|
|
1608
1658
|
if (this.session.isStreaming && this.activeStatusIndicator?.kind !== "working") {
|
|
1609
|
-
this.
|
|
1659
|
+
this.showWorkingStatusIndicator();
|
|
1610
1660
|
}
|
|
1611
1661
|
this.ui.requestRender();
|
|
1612
1662
|
}
|
|
@@ -2226,7 +2276,7 @@ export class InteractiveMode {
|
|
|
2226
2276
|
this.defaultEditor.onAction("app.tools.expand", () => this.toggleToolOutputExpansion());
|
|
2227
2277
|
this.defaultEditor.onAction("app.thinking.toggle", () => this.toggleThinkingBlockVisibility());
|
|
2228
2278
|
this.defaultEditor.onAction("app.editor.external", () => void this.handleOpenExternalEditor());
|
|
2229
|
-
this.defaultEditor.onAction("app.message.copy", () => void this.handleCopyCommand({ flashConfirmation: true }));
|
|
2279
|
+
this.defaultEditor.onAction("app.message.copy", () => void this.handleCopyCommand({ flashConfirmation: true, preferSelection: true }));
|
|
2230
2280
|
this.defaultEditor.onAction("app.message.followUp", () => this.handleFollowUp());
|
|
2231
2281
|
this.defaultEditor.onAction("app.message.dequeue", () => this.handleDequeue());
|
|
2232
2282
|
this.defaultEditor.onAction("app.session.new", () => this.handleClearCommand());
|
|
@@ -2311,6 +2361,12 @@ export class InteractiveMode {
|
|
|
2311
2361
|
await this.handleModelCommand(searchTerm);
|
|
2312
2362
|
return;
|
|
2313
2363
|
}
|
|
2364
|
+
if (text === "/thinking" || text.startsWith("/thinking ")) {
|
|
2365
|
+
const searchTerm = text.startsWith("/thinking ") ? text.slice(10).trim() : undefined;
|
|
2366
|
+
this.editor.setText("");
|
|
2367
|
+
this.handleThinkingCommand(searchTerm);
|
|
2368
|
+
return;
|
|
2369
|
+
}
|
|
2314
2370
|
if (text === "/export" || text.startsWith("/export ")) {
|
|
2315
2371
|
await this.handleExportCommand(text);
|
|
2316
2372
|
this.editor.setText("");
|
|
@@ -2487,17 +2543,21 @@ export class InteractiveMode {
|
|
|
2487
2543
|
switch (event.type) {
|
|
2488
2544
|
case "agent_start":
|
|
2489
2545
|
this.pendingTools.clear();
|
|
2490
|
-
if (this.settingsManager.getShowTerminalProgress()) {
|
|
2491
|
-
this.ui.terminal.setProgress(true);
|
|
2492
|
-
}
|
|
2493
2546
|
// Restore main escape handler if retry handler is still active
|
|
2494
2547
|
// (retry success event fires later, but we need main handler now)
|
|
2495
2548
|
if (this.retryEscapeHandler) {
|
|
2496
2549
|
this.defaultEditor.onEscape = this.retryEscapeHandler;
|
|
2497
2550
|
this.retryEscapeHandler = undefined;
|
|
2498
2551
|
}
|
|
2552
|
+
break;
|
|
2553
|
+
case "turn_start":
|
|
2554
|
+
if (this.settingsManager.getShowTerminalProgress()) {
|
|
2555
|
+
this.ui.terminal.setProgress(true);
|
|
2556
|
+
}
|
|
2499
2557
|
if (this.workingVisible) {
|
|
2500
|
-
|
|
2558
|
+
if (this.activeStatusIndicator?.kind !== "working") {
|
|
2559
|
+
this.showWorkingStatusIndicator();
|
|
2560
|
+
}
|
|
2501
2561
|
}
|
|
2502
2562
|
else {
|
|
2503
2563
|
this.clearStatusIndicator();
|
|
@@ -2689,9 +2749,21 @@ export class InteractiveMode {
|
|
|
2689
2749
|
}
|
|
2690
2750
|
}
|
|
2691
2751
|
else if (event.result) {
|
|
2752
|
+
const entries = this.sessionManager.buildContextEntries();
|
|
2753
|
+
if (entries[0]?.type !== "compaction") {
|
|
2754
|
+
throw new Error("Completed compaction is missing from the session context");
|
|
2755
|
+
}
|
|
2692
2756
|
this.chatContainer.clear();
|
|
2693
|
-
|
|
2757
|
+
// The latest compaction is prepended for model context; append it below at its chronological position.
|
|
2758
|
+
this.renderSessionEntries(entries.slice(1));
|
|
2694
2759
|
this.addMessageToChat(createCompactionSummaryMessage(event.result.summary, event.result.tokensBefore, new Date().toISOString()));
|
|
2760
|
+
if (event.result.usage) {
|
|
2761
|
+
this.addCompactionCostNotice({
|
|
2762
|
+
type: "compaction_cost",
|
|
2763
|
+
kind: "compaction",
|
|
2764
|
+
usage: event.result.usage,
|
|
2765
|
+
});
|
|
2766
|
+
}
|
|
2695
2767
|
this.footer.invalidate();
|
|
2696
2768
|
}
|
|
2697
2769
|
else if (event.errorMessage) {
|
|
@@ -2913,6 +2985,10 @@ export class InteractiveMode {
|
|
|
2913
2985
|
this.addCustomEntryToChat(item);
|
|
2914
2986
|
continue;
|
|
2915
2987
|
}
|
|
2988
|
+
if (isCompactionCostNotice(item)) {
|
|
2989
|
+
this.addCompactionCostNotice(item);
|
|
2990
|
+
continue;
|
|
2991
|
+
}
|
|
2916
2992
|
const message = item;
|
|
2917
2993
|
// Assistant messages need special handling for tool calls
|
|
2918
2994
|
if (message.role === "assistant") {
|
|
@@ -2980,10 +3056,28 @@ export class InteractiveMode {
|
|
|
2980
3056
|
if (entry.type === "custom") {
|
|
2981
3057
|
return [entry];
|
|
2982
3058
|
}
|
|
2983
|
-
|
|
3059
|
+
const messages = sessionEntryToContextMessages(entry);
|
|
3060
|
+
if ((entry.type === "compaction" || entry.type === "branch_summary") && entry.usage && messages.length > 0) {
|
|
3061
|
+
return [...messages, { type: "compaction_cost", kind: entry.type, usage: entry.usage }];
|
|
3062
|
+
}
|
|
3063
|
+
return messages;
|
|
2984
3064
|
});
|
|
2985
3065
|
this.renderSessionItems(items, options);
|
|
2986
3066
|
}
|
|
3067
|
+
/**
|
|
3068
|
+
* Render billing usage for a compaction or branch summary. The notice is derived
|
|
3069
|
+
* from persisted summary usage and is not stored as a separate session entry.
|
|
3070
|
+
*/
|
|
3071
|
+
addCompactionCostNotice(notice) {
|
|
3072
|
+
if (!this.settingsManager.getShowCacheMissNotices())
|
|
3073
|
+
return;
|
|
3074
|
+
const { usage } = notice;
|
|
3075
|
+
const tokens = usage.input + usage.output + usage.cacheRead + usage.cacheWrite;
|
|
3076
|
+
const cost = usage.cost.total >= 0.01 ? ` (~$${usage.cost.total.toFixed(2)})` : "";
|
|
3077
|
+
const label = notice.kind === "compaction" ? "Compaction" : "Branch summary";
|
|
3078
|
+
this.chatContainer.addChild(new Spacer(1));
|
|
3079
|
+
this.chatContainer.addChild(new Text(theme.fg("warning", `${label}: ${formatTokens(tokens)} tokens billed${cost}`), 1, 0));
|
|
3080
|
+
}
|
|
2987
3081
|
/**
|
|
2988
3082
|
* Show a transcript notice when a completed assistant message paid for a
|
|
2989
3083
|
* significant cache miss. Only states observable facts: the miss itself,
|
|
@@ -3327,18 +3421,19 @@ export class InteractiveMode {
|
|
|
3327
3421
|
}
|
|
3328
3422
|
this.showStatus(`Tool output: ${expanded ? "expanded" : "collapsed"}`);
|
|
3329
3423
|
}
|
|
3424
|
+
/** Update rendered assistant messages without rebuilding live tool components. */
|
|
3425
|
+
updateThinkingBlockVisibility() {
|
|
3426
|
+
for (const child of this.chatContainer.children) {
|
|
3427
|
+
if (child instanceof AssistantMessageComponent) {
|
|
3428
|
+
child.setHideThinkingBlock(this.hideThinkingBlock);
|
|
3429
|
+
}
|
|
3430
|
+
}
|
|
3431
|
+
this.ui.requestRender();
|
|
3432
|
+
}
|
|
3330
3433
|
toggleThinkingBlockVisibility() {
|
|
3331
3434
|
this.hideThinkingBlock = !this.hideThinkingBlock;
|
|
3332
3435
|
this.settingsManager.setHideThinkingBlock(this.hideThinkingBlock);
|
|
3333
|
-
|
|
3334
|
-
this.chatContainer.clear();
|
|
3335
|
-
this.rebuildChatFromMessages();
|
|
3336
|
-
// If streaming, re-add the streaming component with updated visibility and re-render
|
|
3337
|
-
if (this.streamingComponent && this.streamingMessage) {
|
|
3338
|
-
this.streamingComponent.setHideThinkingBlock(this.hideThinkingBlock);
|
|
3339
|
-
this.streamingComponent.updateContent(this.streamingMessage);
|
|
3340
|
-
this.chatContainer.addChild(this.streamingComponent);
|
|
3341
|
-
}
|
|
3436
|
+
this.updateThinkingBlockVisibility();
|
|
3342
3437
|
this.showStatus(`Thinking blocks: ${this.hideThinkingBlock ? "hidden" : "visible"}`);
|
|
3343
3438
|
}
|
|
3344
3439
|
async handleOpenExternalEditor() {
|
|
@@ -3614,8 +3709,14 @@ export class InteractiveMode {
|
|
|
3614
3709
|
showSettingsSelector() {
|
|
3615
3710
|
this.showSelector((done) => {
|
|
3616
3711
|
let selector;
|
|
3712
|
+
const defaultProvider = this.settingsManager.getDefaultProvider();
|
|
3713
|
+
const defaultModelId = this.settingsManager.getDefaultModel();
|
|
3714
|
+
const defaultModel = defaultProvider && defaultModelId ? `${defaultProvider}/${defaultModelId}` : "not set";
|
|
3617
3715
|
selector = new SettingsSelectorComponent({
|
|
3618
3716
|
autoCompact: this.session.autoCompactionEnabled,
|
|
3717
|
+
defaultModel,
|
|
3718
|
+
currentModel: this.session.model,
|
|
3719
|
+
availableDefaultModels: this.session.modelRuntime.getAvailableSnapshot(),
|
|
3619
3720
|
showImages: this.settingsManager.getShowImages(),
|
|
3620
3721
|
imageWidthCells: this.settingsManager.getImageWidthCells(),
|
|
3621
3722
|
autoResizeImages: this.settingsManager.getImageAutoResize(),
|
|
@@ -3625,8 +3726,9 @@ export class InteractiveMode {
|
|
|
3625
3726
|
followUpMode: this.session.followUpMode,
|
|
3626
3727
|
transport: this.settingsManager.getTransport(),
|
|
3627
3728
|
httpIdleTimeoutMs: this.settingsManager.getHttpIdleTimeoutMs(),
|
|
3628
|
-
thinkingLevel: this.
|
|
3629
|
-
availableThinkingLevels:
|
|
3729
|
+
thinkingLevel: this.settingsManager.getDefaultThinkingLevel() ?? DEFAULT_THINKING_LEVEL,
|
|
3730
|
+
availableThinkingLevels: [...THINKING_LEVEL_OPTIONS],
|
|
3731
|
+
modelThinkingLevels: this.settingsManager.getAllModelThinkingLevels(),
|
|
3630
3732
|
currentTheme: this.themeController.getThemeSelection() || "dark",
|
|
3631
3733
|
terminalTheme: this.themeController.getTerminalTheme(),
|
|
3632
3734
|
availableThemes: getAvailableThemes(),
|
|
@@ -3648,6 +3750,7 @@ export class InteractiveMode {
|
|
|
3648
3750
|
tuiMode: this.ui.mode,
|
|
3649
3751
|
fullscreenExitOutput: this.settingsManager.getFullscreenExitOutput(),
|
|
3650
3752
|
fullscreenScrollbar: this.settingsManager.getFullscreenScrollbar(),
|
|
3753
|
+
fullscreenCopyOnSelect: this.settingsManager.getFullscreenCopyOnSelect(),
|
|
3651
3754
|
warnings: this.settingsManager.getWarnings(),
|
|
3652
3755
|
}, {
|
|
3653
3756
|
onAutoCompactChange: (enabled) => {
|
|
@@ -3695,10 +3798,26 @@ export class InteractiveMode {
|
|
|
3695
3798
|
configureHttpDispatcher(timeoutMs);
|
|
3696
3799
|
this.showStatus(`HTTP idle timeout: ${formatHttpIdleTimeoutMs(timeoutMs)}`);
|
|
3697
3800
|
},
|
|
3698
|
-
|
|
3699
|
-
this.
|
|
3700
|
-
|
|
3701
|
-
this.
|
|
3801
|
+
onModelThinkingLevelChange: (provider, modelId, level) => {
|
|
3802
|
+
this.settingsManager.setModelThinkingLevel(provider, modelId, level);
|
|
3803
|
+
// If the override is for the current model, apply it to the session too
|
|
3804
|
+
const current = this.session.model;
|
|
3805
|
+
if (current && current.provider === provider && current.id === modelId) {
|
|
3806
|
+
this.session.setThinkingLevel(level);
|
|
3807
|
+
this.footer.invalidate();
|
|
3808
|
+
this.updateEditorBorderColor();
|
|
3809
|
+
}
|
|
3810
|
+
},
|
|
3811
|
+
onModelThinkingLevelRemove: (provider, modelId) => {
|
|
3812
|
+
this.settingsManager.removeModelThinkingLevel(provider, modelId);
|
|
3813
|
+
// If the override was for the current model, revert to global default
|
|
3814
|
+
const current = this.session.model;
|
|
3815
|
+
if (current && current.provider === provider && current.id === modelId) {
|
|
3816
|
+
const globalDefault = this.settingsManager.getDefaultThinkingLevel() ?? DEFAULT_THINKING_LEVEL;
|
|
3817
|
+
this.session.setThinkingLevel(globalDefault);
|
|
3818
|
+
this.footer.invalidate();
|
|
3819
|
+
this.updateEditorBorderColor();
|
|
3820
|
+
}
|
|
3702
3821
|
},
|
|
3703
3822
|
onThemeChange: (themeSetting) => {
|
|
3704
3823
|
this.settingsManager.setTheme(themeSetting);
|
|
@@ -3708,13 +3827,7 @@ export class InteractiveMode {
|
|
|
3708
3827
|
onHideThinkingBlockChange: (hidden) => {
|
|
3709
3828
|
this.hideThinkingBlock = hidden;
|
|
3710
3829
|
this.settingsManager.setHideThinkingBlock(hidden);
|
|
3711
|
-
|
|
3712
|
-
if (child instanceof AssistantMessageComponent) {
|
|
3713
|
-
child.setHideThinkingBlock(hidden);
|
|
3714
|
-
}
|
|
3715
|
-
}
|
|
3716
|
-
this.chatContainer.clear();
|
|
3717
|
-
this.rebuildChatFromMessages();
|
|
3830
|
+
this.updateThinkingBlockVisibility();
|
|
3718
3831
|
},
|
|
3719
3832
|
onMermaidRenderingModeChange: (mode) => {
|
|
3720
3833
|
this.settingsManager.setMermaidRenderingMode(mode);
|
|
@@ -3808,6 +3921,11 @@ export class InteractiveMode {
|
|
|
3808
3921
|
this.settingsManager.setFullscreenScrollbar(mode);
|
|
3809
3922
|
this.applyFullscreenScrollbarSetting();
|
|
3810
3923
|
},
|
|
3924
|
+
onFullscreenCopyOnSelectChange: (enabled) => {
|
|
3925
|
+
this.settingsManager.setFullscreenCopyOnSelect(enabled);
|
|
3926
|
+
if (this.renderer instanceof TuiAltScreen)
|
|
3927
|
+
this.renderer.setCopyOnSelect(enabled);
|
|
3928
|
+
},
|
|
3811
3929
|
onWarningsChange: (warnings) => {
|
|
3812
3930
|
this.settingsManager.setWarnings(warnings);
|
|
3813
3931
|
},
|
|
@@ -3819,6 +3937,44 @@ export class InteractiveMode {
|
|
|
3819
3937
|
return { component: selector, focus: selector.getSettingsList() };
|
|
3820
3938
|
});
|
|
3821
3939
|
}
|
|
3940
|
+
handleThinkingCommand(searchTerm) {
|
|
3941
|
+
const availableLevels = this.session.getAvailableThinkingLevels();
|
|
3942
|
+
if (!searchTerm) {
|
|
3943
|
+
this.showThinkingSelector();
|
|
3944
|
+
return;
|
|
3945
|
+
}
|
|
3946
|
+
const normalized = searchTerm.trim().toLowerCase();
|
|
3947
|
+
const level = availableLevels.find((candidate) => candidate.toLowerCase() === normalized);
|
|
3948
|
+
if (!level) {
|
|
3949
|
+
this.showError(`Unknown thinking level "${searchTerm}". Available levels: ${availableLevels.join(", ")}.`);
|
|
3950
|
+
return;
|
|
3951
|
+
}
|
|
3952
|
+
this.selectThinkingLevel(level, false);
|
|
3953
|
+
}
|
|
3954
|
+
selectThinkingLevel(level, persist) {
|
|
3955
|
+
try {
|
|
3956
|
+
this.session.setThinkingLevel(level, { persist });
|
|
3957
|
+
this.footer.invalidate();
|
|
3958
|
+
this.updateEditorBorderColor();
|
|
3959
|
+
this.showStatus(persist ? `Default thinking level: ${level}` : `Thinking level: ${level}`);
|
|
3960
|
+
}
|
|
3961
|
+
catch (error) {
|
|
3962
|
+
this.showError(error instanceof Error ? error.message : String(error));
|
|
3963
|
+
}
|
|
3964
|
+
}
|
|
3965
|
+
showThinkingSelector() {
|
|
3966
|
+
this.showSelector((done) => {
|
|
3967
|
+
const selectLevel = (level, persist) => {
|
|
3968
|
+
this.selectThinkingLevel(level, persist);
|
|
3969
|
+
done();
|
|
3970
|
+
};
|
|
3971
|
+
const selector = new ThinkingSelectorComponent(this.session.thinkingLevel ?? DEFAULT_THINKING_LEVEL, this.session.getAvailableThinkingLevels(), (level) => selectLevel(level, false), () => {
|
|
3972
|
+
done();
|
|
3973
|
+
this.ui.requestRender();
|
|
3974
|
+
}, (level) => selectLevel(level, true), this.settingsManager.getDefaultThinkingLevel() ?? DEFAULT_THINKING_LEVEL);
|
|
3975
|
+
return { component: selector, focus: selector };
|
|
3976
|
+
});
|
|
3977
|
+
}
|
|
3822
3978
|
async handleModelCommand(searchTerm) {
|
|
3823
3979
|
if (!searchTerm) {
|
|
3824
3980
|
this.showModelSelector();
|
|
@@ -3827,7 +3983,7 @@ export class InteractiveMode {
|
|
|
3827
3983
|
const model = await this.findExactModelMatch(searchTerm);
|
|
3828
3984
|
if (model) {
|
|
3829
3985
|
try {
|
|
3830
|
-
await this.session.setModel(model);
|
|
3986
|
+
await this.session.setModel(model, { persist: false });
|
|
3831
3987
|
this.footer.invalidate();
|
|
3832
3988
|
this.updateEditorBorderColor();
|
|
3833
3989
|
this.showStatus(`Model: ${model.id}`);
|
|
@@ -3956,13 +4112,14 @@ export class InteractiveMode {
|
|
|
3956
4112
|
}
|
|
3957
4113
|
showModelSelector(initialSearchInput) {
|
|
3958
4114
|
this.showSelector((done) => {
|
|
3959
|
-
const
|
|
4115
|
+
const selectModel = async (model, persist) => {
|
|
3960
4116
|
try {
|
|
3961
|
-
await this.session.setModel(model);
|
|
4117
|
+
await this.session.setModel(model, { persist });
|
|
4118
|
+
this.updateAvailableProviderCount();
|
|
3962
4119
|
this.footer.invalidate();
|
|
3963
4120
|
this.updateEditorBorderColor();
|
|
3964
4121
|
done();
|
|
3965
|
-
this.showStatus(`Model: ${model.id}`);
|
|
4122
|
+
this.showStatus(persist ? `Default model: ${model.provider}/${model.id}` : `Model: ${model.id}`);
|
|
3966
4123
|
void this.maybeWarnAboutAnthropicSubscriptionAuth(model);
|
|
3967
4124
|
this.checkDaxnutsEasterEgg(model);
|
|
3968
4125
|
}
|
|
@@ -3970,10 +4127,13 @@ export class InteractiveMode {
|
|
|
3970
4127
|
done();
|
|
3971
4128
|
this.showError(error instanceof Error ? error.message : String(error));
|
|
3972
4129
|
}
|
|
3973
|
-
}
|
|
4130
|
+
};
|
|
4131
|
+
const defaultProvider = this.settingsManager.getDefaultProvider();
|
|
4132
|
+
const defaultModel = this.settingsManager.getDefaultModel();
|
|
4133
|
+
const selector = new ModelSelectorComponent(this.ui, this.session.model, this.session.modelRuntime, this.session.scopedModels, (model) => selectModel(model, false), () => {
|
|
3974
4134
|
done();
|
|
3975
4135
|
this.ui.requestRender();
|
|
3976
|
-
}, initialSearchInput);
|
|
4136
|
+
}, initialSearchInput, (model) => selectModel(model, true), defaultProvider && defaultModel ? { provider: defaultProvider, id: defaultModel } : undefined);
|
|
3977
4137
|
return { component: selector, focus: selector, dispose: () => selector.dispose() };
|
|
3978
4138
|
});
|
|
3979
4139
|
}
|
|
@@ -4529,7 +4689,11 @@ export class InteractiveMode {
|
|
|
4529
4689
|
if (isUnknownModel(previousModel)) {
|
|
4530
4690
|
const availableModels = this.session.modelRuntime.getAvailableSnapshot();
|
|
4531
4691
|
const providerModels = availableModels.filter((model) => model.provider === providerId);
|
|
4532
|
-
|
|
4692
|
+
// Matches LLAMA_PROVIDER_ID from extensions/llama/provider.ts; kept inline to avoid coupling interactive mode to the built-in extension.
|
|
4693
|
+
if (providerId === "llama.cpp") {
|
|
4694
|
+
selectionError = llamaCppPostLoginGuidance(actionLabel, providerModels.length);
|
|
4695
|
+
}
|
|
4696
|
+
else if (!hasDefaultModelProvider(providerId)) {
|
|
4533
4697
|
selectionError = `${actionLabel}, but no default model is configured for provider "${providerId}". Use /model to select a model.`;
|
|
4534
4698
|
}
|
|
4535
4699
|
else if (providerModels.length === 0) {
|
|
@@ -4543,7 +4707,7 @@ export class InteractiveMode {
|
|
|
4543
4707
|
}
|
|
4544
4708
|
else {
|
|
4545
4709
|
try {
|
|
4546
|
-
await this.session.setModel(selectedModel);
|
|
4710
|
+
await this.session.setModel(selectedModel, { persist: true });
|
|
4547
4711
|
}
|
|
4548
4712
|
catch (error) {
|
|
4549
4713
|
selectedModel = undefined;
|
|
@@ -4800,8 +4964,8 @@ export class InteractiveMode {
|
|
|
4800
4964
|
activeHeader.setExpanded(this.toolOutputExpanded);
|
|
4801
4965
|
}
|
|
4802
4966
|
setRegisteredThemes(this.session.resourceLoader.getThemes().themes);
|
|
4803
|
-
await this.themeController.applyFromSettings();
|
|
4804
4967
|
this.applyRuntimeSettings();
|
|
4968
|
+
await this.themeController.applyFromSettings();
|
|
4805
4969
|
this.setupAutocompleteProvider();
|
|
4806
4970
|
const runner = this.session.extensionRunner;
|
|
4807
4971
|
this.setupExtensionShortcuts(runner);
|
|
@@ -4913,93 +5077,23 @@ export class InteractiveMode {
|
|
|
4913
5077
|
}
|
|
4914
5078
|
}
|
|
4915
5079
|
async handleShareCommand() {
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
}
|
|
4924
|
-
catch {
|
|
4925
|
-
this.showError("GitHub CLI (gh) is not installed. Install it from https://cli.github.com/");
|
|
4926
|
-
return;
|
|
4927
|
-
}
|
|
4928
|
-
// Export to a temp file
|
|
4929
|
-
const tmpFile = path.join(os.tmpdir(), "session.html");
|
|
4930
|
-
try {
|
|
4931
|
-
await this.session.exportToHtml(tmpFile, { themeName: theme.name });
|
|
4932
|
-
}
|
|
4933
|
-
catch (error) {
|
|
4934
|
-
this.showError(`Failed to export session: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
4935
|
-
return;
|
|
4936
|
-
}
|
|
4937
|
-
// Show cancellable loader, replacing the editor
|
|
4938
|
-
const loader = new BorderedLoader(this.ui, theme, "Creating gist...");
|
|
4939
|
-
this.editorContainer.clear();
|
|
4940
|
-
this.editorContainer.addChild(loader);
|
|
4941
|
-
this.ui.setFocus(loader);
|
|
4942
|
-
this.ui.requestRender();
|
|
4943
|
-
const restoreEditor = () => {
|
|
4944
|
-
loader.dispose();
|
|
4945
|
-
this.editorContainer.clear();
|
|
4946
|
-
this.editorContainer.addChild(this.editor);
|
|
4947
|
-
this.ui.setFocus(this.editor);
|
|
4948
|
-
try {
|
|
4949
|
-
fs.unlinkSync(tmpFile);
|
|
4950
|
-
}
|
|
4951
|
-
catch {
|
|
4952
|
-
// Ignore cleanup errors
|
|
4953
|
-
}
|
|
4954
|
-
};
|
|
4955
|
-
// Create a secret gist asynchronously
|
|
4956
|
-
let proc = null;
|
|
4957
|
-
loader.onAbort = () => {
|
|
4958
|
-
proc?.kill();
|
|
4959
|
-
restoreEditor();
|
|
4960
|
-
this.showStatus("Share cancelled");
|
|
4961
|
-
};
|
|
4962
|
-
try {
|
|
4963
|
-
const result = await new Promise((resolve) => {
|
|
4964
|
-
proc = spawn("gh", ["gist", "create", "--public=false", tmpFile]);
|
|
4965
|
-
let stdout = "";
|
|
4966
|
-
let stderr = "";
|
|
4967
|
-
proc.stdout?.on("data", (data) => {
|
|
4968
|
-
stdout += data.toString();
|
|
4969
|
-
});
|
|
4970
|
-
proc.stderr?.on("data", (data) => {
|
|
4971
|
-
stderr += data.toString();
|
|
4972
|
-
});
|
|
4973
|
-
proc.on("close", (code) => resolve({ stdout, stderr, code }));
|
|
4974
|
-
});
|
|
4975
|
-
if (loader.signal.aborted)
|
|
4976
|
-
return;
|
|
4977
|
-
restoreEditor();
|
|
4978
|
-
if (result.code !== 0) {
|
|
4979
|
-
const errorMsg = result.stderr?.trim() || "Unknown error";
|
|
4980
|
-
this.showError(`Failed to create gist: ${errorMsg}`);
|
|
4981
|
-
return;
|
|
4982
|
-
}
|
|
4983
|
-
// Extract gist ID from the URL returned by gh
|
|
4984
|
-
// gh returns something like: https://gist.github.com/username/GIST_ID
|
|
4985
|
-
const gistUrl = result.stdout?.trim();
|
|
4986
|
-
const gistId = gistUrl?.split("/").pop();
|
|
4987
|
-
if (!gistId) {
|
|
4988
|
-
this.showError("Failed to parse gist ID from gh output");
|
|
4989
|
-
return;
|
|
4990
|
-
}
|
|
4991
|
-
// Create the preview URL
|
|
4992
|
-
const previewUrl = getShareViewerUrl(gistId);
|
|
4993
|
-
this.showStatus(`Share URL: ${previewUrl}\nGist: ${gistUrl}`);
|
|
4994
|
-
}
|
|
4995
|
-
catch (error) {
|
|
4996
|
-
if (!loader.signal.aborted) {
|
|
4997
|
-
restoreEditor();
|
|
4998
|
-
this.showError(`Failed to create gist: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
4999
|
-
}
|
|
5000
|
-
}
|
|
5080
|
+
await shareSession({
|
|
5081
|
+
session: this.session,
|
|
5082
|
+
ui: this.ui,
|
|
5083
|
+
editorContainer: this.editorContainer,
|
|
5084
|
+
editor: this.editor,
|
|
5085
|
+
showStatus: (message) => this.showStatus(message),
|
|
5086
|
+
showError: (message) => this.showError(message),
|
|
5087
|
+
});
|
|
5001
5088
|
}
|
|
5002
5089
|
async handleCopyCommand(options = {}) {
|
|
5090
|
+
if (options.preferSelection &&
|
|
5091
|
+
this.ui instanceof TuiAltScreen &&
|
|
5092
|
+
!this.ui.getCopyOnSelect() &&
|
|
5093
|
+
this.ui.hasActiveSelection()) {
|
|
5094
|
+
await this.ui.copyActiveSelectionToClipboard();
|
|
5095
|
+
return;
|
|
5096
|
+
}
|
|
5003
5097
|
const text = this.session.getLastAssistantText();
|
|
5004
5098
|
if (!text) {
|
|
5005
5099
|
this.showError("No agent messages to copy yet.");
|