@code-yeongyu/senpi 2026.9.12 → 2026.9.13
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 +76 -0
- package/README.md +1 -1
- package/dist/bun/cli.d.ts +2 -1
- package/dist/bun/cli.d.ts.map +1 -1
- package/dist/bun/cli.js +5 -8
- package/dist/bun/cli.js.map +1 -1
- package/dist/bun/runtime-setup.d.ts +2 -0
- package/dist/bun/runtime-setup.d.ts.map +1 -0
- package/dist/bun/runtime-setup.js +9 -0
- package/dist/bun/runtime-setup.js.map +1 -0
- package/dist/bun/sandbox-env-setup.d.ts +2 -0
- package/dist/bun/sandbox-env-setup.d.ts.map +1 -0
- package/dist/bun/sandbox-env-setup.js +4 -0
- package/dist/bun/sandbox-env-setup.js.map +1 -0
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js +2 -1
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/setup.d.ts +2 -0
- package/dist/cli/setup.d.ts.map +1 -0
- package/dist/cli/setup.js +12 -0
- package/dist/cli/setup.js.map +1 -0
- package/dist/cli.js +3 -0
- package/dist/cli.js.map +1 -1
- package/dist/client/index.d.ts +1 -2
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -2
- package/dist/client/index.js.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -0
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +18 -6
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session.d.ts +54 -17
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +153 -157
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts +1 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +6 -4
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction-settings-access.d.ts +18 -2
- package/dist/core/compaction-settings-access.d.ts.map +1 -1
- package/dist/core/compaction-settings-access.js +35 -4
- package/dist/core/compaction-settings-access.js.map +1 -1
- package/dist/core/compaction-settings-resolver.d.ts +2 -2
- package/dist/core/compaction-settings-resolver.d.ts.map +1 -1
- package/dist/core/compaction-settings-resolver.js +6 -3
- package/dist/core/compaction-settings-resolver.js.map +1 -1
- package/dist/core/cursor-history-admission.d.ts +50 -0
- package/dist/core/cursor-history-admission.d.ts.map +1 -0
- package/dist/core/cursor-history-admission.js +130 -0
- package/dist/core/cursor-history-admission.js.map +1 -0
- package/dist/core/extensions/builtin/ask-user/extension.d.ts.map +1 -1
- package/dist/core/extensions/builtin/ask-user/extension.js +11 -0
- package/dist/core/extensions/builtin/ask-user/extension.js.map +1 -1
- package/dist/core/extensions/builtin/ask-user/notify.d.ts +12 -0
- package/dist/core/extensions/builtin/ask-user/notify.d.ts.map +1 -0
- package/dist/core/extensions/builtin/ask-user/notify.js +8 -0
- package/dist/core/extensions/builtin/ask-user/notify.js.map +1 -0
- package/dist/core/extensions/builtin/ask-user/resume.d.ts +1 -1
- package/dist/core/extensions/builtin/ask-user/resume.d.ts.map +1 -1
- package/dist/core/extensions/builtin/ask-user/resume.js +16 -11
- package/dist/core/extensions/builtin/ask-user/resume.js.map +1 -1
- package/dist/core/extensions/builtin/ask-user/tool.d.ts.map +1 -1
- package/dist/core/extensions/builtin/ask-user/tool.js +9 -4
- package/dist/core/extensions/builtin/ask-user/tool.js.map +1 -1
- package/dist/core/extensions/builtin/cursor-cli-oauth/models.d.ts.map +1 -1
- package/dist/core/extensions/builtin/cursor-cli-oauth/models.js +2 -1
- package/dist/core/extensions/builtin/cursor-cli-oauth/models.js.map +1 -1
- package/dist/core/extensions/builtin/hooks/config-loader.d.ts +2 -0
- package/dist/core/extensions/builtin/hooks/config-loader.d.ts.map +1 -1
- package/dist/core/extensions/builtin/hooks/config-loader.js +27 -0
- package/dist/core/extensions/builtin/hooks/config-loader.js.map +1 -1
- package/dist/core/extensions/builtin/hooks/dispatcher.js +1 -0
- package/dist/core/extensions/builtin/hooks/dispatcher.js.map +1 -1
- package/dist/core/extensions/builtin/hooks/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/hooks/index.js +41 -2
- package/dist/core/extensions/builtin/hooks/index.js.map +1 -1
- package/dist/core/extensions/builtin/hooks/lifecycle-adapter.d.ts +18 -1
- package/dist/core/extensions/builtin/hooks/lifecycle-adapter.d.ts.map +1 -1
- package/dist/core/extensions/builtin/hooks/lifecycle-adapter.js +36 -1
- package/dist/core/extensions/builtin/hooks/lifecycle-adapter.js.map +1 -1
- package/dist/core/extensions/builtin/hooks/matcher.js +1 -0
- package/dist/core/extensions/builtin/hooks/matcher.js.map +1 -1
- package/dist/core/extensions/builtin/hooks/output-parser.js +6 -0
- package/dist/core/extensions/builtin/hooks/output-parser.js.map +1 -1
- package/dist/core/extensions/builtin/hooks/trust-storage.d.ts +2 -0
- package/dist/core/extensions/builtin/hooks/trust-storage.d.ts.map +1 -1
- package/dist/core/extensions/builtin/hooks/trust-storage.js +13 -0
- package/dist/core/extensions/builtin/hooks/trust-storage.js.map +1 -1
- package/dist/core/extensions/builtin/hooks/types.d.ts +14 -2
- package/dist/core/extensions/builtin/hooks/types.d.ts.map +1 -1
- package/dist/core/extensions/builtin/hooks/types.js +1 -1
- package/dist/core/extensions/builtin/hooks/types.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/presets.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/presets.js +7 -1
- package/dist/core/extensions/builtin/prompt-preset/presets.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +4 -2
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/keybindings.d.ts +10 -0
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +8 -0
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/messages.d.ts +1 -1
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js.map +1 -1
- package/dist/core/model-registry.d.ts +5 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +8 -0
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +2 -0
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts +1 -0
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +5 -2
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/retry-fallback/settings.d.ts +2 -0
- package/dist/core/retry-fallback/settings.d.ts.map +1 -1
- package/dist/core/retry-fallback/settings.js.map +1 -1
- package/dist/core/session-manager.d.ts +5 -2
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +68 -19
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/session-write-reservation.d.ts +9 -0
- package/dist/core/session-write-reservation.d.ts.map +1 -1
- package/dist/core/session-write-reservation.js +33 -0
- package/dist/core/session-write-reservation.js.map +1 -1
- package/dist/core/settings-manager.d.ts +12 -5
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +18 -6
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/settings-public-types.d.ts +1 -1
- package/dist/core/settings-public-types.d.ts.map +1 -1
- package/dist/core/settings-public-types.js.map +1 -1
- package/dist/core/skills.d.ts +1 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +6 -2
- package/dist/core/skills.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +8 -9
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +3 -142
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit.d.ts +1 -12
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +4 -168
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +2 -53
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +2 -58
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +2 -47
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/read.d.ts +1 -4
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +4 -141
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/renderers/bash.d.ts +12 -0
- package/dist/core/tools/renderers/bash.d.ts.map +1 -0
- package/dist/core/tools/renderers/bash.js +156 -0
- package/dist/core/tools/renderers/bash.js.map +1 -0
- package/dist/core/tools/renderers/edit.d.ts +23 -0
- package/dist/core/tools/renderers/edit.d.ts.map +1 -0
- package/dist/core/tools/renderers/edit.js +172 -0
- package/dist/core/tools/renderers/edit.js.map +1 -0
- package/dist/core/tools/renderers/find.d.ts +10 -0
- package/dist/core/tools/renderers/find.d.ts.map +1 -0
- package/dist/core/tools/renderers/find.js +64 -0
- package/dist/core/tools/renderers/find.js.map +1 -0
- package/dist/core/tools/renderers/grep.d.ts +10 -0
- package/dist/core/tools/renderers/grep.d.ts.map +1 -0
- package/dist/core/tools/renderers/grep.js +69 -0
- package/dist/core/tools/renderers/grep.js.map +1 -0
- package/dist/core/tools/renderers/index.d.ts +28 -0
- package/dist/core/tools/renderers/index.d.ts.map +1 -0
- package/dist/core/tools/renderers/index.js +47 -0
- package/dist/core/tools/renderers/index.js.map +1 -0
- package/dist/core/tools/renderers/ls.d.ts +10 -0
- package/dist/core/tools/renderers/ls.d.ts.map +1 -0
- package/dist/core/tools/renderers/ls.js +58 -0
- package/dist/core/tools/renderers/ls.js.map +1 -0
- package/dist/core/tools/renderers/read.d.ts +19 -0
- package/dist/core/tools/renderers/read.d.ts.map +1 -0
- package/dist/core/tools/renderers/read.js +149 -0
- package/dist/core/tools/renderers/read.js.map +1 -0
- package/dist/core/tools/renderers/write.d.ts +10 -0
- package/dist/core/tools/renderers/write.d.ts.map +1 -0
- package/dist/core/tools/renderers/write.js +162 -0
- package/dist/core/tools/renderers/write.js.map +1 -0
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +4 -153
- package/dist/core/tools/write.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +2 -2
- package/dist/migrations.js.map +1 -1
- package/dist/modes/app-server/threads/turn-runtime.d.ts +3 -1
- package/dist/modes/app-server/threads/turn-runtime.d.ts.map +1 -1
- package/dist/modes/app-server/threads/turn-runtime.js.map +1 -1
- package/dist/modes/app-server/threads/turns.js +1 -1
- package/dist/modes/app-server/threads/turns.js.map +1 -1
- package/dist/modes/app-server/turn-adapter.js +4 -2
- package/dist/modes/app-server/turn-adapter.js.map +1 -1
- package/dist/modes/interactive/chat-viewport.d.ts +22 -0
- package/dist/modes/interactive/chat-viewport.d.ts.map +1 -0
- package/dist/modes/interactive/chat-viewport.js +29 -0
- package/dist/modes/interactive/chat-viewport.js.map +1 -0
- package/dist/modes/interactive/components/ask-user-answer-key.d.ts +14 -0
- package/dist/modes/interactive/components/ask-user-answer-key.d.ts.map +1 -0
- package/dist/modes/interactive/components/ask-user-answer-key.js +65 -0
- package/dist/modes/interactive/components/ask-user-answer-key.js.map +1 -0
- package/dist/modes/interactive/components/ask-user-async-widget.d.ts +17 -12
- package/dist/modes/interactive/components/ask-user-async-widget.d.ts.map +1 -1
- package/dist/modes/interactive/components/ask-user-async-widget.js +47 -23
- package/dist/modes/interactive/components/ask-user-async-widget.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +7 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +26 -2
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/assistant-render-descriptors.d.ts +4 -0
- package/dist/modes/interactive/components/assistant-render-descriptors.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-render-descriptors.js +8 -5
- package/dist/modes/interactive/components/assistant-render-descriptors.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +10 -1
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +37 -1
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts +1 -1
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +8 -8
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/status-indicator.d.ts +4 -1
- package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
- package/dist/modes/interactive/components/status-indicator.js +14 -2
- package/dist/modes/interactive/components/status-indicator.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +4 -4
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution-renderer.d.ts +4 -1
- package/dist/modes/interactive/components/tool-execution-renderer.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution-renderer.js +23 -10
- package/dist/modes/interactive/components/tool-execution-renderer.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution-types.d.ts +18 -2
- package/dist/modes/interactive/components/tool-execution-types.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution-types.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +3 -3
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +5 -0
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +10 -15
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +178 -138
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/dark.json +2 -1
- package/dist/modes/interactive/theme/grok-day.json +2 -1
- package/dist/modes/interactive/theme/grok-night.json +2 -1
- package/dist/modes/interactive/theme/light.json +2 -1
- package/dist/modes/interactive/theme/theme-controller.d.ts +1 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.js +5 -0
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
- package/dist/modes/interactive/theme/theme-json.d.ts +84 -0
- package/dist/modes/interactive/theme/theme-json.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-json.js +130 -0
- package/dist/modes/interactive/theme/theme-json.js.map +1 -0
- package/dist/modes/interactive/theme/theme-schema.json +6 -2
- package/dist/modes/interactive/theme/theme.d.ts +10 -5
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +14 -117
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/interactive/tips/catalog/input-tips.d.ts +5 -0
- package/dist/modes/interactive/tips/catalog/input-tips.d.ts.map +1 -1
- package/dist/modes/interactive/tips/catalog/input-tips.js +5 -0
- package/dist/modes/interactive/tips/catalog/input-tips.js.map +1 -1
- package/dist/modes/interactive/tui-renderer.d.ts +21 -0
- package/dist/modes/interactive/tui-renderer.d.ts.map +1 -0
- package/dist/modes/interactive/tui-renderer.js +67 -0
- package/dist/modes/interactive/tui-renderer.js.map +1 -0
- package/dist/modes/rpc/connection-handler.d.ts.map +1 -1
- package/dist/modes/rpc/connection-handler.js +8 -2
- package/dist/modes/rpc/connection-handler.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +11 -1
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +2 -1
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js +1 -0
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/modes/rpc/session-path-reservations.d.ts +30 -0
- package/dist/modes/rpc/session-path-reservations.d.ts.map +1 -0
- package/dist/modes/rpc/session-path-reservations.js +58 -0
- package/dist/modes/rpc/session-path-reservations.js.map +1 -0
- package/dist/modes/rpc/session-registry.d.ts +3 -1
- package/dist/modes/rpc/session-registry.d.ts.map +1 -1
- package/dist/modes/rpc/session-registry.js.map +1 -1
- package/dist/modes/rpc/session-worker-client.d.ts +10 -8
- package/dist/modes/rpc/session-worker-client.d.ts.map +1 -1
- package/dist/modes/rpc/session-worker-client.js +14 -23
- package/dist/modes/rpc/session-worker-client.js.map +1 -1
- package/dist/modes/rpc/session-worker-credit.d.ts +17 -0
- package/dist/modes/rpc/session-worker-credit.d.ts.map +1 -0
- package/dist/modes/rpc/session-worker-credit.js +39 -0
- package/dist/modes/rpc/session-worker-credit.js.map +1 -0
- package/dist/modes/rpc/session-worker-protocol.d.ts +10 -0
- package/dist/modes/rpc/session-worker-protocol.d.ts.map +1 -1
- package/dist/modes/rpc/session-worker-protocol.js +2 -0
- package/dist/modes/rpc/session-worker-protocol.js.map +1 -1
- package/dist/modes/rpc/session-worker-signals.d.ts +7 -0
- package/dist/modes/rpc/session-worker-signals.d.ts.map +1 -0
- package/dist/modes/rpc/session-worker-signals.js +19 -0
- package/dist/modes/rpc/session-worker-signals.js.map +1 -0
- package/dist/modes/rpc/session-worker.js +12 -16
- package/dist/modes/rpc/session-worker.js.map +1 -1
- package/dist/modes/rpc/worker-session-registry.d.ts +12 -0
- package/dist/modes/rpc/worker-session-registry.d.ts.map +1 -1
- package/dist/modes/rpc/worker-session-registry.js +51 -24
- package/dist/modes/rpc/worker-session-registry.js.map +1 -1
- package/dist/senpi +3 -0
- package/dist/utils/clipboard-command.d.ts +7 -0
- package/dist/utils/clipboard-command.d.ts.map +1 -0
- package/dist/utils/clipboard-command.js +45 -0
- package/dist/utils/clipboard-command.js.map +1 -0
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +52 -69
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +49 -126
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/exif-orientation.d.ts.map +1 -1
- package/dist/utils/exif-orientation.js +2 -3
- package/dist/utils/exif-orientation.js.map +1 -1
- package/dist/utils/tools-manager.d.ts +1 -0
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +41 -19
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/compaction.md +39 -13
- package/docs/containerization.md +45 -0
- package/docs/development.md +19 -0
- package/docs/docs.json +4 -0
- package/docs/environment-variables.md +2 -0
- package/docs/extensions.md +21 -10
- package/docs/keybindings.md +7 -2
- package/docs/models.md +1 -1
- package/docs/providers.md +1 -1
- package/docs/rpc.md +16 -8
- package/docs/sdk.md +7 -0
- package/docs/session-format.md +52 -38
- package/docs/settings.md +40 -4
- package/docs/skills.md +1 -1
- package/docs/termux.md +0 -1
- package/docs/themes.md +8 -6
- package/docs/tui.md +22 -3
- package/examples/README.md +3 -0
- package/examples/extensions/dynamic-resources/dynamic.json +2 -0
- package/examples/plugins/pi-example-plugin/README.md +38 -0
- package/examples/plugins/pi-example-plugin/package.json +10 -0
- package/examples/plugins/pi-example-plugin/src/contract.ts +13 -0
- package/examples/plugins/pi-example-plugin/src/session.ts +23 -0
- package/examples/plugins/pi-example-plugin/src/tui.ts +31 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/index.js +1 -1
- package/node_modules/@aws-sdk/client-bedrock-runtime/package.json +3 -3
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/util/index.js +5 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/util/hasOwn.js +3 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/util/index.js +1 -0
- package/node_modules/@aws-sdk/core/dist-types/submodules/util/hasOwn.d.ts +4 -0
- package/node_modules/@aws-sdk/core/dist-types/submodules/util/index.d.ts +1 -0
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/util/hasOwn.d.ts +1 -0
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/util/index.d.ts +1 -0
- package/node_modules/@aws-sdk/core/package.json +1 -1
- package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-http/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +9 -9
- package/node_modules/@aws-sdk/credential-provider-login/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-node/dist-cjs/index.js +2 -0
- package/node_modules/@aws-sdk/credential-provider-node/dist-es/runtime/memoize-chain.js +2 -0
- package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/LICENSE +201 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/README.md +62 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-cjs/index.js +158 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/constants.js +2 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/fromEnvSigningName.js +16 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/fromSso.js +84 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/fromStatic.js +8 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/getNewSsoOidcToken.js +11 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/getSsoOidcClient.js +10 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/index.js +4 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/nodeProvider.js +5 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/validateTokenExpiry.js +7 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/validateTokenKey.js +7 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/writeSSOTokenToFile.js +8 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/constants.d.ts +8 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/fromEnvSigningName.d.ts +18 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/fromSso.d.ts +12 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/fromStatic.d.ts +9 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/getNewSsoOidcToken.d.ts +8 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/getSsoOidcClient.d.ts +7 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/index.d.ts +7 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/nodeProvider.d.ts +18 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/constants.d.ts +3 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/fromEnvSigningName.d.ts +8 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/fromSso.d.ts +10 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/fromStatic.d.ts +5 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/getNewSsoOidcToken.d.ts +9 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/getSsoOidcClient.d.ts +7 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/index.d.ts +7 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/nodeProvider.d.ts +3 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/validateTokenExpiry.d.ts +2 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/validateTokenKey.d.ts +1 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/writeSSOTokenToFile.d.ts +2 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/validateTokenExpiry.d.ts +5 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/validateTokenKey.d.ts +4 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/writeSSOTokenToFile.d.ts +5 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/package.json +69 -0
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/package.json +2 -2
- package/node_modules/@aws-sdk/token-providers/package.json +1 -1
- package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +36 -0
- package/node_modules/@code-yeongyu/senpi-codemode/package.json +5 -5
- package/node_modules/@earendil-works/chord/README.md +205 -0
- package/node_modules/@earendil-works/chord/dist/api.d.ts +15 -0
- package/node_modules/@earendil-works/chord/dist/api.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/api.js +72 -0
- package/node_modules/@earendil-works/chord/dist/api.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/bundler.d.ts +6 -0
- package/node_modules/@earendil-works/chord/dist/bundler.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/bundler.js +3 -0
- package/node_modules/@earendil-works/chord/dist/bundler.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/context/index.d.ts +24 -0
- package/node_modules/@earendil-works/chord/dist/context/index.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/context/index.js +97 -0
- package/node_modules/@earendil-works/chord/dist/context/index.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/delta/index.d.ts +119 -0
- package/node_modules/@earendil-works/chord/dist/delta/index.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/delta/index.js +1209 -0
- package/node_modules/@earendil-works/chord/dist/delta/index.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/facets/host.d.ts +12 -0
- package/node_modules/@earendil-works/chord/dist/facets/host.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/facets/host.js +762 -0
- package/node_modules/@earendil-works/chord/dist/facets/host.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/facets/loader.d.ts +3 -0
- package/node_modules/@earendil-works/chord/dist/facets/loader.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/facets/loader.js +5 -0
- package/node_modules/@earendil-works/chord/dist/facets/loader.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/index.d.ts +11 -0
- package/node_modules/@earendil-works/chord/dist/index.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/index.js +10 -0
- package/node_modules/@earendil-works/chord/dist/index.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/json.d.ts +4 -0
- package/node_modules/@earendil-works/chord/dist/json.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/json.js +57 -0
- package/node_modules/@earendil-works/chord/dist/json.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/node/bundle-loader.d.ts +30 -0
- package/node_modules/@earendil-works/chord/dist/node/bundle-loader.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/node/bundle-loader.js +377 -0
- package/node_modules/@earendil-works/chord/dist/node/bundle-loader.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/node/bundle.d.ts +26 -0
- package/node_modules/@earendil-works/chord/dist/node/bundle.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/node/bundle.js +183 -0
- package/node_modules/@earendil-works/chord/dist/node/bundle.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/node/manifest.d.ts +36 -0
- package/node_modules/@earendil-works/chord/dist/node/manifest.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/node/manifest.js +6 -0
- package/node_modules/@earendil-works/chord/dist/node/manifest.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/node/package.d.ts +15 -0
- package/node_modules/@earendil-works/chord/dist/node/package.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/node/package.js +199 -0
- package/node_modules/@earendil-works/chord/dist/node/package.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/node.d.ts +5 -0
- package/node_modules/@earendil-works/chord/dist/node.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/node.js +3 -0
- package/node_modules/@earendil-works/chord/dist/node.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/services/consumer.d.ts +11 -0
- package/node_modules/@earendil-works/chord/dist/services/consumer.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/services/consumer.js +535 -0
- package/node_modules/@earendil-works/chord/dist/services/consumer.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/services/errors.d.ts +8 -0
- package/node_modules/@earendil-works/chord/dist/services/errors.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/services/errors.js +21 -0
- package/node_modules/@earendil-works/chord/dist/services/errors.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/services/handle.d.ts +15 -0
- package/node_modules/@earendil-works/chord/dist/services/handle.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/services/handle.js +99 -0
- package/node_modules/@earendil-works/chord/dist/services/handle.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/services/instances.d.ts +25 -0
- package/node_modules/@earendil-works/chord/dist/services/instances.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/services/instances.js +137 -0
- package/node_modules/@earendil-works/chord/dist/services/instances.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/services/loopback.d.ts +5 -0
- package/node_modules/@earendil-works/chord/dist/services/loopback.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/services/loopback.js +15 -0
- package/node_modules/@earendil-works/chord/dist/services/loopback.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/services/provider.d.ts +37 -0
- package/node_modules/@earendil-works/chord/dist/services/provider.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/services/provider.js +472 -0
- package/node_modules/@earendil-works/chord/dist/services/provider.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/services/state-codec.d.ts +15 -0
- package/node_modules/@earendil-works/chord/dist/services/state-codec.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/services/state-codec.js +115 -0
- package/node_modules/@earendil-works/chord/dist/services/state-codec.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/services/state-internals.d.ts +11 -0
- package/node_modules/@earendil-works/chord/dist/services/state-internals.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/services/state-internals.js +10 -0
- package/node_modules/@earendil-works/chord/dist/services/state-internals.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/services/state.d.ts +23 -0
- package/node_modules/@earendil-works/chord/dist/services/state.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/services/state.js +124 -0
- package/node_modules/@earendil-works/chord/dist/services/state.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/services/wire.d.ts +60 -0
- package/node_modules/@earendil-works/chord/dist/services/wire.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/services/wire.js +173 -0
- package/node_modules/@earendil-works/chord/dist/services/wire.js.map +1 -0
- package/node_modules/@earendil-works/chord/dist/types.d.ts +203 -0
- package/node_modules/@earendil-works/chord/dist/types.d.ts.map +1 -0
- package/node_modules/@earendil-works/chord/dist/types.js +2 -0
- package/node_modules/@earendil-works/chord/dist/types.js.map +1 -0
- package/node_modules/@earendil-works/chord/package.json +73 -0
- package/node_modules/@earendil-works/pi-agent-core/README.md +4 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts +639 -384
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js +5 -250
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.d.ts +12 -6
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js +33 -27
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts +30 -8
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +53 -64
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/config.d.ts +9 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/config.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/config.js +35 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/config.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/context.d.ts +9 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/context.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/context.js +13 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/context.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.d.ts +25 -28
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js +368 -125
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/events.d.ts +20 -38
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/events.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/events.js +233 -55
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/events.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/assistant.d.ts +42 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/assistant.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/assistant.js +82 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/assistant.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/effect-gate.d.ts +22 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/effect-gate.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/effect-gate.js +48 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/effect-gate.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/tools.d.ts +67 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/tools.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/tools.js +121 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/tools.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/hooks.d.ts +38 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/hooks.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/hooks.js +404 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/hooks.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.d.ts +2 -2
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.d.ts +3 -2
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.js +17 -17
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/result.d.ts +93 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/result.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/result.js +39 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/result.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/boundary.d.ts +28 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/boundary.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/boundary.js +173 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/boundary.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/checkpoint.d.ts +8 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/checkpoint.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/checkpoint.js +133 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/checkpoint.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/deferred.d.ts +15 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/deferred.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/deferred.js +179 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/deferred.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/generation.d.ts +8 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/generation.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/generation.js +205 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/generation.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/reconcile.d.ts +5 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/reconcile.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/reconcile.js +140 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/reconcile.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/recovery.d.ts +8 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/recovery.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/recovery.js +85 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/recovery.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/response.d.ts +23 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/response.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/response.js +394 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/response.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/retry.d.ts +4 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/retry.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/retry.js +34 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/retry.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/structural.d.ts +32 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/structural.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/structural.js +929 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/structural.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/terminal.d.ts +7 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/terminal.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/terminal.js +49 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/terminal.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tool-placement.d.ts +14 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tool-placement.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tool-placement.js +244 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tool-placement.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tools.d.ts +6 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tools.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tools.js +449 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tools.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive.d.ts +6 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive.js +93 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/harness.d.ts +59 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/harness.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/harness.js +302 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/harness.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/index.d.ts +2 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/index.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/index.js +2 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/index.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/lane.d.ts +118 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/lane.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/lane.js +1559 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/lane.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/progress.d.ts +15 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/progress.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/progress.js +66 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/progress.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/reducer.d.ts +5 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/reducer.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/reducer.js +240 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/reducer.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/restore.d.ts +24 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/restore.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/restore.js +117 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/restore.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/transcript.d.ts +21 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/transcript.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/transcript.js +72 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/transcript.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/types.d.ts +105 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/types.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/types.js +50 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/types.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/commit.d.ts +53 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/commit.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/commit.js +57 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/commit.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/context.d.ts +6 -19
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/context.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/context.js +31 -53
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/context.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork-policy.d.ts +21 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork-policy.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork-policy.js +55 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork-policy.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.d.ts +16 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.js +79 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/in-memory-storage-state.d.ts +39 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/in-memory-storage-state.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/in-memory-storage-state.js +269 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/in-memory-storage-state.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/index.d.ts +9 -5
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/index.js +7 -4
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/codec.d.ts +19 -8
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/codec.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/codec.js +34 -219
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/codec.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/fork.d.ts +38 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/fork.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/fork.js +266 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/fork.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/index.d.ts +4 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/index.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/index.js +4 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/index.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/io.d.ts +14 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/io.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/io.js +86 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/io.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/legacy-v3.d.ts +44 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/legacy-v3.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/legacy-v3.js +454 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/legacy-v3.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/repo.d.ts +27 -24
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/repo.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/repo.js +276 -151
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/repo.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/storage.d.ts +39 -41
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/storage.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/storage.js +175 -196
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/storage.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/types.d.ts +23 -22
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/types.js +2 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory.d.ts +44 -40
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory.js +333 -115
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/mutation-line.d.ts +8 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/mutation-line.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/mutation-line.js +22 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/mutation-line.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts +78 -51
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js +327 -207
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/datasets.d.ts +12 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/datasets.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/datasets.js +24 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/datasets.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/session-repo.d.ts +42 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/session-repo.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/session-repo.js +127 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/session-repo.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/storage.d.ts +25 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/storage.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/storage.js +114 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/storage.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/session-repo.d.ts +23 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/session-repo.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/session-repo.js +809 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/session-repo.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/storage.d.ts +4 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/storage.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/storage.js +600 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/storage.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/gating-storage.d.ts +26 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/gating-storage.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/gating-storage.js +103 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/gating-storage.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/index.d.ts +9 -2
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/index.js +8 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/instrumented-storage.d.ts +11 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/instrumented-storage.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/instrumented-storage.js +19 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/instrumented-storage.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/storage-decorator.d.ts +20 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/storage-decorator.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/storage-decorator.js +40 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/storage-decorator.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/types.d.ts +5 -7
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/types.d.ts +425 -265
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/types.js +7 -7
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/values.d.ts +95 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/values.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/values.js +81 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/values.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.d.ts +3 -2
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.js +29 -26
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/telemetry.d.ts +64 -43
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/telemetry.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/telemetry.js +45 -26
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/telemetry.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/bash.d.ts +4 -4
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/bash.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/bash.js +66 -93
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/bash.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit.js +17 -13
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/file-mutation-queue.d.ts +2 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/file-mutation-queue.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/file-mutation-queue.js +5 -5
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/file-mutation-queue.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/path-utils.d.ts +3 -2
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/path-utils.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/path-utils.js +5 -5
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/path-utils.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/read.d.ts +2 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/read.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/read.js +4 -6
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/read.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.js +12 -8
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts +128 -45
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/adaptive-publisher.d.ts +24 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/adaptive-publisher.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/adaptive-publisher.js +79 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/adaptive-publisher.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/output-capture.d.ts +31 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/output-capture.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/output-capture.js +217 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/output-capture.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.d.ts +19 -5
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.js +65 -192
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.d.ts +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.js +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/usage.d.ts +4 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/usage.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/usage.js +33 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/usage.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts +4 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/index.js +3 -6
- package/node_modules/@earendil-works/pi-agent-core/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/search/index.d.ts +24 -16
- package/node_modules/@earendil-works/pi-agent-core/dist/search/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/search/index.js +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/search/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +2 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/package.json +27 -6
- package/node_modules/@earendil-works/pi-ai/README.md +39 -4
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +8 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-ai-binding.d.ts +77 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-ai-binding.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-ai-binding.js +72 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-ai-binding.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/measure.d.ts +11 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/measure.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/measure.js +18 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/measure.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.d.ts +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.js +5 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +4 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +6 -3
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js +4 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +13 -3
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/cursor/context-limit-store.d.ts +32 -0
- package/node_modules/@earendil-works/pi-ai/dist/cursor/context-limit-store.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/cursor/context-limit-store.js +62 -0
- package/node_modules/@earendil-works/pi-ai/dist/cursor/context-limit-store.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/cursor/store-migration.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/cursor/store-migration.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/cursor/store-migration.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/index.d.ts +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/index.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.d.ts +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.js +5 -2
- package/node_modules/@earendil-works/pi-ai/dist/models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/openai-responses-compat.d.ts +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/openai-responses-compat.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/openai-responses-compat.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.js +4 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/cursor.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/cursor.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/cursor.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/azure-openai-responses.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/baseten.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/deepseek.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai-codex.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-cn.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-individual.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/xai.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js +5 -5
- package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.js +4 -3
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-headers.d.ts +4 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-headers.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-headers.js +22 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-headers.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.js +5 -4
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +16 -6
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/assistant-message-frame.d.ts +77 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/assistant-message-frame.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/assistant-message-frame.js +427 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/assistant-message-frame.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/cursor-context-limit.d.ts +12 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/cursor-context-limit.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/cursor-context-limit.js +93 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/cursor-context-limit.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js +25 -5
- package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/prompt-cache-ttl.d.ts +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/prompt-cache-ttl.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/prompt-cache-ttl.js +5 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/prompt-cache-ttl.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/types.d.ts +10 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry.d.ts +13 -2
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js +18 -7
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/uuid.d.ts +2 -2
- package/node_modules/@earendil-works/pi-ai/dist/utils/uuid.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/uuid.js +36 -31
- package/node_modules/@earendil-works/pi-ai/dist/utils/uuid.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/package.json +6 -6
- package/node_modules/@earendil-works/pi-pty/package.json +1 -1
- package/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
- package/node_modules/@earendil-works/pi-tui/README.md +53 -4
- package/node_modules/@earendil-works/pi-tui/dist/alt-screen-search.d.ts +21 -1
- package/node_modules/@earendil-works/pi-tui/dist/alt-screen-search.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/alt-screen-search.js +199 -42
- package/node_modules/@earendil-works/pi-tui/dist/alt-screen-search.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts +3 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/box.js +28 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/box.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts +6 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +98 -18
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts +12 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/input.js +40 -6
- package/node_modules/@earendil-works/pi-tui/dist/components/input.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/latex.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/latex.js +7 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/latex.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts +3 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/loader.js +20 -8
- package/node_modules/@earendil-works/pi-tui/dist/components/loader.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/mouse-region.d.ts +12 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/mouse-region.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/mouse-region.js +19 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/mouse-region.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/scroll-view.d.ts +6 -3
- package/node_modules/@earendil-works/pi-tui/dist/components/scroll-view.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/scroll-view.js +6 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/scroll-view.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts +4 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/select-list.js +48 -2
- package/node_modules/@earendil-works/pi-tui/dist/components/select-list.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts +5 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js +54 -5
- package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.d.ts +3 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.js +3 -0
- package/node_modules/@earendil-works/pi-tui/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/layout.d.ts +3 -1
- package/node_modules/@earendil-works/pi-tui/dist/layout.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/layout.js +32 -9
- package/node_modules/@earendil-works/pi-tui/dist/layout.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.d.ts +2 -1
- package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.js +3 -44
- package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/native-platform.d.ts +18 -0
- package/node_modules/@earendil-works/pi-tui/dist/native-platform.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/native-platform.js +42 -0
- package/node_modules/@earendil-works/pi-tui/dist/native-platform.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal.js +2 -20
- package/node_modules/@earendil-works/pi-tui/dist/terminal.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts +31 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js +335 -41
- package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts +83 -5
- package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui.js +118 -4
- package/node_modules/@earendil-works/pi-tui/dist/tui.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts +2 -0
- package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/utils.js +9 -0
- package/node_modules/@earendil-works/pi-tui/dist/utils.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/native/clipboard.h +170 -0
- package/node_modules/@earendil-works/pi-tui/native/darwin/README.md +8 -6
- package/node_modules/@earendil-works/pi-tui/native/darwin/build.sh +12 -5
- package/node_modules/@earendil-works/pi-tui/native/darwin/prebuilds/darwin-arm64/{darwin-modifiers.node → darwin-platform.node} +0 -0
- package/node_modules/@earendil-works/pi-tui/native/darwin/prebuilds/darwin-x64/{darwin-modifiers.node → darwin-platform.node} +0 -0
- package/node_modules/@earendil-works/pi-tui/native/darwin/src/darwin-platform.m +93 -0
- package/node_modules/@earendil-works/pi-tui/native/linux/README.md +23 -0
- package/node_modules/@earendil-works/pi-tui/native/linux/build.sh +65 -0
- package/node_modules/@earendil-works/pi-tui/native/linux/prebuilds/linux-arm64/linux-platform-x11.node +0 -0
- package/node_modules/@earendil-works/pi-tui/native/linux/prebuilds/linux-x64/linux-platform-x11.node +0 -0
- package/node_modules/@earendil-works/pi-tui/native/linux/src/clipboard-worker.h +70 -0
- package/node_modules/@earendil-works/pi-tui/native/linux/src/linux-platform-x11.c +274 -0
- package/node_modules/@earendil-works/pi-tui/native/napi.h +89 -0
- package/node_modules/@earendil-works/pi-tui/native/win32/README.md +18 -7
- package/node_modules/@earendil-works/pi-tui/native/win32/build.mjs +7 -4
- package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-arm64/win32-platform.node +0 -0
- package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-x64/win32-platform.node +0 -0
- package/node_modules/@earendil-works/pi-tui/native/win32/src/win32-platform.c +241 -0
- package/node_modules/@earendil-works/pi-tui/package.json +10 -3
- package/node_modules/@google/genai/dist/genai.d.ts +1799 -289
- package/node_modules/@google/genai/dist/index.cjs +319 -299
- package/node_modules/@google/genai/dist/index.mjs +319 -299
- package/node_modules/@google/genai/dist/index.mjs.map +1 -1
- package/node_modules/@google/genai/dist/node/index.cjs +320 -300
- package/node_modules/@google/genai/dist/node/index.mjs +320 -300
- package/node_modules/@google/genai/dist/node/index.mjs.map +1 -1
- package/node_modules/@google/genai/dist/node/node.d.ts +1799 -289
- package/node_modules/@google/genai/dist/tokenizer/node.cjs +49 -2
- package/node_modules/@google/genai/dist/tokenizer/node.d.ts +43 -3
- package/node_modules/@google/genai/dist/tokenizer/node.mjs +49 -2
- package/node_modules/@google/genai/dist/tokenizer/node.mjs.map +1 -1
- package/node_modules/@google/genai/dist/vertex_internal/index.cjs +39 -3
- package/node_modules/@google/genai/dist/vertex_internal/index.cjs.map +1 -1
- package/node_modules/@google/genai/dist/vertex_internal/index.d.ts +51 -9
- package/node_modules/@google/genai/dist/vertex_internal/index.js +39 -3
- package/node_modules/@google/genai/dist/vertex_internal/index.js.map +1 -1
- package/node_modules/@google/genai/dist/web/index.mjs +319 -299
- package/node_modules/@google/genai/dist/web/index.mjs.map +1 -1
- package/node_modules/@google/genai/dist/web/web.d.ts +1799 -289
- package/node_modules/@google/genai/package.json +1 -1
- package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +11 -4
- package/node_modules/@smithy/node-http-handler/dist-es/http2/ClientHttp2SessionRef.js +1 -0
- package/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js +2 -3
- package/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +8 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/LICENSE +201 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/README.md +115 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-cjs/index.js +96 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/abort-handler.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/abort.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/auth/HttpApiKeyAuth.js +5 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/auth/HttpAuthScheme.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/auth/HttpAuthSchemeProvider.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/auth/HttpSigner.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/auth/IdentityProviderConfig.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/auth/auth.js +5 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/auth/index.js +2 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/blob/blob-payload-input-types.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/checksum.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/client.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/command.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/connection/config.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/connection/index.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/connection/manager.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/connection/pool.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/crypto.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/downlevel-ts3.4/transform/type-transform.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/encode.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/endpoint.js +5 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/endpoints/EndpointParameterInstructions.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/endpoints/EndpointRuleObject.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/endpoints/ErrorRuleObject.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/endpoints/RuleSetObject.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/endpoints/TreeRuleObject.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/endpoints/index.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/endpoints/shared.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/eventStream.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/extensions/checksum.js +38 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/extensions/defaultClientConfiguration.js +7 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/extensions/defaultExtensionConfiguration.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/extensions/index.js +2 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/extensions/retry.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/externals-check/browser-externals-check.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/feature-ids.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/http/httpHandlerInitialization.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/http.js +5 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/identity/apiKeyIdentity.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/identity/awsCredentialIdentity.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/identity/identity.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/identity/index.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/identity/tokenIdentity.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/index.js +7 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/logger.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/metrics.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/middleware.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/pagination.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/profile.js +6 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/response.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/retry.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/schema/schema-deprecated.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/schema/schema.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/schema/sentinels.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/schema/static-schemas.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/schema/traits.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/serde.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/shapes.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/signature.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/stream.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/streaming-payload/streaming-blob-common-types.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/streaming-payload/streaming-blob-payload-input-types.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/streaming-payload/streaming-blob-payload-output-types.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/transfer.js +6 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/transform/client-method-transforms.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/transform/client-payload-blob-type-narrow.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/transform/exact.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/transform/mutable.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/transform/no-undefined.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/transform/type-transform.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/uri.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/util.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/waiter.js +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/abort-handler.d.ts +7 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/abort.d.ts +48 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/auth/HttpApiKeyAuth.d.ts +7 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/auth/HttpAuthScheme.d.ts +49 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/auth/HttpAuthSchemeProvider.d.ts +20 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/auth/HttpSigner.d.ts +41 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/auth/IdentityProviderConfig.d.ts +14 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/auth/auth.d.ts +59 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/auth/index.d.ts +7 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/blob/blob-payload-input-types.d.ts +37 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/checksum.d.ts +61 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/client.d.ts +57 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/command.d.ts +28 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/connection/config.d.ts +15 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/connection/index.d.ts +3 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/connection/manager.d.ts +34 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/connection/pool.d.ts +32 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/crypto.d.ts +58 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/downlevel-ts3.4/transform/type-transform.d.ts +24 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/encode.d.ts +31 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/endpoint.d.ts +77 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/endpoints/EndpointParameterInstructions.d.ts +41 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/endpoints/EndpointRuleObject.d.ts +27 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/endpoints/ErrorRuleObject.d.ts +10 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/endpoints/RuleSetObject.d.ts +28 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/endpoints/TreeRuleObject.d.ts +16 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/endpoints/index.d.ts +5 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/endpoints/shared.d.ts +55 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/eventStream.d.ts +137 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/extensions/checksum.d.ts +58 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/extensions/defaultClientConfiguration.d.ts +32 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/extensions/defaultExtensionConfiguration.d.ts +9 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/extensions/index.d.ts +6 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/extensions/retry.d.ts +18 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/externals-check/browser-externals-check.d.ts +35 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/feature-ids.d.ts +16 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/http/httpHandlerInitialization.d.ts +142 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/http.d.ts +110 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/identity/apiKeyIdentity.d.ts +14 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/identity/awsCredentialIdentity.d.ts +31 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/identity/identity.d.ts +15 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/identity/index.d.ts +4 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/identity/tokenIdentity.d.ts +14 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/index.d.ts +52 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/logger.d.ts +13 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/metrics.d.ts +93 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/middleware.d.ts +541 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/pagination.d.ts +33 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/profile.d.ts +30 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/response.d.ts +40 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/retry.d.ts +162 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/schema/schema-deprecated.d.ts +143 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/schema/schema.d.ts +236 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/schema/sentinels.d.ts +65 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/schema/static-schemas.d.ts +99 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/schema/traits.d.ts +46 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/serde.d.ts +114 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/shapes.d.ts +79 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/signature.d.ts +172 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/stream.d.ts +22 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/streaming-payload/streaming-blob-common-types.d.ts +28 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/streaming-payload/streaming-blob-payload-input-types.d.ts +54 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/streaming-payload/streaming-blob-payload-output-types.d.ts +41 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/transfer.d.ts +42 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/transform/client-method-transforms.d.ts +26 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/transform/client-payload-blob-type-narrow.d.ts +73 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/transform/exact.d.ts +6 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/transform/mutable.d.ts +6 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/transform/no-undefined.d.ts +68 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/transform/type-transform.d.ts +39 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/abort-handler.d.ts +7 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/abort.d.ts +45 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/auth/HttpApiKeyAuth.d.ts +7 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/auth/HttpAuthScheme.d.ts +49 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/auth/HttpAuthSchemeProvider.d.ts +20 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/auth/HttpSigner.d.ts +41 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/auth/IdentityProviderConfig.d.ts +14 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/auth/auth.d.ts +59 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/auth/index.d.ts +7 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/blob/blob-payload-input-types.d.ts +37 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/checksum.d.ts +61 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/client.d.ts +57 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/command.d.ts +28 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/connection/config.d.ts +15 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/connection/index.d.ts +3 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/connection/manager.d.ts +34 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/connection/pool.d.ts +32 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/crypto.d.ts +58 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/downlevel-ts3.4/transform/type-transform.d.ts +40 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/encode.d.ts +31 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/endpoint.d.ts +77 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/endpoints/EndpointParameterInstructions.d.ts +41 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/endpoints/EndpointRuleObject.d.ts +27 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/endpoints/ErrorRuleObject.d.ts +10 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/endpoints/RuleSetObject.d.ts +28 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/endpoints/TreeRuleObject.d.ts +16 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/endpoints/index.d.ts +5 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/endpoints/shared.d.ts +55 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/eventStream.d.ts +137 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/extensions/checksum.d.ts +58 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/extensions/defaultClientConfiguration.d.ts +32 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/extensions/defaultExtensionConfiguration.d.ts +9 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/extensions/index.d.ts +6 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/extensions/retry.d.ts +18 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/externals-check/browser-externals-check.d.ts +35 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/feature-ids.d.ts +16 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/http/httpHandlerInitialization.d.ts +142 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/http.d.ts +110 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/identity/apiKeyIdentity.d.ts +14 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/identity/awsCredentialIdentity.d.ts +31 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/identity/identity.d.ts +15 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/identity/index.d.ts +4 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/identity/tokenIdentity.d.ts +14 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/index.d.ts +52 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/logger.d.ts +13 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/metrics.d.ts +93 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/middleware.d.ts +541 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/pagination.d.ts +33 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/profile.d.ts +30 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/response.d.ts +40 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/retry.d.ts +162 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/schema/schema-deprecated.d.ts +149 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/schema/schema.d.ts +251 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/schema/sentinels.d.ts +65 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/schema/static-schemas.d.ts +118 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/schema/traits.d.ts +46 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/serde.d.ts +114 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/shapes.d.ts +79 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/signature.d.ts +172 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/stream.d.ts +22 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/streaming-payload/streaming-blob-common-types.d.ts +28 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/streaming-payload/streaming-blob-payload-input-types.d.ts +54 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/streaming-payload/streaming-blob-payload-output-types.d.ts +41 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/transfer.d.ts +42 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/transform/client-method-transforms.d.ts +26 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/transform/client-payload-blob-type-narrow.d.ts +77 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/transform/exact.d.ts +14 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/transform/mutable.d.ts +6 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/transform/no-undefined.d.ts +88 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/transform/type-transform.d.ts +40 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/uri.d.ts +17 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/util.d.ts +192 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/waiter.d.ts +35 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/uri.d.ts +17 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/util.d.ts +176 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/waiter.d.ts +35 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/package.json +50 -0
- package/node_modules/@smithy/node-http-handler/package.json +2 -2
- package/node_modules/esbuild/LICENSE.md +21 -0
- package/node_modules/esbuild/README.md +3 -0
- package/node_modules/esbuild/bin/esbuild +223 -0
- package/node_modules/esbuild/install.js +300 -0
- package/node_modules/esbuild/lib/main.d.ts +720 -0
- package/node_modules/esbuild/lib/main.js +2536 -0
- package/node_modules/esbuild/package.json +47 -0
- package/node_modules/ignore/README.md +52 -0
- package/node_modules/ignore/index.js +785 -129
- package/node_modules/ignore/legacy.js +660 -98
- package/node_modules/ignore/package.json +10 -4
- package/node_modules/marked/README.md +1 -0
- package/node_modules/marked/lib/marked.d.ts +7 -0
- package/node_modules/marked/lib/marked.esm.js +30 -30
- package/node_modules/marked/lib/marked.esm.js.map +3 -3
- package/node_modules/marked/lib/marked.umd.js +30 -30
- package/node_modules/marked/lib/marked.umd.js.map +3 -3
- package/node_modules/marked/man/marked.1 +1 -1
- package/node_modules/marked/package.json +2 -2
- package/node_modules/typebox/build/compile/validator.d.mts +1 -1
- package/node_modules/typebox/build/compile/validator.mjs +1 -1
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +7 -5
- package/node_modules/typebox/build/format/iri.mjs +5 -1
- package/node_modules/typebox/build/guard/emit.mjs +2 -4
- package/node_modules/typebox/build/guard/guard.mjs +6 -18
- package/node_modules/typebox/build/guard/string.mjs +16 -24
- package/node_modules/typebox/build/schema/compile.d.mts +3 -2
- package/node_modules/typebox/build/schema/compile.mjs +8 -8
- package/node_modules/typebox/build/schema/engine/_context.d.mts +1 -6
- package/node_modules/typebox/build/schema/engine/_context.mjs +9 -14
- package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/_stack.d.mts +6 -2
- package/node_modules/typebox/build/schema/engine/_stack.mjs +135 -32
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +16 -4
- package/node_modules/typebox/build/schema/engine/allOf.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/anyOf.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/if.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/propertyNames.mjs +1 -3
- package/node_modules/typebox/build/schema/engine/ref.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/schema.mjs +6 -0
- package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +2 -2
- package/node_modules/typebox/build/schema/errors.d.mts +2 -2
- package/node_modules/typebox/build/schema/errors.mjs +7 -13
- package/node_modules/typebox/build/schema/intern/index.d.mts +1 -0
- package/node_modules/typebox/build/schema/intern/index.mjs +1 -0
- package/node_modules/typebox/build/schema/intern/intern.d.mts +14 -0
- package/node_modules/typebox/build/schema/intern/intern.mjs +259 -0
- package/node_modules/typebox/build/schema/parse.d.mts +1 -0
- package/node_modules/typebox/build/schema/parse.mjs +10 -5
- package/node_modules/typebox/build/schema/resolve/resolve.d.mts +34 -3
- package/node_modules/typebox/build/schema/resolve/resolve.mjs +198 -73
- package/node_modules/typebox/build/schema/schema.d.mts +1 -0
- package/node_modules/typebox/build/schema/schema.mjs +1 -0
- package/node_modules/typebox/build/value/errors/errors.d.mts +2 -12
- package/node_modules/typebox/build/value/errors/errors.mjs +2 -7
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +9 -5
- package/node_modules/undici/docs/docs/api/Client.md +4 -0
- package/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +3 -2
- package/node_modules/undici/docs/docs/api/EventSource.md +4 -0
- package/node_modules/undici/docs/docs/api/Interceptors.md +7 -3
- package/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +7 -1
- package/node_modules/undici/lib/cache/memory-cache-store.js +2 -2
- package/node_modules/undici/lib/core/symbols.js +2 -0
- package/node_modules/undici/lib/dispatcher/agent.js +7 -2
- package/node_modules/undici/lib/dispatcher/balanced-pool.js +7 -4
- package/node_modules/undici/lib/dispatcher/client-h1.js +12 -4
- package/node_modules/undici/lib/dispatcher/client-h2.js +43 -3
- package/node_modules/undici/lib/dispatcher/client.js +3 -2
- package/node_modules/undici/lib/dispatcher/dispatcher-base.js +13 -1
- package/node_modules/undici/lib/dispatcher/dispatcher.js +15 -1
- package/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +3 -0
- package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +10 -3
- package/node_modules/undici/lib/dispatcher/proxy-agent.js +18 -1
- package/node_modules/undici/lib/dispatcher/retry-agent.js +3 -0
- package/node_modules/undici/lib/dispatcher/round-robin-pool.js +1 -1
- package/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +91 -21
- package/node_modules/undici/lib/handler/cache-handler.js +29 -5
- package/node_modules/undici/lib/handler/decorator-handler.js +7 -1
- package/node_modules/undici/lib/handler/deduplication-handler.js +12 -6
- package/node_modules/undici/lib/handler/redirect-handler.js +21 -4
- package/node_modules/undici/lib/handler/retry-handler.js +148 -30
- package/node_modules/undici/lib/interceptor/cache.js +65 -12
- package/node_modules/undici/lib/interceptor/decompress.js +115 -13
- package/node_modules/undici/lib/interceptor/deduplicate.js +5 -4
- package/node_modules/undici/lib/interceptor/dns.js +7 -0
- package/node_modules/undici/lib/interceptor/dump.js +10 -23
- package/node_modules/undici/lib/mock/mock-agent.js +13 -1
- package/node_modules/undici/lib/mock/mock-utils.js +11 -10
- package/node_modules/undici/lib/util/cache.js +45 -3
- package/node_modules/undici/lib/web/cookies/parse.js +150 -147
- package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +28 -1
- package/node_modules/undici/lib/web/eventsource/eventsource.js +13 -3
- package/node_modules/undici/lib/web/fetch/index.js +6 -0
- package/node_modules/undici/lib/web/fetch/request.js +2 -3
- package/node_modules/undici/lib/web/fetch/util.js +6 -1
- package/node_modules/undici/lib/web/webidl/index.js +3 -3
- package/node_modules/undici/lib/web/websocket/connection.js +1 -1
- package/node_modules/undici/lib/web/websocket/permessage-deflate.js +5 -0
- package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +8 -10
- package/node_modules/undici/package.json +3 -3
- package/node_modules/undici/types/client.d.ts +10 -0
- package/node_modules/undici/types/interceptors.d.ts +2 -0
- package/node_modules/undici/types/mock-agent.d.ts +11 -10
- package/node_modules/undici/types/socks5-proxy-agent.d.ts +2 -0
- package/package.json +70 -49
- package/vendor/pi-client/client.d.ts +20 -15
- package/vendor/pi-client/client.d.ts.map +1 -1
- package/vendor/pi-client/client.js +248 -245
- package/vendor/pi-client/client.js.map +1 -1
- package/vendor/pi-client/connection.d.ts +4 -3
- package/vendor/pi-client/connection.d.ts.map +1 -1
- package/vendor/pi-client/connection.js +13 -9
- package/vendor/pi-client/connection.js.map +1 -1
- package/vendor/pi-client/errors.d.ts +6 -15
- package/vendor/pi-client/errors.d.ts.map +1 -1
- package/vendor/pi-client/errors.js +10 -25
- package/vendor/pi-client/errors.js.map +1 -1
- package/vendor/pi-client/index.d.ts +3 -4
- package/vendor/pi-client/index.d.ts.map +1 -1
- package/vendor/pi-client/index.js +2 -2
- package/vendor/pi-client/index.js.map +1 -1
- package/vendor/pi-client/types.d.ts +14 -8
- package/vendor/pi-client/types.d.ts.map +1 -1
- package/vendor/pi-client/types.js.map +1 -1
- package/vendor/pi-client/unix.d.ts +14 -1
- package/vendor/pi-client/unix.d.ts.map +1 -1
- package/vendor/pi-client/unix.js +138 -8
- package/vendor/pi-client/unix.js.map +1 -1
- package/vendor/pi-protocol/codec.d.ts +2 -4
- package/vendor/pi-protocol/codec.d.ts.map +1 -1
- package/vendor/pi-protocol/codec.js +7 -34
- package/vendor/pi-protocol/codec.js.map +1 -1
- package/vendor/pi-protocol/framing.d.ts +0 -2
- package/vendor/pi-protocol/framing.d.ts.map +1 -1
- package/vendor/pi-protocol/framing.js +0 -15
- package/vendor/pi-protocol/framing.js.map +1 -1
- package/vendor/pi-protocol/index.d.ts +1 -1
- package/vendor/pi-protocol/index.d.ts.map +1 -1
- package/vendor/pi-protocol/index.js +1 -1
- package/vendor/pi-protocol/index.js.map +1 -1
- package/vendor/pi-protocol/protocol.d.ts +167 -0
- package/vendor/pi-protocol/protocol.d.ts.map +1 -0
- package/vendor/pi-protocol/protocol.js +85 -0
- package/vendor/pi-protocol/protocol.js.map +1 -0
- package/dist/bun/register-bedrock.d.ts +0 -2
- package/dist/bun/register-bedrock.d.ts.map +0 -1
- package/dist/bun/register-bedrock.js +0 -4
- package/dist/bun/register-bedrock.js.map +0 -1
- package/dist/cli/experimental/auth.d.ts +0 -16
- package/dist/cli/experimental/auth.d.ts.map +0 -1
- package/dist/cli/experimental/auth.js +0 -13
- package/dist/cli/experimental/auth.js.map +0 -1
- package/dist/cli/experimental/cli.d.ts +0 -6
- package/dist/cli/experimental/cli.d.ts.map +0 -1
- package/dist/cli/experimental/cli.js +0 -5
- package/dist/cli/experimental/cli.js.map +0 -1
- package/dist/cli/experimental/command-options.d.ts +0 -17
- package/dist/cli/experimental/command-options.d.ts.map +0 -1
- package/dist/cli/experimental/command-options.js +0 -35
- package/dist/cli/experimental/command-options.js.map +0 -1
- package/dist/cli/experimental/command.d.ts +0 -63
- package/dist/cli/experimental/command.d.ts.map +0 -1
- package/dist/cli/experimental/command.js +0 -127
- package/dist/cli/experimental/command.js.map +0 -1
- package/dist/cli/experimental/commands/client.d.ts +0 -13
- package/dist/cli/experimental/commands/client.d.ts.map +0 -1
- package/dist/cli/experimental/commands/client.js +0 -25
- package/dist/cli/experimental/commands/client.js.map +0 -1
- package/dist/cli/experimental/commands/pi.d.ts +0 -15
- package/dist/cli/experimental/commands/pi.d.ts.map +0 -1
- package/dist/cli/experimental/commands/pi.js +0 -28
- package/dist/cli/experimental/commands/pi.js.map +0 -1
- package/dist/cli/experimental/commands/server.d.ts +0 -13
- package/dist/cli/experimental/commands/server.d.ts.map +0 -1
- package/dist/cli/experimental/commands/server.js +0 -25
- package/dist/cli/experimental/commands/server.js.map +0 -1
- package/dist/cli/experimental/transport-address.d.ts +0 -10
- package/dist/cli/experimental/transport-address.d.ts.map +0 -1
- package/dist/cli/experimental/transport-address.js +0 -38
- package/dist/cli/experimental/transport-address.js.map +0 -1
- package/dist/client/remote-session.d.ts +0 -53
- package/dist/client/remote-session.d.ts.map +0 -1
- package/dist/client/remote-session.js +0 -340
- package/dist/client/remote-session.js.map +0 -1
- package/dist/client/transcript.d.ts +0 -12
- package/dist/client/transcript.d.ts.map +0 -1
- package/dist/client/transcript.js +0 -98
- package/dist/client/transcript.js.map +0 -1
- package/dist/server/create-harness.d.ts +0 -26
- package/dist/server/create-harness.d.ts.map +0 -1
- package/dist/server/create-harness.js +0 -106
- package/dist/server/create-harness.js.map +0 -1
- package/dist/utils/clipboard-native.d.ts +0 -11
- package/dist/utils/clipboard-native.d.ts.map +0 -1
- package/dist/utils/clipboard-native.js +0 -20
- package/dist/utils/clipboard-native.js.map +0 -1
- package/docs/AGENTS.md +0 -67
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/reducer.d.ts +0 -100
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/reducer.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/reducer.js +0 -420
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/reducer.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/errors.d.ts +0 -9
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/errors.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/errors.js +0 -18
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/errors.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl.d.ts +0 -3
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl.js +0 -2
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/state.d.ts +0 -65
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/state.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/state.js +0 -320
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/state.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance.d.ts +0 -4
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance.js +0 -762
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/search/scanning.d.ts +0 -29
- package/node_modules/@earendil-works/pi-agent-core/dist/search/scanning.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/search/scanning.js +0 -103
- package/node_modules/@earendil-works/pi-agent-core/dist/search/scanning.js.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-gateway-binding.d.ts +0 -69
- package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-gateway-binding.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-gateway-binding.js +0 -159
- package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-gateway-binding.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/native/darwin/src/darwin-modifiers.c +0 -70
- package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-arm64/win32-console-mode.node +0 -0
- package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-x64/win32-console-mode.node +0 -0
- package/node_modules/@earendil-works/pi-tui/native/win32/src/win32-console-mode.c +0 -119
- package/node_modules/@mariozechner/clipboard/.yarnrc.yml +0 -1
- package/node_modules/@mariozechner/clipboard/Cargo.toml +0 -45
- package/node_modules/@mariozechner/clipboard/README.md +0 -60
- package/node_modules/@mariozechner/clipboard/build.rs +0 -5
- package/node_modules/@mariozechner/clipboard/exp.ts +0 -12
- package/node_modules/@mariozechner/clipboard/index.d.ts +0 -37
- package/node_modules/@mariozechner/clipboard/index.js +0 -606
- package/node_modules/@mariozechner/clipboard/package.json +0 -45
- package/node_modules/@mariozechner/clipboard/src/clipboard_rs/common.rs +0 -307
- package/node_modules/@mariozechner/clipboard/src/clipboard_rs/mod.rs +0 -93
- package/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/ios.rs +0 -313
- package/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/macos.rs +0 -471
- package/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/mod.rs +0 -252
- package/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/wayland.rs +0 -431
- package/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/win.rs +0 -712
- package/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/x11.rs +0 -916
- package/node_modules/@mariozechner/clipboard/src/lib.rs +0 -194
- package/vendor/pi-client/session-handle.d.ts +0 -54
- package/vendor/pi-client/session-handle.d.ts.map +0 -1
- package/vendor/pi-client/session-handle.js +0 -50
- package/vendor/pi-client/session-handle.js.map +0 -1
- package/vendor/pi-client/state.d.ts +0 -22
- package/vendor/pi-client/state.d.ts.map +0 -1
- package/vendor/pi-client/state.js +0 -145
- package/vendor/pi-client/state.js.map +0 -1
- package/vendor/pi-protocol/schemas.d.ts +0 -13739
- package/vendor/pi-protocol/schemas.d.ts.map +0 -1
- package/vendor/pi-protocol/schemas.js +0 -386
- package/vendor/pi-protocol/schemas.js.map +0 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { APP_NAME } from "../../../../config.js";
|
|
1
2
|
import { pickVariant, TOOL_NAMES } from "./family.js";
|
|
2
3
|
import { getPendingQuestions } from "./registry.js";
|
|
3
4
|
import { resumeDanglingQuestion } from "./resume.js";
|
|
@@ -8,6 +9,16 @@ export default function askUserExtension(pi) {
|
|
|
8
9
|
type: "boolean",
|
|
9
10
|
default: false,
|
|
10
11
|
});
|
|
12
|
+
pi.registerCommand("answer", {
|
|
13
|
+
description: "Open the pending question",
|
|
14
|
+
handler: async (_args, ctx) => {
|
|
15
|
+
if (ctx.mode !== "tui") {
|
|
16
|
+
ctx.ui.notify(`/answer opens the pending question in the TUI; run ${APP_NAME} in TUI mode to use it.`, "info");
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
// In TUI mode interactive-mode's text dispatch handles /answer first.
|
|
20
|
+
},
|
|
21
|
+
});
|
|
11
22
|
const state = { timedOut: false, unavailable: false };
|
|
12
23
|
let registered = false;
|
|
13
24
|
const cancelPending = (ctx, message) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/ask-user/extension.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"extension.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/ask-user/extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAqB,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAEjE,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EAAgB;IACxD,EAAE,CAAC,YAAY,CAAC,aAAa,EAAE;QAC9B,WAAW,EAAE,qCAAqC;QAClD,IAAI,EAAE,SAAS;Q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cesContent":["import { APP_NAME } from \"../../../../config.ts\";\nimport type { ExtensionAPI, ExtensionContext } from \"../../types.ts\";\nimport { pickVariant, TOOL_NAMES } from \"./family.ts\";\nimport { getPendingQuestions } from \"./registry.ts\";\nimport { resumeDanglingQuestion } from \"./resume.ts\";\nimport { type AskUserState, createAskUserTool } from \"./tool.ts\";\n\nexport default function askUserExtension(pi: ExtensionAPI): void {\n\tpi.registerFlag(\"no-ask-user\", {\n\t\tdescription: \"Disable the built-in question tool.\",\n\t\ttype: \"boolean\",\n\t\tdefault: false,\n\t});\n\tpi.registerCommand(\"answer\", {\n\t\tdescription: \"Open the pending question\",\n\t\thandler: async (_args, ctx) => {\n\t\t\tif (ctx.mode !== \"tui\") {\n\t\t\t\tctx.ui.notify(\n\t\t\t\t\t`/answer opens the pending question in the TUI; run ${APP_NAME} in TUI mode to use it.`,\n\t\t\t\t\t\"info\",\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// In TUI mode interactive-mode's text dispatch handles /answer first.\n\t\t},\n\t});\n\tconst state: AskUserState = { timedOut: false, unavailable: false };\n\tlet registered = false;\n\tconst cancelPending = (ctx: ExtensionContext, message: string) => {\n\t\tfor (const entry of getPendingQuestions(ctx.sessionManager.getSessionId())) entry.cancel(message);\n\t};\n\tconst sync = (ctx: ExtensionContext, model = ctx.model) => {\n\t\tconst rest = pi.getActiveTools().filter((name) => !Object.values(TOOL_NAMES).includes(name));\n\t\tif (ctx.getAskUserSettings?.().enabled === false || pi.getFlag(\"no-ask-user\") === true) {\n\t\t\tcancelPending(ctx, \"The pending question was cancelled because ask-user is disabled.\");\n\t\t\tpi.setActiveTools(rest);\n\t\t\treturn;\n\t\t}\n\t\tif (!registered) {\n\t\t\tpi.registerTool(createAskUserTool(\"codex\", pi, state));\n\t\t\tpi.registerTool(createAskUserTool(\"claude\", pi, state));\n\t\t\tregistered = true;\n\t\t}\n\t\tpi.setActiveTools(state.unavailable ? rest : [...rest, TOOL_NAMES[pickVariant(model)]]);\n\t};\n\tpi.on(\"session_start\", async (event, ctx) => {\n\t\tstate.timedOut = false;\n\t\tstate.unavailable = false;\n\t\tsync(ctx);\n\t\tvoid resumeDanglingQuestion(pi, event, ctx);\n\t});\n\tpi.on(\"model_select\", async (event, ctx) => {\n\t\tsync(ctx, event.model);\n\t});\n\tpi.on(\"agent_end\", async () => {\n\t\tstate.timedOut = false;\n\t});\n\tpi.on(\"session_shutdown\", async (_event, ctx) => {\n\t\tcancelPending(ctx, \"The pending question was cancelled because the session closed.\");\n\t});\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ExtensionAPI, ExtensionContext } from "../../types.ts";
|
|
2
|
+
import type { AskUserVariant, QuestionRequest, QuestionResponse } from "./schema.ts";
|
|
3
|
+
export declare const ASK_USER_SETTLED_EVENT = "ask-user:settled";
|
|
4
|
+
export type AskUserSettledEvent = {
|
|
5
|
+
readonly ctx: ExtensionContext;
|
|
6
|
+
readonly request: QuestionRequest;
|
|
7
|
+
readonly response: QuestionResponse;
|
|
8
|
+
readonly variant: AskUserVariant;
|
|
9
|
+
};
|
|
10
|
+
/** Publish only; the active hooks builtin owns preparation and command execution. */
|
|
11
|
+
export declare function emitAskUserNotification(pi: Pick<ExtensionAPI, "events">, ctx: ExtensionContext, request: QuestionRequest, response: QuestionResponse, variant: AskUserVariant): void;
|
|
12
|
+
//# sourceMappingURL=notify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notify.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/ask-user/notify.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAErF,eAAO,MAAM,sBAAsB,qBAAqB,CAAC;AAEzD,MAAM,MAAM,mBAAmB,GAAG;IACjC,QAAQ,CAAC,GAAG,EAAE,gBAAgB,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;CACjC,CAAC;AAEF,qFAAqF;AACrF,wBAAgB,uBAAuB,CACtC,EAAE,EAAE,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,EAChC,GAAG,EAAE,gBAAgB,EACrB,OAAO,EAAE,eAAe,EACxB,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,EAAE,cAAc,GACrB,IAAI,CAGN"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const ASK_USER_SETTLED_EVENT = "ask-user:settled";
|
|
2
|
+
/** Publish only; the active hooks builtin owns preparation and command execution. */
|
|
3
|
+
export function emitAskUserNotification(pi, ctx, request, response, variant) {
|
|
4
|
+
if (response.status === "cancelled")
|
|
5
|
+
return;
|
|
6
|
+
pi.events.emit(ASK_USER_SETTLED_EVENT, { ctx, request, response, variant });
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=notify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notify.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/ask-user/notify.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,sBAAsB,GAAG,kBAAkB,CAAC;AASzD,qFAAqF;AACrF,MAAM,UAAU,uBAAuB,CACtC,EAAgC,EAChC,GAAqB,EACrB,OAAwB,EACxB,QAA0B,EAC1B,OAAuB;IAEvB,IAAI,QAAQ,CAAC,MAAM,KAAK,WAAW;QAAE,OAAO;IAC5C,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,sBAAsB,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAgC,CAAC,CAAC;AAC3G,CAAC","sourcesContent":["import type { ExtensionAPI, ExtensionContext } from \"../../types.ts\";\nimport type { AskUserVariant, QuestionRequest, QuestionResponse } from \"./schema.ts\";\n\nexport const ASK_USER_SETTLED_EVENT = \"ask-user:settled\";\n\nexport type AskUserSettledEvent = {\n\treadonly ctx: ExtensionContext;\n\treadonly request: QuestionRequest;\n\treadonly response: QuestionResponse;\n\treadonly variant: AskUserVariant;\n};\n\n/** Publish only; the active hooks builtin owns preparation and command execution. */\nexport function emitAskUserNotification(\n\tpi: Pick<ExtensionAPI, \"events\">,\n\tctx: ExtensionContext,\n\trequest: QuestionRequest,\n\tresponse: QuestionResponse,\n\tvariant: AskUserVariant,\n): void {\n\tif (response.status === \"cancelled\") return;\n\tpi.events.emit(ASK_USER_SETTLED_EVENT, { ctx, request, response, variant } satisfies AskUserSettledEvent);\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ExtensionAPI, ExtensionContext, SessionStartEvent } from "../../types.ts";
|
|
2
2
|
export declare const ASK_USER_RESUMED_ENTRY = "ask-user:resumed";
|
|
3
|
-
export declare function resumeDanglingQuestion(pi: Pick<ExtensionAPI, "appendEntry" | "sendUserMessage">, event: Pick<SessionStartEvent, "reason">, ctx:
|
|
3
|
+
export declare function resumeDanglingQuestion(pi: Pick<ExtensionAPI, "appendEntry" | "sendUserMessage" | "events">, event: Pick<SessionStartEvent, "reason">, ctx: ExtensionContext): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=resume.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resume.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/ask-user/resume.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"resume.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/ask-user/resume.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAYxF,eAAO,MAAM,sBAAsB,qBAAqB,CAAC;AAyEzD,wBAAsB,sBAAsB,CAC3C,EAAE,EAAE,IAAI,CAAC,YAAY,EAAE,aAAa,GAAG,iBAAiB,GAAG,QAAQ,CAAC,EACpE,KAAK,EAAE,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAC,EACxC,GAAG,EAAE,gBAAgB,GACnB,OAAO,CAAC,IAAI,CAAC,CAkBf"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TOOL_NAMES } from "./family.js";
|
|
2
2
|
import { formatUserMessage } from "./format.js";
|
|
3
|
+
import { emitAskUserNotification } from "./notify.js";
|
|
3
4
|
import { DEFAULT_ASK_USER_TIMEOUT_MS, toCanonical, } from "./schema.js";
|
|
4
5
|
export const ASK_USER_RESUMED_ENTRY = "ask-user:resumed";
|
|
5
6
|
function isRecord(value) {
|
|
@@ -57,8 +58,11 @@ function orphaned(request) {
|
|
|
57
58
|
unanswered: request.questions.map((question) => question.id),
|
|
58
59
|
};
|
|
59
60
|
}
|
|
60
|
-
function deliver(pi, request, response) {
|
|
61
|
+
function deliver(pi, ctx, request, response, variant) {
|
|
62
|
+
if (response.status === "cancelled")
|
|
63
|
+
return;
|
|
61
64
|
pi.sendUserMessage(formatUserMessage(response, request.requestId, request.questions));
|
|
65
|
+
emitAskUserNotification(pi, ctx, request, response, variant);
|
|
62
66
|
}
|
|
63
67
|
export async function resumeDanglingQuestion(pi, event, ctx) {
|
|
64
68
|
if (event.reason !== "resume" && event.reason !== "reload")
|
|
@@ -70,16 +74,17 @@ export async function resumeDanglingQuestion(pi, event, ctx) {
|
|
|
70
74
|
const timeoutMs = (ctx.getAskUserSettings?.().timeoutMinutes ?? DEFAULT_ASK_USER_TIMEOUT_MS / 60_000) * 60_000;
|
|
71
75
|
const request = requestFromCall(dangling, timeoutMs);
|
|
72
76
|
const question = ctx.ui.question;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
77
|
+
let response;
|
|
78
|
+
if (!question)
|
|
79
|
+
response = orphaned(request);
|
|
80
|
+
else {
|
|
81
|
+
try {
|
|
82
|
+
response = await question.call(ctx.ui, request, { timeout: request.timeoutMs });
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
response = orphaned(request);
|
|
86
|
+
}
|
|
83
87
|
}
|
|
88
|
+
deliver(pi, ctx, request, response, dangling.variant);
|
|
84
89
|
}
|
|
85
90
|
//# sourceMappingURL=resume.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resume.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/ask-user/resume.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAEN,2BAA2B,EAG3B,WAAW,GACX,MAAM,aAAa,CAAC;AAErB,MAAM,CAAC,MAAM,sBAAsB,GAAG,kBAAkB,CAAC;AAQzD,SAAS,QAAQ,CAAC,KAAc;IAC/B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC7E,CAAC;AAED,SAAS,UAAU,CAAC,IAAY;IAC/B,IAAI,IAAI,KAAK,UAAU,CAAC,MAAM;QAAE,OAAO,QAAQ,CAAC;IAChD,IAAI,IAAI,KAAK,UAAU,CAAC,KAAK;QAAE,OAAO,OAAO,CAAC;IAC9C,OAAO,SAAS,CAAC;AAClB,CAAC;AAED,SAAS,oBAAoB,CAAC,OAAgC;IAC7D,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAClC,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU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B,IAAI,CAAC,QAAQ;QAAE,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;SACvC,CAAC;QACL,IAAI,CAAC;YACJ,QAAQ,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;QACjF,CAAC;QAAC,MAAM,CAAC;YACR,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC9B,CAAC;IACF,CAAC;IACD,OAAO,CAAC,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;AACvD,CAAC","sourcesContent":["import type { SessionEntry } from \"../../../session-manager.ts\";\nimport type { ExtensionAPI, ExtensionContext, SessionStartEvent } from \"../../types.ts\";\nimport { TOOL_NAMES } from \"./family.ts\";\nimport { formatUserMessage } from \"./format.ts\";\nimport { emitAskUserNotification } from \"./notify.ts\";\nimport {\n\ttype AskUserVariant,\n\tDEFAULT_ASK_USER_TIMEOUT_MS,\n\ttype QuestionRequest,\n\ttype QuestionResponse,\n\ttoCanonical,\n} from \"./schema.ts\";\n\nexport const ASK_USER_RESUMED_ENTRY = \"ask-user:resumed\";\n\ntype DanglingQuestion = {\n\ttoolCallId: string;\n\tvariant: AskUserVariant;\n\targs: unknown;\n};\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction variantFor(name: string): AskUserVariant | undefined {\n\tif (name === TOOL_NAMES.claude) return \"claude\";\n\tif (name === TOOL_NAMES.codex) return \"codex\";\n\treturn undefined;\n}\n\nfunction findDanglingQuestion(entries: readonly SessionEntry[]): DanglingQuestion | undefined {\n\tconst results = new Set<string>();\n\tconst resumed = new Set<string>();\n\tfor (const entry of entries) {\n\t\tif (entry.type === \"custom\" && entry.customType === ASK_USER_RESUMED_ENTRY && isRecord(entry.data)) {\n\t\t\tconst toolCallId = entry.data.toolCallId;\n\t\t\tif (typeof toolCallId === \"string\") resumed.add(toolCallId);\n\t\t}\n\t\tif (entry.type === \"message\" && entry.message.role === \"toolResult\") {\n\t\t\tresults.add(entry.message.toolCallId);\n\t\t}\n\t}\n\tfor (let index = entries.length - 1; index >= 0; index--) {\n\t\tconst entry = entries[index];\n\t\tif (entry?.type !== \"message\" || entry.message.role !== \"assistant\") continue;\n\t\tconst content = entry.message.content;\n\t\tfor (let blockIndex = content.length - 1; blockIndex >= 0; blockIndex--) {\n\t\t\tconst block = content[blockIndex];\n\t\t\tif (block?.type !== \"toolCall\" || block.incomplete === true) continue;\n\t\t\tconst variant = variantFor(block.name);\n\t\t\tif (!variant || results.has(block.id) || resumed.has(block.id)) continue;\n\t\t\treturn { toolCallId: block.id, variant, args: block.arguments };\n\t\t}\n\t}\n\treturn undefined;\n}\n\nfunction requestFromCall(dangling: DanglingQuestion, timeoutMs: number): QuestionRequest {\n\ttry {\n\t\treturn toCanonical(dangling.variant, dangling.args, { requestId: dangling.toolCallId, timeoutMs });\n\t} catch {\n\t\treturn { requestId: dangling.toolCallId, questions: [], waitForAnswer: false, timeoutMs };\n\t}\n}\n\nfunction orphaned(request: QuestionRequest): QuestionResponse {\n\treturn {\n\t\tstatus: \"orphaned-after-restart\",\n\t\tanswers: {},\n\t\tunanswered: request.questions.map((question) => question.id),\n\t};\n}\n\nfunction deliver(\n\tpi: Pick<ExtensionAPI, \"sendUserMessage\" | \"events\">,\n\tctx: ExtensionContext,\n\trequest: QuestionRequest,\n\tresponse: QuestionResponse,\n\tvariant: AskUserVariant,\n): void {\n\tif (response.status === \"cancelled\") return;\n\tpi.sendUserMessage(formatUserMessage(response, request.requestId, request.questions));\n\temitAskUserNotification(pi, ctx, request, response, variant);\n}\n\nexport async function resumeDanglingQuestion(\n\tpi: Pick<ExtensionAPI, \"appendEntry\" | \"sendUserMessage\" | \"events\">,\n\tevent: Pick<SessionStartEvent, \"reason\">,\n\tctx: ExtensionContext,\n): Promise<void> {\n\tif (event.reason !== \"resume\" && event.reason !== \"reload\") return;\n\tconst dangling = findDanglingQuestion(ctx.sessionManager.getBranch());\n\tif (!dangling) return;\n\tpi.appendEntry(ASK_USER_RESUMED_ENTRY, { toolCallId: dangling.toolCallId });\n\tconst timeoutMs = (ctx.getAskUserSettings?.().timeoutMinutes ?? DEFAULT_ASK_USER_TIMEOUT_MS / 60_000) * 60_000;\n\tconst request = requestFromCall(dangling, timeoutMs);\n\tconst question = ctx.ui.question;\n\tlet response: QuestionResponse;\n\tif (!question) response = orphaned(request);\n\telse {\n\t\ttry {\n\t\t\tresponse = await question.call(ctx.ui, request, { timeout: request.timeoutMs });\n\t\t} catch {\n\t\t\tresponse = orphaned(request);\n\t\t}\n\t}\n\tdeliver(pi, ctx, request, response, dangling.variant);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/ask-user/tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAoB,cAAc,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/ask-user/tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAoB,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAQrF,OAAO,EAEN,KAAK,cAAc,EAMnB,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,YAAY;IAC5B,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;CACrB;AAsID,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,GAAG,cAAc,CAmEhH"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { WAKE_SOURCE_STATE_EVENT } from "../monitor-state-event.js";
|
|
2
2
|
import { TOOL_NAMES } from "./family.js";
|
|
3
3
|
import { formatResultDetails, formatResultText, formatUserMessage } from "./format.js";
|
|
4
|
+
import { emitAskUserNotification } from "./notify.js";
|
|
4
5
|
import { createPendingQuestion } from "./pending.js";
|
|
5
6
|
import { getPendingQuestions, registerPendingQuestion } from "./registry.js";
|
|
6
7
|
import { renderCall, renderResult } from "./render.js";
|
|
@@ -20,12 +21,13 @@ function result(variant, response, request, text) {
|
|
|
20
21
|
* triggers a turn, which is what wakes the model after a timeout. A cancelled
|
|
21
22
|
* question stays silent: it was dismissed, superseded, or aborted.
|
|
22
23
|
*/
|
|
23
|
-
function deliverAnswer(pi, ctx, request, response) {
|
|
24
|
+
function deliverAnswer(pi, ctx, request, response, variant) {
|
|
24
25
|
if (response.status === "cancelled")
|
|
25
26
|
return;
|
|
26
27
|
pi.sendUserMessage(formatUserMessage(response, request.requestId, request.questions), {
|
|
27
28
|
deliverAs: ctx.isIdle() ? "followUp" : "steer",
|
|
28
29
|
});
|
|
30
|
+
void emitAskUserNotification(pi, ctx, request, response, variant);
|
|
29
31
|
}
|
|
30
32
|
function emitWake(pi, sessionId) {
|
|
31
33
|
const entries = getPendingQuestions(sessionId).filter((e) => !e.request.waitForAnswer);
|
|
@@ -39,7 +41,7 @@ function emitWake(pi, sessionId) {
|
|
|
39
41
|
};
|
|
40
42
|
pi.events.emit(WAKE_SOURCE_STATE_EVENT, event);
|
|
41
43
|
}
|
|
42
|
-
function startQuestion(pi, ctx, request, signal, state) {
|
|
44
|
+
function startQuestion(pi, ctx, request, signal, state, variant) {
|
|
43
45
|
const question = ctx.ui.question;
|
|
44
46
|
if (!question)
|
|
45
47
|
throw new Error("Question UI is unavailable");
|
|
@@ -129,7 +131,7 @@ function startQuestion(pi, ctx, request, signal, state) {
|
|
|
129
131
|
}
|
|
130
132
|
}
|
|
131
133
|
if (!request.waitForAnswer)
|
|
132
|
-
void completion.promise.then((response) => deliverAnswer(pi, ctx, request, response));
|
|
134
|
+
void completion.promise.then((response) => deliverAnswer(pi, ctx, request, response, variant));
|
|
133
135
|
return completion.promise;
|
|
134
136
|
}
|
|
135
137
|
export function createAskUserTool(variant, pi, state) {
|
|
@@ -179,13 +181,16 @@ export function createAskUserTool(variant, pi, state) {
|
|
|
179
181
|
pi.setActiveTools(pi.getActiveTools().filter((name) => !Object.values(TOOL_NAMES).includes(name)));
|
|
180
182
|
return result(variant, unavailable, request);
|
|
181
183
|
}
|
|
182
|
-
const completion = startQuestion(pi, ctx, request, signal, state);
|
|
184
|
+
const completion = startQuestion(pi, ctx, request, signal, state, variant);
|
|
183
185
|
if (!request.waitForAnswer)
|
|
184
186
|
return {
|
|
185
187
|
content: [{ type: "text", text: "Question accepted; the answer will arrive as a user message." }],
|
|
186
188
|
details: { accepted: true, requestId: request.requestId, status: "pending" },
|
|
187
189
|
};
|
|
188
190
|
const response = await completion;
|
|
191
|
+
if (response.status !== "cancelled") {
|
|
192
|
+
void emitAskUserNotification(pi, ctx, request, response, variant);
|
|
193
|
+
}
|
|
189
194
|
return result(variant, response, request, response.status === "cancelled" && response.comment ? response.comment : undefined);
|
|
190
195
|
},
|
|
191
196
|
renderCall,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/ask-user/tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAA6B,MAAM,2BAA2B,CAAC;AAC/F,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACvF,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAA8B,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACzG,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EACN,kBAA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a,CAAC,KAAK,IAAI;gBAClC,GAAG,CAAC,IAAI,KAAK,OAAO;gBACpB,GAAG,CAAC,IAAI,KAAK,MAAM;gBACnB,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,EACf,CAAC;gBACF,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;gBACzB,EAAE,CAAC,cAAc,CAAC,EAAE,CAAC,cAAc,EAAE,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBACnG,OAAO,MAAM,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;YAC9C,CAAC;YACD,MAAM,UAAU,GAAG,aAAa,CAAC,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;YAClE,IAAI,CAAC,OAAO,CAAC,aAAa;gBACzB,OAAO;oBACN,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,8DAA8D,EAAE,CAAC;oBACjG,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE;iBAC5E,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC;YAClC,OAAO,MAAM,CACZ,OAAO,EACP,QAAQ,EACR,OAAO,EACP,QAAQ,CAAC,MAAM,KAAK,WAAW,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAClF,CAAC;QACH,CAAC;QACD,UAAU;QACV,YAAY;KACZ,CAAC;AACH,CAAC","sourcesContent":["import type { ExtensionAPI, ExtensionContext, ToolDefinition } from \"../../types.ts\";\nimport { WAKE_SOURCE_STATE_EVENT, type WakeSourceStateEvent } from \"../monitor-state-event.ts\";\nimport { TOOL_NAMES } from \"./family.ts\";\nimport { formatResultDetails, formatResultText, formatUserMessage } from \"./format.ts\";\nimport { createPendingQuestion } from \"./pending.ts\";\nimport { getPendingQuestions, type QuestionDialogOptions, registerPendingQuestion } from \"./registry.ts\";\nimport { renderCall, renderResult } from \"./render.ts\";\nimport {\n\tAskUserSchemaError,\n\ttype AskUserVariant,\n\tCLAUDE_PARAMS,\n\tCODEX_PARAMS,\n\ttype QuestionRequest,\n\ttype QuestionResponse,\n\ttoCanonical,\n} from \"./schema.ts\";\n\nexport interface AskUserState {\n\ttimedOut: boolean;\n\tunavailable: boolean;\n}\nconst REASK = \"The user did not answer the previous question this turn; continue without asking again.\";\nfunction result(\n\tvariant: AskUserVariant,\n\tresponse: QuestionResponse,\n\trequest: QuestionRequest,\n\ttext?: string,\n): Awaited<ReturnType<ToolDefinition[\"execute\"]>> {\n\treturn {\n\t\tcontent: [{ type: \"text\", text: text ?? formatResultText(variant, response, request.questions) }],\n\t\tdetails: formatResultDetails(variant, response, request.questions),\n\t};\n}\n/**\n * Deliver a settled async answer as one framed user message. The extension owns\n * this so every surface (interactive TUI, RPC, app-server) only has to RESOLVE\n * the question; a surface that delivered on its own would send it twice. It\n * steers into a running turn and follows up when idle - a follow-up always\n * triggers a turn, which is what wakes the model after a timeout. A cancelled\n * question stays silent: it was dismissed, superseded, or aborted.\n */\nfunction deliverAnswer(\n\tpi: ExtensionAPI,\n\tctx: ExtensionContext,\n\trequest: QuestionRequest,\n\tresponse: QuestionResponse,\n): void {\n\tif (response.status === \"cancelled\") return;\n\tpi.sendUserMessage(formatUserMessage(response, request.requestId, request.questions), {\n\t\tdeliverAs: ctx.isIdle() ? \"followUp\" : \"steer\",\n\t});\n}\nfunction emitWake(pi: ExtensionAPI, sessionId: string) {\n\tconst entries = getPendingQuestions(sessionId).filter((e) => !e.request.waitForAnswer);\n\tconst event: WakeSourceStateEvent = {\n\t\tsource: \"ask-user\",\n\t\tactiveCount: entries.length,\n\t\titems: entries.map((e) => ({\n\t\t\tid: e.request.requestId,\n\t\t\tdescription: e.request.questions.map((q) => q.header).join(\", \"),\n\t\t})),\n\t};\n\tpi.events.emit(WAKE_SOURCE_STATE_EVENT, event);\n}\nfunction startQuestion(\n\tpi: ExtensionAPI,\n\tctx: ExtensionContext,\n\trequest: QuestionRequest,\n\tsignal: AbortSignal | undefined,\n\tstate: AskUserState,\n) {\n\tconst question = ctx.ui.question;\n\tif (!question) throw new Error(\"Question UI is unavailable\");\n\tconst sessionId = ctx.sessionManager.getSessionId();\n\tconst controller = new AbortController();\n\tconst completion = Promise.withResolvers<QuestionResponse>();\n\tlet settled = false;\n\tlet unregister = () => {};\n\tconst finish = (response: QuestionResponse) => {\n\t\tif (settled) return;\n\t\tsettled = true;\n\t\tif (response.status === \"timed_out\") state.timedOut = true;\n\t\tunregister();\n\t\tsignal?.removeEventListener(\"abort\", abort);\n\t\tif (!request.waitForAnswer) emitWake(pi, sessionId);\n\t\tcompletion.resolve(response);\n\t\t// This extension owns the authoritative idle timer (pending.ts), so a UI\n\t\t// bridge that is still waiting learns the outcome only from this abort.\n\t\t// Carry the resolved status as the abort reason: a bare abort reads as a\n\t\t// dismissal, and the RPC bridge would broadcast a timeout as \"cancelled\".\n\t\tconst abortReason: QuestionResponse[\"status\"] = response.status;\n\t\tcontroller.abort(abortReason);\n\t};\n\tconst pending = createPendingQuestion({\n\t\trequest,\n\t\tnow: Date.now,\n\t\tidleTimeoutMs: request.timeoutMs,\n\t\tonTimeout: finish,\n\t});\n\tconst cancel = (message?: string) => {\n\t\tconst response = pending.cancel();\n\t\tfinish(message ? { ...response, comment: message } : response);\n\t};\n\tconst abort = () => cancel();\n\tunregister = registerPendingQuestion(sessionId, { request, pending, completion: completion.promise, cancel });\n\tif (!request.waitForAnswer) emitWake(pi, sessionId);\n\tsignal?.addEventListener(\"abort\", abort, { once: true });\n\tlet draft: { answers: QuestionResponse[\"answers\"]; comment?: string } = { answers: {} };\n\tconst opts: QuestionDialogOptions = {\n\t\ttimeout: request.timeoutMs,\n\t\tsignal: controller.signal,\n\t\tdeliver: request.waitForAnswer ? \"tool-result\" : \"user-message\",\n\t\thardDeadlineAtMs: Date.now() + 7_200_000,\n\t\tonProgress: (progress) => {\n\t\t\tdraft = { ...draft, ...progress, answers: progress.answers ?? draft.answers };\n\t\t\tpending.touch(draft);\n\t\t},\n\t};\n\tconst accept = (response: QuestionResponse) => {\n\t\tif (settled) return;\n\t\tpending.touch({ answers: response.answers, comment: response.comment });\n\t\tif (response.status === \"timed_out\") {\n\t\t\tfinish(response);\n\t\t\tpending.timeout();\n\t\t\treturn;\n\t\t}\n\t\tif (response.status === \"answered\" || response.status === \"comment-submitted\") {\n\t\t\t// The UI owns partial submission validation; retain its response verbatim.\n\t\t\tpending.submit(response.answers, response.comment);\n\t\t\tif (pending.state === \"pending\") pending.cancel();\n\t\t} else pending.cancel(response.status);\n\t\tfinish(response);\n\t};\n\tconst fail = (error: unknown) => {\n\t\tif (settled) return;\n\t\tconst message = `Question UI failed: ${error instanceof Error ? error.message : String(error)}`;\n\t\tcancel(message);\n\t\tctx.ui.notify(message, \"error\");\n\t};\n\tif (signal?.aborted) abort();\n\telse {\n\t\ttry {\n\t\t\tquestion.call(ctx.ui, request, opts).then(accept, fail);\n\t\t} catch (error: unknown) {\n\t\t\tfail(error);\n\t\t}\n\t}\n\tif (!request.waitForAnswer) void completion.promise.then((response) => deliverAnswer(pi, ctx, request, response));\n\treturn completion.promise;\n}\nexport function createAskUserTool(variant: AskUserVariant, pi: ExtensionAPI, state: AskUserState): ToolDefinition {\n\tconst flag = variant === \"codex\" ? \"wait_for_answer\" : \"waitForAnswer\";\n\tconst opener =\n\t\tvariant === \"codex\"\n\t\t\t? \"Request user input for one to three short questions.\"\n\t\t\t: \"Ask the user one to four concise questions.\";\n\treturn {\n\t\tname: TOOL_NAMES[variant],\n\t\tlabel: \"Ask user\",\n\t\texposure: \"direct\",\n\t\tallowLazyActivation: false,\n\t\tparameters: variant === \"codex\" ? CODEX_PARAMS : CLAUDE_PARAMS,\n\t\tpromptSnippet: \"Ask a material question, explicitly choosing whether to wait or receive the answer later.\",\n\t\tdescription: `${opener} Set ${flag} true to pause here until the user answers (the answer returns as this tool's result, or a timeout result after 30 idle minutes); set ${flag} false to keep working while the question stays open (the answer arrives later as a user message). Use it only when the answer materially changes the work; if it returns no answers, continue with best judgment instead of asking again. Never use it for permission requests; ask those directly in your message. Unavailable to subagents.${variant === \"claude\" ? \" Users will always be able to type a free-text answer or one comment covering everything; do not add an Other option.\" : \"\"} Call this tool directly, never from inside an eval cell (a cell that waits on the user would hold the kernel).`,\n\t\tprepareArguments(args) {\n\t\t\ttoCanonical(variant, args);\n\t\t\treturn args;\n\t\t},\n\t\tasync execute(toolCallId, params, signal, _onUpdate, ctx) {\n\t\t\tlet request: QuestionRequest;\n\t\t\ttry {\n\t\t\t\trequest = toCanonical(variant, params, {\n\t\t\t\t\trequestId: toolCallId,\n\t\t\t\t\ttimeoutMs: (ctx.getAskUserSettings?.().timeoutMinutes ?? 30) * 60_000,\n\t\t\t\t});\n\t\t\t} catch (error: unknown) {\n\t\t\t\tif (!(error instanceof AskUserSchemaError)) throw error;\n\t\t\t\treturn { content: [{ type: \"text\", text: error.message }], details: { status: \"unavailable\" } };\n\t\t\t}\n\t\t\tconst unavailable: QuestionResponse = {\n\t\t\t\tstatus: \"unavailable\",\n\t\t\t\tanswers: {},\n\t\t\t\tunanswered: request.questions.map((q) => q.id),\n\t\t\t};\n\t\t\tif (state.timedOut) return result(variant, unavailable, request, REASK);\n\t\t\tif (\n\t\t\t\tstate.unavailable ||\n\t\t\t\tctx.getAskUserSettings?.().enabled === false ||\n\t\t\t\tpi.getFlag(\"no-ask-user\") === true ||\n\t\t\t\tctx.mode === \"print\" ||\n\t\t\t\tctx.mode === \"json\" ||\n\t\t\t\t!ctx.ui.question\n\t\t\t) {\n\t\t\t\tstate.unavailable = true;\n\t\t\t\tpi.setActiveTools(pi.getActiveTools().filter((name) => !Object.values(TOOL_NAMES).includes(name)));\n\t\t\t\treturn result(variant, unavailable, request);\n\t\t\t}\n\t\t\tconst completion = startQuestion(pi, ctx, request, signal, state);\n\t\t\tif (!request.waitForAnswer)\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: \"Question accepted; the answer will arrive as a user message.\" }],\n\t\t\t\t\tdetails: { accepted: true, requestId: request.requestId, status: \"pending\" },\n\t\t\t\t};\n\t\t\tconst response = await completion;\n\t\t\treturn result(\n\t\t\t\tvariant,\n\t\t\t\tresponse,\n\t\t\t\trequest,\n\t\t\t\tresponse.status === \"cancelled\" && response.comment ? response.comment : undefined,\n\t\t\t);\n\t\t},\n\t\trenderCall,\n\t\trenderResult,\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/ask-user/tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAA6B,MAAM,2BAA2B,CAAC;AAC/F,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAA8B,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACzG,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EACN,kBAAkB,EAElB,aAAa,EACb,YAAY,EAGZ,WAAW,GACX,MAAM,aAAa,CAAC;AAMrB,MAAM,KAAK,GAAG,yFAAyF,CAAC;AACxG,SAAS,MAAM,CACd,OAAuB,EACvB,QAA0B,EAC1B,OAAwB,EACxB,IAAa;IAEb,OAAO;QACN,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAA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\nimport { WAKE_SOURCE_STATE_EVENT, type WakeSourceStateEvent } from \"../monitor-state-event.ts\";\nimport { TOOL_NAMES } from \"./family.ts\";\nimport { formatResultDetails, formatResultText, formatUserMessage } from \"./format.ts\";\nimport { emitAskUserNotification } from \"./notify.ts\";\nimport { createPendingQuestion } from \"./pending.ts\";\nimport { getPendingQuestions, type QuestionDialogOptions, registerPendingQuestion } from \"./registry.ts\";\nimport { renderCall, renderResult } from \"./render.ts\";\nimport {\n\tAskUserSchemaError,\n\ttype AskUserVariant,\n\tCLAUDE_PARAMS,\n\tCODEX_PARAMS,\n\ttype QuestionRequest,\n\ttype QuestionResponse,\n\ttoCanonical,\n} from \"./schema.ts\";\n\nexport interface AskUserState {\n\ttimedOut: boolean;\n\tunavailable: boolean;\n}\nconst REASK = \"The user did not answer the previous question this turn; continue without asking again.\";\nfunction result(\n\tvariant: AskUserVariant,\n\tresponse: QuestionResponse,\n\trequest: QuestionRequest,\n\ttext?: string,\n): Awaited<ReturnType<ToolDefinition[\"execute\"]>> {\n\treturn {\n\t\tcontent: [{ type: \"text\", text: text ?? formatResultText(variant, response, request.questions) }],\n\t\tdetails: formatResultDetails(variant, response, request.questions),\n\t};\n}\n/**\n * Deliver a settled async answer as one framed user message. The extension owns\n * this so every surface (interactive TUI, RPC, app-server) only has to RESOLVE\n * the question; a surface that delivered on its own would send it twice. It\n * steers into a running turn and follows up when idle - a follow-up always\n * triggers a turn, which is what wakes the model after a timeout. A cancelled\n * question stays silent: it was dismissed, superseded, or aborted.\n */\nfunction deliverAnswer(\n\tpi: ExtensionAPI,\n\tctx: ExtensionContext,\n\trequest: QuestionRequest,\n\tresponse: QuestionResponse,\n\tvariant: \"codex\" | \"claude\",\n): void {\n\tif (response.status === \"cancelled\") return;\n\tpi.sendUserMessage(formatUserMessage(response, request.requestId, request.questions), {\n\t\tdeliverAs: ctx.isIdle() ? \"followUp\" : \"steer\",\n\t});\n\tvoid emitAskUserNotification(pi, ctx, request, response, variant);\n}\nfunction emitWake(pi: ExtensionAPI, sessionId: string) {\n\tconst entries = getPendingQuestions(sessionId).filter((e) => !e.request.waitForAnswer);\n\tconst event: WakeSourceStateEvent = {\n\t\tsource: \"ask-user\",\n\t\tactiveCount: entries.length,\n\t\titems: entries.map((e) => ({\n\t\t\tid: e.request.requestId,\n\t\t\tdescription: e.request.questions.map((q) => q.header).join(\", \"),\n\t\t})),\n\t};\n\tpi.events.emit(WAKE_SOURCE_STATE_EVENT, event);\n}\nfunction startQuestion(\n\tpi: ExtensionAPI,\n\tctx: ExtensionContext,\n\trequest: QuestionRequest,\n\tsignal: AbortSignal | undefined,\n\tstate: AskUserState,\n\tvariant: \"codex\" | \"claude\",\n) {\n\tconst question = ctx.ui.question;\n\tif (!question) throw new Error(\"Question UI is unavailable\");\n\tconst sessionId = ctx.sessionManager.getSessionId();\n\tconst controller = new AbortController();\n\tconst completion = Promise.withResolvers<QuestionResponse>();\n\tlet settled = false;\n\tlet unregister = () => {};\n\tconst finish = (response: QuestionResponse) => {\n\t\tif (settled) return;\n\t\tsettled = true;\n\t\tif (response.status === \"timed_out\") state.timedOut = true;\n\t\tunregister();\n\t\tsignal?.removeEventListener(\"abort\", abort);\n\t\tif (!request.waitForAnswer) emitWake(pi, sessionId);\n\t\tcompletion.resolve(response);\n\t\t// This extension owns the authoritative idle timer (pending.ts), so a UI\n\t\t// bridge that is still waiting learns the outcome only from this abort.\n\t\t// Carry the resolved status as the abort reason: a bare abort reads as a\n\t\t// dismissal, and the RPC bridge would broadcast a timeout as \"cancelled\".\n\t\tconst abortReason: QuestionResponse[\"status\"] = response.status;\n\t\tcontroller.abort(abortReason);\n\t};\n\tconst pending = createPendingQuestion({\n\t\trequest,\n\t\tnow: Date.now,\n\t\tidleTimeoutMs: request.timeoutMs,\n\t\tonTimeout: finish,\n\t});\n\tconst cancel = (message?: string) => {\n\t\tconst response = pending.cancel();\n\t\tfinish(message ? { ...response, comment: message } : response);\n\t};\n\tconst abort = () => cancel();\n\tunregister = registerPendingQuestion(sessionId, { request, pending, completion: completion.promise, cancel });\n\tif (!request.waitForAnswer) emitWake(pi, sessionId);\n\tsignal?.addEventListener(\"abort\", abort, { once: true });\n\tlet draft: { answers: QuestionResponse[\"answers\"]; comment?: string } = { answers: {} };\n\tconst opts: QuestionDialogOptions = {\n\t\ttimeout: request.timeoutMs,\n\t\tsignal: controller.signal,\n\t\tdeliver: request.waitForAnswer ? \"tool-result\" : \"user-message\",\n\t\thardDeadlineAtMs: Date.now() + 7_200_000,\n\t\tonProgress: (progress) => {\n\t\t\tdraft = { ...draft, ...progress, answers: progress.answers ?? draft.answers };\n\t\t\tpending.touch(draft);\n\t\t},\n\t};\n\tconst accept = (response: QuestionResponse) => {\n\t\tif (settled) return;\n\t\tpending.touch({ answers: response.answers, comment: response.comment });\n\t\tif (response.status === \"timed_out\") {\n\t\t\tfinish(response);\n\t\t\tpending.timeout();\n\t\t\treturn;\n\t\t}\n\t\tif (response.status === \"answered\" || response.status === \"comment-submitted\") {\n\t\t\t// The UI owns partial submission validation; retain its response verbatim.\n\t\t\tpending.submit(response.answers, response.comment);\n\t\t\tif (pending.state === \"pending\") pending.cancel();\n\t\t} else pending.cancel(response.status);\n\t\tfinish(response);\n\t};\n\tconst fail = (error: unknown) => {\n\t\tif (settled) return;\n\t\tconst message = `Question UI failed: ${error instanceof Error ? error.message : String(error)}`;\n\t\tcancel(message);\n\t\tctx.ui.notify(message, \"error\");\n\t};\n\tif (signal?.aborted) abort();\n\telse {\n\t\ttry {\n\t\t\tquestion.call(ctx.ui, request, opts).then(accept, fail);\n\t\t} catch (error: unknown) {\n\t\t\tfail(error);\n\t\t}\n\t}\n\tif (!request.waitForAnswer)\n\t\tvoid completion.promise.then((response) => deliverAnswer(pi, ctx, request, response, variant));\n\treturn completion.promise;\n}\nexport function createAskUserTool(variant: AskUserVariant, pi: ExtensionAPI, state: AskUserState): ToolDefinition {\n\tconst flag = variant === \"codex\" ? \"wait_for_answer\" : \"waitForAnswer\";\n\tconst opener =\n\t\tvariant === \"codex\"\n\t\t\t? \"Request user input for one to three short questions.\"\n\t\t\t: \"Ask the user one to four concise questions.\";\n\treturn {\n\t\tname: TOOL_NAMES[variant],\n\t\tlabel: \"Ask user\",\n\t\texposure: \"direct\",\n\t\tallowLazyActivation: false,\n\t\tparameters: variant === \"codex\" ? CODEX_PARAMS : CLAUDE_PARAMS,\n\t\tpromptSnippet: \"Ask a material question, explicitly choosing whether to wait or receive the answer later.\",\n\t\tdescription: `${opener} Set ${flag} true to pause here until the user answers (the answer returns as this tool's result, or a timeout result after 30 idle minutes); set ${flag} false to keep working while the question stays open (the answer arrives later as a user message). Use it only when the answer materially changes the work; if it returns no answers, continue with best judgment instead of asking again. Never use it for permission requests; ask those directly in your message. Unavailable to subagents.${variant === \"claude\" ? \" Users will always be able to type a free-text answer or one comment covering everything; do not add an Other option.\" : \"\"} Call this tool directly, never from inside an eval cell (a cell that waits on the user would hold the kernel).`,\n\t\tprepareArguments(args) {\n\t\t\ttoCanonical(variant, args);\n\t\t\treturn args;\n\t\t},\n\t\tasync execute(toolCallId, params, signal, _onUpdate, ctx) {\n\t\t\tlet request: QuestionRequest;\n\t\t\ttry {\n\t\t\t\trequest = toCanonical(variant, params, {\n\t\t\t\t\trequestId: toolCallId,\n\t\t\t\t\ttimeoutMs: (ctx.getAskUserSettings?.().timeoutMinutes ?? 30) * 60_000,\n\t\t\t\t});\n\t\t\t} catch (error: unknown) {\n\t\t\t\tif (!(error instanceof AskUserSchemaError)) throw error;\n\t\t\t\treturn { content: [{ type: \"text\", text: error.message }], details: { status: \"unavailable\" } };\n\t\t\t}\n\t\t\tconst unavailable: QuestionResponse = {\n\t\t\t\tstatus: \"unavailable\",\n\t\t\t\tanswers: {},\n\t\t\t\tunanswered: request.questions.map((q) => q.id),\n\t\t\t};\n\t\t\tif (state.timedOut) return result(variant, unavailable, request, REASK);\n\t\t\tif (\n\t\t\t\tstate.unavailable ||\n\t\t\t\tctx.getAskUserSettings?.().enabled === false ||\n\t\t\t\tpi.getFlag(\"no-ask-user\") === true ||\n\t\t\t\tctx.mode === \"print\" ||\n\t\t\t\tctx.mode === \"json\" ||\n\t\t\t\t!ctx.ui.question\n\t\t\t) {\n\t\t\t\tstate.unavailable = true;\n\t\t\t\tpi.setActiveTools(pi.getActiveTools().filter((name) => !Object.values(TOOL_NAMES).includes(name)));\n\t\t\t\treturn result(variant, unavailable, request);\n\t\t\t}\n\t\t\tconst completion = startQuestion(pi, ctx, request, signal, state, variant);\n\t\t\tif (!request.waitForAnswer)\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: \"Question accepted; the answer will arrive as a user message.\" }],\n\t\t\t\t\tdetails: { accepted: true, requestId: request.requestId, status: \"pending\" },\n\t\t\t\t};\n\t\t\tconst response = await completion;\n\t\t\tif (response.status !== \"cancelled\") {\n\t\t\t\tvoid emitAskUserNotification(pi, ctx, request, response, variant);\n\t\t\t}\n\t\t\treturn result(\n\t\t\t\tvariant,\n\t\t\t\tresponse,\n\t\t\t\trequest,\n\t\t\t\tresponse.status === \"cancelled\" && response.comment ? response.comment : undefined,\n\t\t\t);\n\t\t},\n\t\trenderCall,\n\t\trenderResult,\n\t};\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/cursor-cli-oauth/models.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/cursor-cli-oauth/models.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAU1D,MAAM,MAAM,6BAA6B,GAAG;IAC3C,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IACvC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACvC,GAAG,EAAE,MAAM,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ir, mkdtemp, open, readFile, rename, rm, writeFile } from "node:fs/p
|
|
|
3
3
|
import { tmpdir } from "node:os";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { normalizeCursorCatalog } from "@earendil-works/pi-ai";
|
|
6
|
+
import { resolveCursorContextWindow } from "@earendil-works/pi-ai/utils/cursor-context-limit";
|
|
6
7
|
import { defaultCursorAgentExecutableDeps, resolveCursorAgentExecutable } from "./executable.js";
|
|
7
8
|
const MODEL_PROBE_TIMEOUT_MS = 15_000;
|
|
8
9
|
const DEFAULT_MODEL_CATALOG_TTL_HOURS = 24;
|
|
@@ -38,7 +39,7 @@ function normalizeEntries(raw) {
|
|
|
38
39
|
...(entry.thinkingLevelMap ? { thinkingLevelMap: entry.thinkingLevelMap } : {}),
|
|
39
40
|
input: ["text"],
|
|
40
41
|
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
41
|
-
contextWindow: entry.window,
|
|
42
|
+
contextWindow: resolveCursorContextWindow(entry.id, entry.window),
|
|
42
43
|
maxTokens: 64_000,
|
|
43
44
|
...(entry.representativeVariantId !== undefined && entry.representativeVariantId !== entry.id
|
|
44
45
|
? { upstreamModelId: entry.representativeVariantId }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/cursor-cli-oauth/models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACzF,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,OAAO,EAAE,gCAAgC,EAAE,4BAA4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AE,YAAY,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,CAAC;IAClF,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAE1B,IAAI,kBAAsC,CAAC;IAC3C,IAAI,CAAC;QACJ,MAAM,UAAU,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAC5C,kBAAkB,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,sBAAsB,CAAC,CAAC,CAAC;QAC/F,MAAM,UAAU,GAAG,IAAI,CAAC,kBAAkB,EAAE,YAAY,CAAC,CAAC;QAC1D,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,UAAU,EAAE,sBAAsB,CAAC,CAAC;QACpE,MAAM,MAAM,GAAG,6BAA6B,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC;QAClF,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,wBAAwB,CAAC;QACzD,IAAI,CAAC;YACJ,MAAM,UAAU,CAAC,cAAc,EAAE,SAAS,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,CAAC;QAC9E,CAAC;QAAC,MAAM,CAAC;YACR,sEAAsE;QACvE,CAAC;QACD,OAAO,MAAM,CAAC;IACf,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,wBAAwB,CAAC;IACjC,CAAC;YAAS,CAAC;QACV,IAAI,kBAAkB,KAAK,SAAS,EAAE,CAAC;YACtC,IAAI,CAAC;gBACJ,MAAM,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC;YAChD,CAAC;YAAC,MAAM,CAAC;gBACR,2DAA2D;YAC5D,CAAC;QACF,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["import { spawn } from \"node:child_process\";\nimport { mkdir, mkdtemp, open, readFile, rename, rm, writeFile } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { normalizeCursorCatalog } from \"@earendil-works/pi-ai\";\nimport type { ProviderModelConfig } from \"../../types.ts\";\nimport { defaultCursorAgentExecutableDeps, resolveCursorAgentExecutable } from \"./executable.ts\";\n\nconst MODEL_PROBE_TIMEOUT_MS = 15_000;\nconst DEFAULT_MODEL_CATALOG_TTL_HOURS = 24;\nconst ANSI_ESCAPE_SEQUENCE = /\\u001B(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])/g;\nconst MODEL_LINE = /^(\\S+)\\s+-\\s+(.+)$/;\nconst MODEL_ID = /^[A-Za-z0-9][A-Za-z0-9._/:+-]*$/;\nconst MISLEADING_ERROR_LINE = /^\\s*(?:error|failed|failure)(?=\\s|:|-|$)/i;\n\nexport type CursorCliModelCatalogSettings = {\n\treadonly modelCatalogTtlHours?: number;\n\treadonly executablePath?: string;\n};\n\nexport type CursorCliModelCatalogDeps = {\n\tnow: () => number;\n\tresolveExecutable: () => string;\n\trunProbe: (executable: string, stdoutPath: string, timeoutMs: number) => Promise<void>;\n\tmakeTemporaryDirectory: (prefix: string) => Promise<string>;\n\treadTextFile: (path: string) => Promise<string>;\n\tmakeDirectory: (path: string) => Promise<void>;\n\twriteTextFile: (path: string, contents: string) => Promise<void>;\n\trenameFile: (from: string, to: string) => Promise<void>;\n\tremoveDirectory: (path: string) => Promise<void>;\n};\n\nexport type ResolveCursorCliModelCatalogOptions = {\n\treadonly agentDir: string;\n\treadonly settings?: CursorCliModelCatalogSettings;\n\treadonly deps?: Partial<CursorCliModelCatalogDeps>;\n};\n\ntype CachedModelCatalog = {\n\treadonly cachedAt: number;\n\treadonly models: readonly ProviderModelConfig[];\n};\n\ntype StaticModelDefinition = {\n\treadonly id: string;\n\treadonly label: string;\n};\n\nconst STATIC_MODEL_DEFINITIONS: readonly StaticModelDefinition[] = [\n\t{ id: \"auto\", label: \"Auto\" },\n\t{ id: \"composer-2.5\", label: \"Composer 2.5 (200K context)\" },\n\t{ id: \"composer-2.5-fast\", label: \"Composer 2.5 Fast (200K context)\" },\n\t{ id: \"gpt-5.6-sol-high\", label: \"GPT 5.6 SOL High (272K context)\" },\n\t{ id: \"gpt-5.6-luna-high\", label: \"GPT 5.6 Luna High (272K context)\" },\n\t{ id: \"gpt-5.5-high\", label: \"GPT 5.5 High (272K context)\" },\n\t{ id: \"gpt-5.3-codex\", label: \"GPT 5.3 Codex (272K context)\" },\n\t{ id: \"gpt-5.2\", label: \"GPT 5.2 (272K context)\" },\n\t{ id: \"claude-opus-5-high\", label: \"Claude Opus 5 High (300K context)\" },\n\t{ id: \"claude-opus-5-thinking-high\", label: \"Claude Opus 5 Thinking High (300K context)\" },\n\t{ id: \"claude-opus-4-8-thinking-high\", label: \"Claude Opus 4.8 Thinking High (300K context)\" },\n\t{ id: \"claude-fable-5-thinking-high\", label: \"Claude Fable 5 Thinking High (300K context)\" },\n\t{ id: \"claude-sonnet-5-thinking-high\", label: \"Claude Sonnet 5 Thinking High (300K context)\" },\n\t{ id: \"gemini-3.7-flash-high\", label: \"Gemini 3.7 Flash High (1M context)\" },\n\t{ id: \"cursor-grok-4.6-high\", label: \"Cursor Grok 4.6 High (200K context)\" },\n];\n\nfunction stripAnsi(value: string): string {\n\treturn value.replace(ANSI_ESCAPE_SEQUENCE, \"\");\n}\n\nfunction normalizeEntries(raw: readonly { id: string; label: string }[]): ProviderModelConfig[] {\n\treturn normalizeCursorCatalog(\n\t\traw.map(({ id, label }) => ({ id, name: label, input: [\"text\"] as const, cursorMaxMode: false })),\n\t).map((entry) => ({\n\t\tid: entry.id,\n\t\tname: entry.name,\n\t\treasoning: entry.reasoning,\n\t\t...(entry.thinkingLevelMap ? { thinkingLevelMap: entry.thinkingLevelMap } : {}),\n\t\tinput: [\"text\"] as (\"text\" | \"image\")[],\n\t\tcost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },\n\t\tcontextWindow: entry.window,\n\t\tmaxTokens: 64_000,\n\t\t...(entry.representativeVariantId !== undefined && entry.representativeVariantId !== entry.id\n\t\t\t? { upstreamModelId: entry.representativeVariantId }\n\t\t\t: {}),\n\t\tcompat: {\n\t\t\t...(entry.capabilityId !== undefined && entry.representativeVariantId !== undefined\n\t\t\t\t? {\n\t\t\t\t\t\tcursorReasoning: {\n\t\t\t\t\t\t\tcapabilityId: entry.capabilityId,\n\t\t\t\t\t\t\t...(entry.thinkingMode !== undefined ? { thinkingMode: entry.thinkingMode } : {}),\n\t\t\t\t\t\t\trepresentativeVariantId: entry.representativeVariantId,\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t},\n\t}));\n}\n\nexport const STATIC_CURSOR_CLI_MODELS: readonly ProviderModelConfig[] = normalizeEntries(STATIC_MODEL_DEFINITIONS);\n\n/** Parse the complete `cursor-agent models` listing into extension provider entries. */\nexport function parseCursorAgentModelsListing(listing: string): ProviderModelConfig[] {\n\tconst plainListing = stripAnsi(listing);\n\tconst lines = plainListing.split(/\\r?\\n/);\n\tif (lines.some((line) => MISLEADING_ERROR_LINE.test(line))) return [];\n\n\tconst seen = new Set<string>();\n\tconst raw: { id: string; label: string }[] = [];\n\tfor (const rawLine of lines) {\n\t\tconst match = MODEL_LINE.exec(rawLine.trim());\n\t\tif (!match) continue;\n\t\tconst id = match[1];\n\t\tconst label = match[2].trim();\n\t\tif (!MODEL_ID.test(id) || label.length === 0 || seen.has(id)) continue;\n\t\tseen.add(id);\n\t\traw.push({ id, label });\n\t}\n\treturn normalizeEntries(raw);\n}\n\nasync function runModelsProbe(executable: string, stdoutPath: string, timeoutMs: number): Promise<void> {\n\tconst output = await open(stdoutPath, \"w\");\n\ttry {\n\t\tawait new Promise<void>((resolve, reject) => {\n\t\t\tconst child = spawn(executable, [\"models\"], {\n\t\t\t\tstdio: [\"ignore\", output.fd, \"ignore\"],\n\t\t\t});\n\t\t\tlet timedOut = false;\n\t\t\tlet settled = false;\n\t\t\tconst finish = (error?: Error): void => {\n\t\t\t\tif (settled) return;\n\t\t\t\tsettled = true;\n\t\t\t\tclearTimeout(deadline);\n\t\t\t\tif (error) reject(error);\n\t\t\t\telse resolve();\n\t\t\t};\n\t\t\tconst deadline = setTimeout(() => {\n\t\t\t\ttimedOut = true;\n\t\t\t\tchild.kill(\"SIGKILL\");\n\t\t\t}, timeoutMs);\n\t\t\tchild.once(\"error\", (error) => finish(error));\n\t\t\tchild.once(\"close\", (code, signal) => {\n\t\t\t\tif (timedOut) {\n\t\t\t\t\tfinish(new Error(`cursor-agent models exceeded its ${timeoutMs}ms deadline`));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (code !== 0) {\n\t\t\t\t\tfinish(new Error(`cursor-agent models failed with code ${String(code)} and signal ${String(signal)}`));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tfinish();\n\t\t\t});\n\t\t});\n\t} finally {\n\t\tawait output.close();\n\t}\n}\n\nfunction defaultDeps(settings: CursorCliModelCatalogSettings): CursorCliModelCatalogDeps {\n\treturn {\n\t\tnow: Date.now,\n\t\tresolveExecutable: () => {\n\t\t\tconst executableDeps = defaultCursorAgentExecutableDeps();\n\t\t\treturn resolveCursorAgentExecutable({\n\t\t\t\t...executableDeps,\n\t\t\t\tsettings: { executablePath: settings.executablePath },\n\t\t\t});\n\t\t},\n\t\trunProbe: runModelsProbe,\n\t\tmakeTemporaryDirectory: (prefix) => mkdtemp(prefix),\n\t\treadTextFile: (path) => readFile(path, \"utf8\"),\n\t\tmakeDirectory: async (path) => {\n\t\t\tawait mkdir(path, { recursive: true });\n\t\t},\n\t\twriteTextFile: async (path, contents) => {\n\t\t\tawait writeFile(path, contents, \"utf8\");\n\t\t},\n\t\trenameFile: async (from, to) => {\n\t\t\tawait rename(from, to);\n\t\t},\n\t\tremoveDirectory: async (path) => {\n\t\t\tawait rm(path, { recursive: true, force: true });\n\t\t},\n\t};\n}\n\nfunction catalogTtlMs(settings: CursorCliModelCatalogSettings): number {\n\tconst hours = settings.modelCatalogTtlHours;\n\tconst validHours =\n\t\ttypeof hours === \"number\" && Number.isFinite(hours) && hours > 0 ? hours : DEFAULT_MODEL_CATALOG_TTL_HOURS;\n\treturn validHours * 60 * 60 * 1_000;\n}\n\nfunction parseCachedCatalog(contents: string): CachedModelCatalog | undefined {\n\tlet parsed: unknown;\n\ttry {\n\t\tparsed = JSON.parse(contents);\n\t} catch {\n\t\treturn undefined;\n\t}\n\tif (typeof parsed !== \"object\" || parsed === null || !(\"cachedAt\" in parsed) || !(\"models\" in parsed)) {\n\t\treturn undefined;\n\t}\n\tconst cachedAt = parsed.cachedAt;\n\tconst models = parsed.models;\n\tif (typeof cachedAt !== \"number\" || !Number.isFinite(cachedAt) || !Array.isArray(models) || models.length === 0) {\n\t\treturn undefined;\n\t}\n\n\tconst rawCached: { id: string; label: string }[] = [];\n\tconst seen = new Set<string>();\n\tfor (const candidate of models) {\n\t\tif (typeof candidate !== \"object\" || candidate === null || !(\"id\" in candidate) || !(\"name\" in candidate)) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst id = candidate.id;\n\t\tconst name = candidate.name;\n\t\tif (\n\t\t\ttypeof id !== \"string\" ||\n\t\t\t!MODEL_ID.test(id) ||\n\t\t\ttypeof name !== \"string\" ||\n\t\t\tname.length === 0 ||\n\t\t\tseen.has(id)\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\t\tseen.add(id);\n\t\trawCached.push({ id, label: name });\n\t}\n\treturn { cachedAt, models: normalizeEntries(rawCached) };\n}\n\nasync function readFreshCache(\n\tcachePath: string,\n\tnow: number,\n\tttlMs: number,\n\tdeps: CursorCliModelCatalogDeps,\n): Promise<readonly ProviderModelConfig[] | undefined> {\n\ttry {\n\t\tconst cached = parseCachedCatalog(await deps.readTextFile(cachePath));\n\t\tif (!cached || now < cached.cachedAt || now - cached.cachedAt >= ttlMs) return undefined;\n\t\treturn cached.models;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nasync function writeCache(\n\tcacheDirectory: string,\n\tcachePath: string,\n\tcatalog: CachedModelCatalog,\n\tdeps: CursorCliModelCatalogDeps,\n): Promise<void> {\n\tconst temporaryPath = `${cachePath}.${process.pid}.${catalog.cachedAt}.tmp`;\n\tawait deps.makeDirectory(cacheDirectory);\n\tawait deps.writeTextFile(temporaryPath, `${JSON.stringify(catalog, null, 2)}\\n`);\n\tawait deps.renameFile(temporaryPath, cachePath);\n}\n\n/** Resolve a cached or probed catalog, always degrading to the exact offline fallback. */\nexport async function resolveCursorCliModelCatalog(\n\toptions: ResolveCursorCliModelCatalogOptions,\n): Promise<readonly ProviderModelConfig[]> {\n\tconst settings = options.settings ?? {};\n\tconst deps = { ...defaultDeps(settings), ...options.deps };\n\tconst cacheDirectory = join(options.agentDir, \"cursor-cli-oauth\");\n\tconst cachePath = join(cacheDirectory, \"models.json\");\n\tconst now = deps.now();\n\tconst cached = await readFreshCache(cachePath, now, catalogTtlMs(settings), deps);\n\tif (cached) return cached;\n\n\tlet temporaryDirectory: string | undefined;\n\ttry {\n\t\tconst executable = deps.resolveExecutable();\n\t\ttemporaryDirectory = await deps.makeTemporaryDirectory(join(tmpdir(), \"senpi-cursor-models-\"));\n\t\tconst stdoutPath = join(temporaryDirectory, \"stdout.txt\");\n\t\tawait deps.runProbe(executable, stdoutPath, MODEL_PROBE_TIMEOUT_MS);\n\t\tconst models = parseCursorAgentModelsListing(await deps.readTextFile(stdoutPath));\n\t\tif (models.length === 0) return STATIC_CURSOR_CLI_MODELS;\n\t\ttry {\n\t\t\tawait writeCache(cacheDirectory, cachePath, { cachedAt: now, models }, deps);\n\t\t} catch {\n\t\t\t// A read-only cache directory must not prevent provider registration.\n\t\t}\n\t\treturn models;\n\t} catch {\n\t\treturn STATIC_CURSOR_CLI_MODELS;\n\t} finally {\n\t\tif (temporaryDirectory !== undefined) {\n\t\t\ttry {\n\t\t\t\tawait deps.removeDirectory(temporaryDirectory);\n\t\t\t} catch {\n\t\t\t\t// Best-effort cleanup must not replace the catalog result.\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
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EAAE,SAAS,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,CAAC;QAC9E,CAAC;QAAC,MAAM,CAAC;YACR,sEAAsE;QACvE,CAAC;QACD,OAAO,MAAM,CAAC;IACf,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,wBAAwB,CAAC;IACjC,CAAC;YAAS,CAAC;QACV,IAAI,kBAAkB,KAAK,SAAS,EAAE,CAAC;YACtC,IAAI,CAAC;gBACJ,MAAM,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC;YAChD,CAAC;YAAC,MAAM,CAAC;gBACR,2DAA2D;YAC5D,CAAC;QACF,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["import { spawn } from \"node:child_process\";\nimport { mkdir, mkdtemp, open, readFile, rename, rm, writeFile } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { normalizeCursorCatalog } from \"@earendil-works/pi-ai\";\nimport { resolveCursorContextWindow } from \"@earendil-works/pi-ai/utils/cursor-context-limit\";\nimport type { ProviderModelConfig } from \"../../types.ts\";\nimport { defaultCursorAgentExecutableDeps, resolveCursorAgentExecutable } from \"./executable.ts\";\n\nconst MODEL_PROBE_TIMEOUT_MS = 15_000;\nconst DEFAULT_MODEL_CATALOG_TTL_HOURS = 24;\nconst ANSI_ESCAPE_SEQUENCE = /\\u001B(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])/g;\nconst MODEL_LINE = /^(\\S+)\\s+-\\s+(.+)$/;\nconst MODEL_ID = /^[A-Za-z0-9][A-Za-z0-9._/:+-]*$/;\nconst MISLEADING_ERROR_LINE = /^\\s*(?:error|failed|failure)(?=\\s|:|-|$)/i;\n\nexport type CursorCliModelCatalogSettings = {\n\treadonly modelCatalogTtlHours?: number;\n\treadonly executablePath?: string;\n};\n\nexport type CursorCliModelCatalogDeps = {\n\tnow: () => number;\n\tresolveExecutable: () => string;\n\trunProbe: (executable: string, stdoutPath: string, timeoutMs: number) => Promise<void>;\n\tmakeTemporaryDirectory: (prefix: string) => Promise<string>;\n\treadTextFile: (path: string) => Promise<string>;\n\tmakeDirectory: (path: string) => Promise<void>;\n\twriteTextFile: (path: string, contents: string) => Promise<void>;\n\trenameFile: (from: string, to: string) => Promise<void>;\n\tremoveDirectory: (path: string) => Promise<void>;\n};\n\nexport type ResolveCursorCliModelCatalogOptions = {\n\treadonly agentDir: string;\n\treadonly settings?: CursorCliModelCatalogSettings;\n\treadonly deps?: Partial<CursorCliModelCatalogDeps>;\n};\n\ntype CachedModelCatalog = {\n\treadonly cachedAt: number;\n\treadonly models: readonly ProviderModelConfig[];\n};\n\ntype StaticModelDefinition = {\n\treadonly id: string;\n\treadonly label: string;\n};\n\nconst STATIC_MODEL_DEFINITIONS: readonly StaticModelDefinition[] = [\n\t{ id: \"auto\", label: \"Auto\" },\n\t{ id: \"composer-2.5\", label: \"Composer 2.5 (200K context)\" },\n\t{ id: \"composer-2.5-fast\", label: \"Composer 2.5 Fast (200K context)\" },\n\t{ id: \"gpt-5.6-sol-high\", label: \"GPT 5.6 SOL High (272K context)\" },\n\t{ id: \"gpt-5.6-luna-high\", label: \"GPT 5.6 Luna High (272K context)\" },\n\t{ id: \"gpt-5.5-high\", label: \"GPT 5.5 High (272K context)\" },\n\t{ id: \"gpt-5.3-codex\", label: \"GPT 5.3 Codex (272K context)\" },\n\t{ id: \"gpt-5.2\", label: \"GPT 5.2 (272K context)\" },\n\t{ id: \"claude-opus-5-high\", label: \"Claude Opus 5 High (300K context)\" },\n\t{ id: \"claude-opus-5-thinking-high\", label: \"Claude Opus 5 Thinking High (300K context)\" },\n\t{ id: \"claude-opus-4-8-thinking-high\", label: \"Claude Opus 4.8 Thinking High (300K context)\" },\n\t{ id: \"claude-fable-5-thinking-high\", label: \"Claude Fable 5 Thinking High (300K context)\" },\n\t{ id: \"claude-sonnet-5-thinking-high\", label: \"Claude Sonnet 5 Thinking High (300K context)\" },\n\t{ id: \"gemini-3.7-flash-high\", label: \"Gemini 3.7 Flash High (1M context)\" },\n\t{ id: \"cursor-grok-4.6-high\", label: \"Cursor Grok 4.6 High (200K context)\" },\n];\n\nfunction stripAnsi(value: string): string {\n\treturn value.replace(ANSI_ESCAPE_SEQUENCE, \"\");\n}\n\nfunction normalizeEntries(raw: readonly { id: string; label: string }[]): ProviderModelConfig[] {\n\treturn normalizeCursorCatalog(\n\t\traw.map(({ id, label }) => ({ id, name: label, input: [\"text\"] as const, cursorMaxMode: false })),\n\t).map((entry) => ({\n\t\tid: entry.id,\n\t\tname: entry.name,\n\t\treasoning: entry.reasoning,\n\t\t...(entry.thinkingLevelMap ? { thinkingLevelMap: entry.thinkingLevelMap } : {}),\n\t\tinput: [\"text\"] as (\"text\" | \"image\")[],\n\t\tcost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },\n\t\tcontextWindow: resolveCursorContextWindow(entry.id, entry.window),\n\t\tmaxTokens: 64_000,\n\t\t...(entry.representativeVariantId !== undefined && entry.representativeVariantId !== entry.id\n\t\t\t? { upstreamModelId: entry.representativeVariantId }\n\t\t\t: {}),\n\t\tcompat: {\n\t\t\t...(entry.capabilityId !== undefined && entry.representativeVariantId !== undefined\n\t\t\t\t? {\n\t\t\t\t\t\tcursorReasoning: {\n\t\t\t\t\t\t\tcapabilityId: entry.capabilityId,\n\t\t\t\t\t\t\t...(entry.thinkingMode !== undefined ? { thinkingMode: entry.thinkingMode } : {}),\n\t\t\t\t\t\t\trepresentativeVariantId: entry.representativeVariantId,\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t},\n\t}));\n}\n\nexport const STATIC_CURSOR_CLI_MODELS: readonly ProviderModelConfig[] = normalizeEntries(STATIC_MODEL_DEFINITIONS);\n\n/** Parse the complete `cursor-agent models` listing into extension provider entries. */\nexport function parseCursorAgentModelsListing(listing: string): ProviderModelConfig[] {\n\tconst plainListing = stripAnsi(listing);\n\tconst lines = plainListing.split(/\\r?\\n/);\n\tif (lines.some((line) => MISLEADING_ERROR_LINE.test(line))) return [];\n\n\tconst seen = new Set<string>();\n\tconst raw: { id: string; label: string }[] = [];\n\tfor (const rawLine of lines) {\n\t\tconst match = MODEL_LINE.exec(rawLine.trim());\n\t\tif (!match) continue;\n\t\tconst id = match[1];\n\t\tconst label = match[2].trim();\n\t\tif (!MODEL_ID.test(id) || label.length === 0 || seen.has(id)) continue;\n\t\tseen.add(id);\n\t\traw.push({ id, label });\n\t}\n\treturn normalizeEntries(raw);\n}\n\nasync function runModelsProbe(executable: string, stdoutPath: string, timeoutMs: number): Promise<void> {\n\tconst output = await open(stdoutPath, \"w\");\n\ttry {\n\t\tawait new Promise<void>((resolve, reject) => {\n\t\t\tconst child = spawn(executable, [\"models\"], {\n\t\t\t\tstdio: [\"ignore\", output.fd, \"ignore\"],\n\t\t\t});\n\t\t\tlet timedOut = false;\n\t\t\tlet settled = false;\n\t\t\tconst finish = (error?: Error): void => {\n\t\t\t\tif (settled) return;\n\t\t\t\tsettled = true;\n\t\t\t\tclearTimeout(deadline);\n\t\t\t\tif (error) reject(error);\n\t\t\t\telse resolve();\n\t\t\t};\n\t\t\tconst deadline = setTimeout(() => {\n\t\t\t\ttimedOut = true;\n\t\t\t\tchild.kill(\"SIGKILL\");\n\t\t\t}, timeoutMs);\n\t\t\tchild.once(\"error\", (error) => finish(error));\n\t\t\tchild.once(\"close\", (code, signal) => {\n\t\t\t\tif (timedOut) {\n\t\t\t\t\tfinish(new Error(`cursor-agent models exceeded its ${timeoutMs}ms deadline`));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (code !== 0) {\n\t\t\t\t\tfinish(new Error(`cursor-agent models failed with code ${String(code)} and signal ${String(signal)}`));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tfinish();\n\t\t\t});\n\t\t});\n\t} finally {\n\t\tawait output.close();\n\t}\n}\n\nfunction defaultDeps(settings: CursorCliModelCatalogSettings): CursorCliModelCatalogDeps {\n\treturn {\n\t\tnow: Date.now,\n\t\tresolveExecutable: () => {\n\t\t\tconst executableDeps = defaultCursorAgentExecutableDeps();\n\t\t\treturn resolveCursorAgentExecutable({\n\t\t\t\t...executableDeps,\n\t\t\t\tsettings: { executablePath: settings.executablePath },\n\t\t\t});\n\t\t},\n\t\trunProbe: runModelsProbe,\n\t\tmakeTemporaryDirectory: (prefix) => mkdtemp(prefix),\n\t\treadTextFile: (path) => readFile(path, \"utf8\"),\n\t\tmakeDirectory: async (path) => {\n\t\t\tawait mkdir(path, { recursive: true });\n\t\t},\n\t\twriteTextFile: async (path, contents) => {\n\t\t\tawait writeFile(path, contents, \"utf8\");\n\t\t},\n\t\trenameFile: async (from, to) => {\n\t\t\tawait rename(from, to);\n\t\t},\n\t\tremoveDirectory: async (path) => {\n\t\t\tawait rm(path, { recursive: true, force: true });\n\t\t},\n\t};\n}\n\nfunction catalogTtlMs(settings: CursorCliModelCatalogSettings): number {\n\tconst hours = settings.modelCatalogTtlHours;\n\tconst validHours =\n\t\ttypeof hours === \"number\" && Number.isFinite(hours) && hours > 0 ? hours : DEFAULT_MODEL_CATALOG_TTL_HOURS;\n\treturn validHours * 60 * 60 * 1_000;\n}\n\nfunction parseCachedCatalog(contents: string): CachedModelCatalog | undefined {\n\tlet parsed: unknown;\n\ttry {\n\t\tparsed = JSON.parse(contents);\n\t} catch {\n\t\treturn undefined;\n\t}\n\tif (typeof parsed !== \"object\" || parsed === null || !(\"cachedAt\" in parsed) || !(\"models\" in parsed)) {\n\t\treturn undefined;\n\t}\n\tconst cachedAt = parsed.cachedAt;\n\tconst models = parsed.models;\n\tif (typeof cachedAt !== \"number\" || !Number.isFinite(cachedAt) || !Array.isArray(models) || models.length === 0) {\n\t\treturn undefined;\n\t}\n\n\tconst rawCached: { id: string; label: string }[] = [];\n\tconst seen = new Set<string>();\n\tfor (const candidate of models) {\n\t\tif (typeof candidate !== \"object\" || candidate === null || !(\"id\" in candidate) || !(\"name\" in candidate)) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst id = candidate.id;\n\t\tconst name = candidate.name;\n\t\tif (\n\t\t\ttypeof id !== \"string\" ||\n\t\t\t!MODEL_ID.test(id) ||\n\t\t\ttypeof name !== \"string\" ||\n\t\t\tname.length === 0 ||\n\t\t\tseen.has(id)\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\t\tseen.add(id);\n\t\trawCached.push({ id, label: name });\n\t}\n\treturn { cachedAt, models: normalizeEntries(rawCached) };\n}\n\nasync function readFreshCache(\n\tcachePath: string,\n\tnow: number,\n\tttlMs: number,\n\tdeps: CursorCliModelCatalogDeps,\n): Promise<readonly ProviderModelConfig[] | undefined> {\n\ttry {\n\t\tconst cached = parseCachedCatalog(await deps.readTextFile(cachePath));\n\t\tif (!cached || now < cached.cachedAt || now - cached.cachedAt >= ttlMs) return undefined;\n\t\treturn cached.models;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nasync function writeCache(\n\tcacheDirectory: string,\n\tcachePath: string,\n\tcatalog: CachedModelCatalog,\n\tdeps: CursorCliModelCatalogDeps,\n): Promise<void> {\n\tconst temporaryPath = `${cachePath}.${process.pid}.${catalog.cachedAt}.tmp`;\n\tawait deps.makeDirectory(cacheDirectory);\n\tawait deps.writeTextFile(temporaryPath, `${JSON.stringify(catalog, null, 2)}\\n`);\n\tawait deps.renameFile(temporaryPath, cachePath);\n}\n\n/** Resolve a cached or probed catalog, always degrading to the exact offline fallback. */\nexport async function resolveCursorCliModelCatalog(\n\toptions: ResolveCursorCliModelCatalogOptions,\n): Promise<readonly ProviderModelConfig[]> {\n\tconst settings = options.settings ?? {};\n\tconst deps = { ...defaultDeps(settings), ...options.deps };\n\tconst cacheDirectory = join(options.agentDir, \"cursor-cli-oauth\");\n\tconst cachePath = join(cacheDirectory, \"models.json\");\n\tconst now = deps.now();\n\tconst cached = await readFreshCache(cachePath, now, catalogTtlMs(settings), deps);\n\tif (cached) return cached;\n\n\tlet temporaryDirectory: string | undefined;\n\ttry {\n\t\tconst executable = deps.resolveExecutable();\n\t\ttemporaryDirectory = await deps.makeTemporaryDirectory(join(tmpdir(), \"senpi-cursor-models-\"));\n\t\tconst stdoutPath = join(temporaryDirectory, \"stdout.txt\");\n\t\tawait deps.runProbe(executable, stdoutPath, MODEL_PROBE_TIMEOUT_MS);\n\t\tconst models = parseCursorAgentModelsListing(await deps.readTextFile(stdoutPath));\n\t\tif (models.length === 0) return STATIC_CURSOR_CLI_MODELS;\n\t\ttry {\n\t\t\tawait writeCache(cacheDirectory, cachePath, { cachedAt: now, models }, deps);\n\t\t} catch {\n\t\t\t// A read-only cache directory must not prevent provider registration.\n\t\t}\n\t\treturn models;\n\t} catch {\n\t\treturn STATIC_CURSOR_CLI_MODELS;\n\t} finally {\n\t\tif (temporaryDirectory !== undefined) {\n\t\t\ttry {\n\t\t\t\tawait deps.removeDirectory(temporaryDirectory);\n\t\t\t} catch {\n\t\t\t\t// Best-effort cleanup must not replace the catalog result.\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
|
|
@@ -16,4 +16,6 @@ export type HookConfigLoaderOptions = {
|
|
|
16
16
|
readonly runtimeHookSourcePaths?: readonly string[];
|
|
17
17
|
};
|
|
18
18
|
export declare function loadHookConfigSources(options: HookConfigLoaderOptions): ParsedHookConfig;
|
|
19
|
+
/** Read files asynchronously, retaining the synchronous parser's source order and diagnostics. */
|
|
20
|
+
export declare function loadHookConfigSourcesAsync(options: Omit<HookConfigLoaderOptions, "fileSystem">): Promise<ParsedHookConfig>;
|
|
19
21
|
//# sourceMappingURL=config-loader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/hooks/config-loader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/hooks/config-loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAsC,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEvF,MAAM,MAAM,oBAAoB,GAAG;IAClC,QAAQ,CAAC,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;CAC5D,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACrC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,oBAAoB,CAAC;IAC1C,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IACvC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IACxC,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,qBAAqB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnD,QAAQ,CAAC,sBAAsB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpD,QAAQ,CAAC,yBAAyB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACvD,QAAQ,CAAC,sBAAsB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACpD,CAAC;AAsBF,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,uBAAuB,GAAG,gBAAgB,CAyBxF;AAED,kGAAkG;AAClG,wBAAsB,0BAA0B,CAC/C,OAAO,EAAE,IAAI,CAAC,uBAAuB,EAAE,YAAY,CAAC,GAClD,OAAO,CAAC,gBAAgB,CAAC,CAuB3B"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
1
2
|
import { diagnostic } from "./diagnostics.js";
|
|
2
3
|
import { parseHookConfig } from "./schema.js";
|
|
3
4
|
export function loadHookConfigSources(options) {
|
|
@@ -24,6 +25,32 @@ export function loadHookConfigSources(options) {
|
|
|
24
25
|
}
|
|
25
26
|
return { executableHandlers, diagnostics };
|
|
26
27
|
}
|
|
28
|
+
/** Read files asynchronously, retaining the synchronous parser's source order and diagnostics. */
|
|
29
|
+
export async function loadHookConfigSourcesAsync(options) {
|
|
30
|
+
const files = new Map();
|
|
31
|
+
const candidates = createSourceCandidates(options);
|
|
32
|
+
await Promise.all(candidates.map(async (candidate) => {
|
|
33
|
+
if (candidate.kind !== "file")
|
|
34
|
+
return;
|
|
35
|
+
try {
|
|
36
|
+
files.set(candidate.sourcePath, { text: await readFile(candidate.sourcePath, "utf8") });
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
files.set(candidate.sourcePath, error.code === "ENOENT" ? {} : { error });
|
|
40
|
+
}
|
|
41
|
+
}));
|
|
42
|
+
return loadHookConfigSources({
|
|
43
|
+
...options,
|
|
44
|
+
fileSystem: {
|
|
45
|
+
readTextFile(path) {
|
|
46
|
+
const file = files.get(path);
|
|
47
|
+
if (file?.error !== undefined)
|
|
48
|
+
throw file.error;
|
|
49
|
+
return file?.text;
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
}
|
|
27
54
|
function createSourceCandidates(options) {
|
|
28
55
|
const candidates = [];
|
|
29
56
|
if (options.globalSettingsHooks !== undefined) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-loader.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/hooks/config-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAyC9C,MAAM,UAAU,qBAAqB,CAAC,OAAgC;IACrE,MAAM,kBAAkB,GAAqD,EAAE,CAAC;IAChF,MAAM,WAAW,GAAqB,EAAE,CAAC;IACzC,IAAI,YAAY,GAAG,CAAC,CAAC;IAErB,KAAK,MAAM,SAAS,IAAI,sBAAsB,CAAC,OAAO,CAAC,EAAE,CA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AK,CAAC,OAAO,CAAC,CAAC,CAAC,4BAA4B,CAAC;QACtF,OAAO;YACN,WAAW,EAAE;gBACZ,UAAU,CACT;oBACC,IAAI,EAAE,cAAc;oBACpB,OAAO,EAAE,kCAAkC,OAAO,EAAE;oBACpD,IAAI,EAAE,GAAG;iBACT,EACD,MAAM,CACN;aACD;YACD,kBAAkB,EAAE,EAAE;SACtB,CAAC;IACH,CAAC;AACF,CAAC;AAED,SAAS,8BAA8B,CACtC,QAAgD,EAChD,MAA0B;IAE1B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,KAAK,cAAc,CAAC,EAAE,CAAC;QACnE,OAAO,EAAE,CAAC;IACX,CAAC;IACD,OAAO;QACN,UAAU,CACT;YACC,IAAI,EAAE,mBAAmB;YACzB,KAAK,EAAE,cAAc;YACrB,OAAO,EAAE,4EAA4E;YACrF,IAAI,EAAE,oBAAoB;YAC1B,QAAQ,EAAE,SAAS;SACnB,EACD,MAAM,CACN;KACD,CAAC;AACH,CAAC","sourcesContent":["import { diagnostic } from \"./diagnostics.ts\";\nimport { parseHookConfig } from \"./schema.ts\";\nimport type { HookDiagnostic, HookSourceMetadata, ParsedHookConfig } from \"./types.ts\";\n\nexport type HookConfigFileSystem = {\n\treadonly readTextFile: (path: string) => string | undefined;\n};\n\nexport type HookConfigLoaderOptions = {\n\treadonly cwd: string;\n\treadonly agentDir: string;\n\treadonly fileSystem: HookConfigFileSystem;\n\treadonly globalSettingsHooks?: unknown;\n\treadonly projectSettingsHooks?: unknown;\n\treadonly globalHooksPath?: string;\n\treadonly projectHooksPath?: string;\n\treadonly globalHookSourcePaths?: readonly string[];\n\treadonly projectHookSourcePaths?: readonly string[];\n\treadonly preSessionHookSourcePaths?: readonly string[];\n\treadonly runtimeHookSourcePaths?: readonly string[];\n};\n\ntype SourceScope = HookSourceMetadata[\"scope\"];\ntype SourceTiming = HookSourceMetadata[\"discoveredAt\"];\n\ntype InlineSource = {\n\treadonly kind: \"inline\";\n\treadonly hooks: unknown;\n\treadonly scope: SourceScope;\n\treadonly sourcePath: string;\n\treadonly discoveredAt: SourceTiming;\n};\n\ntype FileSource = {\n\treadonly kind: \"file\";\n\treadonly scope: SourceScope;\n\treadonly sourcePath: string;\n\treadonly discoveredAt: SourceTiming;\n};\n\ntype SourceCandidate = InlineSource | FileSource;\n\nexport function loadHookConfigSources(options: HookConfigLoaderOptions): ParsedHookConfig {\n\tconst executableHandlers: ParsedHookConfig[\"executableHandlers\"][number][] = [];\n\tconst diagnostics: HookDiagnostic[] = [];\n\tlet displayOrder = 0;\n\n\tfor (const candidate of createSourceCandidates(options)) {\n\t\tconst source: HookSourceMetadata = {\n\t\t\tdiscoveredAt: candidate.discoveredAt,\n\t\t\tdisplayOrder,\n\t\t\tscope: candidate.scope,\n\t\t\tsourcePath: candidate.sourcePath,\n\t\t};\n\t\tconst loaded = loadCandidate(candidate, source, options.fileSystem);\n\t\tif (!loaded) {\n\t\t\tcontinue;\n\t\t}\n\t\tdisplayOrder += 1;\n\t\texecutableHandlers.push(...loaded.executableHandlers);\n\t\tdiagnostics.push(...loaded.diagnostics);\n\t\tif (source.discoveredAt === \"runtime\") {\n\t\t\tdiagnostics.push(...runtimeSessionStartDiagnostics(loaded.executableHandlers, source));\n\t\t}\n\t}\n\n\treturn { executableHandlers, diagnostics };\n}\n\nfunction createSourceCandidates(options: HookConfigLoaderOptions): SourceCandidate[] {\n\tconst candidates: SourceCandidate[] = [];\n\tif (options.globalSettingsHooks !== undefined) {\n\t\tcandidates.push({\n\t\t\tdiscoveredAt: \"pre-session\",\n\t\t\thooks: options.globalSettingsHooks,\n\t\t\tkind: \"inline\",\n\t\t\tscope: \"global\",\n\t\t\tsourcePath: \"<global-settings-hooks>\",\n\t\t});\n\t}\n\tcandidates.push(fileSource(\"global\", options.globalHooksPath ?? `${options.agentDir}/hooks.json`, \"pre-session\"));\n\tcandidates.push(...fileSources(\"global\", options.globalHookSourcePaths, \"pre-session\"));\n\tif (options.projectSettingsHooks !== undefined) {\n\t\tcandidates.push({\n\t\t\tdiscoveredAt: \"pre-session\",\n\t\t\thooks: options.projectSettingsHooks,\n\t\t\tkind: \"inline\",\n\t\t\tscope: \"project\",\n\t\t\tsourcePath: \"<project-settings-hooks>\",\n\t\t});\n\t}\n\tcandidates.push(\n\t\tfileSource(\"project\", options.projectHooksPath ?? `${options.cwd}/.senpi/hooks.json`, \"pre-session\"),\n\t);\n\tcandidates.push(...fileSources(\"project\", options.projectHookSourcePaths, \"pre-session\"));\n\tcandidates.push(...fileSources(\"plugin\", options.preSessionHookSourcePaths, \"pre-session\"));\n\tcandidates.push(...fileSources(\"runtime\", options.runtimeHookSourcePaths, \"runtime\"));\n\treturn candidates;\n}\n\nfunction fileSources(\n\tscope: SourceScope,\n\tpaths: readonly string[] | undefined,\n\tdiscoveredAt: SourceTiming,\n): SourceCandidate[] {\n\tif (!paths) {\n\t\treturn [];\n\t}\n\treturn paths.map((path) => fileSource(scope, path, discoveredAt));\n}\n\nfunction fileSource(scope: SourceScope, sourcePath: string, discoveredAt: SourceTiming): FileSource {\n\treturn { discoveredAt, kind: \"file\", scope, sourcePath };\n}\n\nfunction loadCandidate(\n\tcandidate: SourceCandidate,\n\tsource: HookSourceMetadata,\n\tfileSystem: HookConfigFileSystem,\n): ParsedHookConfig | undefined {\n\tif (candidate.kind === \"inline\") {\n\t\treturn parseHookConfig({ hooks: candidate.hooks }, source);\n\t}\n\n\tconst text = readSourceText(candidate.sourcePath, source, fileSystem);\n\tif (text === undefined) {\n\t\treturn undefined;\n\t}\n\tif (typeof text !== \"string\") {\n\t\treturn text;\n\t}\n\n\ttry {\n\t\tconst parsed: unknown = JSON.parse(text);\n\t\treturn parseHookConfig(parsed, source);\n\t} catch (error) {\n\t\tconst message = error instanceof Error ? error.message : \"Unknown JSON parse failure.\";\n\t\treturn {\n\t\t\tdiagnostics: [\n\t\t\t\tdiagnostic(\n\t\t\t\t\t{\n\t\t\t\t\t\tcode: \"invalid_root\",\n\t\t\t\t\t\tmessage: `Hook source JSON is malformed: ${message}`,\n\t\t\t\t\t\tpath: \"$\",\n\t\t\t\t\t},\n\t\t\t\t\tsource,\n\t\t\t\t),\n\t\t\t],\n\t\t\texecutableHandlers: [],\n\t\t};\n\t}\n}\n\nfunction readSourceText(\n\tsourcePath: string,\n\tsource: HookSourceMetadata,\n\tfileSystem: HookConfigFileSystem,\n): string | undefined | ParsedHookConfig {\n\ttry {\n\t\treturn fileSystem.readTextFile(sourcePath);\n\t} catch (error) {\n\t\tconst message = error instanceof Error ? error.message : \"Unknown file read failure.\";\n\t\treturn {\n\t\t\tdiagnostics: [\n\t\t\t\tdiagnostic(\n\t\t\t\t\t{\n\t\t\t\t\t\tcode: \"invalid_root\",\n\t\t\t\t\t\tmessage: `Hook source could not be read: ${message}`,\n\t\t\t\t\t\tpath: \"$\",\n\t\t\t\t\t},\n\t\t\t\t\tsource,\n\t\t\t\t),\n\t\t\t],\n\t\t\texecutableHandlers: [],\n\t\t};\n\t}\n}\n\nfunction runtimeSessionStartDiagnostics(\n\thandlers: ParsedHookConfig[\"executableHandlers\"],\n\tsource: HookSourceMetadata,\n): HookDiagnostic[] {\n\tif (!handlers.some((handler) => handler.event === \"SessionStart\")) {\n\t\treturn [];\n\t}\n\treturn [\n\t\tdiagnostic(\n\t\t\t{\n\t\t\t\tcode: \"unsupported_event\",\n\t\t\t\tevent: \"SessionStart\",\n\t\t\t\tmessage: \"Runtime SessionStart hooks are loaded for reload or the next session only.\",\n\t\t\t\tpath: \"hooks.SessionStart\",\n\t\t\t\tseverity: \"warning\",\n\t\t\t},\n\t\t\tsource,\n\t\t),\n\t];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"config-loader.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/hooks/config-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,UAAU,EA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CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,4BAA4B,CAAC;QACtF,OAAO;YACN,WAAW,EAAE;gBACZ,UAAU,CACT;oBACC,IAAI,EAAE,cAAc;oBACpB,OAAO,EAAE,kCAAkC,OAAO,EAAE;oBACpD,IAAI,EAAE,GAAG;iBACT,EACD,MAAM,CACN;aACD;YACD,kBAAkB,EAAE,EAAE;SACtB,CAAC;IACH,CAAC;AACF,CAAC;AAED,SAAS,8BAA8B,CACtC,QAAgD,EAChD,MAA0B;IAE1B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,KAAK,cAAc,CAAC,EAAE,CAAC;QACnE,OAAO,EAAE,CAAC;IACX,CAAC;IACD,OAAO;QACN,UAAU,CACT;YACC,IAAI,EAAE,mBAAmB;YACzB,KAAK,EAAE,cAAc;YACrB,OAAO,EAAE,4EAA4E;YACrF,IAAI,EAAE,oBAAoB;YAC1B,QAAQ,EAAE,SAAS;SACnB,EACD,MAAM,CACN;KACD,CAAC;AACH,CAAC","sourcesContent":["import { readFile } from \"node:fs/promises\";\nimport { diagnostic } from \"./diagnostics.ts\";\nimport { parseHookConfig } from \"./schema.ts\";\nimport type { HookDiagnostic, HookSourceMetadata, ParsedHookConfig } from \"./types.ts\";\n\nexport type HookConfigFileSystem = {\n\treadonly readTextFile: (path: string) => string | undefined;\n};\n\nexport type HookConfigLoaderOptions = {\n\treadonly cwd: string;\n\treadonly agentDir: string;\n\treadonly fileSystem: HookConfigFileSystem;\n\treadonly globalSettingsHooks?: unknown;\n\treadonly projectSettingsHooks?: unknown;\n\treadonly globalHooksPath?: string;\n\treadonly projectHooksPath?: string;\n\treadonly globalHookSourcePaths?: readonly string[];\n\treadonly projectHookSourcePaths?: readonly string[];\n\treadonly preSessionHookSourcePaths?: readonly string[];\n\treadonly runtimeHookSourcePaths?: readonly string[];\n};\n\ntype SourceScope = HookSourceMetadata[\"scope\"];\ntype SourceTiming = HookSourceMetadata[\"discoveredAt\"];\n\ntype InlineSource = {\n\treadonly kind: \"inline\";\n\treadonly hooks: unknown;\n\treadonly scope: SourceScope;\n\treadonly sourcePath: string;\n\treadonly discoveredAt: SourceTiming;\n};\n\ntype FileSource = {\n\treadonly kind: \"file\";\n\treadonly scope: SourceScope;\n\treadonly sourcePath: string;\n\treadonly discoveredAt: SourceTiming;\n};\n\ntype SourceCandidate = InlineSource | FileSource;\n\nexport function loadHookConfigSources(options: HookConfigLoaderOptions): ParsedHookConfig {\n\tconst executableHandlers: ParsedHookConfig[\"executableHandlers\"][number][] = [];\n\tconst diagnostics: HookDiagnostic[] = [];\n\tlet displayOrder = 0;\n\n\tfor (const candidate of createSourceCandidates(options)) {\n\t\tconst source: HookSourceMetadata = {\n\t\t\tdiscoveredAt: candidate.discoveredAt,\n\t\t\tdisplayOrder,\n\t\t\tscope: candidate.scope,\n\t\t\tsourcePath: candidate.sourcePath,\n\t\t};\n\t\tconst loaded = loadCandidate(candidate, source, options.fileSystem);\n\t\tif (!loaded) {\n\t\t\tcontinue;\n\t\t}\n\t\tdisplayOrder += 1;\n\t\texecutableHandlers.push(...loaded.executableHandlers);\n\t\tdiagnostics.push(...loaded.diagnostics);\n\t\tif (source.discoveredAt === \"runtime\") {\n\t\t\tdiagnostics.push(...runtimeSessionStartDiagnostics(loaded.executableHandlers, source));\n\t\t}\n\t}\n\n\treturn { executableHandlers, diagnostics };\n}\n\n/** Read files asynchronously, retaining the synchronous parser's source order and diagnostics. */\nexport async function loadHookConfigSourcesAsync(\n\toptions: Omit<HookConfigLoaderOptions, \"fileSystem\">,\n): Promise<ParsedHookConfig> {\n\tconst files = new Map<string, { text?: string; error?: unknown }>();\n\tconst candidates = createSourceCandidates(options);\n\tawait Promise.all(\n\t\tcandidates.map(async (candidate) => {\n\t\t\tif (candidate.kind !== \"file\") return;\n\t\t\ttry {\n\t\t\t\tfiles.set(candidate.sourcePath, { text: await readFile(candidate.sourcePath, \"utf8\") });\n\t\t\t} catch (error) {\n\t\t\t\tfiles.set(candidate.sourcePath, (error as NodeJS.ErrnoException).code === \"ENOENT\" ? {} : { error });\n\t\t\t}\n\t\t}),\n\t);\n\treturn loadHookConfigSources({\n\t\t...options,\n\t\tfileSystem: {\n\t\t\treadTextFile(path) {\n\t\t\t\tconst file = files.get(path);\n\t\t\t\tif (file?.error !== undefined) throw file.error;\n\t\t\t\treturn file?.text;\n\t\t\t},\n\t\t},\n\t});\n}\n\nfunction createSourceCandidates(options: Omit<HookConfigLoaderOptions, \"fileSystem\">): SourceCandidate[] {\n\tconst candidates: SourceCandidate[] = [];\n\tif (options.globalSettingsHooks !== undefined) {\n\t\tcandidates.push({\n\t\t\tdiscoveredAt: \"pre-session\",\n\t\t\thooks: options.globalSettingsHooks,\n\t\t\tkind: \"inline\",\n\t\t\tscope: \"global\",\n\t\t\tsourcePath: \"<global-settings-hooks>\",\n\t\t});\n\t}\n\tcandidates.push(fileSource(\"global\", options.globalHooksPath ?? `${options.agentDir}/hooks.json`, \"pre-session\"));\n\tcandidates.push(...fileSources(\"global\", options.globalHookSourcePaths, \"pre-session\"));\n\tif (options.projectSettingsHooks !== undefined) {\n\t\tcandidates.push({\n\t\t\tdiscoveredAt: \"pre-session\",\n\t\t\thooks: options.projectSettingsHooks,\n\t\t\tkind: \"inline\",\n\t\t\tscope: \"project\",\n\t\t\tsourcePath: \"<project-settings-hooks>\",\n\t\t});\n\t}\n\tcandidates.push(\n\t\tfileSource(\"project\", options.projectHooksPath ?? `${options.cwd}/.senpi/hooks.json`, \"pre-session\"),\n\t);\n\tcandidates.push(...fileSources(\"project\", options.projectHookSourcePaths, \"pre-session\"));\n\tcandidates.push(...fileSources(\"plugin\", options.preSessionHookSourcePaths, \"pre-session\"));\n\tcandidates.push(...fileSources(\"runtime\", options.runtimeHookSourcePaths, \"runtime\"));\n\treturn candidates;\n}\n\nfunction fileSources(\n\tscope: SourceScope,\n\tpaths: readonly string[] | undefined,\n\tdiscoveredAt: SourceTiming,\n): SourceCandidate[] {\n\tif (!paths) {\n\t\treturn [];\n\t}\n\treturn paths.map((path) => fileSource(scope, path, discoveredAt));\n}\n\nfunction fileSource(scope: SourceScope, sourcePath: string, discoveredAt: SourceTiming): FileSource {\n\treturn { discoveredAt, kind: \"file\", scope, sourcePath };\n}\n\nfunction loadCandidate(\n\tcandidate: SourceCandidate,\n\tsource: HookSourceMetadata,\n\tfileSystem: HookConfigFileSystem,\n): ParsedHookConfig | undefined {\n\tif (candidate.kind === \"inline\") {\n\t\treturn parseHookConfig({ hooks: candidate.hooks }, source);\n\t}\n\n\tconst text = readSourceText(candidate.sourcePath, source, fileSystem);\n\tif (text === undefined) {\n\t\treturn undefined;\n\t}\n\tif (typeof text !== \"string\") {\n\t\treturn text;\n\t}\n\n\ttry {\n\t\tconst parsed: unknown = JSON.parse(text);\n\t\treturn parseHookConfig(parsed, source);\n\t} catch (error) {\n\t\tconst message = error instanceof Error ? error.message : \"Unknown JSON parse failure.\";\n\t\treturn {\n\t\t\tdiagnostics: [\n\t\t\t\tdiagnostic(\n\t\t\t\t\t{\n\t\t\t\t\t\tcode: \"invalid_root\",\n\t\t\t\t\t\tmessage: `Hook source JSON is malformed: ${message}`,\n\t\t\t\t\t\tpath: \"$\",\n\t\t\t\t\t},\n\t\t\t\t\tsource,\n\t\t\t\t),\n\t\t\t],\n\t\t\texecutableHandlers: [],\n\t\t};\n\t}\n}\n\nfunction readSourceText(\n\tsourcePath: string,\n\tsource: HookSourceMetadata,\n\tfileSystem: HookConfigFileSystem,\n): string | undefined | ParsedHookConfig {\n\ttry {\n\t\treturn fileSystem.readTextFile(sourcePath);\n\t} catch (error) {\n\t\tconst message = error instanceof Error ? error.message : \"Unknown file read failure.\";\n\t\treturn {\n\t\t\tdiagnostics: [\n\t\t\t\tdiagnostic(\n\t\t\t\t\t{\n\t\t\t\t\t\tcode: \"invalid_root\",\n\t\t\t\t\t\tmessage: `Hook source could not be read: ${message}`,\n\t\t\t\t\t\tpath: \"$\",\n\t\t\t\t\t},\n\t\t\t\t\tsource,\n\t\t\t\t),\n\t\t\t],\n\t\t\texecutableHandlers: [],\n\t\t};\n\t}\n}\n\nfunction runtimeSessionStartDiagnostics(\n\thandlers: ParsedHookConfig[\"executableHandlers\"],\n\tsource: HookSourceMetadata,\n): HookDiagnostic[] {\n\tif (!handlers.some((handler) => handler.event === \"SessionStart\")) {\n\t\treturn [];\n\t}\n\treturn [\n\t\tdiagnostic(\n\t\t\t{\n\t\t\t\tcode: \"unsupported_event\",\n\t\t\t\tevent: \"SessionStart\",\n\t\t\t\tmessage: \"Runtime SessionStart hooks are loaded for reload or the next session only.\",\n\t\t\t\tpath: \"hooks.SessionStart\",\n\t\t\t\tseverity: \"warning\",\n\t\t\t},\n\t\t\tsource,\n\t\t),\n\t];\n}\n"]}
|