@f5-sales-demo/xcsh 19.51.2
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 +7073 -0
- package/README.md +14 -0
- package/examples/README.md +21 -0
- package/examples/custom-tools/README.md +109 -0
- package/examples/custom-tools/hello/index.ts +20 -0
- package/examples/custom-tools/todo/index.ts +206 -0
- package/examples/extensions/README.md +143 -0
- package/examples/extensions/api-demo.ts +89 -0
- package/examples/extensions/chalk-logger.ts +25 -0
- package/examples/extensions/hello.ts +32 -0
- package/examples/extensions/pirate.ts +43 -0
- package/examples/extensions/plan-mode.ts +551 -0
- package/examples/extensions/reload-runtime.ts +37 -0
- package/examples/extensions/todo.ts +296 -0
- package/examples/extensions/tools.ts +145 -0
- package/examples/extensions/with-deps/index.ts +36 -0
- package/examples/extensions/with-deps/package-lock.json +31 -0
- package/examples/extensions/with-deps/package.json +16 -0
- package/examples/hooks/README.md +56 -0
- package/examples/hooks/auto-commit-on-exit.ts +48 -0
- package/examples/hooks/confirm-destructive.ts +58 -0
- package/examples/hooks/custom-compaction.ts +115 -0
- package/examples/hooks/dirty-repo-guard.ts +51 -0
- package/examples/hooks/file-trigger.ts +40 -0
- package/examples/hooks/git-checkpoint.ts +52 -0
- package/examples/hooks/handoff.ts +149 -0
- package/examples/hooks/permission-gate.ts +33 -0
- package/examples/hooks/protected-paths.ts +29 -0
- package/examples/hooks/qna.ts +118 -0
- package/examples/hooks/status-line.ts +39 -0
- package/examples/sdk/01-minimal.ts +21 -0
- package/examples/sdk/02-custom-model.ts +49 -0
- package/examples/sdk/03-custom-prompt.ts +43 -0
- package/examples/sdk/04-skills.ts +43 -0
- package/examples/sdk/06-extensions.ts +80 -0
- package/examples/sdk/06-hooks.ts +61 -0
- package/examples/sdk/07-context-files.ts +35 -0
- package/examples/sdk/08-prompt-templates.ts +41 -0
- package/examples/sdk/08-slash-commands.ts +46 -0
- package/examples/sdk/09-api-keys-and-oauth.ts +54 -0
- package/examples/sdk/11-sessions.ts +47 -0
- package/examples/sdk/README.md +172 -0
- package/package.json +539 -0
- package/scripts/build-info/resolvers.ts +51 -0
- package/scripts/capture-ax-fixture.ts +84 -0
- package/scripts/capture-login-fixture.ts +30 -0
- package/scripts/check-workflow-field-coverage.ts +101 -0
- package/scripts/extension-uat-harness.ts +340 -0
- package/scripts/format-prompts.ts +68 -0
- package/scripts/generate-api-spec-index.ts +580 -0
- package/scripts/generate-branding-index.ts +81 -0
- package/scripts/generate-build-info.ts +106 -0
- package/scripts/generate-console-catalog.ts +88 -0
- package/scripts/generate-console-field-metadata.ts +74 -0
- package/scripts/generate-docs-index.ts +40 -0
- package/scripts/generate-template.ts +32 -0
- package/scripts/generate-terraform-index.ts +81 -0
- package/scripts/mermaid-gallery.ts +132 -0
- package/scripts/uat-matrix-modalities.ts +451 -0
- package/scripts/uat-matrix-report.ts +175 -0
- package/scripts/uat-matrix.ts +353 -0
- package/src/async/index.ts +2 -0
- package/src/async/job-manager.ts +416 -0
- package/src/async/support.ts +5 -0
- package/src/autoresearch/apply-contract-to-state.ts +1 -0
- package/src/autoresearch/command-resume.md +17 -0
- package/src/autoresearch/contract.ts +205 -0
- package/src/autoresearch/dashboard.ts +374 -0
- package/src/autoresearch/git.ts +191 -0
- package/src/autoresearch/helpers.ts +328 -0
- package/src/autoresearch/index.ts +402 -0
- package/src/autoresearch/prompt.md +236 -0
- package/src/autoresearch/resume-message.md +16 -0
- package/src/autoresearch/state.ts +303 -0
- package/src/autoresearch/tools/init-experiment.ts +400 -0
- package/src/autoresearch/tools/log-experiment.ts +793 -0
- package/src/autoresearch/tools/run-experiment.ts +679 -0
- package/src/autoresearch/types.ts +114 -0
- package/src/browser/acquire.ts +249 -0
- package/src/browser/actions.ts +126 -0
- package/src/browser/auth.ts +176 -0
- package/src/browser/ax.ts +134 -0
- package/src/browser/cdp-core.ts +45 -0
- package/src/browser/cdp-page-actions.ts +51 -0
- package/src/browser/chrome-locate.ts +66 -0
- package/src/browser/dom-context.ts +89 -0
- package/src/browser/dt-context.ts +100 -0
- package/src/browser/extension-bridge.ts +182 -0
- package/src/browser/extension-page-actions.ts +397 -0
- package/src/browser/extension-provider.ts +373 -0
- package/src/browser/index.ts +17 -0
- package/src/browser/input-commit.ts +74 -0
- package/src/browser/native-messaging.ts +20 -0
- package/src/browser/page-actions.ts +18 -0
- package/src/browser/provider.ts +155 -0
- package/src/browser/resolver.ts +126 -0
- package/src/browser/selector.ts +40 -0
- package/src/bun-imports.d.ts +22 -0
- package/src/capability/context-file.ts +43 -0
- package/src/capability/extension-module.ts +34 -0
- package/src/capability/extension.ts +47 -0
- package/src/capability/fs.ts +107 -0
- package/src/capability/hook.ts +40 -0
- package/src/capability/index.ts +438 -0
- package/src/capability/instruction.ts +37 -0
- package/src/capability/mcp.ts +74 -0
- package/src/capability/prompt.ts +35 -0
- package/src/capability/rule.ts +224 -0
- package/src/capability/settings.ts +34 -0
- package/src/capability/skill.ts +50 -0
- package/src/capability/slash-command.ts +40 -0
- package/src/capability/ssh.ts +41 -0
- package/src/capability/system-prompt.ts +34 -0
- package/src/capability/tool.ts +38 -0
- package/src/capability/types.ts +168 -0
- package/src/cli/agents-cli.ts +138 -0
- package/src/cli/args.ts +286 -0
- package/src/cli/chrome-cli.ts +88 -0
- package/src/cli/classify-install-target.ts +50 -0
- package/src/cli/commands/init-xdg.ts +27 -0
- package/src/cli/config-cli.ts +418 -0
- package/src/cli/file-processor.ts +121 -0
- package/src/cli/grep-cli.ts +160 -0
- package/src/cli/grievances-cli.ts +78 -0
- package/src/cli/initial-message.ts +58 -0
- package/src/cli/jupyter-cli.ts +106 -0
- package/src/cli/list-models.ts +128 -0
- package/src/cli/plugin-cli.ts +964 -0
- package/src/cli/read-cli.ts +68 -0
- package/src/cli/session-picker.ts +52 -0
- package/src/cli/setup-cli.ts +479 -0
- package/src/cli/shell-cli.ts +174 -0
- package/src/cli/ssh-cli.ts +179 -0
- package/src/cli/stats-cli.ts +182 -0
- package/src/cli/update-cli.ts +446 -0
- package/src/cli/web-search-cli.ts +203 -0
- package/src/cli.ts +123 -0
- package/src/commands/agents.ts +57 -0
- package/src/commands/chrome-host.ts +71 -0
- package/src/commands/chrome.ts +28 -0
- package/src/commands/commit.ts +36 -0
- package/src/commands/config.ts +51 -0
- package/src/commands/grep.ts +48 -0
- package/src/commands/grievances.ts +20 -0
- package/src/commands/jupyter.ts +32 -0
- package/src/commands/launch.ts +144 -0
- package/src/commands/plugin.ts +78 -0
- package/src/commands/read.ts +33 -0
- package/src/commands/setup.ts +42 -0
- package/src/commands/shell.ts +29 -0
- package/src/commands/ssh.ts +60 -0
- package/src/commands/stats.ts +29 -0
- package/src/commands/update.ts +21 -0
- package/src/commands/web-search.ts +46 -0
- package/src/commit/agentic/agent.ts +314 -0
- package/src/commit/agentic/fallback.ts +96 -0
- package/src/commit/agentic/index.ts +354 -0
- package/src/commit/agentic/prompts/analyze-file.md +22 -0
- package/src/commit/agentic/prompts/session-user.md +25 -0
- package/src/commit/agentic/prompts/split-confirm.md +1 -0
- package/src/commit/agentic/prompts/system.md +38 -0
- package/src/commit/agentic/state.ts +60 -0
- package/src/commit/agentic/tools/analyze-file.ts +127 -0
- package/src/commit/agentic/tools/git-file-diff.ts +191 -0
- package/src/commit/agentic/tools/git-hunk.ts +50 -0
- package/src/commit/agentic/tools/git-overview.ts +81 -0
- package/src/commit/agentic/tools/index.ts +54 -0
- package/src/commit/agentic/tools/propose-changelog.ts +139 -0
- package/src/commit/agentic/tools/propose-commit.ts +122 -0
- package/src/commit/agentic/tools/recent-commits.ts +81 -0
- package/src/commit/agentic/tools/schemas.ts +31 -0
- package/src/commit/agentic/tools/split-commit.ts +251 -0
- package/src/commit/agentic/topo-sort.ts +44 -0
- package/src/commit/agentic/trivial.ts +51 -0
- package/src/commit/agentic/validation.ts +183 -0
- package/src/commit/analysis/conventional.ts +122 -0
- package/src/commit/analysis/index.ts +4 -0
- package/src/commit/analysis/scope.ts +242 -0
- package/src/commit/analysis/summary.ts +105 -0
- package/src/commit/analysis/validation.ts +66 -0
- package/src/commit/changelog/detect.ts +40 -0
- package/src/commit/changelog/generate.ts +101 -0
- package/src/commit/changelog/index.ts +234 -0
- package/src/commit/changelog/parse.ts +44 -0
- package/src/commit/cli.ts +85 -0
- package/src/commit/git/diff.ts +148 -0
- package/src/commit/index.ts +5 -0
- package/src/commit/map-reduce/index.ts +69 -0
- package/src/commit/map-reduce/map-phase.ts +193 -0
- package/src/commit/map-reduce/reduce-phase.ts +108 -0
- package/src/commit/map-reduce/utils.ts +9 -0
- package/src/commit/message.ts +11 -0
- package/src/commit/model-selection.ts +66 -0
- package/src/commit/pipeline.ts +242 -0
- package/src/commit/prompts/analysis-system.md +148 -0
- package/src/commit/prompts/analysis-user.md +38 -0
- package/src/commit/prompts/changelog-system.md +50 -0
- package/src/commit/prompts/changelog-user.md +18 -0
- package/src/commit/prompts/file-observer-system.md +24 -0
- package/src/commit/prompts/file-observer-user.md +8 -0
- package/src/commit/prompts/reduce-system.md +50 -0
- package/src/commit/prompts/reduce-user.md +17 -0
- package/src/commit/prompts/summary-retry.md +3 -0
- package/src/commit/prompts/summary-system.md +38 -0
- package/src/commit/prompts/summary-user.md +13 -0
- package/src/commit/prompts/types-description.md +2 -0
- package/src/commit/types.ts +118 -0
- package/src/commit/utils/exclusions.ts +42 -0
- package/src/commit/utils.ts +44 -0
- package/src/config/auto-config.ts +698 -0
- package/src/config/context-schema.json +115 -0
- package/src/config/file-lock.ts +121 -0
- package/src/config/keybindings.ts +493 -0
- package/src/config/mcp-schema.json +230 -0
- package/src/config/model-equivalence.ts +675 -0
- package/src/config/model-registry.ts +2265 -0
- package/src/config/model-resolver.ts +1289 -0
- package/src/config/prompt-templates.ts +271 -0
- package/src/config/resolve-config-value.ts +110 -0
- package/src/config/settings-schema.ts +2155 -0
- package/src/config/settings.ts +730 -0
- package/src/config.ts +418 -0
- package/src/cursor.ts +323 -0
- package/src/dap/client.ts +674 -0
- package/src/dap/config.ts +150 -0
- package/src/dap/defaults.json +211 -0
- package/src/dap/index.ts +4 -0
- package/src/dap/session.ts +1255 -0
- package/src/dap/types.ts +600 -0
- package/src/debug/index.ts +440 -0
- package/src/debug/log-formatting.ts +58 -0
- package/src/debug/log-viewer.ts +908 -0
- package/src/debug/profiler.ts +158 -0
- package/src/debug/report-bundle.ts +365 -0
- package/src/debug/system-info.ts +107 -0
- package/src/discovery/agents-md.ts +67 -0
- package/src/discovery/agents.ts +219 -0
- package/src/discovery/builtin.ts +851 -0
- package/src/discovery/claude-plugins.ts +297 -0
- package/src/discovery/claude.ts +543 -0
- package/src/discovery/cline.ts +83 -0
- package/src/discovery/codex.ts +535 -0
- package/src/discovery/cursor.ts +220 -0
- package/src/discovery/gemini.ts +396 -0
- package/src/discovery/github.ts +118 -0
- package/src/discovery/helpers.ts +934 -0
- package/src/discovery/index.ts +79 -0
- package/src/discovery/language.ts +46 -0
- package/src/discovery/mcp-json.ts +171 -0
- package/src/discovery/opencode.ts +393 -0
- package/src/discovery/plugin-dir-roots.ts +28 -0
- package/src/discovery/ssh.ts +153 -0
- package/src/discovery/substitute-plugin-root.ts +29 -0
- package/src/discovery/vscode.ts +105 -0
- package/src/discovery/windsurf.ts +147 -0
- package/src/edit/diff.ts +818 -0
- package/src/edit/index.ts +481 -0
- package/src/edit/line-hash.ts +67 -0
- package/src/edit/modes/chunk.ts +762 -0
- package/src/edit/modes/hashline.ts +1366 -0
- package/src/edit/modes/patch.ts +1791 -0
- package/src/edit/modes/replace.ts +1115 -0
- package/src/edit/normalize.ts +375 -0
- package/src/edit/renderer.ts +627 -0
- package/src/exa/factory.ts +61 -0
- package/src/exa/index.ts +27 -0
- package/src/exa/mcp-client.ts +293 -0
- package/src/exa/render.ts +232 -0
- package/src/exa/researcher.ts +47 -0
- package/src/exa/search.ts +86 -0
- package/src/exa/types.ts +166 -0
- package/src/exa/websets.ts +247 -0
- package/src/exec/bash-executor.ts +332 -0
- package/src/exec/exec.ts +53 -0
- package/src/exec/idle-timeout-watchdog.ts +126 -0
- package/src/exec/non-interactive-env.ts +48 -0
- package/src/export/custom-share.ts +65 -0
- package/src/export/html/index.ts +161 -0
- package/src/export/html/template.css +1001 -0
- package/src/export/html/template.generated.ts +2 -0
- package/src/export/html/template.html +46 -0
- package/src/export/html/template.js +1950 -0
- package/src/export/html/template.macro.ts +24 -0
- package/src/export/html/vendor/highlight.min.js +1213 -0
- package/src/export/html/vendor/marked.min.js +6 -0
- package/src/export/ttsr.ts +434 -0
- package/src/extensibility/custom-commands/bundled/ci-green/index.ts +25 -0
- package/src/extensibility/custom-commands/bundled/review/index.ts +456 -0
- package/src/extensibility/custom-commands/index.ts +2 -0
- package/src/extensibility/custom-commands/loader.ts +236 -0
- package/src/extensibility/custom-commands/types.ts +111 -0
- package/src/extensibility/custom-tools/index.ts +7 -0
- package/src/extensibility/custom-tools/loader.ts +238 -0
- package/src/extensibility/custom-tools/types.ts +251 -0
- package/src/extensibility/custom-tools/wrapper.ts +47 -0
- package/src/extensibility/extensions/index.ts +15 -0
- package/src/extensibility/extensions/loader.ts +572 -0
- package/src/extensibility/extensions/runner.ts +848 -0
- package/src/extensibility/extensions/types.ts +1394 -0
- package/src/extensibility/extensions/wrapper.ts +191 -0
- package/src/extensibility/hooks/index.ts +5 -0
- package/src/extensibility/hooks/loader.ts +255 -0
- package/src/extensibility/hooks/runner.ts +425 -0
- package/src/extensibility/hooks/tool-wrapper.ts +108 -0
- package/src/extensibility/hooks/types.ts +826 -0
- package/src/extensibility/plugins/doctor.ts +66 -0
- package/src/extensibility/plugins/git-url.ts +281 -0
- package/src/extensibility/plugins/index.ts +9 -0
- package/src/extensibility/plugins/installer.ts +192 -0
- package/src/extensibility/plugins/loader.ts +267 -0
- package/src/extensibility/plugins/manager.ts +731 -0
- package/src/extensibility/plugins/marketplace/cache.ts +136 -0
- package/src/extensibility/plugins/marketplace/fetcher.ts +318 -0
- package/src/extensibility/plugins/marketplace/index.ts +6 -0
- package/src/extensibility/plugins/marketplace/manager.ts +781 -0
- package/src/extensibility/plugins/marketplace/prerequisites.ts +255 -0
- package/src/extensibility/plugins/marketplace/registry.ts +196 -0
- package/src/extensibility/plugins/marketplace/source-resolver.ts +147 -0
- package/src/extensibility/plugins/marketplace/types.ts +201 -0
- package/src/extensibility/plugins/parser.ts +105 -0
- package/src/extensibility/plugins/types.ts +194 -0
- package/src/extensibility/skills.ts +269 -0
- package/src/extensibility/slash-commands.ts +246 -0
- package/src/extensibility/tool-proxy.ts +25 -0
- package/src/extensibility/utils.ts +38 -0
- package/src/index.ts +61 -0
- package/src/internal-urls/agent-protocol.ts +136 -0
- package/src/internal-urls/api-catalog-resolve.ts +495 -0
- package/src/internal-urls/api-catalog-types.ts +94 -0
- package/src/internal-urls/api-spec-resolve.ts +1036 -0
- package/src/internal-urls/api-spec-types.ts +239 -0
- package/src/internal-urls/artifact-protocol.ts +97 -0
- package/src/internal-urls/branding-index.generated.ts +88 -0
- package/src/internal-urls/build-info-runtime.ts +302 -0
- package/src/internal-urls/build-info.generated.ts +33 -0
- package/src/internal-urls/computer-profile.ts +692 -0
- package/src/internal-urls/console-catalog-types.ts +21 -0
- package/src/internal-urls/console-catalog.generated.ts +532 -0
- package/src/internal-urls/console-field-metadata-types.ts +59 -0
- package/src/internal-urls/console-field-metadata.generated.ts +4841 -0
- package/src/internal-urls/console-resolve.ts +178 -0
- package/src/internal-urls/docs-index.generated.ts +698 -0
- package/src/internal-urls/extension-api.md +147 -0
- package/src/internal-urls/index.ts +46 -0
- package/src/internal-urls/jobs-protocol.ts +119 -0
- package/src/internal-urls/json-query.ts +126 -0
- package/src/internal-urls/local-protocol.ts +206 -0
- package/src/internal-urls/mcp-protocol.ts +156 -0
- package/src/internal-urls/memory-protocol.ts +133 -0
- package/src/internal-urls/parse.ts +72 -0
- package/src/internal-urls/profile-collectors.ts +106 -0
- package/src/internal-urls/router.ts +55 -0
- package/src/internal-urls/rule-protocol.ts +55 -0
- package/src/internal-urls/skill-protocol.ts +111 -0
- package/src/internal-urls/terraform-index.generated.ts +1852 -0
- package/src/internal-urls/terraform-resolve.ts +184 -0
- package/src/internal-urls/terraform-types.ts +45 -0
- package/src/internal-urls/types.ts +52 -0
- package/src/internal-urls/user-profile.ts +363 -0
- package/src/internal-urls/xcsh-protocol.ts +644 -0
- package/src/ipy/cancellation.ts +28 -0
- package/src/ipy/executor.ts +1155 -0
- package/src/ipy/gateway-coordinator.ts +424 -0
- package/src/ipy/kernel.ts +1091 -0
- package/src/ipy/modules.ts +144 -0
- package/src/ipy/prelude.py +849 -0
- package/src/ipy/prelude.ts +3 -0
- package/src/ipy/runtime.ts +221 -0
- package/src/locales/ar.json +512 -0
- package/src/locales/de.json +512 -0
- package/src/locales/en.json +549 -0
- package/src/locales/es.json +512 -0
- package/src/locales/fr.json +512 -0
- package/src/locales/hi.json +512 -0
- package/src/locales/index.ts +29 -0
- package/src/locales/it.json +512 -0
- package/src/locales/ja.json +512 -0
- package/src/locales/ko.json +512 -0
- package/src/locales/pt-br.json +512 -0
- package/src/locales/th.json +512 -0
- package/src/locales/zh-cn.json +512 -0
- package/src/locales/zh-tw.json +512 -0
- package/src/lsp/client.ts +941 -0
- package/src/lsp/clients/biome-client.ts +202 -0
- package/src/lsp/clients/index.ts +50 -0
- package/src/lsp/clients/lsp-linter-client.ts +93 -0
- package/src/lsp/clients/swiftlint-client.ts +120 -0
- package/src/lsp/config.ts +418 -0
- package/src/lsp/defaults.json +999 -0
- package/src/lsp/edits.ts +109 -0
- package/src/lsp/index.ts +1746 -0
- package/src/lsp/lspmux.ts +233 -0
- package/src/lsp/render.ts +692 -0
- package/src/lsp/startup-events.ts +13 -0
- package/src/lsp/types.ts +444 -0
- package/src/lsp/utils.ts +691 -0
- package/src/main.ts +944 -0
- package/src/mcp/client.ts +482 -0
- package/src/mcp/config-writer.ts +225 -0
- package/src/mcp/config.ts +365 -0
- package/src/mcp/discoverable-tool-metadata.ts +202 -0
- package/src/mcp/index.ts +29 -0
- package/src/mcp/json-rpc.ts +84 -0
- package/src/mcp/loader.ts +124 -0
- package/src/mcp/manager.ts +1152 -0
- package/src/mcp/oauth-discovery.ts +349 -0
- package/src/mcp/oauth-flow.ts +387 -0
- package/src/mcp/render.ts +157 -0
- package/src/mcp/smithery-auth.ts +104 -0
- package/src/mcp/smithery-connect.ts +145 -0
- package/src/mcp/smithery-registry.ts +477 -0
- package/src/mcp/tool-bridge.ts +417 -0
- package/src/mcp/tool-cache.ts +117 -0
- package/src/mcp/transports/http.ts +475 -0
- package/src/mcp/transports/index.ts +6 -0
- package/src/mcp/transports/stdio.ts +325 -0
- package/src/mcp/types.ts +423 -0
- package/src/memories/index.ts +1115 -0
- package/src/memories/storage.ts +577 -0
- package/src/modes/acp/acp-agent.ts +1361 -0
- package/src/modes/acp/acp-event-mapper.ts +538 -0
- package/src/modes/acp/acp-mode.ts +15 -0
- package/src/modes/acp/index.ts +2 -0
- package/src/modes/components/agent-dashboard.ts +1124 -0
- package/src/modes/components/assistant-message.ts +213 -0
- package/src/modes/components/bash-execution.ts +345 -0
- package/src/modes/components/bordered-loader.ts +41 -0
- package/src/modes/components/branch-summary-message.ts +45 -0
- package/src/modes/components/btw-panel.ts +103 -0
- package/src/modes/components/compaction-summary-message.ts +51 -0
- package/src/modes/components/context-add-wizard.ts +534 -0
- package/src/modes/components/countdown-timer.ts +75 -0
- package/src/modes/components/custom-editor.ts +238 -0
- package/src/modes/components/custom-message.ts +91 -0
- package/src/modes/components/diff.ts +210 -0
- package/src/modes/components/dynamic-border.ts +25 -0
- package/src/modes/components/extensions/extension-dashboard.ts +326 -0
- package/src/modes/components/extensions/extension-list.ts +492 -0
- package/src/modes/components/extensions/index.ts +9 -0
- package/src/modes/components/extensions/inspector-panel.ts +317 -0
- package/src/modes/components/extensions/state-manager.ts +587 -0
- package/src/modes/components/extensions/types.ts +191 -0
- package/src/modes/components/footer.ts +262 -0
- package/src/modes/components/gutter-block.ts +315 -0
- package/src/modes/components/history-search.ts +158 -0
- package/src/modes/components/hook-editor.ts +151 -0
- package/src/modes/components/hook-input.ts +81 -0
- package/src/modes/components/hook-message.ts +100 -0
- package/src/modes/components/hook-selector.ts +192 -0
- package/src/modes/components/index.ts +36 -0
- package/src/modes/components/keybinding-hints.ts +65 -0
- package/src/modes/components/login-dialog.ts +164 -0
- package/src/modes/components/mcp-add-wizard.ts +1314 -0
- package/src/modes/components/model-selector.ts +946 -0
- package/src/modes/components/oauth-selector.ts +211 -0
- package/src/modes/components/plugin-selector.ts +95 -0
- package/src/modes/components/plugin-settings.ts +477 -0
- package/src/modes/components/plugins/index.ts +5 -0
- package/src/modes/components/plugins/plugin-dashboard.ts +523 -0
- package/src/modes/components/plugins/plugin-inspector-pane.ts +84 -0
- package/src/modes/components/plugins/plugin-list-pane.ts +109 -0
- package/src/modes/components/plugins/state-manager.ts +229 -0
- package/src/modes/components/plugins/types.ts +51 -0
- package/src/modes/components/plugins/utils.ts +6 -0
- package/src/modes/components/python-execution.ts +244 -0
- package/src/modes/components/queue-mode-selector.ts +56 -0
- package/src/modes/components/read-tool-group.ts +137 -0
- package/src/modes/components/session-observer-overlay.ts +483 -0
- package/src/modes/components/session-selector.ts +343 -0
- package/src/modes/components/settings-defs.ts +568 -0
- package/src/modes/components/settings-selector.ts +641 -0
- package/src/modes/components/show-images-selector.ts +45 -0
- package/src/modes/components/skill-message.ts +90 -0
- package/src/modes/components/status-line/context-gradient.ts +64 -0
- package/src/modes/components/status-line/git-utils.ts +42 -0
- package/src/modes/components/status-line/hex-ansi.ts +29 -0
- package/src/modes/components/status-line/index.ts +4 -0
- package/src/modes/components/status-line/presets.ts +174 -0
- package/src/modes/components/status-line/segments.ts +494 -0
- package/src/modes/components/status-line/separators.ts +55 -0
- package/src/modes/components/status-line/token-rate.ts +66 -0
- package/src/modes/components/status-line/types.ts +96 -0
- package/src/modes/components/status-line-segment-editor.ts +361 -0
- package/src/modes/components/status-line.ts +729 -0
- package/src/modes/components/theme-selector.ts +63 -0
- package/src/modes/components/thinking-selector.ts +52 -0
- package/src/modes/components/todo-reminder.ts +54 -0
- package/src/modes/components/tool-execution.ts +781 -0
- package/src/modes/components/tree-selector.ts +908 -0
- package/src/modes/components/ttsr-notification.ts +80 -0
- package/src/modes/components/user-message-selector.ts +141 -0
- package/src/modes/components/user-message.ts +100 -0
- package/src/modes/components/visual-truncate.ts +63 -0
- package/src/modes/components/welcome-checks.ts +313 -0
- package/src/modes/components/welcome.ts +270 -0
- package/src/modes/controllers/btw-controller.ts +193 -0
- package/src/modes/controllers/chord-routing.ts +37 -0
- package/src/modes/controllers/command-controller.ts +1293 -0
- package/src/modes/controllers/context-command-controller.ts +61 -0
- package/src/modes/controllers/event-controller.ts +743 -0
- package/src/modes/controllers/extension-ui-controller.ts +983 -0
- package/src/modes/controllers/input-controller.ts +877 -0
- package/src/modes/controllers/mcp-command-controller.ts +1940 -0
- package/src/modes/controllers/selector-controller.ts +1292 -0
- package/src/modes/controllers/ssh-command-controller.ts +421 -0
- package/src/modes/index.ts +34 -0
- package/src/modes/interactive-mode.ts +1781 -0
- package/src/modes/oauth-manual-input.ts +42 -0
- package/src/modes/print-mode.ts +196 -0
- package/src/modes/prompt-action-autocomplete.ts +231 -0
- package/src/modes/rpc/host-tools.ts +186 -0
- package/src/modes/rpc/rpc-client.ts +762 -0
- package/src/modes/rpc/rpc-mode.ts +877 -0
- package/src/modes/rpc/rpc-types.ts +322 -0
- package/src/modes/session-observer-registry.ts +146 -0
- package/src/modes/shared.ts +30 -0
- package/src/modes/theme/defaults/index.ts +7 -0
- package/src/modes/theme/defaults/xcsh-dark.json +113 -0
- package/src/modes/theme/defaults/xcsh-light.json +115 -0
- package/src/modes/theme/mermaid-cache.ts +151 -0
- package/src/modes/theme/mermaid-palette.ts +39 -0
- package/src/modes/theme/theme-schema.json +553 -0
- package/src/modes/theme/theme.ts +2563 -0
- package/src/modes/types.ts +273 -0
- package/src/modes/utils/hotkeys-markdown.ts +60 -0
- package/src/modes/utils/keybinding-matchers.ts +30 -0
- package/src/modes/utils/read-group-outcome-aggregator.ts +55 -0
- package/src/modes/utils/sanitize-error-message.ts +60 -0
- package/src/modes/utils/tools-markdown.ts +28 -0
- package/src/modes/utils/ui-helpers.ts +734 -0
- package/src/plan-mode/approved-plan.ts +55 -0
- package/src/plan-mode/state.ts +6 -0
- package/src/priority.json +37 -0
- package/src/prompts/agents/designer.md +67 -0
- package/src/prompts/agents/explore.md +61 -0
- package/src/prompts/agents/frontmatter.md +10 -0
- package/src/prompts/agents/init.md +36 -0
- package/src/prompts/agents/librarian.md +121 -0
- package/src/prompts/agents/plan.md +49 -0
- package/src/prompts/agents/reviewer.md +127 -0
- package/src/prompts/agents/task.md +16 -0
- package/src/prompts/ci-green-request.md +35 -0
- package/src/prompts/compaction/branch-summary-context.md +5 -0
- package/src/prompts/compaction/branch-summary-preamble.md +2 -0
- package/src/prompts/compaction/branch-summary.md +30 -0
- package/src/prompts/compaction/compaction-short-summary.md +9 -0
- package/src/prompts/compaction/compaction-summary-context.md +5 -0
- package/src/prompts/compaction/compaction-summary.md +38 -0
- package/src/prompts/compaction/compaction-turn-prefix.md +17 -0
- package/src/prompts/compaction/compaction-update-summary.md +45 -0
- package/src/prompts/memories/consolidation.md +30 -0
- package/src/prompts/memories/read-path.md +11 -0
- package/src/prompts/memories/stage_one_input.md +6 -0
- package/src/prompts/memories/stage_one_system.md +21 -0
- package/src/prompts/review-request.md +70 -0
- package/src/prompts/system/agent-creation-architect.md +65 -0
- package/src/prompts/system/agent-creation-user.md +6 -0
- package/src/prompts/system/auto-handoff-threshold-focus.md +1 -0
- package/src/prompts/system/btw-user.md +8 -0
- package/src/prompts/system/commit-message-system.md +2 -0
- package/src/prompts/system/custom-system-prompt.md +82 -0
- package/src/prompts/system/eager-todo.md +13 -0
- package/src/prompts/system/file-operations.md +10 -0
- package/src/prompts/system/handoff-document.md +48 -0
- package/src/prompts/system/plan-mode-active.md +114 -0
- package/src/prompts/system/plan-mode-approved.md +23 -0
- package/src/prompts/system/plan-mode-reference.md +14 -0
- package/src/prompts/system/plan-mode-subagent.md +34 -0
- package/src/prompts/system/plan-mode-tool-decision-reminder.md +9 -0
- package/src/prompts/system/subagent-submit-reminder.md +7 -0
- package/src/prompts/system/subagent-system-prompt.md +36 -0
- package/src/prompts/system/subagent-user-prompt.md +12 -0
- package/src/prompts/system/summarization-system.md +3 -0
- package/src/prompts/system/system-prompt.md +698 -0
- package/src/prompts/system/title-system.md +2 -0
- package/src/prompts/system/ttsr-interrupt.md +7 -0
- package/src/prompts/system/web-search.md +28 -0
- package/src/prompts/tools/ask.md +28 -0
- package/src/prompts/tools/ast-edit.md +48 -0
- package/src/prompts/tools/ast-grep.md +54 -0
- package/src/prompts/tools/async-result.md +5 -0
- package/src/prompts/tools/bash.md +67 -0
- package/src/prompts/tools/browser.md +26 -0
- package/src/prompts/tools/calculator.md +10 -0
- package/src/prompts/tools/cancel-job.md +5 -0
- package/src/prompts/tools/catalog-workflow-runner.md +13 -0
- package/src/prompts/tools/checkpoint.md +16 -0
- package/src/prompts/tools/chunk-edit.md +279 -0
- package/src/prompts/tools/debug.md +43 -0
- package/src/prompts/tools/display-image.md +23 -0
- package/src/prompts/tools/exit-plan-mode.md +41 -0
- package/src/prompts/tools/find.md +26 -0
- package/src/prompts/tools/gemini-image.md +7 -0
- package/src/prompts/tools/grep.md +29 -0
- package/src/prompts/tools/hashline.md +131 -0
- package/src/prompts/tools/inspect-image-system.md +20 -0
- package/src/prompts/tools/inspect-image.md +32 -0
- package/src/prompts/tools/lsp.md +33 -0
- package/src/prompts/tools/patch.md +77 -0
- package/src/prompts/tools/poll.md +5 -0
- package/src/prompts/tools/python.md +60 -0
- package/src/prompts/tools/read-chunk.md +35 -0
- package/src/prompts/tools/read.md +63 -0
- package/src/prompts/tools/render-mermaid.md +9 -0
- package/src/prompts/tools/replace.md +36 -0
- package/src/prompts/tools/resolve.md +8 -0
- package/src/prompts/tools/rewind.md +13 -0
- package/src/prompts/tools/search-tool-bm25.md +34 -0
- package/src/prompts/tools/ssh.md +44 -0
- package/src/prompts/tools/task-summary.md +28 -0
- package/src/prompts/tools/task.md +131 -0
- package/src/prompts/tools/todo-write.md +89 -0
- package/src/prompts/tools/vim.md +98 -0
- package/src/prompts/tools/web-search.md +10 -0
- package/src/prompts/tools/write.md +14 -0
- package/src/prompts/tools/xcsh-api.md +283 -0
- package/src/resource-management/index.ts +42 -0
- package/src/sdk.ts +2123 -0
- package/src/secrets/index.ts +146 -0
- package/src/secrets/obfuscator.ts +290 -0
- package/src/secrets/regex.ts +21 -0
- package/src/services/context-env.ts +102 -0
- package/src/services/xcsh-api-client.ts +230 -0
- package/src/services/xcsh-context-command.ts +803 -0
- package/src/services/xcsh-context-display.ts +49 -0
- package/src/services/xcsh-context-indicators.ts +17 -0
- package/src/services/xcsh-context-segment.ts +39 -0
- package/src/services/xcsh-context.ts +1410 -0
- package/src/services/xcsh-env.ts +107 -0
- package/src/services/xcsh-knowledge.ts +177 -0
- package/src/services/xcsh-table.ts +164 -0
- package/src/session/agent-session.ts +6690 -0
- package/src/session/agent-storage.ts +451 -0
- package/src/session/artifacts.ts +132 -0
- package/src/session/auth-storage.ts +17 -0
- package/src/session/blob-store.ts +135 -0
- package/src/session/compaction/branch-summarization.ts +322 -0
- package/src/session/compaction/compaction.ts +1388 -0
- package/src/session/compaction/index.ts +7 -0
- package/src/session/compaction/pruning.ts +91 -0
- package/src/session/compaction/utils.ts +184 -0
- package/src/session/history-storage.ts +253 -0
- package/src/session/messages.ts +597 -0
- package/src/session/session-dump-format.ts +203 -0
- package/src/session/session-manager.ts +2816 -0
- package/src/session/session-storage.ts +370 -0
- package/src/session/streaming-output.ts +770 -0
- package/src/session/tool-choice-queue.ts +213 -0
- package/src/slash-commands/builtin-registry.ts +1614 -0
- package/src/slash-commands/export-command.ts +178 -0
- package/src/slash-commands/marketplace-install-parser.ts +99 -0
- package/src/slash-commands/resource-commands.ts +250 -0
- package/src/ssh/config-writer.ts +183 -0
- package/src/ssh/connection-manager.ts +445 -0
- package/src/ssh/ssh-executor.ts +131 -0
- package/src/ssh/sshfs-mount.ts +137 -0
- package/src/ssh/utils.ts +8 -0
- package/src/stt/downloader.ts +71 -0
- package/src/stt/index.ts +3 -0
- package/src/stt/recorder.ts +351 -0
- package/src/stt/setup.ts +52 -0
- package/src/stt/stt-controller.ts +160 -0
- package/src/stt/transcribe.py +70 -0
- package/src/stt/transcriber.ts +91 -0
- package/src/system-prompt.ts +688 -0
- package/src/task/agents.ts +166 -0
- package/src/task/commands.ts +131 -0
- package/src/task/discovery.ts +126 -0
- package/src/task/executor.ts +1324 -0
- package/src/task/index.ts +1197 -0
- package/src/task/isolation-backend.ts +72 -0
- package/src/task/name-generator.ts +1577 -0
- package/src/task/output-manager.ts +107 -0
- package/src/task/parallel.ts +116 -0
- package/src/task/render.ts +1035 -0
- package/src/task/subprocess-tool-registry.ts +88 -0
- package/src/task/template.ts +33 -0
- package/src/task/types.ts +230 -0
- package/src/task/worktree.ts +580 -0
- package/src/task/xcsh-command.ts +26 -0
- package/src/thinking.ts +87 -0
- package/src/tools/action-renderer.ts +198 -0
- package/src/tools/archive-reader.ts +315 -0
- package/src/tools/ask.ts +791 -0
- package/src/tools/ast-edit.ts +492 -0
- package/src/tools/ast-grep.ts +453 -0
- package/src/tools/auto-generated-guard.ts +305 -0
- package/src/tools/bash-interactive.ts +383 -0
- package/src/tools/bash-interceptor.ts +67 -0
- package/src/tools/bash-normalize.ts +107 -0
- package/src/tools/bash-skill-urls.ts +246 -0
- package/src/tools/bash.ts +878 -0
- package/src/tools/browser-renderer.ts +129 -0
- package/src/tools/browser.ts +1366 -0
- package/src/tools/calculator.ts +543 -0
- package/src/tools/cancel-job.ts +100 -0
- package/src/tools/catalog-workflow-runner.ts +718 -0
- package/src/tools/checkpoint.ts +133 -0
- package/src/tools/context.ts +39 -0
- package/src/tools/debug.ts +1004 -0
- package/src/tools/display-image-renderer.ts +96 -0
- package/src/tools/display-image.ts +109 -0
- package/src/tools/exit-plan-mode.ts +101 -0
- package/src/tools/fetch.ts +1462 -0
- package/src/tools/find.ts +437 -0
- package/src/tools/fs-cache-invalidation.ts +33 -0
- package/src/tools/gemini-image.ts +1004 -0
- package/src/tools/grep.ts +705 -0
- package/src/tools/index.ts +442 -0
- package/src/tools/inspect-image-renderer.ts +101 -0
- package/src/tools/inspect-image.ts +176 -0
- package/src/tools/json-tree.ts +266 -0
- package/src/tools/jtd-to-json-schema.ts +199 -0
- package/src/tools/jtd-to-typescript.ts +136 -0
- package/src/tools/jtd-utils.ts +102 -0
- package/src/tools/list-limit.ts +40 -0
- package/src/tools/mermaid-renderer.ts +127 -0
- package/src/tools/notebook.ts +288 -0
- package/src/tools/output-meta.ts +588 -0
- package/src/tools/path-utils.ts +560 -0
- package/src/tools/plan-mode-guard.ts +41 -0
- package/src/tools/poll-tool.ts +177 -0
- package/src/tools/puppeteer/00_stealth_tampering.txt +63 -0
- package/src/tools/puppeteer/01_stealth_activity.txt +20 -0
- package/src/tools/puppeteer/02_stealth_hairline.txt +11 -0
- package/src/tools/puppeteer/03_stealth_botd.txt +384 -0
- package/src/tools/puppeteer/04_stealth_iframe.txt +81 -0
- package/src/tools/puppeteer/05_stealth_webgl.txt +75 -0
- package/src/tools/puppeteer/06_stealth_screen.txt +72 -0
- package/src/tools/puppeteer/07_stealth_fonts.txt +97 -0
- package/src/tools/puppeteer/08_stealth_audio.txt +51 -0
- package/src/tools/puppeteer/09_stealth_locale.txt +46 -0
- package/src/tools/puppeteer/10_stealth_plugins.txt +206 -0
- package/src/tools/puppeteer/11_stealth_hardware.txt +8 -0
- package/src/tools/puppeteer/12_stealth_codecs.txt +40 -0
- package/src/tools/puppeteer/13_stealth_worker.txt +74 -0
- package/src/tools/python.ts +1184 -0
- package/src/tools/read.ts +1591 -0
- package/src/tools/render-mermaid.ts +93 -0
- package/src/tools/render-utils.ts +677 -0
- package/src/tools/renderers.ts +82 -0
- package/src/tools/report-tool-issue.ts +80 -0
- package/src/tools/resolve.ts +196 -0
- package/src/tools/review.ts +238 -0
- package/src/tools/search-tool-bm25.ts +288 -0
- package/src/tools/sqlite-reader.ts +623 -0
- package/src/tools/ssh.ts +322 -0
- package/src/tools/submit-result.ts +229 -0
- package/src/tools/todo-render.ts +33 -0
- package/src/tools/todo-write.ts +440 -0
- package/src/tools/tool-errors.ts +62 -0
- package/src/tools/tool-result.ts +93 -0
- package/src/tools/tool-timeouts.ts +30 -0
- package/src/tools/vim.ts +981 -0
- package/src/tools/write.ts +671 -0
- package/src/tools/xcsh-api-renderer.ts +402 -0
- package/src/tools/xcsh-api.ts +887 -0
- package/src/tui/code-cell.ts +101 -0
- package/src/tui/file-list.ts +47 -0
- package/src/tui/index.ts +11 -0
- package/src/tui/output-block.ts +175 -0
- package/src/tui/status-line.ts +39 -0
- package/src/tui/tree-list.ts +84 -0
- package/src/tui/types.ts +15 -0
- package/src/tui/utils.ts +103 -0
- package/src/utils/changelog.ts +98 -0
- package/src/utils/clipboard.ts +80 -0
- package/src/utils/command-args.ts +76 -0
- package/src/utils/commit-message-generator.ts +137 -0
- package/src/utils/edit-mode.ts +50 -0
- package/src/utils/event-bus.ts +33 -0
- package/src/utils/external-editor.ts +65 -0
- package/src/utils/file-display-mode.ts +37 -0
- package/src/utils/file-mentions.ts +376 -0
- package/src/utils/fuzzy.ts +108 -0
- package/src/utils/git.ts +1495 -0
- package/src/utils/gitstatus.ts +140 -0
- package/src/utils/image-convert.ts +27 -0
- package/src/utils/image-loading.ts +98 -0
- package/src/utils/image-passthrough.ts +118 -0
- package/src/utils/image-resize.ts +272 -0
- package/src/utils/image-viewer.ts +17 -0
- package/src/utils/lang-from-path.ts +239 -0
- package/src/utils/markit.ts +81 -0
- package/src/utils/open.ts +20 -0
- package/src/utils/session-color.ts +55 -0
- package/src/utils/shell-snapshot.ts +188 -0
- package/src/utils/title-generator.ts +193 -0
- package/src/utils/tool-choice.ts +28 -0
- package/src/utils/tools-manager.ts +356 -0
- package/src/vim/buffer.ts +309 -0
- package/src/vim/commands.ts +382 -0
- package/src/vim/engine.ts +2426 -0
- package/src/vim/parser.ts +151 -0
- package/src/vim/render.ts +252 -0
- package/src/vim/types.ts +197 -0
- package/src/web/kagi.ts +174 -0
- package/src/web/parallel.ts +346 -0
- package/src/web/scrapers/artifacthub.ts +207 -0
- package/src/web/scrapers/arxiv.ts +83 -0
- package/src/web/scrapers/aur.ts +162 -0
- package/src/web/scrapers/biorxiv.ts +133 -0
- package/src/web/scrapers/bluesky.ts +262 -0
- package/src/web/scrapers/brew.ts +172 -0
- package/src/web/scrapers/cheatsh.ts +68 -0
- package/src/web/scrapers/chocolatey.ts +196 -0
- package/src/web/scrapers/choosealicense.ts +95 -0
- package/src/web/scrapers/cisa-kev.ts +87 -0
- package/src/web/scrapers/clojars.ts +154 -0
- package/src/web/scrapers/coingecko.ts +177 -0
- package/src/web/scrapers/crates-io.ts +110 -0
- package/src/web/scrapers/crossref.ts +136 -0
- package/src/web/scrapers/devto.ts +147 -0
- package/src/web/scrapers/discogs.ts +306 -0
- package/src/web/scrapers/discourse.ts +197 -0
- package/src/web/scrapers/dockerhub.ts +138 -0
- package/src/web/scrapers/docs-rs.ts +653 -0
- package/src/web/scrapers/fdroid.ts +134 -0
- package/src/web/scrapers/firefox-addons.ts +191 -0
- package/src/web/scrapers/flathub.ts +223 -0
- package/src/web/scrapers/github-gist.ts +58 -0
- package/src/web/scrapers/github.ts +452 -0
- package/src/web/scrapers/gitlab.ts +401 -0
- package/src/web/scrapers/go-pkg.ts +266 -0
- package/src/web/scrapers/hackage.ts +140 -0
- package/src/web/scrapers/hackernews.ts +189 -0
- package/src/web/scrapers/hex.ts +105 -0
- package/src/web/scrapers/huggingface.ts +321 -0
- package/src/web/scrapers/iacr.ts +89 -0
- package/src/web/scrapers/index.ts +252 -0
- package/src/web/scrapers/jetbrains-marketplace.ts +159 -0
- package/src/web/scrapers/lemmy.ts +203 -0
- package/src/web/scrapers/lobsters.ts +175 -0
- package/src/web/scrapers/mastodon.ts +292 -0
- package/src/web/scrapers/maven.ts +138 -0
- package/src/web/scrapers/mdn.ts +169 -0
- package/src/web/scrapers/metacpan.ts +222 -0
- package/src/web/scrapers/musicbrainz.ts +250 -0
- package/src/web/scrapers/npm.ts +98 -0
- package/src/web/scrapers/nuget.ts +183 -0
- package/src/web/scrapers/nvd.ts +222 -0
- package/src/web/scrapers/ollama.ts +239 -0
- package/src/web/scrapers/open-vsx.ts +106 -0
- package/src/web/scrapers/opencorporates.ts +292 -0
- package/src/web/scrapers/openlibrary.ts +336 -0
- package/src/web/scrapers/orcid.ts +286 -0
- package/src/web/scrapers/osv.ts +176 -0
- package/src/web/scrapers/packagist.ts +160 -0
- package/src/web/scrapers/pub-dev.ts +143 -0
- package/src/web/scrapers/pubmed.ts +211 -0
- package/src/web/scrapers/pypi.ts +112 -0
- package/src/web/scrapers/rawg.ts +110 -0
- package/src/web/scrapers/readthedocs.ts +120 -0
- package/src/web/scrapers/reddit.ts +95 -0
- package/src/web/scrapers/repology.ts +251 -0
- package/src/web/scrapers/rfc.ts +201 -0
- package/src/web/scrapers/rubygems.ts +103 -0
- package/src/web/scrapers/searchcode.ts +190 -0
- package/src/web/scrapers/sec-edgar.ts +261 -0
- package/src/web/scrapers/semantic-scholar.ts +171 -0
- package/src/web/scrapers/snapcraft.ts +187 -0
- package/src/web/scrapers/sourcegraph.ts +336 -0
- package/src/web/scrapers/spdx.ts +108 -0
- package/src/web/scrapers/spotify.ts +198 -0
- package/src/web/scrapers/stackoverflow.ts +120 -0
- package/src/web/scrapers/terraform.ts +277 -0
- package/src/web/scrapers/tldr.ts +47 -0
- package/src/web/scrapers/twitter.ts +93 -0
- package/src/web/scrapers/types.ts +267 -0
- package/src/web/scrapers/utils.ts +109 -0
- package/src/web/scrapers/vimeo.ts +133 -0
- package/src/web/scrapers/vscode-marketplace.ts +187 -0
- package/src/web/scrapers/w3c.ts +156 -0
- package/src/web/scrapers/wikidata.ts +344 -0
- package/src/web/scrapers/wikipedia.ts +84 -0
- package/src/web/scrapers/youtube.ts +313 -0
- package/src/web/search/errors.ts +120 -0
- package/src/web/search/index.ts +346 -0
- package/src/web/search/params.ts +129 -0
- package/src/web/search/provider.ts +97 -0
- package/src/web/search/providers/anthropic.ts +339 -0
- package/src/web/search/providers/base.ts +35 -0
- package/src/web/search/providers/brave.ts +150 -0
- package/src/web/search/providers/codex.ts +402 -0
- package/src/web/search/providers/exa.ts +264 -0
- package/src/web/search/providers/firecrawl.ts +115 -0
- package/src/web/search/providers/gemini.ts +566 -0
- package/src/web/search/providers/jina.ts +99 -0
- package/src/web/search/providers/kagi.ts +70 -0
- package/src/web/search/providers/kimi.ts +157 -0
- package/src/web/search/providers/parallel.ts +63 -0
- package/src/web/search/providers/perplexity.ts +546 -0
- package/src/web/search/providers/synthetic.ts +113 -0
- package/src/web/search/providers/tavily.ts +162 -0
- package/src/web/search/providers/utils.ts +36 -0
- package/src/web/search/providers/zai.ts +311 -0
- package/src/web/search/render.ts +348 -0
- package/src/web/search/types.ts +438 -0
- package/src/web/search/utils.ts +17 -0
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import type { AgentMessage } from "@f5xc-salesdemos/pi-agent-core";
|
|
2
|
+
import type { AssistantMessage, ImageContent, Message, UsageReport } from "@f5xc-salesdemos/pi-ai";
|
|
3
|
+
import type { Component, Container, Loader, Spacer, Text, TUI } from "@f5xc-salesdemos/pi-tui";
|
|
4
|
+
import type { KeybindingsManager } from "../config/keybindings";
|
|
5
|
+
import type { Settings } from "../config/settings";
|
|
6
|
+
import type {
|
|
7
|
+
ExtensionUIContext,
|
|
8
|
+
ExtensionUIDialogOptions,
|
|
9
|
+
ExtensionWidgetContent,
|
|
10
|
+
ExtensionWidgetOptions,
|
|
11
|
+
} from "../extensibility/extensions";
|
|
12
|
+
import type { CompactOptions } from "../extensibility/extensions/types";
|
|
13
|
+
import type { MCPManager } from "../mcp";
|
|
14
|
+
import type { AgentSession, AgentSessionEvent } from "../session/agent-session";
|
|
15
|
+
import type { HistoryStorage } from "../session/history-storage";
|
|
16
|
+
import type { SessionContext, SessionManager } from "../session/session-manager";
|
|
17
|
+
import type { ExitPlanModeDetails, LspStartupServerInfo } from "../tools";
|
|
18
|
+
import type { AssistantMessageComponent } from "./components/assistant-message";
|
|
19
|
+
import type { BashExecutionComponent } from "./components/bash-execution";
|
|
20
|
+
import type { CustomEditor } from "./components/custom-editor";
|
|
21
|
+
import type { GutterBlock } from "./components/gutter-block";
|
|
22
|
+
import type { HookEditorComponent } from "./components/hook-editor";
|
|
23
|
+
import type { HookInputComponent } from "./components/hook-input";
|
|
24
|
+
import type { HookSelectorComponent } from "./components/hook-selector";
|
|
25
|
+
import type { PythonExecutionComponent } from "./components/python-execution";
|
|
26
|
+
import type { StatusLineComponent } from "./components/status-line";
|
|
27
|
+
import type { ToolExecutionHandle } from "./components/tool-execution";
|
|
28
|
+
import type { OAuthManualInputManager } from "./oauth-manual-input";
|
|
29
|
+
import type { Theme } from "./theme/theme";
|
|
30
|
+
|
|
31
|
+
export type CompactionQueuedMessage = {
|
|
32
|
+
text: string;
|
|
33
|
+
mode: "steer" | "followUp";
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export type SubmittedUserInput = {
|
|
37
|
+
text: string;
|
|
38
|
+
images?: ImageContent[];
|
|
39
|
+
cancelled: boolean;
|
|
40
|
+
started: boolean;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export type TodoStatus = "pending" | "in_progress" | "completed" | "abandoned";
|
|
44
|
+
|
|
45
|
+
export type TodoItem = {
|
|
46
|
+
id: string;
|
|
47
|
+
content: string;
|
|
48
|
+
status: TodoStatus;
|
|
49
|
+
details?: string;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export type TodoPhase = {
|
|
53
|
+
id: string;
|
|
54
|
+
name: string;
|
|
55
|
+
tasks: TodoItem[];
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export interface InteractiveModeContext {
|
|
59
|
+
// UI access
|
|
60
|
+
ui: TUI;
|
|
61
|
+
chatContainer: Container;
|
|
62
|
+
pendingMessagesContainer: Container;
|
|
63
|
+
statusContainer: Container;
|
|
64
|
+
todoContainer: Container;
|
|
65
|
+
btwContainer: Container;
|
|
66
|
+
editor: CustomEditor;
|
|
67
|
+
editorContainer: Container;
|
|
68
|
+
hookWidgetContainerAbove: Container;
|
|
69
|
+
hookWidgetContainerBelow: Container;
|
|
70
|
+
statusLine: StatusLineComponent;
|
|
71
|
+
|
|
72
|
+
// Session access
|
|
73
|
+
session: AgentSession;
|
|
74
|
+
sessionManager: SessionManager;
|
|
75
|
+
settings: Settings;
|
|
76
|
+
keybindings: KeybindingsManager;
|
|
77
|
+
agent: AgentSession["agent"];
|
|
78
|
+
historyStorage?: HistoryStorage;
|
|
79
|
+
mcpManager?: MCPManager;
|
|
80
|
+
lspServers?: LspStartupServerInfo[];
|
|
81
|
+
|
|
82
|
+
// State
|
|
83
|
+
isInitialized: boolean;
|
|
84
|
+
isBackgrounded: boolean;
|
|
85
|
+
isBashMode: boolean;
|
|
86
|
+
toolOutputExpanded: boolean;
|
|
87
|
+
todoExpanded: boolean;
|
|
88
|
+
planModeEnabled: boolean;
|
|
89
|
+
planModePlanFilePath?: string;
|
|
90
|
+
hideThinkingBlock: boolean;
|
|
91
|
+
pendingImages: ImageContent[];
|
|
92
|
+
compactionQueuedMessages: CompactionQueuedMessage[];
|
|
93
|
+
pendingTools: Map<string, ToolExecutionHandle>;
|
|
94
|
+
pendingBashComponents: BashExecutionComponent[];
|
|
95
|
+
bashComponent: BashExecutionComponent | undefined;
|
|
96
|
+
pendingPythonComponents: PythonExecutionComponent[];
|
|
97
|
+
pythonComponent: PythonExecutionComponent | undefined;
|
|
98
|
+
isPythonMode: boolean;
|
|
99
|
+
streamingComponent: AssistantMessageComponent | undefined;
|
|
100
|
+
streamingAssistantGutter: GutterBlock<AssistantMessageComponent> | undefined;
|
|
101
|
+
streamingMessage: AssistantMessage | undefined;
|
|
102
|
+
loadingAnimation: Loader | undefined;
|
|
103
|
+
autoCompactionLoader: Loader | undefined;
|
|
104
|
+
retryLoader: Loader | undefined;
|
|
105
|
+
autoCompactionEscapeHandler?: () => void;
|
|
106
|
+
retryEscapeHandler?: () => void;
|
|
107
|
+
unsubscribe?: () => void;
|
|
108
|
+
onInputCallback?: (input: SubmittedUserInput) => void;
|
|
109
|
+
optimisticUserMessageSignature: string | undefined;
|
|
110
|
+
lastSigintTime: number;
|
|
111
|
+
lastEscapeTime: number;
|
|
112
|
+
shutdownRequested: boolean;
|
|
113
|
+
hookSelector: HookSelectorComponent | undefined;
|
|
114
|
+
hookInput: HookInputComponent | undefined;
|
|
115
|
+
hookEditor: HookEditorComponent | undefined;
|
|
116
|
+
lastStatusSpacer: Spacer | undefined;
|
|
117
|
+
lastStatusText: Text | undefined;
|
|
118
|
+
fileSlashCommands: Set<string>;
|
|
119
|
+
skillCommands: Map<string, string>;
|
|
120
|
+
oauthManualInput: OAuthManualInputManager;
|
|
121
|
+
todoPhases: TodoPhase[];
|
|
122
|
+
|
|
123
|
+
// Lifecycle
|
|
124
|
+
init(): Promise<void>;
|
|
125
|
+
shutdown(): Promise<void>;
|
|
126
|
+
checkShutdownRequested(): Promise<void>;
|
|
127
|
+
|
|
128
|
+
// Extension UI integration
|
|
129
|
+
setToolUIContext(uiContext: ExtensionUIContext, hasUI: boolean): void;
|
|
130
|
+
initializeHookRunner(uiContext: ExtensionUIContext, hasUI: boolean): void;
|
|
131
|
+
createBackgroundUiContext(): ExtensionUIContext;
|
|
132
|
+
|
|
133
|
+
// Event handling
|
|
134
|
+
handleBackgroundEvent(event: AgentSessionEvent): Promise<void>;
|
|
135
|
+
|
|
136
|
+
// UI helpers
|
|
137
|
+
showStatus(message: string, options?: { dim?: boolean }): void;
|
|
138
|
+
showError(message: string): void;
|
|
139
|
+
showWarning(message: string): void;
|
|
140
|
+
clearEditor(): void;
|
|
141
|
+
updatePendingMessagesDisplay(): void;
|
|
142
|
+
queueCompactionMessage(text: string, mode: "steer" | "followUp"): void;
|
|
143
|
+
flushCompactionQueue(options?: { willRetry?: boolean }): Promise<void>;
|
|
144
|
+
flushPendingBashComponents(): void;
|
|
145
|
+
flushPendingModelSwitch(): Promise<void>;
|
|
146
|
+
setWorkingMessage(message?: string): void;
|
|
147
|
+
applyPendingWorkingMessage(): void;
|
|
148
|
+
ensureLoadingAnimation(): void;
|
|
149
|
+
startPendingSubmission(input: { text: string; images?: ImageContent[] }): SubmittedUserInput;
|
|
150
|
+
cancelPendingSubmission(): boolean;
|
|
151
|
+
markPendingSubmissionStarted(input: SubmittedUserInput): boolean;
|
|
152
|
+
finishPendingSubmission(input: SubmittedUserInput): void;
|
|
153
|
+
isKnownSlashCommand(text: string): boolean;
|
|
154
|
+
addMessageToChat(message: AgentMessage, options?: { populateHistory?: boolean }): void;
|
|
155
|
+
renderSessionContext(
|
|
156
|
+
sessionContext: SessionContext,
|
|
157
|
+
options?: { updateFooter?: boolean; populateHistory?: boolean },
|
|
158
|
+
): void;
|
|
159
|
+
renderInitialMessages(): void;
|
|
160
|
+
getUserMessageText(message: Message): string;
|
|
161
|
+
findLastAssistantMessage(): AssistantMessage | undefined;
|
|
162
|
+
extractAssistantText(message: AssistantMessage): string;
|
|
163
|
+
updateEditorTopBorder(): void;
|
|
164
|
+
updateEditorBorderColor(): void;
|
|
165
|
+
rebuildChatFromMessages(): void;
|
|
166
|
+
setTodos(todos: TodoItem[] | TodoPhase[]): void;
|
|
167
|
+
reloadTodos(): Promise<void>;
|
|
168
|
+
toggleTodoExpansion(): void;
|
|
169
|
+
|
|
170
|
+
// Command handling
|
|
171
|
+
handleExportCommand(text: string): Promise<void>;
|
|
172
|
+
handleShareCommand(): Promise<void>;
|
|
173
|
+
handleCopyCommand(sub?: string): void;
|
|
174
|
+
handleSessionCommand(): Promise<void>;
|
|
175
|
+
handleJobsCommand(): Promise<void>;
|
|
176
|
+
handleUsageCommand(reports?: UsageReport[] | null): Promise<void>;
|
|
177
|
+
handleChangelogCommand(showFull?: boolean): Promise<void>;
|
|
178
|
+
handleHotkeysCommand(): void;
|
|
179
|
+
handleToolsCommand(): void;
|
|
180
|
+
handleDumpCommand(): void;
|
|
181
|
+
handleDebugTranscriptCommand(): Promise<void>;
|
|
182
|
+
handleClearCommand(): Promise<void>;
|
|
183
|
+
handleForkCommand(): Promise<void>;
|
|
184
|
+
handleBashCommand(command: string, excludeFromContext?: boolean): Promise<void>;
|
|
185
|
+
handlePythonCommand(code: string, excludeFromContext?: boolean): Promise<void>;
|
|
186
|
+
handleMCPCommand(text: string): Promise<void>;
|
|
187
|
+
handleSSHCommand(text: string): Promise<void>;
|
|
188
|
+
handleCompactCommand(customInstructions?: string): Promise<void>;
|
|
189
|
+
handleHandoffCommand(customInstructions?: string): Promise<void>;
|
|
190
|
+
handleMoveCommand(targetPath: string): Promise<void>;
|
|
191
|
+
handleRenameCommand(title: string): Promise<void>;
|
|
192
|
+
handleMemoryCommand(text: string): Promise<void>;
|
|
193
|
+
handleSTTToggle(): Promise<void>;
|
|
194
|
+
executeCompaction(customInstructionsOrOptions?: string | CompactOptions, isAuto?: boolean): Promise<void>;
|
|
195
|
+
openInBrowser(urlOrPath: string): void;
|
|
196
|
+
refreshSlashCommandState(cwd?: string): Promise<void>;
|
|
197
|
+
|
|
198
|
+
// Selector handling
|
|
199
|
+
showSettingsSelector(): void;
|
|
200
|
+
showHistorySearch(): void;
|
|
201
|
+
showExtensionsDashboard(): void;
|
|
202
|
+
showAgentsDashboard(): void;
|
|
203
|
+
showModelSelector(options?: { temporaryOnly?: boolean }): void;
|
|
204
|
+
showPluginSelector(mode?: "install" | "uninstall"): void;
|
|
205
|
+
showPluginDashboard(): void;
|
|
206
|
+
showUserMessageSelector(): void;
|
|
207
|
+
showTreeSelector(): void;
|
|
208
|
+
showSessionSelector(): void;
|
|
209
|
+
handleResumeSession(sessionPath: string): Promise<void>;
|
|
210
|
+
handleSessionDeleteCommand(): Promise<void>;
|
|
211
|
+
showOAuthSelector(mode: "login" | "logout", providerId?: string): Promise<void>;
|
|
212
|
+
showHookConfirm(title: string, message: string): Promise<boolean>;
|
|
213
|
+
showDebugSelector(): void;
|
|
214
|
+
showSessionObserver(): void;
|
|
215
|
+
resetObserverRegistry(): void;
|
|
216
|
+
refreshWelcomeAfterLogin(): Promise<void>;
|
|
217
|
+
|
|
218
|
+
// Input handling
|
|
219
|
+
handleCtrlC(): void;
|
|
220
|
+
handleCtrlD(): void;
|
|
221
|
+
handleCtrlZ(): void;
|
|
222
|
+
handleDequeue(): void;
|
|
223
|
+
handleBackgroundCommand(): void;
|
|
224
|
+
handleImagePaste(): Promise<boolean>;
|
|
225
|
+
handleBtwCommand(question: string): Promise<void>;
|
|
226
|
+
hasActiveBtw(): boolean;
|
|
227
|
+
handleBtwEscape(): boolean;
|
|
228
|
+
cycleThinkingLevel(): void;
|
|
229
|
+
cycleRoleModel(options?: { temporary?: boolean }): Promise<void>;
|
|
230
|
+
toggleToolOutputExpansion(): void;
|
|
231
|
+
setToolsExpanded(expanded: boolean): void;
|
|
232
|
+
toggleThinkingBlockVisibility(): void;
|
|
233
|
+
openExternalEditor(): void;
|
|
234
|
+
registerExtensionShortcuts(): void;
|
|
235
|
+
handlePlanModeCommand(initialPrompt?: string): Promise<void>;
|
|
236
|
+
handleExitPlanModeTool(details: ExitPlanModeDetails): Promise<void>;
|
|
237
|
+
|
|
238
|
+
// Hook UI methods
|
|
239
|
+
initHooksAndCustomTools(): Promise<void>;
|
|
240
|
+
emitCustomToolSessionEvent(
|
|
241
|
+
reason: "start" | "switch" | "branch" | "tree" | "shutdown",
|
|
242
|
+
previousSessionFile?: string,
|
|
243
|
+
): Promise<void>;
|
|
244
|
+
setHookWidget(key: string, content: ExtensionWidgetContent, options?: ExtensionWidgetOptions): void;
|
|
245
|
+
setHookStatus(key: string, text: string | undefined): void;
|
|
246
|
+
showHookSelector(
|
|
247
|
+
title: string,
|
|
248
|
+
options: string[],
|
|
249
|
+
dialogOptions?: ExtensionUIDialogOptions,
|
|
250
|
+
): Promise<string | undefined>;
|
|
251
|
+
hideHookSelector(): void;
|
|
252
|
+
showHookInput(title: string, placeholder?: string): Promise<string | undefined>;
|
|
253
|
+
hideHookInput(): void;
|
|
254
|
+
showHookEditor(
|
|
255
|
+
title: string,
|
|
256
|
+
prefill?: string,
|
|
257
|
+
dialogOptions?: ExtensionUIDialogOptions,
|
|
258
|
+
editorOptions?: { promptStyle?: boolean },
|
|
259
|
+
): Promise<string | undefined>;
|
|
260
|
+
hideHookEditor(): void;
|
|
261
|
+
showHookNotify(message: string, type?: "info" | "warning" | "error"): void;
|
|
262
|
+
showHookCustom<T>(
|
|
263
|
+
factory: (
|
|
264
|
+
tui: TUI,
|
|
265
|
+
theme: Theme,
|
|
266
|
+
keybindings: KeybindingsManager,
|
|
267
|
+
done: (result: T) => void,
|
|
268
|
+
) => (Component & { dispose?(): void }) | Promise<Component & { dispose?(): void }>,
|
|
269
|
+
options?: { overlay?: boolean },
|
|
270
|
+
): Promise<T>;
|
|
271
|
+
showExtensionError(extensionPath: string, error: string): void;
|
|
272
|
+
showToolError(toolName: string, error: string): void;
|
|
273
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { t } from "@f5xc-salesdemos/pi-utils";
|
|
2
|
+
import type { AppKeybinding, KeybindingsManager } from "../../config/keybindings";
|
|
3
|
+
|
|
4
|
+
export interface HotkeysMarkdownBindings {
|
|
5
|
+
keybindings: Pick<KeybindingsManager, "getDisplayString">;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function appKey(bindings: HotkeysMarkdownBindings, action: AppKeybinding): string {
|
|
9
|
+
return bindings.keybindings.getDisplayString(action) || "Disabled";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function buildHotkeysMarkdown(bindings: HotkeysMarkdownBindings): string {
|
|
13
|
+
return [
|
|
14
|
+
`**${t("hotkeys.navigation.title")}**`,
|
|
15
|
+
"| Key | Action |",
|
|
16
|
+
"|-----|--------|",
|
|
17
|
+
`| \`Arrow keys\` | ${t("hotkeys.navigation.moveCursor")} |`,
|
|
18
|
+
`| \`Option+Left/Right\` | ${t("hotkeys.navigation.moveByWord")} |`,
|
|
19
|
+
`| \`Ctrl+A\` / \`Home\` / \`Cmd+Left\` | ${t("hotkeys.navigation.startOfLine")} |`,
|
|
20
|
+
`| \`Ctrl+E\` / \`End\` / \`Cmd+Right\` | ${t("hotkeys.navigation.endOfLine")} |`,
|
|
21
|
+
"",
|
|
22
|
+
`**${t("hotkeys.editing.title")}**`,
|
|
23
|
+
"| Key | Action |",
|
|
24
|
+
"|-----|--------|",
|
|
25
|
+
`| \`Enter\` | ${t("hotkeys.editing.sendMessage")} |`,
|
|
26
|
+
`| \`Shift+Enter\` / \`Alt+Enter\` | ${t("hotkeys.editing.newLine")} |`,
|
|
27
|
+
`| \`Ctrl+W\` / \`Option+Backspace\` | ${t("hotkeys.editing.deleteWordBackwards")} |`,
|
|
28
|
+
`| \`Ctrl+U\` | ${t("hotkeys.editing.deleteToStart")} |`,
|
|
29
|
+
`| \`Ctrl+K\` | ${t("hotkeys.editing.deleteToEnd")} |`,
|
|
30
|
+
`| \`${appKey(bindings, "app.clipboard.copyLine")}\` | ${t("hotkeys.editing.copyLine")} |`,
|
|
31
|
+
`| \`${appKey(bindings, "app.clipboard.copyPrompt")}\` | ${t("hotkeys.editing.copyPrompt")} |`,
|
|
32
|
+
"",
|
|
33
|
+
`**${t("hotkeys.other.title")}**`,
|
|
34
|
+
"| Key | Action |",
|
|
35
|
+
"|-----|--------|",
|
|
36
|
+
`| \`Tab\` | ${t("hotkeys.other.pathCompletion")} |`,
|
|
37
|
+
`| \`${appKey(bindings, "app.interrupt")}\` | ${t("hotkeys.other.cancelInterrupt")} |`,
|
|
38
|
+
`| \`${appKey(bindings, "app.clear")}\` | ${t("hotkeys.other.clearExit")} |`,
|
|
39
|
+
`| \`${appKey(bindings, "app.exit")}\` | ${t("hotkeys.other.exit")} |`,
|
|
40
|
+
`| \`${appKey(bindings, "app.suspend")}\` | ${t("hotkeys.other.suspend")} |`,
|
|
41
|
+
`| \`${appKey(bindings, "app.thinking.cycle")}\` | ${t("hotkeys.other.cycleThinking")} |`,
|
|
42
|
+
`| \`${appKey(bindings, "app.model.cycleForward")}\` | ${t("hotkeys.other.cycleModelsForward")} |`,
|
|
43
|
+
`| \`${appKey(bindings, "app.model.cycleBackward")}\` | ${t("hotkeys.other.cycleModelsBackward")} |`,
|
|
44
|
+
`| \`${appKey(bindings, "app.model.selectTemporary")}\` | ${t("hotkeys.other.selectModelTemp")} |`,
|
|
45
|
+
`| \`${appKey(bindings, "app.model.select")}\` | ${t("hotkeys.other.selectModel")} |`,
|
|
46
|
+
`| \`${appKey(bindings, "app.plan.toggle")}\` | ${t("hotkeys.other.togglePlan")} |`,
|
|
47
|
+
`| \`${appKey(bindings, "app.history.search")}\` | ${t("hotkeys.other.searchHistory")} |`,
|
|
48
|
+
`| \`${appKey(bindings, "app.tools.expand")}\` | ${t("hotkeys.other.toggleToolExpand")} |`,
|
|
49
|
+
`| \`${appKey(bindings, "app.thinking.toggle")}\` | ${t("hotkeys.other.toggleThinking")} |`,
|
|
50
|
+
`| \`${appKey(bindings, "app.editor.external")}\` | ${t("hotkeys.other.externalEditor")} |`,
|
|
51
|
+
`| \`${appKey(bindings, "app.clipboard.pasteImage")}\` | ${t("hotkeys.other.pasteImage")} |`,
|
|
52
|
+
`| \`${appKey(bindings, "app.stt.toggle")}\` | ${t("hotkeys.other.toggleStt")} |`,
|
|
53
|
+
`| \`#\` | ${t("hotkeys.other.promptActions")} |`,
|
|
54
|
+
`| \`/\` | ${t("hotkeys.other.slashCommands")} |`,
|
|
55
|
+
`| \`!\` | ${t("hotkeys.other.runBash")} |`,
|
|
56
|
+
`| \`!!\` | ${t("hotkeys.other.runBashExcluded")} |`,
|
|
57
|
+
`| \`$\` | ${t("hotkeys.other.runPython")} |`,
|
|
58
|
+
`| \`$$\` | ${t("hotkeys.other.runPythonExcluded")} |`,
|
|
59
|
+
].join("\n");
|
|
60
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { getKeybindings, matchesKey } from "@f5xc-salesdemos/pi-tui";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Match the coding-agent interrupt key.
|
|
5
|
+
*
|
|
6
|
+
* Interactive mode installs a keybinding manager that exposes `app.interrupt`
|
|
7
|
+
* globally, but some isolated component tests still run with only TUI
|
|
8
|
+
* keybindings registered. In that case, fall back to raw Escape matching.
|
|
9
|
+
*/
|
|
10
|
+
export function matchesAppInterrupt(data: string): boolean {
|
|
11
|
+
const keybindings = getKeybindings();
|
|
12
|
+
const interruptKeys = keybindings.getKeys("app.interrupt");
|
|
13
|
+
if (interruptKeys.length > 0) {
|
|
14
|
+
return keybindings.matches(data, "app.interrupt");
|
|
15
|
+
}
|
|
16
|
+
return matchesKey(data, "escape") || matchesKey(data, "esc");
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function matchesSelectCancel(data: string): boolean {
|
|
20
|
+
return getKeybindings().matches(data, "tui.select.cancel");
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function matchesAppExternalEditor(data: string): boolean {
|
|
24
|
+
const keybindings = getKeybindings();
|
|
25
|
+
const externalEditorKeys = keybindings.getKeys("app.editor.external");
|
|
26
|
+
if (externalEditorKeys.length > 0) {
|
|
27
|
+
return keybindings.matches(data, "app.editor.external");
|
|
28
|
+
}
|
|
29
|
+
return matchesKey(data, "ctrl+g");
|
|
30
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { Component } from "@f5xc-salesdemos/pi-tui";
|
|
2
|
+
import type { GutterBlock } from "../components/gutter-block";
|
|
3
|
+
|
|
4
|
+
type Outcome = "success" | "error";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Aggregates per-read outcomes across a shared read-group gutter so the
|
|
8
|
+
* final rendered dot reflects the worst-case outcome of the group.
|
|
9
|
+
*
|
|
10
|
+
* Called by two paths:
|
|
11
|
+
* • live event-controller — reads arrive one at a time during streaming;
|
|
12
|
+
* the gutter's spinner must stay active until the last read in the
|
|
13
|
+
* group completes, so finalize is called only when `stillActive` is
|
|
14
|
+
* false.
|
|
15
|
+
* • replay ui-helpers — transcript rebuild walks completed tool results
|
|
16
|
+
* in order; finalize is called at each group boundary.
|
|
17
|
+
*
|
|
18
|
+
* Semantics:
|
|
19
|
+
* • `record` merges an incoming outcome into the running worst-case for
|
|
20
|
+
* the gutter. "error" beats "success" regardless of ordering.
|
|
21
|
+
* • `finalize` flushes the aggregated outcome to `gutter.setDone()`,
|
|
22
|
+
* clears the entry, and returns. Calling `finalize` on a gutter that
|
|
23
|
+
* was never `record`ed calls `setDone()` with no argument so the
|
|
24
|
+
* gutter renders in its neutral done state.
|
|
25
|
+
* • `peek` is read-only — useful for assertions and instrumentation.
|
|
26
|
+
*/
|
|
27
|
+
// Gutter generic parameter is not relevant to aggregation; constrain to
|
|
28
|
+
// `Component` (the superclass required by GutterBlock) so callers with
|
|
29
|
+
// concrete child types still flow in cleanly.
|
|
30
|
+
type AnyGutter = GutterBlock<Component>;
|
|
31
|
+
|
|
32
|
+
export class ReadGroupOutcomeAggregator {
|
|
33
|
+
#outcomes = new WeakMap<AnyGutter, Outcome>();
|
|
34
|
+
|
|
35
|
+
record(gutter: AnyGutter, outcome: Outcome): void {
|
|
36
|
+
const current = this.#outcomes.get(gutter);
|
|
37
|
+
// "error" is strictly worse than "success" — once any read in the
|
|
38
|
+
// group fails, the whole group is marked failed.
|
|
39
|
+
if (current === "error") return;
|
|
40
|
+
this.#outcomes.set(gutter, outcome);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
peek(gutter: AnyGutter): Outcome | undefined {
|
|
44
|
+
return this.#outcomes.get(gutter);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
finalize(gutter: AnyGutter): void {
|
|
48
|
+
const outcome = this.#outcomes.get(gutter);
|
|
49
|
+
this.#outcomes.delete(gutter);
|
|
50
|
+
gutter.setDone(outcome);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Re-export for callers that need the generic gutter type alias.
|
|
55
|
+
export type { AnyGutter as ReadGroupGutter, Outcome as ReadGroupOutcome };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Ellipsis, truncateToWidth } from "@f5xc-salesdemos/pi-tui";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Single-line-safe sanitizer for error messages rendered inside TUI status
|
|
5
|
+
* footers (e.g. `(error: <message>)`). Protects the layout from payloads that
|
|
6
|
+
* contain ANSI escape sequences, embedded newlines, tabs, other control
|
|
7
|
+
* characters, wide glyphs (CJK / emoji), or are simply too long to fit on
|
|
8
|
+
* one terminal row.
|
|
9
|
+
*
|
|
10
|
+
* Contract (applied in order):
|
|
11
|
+
* 1. Full ANSI escape sequences (CSI like `\x1b[31m`, OSC like
|
|
12
|
+
* `\x1b]8;;...\x1b\\`, and single-byte ESC introducers) are removed
|
|
13
|
+
* WHOLE — not just the lone ESC byte — so no `[31mboom[0m` garbage
|
|
14
|
+
* survives.
|
|
15
|
+
* 2. Embedded newlines and tabs are collapsed to a single space.
|
|
16
|
+
* 3. Any remaining ASCII control characters (\x00–\x1F and \x7F) are
|
|
17
|
+
* stripped.
|
|
18
|
+
* 4. Runs of whitespace are collapsed to a single space; leading/trailing
|
|
19
|
+
* whitespace is trimmed.
|
|
20
|
+
* 5. Output is truncated to {@link MAX_ERROR_MESSAGE_WIDTH} **terminal
|
|
21
|
+
* cells** (not UTF-16 code units) via `truncateToWidth` from pi-tui;
|
|
22
|
+
* wide glyphs therefore count as 2 cells each. Truncation is marked
|
|
23
|
+
* with a single horizontal ellipsis (`…`). The limit is chosen so
|
|
24
|
+
* that `(error: <msg>)` (9-cell wrapper) fits on a single row of an
|
|
25
|
+
* 80-column terminal.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
// Sanitized-message budget for the `(error: <msg>)` footer.
|
|
29
|
+
//
|
|
30
|
+
// The footer is rendered inside GutterBlock (2-cell prefix) + the bash/
|
|
31
|
+
// python execution box (which reserves a 1-cell Text indent on each side
|
|
32
|
+
// plus a further gap on the right before wrapping occurs in practice).
|
|
33
|
+
// Arithmetic gives ~68 cells on an 80-column terminal, but empirical
|
|
34
|
+
// rendering with `createToolGutter(new BashExecutionComponent(...)).render(80)`
|
|
35
|
+
// still wraps the trailing `)` onto the next row at that ceiling.
|
|
36
|
+
// Pin the budget well inside the algebraic limit so the guarantee holds
|
|
37
|
+
// under the real layered layout.
|
|
38
|
+
//
|
|
39
|
+
// Net budget for the message: 60 cells → full footer ≤ ~73 cells →
|
|
40
|
+
// safe on any terminal ≥ 80 columns even after the gutter + box overhead.
|
|
41
|
+
export const MAX_ERROR_MESSAGE_WIDTH = 60;
|
|
42
|
+
|
|
43
|
+
// Matches CSI (Control Sequence Introducer) / SGR sequences: \x1b[ … final byte.
|
|
44
|
+
const ANSI_CSI_RE = /\x1b\[[0-?]*[ -/]*[@-~]/g;
|
|
45
|
+
// Matches OSC (Operating System Command) sequences: \x1b] … terminator (BEL or ESC\).
|
|
46
|
+
const ANSI_OSC_RE = /\x1b\][\s\S]*?(?:\x07|\x1b\\)/g;
|
|
47
|
+
// Fallback for any stray single-byte ESC sequences (e.g. "\x1bM" reverse index).
|
|
48
|
+
const ANSI_ESC_RE = /\x1b[@-_]?/g;
|
|
49
|
+
|
|
50
|
+
export function sanitizeErrorMessage(raw: string): string {
|
|
51
|
+
const withoutAnsi = raw.replace(ANSI_OSC_RE, "").replace(ANSI_CSI_RE, "").replace(ANSI_ESC_RE, "");
|
|
52
|
+
// Collapse whitespace-like control chars (tab, newline, CR, form feed)
|
|
53
|
+
// to a single space, then strip every remaining control character.
|
|
54
|
+
const flattened = withoutAnsi.replace(/[\t\n\r\f\v]+/g, " ").replace(/[\x00-\x1F\x7F]/g, "");
|
|
55
|
+
const collapsed = flattened.replace(/\s+/g, " ").trim();
|
|
56
|
+
// truncateToWidth measures in terminal cells (wide glyphs count as 2)
|
|
57
|
+
// and appends an ellipsis when it clips. Returns the input unchanged if
|
|
58
|
+
// already within budget.
|
|
59
|
+
return truncateToWidth(collapsed, MAX_ERROR_MESSAGE_WIDTH, Ellipsis.Unicode);
|
|
60
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { t } from "@f5xc-salesdemos/pi-utils";
|
|
2
|
+
import type { Tool } from "../../tools";
|
|
3
|
+
|
|
4
|
+
export interface ToolsMarkdownBindings {
|
|
5
|
+
tools: ReadonlyArray<Pick<Tool, "description" | "name">>;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function escapeTableCell(value: string): string {
|
|
9
|
+
return value
|
|
10
|
+
.replace(/\|/g, "\\|")
|
|
11
|
+
.replace(/\r?\n+/g, " ")
|
|
12
|
+
.trim();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function buildToolsMarkdown(bindings: ToolsMarkdownBindings): string {
|
|
16
|
+
if (bindings.tools.length === 0) {
|
|
17
|
+
return t("tools.emptyState");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return [
|
|
21
|
+
`| ${t("tools.tableHeaderTool")} | ${t("tools.tableHeaderDescription")} |`,
|
|
22
|
+
"|------|-------------|",
|
|
23
|
+
...bindings.tools.map(tool => {
|
|
24
|
+
const description = escapeTableCell(tool.description) || t("tools.noDescription");
|
|
25
|
+
return `| \`${tool.name}\` | ${description} |`;
|
|
26
|
+
}),
|
|
27
|
+
].join("\n");
|
|
28
|
+
}
|