@greppleai/grip 0.0.0-stage → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/README.md +725 -2
- package/dist/bun/cli.d.ts +3 -0
- package/dist/bun/cli.d.ts.map +1 -0
- package/dist/bun/cli.js +11 -0
- package/dist/bun/cli.js.map +1 -0
- package/dist/bun/register-bedrock.d.ts +2 -0
- package/dist/bun/register-bedrock.d.ts.map +1 -0
- package/dist/bun/register-bedrock.js +4 -0
- package/dist/bun/register-bedrock.js.map +1 -0
- package/dist/bun/restore-sandbox-env.d.ts +13 -0
- package/dist/bun/restore-sandbox-env.d.ts.map +1 -0
- package/dist/bun/restore-sandbox-env.js +32 -0
- package/dist/bun/restore-sandbox-env.js.map +1 -0
- package/dist/cli/args.d.ts +70 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +441 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/config-selector.d.ts +14 -0
- package/dist/cli/config-selector.d.ts.map +1 -0
- package/dist/cli/config-selector.js +31 -0
- package/dist/cli/config-selector.js.map +1 -0
- package/dist/cli/file-processor.d.ts +15 -0
- package/dist/cli/file-processor.d.ts.map +1 -0
- package/dist/cli/file-processor.js +60 -0
- package/dist/cli/file-processor.js.map +1 -0
- package/dist/cli/initial-message.d.ts +18 -0
- package/dist/cli/initial-message.d.ts.map +1 -0
- package/dist/cli/initial-message.js +22 -0
- package/dist/cli/initial-message.js.map +1 -0
- package/dist/cli/list-models.d.ts +9 -0
- package/dist/cli/list-models.d.ts.map +1 -0
- package/dist/cli/list-models.js +98 -0
- package/dist/cli/list-models.js.map +1 -0
- package/dist/cli/session-picker.d.ts +9 -0
- package/dist/cli/session-picker.d.ts.map +1 -0
- package/dist/cli/session-picker.js +35 -0
- package/dist/cli/session-picker.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +14 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +82 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +406 -0
- package/dist/config.js.map +1 -0
- package/dist/core/agent-session.d.ts +970 -0
- package/dist/core/agent-session.d.ts.map +1 -0
- package/dist/core/agent-session.js +5176 -0
- package/dist/core/agent-session.js.map +1 -0
- package/dist/core/auth-guidance.d.ts +5 -0
- package/dist/core/auth-guidance.d.ts.map +1 -0
- package/dist/core/auth-guidance.js +21 -0
- package/dist/core/auth-guidance.js.map +1 -0
- package/dist/core/auth-storage.d.ts +150 -0
- package/dist/core/auth-storage.d.ts.map +1 -0
- package/dist/core/auth-storage.js +557 -0
- package/dist/core/auth-storage.js.map +1 -0
- package/dist/core/bash-executor.d.ts +26 -0
- package/dist/core/bash-executor.d.ts.map +1 -0
- package/dist/core/bash-executor.js +99 -0
- package/dist/core/bash-executor.js.map +1 -0
- package/dist/core/compaction/branch-summarization.d.ts +83 -0
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -0
- package/dist/core/compaction/branch-summarization.js +220 -0
- package/dist/core/compaction/branch-summarization.js.map +1 -0
- package/dist/core/compaction/compaction.d.ts +65 -0
- package/dist/core/compaction/compaction.d.ts.map +1 -0
- package/dist/core/compaction/compaction.js +550 -0
- package/dist/core/compaction/compaction.js.map +1 -0
- package/dist/core/compaction/compression-detection-ledger.d.ts +34 -0
- package/dist/core/compaction/compression-detection-ledger.d.ts.map +1 -0
- package/dist/core/compaction/compression-detection-ledger.js +52 -0
- package/dist/core/compaction/compression-detection-ledger.js.map +1 -0
- package/dist/core/compaction/compression-detector.d.ts +71 -0
- package/dist/core/compaction/compression-detector.d.ts.map +1 -0
- package/dist/core/compaction/compression-detector.js +407 -0
- package/dist/core/compaction/compression-detector.js.map +1 -0
- package/dist/core/compaction/compression-economics.d.ts +55 -0
- package/dist/core/compaction/compression-economics.d.ts.map +1 -0
- package/dist/core/compaction/compression-economics.js +151 -0
- package/dist/core/compaction/compression-economics.js.map +1 -0
- package/dist/core/compaction/utils.d.ts +28 -0
- package/dist/core/compaction/utils.d.ts.map +1 -0
- package/dist/core/compaction/utils.js +165 -0
- package/dist/core/compaction/utils.js.map +1 -0
- package/dist/core/defaults.d.ts +3 -0
- package/dist/core/defaults.d.ts.map +1 -0
- package/dist/core/defaults.js +2 -0
- package/dist/core/defaults.js.map +1 -0
- package/dist/core/diagnostics.d.ts +18 -0
- package/dist/core/diagnostics.d.ts.map +1 -0
- package/dist/core/diagnostics.js +2 -0
- package/dist/core/diagnostics.js.map +1 -0
- package/dist/core/event-bus.d.ts +9 -0
- package/dist/core/event-bus.d.ts.map +1 -0
- package/dist/core/event-bus.js +25 -0
- package/dist/core/event-bus.js.map +1 -0
- package/dist/core/exec.d.ts +29 -0
- package/dist/core/exec.d.ts.map +1 -0
- package/dist/core/exec.js +75 -0
- package/dist/core/exec.js.map +1 -0
- package/dist/core/export-html/ansi-to-html.d.ts +22 -0
- package/dist/core/export-html/ansi-to-html.d.ts.map +1 -0
- package/dist/core/export-html/ansi-to-html.js +245 -0
- package/dist/core/export-html/ansi-to-html.js.map +1 -0
- package/dist/core/export-html/index.d.ts +21 -0
- package/dist/core/export-html/index.d.ts.map +1 -0
- package/dist/core/export-html/index.js +230 -0
- package/dist/core/export-html/index.js.map +1 -0
- package/dist/core/export-html/template.css +1066 -0
- package/dist/core/export-html/template.html +55 -0
- package/dist/core/export-html/template.js +1864 -0
- package/dist/core/export-html/tool-renderer.d.ts +32 -0
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -0
- package/dist/core/export-html/tool-renderer.js +108 -0
- package/dist/core/export-html/tool-renderer.js.map +1 -0
- package/dist/core/export-html/vendor/highlight.min.js +1213 -0
- package/dist/core/export-html/vendor/marked.min.js +78 -0
- package/dist/core/extensions/loader.d.ts +24 -0
- package/dist/core/extensions/loader.d.ts.map +1 -0
- package/dist/core/extensions/loader.js +613 -0
- package/dist/core/extensions/loader.js.map +1 -0
- package/dist/core/extensions/runner.d.ts +160 -0
- package/dist/core/extensions/runner.d.ts.map +1 -0
- package/dist/core/extensions/runner.js +962 -0
- package/dist/core/extensions/runner.js.map +1 -0
- package/dist/core/extensions/types.d.ts +1311 -0
- package/dist/core/extensions/types.d.ts.map +1 -0
- package/dist/core/extensions/types.js +51 -0
- package/dist/core/extensions/types.js.map +1 -0
- package/dist/core/extensions/wrapper.d.ts +20 -0
- package/dist/core/extensions/wrapper.d.ts.map +1 -0
- package/dist/core/extensions/wrapper.js +22 -0
- package/dist/core/extensions/wrapper.js.map +1 -0
- package/dist/core/footer-data-provider.d.ts +52 -0
- package/dist/core/footer-data-provider.d.ts.map +1 -0
- package/dist/core/footer-data-provider.js +318 -0
- package/dist/core/footer-data-provider.js.map +1 -0
- package/dist/core/grip-agent.d.ts +240 -0
- package/dist/core/grip-agent.d.ts.map +1 -0
- package/dist/core/grip-agent.js +1243 -0
- package/dist/core/grip-agent.js.map +1 -0
- package/dist/core/grip-manifest.d.ts +9 -0
- package/dist/core/grip-manifest.d.ts.map +1 -0
- package/dist/core/grip-manifest.js +25 -0
- package/dist/core/grip-manifest.js.map +1 -0
- package/dist/core/hooks/aggregate.d.ts +5 -0
- package/dist/core/hooks/aggregate.d.ts.map +1 -0
- package/dist/core/hooks/aggregate.js +226 -0
- package/dist/core/hooks/aggregate.js.map +1 -0
- package/dist/core/hooks/config.d.ts +14 -0
- package/dist/core/hooks/config.d.ts.map +1 -0
- package/dist/core/hooks/config.js +372 -0
- package/dist/core/hooks/config.js.map +1 -0
- package/dist/core/hooks/executor.d.ts +12 -0
- package/dist/core/hooks/executor.d.ts.map +1 -0
- package/dist/core/hooks/executor.js +708 -0
- package/dist/core/hooks/executor.js.map +1 -0
- package/dist/core/hooks/index.d.ts +9 -0
- package/dist/core/hooks/index.d.ts.map +1 -0
- package/dist/core/hooks/index.js +14 -0
- package/dist/core/hooks/index.js.map +1 -0
- package/dist/core/hooks/matcher.d.ts +10 -0
- package/dist/core/hooks/matcher.d.ts.map +1 -0
- package/dist/core/hooks/matcher.js +70 -0
- package/dist/core/hooks/matcher.js.map +1 -0
- package/dist/core/hooks/trust-store.d.ts +38 -0
- package/dist/core/hooks/trust-store.d.ts.map +1 -0
- package/dist/core/hooks/trust-store.js +167 -0
- package/dist/core/hooks/trust-store.js.map +1 -0
- package/dist/core/hooks/types.d.ts +234 -0
- package/dist/core/hooks/types.d.ts.map +1 -0
- package/dist/core/hooks/types.js +52 -0
- package/dist/core/hooks/types.js.map +1 -0
- package/dist/core/http-dispatcher.d.ts +21 -0
- package/dist/core/http-dispatcher.d.ts.map +1 -0
- package/dist/core/http-dispatcher.js +82 -0
- package/dist/core/http-dispatcher.js.map +1 -0
- package/dist/core/instruction-resource-loader.d.ts +81 -0
- package/dist/core/instruction-resource-loader.d.ts.map +1 -0
- package/dist/core/instruction-resource-loader.js +574 -0
- package/dist/core/instruction-resource-loader.js.map +1 -0
- package/dist/core/keybindings.d.ts +399 -0
- package/dist/core/keybindings.d.ts.map +1 -0
- package/dist/core/keybindings.js +299 -0
- package/dist/core/keybindings.js.map +1 -0
- package/dist/core/lsp/abort.d.ts +3 -0
- package/dist/core/lsp/abort.d.ts.map +1 -0
- package/dist/core/lsp/abort.js +28 -0
- package/dist/core/lsp/abort.js.map +1 -0
- package/dist/core/lsp/client.d.ts +108 -0
- package/dist/core/lsp/client.d.ts.map +1 -0
- package/dist/core/lsp/client.js +586 -0
- package/dist/core/lsp/client.js.map +1 -0
- package/dist/core/lsp/config-loader.d.ts +44 -0
- package/dist/core/lsp/config-loader.d.ts.map +1 -0
- package/dist/core/lsp/config-loader.js +223 -0
- package/dist/core/lsp/config-loader.js.map +1 -0
- package/dist/core/lsp/config.d.ts +134 -0
- package/dist/core/lsp/config.d.ts.map +1 -0
- package/dist/core/lsp/config.js +682 -0
- package/dist/core/lsp/config.js.map +1 -0
- package/dist/core/lsp/diagnostics.d.ts +18 -0
- package/dist/core/lsp/diagnostics.d.ts.map +1 -0
- package/dist/core/lsp/diagnostics.js +311 -0
- package/dist/core/lsp/diagnostics.js.map +1 -0
- package/dist/core/lsp/file-sync.d.ts +58 -0
- package/dist/core/lsp/file-sync.d.ts.map +1 -0
- package/dist/core/lsp/file-sync.js +432 -0
- package/dist/core/lsp/file-sync.js.map +1 -0
- package/dist/core/lsp/integration.d.ts +62 -0
- package/dist/core/lsp/integration.d.ts.map +1 -0
- package/dist/core/lsp/integration.js +145 -0
- package/dist/core/lsp/integration.js.map +1 -0
- package/dist/core/lsp/language-map.d.ts +54 -0
- package/dist/core/lsp/language-map.d.ts.map +1 -0
- package/dist/core/lsp/language-map.js +300 -0
- package/dist/core/lsp/language-map.js.map +1 -0
- package/dist/core/lsp/manager.d.ts +120 -0
- package/dist/core/lsp/manager.d.ts.map +1 -0
- package/dist/core/lsp/manager.js +636 -0
- package/dist/core/lsp/manager.js.map +1 -0
- package/dist/core/lsp/navigation.d.ts +32 -0
- package/dist/core/lsp/navigation.d.ts.map +1 -0
- package/dist/core/lsp/navigation.js +327 -0
- package/dist/core/lsp/navigation.js.map +1 -0
- package/dist/core/lsp/portable-path.d.ts +18 -0
- package/dist/core/lsp/portable-path.d.ts.map +1 -0
- package/dist/core/lsp/portable-path.js +83 -0
- package/dist/core/lsp/portable-path.js.map +1 -0
- package/dist/core/lsp/refactor.d.ts +32 -0
- package/dist/core/lsp/refactor.d.ts.map +1 -0
- package/dist/core/lsp/refactor.js +519 -0
- package/dist/core/lsp/refactor.js.map +1 -0
- package/dist/core/lsp/transport.d.ts +39 -0
- package/dist/core/lsp/transport.d.ts.map +1 -0
- package/dist/core/lsp/transport.js +261 -0
- package/dist/core/lsp/transport.js.map +1 -0
- package/dist/core/messages.d.ts +34 -0
- package/dist/core/messages.d.ts.map +1 -0
- package/dist/core/messages.js +140 -0
- package/dist/core/messages.js.map +1 -0
- package/dist/core/model-registry.d.ts +148 -0
- package/dist/core/model-registry.d.ts.map +1 -0
- package/dist/core/model-registry.js +812 -0
- package/dist/core/model-registry.js.map +1 -0
- package/dist/core/model-resolver.d.ts +115 -0
- package/dist/core/model-resolver.d.ts.map +1 -0
- package/dist/core/model-resolver.js +498 -0
- package/dist/core/model-resolver.js.map +1 -0
- package/dist/core/output-guard.d.ts +7 -0
- package/dist/core/output-guard.d.ts.map +1 -0
- package/dist/core/output-guard.js +89 -0
- package/dist/core/output-guard.js.map +1 -0
- package/dist/core/package-manager.d.ts +209 -0
- package/dist/core/package-manager.d.ts.map +1 -0
- package/dist/core/package-manager.js +2341 -0
- package/dist/core/package-manager.js.map +1 -0
- package/dist/core/prompt-templates.d.ts +57 -0
- package/dist/core/prompt-templates.d.ts.map +1 -0
- package/dist/core/prompt-templates.js +353 -0
- package/dist/core/prompt-templates.js.map +1 -0
- package/dist/core/provider-display-names.d.ts +2 -0
- package/dist/core/provider-display-names.d.ts.map +1 -0
- package/dist/core/provider-display-names.js +33 -0
- package/dist/core/provider-display-names.js.map +1 -0
- package/dist/core/remote-workspace-protocol/contract.d.ts +456 -0
- package/dist/core/remote-workspace-protocol/contract.d.ts.map +1 -0
- package/dist/core/remote-workspace-protocol/contract.js +809 -0
- package/dist/core/remote-workspace-protocol/contract.js.map +1 -0
- package/dist/core/remote-workspace-protocol/session.d.ts +247 -0
- package/dist/core/remote-workspace-protocol/session.d.ts.map +1 -0
- package/dist/core/remote-workspace-protocol/session.js +1839 -0
- package/dist/core/remote-workspace-protocol/session.js.map +1 -0
- package/dist/core/resolve-config-value.d.ts +32 -0
- package/dist/core/resolve-config-value.d.ts.map +1 -0
- package/dist/core/resolve-config-value.js +257 -0
- package/dist/core/resolve-config-value.js.map +1 -0
- package/dist/core/resource-loader.d.ts +200 -0
- package/dist/core/resource-loader.d.ts.map +1 -0
- package/dist/core/resource-loader.js +1209 -0
- package/dist/core/resource-loader.js.map +1 -0
- package/dist/core/rules.d.ts +40 -0
- package/dist/core/rules.d.ts.map +1 -0
- package/dist/core/rules.js +57 -0
- package/dist/core/rules.js.map +1 -0
- package/dist/core/sandbox/command.d.ts +27 -0
- package/dist/core/sandbox/command.d.ts.map +1 -0
- package/dist/core/sandbox/command.js +124 -0
- package/dist/core/sandbox/command.js.map +1 -0
- package/dist/core/sandbox/docker.d.ts +169 -0
- package/dist/core/sandbox/docker.d.ts.map +1 -0
- package/dist/core/sandbox/docker.js +633 -0
- package/dist/core/sandbox/docker.js.map +1 -0
- package/dist/core/sandbox/lima.d.ts +38 -0
- package/dist/core/sandbox/lima.d.ts.map +1 -0
- package/dist/core/sandbox/lima.js +324 -0
- package/dist/core/sandbox/lima.js.map +1 -0
- package/dist/core/session/constants.d.ts +2 -0
- package/dist/core/session/constants.d.ts.map +1 -0
- package/dist/core/session/constants.js +2 -0
- package/dist/core/session/constants.js.map +1 -0
- package/dist/core/session/context-metadata.d.ts +5 -0
- package/dist/core/session/context-metadata.d.ts.map +1 -0
- package/dist/core/session/context-metadata.js +55 -0
- package/dist/core/session/context-metadata.js.map +1 -0
- package/dist/core/session/context.d.ts +14 -0
- package/dist/core/session/context.d.ts.map +1 -0
- package/dist/core/session/context.js +117 -0
- package/dist/core/session/context.js.map +1 -0
- package/dist/core/session/ids.d.ts +9 -0
- package/dist/core/session/ids.d.ts.map +1 -0
- package/dist/core/session/ids.js +21 -0
- package/dist/core/session/ids.js.map +1 -0
- package/dist/core/session/in-memory-session-manager.d.ts +17 -0
- package/dist/core/session/in-memory-session-manager.d.ts.map +1 -0
- package/dist/core/session/in-memory-session-manager.js +40 -0
- package/dist/core/session/in-memory-session-manager.js.map +1 -0
- package/dist/core/session/in-memory-session.d.ts +7 -0
- package/dist/core/session/in-memory-session.d.ts.map +1 -0
- package/dist/core/session/in-memory-session.js +11 -0
- package/dist/core/session/in-memory-session.js.map +1 -0
- package/dist/core/session/jsonl-errors.d.ts +36 -0
- package/dist/core/session/jsonl-errors.d.ts.map +1 -0
- package/dist/core/session/jsonl-errors.js +49 -0
- package/dist/core/session/jsonl-errors.js.map +1 -0
- package/dist/core/session/jsonl-helpers.d.ts +20 -0
- package/dist/core/session/jsonl-helpers.d.ts.map +1 -0
- package/dist/core/session/jsonl-helpers.js +21 -0
- package/dist/core/session/jsonl-helpers.js.map +1 -0
- package/dist/core/session/local-session-manager.d.ts +30 -0
- package/dist/core/session/local-session-manager.d.ts.map +1 -0
- package/dist/core/session/local-session-manager.js +205 -0
- package/dist/core/session/local-session-manager.js.map +1 -0
- package/dist/core/session/local-session.d.ts +9 -0
- package/dist/core/session/local-session.d.ts.map +1 -0
- package/dist/core/session/local-session.js +15 -0
- package/dist/core/session/local-session.js.map +1 -0
- package/dist/core/session/migrations.d.ts +11 -0
- package/dist/core/session/migrations.d.ts.map +1 -0
- package/dist/core/session/migrations.js +78 -0
- package/dist/core/session/migrations.js.map +1 -0
- package/dist/core/session/remote-session-client.d.ts +83 -0
- package/dist/core/session/remote-session-client.d.ts.map +1 -0
- package/dist/core/session/remote-session-client.js +224 -0
- package/dist/core/session/remote-session-client.js.map +1 -0
- package/dist/core/session/remote-session-manager.d.ts +32 -0
- package/dist/core/session/remote-session-manager.d.ts.map +1 -0
- package/dist/core/session/remote-session-manager.js +124 -0
- package/dist/core/session/remote-session-manager.js.map +1 -0
- package/dist/core/session/remote-session.d.ts +20 -0
- package/dist/core/session/remote-session.d.ts.map +1 -0
- package/dist/core/session/remote-session.js +33 -0
- package/dist/core/session/remote-session.js.map +1 -0
- package/dist/core/session/session-manager.d.ts +18 -0
- package/dist/core/session/session-manager.d.ts.map +1 -0
- package/dist/core/session/session-manager.js +2 -0
- package/dist/core/session/session-manager.js.map +1 -0
- package/dist/core/session/session.d.ts +140 -0
- package/dist/core/session/session.d.ts.map +1 -0
- package/dist/core/session/session.js +461 -0
- package/dist/core/session/session.js.map +1 -0
- package/dist/core/session/stores/in-memory-session-store.d.ts +39 -0
- package/dist/core/session/stores/in-memory-session-store.d.ts.map +1 -0
- package/dist/core/session/stores/in-memory-session-store.js +168 -0
- package/dist/core/session/stores/in-memory-session-store.js.map +1 -0
- package/dist/core/session/stores/jsonl-session-store.d.ts +97 -0
- package/dist/core/session/stores/jsonl-session-store.d.ts.map +1 -0
- package/dist/core/session/stores/jsonl-session-store.js +1140 -0
- package/dist/core/session/stores/jsonl-session-store.js.map +1 -0
- package/dist/core/session/stores/remote-session-store.d.ts +44 -0
- package/dist/core/session/stores/remote-session-store.d.ts.map +1 -0
- package/dist/core/session/stores/remote-session-store.js +159 -0
- package/dist/core/session/stores/remote-session-store.js.map +1 -0
- package/dist/core/session/stores/session-store.d.ts +42 -0
- package/dist/core/session/stores/session-store.d.ts.map +1 -0
- package/dist/core/session/stores/session-store.js +2 -0
- package/dist/core/session/stores/session-store.js.map +1 -0
- package/dist/core/session/types.d.ts +141 -0
- package/dist/core/session/types.d.ts.map +1 -0
- package/dist/core/session/types.js +2 -0
- package/dist/core/session/types.js.map +1 -0
- package/dist/core/session/usage-ledger.d.ts +18 -0
- package/dist/core/session/usage-ledger.d.ts.map +1 -0
- package/dist/core/session/usage-ledger.js +68 -0
- package/dist/core/session/usage-ledger.js.map +1 -0
- package/dist/core/session-cwd.d.ts +19 -0
- package/dist/core/session-cwd.d.ts.map +1 -0
- package/dist/core/session-cwd.js +38 -0
- package/dist/core/session-cwd.js.map +1 -0
- package/dist/core/settings-manager.d.ts +318 -0
- package/dist/core/settings-manager.d.ts.map +1 -0
- package/dist/core/settings-manager.js +991 -0
- package/dist/core/settings-manager.js.map +1 -0
- package/dist/core/skills.d.ts +40 -0
- package/dist/core/skills.d.ts.map +1 -0
- package/dist/core/skills.js +57 -0
- package/dist/core/skills.js.map +1 -0
- package/dist/core/slash-commands.d.ts +15 -0
- package/dist/core/slash-commands.d.ts.map +1 -0
- package/dist/core/slash-commands.js +36 -0
- package/dist/core/slash-commands.js.map +1 -0
- package/dist/core/source-info.d.ts +26 -0
- package/dist/core/source-info.d.ts.map +1 -0
- package/dist/core/source-info.js +27 -0
- package/dist/core/source-info.js.map +1 -0
- package/dist/core/system-prompt.d.ts +32 -0
- package/dist/core/system-prompt.d.ts.map +1 -0
- package/dist/core/system-prompt.js +131 -0
- package/dist/core/system-prompt.js.map +1 -0
- package/dist/core/telemetry.d.ts +3 -0
- package/dist/core/telemetry.d.ts.map +1 -0
- package/dist/core/telemetry.js +9 -0
- package/dist/core/telemetry.js.map +1 -0
- package/dist/core/timings.d.ts +10 -0
- package/dist/core/timings.d.ts.map +1 -0
- package/dist/core/timings.js +41 -0
- package/dist/core/timings.js.map +1 -0
- package/dist/core/tools/bash.d.ts +51 -0
- package/dist/core/tools/bash.d.ts.map +1 -0
- package/dist/core/tools/bash.js +310 -0
- package/dist/core/tools/bash.js.map +1 -0
- package/dist/core/tools/compress-context.d.ts +27 -0
- package/dist/core/tools/compress-context.d.ts.map +1 -0
- package/dist/core/tools/compress-context.js +142 -0
- package/dist/core/tools/compress-context.js.map +1 -0
- package/dist/core/tools/edit-diff.d.ts +82 -0
- package/dist/core/tools/edit-diff.d.ts.map +1 -0
- package/dist/core/tools/edit-diff.js +327 -0
- package/dist/core/tools/edit-diff.js.map +1 -0
- package/dist/core/tools/edit.d.ts +50 -0
- package/dist/core/tools/edit.d.ts.map +1 -0
- package/dist/core/tools/edit.js +324 -0
- package/dist/core/tools/edit.js.map +1 -0
- package/dist/core/tools/file-mutation-queue.d.ts +6 -0
- package/dist/core/tools/file-mutation-queue.d.ts.map +1 -0
- package/dist/core/tools/file-mutation-queue.js +60 -0
- package/dist/core/tools/file-mutation-queue.js.map +1 -0
- package/dist/core/tools/find.d.ts +22 -0
- package/dist/core/tools/find.d.ts.map +1 -0
- package/dist/core/tools/find.js +268 -0
- package/dist/core/tools/find.js.map +1 -0
- package/dist/core/tools/grep.d.ts +27 -0
- package/dist/core/tools/grep.d.ts.map +1 -0
- package/dist/core/tools/grep.js +332 -0
- package/dist/core/tools/grep.js.map +1 -0
- package/dist/core/tools/hash-store.d.ts +12 -0
- package/dist/core/tools/hash-store.d.ts.map +1 -0
- package/dist/core/tools/hash-store.js +48 -0
- package/dist/core/tools/hash-store.js.map +1 -0
- package/dist/core/tools/hashline/apply.d.ts +40 -0
- package/dist/core/tools/hashline/apply.d.ts.map +1 -0
- package/dist/core/tools/hashline/apply.js +261 -0
- package/dist/core/tools/hashline/apply.js.map +1 -0
- package/dist/core/tools/hashline/hash.d.ts +56 -0
- package/dist/core/tools/hashline/hash.d.ts.map +1 -0
- package/dist/core/tools/hashline/hash.js +196 -0
- package/dist/core/tools/hashline/hash.js.map +1 -0
- package/dist/core/tools/hashline/parse.d.ts +8 -0
- package/dist/core/tools/hashline/parse.d.ts.map +1 -0
- package/dist/core/tools/hashline/parse.js +41 -0
- package/dist/core/tools/hashline/parse.js.map +1 -0
- package/dist/core/tools/hashline/resolve.d.ts +51 -0
- package/dist/core/tools/hashline/resolve.d.ts.map +1 -0
- package/dist/core/tools/hashline/resolve.js +187 -0
- package/dist/core/tools/hashline/resolve.js.map +1 -0
- package/dist/core/tools/hashline-utils.d.ts +6 -0
- package/dist/core/tools/hashline-utils.d.ts.map +1 -0
- package/dist/core/tools/hashline-utils.js +23 -0
- package/dist/core/tools/hashline-utils.js.map +1 -0
- package/dist/core/tools/index.d.ts +36 -0
- package/dist/core/tools/index.d.ts.map +1 -0
- package/dist/core/tools/index.js +141 -0
- package/dist/core/tools/index.js.map +1 -0
- package/dist/core/tools/ls.d.ts +21 -0
- package/dist/core/tools/ls.d.ts.map +1 -0
- package/dist/core/tools/ls.js +156 -0
- package/dist/core/tools/ls.js.map +1 -0
- package/dist/core/tools/operations.d.ts +201 -0
- package/dist/core/tools/operations.d.ts.map +1 -0
- package/dist/core/tools/operations.js +697 -0
- package/dist/core/tools/operations.js.map +1 -0
- package/dist/core/tools/output-accumulator.d.ts +54 -0
- package/dist/core/tools/output-accumulator.d.ts.map +1 -0
- package/dist/core/tools/output-accumulator.js +184 -0
- package/dist/core/tools/output-accumulator.js.map +1 -0
- package/dist/core/tools/path-utils.d.ts +9 -0
- package/dist/core/tools/path-utils.d.ts.map +1 -0
- package/dist/core/tools/path-utils.js +99 -0
- package/dist/core/tools/path-utils.js.map +1 -0
- package/dist/core/tools/read.d.ts +32 -0
- package/dist/core/tools/read.d.ts.map +1 -0
- package/dist/core/tools/read.js +318 -0
- package/dist/core/tools/read.js.map +1 -0
- package/dist/core/tools/render-utils.d.ts +33 -0
- package/dist/core/tools/render-utils.d.ts.map +1 -0
- package/dist/core/tools/render-utils.js +61 -0
- package/dist/core/tools/render-utils.js.map +1 -0
- package/dist/core/tools/replace-diff.d.ts +16 -0
- package/dist/core/tools/replace-diff.d.ts.map +1 -0
- package/dist/core/tools/replace-diff.js +117 -0
- package/dist/core/tools/replace-diff.js.map +1 -0
- package/dist/core/tools/replace-normalize.d.ts +2 -0
- package/dist/core/tools/replace-normalize.d.ts.map +1 -0
- package/dist/core/tools/replace-normalize.js +73 -0
- package/dist/core/tools/replace-normalize.js.map +1 -0
- package/dist/core/tools/replace-render.d.ts +51 -0
- package/dist/core/tools/replace-render.d.ts.map +1 -0
- package/dist/core/tools/replace-render.js +162 -0
- package/dist/core/tools/replace-render.js.map +1 -0
- package/dist/core/tools/runtime.d.ts +2 -0
- package/dist/core/tools/runtime.d.ts.map +1 -0
- package/dist/core/tools/runtime.js +6 -0
- package/dist/core/tools/runtime.js.map +1 -0
- package/dist/core/tools/session-history.d.ts +55 -0
- package/dist/core/tools/session-history.d.ts.map +1 -0
- package/dist/core/tools/session-history.js +649 -0
- package/dist/core/tools/session-history.js.map +1 -0
- package/dist/core/tools/subagent-agents.d.ts +29 -0
- package/dist/core/tools/subagent-agents.d.ts.map +1 -0
- package/dist/core/tools/subagent-agents.js +223 -0
- package/dist/core/tools/subagent-agents.js.map +1 -0
- package/dist/core/tools/subagent.d.ts +185 -0
- package/dist/core/tools/subagent.d.ts.map +1 -0
- package/dist/core/tools/subagent.js +1309 -0
- package/dist/core/tools/subagent.js.map +1 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts +14 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -0
- package/dist/core/tools/tool-definition-wrapper.js +34 -0
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -0
- package/dist/core/tools/truncate.d.ts +39 -0
- package/dist/core/tools/truncate.d.ts.map +1 -0
- package/dist/core/tools/truncate.js +215 -0
- package/dist/core/tools/truncate.js.map +1 -0
- package/dist/core/tools/websearch.d.ts +33 -0
- package/dist/core/tools/websearch.d.ts.map +1 -0
- package/dist/core/tools/websearch.js +341 -0
- package/dist/core/tools/websearch.js.map +1 -0
- package/dist/core/tools/workspace-tool-host.d.ts +102 -0
- package/dist/core/tools/workspace-tool-host.d.ts.map +1 -0
- package/dist/core/tools/workspace-tool-host.js +348 -0
- package/dist/core/tools/workspace-tool-host.js.map +1 -0
- package/dist/core/tools/write.d.ts +16 -0
- package/dist/core/tools/write.d.ts.map +1 -0
- package/dist/core/tools/write.js +204 -0
- package/dist/core/tools/write.js.map +1 -0
- package/dist/core/workspace-identity.d.ts +7 -0
- package/dist/core/workspace-identity.d.ts.map +1 -0
- package/dist/core/workspace-identity.js +2 -0
- package/dist/core/workspace-identity.js.map +1 -0
- package/dist/daemon/command.d.ts +6 -0
- package/dist/daemon/command.d.ts.map +1 -0
- package/dist/daemon/command.js +58 -0
- package/dist/daemon/command.js.map +1 -0
- package/dist/daemon/config.d.ts +43 -0
- package/dist/daemon/config.d.ts.map +1 -0
- package/dist/daemon/config.js +304 -0
- package/dist/daemon/config.js.map +1 -0
- package/dist/daemon/help.d.ts +2 -0
- package/dist/daemon/help.d.ts.map +1 -0
- package/dist/daemon/help.js +42 -0
- package/dist/daemon/help.js.map +1 -0
- package/dist/daemon/lsp-config.d.ts +4 -0
- package/dist/daemon/lsp-config.d.ts.map +1 -0
- package/dist/daemon/lsp-config.js +155 -0
- package/dist/daemon/lsp-config.js.map +1 -0
- package/dist/daemon/security.d.ts +19 -0
- package/dist/daemon/security.d.ts.map +1 -0
- package/dist/daemon/security.js +175 -0
- package/dist/daemon/security.js.map +1 -0
- package/dist/daemon/server.d.ts +20 -0
- package/dist/daemon/server.d.ts.map +1 -0
- package/dist/daemon/server.js +400 -0
- package/dist/daemon/server.js.map +1 -0
- package/dist/daemon/workspace-runtime.d.ts +46 -0
- package/dist/daemon/workspace-runtime.d.ts.map +1 -0
- package/dist/daemon/workspace-runtime.js +673 -0
- package/dist/daemon/workspace-runtime.js.map +1 -0
- package/dist/index.d.ts +109 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +107 -0
- package/dist/index.js.map +1 -0
- package/dist/main.d.ts +39 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +763 -0
- package/dist/main.js.map +1 -0
- package/dist/migrations.d.ts +35 -0
- package/dist/migrations.d.ts.map +1 -0
- package/dist/migrations.js +412 -0
- package/dist/migrations.js.map +1 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +29 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/assistant-message.js +149 -0
- package/dist/modes/interactive/components/assistant-message.js.map +1 -0
- package/dist/modes/interactive/components/bash-execution.d.ts +36 -0
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -0
- package/dist/modes/interactive/components/bash-execution.js +173 -0
- package/dist/modes/interactive/components/bash-execution.js.map +1 -0
- package/dist/modes/interactive/components/bordered-loader.d.ts +18 -0
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -0
- package/dist/modes/interactive/components/bordered-loader.js +54 -0
- package/dist/modes/interactive/components/bordered-loader.js.map +1 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts +16 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/branch-summary-message.js +44 -0
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -0
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +16 -0
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/compaction-summary-message.js +45 -0
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -0
- package/dist/modes/interactive/components/config-selector.d.ts +74 -0
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/config-selector.js +514 -0
- package/dist/modes/interactive/components/config-selector.js.map +1 -0
- package/dist/modes/interactive/components/countdown-timer.d.ts +14 -0
- package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -0
- package/dist/modes/interactive/components/countdown-timer.js +33 -0
- package/dist/modes/interactive/components/countdown-timer.js.map +1 -0
- package/dist/modes/interactive/components/custom-editor.d.ts +25 -0
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -0
- package/dist/modes/interactive/components/custom-editor.js +85 -0
- package/dist/modes/interactive/components/custom-editor.js.map +1 -0
- package/dist/modes/interactive/components/custom-message.d.ts +20 -0
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/custom-message.js +80 -0
- package/dist/modes/interactive/components/custom-message.js.map +1 -0
- package/dist/modes/interactive/components/diff.d.ts +12 -0
- package/dist/modes/interactive/components/diff.d.ts.map +1 -0
- package/dist/modes/interactive/components/diff.js +118 -0
- package/dist/modes/interactive/components/diff.js.map +1 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts +15 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -0
- package/dist/modes/interactive/components/dynamic-border.js +21 -0
- package/dist/modes/interactive/components/dynamic-border.js.map +1 -0
- package/dist/modes/interactive/components/extension-editor.d.ts +22 -0
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-editor.js +128 -0
- package/dist/modes/interactive/components/extension-editor.js.map +1 -0
- package/dist/modes/interactive/components/extension-input.d.ts +23 -0
- package/dist/modes/interactive/components/extension-input.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-input.js +61 -0
- package/dist/modes/interactive/components/extension-input.js.map +1 -0
- package/dist/modes/interactive/components/extension-selector.d.ts +26 -0
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-selector.js +83 -0
- package/dist/modes/interactive/components/extension-selector.js.map +1 -0
- package/dist/modes/interactive/components/footer.d.ts +36 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -0
- package/dist/modes/interactive/components/footer.js +227 -0
- package/dist/modes/interactive/components/footer.js.map +1 -0
- package/dist/modes/interactive/components/hook-execution.d.ts +19 -0
- package/dist/modes/interactive/components/hook-execution.d.ts.map +1 -0
- package/dist/modes/interactive/components/hook-execution.js +184 -0
- package/dist/modes/interactive/components/hook-execution.js.map +1 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts +13 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -0
- package/dist/modes/interactive/components/keybinding-hints.js +36 -0
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -0
- package/dist/modes/interactive/components/login-dialog.d.ts +55 -0
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -0
- package/dist/modes/interactive/components/login-dialog.js +176 -0
- package/dist/modes/interactive/components/login-dialog.js.map +1 -0
- package/dist/modes/interactive/components/markdown-transform.d.ts +4 -0
- package/dist/modes/interactive/components/markdown-transform.d.ts.map +1 -0
- package/dist/modes/interactive/components/markdown-transform.js +19 -0
- package/dist/modes/interactive/components/markdown-transform.js.map +1 -0
- package/dist/modes/interactive/components/mermaid.d.ts +14 -0
- package/dist/modes/interactive/components/mermaid.d.ts.map +1 -0
- package/dist/modes/interactive/components/mermaid.js +228 -0
- package/dist/modes/interactive/components/mermaid.js.map +1 -0
- package/dist/modes/interactive/components/model-selector.d.ts +52 -0
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/model-selector.js +296 -0
- package/dist/modes/interactive/components/model-selector.js.map +1 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts +33 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/oauth-selector.js +165 -0
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +50 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.js +300 -0
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts +22 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector-search.js +144 -0
- package/dist/modes/interactive/components/session-selector-search.js.map +1 -0
- package/dist/modes/interactive/components/session-selector.d.ts +108 -0
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector.js +835 -0
- package/dist/modes/interactive/components/session-selector.js.map +1 -0
- package/dist/modes/interactive/components/settings-selector.d.ts +81 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/settings-selector.js +455 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -0
- package/dist/modes/interactive/components/show-images-selector.d.ts +10 -0
- package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/show-images-selector.js +39 -0
- package/dist/modes/interactive/components/show-images-selector.js.map +1 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +17 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/skill-invocation-message.js +47 -0
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -0
- package/dist/modes/interactive/components/theme-selector.d.ts +11 -0
- package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/theme-selector.js +50 -0
- package/dist/modes/interactive/components/theme-selector.js.map +1 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts +11 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/thinking-selector.js +51 -0
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -0
- package/dist/modes/interactive/components/tool-execution.d.ts +67 -0
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -0
- package/dist/modes/interactive/components/tool-execution.js +306 -0
- package/dist/modes/interactive/components/tool-execution.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector.d.ts +127 -0
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-selector.js +1098 -0
- package/dist/modes/interactive/components/tree-selector.js.map +1 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts +30 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/user-message-selector.js +114 -0
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -0
- package/dist/modes/interactive/components/user-message.d.ts +16 -0
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/user-message.js +49 -0
- package/dist/modes/interactive/components/user-message.js.map +1 -0
- package/dist/modes/interactive/components/visual-truncate.d.ts +24 -0
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -0
- package/dist/modes/interactive/components/visual-truncate.js +33 -0
- package/dist/modes/interactive/components/visual-truncate.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +557 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-mode.js +5859 -0
- package/dist/modes/interactive/interactive-mode.js.map +1 -0
- package/dist/modes/interactive/theme/dark.json +86 -0
- package/dist/modes/interactive/theme/light.json +85 -0
- package/dist/modes/interactive/theme/theme-schema.json +335 -0
- package/dist/modes/interactive/theme/theme.d.ts +106 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme.js +1030 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -0
- package/dist/modes/json-event.d.ts +28 -0
- package/dist/modes/json-event.d.ts.map +1 -0
- package/dist/modes/json-event.js +12 -0
- package/dist/modes/json-event.js.map +1 -0
- package/dist/modes/print-mode.d.ts +29 -0
- package/dist/modes/print-mode.d.ts.map +1 -0
- package/dist/modes/print-mode.js +142 -0
- package/dist/modes/print-mode.js.map +1 -0
- package/dist/modes/rpc/jsonl.d.ts +17 -0
- package/dist/modes/rpc/jsonl.d.ts.map +1 -0
- package/dist/modes/rpc/jsonl.js +49 -0
- package/dist/modes/rpc/jsonl.js.map +1 -0
- package/dist/modes/rpc/rpc-client.d.ts +321 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-client.js +755 -0
- package/dist/modes/rpc/rpc-client.js.map +1 -0
- package/dist/modes/rpc/rpc-mode.d.ts +20 -0
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-mode.js +963 -0
- package/dist/modes/rpc/rpc-mode.js.map +1 -0
- package/dist/modes/rpc/rpc-types.d.ts +652 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-types.js +8 -0
- package/dist/modes/rpc/rpc-types.js.map +1 -0
- package/dist/package-manager-cli.d.ts +4 -0
- package/dist/package-manager-cli.d.ts.map +1 -0
- package/dist/package-manager-cli.js +488 -0
- package/dist/package-manager-cli.js.map +1 -0
- package/dist/utils/ansi.d.ts +2 -0
- package/dist/utils/ansi.d.ts.map +1 -0
- package/dist/utils/ansi.js +25 -0
- package/dist/utils/ansi.js.map +1 -0
- package/dist/utils/changelog.d.ts +23 -0
- package/dist/utils/changelog.d.ts.map +1 -0
- package/dist/utils/changelog.js +74 -0
- package/dist/utils/changelog.js.map +1 -0
- package/dist/utils/child-process.d.ts +15 -0
- package/dist/utils/child-process.d.ts.map +1 -0
- package/dist/utils/child-process.js +88 -0
- package/dist/utils/child-process.js.map +1 -0
- package/dist/utils/clipboard-image.d.ts +13 -0
- package/dist/utils/clipboard-image.d.ts.map +1 -0
- package/dist/utils/clipboard-image.js +248 -0
- package/dist/utils/clipboard-image.js.map +1 -0
- package/dist/utils/clipboard-native.d.ts +11 -0
- package/dist/utils/clipboard-native.d.ts.map +1 -0
- package/dist/utils/clipboard-native.js +20 -0
- package/dist/utils/clipboard-native.js.map +1 -0
- package/dist/utils/clipboard.d.ts +4 -0
- package/dist/utils/clipboard.d.ts.map +1 -0
- package/dist/utils/clipboard.js +171 -0
- package/dist/utils/clipboard.js.map +1 -0
- package/dist/utils/deprecation.d.ts +4 -0
- package/dist/utils/deprecation.d.ts.map +1 -0
- package/dist/utils/deprecation.js +13 -0
- package/dist/utils/deprecation.js.map +1 -0
- package/dist/utils/directory-completions.d.ts +5 -0
- package/dist/utils/directory-completions.d.ts.map +1 -0
- package/dist/utils/directory-completions.js +64 -0
- package/dist/utils/directory-completions.js.map +1 -0
- package/dist/utils/exif-orientation.d.ts +6 -0
- package/dist/utils/exif-orientation.d.ts.map +1 -0
- package/dist/utils/exif-orientation.js +166 -0
- package/dist/utils/exif-orientation.js.map +1 -0
- package/dist/utils/frontmatter.d.ts +8 -0
- package/dist/utils/frontmatter.d.ts.map +1 -0
- package/dist/utils/frontmatter.js +26 -0
- package/dist/utils/frontmatter.js.map +1 -0
- package/dist/utils/fs-watch.d.ts +5 -0
- package/dist/utils/fs-watch.d.ts.map +1 -0
- package/dist/utils/fs-watch.js +25 -0
- package/dist/utils/fs-watch.js.map +1 -0
- package/dist/utils/git.d.ts +27 -0
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/utils/git.js +237 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/grip-user-agent.d.ts +2 -0
- package/dist/utils/grip-user-agent.d.ts.map +1 -0
- package/dist/utils/grip-user-agent.js +5 -0
- package/dist/utils/grip-user-agent.js.map +1 -0
- package/dist/utils/html.d.ts +7 -0
- package/dist/utils/html.d.ts.map +1 -0
- package/dist/utils/html.js +40 -0
- package/dist/utils/html.js.map +1 -0
- package/dist/utils/image-convert.d.ts +12 -0
- package/dist/utils/image-convert.d.ts.map +1 -0
- package/dist/utils/image-convert.js +43 -0
- package/dist/utils/image-convert.js.map +1 -0
- package/dist/utils/image-process.d.ts +18 -0
- package/dist/utils/image-process.d.ts.map +1 -0
- package/dist/utils/image-process.js +83 -0
- package/dist/utils/image-process.js.map +1 -0
- package/dist/utils/image-resize-core.d.ts +30 -0
- package/dist/utils/image-resize-core.d.ts.map +1 -0
- package/dist/utils/image-resize-core.js +133 -0
- package/dist/utils/image-resize-core.js.map +1 -0
- package/dist/utils/image-resize-worker.d.ts +2 -0
- package/dist/utils/image-resize-worker.d.ts.map +1 -0
- package/dist/utils/image-resize-worker.js +31 -0
- package/dist/utils/image-resize-worker.js.map +1 -0
- package/dist/utils/image-resize.d.ts +19 -0
- package/dist/utils/image-resize.d.ts.map +1 -0
- package/dist/utils/image-resize.js +81 -0
- package/dist/utils/image-resize.js.map +1 -0
- package/dist/utils/json.d.ts +3 -0
- package/dist/utils/json.d.ts.map +1 -0
- package/dist/utils/json.js +7 -0
- package/dist/utils/json.js.map +1 -0
- package/dist/utils/mime.d.ts +3 -0
- package/dist/utils/mime.d.ts.map +1 -0
- package/dist/utils/mime.js +110 -0
- package/dist/utils/mime.js.map +1 -0
- package/dist/utils/open-browser.d.ts +9 -0
- package/dist/utils/open-browser.d.ts.map +1 -0
- package/dist/utils/open-browser.js +22 -0
- package/dist/utils/open-browser.js.map +1 -0
- package/dist/utils/paths.d.ts +31 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +87 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/photon.d.ts +22 -0
- package/dist/utils/photon.d.ts.map +1 -0
- package/dist/utils/photon.js +125 -0
- package/dist/utils/photon.js.map +1 -0
- package/dist/utils/shell.d.ts +28 -0
- package/dist/utils/shell.d.ts.map +1 -0
- package/dist/utils/shell.js +188 -0
- package/dist/utils/shell.js.map +1 -0
- package/dist/utils/sleep.d.ts +5 -0
- package/dist/utils/sleep.d.ts.map +1 -0
- package/dist/utils/sleep.js +17 -0
- package/dist/utils/sleep.js.map +1 -0
- package/dist/utils/syntax-highlight.d.ts +12 -0
- package/dist/utils/syntax-highlight.d.ts.map +1 -0
- package/dist/utils/syntax-highlight.js +125 -0
- package/dist/utils/syntax-highlight.js.map +1 -0
- package/dist/utils/tools-manager.d.ts +5 -0
- package/dist/utils/tools-manager.d.ts.map +1 -0
- package/dist/utils/tools-manager.js +329 -0
- package/dist/utils/tools-manager.js.map +1 -0
- package/dist/utils/version-check.d.ts +14 -0
- package/dist/utils/version-check.d.ts.map +1 -0
- package/dist/utils/version-check.js +91 -0
- package/dist/utils/version-check.js.map +1 -0
- package/dist/utils/windows-self-update.d.ts +3 -0
- package/dist/utils/windows-self-update.d.ts.map +1 -0
- package/dist/utils/windows-self-update.js +77 -0
- package/dist/utils/windows-self-update.js.map +1 -0
- package/docs/compaction.md +408 -0
- package/docs/custom-provider.md +714 -0
- package/docs/daemon-architecture.md +399 -0
- package/docs/daemon.md +110 -0
- package/docs/development.md +72 -0
- package/docs/docs.json +164 -0
- package/docs/extensions.md +2745 -0
- package/docs/hooks.md +85 -0
- package/docs/images/doom-extension.png +0 -0
- package/docs/images/exy.png +0 -0
- package/docs/images/interactive-mode.png +0 -0
- package/docs/images/tree-view.png +0 -0
- package/docs/index.md +81 -0
- package/docs/json.md +89 -0
- package/docs/keybindings.md +230 -0
- package/docs/lsp.md +499 -0
- package/docs/migrating-to-grip.md +18 -0
- package/docs/models.md +496 -0
- package/docs/packages.md +228 -0
- package/docs/prompt-templates.md +88 -0
- package/docs/providers.md +251 -0
- package/docs/quickstart.md +167 -0
- package/docs/rpc.md +1492 -0
- package/docs/rules.md +117 -0
- package/docs/sandbox.md +181 -0
- package/docs/sdk.md +360 -0
- package/docs/session-format.md +414 -0
- package/docs/sessions.md +137 -0
- package/docs/settings.md +371 -0
- package/docs/shell-aliases.md +13 -0
- package/docs/skills.md +246 -0
- package/docs/terminal-setup.md +112 -0
- package/docs/termux.md +129 -0
- package/docs/themes.md +295 -0
- package/docs/tmux.md +61 -0
- package/docs/tui.md +918 -0
- package/docs/usage.md +304 -0
- package/docs/windows.md +17 -0
- package/examples/README.md +31 -0
- package/examples/daemon-docker/Dockerfile +43 -0
- package/examples/daemon-docker/README.md +45 -0
- package/examples/extensions/README.md +208 -0
- package/examples/extensions/auto-commit-on-exit.ts +46 -0
- package/examples/extensions/bash-spawn-hook.ts +30 -0
- package/examples/extensions/bookmark.ts +50 -0
- package/examples/extensions/border-status-editor.ts +145 -0
- package/examples/extensions/built-in-tool-renderer.ts +259 -0
- package/examples/extensions/claude-rules.ts +86 -0
- package/examples/extensions/commands.ts +82 -0
- package/examples/extensions/confirm-destructive.ts +59 -0
- package/examples/extensions/custom-compaction.ts +131 -0
- package/examples/extensions/custom-footer.ts +79 -0
- package/examples/extensions/custom-header.ts +73 -0
- package/examples/extensions/custom-provider-anthropic/index.ts +707 -0
- package/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
- package/examples/extensions/custom-provider-anthropic/package.json +19 -0
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +402 -0
- package/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
- package/examples/extensions/custom-provider-gitlab-duo/test.ts +104 -0
- package/examples/extensions/dirty-repo-guard.ts +59 -0
- package/examples/extensions/doom-overlay/README.md +46 -0
- package/examples/extensions/doom-overlay/doom/build/doom.js +21 -0
- package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
- package/examples/extensions/doom-overlay/doom/build.sh +152 -0
- package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
- package/examples/extensions/doom-overlay/doom-component.ts +133 -0
- package/examples/extensions/doom-overlay/doom-engine.ts +173 -0
- package/examples/extensions/doom-overlay/doom-keys.ts +104 -0
- package/examples/extensions/doom-overlay/index.ts +74 -0
- package/examples/extensions/doom-overlay/wad-finder.ts +51 -0
- package/examples/extensions/dynamic-resources/RULES.md +8 -0
- package/examples/extensions/dynamic-resources/SKILL.md +8 -0
- package/examples/extensions/dynamic-resources/dynamic.json +79 -0
- package/examples/extensions/dynamic-resources/dynamic.md +5 -0
- package/examples/extensions/dynamic-resources/index.ts +16 -0
- package/examples/extensions/dynamic-tools.ts +74 -0
- package/examples/extensions/event-bus.ts +43 -0
- package/examples/extensions/file-trigger.ts +41 -0
- package/examples/extensions/git-checkpoint.ts +53 -0
- package/examples/extensions/git-merge-and-resolve.ts +125 -0
- package/examples/extensions/github-issue-autocomplete.ts +191 -0
- package/examples/extensions/handoff.ts +191 -0
- package/examples/extensions/hello.ts +26 -0
- package/examples/extensions/hidden-thinking-label.ts +53 -0
- package/examples/extensions/inline-bash.ts +104 -0
- package/examples/extensions/input-transform.ts +43 -0
- package/examples/extensions/interactive-shell.ts +194 -0
- package/examples/extensions/mac-system-theme.ts +47 -0
- package/examples/extensions/message-renderer.ts +59 -0
- package/examples/extensions/minimal-mode.ts +428 -0
- package/examples/extensions/modal-editor.ts +86 -0
- package/examples/extensions/model-status.ts +31 -0
- package/examples/extensions/notify.ts +55 -0
- package/examples/extensions/overlay-qa-tests.ts +1374 -0
- package/examples/extensions/overlay-test.ts +171 -0
- package/examples/extensions/permission-gate.ts +34 -0
- package/examples/extensions/pirate.ts +47 -0
- package/examples/extensions/plan-mode/README.md +65 -0
- package/examples/extensions/plan-mode/index.ts +346 -0
- package/examples/extensions/plan-mode/utils.ts +172 -0
- package/examples/extensions/preset.ts +426 -0
- package/examples/extensions/prompt-customizer.ts +97 -0
- package/examples/extensions/protected-paths.ts +29 -0
- package/examples/extensions/provider-payload.ts +18 -0
- package/examples/extensions/qna.ts +125 -0
- package/examples/extensions/question.ts +294 -0
- package/examples/extensions/questionnaire.ts +459 -0
- package/examples/extensions/rainbow-editor.ts +88 -0
- package/examples/extensions/reload-runtime.ts +37 -0
- package/examples/extensions/rpc-demo.ts +118 -0
- package/examples/extensions/sandbox/index.ts +320 -0
- package/examples/extensions/sandbox/package-lock.json +92 -0
- package/examples/extensions/sandbox/package.json +19 -0
- package/examples/extensions/send-user-message.ts +97 -0
- package/examples/extensions/session-name.ts +27 -0
- package/examples/extensions/shutdown-command.ts +63 -0
- package/examples/extensions/snake.ts +381 -0
- package/examples/extensions/space-invaders.ts +597 -0
- package/examples/extensions/status-line.ts +32 -0
- package/examples/extensions/structured-output.ts +65 -0
- package/examples/extensions/subagent/README.md +175 -0
- package/examples/extensions/subagent/agents/planner.md +37 -0
- package/examples/extensions/subagent/agents/reviewer.md +35 -0
- package/examples/extensions/subagent/agents/scout.md +50 -0
- package/examples/extensions/subagent/agents/worker.md +24 -0
- package/examples/extensions/subagent/agents.ts +126 -0
- package/examples/extensions/subagent/index.ts +1083 -0
- package/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
- package/examples/extensions/subagent/prompts/implement.md +10 -0
- package/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
- package/examples/extensions/summarize.ts +186 -0
- package/examples/extensions/system-prompt-header.ts +17 -0
- package/examples/extensions/tic-tac-toe.ts +1091 -0
- package/examples/extensions/timed-confirm.ts +70 -0
- package/examples/extensions/titlebar-spinner.ts +58 -0
- package/examples/extensions/todo.ts +306 -0
- package/examples/extensions/tool-override.ts +144 -0
- package/examples/extensions/tools.ts +141 -0
- package/examples/extensions/trigger-compact.ts +50 -0
- package/examples/extensions/truncated-tool.ts +200 -0
- package/examples/extensions/widget-placement.ts +9 -0
- package/examples/extensions/with-deps/index.ts +32 -0
- package/examples/extensions/with-deps/package-lock.json +31 -0
- package/examples/extensions/with-deps/package.json +22 -0
- package/examples/extensions/working-indicator.ts +123 -0
- package/examples/extensions/working-message-test.ts +25 -0
- package/examples/remote-session-server/README.md +71 -0
- package/examples/remote-session-server/server.ts +353 -0
- package/examples/rpc-extension-ui.ts +642 -0
- package/examples/sandbox-docker/Dockerfile +274 -0
- package/examples/sandbox-docker/README.md +88 -0
- package/examples/sdk/01-minimal.ts +27 -0
- package/examples/sdk/02-custom-model.ts +54 -0
- package/examples/sdk/03-custom-prompt.ts +76 -0
- package/examples/sdk/04-skills.ts +60 -0
- package/examples/sdk/05-tools.ts +55 -0
- package/examples/sdk/06-extensions.ts +94 -0
- package/examples/sdk/07-context-files.ts +47 -0
- package/examples/sdk/08-prompt-templates.ts +56 -0
- package/examples/sdk/09-api-keys-and-oauth.ts +50 -0
- package/examples/sdk/10-settings.ts +58 -0
- package/examples/sdk/11-sessions.ts +54 -0
- package/examples/sdk/12-full-control.ts +79 -0
- package/examples/sdk/13-session-runtime.ts +49 -0
- package/examples/sdk/README.md +94 -0
- package/npm-shrinkwrap.json +1878 -0
- package/package.json +102 -5
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import type { ToolOperations } from "../tools/operations.ts";
|
|
2
|
+
export declare const HOOK_EVENT_NAMES: readonly ["SessionStart", "UserPromptSubmit", "PreToolUse", "PostToolUse", "PostToolUseFailure", "Stop", "StopFailure", "PreCompact", "PostCompact", "SessionEnd"];
|
|
3
|
+
export declare const HOOK_EXECUTION_CUSTOM_TYPE = "hook_execution";
|
|
4
|
+
export type HookEventName = (typeof HOOK_EVENT_NAMES)[number];
|
|
5
|
+
export type JsonPrimitive = string | number | boolean | null;
|
|
6
|
+
export type JsonValue = JsonPrimitive | JsonValue[] | {
|
|
7
|
+
[key: string]: JsonValue;
|
|
8
|
+
};
|
|
9
|
+
export type JsonObject = {
|
|
10
|
+
[key: string]: JsonValue;
|
|
11
|
+
};
|
|
12
|
+
export type PermissionMode = "default" | "plan" | "acceptEdits" | "auto" | "dontAsk" | "bypassPermissions";
|
|
13
|
+
export type HookEffortLevel = "low" | "medium" | "high" | "xhigh" | "max";
|
|
14
|
+
export interface HookEffort {
|
|
15
|
+
level: HookEffortLevel;
|
|
16
|
+
}
|
|
17
|
+
export type SessionStartHookSource = "startup" | "resume" | "clear" | "compact" | "fork";
|
|
18
|
+
export type CompactionHookTrigger = "manual" | "auto";
|
|
19
|
+
export interface HookInputCommon {
|
|
20
|
+
session_id: string;
|
|
21
|
+
transcript_path: string;
|
|
22
|
+
cwd: string;
|
|
23
|
+
hook_event_name: HookEventName;
|
|
24
|
+
prompt_id?: string;
|
|
25
|
+
permission_mode?: PermissionMode;
|
|
26
|
+
agent_id?: string;
|
|
27
|
+
agent_type?: string;
|
|
28
|
+
effort?: HookEffort;
|
|
29
|
+
}
|
|
30
|
+
export interface SessionStartHookInput extends HookInputCommon {
|
|
31
|
+
hook_event_name: "SessionStart";
|
|
32
|
+
source: SessionStartHookSource;
|
|
33
|
+
model?: string;
|
|
34
|
+
session_title?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface UserPromptSubmitHookInput extends HookInputCommon {
|
|
37
|
+
hook_event_name: "UserPromptSubmit";
|
|
38
|
+
prompt: string;
|
|
39
|
+
}
|
|
40
|
+
export interface ToolHookInput extends HookInputCommon {
|
|
41
|
+
tool_name: string;
|
|
42
|
+
tool_input: JsonObject;
|
|
43
|
+
tool_use_id: string;
|
|
44
|
+
}
|
|
45
|
+
export interface PreToolUseHookInput extends ToolHookInput {
|
|
46
|
+
hook_event_name: "PreToolUse";
|
|
47
|
+
}
|
|
48
|
+
export interface PostToolUseHookInput extends ToolHookInput {
|
|
49
|
+
hook_event_name: "PostToolUse";
|
|
50
|
+
tool_response: JsonValue;
|
|
51
|
+
duration_ms?: number;
|
|
52
|
+
}
|
|
53
|
+
export interface PostToolUseFailureHookInput extends ToolHookInput {
|
|
54
|
+
hook_event_name: "PostToolUseFailure";
|
|
55
|
+
error: string;
|
|
56
|
+
is_interrupt?: boolean;
|
|
57
|
+
duration_ms?: number;
|
|
58
|
+
}
|
|
59
|
+
export interface StopHookInput extends HookInputCommon {
|
|
60
|
+
hook_event_name: "Stop";
|
|
61
|
+
stop_hook_active: boolean;
|
|
62
|
+
last_assistant_message: string;
|
|
63
|
+
background_tasks?: JsonObject[];
|
|
64
|
+
session_crons?: JsonObject[];
|
|
65
|
+
}
|
|
66
|
+
export interface StopFailureHookInput extends HookInputCommon {
|
|
67
|
+
hook_event_name: "StopFailure";
|
|
68
|
+
error: string;
|
|
69
|
+
error_details?: string;
|
|
70
|
+
last_assistant_message?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface PreCompactHookInput extends HookInputCommon {
|
|
73
|
+
hook_event_name: "PreCompact";
|
|
74
|
+
trigger: CompactionHookTrigger;
|
|
75
|
+
custom_instructions: string;
|
|
76
|
+
}
|
|
77
|
+
export interface PostCompactHookInput extends HookInputCommon {
|
|
78
|
+
hook_event_name: "PostCompact";
|
|
79
|
+
trigger: CompactionHookTrigger;
|
|
80
|
+
compact_summary: string;
|
|
81
|
+
}
|
|
82
|
+
export type SessionEndReason = "clear" | "resume" | "logout" | "prompt_input_exit" | "other";
|
|
83
|
+
export interface SessionEndHookInput extends HookInputCommon {
|
|
84
|
+
hook_event_name: "SessionEnd";
|
|
85
|
+
reason: SessionEndReason;
|
|
86
|
+
}
|
|
87
|
+
export type HookInput = SessionStartHookInput | UserPromptSubmitHookInput | PreToolUseHookInput | PostToolUseHookInput | PostToolUseFailureHookInput | StopHookInput | StopFailureHookInput | PreCompactHookInput | PostCompactHookInput | SessionEndHookInput;
|
|
88
|
+
export type HookCommandShell = "bash" | "powershell";
|
|
89
|
+
export type UnsupportedHookHandlerType = "prompt" | "agent" | "mcp_tool";
|
|
90
|
+
export interface HookHandlerCommon {
|
|
91
|
+
timeout?: number;
|
|
92
|
+
if?: string;
|
|
93
|
+
statusMessage?: string;
|
|
94
|
+
}
|
|
95
|
+
export interface CommandHookHandler extends HookHandlerCommon {
|
|
96
|
+
type: "command";
|
|
97
|
+
command: string;
|
|
98
|
+
args?: string[];
|
|
99
|
+
shell?: HookCommandShell;
|
|
100
|
+
}
|
|
101
|
+
export interface HttpHookHandler extends HookHandlerCommon {
|
|
102
|
+
type: "http";
|
|
103
|
+
url: string;
|
|
104
|
+
headers?: Record<string, string>;
|
|
105
|
+
allowedEnvVars?: string[];
|
|
106
|
+
}
|
|
107
|
+
export interface UnsupportedHookHandler extends HookHandlerCommon {
|
|
108
|
+
type: UnsupportedHookHandlerType;
|
|
109
|
+
}
|
|
110
|
+
export type HookHandler = CommandHookHandler | HttpHookHandler | UnsupportedHookHandler;
|
|
111
|
+
export interface HookGroup {
|
|
112
|
+
matcher?: string;
|
|
113
|
+
hooks: HookHandler[];
|
|
114
|
+
}
|
|
115
|
+
export type HookConfiguration = Partial<Record<HookEventName, HookGroup[]>>;
|
|
116
|
+
export type HookSettingsSourceKind = "user" | "project" | "local" | "host";
|
|
117
|
+
export interface HookSettingsSource {
|
|
118
|
+
kind: HookSettingsSourceKind;
|
|
119
|
+
path: string;
|
|
120
|
+
}
|
|
121
|
+
export type HookDiagnosticCode = "read" | "parse" | "schema" | "unsupported-handler" | "invalid-regex" | "execution" | "policy" | "malformed-output" | "system-message" | "unsupported-update" | "continuation-cap";
|
|
122
|
+
export type HookDiagnosticLevel = "warning" | "error";
|
|
123
|
+
export interface HookDiagnostic {
|
|
124
|
+
level: HookDiagnosticLevel;
|
|
125
|
+
code: HookDiagnosticCode;
|
|
126
|
+
message: string;
|
|
127
|
+
source?: HookSettingsSource;
|
|
128
|
+
event?: HookEventName;
|
|
129
|
+
}
|
|
130
|
+
export interface LoadedHookHandler {
|
|
131
|
+
event: HookEventName;
|
|
132
|
+
matcher?: string;
|
|
133
|
+
handler: HookHandler;
|
|
134
|
+
source: HookSettingsSource;
|
|
135
|
+
order: number;
|
|
136
|
+
/** Effective settings-policy environment allowlist for this HTTP hook. */
|
|
137
|
+
httpHookAllowedEnvVars?: readonly string[];
|
|
138
|
+
}
|
|
139
|
+
export interface LoadedHooks {
|
|
140
|
+
readonly handlers: readonly LoadedHookHandler[];
|
|
141
|
+
readonly diagnostics: readonly HookDiagnostic[];
|
|
142
|
+
readonly sources: readonly HookSettingsSource[];
|
|
143
|
+
}
|
|
144
|
+
export interface HookStructuredOutput {
|
|
145
|
+
continue?: boolean;
|
|
146
|
+
stopReason?: string;
|
|
147
|
+
suppressOutput?: boolean;
|
|
148
|
+
systemMessage?: string;
|
|
149
|
+
terminalSequence?: string;
|
|
150
|
+
decision?: string;
|
|
151
|
+
reason?: string;
|
|
152
|
+
hookSpecificOutput?: JsonObject;
|
|
153
|
+
}
|
|
154
|
+
export type HookOutputClassification = {
|
|
155
|
+
kind: "empty";
|
|
156
|
+
} | {
|
|
157
|
+
kind: "text";
|
|
158
|
+
text: string;
|
|
159
|
+
malformedJson: boolean;
|
|
160
|
+
} | {
|
|
161
|
+
kind: "json";
|
|
162
|
+
value: HookStructuredOutput;
|
|
163
|
+
};
|
|
164
|
+
export type HookExecutionStatus = "completed" | "timeout" | "cancelled" | "error" | "unsupported";
|
|
165
|
+
export interface HookExecutionResult {
|
|
166
|
+
hook: LoadedHookHandler;
|
|
167
|
+
status: HookExecutionStatus;
|
|
168
|
+
exitCode: number | null;
|
|
169
|
+
stdout: string;
|
|
170
|
+
stderr: string;
|
|
171
|
+
stdoutTruncated: boolean;
|
|
172
|
+
stderrTruncated: boolean;
|
|
173
|
+
output: HookOutputClassification;
|
|
174
|
+
blocking: boolean;
|
|
175
|
+
blockingReason?: string;
|
|
176
|
+
durationMs: number;
|
|
177
|
+
diagnostic?: HookDiagnostic;
|
|
178
|
+
}
|
|
179
|
+
export interface HookRunOptions {
|
|
180
|
+
/** Active workspace backend used for project/local hook isolation. */
|
|
181
|
+
toolOperations?: Pick<ToolOperations, "cwd" | "exec" | "getBackendInfo">;
|
|
182
|
+
signal?: AbortSignal;
|
|
183
|
+
env?: NodeJS.ProcessEnv;
|
|
184
|
+
maxOutputBytes?: number;
|
|
185
|
+
fetch?: typeof globalThis.fetch;
|
|
186
|
+
/** Internal/test platform override for process-tree termination behavior. */
|
|
187
|
+
platform?: NodeJS.Platform;
|
|
188
|
+
/** Internal/test override for Windows process-tree termination. Return false to request direct-child fallback. */
|
|
189
|
+
terminateWindowsProcessTree?: (pid: number) => boolean;
|
|
190
|
+
/** Shared timeout override (used for SessionEnd matching handlers). */
|
|
191
|
+
timeoutSeconds?: number;
|
|
192
|
+
/** Host ceiling for HTTP destinations. Omitted means no additional host restriction. */
|
|
193
|
+
allowedHttpHookUrls?: readonly string[];
|
|
194
|
+
/** Host ceiling for HTTP header environment interpolation. */
|
|
195
|
+
httpHookAllowedEnvVars?: readonly string[];
|
|
196
|
+
}
|
|
197
|
+
export type HookPermissionDecision = "allow" | "ask" | "defer" | "deny";
|
|
198
|
+
export interface HookAggregateResult {
|
|
199
|
+
continue: boolean;
|
|
200
|
+
blocked: boolean;
|
|
201
|
+
reason?: string;
|
|
202
|
+
additionalContext: string[];
|
|
203
|
+
systemMessages: string[];
|
|
204
|
+
plainText: string[];
|
|
205
|
+
permissionDecision?: HookPermissionDecision;
|
|
206
|
+
updatedInput?: JsonObject;
|
|
207
|
+
updatedToolOutput?: JsonValue;
|
|
208
|
+
sessionTitle?: string;
|
|
209
|
+
initialUserMessage?: string;
|
|
210
|
+
/** Aggregate remaining-work metric reported by Stop hooks. Lower values indicate progress. */
|
|
211
|
+
stopContinuationProgress?: number;
|
|
212
|
+
reloadSkills?: boolean;
|
|
213
|
+
results: HookExecutionResult[];
|
|
214
|
+
}
|
|
215
|
+
/** Sanitized completed handler call for host UI rendering. */
|
|
216
|
+
export interface HookExecutionCallNotice {
|
|
217
|
+
type: HookHandler["type"];
|
|
218
|
+
label: string;
|
|
219
|
+
source: HookSettingsSource;
|
|
220
|
+
status: HookExecutionStatus;
|
|
221
|
+
exitCode: number | null;
|
|
222
|
+
durationMs: number;
|
|
223
|
+
}
|
|
224
|
+
/** One completed hook event execution persisted as audit-only session data and exposed to host UI observers. */
|
|
225
|
+
export interface HookExecutionNotice {
|
|
226
|
+
event: HookEventName;
|
|
227
|
+
subject?: string;
|
|
228
|
+
calls: HookExecutionCallNotice[];
|
|
229
|
+
returnedPrompts: string[];
|
|
230
|
+
}
|
|
231
|
+
export declare function parseHookExecutionNotice(value: unknown): HookExecutionNotice | undefined;
|
|
232
|
+
export type HookExecutionListener = (notice: HookExecutionNotice) => void;
|
|
233
|
+
export type HookExecutionActivityListener = (active: boolean) => void;
|
|
234
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/hooks/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EA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AC;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,8FAA8F;IAC9F,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,EAAE,mBAAmB,EAAE,CAAC;CAC/B;AAED,8DAA8D;AAC9D,MAAM,WAAW,uBAAuB;IACvC,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,kBAAkB,CAAC;IAC3B,MAAM,EAAE,mBAAmB,CAAC;IAC5B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACnB;AAED,gHAAgH;AAChH,MAAM,WAAW,mBAAmB;IACnC,KAAK,EAAE,aAAa,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,uBAAuB,EAAE,CAAC;IACjC,eAAe,EAAE,MAAM,EAAE,CAAC;CAC1B;AAMD,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,mBAAmB,GAAG,SAAS,CAmBxF;AAeD,MAAM,MAAM,qBAAqB,GAAG,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAC;AAC1E,MAAM,MAAM,6BAA6B,GAAG,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC","sourcesContent":["import type { ToolOperations } from \"../tools/operations.ts\";\n\nexport const HOOK_EVENT_NAMES = [\n\t\"SessionStart\",\n\t\"UserPromptSubmit\",\n\t\"PreToolUse\",\n\t\"PostToolUse\",\n\t\"PostToolUseFailure\",\n\t\"Stop\",\n\t\"StopFailure\",\n\t\"PreCompact\",\n\t\"PostCompact\",\n\t\"SessionEnd\",\n] as const;\nexport const HOOK_EXECUTION_CUSTOM_TYPE = \"hook_execution\";\n\nexport type HookEventName = (typeof HOOK_EVENT_NAMES)[number];\nexport type JsonPrimitive = string | number | boolean | null;\nexport type JsonValue = JsonPrimitive | JsonValue[] | { [key: string]: JsonValue };\nexport type JsonObject = { [key: string]: JsonValue };\n\nexport type PermissionMode = \"default\" | \"plan\" | \"acceptEdits\" | \"auto\" | \"dontAsk\" | \"bypassPermissions\";\nexport type HookEffortLevel = \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\n\nexport interface HookEffort {\n\tlevel: HookEffortLevel;\n}\nexport type SessionStartHookSource = \"startup\" | \"resume\" | \"clear\" | \"compact\" | \"fork\";\nexport type CompactionHookTrigger = \"manual\" | \"auto\";\n\nexport interface HookInputCommon {\n\tsession_id: string;\n\ttranscript_path: string;\n\tcwd: string;\n\thook_event_name: HookEventName;\n\tprompt_id?: string;\n\tpermission_mode?: PermissionMode;\n\tagent_id?: string;\n\tagent_type?: string;\n\teffort?: HookEffort;\n}\n\nexport interface SessionStartHookInput extends HookInputCommon {\n\thook_event_name: \"SessionStart\";\n\tsource: SessionStartHookSource;\n\tmodel?: string;\n\tsession_title?: string;\n}\nexport interface UserPromptSubmitHookInput extends HookInputCommon {\n\thook_event_name: \"UserPromptSubmit\";\n\tprompt: string;\n}\nexport interface ToolHookInput extends HookInputCommon {\n\ttool_name: string;\n\ttool_input: JsonObject;\n\ttool_use_id: string;\n}\nexport interface PreToolUseHookInput extends ToolHookInput {\n\thook_event_name: \"PreToolUse\";\n}\nexport interface PostToolUseHookInput extends ToolHookInput {\n\thook_event_name: \"PostToolUse\";\n\ttool_response: JsonValue;\n\tduration_ms?: number;\n}\nexport interface PostToolUseFailureHookInput extends ToolHookInput {\n\thook_event_name: \"PostToolUseFailure\";\n\terror: string;\n\tis_interrupt?: boolean;\n\tduration_ms?: number;\n}\nexport interface StopHookInput extends HookInputCommon {\n\thook_event_name: \"Stop\";\n\tstop_hook_active: boolean;\n\tlast_assistant_message: string;\n\tbackground_tasks?: JsonObject[];\n\tsession_crons?: JsonObject[];\n}\nexport interface StopFailureHookInput extends HookInputCommon {\n\thook_event_name: \"StopFailure\";\n\terror: string;\n\terror_details?: string;\n\tlast_assistant_message?: string;\n}\nexport interface PreCompactHookInput extends HookInputCommon {\n\thook_event_name: \"PreCompact\";\n\ttrigger: CompactionHookTrigger;\n\tcustom_instructions: string;\n}\nexport interface PostCompactHookInput extends HookInputCommon {\n\thook_event_name: \"PostCompact\";\n\ttrigger: CompactionHookTrigger;\n\tcompact_summary: string;\n}\nexport type SessionEndReason = \"clear\" | \"resume\" | \"logout\" | \"prompt_input_exit\" | \"other\";\n\nexport interface SessionEndHookInput extends HookInputCommon {\n\thook_event_name: \"SessionEnd\";\n\treason: SessionEndReason;\n}\nexport type HookInput =\n\t| SessionStartHookInput\n\t| UserPromptSubmitHookInput\n\t| PreToolUseHookInput\n\t| PostToolUseHookInput\n\t| PostToolUseFailureHookInput\n\t| StopHookInput\n\t| StopFailureHookInput\n\t| PreCompactHookInput\n\t| PostCompactHookInput\n\t| SessionEndHookInput;\n\nexport type HookCommandShell = \"bash\" | \"powershell\";\nexport type UnsupportedHookHandlerType = \"prompt\" | \"agent\" | \"mcp_tool\";\n\nexport interface HookHandlerCommon {\n\ttimeout?: number;\n\tif?: string;\n\tstatusMessage?: string;\n}\nexport interface CommandHookHandler extends HookHandlerCommon {\n\ttype: \"command\";\n\tcommand: string;\n\targs?: string[];\n\tshell?: HookCommandShell;\n}\nexport interface HttpHookHandler extends HookHandlerCommon {\n\ttype: \"http\";\n\turl: string;\n\theaders?: Record<string, string>;\n\tallowedEnvVars?: string[];\n}\nexport interface UnsupportedHookHandler extends HookHandlerCommon {\n\ttype: UnsupportedHookHandlerType;\n}\nexport type HookHandler = CommandHookHandler | HttpHookHandler | UnsupportedHookHandler;\nexport interface HookGroup {\n\tmatcher?: string;\n\thooks: HookHandler[];\n}\nexport type HookConfiguration = Partial<Record<HookEventName, HookGroup[]>>;\n\nexport type HookSettingsSourceKind = \"user\" | \"project\" | \"local\" | \"host\";\nexport interface HookSettingsSource {\n\tkind: HookSettingsSourceKind;\n\tpath: string;\n}\nexport type HookDiagnosticCode =\n\t| \"read\"\n\t| \"parse\"\n\t| \"schema\"\n\t| \"unsupported-handler\"\n\t| \"invalid-regex\"\n\t| \"execution\"\n\t| \"policy\"\n\t| \"malformed-output\"\n\t| \"system-message\"\n\t| \"unsupported-update\"\n\t| \"continuation-cap\";\n\nexport type HookDiagnosticLevel = \"warning\" | \"error\";\n\nexport interface HookDiagnostic {\n\tlevel: HookDiagnosticLevel;\n\tcode: HookDiagnosticCode;\n\tmessage: string;\n\tsource?: HookSettingsSource;\n\tevent?: HookEventName;\n}\nexport interface LoadedHookHandler {\n\tevent: HookEventName;\n\tmatcher?: string;\n\thandler: HookHandler;\n\tsource: HookSettingsSource;\n\torder: number;\n\t/** Effective settings-policy environment allowlist for this HTTP hook. */\n\thttpHookAllowedEnvVars?: readonly string[];\n}\nexport interface LoadedHooks {\n\treadonly handlers: readonly LoadedHookHandler[];\n\treadonly diagnostics: readonly HookDiagnostic[];\n\treadonly sources: readonly HookSettingsSource[];\n}\n\nexport interface HookStructuredOutput {\n\tcontinue?: boolean;\n\tstopReason?: string;\n\tsuppressOutput?: boolean;\n\tsystemMessage?: string;\n\tterminalSequence?: string;\n\tdecision?: string;\n\treason?: string;\n\thookSpecificOutput?: JsonObject;\n}\nexport type HookOutputClassification =\n\t| { kind: \"empty\" }\n\t| { kind: \"text\"; text: string; malformedJson: boolean }\n\t| { kind: \"json\"; value: HookStructuredOutput };\nexport type HookExecutionStatus = \"completed\" | \"timeout\" | \"cancelled\" | \"error\" | \"unsupported\";\n\nexport interface HookExecutionResult {\n\thook: LoadedHookHandler;\n\tstatus: HookExecutionStatus;\n\texitCode: number | null;\n\tstdout: string;\n\tstderr: string;\n\tstdoutTruncated: boolean;\n\tstderrTruncated: boolean;\n\toutput: HookOutputClassification;\n\tblocking: boolean;\n\tblockingReason?: string;\n\tdurationMs: number;\n\tdiagnostic?: HookDiagnostic;\n}\n\nexport interface HookRunOptions {\n\t/** Active workspace backend used for project/local hook isolation. */\n\ttoolOperations?: Pick<ToolOperations, \"cwd\" | \"exec\" | \"getBackendInfo\">;\n\tsignal?: AbortSignal;\n\tenv?: NodeJS.ProcessEnv;\n\tmaxOutputBytes?: number;\n\tfetch?: typeof globalThis.fetch;\n\t/** Internal/test platform override for process-tree termination behavior. */\n\tplatform?: NodeJS.Platform;\n\t/** Internal/test override for Windows process-tree termination. Return false to request direct-child fallback. */\n\tterminateWindowsProcessTree?: (pid: number) => boolean;\n\t/** Shared timeout override (used for SessionEnd matching handlers). */\n\ttimeoutSeconds?: number;\n\t/** Host ceiling for HTTP destinations. Omitted means no additional host restriction. */\n\tallowedHttpHookUrls?: readonly string[];\n\t/** Host ceiling for HTTP header environment interpolation. */\n\thttpHookAllowedEnvVars?: readonly string[];\n}\nexport type HookPermissionDecision = \"allow\" | \"ask\" | \"defer\" | \"deny\";\n\nexport interface HookAggregateResult {\n\tcontinue: boolean;\n\tblocked: boolean;\n\treason?: string;\n\tadditionalContext: string[];\n\tsystemMessages: string[];\n\tplainText: string[];\n\tpermissionDecision?: HookPermissionDecision;\n\tupdatedInput?: JsonObject;\n\tupdatedToolOutput?: JsonValue;\n\tsessionTitle?: string;\n\tinitialUserMessage?: string;\n\t/** Aggregate remaining-work metric reported by Stop hooks. Lower values indicate progress. */\n\tstopContinuationProgress?: number;\n\treloadSkills?: boolean;\n\tresults: HookExecutionResult[];\n}\n\n/** Sanitized completed handler call for host UI rendering. */\nexport interface HookExecutionCallNotice {\n\ttype: HookHandler[\"type\"];\n\tlabel: string;\n\tsource: HookSettingsSource;\n\tstatus: HookExecutionStatus;\n\texitCode: number | null;\n\tdurationMs: number;\n}\n\n/** One completed hook event execution persisted as audit-only session data and exposed to host UI observers. */\nexport interface HookExecutionNotice {\n\tevent: HookEventName;\n\tsubject?: string;\n\tcalls: HookExecutionCallNotice[];\n\treturnedPrompts: string[];\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null;\n}\n\nexport function parseHookExecutionNotice(value: unknown): HookExecutionNotice | undefined {\n\tif (typeof value !== \"string\") return undefined;\n\tlet parsed: unknown;\n\ttry {\n\t\tparsed = JSON.parse(value);\n\t} catch {\n\t\treturn undefined;\n\t}\n\tif (!isRecord(parsed) || typeof parsed.event !== \"string\") return undefined;\n\tif (!HOOK_EVENT_NAMES.includes(parsed.event as HookEventName)) return undefined;\n\tif (parsed.subject !== undefined && typeof parsed.subject !== \"string\") return undefined;\n\tif (\n\t\t!Array.isArray(parsed.returnedPrompts) ||\n\t\t!parsed.returnedPrompts.every((prompt) => typeof prompt === \"string\")\n\t) {\n\t\treturn undefined;\n\t}\n\tif (!Array.isArray(parsed.calls) || !parsed.calls.every(isHookExecutionCallNotice)) return undefined;\n\treturn parsed as unknown as HookExecutionNotice;\n}\n\nfunction isHookExecutionCallNotice(value: unknown): value is HookExecutionCallNotice {\n\tif (!isRecord(value) || !isRecord(value.source)) return false;\n\treturn (\n\t\ttypeof value.type === \"string\" &&\n\t\ttypeof value.label === \"string\" &&\n\t\ttypeof value.source.kind === \"string\" &&\n\t\ttypeof value.source.path === \"string\" &&\n\t\ttypeof value.status === \"string\" &&\n\t\t(value.exitCode === null || typeof value.exitCode === \"number\") &&\n\t\ttypeof value.durationMs === \"number\"\n\t);\n}\n\nexport type HookExecutionListener = (notice: HookExecutionNotice) => void;\nexport type HookExecutionActivityListener = (active: boolean) => void;\n"]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export const HOOK_EVENT_NAMES = [
|
|
2
|
+
"SessionStart",
|
|
3
|
+
"UserPromptSubmit",
|
|
4
|
+
"PreToolUse",
|
|
5
|
+
"PostToolUse",
|
|
6
|
+
"PostToolUseFailure",
|
|
7
|
+
"Stop",
|
|
8
|
+
"StopFailure",
|
|
9
|
+
"PreCompact",
|
|
10
|
+
"PostCompact",
|
|
11
|
+
"SessionEnd",
|
|
12
|
+
];
|
|
13
|
+
export const HOOK_EXECUTION_CUSTOM_TYPE = "hook_execution";
|
|
14
|
+
function isRecord(value) {
|
|
15
|
+
return typeof value === "object" && value !== null;
|
|
16
|
+
}
|
|
17
|
+
export function parseHookExecutionNotice(value) {
|
|
18
|
+
if (typeof value !== "string")
|
|
19
|
+
return undefined;
|
|
20
|
+
let parsed;
|
|
21
|
+
try {
|
|
22
|
+
parsed = JSON.parse(value);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
if (!isRecord(parsed) || typeof parsed.event !== "string")
|
|
28
|
+
return undefined;
|
|
29
|
+
if (!HOOK_EVENT_NAMES.includes(parsed.event))
|
|
30
|
+
return undefined;
|
|
31
|
+
if (parsed.subject !== undefined && typeof parsed.subject !== "string")
|
|
32
|
+
return undefined;
|
|
33
|
+
if (!Array.isArray(parsed.returnedPrompts) ||
|
|
34
|
+
!parsed.returnedPrompts.every((prompt) => typeof prompt === "string")) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
if (!Array.isArray(parsed.calls) || !parsed.calls.every(isHookExecutionCallNotice))
|
|
38
|
+
return undefined;
|
|
39
|
+
return parsed;
|
|
40
|
+
}
|
|
41
|
+
function isHookExecutionCallNotice(value) {
|
|
42
|
+
if (!isRecord(value) || !isRecord(value.source))
|
|
43
|
+
return false;
|
|
44
|
+
return (typeof value.type === "string" &&
|
|
45
|
+
typeof value.label === "string" &&
|
|
46
|
+
typeof value.source.kind === "string" &&
|
|
47
|
+
typeof value.source.path === "string" &&
|
|
48
|
+
typeof value.status === "string" &&
|
|
49
|
+
(value.exitCode === null || typeof value.exitCode === "number") &&
|
|
50
|
+
typeof value.durationMs === "number");
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/hooks/types.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC/B,cAAc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AAE,OAAO,SAAS,CAAC;IACrG,OAAO,MAAwC,CAAC;AAAA,CAChD;AAED,SAAS,yBAAyB,CAAC,KAAc,EAAoC;IACpF,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC;QAAE,OAAO,KAAK,CAAC;IAC9D,OAAO,CACN,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;QAC9B,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ;QAC/B,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,QAAQ;QACrC,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,QAAQ;QACrC,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ;QAChC,CAAC,KAAK,CAAC,QAAQ,KAAK,IAAI,IAAI,OAAO,KAAK,CAAC,QAAQ,KAAK,QAAQ,CAAC;QAC/D,OAAO,KAAK,CAAC,UAAU,KAAK,QAAQ,CACpC,CAAC;AAAA,CACF","sourcesContent":["import type { ToolOperations } from \"../tools/operations.ts\";\n\nexport const HOOK_EVENT_NAMES = [\n\t\"SessionStart\",\n\t\"UserPromptSubmit\",\n\t\"PreToolUse\",\n\t\"PostToolUse\",\n\t\"PostToolUseFailure\",\n\t\"Stop\",\n\t\"StopFailure\",\n\t\"PreCompact\",\n\t\"PostCompact\",\n\t\"SessionEnd\",\n] as const;\nexport const HOOK_EXECUTION_CUSTOM_TYPE = \"hook_execution\";\n\nexport type HookEventName = (typeof HOOK_EVENT_NAMES)[number];\nexport type JsonPrimitive = string | number | boolean | null;\nexport type JsonValue = JsonPrimitive | JsonValue[] | { [key: string]: JsonValue };\nexport type JsonObject = { [key: string]: JsonValue };\n\nexport type PermissionMode = \"default\" | \"plan\" | \"acceptEdits\" | \"auto\" | \"dontAsk\" | \"bypassPermissions\";\nexport type HookEffortLevel = \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\n\nexport interface HookEffort {\n\tlevel: HookEffortLevel;\n}\nexport type SessionStartHookSource = \"startup\" | \"resume\" | \"clear\" | \"compact\" | \"fork\";\nexport type CompactionHookTrigger = \"manual\" | \"auto\";\n\nexport interface HookInputCommon {\n\tsession_id: string;\n\ttranscript_path: string;\n\tcwd: string;\n\thook_event_name: HookEventName;\n\tprompt_id?: string;\n\tpermission_mode?: PermissionMode;\n\tagent_id?: string;\n\tagent_type?: string;\n\teffort?: HookEffort;\n}\n\nexport interface SessionStartHookInput extends HookInputCommon {\n\thook_event_name: \"SessionStart\";\n\tsource: SessionStartHookSource;\n\tmodel?: string;\n\tsession_title?: string;\n}\nexport interface UserPromptSubmitHookInput extends HookInputCommon {\n\thook_event_name: \"UserPromptSubmit\";\n\tprompt: string;\n}\nexport interface ToolHookInput extends HookInputCommon {\n\ttool_name: string;\n\ttool_input: JsonObject;\n\ttool_use_id: string;\n}\nexport interface PreToolUseHookInput extends ToolHookInput {\n\thook_event_name: \"PreToolUse\";\n}\nexport interface PostToolUseHookInput extends ToolHookInput {\n\thook_event_name: \"PostToolUse\";\n\ttool_response: JsonValue;\n\tduration_ms?: number;\n}\nexport interface PostToolUseFailureHookInput extends ToolHookInput {\n\thook_event_name: \"PostToolUseFailure\";\n\terror: string;\n\tis_interrupt?: boolean;\n\tduration_ms?: number;\n}\nexport interface StopHookInput extends HookInputCommon {\n\thook_event_name: \"Stop\";\n\tstop_hook_active: boolean;\n\tlast_assistant_message: string;\n\tbackground_tasks?: JsonObject[];\n\tsession_crons?: JsonObject[];\n}\nexport interface StopFailureHookInput extends HookInputCommon {\n\thook_event_name: \"StopFailure\";\n\terror: string;\n\terror_details?: string;\n\tlast_assistant_message?: string;\n}\nexport interface PreCompactHookInput extends HookInputCommon {\n\thook_event_name: \"PreCompact\";\n\ttrigger: CompactionHookTrigger;\n\tcustom_instructions: string;\n}\nexport interface PostCompactHookInput extends HookInputCommon {\n\thook_event_name: \"PostCompact\";\n\ttrigger: CompactionHookTrigger;\n\tcompact_summary: string;\n}\nexport type SessionEndReason = \"clear\" | \"resume\" | \"logout\" | \"prompt_input_exit\" | \"other\";\n\nexport interface SessionEndHookInput extends HookInputCommon {\n\thook_event_name: \"SessionEnd\";\n\treason: SessionEndReason;\n}\nexport type HookInput =\n\t| SessionStartHookInput\n\t| UserPromptSubmitHookInput\n\t| PreToolUseHookInput\n\t| PostToolUseHookInput\n\t| PostToolUseFailureHookInput\n\t| StopHookInput\n\t| StopFailureHookInput\n\t| PreCompactHookInput\n\t| PostCompactHookInput\n\t| SessionEndHookInput;\n\nexport type HookCommandShell = \"bash\" | \"powershell\";\nexport type UnsupportedHookHandlerType = \"prompt\" | \"agent\" | \"mcp_tool\";\n\nexport interface HookHandlerCommon {\n\ttimeout?: number;\n\tif?: string;\n\tstatusMessage?: string;\n}\nexport interface CommandHookHandler extends HookHandlerCommon {\n\ttype: \"command\";\n\tcommand: string;\n\targs?: string[];\n\tshell?: HookCommandShell;\n}\nexport interface HttpHookHandler extends HookHandlerCommon {\n\ttype: \"http\";\n\turl: string;\n\theaders?: Record<string, string>;\n\tallowedEnvVars?: string[];\n}\nexport interface UnsupportedHookHandler extends HookHandlerCommon {\n\ttype: UnsupportedHookHandlerType;\n}\nexport type HookHandler = CommandHookHandler | HttpHookHandler | UnsupportedHookHandler;\nexport interface HookGroup {\n\tmatcher?: string;\n\thooks: HookHandler[];\n}\nexport type HookConfiguration = Partial<Record<HookEventName, HookGroup[]>>;\n\nexport type HookSettingsSourceKind = \"user\" | \"project\" | \"local\" | \"host\";\nexport interface HookSettingsSource {\n\tkind: HookSettingsSourceKind;\n\tpath: string;\n}\nexport type HookDiagnosticCode =\n\t| \"read\"\n\t| \"parse\"\n\t| \"schema\"\n\t| \"unsupported-handler\"\n\t| \"invalid-regex\"\n\t| \"execution\"\n\t| \"policy\"\n\t| \"malformed-output\"\n\t| \"system-message\"\n\t| \"unsupported-update\"\n\t| \"continuation-cap\";\n\nexport type HookDiagnosticLevel = \"warning\" | \"error\";\n\nexport interface HookDiagnostic {\n\tlevel: HookDiagnosticLevel;\n\tcode: HookDiagnosticCode;\n\tmessage: string;\n\tsource?: HookSettingsSource;\n\tevent?: HookEventName;\n}\nexport interface LoadedHookHandler {\n\tevent: HookEventName;\n\tmatcher?: string;\n\thandler: HookHandler;\n\tsource: HookSettingsSource;\n\torder: number;\n\t/** Effective settings-policy environment allowlist for this HTTP hook. */\n\thttpHookAllowedEnvVars?: readonly string[];\n}\nexport interface LoadedHooks {\n\treadonly handlers: readonly LoadedHookHandler[];\n\treadonly diagnostics: readonly HookDiagnostic[];\n\treadonly sources: readonly HookSettingsSource[];\n}\n\nexport interface HookStructuredOutput {\n\tcontinue?: boolean;\n\tstopReason?: string;\n\tsuppressOutput?: boolean;\n\tsystemMessage?: string;\n\tterminalSequence?: string;\n\tdecision?: string;\n\treason?: string;\n\thookSpecificOutput?: JsonObject;\n}\nexport type HookOutputClassification =\n\t| { kind: \"empty\" }\n\t| { kind: \"text\"; text: string; malformedJson: boolean }\n\t| { kind: \"json\"; value: HookStructuredOutput };\nexport type HookExecutionStatus = \"completed\" | \"timeout\" | \"cancelled\" | \"error\" | \"unsupported\";\n\nexport interface HookExecutionResult {\n\thook: LoadedHookHandler;\n\tstatus: HookExecutionStatus;\n\texitCode: number | null;\n\tstdout: string;\n\tstderr: string;\n\tstdoutTruncated: boolean;\n\tstderrTruncated: boolean;\n\toutput: HookOutputClassification;\n\tblocking: boolean;\n\tblockingReason?: string;\n\tdurationMs: number;\n\tdiagnostic?: HookDiagnostic;\n}\n\nexport interface HookRunOptions {\n\t/** Active workspace backend used for project/local hook isolation. */\n\ttoolOperations?: Pick<ToolOperations, \"cwd\" | \"exec\" | \"getBackendInfo\">;\n\tsignal?: AbortSignal;\n\tenv?: NodeJS.ProcessEnv;\n\tmaxOutputBytes?: number;\n\tfetch?: typeof globalThis.fetch;\n\t/** Internal/test platform override for process-tree termination behavior. */\n\tplatform?: NodeJS.Platform;\n\t/** Internal/test override for Windows process-tree termination. Return false to request direct-child fallback. */\n\tterminateWindowsProcessTree?: (pid: number) => boolean;\n\t/** Shared timeout override (used for SessionEnd matching handlers). */\n\ttimeoutSeconds?: number;\n\t/** Host ceiling for HTTP destinations. Omitted means no additional host restriction. */\n\tallowedHttpHookUrls?: readonly string[];\n\t/** Host ceiling for HTTP header environment interpolation. */\n\thttpHookAllowedEnvVars?: readonly string[];\n}\nexport type HookPermissionDecision = \"allow\" | \"ask\" | \"defer\" | \"deny\";\n\nexport interface HookAggregateResult {\n\tcontinue: boolean;\n\tblocked: boolean;\n\treason?: string;\n\tadditionalContext: string[];\n\tsystemMessages: string[];\n\tplainText: string[];\n\tpermissionDecision?: HookPermissionDecision;\n\tupdatedInput?: JsonObject;\n\tupdatedToolOutput?: JsonValue;\n\tsessionTitle?: string;\n\tinitialUserMessage?: string;\n\t/** Aggregate remaining-work metric reported by Stop hooks. Lower values indicate progress. */\n\tstopContinuationProgress?: number;\n\treloadSkills?: boolean;\n\tresults: HookExecutionResult[];\n}\n\n/** Sanitized completed handler call for host UI rendering. */\nexport interface HookExecutionCallNotice {\n\ttype: HookHandler[\"type\"];\n\tlabel: string;\n\tsource: HookSettingsSource;\n\tstatus: HookExecutionStatus;\n\texitCode: number | null;\n\tdurationMs: number;\n}\n\n/** One completed hook event execution persisted as audit-only session data and exposed to host UI observers. */\nexport interface HookExecutionNotice {\n\tevent: HookEventName;\n\tsubject?: string;\n\tcalls: HookExecutionCallNotice[];\n\treturnedPrompts: string[];\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null;\n}\n\nexport function parseHookExecutionNotice(value: unknown): HookExecutionNotice | undefined {\n\tif (typeof value !== \"string\") return undefined;\n\tlet parsed: unknown;\n\ttry {\n\t\tparsed = JSON.parse(value);\n\t} catch {\n\t\treturn undefined;\n\t}\n\tif (!isRecord(parsed) || typeof parsed.event !== \"string\") return undefined;\n\tif (!HOOK_EVENT_NAMES.includes(parsed.event as HookEventName)) return undefined;\n\tif (parsed.subject !== undefined && typeof parsed.subject !== \"string\") return undefined;\n\tif (\n\t\t!Array.isArray(parsed.returnedPrompts) ||\n\t\t!parsed.returnedPrompts.every((prompt) => typeof prompt === \"string\")\n\t) {\n\t\treturn undefined;\n\t}\n\tif (!Array.isArray(parsed.calls) || !parsed.calls.every(isHookExecutionCallNotice)) return undefined;\n\treturn parsed as unknown as HookExecutionNotice;\n}\n\nfunction isHookExecutionCallNotice(value: unknown): value is HookExecutionCallNotice {\n\tif (!isRecord(value) || !isRecord(value.source)) return false;\n\treturn (\n\t\ttypeof value.type === \"string\" &&\n\t\ttypeof value.label === \"string\" &&\n\t\ttypeof value.source.kind === \"string\" &&\n\t\ttypeof value.source.path === \"string\" &&\n\t\ttypeof value.status === \"string\" &&\n\t\t(value.exitCode === null || typeof value.exitCode === \"number\") &&\n\t\ttypeof value.durationMs === \"number\"\n\t);\n}\n\nexport type HookExecutionListener = (notice: HookExecutionNotice) => void;\nexport type HookExecutionActivityListener = (active: boolean) => void;\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const DEFAULT_HTTP_IDLE_TIMEOUT_MS = 300000;
|
|
2
|
+
export declare const HTTP_IDLE_TIMEOUT_CHOICES: readonly [{
|
|
3
|
+
readonly label: "30 sec";
|
|
4
|
+
readonly timeoutMs: 30000;
|
|
5
|
+
}, {
|
|
6
|
+
readonly label: "1 min";
|
|
7
|
+
readonly timeoutMs: 60000;
|
|
8
|
+
}, {
|
|
9
|
+
readonly label: "2 min";
|
|
10
|
+
readonly timeoutMs: 120000;
|
|
11
|
+
}, {
|
|
12
|
+
readonly label: "5 min";
|
|
13
|
+
readonly timeoutMs: 300000;
|
|
14
|
+
}, {
|
|
15
|
+
readonly label: "disabled";
|
|
16
|
+
readonly timeoutMs: 0;
|
|
17
|
+
}];
|
|
18
|
+
export declare function parseHttpIdleTimeoutMs(value: unknown): number | undefined;
|
|
19
|
+
export declare function formatHttpIdleTimeoutMs(timeoutMs: number): string;
|
|
20
|
+
export declare function configureHttpDispatcher(timeoutMs?: number): void;
|
|
21
|
+
//# sourceMappingURL=http-dispatcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-dispatcher.d.ts","sourceRoot":"","sources":["../../src/core/http-dispatcher.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,4BAA4B,SAAU,CAAC;AAEpD,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;EAM5B,CAAC;AAEX,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAgBzE;AAED,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAMjE;AAmCD,wBAAgB,uBAAuB,CAAC,SAAS,GAAE,MAAqC,GAAG,IAAI,CAuB9F","sourcesContent":["import { EventEmitter } from \"node:events\";\nimport * as undici from \"undici\";\n\nexport const DEFAULT_HTTP_IDLE_TIMEOUT_MS = 300_000;\n\nexport const HTTP_IDLE_TIMEOUT_CHOICES = [\n\t{ label: \"30 sec\", timeoutMs: 30_000 },\n\t{ label: \"1 min\", timeoutMs: 60_000 },\n\t{ label: \"2 min\", timeoutMs: 120_000 },\n\t{ label: \"5 min\", timeoutMs: 300_000 },\n\t{ label: \"disabled\", timeoutMs: 0 },\n] as const;\n\nexport function parseHttpIdleTimeoutMs(value: unknown): number | undefined {\n\tif (typeof value === \"string\") {\n\t\tconst trimmed = value.trim();\n\t\tif (trimmed.toLowerCase() === \"disabled\") {\n\t\t\treturn 0;\n\t\t}\n\t\tif (trimmed.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn parseHttpIdleTimeoutMs(Number(trimmed));\n\t}\n\n\tif (typeof value !== \"number\" || !Number.isFinite(value) || value < 0) {\n\t\treturn undefined;\n\t}\n\treturn Math.floor(value);\n}\n\nexport function formatHttpIdleTimeoutMs(timeoutMs: number): string {\n\tconst choice = HTTP_IDLE_TIMEOUT_CHOICES.find((item) => item.timeoutMs === timeoutMs);\n\tif (choice) {\n\t\treturn choice.label;\n\t}\n\treturn `${timeoutMs / 1000} sec`;\n}\n\nconst ignoreUndiciDispatcherError = (_error: unknown): void => {};\n\n// Undici can emit an internal Client \"error\" while terminating a mid-stream\n// fetch body. The body stream still rejects through reader.read(); this listener\n// only prevents EventEmitter's unhandled \"error\" special case from crashing grip.\nfunction withUndiciErrorListener<T extends undici.Dispatcher>(dispatcher: T): T {\n\tif (dispatcher instanceof EventEmitter) {\n\t\tEventEmitter.prototype.on.call(dispatcher, \"error\", ignoreUndiciDispatcherError);\n\t}\n\treturn dispatcher;\n}\n\nfunction createUndiciClient(origin: string | URL, options: object): undici.Dispatcher {\n\treturn withUndiciErrorListener(new undici.Client(origin, options as undici.Client.Options));\n}\n\nfunction createUndiciOriginDispatcher(origin: string | URL, options: object): undici.Dispatcher {\n\tconst dispatcherOptions = options as undici.Pool.Options;\n\tif (dispatcherOptions.connections === 1) {\n\t\treturn createUndiciClient(origin, dispatcherOptions);\n\t}\n\treturn withUndiciErrorListener(\n\t\tnew undici.Pool(origin, {\n\t\t\t...dispatcherOptions,\n\t\t\tfactory: createUndiciClient,\n\t\t}),\n\t);\n}\n\nfunction isMockedFetch(fetchImplementation: typeof globalThis.fetch | undefined): boolean {\n\treturn (fetchImplementation as { _isMockFunction?: unknown } | undefined)?._isMockFunction === true;\n}\n\nexport function configureHttpDispatcher(timeoutMs: number = DEFAULT_HTTP_IDLE_TIMEOUT_MS): void {\n\tconst normalizedTimeoutMs = parseHttpIdleTimeoutMs(timeoutMs);\n\tif (normalizedTimeoutMs === undefined) {\n\t\tthrow new Error(`Invalid HTTP idle timeout: ${String(timeoutMs)}`);\n\t}\n\tconst dispatcher = withUndiciErrorListener(\n\t\tnew undici.EnvHttpProxyAgent({\n\t\t\tallowH2: false,\n\t\t\tbodyTimeout: normalizedTimeoutMs,\n\t\t\theadersTimeout: normalizedTimeoutMs,\n\t\t\tclientFactory: createUndiciClient,\n\t\t\tfactory: createUndiciOriginDispatcher,\n\t\t}),\n\t);\n\tundici.setGlobalDispatcher(dispatcher);\n\t// Keep fetch and the dispatcher on the same undici implementation. Node 26.0's\n\t// bundled fetch can otherwise consume compressed responses through npm undici's\n\t// dispatcher without decompressing them, causing response.json() failures.\n\tconst existingFetch = globalThis.fetch;\n\tundici.install?.();\n\tif (isMockedFetch(existingFetch)) {\n\t\tglobalThis.fetch = existingFetch;\n\t}\n}\n"]}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
|
+
import * as undici from "undici";
|
|
3
|
+
export const DEFAULT_HTTP_IDLE_TIMEOUT_MS = 300_000;
|
|
4
|
+
export const HTTP_IDLE_TIMEOUT_CHOICES = [
|
|
5
|
+
{ label: "30 sec", timeoutMs: 30_000 },
|
|
6
|
+
{ label: "1 min", timeoutMs: 60_000 },
|
|
7
|
+
{ label: "2 min", timeoutMs: 120_000 },
|
|
8
|
+
{ label: "5 min", timeoutMs: 300_000 },
|
|
9
|
+
{ label: "disabled", timeoutMs: 0 },
|
|
10
|
+
];
|
|
11
|
+
export function parseHttpIdleTimeoutMs(value) {
|
|
12
|
+
if (typeof value === "string") {
|
|
13
|
+
const trimmed = value.trim();
|
|
14
|
+
if (trimmed.toLowerCase() === "disabled") {
|
|
15
|
+
return 0;
|
|
16
|
+
}
|
|
17
|
+
if (trimmed.length === 0) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
return parseHttpIdleTimeoutMs(Number(trimmed));
|
|
21
|
+
}
|
|
22
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value < 0) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
return Math.floor(value);
|
|
26
|
+
}
|
|
27
|
+
export function formatHttpIdleTimeoutMs(timeoutMs) {
|
|
28
|
+
const choice = HTTP_IDLE_TIMEOUT_CHOICES.find((item) => item.timeoutMs === timeoutMs);
|
|
29
|
+
if (choice) {
|
|
30
|
+
return choice.label;
|
|
31
|
+
}
|
|
32
|
+
return `${timeoutMs / 1000} sec`;
|
|
33
|
+
}
|
|
34
|
+
const ignoreUndiciDispatcherError = (_error) => { };
|
|
35
|
+
// Undici can emit an internal Client "error" while terminating a mid-stream
|
|
36
|
+
// fetch body. The body stream still rejects through reader.read(); this listener
|
|
37
|
+
// only prevents EventEmitter's unhandled "error" special case from crashing grip.
|
|
38
|
+
function withUndiciErrorListener(dispatcher) {
|
|
39
|
+
if (dispatcher instanceof EventEmitter) {
|
|
40
|
+
EventEmitter.prototype.on.call(dispatcher, "error", ignoreUndiciDispatcherError);
|
|
41
|
+
}
|
|
42
|
+
return dispatcher;
|
|
43
|
+
}
|
|
44
|
+
function createUndiciClient(origin, options) {
|
|
45
|
+
return withUndiciErrorListener(new undici.Client(origin, options));
|
|
46
|
+
}
|
|
47
|
+
function createUndiciOriginDispatcher(origin, options) {
|
|
48
|
+
const dispatcherOptions = options;
|
|
49
|
+
if (dispatcherOptions.connections === 1) {
|
|
50
|
+
return createUndiciClient(origin, dispatcherOptions);
|
|
51
|
+
}
|
|
52
|
+
return withUndiciErrorListener(new undici.Pool(origin, {
|
|
53
|
+
...dispatcherOptions,
|
|
54
|
+
factory: createUndiciClient,
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
57
|
+
function isMockedFetch(fetchImplementation) {
|
|
58
|
+
return fetchImplementation?._isMockFunction === true;
|
|
59
|
+
}
|
|
60
|
+
export function configureHttpDispatcher(timeoutMs = DEFAULT_HTTP_IDLE_TIMEOUT_MS) {
|
|
61
|
+
const normalizedTimeoutMs = parseHttpIdleTimeoutMs(timeoutMs);
|
|
62
|
+
if (normalizedTimeoutMs === undefined) {
|
|
63
|
+
throw new Error(`Invalid HTTP idle timeout: ${String(timeoutMs)}`);
|
|
64
|
+
}
|
|
65
|
+
const dispatcher = withUndiciErrorListener(new undici.EnvHttpProxyAgent({
|
|
66
|
+
allowH2: false,
|
|
67
|
+
bodyTimeout: normalizedTimeoutMs,
|
|
68
|
+
headersTimeout: normalizedTimeoutMs,
|
|
69
|
+
clientFactory: createUndiciClient,
|
|
70
|
+
factory: createUndiciOriginDispatcher,
|
|
71
|
+
}));
|
|
72
|
+
undici.setGlobalDispatcher(dispatcher);
|
|
73
|
+
// Keep fetch and the dispatcher on the same undici implementation. Node 26.0's
|
|
74
|
+
// bundled fetch can otherwise consume compressed responses through npm undici's
|
|
75
|
+
// dispatcher without decompressing them, causing response.json() failures.
|
|
76
|
+
const existingFetch = globalThis.fetch;
|
|
77
|
+
undici.install?.();
|
|
78
|
+
if (isMockedFetch(existingFetch)) {
|
|
79
|
+
globalThis.fetch = existingFetch;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=http-dispatcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-dispatcher.js","sourceRoot":"","sources":["../../src/core/http-dispatcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,MAAM,CAAC,MAAM,4BAA4B,GAAG,OAAO,CAAC;AAEpD,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACxC,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE;IACtC,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE;IACrC,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE;IACtC,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE;IACtC,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,EAAE;CAC1B,CAAC;AAEX,MAAM,UAAU,sBAAsB,CAAC,KAAc,EAAsB;IAC1E,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC/B,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;QAC7B,IAAI,OAAO,CAAC,WA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CAAC,KAAK,GAAG,aAAa,CAAC;IAClC,CAAC;AAAA,CACD","sourcesContent":["import { EventEmitter } from \"node:events\";\nimport * as undici from \"undici\";\n\nexport const DEFAULT_HTTP_IDLE_TIMEOUT_MS = 300_000;\n\nexport const HTTP_IDLE_TIMEOUT_CHOICES = [\n\t{ label: \"30 sec\", timeoutMs: 30_000 },\n\t{ label: \"1 min\", timeoutMs: 60_000 },\n\t{ label: \"2 min\", timeoutMs: 120_000 },\n\t{ label: \"5 min\", timeoutMs: 300_000 },\n\t{ label: \"disabled\", timeoutMs: 0 },\n] as const;\n\nexport function parseHttpIdleTimeoutMs(value: unknown): number | undefined {\n\tif (typeof value === \"string\") {\n\t\tconst trimmed = value.trim();\n\t\tif (trimmed.toLowerCase() === \"disabled\") {\n\t\t\treturn 0;\n\t\t}\n\t\tif (trimmed.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn parseHttpIdleTimeoutMs(Number(trimmed));\n\t}\n\n\tif (typeof value !== \"number\" || !Number.isFinite(value) || value < 0) {\n\t\treturn undefined;\n\t}\n\treturn Math.floor(value);\n}\n\nexport function formatHttpIdleTimeoutMs(timeoutMs: number): string {\n\tconst choice = HTTP_IDLE_TIMEOUT_CHOICES.find((item) => item.timeoutMs === timeoutMs);\n\tif (choice) {\n\t\treturn choice.label;\n\t}\n\treturn `${timeoutMs / 1000} sec`;\n}\n\nconst ignoreUndiciDispatcherError = (_error: unknown): void => {};\n\n// Undici can emit an internal Client \"error\" while terminating a mid-stream\n// fetch body. The body stream still rejects through reader.read(); this listener\n// only prevents EventEmitter's unhandled \"error\" special case from crashing grip.\nfunction withUndiciErrorListener<T extends undici.Dispatcher>(dispatcher: T): T {\n\tif (dispatcher instanceof EventEmitter) {\n\t\tEventEmitter.prototype.on.call(dispatcher, \"error\", ignoreUndiciDispatcherError);\n\t}\n\treturn dispatcher;\n}\n\nfunction createUndiciClient(origin: string | URL, options: object): undici.Dispatcher {\n\treturn withUndiciErrorListener(new undici.Client(origin, options as undici.Client.Options));\n}\n\nfunction createUndiciOriginDispatcher(origin: string | URL, options: object): undici.Dispatcher {\n\tconst dispatcherOptions = options as undici.Pool.Options;\n\tif (dispatcherOptions.connections === 1) {\n\t\treturn createUndiciClient(origin, dispatcherOptions);\n\t}\n\treturn withUndiciErrorListener(\n\t\tnew undici.Pool(origin, {\n\t\t\t...dispatcherOptions,\n\t\t\tfactory: createUndiciClient,\n\t\t}),\n\t);\n}\n\nfunction isMockedFetch(fetchImplementation: typeof globalThis.fetch | undefined): boolean {\n\treturn (fetchImplementation as { _isMockFunction?: unknown } | undefined)?._isMockFunction === true;\n}\n\nexport function configureHttpDispatcher(timeoutMs: number = DEFAULT_HTTP_IDLE_TIMEOUT_MS): void {\n\tconst normalizedTimeoutMs = parseHttpIdleTimeoutMs(timeoutMs);\n\tif (normalizedTimeoutMs === undefined) {\n\t\tthrow new Error(`Invalid HTTP idle timeout: ${String(timeoutMs)}`);\n\t}\n\tconst dispatcher = withUndiciErrorListener(\n\t\tnew undici.EnvHttpProxyAgent({\n\t\t\tallowH2: false,\n\t\t\tbodyTimeout: normalizedTimeoutMs,\n\t\t\theadersTimeout: normalizedTimeoutMs,\n\t\t\tclientFactory: createUndiciClient,\n\t\t\tfactory: createUndiciOriginDispatcher,\n\t\t}),\n\t);\n\tundici.setGlobalDispatcher(dispatcher);\n\t// Keep fetch and the dispatcher on the same undici implementation. Node 26.0's\n\t// bundled fetch can otherwise consume compressed responses through npm undici's\n\t// dispatcher without decompressing them, causing response.json() failures.\n\tconst existingFetch = globalThis.fetch;\n\tundici.install?.();\n\tif (isMockedFetch(existingFetch)) {\n\t\tglobalThis.fetch = existingFetch;\n\t}\n}\n"]}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { ResourceCollision, ResourceDiagnostic } from "./diagnostics.ts";
|
|
2
|
+
import { type SourceInfo } from "./source-info.ts";
|
|
3
|
+
import type { ToolOperations } from "./tools/operations.ts";
|
|
4
|
+
export interface InstructionResourceFrontmatter {
|
|
5
|
+
name?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
tools?: string | string[];
|
|
8
|
+
"disable-model-invocation"?: boolean;
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
}
|
|
11
|
+
export interface InstructionResource {
|
|
12
|
+
name: string;
|
|
13
|
+
description: string;
|
|
14
|
+
filePath: string;
|
|
15
|
+
baseDir: string;
|
|
16
|
+
sourceInfo: SourceInfo;
|
|
17
|
+
disableModelInvocation: boolean;
|
|
18
|
+
tools?: string[];
|
|
19
|
+
content?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface InstructionResourceLoadResult<TResource extends InstructionResource> {
|
|
22
|
+
resources: TResource[];
|
|
23
|
+
diagnostics: ResourceDiagnostic[];
|
|
24
|
+
}
|
|
25
|
+
export interface InstructionResourceDirectoryOptions {
|
|
26
|
+
/** Directory to scan for instruction resources. */
|
|
27
|
+
dir: string;
|
|
28
|
+
/** Source identifier for these instruction resources. */
|
|
29
|
+
source: string;
|
|
30
|
+
}
|
|
31
|
+
interface InstructionResourcePromptFormatOptions {
|
|
32
|
+
intro: string[];
|
|
33
|
+
containerTag: string;
|
|
34
|
+
itemTag: string;
|
|
35
|
+
}
|
|
36
|
+
export interface InstructionResourceLoaderOptions {
|
|
37
|
+
cwd: string;
|
|
38
|
+
agentDir: string;
|
|
39
|
+
resourcePaths: string[];
|
|
40
|
+
includeDefaults: boolean;
|
|
41
|
+
}
|
|
42
|
+
export interface InstructionResourceLoaderWithOperationsOptions extends InstructionResourceLoaderOptions {
|
|
43
|
+
operations: ToolOperations;
|
|
44
|
+
}
|
|
45
|
+
export interface InstructionResourceLoaderConfig {
|
|
46
|
+
resourceType: ResourceCollision["resourceType"];
|
|
47
|
+
defaultDirectoryName: string;
|
|
48
|
+
rootFileName: string;
|
|
49
|
+
}
|
|
50
|
+
export declare abstract class InstructionResourceLoader<TResource extends InstructionResource, TFrontmatter extends InstructionResourceFrontmatter> {
|
|
51
|
+
private resourceType;
|
|
52
|
+
private defaultDirectoryName;
|
|
53
|
+
private rootFileName;
|
|
54
|
+
constructor(config: InstructionResourceLoaderConfig);
|
|
55
|
+
protected abstract createResource(resource: InstructionResource, frontmatter: TFrontmatter): TResource;
|
|
56
|
+
protected loadResourcesFromDir(dir: string, source: string): InstructionResourceLoadResult<TResource>;
|
|
57
|
+
private loadResourcesFromConfiguredPath;
|
|
58
|
+
protected loadResources(options: InstructionResourceLoaderOptions): InstructionResourceLoadResult<TResource>;
|
|
59
|
+
private loadResourcesFromConfiguredPathWithOperations;
|
|
60
|
+
protected loadResourcesWithOperations(options: InstructionResourceLoaderWithOperationsOptions): Promise<InstructionResourceLoadResult<TResource>>;
|
|
61
|
+
private createCollisionDiagnostic;
|
|
62
|
+
private addIgnoreRules;
|
|
63
|
+
private addIgnoreRulesWithOperations;
|
|
64
|
+
private getLocalResourceEntry;
|
|
65
|
+
private loadRootResourceFromEntries;
|
|
66
|
+
private loadNestedResourceEntry;
|
|
67
|
+
private loadNestedResourcesFromEntries;
|
|
68
|
+
private loadResourcesFromDirInternal;
|
|
69
|
+
private getBackendResourceEntry;
|
|
70
|
+
private loadRootResourceWithOperations;
|
|
71
|
+
private loadNestedResourceWithOperations;
|
|
72
|
+
private loadNestedResourcesWithOperations;
|
|
73
|
+
private loadResourcesFromDirInternalWithOperations;
|
|
74
|
+
private loadResourceFromFile;
|
|
75
|
+
private loadResourceFromFileWithOperations;
|
|
76
|
+
private parseResource;
|
|
77
|
+
private createParseError;
|
|
78
|
+
}
|
|
79
|
+
export declare function formatInstructionResourcesForPrompt(resources: InstructionResource[], options: InstructionResourcePromptFormatOptions): string;
|
|
80
|
+
export {};
|
|
81
|
+
//# sourceMappingURL=instruction-resource-loader.d.ts.map
|