gsd-pi 2.34.0 → 2.35.0-dev.30eec3f
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/dist/cli.js +7 -2
- package/dist/resource-loader.d.ts +1 -1
- package/dist/resource-loader.js +13 -1
- package/dist/resources/extensions/async-jobs/await-tool.js +0 -2
- package/dist/resources/extensions/async-jobs/job-manager.js +0 -6
- package/dist/resources/extensions/bg-shell/output-formatter.js +1 -19
- package/dist/resources/extensions/bg-shell/process-manager.js +0 -4
- package/dist/resources/extensions/bg-shell/types.js +0 -2
- package/dist/resources/extensions/context7/index.js +5 -0
- package/dist/resources/extensions/get-secrets-from-user.js +2 -30
- package/dist/resources/extensions/google-search/index.js +5 -0
- package/dist/resources/extensions/gsd/auto-dispatch.js +43 -1
- package/dist/resources/extensions/gsd/auto-loop.js +10 -1
- package/dist/resources/extensions/gsd/auto-recovery.js +35 -0
- package/dist/resources/extensions/gsd/auto-start.js +35 -2
- package/dist/resources/extensions/gsd/auto.js +59 -4
- package/dist/resources/extensions/gsd/changelog.js +162 -0
- package/dist/resources/extensions/gsd/commands-bootstrap.js +1 -0
- package/dist/resources/extensions/gsd/commands-handlers.js +2 -2
- package/dist/resources/extensions/gsd/commands-inspect.js +10 -3
- package/dist/resources/extensions/gsd/commands-prefs-wizard.js +5 -1
- package/dist/resources/extensions/gsd/commands.js +8 -1
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +10 -0
- package/dist/resources/extensions/gsd/doctor-checks.js +113 -5
- package/dist/resources/extensions/gsd/doctor-environment.js +26 -17
- package/dist/resources/extensions/gsd/doctor-proactive.js +22 -0
- package/dist/resources/extensions/gsd/doctor.js +36 -0
- package/dist/resources/extensions/gsd/files.js +11 -2
- package/dist/resources/extensions/gsd/gitignore.js +54 -7
- package/dist/resources/extensions/gsd/guided-flow.js +5 -3
- package/dist/resources/extensions/gsd/health-widget-core.js +96 -0
- package/dist/resources/extensions/gsd/health-widget.js +97 -46
- package/dist/resources/extensions/gsd/index.js +10 -1
- package/dist/resources/extensions/gsd/migrate-external.js +55 -2
- package/dist/resources/extensions/gsd/paths.js +74 -7
- package/dist/resources/extensions/gsd/post-unit-hooks.js +4 -1
- package/dist/resources/extensions/gsd/preferences-validation.js +54 -1
- package/dist/resources/extensions/gsd/preferences.js +2 -0
- package/dist/resources/extensions/gsd/prompts/complete-milestone.md +2 -0
- package/dist/resources/extensions/gsd/prompts/validate-milestone.md +2 -0
- package/dist/resources/extensions/gsd/roadmap-mutations.js +55 -0
- package/dist/resources/extensions/gsd/session-lock.js +26 -2
- package/dist/resources/extensions/gsd/templates/plan.md +8 -0
- package/dist/resources/extensions/gsd/worktree-resolver.js +12 -0
- package/dist/resources/extensions/mcp-client/index.js +2 -1
- package/dist/resources/extensions/remote-questions/remote-command.js +2 -22
- package/dist/resources/extensions/shared/mod.js +1 -1
- package/dist/resources/extensions/shared/sanitize.js +30 -0
- package/dist/resources/extensions/subagent/index.js +6 -14
- package/dist/resources/skills/create-gsd-extension/references/events-reference.md +4 -4
- package/package.json +2 -1
- package/packages/native/dist/native.d.ts +0 -2
- package/packages/native/dist/native.js +0 -2
- package/packages/native/src/native.ts +0 -3
- package/packages/pi-agent-core/dist/agent-loop.d.ts +14 -0
- package/packages/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/agent-loop.js +24 -27
- package/packages/pi-agent-core/dist/agent-loop.js.map +1 -1
- package/packages/pi-agent-core/dist/agent.d.ts +1 -0
- package/packages/pi-agent-core/dist/agent.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/agent.js +11 -22
- package/packages/pi-agent-core/dist/agent.js.map +1 -1
- package/packages/pi-agent-core/dist/proxy.d.ts +1 -25
- package/packages/pi-agent-core/dist/proxy.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/proxy.js +3 -9
- package/packages/pi-agent-core/dist/proxy.js.map +1 -1
- package/packages/pi-agent-core/src/agent-loop.ts +30 -27
- package/packages/pi-agent-core/src/agent.ts +12 -23
- package/packages/pi-agent-core/src/proxy.ts +3 -9
- package/packages/pi-ai/dist/api-registry.d.ts +0 -2
- package/packages/pi-ai/dist/api-registry.d.ts.map +1 -1
- package/packages/pi-ai/dist/api-registry.js +0 -10
- package/packages/pi-ai/dist/api-registry.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.d.ts +0 -8
- package/packages/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.js +1 -1
- package/packages/pi-ai/dist/providers/anthropic.js.map +1 -1
- package/packages/pi-ai/dist/providers/azure-openai-responses.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/azure-openai-responses.js +5 -41
- package/packages/pi-ai/dist/providers/azure-openai-responses.js.map +1 -1
- package/packages/pi-ai/dist/providers/github-copilot-headers.d.ts +0 -1
- package/packages/pi-ai/dist/providers/github-copilot-headers.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/github-copilot-headers.js +1 -1
- package/packages/pi-ai/dist/providers/github-copilot-headers.js.map +1 -1
- package/packages/pi-ai/dist/providers/google-gemini-cli.d.ts +1 -43
- package/packages/pi-ai/dist/providers/google-gemini-cli.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/google-gemini-cli.js +2 -2
- package/packages/pi-ai/dist/providers/google-gemini-cli.js.map +1 -1
- package/packages/pi-ai/dist/providers/google-shared.d.ts +0 -4
- package/packages/pi-ai/dist/providers/google-shared.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/google-shared.js +1 -1
- package/packages/pi-ai/dist/providers/google-shared.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-completions.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/openai-completions.js +10 -73
- package/packages/pi-ai/dist/providers/openai-completions.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-responses.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/openai-responses.js +9 -80
- package/packages/pi-ai/dist/providers/openai-responses.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-shared.d.ts +65 -0
- package/packages/pi-ai/dist/providers/openai-shared.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/openai-shared.js +146 -0
- package/packages/pi-ai/dist/providers/openai-shared.js.map +1 -0
- package/packages/pi-ai/dist/providers/register-builtins.d.ts +0 -1
- package/packages/pi-ai/dist/providers/register-builtins.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/register-builtins.js +1 -1
- package/packages/pi-ai/dist/providers/register-builtins.js.map +1 -1
- package/packages/pi-ai/dist/utils/event-stream.d.ts +0 -2
- package/packages/pi-ai/dist/utils/event-stream.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/event-stream.js +0 -4
- package/packages/pi-ai/dist/utils/event-stream.js.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.js +7 -135
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.js.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.js +7 -135
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.js.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-oauth-utils.d.ts +46 -0
- package/packages/pi-ai/dist/utils/oauth/google-oauth-utils.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/google-oauth-utils.js +160 -0
- package/packages/pi-ai/dist/utils/oauth/google-oauth-utils.js.map +1 -0
- package/packages/pi-ai/dist/utils/overflow.d.ts +0 -4
- package/packages/pi-ai/dist/utils/overflow.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/overflow.js +0 -6
- package/packages/pi-ai/dist/utils/overflow.js.map +1 -1
- package/packages/pi-ai/dist/utils/validation.d.ts +0 -8
- package/packages/pi-ai/dist/utils/validation.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/validation.js +0 -14
- package/packages/pi-ai/dist/utils/validation.js.map +1 -1
- package/packages/pi-ai/src/api-registry.ts +0 -12
- package/packages/pi-ai/src/providers/anthropic.ts +1 -1
- package/packages/pi-ai/src/providers/azure-openai-responses.ts +11 -45
- package/packages/pi-ai/src/providers/github-copilot-headers.ts +1 -1
- package/packages/pi-ai/src/providers/google-gemini-cli.ts +2 -2
- package/packages/pi-ai/src/providers/google-shared.ts +1 -1
- package/packages/pi-ai/src/providers/openai-completions.ts +16 -86
- package/packages/pi-ai/src/providers/openai-responses.ts +16 -96
- package/packages/pi-ai/src/providers/openai-shared.ts +193 -0
- package/packages/pi-ai/src/providers/register-builtins.ts +1 -1
- package/packages/pi-ai/src/utils/event-stream.ts +0 -5
- package/packages/pi-ai/src/utils/oauth/google-antigravity.ts +14 -162
- package/packages/pi-ai/src/utils/oauth/google-gemini-cli.ts +13 -161
- package/packages/pi-ai/src/utils/oauth/google-oauth-utils.ts +201 -0
- package/packages/pi-ai/src/utils/overflow.ts +1 -8
- package/packages/pi-ai/src/utils/validation.ts +0 -15
- package/packages/pi-coding-agent/dist/config.d.ts +0 -9
- package/packages/pi-coding-agent/dist/config.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/config.js +4 -8
- package/packages/pi-coding-agent/dist/config.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts +16 -63
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.js +104 -641
- package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.d.ts +0 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.js +4 -35
- package/packages/pi-coding-agent/dist/core/auth-storage.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/branch-summarization.js +5 -43
- package/packages/pi-coding-agent/dist/core/compaction/branch-summarization.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/compaction.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/compaction.js +11 -69
- package/packages/pi-coding-agent/dist/core/compaction/compaction.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/utils.d.ts +40 -0
- package/packages/pi-coding-agent/dist/core/compaction/utils.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/utils.js +78 -0
- package/packages/pi-coding-agent/dist/core/compaction/utils.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction-orchestrator.d.ts +77 -0
- package/packages/pi-coding-agent/dist/core/compaction-orchestrator.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/compaction-orchestrator.js +331 -0
- package/packages/pi-coding-agent/dist/core/compaction-orchestrator.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.d.ts +0 -4
- package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.js +1 -1
- package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.d.ts +2 -2
- package/packages/pi-coding-agent/dist/core/extensions/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.js +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts +15 -5
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.js +129 -256
- package/packages/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts +49 -42
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.js +2 -21
- package/packages/pi-coding-agent/dist/core/extensions/types.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/keybindings.d.ts +0 -8
- package/packages/pi-coding-agent/dist/core/keybindings.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/keybindings.js +2 -2
- package/packages/pi-coding-agent/dist/core/keybindings.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lock-utils.d.ts +39 -0
- package/packages/pi-coding-agent/dist/core/lock-utils.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/lock-utils.js +89 -0
- package/packages/pi-coding-agent/dist/core/lock-utils.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/lsp/client.d.ts +0 -17
- package/packages/pi-coding-agent/dist/core/lsp/client.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/client.js +3 -62
- package/packages/pi-coding-agent/dist/core/lsp/client.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/config.d.ts +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/config.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/config.js +2 -6
- package/packages/pi-coding-agent/dist/core/lsp/config.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/edits.d.ts +0 -5
- package/packages/pi-coding-agent/dist/core/lsp/edits.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/edits.js +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/edits.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/index.js +52 -107
- package/packages/pi-coding-agent/dist/core/lsp/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/lspmux.d.ts +0 -1
- package/packages/pi-coding-agent/dist/core/lsp/lspmux.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/lspmux.js +3 -22
- package/packages/pi-coding-agent/dist/core/lsp/lspmux.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/types.d.ts +0 -1
- package/packages/pi-coding-agent/dist/core/lsp/types.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/types.js +0 -28
- package/packages/pi-coding-agent/dist/core/lsp/types.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/utils.d.ts +1 -6
- package/packages/pi-coding-agent/dist/core/lsp/utils.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/utils.js +1 -28
- package/packages/pi-coding-agent/dist/core/lsp/utils.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/messages.d.ts +0 -8
- package/packages/pi-coding-agent/dist/core/messages.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/messages.js +5 -5
- package/packages/pi-coding-agent/dist/core/messages.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts +0 -3
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.js +1 -3
- package/packages/pi-coding-agent/dist/core/model-registry.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-resolver.d.ts +1 -26
- package/packages/pi-coding-agent/dist/core/model-resolver.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-resolver.js +3 -59
- package/packages/pi-coding-agent/dist/core/model-resolver.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/package-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/package-manager.js +2 -4
- package/packages/pi-coding-agent/dist/core/package-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/prompt-templates.d.ts +0 -17
- package/packages/pi-coding-agent/dist/core/prompt-templates.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/prompt-templates.js +2 -2
- package/packages/pi-coding-agent/dist/core/prompt-templates.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/resource-loader.d.ts +2 -4
- package/packages/pi-coding-agent/dist/core/resource-loader.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/resource-loader.js +46 -60
- package/packages/pi-coding-agent/dist/core/resource-loader.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/retry-handler.d.ts +87 -0
- package/packages/pi-coding-agent/dist/core/retry-handler.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/retry-handler.js +295 -0
- package/packages/pi-coding-agent/dist/core/retry-handler.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/session-manager.d.ts +0 -5
- package/packages/pi-coding-agent/dist/core/session-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/session-manager.js +5 -32
- package/packages/pi-coding-agent/dist/core/session-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts +8 -12
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.js +78 -168
- package/packages/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/skills.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/skills.js +1 -3
- package/packages/pi-coding-agent/dist/core/skills.js.map +1 -1
- package/packages/pi-coding-agent/dist/index.d.ts +1 -1
- package/packages/pi-coding-agent/dist/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/index.js +1 -1
- package/packages/pi-coding-agent/dist/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/migrations.d.ts +0 -16
- package/packages/pi-coding-agent/dist/migrations.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/migrations.js +2 -2
- package/packages/pi-coding-agent/dist/migrations.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.d.ts +0 -2
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.js +2 -2
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector.d.ts +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector.js +9 -26
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +1 -13
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-render-utils.d.ts +44 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-render-utils.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-render-utils.js +61 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-render-utils.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-selector.js +6 -9
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +1 -24
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +50 -512
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.d.ts +71 -0
- package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.js +514 -0
- package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts +65 -4
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js +6 -23
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.d.ts +12 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js +175 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/utils/shorten-path.d.ts +6 -0
- package/packages/pi-coding-agent/dist/modes/interactive/utils/shorten-path.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/utils/shorten-path.js +15 -0
- package/packages/pi-coding-agent/dist/modes/interactive/utils/shorten-path.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/print-mode.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/print-mode.js +2 -30
- package/packages/pi-coding-agent/dist/modes/print-mode.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-mode.js +2 -28
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/shared/command-context-actions.d.ts +19 -0
- package/packages/pi-coding-agent/dist/modes/shared/command-context-actions.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/shared/command-context-actions.js +45 -0
- package/packages/pi-coding-agent/dist/modes/shared/command-context-actions.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/changelog.d.ts +0 -4
- package/packages/pi-coding-agent/dist/utils/changelog.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/utils/changelog.js +1 -1
- package/packages/pi-coding-agent/dist/utils/changelog.js.map +1 -1
- package/packages/pi-coding-agent/dist/utils/clipboard-image.d.ts +0 -1
- package/packages/pi-coding-agent/dist/utils/clipboard-image.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/utils/clipboard-image.js +1 -1
- package/packages/pi-coding-agent/dist/utils/clipboard-image.js.map +1 -1
- package/packages/pi-coding-agent/dist/utils/error.d.ts +5 -0
- package/packages/pi-coding-agent/dist/utils/error.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/utils/error.js +7 -0
- package/packages/pi-coding-agent/dist/utils/error.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/photon.d.ts +0 -19
- package/packages/pi-coding-agent/dist/utils/photon.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/utils/photon.js +1 -120
- package/packages/pi-coding-agent/dist/utils/photon.js.map +1 -1
- package/packages/pi-coding-agent/dist/utils/tools-manager.d.ts +0 -1
- package/packages/pi-coding-agent/dist/utils/tools-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/utils/tools-manager.js +1 -1
- package/packages/pi-coding-agent/dist/utils/tools-manager.js.map +1 -1
- package/packages/pi-coding-agent/package.json +1 -1
- package/packages/pi-coding-agent/src/config.ts +5 -10
- package/packages/pi-coding-agent/src/core/agent-session.ts +117 -745
- package/packages/pi-coding-agent/src/core/auth-storage.ts +4 -38
- package/packages/pi-coding-agent/src/core/compaction/branch-summarization.ts +7 -53
- package/packages/pi-coding-agent/src/core/compaction/compaction.ts +14 -74
- package/packages/pi-coding-agent/src/core/compaction/utils.ts +100 -0
- package/packages/pi-coding-agent/src/core/compaction-orchestrator.ts +424 -0
- package/packages/pi-coding-agent/src/core/export-html/ansi-to-html.ts +1 -1
- package/packages/pi-coding-agent/src/core/extensions/index.ts +1 -21
- package/packages/pi-coding-agent/src/core/extensions/runner.ts +119 -256
- package/packages/pi-coding-agent/src/core/extensions/types.ts +50 -69
- package/packages/pi-coding-agent/src/core/keybindings.ts +2 -2
- package/packages/pi-coding-agent/src/core/lock-utils.ts +113 -0
- package/packages/pi-coding-agent/src/core/lsp/client.ts +3 -73
- package/packages/pi-coding-agent/src/core/lsp/config.ts +2 -10
- package/packages/pi-coding-agent/src/core/lsp/edits.ts +1 -1
- package/packages/pi-coding-agent/src/core/lsp/index.ts +83 -152
- package/packages/pi-coding-agent/src/core/lsp/lspmux.ts +3 -23
- package/packages/pi-coding-agent/src/core/lsp/types.ts +0 -29
- package/packages/pi-coding-agent/src/core/lsp/utils.ts +1 -33
- package/packages/pi-coding-agent/src/core/messages.ts +5 -5
- package/packages/pi-coding-agent/src/core/model-registry.ts +0 -2
- package/packages/pi-coding-agent/src/core/model-resolver.ts +3 -77
- package/packages/pi-coding-agent/src/core/package-manager.ts +1 -4
- package/packages/pi-coding-agent/src/core/prompt-templates.ts +2 -2
- package/packages/pi-coding-agent/src/core/resource-loader.ts +56 -69
- package/packages/pi-coding-agent/src/core/retry-handler.ts +359 -0
- package/packages/pi-coding-agent/src/core/session-manager.ts +5 -34
- package/packages/pi-coding-agent/src/core/settings-manager.ts +87 -166
- package/packages/pi-coding-agent/src/core/skills.ts +1 -4
- package/packages/pi-coding-agent/src/index.ts +1 -7
- package/packages/pi-coding-agent/src/migrations.ts +2 -2
- package/packages/pi-coding-agent/src/modes/interactive/components/session-selector-search.ts +2 -2
- package/packages/pi-coding-agent/src/modes/interactive/components/session-selector.ts +17 -29
- package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +1 -13
- package/packages/pi-coding-agent/src/modes/interactive/components/tree-render-utils.ts +81 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/tree-selector.ts +14 -19
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +50 -561
- package/packages/pi-coding-agent/src/modes/interactive/slash-command-handlers.ts +653 -0
- package/packages/pi-coding-agent/src/modes/interactive/theme/theme.ts +7 -26
- package/packages/pi-coding-agent/src/modes/interactive/theme/themes.ts +196 -0
- package/packages/pi-coding-agent/src/modes/interactive/utils/shorten-path.ts +14 -0
- package/packages/pi-coding-agent/src/modes/print-mode.ts +2 -30
- package/packages/pi-coding-agent/src/modes/rpc/rpc-mode.ts +2 -28
- package/packages/pi-coding-agent/src/modes/shared/command-context-actions.ts +53 -0
- package/packages/pi-coding-agent/src/utils/changelog.ts +1 -1
- package/packages/pi-coding-agent/src/utils/clipboard-image.ts +1 -1
- package/packages/pi-coding-agent/src/utils/error.ts +6 -0
- package/packages/pi-coding-agent/src/utils/photon.ts +0 -137
- package/packages/pi-coding-agent/src/utils/tools-manager.ts +1 -1
- package/packages/pi-tui/dist/components/editor.d.ts +0 -10
- package/packages/pi-tui/dist/components/editor.d.ts.map +1 -1
- package/packages/pi-tui/dist/components/editor.js +1 -1
- package/packages/pi-tui/dist/components/editor.js.map +1 -1
- package/packages/pi-tui/dist/components/markdown.d.ts +5 -0
- package/packages/pi-tui/dist/components/markdown.d.ts.map +1 -1
- package/packages/pi-tui/dist/components/markdown.js +25 -31
- package/packages/pi-tui/dist/components/markdown.js.map +1 -1
- package/packages/pi-tui/dist/keys.d.ts +0 -4
- package/packages/pi-tui/dist/keys.d.ts.map +1 -1
- package/packages/pi-tui/dist/keys.js +94 -162
- package/packages/pi-tui/dist/keys.js.map +1 -1
- package/packages/pi-tui/dist/overlay-layout.d.ts +55 -0
- package/packages/pi-tui/dist/overlay-layout.d.ts.map +1 -0
- package/packages/pi-tui/dist/overlay-layout.js +288 -0
- package/packages/pi-tui/dist/overlay-layout.js.map +1 -0
- package/packages/pi-tui/dist/tui.d.ts +0 -22
- package/packages/pi-tui/dist/tui.d.ts.map +1 -1
- package/packages/pi-tui/dist/tui.js +6 -272
- package/packages/pi-tui/dist/tui.js.map +1 -1
- package/packages/pi-tui/dist/utils.d.ts +0 -7
- package/packages/pi-tui/dist/utils.d.ts.map +1 -1
- package/packages/pi-tui/dist/utils.js +0 -44
- package/packages/pi-tui/dist/utils.js.map +1 -1
- package/packages/pi-tui/src/components/editor.ts +1 -1
- package/packages/pi-tui/src/components/markdown.ts +25 -29
- package/packages/pi-tui/src/keys.ts +94 -173
- package/packages/pi-tui/src/overlay-layout.ts +372 -0
- package/packages/pi-tui/src/tui.ts +11 -312
- package/packages/pi-tui/src/utils.ts +0 -43
- package/pkg/dist/core/export-html/ansi-to-html.d.ts +0 -4
- package/pkg/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
- package/pkg/dist/core/export-html/ansi-to-html.js +1 -1
- package/pkg/dist/core/export-html/ansi-to-html.js.map +1 -1
- package/pkg/dist/modes/interactive/theme/theme.d.ts +65 -4
- package/pkg/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/pkg/dist/modes/interactive/theme/theme.js +6 -23
- package/pkg/dist/modes/interactive/theme/theme.js.map +1 -1
- package/pkg/dist/modes/interactive/theme/themes.d.ts +12 -0
- package/pkg/dist/modes/interactive/theme/themes.d.ts.map +1 -0
- package/pkg/dist/modes/interactive/theme/themes.js +175 -0
- package/pkg/dist/modes/interactive/theme/themes.js.map +1 -0
- package/pkg/package.json +1 -1
- package/src/resources/extensions/async-jobs/await-tool.ts +0 -2
- package/src/resources/extensions/async-jobs/job-manager.ts +0 -7
- package/src/resources/extensions/bg-shell/output-formatter.ts +0 -17
- package/src/resources/extensions/bg-shell/process-manager.ts +0 -4
- package/src/resources/extensions/bg-shell/types.ts +0 -12
- package/src/resources/extensions/context7/index.ts +7 -0
- package/src/resources/extensions/get-secrets-from-user.ts +2 -35
- package/src/resources/extensions/google-search/index.ts +7 -0
- package/src/resources/extensions/gsd/auto-dispatch.ts +49 -1
- package/src/resources/extensions/gsd/auto-loop.ts +11 -1
- package/src/resources/extensions/gsd/auto-recovery.ts +39 -0
- package/src/resources/extensions/gsd/auto-start.ts +42 -2
- package/src/resources/extensions/gsd/auto.ts +61 -3
- package/src/resources/extensions/gsd/changelog.ts +213 -0
- package/src/resources/extensions/gsd/commands-bootstrap.ts +1 -0
- package/src/resources/extensions/gsd/commands-handlers.ts +2 -2
- package/src/resources/extensions/gsd/commands-inspect.ts +10 -3
- package/src/resources/extensions/gsd/commands-prefs-wizard.ts +5 -1
- package/src/resources/extensions/gsd/commands.ts +9 -1
- package/src/resources/extensions/gsd/docs/preferences-reference.md +10 -0
- package/src/resources/extensions/gsd/doctor-checks.ts +107 -5
- package/src/resources/extensions/gsd/doctor-environment.ts +26 -16
- package/src/resources/extensions/gsd/doctor-proactive.ts +24 -0
- package/src/resources/extensions/gsd/doctor-types.ts +9 -1
- package/src/resources/extensions/gsd/doctor.ts +35 -0
- package/src/resources/extensions/gsd/files.ts +12 -2
- package/src/resources/extensions/gsd/gitignore.ts +54 -7
- package/src/resources/extensions/gsd/guided-flow.ts +5 -3
- package/src/resources/extensions/gsd/health-widget-core.ts +129 -0
- package/src/resources/extensions/gsd/health-widget.ts +103 -59
- package/src/resources/extensions/gsd/index.ts +10 -1
- package/src/resources/extensions/gsd/migrate-external.ts +47 -2
- package/src/resources/extensions/gsd/paths.ts +73 -7
- package/src/resources/extensions/gsd/post-unit-hooks.ts +5 -1
- package/src/resources/extensions/gsd/preferences-validation.ts +54 -1
- package/src/resources/extensions/gsd/preferences.ts +2 -0
- package/src/resources/extensions/gsd/prompts/complete-milestone.md +2 -0
- package/src/resources/extensions/gsd/prompts/validate-milestone.md +2 -0
- package/src/resources/extensions/gsd/roadmap-mutations.ts +66 -0
- package/src/resources/extensions/gsd/session-lock.ts +29 -2
- package/src/resources/extensions/gsd/templates/plan.md +8 -0
- package/src/resources/extensions/gsd/tests/commands-inspect-open-db.test.ts +46 -0
- package/src/resources/extensions/gsd/tests/doctor-git.test.ts +98 -2
- package/src/resources/extensions/gsd/tests/doctor-runtime.test.ts +59 -3
- package/src/resources/extensions/gsd/tests/files-loadfile-eisdir.test.ts +20 -0
- package/src/resources/extensions/gsd/tests/gitignore-tracked-gsd.test.ts +214 -0
- package/src/resources/extensions/gsd/tests/health-widget.test.ts +158 -0
- package/src/resources/extensions/gsd/tests/paths.test.ts +113 -0
- package/src/resources/extensions/gsd/tests/preferences.test.ts +40 -2
- package/src/resources/extensions/gsd/tests/test-utils.ts +165 -0
- package/src/resources/extensions/gsd/tests/validate-directory.test.ts +15 -0
- package/src/resources/extensions/gsd/tests/validate-milestone.test.ts +2 -0
- package/src/resources/extensions/gsd/tests/worktree-sync-milestones.test.ts +32 -0
- package/src/resources/extensions/gsd/worktree-resolver.ts +11 -0
- package/src/resources/extensions/mcp-client/index.ts +2 -1
- package/src/resources/extensions/remote-questions/remote-command.ts +2 -23
- package/src/resources/extensions/shared/mod.ts +1 -1
- package/src/resources/extensions/shared/sanitize.ts +36 -0
- package/src/resources/extensions/subagent/index.ts +6 -12
- package/src/resources/skills/create-gsd-extension/references/events-reference.md +4 -4
- package/dist/resources/extensions/shared/wizard-ui.js +0 -478
- package/packages/pi-coding-agent/dist/modes/interactive/theme/dark.json +0 -85
- package/packages/pi-coding-agent/dist/modes/interactive/theme/light.json +0 -84
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.json +0 -335
- package/packages/pi-coding-agent/src/modes/interactive/theme/dark.json +0 -85
- package/packages/pi-coding-agent/src/modes/interactive/theme/light.json +0 -84
- package/packages/pi-coding-agent/src/modes/interactive/theme/theme-schema.json +0 -335
- package/pkg/dist/modes/interactive/theme/dark.json +0 -85
- package/pkg/dist/modes/interactive/theme/light.json +0 -84
- package/pkg/dist/modes/interactive/theme/theme-schema.json +0 -335
- package/src/resources/extensions/shared/wizard-ui.ts +0 -551
|
@@ -153,19 +153,6 @@ export type ReloadHandler = () => Promise<void>;
|
|
|
153
153
|
|
|
154
154
|
export type ShutdownHandler = () => void;
|
|
155
155
|
|
|
156
|
-
/**
|
|
157
|
-
* Helper function to emit session_shutdown event to extensions.
|
|
158
|
-
* Returns true if the event was emitted, false if there were no handlers.
|
|
159
|
-
*/
|
|
160
|
-
export async function emitSessionShutdownEvent(extensionRunner: ExtensionRunner | undefined): Promise<boolean> {
|
|
161
|
-
if (extensionRunner?.hasHandlers("session_shutdown")) {
|
|
162
|
-
await extensionRunner.emit({
|
|
163
|
-
type: "session_shutdown",
|
|
164
|
-
});
|
|
165
|
-
return true;
|
|
166
|
-
}
|
|
167
|
-
return false;
|
|
168
|
-
}
|
|
169
156
|
|
|
170
157
|
const noOpUIContext: ExtensionUIContext = {
|
|
171
158
|
select: async () => undefined,
|
|
@@ -555,216 +542,136 @@ export class ExtensionRunner {
|
|
|
555
542
|
);
|
|
556
543
|
}
|
|
557
544
|
|
|
558
|
-
|
|
545
|
+
/**
|
|
546
|
+
* Shared handler invocation loop.
|
|
547
|
+
*
|
|
548
|
+
* Iterates every handler registered for `eventType` across all extensions,
|
|
549
|
+
* calling each inside a try/catch that emits an ExtensionError on failure.
|
|
550
|
+
*
|
|
551
|
+
* `getEvent` builds the event object for each handler call — callers that
|
|
552
|
+
* mutate state between calls (e.g. context, before_provider_request) supply
|
|
553
|
+
* a function; callers with a fixed event can pass a constant.
|
|
554
|
+
*
|
|
555
|
+
* `processResult` receives each handler's return value and the owning
|
|
556
|
+
* extension's path. It returns `{ done: true }` to short-circuit
|
|
557
|
+
* or `{ done: false }` to keep iterating.
|
|
558
|
+
*/
|
|
559
|
+
private async invokeHandlers(
|
|
560
|
+
eventType: string,
|
|
561
|
+
getEvent: () => unknown,
|
|
562
|
+
processResult: (handlerResult: unknown, extensionPath: string) => { done: boolean },
|
|
563
|
+
): Promise<void> {
|
|
559
564
|
const ctx = this.createContext();
|
|
560
|
-
let result: SessionBeforeEventResult | undefined;
|
|
561
565
|
|
|
562
566
|
for (const ext of this.extensions) {
|
|
563
|
-
const handlers = ext.handlers.get(
|
|
567
|
+
const handlers = ext.handlers.get(eventType);
|
|
564
568
|
if (!handlers || handlers.length === 0) continue;
|
|
565
569
|
|
|
566
570
|
for (const handler of handlers) {
|
|
567
571
|
try {
|
|
572
|
+
const event = getEvent();
|
|
568
573
|
const handlerResult = await handler(event, ctx);
|
|
569
|
-
|
|
570
|
-
if (
|
|
571
|
-
result = handlerResult as SessionBeforeEventResult;
|
|
572
|
-
if (result.cancel) {
|
|
573
|
-
return result as RunnerEmitResult<TEvent>;
|
|
574
|
-
}
|
|
575
|
-
}
|
|
574
|
+
const action = processResult(handlerResult, ext.path);
|
|
575
|
+
if (action.done) return;
|
|
576
576
|
} catch (err) {
|
|
577
577
|
const message = err instanceof Error ? err.message : String(err);
|
|
578
578
|
const stack = err instanceof Error ? err.stack : undefined;
|
|
579
579
|
this.emitError({
|
|
580
580
|
extensionPath: ext.path,
|
|
581
|
-
event:
|
|
581
|
+
event: eventType,
|
|
582
582
|
error: message,
|
|
583
583
|
stack,
|
|
584
584
|
});
|
|
585
585
|
}
|
|
586
586
|
}
|
|
587
587
|
}
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
async emit<TEvent extends RunnerEmitEvent>(event: TEvent): Promise<RunnerEmitResult<TEvent>> {
|
|
591
|
+
let result: SessionBeforeEventResult | undefined;
|
|
592
|
+
const isSessionBefore = this.isSessionBeforeEvent(event);
|
|
593
|
+
|
|
594
|
+
await this.invokeHandlers(event.type, () => event, (handlerResult) => {
|
|
595
|
+
if (isSessionBefore && handlerResult) {
|
|
596
|
+
result = handlerResult as SessionBeforeEventResult;
|
|
597
|
+
if (result.cancel) return { done: true };
|
|
598
|
+
}
|
|
599
|
+
return { done: false };
|
|
600
|
+
});
|
|
588
601
|
|
|
589
602
|
return result as RunnerEmitResult<TEvent>;
|
|
590
603
|
}
|
|
591
604
|
|
|
592
605
|
async emitToolResult(event: ToolResultEvent): Promise<ToolResultEventResult | undefined> {
|
|
593
|
-
const ctx = this.createContext();
|
|
594
606
|
const currentEvent: ToolResultEvent = { ...event };
|
|
595
607
|
let modified = false;
|
|
596
608
|
|
|
597
|
-
|
|
598
|
-
const
|
|
599
|
-
if (!
|
|
600
|
-
|
|
601
|
-
for (const handler of handlers) {
|
|
602
|
-
try {
|
|
603
|
-
const handlerResult = (await handler(currentEvent, ctx)) as ToolResultEventResult | undefined;
|
|
604
|
-
if (!handlerResult) continue;
|
|
609
|
+
await this.invokeHandlers("tool_result", () => currentEvent, (handlerResult) => {
|
|
610
|
+
const r = handlerResult as ToolResultEventResult | undefined;
|
|
611
|
+
if (!r) return { done: false };
|
|
605
612
|
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
currentEvent.details = handlerResult.details;
|
|
612
|
-
modified = true;
|
|
613
|
-
}
|
|
614
|
-
if (handlerResult.isError !== undefined) {
|
|
615
|
-
currentEvent.isError = handlerResult.isError;
|
|
616
|
-
modified = true;
|
|
617
|
-
}
|
|
618
|
-
} catch (err) {
|
|
619
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
620
|
-
const stack = err instanceof Error ? err.stack : undefined;
|
|
621
|
-
this.emitError({
|
|
622
|
-
extensionPath: ext.path,
|
|
623
|
-
event: "tool_result",
|
|
624
|
-
error: message,
|
|
625
|
-
stack,
|
|
626
|
-
});
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
if (!modified) {
|
|
632
|
-
return undefined;
|
|
633
|
-
}
|
|
613
|
+
if (r.content !== undefined) { currentEvent.content = r.content; modified = true; }
|
|
614
|
+
if (r.details !== undefined) { currentEvent.details = r.details; modified = true; }
|
|
615
|
+
if (r.isError !== undefined) { currentEvent.isError = r.isError; modified = true; }
|
|
616
|
+
return { done: false };
|
|
617
|
+
});
|
|
634
618
|
|
|
635
|
-
return
|
|
636
|
-
|
|
637
|
-
details: currentEvent.details,
|
|
638
|
-
isError: currentEvent.isError,
|
|
639
|
-
};
|
|
619
|
+
if (!modified) return undefined;
|
|
620
|
+
return { content: currentEvent.content, details: currentEvent.details, isError: currentEvent.isError };
|
|
640
621
|
}
|
|
641
622
|
|
|
642
623
|
async emitToolCall(event: ToolCallEvent): Promise<ToolCallEventResult | undefined> {
|
|
643
|
-
const ctx = this.createContext();
|
|
644
624
|
let result: ToolCallEventResult | undefined;
|
|
645
625
|
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
for (const handler of handlers) {
|
|
651
|
-
try {
|
|
652
|
-
const handlerResult = await handler(event, ctx);
|
|
653
|
-
|
|
654
|
-
if (handlerResult) {
|
|
655
|
-
result = handlerResult as ToolCallEventResult;
|
|
656
|
-
if (result.block) {
|
|
657
|
-
return result;
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
} catch (err) {
|
|
661
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
662
|
-
const stack = err instanceof Error ? err.stack : undefined;
|
|
663
|
-
this.emitError({
|
|
664
|
-
extensionPath: ext.path,
|
|
665
|
-
event: "tool_call",
|
|
666
|
-
error: message,
|
|
667
|
-
stack,
|
|
668
|
-
});
|
|
669
|
-
}
|
|
626
|
+
await this.invokeHandlers("tool_call", () => event, (handlerResult) => {
|
|
627
|
+
if (handlerResult) {
|
|
628
|
+
result = handlerResult as ToolCallEventResult;
|
|
629
|
+
if (result.block) return { done: true };
|
|
670
630
|
}
|
|
671
|
-
|
|
631
|
+
return { done: false };
|
|
632
|
+
});
|
|
672
633
|
|
|
673
634
|
return result;
|
|
674
635
|
}
|
|
675
636
|
|
|
676
637
|
async emitUserBash(event: UserBashEvent): Promise<UserBashEventResult | undefined> {
|
|
677
|
-
|
|
638
|
+
let result: UserBashEventResult | undefined;
|
|
678
639
|
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
for (const handler of handlers) {
|
|
684
|
-
try {
|
|
685
|
-
const handlerResult = await handler(event, ctx);
|
|
686
|
-
if (handlerResult) {
|
|
687
|
-
return handlerResult as UserBashEventResult;
|
|
688
|
-
}
|
|
689
|
-
} catch (err) {
|
|
690
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
691
|
-
const stack = err instanceof Error ? err.stack : undefined;
|
|
692
|
-
this.emitError({
|
|
693
|
-
extensionPath: ext.path,
|
|
694
|
-
event: "user_bash",
|
|
695
|
-
error: message,
|
|
696
|
-
stack,
|
|
697
|
-
});
|
|
698
|
-
}
|
|
640
|
+
await this.invokeHandlers("user_bash", () => event, (handlerResult) => {
|
|
641
|
+
if (handlerResult) {
|
|
642
|
+
result = handlerResult as UserBashEventResult;
|
|
643
|
+
return { done: true };
|
|
699
644
|
}
|
|
700
|
-
|
|
645
|
+
return { done: false };
|
|
646
|
+
});
|
|
701
647
|
|
|
702
|
-
return
|
|
648
|
+
return result;
|
|
703
649
|
}
|
|
704
650
|
|
|
705
651
|
async emitContext(messages: AgentMessage[]): Promise<AgentMessage[]> {
|
|
706
|
-
const ctx = this.createContext();
|
|
707
652
|
let currentMessages = structuredClone(messages);
|
|
708
653
|
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
for (const handler of handlers) {
|
|
714
|
-
try {
|
|
715
|
-
const event: ContextEvent = { type: "context", messages: currentMessages };
|
|
716
|
-
const handlerResult = await handler(event, ctx);
|
|
717
|
-
|
|
718
|
-
if (handlerResult && (handlerResult as ContextEventResult).messages) {
|
|
719
|
-
currentMessages = (handlerResult as ContextEventResult).messages!;
|
|
720
|
-
}
|
|
721
|
-
} catch (err) {
|
|
722
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
723
|
-
const stack = err instanceof Error ? err.stack : undefined;
|
|
724
|
-
this.emitError({
|
|
725
|
-
extensionPath: ext.path,
|
|
726
|
-
event: "context",
|
|
727
|
-
error: message,
|
|
728
|
-
stack,
|
|
729
|
-
});
|
|
730
|
-
}
|
|
654
|
+
await this.invokeHandlers("context", () => ({ type: "context", messages: currentMessages } satisfies ContextEvent), (handlerResult) => {
|
|
655
|
+
if (handlerResult && (handlerResult as ContextEventResult).messages) {
|
|
656
|
+
currentMessages = (handlerResult as ContextEventResult).messages!;
|
|
731
657
|
}
|
|
732
|
-
|
|
658
|
+
return { done: false };
|
|
659
|
+
});
|
|
733
660
|
|
|
734
661
|
return currentMessages;
|
|
735
662
|
}
|
|
736
663
|
|
|
737
664
|
async emitBeforeProviderRequest(payload: unknown, model?: { provider: string; id: string }): Promise<unknown> {
|
|
738
|
-
const ctx = this.createContext();
|
|
739
665
|
let currentPayload = payload;
|
|
740
666
|
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
payload: currentPayload,
|
|
750
|
-
model,
|
|
751
|
-
};
|
|
752
|
-
const handlerResult = await handler(event, ctx);
|
|
753
|
-
if (handlerResult !== undefined) {
|
|
754
|
-
currentPayload = handlerResult;
|
|
755
|
-
}
|
|
756
|
-
} catch (err) {
|
|
757
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
758
|
-
const stack = err instanceof Error ? err.stack : undefined;
|
|
759
|
-
this.emitError({
|
|
760
|
-
extensionPath: ext.path,
|
|
761
|
-
event: "before_provider_request",
|
|
762
|
-
error: message,
|
|
763
|
-
stack,
|
|
764
|
-
});
|
|
765
|
-
}
|
|
766
|
-
}
|
|
767
|
-
}
|
|
667
|
+
await this.invokeHandlers("before_provider_request", () => ({
|
|
668
|
+
type: "before_provider_request",
|
|
669
|
+
payload: currentPayload,
|
|
670
|
+
model,
|
|
671
|
+
} satisfies BeforeProviderRequestEvent), (handlerResult) => {
|
|
672
|
+
if (handlerResult !== undefined) currentPayload = handlerResult;
|
|
673
|
+
return { done: false };
|
|
674
|
+
});
|
|
768
675
|
|
|
769
676
|
return currentPayload;
|
|
770
677
|
}
|
|
@@ -774,47 +681,26 @@ export class ExtensionRunner {
|
|
|
774
681
|
images: ImageContent[] | undefined,
|
|
775
682
|
systemPrompt: string,
|
|
776
683
|
): Promise<BeforeAgentStartCombinedResult | undefined> {
|
|
777
|
-
const ctx = this.createContext();
|
|
778
684
|
const messages: NonNullable<BeforeAgentStartEventResult["message"]>[] = [];
|
|
779
685
|
let currentSystemPrompt = systemPrompt;
|
|
780
686
|
let systemPromptModified = false;
|
|
781
687
|
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
const handlerResult = await handler(event, ctx);
|
|
795
|
-
|
|
796
|
-
if (handlerResult) {
|
|
797
|
-
const result = handlerResult as BeforeAgentStartEventResult;
|
|
798
|
-
if (result.message) {
|
|
799
|
-
messages.push(result.message);
|
|
800
|
-
}
|
|
801
|
-
if (result.systemPrompt !== undefined) {
|
|
802
|
-
currentSystemPrompt = result.systemPrompt;
|
|
803
|
-
systemPromptModified = true;
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
} catch (err) {
|
|
807
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
808
|
-
const stack = err instanceof Error ? err.stack : undefined;
|
|
809
|
-
this.emitError({
|
|
810
|
-
extensionPath: ext.path,
|
|
811
|
-
event: "before_agent_start",
|
|
812
|
-
error: message,
|
|
813
|
-
stack,
|
|
814
|
-
});
|
|
688
|
+
await this.invokeHandlers("before_agent_start", () => ({
|
|
689
|
+
type: "before_agent_start",
|
|
690
|
+
prompt,
|
|
691
|
+
images,
|
|
692
|
+
systemPrompt: currentSystemPrompt,
|
|
693
|
+
} satisfies BeforeAgentStartEvent), (handlerResult) => {
|
|
694
|
+
if (handlerResult) {
|
|
695
|
+
const r = handlerResult as BeforeAgentStartEventResult;
|
|
696
|
+
if (r.message) messages.push(r.message);
|
|
697
|
+
if (r.systemPrompt !== undefined) {
|
|
698
|
+
currentSystemPrompt = r.systemPrompt;
|
|
699
|
+
systemPromptModified = true;
|
|
815
700
|
}
|
|
816
701
|
}
|
|
817
|
-
|
|
702
|
+
return { done: false };
|
|
703
|
+
});
|
|
818
704
|
|
|
819
705
|
if (messages.length > 0 || systemPromptModified) {
|
|
820
706
|
return {
|
|
@@ -822,7 +708,6 @@ export class ExtensionRunner {
|
|
|
822
708
|
systemPrompt: systemPromptModified ? currentSystemPrompt : undefined,
|
|
823
709
|
};
|
|
824
710
|
}
|
|
825
|
-
|
|
826
711
|
return undefined;
|
|
827
712
|
}
|
|
828
713
|
|
|
@@ -834,72 +719,50 @@ export class ExtensionRunner {
|
|
|
834
719
|
promptPaths: Array<{ path: string; extensionPath: string }>;
|
|
835
720
|
themePaths: Array<{ path: string; extensionPath: string }>;
|
|
836
721
|
}> {
|
|
837
|
-
const ctx = this.createContext();
|
|
838
722
|
const skillPaths: Array<{ path: string; extensionPath: string }> = [];
|
|
839
723
|
const promptPaths: Array<{ path: string; extensionPath: string }> = [];
|
|
840
724
|
const themePaths: Array<{ path: string; extensionPath: string }> = [];
|
|
841
725
|
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
skillPaths.push(...result.skillPaths.map((path) => ({ path, extensionPath: ext.path })));
|
|
854
|
-
}
|
|
855
|
-
if (result?.promptPaths?.length) {
|
|
856
|
-
promptPaths.push(...result.promptPaths.map((path) => ({ path, extensionPath: ext.path })));
|
|
857
|
-
}
|
|
858
|
-
if (result?.themePaths?.length) {
|
|
859
|
-
themePaths.push(...result.themePaths.map((path) => ({ path, extensionPath: ext.path })));
|
|
860
|
-
}
|
|
861
|
-
} catch (err) {
|
|
862
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
863
|
-
const stack = err instanceof Error ? err.stack : undefined;
|
|
864
|
-
this.emitError({
|
|
865
|
-
extensionPath: ext.path,
|
|
866
|
-
event: "resources_discover",
|
|
867
|
-
error: message,
|
|
868
|
-
stack,
|
|
869
|
-
});
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
}
|
|
726
|
+
await this.invokeHandlers("resources_discover", () => ({
|
|
727
|
+
type: "resources_discover",
|
|
728
|
+
cwd,
|
|
729
|
+
reason,
|
|
730
|
+
} satisfies ResourcesDiscoverEvent), (handlerResult, extensionPath) => {
|
|
731
|
+
const r = handlerResult as ResourcesDiscoverResult | undefined;
|
|
732
|
+
if (r?.skillPaths?.length) skillPaths.push(...r.skillPaths.map((path) => ({ path, extensionPath })));
|
|
733
|
+
if (r?.promptPaths?.length) promptPaths.push(...r.promptPaths.map((path) => ({ path, extensionPath })));
|
|
734
|
+
if (r?.themePaths?.length) themePaths.push(...r.themePaths.map((path) => ({ path, extensionPath })));
|
|
735
|
+
return { done: false };
|
|
736
|
+
});
|
|
873
737
|
|
|
874
738
|
return { skillPaths, promptPaths, themePaths };
|
|
875
739
|
}
|
|
876
740
|
|
|
877
741
|
/** Emit input event. Transforms chain, "handled" short-circuits. */
|
|
878
742
|
async emitInput(text: string, images: ImageContent[] | undefined, source: InputSource): Promise<InputEventResult> {
|
|
879
|
-
const ctx = this.createContext();
|
|
880
743
|
let currentText = text;
|
|
881
744
|
let currentImages = images;
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
this.emitError({
|
|
895
|
-
extensionPath: ext.path,
|
|
896
|
-
event: "input",
|
|
897
|
-
error: err instanceof Error ? err.message : String(err),
|
|
898
|
-
stack: err instanceof Error ? err.stack : undefined,
|
|
899
|
-
});
|
|
900
|
-
}
|
|
745
|
+
let handled: InputEventResult | undefined;
|
|
746
|
+
|
|
747
|
+
await this.invokeHandlers("input", () => ({
|
|
748
|
+
type: "input",
|
|
749
|
+
text: currentText,
|
|
750
|
+
images: currentImages,
|
|
751
|
+
source,
|
|
752
|
+
} satisfies InputEvent), (handlerResult) => {
|
|
753
|
+
const r = handlerResult as InputEventResult | undefined;
|
|
754
|
+
if (r?.action === "handled") {
|
|
755
|
+
handled = r;
|
|
756
|
+
return { done: true };
|
|
901
757
|
}
|
|
902
|
-
|
|
758
|
+
if (r?.action === "transform") {
|
|
759
|
+
currentText = r.text;
|
|
760
|
+
currentImages = r.images ?? currentImages;
|
|
761
|
+
}
|
|
762
|
+
return { done: false };
|
|
763
|
+
});
|
|
764
|
+
|
|
765
|
+
if (handled) return handled;
|
|
903
766
|
return currentText !== text || currentImages !== images
|
|
904
767
|
? { action: "transform", text: currentText, images: currentImages }
|
|
905
768
|
: { action: "continue" };
|
|
@@ -761,27 +761,36 @@ export type ToolResultEvent =
|
|
|
761
761
|
| LsToolResultEvent
|
|
762
762
|
| CustomToolResultEvent;
|
|
763
763
|
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
export function
|
|
784
|
-
|
|
764
|
+
/**
|
|
765
|
+
* Type guard for narrowing ToolResultEvent by tool name.
|
|
766
|
+
*
|
|
767
|
+
* Built-in tools narrow automatically (no type params needed):
|
|
768
|
+
* ```ts
|
|
769
|
+
* if (isToolResultEventType("bash", event)) {
|
|
770
|
+
* event.details; // BashToolDetails | undefined
|
|
771
|
+
* }
|
|
772
|
+
* ```
|
|
773
|
+
*
|
|
774
|
+
* Custom tools require explicit type parameters:
|
|
775
|
+
* ```ts
|
|
776
|
+
* if (isToolResultEventType<"my_tool", MyDetails>("my_tool", event)) {
|
|
777
|
+
* event.details; // typed
|
|
778
|
+
* }
|
|
779
|
+
* ```
|
|
780
|
+
*/
|
|
781
|
+
export function isToolResultEventType(toolName: "bash", event: ToolResultEvent): event is BashToolResultEvent;
|
|
782
|
+
export function isToolResultEventType(toolName: "read", event: ToolResultEvent): event is ReadToolResultEvent;
|
|
783
|
+
export function isToolResultEventType(toolName: "edit", event: ToolResultEvent): event is EditToolResultEvent;
|
|
784
|
+
export function isToolResultEventType(toolName: "write", event: ToolResultEvent): event is WriteToolResultEvent;
|
|
785
|
+
export function isToolResultEventType(toolName: "grep", event: ToolResultEvent): event is GrepToolResultEvent;
|
|
786
|
+
export function isToolResultEventType(toolName: "find", event: ToolResultEvent): event is FindToolResultEvent;
|
|
787
|
+
export function isToolResultEventType(toolName: "ls", event: ToolResultEvent): event is LsToolResultEvent;
|
|
788
|
+
export function isToolResultEventType<TName extends string, TDetails = unknown>(
|
|
789
|
+
toolName: TName,
|
|
790
|
+
event: ToolResultEvent,
|
|
791
|
+
): event is ToolResultEvent & { toolName: TName; details: TDetails };
|
|
792
|
+
export function isToolResultEventType(toolName: string, event: ToolResultEvent): boolean {
|
|
793
|
+
return event.toolName === toolName;
|
|
785
794
|
}
|
|
786
795
|
|
|
787
796
|
/**
|
|
@@ -1274,43 +1283,9 @@ export interface ExtensionShortcut {
|
|
|
1274
1283
|
|
|
1275
1284
|
type HandlerFn = (...args: unknown[]) => Promise<unknown>;
|
|
1276
1285
|
|
|
1277
|
-
export type SendMessageHandler = <T = unknown>(
|
|
1278
|
-
message: Pick<CustomMessage<T>, "customType" | "content" | "display" | "details">,
|
|
1279
|
-
options?: { triggerTurn?: boolean; deliverAs?: "steer" | "followUp" | "nextTurn" },
|
|
1280
|
-
) => void;
|
|
1281
|
-
|
|
1282
|
-
export type SendUserMessageHandler = (
|
|
1283
|
-
content: string | (TextContent | ImageContent)[],
|
|
1284
|
-
options?: { deliverAs?: "steer" | "followUp" },
|
|
1285
|
-
) => void;
|
|
1286
|
-
|
|
1287
|
-
export type AppendEntryHandler = <T = unknown>(customType: string, data?: T) => void;
|
|
1288
|
-
|
|
1289
|
-
export type SetSessionNameHandler = (name: string) => void;
|
|
1290
|
-
|
|
1291
|
-
export type GetSessionNameHandler = () => string | undefined;
|
|
1292
|
-
|
|
1293
|
-
export type GetActiveToolsHandler = () => string[];
|
|
1294
|
-
|
|
1295
1286
|
/** Tool info with name, description, and parameter schema */
|
|
1296
1287
|
export type ToolInfo = Pick<ToolDefinition, "name" | "description" | "parameters">;
|
|
1297
1288
|
|
|
1298
|
-
export type GetAllToolsHandler = () => ToolInfo[];
|
|
1299
|
-
|
|
1300
|
-
export type GetCommandsHandler = () => SlashCommandInfo[];
|
|
1301
|
-
|
|
1302
|
-
export type SetActiveToolsHandler = (toolNames: string[]) => void;
|
|
1303
|
-
|
|
1304
|
-
export type RefreshToolsHandler = () => void;
|
|
1305
|
-
|
|
1306
|
-
export type SetModelHandler = (model: Model<any>, options?: { persist?: boolean }) => Promise<boolean>;
|
|
1307
|
-
|
|
1308
|
-
export type GetThinkingLevelHandler = () => ThinkingLevel;
|
|
1309
|
-
|
|
1310
|
-
export type SetThinkingLevelHandler = (level: ThinkingLevel) => void;
|
|
1311
|
-
|
|
1312
|
-
export type SetLabelHandler = (entryId: string, label: string | undefined) => void;
|
|
1313
|
-
|
|
1314
1289
|
/**
|
|
1315
1290
|
* Shared state created by loader, used during registration and runtime.
|
|
1316
1291
|
* Contains flag values (defaults set during registration, CLI values set after).
|
|
@@ -1334,21 +1309,27 @@ export interface ExtensionRuntimeState {
|
|
|
1334
1309
|
* Provided to runner.initialize(), copied into the shared runtime.
|
|
1335
1310
|
*/
|
|
1336
1311
|
export interface ExtensionActions {
|
|
1337
|
-
sendMessage:
|
|
1338
|
-
|
|
1312
|
+
sendMessage: <T = unknown>(
|
|
1313
|
+
message: Pick<CustomMessage<T>, "customType" | "content" | "display" | "details">,
|
|
1314
|
+
options?: { triggerTurn?: boolean; deliverAs?: "steer" | "followUp" | "nextTurn" },
|
|
1315
|
+
) => void;
|
|
1316
|
+
sendUserMessage: (
|
|
1317
|
+
content: string | (TextContent | ImageContent)[],
|
|
1318
|
+
options?: { deliverAs?: "steer" | "followUp" },
|
|
1319
|
+
) => void;
|
|
1339
1320
|
retryLastTurn: () => void;
|
|
1340
|
-
appendEntry:
|
|
1341
|
-
setSessionName:
|
|
1342
|
-
getSessionName:
|
|
1343
|
-
setLabel:
|
|
1344
|
-
getActiveTools:
|
|
1345
|
-
getAllTools:
|
|
1346
|
-
setActiveTools:
|
|
1347
|
-
refreshTools:
|
|
1348
|
-
getCommands:
|
|
1349
|
-
setModel:
|
|
1350
|
-
getThinkingLevel:
|
|
1351
|
-
setThinkingLevel:
|
|
1321
|
+
appendEntry: <T = unknown>(customType: string, data?: T) => void;
|
|
1322
|
+
setSessionName: (name: string) => void;
|
|
1323
|
+
getSessionName: () => string | undefined;
|
|
1324
|
+
setLabel: (entryId: string, label: string | undefined) => void;
|
|
1325
|
+
getActiveTools: () => string[];
|
|
1326
|
+
getAllTools: () => ToolInfo[];
|
|
1327
|
+
setActiveTools: (toolNames: string[]) => void;
|
|
1328
|
+
refreshTools: () => void;
|
|
1329
|
+
getCommands: () => SlashCommandInfo[];
|
|
1330
|
+
setModel: (model: Model<any>, options?: { persist?: boolean }) => Promise<boolean>;
|
|
1331
|
+
getThinkingLevel: () => ThinkingLevel;
|
|
1332
|
+
setThinkingLevel: (level: ThinkingLevel) => void;
|
|
1352
1333
|
}
|
|
1353
1334
|
|
|
1354
1335
|
/**
|
|
@@ -50,7 +50,7 @@ export type KeybindingsConfig = {
|
|
|
50
50
|
/**
|
|
51
51
|
* Default application keybindings.
|
|
52
52
|
*/
|
|
53
|
-
|
|
53
|
+
const DEFAULT_APP_KEYBINDINGS: Record<AppAction, KeyId | KeyId[]> = {
|
|
54
54
|
interrupt: "escape",
|
|
55
55
|
clear: "ctrl+c",
|
|
56
56
|
exit: "ctrl+d",
|
|
@@ -75,7 +75,7 @@ export const DEFAULT_APP_KEYBINDINGS: Record<AppAction, KeyId | KeyId[]> = {
|
|
|
75
75
|
/**
|
|
76
76
|
* All default keybindings (app + editor).
|
|
77
77
|
*/
|
|
78
|
-
|
|
78
|
+
const DEFAULT_KEYBINDINGS: Required<KeybindingsConfig> = {
|
|
79
79
|
...DEFAULT_EDITOR_KEYBINDINGS,
|
|
80
80
|
...DEFAULT_APP_KEYBINDINGS,
|
|
81
81
|
};
|