gsd-pi 2.34.0-dev.ed0bfbf → 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/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/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.map +1 -1
- package/packages/pi-agent-core/dist/proxy.js +2 -8
- 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 +2 -8
- 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/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/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/src/providers/azure-openai-responses.ts +11 -45
- 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/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-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/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 -0
- 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 -243
- 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/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/config.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/lsp/config.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/config.js +4 -1
- package/packages/pi-coding-agent/dist/core/lsp/config.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.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/lspmux.js +2 -21
- 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/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/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 -1
- package/packages/pi-coding-agent/dist/core/session-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/session-manager.js +3 -28
- 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 -0
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.js +76 -166
- 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/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/theme/theme.d.ts +65 -0
- 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 -16
- 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/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/package.json +1 -1
- 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/extensions/index.ts +1 -21
- package/packages/pi-coding-agent/src/core/extensions/runner.ts +119 -243
- package/packages/pi-coding-agent/src/core/extensions/types.ts +50 -69
- package/packages/pi-coding-agent/src/core/lock-utils.ts +113 -0
- package/packages/pi-coding-agent/src/core/lsp/config.ts +4 -1
- package/packages/pi-coding-agent/src/core/lsp/index.ts +83 -152
- package/packages/pi-coding-agent/src/core/lsp/lspmux.ts +2 -22
- package/packages/pi-coding-agent/src/core/lsp/types.ts +0 -29
- package/packages/pi-coding-agent/src/core/package-manager.ts +1 -4
- 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 +3 -30
- package/packages/pi-coding-agent/src/core/settings-manager.ts +85 -164
- 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/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/theme/theme.ts +7 -18
- 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/error.ts +6 -0
- 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/src/components/markdown.ts +25 -29
- package/packages/pi-tui/src/keys.ts +94 -173
- package/pkg/dist/modes/interactive/theme/theme.d.ts +65 -0
- package/pkg/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/pkg/dist/modes/interactive/theme/theme.js +6 -16
- 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/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
|
@@ -542,216 +542,136 @@ export class ExtensionRunner {
|
|
|
542
542
|
);
|
|
543
543
|
}
|
|
544
544
|
|
|
545
|
-
|
|
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> {
|
|
546
564
|
const ctx = this.createContext();
|
|
547
|
-
let result: SessionBeforeEventResult | undefined;
|
|
548
565
|
|
|
549
566
|
for (const ext of this.extensions) {
|
|
550
|
-
const handlers = ext.handlers.get(
|
|
567
|
+
const handlers = ext.handlers.get(eventType);
|
|
551
568
|
if (!handlers || handlers.length === 0) continue;
|
|
552
569
|
|
|
553
570
|
for (const handler of handlers) {
|
|
554
571
|
try {
|
|
572
|
+
const event = getEvent();
|
|
555
573
|
const handlerResult = await handler(event, ctx);
|
|
556
|
-
|
|
557
|
-
if (
|
|
558
|
-
result = handlerResult as SessionBeforeEventResult;
|
|
559
|
-
if (result.cancel) {
|
|
560
|
-
return result as RunnerEmitResult<TEvent>;
|
|
561
|
-
}
|
|
562
|
-
}
|
|
574
|
+
const action = processResult(handlerResult, ext.path);
|
|
575
|
+
if (action.done) return;
|
|
563
576
|
} catch (err) {
|
|
564
577
|
const message = err instanceof Error ? err.message : String(err);
|
|
565
578
|
const stack = err instanceof Error ? err.stack : undefined;
|
|
566
579
|
this.emitError({
|
|
567
580
|
extensionPath: ext.path,
|
|
568
|
-
event:
|
|
581
|
+
event: eventType,
|
|
569
582
|
error: message,
|
|
570
583
|
stack,
|
|
571
584
|
});
|
|
572
585
|
}
|
|
573
586
|
}
|
|
574
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
|
+
});
|
|
575
601
|
|
|
576
602
|
return result as RunnerEmitResult<TEvent>;
|
|
577
603
|
}
|
|
578
604
|
|
|
579
605
|
async emitToolResult(event: ToolResultEvent): Promise<ToolResultEventResult | undefined> {
|
|
580
|
-
const ctx = this.createContext();
|
|
581
606
|
const currentEvent: ToolResultEvent = { ...event };
|
|
582
607
|
let modified = false;
|
|
583
608
|
|
|
584
|
-
|
|
585
|
-
const
|
|
586
|
-
if (!
|
|
587
|
-
|
|
588
|
-
for (const handler of handlers) {
|
|
589
|
-
try {
|
|
590
|
-
const handlerResult = (await handler(currentEvent, ctx)) as ToolResultEventResult | undefined;
|
|
591
|
-
if (!handlerResult) continue;
|
|
592
|
-
|
|
593
|
-
if (handlerResult.content !== undefined) {
|
|
594
|
-
currentEvent.content = handlerResult.content;
|
|
595
|
-
modified = true;
|
|
596
|
-
}
|
|
597
|
-
if (handlerResult.details !== undefined) {
|
|
598
|
-
currentEvent.details = handlerResult.details;
|
|
599
|
-
modified = true;
|
|
600
|
-
}
|
|
601
|
-
if (handlerResult.isError !== undefined) {
|
|
602
|
-
currentEvent.isError = handlerResult.isError;
|
|
603
|
-
modified = true;
|
|
604
|
-
}
|
|
605
|
-
} catch (err) {
|
|
606
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
607
|
-
const stack = err instanceof Error ? err.stack : undefined;
|
|
608
|
-
this.emitError({
|
|
609
|
-
extensionPath: ext.path,
|
|
610
|
-
event: "tool_result",
|
|
611
|
-
error: message,
|
|
612
|
-
stack,
|
|
613
|
-
});
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
}
|
|
609
|
+
await this.invokeHandlers("tool_result", () => currentEvent, (handlerResult) => {
|
|
610
|
+
const r = handlerResult as ToolResultEventResult | undefined;
|
|
611
|
+
if (!r) return { done: false };
|
|
617
612
|
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
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
|
+
});
|
|
621
618
|
|
|
622
|
-
return
|
|
623
|
-
|
|
624
|
-
details: currentEvent.details,
|
|
625
|
-
isError: currentEvent.isError,
|
|
626
|
-
};
|
|
619
|
+
if (!modified) return undefined;
|
|
620
|
+
return { content: currentEvent.content, details: currentEvent.details, isError: currentEvent.isError };
|
|
627
621
|
}
|
|
628
622
|
|
|
629
623
|
async emitToolCall(event: ToolCallEvent): Promise<ToolCallEventResult | undefined> {
|
|
630
|
-
const ctx = this.createContext();
|
|
631
624
|
let result: ToolCallEventResult | undefined;
|
|
632
625
|
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
for (const handler of handlers) {
|
|
638
|
-
try {
|
|
639
|
-
const handlerResult = await handler(event, ctx);
|
|
640
|
-
|
|
641
|
-
if (handlerResult) {
|
|
642
|
-
result = handlerResult as ToolCallEventResult;
|
|
643
|
-
if (result.block) {
|
|
644
|
-
return result;
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
} catch (err) {
|
|
648
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
649
|
-
const stack = err instanceof Error ? err.stack : undefined;
|
|
650
|
-
this.emitError({
|
|
651
|
-
extensionPath: ext.path,
|
|
652
|
-
event: "tool_call",
|
|
653
|
-
error: message,
|
|
654
|
-
stack,
|
|
655
|
-
});
|
|
656
|
-
}
|
|
626
|
+
await this.invokeHandlers("tool_call", () => event, (handlerResult) => {
|
|
627
|
+
if (handlerResult) {
|
|
628
|
+
result = handlerResult as ToolCallEventResult;
|
|
629
|
+
if (result.block) return { done: true };
|
|
657
630
|
}
|
|
658
|
-
|
|
631
|
+
return { done: false };
|
|
632
|
+
});
|
|
659
633
|
|
|
660
634
|
return result;
|
|
661
635
|
}
|
|
662
636
|
|
|
663
637
|
async emitUserBash(event: UserBashEvent): Promise<UserBashEventResult | undefined> {
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
for (const ext of this.extensions) {
|
|
667
|
-
const handlers = ext.handlers.get("user_bash");
|
|
668
|
-
if (!handlers || handlers.length === 0) continue;
|
|
638
|
+
let result: UserBashEventResult | undefined;
|
|
669
639
|
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
return handlerResult as UserBashEventResult;
|
|
675
|
-
}
|
|
676
|
-
} catch (err) {
|
|
677
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
678
|
-
const stack = err instanceof Error ? err.stack : undefined;
|
|
679
|
-
this.emitError({
|
|
680
|
-
extensionPath: ext.path,
|
|
681
|
-
event: "user_bash",
|
|
682
|
-
error: message,
|
|
683
|
-
stack,
|
|
684
|
-
});
|
|
685
|
-
}
|
|
640
|
+
await this.invokeHandlers("user_bash", () => event, (handlerResult) => {
|
|
641
|
+
if (handlerResult) {
|
|
642
|
+
result = handlerResult as UserBashEventResult;
|
|
643
|
+
return { done: true };
|
|
686
644
|
}
|
|
687
|
-
|
|
645
|
+
return { done: false };
|
|
646
|
+
});
|
|
688
647
|
|
|
689
|
-
return
|
|
648
|
+
return result;
|
|
690
649
|
}
|
|
691
650
|
|
|
692
651
|
async emitContext(messages: AgentMessage[]): Promise<AgentMessage[]> {
|
|
693
|
-
const ctx = this.createContext();
|
|
694
652
|
let currentMessages = structuredClone(messages);
|
|
695
653
|
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
for (const handler of handlers) {
|
|
701
|
-
try {
|
|
702
|
-
const event: ContextEvent = { type: "context", messages: currentMessages };
|
|
703
|
-
const handlerResult = await handler(event, ctx);
|
|
704
|
-
|
|
705
|
-
if (handlerResult && (handlerResult as ContextEventResult).messages) {
|
|
706
|
-
currentMessages = (handlerResult as ContextEventResult).messages!;
|
|
707
|
-
}
|
|
708
|
-
} catch (err) {
|
|
709
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
710
|
-
const stack = err instanceof Error ? err.stack : undefined;
|
|
711
|
-
this.emitError({
|
|
712
|
-
extensionPath: ext.path,
|
|
713
|
-
event: "context",
|
|
714
|
-
error: message,
|
|
715
|
-
stack,
|
|
716
|
-
});
|
|
717
|
-
}
|
|
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!;
|
|
718
657
|
}
|
|
719
|
-
|
|
658
|
+
return { done: false };
|
|
659
|
+
});
|
|
720
660
|
|
|
721
661
|
return currentMessages;
|
|
722
662
|
}
|
|
723
663
|
|
|
724
664
|
async emitBeforeProviderRequest(payload: unknown, model?: { provider: string; id: string }): Promise<unknown> {
|
|
725
|
-
const ctx = this.createContext();
|
|
726
665
|
let currentPayload = payload;
|
|
727
666
|
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
payload: currentPayload,
|
|
737
|
-
model,
|
|
738
|
-
};
|
|
739
|
-
const handlerResult = await handler(event, ctx);
|
|
740
|
-
if (handlerResult !== undefined) {
|
|
741
|
-
currentPayload = handlerResult;
|
|
742
|
-
}
|
|
743
|
-
} catch (err) {
|
|
744
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
745
|
-
const stack = err instanceof Error ? err.stack : undefined;
|
|
746
|
-
this.emitError({
|
|
747
|
-
extensionPath: ext.path,
|
|
748
|
-
event: "before_provider_request",
|
|
749
|
-
error: message,
|
|
750
|
-
stack,
|
|
751
|
-
});
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
|
-
}
|
|
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
|
+
});
|
|
755
675
|
|
|
756
676
|
return currentPayload;
|
|
757
677
|
}
|
|
@@ -761,47 +681,26 @@ export class ExtensionRunner {
|
|
|
761
681
|
images: ImageContent[] | undefined,
|
|
762
682
|
systemPrompt: string,
|
|
763
683
|
): Promise<BeforeAgentStartCombinedResult | undefined> {
|
|
764
|
-
const ctx = this.createContext();
|
|
765
684
|
const messages: NonNullable<BeforeAgentStartEventResult["message"]>[] = [];
|
|
766
685
|
let currentSystemPrompt = systemPrompt;
|
|
767
686
|
let systemPromptModified = false;
|
|
768
687
|
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
const handlerResult = await handler(event, ctx);
|
|
782
|
-
|
|
783
|
-
if (handlerResult) {
|
|
784
|
-
const result = handlerResult as BeforeAgentStartEventResult;
|
|
785
|
-
if (result.message) {
|
|
786
|
-
messages.push(result.message);
|
|
787
|
-
}
|
|
788
|
-
if (result.systemPrompt !== undefined) {
|
|
789
|
-
currentSystemPrompt = result.systemPrompt;
|
|
790
|
-
systemPromptModified = true;
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
} catch (err) {
|
|
794
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
795
|
-
const stack = err instanceof Error ? err.stack : undefined;
|
|
796
|
-
this.emitError({
|
|
797
|
-
extensionPath: ext.path,
|
|
798
|
-
event: "before_agent_start",
|
|
799
|
-
error: message,
|
|
800
|
-
stack,
|
|
801
|
-
});
|
|
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;
|
|
802
700
|
}
|
|
803
701
|
}
|
|
804
|
-
|
|
702
|
+
return { done: false };
|
|
703
|
+
});
|
|
805
704
|
|
|
806
705
|
if (messages.length > 0 || systemPromptModified) {
|
|
807
706
|
return {
|
|
@@ -809,7 +708,6 @@ export class ExtensionRunner {
|
|
|
809
708
|
systemPrompt: systemPromptModified ? currentSystemPrompt : undefined,
|
|
810
709
|
};
|
|
811
710
|
}
|
|
812
|
-
|
|
813
711
|
return undefined;
|
|
814
712
|
}
|
|
815
713
|
|
|
@@ -821,72 +719,50 @@ export class ExtensionRunner {
|
|
|
821
719
|
promptPaths: Array<{ path: string; extensionPath: string }>;
|
|
822
720
|
themePaths: Array<{ path: string; extensionPath: string }>;
|
|
823
721
|
}> {
|
|
824
|
-
const ctx = this.createContext();
|
|
825
722
|
const skillPaths: Array<{ path: string; extensionPath: string }> = [];
|
|
826
723
|
const promptPaths: Array<{ path: string; extensionPath: string }> = [];
|
|
827
724
|
const themePaths: Array<{ path: string; extensionPath: string }> = [];
|
|
828
725
|
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
skillPaths.push(...result.skillPaths.map((path) => ({ path, extensionPath: ext.path })));
|
|
841
|
-
}
|
|
842
|
-
if (result?.promptPaths?.length) {
|
|
843
|
-
promptPaths.push(...result.promptPaths.map((path) => ({ path, extensionPath: ext.path })));
|
|
844
|
-
}
|
|
845
|
-
if (result?.themePaths?.length) {
|
|
846
|
-
themePaths.push(...result.themePaths.map((path) => ({ path, extensionPath: ext.path })));
|
|
847
|
-
}
|
|
848
|
-
} catch (err) {
|
|
849
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
850
|
-
const stack = err instanceof Error ? err.stack : undefined;
|
|
851
|
-
this.emitError({
|
|
852
|
-
extensionPath: ext.path,
|
|
853
|
-
event: "resources_discover",
|
|
854
|
-
error: message,
|
|
855
|
-
stack,
|
|
856
|
-
});
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
}
|
|
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
|
+
});
|
|
860
737
|
|
|
861
738
|
return { skillPaths, promptPaths, themePaths };
|
|
862
739
|
}
|
|
863
740
|
|
|
864
741
|
/** Emit input event. Transforms chain, "handled" short-circuits. */
|
|
865
742
|
async emitInput(text: string, images: ImageContent[] | undefined, source: InputSource): Promise<InputEventResult> {
|
|
866
|
-
const ctx = this.createContext();
|
|
867
743
|
let currentText = text;
|
|
868
744
|
let currentImages = images;
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
this.emitError({
|
|
882
|
-
extensionPath: ext.path,
|
|
883
|
-
event: "input",
|
|
884
|
-
error: err instanceof Error ? err.message : String(err),
|
|
885
|
-
stack: err instanceof Error ? err.stack : undefined,
|
|
886
|
-
});
|
|
887
|
-
}
|
|
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 };
|
|
888
757
|
}
|
|
889
|
-
|
|
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;
|
|
890
766
|
return currentText !== text || currentImages !== images
|
|
891
767
|
? { action: "transform", text: currentText, images: currentImages }
|
|
892
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
|
/**
|