@gajae-code/coding-agent 0.1.1
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 +8662 -0
- package/README.md +37 -0
- package/dist/types/async/index.d.ts +2 -0
- package/dist/types/async/job-manager.d.ts +101 -0
- package/dist/types/async/support.d.ts +2 -0
- package/dist/types/autoresearch/dashboard.d.ts +4 -0
- package/dist/types/autoresearch/git.d.ts +36 -0
- package/dist/types/autoresearch/helpers.d.ts +24 -0
- package/dist/types/autoresearch/index.d.ts +2 -0
- package/dist/types/autoresearch/state.d.ts +17 -0
- package/dist/types/autoresearch/storage.d.ts +142 -0
- package/dist/types/autoresearch/tools/init-experiment.d.ts +31 -0
- package/dist/types/autoresearch/tools/log-experiment.d.ts +23 -0
- package/dist/types/autoresearch/tools/run-experiment.d.ts +8 -0
- package/dist/types/autoresearch/tools/update-notes.d.ts +12 -0
- package/dist/types/autoresearch/types.d.ts +154 -0
- package/dist/types/capability/context-file.d.ts +17 -0
- package/dist/types/capability/extension-module.d.ts +15 -0
- package/dist/types/capability/extension.d.ts +28 -0
- package/dist/types/capability/fs.d.ts +20 -0
- package/dist/types/capability/hook.d.ts +19 -0
- package/dist/types/capability/index.d.ts +80 -0
- package/dist/types/capability/instruction.d.ts +17 -0
- package/dist/types/capability/mcp.d.ts +45 -0
- package/dist/types/capability/prompt.d.ts +15 -0
- package/dist/types/capability/rule.d.ts +61 -0
- package/dist/types/capability/settings.d.ts +15 -0
- package/dist/types/capability/skill.d.ts +36 -0
- package/dist/types/capability/slash-command.d.ts +17 -0
- package/dist/types/capability/ssh.d.ts +23 -0
- package/dist/types/capability/system-prompt.d.ts +15 -0
- package/dist/types/capability/tool.d.ts +19 -0
- package/dist/types/capability/types.d.ts +154 -0
- package/dist/types/cli/agents-cli.d.ts +12 -0
- package/dist/types/cli/args.d.ts +53 -0
- package/dist/types/cli/auth-broker-cli.d.ts +25 -0
- package/dist/types/cli/auth-gateway-cli.d.ts +18 -0
- package/dist/types/cli/classify-install-target.d.ts +18 -0
- package/dist/types/cli/commands/init-xdg.d.ts +1 -0
- package/dist/types/cli/config-cli.d.ts +22 -0
- package/dist/types/cli/file-processor.d.ts +11 -0
- package/dist/types/cli/grep-cli.d.ts +17 -0
- package/dist/types/cli/initial-message.d.ts +17 -0
- package/dist/types/cli/list-models.d.ts +30 -0
- package/dist/types/cli/plugin-cli.d.ts +32 -0
- package/dist/types/cli/read-cli.d.ts +4 -0
- package/dist/types/cli/session-picker.d.ts +3 -0
- package/dist/types/cli/setup-cli.d.ts +31 -0
- package/dist/types/cli/shell-cli.d.ts +8 -0
- package/dist/types/cli/ssh-cli.d.ts +21 -0
- package/dist/types/cli/stats-cli.d.ts +17 -0
- package/dist/types/cli/update-cli.d.ts +38 -0
- package/dist/types/cli/web-search-cli.d.ts +20 -0
- package/dist/types/cli/worktree-cli.d.ts +26 -0
- package/dist/types/cli.d.ts +3 -0
- package/dist/types/commands/acp.d.ts +12 -0
- package/dist/types/commands/agents.d.ts +34 -0
- package/dist/types/commands/auth-broker.d.ts +54 -0
- package/dist/types/commands/auth-gateway.d.ts +32 -0
- package/dist/types/commands/codex-native-hook.d.ts +6 -0
- package/dist/types/commands/commit.d.ts +27 -0
- package/dist/types/commands/config.d.ts +30 -0
- package/dist/types/commands/deep-interview.d.ts +7 -0
- package/dist/types/commands/gjc-runtime-bridge.d.ts +6 -0
- package/dist/types/commands/grep.d.ts +42 -0
- package/dist/types/commands/launch.d.ts +121 -0
- package/dist/types/commands/plugin.d.ts +52 -0
- package/dist/types/commands/question.d.ts +7 -0
- package/dist/types/commands/ralplan.d.ts +7 -0
- package/dist/types/commands/read.d.ts +15 -0
- package/dist/types/commands/setup.d.ts +48 -0
- package/dist/types/commands/shell.d.ts +21 -0
- package/dist/types/commands/ssh.d.ts +48 -0
- package/dist/types/commands/state.d.ts +7 -0
- package/dist/types/commands/stats.d.ts +25 -0
- package/dist/types/commands/team.d.ts +24 -0
- package/dist/types/commands/ultragoal.d.ts +7 -0
- package/dist/types/commands/update.d.ts +20 -0
- package/dist/types/commands/web-search.d.ts +33 -0
- package/dist/types/commands/worktree.d.ts +34 -0
- package/dist/types/commit/agentic/agent.d.ts +31 -0
- package/dist/types/commit/agentic/fallback.d.ts +5 -0
- package/dist/types/commit/agentic/index.d.ts +2 -0
- package/dist/types/commit/agentic/state.d.ts +58 -0
- package/dist/types/commit/agentic/tools/analyze-file.d.ts +19 -0
- package/dist/types/commit/agentic/tools/git-file-diff.d.ts +10 -0
- package/dist/types/commit/agentic/tools/git-hunk.d.ts +9 -0
- package/dist/types/commit/agentic/tools/git-overview.d.ts +9 -0
- package/dist/types/commit/agentic/tools/index.d.ts +16 -0
- package/dist/types/commit/agentic/tools/propose-changelog.d.ts +28 -0
- package/dist/types/commit/agentic/tools/propose-commit.d.ts +36 -0
- package/dist/types/commit/agentic/tools/recent-commits.d.ts +7 -0
- package/dist/types/commit/agentic/tools/schemas.d.ts +27 -0
- package/dist/types/commit/agentic/tools/split-commit.d.ts +53 -0
- package/dist/types/commit/agentic/topo-sort.d.ts +4 -0
- package/dist/types/commit/agentic/trivial.d.ts +7 -0
- package/dist/types/commit/agentic/validation.d.ts +20 -0
- package/dist/types/commit/analysis/conventional.d.ts +22 -0
- package/dist/types/commit/analysis/index.d.ts +4 -0
- package/dist/types/commit/analysis/scope.d.ts +6 -0
- package/dist/types/commit/analysis/summary.d.ts +19 -0
- package/dist/types/commit/analysis/validation.d.ts +8 -0
- package/dist/types/commit/changelog/detect.d.ts +2 -0
- package/dist/types/commit/changelog/generate.d.ts +30 -0
- package/dist/types/commit/changelog/index.d.ts +30 -0
- package/dist/types/commit/changelog/parse.d.ts +2 -0
- package/dist/types/commit/cli.d.ts +3 -0
- package/dist/types/commit/git/diff.d.ts +5 -0
- package/dist/types/commit/index.d.ts +4 -0
- package/dist/types/commit/map-reduce/index.d.ts +28 -0
- package/dist/types/commit/map-reduce/map-phase.d.ts +17 -0
- package/dist/types/commit/map-reduce/reduce-phase.d.ts +13 -0
- package/dist/types/commit/map-reduce/utils.d.ts +2 -0
- package/dist/types/commit/message.d.ts +2 -0
- package/dist/types/commit/model-selection.d.ts +15 -0
- package/dist/types/commit/pipeline.d.ts +5 -0
- package/dist/types/commit/shared-llm.d.ts +54 -0
- package/dist/types/commit/types.d.ts +78 -0
- package/dist/types/commit/utils/exclusions.d.ts +4 -0
- package/dist/types/commit/utils.d.ts +20 -0
- package/dist/types/config/config-file.d.ts +58 -0
- package/dist/types/config/file-lock.d.ts +6 -0
- package/dist/types/config/keybindings.d.ts +334 -0
- package/dist/types/config/model-equivalence.d.ts +24 -0
- package/dist/types/config/model-registry.d.ts +390 -0
- package/dist/types/config/model-resolver.d.ts +230 -0
- package/dist/types/config/models-config-schema.d.ts +504 -0
- package/dist/types/config/prompt-templates.d.ts +32 -0
- package/dist/types/config/resolve-config-value.d.ts +17 -0
- package/dist/types/config/settings-schema.d.ts +3337 -0
- package/dist/types/config/settings.d.ts +132 -0
- package/dist/types/config/skill-settings-defaults.d.ts +14 -0
- package/dist/types/config.d.ts +66 -0
- package/dist/types/cursor.d.ts +24 -0
- package/dist/types/dap/client.d.ts +38 -0
- package/dist/types/dap/config.d.ts +6 -0
- package/dist/types/dap/index.d.ts +4 -0
- package/dist/types/dap/session.d.ts +108 -0
- package/dist/types/dap/types.d.ts +524 -0
- package/dist/types/debug/index.d.ts +15 -0
- package/dist/types/debug/log-formatting.d.ts +4 -0
- package/dist/types/debug/log-viewer.d.ts +68 -0
- package/dist/types/debug/profiler.d.ts +24 -0
- package/dist/types/debug/raw-sse-buffer.d.ts +44 -0
- package/dist/types/debug/raw-sse.d.ts +16 -0
- package/dist/types/debug/report-bundle.d.ts +55 -0
- package/dist/types/debug/system-info.d.ts +26 -0
- package/dist/types/defaults/gjc-defaults.d.ts +44 -0
- package/dist/types/discovery/agents-md.d.ts +1 -0
- package/dist/types/discovery/agents.d.ts +12 -0
- package/dist/types/discovery/builtin.d.ts +1 -0
- package/dist/types/discovery/claude-plugins.d.ts +1 -0
- package/dist/types/discovery/claude.d.ts +1 -0
- package/dist/types/discovery/cline.d.ts +1 -0
- package/dist/types/discovery/codex.d.ts +1 -0
- package/dist/types/discovery/cursor.d.ts +16 -0
- package/dist/types/discovery/gemini.d.ts +1 -0
- package/dist/types/discovery/github.d.ts +1 -0
- package/dist/types/discovery/helpers.d.ts +268 -0
- package/dist/types/discovery/index.d.ts +48 -0
- package/dist/types/discovery/mcp-json.d.ts +1 -0
- package/dist/types/discovery/opencode.d.ts +1 -0
- package/dist/types/discovery/plugin-dir-roots.d.ts +15 -0
- package/dist/types/discovery/ssh.d.ts +1 -0
- package/dist/types/discovery/substitute-plugin-root.d.ts +5 -0
- package/dist/types/discovery/vscode.d.ts +1 -0
- package/dist/types/discovery/windsurf.d.ts +13 -0
- package/dist/types/edit/apply-patch/index.d.ts +35 -0
- package/dist/types/edit/apply-patch/parser.d.ts +34 -0
- package/dist/types/edit/diff.d.ts +59 -0
- package/dist/types/edit/file-read-cache.d.ts +25 -0
- package/dist/types/edit/index.d.ts +58 -0
- package/dist/types/edit/modes/apply-patch.d.ts +24 -0
- package/dist/types/edit/modes/patch.d.ts +99 -0
- package/dist/types/edit/modes/replace.d.ts +142 -0
- package/dist/types/edit/normalize.d.ts +43 -0
- package/dist/types/edit/notebook.d.ts +23 -0
- package/dist/types/edit/read-file.d.ts +2 -0
- package/dist/types/edit/renderer.d.ts +110 -0
- package/dist/types/edit/streaming.d.ts +66 -0
- package/dist/types/eval/backend.d.ts +40 -0
- package/dist/types/eval/index.d.ts +4 -0
- package/dist/types/eval/js/context-manager.d.ts +24 -0
- package/dist/types/eval/js/executor.d.ts +28 -0
- package/dist/types/eval/js/index.d.ts +10 -0
- package/dist/types/eval/js/shared/helpers.d.ts +38 -0
- package/dist/types/eval/js/shared/indirect-eval.d.ts +14 -0
- package/dist/types/eval/js/shared/prelude.d.ts +1 -0
- package/dist/types/eval/js/shared/rewrite-imports.d.ts +6 -0
- package/dist/types/eval/js/shared/runtime.d.ts +47 -0
- package/dist/types/eval/js/shared/types.d.ts +24 -0
- package/dist/types/eval/js/tool-bridge.d.ts +18 -0
- package/dist/types/eval/js/worker-core.d.ts +5 -0
- package/dist/types/eval/js/worker-entry.d.ts +1 -0
- package/dist/types/eval/js/worker-protocol.d.ts +77 -0
- package/dist/types/eval/py/display.d.ts +25 -0
- package/dist/types/eval/py/executor.d.ts +83 -0
- package/dist/types/eval/py/index.d.ts +10 -0
- package/dist/types/eval/py/kernel.d.ts +61 -0
- package/dist/types/eval/py/prelude.d.ts +1 -0
- package/dist/types/eval/py/runtime.d.ts +21 -0
- package/dist/types/eval/py/tool-bridge.d.ts +20 -0
- package/dist/types/eval/types.d.ts +52 -0
- package/dist/types/exa/factory.d.ts +13 -0
- package/dist/types/exa/index.d.ts +20 -0
- package/dist/types/exa/mcp-client.d.ts +45 -0
- package/dist/types/exa/render.d.ts +19 -0
- package/dist/types/exa/researcher.d.ts +9 -0
- package/dist/types/exa/search.d.ts +9 -0
- package/dist/types/exa/types.d.ts +155 -0
- package/dist/types/exa/websets.d.ts +9 -0
- package/dist/types/exec/bash-executor.d.ts +41 -0
- package/dist/types/exec/exec.d.ts +25 -0
- package/dist/types/exec/idle-timeout-watchdog.d.ts +18 -0
- package/dist/types/exec/non-interactive-env.d.ts +1 -0
- package/dist/types/export/custom-share.d.ts +20 -0
- package/dist/types/export/html/index.d.ts +10 -0
- package/dist/types/export/html/template.generated.d.ts +1 -0
- package/dist/types/export/html/template.macro.d.ts +5 -0
- package/dist/types/export/ttsr.d.ts +44 -0
- package/dist/types/extensibility/custom-commands/bundled/ci-green/index.d.ts +9 -0
- package/dist/types/extensibility/custom-commands/bundled/review/index.d.ts +10 -0
- package/dist/types/extensibility/custom-commands/index.d.ts +2 -0
- package/dist/types/extensibility/custom-commands/loader.d.ts +29 -0
- package/dist/types/extensibility/custom-commands/types.d.ts +106 -0
- package/dist/types/extensibility/custom-tools/index.d.ts +6 -0
- package/dist/types/extensibility/custom-tools/loader.d.ts +69 -0
- package/dist/types/extensibility/custom-tools/types.d.ts +226 -0
- package/dist/types/extensibility/custom-tools/wrapper.d.ts +23 -0
- package/dist/types/extensibility/extensions/compact-handler.d.ts +26 -0
- package/dist/types/extensibility/extensions/get-commands-handler.d.ts +29 -0
- package/dist/types/extensibility/extensions/index.d.ts +8 -0
- package/dist/types/extensibility/extensions/loader.d.ts +43 -0
- package/dist/types/extensibility/extensions/runner.d.ts +134 -0
- package/dist/types/extensibility/extensions/types.d.ts +864 -0
- package/dist/types/extensibility/extensions/wrapper.d.ts +54 -0
- package/dist/types/extensibility/hooks/index.d.ts +5 -0
- package/dist/types/extensibility/hooks/loader.d.ts +89 -0
- package/dist/types/extensibility/hooks/runner.d.ts +126 -0
- package/dist/types/extensibility/hooks/tool-wrapper.d.ts +25 -0
- package/dist/types/extensibility/hooks/types.d.ts +431 -0
- package/dist/types/extensibility/plugins/doctor.d.ts +3 -0
- package/dist/types/extensibility/plugins/git-url.d.ts +34 -0
- package/dist/types/extensibility/plugins/index.d.ts +7 -0
- package/dist/types/extensibility/plugins/installer.d.ts +5 -0
- package/dist/types/extensibility/plugins/legacy-pi-compat.d.ts +2 -0
- package/dist/types/extensibility/plugins/loader.d.ts +31 -0
- package/dist/types/extensibility/plugins/manager.d.ts +65 -0
- package/dist/types/extensibility/plugins/marketplace/cache.d.ts +41 -0
- package/dist/types/extensibility/plugins/marketplace/fetcher.d.ts +48 -0
- package/dist/types/extensibility/plugins/marketplace/index.d.ts +6 -0
- package/dist/types/extensibility/plugins/marketplace/manager.d.ts +57 -0
- package/dist/types/extensibility/plugins/marketplace/registry.d.ts +34 -0
- package/dist/types/extensibility/plugins/marketplace/source-resolver.d.ts +28 -0
- package/dist/types/extensibility/plugins/marketplace/types.d.ts +130 -0
- package/dist/types/extensibility/plugins/parser.d.ts +52 -0
- package/dist/types/extensibility/plugins/types.d.ts +149 -0
- package/dist/types/extensibility/shared-events.d.ts +279 -0
- package/dist/types/extensibility/skills.d.ts +74 -0
- package/dist/types/extensibility/slash-commands.d.ts +48 -0
- package/dist/types/extensibility/tool-proxy.d.ts +4 -0
- package/dist/types/extensibility/typebox.d.ts +155 -0
- package/dist/types/extensibility/utils.d.ts +12 -0
- package/dist/types/gjc-runtime/goal-mode-request.d.ts +46 -0
- package/dist/types/gjc-runtime/launch-tmux.d.ts +45 -0
- package/dist/types/gjc-runtime/launch-worktree.d.ts +46 -0
- package/dist/types/gjc-runtime/team-runtime.d.ts +204 -0
- package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +85 -0
- package/dist/types/goals/index.d.ts +3 -0
- package/dist/types/goals/runtime.d.ts +68 -0
- package/dist/types/goals/state.d.ts +35 -0
- package/dist/types/goals/tools/goal-tool.d.ts +128 -0
- package/dist/types/hashline/anchors.d.ts +20 -0
- package/dist/types/hashline/apply.d.ts +14 -0
- package/dist/types/hashline/constants.d.ts +19 -0
- package/dist/types/hashline/diff-preview.d.ts +2 -0
- package/dist/types/hashline/diff.d.ts +17 -0
- package/dist/types/hashline/execute.d.ts +4 -0
- package/dist/types/hashline/hash.d.ts +123 -0
- package/dist/types/hashline/index.d.ts +13 -0
- package/dist/types/hashline/input.d.ts +11 -0
- package/dist/types/hashline/parser.d.ts +7 -0
- package/dist/types/hashline/prefixes.d.ts +7 -0
- package/dist/types/hashline/recovery.d.ts +27 -0
- package/dist/types/hashline/stream.d.ts +2 -0
- package/dist/types/hashline/types.d.ts +77 -0
- package/dist/types/hindsight/backend.d.ts +13 -0
- package/dist/types/hindsight/bank.d.ts +54 -0
- package/dist/types/hindsight/client.d.ts +224 -0
- package/dist/types/hindsight/config.d.ts +51 -0
- package/dist/types/hindsight/content.d.ts +70 -0
- package/dist/types/hindsight/index.d.ts +8 -0
- package/dist/types/hindsight/mental-models.d.ts +125 -0
- package/dist/types/hindsight/state.d.ts +99 -0
- package/dist/types/hindsight/transcript.d.ts +28 -0
- package/dist/types/hooks/codex-native-hooks-config.d.ts +29 -0
- package/dist/types/hooks/native-skill-hook.d.ts +16 -0
- package/dist/types/hooks/skill-keywords.d.ts +17 -0
- package/dist/types/hooks/skill-state.d.ts +80 -0
- package/dist/types/index.d.ts +33 -0
- package/dist/types/internal-urls/agent-protocol.d.ts +12 -0
- package/dist/types/internal-urls/artifact-protocol.d.ts +6 -0
- package/dist/types/internal-urls/docs-index.generated.d.ts +2 -0
- package/dist/types/internal-urls/gjc-protocol.d.ts +12 -0
- package/dist/types/internal-urls/index.d.ts +20 -0
- package/dist/types/internal-urls/issue-pr-protocol.d.ts +17 -0
- package/dist/types/internal-urls/json-query.d.ts +30 -0
- package/dist/types/internal-urls/local-protocol.d.ts +39 -0
- package/dist/types/internal-urls/mcp-protocol.d.ts +12 -0
- package/dist/types/internal-urls/memory-protocol.d.ts +23 -0
- package/dist/types/internal-urls/parse.d.ts +19 -0
- package/dist/types/internal-urls/registry-helpers.d.ts +10 -0
- package/dist/types/internal-urls/router.d.ts +14 -0
- package/dist/types/internal-urls/rule-protocol.d.ts +6 -0
- package/dist/types/internal-urls/skill-protocol.d.ts +13 -0
- package/dist/types/internal-urls/types.d.ts +105 -0
- package/dist/types/lsp/client.d.ts +65 -0
- package/dist/types/lsp/clients/biome-client.d.ts +16 -0
- package/dist/types/lsp/clients/index.d.ts +19 -0
- package/dist/types/lsp/clients/lsp-linter-client.d.ts +16 -0
- package/dist/types/lsp/clients/swiftlint-client.d.ts +20 -0
- package/dist/types/lsp/config.d.ts +65 -0
- package/dist/types/lsp/edits.d.ts +23 -0
- package/dist/types/lsp/index.d.ts +130 -0
- package/dist/types/lsp/lspmux.d.ts +58 -0
- package/dist/types/lsp/render.d.ts +32 -0
- package/dist/types/lsp/startup-events.d.ts +11 -0
- package/dist/types/lsp/types.d.ts +302 -0
- package/dist/types/lsp/utils.d.ts +108 -0
- package/dist/types/main.d.ts +50 -0
- package/dist/types/memories/index.d.ts +28 -0
- package/dist/types/memories/storage.d.ts +110 -0
- package/dist/types/memory-backend/index.d.ts +4 -0
- package/dist/types/memory-backend/local-backend.d.ts +9 -0
- package/dist/types/memory-backend/off-backend.d.ts +7 -0
- package/dist/types/memory-backend/resolve.d.ts +15 -0
- package/dist/types/memory-backend/types.d.ts +61 -0
- package/dist/types/modes/acp/acp-agent.d.ts +61 -0
- package/dist/types/modes/acp/acp-client-bridge.d.ts +9 -0
- package/dist/types/modes/acp/acp-event-mapper.d.ts +32 -0
- package/dist/types/modes/acp/acp-mode.d.ts +5 -0
- package/dist/types/modes/acp/index.d.ts +2 -0
- package/dist/types/modes/acp/terminal-auth.d.ts +6 -0
- package/dist/types/modes/components/agent-dashboard.d.ts +21 -0
- package/dist/types/modes/components/assistant-message.d.ts +16 -0
- package/dist/types/modes/components/bash-execution.d.ts +29 -0
- package/dist/types/modes/components/bordered-loader.d.ts +11 -0
- package/dist/types/modes/components/branch-summary-message.d.ts +13 -0
- package/dist/types/modes/components/btw-panel.d.ts +16 -0
- package/dist/types/modes/components/compaction-summary-message.d.ts +13 -0
- package/dist/types/modes/components/countdown-timer.d.ts +14 -0
- package/dist/types/modes/components/custom-editor.d.ts +47 -0
- package/dist/types/modes/components/custom-message.d.ts +15 -0
- package/dist/types/modes/components/diff.d.ts +11 -0
- package/dist/types/modes/components/dynamic-border.d.ts +14 -0
- package/dist/types/modes/components/eval-execution.d.ts +23 -0
- package/dist/types/modes/components/execution-shared.d.ts +46 -0
- package/dist/types/modes/components/extensions/extension-dashboard.d.ts +26 -0
- package/dist/types/modes/components/extensions/extension-list.d.ts +39 -0
- package/dist/types/modes/components/extensions/index.d.ts +8 -0
- package/dist/types/modes/components/extensions/inspector-panel.d.ts +8 -0
- package/dist/types/modes/components/extensions/state-manager.d.ts +50 -0
- package/dist/types/modes/components/extensions/types.d.ts +151 -0
- package/dist/types/modes/components/footer.d.ts +30 -0
- package/dist/types/modes/components/history-search.d.ts +7 -0
- package/dist/types/modes/components/hook-editor.d.ts +18 -0
- package/dist/types/modes/components/hook-input.d.ts +15 -0
- package/dist/types/modes/components/hook-message.d.ts +15 -0
- package/dist/types/modes/components/hook-selector.d.ts +23 -0
- package/dist/types/modes/components/index.d.ts +35 -0
- package/dist/types/modes/components/keybinding-hints.d.ts +40 -0
- package/dist/types/modes/components/login-dialog.d.ts +32 -0
- package/dist/types/modes/components/message-frame.d.ts +42 -0
- package/dist/types/modes/components/model-selector.d.ts +26 -0
- package/dist/types/modes/components/oauth-selector.d.ts +14 -0
- package/dist/types/modes/components/plugin-selector.d.ts +26 -0
- package/dist/types/modes/components/plugin-settings.d.ts +66 -0
- package/dist/types/modes/components/provider-onboarding-selector.d.ts +7 -0
- package/dist/types/modes/components/queue-mode-selector.d.ts +9 -0
- package/dist/types/modes/components/read-tool-group.d.ts +30 -0
- package/dist/types/modes/components/runtime-mcp-add-wizard.d.ts +25 -0
- package/dist/types/modes/components/session-observer-overlay.d.ts +11 -0
- package/dist/types/modes/components/session-selector.d.ts +30 -0
- package/dist/types/modes/components/settings-defs.d.ts +50 -0
- package/dist/types/modes/components/settings-selector.d.ts +54 -0
- package/dist/types/modes/components/show-images-selector.d.ts +9 -0
- package/dist/types/modes/components/skill-hud/render.d.ts +2 -0
- package/dist/types/modes/components/skill-message.d.ts +9 -0
- package/dist/types/modes/components/status-line/context-thresholds.d.ts +4 -0
- package/dist/types/modes/components/status-line/git-utils.d.ts +22 -0
- package/dist/types/modes/components/status-line/index.d.ts +4 -0
- package/dist/types/modes/components/status-line/presets.d.ts +3 -0
- package/dist/types/modes/components/status-line/segments.d.ts +5 -0
- package/dist/types/modes/components/status-line/separators.d.ts +3 -0
- package/dist/types/modes/components/status-line/token-rate.d.ts +10 -0
- package/dist/types/modes/components/status-line/types.d.ts +80 -0
- package/dist/types/modes/components/status-line.d.ts +80 -0
- package/dist/types/modes/components/theme-selector.d.ts +10 -0
- package/dist/types/modes/components/thinking-selector.d.ts +10 -0
- package/dist/types/modes/components/todo-reminder.d.ts +13 -0
- package/dist/types/modes/components/tool-execution.d.ts +53 -0
- package/dist/types/modes/components/tree-selector.d.ts +31 -0
- package/dist/types/modes/components/ttsr-notification.d.ts +13 -0
- package/dist/types/modes/components/user-message-selector.d.ts +28 -0
- package/dist/types/modes/components/user-message.d.ts +7 -0
- package/dist/types/modes/components/visual-truncate.d.ts +19 -0
- package/dist/types/modes/components/welcome.d.ts +34 -0
- package/dist/types/modes/controllers/btw-controller.d.ts +10 -0
- package/dist/types/modes/controllers/command-controller-shared.d.ts +47 -0
- package/dist/types/modes/controllers/command-controller.d.ts +36 -0
- package/dist/types/modes/controllers/event-controller.d.ts +12 -0
- package/dist/types/modes/controllers/extension-ui-controller.d.ts +80 -0
- package/dist/types/modes/controllers/input-controller.d.ts +35 -0
- package/dist/types/modes/controllers/runtime-mcp-command-controller.d.ts +10 -0
- package/dist/types/modes/controllers/selector-controller.d.ts +46 -0
- package/dist/types/modes/controllers/ssh-command-controller.d.ts +10 -0
- package/dist/types/modes/controllers/todo-command-controller.d.ts +7 -0
- package/dist/types/modes/emoji-autocomplete.d.ts +16 -0
- package/dist/types/modes/index.d.ts +9 -0
- package/dist/types/modes/interactive-mode.d.ts +271 -0
- package/dist/types/modes/loop-limit.d.ts +22 -0
- package/dist/types/modes/oauth-manual-input.d.ts +8 -0
- package/dist/types/modes/print-mode.d.ts +27 -0
- package/dist/types/modes/prompt-action-autocomplete.d.ts +46 -0
- package/dist/types/modes/rpc/host-tools.d.ts +16 -0
- package/dist/types/modes/rpc/host-uris.d.ts +38 -0
- package/dist/types/modes/rpc/rpc-client.d.ts +249 -0
- package/dist/types/modes/rpc/rpc-mode.d.ts +17 -0
- package/dist/types/modes/rpc/rpc-types.d.ts +586 -0
- package/dist/types/modes/runtime-init.d.ts +21 -0
- package/dist/types/modes/session-observer-registry.d.ts +26 -0
- package/dist/types/modes/shared.d.ts +15 -0
- package/dist/types/modes/theme/defaults/index.d.ts +9559 -0
- package/dist/types/modes/theme/mermaid-cache.d.ts +9 -0
- package/dist/types/modes/theme/shimmer.d.ts +38 -0
- package/dist/types/modes/theme/theme.d.ts +273 -0
- package/dist/types/modes/types.d.ts +278 -0
- package/dist/types/modes/utils/context-usage.d.ts +47 -0
- package/dist/types/modes/utils/hotkeys-markdown.d.ts +5 -0
- package/dist/types/modes/utils/keybinding-matchers.d.ts +10 -0
- package/dist/types/modes/utils/tools-markdown.d.ts +5 -0
- package/dist/types/modes/utils/ui-helpers.d.ts +53 -0
- package/dist/types/plan-mode/approved-plan.d.ts +49 -0
- package/dist/types/plan-mode/state.d.ts +6 -0
- package/dist/types/registry/agent-registry.d.ts +62 -0
- package/dist/types/runtime-mcp/client.d.ts +74 -0
- package/dist/types/runtime-mcp/config-writer.d.ts +53 -0
- package/dist/types/runtime-mcp/config.d.ts +75 -0
- package/dist/types/runtime-mcp/discoverable-tool-metadata.d.ts +7 -0
- package/dist/types/runtime-mcp/index.d.ts +18 -0
- package/dist/types/runtime-mcp/json-rpc.d.ts +22 -0
- package/dist/types/runtime-mcp/loader.d.ts +43 -0
- package/dist/types/runtime-mcp/manager.d.ts +193 -0
- package/dist/types/runtime-mcp/oauth-discovery.d.ts +40 -0
- package/dist/types/runtime-mcp/oauth-flow.d.ts +59 -0
- package/dist/types/runtime-mcp/render.d.ts +25 -0
- package/dist/types/runtime-mcp/smithery-auth.d.ts +16 -0
- package/dist/types/runtime-mcp/smithery-connect.d.ts +38 -0
- package/dist/types/runtime-mcp/smithery-registry.d.ts +51 -0
- package/dist/types/runtime-mcp/tool-bridge.d.ts +86 -0
- package/dist/types/runtime-mcp/tool-cache.d.ts +8 -0
- package/dist/types/runtime-mcp/transports/http.d.ts +36 -0
- package/dist/types/runtime-mcp/transports/index.d.ts +5 -0
- package/dist/types/runtime-mcp/transports/stdio.d.ts +32 -0
- package/dist/types/runtime-mcp/types.d.ts +333 -0
- package/dist/types/sdk.d.ts +216 -0
- package/dist/types/secrets/index.d.ts +9 -0
- package/dist/types/secrets/obfuscator.d.ts +23 -0
- package/dist/types/secrets/regex.d.ts +2 -0
- package/dist/types/session/agent-session.d.ts +930 -0
- package/dist/types/session/agent-storage.d.ts +100 -0
- package/dist/types/session/artifacts.d.ts +61 -0
- package/dist/types/session/auth-broker-config.d.ts +13 -0
- package/dist/types/session/auth-storage.d.ts +6 -0
- package/dist/types/session/blob-store.d.ts +63 -0
- package/dist/types/session/client-bridge.d.ts +88 -0
- package/dist/types/session/history-storage.d.ts +16 -0
- package/dist/types/session/messages.d.ts +162 -0
- package/dist/types/session/session-dump-format.d.ts +22 -0
- package/dist/types/session/session-manager.d.ts +549 -0
- package/dist/types/session/session-storage.d.ts +82 -0
- package/dist/types/session/streaming-output.d.ts +185 -0
- package/dist/types/session/tool-choice-queue.d.ts +78 -0
- package/dist/types/session/yield-queue.d.ts +24 -0
- package/dist/types/setup/model-onboarding-guidance.d.ts +8 -0
- package/dist/types/setup/provider-onboarding.d.ts +28 -0
- package/dist/types/skill-state/active-state.d.ts +50 -0
- package/dist/types/slash-commands/acp-builtins.d.ts +18 -0
- package/dist/types/slash-commands/builtin-registry.d.ts +23 -0
- package/dist/types/slash-commands/helpers/context-report.d.ts +7 -0
- package/dist/types/slash-commands/helpers/format.d.ts +10 -0
- package/dist/types/slash-commands/helpers/mcp.d.ts +3 -0
- package/dist/types/slash-commands/helpers/parse.d.ts +33 -0
- package/dist/types/slash-commands/helpers/ssh.d.ts +3 -0
- package/dist/types/slash-commands/helpers/todo.d.ts +3 -0
- package/dist/types/slash-commands/helpers/usage-report.d.ts +7 -0
- package/dist/types/slash-commands/types.d.ts +118 -0
- package/dist/types/ssh/config-writer.d.ts +49 -0
- package/dist/types/ssh/connection-manager.d.ts +33 -0
- package/dist/types/ssh/ssh-executor.d.ts +37 -0
- package/dist/types/ssh/sshfs-mount.d.ts +6 -0
- package/dist/types/ssh/utils.d.ts +2 -0
- package/dist/types/stt/downloader.d.ts +9 -0
- package/dist/types/stt/index.d.ts +3 -0
- package/dist/types/stt/recorder.d.ts +13 -0
- package/dist/types/stt/setup.d.ts +18 -0
- package/dist/types/stt/stt-controller.d.ts +16 -0
- package/dist/types/stt/transcriber.d.ts +16 -0
- package/dist/types/system-prompt.d.ts +93 -0
- package/dist/types/task/agents.d.ts +28 -0
- package/dist/types/task/commands.d.ts +35 -0
- package/dist/types/task/discovery.d.ts +19 -0
- package/dist/types/task/executor.d.ts +106 -0
- package/dist/types/task/gjc-command.d.ts +7 -0
- package/dist/types/task/index.d.ts +38 -0
- package/dist/types/task/name-generator.d.ts +16 -0
- package/dist/types/task/output-manager.d.ts +36 -0
- package/dist/types/task/parallel.d.ts +34 -0
- package/dist/types/task/render.d.ts +22 -0
- package/dist/types/task/simple-mode.d.ts +8 -0
- package/dist/types/task/subprocess-tool-registry.d.ts +72 -0
- package/dist/types/task/types.d.ts +295 -0
- package/dist/types/task/worktree.d.ts +94 -0
- package/dist/types/thinking.d.ts +30 -0
- package/dist/types/tool-discovery/tool-index.d.ts +112 -0
- package/dist/types/tools/archive-reader.d.ts +40 -0
- package/dist/types/tools/ask.d.ts +109 -0
- package/dist/types/tools/ast-edit.d.ts +77 -0
- package/dist/types/tools/ast-grep.d.ts +69 -0
- package/dist/types/tools/auto-generated-guard.d.ts +17 -0
- package/dist/types/tools/bash-command-fixup.d.ts +11 -0
- package/dist/types/tools/bash-interactive.d.ts +16 -0
- package/dist/types/tools/bash-interceptor.d.ts +24 -0
- package/dist/types/tools/bash-pty-selection.d.ts +7 -0
- package/dist/types/tools/bash-skill-urls.d.ts +31 -0
- package/dist/types/tools/bash.d.ts +130 -0
- package/dist/types/tools/browser/attach.d.ts +34 -0
- package/dist/types/tools/browser/launch.d.ts +62 -0
- package/dist/types/tools/browser/readable.d.ts +17 -0
- package/dist/types/tools/browser/registry.d.ts +42 -0
- package/dist/types/tools/browser/render.d.ts +50 -0
- package/dist/types/tools/browser/tab-protocol.d.ts +144 -0
- package/dist/types/tools/browser/tab-supervisor.d.ts +63 -0
- package/dist/types/tools/browser/tab-worker-entry.d.ts +1 -0
- package/dist/types/tools/browser/tab-worker.d.ts +19 -0
- package/dist/types/tools/browser.d.ts +114 -0
- package/dist/types/tools/calculator.d.ts +76 -0
- package/dist/types/tools/checkpoint.d.ts +63 -0
- package/dist/types/tools/conflict-detect.d.ts +205 -0
- package/dist/types/tools/context.d.ts +19 -0
- package/dist/types/tools/debug.d.ts +209 -0
- package/dist/types/tools/eval.d.ts +108 -0
- package/dist/types/tools/fetch.d.ts +61 -0
- package/dist/types/tools/file-recorder.d.ts +13 -0
- package/dist/types/tools/find.d.ts +95 -0
- package/dist/types/tools/fs-cache-invalidation.d.ts +15 -0
- package/dist/types/tools/gh-format.d.ts +6 -0
- package/dist/types/tools/gh-renderer.d.ts +25 -0
- package/dist/types/tools/gh.d.ts +356 -0
- package/dist/types/tools/github-cache.d.ts +103 -0
- package/dist/types/tools/grouped-file-output.d.ts +36 -0
- package/dist/types/tools/hindsight-recall.d.ts +23 -0
- package/dist/types/tools/hindsight-reflect.d.ts +25 -0
- package/dist/types/tools/hindsight-retain.d.ts +29 -0
- package/dist/types/tools/image-gen.d.ts +78 -0
- package/dist/types/tools/index.d.ts +242 -0
- package/dist/types/tools/inspect-image-renderer.d.ts +26 -0
- package/dist/types/tools/inspect-image.d.ts +31 -0
- package/dist/types/tools/irc.d.ts +79 -0
- package/dist/types/tools/job.d.ts +65 -0
- package/dist/types/tools/json-tree.d.ts +23 -0
- package/dist/types/tools/jtd-to-json-schema.d.ts +29 -0
- package/dist/types/tools/jtd-to-typescript.d.ts +26 -0
- package/dist/types/tools/jtd-utils.d.ts +42 -0
- package/dist/types/tools/list-limit.d.ts +12 -0
- package/dist/types/tools/match-line-format.d.ts +11 -0
- package/dist/types/tools/output-meta.d.ts +204 -0
- package/dist/types/tools/path-utils.d.ts +146 -0
- package/dist/types/tools/plan-mode-guard.d.ts +18 -0
- package/dist/types/tools/read.d.ts +85 -0
- package/dist/types/tools/recipe/index.d.ts +45 -0
- package/dist/types/tools/recipe/render.d.ts +36 -0
- package/dist/types/tools/recipe/runner.d.ts +60 -0
- package/dist/types/tools/recipe/runners/cargo.d.ts +16 -0
- package/dist/types/tools/recipe/runners/index.d.ts +2 -0
- package/dist/types/tools/recipe/runners/just.d.ts +2 -0
- package/dist/types/tools/recipe/runners/make.d.ts +2 -0
- package/dist/types/tools/recipe/runners/pkg.d.ts +2 -0
- package/dist/types/tools/recipe/runners/task.d.ts +2 -0
- package/dist/types/tools/render-mermaid.d.ts +37 -0
- package/dist/types/tools/render-utils.d.ts +158 -0
- package/dist/types/tools/renderers.d.ts +26 -0
- package/dist/types/tools/resolve.d.ts +90 -0
- package/dist/types/tools/review.d.ts +63 -0
- package/dist/types/tools/search-tool-bm25.d.ts +65 -0
- package/dist/types/tools/search.d.ts +93 -0
- package/dist/types/tools/sqlite-reader.d.ts +93 -0
- package/dist/types/tools/ssh.d.ts +67 -0
- package/dist/types/tools/subagent.d.ts +58 -0
- package/dist/types/tools/todo-write.d.ts +120 -0
- package/dist/types/tools/tool-errors.d.ts +33 -0
- package/dist/types/tools/tool-result.d.ts +30 -0
- package/dist/types/tools/tool-timeouts.d.ts +51 -0
- package/dist/types/tools/vim.d.ts +58 -0
- package/dist/types/tools/write.d.ts +59 -0
- package/dist/types/tools/yield.d.ts +25 -0
- package/dist/types/tui/code-cell.d.ts +32 -0
- package/dist/types/tui/file-list.d.ts +22 -0
- package/dist/types/tui/hyperlink.d.ts +42 -0
- package/dist/types/tui/index.d.ts +11 -0
- package/dist/types/tui/output-block.d.ts +28 -0
- package/dist/types/tui/status-line.d.ts +18 -0
- package/dist/types/tui/tree-list.d.ts +19 -0
- package/dist/types/tui/types.d.ts +13 -0
- package/dist/types/tui/utils.d.ts +36 -0
- package/dist/types/utils/changelog.d.ts +20 -0
- package/dist/types/utils/clipboard.d.ts +22 -0
- package/dist/types/utils/command-args.d.ts +9 -0
- package/dist/types/utils/commit-message-generator.d.ts +7 -0
- package/dist/types/utils/edit-mode.d.ts +13 -0
- package/dist/types/utils/event-bus.d.ts +6 -0
- package/dist/types/utils/external-editor.d.ts +17 -0
- package/dist/types/utils/file-display-mode.d.ts +27 -0
- package/dist/types/utils/file-mentions.d.ts +11 -0
- package/dist/types/utils/git.d.ts +361 -0
- package/dist/types/utils/image-loading.d.ts +26 -0
- package/dist/types/utils/image-resize.d.ts +39 -0
- package/dist/types/utils/lang-from-path.d.ts +8 -0
- package/dist/types/utils/markit.d.ts +7 -0
- package/dist/types/utils/open.d.ts +2 -0
- package/dist/types/utils/session-color.d.ts +10 -0
- package/dist/types/utils/shell-snapshot.d.ts +5 -0
- package/dist/types/utils/sixel.d.ts +21 -0
- package/dist/types/utils/title-generator.d.ts +31 -0
- package/dist/types/utils/tool-choice.d.ts +7 -0
- package/dist/types/utils/tools-manager.d.ts +9 -0
- package/dist/types/vim/buffer.d.ts +41 -0
- package/dist/types/vim/commands.d.ts +6 -0
- package/dist/types/vim/engine.d.ts +47 -0
- package/dist/types/vim/parser.d.ts +3 -0
- package/dist/types/vim/render.d.ts +25 -0
- package/dist/types/vim/types.d.ts +182 -0
- package/dist/types/web/kagi.d.ts +23 -0
- package/dist/types/web/parallel.d.ts +58 -0
- package/dist/types/web/scrapers/artifacthub.d.ts +6 -0
- package/dist/types/web/scrapers/arxiv.d.ts +5 -0
- package/dist/types/web/scrapers/aur.d.ts +5 -0
- package/dist/types/web/scrapers/biorxiv.d.ts +5 -0
- package/dist/types/web/scrapers/bluesky.d.ts +5 -0
- package/dist/types/web/scrapers/brew.d.ts +5 -0
- package/dist/types/web/scrapers/cheatsh.d.ts +8 -0
- package/dist/types/web/scrapers/chocolatey.d.ts +5 -0
- package/dist/types/web/scrapers/choosealicense.d.ts +2 -0
- package/dist/types/web/scrapers/cisa-kev.d.ts +5 -0
- package/dist/types/web/scrapers/clojars.d.ts +5 -0
- package/dist/types/web/scrapers/coingecko.d.ts +5 -0
- package/dist/types/web/scrapers/crates-io.d.ts +5 -0
- package/dist/types/web/scrapers/crossref.d.ts +2 -0
- package/dist/types/web/scrapers/devto.d.ts +5 -0
- package/dist/types/web/scrapers/discogs.d.ts +8 -0
- package/dist/types/web/scrapers/discourse.d.ts +5 -0
- package/dist/types/web/scrapers/dockerhub.d.ts +5 -0
- package/dist/types/web/scrapers/docs-rs.d.ts +2 -0
- package/dist/types/web/scrapers/fdroid.d.ts +5 -0
- package/dist/types/web/scrapers/firefox-addons.d.ts +2 -0
- package/dist/types/web/scrapers/flathub.d.ts +2 -0
- package/dist/types/web/scrapers/github-gist.d.ts +5 -0
- package/dist/types/web/scrapers/github.d.ts +12 -0
- package/dist/types/web/scrapers/gitlab.d.ts +5 -0
- package/dist/types/web/scrapers/go-pkg.d.ts +5 -0
- package/dist/types/web/scrapers/hackage.d.ts +5 -0
- package/dist/types/web/scrapers/hackernews.d.ts +2 -0
- package/dist/types/web/scrapers/hex.d.ts +5 -0
- package/dist/types/web/scrapers/huggingface.d.ts +2 -0
- package/dist/types/web/scrapers/iacr.d.ts +5 -0
- package/dist/types/web/scrapers/index.d.ts +84 -0
- package/dist/types/web/scrapers/jetbrains-marketplace.d.ts +2 -0
- package/dist/types/web/scrapers/lemmy.d.ts +2 -0
- package/dist/types/web/scrapers/lobsters.d.ts +5 -0
- package/dist/types/web/scrapers/mastodon.d.ts +5 -0
- package/dist/types/web/scrapers/maven.d.ts +6 -0
- package/dist/types/web/scrapers/mdn.d.ts +2 -0
- package/dist/types/web/scrapers/metacpan.d.ts +5 -0
- package/dist/types/web/scrapers/musicbrainz.d.ts +5 -0
- package/dist/types/web/scrapers/npm.d.ts +5 -0
- package/dist/types/web/scrapers/nuget.d.ts +5 -0
- package/dist/types/web/scrapers/nvd.d.ts +5 -0
- package/dist/types/web/scrapers/ollama.d.ts +2 -0
- package/dist/types/web/scrapers/open-vsx.d.ts +5 -0
- package/dist/types/web/scrapers/opencorporates.d.ts +5 -0
- package/dist/types/web/scrapers/openlibrary.d.ts +5 -0
- package/dist/types/web/scrapers/orcid.d.ts +5 -0
- package/dist/types/web/scrapers/osv.d.ts +5 -0
- package/dist/types/web/scrapers/packagist.d.ts +5 -0
- package/dist/types/web/scrapers/pub-dev.d.ts +5 -0
- package/dist/types/web/scrapers/pubmed.d.ts +5 -0
- package/dist/types/web/scrapers/pypi.d.ts +5 -0
- package/dist/types/web/scrapers/rawg.d.ts +2 -0
- package/dist/types/web/scrapers/readthedocs.d.ts +2 -0
- package/dist/types/web/scrapers/reddit.d.ts +5 -0
- package/dist/types/web/scrapers/repology.d.ts +5 -0
- package/dist/types/web/scrapers/rfc.d.ts +5 -0
- package/dist/types/web/scrapers/rubygems.d.ts +5 -0
- package/dist/types/web/scrapers/searchcode.d.ts +2 -0
- package/dist/types/web/scrapers/sec-edgar.d.ts +5 -0
- package/dist/types/web/scrapers/semantic-scholar.d.ts +2 -0
- package/dist/types/web/scrapers/snapcraft.d.ts +2 -0
- package/dist/types/web/scrapers/sourcegraph.d.ts +2 -0
- package/dist/types/web/scrapers/spdx.d.ts +5 -0
- package/dist/types/web/scrapers/spotify.d.ts +8 -0
- package/dist/types/web/scrapers/stackoverflow.d.ts +6 -0
- package/dist/types/web/scrapers/terraform.d.ts +5 -0
- package/dist/types/web/scrapers/tldr.d.ts +7 -0
- package/dist/types/web/scrapers/twitter.d.ts +5 -0
- package/dist/types/web/scrapers/types.d.ts +78 -0
- package/dist/types/web/scrapers/utils.d.ts +26 -0
- package/dist/types/web/scrapers/vimeo.d.ts +5 -0
- package/dist/types/web/scrapers/vscode-marketplace.d.ts +5 -0
- package/dist/types/web/scrapers/w3c.d.ts +2 -0
- package/dist/types/web/scrapers/wikidata.d.ts +5 -0
- package/dist/types/web/scrapers/wikipedia.d.ts +5 -0
- package/dist/types/web/scrapers/youtube.d.ts +5 -0
- package/dist/types/web/search/index.d.ts +84 -0
- package/dist/types/web/search/provider.d.ts +21 -0
- package/dist/types/web/search/providers/anthropic.d.ts +32 -0
- package/dist/types/web/search/providers/base.d.ts +67 -0
- package/dist/types/web/search/providers/brave.d.ts +27 -0
- package/dist/types/web/search/providers/codex.d.ts +35 -0
- package/dist/types/web/search/providers/exa.d.ts +52 -0
- package/dist/types/web/search/providers/gemini.d.ts +57 -0
- package/dist/types/web/search/providers/jina.d.ts +26 -0
- package/dist/types/web/search/providers/kagi.d.ts +24 -0
- package/dist/types/web/search/providers/kimi.d.ts +27 -0
- package/dist/types/web/search/providers/parallel.d.ts +15 -0
- package/dist/types/web/search/providers/perplexity.d.ts +38 -0
- package/dist/types/web/search/providers/searxng.d.ts +44 -0
- package/dist/types/web/search/providers/synthetic.d.ts +21 -0
- package/dist/types/web/search/providers/tavily.d.ts +29 -0
- package/dist/types/web/search/providers/utils.d.ts +52 -0
- package/dist/types/web/search/providers/zai.d.ts +28 -0
- package/dist/types/web/search/render.d.ts +35 -0
- package/dist/types/web/search/types.d.ts +344 -0
- package/dist/types/web/search/utils.d.ts +4 -0
- package/dist/types/workspace-tree.d.ts +42 -0
- package/examples/README.md +21 -0
- package/examples/custom-tools/README.md +104 -0
- package/examples/custom-tools/hello/index.ts +20 -0
- package/examples/extensions/README.md +141 -0
- package/examples/extensions/api-demo.ts +79 -0
- package/examples/extensions/chalk-logger.ts +25 -0
- package/examples/extensions/hello.ts +31 -0
- package/examples/extensions/pirate.ts +43 -0
- package/examples/extensions/plan-mode.ts +549 -0
- package/examples/extensions/reload-runtime.ts +38 -0
- package/examples/extensions/tools.ts +144 -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 +46 -0
- package/examples/sdk/04-skills.ts +43 -0
- package/examples/sdk/06-extensions.ts +82 -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 +533 -0
- package/scripts/build-binary.ts +77 -0
- package/scripts/format-prompts.ts +68 -0
- package/scripts/generate-docs-index.ts +71 -0
- package/scripts/generate-template.ts +33 -0
- package/src/async/index.ts +2 -0
- package/src/async/job-manager.ts +586 -0
- package/src/async/support.ts +6 -0
- package/src/autoresearch/command-resume.md +14 -0
- package/src/autoresearch/dashboard.ts +446 -0
- package/src/autoresearch/git.ts +319 -0
- package/src/autoresearch/helpers.ts +218 -0
- package/src/autoresearch/index.ts +536 -0
- package/src/autoresearch/prompt-setup.md +43 -0
- package/src/autoresearch/prompt.md +103 -0
- package/src/autoresearch/resume-message.md +10 -0
- package/src/autoresearch/state.ts +273 -0
- package/src/autoresearch/storage.ts +699 -0
- package/src/autoresearch/tools/init-experiment.ts +272 -0
- package/src/autoresearch/tools/log-experiment.ts +524 -0
- package/src/autoresearch/tools/run-experiment.ts +475 -0
- package/src/autoresearch/tools/update-notes.ts +109 -0
- package/src/autoresearch/types.ts +168 -0
- package/src/bun-imports.d.ts +28 -0
- package/src/capability/context-file.ts +44 -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 +436 -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 +244 -0
- package/src/capability/settings.ts +34 -0
- package/src/capability/skill.ts +56 -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 +269 -0
- package/src/cli/auth-broker-cli.ts +746 -0
- package/src/cli/auth-gateway-cli.ts +411 -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 +123 -0
- package/src/cli/grep-cli.ts +160 -0
- package/src/cli/initial-message.ts +58 -0
- package/src/cli/list-models.ts +194 -0
- package/src/cli/plugin-cli.ts +942 -0
- package/src/cli/read-cli.ts +57 -0
- package/src/cli/session-picker.ts +52 -0
- package/src/cli/setup-cli.ts +433 -0
- package/src/cli/shell-cli.ts +176 -0
- package/src/cli/ssh-cli.ts +179 -0
- package/src/cli/stats-cli.ts +238 -0
- package/src/cli/update-cli.ts +408 -0
- package/src/cli/web-search-cli.ts +133 -0
- package/src/cli/worktree-cli.ts +291 -0
- package/src/cli.ts +99 -0
- package/src/commands/acp.ts +24 -0
- package/src/commands/agents.ts +57 -0
- package/src/commands/auth-broker.ts +96 -0
- package/src/commands/auth-gateway.ts +63 -0
- package/src/commands/codex-native-hook.ts +11 -0
- package/src/commands/commit.ts +46 -0
- package/src/commands/config.ts +51 -0
- package/src/commands/deep-interview.ts +12 -0
- package/src/commands/gjc-runtime-bridge.ts +81 -0
- package/src/commands/grep.ts +48 -0
- package/src/commands/launch.ts +161 -0
- package/src/commands/plugin.ts +78 -0
- package/src/commands/question.ts +12 -0
- package/src/commands/ralplan.ts +12 -0
- package/src/commands/read.ts +35 -0
- package/src/commands/setup.ts +52 -0
- package/src/commands/shell.ts +29 -0
- package/src/commands/ssh.ts +60 -0
- package/src/commands/state.ts +12 -0
- package/src/commands/stats.ts +29 -0
- package/src/commands/team.ts +130 -0
- package/src/commands/ultragoal.ts +32 -0
- package/src/commands/update.ts +21 -0
- package/src/commands/web-search.ts +42 -0
- package/src/commands/worktree.ts +56 -0
- package/src/commit/agentic/agent.ts +316 -0
- package/src/commit/agentic/fallback.ts +96 -0
- package/src/commit/agentic/index.ts +355 -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 +144 -0
- package/src/commit/agentic/tools/propose-commit.ts +109 -0
- package/src/commit/agentic/tools/recent-commits.ts +81 -0
- package/src/commit/agentic/tools/schemas.ts +23 -0
- package/src/commit/agentic/tools/split-commit.ts +238 -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 +64 -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 +97 -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 +49 -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 +243 -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/shared-llm.ts +77 -0
- package/src/commit/types.ts +118 -0
- package/src/commit/utils/exclusions.ts +42 -0
- package/src/commit/utils.ts +58 -0
- package/src/config/config-file.ts +232 -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 +811 -0
- package/src/config/model-registry.ts +2384 -0
- package/src/config/model-resolver.ts +1398 -0
- package/src/config/models-config-schema.ts +175 -0
- package/src/config/prompt-templates.ts +310 -0
- package/src/config/resolve-config-value.ts +94 -0
- package/src/config/settings-schema.ts +2939 -0
- package/src/config/settings.ts +919 -0
- package/src/config/skill-settings-defaults.ts +27 -0
- package/src/config.ts +212 -0
- package/src/cursor.ts +350 -0
- package/src/dap/client.ts +675 -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 +1306 -0
- package/src/dap/types.ts +600 -0
- package/src/debug/index.ts +459 -0
- package/src/debug/log-formatting.ts +58 -0
- package/src/debug/log-viewer.ts +908 -0
- package/src/debug/profiler.ts +162 -0
- package/src/debug/raw-sse-buffer.ts +270 -0
- package/src/debug/raw-sse.ts +213 -0
- package/src/debug/report-bundle.ts +365 -0
- package/src/debug/system-info.ts +111 -0
- package/src/defaults/gjc/skills/deep-interview/SKILL.md +795 -0
- package/src/defaults/gjc/skills/ralplan/SKILL.md +142 -0
- package/src/defaults/gjc/skills/team/SKILL.md +373 -0
- package/src/defaults/gjc/skills/ultragoal/SKILL.md +176 -0
- package/src/defaults/gjc-defaults.ts +151 -0
- package/src/discovery/agents-md.ts +67 -0
- package/src/discovery/agents.ts +230 -0
- package/src/discovery/builtin.ts +932 -0
- package/src/discovery/claude-plugins.ts +387 -0
- package/src/discovery/claude.ts +313 -0
- package/src/discovery/cline.ts +83 -0
- package/src/discovery/codex.ts +330 -0
- package/src/discovery/cursor.ts +220 -0
- package/src/discovery/gemini.ts +383 -0
- package/src/discovery/github.ts +118 -0
- package/src/discovery/helpers.ts +964 -0
- package/src/discovery/index.ts +76 -0
- package/src/discovery/mcp-json.ts +171 -0
- package/src/discovery/opencode.ts +398 -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/apply-patch/index.ts +87 -0
- package/src/edit/apply-patch/parser.ts +174 -0
- package/src/edit/diff.ts +810 -0
- package/src/edit/file-read-cache.ts +95 -0
- package/src/edit/index.ts +528 -0
- package/src/edit/modes/apply-patch.lark +19 -0
- package/src/edit/modes/apply-patch.ts +53 -0
- package/src/edit/modes/patch.ts +1835 -0
- package/src/edit/modes/replace.ts +1103 -0
- package/src/edit/normalize.ts +375 -0
- package/src/edit/notebook.ts +222 -0
- package/src/edit/read-file.ts +25 -0
- package/src/edit/renderer.ts +683 -0
- package/src/edit/streaming.ts +561 -0
- package/src/eval/backend.ts +43 -0
- package/src/eval/index.ts +4 -0
- package/src/eval/js/context-manager.ts +414 -0
- package/src/eval/js/executor.ts +134 -0
- package/src/eval/js/index.ts +46 -0
- package/src/eval/js/shared/helpers.ts +237 -0
- package/src/eval/js/shared/indirect-eval.ts +30 -0
- package/src/eval/js/shared/prelude.ts +2 -0
- package/src/eval/js/shared/prelude.txt +70 -0
- package/src/eval/js/shared/rewrite-imports.ts +416 -0
- package/src/eval/js/shared/runtime.ts +301 -0
- package/src/eval/js/shared/types.ts +18 -0
- package/src/eval/js/tool-bridge.ts +144 -0
- package/src/eval/js/worker-core.ts +146 -0
- package/src/eval/js/worker-entry.ts +24 -0
- package/src/eval/js/worker-protocol.ts +41 -0
- package/src/eval/py/display.ts +71 -0
- package/src/eval/py/executor.ts +602 -0
- package/src/eval/py/index.ts +58 -0
- package/src/eval/py/kernel.ts +668 -0
- package/src/eval/py/prelude.py +462 -0
- package/src/eval/py/prelude.ts +3 -0
- package/src/eval/py/runner.py +910 -0
- package/src/eval/py/runtime.ts +210 -0
- package/src/eval/py/tool-bridge.ts +137 -0
- package/src/eval/types.ts +48 -0
- package/src/exa/factory.ts +60 -0
- package/src/exa/index.ts +27 -0
- package/src/exa/mcp-client.ts +364 -0
- package/src/exa/render.ts +244 -0
- package/src/exa/researcher.ts +36 -0
- package/src/exa/search.ts +47 -0
- package/src/exa/types.ts +166 -0
- package/src/exa/websets.ts +248 -0
- package/src/exec/bash-executor.ts +309 -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 +164 -0
- package/src/export/html/template.css +1060 -0
- package/src/export/html/template.generated.ts +2 -0
- package/src/export/html/template.html +47 -0
- package/src/export/html/template.js +2268 -0
- package/src/export/html/template.macro.ts +25 -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 +238 -0
- package/src/extensibility/custom-commands/types.ts +113 -0
- package/src/extensibility/custom-tools/index.ts +7 -0
- package/src/extensibility/custom-tools/loader.ts +245 -0
- package/src/extensibility/custom-tools/types.ts +254 -0
- package/src/extensibility/custom-tools/wrapper.ts +47 -0
- package/src/extensibility/extensions/compact-handler.ts +40 -0
- package/src/extensibility/extensions/get-commands-handler.ts +80 -0
- package/src/extensibility/extensions/index.ts +15 -0
- package/src/extensibility/extensions/loader.ts +545 -0
- package/src/extensibility/extensions/runner.ts +900 -0
- package/src/extensibility/extensions/types.ts +1259 -0
- package/src/extensibility/extensions/wrapper.ts +189 -0
- package/src/extensibility/hooks/index.ts +5 -0
- package/src/extensibility/hooks/loader.ts +257 -0
- package/src/extensibility/hooks/runner.ts +425 -0
- package/src/extensibility/hooks/tool-wrapper.ts +107 -0
- package/src/extensibility/hooks/types.ts +599 -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/legacy-pi-compat.ts +336 -0
- package/src/extensibility/plugins/loader.ts +288 -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 +317 -0
- package/src/extensibility/plugins/marketplace/index.ts +6 -0
- package/src/extensibility/plugins/marketplace/manager.ts +770 -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 +191 -0
- package/src/extensibility/plugins/parser.ts +105 -0
- package/src/extensibility/plugins/types.ts +194 -0
- package/src/extensibility/shared-events.ts +343 -0
- package/src/extensibility/skills.ts +391 -0
- package/src/extensibility/slash-commands.ts +227 -0
- package/src/extensibility/tool-proxy.ts +25 -0
- package/src/extensibility/typebox.ts +418 -0
- package/src/extensibility/utils.ts +44 -0
- package/src/gjc-runtime/goal-mode-request.ts +212 -0
- package/src/gjc-runtime/launch-tmux.ts +162 -0
- package/src/gjc-runtime/launch-worktree.ts +291 -0
- package/src/gjc-runtime/team-runtime.ts +2025 -0
- package/src/gjc-runtime/ultragoal-runtime.ts +564 -0
- package/src/goals/index.ts +3 -0
- package/src/goals/runtime.ts +524 -0
- package/src/goals/state.ts +37 -0
- package/src/goals/tools/goal-tool.ts +371 -0
- package/src/hashline/anchors.ts +113 -0
- package/src/hashline/apply.ts +737 -0
- package/src/hashline/bigrams.json +649 -0
- package/src/hashline/constants.ts +25 -0
- package/src/hashline/diff-preview.ts +43 -0
- package/src/hashline/diff.ts +56 -0
- package/src/hashline/execute.ts +267 -0
- package/src/hashline/grammar.lark +21 -0
- package/src/hashline/hash.ts +173 -0
- package/src/hashline/index.ts +13 -0
- package/src/hashline/input.ts +130 -0
- package/src/hashline/parser.ts +246 -0
- package/src/hashline/prefixes.ts +101 -0
- package/src/hashline/recovery.ts +113 -0
- package/src/hashline/stream.ts +123 -0
- package/src/hashline/types.ts +68 -0
- package/src/hindsight/backend.ts +205 -0
- package/src/hindsight/bank.ts +131 -0
- package/src/hindsight/client.ts +598 -0
- package/src/hindsight/config.ts +175 -0
- package/src/hindsight/content.ts +210 -0
- package/src/hindsight/index.ts +8 -0
- package/src/hindsight/mental-models.ts +382 -0
- package/src/hindsight/seeds.json +32 -0
- package/src/hindsight/state.ts +469 -0
- package/src/hindsight/transcript.ts +71 -0
- package/src/hooks/codex-native-hooks-config.ts +143 -0
- package/src/hooks/native-skill-hook.ts +279 -0
- package/src/hooks/skill-keywords.ts +86 -0
- package/src/hooks/skill-state.ts +416 -0
- package/src/index.ts +56 -0
- package/src/internal-urls/agent-protocol.ts +129 -0
- package/src/internal-urls/artifact-protocol.ts +80 -0
- package/src/internal-urls/docs-index.generated.ts +81 -0
- package/src/internal-urls/gjc-protocol.ts +83 -0
- package/src/internal-urls/index.ts +21 -0
- package/src/internal-urls/issue-pr-protocol.ts +577 -0
- package/src/internal-urls/json-query.ts +126 -0
- package/src/internal-urls/local-protocol.ts +249 -0
- package/src/internal-urls/mcp-protocol.ts +151 -0
- package/src/internal-urls/memory-protocol.ts +164 -0
- package/src/internal-urls/parse.ts +72 -0
- package/src/internal-urls/registry-helpers.ts +25 -0
- package/src/internal-urls/router.ts +78 -0
- package/src/internal-urls/rule-protocol.ts +38 -0
- package/src/internal-urls/skill-protocol.ts +103 -0
- package/src/internal-urls/types.ts +110 -0
- package/src/lsp/client.ts +951 -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 +492 -0
- package/src/lsp/defaults.json +493 -0
- package/src/lsp/edits.ts +166 -0
- package/src/lsp/index.ts +2282 -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 +443 -0
- package/src/lsp/utils.ts +678 -0
- package/src/main.ts +961 -0
- package/src/memories/index.ts +1135 -0
- package/src/memories/storage.ts +577 -0
- package/src/memory-backend/index.ts +4 -0
- package/src/memory-backend/local-backend.ts +30 -0
- package/src/memory-backend/off-backend.ts +16 -0
- package/src/memory-backend/resolve.ts +24 -0
- package/src/memory-backend/types.ts +79 -0
- package/src/modes/acp/acp-agent.ts +2170 -0
- package/src/modes/acp/acp-client-bridge.ts +154 -0
- package/src/modes/acp/acp-event-mapper.ts +879 -0
- package/src/modes/acp/acp-mode.ts +23 -0
- package/src/modes/acp/index.ts +2 -0
- package/src/modes/acp/terminal-auth.ts +37 -0
- package/src/modes/components/agent-dashboard.ts +1120 -0
- package/src/modes/components/assistant-message.ts +231 -0
- package/src/modes/components/bash-execution.ts +228 -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 +104 -0
- package/src/modes/components/compaction-summary-message.ts +51 -0
- package/src/modes/components/countdown-timer.ts +75 -0
- package/src/modes/components/custom-editor.ts +237 -0
- package/src/modes/components/custom-message.ts +65 -0
- package/src/modes/components/diff.ts +266 -0
- package/src/modes/components/dynamic-border.ts +25 -0
- package/src/modes/components/eval-execution.ts +164 -0
- package/src/modes/components/execution-shared.ts +102 -0
- package/src/modes/components/extensions/extension-dashboard.ts +350 -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 +628 -0
- package/src/modes/components/extensions/types.ts +191 -0
- package/src/modes/components/footer.ts +270 -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 +79 -0
- package/src/modes/components/hook-message.ts +68 -0
- package/src/modes/components/hook-selector.ts +190 -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/message-frame.ts +88 -0
- package/src/modes/components/model-selector.ts +794 -0
- package/src/modes/components/oauth-selector.ts +248 -0
- package/src/modes/components/plugin-selector.ts +95 -0
- package/src/modes/components/plugin-settings.ts +488 -0
- package/src/modes/components/provider-onboarding-selector.ts +88 -0
- package/src/modes/components/queue-mode-selector.ts +56 -0
- package/src/modes/components/read-tool-group.ts +267 -0
- package/src/modes/components/runtime-mcp-add-wizard.ts +1341 -0
- package/src/modes/components/session-observer-overlay.ts +839 -0
- package/src/modes/components/session-selector.ts +343 -0
- package/src/modes/components/settings-defs.ts +175 -0
- package/src/modes/components/settings-selector.ts +635 -0
- package/src/modes/components/show-images-selector.ts +45 -0
- package/src/modes/components/skill-hud/render.ts +47 -0
- package/src/modes/components/skill-message.ts +90 -0
- package/src/modes/components/status-line/context-thresholds.ts +68 -0
- package/src/modes/components/status-line/git-utils.ts +42 -0
- package/src/modes/components/status-line/index.ts +4 -0
- package/src/modes/components/status-line/presets.ts +105 -0
- package/src/modes/components/status-line/segments.ts +560 -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 +93 -0
- package/src/modes/components/status-line.ts +839 -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 +40 -0
- package/src/modes/components/tool-execution.ts +830 -0
- package/src/modes/components/tree-selector.ts +930 -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 +51 -0
- package/src/modes/components/visual-truncate.ts +63 -0
- package/src/modes/components/welcome.ts +389 -0
- package/src/modes/controllers/btw-controller.ts +105 -0
- package/src/modes/controllers/command-controller-shared.ts +108 -0
- package/src/modes/controllers/command-controller.ts +1630 -0
- package/src/modes/controllers/event-controller.ts +786 -0
- package/src/modes/controllers/extension-ui-controller.ts +927 -0
- package/src/modes/controllers/input-controller.ts +858 -0
- package/src/modes/controllers/runtime-mcp-command-controller.ts +1934 -0
- package/src/modes/controllers/selector-controller.ts +1039 -0
- package/src/modes/controllers/ssh-command-controller.ts +384 -0
- package/src/modes/controllers/todo-command-controller.ts +485 -0
- package/src/modes/data/emojis.json +1 -0
- package/src/modes/emoji-autocomplete.ts +285 -0
- package/src/modes/index.ts +34 -0
- package/src/modes/interactive-mode.ts +2756 -0
- package/src/modes/loop-limit.ts +140 -0
- package/src/modes/oauth-manual-input.ts +42 -0
- package/src/modes/print-mode.ts +121 -0
- package/src/modes/prompt-action-autocomplete.ts +345 -0
- package/src/modes/rpc/host-tools.ts +186 -0
- package/src/modes/rpc/host-uris.ts +235 -0
- package/src/modes/rpc/rpc-client.ts +810 -0
- package/src/modes/rpc/rpc-mode.ts +851 -0
- package/src/modes/rpc/rpc-types.ts +378 -0
- package/src/modes/runtime-init.ts +116 -0
- package/src/modes/session-observer-registry.ts +146 -0
- package/src/modes/shared.ts +55 -0
- package/src/modes/theme/dark.json +95 -0
- package/src/modes/theme/defaults/alabaster.json +93 -0
- package/src/modes/theme/defaults/amethyst.json +96 -0
- package/src/modes/theme/defaults/anthracite.json +93 -0
- package/src/modes/theme/defaults/basalt.json +91 -0
- package/src/modes/theme/defaults/birch.json +95 -0
- package/src/modes/theme/defaults/dark-abyss.json +91 -0
- package/src/modes/theme/defaults/dark-arctic.json +104 -0
- package/src/modes/theme/defaults/dark-aurora.json +95 -0
- package/src/modes/theme/defaults/dark-catppuccin.json +107 -0
- package/src/modes/theme/defaults/dark-cavern.json +91 -0
- package/src/modes/theme/defaults/dark-copper.json +95 -0
- package/src/modes/theme/defaults/dark-cosmos.json +90 -0
- package/src/modes/theme/defaults/dark-cyberpunk.json +102 -0
- package/src/modes/theme/defaults/dark-dracula.json +98 -0
- package/src/modes/theme/defaults/dark-eclipse.json +91 -0
- package/src/modes/theme/defaults/dark-ember.json +95 -0
- package/src/modes/theme/defaults/dark-equinox.json +90 -0
- package/src/modes/theme/defaults/dark-forest.json +96 -0
- package/src/modes/theme/defaults/dark-github.json +105 -0
- package/src/modes/theme/defaults/dark-gruvbox.json +112 -0
- package/src/modes/theme/defaults/dark-lavender.json +95 -0
- package/src/modes/theme/defaults/dark-lunar.json +89 -0
- package/src/modes/theme/defaults/dark-midnight.json +95 -0
- package/src/modes/theme/defaults/dark-monochrome.json +94 -0
- package/src/modes/theme/defaults/dark-monokai.json +98 -0
- package/src/modes/theme/defaults/dark-nebula.json +90 -0
- package/src/modes/theme/defaults/dark-nord.json +97 -0
- package/src/modes/theme/defaults/dark-ocean.json +101 -0
- package/src/modes/theme/defaults/dark-one.json +100 -0
- package/src/modes/theme/defaults/dark-poimandres.json +142 -0
- package/src/modes/theme/defaults/dark-rainforest.json +91 -0
- package/src/modes/theme/defaults/dark-reef.json +91 -0
- package/src/modes/theme/defaults/dark-retro.json +92 -0
- package/src/modes/theme/defaults/dark-rose-pine.json +96 -0
- package/src/modes/theme/defaults/dark-sakura.json +95 -0
- package/src/modes/theme/defaults/dark-slate.json +95 -0
- package/src/modes/theme/defaults/dark-solarized.json +97 -0
- package/src/modes/theme/defaults/dark-solstice.json +90 -0
- package/src/modes/theme/defaults/dark-starfall.json +91 -0
- package/src/modes/theme/defaults/dark-sunset.json +99 -0
- package/src/modes/theme/defaults/dark-swamp.json +90 -0
- package/src/modes/theme/defaults/dark-synthwave.json +103 -0
- package/src/modes/theme/defaults/dark-taiga.json +91 -0
- package/src/modes/theme/defaults/dark-terminal.json +95 -0
- package/src/modes/theme/defaults/dark-tokyo-night.json +101 -0
- package/src/modes/theme/defaults/dark-tundra.json +91 -0
- package/src/modes/theme/defaults/dark-twilight.json +91 -0
- package/src/modes/theme/defaults/dark-volcanic.json +91 -0
- package/src/modes/theme/defaults/graphite.json +92 -0
- package/src/modes/theme/defaults/index.ts +201 -0
- package/src/modes/theme/defaults/light-arctic.json +107 -0
- package/src/modes/theme/defaults/light-aurora-day.json +91 -0
- package/src/modes/theme/defaults/light-canyon.json +91 -0
- package/src/modes/theme/defaults/light-catppuccin.json +106 -0
- package/src/modes/theme/defaults/light-cirrus.json +90 -0
- package/src/modes/theme/defaults/light-coral.json +95 -0
- package/src/modes/theme/defaults/light-cyberpunk.json +96 -0
- package/src/modes/theme/defaults/light-dawn.json +90 -0
- package/src/modes/theme/defaults/light-dunes.json +91 -0
- package/src/modes/theme/defaults/light-eucalyptus.json +95 -0
- package/src/modes/theme/defaults/light-forest.json +100 -0
- package/src/modes/theme/defaults/light-frost.json +95 -0
- package/src/modes/theme/defaults/light-github.json +115 -0
- package/src/modes/theme/defaults/light-glacier.json +91 -0
- package/src/modes/theme/defaults/light-gruvbox.json +108 -0
- package/src/modes/theme/defaults/light-haze.json +90 -0
- package/src/modes/theme/defaults/light-honeycomb.json +95 -0
- package/src/modes/theme/defaults/light-lagoon.json +91 -0
- package/src/modes/theme/defaults/light-lavender.json +95 -0
- package/src/modes/theme/defaults/light-meadow.json +91 -0
- package/src/modes/theme/defaults/light-mint.json +95 -0
- package/src/modes/theme/defaults/light-monochrome.json +101 -0
- package/src/modes/theme/defaults/light-ocean.json +99 -0
- package/src/modes/theme/defaults/light-one.json +99 -0
- package/src/modes/theme/defaults/light-opal.json +91 -0
- package/src/modes/theme/defaults/light-orchard.json +91 -0
- package/src/modes/theme/defaults/light-paper.json +95 -0
- package/src/modes/theme/defaults/light-poimandres.json +142 -0
- package/src/modes/theme/defaults/light-prism.json +90 -0
- package/src/modes/theme/defaults/light-retro.json +98 -0
- package/src/modes/theme/defaults/light-sand.json +95 -0
- package/src/modes/theme/defaults/light-savanna.json +91 -0
- package/src/modes/theme/defaults/light-solarized.json +102 -0
- package/src/modes/theme/defaults/light-soleil.json +90 -0
- package/src/modes/theme/defaults/light-sunset.json +99 -0
- package/src/modes/theme/defaults/light-synthwave.json +98 -0
- package/src/modes/theme/defaults/light-tokyo-night.json +111 -0
- package/src/modes/theme/defaults/light-wetland.json +91 -0
- package/src/modes/theme/defaults/light-zenith.json +89 -0
- package/src/modes/theme/defaults/limestone.json +94 -0
- package/src/modes/theme/defaults/mahogany.json +97 -0
- package/src/modes/theme/defaults/marble.json +93 -0
- package/src/modes/theme/defaults/obsidian.json +91 -0
- package/src/modes/theme/defaults/onyx.json +91 -0
- package/src/modes/theme/defaults/pearl.json +93 -0
- package/src/modes/theme/defaults/porcelain.json +91 -0
- package/src/modes/theme/defaults/quartz.json +96 -0
- package/src/modes/theme/defaults/red-claw.json +123 -0
- package/src/modes/theme/defaults/sandstone.json +95 -0
- package/src/modes/theme/defaults/titanium.json +90 -0
- package/src/modes/theme/light.json +93 -0
- package/src/modes/theme/mermaid-cache.ts +29 -0
- package/src/modes/theme/shimmer.ts +219 -0
- package/src/modes/theme/theme-schema.json +429 -0
- package/src/modes/theme/theme.ts +2413 -0
- package/src/modes/types.ts +313 -0
- package/src/modes/utils/context-usage.ts +335 -0
- package/src/modes/utils/hotkeys-markdown.ts +59 -0
- package/src/modes/utils/keybinding-matchers.ts +30 -0
- package/src/modes/utils/tools-markdown.ts +27 -0
- package/src/modes/utils/ui-helpers.ts +741 -0
- package/src/plan-mode/approved-plan.ts +163 -0
- package/src/plan-mode/state.ts +6 -0
- package/src/priority.json +37 -0
- package/src/prompts/agents/architect.md +79 -0
- package/src/prompts/agents/critic.md +55 -0
- package/src/prompts/agents/executor.md +45 -0
- package/src/prompts/agents/explore.md +58 -0
- package/src/prompts/agents/frontmatter.md +12 -0
- package/src/prompts/agents/init.md +34 -0
- package/src/prompts/agents/plan.md +49 -0
- package/src/prompts/agents/planner.md +49 -0
- package/src/prompts/agents/reviewer.md +141 -0
- package/src/prompts/agents/task.md +16 -0
- package/src/prompts/ci-green-request.md +36 -0
- package/src/prompts/commands/orchestrate.md +49 -0
- package/src/prompts/goals/goal-budget-limit.md +16 -0
- package/src/prompts/goals/goal-continuation.md +28 -0
- package/src/prompts/goals/goal-mode-active.md +23 -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 +75 -0
- package/src/prompts/system/agent-creation-user.md +6 -0
- package/src/prompts/system/auto-continue.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 +64 -0
- package/src/prompts/system/eager-todo.md +13 -0
- package/src/prompts/system/irc-incoming.md +8 -0
- package/src/prompts/system/plan-mode-active.md +116 -0
- package/src/prompts/system/plan-mode-approved.md +28 -0
- package/src/prompts/system/plan-mode-compact-instructions.md +16 -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/project-prompt.md +46 -0
- package/src/prompts/system/subagent-system-prompt.md +54 -0
- package/src/prompts/system/subagent-user-prompt.md +3 -0
- package/src/prompts/system/subagent-yield-reminder.md +12 -0
- package/src/prompts/system/system-prompt.md +267 -0
- package/src/prompts/system/title-system.md +2 -0
- package/src/prompts/system/ttsr-interrupt.md +7 -0
- package/src/prompts/system/ttsr-tool-reminder.md +5 -0
- package/src/prompts/system/web-search.md +25 -0
- package/src/prompts/tools/apply-patch.md +65 -0
- package/src/prompts/tools/ask.md +29 -0
- package/src/prompts/tools/ast-edit.md +39 -0
- package/src/prompts/tools/ast-grep.md +42 -0
- package/src/prompts/tools/async-result.md +8 -0
- package/src/prompts/tools/bash.md +39 -0
- package/src/prompts/tools/browser.md +70 -0
- package/src/prompts/tools/calculator.md +10 -0
- package/src/prompts/tools/checkpoint.md +16 -0
- package/src/prompts/tools/create-goal.md +3 -0
- package/src/prompts/tools/debug.md +33 -0
- package/src/prompts/tools/eval.md +75 -0
- package/src/prompts/tools/find.md +34 -0
- package/src/prompts/tools/get-goal.md +3 -0
- package/src/prompts/tools/github.md +20 -0
- package/src/prompts/tools/goal.md +18 -0
- package/src/prompts/tools/hashline.md +130 -0
- package/src/prompts/tools/image-gen.md +7 -0
- package/src/prompts/tools/inspect-image-system.md +20 -0
- package/src/prompts/tools/inspect-image.md +32 -0
- package/src/prompts/tools/irc.md +49 -0
- package/src/prompts/tools/job.md +19 -0
- package/src/prompts/tools/lsp.md +42 -0
- package/src/prompts/tools/patch.md +70 -0
- package/src/prompts/tools/read.md +82 -0
- package/src/prompts/tools/recall.md +5 -0
- package/src/prompts/tools/recipe.md +16 -0
- package/src/prompts/tools/reflect.md +5 -0
- package/src/prompts/tools/render-mermaid.md +9 -0
- package/src/prompts/tools/replace.md +36 -0
- package/src/prompts/tools/resolve.md +9 -0
- package/src/prompts/tools/retain.md +6 -0
- package/src/prompts/tools/rewind.md +13 -0
- package/src/prompts/tools/search-tool-bm25.md +33 -0
- package/src/prompts/tools/search.md +25 -0
- package/src/prompts/tools/ssh.md +35 -0
- package/src/prompts/tools/subagent.md +21 -0
- package/src/prompts/tools/task-summary.md +28 -0
- package/src/prompts/tools/task.md +79 -0
- package/src/prompts/tools/todo-write.md +50 -0
- package/src/prompts/tools/update-goal.md +3 -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/registry/agent-registry.ts +140 -0
- package/src/runtime-mcp/client.ts +482 -0
- package/src/runtime-mcp/config-writer.ts +225 -0
- package/src/runtime-mcp/config.ts +365 -0
- package/src/runtime-mcp/discoverable-tool-metadata.ts +25 -0
- package/src/runtime-mcp/index.ts +29 -0
- package/src/runtime-mcp/json-rpc.ts +84 -0
- package/src/runtime-mcp/loader.ts +124 -0
- package/src/runtime-mcp/manager.ts +1172 -0
- package/src/runtime-mcp/oauth-discovery.ts +349 -0
- package/src/runtime-mcp/oauth-flow.ts +407 -0
- package/src/runtime-mcp/render.ts +123 -0
- package/src/runtime-mcp/smithery-auth.ts +104 -0
- package/src/runtime-mcp/smithery-connect.ts +145 -0
- package/src/runtime-mcp/smithery-registry.ts +477 -0
- package/src/runtime-mcp/tool-bridge.ts +416 -0
- package/src/runtime-mcp/tool-cache.ts +117 -0
- package/src/runtime-mcp/transports/http.ts +477 -0
- package/src/runtime-mcp/transports/index.ts +6 -0
- package/src/runtime-mcp/transports/stdio.ts +325 -0
- package/src/runtime-mcp/types.ts +423 -0
- package/src/sdk.ts +2064 -0
- package/src/secrets/index.ts +116 -0
- package/src/secrets/obfuscator.ts +277 -0
- package/src/secrets/regex.ts +21 -0
- package/src/session/agent-session.ts +8794 -0
- package/src/session/agent-storage.ts +466 -0
- package/src/session/artifacts.ts +135 -0
- package/src/session/auth-broker-config.ts +102 -0
- package/src/session/auth-storage.ts +23 -0
- package/src/session/blob-store.ts +168 -0
- package/src/session/client-bridge.ts +85 -0
- package/src/session/history-storage.ts +311 -0
- package/src/session/messages.ts +403 -0
- package/src/session/session-dump-format.ts +209 -0
- package/src/session/session-manager.ts +3333 -0
- package/src/session/session-storage.ts +389 -0
- package/src/session/streaming-output.ts +1093 -0
- package/src/session/tool-choice-queue.ts +213 -0
- package/src/session/yield-queue.ts +155 -0
- package/src/setup/model-onboarding-guidance.ts +36 -0
- package/src/setup/provider-onboarding.ts +195 -0
- package/src/skill-state/active-state.ts +272 -0
- package/src/slash-commands/acp-builtins.ts +46 -0
- package/src/slash-commands/builtin-registry.ts +955 -0
- package/src/slash-commands/helpers/context-report.ts +39 -0
- package/src/slash-commands/helpers/format.ts +46 -0
- package/src/slash-commands/helpers/mcp.ts +532 -0
- package/src/slash-commands/helpers/parse.ts +85 -0
- package/src/slash-commands/helpers/ssh.ts +195 -0
- package/src/slash-commands/helpers/todo.ts +279 -0
- package/src/slash-commands/helpers/usage-report.ts +91 -0
- package/src/slash-commands/types.ts +125 -0
- package/src/ssh/config-writer.ts +183 -0
- package/src/ssh/connection-manager.ts +482 -0
- package/src/ssh/ssh-executor.ts +133 -0
- package/src/ssh/sshfs-mount.ts +140 -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 +581 -0
- package/src/task/agents.ts +162 -0
- package/src/task/commands.ts +135 -0
- package/src/task/discovery.ts +130 -0
- package/src/task/executor.ts +1564 -0
- package/src/task/gjc-command.ts +26 -0
- package/src/task/index.ts +1366 -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 +1136 -0
- package/src/task/simple-mode.ts +27 -0
- package/src/task/subprocess-tool-registry.ts +88 -0
- package/src/task/types.ts +315 -0
- package/src/task/worktree.ts +506 -0
- package/src/thinking.ts +87 -0
- package/src/tool-discovery/tool-index.ts +400 -0
- package/src/tools/archive-reader.ts +321 -0
- package/src/tools/ask.ts +790 -0
- package/src/tools/ast-edit.ts +542 -0
- package/src/tools/ast-grep.ts +423 -0
- package/src/tools/auto-generated-guard.ts +305 -0
- package/src/tools/bash-command-fixup.ts +37 -0
- package/src/tools/bash-interactive.ts +388 -0
- package/src/tools/bash-interceptor.ts +67 -0
- package/src/tools/bash-pty-selection.ts +14 -0
- package/src/tools/bash-skill-urls.ts +248 -0
- package/src/tools/bash.ts +1061 -0
- package/src/tools/browser/attach.ts +175 -0
- package/src/tools/browser/launch.ts +651 -0
- package/src/tools/browser/readable.ts +95 -0
- package/src/tools/browser/registry.ts +194 -0
- package/src/tools/browser/render.ts +212 -0
- package/src/tools/browser/tab-protocol.ts +105 -0
- package/src/tools/browser/tab-supervisor.ts +577 -0
- package/src/tools/browser/tab-worker-entry.ts +21 -0
- package/src/tools/browser/tab-worker.ts +1054 -0
- package/src/tools/browser.ts +301 -0
- package/src/tools/calculator.ts +540 -0
- package/src/tools/checkpoint.ts +134 -0
- package/src/tools/conflict-detect.ts +672 -0
- package/src/tools/context.ts +39 -0
- package/src/tools/debug.ts +1014 -0
- package/src/tools/eval.ts +1101 -0
- package/src/tools/fetch.ts +1482 -0
- package/src/tools/file-recorder.ts +35 -0
- package/src/tools/find.ts +540 -0
- package/src/tools/fs-cache-invalidation.ts +28 -0
- package/src/tools/gh-format.ts +12 -0
- package/src/tools/gh-renderer.ts +428 -0
- package/src/tools/gh.ts +3499 -0
- package/src/tools/github-cache.ts +548 -0
- package/src/tools/grouped-file-output.ts +96 -0
- package/src/tools/hindsight-recall.ts +68 -0
- package/src/tools/hindsight-reflect.ts +57 -0
- package/src/tools/hindsight-retain.ts +56 -0
- package/src/tools/image-gen.ts +1248 -0
- package/src/tools/index.ts +519 -0
- package/src/tools/inspect-image-renderer.ts +103 -0
- package/src/tools/inspect-image.ts +165 -0
- package/src/tools/irc.ts +239 -0
- package/src/tools/job.ts +520 -0
- package/src/tools/json-tree.ts +243 -0
- package/src/tools/jtd-to-json-schema.ts +219 -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/match-line-format.ts +22 -0
- package/src/tools/output-meta.ts +754 -0
- package/src/tools/path-utils.ts +739 -0
- package/src/tools/plan-mode-guard.ts +68 -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/read.ts +2332 -0
- package/src/tools/recipe/index.ts +80 -0
- package/src/tools/recipe/render.ts +19 -0
- package/src/tools/recipe/runner.ts +219 -0
- package/src/tools/recipe/runners/cargo.ts +131 -0
- package/src/tools/recipe/runners/index.ts +8 -0
- package/src/tools/recipe/runners/just.ts +73 -0
- package/src/tools/recipe/runners/make.ts +101 -0
- package/src/tools/recipe/runners/pkg.ts +167 -0
- package/src/tools/recipe/runners/task.ts +72 -0
- package/src/tools/render-mermaid.ts +68 -0
- package/src/tools/render-utils.ts +774 -0
- package/src/tools/renderers.ts +75 -0
- package/src/tools/resolve.ts +258 -0
- package/src/tools/review.ts +252 -0
- package/src/tools/search-tool-bm25.ts +360 -0
- package/src/tools/search.ts +786 -0
- package/src/tools/sqlite-reader.ts +736 -0
- package/src/tools/ssh.ts +310 -0
- package/src/tools/subagent.ts +312 -0
- package/src/tools/todo-write.ts +695 -0
- package/src/tools/tool-errors.ts +62 -0
- package/src/tools/tool-result.ts +86 -0
- package/src/tools/tool-timeouts.ts +30 -0
- package/src/tools/vim.ts +949 -0
- package/src/tools/write.ts +953 -0
- package/src/tools/yield.ts +268 -0
- package/src/tui/code-cell.ts +201 -0
- package/src/tui/file-list.ts +55 -0
- package/src/tui/hyperlink.ts +126 -0
- package/src/tui/index.ts +12 -0
- package/src/tui/output-block.ts +150 -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 +156 -0
- package/src/utils/command-args.ts +76 -0
- package/src/utils/commit-message-generator.ts +142 -0
- package/src/utils/edit-mode.ts +42 -0
- package/src/utils/event-bus.ts +33 -0
- package/src/utils/external-editor.ts +65 -0
- package/src/utils/file-display-mode.ts +45 -0
- package/src/utils/file-mentions.ts +376 -0
- package/src/utils/git.ts +1536 -0
- package/src/utils/image-loading.ts +102 -0
- package/src/utils/image-resize.ts +309 -0
- package/src/utils/lang-from-path.ts +239 -0
- package/src/utils/markit.ts +89 -0
- package/src/utils/open.ts +20 -0
- package/src/utils/session-color.ts +43 -0
- package/src/utils/shell-snapshot.ts +187 -0
- package/src/utils/sixel.ts +69 -0
- package/src/utils/title-generator.ts +223 -0
- package/src/utils/tool-choice.ts +33 -0
- package/src/utils/tools-manager.ts +363 -0
- package/src/vim/buffer.ts +309 -0
- package/src/vim/commands.ts +382 -0
- package/src/vim/engine.ts +2409 -0
- package/src/vim/parser.ts +134 -0
- package/src/vim/render.ts +252 -0
- package/src/vim/types.ts +197 -0
- package/src/web/kagi.ts +183 -0
- package/src/web/parallel.ts +349 -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 +97 -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 +173 -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 +189 -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 +318 -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 +319 -0
- package/src/web/search/index.ts +288 -0
- package/src/web/search/provider.ts +173 -0
- package/src/web/search/providers/anthropic.ts +302 -0
- package/src/web/search/providers/base.ts +71 -0
- package/src/web/search/providers/brave.ts +149 -0
- package/src/web/search/providers/codex.ts +556 -0
- package/src/web/search/providers/exa.ts +193 -0
- package/src/web/search/providers/gemini.ts +455 -0
- package/src/web/search/providers/jina.ts +101 -0
- package/src/web/search/providers/kagi.ts +75 -0
- package/src/web/search/providers/kimi.ts +171 -0
- package/src/web/search/providers/parallel.ts +210 -0
- package/src/web/search/providers/perplexity.ts +575 -0
- package/src/web/search/providers/searxng.ts +309 -0
- package/src/web/search/providers/synthetic.ts +108 -0
- package/src/web/search/providers/tavily.ts +173 -0
- package/src/web/search/providers/utils.ts +128 -0
- package/src/web/search/providers/zai.ts +320 -0
- package/src/web/search/render.ts +299 -0
- package/src/web/search/types.ts +436 -0
- package/src/web/search/utils.ts +17 -0
- package/src/workspace-tree.ts +286 -0
|
@@ -0,0 +1,2268 @@
|
|
|
1
|
+
(function() {
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
// ============================================================
|
|
5
|
+
// DATA LOADING
|
|
6
|
+
// ============================================================
|
|
7
|
+
|
|
8
|
+
const base64 = document.getElementById('session-data').textContent;
|
|
9
|
+
const binary = atob(base64);
|
|
10
|
+
const bytes = new Uint8Array(binary.length);
|
|
11
|
+
for (let i = 0; i < binary.length; i++) {
|
|
12
|
+
bytes[i] = binary.charCodeAt(i);
|
|
13
|
+
}
|
|
14
|
+
const data = JSON.parse(new TextDecoder('utf-8').decode(bytes));
|
|
15
|
+
const { header, entries, leafId: defaultLeafId, systemPrompt, tools } = data;
|
|
16
|
+
|
|
17
|
+
// ============================================================
|
|
18
|
+
// URL PARAMETER HANDLING
|
|
19
|
+
// ============================================================
|
|
20
|
+
|
|
21
|
+
// Parse URL parameters for deep linking: leafId and targetId
|
|
22
|
+
// Check for injected params (when loaded in iframe via srcdoc) or use window.location
|
|
23
|
+
const injectedParams =
|
|
24
|
+
document.querySelector('meta[name="gjc-url-params"]') ||
|
|
25
|
+
document.querySelector('meta[name="pi-url-params"]');
|
|
26
|
+
const searchString = injectedParams ? injectedParams.content : window.location.search.substring(1);
|
|
27
|
+
const urlParams = new URLSearchParams(searchString);
|
|
28
|
+
const urlLeafId = urlParams.get('leafId');
|
|
29
|
+
const urlTargetId = urlParams.get('targetId');
|
|
30
|
+
// Use URL leafId if provided, otherwise fall back to session default
|
|
31
|
+
const leafId = urlLeafId || defaultLeafId;
|
|
32
|
+
|
|
33
|
+
// ============================================================
|
|
34
|
+
// DATA STRUCTURES
|
|
35
|
+
// ============================================================
|
|
36
|
+
|
|
37
|
+
// Entry lookup by ID
|
|
38
|
+
const byId = new Map();
|
|
39
|
+
for (const entry of entries) {
|
|
40
|
+
byId.set(entry.id, entry);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Tool call lookup (toolCallId -> {name, arguments})
|
|
44
|
+
const toolCallMap = new Map();
|
|
45
|
+
for (const entry of entries) {
|
|
46
|
+
if (entry.type === 'message' && entry.message.role === 'assistant') {
|
|
47
|
+
const content = entry.message.content;
|
|
48
|
+
if (Array.isArray(content)) {
|
|
49
|
+
for (const block of content) {
|
|
50
|
+
if (block.type === 'toolCall') {
|
|
51
|
+
toolCallMap.set(block.id, { name: block.name, arguments: block.arguments });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Label lookup (entryId -> label string)
|
|
59
|
+
// Labels are stored in 'label' entries that reference their target via targetId
|
|
60
|
+
const labelMap = new Map();
|
|
61
|
+
for (const entry of entries) {
|
|
62
|
+
if (entry.type === 'label' && entry.targetId && entry.label) {
|
|
63
|
+
labelMap.set(entry.targetId, entry.label);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// ============================================================
|
|
68
|
+
// TREE DATA PREPARATION (no DOM, pure data)
|
|
69
|
+
// ============================================================
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Build tree structure from flat entries.
|
|
73
|
+
* Returns array of root nodes, each with { entry, children, label }.
|
|
74
|
+
*/
|
|
75
|
+
function buildTree() {
|
|
76
|
+
const nodeMap = new Map();
|
|
77
|
+
const roots = [];
|
|
78
|
+
|
|
79
|
+
// Create nodes
|
|
80
|
+
for (const entry of entries) {
|
|
81
|
+
nodeMap.set(entry.id, {
|
|
82
|
+
entry,
|
|
83
|
+
children: [],
|
|
84
|
+
label: labelMap.get(entry.id)
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Build parent-child relationships
|
|
89
|
+
for (const entry of entries) {
|
|
90
|
+
const node = nodeMap.get(entry.id);
|
|
91
|
+
if (entry.parentId === null || entry.parentId === undefined || entry.parentId === entry.id) {
|
|
92
|
+
roots.push(node);
|
|
93
|
+
} else {
|
|
94
|
+
const parent = nodeMap.get(entry.parentId);
|
|
95
|
+
if (parent) {
|
|
96
|
+
parent.children.push(node);
|
|
97
|
+
} else {
|
|
98
|
+
roots.push(node);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Sort children by timestamp
|
|
104
|
+
function sortChildren(node) {
|
|
105
|
+
node.children.sort((a, b) =>
|
|
106
|
+
new Date(a.entry.timestamp).getTime() - new Date(b.entry.timestamp).getTime()
|
|
107
|
+
);
|
|
108
|
+
node.children.forEach(sortChildren);
|
|
109
|
+
}
|
|
110
|
+
roots.forEach(sortChildren);
|
|
111
|
+
|
|
112
|
+
return roots;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Build set of entry IDs on path from root to target.
|
|
117
|
+
*/
|
|
118
|
+
function buildActivePathIds(targetId) {
|
|
119
|
+
const ids = new Set();
|
|
120
|
+
let current = byId.get(targetId);
|
|
121
|
+
while (current) {
|
|
122
|
+
ids.add(current.id);
|
|
123
|
+
// Stop if no parent or self-referencing (root)
|
|
124
|
+
if (!current.parentId || current.parentId === current.id) {
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
current = byId.get(current.parentId);
|
|
128
|
+
}
|
|
129
|
+
return ids;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Get array of entries from root to target (the conversation path).
|
|
134
|
+
*/
|
|
135
|
+
function getPath(targetId) {
|
|
136
|
+
const path = [];
|
|
137
|
+
let current = byId.get(targetId);
|
|
138
|
+
while (current) {
|
|
139
|
+
path.unshift(current);
|
|
140
|
+
// Stop if no parent or self-referencing (root)
|
|
141
|
+
if (!current.parentId || current.parentId === current.id) {
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
current = byId.get(current.parentId);
|
|
145
|
+
}
|
|
146
|
+
return path;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Flatten tree into list with indentation and connector info.
|
|
151
|
+
* Returns array of { node, indent, showConnector, isLast, gutters, isVirtualRootChild, multipleRoots }.
|
|
152
|
+
* Matches tree-selector.ts logic exactly.
|
|
153
|
+
*/
|
|
154
|
+
function flattenTree(roots, activePathIds) {
|
|
155
|
+
const result = [];
|
|
156
|
+
const multipleRoots = roots.length > 1;
|
|
157
|
+
|
|
158
|
+
// Mark which subtrees contain the active leaf
|
|
159
|
+
const containsActive = new Map();
|
|
160
|
+
function markActive(node) {
|
|
161
|
+
let has = activePathIds.has(node.entry.id);
|
|
162
|
+
for (const child of node.children) {
|
|
163
|
+
if (markActive(child)) has = true;
|
|
164
|
+
}
|
|
165
|
+
containsActive.set(node, has);
|
|
166
|
+
return has;
|
|
167
|
+
}
|
|
168
|
+
roots.forEach(markActive);
|
|
169
|
+
|
|
170
|
+
// Stack: [node, indent, justBranched, showConnector, isLast, gutters, isVirtualRootChild]
|
|
171
|
+
const stack = [];
|
|
172
|
+
|
|
173
|
+
// Add roots (prioritize branch containing active leaf)
|
|
174
|
+
const orderedRoots = [...roots].sort((a, b) =>
|
|
175
|
+
Number(containsActive.get(b)) - Number(containsActive.get(a))
|
|
176
|
+
);
|
|
177
|
+
for (let i = orderedRoots.length - 1; i >= 0; i--) {
|
|
178
|
+
const isLast = i === orderedRoots.length - 1;
|
|
179
|
+
stack.push([orderedRoots[i], multipleRoots ? 1 : 0, multipleRoots, multipleRoots, isLast, [], multipleRoots]);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
while (stack.length > 0) {
|
|
183
|
+
const [node, indent, justBranched, showConnector, isLast, gutters, isVirtualRootChild] = stack.pop();
|
|
184
|
+
|
|
185
|
+
result.push({ node, indent, showConnector, isLast, gutters, isVirtualRootChild, multipleRoots });
|
|
186
|
+
|
|
187
|
+
const children = node.children;
|
|
188
|
+
const multipleChildren = children.length > 1;
|
|
189
|
+
|
|
190
|
+
// Order children (active branch first)
|
|
191
|
+
const orderedChildren = [...children].sort((a, b) =>
|
|
192
|
+
Number(containsActive.get(b)) - Number(containsActive.get(a))
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
// Calculate child indent (matches tree-selector.ts)
|
|
196
|
+
let childIndent;
|
|
197
|
+
if (multipleChildren) {
|
|
198
|
+
// Parent branches: children get +1
|
|
199
|
+
childIndent = indent + 1;
|
|
200
|
+
} else if (justBranched && indent > 0) {
|
|
201
|
+
// First generation after a branch: +1 for visual grouping
|
|
202
|
+
childIndent = indent + 1;
|
|
203
|
+
} else {
|
|
204
|
+
// Single-child chain: stay flat
|
|
205
|
+
childIndent = indent;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// Build gutters for children
|
|
209
|
+
const connectorDisplayed = showConnector && !isVirtualRootChild;
|
|
210
|
+
const currentDisplayIndent = multipleRoots ? Math.max(0, indent - 1) : indent;
|
|
211
|
+
const connectorPosition = Math.max(0, currentDisplayIndent - 1);
|
|
212
|
+
const childGutters = connectorDisplayed
|
|
213
|
+
? [...gutters, { position: connectorPosition, show: !isLast }]
|
|
214
|
+
: gutters;
|
|
215
|
+
|
|
216
|
+
// Add children in reverse order for stack
|
|
217
|
+
for (let i = orderedChildren.length - 1; i >= 0; i--) {
|
|
218
|
+
const childIsLast = i === orderedChildren.length - 1;
|
|
219
|
+
stack.push([orderedChildren[i], childIndent, multipleChildren, multipleChildren, childIsLast, childGutters, false]);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
return result;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Build ASCII prefix string for tree node.
|
|
228
|
+
*/
|
|
229
|
+
function buildTreePrefix(flatNode) {
|
|
230
|
+
const { indent, showConnector, isLast, gutters, isVirtualRootChild, multipleRoots } = flatNode;
|
|
231
|
+
const displayIndent = multipleRoots ? Math.max(0, indent - 1) : indent;
|
|
232
|
+
const connector = showConnector && !isVirtualRootChild ? (isLast ? '└─ ' : '├─ ') : '';
|
|
233
|
+
const connectorPosition = connector ? displayIndent - 1 : -1;
|
|
234
|
+
|
|
235
|
+
const totalChars = displayIndent * 3;
|
|
236
|
+
const prefixChars = [];
|
|
237
|
+
for (let i = 0; i < totalChars; i++) {
|
|
238
|
+
const level = Math.floor(i / 3);
|
|
239
|
+
const posInLevel = i % 3;
|
|
240
|
+
|
|
241
|
+
const gutter = gutters.find(g => g.position === level);
|
|
242
|
+
if (gutter) {
|
|
243
|
+
prefixChars.push(posInLevel === 0 ? (gutter.show ? '│' : ' ') : ' ');
|
|
244
|
+
} else if (connector && level === connectorPosition) {
|
|
245
|
+
if (posInLevel === 0) {
|
|
246
|
+
prefixChars.push(isLast ? '└' : '├');
|
|
247
|
+
} else if (posInLevel === 1) {
|
|
248
|
+
prefixChars.push('─');
|
|
249
|
+
} else {
|
|
250
|
+
prefixChars.push(' ');
|
|
251
|
+
}
|
|
252
|
+
} else {
|
|
253
|
+
prefixChars.push(' ');
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
return prefixChars.join('');
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// ============================================================
|
|
260
|
+
// FILTERING (pure data)
|
|
261
|
+
// ============================================================
|
|
262
|
+
|
|
263
|
+
let filterMode = 'default';
|
|
264
|
+
let searchQuery = '';
|
|
265
|
+
|
|
266
|
+
function hasTextContent(content) {
|
|
267
|
+
if (typeof content === 'string') return content.trim().length > 0;
|
|
268
|
+
if (Array.isArray(content)) {
|
|
269
|
+
for (const c of content) {
|
|
270
|
+
if (c.type === 'text' && c.text && c.text.trim().length > 0) return true;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
function extractContent(content) {
|
|
277
|
+
if (typeof content === 'string') return content;
|
|
278
|
+
if (Array.isArray(content)) {
|
|
279
|
+
return content
|
|
280
|
+
.filter(c => c.type === 'text' && c.text)
|
|
281
|
+
.map(c => c.text)
|
|
282
|
+
.join('');
|
|
283
|
+
}
|
|
284
|
+
return '';
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
function getSearchableText(entry, label) {
|
|
288
|
+
const parts = [];
|
|
289
|
+
if (label) parts.push(label);
|
|
290
|
+
|
|
291
|
+
switch (entry.type) {
|
|
292
|
+
case 'message': {
|
|
293
|
+
const msg = entry.message;
|
|
294
|
+
parts.push(msg.role);
|
|
295
|
+
if (msg.content) parts.push(extractContent(msg.content));
|
|
296
|
+
if (msg.role === 'bashExecution' && msg.command) parts.push(msg.command);
|
|
297
|
+
if (msg.role === 'jsExecution' && msg.code) parts.push(msg.code);
|
|
298
|
+
break;
|
|
299
|
+
}
|
|
300
|
+
case 'custom_message':
|
|
301
|
+
parts.push(entry.customType);
|
|
302
|
+
parts.push(typeof entry.content === 'string' ? entry.content : extractContent(entry.content));
|
|
303
|
+
break;
|
|
304
|
+
case 'compaction':
|
|
305
|
+
parts.push('compaction');
|
|
306
|
+
break;
|
|
307
|
+
case 'branch_summary':
|
|
308
|
+
parts.push('branch summary', entry.summary);
|
|
309
|
+
break;
|
|
310
|
+
case 'model_change':
|
|
311
|
+
parts.push('model', entry.model);
|
|
312
|
+
break;
|
|
313
|
+
case 'thinking_level_change':
|
|
314
|
+
parts.push('thinking', entry.thinkingLevel);
|
|
315
|
+
break;
|
|
316
|
+
case 'mode_change':
|
|
317
|
+
parts.push('mode', entry.mode);
|
|
318
|
+
break;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
return parts.join(' ').toLowerCase();
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Filter flat nodes based on current filterMode and searchQuery.
|
|
326
|
+
*/
|
|
327
|
+
function filterNodes(flatNodes, currentLeafId) {
|
|
328
|
+
const searchTokens = searchQuery.toLowerCase().split(/\s+/).filter(Boolean);
|
|
329
|
+
|
|
330
|
+
return flatNodes.filter(flatNode => {
|
|
331
|
+
const entry = flatNode.node.entry;
|
|
332
|
+
const label = flatNode.node.label;
|
|
333
|
+
const isCurrentLeaf = entry.id === currentLeafId;
|
|
334
|
+
|
|
335
|
+
// Always show current leaf
|
|
336
|
+
if (isCurrentLeaf) return true;
|
|
337
|
+
|
|
338
|
+
// Hide assistant messages with only tool calls (no text) unless error/aborted
|
|
339
|
+
if (entry.type === 'message' && entry.message.role === 'assistant') {
|
|
340
|
+
const msg = entry.message;
|
|
341
|
+
const hasText = hasTextContent(msg.content);
|
|
342
|
+
const isErrorOrAborted = msg.stopReason && msg.stopReason !== 'stop' && msg.stopReason !== 'toolUse';
|
|
343
|
+
if (!hasText && !isErrorOrAborted) return false;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
// Apply filter mode
|
|
347
|
+
const isSettingsEntry = ['label', 'custom', 'model_change', 'thinking_level_change', 'mode_change', 'ttsr_injection', 'session_init'].includes(entry.type);
|
|
348
|
+
let passesFilter = true;
|
|
349
|
+
|
|
350
|
+
switch (filterMode) {
|
|
351
|
+
case 'user-only':
|
|
352
|
+
passesFilter = entry.type === 'message' && entry.message.role === 'user';
|
|
353
|
+
break;
|
|
354
|
+
case 'no-tools':
|
|
355
|
+
passesFilter = !isSettingsEntry && !(entry.type === 'message' && entry.message.role === 'toolResult');
|
|
356
|
+
break;
|
|
357
|
+
case 'labeled-only':
|
|
358
|
+
passesFilter = label !== undefined;
|
|
359
|
+
break;
|
|
360
|
+
case 'all':
|
|
361
|
+
passesFilter = true;
|
|
362
|
+
break;
|
|
363
|
+
default: // 'default'
|
|
364
|
+
passesFilter = !isSettingsEntry;
|
|
365
|
+
break;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
if (!passesFilter) return false;
|
|
369
|
+
|
|
370
|
+
// Apply search filter
|
|
371
|
+
if (searchTokens.length > 0) {
|
|
372
|
+
const nodeText = getSearchableText(entry, label);
|
|
373
|
+
if (!searchTokens.every(t => nodeText.includes(t))) return false;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
return true;
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
// ============================================================
|
|
381
|
+
// TREE DISPLAY TEXT (pure data -> string)
|
|
382
|
+
// ============================================================
|
|
383
|
+
|
|
384
|
+
function shortenPath(p) {
|
|
385
|
+
if (typeof p !== 'string') return '';
|
|
386
|
+
if (p.startsWith('/Users/')) {
|
|
387
|
+
const parts = p.split('/');
|
|
388
|
+
if (parts.length > 2) return '~' + p.slice(('/Users/' + parts[2]).length);
|
|
389
|
+
}
|
|
390
|
+
if (p.startsWith('/home/')) {
|
|
391
|
+
const parts = p.split('/');
|
|
392
|
+
if (parts.length > 2) return '~' + p.slice(('/home/' + parts[2]).length);
|
|
393
|
+
}
|
|
394
|
+
return p;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
function formatToolCall(name, args) {
|
|
398
|
+
switch (name) {
|
|
399
|
+
case 'read': {
|
|
400
|
+
const path = shortenPath(String(args.path || args.file_path || ''));
|
|
401
|
+
const offset = args.offset;
|
|
402
|
+
const limit = args.limit;
|
|
403
|
+
let display = path;
|
|
404
|
+
if (offset !== undefined || limit !== undefined) {
|
|
405
|
+
const start = offset ?? 1;
|
|
406
|
+
const end = limit !== undefined ? start + limit - 1 : '';
|
|
407
|
+
display += `:${start}${end ? `-${end}` : ''}`;
|
|
408
|
+
}
|
|
409
|
+
return `[read: ${display}]`;
|
|
410
|
+
}
|
|
411
|
+
case 'write':
|
|
412
|
+
return `[write: ${shortenPath(String(args.path || args.file_path || ''))}]`;
|
|
413
|
+
case 'edit':
|
|
414
|
+
return `[edit: ${shortenPath(String(args.path || args.file_path || ''))}]`;
|
|
415
|
+
case 'bash': {
|
|
416
|
+
const rawCmd = String(args.command || '');
|
|
417
|
+
const cmd = rawCmd.replace(/[\n\t]/g, ' ').trim().slice(0, 50);
|
|
418
|
+
return `[bash: ${cmd}${rawCmd.length > 50 ? '...' : ''}]`;
|
|
419
|
+
}
|
|
420
|
+
case 'grep':
|
|
421
|
+
return `[grep: /${args.pattern || ''}/ in ${shortenPath(String((args.paths || [args.path || '.']).join(', ')))}]`;
|
|
422
|
+
case 'find':
|
|
423
|
+
return `[find: ${shortenPath(String((args.paths || [args.pattern || '.']).join(', ')))}]`;
|
|
424
|
+
case 'ls':
|
|
425
|
+
return `[ls: ${shortenPath(String(args.path || '.'))}]`;
|
|
426
|
+
default: {
|
|
427
|
+
const argsStr = JSON.stringify(args).slice(0, 40);
|
|
428
|
+
return `[${name}: ${argsStr}${JSON.stringify(args).length > 40 ? '...' : ''}]`;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
function escapeHtml(text) {
|
|
434
|
+
const div = document.createElement('div');
|
|
435
|
+
div.textContent = text;
|
|
436
|
+
return div.innerHTML;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* Truncate string to maxLen chars, append "..." if truncated.
|
|
441
|
+
*/
|
|
442
|
+
function truncate(s, maxLen = 100) {
|
|
443
|
+
if (s.length <= maxLen) return s;
|
|
444
|
+
return s.slice(0, maxLen) + '...';
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* Get display text for tree node (returns HTML string).
|
|
449
|
+
*/
|
|
450
|
+
function getTreeNodeDisplayHtml(entry, label) {
|
|
451
|
+
const normalize = s => s.replace(/[\n\t]/g, ' ').trim();
|
|
452
|
+
const labelHtml = label ? `<span class="tree-label">[${escapeHtml(label)}]</span> ` : '';
|
|
453
|
+
|
|
454
|
+
switch (entry.type) {
|
|
455
|
+
case 'message': {
|
|
456
|
+
const msg = entry.message;
|
|
457
|
+
if (msg.role === 'user') {
|
|
458
|
+
const content = truncate(normalize(extractContent(msg.content)));
|
|
459
|
+
return labelHtml + `<span class="tree-role-user">user:</span> ${escapeHtml(content)}`;
|
|
460
|
+
}
|
|
461
|
+
if (msg.role === 'developer') {
|
|
462
|
+
const content = truncate(normalize(extractContent(msg.content)));
|
|
463
|
+
return labelHtml + `<span class="tree-role-developer">developer:</span> ${escapeHtml(content)}`;
|
|
464
|
+
}
|
|
465
|
+
if (msg.role === 'assistant') {
|
|
466
|
+
const textContent = truncate(normalize(extractContent(msg.content)));
|
|
467
|
+
if (textContent) {
|
|
468
|
+
return labelHtml + `<span class="tree-role-assistant">assistant:</span> ${escapeHtml(textContent)}`;
|
|
469
|
+
}
|
|
470
|
+
if (msg.stopReason === 'aborted') {
|
|
471
|
+
return labelHtml + `<span class="tree-role-assistant">assistant:</span> <span class="tree-muted">(aborted)</span>`;
|
|
472
|
+
}
|
|
473
|
+
if (msg.errorMessage) {
|
|
474
|
+
return labelHtml + `<span class="tree-role-assistant">assistant:</span> <span class="tree-error">${escapeHtml(truncate(msg.errorMessage))}</span>`;
|
|
475
|
+
}
|
|
476
|
+
return labelHtml + `<span class="tree-role-assistant">assistant:</span> <span class="tree-muted">(no text)</span>`;
|
|
477
|
+
}
|
|
478
|
+
if (msg.role === 'toolResult') {
|
|
479
|
+
const toolCall = msg.toolCallId ? toolCallMap.get(msg.toolCallId) : null;
|
|
480
|
+
if (toolCall) {
|
|
481
|
+
return labelHtml + `<span class="tree-role-tool">${escapeHtml(formatToolCall(toolCall.name, toolCall.arguments))}</span>`;
|
|
482
|
+
}
|
|
483
|
+
return labelHtml + `<span class="tree-role-tool">[${msg.toolName || 'tool'}]</span>`;
|
|
484
|
+
}
|
|
485
|
+
if (msg.role === 'bashExecution') {
|
|
486
|
+
const cmd = truncate(normalize(msg.command || ''));
|
|
487
|
+
return labelHtml + `<span class="tree-role-tool">[bash]:</span> ${escapeHtml(cmd)}`;
|
|
488
|
+
}
|
|
489
|
+
if (msg.role === 'jsExecution') {
|
|
490
|
+
const code = truncate(normalize(msg.code || ''));
|
|
491
|
+
return labelHtml + `<span class="tree-role-tool">[js]:</span> ${escapeHtml(code)}`;
|
|
492
|
+
}
|
|
493
|
+
return labelHtml + `<span class="tree-muted">[${msg.role}]</span>`;
|
|
494
|
+
}
|
|
495
|
+
case 'compaction':
|
|
496
|
+
return labelHtml + `<span class="tree-compaction">[compaction: ${Math.round(entry.tokensBefore/1000)}k tokens]</span>`;
|
|
497
|
+
case 'branch_summary': {
|
|
498
|
+
const summary = truncate(normalize(entry.summary || ''));
|
|
499
|
+
return labelHtml + `<span class="tree-branch-summary">[branch summary]:</span> ${escapeHtml(summary)}`;
|
|
500
|
+
}
|
|
501
|
+
case 'custom_message': {
|
|
502
|
+
const content = typeof entry.content === 'string' ? entry.content : extractContent(entry.content);
|
|
503
|
+
return labelHtml + `<span class="tree-custom">[${escapeHtml(entry.customType)}]:</span> ${escapeHtml(truncate(normalize(content)))}`;
|
|
504
|
+
}
|
|
505
|
+
case 'model_change':
|
|
506
|
+
return labelHtml + `<span class="tree-muted">[model: ${escapeHtml(entry.model)}]</span>`;
|
|
507
|
+
case 'thinking_level_change':
|
|
508
|
+
return labelHtml + `<span class="tree-muted">[thinking: ${entry.thinkingLevel}]</span>`;
|
|
509
|
+
case 'mode_change':
|
|
510
|
+
return labelHtml + `<span class="tree-muted">[mode: ${escapeHtml(entry.mode)}]</span>`;
|
|
511
|
+
default:
|
|
512
|
+
return labelHtml + `<span class="tree-muted">[${entry.type}]</span>`;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
// ============================================================
|
|
517
|
+
// TREE RENDERING (DOM manipulation)
|
|
518
|
+
// ============================================================
|
|
519
|
+
|
|
520
|
+
let currentLeafId = leafId;
|
|
521
|
+
let currentTargetId = urlTargetId || leafId;
|
|
522
|
+
let treeRendered = false;
|
|
523
|
+
|
|
524
|
+
function renderTree() {
|
|
525
|
+
const tree = buildTree();
|
|
526
|
+
const activePathIds = buildActivePathIds(currentLeafId);
|
|
527
|
+
const flatNodes = flattenTree(tree, activePathIds);
|
|
528
|
+
const filtered = filterNodes(flatNodes, currentLeafId);
|
|
529
|
+
const container = document.getElementById('tree-container');
|
|
530
|
+
|
|
531
|
+
// Full render only on first call or when filter/search changes
|
|
532
|
+
if (!treeRendered) {
|
|
533
|
+
container.innerHTML = '';
|
|
534
|
+
|
|
535
|
+
for (const flatNode of filtered) {
|
|
536
|
+
const entry = flatNode.node.entry;
|
|
537
|
+
const isOnPath = activePathIds.has(entry.id);
|
|
538
|
+
const isTarget = entry.id === currentTargetId;
|
|
539
|
+
|
|
540
|
+
const div = document.createElement('div');
|
|
541
|
+
div.className = 'tree-node';
|
|
542
|
+
if (isOnPath) div.classList.add('in-path');
|
|
543
|
+
if (isTarget) div.classList.add('active');
|
|
544
|
+
div.dataset.id = entry.id;
|
|
545
|
+
|
|
546
|
+
const prefix = buildTreePrefix(flatNode);
|
|
547
|
+
const prefixSpan = document.createElement('span');
|
|
548
|
+
prefixSpan.className = 'tree-prefix';
|
|
549
|
+
prefixSpan.textContent = prefix;
|
|
550
|
+
|
|
551
|
+
const marker = document.createElement('span');
|
|
552
|
+
marker.className = 'tree-marker';
|
|
553
|
+
marker.textContent = isOnPath ? '•' : ' ';
|
|
554
|
+
|
|
555
|
+
const content = document.createElement('span');
|
|
556
|
+
content.className = 'tree-content';
|
|
557
|
+
content.innerHTML = getTreeNodeDisplayHtml(entry, flatNode.node.label);
|
|
558
|
+
|
|
559
|
+
div.appendChild(prefixSpan);
|
|
560
|
+
div.appendChild(marker);
|
|
561
|
+
div.appendChild(content);
|
|
562
|
+
div.addEventListener('click', () => navigateTo(entry.id));
|
|
563
|
+
|
|
564
|
+
container.appendChild(div);
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
treeRendered = true;
|
|
568
|
+
} else {
|
|
569
|
+
// Just update markers and classes
|
|
570
|
+
const nodes = container.querySelectorAll('.tree-node');
|
|
571
|
+
for (const node of nodes) {
|
|
572
|
+
const id = node.dataset.id;
|
|
573
|
+
const isOnPath = activePathIds.has(id);
|
|
574
|
+
const isTarget = id === currentTargetId;
|
|
575
|
+
|
|
576
|
+
node.classList.toggle('in-path', isOnPath);
|
|
577
|
+
node.classList.toggle('active', isTarget);
|
|
578
|
+
|
|
579
|
+
const marker = node.querySelector('.tree-marker');
|
|
580
|
+
if (marker) {
|
|
581
|
+
marker.textContent = isOnPath ? '•' : ' ';
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
document.getElementById('tree-status').textContent = `${filtered.length} / ${flatNodes.length} entries`;
|
|
587
|
+
|
|
588
|
+
// Scroll active node into view after layout
|
|
589
|
+
setTimeout(() => {
|
|
590
|
+
const activeNode = container.querySelector('.tree-node.active');
|
|
591
|
+
if (activeNode) {
|
|
592
|
+
activeNode.scrollIntoView({ block: 'nearest' });
|
|
593
|
+
}
|
|
594
|
+
}, 0);
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
function forceTreeRerender() {
|
|
598
|
+
treeRendered = false;
|
|
599
|
+
renderTree();
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
// ============================================================
|
|
603
|
+
// MESSAGE RENDERING
|
|
604
|
+
// ============================================================
|
|
605
|
+
|
|
606
|
+
function formatTokens(count) {
|
|
607
|
+
if (count < 1000) return count.toString();
|
|
608
|
+
if (count < 10000) return (count / 1000).toFixed(1) + 'k';
|
|
609
|
+
if (count < 1000000) return Math.round(count / 1000) + 'k';
|
|
610
|
+
return (count / 1000000).toFixed(1) + 'M';
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
function formatTimestamp(ts) {
|
|
614
|
+
if (!ts) return '';
|
|
615
|
+
const date = new Date(ts);
|
|
616
|
+
return date.toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit', second: '2-digit' });
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
function replaceTabs(text) {
|
|
620
|
+
return text.replace(/\t/g, ' ');
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
/** Safely coerce value to string for display. Returns null if invalid type. */
|
|
624
|
+
function str(value) {
|
|
625
|
+
if (typeof value === 'string') return value;
|
|
626
|
+
if (value == null) return '';
|
|
627
|
+
return null;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
function getLanguageFromPath(filePath) {
|
|
631
|
+
const ext = filePath.split('.').pop()?.toLowerCase();
|
|
632
|
+
const extToLang = {
|
|
633
|
+
ts: 'typescript', tsx: 'typescript', js: 'javascript', jsx: 'javascript',
|
|
634
|
+
py: 'python', rb: 'ruby', rs: 'rust', go: 'go', java: 'java',
|
|
635
|
+
c: 'c', cpp: 'cpp', h: 'c', hpp: 'cpp', cs: 'csharp',
|
|
636
|
+
php: 'php', sh: 'bash', bash: 'bash', zsh: 'bash',
|
|
637
|
+
sql: 'sql', html: 'html', css: 'css', scss: 'scss',
|
|
638
|
+
json: 'json', yaml: 'yaml', yml: 'yaml', xml: 'xml',
|
|
639
|
+
md: 'markdown', dockerfile: 'dockerfile'
|
|
640
|
+
};
|
|
641
|
+
return extToLang[ext];
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
function findToolResult(toolCallId) {
|
|
645
|
+
for (const entry of entries) {
|
|
646
|
+
if (entry.type === 'message' && entry.message.role === 'toolResult') {
|
|
647
|
+
if (entry.message.toolCallId === toolCallId) {
|
|
648
|
+
return entry.message;
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
return null;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
function formatExpandableOutput(text, maxLines, lang) {
|
|
656
|
+
text = replaceTabs(text);
|
|
657
|
+
const lines = text.split('\n');
|
|
658
|
+
const displayLines = lines.slice(0, maxLines);
|
|
659
|
+
const remaining = lines.length - maxLines;
|
|
660
|
+
|
|
661
|
+
if (lang) {
|
|
662
|
+
let highlighted;
|
|
663
|
+
try {
|
|
664
|
+
highlighted = hljs.highlight(text, { language: lang }).value;
|
|
665
|
+
} catch {
|
|
666
|
+
highlighted = escapeHtml(text);
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
if (remaining > 0) {
|
|
670
|
+
const previewCode = displayLines.join('\n');
|
|
671
|
+
let previewHighlighted;
|
|
672
|
+
try {
|
|
673
|
+
previewHighlighted = hljs.highlight(previewCode, { language: lang }).value;
|
|
674
|
+
} catch {
|
|
675
|
+
previewHighlighted = escapeHtml(previewCode);
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
return `<div class="tool-output expandable" onclick="this.classList.toggle('expanded')">
|
|
679
|
+
<div class="output-preview"><pre><code class="hljs">${previewHighlighted}</code></pre>
|
|
680
|
+
<div class="expand-hint">... (${remaining} more lines)</div></div>
|
|
681
|
+
<div class="output-full"><pre><code class="hljs">${highlighted}</code></pre></div></div>`;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
return `<div class="tool-output"><pre><code class="hljs">${highlighted}</code></pre></div>`;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
// Plain text output
|
|
688
|
+
if (remaining > 0) {
|
|
689
|
+
let out = '<div class="tool-output expandable" onclick="this.classList.toggle(\'expanded\')">';
|
|
690
|
+
out += '<div class="output-preview">';
|
|
691
|
+
for (const line of displayLines) {
|
|
692
|
+
out += `<div>${escapeHtml(replaceTabs(line))}</div>`;
|
|
693
|
+
}
|
|
694
|
+
out += `<div class="expand-hint">... (${remaining} more lines)</div></div>`;
|
|
695
|
+
out += '<div class="output-full">';
|
|
696
|
+
for (const line of lines) {
|
|
697
|
+
out += `<div>${escapeHtml(replaceTabs(line))}</div>`;
|
|
698
|
+
}
|
|
699
|
+
out += '</div></div>';
|
|
700
|
+
return out;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
let out = '<div class="tool-output">';
|
|
704
|
+
for (const line of displayLines) {
|
|
705
|
+
out += `<div>${escapeHtml(replaceTabs(line))}</div>`;
|
|
706
|
+
}
|
|
707
|
+
out += '</div>';
|
|
708
|
+
return out;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
// ============================================================
|
|
712
|
+
// TOOL CALL RENDERING
|
|
713
|
+
// ============================================================
|
|
714
|
+
|
|
715
|
+
// Shared helpers for per-tool renderers.
|
|
716
|
+
function toolHead(label, pathHtml, badges) {
|
|
717
|
+
let html = '<div class="tool-header"><span class="tool-name">' + escapeHtml(label) + '</span>';
|
|
718
|
+
if (pathHtml) html += ' <span class="tool-path">' + pathHtml + '</span>';
|
|
719
|
+
if (badges) {
|
|
720
|
+
for (const badge of badges) {
|
|
721
|
+
if (badge != null && badge !== '') {
|
|
722
|
+
html += ' <span class="tool-badge">' + escapeHtml(String(badge)) + '</span>';
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
html += '</div>';
|
|
727
|
+
return html;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
function invalidArgHtml() {
|
|
731
|
+
return '<span class="tool-error">[invalid arg]</span>';
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
function pathDisplay(filePath, offset, limit) {
|
|
735
|
+
if (filePath == null) return invalidArgHtml();
|
|
736
|
+
let html = escapeHtml(shortenPath(filePath || ''));
|
|
737
|
+
if (offset !== undefined || limit !== undefined) {
|
|
738
|
+
const start = offset == null ? 1 : offset;
|
|
739
|
+
const end = limit !== undefined ? start + limit - 1 : '';
|
|
740
|
+
html += '<span class="line-numbers">:' + start + (end ? '-' + end : '') + '</span>';
|
|
741
|
+
}
|
|
742
|
+
return html;
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
function codeBlock(code, lang) {
|
|
746
|
+
if (code == null || code === '') return '';
|
|
747
|
+
const text = String(code);
|
|
748
|
+
let highlighted;
|
|
749
|
+
try {
|
|
750
|
+
highlighted = lang ? hljs.highlight(text, { language: lang }).value : escapeHtml(text);
|
|
751
|
+
} catch {
|
|
752
|
+
highlighted = escapeHtml(text);
|
|
753
|
+
}
|
|
754
|
+
return '<div class="tool-output"><pre><code class="hljs">' + highlighted + '</code></pre></div>';
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
// Per-tool renderers. Each accepts (name, args, result, ctx) and returns the inner HTML.
|
|
758
|
+
function renderBash(name, args, result, ctx) {
|
|
759
|
+
const command = str(args.command);
|
|
760
|
+
const cwd = str(args.cwd);
|
|
761
|
+
const env = args.env && typeof args.env === 'object' ? args.env : null;
|
|
762
|
+
const cmdDisplay = command === null ? invalidArgHtml() : escapeHtml(command || '...');
|
|
763
|
+
let prefix = '';
|
|
764
|
+
if (env) {
|
|
765
|
+
for (const [k, v] of Object.entries(env)) {
|
|
766
|
+
prefix += escapeHtml(k) + '=' + escapeHtml(String(v)) + ' ';
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
let html = '<div class="tool-command">$ ' + prefix + cmdDisplay + '</div>';
|
|
770
|
+
const badges = [];
|
|
771
|
+
if (cwd) badges.push('cwd=' + shortenPath(cwd));
|
|
772
|
+
if (args.timeout) badges.push('timeout=' + args.timeout + 's');
|
|
773
|
+
if (args.pty) badges.push('pty');
|
|
774
|
+
if (args.head) badges.push('head=' + args.head);
|
|
775
|
+
if (args.tail) badges.push('tail=' + args.tail);
|
|
776
|
+
if (badges.length) {
|
|
777
|
+
html += '<div class="tool-meta">' + badges.map(b => '<span class="tool-badge">' + escapeHtml(b) + '</span>').join(' ') + '</div>';
|
|
778
|
+
}
|
|
779
|
+
if (result) {
|
|
780
|
+
html += ctx.renderResultImages();
|
|
781
|
+
const output = ctx.getResultText().trim();
|
|
782
|
+
if (output) html += formatExpandableOutput(output, 5);
|
|
783
|
+
}
|
|
784
|
+
return html;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
function renderJsLike(name, args, result, ctx) {
|
|
788
|
+
let html = toolHead(name, '');
|
|
789
|
+
const cells = result && result.details && Array.isArray(result.details.cells) ? result.details.cells : null;
|
|
790
|
+
if (cells) {
|
|
791
|
+
for (const cell of cells) {
|
|
792
|
+
html += '<div class="tool-cell">';
|
|
793
|
+
if (cell && cell.title) html += '<div class="tool-cell-title">' + escapeHtml(String(cell.title)) + '</div>';
|
|
794
|
+
const code = cell && typeof cell.code === 'string' ? cell.code : '';
|
|
795
|
+
const lang = cell && cell.language === 'js' ? 'javascript' : 'python';
|
|
796
|
+
html += codeBlock(code, lang);
|
|
797
|
+
html += '</div>';
|
|
798
|
+
}
|
|
799
|
+
} else if (typeof args.input === 'string') {
|
|
800
|
+
html += codeBlock(args.input, null);
|
|
801
|
+
} else {
|
|
802
|
+
html += '<div class="tool-error">[missing input]</div>';
|
|
803
|
+
}
|
|
804
|
+
if (result) {
|
|
805
|
+
html += ctx.renderResultImages();
|
|
806
|
+
const output = ctx.getResultText();
|
|
807
|
+
if (output) html += formatExpandableOutput(output, 10);
|
|
808
|
+
}
|
|
809
|
+
return html;
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
function renderRead(name, args, result, ctx) {
|
|
813
|
+
const filePath = str(args.file_path == null ? args.path : args.file_path);
|
|
814
|
+
let pathHtml = pathDisplay(filePath, args.offset, args.limit);
|
|
815
|
+
if (args.sel) pathHtml += '<span class="line-numbers">:' + escapeHtml(String(args.sel)) + '</span>';
|
|
816
|
+
let html = toolHead('read', pathHtml);
|
|
817
|
+
if (result) {
|
|
818
|
+
html += ctx.renderResultImages();
|
|
819
|
+
const output = ctx.getResultText();
|
|
820
|
+
const lang = filePath ? getLanguageFromPath(filePath) : null;
|
|
821
|
+
if (output) html += formatExpandableOutput(output, 10, lang);
|
|
822
|
+
}
|
|
823
|
+
return html;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
function renderWrite(name, args, result, ctx) {
|
|
827
|
+
const filePath = str(args.file_path == null ? args.path : args.file_path);
|
|
828
|
+
const content = str(args.content);
|
|
829
|
+
const pathHtml = filePath === null ? invalidArgHtml() : escapeHtml(shortenPath(filePath || ''));
|
|
830
|
+
const lineCount = (content != null && content !== '') ? content.split('\n').length : 0;
|
|
831
|
+
const badges = lineCount > 10 ? ['(' + lineCount + ' lines)'] : null;
|
|
832
|
+
let html = toolHead('write', pathHtml, badges);
|
|
833
|
+
if (content === null) {
|
|
834
|
+
html += '<div class="tool-error">[invalid content arg - expected string]</div>';
|
|
835
|
+
} else if (content) {
|
|
836
|
+
const lang = filePath ? getLanguageFromPath(filePath) : null;
|
|
837
|
+
html += formatExpandableOutput(content, 10, lang);
|
|
838
|
+
}
|
|
839
|
+
if (result) {
|
|
840
|
+
const output = ctx.getResultText().trim();
|
|
841
|
+
if (output) html += '<div class="tool-output"><div>' + escapeHtml(output) + '</div></div>';
|
|
842
|
+
}
|
|
843
|
+
return html;
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
function renderEdit(name, args, result, ctx) {
|
|
847
|
+
const filePath = str(args.file_path == null ? args.path : args.file_path);
|
|
848
|
+
const pathHtml = filePath ? escapeHtml(shortenPath(filePath)) : '';
|
|
849
|
+
let html = toolHead('edit', pathHtml);
|
|
850
|
+
if (typeof args.input === 'string' && args.input.length) {
|
|
851
|
+
html += codeBlock(args.input, null);
|
|
852
|
+
} else if (Array.isArray(args.edits)) {
|
|
853
|
+
html += '<div class="tool-args">';
|
|
854
|
+
for (const e of args.edits) {
|
|
855
|
+
const op = e && typeof e.op === 'string' ? e.op : '?';
|
|
856
|
+
const sel = e && typeof e.sel === 'string' ? e.sel : '?';
|
|
857
|
+
html += '<div class="tool-arg"><span class="tool-arg-key">' + escapeHtml(op) + '</span> <span class="tool-arg-val">' + escapeHtml(sel) + '</span></div>';
|
|
858
|
+
}
|
|
859
|
+
html += '</div>';
|
|
860
|
+
}
|
|
861
|
+
if (result?.details?.diff) {
|
|
862
|
+
const diffLines = String(result.details.diff).split('\n');
|
|
863
|
+
html += '<div class="tool-diff">';
|
|
864
|
+
for (const line of diffLines) {
|
|
865
|
+
const cls = line.match(/^\+/) ? 'diff-added' : line.match(/^-/) ? 'diff-removed' : 'diff-context';
|
|
866
|
+
html += '<div class="' + cls + '">' + escapeHtml(replaceTabs(line)) + '</div>';
|
|
867
|
+
}
|
|
868
|
+
html += '</div>';
|
|
869
|
+
} else if (result) {
|
|
870
|
+
const output = ctx.getResultText().trim();
|
|
871
|
+
if (output) html += '<div class="tool-output"><pre>' + escapeHtml(output) + '</pre></div>';
|
|
872
|
+
}
|
|
873
|
+
return html;
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
function renderAstEdit(name, args, result, ctx) {
|
|
877
|
+
const lang = args.lang || null;
|
|
878
|
+
const paths = Array.isArray(args.paths) ? args.paths.map(p => shortenPath(String(p))).join(', ') : (args.path ? shortenPath(String(args.path)) : '');
|
|
879
|
+
const pathHtml = paths ? escapeHtml(paths) : '';
|
|
880
|
+
const badges = [];
|
|
881
|
+
if (lang) badges.push(lang);
|
|
882
|
+
if (args.glob) badges.push('glob=' + args.glob);
|
|
883
|
+
if (args.sel) badges.push('sel=' + args.sel);
|
|
884
|
+
let html = toolHead('ast_edit', pathHtml, badges);
|
|
885
|
+
if (Array.isArray(args.ops)) {
|
|
886
|
+
for (const op of args.ops) {
|
|
887
|
+
html += '<div class="tool-cell">';
|
|
888
|
+
html += '<div class="tool-cell-title">pattern</div>';
|
|
889
|
+
html += codeBlock(String(op?.pat == null ? '' : op.pat), lang);
|
|
890
|
+
html += '<div class="tool-cell-title">replacement</div>';
|
|
891
|
+
html += codeBlock(String(op?.out == null ? '' : op.out), lang);
|
|
892
|
+
html += '</div>';
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
if (result) {
|
|
896
|
+
const output = ctx.getResultText();
|
|
897
|
+
if (output) html += formatExpandableOutput(output, 10);
|
|
898
|
+
}
|
|
899
|
+
return html;
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
function renderAstGrep(name, args, result, ctx) {
|
|
903
|
+
const lang = args.lang || null;
|
|
904
|
+
const pathHtml = args.path ? escapeHtml(shortenPath(String(args.path))) : '';
|
|
905
|
+
const badges = [];
|
|
906
|
+
if (lang) badges.push(lang);
|
|
907
|
+
if (args.glob) badges.push('glob=' + args.glob);
|
|
908
|
+
if (args.sel) badges.push('sel=' + args.sel);
|
|
909
|
+
let html = toolHead('ast_grep', pathHtml, badges);
|
|
910
|
+
if (Array.isArray(args.pat)) {
|
|
911
|
+
for (const pat of args.pat) {
|
|
912
|
+
html += '<div class="tool-cell">' + codeBlock(String(pat == null ? '' : pat), lang) + '</div>';
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
if (result) {
|
|
916
|
+
const output = ctx.getResultText();
|
|
917
|
+
if (output) html += formatExpandableOutput(output, 10);
|
|
918
|
+
}
|
|
919
|
+
return html;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
function renderGrep(name, args, result, ctx) {
|
|
923
|
+
const pattern = str(args.pattern);
|
|
924
|
+
const pathHtml = args.path ? escapeHtml(shortenPath(String(args.path))) : escapeHtml('.');
|
|
925
|
+
const patHtml = pattern === null ? invalidArgHtml() : escapeHtml(pattern);
|
|
926
|
+
let head = '<span class="tool-name">grep</span> <span class="tool-pattern">/' + patHtml + '/</span>';
|
|
927
|
+
head += ' <span class="tool-arg-key">in</span> <span class="tool-path">' + pathHtml + '</span>';
|
|
928
|
+
const badges = [];
|
|
929
|
+
if (args.glob) badges.push('glob=' + args.glob);
|
|
930
|
+
if (args.type) badges.push('type=' + args.type);
|
|
931
|
+
if (args.i) badges.push('i');
|
|
932
|
+
if (args.multiline) badges.push('multiline');
|
|
933
|
+
for (const b of badges) head += ' <span class="tool-badge">' + escapeHtml(b) + '</span>';
|
|
934
|
+
let html = '<div class="tool-header">' + head + '</div>';
|
|
935
|
+
if (result) {
|
|
936
|
+
const output = ctx.getResultText();
|
|
937
|
+
if (output) html += formatExpandableOutput(output, 10);
|
|
938
|
+
}
|
|
939
|
+
return html;
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
function renderFind(name, args, result, ctx) {
|
|
943
|
+
const paths = Array.isArray(args.paths) ? args.paths.map(p => shortenPath(String(p))).join(', ') : (str(args.pattern) || '.');
|
|
944
|
+
const patHtml = paths ? escapeHtml(paths) : invalidArgHtml();
|
|
945
|
+
const badges = [];
|
|
946
|
+
if (args.limit) badges.push('limit=' + args.limit);
|
|
947
|
+
if (args.hidden === false) badges.push('no-hidden');
|
|
948
|
+
let html = toolHead('find', '<span class="tool-pattern">' + patHtml + '</span>', badges.length ? badges : null);
|
|
949
|
+
if (result) {
|
|
950
|
+
const output = ctx.getResultText();
|
|
951
|
+
if (output) html += formatExpandableOutput(output, 10);
|
|
952
|
+
}
|
|
953
|
+
return html;
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
function renderLsp(name, args, result, ctx) {
|
|
957
|
+
const action = str(args.action) || '?';
|
|
958
|
+
let head = '<span class="tool-name">lsp</span> <span class="tool-badge">' + escapeHtml(action) + '</span>';
|
|
959
|
+
if (args.file && args.file !== '*') {
|
|
960
|
+
head += ' <span class="tool-path">' + escapeHtml(shortenPath(String(args.file))) + '</span>';
|
|
961
|
+
} else if (args.file === '*') {
|
|
962
|
+
head += ' <span class="tool-badge">workspace</span>';
|
|
963
|
+
}
|
|
964
|
+
if (args.line) head += '<span class="line-numbers">:' + args.line + '</span>';
|
|
965
|
+
if (args.symbol) head += ' <span class="tool-arg-val">' + escapeHtml(String(args.symbol)) + '</span>';
|
|
966
|
+
if (args.query) head += ' <span class="tool-arg-key">query=</span><span class="tool-arg-val">' + escapeHtml(String(args.query)) + '</span>';
|
|
967
|
+
if (args.new_name) head += ' <span class="tool-arg-key">→</span> <span class="tool-arg-val">' + escapeHtml(String(args.new_name)) + '</span>';
|
|
968
|
+
let html = '<div class="tool-header">' + head + '</div>';
|
|
969
|
+
if (result) {
|
|
970
|
+
const output = ctx.getResultText();
|
|
971
|
+
if (output) html += formatExpandableOutput(output, 12);
|
|
972
|
+
}
|
|
973
|
+
return html;
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
function todoRoman(n) {
|
|
977
|
+
if (n <= 0) return '';
|
|
978
|
+
var pairs = [[1000,'M'],[900,'CM'],[500,'D'],[400,'CD'],[100,'C'],[90,'XC'],[50,'L'],[40,'XL'],[10,'X'],[9,'IX'],[5,'V'],[4,'IV'],[1,'I']];
|
|
979
|
+
var out = '', rem = n;
|
|
980
|
+
for (var i = 0; i < pairs.length; i++) {
|
|
981
|
+
while (rem >= pairs[i][0]) { out += pairs[i][1]; rem -= pairs[i][0]; }
|
|
982
|
+
}
|
|
983
|
+
return out;
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
function renderTodoWrite(name, args, result, ctx) {
|
|
987
|
+
let html = toolHead('todo_write');
|
|
988
|
+
const ops = Array.isArray(args.ops) ? args.ops : null;
|
|
989
|
+
if (ops) {
|
|
990
|
+
html += '<div class="tool-args">';
|
|
991
|
+
for (const op of ops) {
|
|
992
|
+
const t = op && op.op ? op.op : '?';
|
|
993
|
+
let line = '<span class="tool-arg-key">' + escapeHtml(t) + '</span>';
|
|
994
|
+
if (op?.id) line += ' <span class="tool-arg-val">' + escapeHtml(String(op.id)) + '</span>';
|
|
995
|
+
if (op?.status) line += ' <span class="tool-badge">' + escapeHtml(String(op.status)) + '</span>';
|
|
996
|
+
if (op?.content) line += ' ' + escapeHtml(truncate(String(op.content), 80));
|
|
997
|
+
if (op?.task && typeof op.task === 'object' && op.task.content) line += ' ' + escapeHtml(truncate(String(op.task.content), 80));
|
|
998
|
+
html += '<div class="tool-arg">' + line + '</div>';
|
|
999
|
+
}
|
|
1000
|
+
html += '</div>';
|
|
1001
|
+
}
|
|
1002
|
+
const phases = result?.details?.phases;
|
|
1003
|
+
if (Array.isArray(phases)) {
|
|
1004
|
+
html += '<div class="todo-tree">';
|
|
1005
|
+
for (var __i = 0; __i < phases.length; __i++) {
|
|
1006
|
+
var phase = phases[__i];
|
|
1007
|
+
var phaseLabel = todoRoman(__i + 1) + '. ' + String(phase.name || '');
|
|
1008
|
+
html += '<div class="todo-phase">' + escapeHtml(phaseLabel) + '</div>';
|
|
1009
|
+
if (Array.isArray(phase.tasks)) {
|
|
1010
|
+
for (const task of phase.tasks) {
|
|
1011
|
+
const status = task.status || 'pending';
|
|
1012
|
+
const icon = status === 'completed' ? '✓' : status === 'in_progress' ? '→' : status === 'abandoned' ? '✕' : '○';
|
|
1013
|
+
html += '<div class="todo-task todo-' + status + '"><span class="todo-icon">' + icon + '</span> ' + escapeHtml(String(task.content || '')) + '</div>';
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
html += '</div>';
|
|
1018
|
+
} else if (result) {
|
|
1019
|
+
const output = ctx.getResultText();
|
|
1020
|
+
if (output) html += formatExpandableOutput(output, 8);
|
|
1021
|
+
}
|
|
1022
|
+
return html;
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
function renderTask(name, args, result, ctx) {
|
|
1026
|
+
const agent = str(args.agent) || '?';
|
|
1027
|
+
const tasks = Array.isArray(args.tasks) ? args.tasks : [];
|
|
1028
|
+
const badges = ['agent=' + agent, tasks.length + ' subtask' + (tasks.length === 1 ? '' : 's')];
|
|
1029
|
+
if (args.isolated) badges.push('isolated');
|
|
1030
|
+
let html = toolHead('task', '', badges);
|
|
1031
|
+
if (tasks.length) {
|
|
1032
|
+
html += '<div class="tool-args">';
|
|
1033
|
+
for (const t of tasks) {
|
|
1034
|
+
const id = t?.id ? escapeHtml(String(t.id)) : '?';
|
|
1035
|
+
const desc = t?.description ? escapeHtml(String(t.description)) : '';
|
|
1036
|
+
html += '<div class="tool-arg"><span class="tool-arg-key">' + id + '</span> ' + desc + '</div>';
|
|
1037
|
+
}
|
|
1038
|
+
html += '</div>';
|
|
1039
|
+
}
|
|
1040
|
+
if (result) {
|
|
1041
|
+
const output = ctx.getResultText();
|
|
1042
|
+
if (output) html += formatExpandableOutput(output, 12);
|
|
1043
|
+
}
|
|
1044
|
+
return html;
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
function renderWebSearch(name, args, result, ctx) {
|
|
1048
|
+
const query = str(args.query);
|
|
1049
|
+
const queryHtml = query === null ? invalidArgHtml() : escapeHtml(query);
|
|
1050
|
+
const badges = [];
|
|
1051
|
+
if (args.recency) badges.push('recency=' + args.recency);
|
|
1052
|
+
if (args.limit) badges.push('limit=' + args.limit);
|
|
1053
|
+
let html = toolHead('web_search', '<span class="tool-pattern">' + queryHtml + '</span>', badges);
|
|
1054
|
+
if (result) {
|
|
1055
|
+
const output = ctx.getResultText();
|
|
1056
|
+
if (output) html += formatExpandableOutput(output, 12, 'markdown');
|
|
1057
|
+
}
|
|
1058
|
+
return html;
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
function renderFetch(name, args, result, ctx) {
|
|
1062
|
+
const url = str(args.url) || '';
|
|
1063
|
+
const badges = args.method ? [String(args.method)] : null;
|
|
1064
|
+
let html = toolHead('fetch', '<span class="tool-path">' + escapeHtml(url) + '</span>', badges);
|
|
1065
|
+
if (result) {
|
|
1066
|
+
const output = ctx.getResultText();
|
|
1067
|
+
if (output) html += formatExpandableOutput(output, 10);
|
|
1068
|
+
}
|
|
1069
|
+
return html;
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
function renderDebug(name, args, result, ctx) {
|
|
1073
|
+
const action = str(args.action) || '?';
|
|
1074
|
+
const badges = [];
|
|
1075
|
+
if (args.adapter) badges.push(args.adapter);
|
|
1076
|
+
if (args.program) badges.push('program=' + shortenPath(String(args.program)));
|
|
1077
|
+
if (args.file) badges.push('file=' + shortenPath(String(args.file)));
|
|
1078
|
+
if (args.line) badges.push('line=' + args.line);
|
|
1079
|
+
let head = '<span class="tool-name">debug</span> <span class="tool-badge">' + escapeHtml(action) + '</span>';
|
|
1080
|
+
for (const b of badges) head += ' <span class="tool-badge">' + escapeHtml(String(b)) + '</span>';
|
|
1081
|
+
let html = '<div class="tool-header">' + head + '</div>';
|
|
1082
|
+
if (args.expression) html += codeBlock(String(args.expression));
|
|
1083
|
+
if (result) {
|
|
1084
|
+
const output = ctx.getResultText();
|
|
1085
|
+
if (output) html += formatExpandableOutput(output, 10);
|
|
1086
|
+
}
|
|
1087
|
+
return html;
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
function renderBrowser(name, args, result, ctx) {
|
|
1091
|
+
const action = str(args.action) || '?';
|
|
1092
|
+
const tabName = str(args.name);
|
|
1093
|
+
const badges = [];
|
|
1094
|
+
if (tabName) badges.push('name=' + tabName);
|
|
1095
|
+
if (args.url) badges.push(String(args.url));
|
|
1096
|
+
if (args.app && typeof args.app === 'object') {
|
|
1097
|
+
if (args.app.path) badges.push('app=' + shortenPath(String(args.app.path)));
|
|
1098
|
+
else if (args.app.cdp_url) badges.push('cdp=' + String(args.app.cdp_url));
|
|
1099
|
+
}
|
|
1100
|
+
if (args.all) badges.push('all');
|
|
1101
|
+
if (args.kill) badges.push('kill');
|
|
1102
|
+
let head = '<span class="tool-name">browser</span> <span class="tool-badge">' + escapeHtml(action) + '</span>';
|
|
1103
|
+
for (const b of badges) head += ' <span class="tool-badge">' + escapeHtml(String(b)) + '</span>';
|
|
1104
|
+
let html = '<div class="tool-header">' + head + '</div>';
|
|
1105
|
+
if (action === 'run' && args.code) {
|
|
1106
|
+
html += codeBlock(String(args.code), 'javascript');
|
|
1107
|
+
}
|
|
1108
|
+
if (result) {
|
|
1109
|
+
html += ctx.renderResultImages();
|
|
1110
|
+
const output = ctx.getResultText();
|
|
1111
|
+
if (output) html += formatExpandableOutput(output, 10);
|
|
1112
|
+
}
|
|
1113
|
+
return html;
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
function renderInspectImage(name, args, result, ctx) {
|
|
1117
|
+
const p = str(args.path == null ? args.url : args.path) || '';
|
|
1118
|
+
let html = toolHead('inspect_image', escapeHtml(shortenPath(p)));
|
|
1119
|
+
if (result) {
|
|
1120
|
+
html += ctx.renderResultImages();
|
|
1121
|
+
const output = ctx.getResultText();
|
|
1122
|
+
if (output) html += formatExpandableOutput(output, 8);
|
|
1123
|
+
}
|
|
1124
|
+
return html;
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
function renderGenerateImage(name, args, result, ctx) {
|
|
1128
|
+
const subject = str(args.subject) || '';
|
|
1129
|
+
const badges = args.aspect_ratio ? [String(args.aspect_ratio)] : null;
|
|
1130
|
+
let html = toolHead('generate_image', '', badges);
|
|
1131
|
+
if (subject) html += '<div class="tool-output"><div>' + escapeHtml(subject) + '</div></div>';
|
|
1132
|
+
if (result) {
|
|
1133
|
+
html += ctx.renderResultImages();
|
|
1134
|
+
}
|
|
1135
|
+
return html;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
function renderAsk(name, args, result, ctx) {
|
|
1139
|
+
let html = toolHead('ask');
|
|
1140
|
+
const questions = Array.isArray(args.questions) ? args.questions : null;
|
|
1141
|
+
if (questions) {
|
|
1142
|
+
html += '<div class="tool-args">';
|
|
1143
|
+
for (const q of questions) {
|
|
1144
|
+
html += '<div class="tool-arg"><span class="tool-arg-key">Q:</span> ' + escapeHtml(String(q?.question || '')) + '</div>';
|
|
1145
|
+
if (Array.isArray(q?.options)) {
|
|
1146
|
+
for (const opt of q.options) {
|
|
1147
|
+
html += '<div class="tool-arg"><span class="tool-arg-key"> -</span> ' + escapeHtml(String(opt?.label || '')) + '</div>';
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
html += '</div>';
|
|
1152
|
+
}
|
|
1153
|
+
if (result) {
|
|
1154
|
+
const output = ctx.getResultText();
|
|
1155
|
+
if (output) html += formatExpandableOutput(output, 8);
|
|
1156
|
+
}
|
|
1157
|
+
return html;
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
function renderResolve(name, args, result, ctx) {
|
|
1161
|
+
const action = str(args.action) || '?';
|
|
1162
|
+
let html = toolHead('resolve', '', [action]);
|
|
1163
|
+
if (args.reason) html += '<div class="tool-output"><div>' + escapeHtml(String(args.reason)) + '</div></div>';
|
|
1164
|
+
if (result) {
|
|
1165
|
+
const output = ctx.getResultText();
|
|
1166
|
+
if (output) html += formatExpandableOutput(output, 6);
|
|
1167
|
+
}
|
|
1168
|
+
return html;
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
function renderGh(name, args, result, ctx) {
|
|
1172
|
+
const op = str(args.op);
|
|
1173
|
+
const badges = [];
|
|
1174
|
+
if (op) badges.push(op);
|
|
1175
|
+
if (args.repo) badges.push(String(args.repo));
|
|
1176
|
+
if (args.issue) badges.push('#' + args.issue);
|
|
1177
|
+
if (args.pr) badges.push(Array.isArray(args.pr) ? 'PRs ' + args.pr.join(',') : 'PR ' + args.pr);
|
|
1178
|
+
if (args.branch) badges.push('branch=' + args.branch);
|
|
1179
|
+
if (args.query) badges.push('query=' + truncate(String(args.query), 60));
|
|
1180
|
+
if (args.run) badges.push('run=' + args.run);
|
|
1181
|
+
if (args.title) badges.push('title=' + truncate(String(args.title), 40));
|
|
1182
|
+
let html = toolHead(name, '', badges);
|
|
1183
|
+
if (args.body) html += '<div class="tool-output"><div>' + escapeHtml(truncate(String(args.body), 400)) + '</div></div>';
|
|
1184
|
+
if (result) {
|
|
1185
|
+
const output = ctx.getResultText();
|
|
1186
|
+
if (output) html += formatExpandableOutput(output, 12, 'markdown');
|
|
1187
|
+
}
|
|
1188
|
+
return html;
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
function renderMermaid(name, args, result, ctx) {
|
|
1192
|
+
let html = toolHead('render_mermaid');
|
|
1193
|
+
const code = args.code || args.source;
|
|
1194
|
+
if (code) html += codeBlock(String(code), 'mermaid');
|
|
1195
|
+
if (result) {
|
|
1196
|
+
html += ctx.renderResultImages();
|
|
1197
|
+
const output = ctx.getResultText();
|
|
1198
|
+
if (output) html += formatExpandableOutput(output, 6);
|
|
1199
|
+
}
|
|
1200
|
+
return html;
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
function renderYield(name, args, result, ctx) {
|
|
1204
|
+
let html = toolHead('yield');
|
|
1205
|
+
if (args.data !== undefined) {
|
|
1206
|
+
html += '<div class="tool-output"><pre>' + escapeHtml(JSON.stringify(args.data, null, 2)) + '</pre></div>';
|
|
1207
|
+
}
|
|
1208
|
+
if (result) {
|
|
1209
|
+
const output = ctx.getResultText();
|
|
1210
|
+
if (output) html += formatExpandableOutput(output, 6);
|
|
1211
|
+
}
|
|
1212
|
+
return html;
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
function renderReportFinding(name, args, result, ctx) {
|
|
1216
|
+
const badges = [];
|
|
1217
|
+
if (args.priority) badges.push('priority=' + args.priority);
|
|
1218
|
+
if (args.confidence != null) badges.push('confidence=' + args.confidence);
|
|
1219
|
+
if (args.file_path) badges.push(shortenPath(String(args.file_path)));
|
|
1220
|
+
let html = toolHead('report_finding', args.title ? escapeHtml(String(args.title)) : '', badges);
|
|
1221
|
+
if (args.body) html += '<div class="tool-output"><div>' + escapeHtml(String(args.body)) + '</div></div>';
|
|
1222
|
+
return html;
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
function renderCalc(name, args, result, ctx) {
|
|
1226
|
+
let html = toolHead('calc');
|
|
1227
|
+
const exprs = args.expressions || (args.expression ? [args.expression] : []);
|
|
1228
|
+
for (const e of exprs) html += codeBlock(String(e), 'plaintext');
|
|
1229
|
+
if (result) {
|
|
1230
|
+
const output = ctx.getResultText();
|
|
1231
|
+
if (output) html += formatExpandableOutput(output, 6);
|
|
1232
|
+
}
|
|
1233
|
+
return html;
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
function renderJob(name, args, result, ctx) {
|
|
1237
|
+
const badges = [];
|
|
1238
|
+
const pollIds = Array.isArray(args.poll) ? args.poll : Array.isArray(args.jobs) ? args.jobs : Array.isArray(args.jobIds) ? args.jobIds : [];
|
|
1239
|
+
const cancelIds = Array.isArray(args.cancel) ? args.cancel : args.jobId ? [String(args.jobId)] : [];
|
|
1240
|
+
if (cancelIds.length > 0) badges.push('cancel ' + cancelIds.length);
|
|
1241
|
+
if (pollIds.length > 0) badges.push('poll ' + pollIds.length);
|
|
1242
|
+
let html = toolHead('job', '', badges);
|
|
1243
|
+
if (result) {
|
|
1244
|
+
const output = ctx.getResultText();
|
|
1245
|
+
if (output) html += formatExpandableOutput(output, 8);
|
|
1246
|
+
}
|
|
1247
|
+
return html;
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
// Parse `*** Cell <attrs>` headers (canonical), plus legacy
|
|
1251
|
+
// `*** Begin <LANG>` headers and `===== <info> =====` bars used in
|
|
1252
|
+
// older transcripts. Cells emitted before each format cutover still
|
|
1253
|
+
// need to render in HTML exports.
|
|
1254
|
+
function parseEvalCells(input) {
|
|
1255
|
+
const text = String(input);
|
|
1256
|
+
if (/^[*]{2,}\s*Cell\b/im.test(text)) return parseEvalCellsCell(text);
|
|
1257
|
+
if (/^[*]{2,}\s*Begin\b/im.test(text)) return parseEvalCellsBegin(text);
|
|
1258
|
+
return parseEvalCellsLegacy(text);
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
function evalLangAlias(token) {
|
|
1262
|
+
const t = String(token || '').toUpperCase();
|
|
1263
|
+
if (t === 'PY' || t === 'PYTHON' || t === 'IPY' || t === 'IPYTHON') return 'py';
|
|
1264
|
+
if (t === 'JS' || t === 'JAVASCRIPT') return 'js';
|
|
1265
|
+
if (t === 'TS' || t === 'TYPESCRIPT') return 'ts';
|
|
1266
|
+
return null;
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
// Tokenize a `*** Cell` header attribute list, preserving quoted
|
|
1270
|
+
// segments. Mirrors `tokenizeCellAttrs` in src/eval/parse.ts.
|
|
1271
|
+
function tokenizeCellAttrsHtml(input) {
|
|
1272
|
+
const tokens = [];
|
|
1273
|
+
let i = 0;
|
|
1274
|
+
while (i < input.length) {
|
|
1275
|
+
while (i < input.length && /\s/.test(input[i])) i++;
|
|
1276
|
+
if (i >= input.length) break;
|
|
1277
|
+
let tok = '';
|
|
1278
|
+
while (i < input.length && !/\s/.test(input[i])) {
|
|
1279
|
+
const ch = input[i];
|
|
1280
|
+
if (ch === '"' || ch === "'") {
|
|
1281
|
+
tok += ch; i++;
|
|
1282
|
+
while (i < input.length && input[i] !== ch) { tok += input[i]; i++; }
|
|
1283
|
+
if (i < input.length) { tok += input[i]; i++; }
|
|
1284
|
+
} else { tok += ch; i++; }
|
|
1285
|
+
}
|
|
1286
|
+
tokens.push(tok);
|
|
1287
|
+
}
|
|
1288
|
+
return tokens;
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
function parseEvalCellsCell(text) {
|
|
1292
|
+
const STARS = '\\*{2,}';
|
|
1293
|
+
const CELL = new RegExp('^' + STARS + '\\s*Cell\\b\\s*(.*)$', 'i');
|
|
1294
|
+
const END = new RegExp('^' + STARS + '\\s*End\\b.*$', 'i');
|
|
1295
|
+
const ATTR = /^([a-zA-Z][\w-]*)(?::(?:"([^"]*)"|'([^']*)'|(.*)))?$/;
|
|
1296
|
+
const DUR = /^\d+(?:ms|s|m)?$/;
|
|
1297
|
+
const ID_KEYS = ['id', 'title', 'name', 'cell', 'file', 'label'];
|
|
1298
|
+
const T_KEYS = ['t', 'timeout', 'duration', 'time'];
|
|
1299
|
+
const RST_KEYS = ['rst', 'reset'];
|
|
1300
|
+
const lines = text.split('\n');
|
|
1301
|
+
if (lines.length && lines[lines.length - 1] === '') lines.pop();
|
|
1302
|
+
const cells = [];
|
|
1303
|
+
let i = 0;
|
|
1304
|
+
while (i < lines.length && lines[i].trim() === '') i++;
|
|
1305
|
+
while (i < lines.length) {
|
|
1306
|
+
const m = CELL.exec(lines[i]);
|
|
1307
|
+
if (!m) { i++; continue; }
|
|
1308
|
+
const tokens = tokenizeCellAttrsHtml(m[1] || '');
|
|
1309
|
+
let lang = null;
|
|
1310
|
+
let title = '';
|
|
1311
|
+
const attrs = [];
|
|
1312
|
+
let bareReset = false;
|
|
1313
|
+
const titleParts = [];
|
|
1314
|
+
for (const tok of tokens) {
|
|
1315
|
+
const lower = tok.toLowerCase();
|
|
1316
|
+
if (RST_KEYS.indexOf(lower) >= 0) { bareReset = true; continue; }
|
|
1317
|
+
const am = ATTR.exec(tok);
|
|
1318
|
+
if (am && tok.indexOf(':') >= 0) {
|
|
1319
|
+
const key = am[1].toLowerCase();
|
|
1320
|
+
const value = am[2] !== undefined ? am[2] : am[3] !== undefined ? am[3] : (am[4] || '');
|
|
1321
|
+
const lc = evalLangAlias(key);
|
|
1322
|
+
if (lc) {
|
|
1323
|
+
if (!lang) lang = lc;
|
|
1324
|
+
if (!title && value) title = value;
|
|
1325
|
+
continue;
|
|
1326
|
+
}
|
|
1327
|
+
if (ID_KEYS.indexOf(key) >= 0) { if (!title) title = value; continue; }
|
|
1328
|
+
if (T_KEYS.indexOf(key) >= 0) { attrs.push('t=' + value); continue; }
|
|
1329
|
+
if (RST_KEYS.indexOf(key) >= 0) { attrs.push('rst'); continue; }
|
|
1330
|
+
continue;
|
|
1331
|
+
}
|
|
1332
|
+
const lc = evalLangAlias(tok);
|
|
1333
|
+
if (lc && !lang) { lang = lc; continue; }
|
|
1334
|
+
if (DUR.test(tok)) { attrs.push('t=' + tok); continue; }
|
|
1335
|
+
titleParts.push(tok);
|
|
1336
|
+
}
|
|
1337
|
+
if (!title && titleParts.length) title = titleParts.join(' ');
|
|
1338
|
+
if (bareReset) attrs.push('rst');
|
|
1339
|
+
lang = lang || 'py';
|
|
1340
|
+
i++;
|
|
1341
|
+
const codeLines = [];
|
|
1342
|
+
while (i < lines.length) {
|
|
1343
|
+
if (END.test(lines[i])) { i++; break; }
|
|
1344
|
+
if (CELL.test(lines[i])) break;
|
|
1345
|
+
codeLines.push(lines[i]);
|
|
1346
|
+
i++;
|
|
1347
|
+
}
|
|
1348
|
+
while (codeLines.length && codeLines[codeLines.length - 1].trim() === '') codeLines.pop();
|
|
1349
|
+
cells.push({ lang, title, attrs, code: codeLines.join('\n') });
|
|
1350
|
+
while (i < lines.length && lines[i].trim() === '') i++;
|
|
1351
|
+
}
|
|
1352
|
+
return cells;
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
function parseEvalCellsBegin(text) {
|
|
1356
|
+
const STARS = '\\*{2,}';
|
|
1357
|
+
const BEGIN = new RegExp('^' + STARS + '\\s*Begin\\b\\s*(\\S+)?\\s*$', 'i');
|
|
1358
|
+
const END = new RegExp('^' + STARS + '\\s*End\\b.*$', 'i');
|
|
1359
|
+
const TITLE = new RegExp('^' + STARS + '\\s*Title\\s*:\\s*(.+?)\\s*$', 'i');
|
|
1360
|
+
const TIMEOUT = new RegExp('^' + STARS + '\\s*Timeout\\s*:\\s*(\\S+)\\s*$', 'i');
|
|
1361
|
+
const RESET = new RegExp('^' + STARS + '\\s*Reset\\s*$', 'i');
|
|
1362
|
+
const lines = text.split('\n');
|
|
1363
|
+
if (lines.length && lines[lines.length - 1] === '') lines.pop();
|
|
1364
|
+
const cells = [];
|
|
1365
|
+
let i = 0;
|
|
1366
|
+
while (i < lines.length && lines[i].trim() === '') i++;
|
|
1367
|
+
while (i < lines.length) {
|
|
1368
|
+
const beginMatch = BEGIN.exec(lines[i]);
|
|
1369
|
+
if (!beginMatch) { i++; continue; }
|
|
1370
|
+
const lang = evalLangAlias(beginMatch[1]) || 'py';
|
|
1371
|
+
i++;
|
|
1372
|
+
let title = '';
|
|
1373
|
+
const attrs = [];
|
|
1374
|
+
while (i < lines.length) {
|
|
1375
|
+
const tm = TITLE.exec(lines[i]);
|
|
1376
|
+
if (tm) { if (!title) title = tm[1]; i++; continue; }
|
|
1377
|
+
const to = TIMEOUT.exec(lines[i]);
|
|
1378
|
+
if (to) { attrs.push('t=' + to[1]); i++; continue; }
|
|
1379
|
+
if (RESET.test(lines[i])) { attrs.push('rst'); i++; continue; }
|
|
1380
|
+
break;
|
|
1381
|
+
}
|
|
1382
|
+
const codeLines = [];
|
|
1383
|
+
while (i < lines.length) {
|
|
1384
|
+
if (END.test(lines[i])) { i++; break; }
|
|
1385
|
+
if (BEGIN.test(lines[i])) break;
|
|
1386
|
+
codeLines.push(lines[i]);
|
|
1387
|
+
i++;
|
|
1388
|
+
}
|
|
1389
|
+
while (codeLines.length && codeLines[codeLines.length - 1].trim() === '') codeLines.pop();
|
|
1390
|
+
cells.push({ lang, title, attrs, code: codeLines.join('\n') });
|
|
1391
|
+
while (i < lines.length && lines[i].trim() === '') i++;
|
|
1392
|
+
}
|
|
1393
|
+
return cells;
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1396
|
+
function parseEvalCellsLegacy(input) {
|
|
1397
|
+
const HEADER = /^={5,}\s*(.*?)\s*={5,}\s*$/;
|
|
1398
|
+
const lines = String(input).split('\n');
|
|
1399
|
+
const cells = [];
|
|
1400
|
+
let inheritedLang = 'py';
|
|
1401
|
+
let current = null;
|
|
1402
|
+
for (const line of lines) {
|
|
1403
|
+
const m = line.match(HEADER);
|
|
1404
|
+
if (m) {
|
|
1405
|
+
if (current) cells.push(current);
|
|
1406
|
+
const info = m[1] || '';
|
|
1407
|
+
let lang = inheritedLang;
|
|
1408
|
+
let title = '';
|
|
1409
|
+
const langMatch = info.match(/^(py|js|ts)(?::"([^"]*)")?/);
|
|
1410
|
+
if (langMatch) {
|
|
1411
|
+
lang = langMatch[1];
|
|
1412
|
+
if (langMatch[2]) title = langMatch[2];
|
|
1413
|
+
}
|
|
1414
|
+
if (!title) {
|
|
1415
|
+
const idMatch = info.match(/id:"([^"]*)"/);
|
|
1416
|
+
if (idMatch) title = idMatch[1];
|
|
1417
|
+
}
|
|
1418
|
+
inheritedLang = lang;
|
|
1419
|
+
const attrs = [];
|
|
1420
|
+
const tMatch = info.match(/(?:^|\s)t:(\S+)/);
|
|
1421
|
+
if (tMatch) attrs.push('t=' + tMatch[1]);
|
|
1422
|
+
if (/(?:^|\s)rst(?:\s|$)/.test(info)) attrs.push('rst');
|
|
1423
|
+
current = { lang, title, attrs, code: '' };
|
|
1424
|
+
} else {
|
|
1425
|
+
if (!current) current = { lang: inheritedLang, title: '', attrs: [], code: '' };
|
|
1426
|
+
current.code += (current.code ? '\n' : '') + line;
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
if (current) cells.push(current);
|
|
1430
|
+
return cells.map(c => ({ ...c, code: c.code.replace(/\s+$/, '') }));
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
function evalLangToHljs(lang) {
|
|
1434
|
+
return lang === 'py' ? 'python' : lang === 'js' ? 'javascript' : lang === 'ts' ? 'typescript' : null;
|
|
1435
|
+
}
|
|
1436
|
+
|
|
1437
|
+
function renderEval(name, args, result, ctx) {
|
|
1438
|
+
let html = toolHead('eval');
|
|
1439
|
+
if (typeof args.input !== 'string') {
|
|
1440
|
+
html += '<div class="tool-error">[missing input]</div>';
|
|
1441
|
+
} else {
|
|
1442
|
+
const cells = parseEvalCells(args.input);
|
|
1443
|
+
if (cells.length === 0) {
|
|
1444
|
+
html += codeBlock(args.input, 'python');
|
|
1445
|
+
} else {
|
|
1446
|
+
for (const cell of cells) {
|
|
1447
|
+
html += '<div class="tool-cell">';
|
|
1448
|
+
const titleParts = [];
|
|
1449
|
+
if (cell.title) titleParts.push(cell.title);
|
|
1450
|
+
titleParts.push(cell.lang);
|
|
1451
|
+
if (cell.attrs && cell.attrs.length) titleParts.push(...cell.attrs);
|
|
1452
|
+
html += '<div class="tool-cell-title">' + escapeHtml(titleParts.join(' · ')) + '</div>';
|
|
1453
|
+
html += codeBlock(cell.code, evalLangToHljs(cell.lang));
|
|
1454
|
+
html += '</div>';
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
if (result) {
|
|
1459
|
+
html += ctx.renderResultImages();
|
|
1460
|
+
const output = ctx.getResultText();
|
|
1461
|
+
if (output) html += formatExpandableOutput(output, 12);
|
|
1462
|
+
}
|
|
1463
|
+
return html;
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
function renderSearch(name, args, result, ctx) {
|
|
1467
|
+
const pattern = str(args.pattern);
|
|
1468
|
+
const paths = Array.isArray(args.paths) ? args.paths.map(p => shortenPath(String(p))).join(', ') : (args.path ? shortenPath(String(args.path)) : '.');
|
|
1469
|
+
const patHtml = pattern === null ? invalidArgHtml() : escapeHtml(pattern);
|
|
1470
|
+
let head = '<span class="tool-name">search</span> <span class="tool-pattern">/' + patHtml + '/</span>';
|
|
1471
|
+
head += ' <span class="tool-arg-key">in</span> <span class="tool-path">' + escapeHtml(paths) + '</span>';
|
|
1472
|
+
const badges = [];
|
|
1473
|
+
if (args.i) badges.push('i');
|
|
1474
|
+
if (args.skip) badges.push('skip=' + args.skip);
|
|
1475
|
+
if (args.gitignore === false) badges.push('no-gitignore');
|
|
1476
|
+
for (const b of badges) head += ' <span class="tool-badge">' + escapeHtml(b) + '</span>';
|
|
1477
|
+
let html = '<div class="tool-header">' + head + '</div>';
|
|
1478
|
+
if (result) {
|
|
1479
|
+
const output = ctx.getResultText();
|
|
1480
|
+
if (output) html += formatExpandableOutput(output, 12);
|
|
1481
|
+
}
|
|
1482
|
+
return html;
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
function renderRecipe(name, args, result, ctx) {
|
|
1486
|
+
const op = str(args.op) || '?';
|
|
1487
|
+
let html = toolHead('recipe', '<span class="tool-arg-val">' + escapeHtml(op) + '</span>');
|
|
1488
|
+
if (result) {
|
|
1489
|
+
html += ctx.renderResultImages();
|
|
1490
|
+
const output = ctx.getResultText();
|
|
1491
|
+
if (output) html += formatExpandableOutput(output, 10);
|
|
1492
|
+
}
|
|
1493
|
+
return html;
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
function renderIrc(name, args, result, ctx) {
|
|
1497
|
+
const op = str(args.op) || '?';
|
|
1498
|
+
const badges = [op];
|
|
1499
|
+
if (args.to) badges.push('to=' + args.to);
|
|
1500
|
+
if (args.awaitReply === false) badges.push('no-reply');
|
|
1501
|
+
let html = toolHead('irc', '', badges);
|
|
1502
|
+
if (args.message) html += '<div class="tool-output"><div>' + escapeHtml(String(args.message)) + '</div></div>';
|
|
1503
|
+
if (result) {
|
|
1504
|
+
const output = ctx.getResultText();
|
|
1505
|
+
if (output) html += formatExpandableOutput(output, 8);
|
|
1506
|
+
}
|
|
1507
|
+
return html;
|
|
1508
|
+
}
|
|
1509
|
+
|
|
1510
|
+
|
|
1511
|
+
function renderGenericTool(name, args, result, ctx) {
|
|
1512
|
+
let html = toolHead(name);
|
|
1513
|
+
const argText = JSON.stringify(args, null, 2);
|
|
1514
|
+
if (argText && argText !== '{}') {
|
|
1515
|
+
html += '<div class="tool-output"><pre>' + escapeHtml(argText) + '</pre></div>';
|
|
1516
|
+
}
|
|
1517
|
+
if (result) {
|
|
1518
|
+
html += ctx.renderResultImages();
|
|
1519
|
+
const output = ctx.getResultText();
|
|
1520
|
+
if (output) html += formatExpandableOutput(output, 10);
|
|
1521
|
+
}
|
|
1522
|
+
return html;
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
const TOOL_RENDERERS = {
|
|
1526
|
+
bash: renderBash,
|
|
1527
|
+
eval: renderEval,
|
|
1528
|
+
js: renderJsLike,
|
|
1529
|
+
python: renderJsLike,
|
|
1530
|
+
notebook: renderJsLike,
|
|
1531
|
+
read: renderRead,
|
|
1532
|
+
write: renderWrite,
|
|
1533
|
+
edit: renderEdit,
|
|
1534
|
+
ast_edit: renderAstEdit,
|
|
1535
|
+
ast_grep: renderAstGrep,
|
|
1536
|
+
grep: renderGrep,
|
|
1537
|
+
search: renderSearch,
|
|
1538
|
+
find: renderFind,
|
|
1539
|
+
lsp: renderLsp,
|
|
1540
|
+
todo_write: renderTodoWrite,
|
|
1541
|
+
task: renderTask,
|
|
1542
|
+
web_search: renderWebSearch,
|
|
1543
|
+
fetch: renderFetch,
|
|
1544
|
+
debug: renderDebug,
|
|
1545
|
+
puppeteer: renderBrowser,
|
|
1546
|
+
browser: renderBrowser,
|
|
1547
|
+
inspect_image: renderInspectImage,
|
|
1548
|
+
generate_image: renderGenerateImage,
|
|
1549
|
+
ask: renderAsk,
|
|
1550
|
+
resolve: renderResolve,
|
|
1551
|
+
github: renderGh,
|
|
1552
|
+
render_mermaid: renderMermaid,
|
|
1553
|
+
yield: renderYield,
|
|
1554
|
+
report_finding: renderReportFinding,
|
|
1555
|
+
calc: renderCalc,
|
|
1556
|
+
calculator: renderCalc,
|
|
1557
|
+
await: renderJob,
|
|
1558
|
+
poll: renderJob,
|
|
1559
|
+
cancel_job: renderJob,
|
|
1560
|
+
job: renderJob,
|
|
1561
|
+
recipe: renderRecipe,
|
|
1562
|
+
irc: renderIrc,
|
|
1563
|
+
};
|
|
1564
|
+
|
|
1565
|
+
function renderToolCall(call) {
|
|
1566
|
+
const result = findToolResult(call.id);
|
|
1567
|
+
const isError = result?.isError || false;
|
|
1568
|
+
const statusClass = result ? (isError ? 'error' : 'success') : 'pending';
|
|
1569
|
+
const rawArgs = call.arguments || {};
|
|
1570
|
+
const intent = typeof rawArgs._i === 'string' ? rawArgs._i.trim() : '';
|
|
1571
|
+
// Strip internal _i intent so renderers don't dump it as JSON.
|
|
1572
|
+
const args = {};
|
|
1573
|
+
for (const k of Object.keys(rawArgs)) {
|
|
1574
|
+
if (k !== '_i') args[k] = rawArgs[k];
|
|
1575
|
+
}
|
|
1576
|
+
const name = call.name;
|
|
1577
|
+
|
|
1578
|
+
const ctx = {
|
|
1579
|
+
intent,
|
|
1580
|
+
getResultText: () => {
|
|
1581
|
+
if (!result) return '';
|
|
1582
|
+
const textBlocks = result.content.filter(c => c.type === 'text');
|
|
1583
|
+
return textBlocks.map(c => c.text).join('\n');
|
|
1584
|
+
},
|
|
1585
|
+
getResultImages: () => {
|
|
1586
|
+
if (!result) return [];
|
|
1587
|
+
return result.content.filter(c => c.type === 'image');
|
|
1588
|
+
},
|
|
1589
|
+
renderResultImages: () => {
|
|
1590
|
+
if (!result) return '';
|
|
1591
|
+
const images = result.content.filter(c => c.type === 'image');
|
|
1592
|
+
if (images.length === 0) return '';
|
|
1593
|
+
return '<div class="tool-images">' +
|
|
1594
|
+
images.map(img => '<img src="data:' + img.mimeType + ';base64,' + img.data + '" class="tool-image" />').join('') +
|
|
1595
|
+
'</div>';
|
|
1596
|
+
},
|
|
1597
|
+
};
|
|
1598
|
+
|
|
1599
|
+
const renderer = TOOL_RENDERERS[name] || renderGenericTool;
|
|
1600
|
+
let html = '<div class="tool-execution ' + statusClass + '">';
|
|
1601
|
+
if (intent) html += '<div class="tool-intent">' + escapeHtml(intent) + '</div>';
|
|
1602
|
+
try {
|
|
1603
|
+
html += renderer(name, args, result, ctx);
|
|
1604
|
+
} catch (err) {
|
|
1605
|
+
html += renderGenericTool(name, args, result, ctx);
|
|
1606
|
+
}
|
|
1607
|
+
html += '</div>';
|
|
1608
|
+
return html;
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
|
|
1612
|
+
/**
|
|
1613
|
+
* Build a shareable URL for a specific message.
|
|
1614
|
+
* URL format: base?gistId&leafId=<leafId>&targetId=<entryId>
|
|
1615
|
+
*/
|
|
1616
|
+
function buildShareUrl(entryId) {
|
|
1617
|
+
// Check for injected base URL (used when loaded in iframe via srcdoc)
|
|
1618
|
+
const baseUrlMeta =
|
|
1619
|
+
document.querySelector('meta[name="gjc-share-base-url"]') ||
|
|
1620
|
+
document.querySelector('meta[name="pi-share-base-url"]');
|
|
1621
|
+
const baseUrl = baseUrlMeta ? baseUrlMeta.content : window.location.href.split('?')[0];
|
|
1622
|
+
|
|
1623
|
+
const url = new URL(window.location.href);
|
|
1624
|
+
// Find the gist ID (first query param without value, e.g., ?abc123)
|
|
1625
|
+
const gistId = Array.from(url.searchParams.keys()).find(k => !url.searchParams.get(k));
|
|
1626
|
+
|
|
1627
|
+
// Build the share URL
|
|
1628
|
+
const params = new URLSearchParams();
|
|
1629
|
+
params.set('leafId', currentLeafId);
|
|
1630
|
+
params.set('targetId', entryId);
|
|
1631
|
+
|
|
1632
|
+
// If we have an injected base URL (iframe context), use it directly
|
|
1633
|
+
if (baseUrlMeta) {
|
|
1634
|
+
return `${baseUrl}&${params.toString()}`;
|
|
1635
|
+
}
|
|
1636
|
+
|
|
1637
|
+
// Otherwise build from current location (direct file access)
|
|
1638
|
+
url.search = gistId ? `?${gistId}&${params.toString()}` : `?${params.toString()}`;
|
|
1639
|
+
return url.toString();
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1642
|
+
/**
|
|
1643
|
+
* Copy text to clipboard with visual feedback.
|
|
1644
|
+
* Uses navigator.clipboard with fallback to execCommand for HTTP contexts.
|
|
1645
|
+
*/
|
|
1646
|
+
async function copyToClipboard(text, button) {
|
|
1647
|
+
let success = false;
|
|
1648
|
+
try {
|
|
1649
|
+
if (navigator.clipboard && navigator.clipboard.writeText) {
|
|
1650
|
+
await navigator.clipboard.writeText(text);
|
|
1651
|
+
success = true;
|
|
1652
|
+
}
|
|
1653
|
+
} catch {
|
|
1654
|
+
// Clipboard API failed, try fallback
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1657
|
+
// Fallback for HTTP or when Clipboard API is unavailable
|
|
1658
|
+
if (!success) {
|
|
1659
|
+
try {
|
|
1660
|
+
const textarea = document.createElement('textarea');
|
|
1661
|
+
textarea.value = text;
|
|
1662
|
+
textarea.style.position = 'fixed';
|
|
1663
|
+
textarea.style.opacity = '0';
|
|
1664
|
+
document.body.appendChild(textarea);
|
|
1665
|
+
textarea.select();
|
|
1666
|
+
success = document.execCommand('copy');
|
|
1667
|
+
document.body.removeChild(textarea);
|
|
1668
|
+
} catch {
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
if (success && button) {
|
|
1673
|
+
const originalHtml = button.innerHTML;
|
|
1674
|
+
button.innerHTML = '✓';
|
|
1675
|
+
button.classList.add('copied');
|
|
1676
|
+
setTimeout(() => {
|
|
1677
|
+
button.innerHTML = originalHtml;
|
|
1678
|
+
button.classList.remove('copied');
|
|
1679
|
+
}, 1500);
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
/**
|
|
1684
|
+
* Render the copy-link button HTML for a message.
|
|
1685
|
+
*/
|
|
1686
|
+
function renderCopyLinkButton(entryId) {
|
|
1687
|
+
return `<button class="copy-link-btn" data-entry-id="${entryId}" title="Copy link to this message">
|
|
1688
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
1689
|
+
<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/>
|
|
1690
|
+
<path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>
|
|
1691
|
+
</svg>
|
|
1692
|
+
</button>`;
|
|
1693
|
+
}
|
|
1694
|
+
|
|
1695
|
+
function renderEntry(entry) {
|
|
1696
|
+
const ts = formatTimestamp(entry.timestamp);
|
|
1697
|
+
const tsHtml = ts ? `<div class="message-timestamp">${ts}</div>` : '';
|
|
1698
|
+
const entryId = `entry-${entry.id}`;
|
|
1699
|
+
const copyBtnHtml = renderCopyLinkButton(entry.id);
|
|
1700
|
+
|
|
1701
|
+
if (entry.type === 'message') {
|
|
1702
|
+
const msg = entry.message;
|
|
1703
|
+
|
|
1704
|
+
if (msg.role === 'user') {
|
|
1705
|
+
let html = `<div class="user-message" id="${entryId}">${copyBtnHtml}${tsHtml}`;
|
|
1706
|
+
const content = msg.content;
|
|
1707
|
+
|
|
1708
|
+
if (Array.isArray(content)) {
|
|
1709
|
+
const images = content.filter(c => c.type === 'image');
|
|
1710
|
+
if (images.length > 0) {
|
|
1711
|
+
html += '<div class="message-images">';
|
|
1712
|
+
for (const img of images) {
|
|
1713
|
+
html += `<img src="data:${img.mimeType};base64,${img.data}" class="message-image" />`;
|
|
1714
|
+
}
|
|
1715
|
+
html += '</div>';
|
|
1716
|
+
}
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1719
|
+
const text = typeof content === 'string' ? content :
|
|
1720
|
+
content.filter(c => c.type === 'text').map(c => c.text).join('\n');
|
|
1721
|
+
if (text.trim()) {
|
|
1722
|
+
html += `<div class="markdown-content">${safeMarkedParse(text)}</div>`;
|
|
1723
|
+
}
|
|
1724
|
+
html += '</div>';
|
|
1725
|
+
return html;
|
|
1726
|
+
}
|
|
1727
|
+
|
|
1728
|
+
if (msg.role === 'developer') {
|
|
1729
|
+
let html = `<div class="user-message developer-message" id="${entryId}">${copyBtnHtml}${tsHtml}`;
|
|
1730
|
+
const content = msg.content;
|
|
1731
|
+
const text = typeof content === 'string' ? content :
|
|
1732
|
+
content.filter(c => c.type === 'text').map(c => c.text).join('\n');
|
|
1733
|
+
if (text.trim()) {
|
|
1734
|
+
html += `<div class="markdown-content">${safeMarkedParse(text)}</div>`;
|
|
1735
|
+
}
|
|
1736
|
+
html += '</div>';
|
|
1737
|
+
return html;
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
if (msg.role === 'assistant') {
|
|
1741
|
+
let html = `<div class="assistant-message" id="${entryId}">${copyBtnHtml}${tsHtml}`;
|
|
1742
|
+
|
|
1743
|
+
for (const block of msg.content) {
|
|
1744
|
+
if (block.type === 'text' && block.text.trim()) {
|
|
1745
|
+
html += `<div class="assistant-text markdown-content">${safeMarkedParse(block.text)}</div>`;
|
|
1746
|
+
} else if (block.type === 'thinking' && block.thinking.trim()) {
|
|
1747
|
+
html += `<div class="thinking-block">
|
|
1748
|
+
<div class="thinking-text">${escapeHtml(block.thinking)}</div>
|
|
1749
|
+
<div class="thinking-collapsed">Thinking ...</div>
|
|
1750
|
+
</div>`;
|
|
1751
|
+
}
|
|
1752
|
+
}
|
|
1753
|
+
|
|
1754
|
+
for (const block of msg.content) {
|
|
1755
|
+
if (block.type === 'toolCall') {
|
|
1756
|
+
html += renderToolCall(block);
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
if (msg.stopReason === 'aborted') {
|
|
1761
|
+
html += '<div class="error-text">Aborted</div>';
|
|
1762
|
+
} else if (msg.stopReason === 'error') {
|
|
1763
|
+
html += `<div class="error-text">Error: ${escapeHtml(msg.errorMessage || 'Unknown error')}</div>`;
|
|
1764
|
+
}
|
|
1765
|
+
|
|
1766
|
+
html += '</div>';
|
|
1767
|
+
return html;
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1770
|
+
if (msg.role === 'bashExecution') {
|
|
1771
|
+
const isError = msg.cancelled || (msg.exitCode !== 0 && msg.exitCode !== null);
|
|
1772
|
+
let html = `<div class="tool-execution ${isError ? 'error' : 'success'}" id="${entryId}">${tsHtml}`;
|
|
1773
|
+
html += `<div class="tool-command">$ ${escapeHtml(msg.command)}</div>`;
|
|
1774
|
+
if (msg.output) html += formatExpandableOutput(msg.output, 10);
|
|
1775
|
+
if (msg.cancelled) {
|
|
1776
|
+
html += '<div style="color: var(--warning)">(cancelled)</div>';
|
|
1777
|
+
} else if (msg.exitCode !== 0 && msg.exitCode !== null) {
|
|
1778
|
+
html += `<div style="color: var(--error)">(exit ${msg.exitCode})</div>`;
|
|
1779
|
+
}
|
|
1780
|
+
html += '</div>';
|
|
1781
|
+
return html;
|
|
1782
|
+
}
|
|
1783
|
+
|
|
1784
|
+
if (msg.role === 'jsExecution') {
|
|
1785
|
+
const isError = msg.cancelled || (msg.exitCode !== 0 && msg.exitCode !== null);
|
|
1786
|
+
let html = `<div class="tool-execution ${isError ? 'error' : 'success'}" id="${entryId}">${tsHtml}`;
|
|
1787
|
+
html += `<div class="tool-command">$ ${escapeHtml(msg.code)}</div>`;
|
|
1788
|
+
if (msg.output) html += formatExpandableOutput(msg.output, 10);
|
|
1789
|
+
if (msg.cancelled) {
|
|
1790
|
+
html += '<div style="color: var(--warning)">(cancelled)</div>';
|
|
1791
|
+
} else if (msg.exitCode !== 0 && msg.exitCode !== null) {
|
|
1792
|
+
html += `<div style="color: var(--error)">(exit ${msg.exitCode})</div>`;
|
|
1793
|
+
}
|
|
1794
|
+
html += '</div>';
|
|
1795
|
+
return html;
|
|
1796
|
+
}
|
|
1797
|
+
|
|
1798
|
+
if (msg.role === 'toolResult') return '';
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
if (entry.type === 'model_change') {
|
|
1802
|
+
const html = `<div class="model-change" id="${entryId}">${tsHtml}Switched to model: <span class="model-name">${escapeHtml(entry.model)}</span></div>`;
|
|
1803
|
+
return html;
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
if (entry.type === 'thinking_level_change') {
|
|
1807
|
+
const html = `<div class="thinking-change" id="${entryId}">${tsHtml}Thinking level: <span class="thinking-level">${escapeHtml(entry.thinkingLevel)}</span></div>`;
|
|
1808
|
+
return html;
|
|
1809
|
+
}
|
|
1810
|
+
|
|
1811
|
+
|
|
1812
|
+
if (entry.type === 'compaction') {
|
|
1813
|
+
return `<div class="compaction" id="${entryId}" onclick="this.classList.toggle('expanded')">
|
|
1814
|
+
<div class="compaction-label">[compaction]</div>
|
|
1815
|
+
<div class="compaction-collapsed">Compacted from ${entry.tokensBefore.toLocaleString()} tokens</div>
|
|
1816
|
+
<div class="compaction-content"><strong>Compacted from ${entry.tokensBefore.toLocaleString()} tokens</strong>\n\n${escapeHtml(entry.summary)}</div>
|
|
1817
|
+
</div>`;
|
|
1818
|
+
}
|
|
1819
|
+
|
|
1820
|
+
if (entry.type === 'branch_summary') {
|
|
1821
|
+
return `<div class="branch-summary" id="${entryId}">${tsHtml}
|
|
1822
|
+
<div class="branch-summary-header">Branch Summary</div>
|
|
1823
|
+
<div class="markdown-content">${safeMarkedParse(entry.summary)}</div>
|
|
1824
|
+
</div>`;
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
if (entry.type === 'custom_message' && entry.display) {
|
|
1828
|
+
return `<div class="hook-message" id="${entryId}">${tsHtml}
|
|
1829
|
+
<div class="hook-type">[${escapeHtml(entry.customType)}]</div>
|
|
1830
|
+
<div class="markdown-content">${safeMarkedParse(typeof entry.content === 'string' ? entry.content : JSON.stringify(entry.content))}</div>
|
|
1831
|
+
</div>`;
|
|
1832
|
+
}
|
|
1833
|
+
|
|
1834
|
+
return '';
|
|
1835
|
+
}
|
|
1836
|
+
|
|
1837
|
+
// ============================================================
|
|
1838
|
+
// HEADER / STATS
|
|
1839
|
+
// ============================================================
|
|
1840
|
+
|
|
1841
|
+
function computeStats(entryList) {
|
|
1842
|
+
let userMessages = 0, developerMessages = 0, assistantMessages = 0, toolResults = 0;
|
|
1843
|
+
let customMessages = 0, compactions = 0, branchSummaries = 0, toolCalls = 0;
|
|
1844
|
+
const tokens = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 };
|
|
1845
|
+
const cost = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 };
|
|
1846
|
+
const models = new Set();
|
|
1847
|
+
|
|
1848
|
+
for (const entry of entryList) {
|
|
1849
|
+
if (entry.type === 'message') {
|
|
1850
|
+
const msg = entry.message;
|
|
1851
|
+
if (msg.role === 'user') userMessages++;
|
|
1852
|
+
if (msg.role === 'developer') developerMessages++;
|
|
1853
|
+
if (msg.role === 'assistant') {
|
|
1854
|
+
assistantMessages++;
|
|
1855
|
+
if (msg.model) models.add(msg.provider ? `${msg.provider}/${msg.model}` : msg.model);
|
|
1856
|
+
if (msg.usage) {
|
|
1857
|
+
tokens.input += msg.usage.input || 0;
|
|
1858
|
+
tokens.output += msg.usage.output || 0;
|
|
1859
|
+
tokens.cacheRead += msg.usage.cacheRead || 0;
|
|
1860
|
+
tokens.cacheWrite += msg.usage.cacheWrite || 0;
|
|
1861
|
+
if (msg.usage.cost) {
|
|
1862
|
+
cost.input += msg.usage.cost.input || 0;
|
|
1863
|
+
cost.output += msg.usage.cost.output || 0;
|
|
1864
|
+
cost.cacheRead += msg.usage.cost.cacheRead || 0;
|
|
1865
|
+
cost.cacheWrite += msg.usage.cost.cacheWrite || 0;
|
|
1866
|
+
}
|
|
1867
|
+
}
|
|
1868
|
+
toolCalls += msg.content.filter(c => c.type === 'toolCall').length;
|
|
1869
|
+
}
|
|
1870
|
+
if (msg.role === 'toolResult') toolResults++;
|
|
1871
|
+
} else if (entry.type === 'compaction') {
|
|
1872
|
+
compactions++;
|
|
1873
|
+
} else if (entry.type === 'branch_summary') {
|
|
1874
|
+
branchSummaries++;
|
|
1875
|
+
} else if (entry.type === 'custom_message') {
|
|
1876
|
+
customMessages++;
|
|
1877
|
+
}
|
|
1878
|
+
}
|
|
1879
|
+
|
|
1880
|
+
return { userMessages, developerMessages, assistantMessages, toolResults, customMessages, compactions, branchSummaries, toolCalls, tokens, cost, models: Array.from(models) };
|
|
1881
|
+
}
|
|
1882
|
+
|
|
1883
|
+
const globalStats = computeStats(entries);
|
|
1884
|
+
|
|
1885
|
+
function renderHeader() {
|
|
1886
|
+
const totalCost = globalStats.cost.input + globalStats.cost.output + globalStats.cost.cacheRead + globalStats.cost.cacheWrite;
|
|
1887
|
+
|
|
1888
|
+
const tokenParts = [];
|
|
1889
|
+
if (globalStats.tokens.input) tokenParts.push(`↑${formatTokens(globalStats.tokens.input)}`);
|
|
1890
|
+
if (globalStats.tokens.output) tokenParts.push(`↓${formatTokens(globalStats.tokens.output)}`);
|
|
1891
|
+
if (globalStats.tokens.cacheRead) tokenParts.push(`R${formatTokens(globalStats.tokens.cacheRead)}`);
|
|
1892
|
+
if (globalStats.tokens.cacheWrite) tokenParts.push(`W${formatTokens(globalStats.tokens.cacheWrite)}`);
|
|
1893
|
+
|
|
1894
|
+
const msgParts = [];
|
|
1895
|
+
if (globalStats.userMessages) msgParts.push(`${globalStats.userMessages} user`);
|
|
1896
|
+
if (globalStats.developerMessages) msgParts.push(`${globalStats.developerMessages} developer`);
|
|
1897
|
+
if (globalStats.assistantMessages) msgParts.push(`${globalStats.assistantMessages} assistant`);
|
|
1898
|
+
if (globalStats.toolResults) msgParts.push(`${globalStats.toolResults} tool results`);
|
|
1899
|
+
if (globalStats.customMessages) msgParts.push(`${globalStats.customMessages} custom`);
|
|
1900
|
+
if (globalStats.compactions) msgParts.push(`${globalStats.compactions} compactions`);
|
|
1901
|
+
if (globalStats.branchSummaries) msgParts.push(`${globalStats.branchSummaries} branch summaries`);
|
|
1902
|
+
|
|
1903
|
+
let html = `
|
|
1904
|
+
<div class="header">
|
|
1905
|
+
<div class="brand-kicker">gajae-code · red-claw transcript</div>
|
|
1906
|
+
<h1>GJC Session Export: ${escapeHtml(header?.id || 'unknown')}</h1>
|
|
1907
|
+
<div class="help-bar">Ctrl+T toggle thinking · Ctrl+O toggle tools</div>
|
|
1908
|
+
<div class="header-info">
|
|
1909
|
+
<div class="info-item"><span class="info-label">Product:</span><span class="info-value">GJC / gajae-code</span></div>
|
|
1910
|
+
<div class="info-item"><span class="info-label">Date:</span><span class="info-value">${header?.timestamp ? new Date(header.timestamp).toLocaleString() : 'unknown'}</span></div>
|
|
1911
|
+
<div class="info-item"><span class="info-label">Models:</span><span class="info-value">${globalStats.models.join(', ') || 'unknown'}</span></div>
|
|
1912
|
+
<div class="info-item"><span class="info-label">Messages:</span><span class="info-value">${msgParts.join(', ') || '0'}</span></div>
|
|
1913
|
+
<div class="info-item"><span class="info-label">Tool Calls:</span><span class="info-value">${globalStats.toolCalls}</span></div>
|
|
1914
|
+
<div class="info-item"><span class="info-label">Tokens:</span><span class="info-value">${tokenParts.join(' ') || '0'}</span></div>
|
|
1915
|
+
<div class="info-item"><span class="info-label">Cost:</span><span class="info-value">$${totalCost.toFixed(3)}</span></div>
|
|
1916
|
+
</div>
|
|
1917
|
+
</div>`;
|
|
1918
|
+
|
|
1919
|
+
if (systemPrompt) {
|
|
1920
|
+
html += `<div class="system-prompt">
|
|
1921
|
+
<div class="system-prompt-header">System Prompt</div>
|
|
1922
|
+
<div class="system-prompt-content">${escapeHtml(systemPrompt)}</div>
|
|
1923
|
+
</div>`;
|
|
1924
|
+
}
|
|
1925
|
+
|
|
1926
|
+
if (tools && tools.length > 0) {
|
|
1927
|
+
const namesHtml = tools.map(t => `<span class="tool-name-chip">${escapeHtml(t.name)}</span>`).join('');
|
|
1928
|
+
const fullHtml = tools.map(t => `<div class="tool-item"><span class="tool-item-name">${escapeHtml(t.name)}</span> - <span class="tool-item-desc">${escapeHtml(t.description)}</span></div>`).join('');
|
|
1929
|
+
html += `<div class="tools-list collapsed" onclick="this.classList.toggle('collapsed')">
|
|
1930
|
+
<div class="tools-header">Available Tools (${tools.length})</div>
|
|
1931
|
+
<div class="tools-collapsed">${namesHtml}</div>
|
|
1932
|
+
<div class="tools-content">${fullHtml}</div>
|
|
1933
|
+
</div>`;
|
|
1934
|
+
}
|
|
1935
|
+
|
|
1936
|
+
return html;
|
|
1937
|
+
}
|
|
1938
|
+
|
|
1939
|
+
// ============================================================
|
|
1940
|
+
// NAVIGATION
|
|
1941
|
+
// ============================================================
|
|
1942
|
+
|
|
1943
|
+
// Cache for rendered entry DOM nodes
|
|
1944
|
+
const entryCache = new Map();
|
|
1945
|
+
|
|
1946
|
+
function renderEntryToNode(entry) {
|
|
1947
|
+
// Check cache first
|
|
1948
|
+
if (entryCache.has(entry.id)) {
|
|
1949
|
+
return entryCache.get(entry.id).cloneNode(true);
|
|
1950
|
+
}
|
|
1951
|
+
|
|
1952
|
+
// Render to HTML string, then parse to node
|
|
1953
|
+
const html = renderEntry(entry);
|
|
1954
|
+
if (!html) return null;
|
|
1955
|
+
|
|
1956
|
+
const template = document.createElement('template');
|
|
1957
|
+
template.innerHTML = html;
|
|
1958
|
+
const node = template.content.firstElementChild;
|
|
1959
|
+
|
|
1960
|
+
// Cache the node
|
|
1961
|
+
if (node) {
|
|
1962
|
+
entryCache.set(entry.id, node.cloneNode(true));
|
|
1963
|
+
}
|
|
1964
|
+
return node;
|
|
1965
|
+
}
|
|
1966
|
+
|
|
1967
|
+
function navigateTo(targetId, scrollMode = 'target', scrollToEntryId = null) {
|
|
1968
|
+
currentLeafId = targetId;
|
|
1969
|
+
currentTargetId = scrollToEntryId || targetId;
|
|
1970
|
+
const path = getPath(targetId);
|
|
1971
|
+
|
|
1972
|
+
renderTree();
|
|
1973
|
+
|
|
1974
|
+
document.getElementById('header-container').innerHTML = renderHeader();
|
|
1975
|
+
|
|
1976
|
+
// Build messages using cached DOM nodes
|
|
1977
|
+
const messagesEl = document.getElementById('messages');
|
|
1978
|
+
const fragment = document.createDocumentFragment();
|
|
1979
|
+
|
|
1980
|
+
for (const entry of path) {
|
|
1981
|
+
const node = renderEntryToNode(entry);
|
|
1982
|
+
if (node) {
|
|
1983
|
+
fragment.appendChild(node);
|
|
1984
|
+
}
|
|
1985
|
+
}
|
|
1986
|
+
|
|
1987
|
+
messagesEl.innerHTML = '';
|
|
1988
|
+
messagesEl.appendChild(fragment);
|
|
1989
|
+
|
|
1990
|
+
// Attach click handlers for copy-link buttons
|
|
1991
|
+
messagesEl.querySelectorAll('.copy-link-btn').forEach(btn => {
|
|
1992
|
+
btn.addEventListener('click', (e) => {
|
|
1993
|
+
e.stopPropagation();
|
|
1994
|
+
const entryId = btn.dataset.entryId;
|
|
1995
|
+
const shareUrl = buildShareUrl(entryId);
|
|
1996
|
+
copyToClipboard(shareUrl, btn);
|
|
1997
|
+
});
|
|
1998
|
+
});
|
|
1999
|
+
|
|
2000
|
+
// Use setTimeout(0) to ensure DOM is fully laid out before scrolling
|
|
2001
|
+
setTimeout(() => {
|
|
2002
|
+
const content = document.getElementById('content');
|
|
2003
|
+
if (scrollMode === 'bottom') {
|
|
2004
|
+
content.scrollTop = content.scrollHeight;
|
|
2005
|
+
} else if (scrollMode === 'target') {
|
|
2006
|
+
const scrollTargetId = scrollToEntryId || targetId;
|
|
2007
|
+
const targetEl = document.getElementById(`entry-${scrollTargetId}`);
|
|
2008
|
+
if (targetEl) {
|
|
2009
|
+
targetEl.scrollIntoView({ block: 'center' });
|
|
2010
|
+
if (scrollToEntryId) {
|
|
2011
|
+
targetEl.classList.add('highlight');
|
|
2012
|
+
setTimeout(() => targetEl.classList.remove('highlight'), 2000);
|
|
2013
|
+
}
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
}, 0);
|
|
2017
|
+
}
|
|
2018
|
+
|
|
2019
|
+
// ============================================================
|
|
2020
|
+
// INITIALIZATION
|
|
2021
|
+
// ============================================================
|
|
2022
|
+
|
|
2023
|
+
// Escape HTML tags in text (but not code blocks)
|
|
2024
|
+
function escapeHtmlTags(text) {
|
|
2025
|
+
return text.replace(/<(?=[a-zA-Z\/])/g, '<');
|
|
2026
|
+
}
|
|
2027
|
+
|
|
2028
|
+
// Configure marked with syntax highlighting and HTML escaping for text
|
|
2029
|
+
marked.use({
|
|
2030
|
+
breaks: true,
|
|
2031
|
+
gfm: true,
|
|
2032
|
+
renderer: {
|
|
2033
|
+
// Code blocks: syntax highlight, no HTML escaping
|
|
2034
|
+
code(token) {
|
|
2035
|
+
const code = token.text;
|
|
2036
|
+
const lang = token.lang;
|
|
2037
|
+
let highlighted;
|
|
2038
|
+
if (lang && hljs.getLanguage(lang)) {
|
|
2039
|
+
try {
|
|
2040
|
+
highlighted = hljs.highlight(code, { language: lang }).value;
|
|
2041
|
+
} catch {
|
|
2042
|
+
highlighted = escapeHtml(code);
|
|
2043
|
+
}
|
|
2044
|
+
} else {
|
|
2045
|
+
// Auto-detect language if not specified
|
|
2046
|
+
try {
|
|
2047
|
+
highlighted = hljs.highlightAuto(code).value;
|
|
2048
|
+
} catch {
|
|
2049
|
+
highlighted = escapeHtml(code);
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2052
|
+
return `<pre><code class="hljs">${highlighted}</code></pre>`;
|
|
2053
|
+
},
|
|
2054
|
+
// Text content: escape HTML tags
|
|
2055
|
+
text(token) {
|
|
2056
|
+
return escapeHtmlTags(escapeHtml(token.text));
|
|
2057
|
+
},
|
|
2058
|
+
// Inline code: escape HTML
|
|
2059
|
+
codespan(token) {
|
|
2060
|
+
return `<code>${escapeHtml(token.text)}</code>`;
|
|
2061
|
+
}
|
|
2062
|
+
}
|
|
2063
|
+
});
|
|
2064
|
+
|
|
2065
|
+
// Simple marked parse (escaping handled in renderers)
|
|
2066
|
+
function safeMarkedParse(text) {
|
|
2067
|
+
return marked.parse(text);
|
|
2068
|
+
}
|
|
2069
|
+
|
|
2070
|
+
// Search input
|
|
2071
|
+
const searchInput = document.getElementById('tree-search');
|
|
2072
|
+
searchInput.addEventListener('input', (e) => {
|
|
2073
|
+
searchQuery = e.target.value;
|
|
2074
|
+
forceTreeRerender();
|
|
2075
|
+
});
|
|
2076
|
+
|
|
2077
|
+
// Filter buttons
|
|
2078
|
+
document.querySelectorAll('.filter-btn').forEach(btn => {
|
|
2079
|
+
btn.addEventListener('click', () => {
|
|
2080
|
+
document.querySelectorAll('.filter-btn').forEach(b => b.classList.remove('active'));
|
|
2081
|
+
btn.classList.add('active');
|
|
2082
|
+
filterMode = btn.dataset.filter;
|
|
2083
|
+
forceTreeRerender();
|
|
2084
|
+
});
|
|
2085
|
+
});
|
|
2086
|
+
|
|
2087
|
+
// Sidebar toggle
|
|
2088
|
+
const sidebar = document.getElementById('sidebar');
|
|
2089
|
+
const overlay = document.getElementById('sidebar-overlay');
|
|
2090
|
+
const hamburger = document.getElementById('hamburger');
|
|
2091
|
+
const sidebarResizer = document.getElementById('sidebar-resizer');
|
|
2092
|
+
const SIDEBAR_WIDTH_STORAGE_KEY = 'gjc-share:v1:sidebar-width';
|
|
2093
|
+
const LEGACY_SIDEBAR_WIDTH_STORAGE_KEY = 'pi-share:v1:sidebar-width';
|
|
2094
|
+
const MIN_CONTENT_WIDTH = 320;
|
|
2095
|
+
|
|
2096
|
+
function isMobileLayout() {
|
|
2097
|
+
return window.matchMedia('(max-width: 900px)').matches;
|
|
2098
|
+
}
|
|
2099
|
+
|
|
2100
|
+
function getSidebarBounds() {
|
|
2101
|
+
const rootStyles = getComputedStyle(document.documentElement);
|
|
2102
|
+
const minWidth = parseFloat(rootStyles.getPropertyValue('--sidebar-min-width')) || 240;
|
|
2103
|
+
const maxWidth = parseFloat(rootStyles.getPropertyValue('--sidebar-max-width')) || 720;
|
|
2104
|
+
const viewportMaxWidth = window.innerWidth - MIN_CONTENT_WIDTH;
|
|
2105
|
+
return {
|
|
2106
|
+
minWidth,
|
|
2107
|
+
maxWidth: Math.max(minWidth, Math.min(maxWidth, viewportMaxWidth))
|
|
2108
|
+
};
|
|
2109
|
+
}
|
|
2110
|
+
|
|
2111
|
+
function clampSidebarWidth(width) {
|
|
2112
|
+
const { minWidth, maxWidth } = getSidebarBounds();
|
|
2113
|
+
return Math.max(minWidth, Math.min(maxWidth, width));
|
|
2114
|
+
}
|
|
2115
|
+
|
|
2116
|
+
function applySidebarWidth(width) {
|
|
2117
|
+
document.documentElement.style.setProperty('--sidebar-width', `${Math.round(clampSidebarWidth(width))}px`);
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
function loadSidebarWidth() {
|
|
2121
|
+
try {
|
|
2122
|
+
const raw = localStorage.getItem(SIDEBAR_WIDTH_STORAGE_KEY) ?? localStorage.getItem(LEGACY_SIDEBAR_WIDTH_STORAGE_KEY);
|
|
2123
|
+
if (raw === null) return null;
|
|
2124
|
+
const width = Number(raw);
|
|
2125
|
+
return Number.isFinite(width) ? width : null;
|
|
2126
|
+
} catch {
|
|
2127
|
+
return null;
|
|
2128
|
+
}
|
|
2129
|
+
}
|
|
2130
|
+
|
|
2131
|
+
function saveSidebarWidth(width) {
|
|
2132
|
+
try {
|
|
2133
|
+
localStorage.setItem(SIDEBAR_WIDTH_STORAGE_KEY, String(Math.round(clampSidebarWidth(width))));
|
|
2134
|
+
} catch {
|
|
2135
|
+
// Ignore storage failures (e.g. private browsing restrictions)
|
|
2136
|
+
}
|
|
2137
|
+
}
|
|
2138
|
+
|
|
2139
|
+
function setupSidebarResize() {
|
|
2140
|
+
const savedWidth = loadSidebarWidth();
|
|
2141
|
+
if (savedWidth !== null) {
|
|
2142
|
+
applySidebarWidth(savedWidth);
|
|
2143
|
+
}
|
|
2144
|
+
|
|
2145
|
+
if (!sidebarResizer) return;
|
|
2146
|
+
|
|
2147
|
+
let cleanupDrag = null;
|
|
2148
|
+
|
|
2149
|
+
const stopDrag = (pointerId) => {
|
|
2150
|
+
if (cleanupDrag) {
|
|
2151
|
+
cleanupDrag(pointerId);
|
|
2152
|
+
cleanupDrag = null;
|
|
2153
|
+
}
|
|
2154
|
+
};
|
|
2155
|
+
|
|
2156
|
+
sidebarResizer.addEventListener('pointerdown', (e) => {
|
|
2157
|
+
if (isMobileLayout()) return;
|
|
2158
|
+
|
|
2159
|
+
e.preventDefault();
|
|
2160
|
+
const startX = e.clientX;
|
|
2161
|
+
const startWidth = sidebar.getBoundingClientRect().width;
|
|
2162
|
+
document.body.classList.add('sidebar-resizing');
|
|
2163
|
+
sidebarResizer.setPointerCapture?.(e.pointerId);
|
|
2164
|
+
|
|
2165
|
+
const onPointerMove = (event) => {
|
|
2166
|
+
applySidebarWidth(startWidth + (event.clientX - startX));
|
|
2167
|
+
};
|
|
2168
|
+
|
|
2169
|
+
cleanupDrag = (pointerIdToRelease) => {
|
|
2170
|
+
document.body.classList.remove('sidebar-resizing');
|
|
2171
|
+
sidebarResizer.releasePointerCapture?.(pointerIdToRelease);
|
|
2172
|
+
window.removeEventListener('pointermove', onPointerMove);
|
|
2173
|
+
window.removeEventListener('pointerup', onPointerUp);
|
|
2174
|
+
window.removeEventListener('pointercancel', onPointerCancel);
|
|
2175
|
+
saveSidebarWidth(sidebar.getBoundingClientRect().width);
|
|
2176
|
+
};
|
|
2177
|
+
|
|
2178
|
+
const onPointerUp = (event) => stopDrag(event.pointerId);
|
|
2179
|
+
const onPointerCancel = (event) => stopDrag(event.pointerId);
|
|
2180
|
+
|
|
2181
|
+
window.addEventListener('pointermove', onPointerMove);
|
|
2182
|
+
window.addEventListener('pointerup', onPointerUp);
|
|
2183
|
+
window.addEventListener('pointercancel', onPointerCancel);
|
|
2184
|
+
});
|
|
2185
|
+
|
|
2186
|
+
sidebarResizer.addEventListener('dblclick', () => {
|
|
2187
|
+
if (isMobileLayout()) return;
|
|
2188
|
+
applySidebarWidth(400);
|
|
2189
|
+
saveSidebarWidth(400);
|
|
2190
|
+
});
|
|
2191
|
+
|
|
2192
|
+
window.addEventListener('resize', () => {
|
|
2193
|
+
if (isMobileLayout()) return;
|
|
2194
|
+
applySidebarWidth(sidebar.getBoundingClientRect().width);
|
|
2195
|
+
});
|
|
2196
|
+
}
|
|
2197
|
+
|
|
2198
|
+
setupSidebarResize();
|
|
2199
|
+
|
|
2200
|
+
hamburger.addEventListener('click', () => {
|
|
2201
|
+
sidebar.classList.add('open');
|
|
2202
|
+
overlay.classList.add('open');
|
|
2203
|
+
hamburger.style.display = 'none';
|
|
2204
|
+
});
|
|
2205
|
+
|
|
2206
|
+
const closeSidebar = () => {
|
|
2207
|
+
sidebar.classList.remove('open');
|
|
2208
|
+
overlay.classList.remove('open');
|
|
2209
|
+
hamburger.style.display = '';
|
|
2210
|
+
};
|
|
2211
|
+
|
|
2212
|
+
overlay.addEventListener('click', closeSidebar);
|
|
2213
|
+
document.getElementById('sidebar-close').addEventListener('click', closeSidebar);
|
|
2214
|
+
|
|
2215
|
+
// Toggle states
|
|
2216
|
+
let thinkingExpanded = true;
|
|
2217
|
+
let toolOutputsExpanded = false;
|
|
2218
|
+
|
|
2219
|
+
const toggleThinking = () => {
|
|
2220
|
+
thinkingExpanded = !thinkingExpanded;
|
|
2221
|
+
document.querySelectorAll('.thinking-text').forEach(el => {
|
|
2222
|
+
el.style.display = thinkingExpanded ? '' : 'none';
|
|
2223
|
+
});
|
|
2224
|
+
document.querySelectorAll('.thinking-collapsed').forEach(el => {
|
|
2225
|
+
el.style.display = thinkingExpanded ? 'none' : 'block';
|
|
2226
|
+
});
|
|
2227
|
+
};
|
|
2228
|
+
|
|
2229
|
+
const toggleToolOutputs = () => {
|
|
2230
|
+
toolOutputsExpanded = !toolOutputsExpanded;
|
|
2231
|
+
document.querySelectorAll('.tool-output.expandable').forEach(el => {
|
|
2232
|
+
el.classList.toggle('expanded', toolOutputsExpanded);
|
|
2233
|
+
});
|
|
2234
|
+
document.querySelectorAll('.compaction').forEach(el => {
|
|
2235
|
+
el.classList.toggle('expanded', toolOutputsExpanded);
|
|
2236
|
+
});
|
|
2237
|
+
};
|
|
2238
|
+
|
|
2239
|
+
// Keyboard shortcuts
|
|
2240
|
+
document.addEventListener('keydown', (e) => {
|
|
2241
|
+
if (e.key === 'Escape') {
|
|
2242
|
+
searchInput.value = '';
|
|
2243
|
+
searchQuery = '';
|
|
2244
|
+
navigateTo(leafId, 'bottom');
|
|
2245
|
+
}
|
|
2246
|
+
if (e.ctrlKey && e.key === 't') {
|
|
2247
|
+
e.preventDefault();
|
|
2248
|
+
toggleThinking();
|
|
2249
|
+
}
|
|
2250
|
+
if (e.ctrlKey && e.key === 'o') {
|
|
2251
|
+
e.preventDefault();
|
|
2252
|
+
toggleToolOutputs();
|
|
2253
|
+
}
|
|
2254
|
+
});
|
|
2255
|
+
|
|
2256
|
+
// Initial render
|
|
2257
|
+
// If URL has targetId, scroll to that specific message; otherwise stay at top
|
|
2258
|
+
if (leafId) {
|
|
2259
|
+
if (urlTargetId && byId.has(urlTargetId)) {
|
|
2260
|
+
navigateTo(leafId, 'target', urlTargetId);
|
|
2261
|
+
} else {
|
|
2262
|
+
navigateTo(leafId, 'none');
|
|
2263
|
+
}
|
|
2264
|
+
} else if (entries.length > 0) {
|
|
2265
|
+
// Fallback: use last entry if no leafId
|
|
2266
|
+
navigateTo(entries[entries.length - 1].id, 'none');
|
|
2267
|
+
}
|
|
2268
|
+
})();
|