@code-yeongyu/senpi 2026.7.17-5 → 2026.7.20-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -0
- package/README.md +5 -2
- package/dist/cli/neo/build-argv.d.ts.map +1 -1
- package/dist/cli/neo/build-argv.js +2 -0
- package/dist/cli/neo/build-argv.js.map +1 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +11 -4
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +37 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +395 -73
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +2 -2
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +59 -15
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/index.js +68 -10
- package/dist/core/extensions/builtin/compaction/index.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/speculative.d.ts +7 -1
- package/dist/core/extensions/builtin/compaction/speculative.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/speculative.js +29 -11
- package/dist/core/extensions/builtin/compaction/speculative.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/todo-bridge.d.ts +9 -7
- package/dist/core/extensions/builtin/compaction/todo-bridge.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/todo-bridge.js +34 -9
- package/dist/core/extensions/builtin/compaction/todo-bridge.js.map +1 -1
- package/dist/core/extensions/builtin/goal/command-registration.d.ts +2 -2
- package/dist/core/extensions/builtin/goal/command-registration.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/command-registration.js +3 -4
- package/dist/core/extensions/builtin/goal/command-registration.js.map +1 -1
- package/dist/core/extensions/builtin/goal/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/index.js +11 -27
- package/dist/core/extensions/builtin/goal/index.js.map +1 -1
- package/dist/core/extensions/builtin/goal/tool-registration.d.ts +2 -2
- package/dist/core/extensions/builtin/goal/tool-registration.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/tool-registration.js +2 -3
- package/dist/core/extensions/builtin/goal/tool-registration.js.map +1 -1
- package/dist/core/extensions/builtin/goal/turn-usage.d.ts +20 -0
- package/dist/core/extensions/builtin/goal/turn-usage.d.ts.map +1 -0
- package/dist/core/extensions/builtin/goal/turn-usage.js +61 -0
- package/dist/core/extensions/builtin/goal/turn-usage.js.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/constants.d.ts +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/constants.d.ts.map +1 -1
- package/dist/core/extensions/builtin/gpt-apply-patch/constants.js +5 -1
- package/dist/core/extensions/builtin/gpt-apply-patch/constants.js.map +1 -1
- package/dist/core/extensions/builtin/gpt-apply-patch/extension.d.ts +2 -1
- package/dist/core/extensions/builtin/gpt-apply-patch/extension.d.ts.map +1 -1
- package/dist/core/extensions/builtin/gpt-apply-patch/extension.js +48 -29
- package/dist/core/extensions/builtin/gpt-apply-patch/extension.js.map +1 -1
- package/dist/core/extensions/builtin/gpt-apply-patch/index.d.ts +2 -2
- package/dist/core/extensions/builtin/gpt-apply-patch/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/gpt-apply-patch/index.js +2 -2
- package/dist/core/extensions/builtin/gpt-apply-patch/index.js.map +1 -1
- package/dist/core/extensions/builtin/gpt-apply-patch/tool.d.ts +1 -1
- package/dist/core/extensions/builtin/gpt-apply-patch/tool.d.ts.map +1 -1
- package/dist/core/extensions/builtin/gpt-apply-patch/tool.js +5 -3
- package/dist/core/extensions/builtin/gpt-apply-patch/tool.js.map +1 -1
- package/dist/core/extensions/builtin/gpt-apply-patch/types.d.ts +7 -6
- package/dist/core/extensions/builtin/gpt-apply-patch/types.d.ts.map +1 -1
- package/dist/core/extensions/builtin/gpt-apply-patch/types.js.map +1 -1
- package/dist/core/extensions/builtin/hooks/matcher.d.ts.map +1 -1
- package/dist/core/extensions/builtin/hooks/matcher.js +1 -0
- package/dist/core/extensions/builtin/hooks/matcher.js.map +1 -1
- package/dist/core/extensions/builtin/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/index.js +4 -0
- package/dist/core/extensions/builtin/index.js.map +1 -1
- package/dist/core/extensions/builtin/model-fallback/index.d.ts +4 -0
- package/dist/core/extensions/builtin/model-fallback/index.d.ts.map +1 -0
- package/dist/core/extensions/builtin/model-fallback/index.js +55 -0
- package/dist/core/extensions/builtin/model-fallback/index.js.map +1 -0
- package/dist/core/extensions/builtin/model-fallback/settings.d.ts +6 -0
- package/dist/core/extensions/builtin/model-fallback/settings.d.ts.map +1 -0
- package/dist/core/extensions/builtin/model-fallback/settings.js +11 -0
- package/dist/core/extensions/builtin/model-fallback/settings.js.map +1 -0
- package/dist/core/extensions/builtin/model-fallback/ui.d.ts +12 -0
- package/dist/core/extensions/builtin/model-fallback/ui.d.ts.map +1 -0
- package/dist/core/extensions/builtin/model-fallback/ui.js +72 -0
- package/dist/core/extensions/builtin/model-fallback/ui.js.map +1 -0
- package/dist/core/extensions/builtin/nested-agents-md/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/nested-agents-md/index.js +4 -1
- package/dist/core/extensions/builtin/nested-agents-md/index.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/glm-5-2.js +1 -1
- package/dist/core/extensions/builtin/prompt-preset/glm-5-2.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.5.js +2 -2
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.5.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js +2 -2
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/grok-4.5.d.ts +3 -0
- package/dist/core/extensions/builtin/prompt-preset/grok-4.5.d.ts.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/grok-4.5.js +80 -0
- package/dist/core/extensions/builtin/prompt-preset/grok-4.5.js.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/presets.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/presets.js +14 -0
- package/dist/core/extensions/builtin/prompt-preset/presets.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/settings.d.ts +1 -1
- package/dist/core/extensions/builtin/prompt-preset/settings.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/settings.js +1 -0
- package/dist/core/extensions/builtin/prompt-preset/settings.js.map +1 -1
- package/dist/core/extensions/builtin/rules/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/rules/index.js +4 -1
- package/dist/core/extensions/builtin/rules/index.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/shared.d.ts +7 -0
- package/dist/core/extensions/builtin/terminal/shared.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/shared.js +7 -0
- package/dist/core/extensions/builtin/terminal/shared.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/bash.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/bash.js +68 -6
- package/dist/core/extensions/builtin/terminal/tools/bash.js.map +1 -1
- package/dist/core/extensions/builtin/todotools/commands.d.ts +18 -0
- package/dist/core/extensions/builtin/todotools/commands.d.ts.map +1 -0
- package/dist/core/extensions/builtin/todotools/commands.js +395 -0
- package/dist/core/extensions/builtin/todotools/commands.js.map +1 -0
- package/dist/core/extensions/builtin/todotools/index.d.ts +4 -1
- package/dist/core/extensions/builtin/todotools/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/todotools/index.js +17 -14
- package/dist/core/extensions/builtin/todotools/index.js.map +1 -1
- package/dist/core/extensions/builtin/todotools/markdown.d.ts +13 -0
- package/dist/core/extensions/builtin/todotools/markdown.d.ts.map +1 -0
- package/dist/core/extensions/builtin/todotools/markdown.js +82 -0
- package/dist/core/extensions/builtin/todotools/markdown.js.map +1 -0
- package/dist/core/extensions/builtin/todotools/prompt.d.ts +2 -1
- package/dist/core/extensions/builtin/todotools/prompt.d.ts.map +1 -1
- package/dist/core/extensions/builtin/todotools/prompt.js +50 -153
- package/dist/core/extensions/builtin/todotools/prompt.js.map +1 -1
- package/dist/core/extensions/builtin/todotools/state.d.ts +67 -14
- package/dist/core/extensions/builtin/todotools/state.d.ts.map +1 -1
- package/dist/core/extensions/builtin/todotools/state.js +400 -35
- package/dist/core/extensions/builtin/todotools/state.js.map +1 -1
- package/dist/core/extensions/builtin/todotools/tools/todo.d.ts +22 -0
- package/dist/core/extensions/builtin/todotools/tools/todo.d.ts.map +1 -0
- package/dist/core/extensions/builtin/todotools/tools/todo.js +229 -0
- package/dist/core/extensions/builtin/todotools/tools/todo.js.map +1 -0
- package/dist/core/extensions/builtin/video-in/index.d.ts +3 -0
- package/dist/core/extensions/builtin/video-in/index.d.ts.map +1 -0
- package/dist/core/extensions/builtin/video-in/index.js +111 -0
- package/dist/core/extensions/builtin/video-in/index.js.map +1 -0
- package/dist/core/extensions/builtin/websearch/websearch/renderers.d.ts.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/renderers.js +13 -4
- package/dist/core/extensions/builtin/websearch/websearch/renderers.js.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/search.d.ts +3 -2
- package/dist/core/extensions/builtin/websearch/websearch/search.d.ts.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/search.js +2 -1
- package/dist/core/extensions/builtin/websearch/websearch/search.js.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/tool.d.ts.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/tool.js +17 -1
- package/dist/core/extensions/builtin/websearch/websearch/tool.js.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/types.d.ts +2 -0
- package/dist/core/extensions/builtin/websearch/websearch/types.d.ts.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/types.js.map +1 -1
- package/dist/core/extensions/loader.d.ts +10 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +44 -3
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +3 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +60 -8
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +103 -18
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/model-registry.d.ts +5 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +17 -2
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-runtime.d.ts +12 -1
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +51 -9
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/prompt-templates.d.ts +1 -0
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +4 -4
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/provider-composer.d.ts +1 -1
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +16 -3
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/resource-loader.d.ts +6 -0
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +27 -2
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/retry-fallback/chains.d.ts +29 -0
- package/dist/core/retry-fallback/chains.d.ts.map +1 -0
- package/dist/core/retry-fallback/chains.js +109 -0
- package/dist/core/retry-fallback/chains.js.map +1 -0
- package/dist/core/retry-fallback/controller.d.ts +77 -0
- package/dist/core/retry-fallback/controller.d.ts.map +1 -0
- package/dist/core/retry-fallback/controller.js +157 -0
- package/dist/core/retry-fallback/controller.js.map +1 -0
- package/dist/core/retry-fallback/cooldown.d.ts +21 -0
- package/dist/core/retry-fallback/cooldown.d.ts.map +1 -0
- package/dist/core/retry-fallback/cooldown.js +49 -0
- package/dist/core/retry-fallback/cooldown.js.map +1 -0
- package/dist/core/retry-fallback/log.d.ts +10 -0
- package/dist/core/retry-fallback/log.d.ts.map +1 -0
- package/dist/core/retry-fallback/log.js +128 -0
- package/dist/core/retry-fallback/log.js.map +1 -0
- package/dist/core/retry-fallback/validate.d.ts +8 -0
- package/dist/core/retry-fallback/validate.d.ts.map +1 -0
- package/dist/core/retry-fallback/validate.js +63 -0
- package/dist/core/retry-fallback/validate.js.map +1 -0
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +1 -0
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts +6 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +19 -3
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +21 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +100 -1
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +20 -5
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/read.js +1 -1
- package/dist/core/tools/read.js.map +1 -1
- package/dist/extensions/index.d.ts +3 -0
- package/dist/extensions/index.d.ts.map +1 -0
- package/dist/extensions/index.js +3 -0
- package/dist/extensions/index.js.map +1 -0
- package/dist/extensions/llama/client.d.ts +61 -0
- package/dist/extensions/llama/client.d.ts.map +1 -0
- package/dist/extensions/llama/client.js +298 -0
- package/dist/extensions/llama/client.js.map +1 -0
- package/dist/extensions/llama/huggingface.d.ts +23 -0
- package/dist/extensions/llama/huggingface.d.ts.map +1 -0
- package/dist/extensions/llama/huggingface.js +139 -0
- package/dist/extensions/llama/huggingface.js.map +1 -0
- package/dist/extensions/llama/index.d.ts +3 -0
- package/dist/extensions/llama/index.d.ts.map +1 -0
- package/dist/extensions/llama/index.js +208 -0
- package/dist/extensions/llama/index.js.map +1 -0
- package/dist/extensions/llama/provider.d.ts +10 -0
- package/dist/extensions/llama/provider.d.ts.map +1 -0
- package/dist/extensions/llama/provider.js +106 -0
- package/dist/extensions/llama/provider.js.map +1 -0
- package/dist/extensions/llama/ui.d.ts +42 -0
- package/dist/extensions/llama/ui.d.ts.map +1 -0
- package/dist/extensions/llama/ui.js +400 -0
- package/dist/extensions/llama/ui.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +6 -4
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +6 -7
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +154 -114
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +2 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +25 -4
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +4 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +20 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +7 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +165 -13
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/streaming-reveal.d.ts +35 -0
- package/dist/modes/interactive/streaming-reveal.d.ts.map +1 -0
- package/dist/modes/interactive/streaming-reveal.js +268 -0
- package/dist/modes/interactive/streaming-reveal.js.map +1 -0
- package/dist/modes/interactive/tool-args-reveal.d.ts +20 -0
- package/dist/modes/interactive/tool-args-reveal.d.ts.map +1 -0
- package/dist/modes/interactive/tool-args-reveal.js +153 -0
- package/dist/modes/interactive/tool-args-reveal.js.map +1 -0
- package/dist/utils/child-process.d.ts +17 -1
- package/dist/utils/child-process.d.ts.map +1 -1
- package/dist/utils/child-process.js +41 -1
- package/dist/utils/child-process.js.map +1 -1
- package/docs/custom-provider.md +28 -0
- package/docs/extensions.md +65 -5
- package/docs/index.md +1 -0
- package/docs/llama-cpp.md +99 -0
- package/docs/neo.md +2 -1
- package/docs/prompt-templates.md +1 -0
- package/docs/providers.md +7 -0
- package/docs/settings.md +35 -0
- package/docs/tui.md +41 -26
- package/docs/usage.md +1 -0
- package/examples/extensions/README.md +1 -1
- package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +26 -0
- package/node_modules/@code-yeongyu/senpi-codemode/package.json +3 -3
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/py/prelude.py +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +76 -8
- package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/agent.js +26 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/agent.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js +24 -2
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +5 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
- package/node_modules/@earendil-works/pi-ai/README.md +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +92 -29
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/transform-messages.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/transform-messages.js +105 -61
- package/node_modules/@earendil-works/pi-ai/dist/api/transform-messages.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts +15 -0
- package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js +15 -0
- package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/index.d.ts +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/index.js +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +4263 -22324
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.models.d.ts +436 -1988
- package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.models.js +2 -1892
- package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/ant-ling.models.d.ts +10 -80
- package/node_modules/@earendil-works/pi-ai/dist/providers/ant-ling.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/ant-ling.models.js +2 -57
- package/node_modules/@earendil-works/pi-ai/dist/providers/ant-ling.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.models.d.ts +43 -267
- package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.models.js +2 -252
- package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.d.ts +184 -883
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.js +2 -811
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/cerebras.models.d.ts +10 -60
- package/node_modules/@earendil-works/pi-ai/dist/providers/cerebras.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/cerebras.models.js +2 -56
- package/node_modules/@earendil-works/pi-ai/dist/providers/cerebras.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.models.d.ts +168 -884
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.models.js +2 -755
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.models.d.ts +40 -286
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.models.js +2 -236
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/ant-ling.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/anthropic.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/azure-openai-responses.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/cerebras.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-workers-ai.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/deepseek.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/google-vertex.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/google.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/groq.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/kimi-coding.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/minimax-cn.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/minimax.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/mistral.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/moonshotai-cn.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/moonshotai.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai-codex.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/together.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/xai.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-ams.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-cn.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-sgp.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/zai-coding-cn.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/zai.json +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/deepseek.models.d.ts +7 -58
- package/node_modules/@earendil-works/pi-ai/dist/providers/deepseek.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/deepseek.models.js +2 -40
- package/node_modules/@earendil-works/pi-ai/dist/providers/deepseek.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/fireworks.models.d.ts +49 -362
- package/node_modules/@earendil-works/pi-ai/dist/providers/fireworks.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/fireworks.models.js +2 -292
- package/node_modules/@earendil-works/pi-ai/dist/providers/fireworks.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.models.d.ts +85 -760
- package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.models.js +2 -538
- package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.models.d.ts +31 -189
- package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.models.js +2 -179
- package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/google.models.d.ts +49 -309
- package/node_modules/@earendil-works/pi-ai/dist/providers/google.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/google.models.js +2 -285
- package/node_modules/@earendil-works/pi-ai/dist/providers/google.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/groq.models.d.ts +22 -118
- package/node_modules/@earendil-works/pi-ai/dist/providers/groq.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/groq.models.js +2 -122
- package/node_modules/@earendil-works/pi-ai/dist/providers/groq.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/huggingface.models.d.ts +196 -979
- package/node_modules/@earendil-works/pi-ai/dist/providers/huggingface.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/huggingface.models.js +2 -884
- package/node_modules/@earendil-works/pi-ai/dist/providers/huggingface.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.models.d.ts +13 -122
- package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.models.js +2 -98
- package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/minimax-cn.models.d.ts +10 -48
- package/node_modules/@earendil-works/pi-ai/dist/providers/minimax-cn.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/minimax-cn.models.js +2 -53
- package/node_modules/@earendil-works/pi-ai/dist/providers/minimax-cn.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/minimax.models.d.ts +10 -48
- package/node_modules/@earendil-works/pi-ai/dist/providers/minimax.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/minimax.models.js +2 -53
- package/node_modules/@earendil-works/pi-ai/dist/providers/minimax.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.models.d.ts +91 -480
- package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.models.js +2 -512
- package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.models.d.ts +31 -257
- package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.models.js +2 -185
- package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.models.d.ts +31 -257
- package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.models.js +2 -185
- package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/nvidia.models.d.ts +58 -541
- package/node_modules/@earendil-works/pi-ai/dist/providers/nvidia.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/nvidia.models.js +2 -382
- package/node_modules/@earendil-works/pi-ai/dist/providers/nvidia.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.models.d.ts +22 -196
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.models.js +2 -139
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai.models.d.ts +184 -954
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai.models.js +2 -825
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.d.ts +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.js +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.models.d.ts +46 -335
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.models.js +2 -273
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.models.d.ts +163 -1185
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.models.js +2 -996
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.d.ts +1076 -5729
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.js +2 -4892
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/together.models.d.ts +49 -610
- package/node_modules/@earendil-works/pi-ai/dist/providers/together.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/together.models.js +2 -396
- package/node_modules/@earendil-works/pi-ai/dist/providers/together.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.models.d.ts +752 -3336
- package/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.models.js +2 -3263
- package/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/xai.models.d.ts +10 -65
- package/node_modules/@earendil-works/pi-ai/dist/providers/xai.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/xai.models.js +2 -57
- package/node_modules/@earendil-works/pi-ai/dist/providers/xai.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-ams.models.d.ts +10 -63
- package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-ams.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-ams.models.js +2 -56
- package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-ams.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-cn.models.d.ts +10 -63
- package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-cn.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-cn.models.js +2 -56
- package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-cn.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-sgp.models.d.ts +10 -63
- package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-sgp.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-sgp.models.js +2 -56
- package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-sgp.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi.models.d.ts +19 -126
- package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi.models.js +2 -110
- package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/zai-coding-cn.models.d.ts +19 -144
- package/node_modules/@earendil-works/pi-ai/dist/providers/zai-coding-cn.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/zai-coding-cn.models.js +2 -111
- package/node_modules/@earendil-works/pi-ai/dist/providers/zai-coding-cn.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/zai.models.d.ts +19 -144
- package/node_modules/@earendil-works/pi-ai/dist/providers/zai.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/zai.models.js +2 -111
- package/node_modules/@earendil-works/pi-ai/dist/providers/zai.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/context-transformer.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/context-transformer.js +9 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/context-transformer.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/index.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/coerce-parameters.d.ts +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/coerce-parameters.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/coerce-parameters.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/coerce-parameters.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/format.d.ts +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/format.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/format.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/format.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/invoke-protocol.d.ts +19 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/invoke-protocol.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/invoke-protocol.js +8 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/invoke-protocol.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/parse.d.ts +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/parse.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/parse.js +7 -4
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/parse.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/stream.d.ts +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/stream.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/stream.js +22 -18
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/anthropic-xml/stream.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/antml/coerce-parameters.d.ts +15 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/antml/coerce-parameters.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/antml/coerce-parameters.js +198 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/antml/coerce-parameters.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/antml/config.d.ts +3 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/antml/config.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/antml/config.js +8 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/antml/config.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/antml/format.d.ts +6 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/antml/format.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/antml/format.js +33 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/antml/format.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/antml/index.d.ts +6 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/antml/index.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/antml/index.js +6 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/antml/index.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/antml/parse.d.ts +4 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/antml/parse.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/antml/parse.js +6 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/antml/parse.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/antml/repair.d.ts +12 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/antml/repair.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/antml/repair.js +46 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/antml/repair.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/antml/stream.d.ts +4 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/antml/stream.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/antml/stream.js +6 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/protocols/antml/stream.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/types.d.ts +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +19 -2
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.js +4 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js +6 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/stop-details.d.ts +4 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/stop-details.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/stop-details.js +6 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/stop-details.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/package.json +2 -2
- package/node_modules/@earendil-works/pi-pty/dist/registry-session.d.ts +1 -1
- package/node_modules/@earendil-works/pi-pty/dist/registry-session.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-pty/dist/registry-session.js +25 -6
- package/node_modules/@earendil-works/pi-pty/dist/registry-session.js.map +1 -1
- package/node_modules/@earendil-works/pi-pty/dist/registry-types.d.ts +6 -0
- package/node_modules/@earendil-works/pi-pty/dist/registry-types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-pty/dist/registry-types.js.map +1 -1
- package/node_modules/@earendil-works/pi-pty/dist/registry.d.ts +1 -0
- package/node_modules/@earendil-works/pi-pty/dist/registry.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-pty/dist/registry.js +9 -1
- package/node_modules/@earendil-works/pi-pty/dist/registry.js.map +1 -1
- package/node_modules/@earendil-works/pi-pty/package.json +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.d.ts +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.js +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts +6 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui.js +14 -2
- package/node_modules/@earendil-works/pi-tui/dist/tui.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/utils.js +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/utils.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/package.json +6 -6
- package/dist/core/extensions/builtin/todotools/tools/todoread.d.ts +0 -4
- package/dist/core/extensions/builtin/todotools/tools/todoread.d.ts.map +0 -1
- package/dist/core/extensions/builtin/todotools/tools/todoread.js +0 -37
- package/dist/core/extensions/builtin/todotools/tools/todoread.js.map +0 -1
- package/dist/core/extensions/builtin/todotools/tools/todowrite.d.ts +0 -10
- package/dist/core/extensions/builtin/todotools/tools/todowrite.d.ts.map +0 -1
- package/dist/core/extensions/builtin/todotools/tools/todowrite.js +0 -95
- package/dist/core/extensions/builtin/todotools/tools/todowrite.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/gpt-apply-patch/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC,MAAM,CAAC;IAC7C,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC;QAClB,WAAW,EAAE,gDAAgD;KAC7D,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gCAAgC,GAC5C,sGAAsG,CAAC;AACxG,MAAM,CAAC,MAAM,wBAAwB,GAAG;;;;;;;;;;;;;;;;;;;CAmBvC,CAAC;AACF,MAAM,CAAC,MAAM,6BAA6B,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/gpt-apply-patch/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC,MAAM,CAAC;IAC7C,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC;QAClB,WAAW,EAAE,gDAAgD;KAC7D,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gCAAgC,GAC5C,sGAAsG,CAAC;AACxG,MAAM,CAAC,MAAM,wBAAwB,GAAG;;;;;;;;;;;;;;;;;;;CAmBvC,CAAC;AACF,MAAM,kCAAkC,GACvC,g5FAAg5F,CAAC;AAEl5F,MAAM,CAAC,MAAM,6BAA6B,GAAG,kCAAkC,CAAC;AAEhF,2FAA2F;AAC3F,6FAA6F;AAC7F,MAAM,CAAC,MAAM,4BAA4B,GAAG,6GAA6G,kCAAkC,EAAE,CAAC","sourcesContent":["import { Type } from \"typebox\";\n\nexport const APPLY_PATCH_PARAMS = Type.Object({\n\tinput: Type.String({\n\t\tdescription: \"The entire contents of the apply_patch command\",\n\t}),\n});\n\nexport const APPLY_PATCH_FREEFORM_DESCRIPTION =\n\t\"Use the `apply_patch` tool to edit files. This is a FREEFORM tool, so do not wrap the patch in JSON.\";\nexport const APPLY_PATCH_LARK_GRAMMAR = `start: begin_patch hunk+ end_patch\nbegin_patch: \"*** Begin Patch\" LF\nend_patch: \"*** End Patch\" LF?\n\nhunk: add_hunk | delete_hunk | update_hunk\nadd_hunk: \"*** Add File: \" filename LF add_line+\ndelete_hunk: \"*** Delete File: \" filename LF\nupdate_hunk: \"*** Update File: \" filename LF change_move? change?\n\nfilename: /(.+)/\nadd_line: \"+\" /(.*)/ LF -> line\n\nchange_move: \"*** Move to: \" filename LF\nchange: (change_context | change_line)+ eof_line?\nchange_context: (\"@@\" | \"@@ \" /(.+)/) LF\nchange_line: (\"+\" | \"-\" | \" \") /(.*)/ LF\neof_line: \"*** End of File\" LF\n\n%import common.LF\n`;\nconst CODEX_APPLY_PATCH_DESCRIPTION_BODY =\n\t'Use the `apply_patch` tool to edit files.\\nYour patch language is a stripped‑down, file‑oriented diff format designed to be easy to parse and safe to apply. You can think of it as a high‑level envelope:\\n\\n*** Begin Patch\\n[ one or more file sections ]\\n*** End Patch\\n\\nWithin that envelope, you get a sequence of file operations.\\nYou MUST include a header to specify the action you are taking.\\nEach operation starts with one of three headers:\\n\\n*** Add File: <path> - create a new file. Every following line is a + line (the initial contents).\\n*** Delete File: <path> - remove an existing file. Nothing follows.\\n*** Update File: <path> - patch an existing file in place (optionally with a rename).\\n\\nMay be immediately followed by *** Move to: <new path> if you want to rename the file.\\nThen one or more “hunks”, each introduced by @@ (optionally followed by a hunk header).\\nWithin a hunk each line starts with:\\n\\nFor instructions on [context_before] and [context_after]:\\n- By default, show 3 lines of code immediately above and 3 lines immediately below each change. If a change is within 3 lines of a previous change, do NOT duplicate the first change’s [context_after] lines in the second change’s [context_before] lines.\\n- If 3 lines of context is insufficient to uniquely identify the snippet of code within the file, use the @@ operator to indicate the class or function to which the snippet belongs. For instance, we might have:\\n@@ class BaseClass\\n[3 lines of pre-context]\\n- [old_code]\\n+ [new_code]\\n[3 lines of post-context]\\n\\n- If a code block is repeated so many times in a class or function such that even a single `@@` statement and 3 lines of context cannot uniquely identify the snippet of code, you can use multiple `@@` statements to jump to the right context. For instance:\\n\\n@@ class BaseClass\\n@@ \\t def method():\\n[3 lines of pre-context]\\n- [old_code]\\n+ [new_code]\\n[3 lines of post-context]\\n\\nThe full grammar definition is below:\\nPatch := Begin { FileOp } End\\nBegin := \"*** Begin Patch\" NEWLINE\\nEnd := \"*** End Patch\" NEWLINE\\nFileOp := AddFile | DeleteFile | UpdateFile\\nAddFile := \"*** Add File: \" path NEWLINE { \"+\" line NEWLINE }\\nDeleteFile := \"*** Delete File: \" path NEWLINE\\nUpdateFile := \"*** Update File: \" path NEWLINE [ MoveTo ] { Hunk }\\nMoveTo := \"*** Move to: \" newPath NEWLINE\\nHunk := \"@@\" [ header ] NEWLINE { HunkLine } [ \"*** End of File\" NEWLINE ]\\nHunkLine := (\" \" | \"-\" | \"+\") text NEWLINE\\n\\nA full patch can combine several operations:\\n\\n*** Begin Patch\\n*** Add File: hello.txt\\n+Hello world\\n*** Update File: src/app.py\\n*** Move to: src/main.py\\n@@ def greet():\\n-print(\"Hi\")\\n+print(\"Hello, world!\")\\n*** Delete File: obsolete.txt\\n*** End Patch\\n\\nIt is important to remember:\\n\\n- You must include a header with your intended action (Add/Delete/Update)\\n- You must prefix new lines with `+` even when creating a new file\\n- File references can only be relative, NEVER ABSOLUTE.\\n';\n\nexport const CODEX_APPLY_PATCH_DESCRIPTION = CODEX_APPLY_PATCH_DESCRIPTION_BODY;\n\n// JSON-function variant of the tool description for Chat Completions targets, derived from\n// CODEX_APPLY_PATCH_DESCRIPTION (which carries no freeform / \"do not wrap in JSON\" wording).\nexport const APPLY_PATCH_JSON_DESCRIPTION = `Use the \\`apply_patch\\` tool to edit files by passing the entire patch as the \\`input\\` string argument.\\n${CODEX_APPLY_PATCH_DESCRIPTION_BODY}`;\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Model } from "@earendil-works/pi-ai";
|
|
2
|
-
import type { ApplyPatchExtensionAPI } from "./types.ts";
|
|
2
|
+
import type { ApplyPatchExtensionAPI, ApplyPatchWireMode } from "./types.ts";
|
|
3
|
+
export declare function getApplyPatchWireMode(model: Pick<Model<string>, "api" | "id"> | undefined): ApplyPatchWireMode;
|
|
3
4
|
export declare function isOpenAIGptModel(model: Pick<Model<string>, "api" | "id"> | undefined): boolean;
|
|
4
5
|
export declare function registerApplyPatchExtension(pi: ApplyPatchExtensionAPI): void;
|
|
5
6
|
export default registerApplyPatchExtension;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/gpt-apply-patch/extension.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/gpt-apply-patch/extension.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EACX,sBAAsB,EAGtB,kBAAkB,EAClB,MAAM,YAAY,CAAC;AAepB,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,GAAG,SAAS,GAAG,kBAAkB,CAK9G;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,GAAG,SAAS,GAAG,OAAO,CAE9F;AAkDD,wBAAgB,2BAA2B,CAAC,EAAE,EAAE,sBAAsB,GAAG,IAAI,CAc5E;eAEc,2BAA2B"}
|
|
@@ -1,61 +1,80 @@
|
|
|
1
1
|
import { createApplyPatchTool } from "./tool.js";
|
|
2
|
-
// apply_patch ships as a freeform custom tool, which only the OpenAI Responses-family
|
|
3
|
-
// APIs can carry (openai-completions throws on freeform tools). Gate on the model's API
|
|
4
|
-
// rather than a provider allowlist so OpenAI-compatible custom providers (e.g. a proxy
|
|
5
|
-
// exposing gpt-5.5 via openai-responses) also swap edit/write for apply_patch.
|
|
6
2
|
const APPLY_PATCH_FREEFORM_APIS = new Set([
|
|
7
3
|
"openai-responses",
|
|
8
4
|
"azure-openai-responses",
|
|
9
5
|
"openai-codex-responses",
|
|
10
6
|
]);
|
|
7
|
+
const APPLY_PATCH_JSON_APIS = new Set(["openai-completions"]);
|
|
11
8
|
const EDIT_TOOL_NAMES = new Set(["write", "edit"]);
|
|
9
|
+
const APPLY_PATCH_NAME = "apply_patch";
|
|
10
|
+
function isGptId(model) {
|
|
11
|
+
return model?.id.startsWith("gpt-") ?? false;
|
|
12
|
+
}
|
|
13
|
+
export function getApplyPatchWireMode(model) {
|
|
14
|
+
if (!isGptId(model))
|
|
15
|
+
return "none";
|
|
16
|
+
if (APPLY_PATCH_FREEFORM_APIS.has(model.api))
|
|
17
|
+
return "freeform";
|
|
18
|
+
if (APPLY_PATCH_JSON_APIS.has(model.api))
|
|
19
|
+
return "json";
|
|
20
|
+
return "none";
|
|
21
|
+
}
|
|
12
22
|
export function isOpenAIGptModel(model) {
|
|
13
|
-
return
|
|
23
|
+
return getApplyPatchWireMode(model) === "freeform";
|
|
14
24
|
}
|
|
15
25
|
function hasEditTools(toolNames) {
|
|
16
26
|
return toolNames.some((toolName) => EDIT_TOOL_NAMES.has(toolName));
|
|
17
27
|
}
|
|
18
28
|
function withoutApplyPatch(toolNames) {
|
|
19
|
-
return toolNames.filter((toolName) => toolName !==
|
|
29
|
+
return toolNames.filter((toolName) => toolName !== APPLY_PATCH_NAME);
|
|
20
30
|
}
|
|
21
31
|
function replaceEditToolsWithApplyPatch(toolNames) {
|
|
32
|
+
const hadApplyPatch = toolNames.includes(APPLY_PATCH_NAME);
|
|
33
|
+
const insertIndex = toolNames.findIndex((toolName) => EDIT_TOOL_NAMES.has(toolName) || toolName === APPLY_PATCH_NAME);
|
|
22
34
|
const filteredToolNames = withoutApplyPatch(toolNames).filter((toolName) => !EDIT_TOOL_NAMES.has(toolName));
|
|
23
|
-
if (!hasEditTools(toolNames))
|
|
35
|
+
if (!hasEditTools(toolNames) && !hadApplyPatch)
|
|
24
36
|
return filteredToolNames;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
function restoreEditToolsFromBaseline(currentToolNames, baselineToolNames) {
|
|
28
|
-
const restoredToolNames = [
|
|
29
|
-
...withoutApplyPatch(currentToolNames),
|
|
30
|
-
...baselineToolNames.filter((toolName) => EDIT_TOOL_NAMES.has(toolName)),
|
|
31
|
-
];
|
|
32
|
-
return [...new Set(restoredToolNames)];
|
|
37
|
+
const at = insertIndex === -1 ? filteredToolNames.length : Math.min(insertIndex, filteredToolNames.length);
|
|
38
|
+
return [...filteredToolNames.slice(0, at), APPLY_PATCH_NAME, ...filteredToolNames.slice(at)];
|
|
33
39
|
}
|
|
34
|
-
function syncToolset(pi, model, state) {
|
|
40
|
+
function syncToolset(pi, model, state, variants) {
|
|
41
|
+
const mode = getApplyPatchWireMode(model);
|
|
35
42
|
const currentToolNames = pi.getActiveTools();
|
|
36
|
-
if (
|
|
37
|
-
if (
|
|
38
|
-
|
|
43
|
+
if (mode !== "none") {
|
|
44
|
+
if (state.activeVariant !== mode) {
|
|
45
|
+
pi.registerTool(variants[mode]);
|
|
46
|
+
state.activeVariant = mode;
|
|
47
|
+
}
|
|
48
|
+
const activeEdit = currentToolNames.filter((toolName) => EDIT_TOOL_NAMES.has(toolName));
|
|
49
|
+
if (activeEdit.length > 0)
|
|
50
|
+
state.removedEditToolNames = activeEdit;
|
|
39
51
|
pi.setActiveTools(replaceEditToolsWithApplyPatch(currentToolNames));
|
|
40
52
|
return;
|
|
41
53
|
}
|
|
42
|
-
if (state.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
pi.setActiveTools(restoredToolNames);
|
|
54
|
+
if (state.removedEditToolNames.length === 0) {
|
|
55
|
+
if (currentToolNames.includes(APPLY_PATCH_NAME))
|
|
56
|
+
pi.setActiveTools(withoutApplyPatch(currentToolNames));
|
|
46
57
|
return;
|
|
47
58
|
}
|
|
48
|
-
|
|
49
|
-
|
|
59
|
+
const registeredNames = new Set(pi.getAllTools().map((tool) => tool.name));
|
|
60
|
+
const restorable = state.removedEditToolNames.filter((toolName) => registeredNames.has(toolName));
|
|
61
|
+
const restored = [...withoutApplyPatch(currentToolNames), ...restorable];
|
|
62
|
+
state.removedEditToolNames = [];
|
|
63
|
+
pi.setActiveTools([...new Set(restored)]);
|
|
50
64
|
}
|
|
51
65
|
export function registerApplyPatchExtension(pi) {
|
|
52
|
-
const state = {
|
|
53
|
-
|
|
66
|
+
const state = { removedEditToolNames: [] };
|
|
67
|
+
const variants = {
|
|
68
|
+
freeform: createApplyPatchTool("freeform"),
|
|
69
|
+
json: createApplyPatchTool("json"),
|
|
70
|
+
};
|
|
71
|
+
state.activeVariant = "freeform";
|
|
72
|
+
pi.registerTool(variants.freeform);
|
|
54
73
|
pi.on("session_start", async (_event, ctx) => {
|
|
55
|
-
syncToolset(pi, ctx.model, state);
|
|
74
|
+
syncToolset(pi, ctx.model, state, variants);
|
|
56
75
|
});
|
|
57
76
|
pi.on("model_select", async (event) => {
|
|
58
|
-
syncToolset(pi, event.model, state);
|
|
77
|
+
syncToolset(pi, event.model, state, variants);
|
|
59
78
|
});
|
|
60
79
|
}
|
|
61
80
|
export default registerApplyPatchExtension;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/gpt-apply-patch/extension.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"extension.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/gpt-apply-patch/extension.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAQjD,MAAM,yBAAyB,GAAG,IAAI,GAAG,CAAM;IAC9C,kBAAkB;IAClB,wBAAwB;IACxB,wBAAwB;CACxB,CAAC,CAAC;AACH,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAM,CAAC,oBAAoB,CAAC,CAAC,CAAC;AACnE,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;AACnD,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAEvC,SAAS,OAAO,CAAC,KAAoD;IACpE,OAAO,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,KAAoD;IACzF,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC;IACnC,IAAI,yBAAyB,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC;QAAE,OAAO,UAAU,CAAC;IAChE,IAAI,qBAAqB,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC;QAAE,OAAO,MAAM,CAAC;IACxD,OAAO,MAAM,CAAC;AACf,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAoD;IACpF,OAAO,qBAAqB,CAAC,KAAK,CAAC,KAAK,UAAU,CAAC;AACpD,CAAC;AAED,SAAS,YAAY,CAAC,SAAmB;IACxC,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,QAAQ,EA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AC,CAAC,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AAC3C,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,EAA0B;IACrE,MAAM,KAAK,GAAuE,EAAE,oBAAoB,EAAE,EAAE,EAAE,CAAC;IAC/G,MAAM,QAAQ,GAAG;QAChB,QAAQ,EAAE,oBAAoB,CAAC,UAAU,CAAC;QAC1C,IAAI,EAAE,oBAAoB,CAAC,MAAM,CAAC;KACzB,CAAC;IACX,KAAK,CAAC,aAAa,GAAG,UAAU,CAAC;IACjC,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACnC,EAAE,CAAC,EAAE,CAAC,eAAe,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE;QAC5C,WAAW,CAAC,EAAE,EAAE,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,EAAE,CAAC,cAAc,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;QACrC,WAAW,CAAC,EAAE,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,eAAe,2BAA2B,CAAC","sourcesContent":["import type { Api, Model } from \"@earendil-works/pi-ai\";\nimport { createApplyPatchTool } from \"./tool.ts\";\nimport type {\n\tApplyPatchExtensionAPI,\n\tApplyPatchToolsetState,\n\tApplyPatchToolVariant,\n\tApplyPatchWireMode,\n} from \"./types.ts\";\n\nconst APPLY_PATCH_FREEFORM_APIS = new Set<Api>([\n\t\"openai-responses\",\n\t\"azure-openai-responses\",\n\t\"openai-codex-responses\",\n]);\nconst APPLY_PATCH_JSON_APIS = new Set<Api>([\"openai-completions\"]);\nconst EDIT_TOOL_NAMES = new Set([\"write\", \"edit\"]);\nconst APPLY_PATCH_NAME = \"apply_patch\";\n\nfunction isGptId(model: Pick<Model<string>, \"api\" | \"id\"> | undefined): model is Pick<Model<string>, \"api\" | \"id\"> {\n\treturn model?.id.startsWith(\"gpt-\") ?? false;\n}\n\nexport function getApplyPatchWireMode(model: Pick<Model<string>, \"api\" | \"id\"> | undefined): ApplyPatchWireMode {\n\tif (!isGptId(model)) return \"none\";\n\tif (APPLY_PATCH_FREEFORM_APIS.has(model.api)) return \"freeform\";\n\tif (APPLY_PATCH_JSON_APIS.has(model.api)) return \"json\";\n\treturn \"none\";\n}\n\nexport function isOpenAIGptModel(model: Pick<Model<string>, \"api\" | \"id\"> | undefined): boolean {\n\treturn getApplyPatchWireMode(model) === \"freeform\";\n}\n\nfunction hasEditTools(toolNames: string[]): boolean {\n\treturn toolNames.some((toolName) => EDIT_TOOL_NAMES.has(toolName));\n}\n\nfunction withoutApplyPatch(toolNames: string[]): string[] {\n\treturn toolNames.filter((toolName) => toolName !== APPLY_PATCH_NAME);\n}\n\nfunction replaceEditToolsWithApplyPatch(toolNames: string[]): string[] {\n\tconst hadApplyPatch = toolNames.includes(APPLY_PATCH_NAME);\n\tconst insertIndex = toolNames.findIndex(\n\t\t(toolName) => EDIT_TOOL_NAMES.has(toolName) || toolName === APPLY_PATCH_NAME,\n\t);\n\tconst filteredToolNames = withoutApplyPatch(toolNames).filter((toolName) => !EDIT_TOOL_NAMES.has(toolName));\n\tif (!hasEditTools(toolNames) && !hadApplyPatch) return filteredToolNames;\n\tconst at = insertIndex === -1 ? filteredToolNames.length : Math.min(insertIndex, filteredToolNames.length);\n\treturn [...filteredToolNames.slice(0, at), APPLY_PATCH_NAME, ...filteredToolNames.slice(at)];\n}\n\nfunction syncToolset(\n\tpi: ApplyPatchExtensionAPI,\n\tmodel: Model<string> | undefined,\n\tstate: ApplyPatchToolsetState & { activeVariant?: ApplyPatchToolVariant },\n\tvariants: Readonly<Record<ApplyPatchToolVariant, ReturnType<typeof createApplyPatchTool>>>,\n): void {\n\tconst mode = getApplyPatchWireMode(model);\n\tconst currentToolNames = pi.getActiveTools();\n\tif (mode !== \"none\") {\n\t\tif (state.activeVariant !== mode) {\n\t\t\tpi.registerTool(variants[mode]);\n\t\t\tstate.activeVariant = mode;\n\t\t}\n\t\tconst activeEdit = currentToolNames.filter((toolName) => EDIT_TOOL_NAMES.has(toolName));\n\t\tif (activeEdit.length > 0) state.removedEditToolNames = activeEdit;\n\t\tpi.setActiveTools(replaceEditToolsWithApplyPatch(currentToolNames));\n\t\treturn;\n\t}\n\tif (state.removedEditToolNames.length === 0) {\n\t\tif (currentToolNames.includes(APPLY_PATCH_NAME)) pi.setActiveTools(withoutApplyPatch(currentToolNames));\n\t\treturn;\n\t}\n\tconst registeredNames = new Set(pi.getAllTools().map((tool) => tool.name));\n\tconst restorable = state.removedEditToolNames.filter((toolName) => registeredNames.has(toolName));\n\tconst restored = [...withoutApplyPatch(currentToolNames), ...restorable];\n\tstate.removedEditToolNames = [];\n\tpi.setActiveTools([...new Set(restored)]);\n}\n\nexport function registerApplyPatchExtension(pi: ApplyPatchExtensionAPI): void {\n\tconst state: ApplyPatchToolsetState & { activeVariant?: ApplyPatchToolVariant } = { removedEditToolNames: [] };\n\tconst variants = {\n\t\tfreeform: createApplyPatchTool(\"freeform\"),\n\t\tjson: createApplyPatchTool(\"json\"),\n\t} as const;\n\tstate.activeVariant = \"freeform\";\n\tpi.registerTool(variants.freeform);\n\tpi.on(\"session_start\", async (_event, ctx) => {\n\t\tsyncToolset(pi, ctx.model, state, variants);\n\t});\n\tpi.on(\"model_select\", async (event) => {\n\t\tsyncToolset(pi, event.model, state, variants);\n\t});\n}\n\nexport default registerApplyPatchExtension;\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { __testWriteFileAtomic, applyPatch, applyPatchDetailed, buildPartialFailureText } from "./apply.ts";
|
|
2
|
-
export { APPLY_PATCH_FREEFORM_DESCRIPTION, APPLY_PATCH_LARK_GRAMMAR, APPLY_PATCH_PARAMS, CODEX_APPLY_PATCH_DESCRIPTION, } from "./constants.ts";
|
|
2
|
+
export { APPLY_PATCH_FREEFORM_DESCRIPTION, APPLY_PATCH_JSON_DESCRIPTION, APPLY_PATCH_LARK_GRAMMAR, APPLY_PATCH_PARAMS, CODEX_APPLY_PATCH_DESCRIPTION, } from "./constants.ts";
|
|
3
3
|
export { ApplyPatchError } from "./errors.ts";
|
|
4
|
-
export { default, isOpenAIGptModel, registerApplyPatchExtension } from "./extension.ts";
|
|
4
|
+
export { default, getApplyPatchWireMode, isOpenAIGptModel, registerApplyPatchExtension } from "./extension.ts";
|
|
5
5
|
export { parsePatch } from "./parser.ts";
|
|
6
6
|
export { clearApplyPatchRenderState, displayPath, formatInFlightCallText, formatPatchPreview, getApplyPatchRenderState, PATCH_PREVIEW_MAX_CHARS, PATCH_PREVIEW_MAX_LINES, renderPatchPreview, truncatePreview, } from "./preview-format.ts";
|
|
7
7
|
export { seekSequence } from "./seek-sequence.ts";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/gpt-apply-patch/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAC5G,OAAO,EACN,gCAAgC,EAChC,wBAAwB,EACxB,kBAAkB,EAClB,6BAA6B,GAC7B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/gpt-apply-patch/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAC5G,OAAO,EACN,gCAAgC,EAChC,4BAA4B,EAC5B,wBAAwB,EACxB,kBAAkB,EAClB,6BAA6B,GAC7B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAC/G,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACN,0BAA0B,EAC1B,WAAW,EACX,sBAAsB,EACtB,kBAAkB,EAClB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,kBAAkB,EAClB,eAAe,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,YAAY,EACX,sBAAsB,EACtB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,0BAA0B,EAC1B,8BAA8B,EAC9B,qBAAqB,EACrB,gBAAgB,EAChB,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,WAAW,EACX,UAAU,GACV,MAAM,YAAY,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { __testWriteFileAtomic, applyPatch, applyPatchDetailed, buildPartialFailureText } from "./apply.js";
|
|
2
|
-
export { APPLY_PATCH_FREEFORM_DESCRIPTION, APPLY_PATCH_LARK_GRAMMAR, APPLY_PATCH_PARAMS, CODEX_APPLY_PATCH_DESCRIPTION, } from "./constants.js";
|
|
2
|
+
export { APPLY_PATCH_FREEFORM_DESCRIPTION, APPLY_PATCH_JSON_DESCRIPTION, APPLY_PATCH_LARK_GRAMMAR, APPLY_PATCH_PARAMS, CODEX_APPLY_PATCH_DESCRIPTION, } from "./constants.js";
|
|
3
3
|
export { ApplyPatchError } from "./errors.js";
|
|
4
|
-
export { default, isOpenAIGptModel, registerApplyPatchExtension } from "./extension.js";
|
|
4
|
+
export { default, getApplyPatchWireMode, isOpenAIGptModel, registerApplyPatchExtension } from "./extension.js";
|
|
5
5
|
export { parsePatch } from "./parser.js";
|
|
6
6
|
export { clearApplyPatchRenderState, displayPath, formatInFlightCallText, formatPatchPreview, getApplyPatchRenderState, PATCH_PREVIEW_MAX_CHARS, PATCH_PREVIEW_MAX_LINES, renderPatchPreview, truncatePreview, } from "./preview-format.js";
|
|
7
7
|
export { seekSequence } from "./seek-sequence.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/gpt-apply-patch/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAC5G,OAAO,EACN,gCAAgC,EAChC,wBAAwB,EACxB,kBAAkB,EAClB,6BAA6B,GAC7B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/gpt-apply-patch/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAC5G,OAAO,EACN,gCAAgC,EAChC,4BAA4B,EAC5B,wBAAwB,EACxB,kBAAkB,EAClB,6BAA6B,GAC7B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAC/G,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACN,0BAA0B,EAC1B,WAAW,EACX,sBAAsB,EACtB,kBAAkB,EAClB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,kBAAkB,EAClB,eAAe,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC","sourcesContent":["export { __testWriteFileAtomic, applyPatch, applyPatchDetailed, buildPartialFailureText } from \"./apply.ts\";\nexport {\n\tAPPLY_PATCH_FREEFORM_DESCRIPTION,\n\tAPPLY_PATCH_JSON_DESCRIPTION,\n\tAPPLY_PATCH_LARK_GRAMMAR,\n\tAPPLY_PATCH_PARAMS,\n\tCODEX_APPLY_PATCH_DESCRIPTION,\n} from \"./constants.ts\";\nexport { ApplyPatchError } from \"./errors.ts\";\nexport { default, getApplyPatchWireMode, isOpenAIGptModel, registerApplyPatchExtension } from \"./extension.ts\";\nexport { parsePatch } from \"./parser.ts\";\nexport {\n\tclearApplyPatchRenderState,\n\tdisplayPath,\n\tformatInFlightCallText,\n\tformatPatchPreview,\n\tgetApplyPatchRenderState,\n\tPATCH_PREVIEW_MAX_CHARS,\n\tPATCH_PREVIEW_MAX_LINES,\n\trenderPatchPreview,\n\ttruncatePreview,\n} from \"./preview-format.ts\";\nexport { seekSequence } from \"./seek-sequence.ts\";\nexport { StreamingPatchParser } from \"./streaming-parser.ts\";\nexport { extractPatchedPaths, normalizePatchText, stripHeredoc } from \"./text.ts\";\nexport { createApplyPatchTool } from \"./tool.ts\";\nexport type {\n\tApplyPatchExtensionAPI,\n\tApplyPatchFailure,\n\tApplyPatchParams,\n\tApplyPatchPreview,\n\tApplyPatchProgress,\n\tApplyPatchProgressCallback,\n\tApplyPatchRecoveryInstructions,\n\tApplyPatchRenderState,\n\tApplyPatchResult,\n\tApplyPatchToolDefinition,\n\tApplyPatchToolDetails,\n\tAtomicWriteOperations,\n\tFreeformToolFormat,\n\tParsedPatch,\n\tPatchChunk,\n} from \"./types.ts\";\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ApplyPatchToolDefinition } from "./types.ts";
|
|
2
|
-
export declare function createApplyPatchTool(): ApplyPatchToolDefinition;
|
|
2
|
+
export declare function createApplyPatchTool(variant?: "freeform" | "json"): ApplyPatchToolDefinition;
|
|
3
3
|
//# sourceMappingURL=tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/gpt-apply-patch/tool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/gpt-apply-patch/tool.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAGX,wBAAwB,EAGxB,MAAM,YAAY,CAAC;AAqCpB,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,UAAU,GAAG,MAAmB,GAAG,wBAAwB,CA4FxG"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Box, Container, Spacer, Text } from "@earendil-works/pi-tui";
|
|
2
2
|
import { defineTool } from "../../types.js";
|
|
3
3
|
import { applyPatchDetailed, buildPartialFailureText } from "./apply.js";
|
|
4
|
-
import { APPLY_PATCH_FREEFORM_DESCRIPTION, APPLY_PATCH_LARK_GRAMMAR, APPLY_PATCH_PARAMS } from "./constants.js";
|
|
4
|
+
import { APPLY_PATCH_FREEFORM_DESCRIPTION, APPLY_PATCH_JSON_DESCRIPTION, APPLY_PATCH_LARK_GRAMMAR, APPLY_PATCH_PARAMS, } from "./constants.js";
|
|
5
5
|
import { normalizeApplyPatchArguments } from "./params.js";
|
|
6
6
|
import { parsePatch } from "./parser.js";
|
|
7
7
|
import { createPendingPatchUpdate } from "./preview.js";
|
|
@@ -32,11 +32,11 @@ function renderTextResult(result, theme) {
|
|
|
32
32
|
component.addChild(new Text(theme.fg("toolOutput", text), 0, 0));
|
|
33
33
|
return component;
|
|
34
34
|
}
|
|
35
|
-
export function createApplyPatchTool() {
|
|
35
|
+
export function createApplyPatchTool(variant = "freeform") {
|
|
36
36
|
const tool = defineTool({
|
|
37
37
|
name: "apply_patch",
|
|
38
38
|
label: "ApplyPatch",
|
|
39
|
-
description: APPLY_PATCH_FREEFORM_DESCRIPTION,
|
|
39
|
+
description: variant === "json" ? APPLY_PATCH_JSON_DESCRIPTION : APPLY_PATCH_FREEFORM_DESCRIPTION,
|
|
40
40
|
parameters: APPLY_PATCH_PARAMS,
|
|
41
41
|
prepareArguments: normalizeApplyPatchArguments,
|
|
42
42
|
promptSnippet: "Apply Codex-format file patches with apply_patch",
|
|
@@ -109,6 +109,8 @@ export function createApplyPatchTool() {
|
|
|
109
109
|
return renderTextResult(result, theme);
|
|
110
110
|
},
|
|
111
111
|
});
|
|
112
|
+
if (variant === "json")
|
|
113
|
+
return tool;
|
|
112
114
|
return Object.assign(tool, {
|
|
113
115
|
freeform: { type: "grammar", syntax: "lark", definition: APPLY_PATCH_LARK_GRAMMAR },
|
|
114
116
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/gpt-apply-patch/tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAE,MA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ToolRenderContext } from \"../../types.ts\";\nimport { defineTool } from \"../../types.ts\";\nimport { applyPatchDetailed, buildPartialFailureText } from \"./apply.ts\";\nimport { APPLY_PATCH_FREEFORM_DESCRIPTION, APPLY_PATCH_LARK_GRAMMAR, APPLY_PATCH_PARAMS } from \"./constants.ts\";\nimport { normalizeApplyPatchArguments } from \"./params.ts\";\nimport { parsePatch } from \"./parser.ts\";\nimport { createPendingPatchUpdate } from \"./preview.ts\";\nimport { getApplyPatchRenderState, renderPatchPreview } from \"./preview-format.ts\";\nimport { renderStreamingPatchCall } from \"./streaming-render.ts\";\nimport type {\n\tApplyPatchRenderState,\n\tApplyPatchTheme,\n\tApplyPatchToolDefinition,\n\tApplyPatchToolDetails,\n\tFreeformToolFormat,\n} from \"./types.ts\";\n\nfunction renderPreviewBox(\n\ttitle: string,\n\tdetails: ApplyPatchToolDetails,\n\tisPartial: boolean,\n\tcwd: string,\n\texpanded: boolean,\n\ttheme: ApplyPatchTheme,\n): Container {\n\tconst component = new Container();\n\tif (!details.preview) return component;\n\tconst bgName = isPartial ? \"toolPendingBg\" : \"toolSuccessBg\";\n\tconst progress = details.progress;\n\tconst renderedTitle = progress ? `Applying patch (${progress.applied + progress.failed}/${progress.total})` : title;\n\tconst box = new Box(1, 1, (text: string) => theme.bg(bgName, text));\n\tbox.addChild(new Text(theme.fg(\"toolTitle\", theme.bold(renderedTitle)), 0, 0));\n\tbox.addChild(new Spacer(1));\n\tbox.addChild(new Text(renderPatchPreview(details.preview, cwd, theme, expanded), 0, 0));\n\tcomponent.addChild(box);\n\treturn component;\n}\n\nfunction renderTextResult(\n\tresult: AgentToolResult<ApplyPatchToolDetails | undefined>,\n\ttheme: ApplyPatchTheme,\n): Container {\n\tconst component = new Container();\n\tconst text = result.content\n\t\t.filter((block) => block.type === \"text\")\n\t\t.map((block) => block.text)\n\t\t.filter((value) => typeof value === \"string\" && value.length > 0)\n\t\t.join(\"\\n\");\n\tif (text) component.addChild(new Text(theme.fg(\"toolOutput\", text), 0, 0));\n\treturn component;\n}\n\nexport function createApplyPatchTool(): ApplyPatchToolDefinition {\n\tconst tool = defineTool<typeof APPLY_PATCH_PARAMS, ApplyPatchToolDetails | undefined, ApplyPatchRenderState>({\n\t\tname: \"apply_patch\",\n\t\tlabel: \"ApplyPatch\",\n\t\tdescription: APPLY_PATCH_FREEFORM_DESCRIPTION,\n\t\tparameters: APPLY_PATCH_PARAMS,\n\t\tprepareArguments: normalizeApplyPatchArguments,\n\t\tpromptSnippet: \"Apply Codex-format file patches with apply_patch\",\n\t\tpromptGuidelines: [\n\t\t\t\"Use apply_patch for file edits instead of mutating files through bash, Python scripts, heredocs, or shell redirection.\",\n\t\t\t\"After apply_patch succeeds, do not re-read the edited files just to confirm the patch applied.\",\n\t\t],\n\t\tasync execute(\n\t\t\t_toolCallId,\n\t\t\tparams,\n\t\t\t_signal,\n\t\t\tonUpdate,\n\t\t\tctx,\n\t\t): Promise<AgentToolResult<ApplyPatchToolDetails | undefined>> {\n\t\t\tconst normalizedParams = normalizeApplyPatchArguments(params);\n\t\t\tif (!normalizedParams.input) throw new Error(\"input is required\");\n\t\t\tlet totalOperations = 0;\n\t\t\ttry {\n\t\t\t\ttotalOperations = parsePatch(normalizedParams.input).length;\n\t\t\t} catch {\n\t\t\t\t// createPendingPatchUpdate keeps incomplete or invalid patch text renderable.\n\t\t\t}\n\t\t\tconst initialProgress = totalOperations > 0 ? { applied: 0, failed: 0, total: totalOperations } : undefined;\n\t\t\tconst pendingUpdate = await createPendingPatchUpdate(ctx.cwd, normalizedParams.input, initialProgress);\n\t\t\tonUpdate?.({ content: [{ type: \"text\", text: pendingUpdate.text }], details: pendingUpdate.details });\n\t\t\tconst preview = pendingUpdate.details?.preview;\n\t\t\tconst result = await applyPatchDetailed(ctx.cwd, normalizedParams.input, async (progress) => {\n\t\t\t\tconst progressUpdate = await createPendingPatchUpdate(ctx.cwd, normalizedParams.input, progress, preview);\n\t\t\t\tonUpdate?.({ content: [{ type: \"text\", text: progressUpdate.text }], details: progressUpdate.details });\n\t\t\t});\n\t\t\tif (result.failures.length > 0) {\n\t\t\t\tif (result.appliedFiles.length === 0) {\n\t\t\t\t\tconst firstFailure = result.failures[0];\n\t\t\t\t\tif (firstFailure) throw new Error(firstFailure.message);\n\t\t\t\t}\n\t\t\t\treturn { content: [{ type: \"text\", text: buildPartialFailureText(result) }], details: { result } };\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: result.summaries.join(\"\\n\") }],\n\t\t\t\tdetails: pendingUpdate.details?.preview ? { preview: pendingUpdate.details.preview, result } : { result },\n\t\t\t};\n\t\t},\n\t\trenderCall(args, theme, context: ToolRenderContext<ApplyPatchRenderState, { input: string }>) {\n\t\t\tif (!context.executionStarted) {\n\t\t\t\tconst streaming = renderStreamingPatchCall(normalizeApplyPatchArguments(args), theme, context.state);\n\t\t\t\tif (streaming) return streaming;\n\t\t\t}\n\t\t\tif (!context.argsComplete) return new Text(theme.fg(\"toolTitle\", theme.bold(\"apply_patch: Patching\")), 0, 0);\n\t\t\tconst normalizedArgs = normalizeApplyPatchArguments(args);\n\t\t\tconst renderState = getApplyPatchRenderState(context.toolCallId, context.cwd, normalizedArgs.input);\n\t\t\tconst text = renderState.callText?.length ? `apply_patch: ${renderState.callText}` : \"apply_patch\";\n\t\t\treturn new Text(theme.fg(\"toolTitle\", theme.bold(text)), 0, 0);\n\t\t},\n\t\trenderResult(result, options, theme, context) {\n\t\t\tif (result.details?.preview) {\n\t\t\t\tconst expanded = true;\n\t\t\t\treturn renderPreviewBox(\n\t\t\t\t\toptions.isPartial ? \"Applying patch\" : \"Applied patch\",\n\t\t\t\t\tresult.details,\n\t\t\t\t\toptions.isPartial,\n\t\t\t\t\tcontext.cwd,\n\t\t\t\t\texpanded,\n\t\t\t\t\ttheme,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (result.details?.result) {\n\t\t\t\tconst component = new Container();\n\t\t\t\tconst box = new Box(1, 1, (text: string) =>\n\t\t\t\t\ttheme.bg(options.isPartial ? \"toolPendingBg\" : \"toolSuccessBg\", text),\n\t\t\t\t);\n\t\t\t\tbox.addChild(new Text(theme.fg(\"toolTitle\", theme.bold(\"Applying patch\")), 0, 0));\n\t\t\t\tbox.addChild(new Spacer(1));\n\t\t\t\tif (result.details.preview) {\n\t\t\t\t\tconst expanded = options.isPartial ? true : (options.expanded ?? true);\n\t\t\t\t\tbox.addChild(new Text(renderPatchPreview(result.details.preview, context.cwd, theme, expanded), 0, 0));\n\t\t\t\t}\n\t\t\t\tcomponent.addChild(box);\n\t\t\t\treturn component;\n\t\t\t}\n\t\t\treturn renderTextResult(result, theme);\n\t\t},\n\t});\n\n\treturn Object.assign(tool, {\n\t\tfreeform: { type: \"grammar\", syntax: \"lark\", definition: APPLY_PATCH_LARK_GRAMMAR } satisfies FreeformToolFormat,\n\t});\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/gpt-apply-patch/tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,EACN,gCAAgC,EAChC,4BAA4B,EAC5B,wBAAwB,EACxB,kBAAkB,GAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AASjE,SAAS,gBAAgB,C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,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC5B,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;oBAC5B,MAAM,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,IAAI,IAAI,CAAC,CAAC;oBACvE,GAAG,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;gBACxG,CAAC;gBACD,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;gBACxB,OAAO,SAAS,CAAC;YAClB,CAAC;YACD,OAAO,gBAAgB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACxC,CAAC;KACD,CAAC,CAAC;IAEH,IAAI,OAAO,KAAK,MAAM;QAAE,OAAO,IAAI,CAAC;IACpC,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;QAC1B,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,wBAAwB,EAA+B;KAChH,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { Box, Container, Spacer, Text } from \"@earendil-works/pi-tui\";\nimport type { AgentToolResult, ToolRenderContext } from \"../../types.ts\";\nimport { defineTool } from \"../../types.ts\";\nimport { applyPatchDetailed, buildPartialFailureText } from \"./apply.ts\";\nimport {\n\tAPPLY_PATCH_FREEFORM_DESCRIPTION,\n\tAPPLY_PATCH_JSON_DESCRIPTION,\n\tAPPLY_PATCH_LARK_GRAMMAR,\n\tAPPLY_PATCH_PARAMS,\n} from \"./constants.ts\";\nimport { normalizeApplyPatchArguments } from \"./params.ts\";\nimport { parsePatch } from \"./parser.ts\";\nimport { createPendingPatchUpdate } from \"./preview.ts\";\nimport { getApplyPatchRenderState, renderPatchPreview } from \"./preview-format.ts\";\nimport { renderStreamingPatchCall } from \"./streaming-render.ts\";\nimport type {\n\tApplyPatchRenderState,\n\tApplyPatchTheme,\n\tApplyPatchToolDefinition,\n\tApplyPatchToolDetails,\n\tFreeformToolFormat,\n} from \"./types.ts\";\n\nfunction renderPreviewBox(\n\ttitle: string,\n\tdetails: ApplyPatchToolDetails,\n\tisPartial: boolean,\n\tcwd: string,\n\texpanded: boolean,\n\ttheme: ApplyPatchTheme,\n): Container {\n\tconst component = new Container();\n\tif (!details.preview) return component;\n\tconst bgName = isPartial ? \"toolPendingBg\" : \"toolSuccessBg\";\n\tconst progress = details.progress;\n\tconst renderedTitle = progress ? `Applying patch (${progress.applied + progress.failed}/${progress.total})` : title;\n\tconst box = new Box(1, 1, (text: string) => theme.bg(bgName, text));\n\tbox.addChild(new Text(theme.fg(\"toolTitle\", theme.bold(renderedTitle)), 0, 0));\n\tbox.addChild(new Spacer(1));\n\tbox.addChild(new Text(renderPatchPreview(details.preview, cwd, theme, expanded), 0, 0));\n\tcomponent.addChild(box);\n\treturn component;\n}\n\nfunction renderTextResult(\n\tresult: AgentToolResult<ApplyPatchToolDetails | undefined>,\n\ttheme: ApplyPatchTheme,\n): Container {\n\tconst component = new Container();\n\tconst text = result.content\n\t\t.filter((block) => block.type === \"text\")\n\t\t.map((block) => block.text)\n\t\t.filter((value) => typeof value === \"string\" && value.length > 0)\n\t\t.join(\"\\n\");\n\tif (text) component.addChild(new Text(theme.fg(\"toolOutput\", text), 0, 0));\n\treturn component;\n}\n\nexport function createApplyPatchTool(variant: \"freeform\" | \"json\" = \"freeform\"): ApplyPatchToolDefinition {\n\tconst tool = defineTool<typeof APPLY_PATCH_PARAMS, ApplyPatchToolDetails | undefined, ApplyPatchRenderState>({\n\t\tname: \"apply_patch\",\n\t\tlabel: \"ApplyPatch\",\n\t\tdescription: variant === \"json\" ? APPLY_PATCH_JSON_DESCRIPTION : APPLY_PATCH_FREEFORM_DESCRIPTION,\n\t\tparameters: APPLY_PATCH_PARAMS,\n\t\tprepareArguments: normalizeApplyPatchArguments,\n\t\tpromptSnippet: \"Apply Codex-format file patches with apply_patch\",\n\t\tpromptGuidelines: [\n\t\t\t\"Use apply_patch for file edits instead of mutating files through bash, Python scripts, heredocs, or shell redirection.\",\n\t\t\t\"After apply_patch succeeds, do not re-read the edited files just to confirm the patch applied.\",\n\t\t],\n\t\tasync execute(\n\t\t\t_toolCallId,\n\t\t\tparams,\n\t\t\t_signal,\n\t\t\tonUpdate,\n\t\t\tctx,\n\t\t): Promise<AgentToolResult<ApplyPatchToolDetails | undefined>> {\n\t\t\tconst normalizedParams = normalizeApplyPatchArguments(params);\n\t\t\tif (!normalizedParams.input) throw new Error(\"input is required\");\n\t\t\tlet totalOperations = 0;\n\t\t\ttry {\n\t\t\t\ttotalOperations = parsePatch(normalizedParams.input).length;\n\t\t\t} catch {\n\t\t\t\t// createPendingPatchUpdate keeps incomplete or invalid patch text renderable.\n\t\t\t}\n\t\t\tconst initialProgress = totalOperations > 0 ? { applied: 0, failed: 0, total: totalOperations } : undefined;\n\t\t\tconst pendingUpdate = await createPendingPatchUpdate(ctx.cwd, normalizedParams.input, initialProgress);\n\t\t\tonUpdate?.({ content: [{ type: \"text\", text: pendingUpdate.text }], details: pendingUpdate.details });\n\t\t\tconst preview = pendingUpdate.details?.preview;\n\t\t\tconst result = await applyPatchDetailed(ctx.cwd, normalizedParams.input, async (progress) => {\n\t\t\t\tconst progressUpdate = await createPendingPatchUpdate(ctx.cwd, normalizedParams.input, progress, preview);\n\t\t\t\tonUpdate?.({ content: [{ type: \"text\", text: progressUpdate.text }], details: progressUpdate.details });\n\t\t\t});\n\t\t\tif (result.failures.length > 0) {\n\t\t\t\tif (result.appliedFiles.length === 0) {\n\t\t\t\t\tconst firstFailure = result.failures[0];\n\t\t\t\t\tif (firstFailure) throw new Error(firstFailure.message);\n\t\t\t\t}\n\t\t\t\treturn { content: [{ type: \"text\", text: buildPartialFailureText(result) }], details: { result } };\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: result.summaries.join(\"\\n\") }],\n\t\t\t\tdetails: pendingUpdate.details?.preview ? { preview: pendingUpdate.details.preview, result } : { result },\n\t\t\t};\n\t\t},\n\t\trenderCall(args, theme, context: ToolRenderContext<ApplyPatchRenderState, { input: string }>) {\n\t\t\tif (!context.executionStarted) {\n\t\t\t\tconst streaming = renderStreamingPatchCall(normalizeApplyPatchArguments(args), theme, context.state);\n\t\t\t\tif (streaming) return streaming;\n\t\t\t}\n\t\t\tif (!context.argsComplete) return new Text(theme.fg(\"toolTitle\", theme.bold(\"apply_patch: Patching\")), 0, 0);\n\t\t\tconst normalizedArgs = normalizeApplyPatchArguments(args);\n\t\t\tconst renderState = getApplyPatchRenderState(context.toolCallId, context.cwd, normalizedArgs.input);\n\t\t\tconst text = renderState.callText?.length ? `apply_patch: ${renderState.callText}` : \"apply_patch\";\n\t\t\treturn new Text(theme.fg(\"toolTitle\", theme.bold(text)), 0, 0);\n\t\t},\n\t\trenderResult(result, options, theme, context) {\n\t\t\tif (result.details?.preview) {\n\t\t\t\tconst expanded = true;\n\t\t\t\treturn renderPreviewBox(\n\t\t\t\t\toptions.isPartial ? \"Applying patch\" : \"Applied patch\",\n\t\t\t\t\tresult.details,\n\t\t\t\t\toptions.isPartial,\n\t\t\t\t\tcontext.cwd,\n\t\t\t\t\texpanded,\n\t\t\t\t\ttheme,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (result.details?.result) {\n\t\t\t\tconst component = new Container();\n\t\t\t\tconst box = new Box(1, 1, (text: string) =>\n\t\t\t\t\ttheme.bg(options.isPartial ? \"toolPendingBg\" : \"toolSuccessBg\", text),\n\t\t\t\t);\n\t\t\t\tbox.addChild(new Text(theme.fg(\"toolTitle\", theme.bold(\"Applying patch\")), 0, 0));\n\t\t\t\tbox.addChild(new Spacer(1));\n\t\t\t\tif (result.details.preview) {\n\t\t\t\t\tconst expanded = options.isPartial ? true : (options.expanded ?? true);\n\t\t\t\t\tbox.addChild(new Text(renderPatchPreview(result.details.preview, context.cwd, theme, expanded), 0, 0));\n\t\t\t\t}\n\t\t\t\tcomponent.addChild(box);\n\t\t\t\treturn component;\n\t\t\t}\n\t\t\treturn renderTextResult(result, theme);\n\t\t},\n\t});\n\n\tif (variant === \"json\") return tool;\n\treturn Object.assign(tool, {\n\t\tfreeform: { type: \"grammar\", syntax: \"lark\", definition: APPLY_PATCH_LARK_GRAMMAR } satisfies FreeformToolFormat,\n\t});\n}\n"]}
|
|
@@ -19,8 +19,11 @@ export type PatchChunk = {
|
|
|
19
19
|
newLines: string[];
|
|
20
20
|
isEndOfFile: boolean;
|
|
21
21
|
};
|
|
22
|
-
export type
|
|
23
|
-
|
|
22
|
+
export type ApplyPatchWireMode = "freeform" | "json" | "none";
|
|
23
|
+
export type ApplyPatchToolVariant = Exclude<ApplyPatchWireMode, "none">;
|
|
24
|
+
export type ApplyPatchToolsetState = {
|
|
25
|
+
/** Exactly the edit-family tools this extension removed at the last non-GPT to GPT transition. */
|
|
26
|
+
removedEditToolNames: string[];
|
|
24
27
|
};
|
|
25
28
|
export type FreeformToolFormat = {
|
|
26
29
|
type: "grammar";
|
|
@@ -100,10 +103,8 @@ export type ApplyPatchRenderState = {
|
|
|
100
103
|
streamingHunks?: ParsedPatch[];
|
|
101
104
|
streamingError?: string;
|
|
102
105
|
};
|
|
103
|
-
export type ApplyPatchToolDefinition = ToolDefinition<typeof APPLY_PATCH_PARAMS, ApplyPatchToolDetails | undefined, ApplyPatchRenderState
|
|
104
|
-
|
|
105
|
-
};
|
|
106
|
-
export type ApplyPatchExtensionAPI = Pick<ExtensionAPI, "on" | "getActiveTools" | "setActiveTools"> & {
|
|
106
|
+
export type ApplyPatchToolDefinition = ToolDefinition<typeof APPLY_PATCH_PARAMS, ApplyPatchToolDetails | undefined, ApplyPatchRenderState>;
|
|
107
|
+
export type ApplyPatchExtensionAPI = Pick<ExtensionAPI, "on" | "getActiveTools" | "getAllTools" | "setActiveTools"> & {
|
|
107
108
|
registerTool: (tool: ApplyPatchToolDefinition) => void;
|
|
108
109
|
};
|
|
109
110
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/gpt-apply-patch/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,MAAM,MAAM,WAAW,GACpB;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAClD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACpC;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,UAAU,EAAE,CAAA;CAAE,CAAC;AAEjF,MAAM,MAAM,UAAU,GAAG;IACxB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/gpt-apply-patch/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,MAAM,MAAM,WAAW,GACpB;IAAE,IA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AC;AAEF,MAAM,MAAM,wBAAwB,GAAG,cAAc,CACpD,OAAO,kBAAkB,EACzB,qBAAqB,GAAG,SAAS,EACjC,qBAAqB,CACrB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,IAAI,CAAC,YAAY,EAAE,IAAI,GAAG,gBAAgB,GAAG,aAAa,GAAG,gBAAgB,CAAC,GAAG;IACrH,YAAY,EAAE,CAAC,IAAI,EAAE,wBAAwB,KAAK,IAAI,CAAC;CACvD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/gpt-apply-patch/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ExtensionAPI, ToolDefinition } from \"../../types.ts\";\nimport type { APPLY_PATCH_PARAMS } from \"./constants.ts\";\n\nexport type ParsedPatch =\n\t| { type: \"add\"; filePath: string; content: string }\n\t| { type: \"delete\"; filePath: string }\n\t| { type: \"update\"; filePath: string; movePath?: string; chunks: PatchChunk[] };\n\nexport type PatchChunk = {\n\tchangeContexts: string[];\n\toldLines: string[];\n\tnewLines: string[];\n\tisEndOfFile: boolean;\n};\n\nexport type
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/gpt-apply-patch/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ExtensionAPI, ToolDefinition } from \"../../types.ts\";\nimport type { APPLY_PATCH_PARAMS } from \"./constants.ts\";\n\nexport type ParsedPatch =\n\t| { type: \"add\"; filePath: string; content: string }\n\t| { type: \"delete\"; filePath: string }\n\t| { type: \"update\"; filePath: string; movePath?: string; chunks: PatchChunk[] };\n\nexport type PatchChunk = {\n\tchangeContexts: string[];\n\toldLines: string[];\n\tnewLines: string[];\n\tisEndOfFile: boolean;\n};\n\nexport type ApplyPatchWireMode = \"freeform\" | \"json\" | \"none\";\n\nexport type ApplyPatchToolVariant = Exclude<ApplyPatchWireMode, \"none\">;\n\nexport type ApplyPatchToolsetState = {\n\t/** Exactly the edit-family tools this extension removed at the last non-GPT to GPT transition. */\n\tremovedEditToolNames: string[];\n};\n\nexport type FreeformToolFormat = {\n\ttype: \"grammar\";\n\tsyntax: \"lark\";\n\tdefinition: string;\n};\n\nexport type ApplyPatchParams = {\n\tinput: string;\n};\n\nexport type ApplyPatchOperation = \"add\" | \"delete\" | \"update\";\n\nexport type ApplyPatchPreviewFile = {\n\tfilePath: string;\n\tmovePath?: string;\n\toperation: ApplyPatchOperation;\n\tdiff: string;\n\tadded: number;\n\tremoved: number;\n};\n\nexport type ApplyPatchPreview = {\n\tfiles: ApplyPatchPreviewFile[];\n\tadded: number;\n\tremoved: number;\n};\n\nexport type ApplyPatchToolDetails = {\n\tpreview?: ApplyPatchPreview;\n\tprogress?: ApplyPatchProgress;\n\tresult?: ApplyPatchResult;\n};\n\nexport type ApplyPatchProgress = {\n\tapplied: number;\n\tfailed: number;\n\ttotal: number;\n};\n\nexport type ApplyPatchProgressCallback = (progress: ApplyPatchProgress) => Promise<void> | void;\n\nexport type ApplyPatchFailure = {\n\tfilePath: string;\n\toperation: ApplyPatchOperation;\n\tmessage: string;\n};\n\nexport type ApplyPatchRecoveryInstructions = {\n\tmustReadFiles: string[];\n\tmustNotReadFiles: string[];\n};\n\nexport type ApplyPatchResult = {\n\tsummaries: string[];\n\tappliedFiles: string[];\n\tfailures: ApplyPatchFailure[];\n\thasPartialSuccess: boolean;\n\trecoveryInstructions: ApplyPatchRecoveryInstructions;\n\tdetails: {\n\t\tfuzz: number;\n\t};\n};\n\nexport type AtomicWriteOperations = {\n\twriteFile: (filePath: string, content: string, encoding: \"utf-8\") => Promise<void>;\n\trename: (fromPath: string, toPath: string) => Promise<void>;\n\tunlink: (filePath: string) => Promise<void>;\n};\n\nexport type ApplyPatchThemeColor =\n\t| \"accent\"\n\t| \"error\"\n\t| \"muted\"\n\t| \"toolDiffAdded\"\n\t| \"toolDiffContext\"\n\t| \"toolDiffRemoved\"\n\t| \"toolOutput\"\n\t| \"toolTitle\";\n\nexport type ApplyPatchThemeBg = \"toolErrorBg\" | \"toolPendingBg\" | \"toolSuccessBg\";\n\nexport type ApplyPatchTheme = {\n\tfg: (name: ApplyPatchThemeColor, text: string) => string;\n\tbg: (name: ApplyPatchThemeBg, text: string) => string;\n\tbold: (text: string) => string;\n\tinverse: (text: string) => string;\n};\n\nexport type ApplyPatchRenderState = {\n\tcwd?: string;\n\tpatchText?: string;\n\tcallText?: string;\n\tcollapsed?: string;\n\texpanded?: string;\n\tstreamingInput?: string;\n\tstreamingParser?: { pushDelta: (delta: string) => ParsedPatch[] };\n\tstreamingHunks?: ParsedPatch[];\n\tstreamingError?: string;\n};\n\nexport type ApplyPatchToolDefinition = ToolDefinition<\n\ttypeof APPLY_PATCH_PARAMS,\n\tApplyPatchToolDetails | undefined,\n\tApplyPatchRenderState\n>;\n\nexport type ApplyPatchExtensionAPI = Pick<ExtensionAPI, \"on\" | \"getActiveTools\" | \"getAllTools\" | \"setActiveTools\"> & {\n\tregisterTool: (tool: ApplyPatchToolDefinition) => void;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matcher.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/hooks/matcher.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEvF,MAAM,MAAM,iBAAiB,GAAG;IAC/B,QAAQ,CAAC,QAAQ,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACpD,QAAQ,CAAC,WAAW,EAAE,SAAS,cAAc,EAAE,CAAC;CAChD,CAAC;
|
|
1
|
+
{"version":3,"file":"matcher.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/hooks/matcher.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEvF,MAAM,MAAM,iB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M,CACd;iBACD;aACD,CAAC;QACH,CAAC;QACD,MAAM,KAAK,CAAC;IACb,CAAC;AACF,CAAC","sourcesContent":["import { diagnostic } from \"./diagnostics.ts\";\nimport type { ExecutableHookHandler, HookDiagnostic, HookInputWire } from \"./types.ts\";\n\nexport type HookMatcherResult = {\n\treadonly handlers: readonly ExecutableHookHandler[];\n\treadonly diagnostics: readonly HookDiagnostic[];\n};\n\ntype MatcherSubject = { readonly kind: \"ignored\" } | { readonly kind: \"inputs\"; readonly inputs: readonly string[] };\n\nconst TOOL_MATCHER_ALIASES: Readonly<Record<string, readonly string[]>> = {\n\tapply_patch: [\"ApplyPatch\", \"functions.apply_patch\"],\n\tbash: [\"Bash\", \"Shell\", \"shell\", \"exec_command\", \"functions.exec_command\"],\n\tcreate_goal: [\"CreateGoal\"],\n\tedit: [\"Edit\", \"MultiEdit\", \"multi_edit\"],\n\tfind: [\"Find\", \"Glob\", \"glob\", \"file_search\"],\n\tget_goal: [\"GetGoal\"],\n\tgrep: [\"Grep\", \"Search\", \"grep_app\"],\n\tls: [\"LS\", \"List\", \"list\"],\n\tread: [\"Read\", \"open\", \"read_file\"],\n\ttodoread: [\"TodoRead\"],\n\ttodowrite: [\"TodoWrite\"],\n\tupdate_goal: [\"UpdateGoal\"],\n\tweb_search: [\"WebSearch\", \"web-search\"],\n\twebfetch: [\"WebFetch\", \"web_fetch\", \"web-fetch\"],\n\twrite: [\"Write\", \"write_file\"],\n} as const;\n\nexport function matchingHookHandlers(\n\tinput: HookInputWire,\n\thandlers: readonly ExecutableHookHandler[],\n): HookMatcherResult {\n\tconst subject = matcherSubject(input);\n\tconst selected: ExecutableHookHandler[] = [];\n\tconst diagnostics: HookDiagnostic[] = [];\n\n\tfor (const handler of handlers) {\n\t\tif (handler.event !== input.event) {\n\t\t\tcontinue;\n\t\t}\n\t\tif (subject.kind === \"ignored\") {\n\t\t\tselected.push(handler);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst match = matchesMatcher(handler, subject.inputs);\n\t\tdiagnostics.push(...match.diagnostics);\n\t\tif (match.matched) {\n\t\t\tselected.push(handler);\n\t\t}\n\t}\n\n\treturn { handlers: selected, diagnostics };\n}\n\nfunction matcherSubject(input: HookInputWire): MatcherSubject {\n\tswitch (input.event) {\n\t\tcase \"UserPromptSubmit\":\n\t\tcase \"Stop\":\n\t\t\treturn { kind: \"ignored\" };\n\t\tcase \"PreToolUse\":\n\t\tcase \"PostToolUse\":\n\t\t\treturn { kind: \"inputs\", inputs: toolMatcherInputs(input.toolName) };\n\t\tcase \"SessionStart\":\n\t\tcase \"PreCompact\":\n\t\tcase \"PostCompact\":\n\t\t\treturn { kind: \"inputs\", inputs: [input.event] };\n\t}\n}\n\nfunction toolMatcherInputs(toolName: string): readonly string[] {\n\tconst values = new Set<string>();\n\taddMatcherInput(values, toolName);\n\n\tconst lowerToolName = toolName.toLowerCase();\n\taddMatcherInput(values, lowerToolName);\n\taddMatcherInput(values, toClaudeToolName(lowerToolName));\n\n\tfor (const alias of TOOL_MATCHER_ALIASES[lowerToolName] ?? []) {\n\t\taddMatcherInput(values, alias);\n\t}\n\n\treturn [...values];\n}\n\nfunction addMatcherInput(values: Set<string>, value: string): void {\n\tconst trimmed = value.trim();\n\tif (trimmed.length > 0) {\n\t\tvalues.add(trimmed);\n\t}\n}\n\nfunction toClaudeToolName(toolName: string): string {\n\treturn toolName\n\t\t.split(/[-_]/)\n\t\t.filter((part) => part.length > 0)\n\t\t.map((part) => `${part.slice(0, 1).toUpperCase()}${part.slice(1)}`)\n\t\t.join(\"\");\n}\n\nfunction matchesMatcher(\n\thandler: ExecutableHookHandler,\n\tinputs: readonly string[],\n): { readonly matched: boolean; readonly diagnostics: readonly HookDiagnostic[] } {\n\tconst matcher = handler.matcher?.trim();\n\tif (matcher === undefined || matcher.length === 0 || matcher === \"*\") {\n\t\treturn { matched: true, diagnostics: [] };\n\t}\n\n\tconst literalMatched = matcher\n\t\t.split(/[|,]/)\n\t\t.map((part) => part.trim())\n\t\t.filter((part) => part.length > 0)\n\t\t.some((part) => inputs.includes(part));\n\n\ttry {\n\t\tconst regex = new RegExp(matcher);\n\t\treturn { matched: literalMatched || inputs.some((input) => regex.test(input)), diagnostics: [] };\n\t} catch (error) {\n\t\tif (error instanceof SyntaxError) {\n\t\t\treturn {\n\t\t\t\tmatched: literalMatched,\n\t\t\t\tdiagnostics: [\n\t\t\t\t\tdiagnostic(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcode: \"invalid_matcher\",\n\t\t\t\t\t\t\tevent: handler.event,\n\t\t\t\t\t\t\tmessage: `Hook matcher is not a valid JavaScript regular expression: ${error.message}`,\n\t\t\t\t\t\t\tpath: `hooks.${handler.event}[${handler.groupIndex}].matcher`,\n\t\t\t\t\t\t\tseverity: \"warning\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\thandler.source,\n\t\t\t\t\t),\n\t\t\t\t],\n\t\t\t};\n\t\t}\n\t\tthrow error;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"matcher.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/hooks/matcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAU9C,MAAM,oBAAoB,GAAgD;IACzE,WAAW,EAAE,CAAC,YAAY,EAAE,uBAAuB,CAAC;IACpD,IAAI,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,wBAAwB,CAAC;IAC1E,WAAW,EAAE,CAAC,YAAY,CAAC;IAC3B,IAAI,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,YAAY,CAAC;IACzC,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC;IAC7C,QAAQ,EAAE,CAAC,SAAS,CAAC;IACrB,IAAI,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,CAAC;IACpC,EAAE,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE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AC;QAChB,IAAI,KAAK,YAAY,WAAW,EAAE,CAAC;YAClC,OAAO;gBACN,OAAO,EAAE,cAAc;gBACvB,WAAW,EAAE;oBACZ,UAAU,CACT;wBACC,IAAI,EAAE,iBAAiB;wBACvB,KAAK,EAAE,OAAO,CAAC,KAAK;wBACpB,OAAO,EAAE,8DAA8D,KAAK,CAAC,OAAO,EAAE;wBACtF,IAAI,EAAE,SAAS,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,UAAU,WAAW;wBAC7D,QAAQ,EAAE,SAAS;qBACnB,EACD,OAAO,CAAC,MAAM,CACd;iBACD;aACD,CAAC;QACH,CAAC;QACD,MAAM,KAAK,CAAC;IACb,CAAC;AACF,CAAC","sourcesContent":["import { diagnostic } from \"./diagnostics.ts\";\nimport type { ExecutableHookHandler, HookDiagnostic, HookInputWire } from \"./types.ts\";\n\nexport type HookMatcherResult = {\n\treadonly handlers: readonly ExecutableHookHandler[];\n\treadonly diagnostics: readonly HookDiagnostic[];\n};\n\ntype MatcherSubject = { readonly kind: \"ignored\" } | { readonly kind: \"inputs\"; readonly inputs: readonly string[] };\n\nconst TOOL_MATCHER_ALIASES: Readonly<Record<string, readonly string[]>> = {\n\tapply_patch: [\"ApplyPatch\", \"functions.apply_patch\"],\n\tbash: [\"Bash\", \"Shell\", \"shell\", \"exec_command\", \"functions.exec_command\"],\n\tcreate_goal: [\"CreateGoal\"],\n\tedit: [\"Edit\", \"MultiEdit\", \"multi_edit\"],\n\tfind: [\"Find\", \"Glob\", \"glob\", \"file_search\"],\n\tget_goal: [\"GetGoal\"],\n\tgrep: [\"Grep\", \"Search\", \"grep_app\"],\n\tls: [\"LS\", \"List\", \"list\"],\n\tread: [\"Read\", \"open\", \"read_file\"],\n\ttodo: [\"Todo\"],\n\ttodoread: [\"TodoRead\"],\n\ttodowrite: [\"TodoWrite\"],\n\tupdate_goal: [\"UpdateGoal\"],\n\tweb_search: [\"WebSearch\", \"web-search\"],\n\twebfetch: [\"WebFetch\", \"web_fetch\", \"web-fetch\"],\n\twrite: [\"Write\", \"write_file\"],\n} as const;\n\nexport function matchingHookHandlers(\n\tinput: HookInputWire,\n\thandlers: readonly ExecutableHookHandler[],\n): HookMatcherResult {\n\tconst subject = matcherSubject(input);\n\tconst selected: ExecutableHookHandler[] = [];\n\tconst diagnostics: HookDiagnostic[] = [];\n\n\tfor (const handler of handlers) {\n\t\tif (handler.event !== input.event) {\n\t\t\tcontinue;\n\t\t}\n\t\tif (subject.kind === \"ignored\") {\n\t\t\tselected.push(handler);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst match = matchesMatcher(handler, subject.inputs);\n\t\tdiagnostics.push(...match.diagnostics);\n\t\tif (match.matched) {\n\t\t\tselected.push(handler);\n\t\t}\n\t}\n\n\treturn { handlers: selected, diagnostics };\n}\n\nfunction matcherSubject(input: HookInputWire): MatcherSubject {\n\tswitch (input.event) {\n\t\tcase \"UserPromptSubmit\":\n\t\tcase \"Stop\":\n\t\t\treturn { kind: \"ignored\" };\n\t\tcase \"PreToolUse\":\n\t\tcase \"PostToolUse\":\n\t\t\treturn { kind: \"inputs\", inputs: toolMatcherInputs(input.toolName) };\n\t\tcase \"SessionStart\":\n\t\tcase \"PreCompact\":\n\t\tcase \"PostCompact\":\n\t\t\treturn { kind: \"inputs\", inputs: [input.event] };\n\t}\n}\n\nfunction toolMatcherInputs(toolName: string): readonly string[] {\n\tconst values = new Set<string>();\n\taddMatcherInput(values, toolName);\n\n\tconst lowerToolName = toolName.toLowerCase();\n\taddMatcherInput(values, lowerToolName);\n\taddMatcherInput(values, toClaudeToolName(lowerToolName));\n\n\tfor (const alias of TOOL_MATCHER_ALIASES[lowerToolName] ?? []) {\n\t\taddMatcherInput(values, alias);\n\t}\n\n\treturn [...values];\n}\n\nfunction addMatcherInput(values: Set<string>, value: string): void {\n\tconst trimmed = value.trim();\n\tif (trimmed.length > 0) {\n\t\tvalues.add(trimmed);\n\t}\n}\n\nfunction toClaudeToolName(toolName: string): string {\n\treturn toolName\n\t\t.split(/[-_]/)\n\t\t.filter((part) => part.length > 0)\n\t\t.map((part) => `${part.slice(0, 1).toUpperCase()}${part.slice(1)}`)\n\t\t.join(\"\");\n}\n\nfunction matchesMatcher(\n\thandler: ExecutableHookHandler,\n\tinputs: readonly string[],\n): { readonly matched: boolean; readonly diagnostics: readonly HookDiagnostic[] } {\n\tconst matcher = handler.matcher?.trim();\n\tif (matcher === undefined || matcher.length === 0 || matcher === \"*\") {\n\t\treturn { matched: true, diagnostics: [] };\n\t}\n\n\tconst literalMatched = matcher\n\t\t.split(/[|,]/)\n\t\t.map((part) => part.trim())\n\t\t.filter((part) => part.length > 0)\n\t\t.some((part) => inputs.includes(part));\n\n\ttry {\n\t\tconst regex = new RegExp(matcher);\n\t\treturn { matched: literalMatched || inputs.some((input) => regex.test(input)), diagnostics: [] };\n\t} catch (error) {\n\t\tif (error instanceof SyntaxError) {\n\t\t\treturn {\n\t\t\t\tmatched: literalMatched,\n\t\t\t\tdiagnostics: [\n\t\t\t\t\tdiagnostic(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcode: \"invalid_matcher\",\n\t\t\t\t\t\t\tevent: handler.event,\n\t\t\t\t\t\t\tmessage: `Hook matcher is not a valid JavaScript regular expression: ${error.message}`,\n\t\t\t\t\t\t\tpath: `hooks.${handler.event}[${handler.groupIndex}].matcher`,\n\t\t\t\t\t\t\tseverity: \"warning\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\thandler.source,\n\t\t\t\t\t),\n\t\t\t\t],\n\t\t\t};\n\t\t}\n\t\tthrow error;\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/extensions/builtin/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAKpD,OAAO,aAAa,MAAM,WAAW,CAAC;AACtC,OAAO,cAAc,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/extensions/builtin/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAKpD,OAAO,aAAa,MAAM,WAAW,CAAC;AACtC,OAAO,cAAc,MAAM,YAAY,CAAC;AAYxC,OAAO,wBAAwB,MAAM,wBAAwB,CAAC;AAQ9D,OAAO,YAAY,MAAM,UAAU,CAAC;AAKpC,MAAM,WAAW,uBAAuB;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,gBAAgB,CAAC;CAC1B;AAED,eAAO,MAAM,yBAAyB,YAAI,MAAM,EAAE,OAAO,EAAE,mBAAmB,EAAE,KAAK,CAAU,CAAC;AAEhG,eAAO,MAAM,+BAA+B;;;;;CAKoC,CAAC;AAEjF,eAAO,MAAM,iBAAiB,EAAE,uBAAuB,EA6BtD,CAAC"}
|
|
@@ -10,6 +10,7 @@ import historySearchExtension from "./history-search/index.js";
|
|
|
10
10
|
import hooksExtension from "./hooks/index.js";
|
|
11
11
|
import importReproExtension from "./import-repro.js";
|
|
12
12
|
import mcpExtension from "./mcp/index.js";
|
|
13
|
+
import modelFallbackExtension from "./model-fallback/index.js";
|
|
13
14
|
import nestedAgentsMdExtension from "./nested-agents-md/index.js";
|
|
14
15
|
import openaiWebSearchExtension from "./openai-web-search/index.js";
|
|
15
16
|
import permissionSystemExtension from "./permission-system/index.js";
|
|
@@ -23,6 +24,7 @@ import terminalExtension from "./terminal/index.js";
|
|
|
23
24
|
import todowriteExtension from "./todotools/index.js";
|
|
24
25
|
import toolPairGuardExtension from "./tool-pair-guard/index.js";
|
|
25
26
|
import tpsExtension from "./tps.js";
|
|
27
|
+
import videoInExtension from "./video-in/index.js";
|
|
26
28
|
import webfetchExtension from "./webfetch/index.js";
|
|
27
29
|
import websearchExtension from "./websearch/index.js";
|
|
28
30
|
export const globalDefaultExtensionIds = ["diff", "files", "prompt-url-widget", "tps"];
|
|
@@ -43,6 +45,7 @@ export const builtinExtensions = [
|
|
|
43
45
|
{ id: "anthropic-bash", factory: anthropicBashExtension },
|
|
44
46
|
{ id: "openai-web-search", factory: openaiWebSearchExtension },
|
|
45
47
|
{ id: "service-tier", factory: serviceTierExtension },
|
|
48
|
+
{ id: "model-fallback", factory: modelFallbackExtension },
|
|
46
49
|
{ id: "bash-timeout", factory: bashTimeoutExtension },
|
|
47
50
|
// Terminal follows bash-timeout so its injected default reaches the PTY bash, and follows
|
|
48
51
|
// anthropic-bash so mutual-exclusion (companion step-aside) is evaluated after it registers.
|
|
@@ -54,6 +57,7 @@ export const builtinExtensions = [
|
|
|
54
57
|
{ id: "session-observer", factory: sessionObserverExtension },
|
|
55
58
|
{ id: "websearch", factory: websearchExtension },
|
|
56
59
|
{ id: "webfetch", factory: webfetchExtension },
|
|
60
|
+
{ id: "video-in", factory: videoInExtension },
|
|
57
61
|
{ id: "nested-agents-md", factory: nestedAgentsMdExtension },
|
|
58
62
|
{ id: "rules", factory: piRulesExtension },
|
|
59
63
|
{ id: "goal", factory: goalExtension },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/extensions/builtin/index.ts"],"names":[],"mappings":"AACA,OAAO,sBAAsB,MAAM,2BAA2B,CAAC;AAC/D,OAAO,2BAA2B,MAAM,iCAAiC,CAAC;AAC1E,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAC3D,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,aAAa,MAAM,WAAW,CAAC;AACtC,OAAO,cAAc,MAAM,YAAY,CAAC;AACxC,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,sBAAsB,MAAM,4BAA4B,CAAC;AAChE,OAAO,sBAAsB,MAAM,2BAA2B,CAAC;AAC/D,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,oBAAoB,MAAM,mBAAmB,CAAC;AACrD,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AC","sourcesContent":["import type { ExtensionFactory } from \"../types.ts\";\nimport anthropicBashExtension from \"./anthropic-bash/index.ts\";\nimport anthropicWebSearchExtension from \"./anthropic-web-search/index.ts\";\nimport bashTimeoutExtension from \"./bash-timeout/index.ts\";\nimport compactionExtension from \"./compaction/index.ts\";\nimport diffExtension from \"./diff.ts\";\nimport filesExtension from \"./files.ts\";\nimport goalExtension from \"./goal/index.ts\";\nimport gptApplyPatchExtension from \"./gpt-apply-patch/index.ts\";\nimport historySearchExtension from \"./history-search/index.ts\";\nimport hooksExtension from \"./hooks/index.ts\";\nimport importReproExtension from \"./import-repro.ts\";\nimport mcpExtension from \"./mcp/index.ts\";\nimport nestedAgentsMdExtension from \"./nested-agents-md/index.ts\";\nimport openaiWebSearchExtension from \"./openai-web-search/index.ts\";\nimport permissionSystemExtension from \"./permission-system/index.ts\";\nimport promptPresetExtension from \"./prompt-preset/index.ts\";\nimport promptUrlWidgetExtension from \"./prompt-url-widget.ts\";\nimport redrawsExtension from \"./redraws.ts\";\nimport piRulesExtension from \"./rules/index.ts\";\nimport serviceTierExtension from \"./service-tier.ts\";\nimport sessionObserverExtension from \"./session-observer/index.ts\";\nimport terminalExtension from \"./terminal/index.ts\";\nimport todowriteExtension from \"./todotools/index.ts\";\nimport toolPairGuardExtension from \"./tool-pair-guard/index.ts\";\nimport tpsExtension from \"./tps.ts\";\nimport webfetchExtension from \"./webfetch/index.ts\";\nimport websearchExtension from \"./websearch/index.ts\";\n\nexport interface BuiltinExtensionFactory {\n\tid: string;\n\tfactory: ExtensionFactory;\n}\n\nexport const globalDefaultExtensionIds = [\"diff\", \"files\", \"prompt-url-widget\", \"tps\"] as const;\n\nexport const globalDefaultExtensionFactories = {\n\tdiff: diffExtension,\n\tfiles: filesExtension,\n\t\"prompt-url-widget\": promptUrlWidgetExtension,\n\ttps: tpsExtension,\n} satisfies Record<(typeof globalDefaultExtensionIds)[number], ExtensionFactory>;\n\nexport const builtinExtensions: BuiltinExtensionFactory[] = [\n\t{ id: \"hooks\", factory: hooksExtension },\n\t{ id: \"permission-system\", factory: permissionSystemExtension },\n\t{ id: \"gpt-apply-patch\", factory: gptApplyPatchExtension },\n\t{ id: \"prompt-preset\", factory: promptPresetExtension },\n\t{ id: \"todowrite\", factory: todowriteExtension },\n\t{ id: \"redraws\", factory: redrawsExtension },\n\t{ id: \"anthropic-web-search\", factory: anthropicWebSearchExtension },\n\t{ id: \"anthropic-bash\", factory: anthropicBashExtension },\n\t{ id: \"openai-web-search\", factory: openaiWebSearchExtension },\n\t{ id: \"service-tier\", factory: serviceTierExtension },\n\t{ id: \"bash-timeout\", factory: bashTimeoutExtension },\n\t// Terminal follows bash-timeout so its injected default reaches the PTY bash, and follows\n\t// anthropic-bash so mutual-exclusion (companion step-aside) is evaluated after it registers.\n\t{ id: \"terminal\", factory: terminalExtension },\n\t{ id: \"tool-pair-guard\", factory: toolPairGuardExtension },\n\t{ id: \"compaction\", factory: compactionExtension },\n\t{ id: \"history-search\", factory: historySearchExtension },\n\t{ id: \"import-repro\", factory: importReproExtension },\n\t{ id: \"session-observer\", factory: sessionObserverExtension },\n\t{ id: \"websearch\", factory: websearchExtension },\n\t{ id: \"webfetch\", factory: webfetchExtension },\n\t{ id: \"nested-agents-md\", factory: nestedAgentsMdExtension },\n\t{ id: \"rules\", factory: piRulesExtension },\n\t{ id: \"goal\", factory: goalExtension },\n\t// Keep MCP last so its eventual provider-payload tap observes all co-resident builtin mutations.\n\t{ id: \"mcp\", factory: mcpExtension },\n];\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/extensions/builtin/index.ts"],"names":[],"mappings":"AACA,OAAO,sBAAsB,MAAM,2BAA2B,CAAC;AAC/D,OAAO,2BAA2B,MAAM,iCAAiC,CAAC;AAC1E,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAC3D,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,aAAa,MAAM,WAAW,CAAC;AACtC,OAA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E,EAAE,WAAW,EAAE,OAAO,EAAE,kBAAkB,EAAE;IAChD,EAAE,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,iBAAiB,EAAE;IAC9C,EAAE,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,gBAAgB,EAAE;IAC7C,EAAE,EAAE,EAAE,kBAAkB,EAAE,OAAO,EAAE,uBAAuB,EAAE;IAC5D,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE;IAC1C,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE;IACtC,iGAAiG;IACjG,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE;CACpC,CAAC","sourcesContent":["import type { ExtensionFactory } from \"../types.ts\";\nimport anthropicBashExtension from \"./anthropic-bash/index.ts\";\nimport anthropicWebSearchExtension from \"./anthropic-web-search/index.ts\";\nimport bashTimeoutExtension from \"./bash-timeout/index.ts\";\nimport compactionExtension from \"./compaction/index.ts\";\nimport diffExtension from \"./diff.ts\";\nimport filesExtension from \"./files.ts\";\nimport goalExtension from \"./goal/index.ts\";\nimport gptApplyPatchExtension from \"./gpt-apply-patch/index.ts\";\nimport historySearchExtension from \"./history-search/index.ts\";\nimport hooksExtension from \"./hooks/index.ts\";\nimport importReproExtension from \"./import-repro.ts\";\nimport mcpExtension from \"./mcp/index.ts\";\nimport modelFallbackExtension from \"./model-fallback/index.ts\";\nimport nestedAgentsMdExtension from \"./nested-agents-md/index.ts\";\nimport openaiWebSearchExtension from \"./openai-web-search/index.ts\";\nimport permissionSystemExtension from \"./permission-system/index.ts\";\nimport promptPresetExtension from \"./prompt-preset/index.ts\";\nimport promptUrlWidgetExtension from \"./prompt-url-widget.ts\";\nimport redrawsExtension from \"./redraws.ts\";\nimport piRulesExtension from \"./rules/index.ts\";\nimport serviceTierExtension from \"./service-tier.ts\";\nimport sessionObserverExtension from \"./session-observer/index.ts\";\nimport terminalExtension from \"./terminal/index.ts\";\nimport todowriteExtension from \"./todotools/index.ts\";\nimport toolPairGuardExtension from \"./tool-pair-guard/index.ts\";\nimport tpsExtension from \"./tps.ts\";\nimport videoInExtension from \"./video-in/index.ts\";\nimport webfetchExtension from \"./webfetch/index.ts\";\nimport websearchExtension from \"./websearch/index.ts\";\n\nexport interface BuiltinExtensionFactory {\n\tid: string;\n\tfactory: ExtensionFactory;\n}\n\nexport const globalDefaultExtensionIds = [\"diff\", \"files\", \"prompt-url-widget\", \"tps\"] as const;\n\nexport const globalDefaultExtensionFactories = {\n\tdiff: diffExtension,\n\tfiles: filesExtension,\n\t\"prompt-url-widget\": promptUrlWidgetExtension,\n\ttps: tpsExtension,\n} satisfies Record<(typeof globalDefaultExtensionIds)[number], ExtensionFactory>;\n\nexport const builtinExtensions: BuiltinExtensionFactory[] = [\n\t{ id: \"hooks\", factory: hooksExtension },\n\t{ id: \"permission-system\", factory: permissionSystemExtension },\n\t{ id: \"gpt-apply-patch\", factory: gptApplyPatchExtension },\n\t{ id: \"prompt-preset\", factory: promptPresetExtension },\n\t{ id: \"todowrite\", factory: todowriteExtension },\n\t{ id: \"redraws\", factory: redrawsExtension },\n\t{ id: \"anthropic-web-search\", factory: anthropicWebSearchExtension },\n\t{ id: \"anthropic-bash\", factory: anthropicBashExtension },\n\t{ id: \"openai-web-search\", factory: openaiWebSearchExtension },\n\t{ id: \"service-tier\", factory: serviceTierExtension },\n\t{ id: \"model-fallback\", factory: modelFallbackExtension },\n\t{ id: \"bash-timeout\", factory: bashTimeoutExtension },\n\t// Terminal follows bash-timeout so its injected default reaches the PTY bash, and follows\n\t// anthropic-bash so mutual-exclusion (companion step-aside) is evaluated after it registers.\n\t{ id: \"terminal\", factory: terminalExtension },\n\t{ id: \"tool-pair-guard\", factory: toolPairGuardExtension },\n\t{ id: \"compaction\", factory: compactionExtension },\n\t{ id: \"history-search\", factory: historySearchExtension },\n\t{ id: \"import-repro\", factory: importReproExtension },\n\t{ id: \"session-observer\", factory: sessionObserverExtension },\n\t{ id: \"websearch\", factory: websearchExtension },\n\t{ id: \"webfetch\", factory: webfetchExtension },\n\t{ id: \"video-in\", factory: videoInExtension },\n\t{ id: \"nested-agents-md\", factory: nestedAgentsMdExtension },\n\t{ id: \"rules\", factory: piRulesExtension },\n\t{ id: \"goal\", factory: goalExtension },\n\t// Keep MCP last so its eventual provider-payload tap observes all co-resident builtin mutations.\n\t{ id: \"mcp\", factory: mcpExtension },\n];\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/model-fallback/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAA2B,MAAM,gBAAgB,CAAC;AAM5E,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CAWrE;AAiDD,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC"}
|