@code-yeongyu/senpi 2026.9.12-3 → 2026.9.12
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 +0 -60
- package/README.md +1 -1
- package/dist/bun/cli.d.ts +1 -2
- package/dist/bun/cli.d.ts.map +1 -1
- package/dist/bun/cli.js +8 -5
- package/dist/bun/cli.js.map +1 -1
- package/dist/bun/register-bedrock.d.ts +2 -0
- package/dist/bun/register-bedrock.d.ts.map +1 -0
- package/dist/bun/register-bedrock.js +4 -0
- package/dist/bun/register-bedrock.js.map +1 -0
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js +1 -2
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/experimental/auth.d.ts +16 -0
- package/dist/cli/experimental/auth.d.ts.map +1 -0
- package/dist/cli/experimental/auth.js +13 -0
- package/dist/cli/experimental/auth.js.map +1 -0
- package/dist/cli/experimental/cli.d.ts +6 -0
- package/dist/cli/experimental/cli.d.ts.map +1 -0
- package/dist/cli/experimental/cli.js +5 -0
- package/dist/cli/experimental/cli.js.map +1 -0
- package/dist/cli/experimental/command-options.d.ts +17 -0
- package/dist/cli/experimental/command-options.d.ts.map +1 -0
- package/dist/cli/experimental/command-options.js +35 -0
- package/dist/cli/experimental/command-options.js.map +1 -0
- package/dist/cli/experimental/command.d.ts +63 -0
- package/dist/cli/experimental/command.d.ts.map +1 -0
- package/dist/cli/experimental/command.js +127 -0
- package/dist/cli/experimental/command.js.map +1 -0
- package/dist/cli/experimental/commands/client.d.ts +13 -0
- package/dist/cli/experimental/commands/client.d.ts.map +1 -0
- package/dist/cli/experimental/commands/client.js +25 -0
- package/dist/cli/experimental/commands/client.js.map +1 -0
- package/dist/cli/experimental/commands/pi.d.ts +15 -0
- package/dist/cli/experimental/commands/pi.d.ts.map +1 -0
- package/dist/cli/experimental/commands/pi.js +28 -0
- package/dist/cli/experimental/commands/pi.js.map +1 -0
- package/dist/cli/experimental/commands/server.d.ts +13 -0
- package/dist/cli/experimental/commands/server.d.ts.map +1 -0
- package/dist/cli/experimental/commands/server.js +25 -0
- package/dist/cli/experimental/commands/server.js.map +1 -0
- package/dist/cli/experimental/transport-address.d.ts +10 -0
- package/dist/cli/experimental/transport-address.d.ts.map +1 -0
- package/dist/cli/experimental/transport-address.js +38 -0
- package/dist/cli/experimental/transport-address.js.map +1 -0
- package/dist/cli.js +0 -3
- package/dist/cli.js.map +1 -1
- package/dist/client/index.d.ts +2 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +2 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/remote-session.d.ts +53 -0
- package/dist/client/remote-session.d.ts.map +1 -0
- package/dist/client/remote-session.js +340 -0
- package/dist/client/remote-session.js.map +1 -0
- package/dist/client/transcript.d.ts +12 -0
- package/dist/client/transcript.d.ts.map +1 -0
- package/dist/client/transcript.js +98 -0
- package/dist/client/transcript.js.map +1 -0
- package/dist/config.d.ts +0 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +0 -1
- 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 +6 -18
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session.d.ts +17 -54
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +157 -153
- 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 +4 -6
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction-settings-access.d.ts +2 -18
- package/dist/core/compaction-settings-access.d.ts.map +1 -1
- package/dist/core/compaction-settings-access.js +4 -35
- 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 +3 -6
- package/dist/core/compaction-settings-resolver.js.map +1 -1
- package/dist/core/extensions/builtin/ask-user/extension.d.ts.map +1 -1
- package/dist/core/extensions/builtin/ask-user/extension.js +0 -11
- package/dist/core/extensions/builtin/ask-user/extension.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 +1 -2
- package/dist/core/extensions/builtin/cursor-cli-oauth/models.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 +1 -7
- 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 +2 -4
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/keybindings.d.ts +0 -10
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +0 -8
- 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 +1 -5
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +0 -8
- 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 +0 -2
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts +0 -1
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +2 -5
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/retry-fallback/settings.d.ts +0 -2
- 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 +2 -5
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +19 -68
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/session-write-reservation.d.ts +0 -9
- package/dist/core/session-write-reservation.d.ts.map +1 -1
- package/dist/core/session-write-reservation.js +0 -33
- package/dist/core/session-write-reservation.js.map +1 -1
- package/dist/core/settings-manager.d.ts +5 -12
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +6 -18
- 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 +2 -6
- package/dist/core/skills.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +9 -8
- 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 +142 -3
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit.d.ts +12 -1
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +168 -4
- 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 +53 -2
- 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 +58 -2
- 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 +47 -2
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/read.d.ts +4 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +141 -4
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +153 -4
- 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 +1 -3
- 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 +2 -4
- package/dist/modes/app-server/turn-adapter.js.map +1 -1
- package/dist/modes/interactive/components/ask-user-async-widget.d.ts +12 -17
- package/dist/modes/interactive/components/ask-user-async-widget.d.ts.map +1 -1
- package/dist/modes/interactive/components/ask-user-async-widget.js +23 -47
- package/dist/modes/interactive/components/ask-user-async-widget.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +0 -7
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +2 -26
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/assistant-render-descriptors.d.ts +0 -4
- package/dist/modes/interactive/components/assistant-render-descriptors.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-render-descriptors.js +5 -8
- package/dist/modes/interactive/components/assistant-render-descriptors.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +1 -10
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +1 -37
- 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 +1 -4
- package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
- package/dist/modes/interactive/components/status-indicator.js +2 -14
- 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 +1 -4
- package/dist/modes/interactive/components/tool-execution-renderer.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution-renderer.js +10 -23
- package/dist/modes/interactive/components/tool-execution-renderer.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution-types.d.ts +2 -18
- 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 +0 -5
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +15 -10
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +138 -178
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/dark.json +1 -2
- package/dist/modes/interactive/theme/grok-day.json +1 -2
- package/dist/modes/interactive/theme/grok-night.json +1 -2
- package/dist/modes/interactive/theme/light.json +1 -2
- package/dist/modes/interactive/theme/theme-controller.d.ts +0 -1
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.js +0 -5
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
- package/dist/modes/interactive/theme/theme-schema.json +2 -6
- package/dist/modes/interactive/theme/theme.d.ts +5 -10
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +117 -14
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/interactive/tips/catalog/input-tips.d.ts +0 -5
- package/dist/modes/interactive/tips/catalog/input-tips.d.ts.map +1 -1
- package/dist/modes/interactive/tips/catalog/input-tips.js +0 -5
- package/dist/modes/interactive/tips/catalog/input-tips.js.map +1 -1
- package/dist/modes/rpc/connection-handler.d.ts.map +1 -1
- package/dist/modes/rpc/connection-handler.js +2 -8
- 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 +1 -11
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +1 -2
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js +0 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/modes/rpc/session-registry.d.ts +1 -3
- 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 +8 -10
- package/dist/modes/rpc/session-worker-client.d.ts.map +1 -1
- package/dist/modes/rpc/session-worker-client.js +23 -14
- package/dist/modes/rpc/session-worker-client.js.map +1 -1
- package/dist/modes/rpc/session-worker-protocol.d.ts +0 -10
- package/dist/modes/rpc/session-worker-protocol.d.ts.map +1 -1
- package/dist/modes/rpc/session-worker-protocol.js +0 -2
- package/dist/modes/rpc/session-worker-protocol.js.map +1 -1
- package/dist/modes/rpc/session-worker.js +16 -12
- package/dist/modes/rpc/session-worker.js.map +1 -1
- package/dist/modes/rpc/worker-session-registry.d.ts +0 -12
- package/dist/modes/rpc/worker-session-registry.d.ts.map +1 -1
- package/dist/modes/rpc/worker-session-registry.js +24 -51
- package/dist/modes/rpc/worker-session-registry.js.map +1 -1
- package/dist/senpi +0 -3
- package/dist/server/create-harness.d.ts +26 -0
- package/dist/server/create-harness.d.ts.map +1 -0
- package/dist/server/create-harness.js +106 -0
- package/dist/server/create-harness.js.map +1 -0
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +69 -52
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/clipboard-native.d.ts +11 -0
- package/dist/utils/clipboard-native.d.ts.map +1 -0
- package/dist/utils/clipboard-native.js +20 -0
- package/dist/utils/clipboard-native.js.map +1 -0
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +126 -49
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/exif-orientation.d.ts.map +1 -1
- package/dist/utils/exif-orientation.js +3 -2
- package/dist/utils/exif-orientation.js.map +1 -1
- package/dist/utils/tools-manager.d.ts +0 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +19 -41
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/AGENTS.md +67 -0
- package/docs/compaction.md +13 -39
- package/docs/containerization.md +0 -45
- package/docs/development.md +0 -19
- package/docs/docs.json +0 -4
- package/docs/environment-variables.md +0 -2
- package/docs/extensions.md +10 -21
- package/docs/keybindings.md +2 -7
- package/docs/models.md +1 -1
- package/docs/providers.md +1 -1
- package/docs/rpc.md +8 -16
- package/docs/sdk.md +0 -7
- package/docs/session-format.md +38 -52
- package/docs/settings.md +4 -40
- package/docs/skills.md +1 -1
- package/docs/termux.md +1 -0
- package/docs/themes.md +6 -8
- package/docs/tui.md +3 -22
- package/examples/README.md +0 -3
- package/examples/extensions/dynamic-resources/dynamic.json +0 -2
- 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 +0 -5
- package/node_modules/@aws-sdk/core/dist-es/submodules/util/index.js +0 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/util/index.d.ts +0 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/util/index.d.ts +0 -1
- 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 +0 -2
- package/node_modules/@aws-sdk/credential-provider-node/dist-es/runtime/memoize-chain.js +0 -2
- 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/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 +0 -24
- package/node_modules/@code-yeongyu/senpi-codemode/package.json +5 -5
- package/node_modules/@earendil-works/pi-agent-core/README.md +0 -4
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts +384 -639
- 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 +250 -5
- 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 +6 -12
- 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 +27 -33
- 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 +8 -30
- 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 +64 -53
- 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/env/nodejs.d.ts +28 -25
- 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 +125 -368
- 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 +38 -20
- 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 +55 -233
- 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/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 +2 -3
- 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/reducer.d.ts +100 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/reducer.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/reducer.js +420 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/reducer.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/result.d.ts +0 -93
- 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 +0 -39
- 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/session/context.d.ts +19 -6
- 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 +53 -31
- 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/index.d.ts +5 -9
- 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 +4 -7
- 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 +8 -19
- 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 +219 -34
- 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/errors.d.ts +9 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/errors.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/errors.js +18 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/errors.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/repo.d.ts +24 -27
- 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 +151 -276
- 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 +41 -39
- 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 +196 -175
- 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 +22 -23
- 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 +1 -2
- 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/jsonl.d.ts +3 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl.js +2 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory.d.ts +40 -44
- 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 +115 -333
- 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/session.d.ts +51 -78
- 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 +207 -327
- 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/state.d.ts +65 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/state.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/state.js +320 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/state.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance.d.ts +4 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance.js +762 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/index.d.ts +2 -9
- 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 +1 -8
- 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/types.d.ts +7 -5
- 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 +265 -425
- 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/skills.d.ts +2 -3
- 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 +26 -29
- 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 +43 -64
- 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 +26 -45
- 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 +93 -66
- 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 +13 -17
- 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 +1 -2
- 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 +2 -3
- 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 +1 -2
- 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 +6 -4
- 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 +8 -12
- 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 +45 -128
- 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/shell-output.d.ts +5 -19
- 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 +192 -65
- 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 +0 -1
- 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/index.d.ts +1 -4
- 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 +6 -3
- 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 +16 -24
- 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/search/scanning.d.ts +29 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/search/scanning.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/search/scanning.js +103 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/search/scanning.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +0 -2
- 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 +6 -27
- package/node_modules/@earendil-works/pi-ai/README.md +4 -39
- 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 +1 -8
- 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-gateway-binding.d.ts +69 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-gateway-binding.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-gateway-binding.js +159 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-gateway-binding.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/measure.d.ts +0 -11
- 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 +0 -18
- 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 +1 -5
- 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 +1 -4
- 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 +3 -6
- 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 +1 -4
- 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 +3 -13
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js.map +1 -1
- 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 +1 -2
- 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 +1 -2
- package/node_modules/@earendil-works/pi-ai/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/index.js +1 -2
- package/node_modules/@earendil-works/pi-ai/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.d.ts +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.js +2 -5
- 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 +0 -4
- 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 +1 -2
- 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/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 +3 -4
- 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.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.js +4 -5
- 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 +6 -16
- 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/event-stream.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js +5 -25
- 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 +1 -5
- 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 +1 -10
- 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 +2 -13
- 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 +7 -18
- 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 +31 -36
- 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 +4 -53
- package/node_modules/@earendil-works/pi-tui/dist/alt-screen-search.d.ts +1 -21
- 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 +42 -199
- 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 +1 -3
- 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 +0 -28
- 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 +1 -6
- 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 +18 -98
- 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 +1 -12
- 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 +6 -40
- 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 +0 -7
- 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 +0 -3
- 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 +8 -20
- package/node_modules/@earendil-works/pi-tui/dist/components/loader.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/scroll-view.d.ts +3 -6
- 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 +1 -6
- 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 +1 -4
- 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 +2 -48
- 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 +1 -5
- 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 +5 -54
- 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 +1 -3
- package/node_modules/@earendil-works/pi-tui/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.js +0 -3
- package/node_modules/@earendil-works/pi-tui/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/layout.d.ts +1 -3
- package/node_modules/@earendil-works/pi-tui/dist/layout.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/layout.js +9 -32
- 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 +1 -2
- 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 +44 -3
- package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal.js +20 -2
- 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 +1 -31
- 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 +41 -335
- 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 +5 -83
- package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui.js +4 -118
- package/node_modules/@earendil-works/pi-tui/dist/tui.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts +0 -2
- package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/utils.js +0 -9
- package/node_modules/@earendil-works/pi-tui/dist/utils.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/native/darwin/README.md +6 -8
- package/node_modules/@earendil-works/pi-tui/native/darwin/build.sh +5 -12
- package/node_modules/@earendil-works/pi-tui/native/darwin/prebuilds/darwin-arm64/{darwin-platform.node → darwin-modifiers.node} +0 -0
- package/node_modules/@earendil-works/pi-tui/native/darwin/prebuilds/darwin-x64/{darwin-platform.node → darwin-modifiers.node} +0 -0
- package/node_modules/@earendil-works/pi-tui/native/darwin/src/darwin-modifiers.c +70 -0
- package/node_modules/@earendil-works/pi-tui/native/win32/README.md +7 -18
- package/node_modules/@earendil-works/pi-tui/native/win32/build.mjs +4 -7
- 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 +119 -0
- package/node_modules/@earendil-works/pi-tui/package.json +3 -10
- package/node_modules/@google/genai/dist/genai.d.ts +278 -1788
- package/node_modules/@google/genai/dist/index.cjs +299 -319
- package/node_modules/@google/genai/dist/index.mjs +299 -319
- package/node_modules/@google/genai/dist/index.mjs.map +1 -1
- package/node_modules/@google/genai/dist/node/index.cjs +300 -320
- package/node_modules/@google/genai/dist/node/index.mjs +300 -320
- package/node_modules/@google/genai/dist/node/index.mjs.map +1 -1
- package/node_modules/@google/genai/dist/node/node.d.ts +278 -1788
- package/node_modules/@google/genai/dist/tokenizer/node.cjs +2 -49
- package/node_modules/@google/genai/dist/tokenizer/node.d.ts +3 -43
- package/node_modules/@google/genai/dist/tokenizer/node.mjs +2 -49
- package/node_modules/@google/genai/dist/tokenizer/node.mjs.map +1 -1
- package/node_modules/@google/genai/dist/vertex_internal/index.cjs +3 -39
- package/node_modules/@google/genai/dist/vertex_internal/index.cjs.map +1 -1
- package/node_modules/@google/genai/dist/vertex_internal/index.d.ts +9 -51
- package/node_modules/@google/genai/dist/vertex_internal/index.js +3 -39
- package/node_modules/@google/genai/dist/vertex_internal/index.js.map +1 -1
- package/node_modules/@google/genai/dist/web/index.mjs +299 -319
- package/node_modules/@google/genai/dist/web/index.mjs.map +1 -1
- package/node_modules/@google/genai/dist/web/web.d.ts +278 -1788
- package/node_modules/@google/genai/package.json +1 -1
- package/node_modules/@mariozechner/clipboard/.yarnrc.yml +1 -0
- package/node_modules/@mariozechner/clipboard/Cargo.toml +45 -0
- package/node_modules/@mariozechner/clipboard/README.md +60 -0
- package/node_modules/@mariozechner/clipboard/build.rs +5 -0
- package/node_modules/@mariozechner/clipboard/exp.ts +12 -0
- package/node_modules/@mariozechner/clipboard/index.d.ts +37 -0
- package/node_modules/@mariozechner/clipboard/index.js +606 -0
- package/node_modules/@mariozechner/clipboard/package.json +45 -0
- package/node_modules/@mariozechner/clipboard/src/clipboard_rs/common.rs +307 -0
- package/node_modules/@mariozechner/clipboard/src/clipboard_rs/mod.rs +93 -0
- package/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/ios.rs +313 -0
- package/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/macos.rs +471 -0
- package/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/mod.rs +252 -0
- package/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/wayland.rs +431 -0
- package/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/win.rs +712 -0
- package/node_modules/@mariozechner/clipboard/src/clipboard_rs/platform/x11.rs +916 -0
- package/node_modules/@mariozechner/clipboard/src/lib.rs +194 -0
- package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +4 -11
- package/node_modules/@smithy/node-http-handler/dist-es/http2/ClientHttp2SessionRef.js +0 -1
- package/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js +3 -2
- package/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +1 -8
- package/node_modules/@smithy/node-http-handler/package.json +2 -2
- package/node_modules/ignore/README.md +0 -52
- package/node_modules/ignore/index.js +129 -785
- package/node_modules/ignore/legacy.js +98 -660
- package/node_modules/ignore/package.json +4 -10
- package/node_modules/marked/README.md +0 -1
- package/node_modules/marked/lib/marked.d.ts +0 -7
- 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 +5 -7
- package/node_modules/typebox/build/format/iri.mjs +1 -5
- package/node_modules/typebox/build/guard/emit.mjs +4 -2
- package/node_modules/typebox/build/guard/guard.mjs +18 -6
- package/node_modules/typebox/build/guard/string.mjs +24 -16
- package/node_modules/typebox/build/schema/compile.d.mts +2 -3
- package/node_modules/typebox/build/schema/compile.mjs +8 -8
- package/node_modules/typebox/build/schema/engine/_context.d.mts +6 -1
- package/node_modules/typebox/build/schema/engine/_context.mjs +14 -9
- package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/_stack.d.mts +2 -6
- package/node_modules/typebox/build/schema/engine/_stack.mjs +32 -135
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +4 -16
- 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 +3 -1
- package/node_modules/typebox/build/schema/engine/ref.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/schema.mjs +0 -6
- 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 +13 -7
- package/node_modules/typebox/build/schema/parse.d.mts +0 -1
- package/node_modules/typebox/build/schema/parse.mjs +5 -10
- package/node_modules/typebox/build/schema/resolve/resolve.d.mts +3 -34
- package/node_modules/typebox/build/schema/resolve/resolve.mjs +73 -198
- package/node_modules/typebox/build/schema/schema.d.mts +0 -1
- package/node_modules/typebox/build/schema/schema.mjs +0 -1
- package/node_modules/typebox/build/value/errors/errors.d.mts +12 -2
- package/node_modules/typebox/build/value/errors/errors.mjs +7 -2
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +5 -9
- package/node_modules/undici/docs/docs/api/Client.md +0 -4
- package/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +2 -3
- package/node_modules/undici/docs/docs/api/EventSource.md +0 -4
- package/node_modules/undici/docs/docs/api/Interceptors.md +3 -7
- package/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +1 -7
- package/node_modules/undici/lib/cache/memory-cache-store.js +2 -2
- package/node_modules/undici/lib/core/symbols.js +0 -2
- package/node_modules/undici/lib/dispatcher/agent.js +2 -7
- package/node_modules/undici/lib/dispatcher/balanced-pool.js +4 -7
- package/node_modules/undici/lib/dispatcher/client-h1.js +4 -12
- package/node_modules/undici/lib/dispatcher/client-h2.js +3 -43
- package/node_modules/undici/lib/dispatcher/client.js +2 -3
- package/node_modules/undici/lib/dispatcher/dispatcher-base.js +1 -13
- package/node_modules/undici/lib/dispatcher/dispatcher.js +1 -15
- package/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +0 -3
- package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +3 -10
- package/node_modules/undici/lib/dispatcher/proxy-agent.js +1 -18
- package/node_modules/undici/lib/dispatcher/retry-agent.js +0 -3
- package/node_modules/undici/lib/dispatcher/round-robin-pool.js +1 -1
- package/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +21 -91
- package/node_modules/undici/lib/handler/cache-handler.js +5 -29
- package/node_modules/undici/lib/handler/decorator-handler.js +1 -7
- package/node_modules/undici/lib/handler/deduplication-handler.js +6 -12
- package/node_modules/undici/lib/handler/redirect-handler.js +4 -21
- package/node_modules/undici/lib/handler/retry-handler.js +30 -148
- package/node_modules/undici/lib/interceptor/cache.js +12 -65
- package/node_modules/undici/lib/interceptor/decompress.js +13 -115
- package/node_modules/undici/lib/interceptor/deduplicate.js +4 -5
- package/node_modules/undici/lib/interceptor/dns.js +0 -7
- package/node_modules/undici/lib/interceptor/dump.js +23 -10
- package/node_modules/undici/lib/mock/mock-agent.js +1 -13
- package/node_modules/undici/lib/mock/mock-utils.js +10 -11
- package/node_modules/undici/lib/util/cache.js +3 -45
- package/node_modules/undici/lib/web/cookies/parse.js +147 -150
- package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +1 -28
- package/node_modules/undici/lib/web/eventsource/eventsource.js +3 -13
- package/node_modules/undici/lib/web/fetch/index.js +0 -6
- package/node_modules/undici/lib/web/fetch/request.js +3 -2
- package/node_modules/undici/lib/web/fetch/util.js +1 -6
- 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 +0 -5
- package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +10 -8
- package/node_modules/undici/package.json +3 -3
- package/node_modules/undici/types/client.d.ts +0 -10
- package/node_modules/undici/types/interceptors.d.ts +0 -2
- package/node_modules/undici/types/mock-agent.d.ts +10 -11
- package/node_modules/undici/types/socks5-proxy-agent.d.ts +0 -2
- package/package.json +49 -70
- package/vendor/pi-client/client.d.ts +15 -20
- package/vendor/pi-client/client.d.ts.map +1 -1
- package/vendor/pi-client/client.js +245 -248
- package/vendor/pi-client/client.js.map +1 -1
- package/vendor/pi-client/connection.d.ts +3 -4
- package/vendor/pi-client/connection.d.ts.map +1 -1
- package/vendor/pi-client/connection.js +9 -13
- package/vendor/pi-client/connection.js.map +1 -1
- package/vendor/pi-client/errors.d.ts +15 -6
- package/vendor/pi-client/errors.d.ts.map +1 -1
- package/vendor/pi-client/errors.js +25 -10
- package/vendor/pi-client/errors.js.map +1 -1
- package/vendor/pi-client/index.d.ts +4 -3
- 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/session-handle.d.ts +54 -0
- package/vendor/pi-client/session-handle.d.ts.map +1 -0
- package/vendor/pi-client/session-handle.js +50 -0
- package/vendor/pi-client/session-handle.js.map +1 -0
- package/vendor/pi-client/state.d.ts +22 -0
- package/vendor/pi-client/state.d.ts.map +1 -0
- package/vendor/pi-client/state.js +145 -0
- package/vendor/pi-client/state.js.map +1 -0
- package/vendor/pi-client/types.d.ts +8 -14
- 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 +1 -14
- package/vendor/pi-client/unix.d.ts.map +1 -1
- package/vendor/pi-client/unix.js +8 -138
- package/vendor/pi-client/unix.js.map +1 -1
- package/vendor/pi-protocol/codec.d.ts +4 -2
- package/vendor/pi-protocol/codec.d.ts.map +1 -1
- package/vendor/pi-protocol/codec.js +34 -7
- package/vendor/pi-protocol/codec.js.map +1 -1
- package/vendor/pi-protocol/framing.d.ts +2 -0
- package/vendor/pi-protocol/framing.d.ts.map +1 -1
- package/vendor/pi-protocol/framing.js +15 -0
- 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/schemas.d.ts +13739 -0
- package/vendor/pi-protocol/schemas.d.ts.map +1 -0
- package/vendor/pi-protocol/schemas.js +386 -0
- package/vendor/pi-protocol/schemas.js.map +1 -0
- package/dist/bun/runtime-setup.d.ts +0 -2
- package/dist/bun/runtime-setup.d.ts.map +0 -1
- package/dist/bun/runtime-setup.js +0 -9
- package/dist/bun/runtime-setup.js.map +0 -1
- package/dist/bun/sandbox-env-setup.d.ts +0 -2
- package/dist/bun/sandbox-env-setup.d.ts.map +0 -1
- package/dist/bun/sandbox-env-setup.js +0 -4
- package/dist/bun/sandbox-env-setup.js.map +0 -1
- package/dist/cli/setup.d.ts +0 -2
- package/dist/cli/setup.d.ts.map +0 -1
- package/dist/cli/setup.js +0 -12
- package/dist/cli/setup.js.map +0 -1
- package/dist/core/cursor-history-admission.d.ts +0 -50
- package/dist/core/cursor-history-admission.d.ts.map +0 -1
- package/dist/core/cursor-history-admission.js +0 -130
- package/dist/core/cursor-history-admission.js.map +0 -1
- package/dist/core/tools/renderers/bash.d.ts +0 -12
- package/dist/core/tools/renderers/bash.d.ts.map +0 -1
- package/dist/core/tools/renderers/bash.js +0 -156
- package/dist/core/tools/renderers/bash.js.map +0 -1
- package/dist/core/tools/renderers/edit.d.ts +0 -23
- package/dist/core/tools/renderers/edit.d.ts.map +0 -1
- package/dist/core/tools/renderers/edit.js +0 -172
- package/dist/core/tools/renderers/edit.js.map +0 -1
- package/dist/core/tools/renderers/find.d.ts +0 -10
- package/dist/core/tools/renderers/find.d.ts.map +0 -1
- package/dist/core/tools/renderers/find.js +0 -64
- package/dist/core/tools/renderers/find.js.map +0 -1
- package/dist/core/tools/renderers/grep.d.ts +0 -10
- package/dist/core/tools/renderers/grep.d.ts.map +0 -1
- package/dist/core/tools/renderers/grep.js +0 -69
- package/dist/core/tools/renderers/grep.js.map +0 -1
- package/dist/core/tools/renderers/index.d.ts +0 -28
- package/dist/core/tools/renderers/index.d.ts.map +0 -1
- package/dist/core/tools/renderers/index.js +0 -47
- package/dist/core/tools/renderers/index.js.map +0 -1
- package/dist/core/tools/renderers/ls.d.ts +0 -10
- package/dist/core/tools/renderers/ls.d.ts.map +0 -1
- package/dist/core/tools/renderers/ls.js +0 -58
- package/dist/core/tools/renderers/ls.js.map +0 -1
- package/dist/core/tools/renderers/read.d.ts +0 -19
- package/dist/core/tools/renderers/read.d.ts.map +0 -1
- package/dist/core/tools/renderers/read.js +0 -149
- package/dist/core/tools/renderers/read.js.map +0 -1
- package/dist/core/tools/renderers/write.d.ts +0 -10
- package/dist/core/tools/renderers/write.d.ts.map +0 -1
- package/dist/core/tools/renderers/write.js +0 -162
- package/dist/core/tools/renderers/write.js.map +0 -1
- package/dist/modes/interactive/chat-viewport.d.ts +0 -22
- package/dist/modes/interactive/chat-viewport.d.ts.map +0 -1
- package/dist/modes/interactive/chat-viewport.js +0 -29
- package/dist/modes/interactive/chat-viewport.js.map +0 -1
- package/dist/modes/interactive/components/ask-user-answer-key.d.ts +0 -14
- package/dist/modes/interactive/components/ask-user-answer-key.d.ts.map +0 -1
- package/dist/modes/interactive/components/ask-user-answer-key.js +0 -65
- package/dist/modes/interactive/components/ask-user-answer-key.js.map +0 -1
- package/dist/modes/interactive/theme/theme-json.d.ts +0 -84
- package/dist/modes/interactive/theme/theme-json.d.ts.map +0 -1
- package/dist/modes/interactive/theme/theme-json.js +0 -130
- package/dist/modes/interactive/theme/theme-json.js.map +0 -1
- package/dist/modes/interactive/tui-renderer.d.ts +0 -21
- package/dist/modes/interactive/tui-renderer.d.ts.map +0 -1
- package/dist/modes/interactive/tui-renderer.js +0 -67
- package/dist/modes/interactive/tui-renderer.js.map +0 -1
- package/dist/modes/rpc/session-path-reservations.d.ts +0 -30
- package/dist/modes/rpc/session-path-reservations.d.ts.map +0 -1
- package/dist/modes/rpc/session-path-reservations.js +0 -58
- package/dist/modes/rpc/session-path-reservations.js.map +0 -1
- package/dist/modes/rpc/session-worker-credit.d.ts +0 -17
- package/dist/modes/rpc/session-worker-credit.d.ts.map +0 -1
- package/dist/modes/rpc/session-worker-credit.js +0 -39
- package/dist/modes/rpc/session-worker-credit.js.map +0 -1
- package/dist/modes/rpc/session-worker-signals.d.ts +0 -7
- package/dist/modes/rpc/session-worker-signals.d.ts.map +0 -1
- package/dist/modes/rpc/session-worker-signals.js +0 -19
- package/dist/modes/rpc/session-worker-signals.js.map +0 -1
- package/dist/utils/clipboard-command.d.ts +0 -7
- package/dist/utils/clipboard-command.d.ts.map +0 -1
- package/dist/utils/clipboard-command.js +0 -45
- package/dist/utils/clipboard-command.js.map +0 -1
- package/examples/plugins/pi-example-plugin/README.md +0 -38
- package/examples/plugins/pi-example-plugin/package.json +0 -10
- package/examples/plugins/pi-example-plugin/src/contract.ts +0 -13
- package/examples/plugins/pi-example-plugin/src/session.ts +0 -23
- package/examples/plugins/pi-example-plugin/src/tui.ts +0 -31
- package/node_modules/@aws-sdk/core/dist-es/submodules/util/hasOwn.js +0 -3
- package/node_modules/@aws-sdk/core/dist-types/submodules/util/hasOwn.d.ts +0 -4
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/util/hasOwn.d.ts +0 -1
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/LICENSE +0 -201
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/README.md +0 -62
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-cjs/index.js +0 -158
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/constants.js +0 -2
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/fromEnvSigningName.js +0 -16
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/fromSso.js +0 -84
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/fromStatic.js +0 -8
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/getNewSsoOidcToken.js +0 -11
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/getSsoOidcClient.js +0 -10
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/index.js +0 -4
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/nodeProvider.js +0 -5
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/validateTokenExpiry.js +0 -7
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/validateTokenKey.js +0 -7
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/writeSSOTokenToFile.js +0 -8
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/constants.d.ts +0 -8
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/fromEnvSigningName.d.ts +0 -18
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/fromSso.d.ts +0 -12
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/fromStatic.d.ts +0 -9
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/getNewSsoOidcToken.d.ts +0 -8
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/getSsoOidcClient.d.ts +0 -7
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/index.d.ts +0 -7
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/nodeProvider.d.ts +0 -18
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/constants.d.ts +0 -3
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/fromEnvSigningName.d.ts +0 -8
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/fromSso.d.ts +0 -10
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/fromStatic.d.ts +0 -5
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/getNewSsoOidcToken.d.ts +0 -9
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/getSsoOidcClient.d.ts +0 -7
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/index.d.ts +0 -7
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/nodeProvider.d.ts +0 -3
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/validateTokenExpiry.d.ts +0 -2
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/validateTokenKey.d.ts +0 -1
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/ts3.4/writeSSOTokenToFile.d.ts +0 -2
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/validateTokenExpiry.d.ts +0 -5
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/validateTokenKey.d.ts +0 -4
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-types/writeSSOTokenToFile.d.ts +0 -5
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/package.json +0 -69
- package/node_modules/@earendil-works/chord/README.md +0 -205
- package/node_modules/@earendil-works/chord/dist/api.d.ts +0 -15
- package/node_modules/@earendil-works/chord/dist/api.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/api.js +0 -72
- package/node_modules/@earendil-works/chord/dist/api.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/bundler.d.ts +0 -6
- package/node_modules/@earendil-works/chord/dist/bundler.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/bundler.js +0 -3
- package/node_modules/@earendil-works/chord/dist/bundler.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/context/index.d.ts +0 -24
- package/node_modules/@earendil-works/chord/dist/context/index.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/context/index.js +0 -97
- package/node_modules/@earendil-works/chord/dist/context/index.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/delta/index.d.ts +0 -119
- package/node_modules/@earendil-works/chord/dist/delta/index.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/delta/index.js +0 -1209
- package/node_modules/@earendil-works/chord/dist/delta/index.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/facets/host.d.ts +0 -12
- package/node_modules/@earendil-works/chord/dist/facets/host.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/facets/host.js +0 -762
- package/node_modules/@earendil-works/chord/dist/facets/host.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/facets/loader.d.ts +0 -3
- package/node_modules/@earendil-works/chord/dist/facets/loader.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/facets/loader.js +0 -5
- package/node_modules/@earendil-works/chord/dist/facets/loader.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/index.d.ts +0 -11
- package/node_modules/@earendil-works/chord/dist/index.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/index.js +0 -10
- package/node_modules/@earendil-works/chord/dist/index.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/json.d.ts +0 -4
- package/node_modules/@earendil-works/chord/dist/json.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/json.js +0 -57
- package/node_modules/@earendil-works/chord/dist/json.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/node/bundle-loader.d.ts +0 -30
- package/node_modules/@earendil-works/chord/dist/node/bundle-loader.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/node/bundle-loader.js +0 -377
- package/node_modules/@earendil-works/chord/dist/node/bundle-loader.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/node/bundle.d.ts +0 -26
- package/node_modules/@earendil-works/chord/dist/node/bundle.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/node/bundle.js +0 -183
- package/node_modules/@earendil-works/chord/dist/node/bundle.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/node/manifest.d.ts +0 -36
- package/node_modules/@earendil-works/chord/dist/node/manifest.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/node/manifest.js +0 -6
- package/node_modules/@earendil-works/chord/dist/node/manifest.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/node/package.d.ts +0 -15
- package/node_modules/@earendil-works/chord/dist/node/package.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/node/package.js +0 -199
- package/node_modules/@earendil-works/chord/dist/node/package.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/node.d.ts +0 -5
- package/node_modules/@earendil-works/chord/dist/node.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/node.js +0 -3
- package/node_modules/@earendil-works/chord/dist/node.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/consumer.d.ts +0 -11
- package/node_modules/@earendil-works/chord/dist/services/consumer.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/consumer.js +0 -535
- package/node_modules/@earendil-works/chord/dist/services/consumer.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/errors.d.ts +0 -8
- package/node_modules/@earendil-works/chord/dist/services/errors.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/errors.js +0 -21
- package/node_modules/@earendil-works/chord/dist/services/errors.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/handle.d.ts +0 -15
- package/node_modules/@earendil-works/chord/dist/services/handle.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/handle.js +0 -99
- package/node_modules/@earendil-works/chord/dist/services/handle.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/instances.d.ts +0 -25
- package/node_modules/@earendil-works/chord/dist/services/instances.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/instances.js +0 -137
- package/node_modules/@earendil-works/chord/dist/services/instances.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/loopback.d.ts +0 -5
- package/node_modules/@earendil-works/chord/dist/services/loopback.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/loopback.js +0 -15
- package/node_modules/@earendil-works/chord/dist/services/loopback.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/provider.d.ts +0 -37
- package/node_modules/@earendil-works/chord/dist/services/provider.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/provider.js +0 -472
- package/node_modules/@earendil-works/chord/dist/services/provider.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/state-codec.d.ts +0 -15
- package/node_modules/@earendil-works/chord/dist/services/state-codec.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/state-codec.js +0 -115
- package/node_modules/@earendil-works/chord/dist/services/state-codec.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/state-internals.d.ts +0 -11
- package/node_modules/@earendil-works/chord/dist/services/state-internals.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/state-internals.js +0 -10
- package/node_modules/@earendil-works/chord/dist/services/state-internals.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/state.d.ts +0 -23
- package/node_modules/@earendil-works/chord/dist/services/state.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/state.js +0 -124
- package/node_modules/@earendil-works/chord/dist/services/state.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/wire.d.ts +0 -60
- package/node_modules/@earendil-works/chord/dist/services/wire.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/services/wire.js +0 -173
- package/node_modules/@earendil-works/chord/dist/services/wire.js.map +0 -1
- package/node_modules/@earendil-works/chord/dist/types.d.ts +0 -203
- package/node_modules/@earendil-works/chord/dist/types.d.ts.map +0 -1
- package/node_modules/@earendil-works/chord/dist/types.js +0 -2
- package/node_modules/@earendil-works/chord/dist/types.js.map +0 -1
- package/node_modules/@earendil-works/chord/package.json +0 -73
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/config.d.ts +0 -9
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/config.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/config.js +0 -35
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/config.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/context.d.ts +0 -9
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/context.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/context.js +0 -13
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/context.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/assistant.d.ts +0 -42
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/assistant.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/assistant.js +0 -82
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/assistant.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/effect-gate.d.ts +0 -22
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/effect-gate.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/effect-gate.js +0 -48
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/effect-gate.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/tools.d.ts +0 -67
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/tools.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/tools.js +0 -121
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/tools.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/hooks.d.ts +0 -38
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/hooks.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/hooks.js +0 -404
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/hooks.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/boundary.d.ts +0 -28
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/boundary.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/boundary.js +0 -173
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/boundary.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/checkpoint.d.ts +0 -8
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/checkpoint.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/checkpoint.js +0 -133
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/checkpoint.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/deferred.d.ts +0 -15
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/deferred.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/deferred.js +0 -179
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/deferred.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/generation.d.ts +0 -8
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/generation.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/generation.js +0 -205
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/generation.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/reconcile.d.ts +0 -5
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/reconcile.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/reconcile.js +0 -140
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/reconcile.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/recovery.d.ts +0 -8
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/recovery.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/recovery.js +0 -85
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/recovery.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/response.d.ts +0 -23
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/response.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/response.js +0 -394
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/response.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/retry.d.ts +0 -4
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/retry.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/retry.js +0 -34
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/retry.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/structural.d.ts +0 -32
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/structural.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/structural.js +0 -929
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/structural.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/terminal.d.ts +0 -7
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/terminal.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/terminal.js +0 -49
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/terminal.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tool-placement.d.ts +0 -14
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tool-placement.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tool-placement.js +0 -244
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tool-placement.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tools.d.ts +0 -6
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tools.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tools.js +0 -449
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tools.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive.d.ts +0 -6
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive.js +0 -93
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/harness.d.ts +0 -59
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/harness.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/harness.js +0 -302
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/harness.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/index.d.ts +0 -2
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/index.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/index.js +0 -2
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/index.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/lane.d.ts +0 -118
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/lane.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/lane.js +0 -1559
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/lane.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/progress.d.ts +0 -15
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/progress.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/progress.js +0 -66
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/progress.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/reducer.d.ts +0 -5
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/reducer.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/reducer.js +0 -240
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/reducer.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/restore.d.ts +0 -24
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/restore.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/restore.js +0 -117
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/restore.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/transcript.d.ts +0 -21
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/transcript.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/transcript.js +0 -72
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/transcript.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/types.d.ts +0 -105
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/types.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/types.js +0 -50
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/types.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/commit.d.ts +0 -53
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/commit.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/commit.js +0 -57
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/commit.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork-policy.d.ts +0 -21
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork-policy.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork-policy.js +0 -55
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork-policy.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.d.ts +0 -16
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.js +0 -79
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/in-memory-storage-state.d.ts +0 -39
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/in-memory-storage-state.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/in-memory-storage-state.js +0 -269
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/in-memory-storage-state.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/fork.d.ts +0 -38
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/fork.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/fork.js +0 -266
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/fork.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/index.d.ts +0 -4
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/index.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/index.js +0 -4
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/index.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/io.d.ts +0 -14
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/io.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/io.js +0 -86
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/io.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/legacy-v3.d.ts +0 -44
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/legacy-v3.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/legacy-v3.js +0 -454
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/legacy-v3.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/mutation-line.d.ts +0 -8
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/mutation-line.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/mutation-line.js +0 -22
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/mutation-line.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/datasets.d.ts +0 -12
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/datasets.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/datasets.js +0 -24
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/datasets.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/session-repo.d.ts +0 -42
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/session-repo.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/session-repo.js +0 -127
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/session-repo.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/storage.d.ts +0 -25
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/storage.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/storage.js +0 -114
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/storage.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/session-repo.d.ts +0 -23
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/session-repo.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/session-repo.js +0 -809
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/session-repo.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/storage.d.ts +0 -4
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/storage.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/storage.js +0 -600
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/storage.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/gating-storage.d.ts +0 -26
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/gating-storage.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/gating-storage.js +0 -103
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/gating-storage.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/instrumented-storage.d.ts +0 -11
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/instrumented-storage.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/instrumented-storage.js +0 -19
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/instrumented-storage.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/storage-decorator.d.ts +0 -20
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/storage-decorator.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/storage-decorator.js +0 -40
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/storage-decorator.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/values.d.ts +0 -95
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/values.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/values.js +0 -81
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/values.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/adaptive-publisher.d.ts +0 -24
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/adaptive-publisher.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/adaptive-publisher.js +0 -79
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/adaptive-publisher.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/output-capture.d.ts +0 -31
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/output-capture.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/output-capture.js +0 -217
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/output-capture.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/usage.d.ts +0 -4
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/usage.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/usage.js +0 -33
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/usage.js.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-ai-binding.d.ts +0 -77
- package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-ai-binding.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-ai-binding.js +0 -72
- package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-ai-binding.js.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/cursor/context-limit-store.d.ts +0 -32
- package/node_modules/@earendil-works/pi-ai/dist/cursor/context-limit-store.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/cursor/context-limit-store.js +0 -62
- package/node_modules/@earendil-works/pi-ai/dist/cursor/context-limit-store.js.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-headers.d.ts +0 -4
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-headers.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-headers.js +0 -22
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-headers.js.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/assistant-message-frame.d.ts +0 -77
- package/node_modules/@earendil-works/pi-ai/dist/utils/assistant-message-frame.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/assistant-message-frame.js +0 -427
- package/node_modules/@earendil-works/pi-ai/dist/utils/assistant-message-frame.js.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/cursor-context-limit.d.ts +0 -12
- package/node_modules/@earendil-works/pi-ai/dist/utils/cursor-context-limit.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/cursor-context-limit.js +0 -93
- package/node_modules/@earendil-works/pi-ai/dist/utils/cursor-context-limit.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/mouse-region.d.ts +0 -12
- package/node_modules/@earendil-works/pi-tui/dist/components/mouse-region.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/mouse-region.js +0 -19
- package/node_modules/@earendil-works/pi-tui/dist/components/mouse-region.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/native-platform.d.ts +0 -18
- package/node_modules/@earendil-works/pi-tui/dist/native-platform.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/native-platform.js +0 -42
- package/node_modules/@earendil-works/pi-tui/dist/native-platform.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/native/clipboard.h +0 -170
- package/node_modules/@earendil-works/pi-tui/native/darwin/src/darwin-platform.m +0 -93
- package/node_modules/@earendil-works/pi-tui/native/linux/README.md +0 -23
- package/node_modules/@earendil-works/pi-tui/native/linux/build.sh +0 -65
- 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 +0 -70
- package/node_modules/@earendil-works/pi-tui/native/linux/src/linux-platform-x11.c +0 -274
- package/node_modules/@earendil-works/pi-tui/native/napi.h +0 -89
- 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 +0 -241
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/LICENSE +0 -201
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/README.md +0 -115
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-cjs/index.js +0 -96
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/abort-handler.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/abort.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/auth/HttpApiKeyAuth.js +0 -5
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/auth/HttpAuthScheme.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/auth/HttpAuthSchemeProvider.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/auth/HttpSigner.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/auth/IdentityProviderConfig.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/auth/auth.js +0 -5
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/auth/index.js +0 -2
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/blob/blob-payload-input-types.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/checksum.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/client.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/command.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/connection/config.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/connection/index.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/connection/manager.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/connection/pool.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/crypto.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/downlevel-ts3.4/transform/type-transform.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/encode.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/endpoint.js +0 -5
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/endpoints/EndpointParameterInstructions.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/endpoints/EndpointRuleObject.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/endpoints/ErrorRuleObject.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/endpoints/RuleSetObject.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/endpoints/TreeRuleObject.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/endpoints/index.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/endpoints/shared.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/eventStream.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/extensions/checksum.js +0 -38
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/extensions/defaultClientConfiguration.js +0 -7
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/extensions/defaultExtensionConfiguration.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/extensions/index.js +0 -2
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/extensions/retry.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/externals-check/browser-externals-check.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/feature-ids.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/http/httpHandlerInitialization.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/http.js +0 -5
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/identity/apiKeyIdentity.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/identity/awsCredentialIdentity.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/identity/identity.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/identity/index.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/identity/tokenIdentity.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/index.js +0 -7
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/logger.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/metrics.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/middleware.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/pagination.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/profile.js +0 -6
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/response.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/retry.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/schema/schema-deprecated.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/schema/schema.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/schema/sentinels.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/schema/static-schemas.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/schema/traits.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/serde.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/shapes.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/signature.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/stream.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/streaming-payload/streaming-blob-common-types.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/streaming-payload/streaming-blob-payload-input-types.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/streaming-payload/streaming-blob-payload-output-types.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/transfer.js +0 -6
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/transform/client-method-transforms.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/transform/client-payload-blob-type-narrow.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/transform/exact.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/transform/mutable.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/transform/no-undefined.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/transform/type-transform.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/uri.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/util.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-es/waiter.js +0 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/abort-handler.d.ts +0 -7
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/abort.d.ts +0 -48
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/auth/HttpApiKeyAuth.d.ts +0 -7
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/auth/HttpAuthScheme.d.ts +0 -49
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/auth/HttpAuthSchemeProvider.d.ts +0 -20
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/auth/HttpSigner.d.ts +0 -41
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/auth/IdentityProviderConfig.d.ts +0 -14
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/auth/auth.d.ts +0 -59
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/auth/index.d.ts +0 -7
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/blob/blob-payload-input-types.d.ts +0 -37
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/checksum.d.ts +0 -61
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/client.d.ts +0 -57
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/command.d.ts +0 -28
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/connection/config.d.ts +0 -15
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/connection/index.d.ts +0 -3
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/connection/manager.d.ts +0 -34
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/connection/pool.d.ts +0 -32
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/crypto.d.ts +0 -58
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/downlevel-ts3.4/transform/type-transform.d.ts +0 -24
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/encode.d.ts +0 -31
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/endpoint.d.ts +0 -77
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/endpoints/EndpointParameterInstructions.d.ts +0 -41
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/endpoints/EndpointRuleObject.d.ts +0 -27
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/endpoints/ErrorRuleObject.d.ts +0 -10
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/endpoints/RuleSetObject.d.ts +0 -28
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/endpoints/TreeRuleObject.d.ts +0 -16
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/endpoints/index.d.ts +0 -5
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/endpoints/shared.d.ts +0 -55
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/eventStream.d.ts +0 -137
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/extensions/checksum.d.ts +0 -58
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/extensions/defaultClientConfiguration.d.ts +0 -32
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/extensions/defaultExtensionConfiguration.d.ts +0 -9
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/extensions/index.d.ts +0 -6
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/extensions/retry.d.ts +0 -18
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/externals-check/browser-externals-check.d.ts +0 -35
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/feature-ids.d.ts +0 -16
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/http/httpHandlerInitialization.d.ts +0 -142
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/http.d.ts +0 -110
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/identity/apiKeyIdentity.d.ts +0 -14
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/identity/awsCredentialIdentity.d.ts +0 -31
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/identity/identity.d.ts +0 -15
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/identity/index.d.ts +0 -4
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/identity/tokenIdentity.d.ts +0 -14
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/index.d.ts +0 -52
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/logger.d.ts +0 -13
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/metrics.d.ts +0 -93
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/middleware.d.ts +0 -541
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/pagination.d.ts +0 -33
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/profile.d.ts +0 -30
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/response.d.ts +0 -40
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/retry.d.ts +0 -162
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/schema/schema-deprecated.d.ts +0 -143
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/schema/schema.d.ts +0 -236
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/schema/sentinels.d.ts +0 -65
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/schema/static-schemas.d.ts +0 -99
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/schema/traits.d.ts +0 -46
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/serde.d.ts +0 -114
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/shapes.d.ts +0 -79
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/signature.d.ts +0 -172
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/stream.d.ts +0 -22
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/streaming-payload/streaming-blob-common-types.d.ts +0 -28
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/streaming-payload/streaming-blob-payload-input-types.d.ts +0 -54
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/streaming-payload/streaming-blob-payload-output-types.d.ts +0 -41
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/transfer.d.ts +0 -42
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/transform/client-method-transforms.d.ts +0 -26
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/transform/client-payload-blob-type-narrow.d.ts +0 -73
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/transform/exact.d.ts +0 -6
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/transform/mutable.d.ts +0 -6
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/transform/no-undefined.d.ts +0 -68
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/transform/type-transform.d.ts +0 -39
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/abort-handler.d.ts +0 -7
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/abort.d.ts +0 -45
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/auth/HttpApiKeyAuth.d.ts +0 -7
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/auth/HttpAuthScheme.d.ts +0 -49
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/auth/HttpAuthSchemeProvider.d.ts +0 -20
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/auth/HttpSigner.d.ts +0 -41
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/auth/IdentityProviderConfig.d.ts +0 -14
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/auth/auth.d.ts +0 -59
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/auth/index.d.ts +0 -7
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/blob/blob-payload-input-types.d.ts +0 -37
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/checksum.d.ts +0 -61
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/client.d.ts +0 -57
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/command.d.ts +0 -28
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/connection/config.d.ts +0 -15
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/connection/index.d.ts +0 -3
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/connection/manager.d.ts +0 -34
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/connection/pool.d.ts +0 -32
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/crypto.d.ts +0 -58
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/downlevel-ts3.4/transform/type-transform.d.ts +0 -40
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/encode.d.ts +0 -31
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/endpoint.d.ts +0 -77
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/endpoints/EndpointParameterInstructions.d.ts +0 -41
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/endpoints/EndpointRuleObject.d.ts +0 -27
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/endpoints/ErrorRuleObject.d.ts +0 -10
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/endpoints/RuleSetObject.d.ts +0 -28
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/endpoints/TreeRuleObject.d.ts +0 -16
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/endpoints/index.d.ts +0 -5
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/endpoints/shared.d.ts +0 -55
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/eventStream.d.ts +0 -137
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/extensions/checksum.d.ts +0 -58
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/extensions/defaultClientConfiguration.d.ts +0 -32
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/extensions/defaultExtensionConfiguration.d.ts +0 -9
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/extensions/index.d.ts +0 -6
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/extensions/retry.d.ts +0 -18
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/externals-check/browser-externals-check.d.ts +0 -35
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/feature-ids.d.ts +0 -16
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/http/httpHandlerInitialization.d.ts +0 -142
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/http.d.ts +0 -110
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/identity/apiKeyIdentity.d.ts +0 -14
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/identity/awsCredentialIdentity.d.ts +0 -31
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/identity/identity.d.ts +0 -15
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/identity/index.d.ts +0 -4
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/identity/tokenIdentity.d.ts +0 -14
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/index.d.ts +0 -52
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/logger.d.ts +0 -13
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/metrics.d.ts +0 -93
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/middleware.d.ts +0 -541
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/pagination.d.ts +0 -33
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/profile.d.ts +0 -30
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/response.d.ts +0 -40
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/retry.d.ts +0 -162
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/schema/schema-deprecated.d.ts +0 -149
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/schema/schema.d.ts +0 -251
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/schema/sentinels.d.ts +0 -65
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/schema/static-schemas.d.ts +0 -118
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/schema/traits.d.ts +0 -46
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/serde.d.ts +0 -114
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/shapes.d.ts +0 -79
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/signature.d.ts +0 -172
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/stream.d.ts +0 -22
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/streaming-payload/streaming-blob-common-types.d.ts +0 -28
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/streaming-payload/streaming-blob-payload-input-types.d.ts +0 -54
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/streaming-payload/streaming-blob-payload-output-types.d.ts +0 -41
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/transfer.d.ts +0 -42
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/transform/client-method-transforms.d.ts +0 -26
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/transform/client-payload-blob-type-narrow.d.ts +0 -77
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/transform/exact.d.ts +0 -14
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/transform/mutable.d.ts +0 -6
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/transform/no-undefined.d.ts +0 -88
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/transform/type-transform.d.ts +0 -40
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/uri.d.ts +0 -17
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/util.d.ts +0 -192
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/ts3.4/waiter.d.ts +0 -35
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/uri.d.ts +0 -17
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/util.d.ts +0 -176
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/dist-types/waiter.d.ts +0 -35
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/types/package.json +0 -50
- package/node_modules/esbuild/LICENSE.md +0 -21
- package/node_modules/esbuild/README.md +0 -3
- package/node_modules/esbuild/bin/esbuild +0 -223
- package/node_modules/esbuild/install.js +0 -300
- package/node_modules/esbuild/lib/main.d.ts +0 -720
- package/node_modules/esbuild/lib/main.js +0 -2536
- package/node_modules/esbuild/package.json +0 -47
- package/node_modules/typebox/build/schema/intern/index.d.mts +0 -1
- package/node_modules/typebox/build/schema/intern/index.mjs +0 -1
- package/node_modules/typebox/build/schema/intern/intern.d.mts +0 -14
- package/node_modules/typebox/build/schema/intern/intern.mjs +0 -259
- package/vendor/pi-protocol/protocol.d.ts +0 -167
- package/vendor/pi-protocol/protocol.d.ts.map +0 -1
- package/vendor/pi-protocol/protocol.js +0 -85
- package/vendor/pi-protocol/protocol.js.map +0 -1
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI Gateway transport over the Workers AI binding.
|
|
3
|
+
*
|
|
4
|
+
* pi's Cloudflare AI Gateway support speaks HTTPS
|
|
5
|
+
* (`gateway.ai.cloudflare.com/v1/{account}/{gateway}/{provider}/...`, see `api/cloudflare.ts`),
|
|
6
|
+
* which needs a Cloudflare API token even when the caller is a Worker in the gateway's own
|
|
7
|
+
* account.
|
|
8
|
+
*
|
|
9
|
+
* In order to solve for this problem, `createGatewayBindingFetch` returns a {@link FetchFunction}
|
|
10
|
+
* that translates requests under a gateway HTTPS prefix into calls to the Workers AI binding's
|
|
11
|
+
* universal endpoint, `env.AI.gateway(id).run({provider, endpoint, headers, query})`.
|
|
12
|
+
* Binding calls are pre-authenticated in-account and return the provider's native wire format as a
|
|
13
|
+
* regular (streaming) `Response`, so API implementations behave identically over either
|
|
14
|
+
* transport.
|
|
15
|
+
*
|
|
16
|
+
* The result is the transport for one gateway-bound client, not a general-purpose fetch:
|
|
17
|
+
* requests it cannot serve — URLs outside the prefix, or in-prefix requests the universal
|
|
18
|
+
* endpoint cannot express (non-POST, non-JSON body) — reject with a descriptive error.
|
|
19
|
+
* Transport selection is the caller's job, per client: route such traffic over HTTPS with
|
|
20
|
+
* real gateway auth instead of through this shim.
|
|
21
|
+
*/
|
|
22
|
+
import type { FetchFunction } from "../types.ts";
|
|
23
|
+
/**
|
|
24
|
+
* Structural type for the Workers AI binding's gateway surface (`env.AI`), so this
|
|
25
|
+
* module does not depend on `@cloudflare/workers-types`. Any real `Ai` binding satisfies it.
|
|
26
|
+
*/
|
|
27
|
+
export interface AiGatewayBinding {
|
|
28
|
+
gateway(id: string): AiGatewayBindingGateway;
|
|
29
|
+
}
|
|
30
|
+
export interface AiGatewayBindingGateway {
|
|
31
|
+
run(data: AiGatewayUniversalRequestLike, options?: {
|
|
32
|
+
signal?: AbortSignal;
|
|
33
|
+
}): Promise<Response>;
|
|
34
|
+
}
|
|
35
|
+
/** One universal-endpoint request entry, as accepted by `AiGateway.run()`. */
|
|
36
|
+
export interface AiGatewayUniversalRequestLike {
|
|
37
|
+
provider: string;
|
|
38
|
+
endpoint: string;
|
|
39
|
+
headers: Record<string, string>;
|
|
40
|
+
query: unknown;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Placeholder value for auth headers on binding-routed requests. API implementations
|
|
44
|
+
* require an API key or a recognized auth header (`authorization`, `x-api-key`,
|
|
45
|
+
* `cf-aig-authorization`) before dispatch; binding calls are pre-authenticated, so pass
|
|
46
|
+
* `cf-aig-authorization: Bearer ${CLOUDFLARE_GATEWAY_BINDING_AUTH_SENTINEL}` to satisfy
|
|
47
|
+
* the check. The shim strips `cf-aig-authorization` before calling the binding. Pair it with
|
|
48
|
+
* `Authorization: null` / `x-api-key: null` so the SDKs' placeholder auth headers never reach
|
|
49
|
+
* the gateway, which would treat a request-supplied auth header as a BYOK provider key that
|
|
50
|
+
* overrides its stored keys — the same as it would over HTTPS.
|
|
51
|
+
*/
|
|
52
|
+
export declare const CLOUDFLARE_GATEWAY_BINDING_AUTH_SENTINEL = "cloudflare-gateway-binding";
|
|
53
|
+
export interface GatewayBindingFetchOptions {
|
|
54
|
+
/** The Workers AI binding (e.g. `env.AI`). */
|
|
55
|
+
binding: AiGatewayBinding;
|
|
56
|
+
/**
|
|
57
|
+
* Gateway HTTPS prefix every request must fall under, without a trailing slash:
|
|
58
|
+
* `https://gateway.ai.cloudflare.com/v1/{accountId}/{gatewayName}`.
|
|
59
|
+
*/
|
|
60
|
+
baseUrl: string;
|
|
61
|
+
/** Gateway name passed to `binding.gateway()`. Must match the `baseUrl` gateway. */
|
|
62
|
+
gateway: string;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Create a `fetch` that routes AI Gateway requests through the Workers AI binding.
|
|
66
|
+
* See the module docs for behavior and composition notes.
|
|
67
|
+
*/
|
|
68
|
+
export declare function createGatewayBindingFetch(options: GatewayBindingFetchOptions): FetchFunction;
|
|
69
|
+
//# sourceMappingURL=cloudflare-gateway-binding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloudflare-gateway-binding.d.ts","sourceRoot":"","sources":["../../src/api/cloudflare-gateway-binding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAChC,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,uBAAuB,CAAC;CAC7C;AAED,MAAM,WAAW,uBAAuB;IACvC,GAAG,CAAC,IAAI,EAAE,6BAA6B,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CAChG;AAED,8EAA8E;AAC9E,MAAM,WAAW,6BAA6B;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,KAAK,EAAE,OAAO,CAAC;CACf;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,wCAAwC,+BAA+B,CAAC;AAErF,MAAM,WAAW,0BAA0B;IAC1C,8CAA8C;IAC9C,OAAO,EAAE,gBAAgB,CAAC;IAC1B;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,oFAAoF;IACpF,OAAO,EAAE,MAAM,CAAC;CAChB;AAQD;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,0BAA0B,GAAG,aAAa,CAgE5F"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI Gateway transport over the Workers AI binding.
|
|
3
|
+
*
|
|
4
|
+
* pi's Cloudflare AI Gateway support speaks HTTPS
|
|
5
|
+
* (`gateway.ai.cloudflare.com/v1/{account}/{gateway}/{provider}/...`, see `api/cloudflare.ts`),
|
|
6
|
+
* which needs a Cloudflare API token even when the caller is a Worker in the gateway's own
|
|
7
|
+
* account.
|
|
8
|
+
*
|
|
9
|
+
* In order to solve for this problem, `createGatewayBindingFetch` returns a {@link FetchFunction}
|
|
10
|
+
* that translates requests under a gateway HTTPS prefix into calls to the Workers AI binding's
|
|
11
|
+
* universal endpoint, `env.AI.gateway(id).run({provider, endpoint, headers, query})`.
|
|
12
|
+
* Binding calls are pre-authenticated in-account and return the provider's native wire format as a
|
|
13
|
+
* regular (streaming) `Response`, so API implementations behave identically over either
|
|
14
|
+
* transport.
|
|
15
|
+
*
|
|
16
|
+
* The result is the transport for one gateway-bound client, not a general-purpose fetch:
|
|
17
|
+
* requests it cannot serve — URLs outside the prefix, or in-prefix requests the universal
|
|
18
|
+
* endpoint cannot express (non-POST, non-JSON body) — reject with a descriptive error.
|
|
19
|
+
* Transport selection is the caller's job, per client: route such traffic over HTTPS with
|
|
20
|
+
* real gateway auth instead of through this shim.
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Placeholder value for auth headers on binding-routed requests. API implementations
|
|
24
|
+
* require an API key or a recognized auth header (`authorization`, `x-api-key`,
|
|
25
|
+
* `cf-aig-authorization`) before dispatch; binding calls are pre-authenticated, so pass
|
|
26
|
+
* `cf-aig-authorization: Bearer ${CLOUDFLARE_GATEWAY_BINDING_AUTH_SENTINEL}` to satisfy
|
|
27
|
+
* the check. The shim strips `cf-aig-authorization` before calling the binding. Pair it with
|
|
28
|
+
* `Authorization: null` / `x-api-key: null` so the SDKs' placeholder auth headers never reach
|
|
29
|
+
* the gateway, which would treat a request-supplied auth header as a BYOK provider key that
|
|
30
|
+
* overrides its stored keys — the same as it would over HTTPS.
|
|
31
|
+
*/
|
|
32
|
+
export const CLOUDFLARE_GATEWAY_BINDING_AUTH_SENTINEL = "cloudflare-gateway-binding";
|
|
33
|
+
// Never forwarded to the binding: hop-by-hop/derived headers, and gateway auth
|
|
34
|
+
// (binding calls are pre-authenticated; the sentinel must not reach the wire).
|
|
35
|
+
const STRIP_HEADERS = new Set(["content-length", "host", "cf-aig-authorization"]);
|
|
36
|
+
/**
|
|
37
|
+
* Create a `fetch` that routes AI Gateway requests through the Workers AI binding.
|
|
38
|
+
* See the module docs for behavior and composition notes.
|
|
39
|
+
*/
|
|
40
|
+
export function createGatewayBindingFetch(options) {
|
|
41
|
+
const { binding, gateway } = options;
|
|
42
|
+
// Prefix matching runs on URL-normalized components (origin + pathname), not raw strings:
|
|
43
|
+
// dot segments resolve away and fragments drop, matching what real fetch would put on the
|
|
44
|
+
// wire, so a lexical variant can't split provider/endpoint differently than HTTPS would.
|
|
45
|
+
const base = new URL(options.baseUrl);
|
|
46
|
+
const basePath = base.pathname.endsWith("/") ? base.pathname : `${base.pathname}/`;
|
|
47
|
+
return async (input, init) => {
|
|
48
|
+
const request = input instanceof Request ? input : undefined;
|
|
49
|
+
const url = request ? request.url : input.toString();
|
|
50
|
+
const method = (init?.method ?? request?.method ?? "GET").toUpperCase();
|
|
51
|
+
let parsed;
|
|
52
|
+
try {
|
|
53
|
+
parsed = new URL(url);
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
parsed = undefined;
|
|
57
|
+
}
|
|
58
|
+
// Out-of-prefix URLs are a configuration bug, not passthrough traffic: silently
|
|
59
|
+
// forwarding would ship the auth sentinel to whatever host the URL names.
|
|
60
|
+
if (parsed === undefined || parsed.origin !== base.origin || !parsed.pathname.startsWith(basePath)) {
|
|
61
|
+
throw new Error(`createGatewayBindingFetch: ${method} ${url} is outside the configured gateway ` +
|
|
62
|
+
`prefix (${base.origin}${basePath}); this fetch only serves its gateway-bound client`);
|
|
63
|
+
}
|
|
64
|
+
// In-prefix requests the universal endpoint cannot express always reject: forwarding
|
|
65
|
+
// them over HTTPS would send the sentinel to the gateway and fail with a misleading
|
|
66
|
+
// auth error instead of naming the real problem. Callers that need such endpoints
|
|
67
|
+
// route them over HTTPS with real gateway auth themselves.
|
|
68
|
+
const unexpressible = (reason) => {
|
|
69
|
+
throw new Error(`createGatewayBindingFetch: cannot express ${method} ${url} as a universal ` +
|
|
70
|
+
`gateway request (${reason}); route it over HTTPS with gateway auth instead`);
|
|
71
|
+
};
|
|
72
|
+
if (method !== "POST")
|
|
73
|
+
return unexpressible("only POST is supported");
|
|
74
|
+
const rest = parsed.pathname.slice(basePath.length);
|
|
75
|
+
const slash = rest.indexOf("/");
|
|
76
|
+
if (slash <= 0) {
|
|
77
|
+
return unexpressible("missing provider/endpoint path");
|
|
78
|
+
}
|
|
79
|
+
const provider = rest.slice(0, slash);
|
|
80
|
+
// Keep the query string on the endpoint — it's part of what HTTPS would have sent.
|
|
81
|
+
const endpoint = rest.slice(slash + 1) + parsed.search;
|
|
82
|
+
const bodyText = await readBodyText(request, init);
|
|
83
|
+
let query;
|
|
84
|
+
try {
|
|
85
|
+
query = bodyText === undefined ? undefined : JSON.parse(bodyText);
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
return unexpressible("non-JSON body");
|
|
89
|
+
}
|
|
90
|
+
if (query === undefined) {
|
|
91
|
+
return unexpressible("missing body");
|
|
92
|
+
}
|
|
93
|
+
const headers = collectHeaders(request, init);
|
|
94
|
+
// Per the fetch spec an explicit `signal: null` in init clears a Request input's signal.
|
|
95
|
+
const signal = init?.signal ?? (init && "signal" in init && init.signal === null ? undefined : request?.signal);
|
|
96
|
+
return binding.gateway(gateway).run({ provider, endpoint, headers, query }, signal ? { signal } : {});
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
async function readBodyText(request, init) {
|
|
100
|
+
const body = init?.body;
|
|
101
|
+
if (body === undefined || body === null) {
|
|
102
|
+
// Per the fetch spec an explicit `body: null` in init clears a Request input's body.
|
|
103
|
+
if (init && "body" in init && body === null)
|
|
104
|
+
return undefined;
|
|
105
|
+
if (request && request.body !== null)
|
|
106
|
+
return request.clone().text();
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
if (typeof body === "string")
|
|
110
|
+
return body;
|
|
111
|
+
if (body instanceof Uint8Array)
|
|
112
|
+
return new TextDecoder().decode(body);
|
|
113
|
+
if (body instanceof ArrayBuffer)
|
|
114
|
+
return new TextDecoder().decode(new Uint8Array(body));
|
|
115
|
+
// URLSearchParams, FormData, Blob, ReadableStream in init: read via a Request wrapper.
|
|
116
|
+
// Consuming a one-shot stream here is fine — unexpressible requests reject rather than
|
|
117
|
+
// replay, so nothing downstream needs the body again.
|
|
118
|
+
return new Request("http://body.local", {
|
|
119
|
+
method: "POST",
|
|
120
|
+
body,
|
|
121
|
+
// The fetch spec requires `duplex: "half"` to construct a Request with a stream body
|
|
122
|
+
// (Node's undici enforces it; it is ignored for the replayable body types). TypeScript's
|
|
123
|
+
// RequestInit does not declare the field yet, hence the cast.
|
|
124
|
+
duplex: "half",
|
|
125
|
+
}).text();
|
|
126
|
+
}
|
|
127
|
+
// Entry header names are lowercased so case-variant duplicates collapse and stripping is
|
|
128
|
+
// uniform. Per the fetch spec, `init.headers` replaces a Request input's headers entirely.
|
|
129
|
+
function collectHeaders(request, init) {
|
|
130
|
+
const result = {};
|
|
131
|
+
const add = (key, value) => {
|
|
132
|
+
const name = key.toLowerCase();
|
|
133
|
+
if (!STRIP_HEADERS.has(name))
|
|
134
|
+
result[name] = value;
|
|
135
|
+
};
|
|
136
|
+
const headers = init?.headers;
|
|
137
|
+
if (headers === undefined) {
|
|
138
|
+
if (request) {
|
|
139
|
+
for (const [key, value] of request.headers)
|
|
140
|
+
add(key, value);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
else if (headers instanceof Headers) {
|
|
144
|
+
for (const [key, value] of headers)
|
|
145
|
+
add(key, value);
|
|
146
|
+
}
|
|
147
|
+
else if (Array.isArray(headers)) {
|
|
148
|
+
for (const [key, value] of headers)
|
|
149
|
+
add(key, value);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
153
|
+
if (value !== undefined)
|
|
154
|
+
add(key, String(value));
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return result;
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=cloudflare-gateway-binding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloudflare-gateway-binding.js","sourceRoot":"","sources":["../../src/api/cloudflare-gateway-binding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAwBH;;;;;;;;;GASG;AACH,MAAM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AK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,OAAO;YAAE,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACrD,CAAC;SAAM,CAAC;QACP,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YACpD,IAAI,KAAK,KAAK,SAAS;gBAAE,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAClD,CAAC;IACF,CAAC;IACD,OAAO,MAAM,CAAC;AACf,CAAC","sourcesContent":["/**\n * AI Gateway transport over the Workers AI binding.\n *\n * pi's Cloudflare AI Gateway support speaks HTTPS\n * (`gateway.ai.cloudflare.com/v1/{account}/{gateway}/{provider}/...`, see `api/cloudflare.ts`),\n * which needs a Cloudflare API token even when the caller is a Worker in the gateway's own\n * account.\n *\n * In order to solve for this problem, `createGatewayBindingFetch` returns a {@link FetchFunction}\n * that translates requests under a gateway HTTPS prefix into calls to the Workers AI binding's\n * universal endpoint, `env.AI.gateway(id).run({provider, endpoint, headers, query})`.\n * Binding calls are pre-authenticated in-account and return the provider's native wire format as a\n * regular (streaming) `Response`, so API implementations behave identically over either\n * transport.\n *\n * The result is the transport for one gateway-bound client, not a general-purpose fetch:\n * requests it cannot serve — URLs outside the prefix, or in-prefix requests the universal\n * endpoint cannot express (non-POST, non-JSON body) — reject with a descriptive error.\n * Transport selection is the caller's job, per client: route such traffic over HTTPS with\n * real gateway auth instead of through this shim.\n */\n\nimport type { FetchFunction } from \"../types.ts\";\n\n/**\n * Structural type for the Workers AI binding's gateway surface (`env.AI`), so this\n * module does not depend on `@cloudflare/workers-types`. Any real `Ai` binding satisfies it.\n */\nexport interface AiGatewayBinding {\n\tgateway(id: string): AiGatewayBindingGateway;\n}\n\nexport interface AiGatewayBindingGateway {\n\trun(data: AiGatewayUniversalRequestLike, options?: { signal?: AbortSignal }): Promise<Response>;\n}\n\n/** One universal-endpoint request entry, as accepted by `AiGateway.run()`. */\nexport interface AiGatewayUniversalRequestLike {\n\tprovider: string;\n\tendpoint: string;\n\theaders: Record<string, string>;\n\tquery: unknown;\n}\n\n/**\n * Placeholder value for auth headers on binding-routed requests. API implementations\n * require an API key or a recognized auth header (`authorization`, `x-api-key`,\n * `cf-aig-authorization`) before dispatch; binding calls are pre-authenticated, so pass\n * `cf-aig-authorization: Bearer ${CLOUDFLARE_GATEWAY_BINDING_AUTH_SENTINEL}` to satisfy\n * the check. The shim strips `cf-aig-authorization` before calling the binding. Pair it with\n * `Authorization: null` / `x-api-key: null` so the SDKs' placeholder auth headers never reach\n * the gateway, which would treat a request-supplied auth header as a BYOK provider key that\n * overrides its stored keys — the same as it would over HTTPS.\n */\nexport const CLOUDFLARE_GATEWAY_BINDING_AUTH_SENTINEL = \"cloudflare-gateway-binding\";\n\nexport interface GatewayBindingFetchOptions {\n\t/** The Workers AI binding (e.g. `env.AI`). */\n\tbinding: AiGatewayBinding;\n\t/**\n\t * Gateway HTTPS prefix every request must fall under, without a trailing slash:\n\t * `https://gateway.ai.cloudflare.com/v1/{accountId}/{gatewayName}`.\n\t */\n\tbaseUrl: string;\n\t/** Gateway name passed to `binding.gateway()`. Must match the `baseUrl` gateway. */\n\tgateway: string;\n}\n\n// Never forwarded to the binding: hop-by-hop/derived headers, and gateway auth\n// (binding calls are pre-authenticated; the sentinel must not reach the wire).\nconst STRIP_HEADERS = new Set([\"content-length\", \"host\", \"cf-aig-authorization\"]);\n\ntype FetchInput = Parameters<FetchFunction>[0];\n\n/**\n * Create a `fetch` that routes AI Gateway requests through the Workers AI binding.\n * See the module docs for behavior and composition notes.\n */\nexport function createGatewayBindingFetch(options: GatewayBindingFetchOptions): FetchFunction {\n\tconst { binding, gateway } = options;\n\t// Prefix matching runs on URL-normalized components (origin + pathname), not raw strings:\n\t// dot segments resolve away and fragments drop, matching what real fetch would put on the\n\t// wire, so a lexical variant can't split provider/endpoint differently than HTTPS would.\n\tconst base = new URL(options.baseUrl);\n\tconst basePath = base.pathname.endsWith(\"/\") ? base.pathname : `${base.pathname}/`;\n\n\treturn async (input: FetchInput, init?: RequestInit): Promise<Response> => {\n\t\tconst request = input instanceof Request ? input : undefined;\n\t\tconst url = request ? request.url : input.toString();\n\t\tconst method = (init?.method ?? request?.method ?? \"GET\").toUpperCase();\n\t\tlet parsed: URL | undefined;\n\t\ttry {\n\t\t\tparsed = new URL(url);\n\t\t} catch {\n\t\t\tparsed = undefined;\n\t\t}\n\t\t// Out-of-prefix URLs are a configuration bug, not passthrough traffic: silently\n\t\t// forwarding would ship the auth sentinel to whatever host the URL names.\n\t\tif (parsed === undefined || parsed.origin !== base.origin || !parsed.pathname.startsWith(basePath)) {\n\t\t\tthrow new Error(\n\t\t\t\t`createGatewayBindingFetch: ${method} ${url} is outside the configured gateway ` +\n\t\t\t\t\t`prefix (${base.origin}${basePath}); this fetch only serves its gateway-bound client`,\n\t\t\t);\n\t\t}\n\n\t\t// In-prefix requests the universal endpoint cannot express always reject: forwarding\n\t\t// them over HTTPS would send the sentinel to the gateway and fail with a misleading\n\t\t// auth error instead of naming the real problem. Callers that need such endpoints\n\t\t// route them over HTTPS with real gateway auth themselves.\n\t\tconst unexpressible = (reason: string): never => {\n\t\t\tthrow new Error(\n\t\t\t\t`createGatewayBindingFetch: cannot express ${method} ${url} as a universal ` +\n\t\t\t\t\t`gateway request (${reason}); route it over HTTPS with gateway auth instead`,\n\t\t\t);\n\t\t};\n\t\tif (method !== \"POST\") return unexpressible(\"only POST is supported\");\n\n\t\tconst rest = parsed.pathname.slice(basePath.length);\n\t\tconst slash = rest.indexOf(\"/\");\n\t\tif (slash <= 0) {\n\t\t\treturn unexpressible(\"missing provider/endpoint path\");\n\t\t}\n\t\tconst provider = rest.slice(0, slash);\n\t\t// Keep the query string on the endpoint — it's part of what HTTPS would have sent.\n\t\tconst endpoint = rest.slice(slash + 1) + parsed.search;\n\n\t\tconst bodyText = await readBodyText(request, init);\n\t\tlet query: unknown;\n\t\ttry {\n\t\t\tquery = bodyText === undefined ? undefined : JSON.parse(bodyText);\n\t\t} catch {\n\t\t\treturn unexpressible(\"non-JSON body\");\n\t\t}\n\t\tif (query === undefined) {\n\t\t\treturn unexpressible(\"missing body\");\n\t\t}\n\n\t\tconst headers = collectHeaders(request, init);\n\t\t// Per the fetch spec an explicit `signal: null` in init clears a Request input's signal.\n\t\tconst signal = init?.signal ?? (init && \"signal\" in init && init.signal === null ? undefined : request?.signal);\n\t\treturn binding.gateway(gateway).run({ provider, endpoint, headers, query }, signal ? { signal } : {});\n\t};\n}\n\nasync function readBodyText(request: Request | undefined, init?: RequestInit): Promise<string | undefined> {\n\tconst body = init?.body;\n\tif (body === undefined || body === null) {\n\t\t// Per the fetch spec an explicit `body: null` in init clears a Request input's body.\n\t\tif (init && \"body\" in init && body === null) return undefined;\n\t\tif (request && request.body !== null) return request.clone().text();\n\t\treturn undefined;\n\t}\n\tif (typeof body === \"string\") return body;\n\tif (body instanceof Uint8Array) return new TextDecoder().decode(body);\n\tif (body instanceof ArrayBuffer) return new TextDecoder().decode(new Uint8Array(body));\n\t// URLSearchParams, FormData, Blob, ReadableStream in init: read via a Request wrapper.\n\t// Consuming a one-shot stream here is fine — unexpressible requests reject rather than\n\t// replay, so nothing downstream needs the body again.\n\treturn new Request(\"http://body.local\", {\n\t\tmethod: \"POST\",\n\t\tbody,\n\t\t// The fetch spec requires `duplex: \"half\"` to construct a Request with a stream body\n\t\t// (Node's undici enforces it; it is ignored for the replayable body types). TypeScript's\n\t\t// RequestInit does not declare the field yet, hence the cast.\n\t\tduplex: \"half\",\n\t} as RequestInit).text();\n}\n\n// Entry header names are lowercased so case-variant duplicates collapse and stripping is\n// uniform. Per the fetch spec, `init.headers` replaces a Request input's headers entirely.\nfunction collectHeaders(request: Request | undefined, init?: RequestInit): Record<string, string> {\n\tconst result: Record<string, string> = {};\n\tconst add = (key: string, value: string) => {\n\t\tconst name = key.toLowerCase();\n\t\tif (!STRIP_HEADERS.has(name)) result[name] = value;\n\t};\n\tconst headers = init?.headers;\n\tif (headers === undefined) {\n\t\tif (request) {\n\t\t\tfor (const [key, value] of request.headers) add(key, value);\n\t\t}\n\t} else if (headers instanceof Headers) {\n\t\tfor (const [key, value] of headers) add(key, value);\n\t} else if (Array.isArray(headers)) {\n\t\tfor (const [key, value] of headers) add(key, value);\n\t} else {\n\t\tfor (const [key, value] of Object.entries(headers)) {\n\t\t\tif (value !== undefined) add(key, String(value));\n\t\t}\n\t}\n\treturn result;\n}\n"]}
|
|
@@ -15,17 +15,6 @@ export declare function buildCursorHistoryForTest(messages: Message[], activeUse
|
|
|
15
15
|
turnUserMessagesJson: unknown[];
|
|
16
16
|
turnStepMessagesJson: unknown[][];
|
|
17
17
|
};
|
|
18
|
-
/**
|
|
19
|
-
* Serialized byte cost of the MODEL INPUT alone: the `rootPromptMessagesJson`
|
|
20
|
-
* blobs Cursor's server replays as the prompt. `measureCursorHistorySerializedBytes`
|
|
21
|
-
* additionally counts the `turns[]` display copies of the same conversation, so
|
|
22
|
-
* it reports roughly twice this number and overstates what the model ingests.
|
|
23
|
-
* Each referenced blob is counted once per reference, because a blob replayed
|
|
24
|
-
* twice occupies the prompt twice.
|
|
25
|
-
*
|
|
26
|
-
* First proposed in #1614.
|
|
27
|
-
*/
|
|
28
|
-
export declare function measureCursorModelInputSerializedBytes(messages: Message[], activeUserMessageIndex?: number): number;
|
|
29
18
|
export declare function measureCursorHistorySerializedBytes(messages: Message[], activeUserMessageIndex?: number): number;
|
|
30
19
|
export declare function buildCursorHistoryWireBytesForTest(messages: Message[], activeUserMessageIndex?: number): Uint8Array[];
|
|
31
20
|
//# sourceMappingURL=measure.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"measure.d.ts","sourceRoot":"","sources":["../../../src/api/cursor-agent/measure.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAkC,OAAO,EAA4C,MAAM,gBAAgB,CAAC;AAwJxH;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CASzG;AAwPD,yFAAyF;AACzF,wBAAgB,yBAAyB,CACxC,QAAQ,EAAE,OAAO,EAAE,EACnB,sBAAsB,SAAqC,GACzD;IACF,sBAAsB,EAAE,OAAO,EAAE,CAAC;IAClC,oBAAoB,EAAE,OAAO,EAAE,CAAC;IAChC,oBAAoB,EAAE,OAAO,EAAE,EAAE,CAAC;CAClC,CAsBA;AAoCD
|
|
1
|
+
{"version":3,"file":"measure.d.ts","sourceRoot":"","sources":["../../../src/api/cursor-agent/measure.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAkC,OAAO,EAA4C,MAAM,gBAAgB,CAAC;AAwJxH;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CASzG;AAwPD,yFAAyF;AACzF,wBAAgB,yBAAyB,CACxC,QAAQ,EAAE,OAAO,EAAE,EACnB,sBAAsB,SAAqC,GACzD;IACF,sBAAsB,EAAE,OAAO,EAAE,CAAC;IAClC,oBAAoB,EAAE,OAAO,EAAE,CAAC;IAChC,oBAAoB,EAAE,OAAO,EAAE,EAAE,CAAC;CAClC,CAsBA;AAoCD,wBAAgB,mCAAmC,CAClD,QAAQ,EAAE,OAAO,EAAE,EACnB,sBAAsB,SAAqC,GACzD,MAAM,CAKR;AACD,wBAAgB,kCAAkC,CACjD,QAAQ,EAAE,OAAO,EAAE,EACnB,sBAAsB,SAAqC,GACzD,UAAU,EAAE,CAKd"}
|
|
@@ -431,24 +431,6 @@ function extractImages(content) {
|
|
|
431
431
|
},
|
|
432
432
|
}));
|
|
433
433
|
}
|
|
434
|
-
/**
|
|
435
|
-
* Serialized byte cost of the MODEL INPUT alone: the `rootPromptMessagesJson`
|
|
436
|
-
* blobs Cursor's server replays as the prompt. `measureCursorHistorySerializedBytes`
|
|
437
|
-
* additionally counts the `turns[]` display copies of the same conversation, so
|
|
438
|
-
* it reports roughly twice this number and overstates what the model ingests.
|
|
439
|
-
* Each referenced blob is counted once per reference, because a blob replayed
|
|
440
|
-
* twice occupies the prompt twice.
|
|
441
|
-
*
|
|
442
|
-
* First proposed in #1614.
|
|
443
|
-
*/
|
|
444
|
-
export function measureCursorModelInputSerializedBytes(messages, activeUserMessageIndex = findLastUserMessageIndex(messages)) {
|
|
445
|
-
const blobStore = new Map();
|
|
446
|
-
let total = 0;
|
|
447
|
-
for (const blobId of buildRootPromptMessagesJson(messages, [], blobStore, activeUserMessageIndex)) {
|
|
448
|
-
total += readCursorBlob(blobStore, blobId).byteLength;
|
|
449
|
-
}
|
|
450
|
-
return total;
|
|
451
|
-
}
|
|
452
434
|
export function measureCursorHistorySerializedBytes(messages, activeUserMessageIndex = findLastUserMessageIndex(messages)) {
|
|
453
435
|
return buildCursorHistoryWireBytesForTest(messages, activeUserMessageIndex).reduce((total, bytes) => total + bytes.byteLength, 0);
|
|
454
436
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"measure.js","sourceRoot":"","sources":["../../../src/api/cursor-agent/measure.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAiC,QAAQ,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACnH,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAGhG,OAAO,EACN,oCAAoC,EACpC,sBAAsB,EACtB,sBAAsB,EACtB,+BAA+B,EAC/B,aAAa,EACb,qBAAqB,EACrB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,8BAA8B,EAC9B,mBAAmB,EACnB,qBAAqB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AAM,UAAU,kCAAkC,CACjD,QAAmB,EACnB,sBAAsB,GAAG,wBAAwB,CAAC,QAAQ,CAAC;IAE3D,MAAM,SAAS,GAAG,IAAI,GAAG,EAAsB,CAAC;IAChD,2BAA2B,CAAC,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,sBAAsB,CAAC,CAAC;IAC7E,sBAAsB,CAAC,QAAQ,EAAE,SAAS,EAAE,sBAAsB,CAAC,CAAC;IACpE,OAAO,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;AAChC,CAAC","sourcesContent":["/** Browser-safe Cursor history serialization. */\nimport { create, fromBinary, fromJson, type JsonValue as PbJsonValue, toBinary, toJson } from \"@bufbuild/protobuf\";\nimport { ValueSchema } from \"@bufbuild/protobuf/wkt\";\nimport { CURSOR_COMPOSER_PROMPT, isCursorComposerModel } from \"../../cursor/composer-prompt.ts\";\nimport type { AssistantMessage, ImageContent, Message, TextContent, ToolCall, ToolResultMessage } from \"../../types.ts\";\nimport type { ConversationStep } from \"./gen/agent_pb.ts\";\nimport {\n\tAgentConversationTurnStructureSchema,\n\tAssistantMessageSchema,\n\tConversationStepSchema,\n\tConversationTurnStructureSchema,\n\tMcpArgsSchema,\n\tMcpImageContentSchema,\n\tMcpSuccessSchema,\n\tMcpTextContentSchema,\n\tMcpToolCallSchema,\n\tMcpToolErrorSchema,\n\tMcpToolResultContentItemSchema,\n\tMcpToolResultSchema,\n\tSelectedContextSchema,\n\tSelectedImageSchema,\n\tToolCallSchema,\n\tUserMessageSchema,\n} from \"./gen/agent_pb.ts\";\n\nfunction hashBytes(input: Uint8Array | string): Uint8Array {\n\tconst out = new Uint8Array(32);\n\tconst b = typeof input === \"string\" ? new TextEncoder().encode(input) : input;\n\tfor (let i = 0; i < b.length; i++) out[i % 32] = (out[i % 32] + b[i] + i) & 255;\n\treturn out;\n}\nfunction createHash(input: Uint8Array | string) {\n\tlet data = typeof input === \"string\" ? input : new TextDecoder().decode(input);\n\treturn {\n\t\tupdate(v: Uint8Array | string) {\n\t\t\tdata += typeof v === \"string\" ? v : new TextDecoder().decode(v);\n\t\t\treturn this;\n\t\t},\n\t\tdigest(format?: string) {\n\t\t\tconst b = hashBytes(data);\n\t\t\treturn format === \"hex\" ? [...b].map((x) => x.toString(16).padStart(2, \"0\")).join(\"\") : b;\n\t\t},\n\t} as any;\n}\nfunction deterministicUuid(s: string) {\n\tconst h = [...hashBytes(s)].map((x) => x.toString(16).padStart(2, \"0\")).join(\"\");\n\treturn `${h.slice(0, 8)}-${h.slice(8, 12)}-${h.slice(12, 16)}-${h.slice(16, 20)}-${h.slice(20, 32)}`;\n}\nfunction randomUUID() {\n\tconst h = [...hashBytes(String(Math.random()) + Date.now())].map((x) => x.toString(16).padStart(2, \"0\")).join(\"\");\n\treturn `${h.slice(0, 8)}-${h.slice(8, 12)}-${h.slice(12, 16)}-${h.slice(16, 20)}-${h.slice(20, 32)}`;\n}\nfunction storeCursorBlob(m: Map<string, Uint8Array>, d: Uint8Array) {\n\tconst id = hashBytes(d);\n\tm.set([...id].map((x) => x.toString(16).padStart(2, \"0\")).join(\"\"), d);\n\treturn id;\n}\nfunction readCursorBlob(m: Map<string, Uint8Array>, id: Uint8Array) {\n\tconst d = m.get([...id].map((x) => x.toString(16).padStart(2, \"0\")).join(\"\"));\n\tif (!d) throw Error(\"Cursor blob not found\");\n\treturn d;\n}\nfunction toolResultToText(r: ToolResultMessage) {\n\treturn r.content.map((i) => (i.type === \"text\" ? i.text : `[${i.mimeType} image]`)).join(\"\\n\");\n}\n/** Extract text content from a user message. */\nfunction extractUserMessageText(msg: Message): string {\n\tif (msg.role !== \"user\") return \"\";\n\tconst content = msg.content;\n\tif (typeof content === \"string\") return content.trim();\n\tconst text = content\n\t\t.filter((c): c is TextContent => c.type === \"text\")\n\t\t.map((c) => c.text)\n\t\t.join(\"\\n\");\n\treturn text.trim();\n}\n\nfunction hasUserMessageImages(msg: Message): boolean {\n\treturn msg.role === \"user\" && Array.isArray(msg.content) && msg.content.some((item) => item.type === \"image\");\n}\n\ntype CursorRootPromptContentPart = { type: \"text\"; text: string } | { type: \"image\"; image: string; mediaType: string };\n\nfunction buildCursorRootPromptContent(content: string | (TextContent | ImageContent)[]): CursorRootPromptContentPart[] {\n\tif (typeof content === \"string\") {\n\t\tconst text = content.trim();\n\t\treturn text ? [{ type: \"text\", text }] : [];\n\t}\n\tconst parts: CursorRootPromptContentPart[] = [];\n\tfor (const item of content) {\n\t\tif (item.type === \"text\") {\n\t\t\tconst text = item.text.trim();\n\t\t\tif (text) {\n\t\t\t\tparts.push({ type: \"text\", text });\n\t\t\t}\n\t\t} else {\n\t\t\tparts.push({ type: \"image\", image: `data:${item.mimeType};base64,${item.data}`, mediaType: item.mimeType });\n\t\t}\n\t}\n\treturn parts;\n}\n\nfunction cursorUserContentKey(content: string | (TextContent | ImageContent)[]): string {\n\tif (typeof content === \"string\") {\n\t\treturn content.trim();\n\t}\n\tconst hash = createHash(\"sha256\");\n\tfor (const item of content) {\n\t\thash.update(item.type);\n\t\tif (item.type === \"text\") {\n\t\t\thash.update(item.text);\n\t\t} else {\n\t\t\thash.update(item.mimeType);\n\t\t\thash.update(item.data);\n\t\t}\n\t}\n\treturn hash.digest(\"hex\");\n}\n\ntype CursorRootPromptAssistantContentPart =\n\t| { type: \"text\"; text: string }\n\t| { type: \"tool-call\"; toolCallId: string; toolName: string; args: Record<string, unknown> };\n\nfunction buildCursorAssistantContent(msg: AssistantMessage): CursorRootPromptAssistantContentPart[] {\n\tconst content: CursorRootPromptAssistantContentPart[] = [];\n\tfor (const item of msg.content) {\n\t\tif (item.type === \"text\") {\n\t\t\tif (item.text) content.push({ type: \"text\", text: item.text });\n\t\t} else if (item.type === \"toolCall\") {\n\t\t\tcontent.push({\n\t\t\t\ttype: \"tool-call\",\n\t\t\t\ttoolCallId: item.id,\n\t\t\t\ttoolName: item.name,\n\t\t\t\targs: item.arguments,\n\t\t\t});\n\t\t}\n\t\t// Thinking is never replayed: Cursor manages reasoning server-side and\n\t\t// foreign/hidden reasoning must not leak into history as native thinking.\n\t}\n\treturn content;\n}\n\n/**\n * Index of the last user message in `messages`, or -1 if none. Used to\n * exclude the current user turn from history builders — it goes in the\n * `userMessageAction`, not in history structures.\n */\nfunction findLastUserMessageIndex(messages: Message[]): number {\n\tfor (let i = messages.length - 1; i >= 0; i--) {\n\t\tif (messages[i].role === \"user\") {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n}\n\n/**\n * Build one Cursor system-message JSON blob per system prompt. When no system\n * prompt is provided, returns a single default greeting so we never emit an\n * empty `rootPromptMessagesJson` head.\n *\n * Composer models get their operating prefix as its own leading blob rather\n * than concatenated into the host prompt, so Cursor's per-blob prompt cache\n * keeps the prefix stable while the host prompt changes underneath it.\n */\nexport function buildCursorSystemPromptJsons(systemPrompt: string | undefined, modelId?: string): string[] {\n\tconst trimmed = systemPrompt?.trim();\n\tconst host = trimmed\n\t\t? [JSON.stringify({ role: \"system\", content: trimmed })]\n\t\t: [JSON.stringify({ role: \"system\", content: \"You are a helpful assistant.\" })];\n\tif (modelId !== undefined && isCursorComposerModel(modelId)) {\n\t\treturn [JSON.stringify({ role: \"system\", content: CURSOR_COMPOSER_PROMPT }), ...host];\n\t}\n\treturn host;\n}\n\n/**\n * Build `ConversationStateStructure.rootPromptMessagesJson` blob IDs for the\n * system prompt plus prior conversation history, as JSON blobs matching\n * Cursor's internal Vercel-AI-SDK-shaped message format.\n *\n * Cursor's server uses `rootPromptMessagesJson` (not `turns[]`) to build the\n * actual model prompt; `turns[]` is UI/display metadata. The active user\n * message is excluded because it is sent in the action.\n */\nfunction buildRootPromptMessagesJson(\n\tmessages: Message[],\n\tsystemPromptIds: Uint8Array[],\n\tblobStore: Map<string, Uint8Array>,\n\tactiveUserMessageIndex = findLastUserMessageIndex(messages),\n): Uint8Array[] {\n\tconst entries: Uint8Array[] = [...systemPromptIds];\n\tconst pushJson = (obj: unknown) => {\n\t\tconst bytes = new TextEncoder().encode(JSON.stringify(obj));\n\t\tentries.push(storeCursorBlob(blobStore, bytes));\n\t};\n\n\tfor (let i = 0; i < messages.length; i++) {\n\t\tif (i === activeUserMessageIndex) break;\n\t\tconst msg = messages[i];\n\t\tif (msg.role === \"user\") {\n\t\t\tconst content = buildCursorRootPromptContent(msg.content);\n\t\t\tif (content.length === 0) continue;\n\t\t\tpushJson({ role: \"user\", content });\n\t\t} else if (msg.role === \"assistant\") {\n\t\t\tconst content = buildCursorAssistantContent(msg);\n\t\t\tif (content.length === 0) continue;\n\t\t\tpushJson({ role: \"assistant\", content });\n\t\t} else if (msg.role === \"toolResult\") {\n\t\t\t// Emit even when the result text is empty: the assistant `tool-call`\n\t\t\t// is already in history, so dropping the pair would replay an\n\t\t\t// orphaned call.\n\t\t\tpushJson({\n\t\t\t\trole: \"tool\",\n\t\t\t\tid: msg.toolCallId,\n\t\t\t\tcontent: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"tool-result\",\n\t\t\t\t\t\ttoolName: msg.toolName,\n\t\t\t\t\t\ttoolCallId: msg.toolCallId,\n\t\t\t\t\t\tresult: toolResultToText(msg),\n\t\t\t\t\t\t...(msg.isError ? { isError: true } : {}),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t});\n\t\t}\n\t}\n\n\treturn entries;\n}\n\nfunction isPlainRecord(value: unknown): value is Record<string, unknown> {\n\tif (value === null || typeof value !== \"object\" || Array.isArray(value)) return false;\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn prototype === Object.prototype || prototype === null;\n}\n\nfunction isJsonValue(value: unknown): value is PbJsonValue {\n\tif (value === null || typeof value === \"string\" || typeof value === \"boolean\") return true;\n\tif (typeof value === \"number\") return Number.isFinite(value);\n\tif (Array.isArray(value)) return value.every(isJsonValue);\n\tif (!isPlainRecord(value)) return false;\n\tfor (const key in value) {\n\t\tif (!isJsonValue(value[key])) return false;\n\t}\n\treturn true;\n}\n\nfunction encodeCursorMcpArguments(toolCall: ToolCall): Record<string, Uint8Array> {\n\tconst encoded: Record<string, Uint8Array> = {};\n\tfor (const name in toolCall.arguments) {\n\t\tconst value = toolCall.arguments[name];\n\t\tif (value === undefined) continue;\n\t\tif (!isJsonValue(value)) {\n\t\t\tthrow new Error(`Cursor tool argument ${toolCall.name}.${name} is not JSON-serializable`);\n\t\t}\n\t\tencoded[name] = toBinary(ValueSchema, fromJson(ValueSchema, value));\n\t}\n\treturn encoded;\n}\n\nfunction createCursorMcpResult(result: ToolResultMessage) {\n\tif (result.isError) {\n\t\treturn create(McpToolResultSchema, {\n\t\t\tresult: {\n\t\t\t\tcase: \"error\",\n\t\t\t\tvalue: create(McpToolErrorSchema, { error: toolResultToText(result) }),\n\t\t\t},\n\t\t});\n\t}\n\treturn create(McpToolResultSchema, {\n\t\tresult: {\n\t\t\tcase: \"success\",\n\t\t\tvalue: create(McpSuccessSchema, {\n\t\t\t\tcontent: result.content.map((item) =>\n\t\t\t\t\titem.type === \"text\"\n\t\t\t\t\t\t? create(McpToolResultContentItemSchema, {\n\t\t\t\t\t\t\t\tcontent: { case: \"text\", value: create(McpTextContentSchema, { text: item.text }) },\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t: create(McpToolResultContentItemSchema, {\n\t\t\t\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\t\t\tcase: \"image\",\n\t\t\t\t\t\t\t\t\tvalue: create(McpImageContentSchema, {\n\t\t\t\t\t\t\t\t\t\tdata: Uint8Array.from(Uint8Array.from(atob(item.data), (c) => c.charCodeAt(0))),\n\t\t\t\t\t\t\t\t\t\tmimeType: item.mimeType,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t}),\n\t\t},\n\t});\n}\n\nfunction createCursorToolCallStep(toolCall: ToolCall, result: ToolResultMessage | undefined) {\n\tconst mcpCall = create(McpToolCallSchema, {\n\t\targs: create(McpArgsSchema, {\n\t\t\tname: toolCall.name,\n\t\t\targs: encodeCursorMcpArguments(toolCall),\n\t\t\ttoolCallId: toolCall.id,\n\t\t\tproviderIdentifier: \"pi-agent\",\n\t\t\ttoolName: toolCall.name,\n\t\t}),\n\t\t...(result ? { result: createCursorMcpResult(result) } : {}),\n\t});\n\treturn create(ConversationStepSchema, {\n\t\tmessage: {\n\t\t\tcase: \"toolCall\",\n\t\t\tvalue: create(ToolCallSchema, {\n\t\t\t\ttool: { case: \"mcpToolCall\", value: mcpCall },\n\t\t\t\ttoolCallId: toolCall.id,\n\t\t\t}),\n\t\t},\n\t});\n}\n\n/**\n * Convert context.messages to Cursor's ConversationTurnStructure blob IDs.\n * Groups messages into turns: each turn is a user message followed by the\n * assistant's response. Excludes the active user message (which goes in the\n * action).\n */\nfunction buildConversationTurns(\n\tmessages: Message[],\n\tblobStore: Map<string, Uint8Array>,\n\tactiveUserMessageIndex = findLastUserMessageIndex(messages),\n): Uint8Array[] {\n\tconst turns: Uint8Array[] = [];\n\tconst historyEnd = activeUserMessageIndex >= 0 ? activeUserMessageIndex : messages.length;\n\tconst toolResults = new Map<string, ToolResultMessage>();\n\tconst pairedToolCallIds = new Set<string>();\n\tfor (let index = 0; index < historyEnd; index++) {\n\t\tconst message = messages[index];\n\t\tif (message.role === \"toolResult\") {\n\t\t\ttoolResults.set(message.toolCallId, message);\n\t\t} else if (message.role === \"assistant\") {\n\t\t\tfor (const item of message.content) {\n\t\t\t\tif (item.type === \"toolCall\") pairedToolCallIds.add(item.id);\n\t\t\t}\n\t\t}\n\t}\n\n\tlet i = 0;\n\twhile (i < messages.length) {\n\t\tconst msg = messages[i];\n\t\tif (msg.role !== \"user\") {\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\t\tif (i === activeUserMessageIndex) break;\n\n\t\tconst userText = extractUserMessageText(msg);\n\t\tif (userText.length === 0 && !hasUserMessageImages(msg)) {\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst userMessage = createCursorUserMessage(\n\t\t\tmsg.content,\n\t\t\tuserText,\n\t\t\tdeterministicUuid(`u:${turns.length}:${cursorUserContentKey(msg.content)}`),\n\t\t);\n\t\tconst userMessageBlobId = storeCursorBlob(blobStore, toBinary(UserMessageSchema, userMessage));\n\t\tconst stepBlobIds: Uint8Array[] = [];\n\t\ti++;\n\n\t\twhile (i < messages.length && messages[i].role !== \"user\") {\n\t\t\tconst stepMsg = messages[i];\n\t\t\tif (stepMsg.role === \"assistant\") {\n\t\t\t\tfor (const item of stepMsg.content) {\n\t\t\t\t\tlet step: ConversationStep;\n\t\t\t\t\tif (item.type === \"text\") {\n\t\t\t\t\t\tif (!item.text) continue;\n\t\t\t\t\t\tstep = create(ConversationStepSchema, {\n\t\t\t\t\t\t\tmessage: {\n\t\t\t\t\t\t\t\tcase: \"assistantMessage\",\n\t\t\t\t\t\t\t\tvalue: create(AssistantMessageSchema, { text: item.text }),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t} else if (item.type === \"thinking\") {\n\t\t\t\t\t\t// Foreign/hidden reasoning never leaks into Cursor's turn\n\t\t\t\t\t\t// history as native thinking.\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} else if (item.type === \"toolCall\") {\n\t\t\t\t\t\tstep = createCursorToolCallStep(item, toolResults.get(item.id));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tstepBlobIds.push(storeCursorBlob(blobStore, toBinary(ConversationStepSchema, step)));\n\t\t\t\t}\n\t\t\t} else if (stepMsg.role === \"toolResult\" && !pairedToolCallIds.has(stepMsg.toolCallId)) {\n\t\t\t\tconst text = toolResultToText(stepMsg);\n\t\t\t\tif (text) {\n\t\t\t\t\tconst prefix = stepMsg.isError ? \"[Tool Error]\" : \"[Tool Result]\";\n\t\t\t\t\tconst step = create(ConversationStepSchema, {\n\t\t\t\t\t\tmessage: {\n\t\t\t\t\t\t\tcase: \"assistantMessage\",\n\t\t\t\t\t\t\tvalue: create(AssistantMessageSchema, { text: `${prefix}\\n${text}` }),\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t\tstepBlobIds.push(storeCursorBlob(blobStore, toBinary(ConversationStepSchema, step)));\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\n\t\tconst agentTurn = create(AgentConversationTurnStructureSchema, {\n\t\t\tuserMessage: userMessageBlobId,\n\t\t\tsteps: stepBlobIds,\n\t\t});\n\t\tconst turn = create(ConversationTurnStructureSchema, {\n\t\t\tturn: {\n\t\t\t\tcase: \"agentConversationTurn\",\n\t\t\t\tvalue: agentTurn,\n\t\t\t},\n\t\t});\n\t\tturns.push(storeCursorBlob(blobStore, toBinary(ConversationTurnStructureSchema, turn)));\n\t}\n\n\treturn turns;\n}\n\n/** Exported for tests: decodes Cursor history blobs built from conversation messages. */\nexport function buildCursorHistoryForTest(\n\tmessages: Message[],\n\tactiveUserMessageIndex = findLastUserMessageIndex(messages),\n): {\n\trootPromptMessagesJson: unknown[];\n\tturnUserMessagesJson: unknown[];\n\tturnStepMessagesJson: unknown[][];\n} {\n\tconst blobStore = new Map<string, Uint8Array>();\n\tconst rootPromptMessagesJson = buildRootPromptMessagesJson(messages, [], blobStore, activeUserMessageIndex).map(\n\t\t(blobId) => JSON.parse(new TextDecoder().decode(readCursorBlob(blobStore, blobId))),\n\t);\n\tconst turnUserMessagesJson: unknown[] = [];\n\tconst turnStepMessagesJson: unknown[][] = [];\n\tfor (const turnBlobId of buildConversationTurns(messages, blobStore, activeUserMessageIndex)) {\n\t\tconst turn = fromBinary(ConversationTurnStructureSchema, readCursorBlob(blobStore, turnBlobId));\n\t\tif (turn.turn.case !== \"agentConversationTurn\") {\n\t\t\tcontinue;\n\t\t}\n\t\tconst userMessage = fromBinary(UserMessageSchema, readCursorBlob(blobStore, turn.turn.value.userMessage));\n\t\tturnUserMessagesJson.push(toJson(UserMessageSchema, userMessage));\n\t\tturnStepMessagesJson.push(\n\t\t\tturn.turn.value.steps.map((stepBlobId) => {\n\t\t\t\tconst step = fromBinary(ConversationStepSchema, readCursorBlob(blobStore, stepBlobId));\n\t\t\t\treturn toJson(ConversationStepSchema, step);\n\t\t\t}),\n\t\t);\n\t}\n\treturn { rootPromptMessagesJson, turnUserMessagesJson, turnStepMessagesJson };\n}\n\nfunction createCursorUserMessage(\n\tcontent: string | (TextContent | ImageContent)[],\n\ttext: string,\n\tmessageId = randomUUID() as string,\n) {\n\tconst images = typeof content === \"string\" ? [] : extractImages(content);\n\treturn create(UserMessageSchema, {\n\t\ttext,\n\t\tmessageId,\n\t\t...(images.length > 0\n\t\t\t? {\n\t\t\t\t\tselectedContext: create(SelectedContextSchema, {\n\t\t\t\t\t\tselectedImages: images,\n\t\t\t\t\t}),\n\t\t\t\t}\n\t\t\t: {}),\n\t});\n}\n\nfunction extractImages(content: (TextContent | ImageContent)[]) {\n\treturn content\n\t\t.filter((item): item is ImageContent => item.type === \"image\")\n\t\t.map((image) =>\n\t\t\tcreate(SelectedImageSchema, {\n\t\t\t\tuuid: randomUUID(),\n\t\t\t\tmimeType: image.mimeType,\n\t\t\t\tdataOrBlobId: {\n\t\t\t\t\tcase: \"data\",\n\t\t\t\t\tvalue: Uint8Array.from(atob(image.data), (c) => c.charCodeAt(0)),\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n}\n\n/**\n * Serialized byte cost of the MODEL INPUT alone: the `rootPromptMessagesJson`\n * blobs Cursor's server replays as the prompt. `measureCursorHistorySerializedBytes`\n * additionally counts the `turns[]` display copies of the same conversation, so\n * it reports roughly twice this number and overstates what the model ingests.\n * Each referenced blob is counted once per reference, because a blob replayed\n * twice occupies the prompt twice.\n *\n * First proposed in #1614.\n */\nexport function measureCursorModelInputSerializedBytes(\n\tmessages: Message[],\n\tactiveUserMessageIndex = findLastUserMessageIndex(messages),\n): number {\n\tconst blobStore = new Map<string, Uint8Array>();\n\tlet total = 0;\n\tfor (const blobId of buildRootPromptMessagesJson(messages, [], blobStore, activeUserMessageIndex)) {\n\t\ttotal += readCursorBlob(blobStore, blobId).byteLength;\n\t}\n\treturn total;\n}\n\nexport function measureCursorHistorySerializedBytes(\n\tmessages: Message[],\n\tactiveUserMessageIndex = findLastUserMessageIndex(messages),\n): number {\n\treturn buildCursorHistoryWireBytesForTest(messages, activeUserMessageIndex).reduce(\n\t\t(total, bytes) => total + bytes.byteLength,\n\t\t0,\n\t);\n}\nexport function buildCursorHistoryWireBytesForTest(\n\tmessages: Message[],\n\tactiveUserMessageIndex = findLastUserMessageIndex(messages),\n): Uint8Array[] {\n\tconst blobStore = new Map<string, Uint8Array>();\n\tbuildRootPromptMessagesJson(messages, [], blobStore, activeUserMessageIndex);\n\tbuildConversationTurns(messages, blobStore, activeUserMessageIndex);\n\treturn [...blobStore.values()];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"measure.js","sourceRoot":"","sources":["../../../src/api/cursor-agent/measure.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAiC,QAAQ,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACnH,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAGhG,OAAO,EACN,oCAAoC,EACpC,sBAAsB,EACtB,sBAAsB,EACtB,+BAA+B,EAC/B,aAAa,EACb,qBAAqB,EACrB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,8BAA8B,EAC9B,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,EACd,iBAAiB,GACjB,MAAM,mBAAmB,CAAC;AAE3B,SAAS,SAAS,CAAC,KAA0B;IAC5C,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;IAC/B,MAAM,CAAC,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,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EAAE,UAAU,EAAE;QAClB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,YAAY,EAAE;YACb,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;SAChE;KACD,CAAC,CACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,mCAAmC,CAClD,QAAmB,EACnB,sBAAsB,GAAG,wBAAwB,CAAC,QAAQ,CAAC;IAE3D,OAAO,kCAAkC,CAAC,QAAQ,EAAE,sBAAsB,CAAC,CAAC,MAAM,CACjF,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,GAAG,KAAK,CAAC,UAAU,EAC1C,CAAC,CACD,CAAC;AACH,CAAC;AACD,MAAM,UAAU,kCAAkC,CACjD,QAAmB,EACnB,sBAAsB,GAAG,wBAAwB,CAAC,QAAQ,CAAC;IAE3D,MAAM,SAAS,GAAG,IAAI,GAAG,EAAsB,CAAC;IAChD,2BAA2B,CAAC,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,sBAAsB,CAAC,CAAC;IAC7E,sBAAsB,CAAC,QAAQ,EAAE,SAAS,EAAE,sBAAsB,CAAC,CAAC;IACpE,OAAO,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;AAChC,CAAC","sourcesContent":["/** Browser-safe Cursor history serialization. */\nimport { create, fromBinary, fromJson, type JsonValue as PbJsonValue, toBinary, toJson } from \"@bufbuild/protobuf\";\nimport { ValueSchema } from \"@bufbuild/protobuf/wkt\";\nimport { CURSOR_COMPOSER_PROMPT, isCursorComposerModel } from \"../../cursor/composer-prompt.ts\";\nimport type { AssistantMessage, ImageContent, Message, TextContent, ToolCall, ToolResultMessage } from \"../../types.ts\";\nimport type { ConversationStep } from \"./gen/agent_pb.ts\";\nimport {\n\tAgentConversationTurnStructureSchema,\n\tAssistantMessageSchema,\n\tConversationStepSchema,\n\tConversationTurnStructureSchema,\n\tMcpArgsSchema,\n\tMcpImageContentSchema,\n\tMcpSuccessSchema,\n\tMcpTextContentSchema,\n\tMcpToolCallSchema,\n\tMcpToolErrorSchema,\n\tMcpToolResultContentItemSchema,\n\tMcpToolResultSchema,\n\tSelectedContextSchema,\n\tSelectedImageSchema,\n\tToolCallSchema,\n\tUserMessageSchema,\n} from \"./gen/agent_pb.ts\";\n\nfunction hashBytes(input: Uint8Array | string): Uint8Array {\n\tconst out = new Uint8Array(32);\n\tconst b = typeof input === \"string\" ? new TextEncoder().encode(input) : input;\n\tfor (let i = 0; i < b.length; i++) out[i % 32] = (out[i % 32] + b[i] + i) & 255;\n\treturn out;\n}\nfunction createHash(input: Uint8Array | string) {\n\tlet data = typeof input === \"string\" ? input : new TextDecoder().decode(input);\n\treturn {\n\t\tupdate(v: Uint8Array | string) {\n\t\t\tdata += typeof v === \"string\" ? v : new TextDecoder().decode(v);\n\t\t\treturn this;\n\t\t},\n\t\tdigest(format?: string) {\n\t\t\tconst b = hashBytes(data);\n\t\t\treturn format === \"hex\" ? [...b].map((x) => x.toString(16).padStart(2, \"0\")).join(\"\") : b;\n\t\t},\n\t} as any;\n}\nfunction deterministicUuid(s: string) {\n\tconst h = [...hashBytes(s)].map((x) => x.toString(16).padStart(2, \"0\")).join(\"\");\n\treturn `${h.slice(0, 8)}-${h.slice(8, 12)}-${h.slice(12, 16)}-${h.slice(16, 20)}-${h.slice(20, 32)}`;\n}\nfunction randomUUID() {\n\tconst h = [...hashBytes(String(Math.random()) + Date.now())].map((x) => x.toString(16).padStart(2, \"0\")).join(\"\");\n\treturn `${h.slice(0, 8)}-${h.slice(8, 12)}-${h.slice(12, 16)}-${h.slice(16, 20)}-${h.slice(20, 32)}`;\n}\nfunction storeCursorBlob(m: Map<string, Uint8Array>, d: Uint8Array) {\n\tconst id = hashBytes(d);\n\tm.set([...id].map((x) => x.toString(16).padStart(2, \"0\")).join(\"\"), d);\n\treturn id;\n}\nfunction readCursorBlob(m: Map<string, Uint8Array>, id: Uint8Array) {\n\tconst d = m.get([...id].map((x) => x.toString(16).padStart(2, \"0\")).join(\"\"));\n\tif (!d) throw Error(\"Cursor blob not found\");\n\treturn d;\n}\nfunction toolResultToText(r: ToolResultMessage) {\n\treturn r.content.map((i) => (i.type === \"text\" ? i.text : `[${i.mimeType} image]`)).join(\"\\n\");\n}\n/** Extract text content from a user message. */\nfunction extractUserMessageText(msg: Message): string {\n\tif (msg.role !== \"user\") return \"\";\n\tconst content = msg.content;\n\tif (typeof content === \"string\") return content.trim();\n\tconst text = content\n\t\t.filter((c): c is TextContent => c.type === \"text\")\n\t\t.map((c) => c.text)\n\t\t.join(\"\\n\");\n\treturn text.trim();\n}\n\nfunction hasUserMessageImages(msg: Message): boolean {\n\treturn msg.role === \"user\" && Array.isArray(msg.content) && msg.content.some((item) => item.type === \"image\");\n}\n\ntype CursorRootPromptContentPart = { type: \"text\"; text: string } | { type: \"image\"; image: string; mediaType: string };\n\nfunction buildCursorRootPromptContent(content: string | (TextContent | ImageContent)[]): CursorRootPromptContentPart[] {\n\tif (typeof content === \"string\") {\n\t\tconst text = content.trim();\n\t\treturn text ? [{ type: \"text\", text }] : [];\n\t}\n\tconst parts: CursorRootPromptContentPart[] = [];\n\tfor (const item of content) {\n\t\tif (item.type === \"text\") {\n\t\t\tconst text = item.text.trim();\n\t\t\tif (text) {\n\t\t\t\tparts.push({ type: \"text\", text });\n\t\t\t}\n\t\t} else {\n\t\t\tparts.push({ type: \"image\", image: `data:${item.mimeType};base64,${item.data}`, mediaType: item.mimeType });\n\t\t}\n\t}\n\treturn parts;\n}\n\nfunction cursorUserContentKey(content: string | (TextContent | ImageContent)[]): string {\n\tif (typeof content === \"string\") {\n\t\treturn content.trim();\n\t}\n\tconst hash = createHash(\"sha256\");\n\tfor (const item of content) {\n\t\thash.update(item.type);\n\t\tif (item.type === \"text\") {\n\t\t\thash.update(item.text);\n\t\t} else {\n\t\t\thash.update(item.mimeType);\n\t\t\thash.update(item.data);\n\t\t}\n\t}\n\treturn hash.digest(\"hex\");\n}\n\ntype CursorRootPromptAssistantContentPart =\n\t| { type: \"text\"; text: string }\n\t| { type: \"tool-call\"; toolCallId: string; toolName: string; args: Record<string, unknown> };\n\nfunction buildCursorAssistantContent(msg: AssistantMessage): CursorRootPromptAssistantContentPart[] {\n\tconst content: CursorRootPromptAssistantContentPart[] = [];\n\tfor (const item of msg.content) {\n\t\tif (item.type === \"text\") {\n\t\t\tif (item.text) content.push({ type: \"text\", text: item.text });\n\t\t} else if (item.type === \"toolCall\") {\n\t\t\tcontent.push({\n\t\t\t\ttype: \"tool-call\",\n\t\t\t\ttoolCallId: item.id,\n\t\t\t\ttoolName: item.name,\n\t\t\t\targs: item.arguments,\n\t\t\t});\n\t\t}\n\t\t// Thinking is never replayed: Cursor manages reasoning server-side and\n\t\t// foreign/hidden reasoning must not leak into history as native thinking.\n\t}\n\treturn content;\n}\n\n/**\n * Index of the last user message in `messages`, or -1 if none. Used to\n * exclude the current user turn from history builders — it goes in the\n * `userMessageAction`, not in history structures.\n */\nfunction findLastUserMessageIndex(messages: Message[]): number {\n\tfor (let i = messages.length - 1; i >= 0; i--) {\n\t\tif (messages[i].role === \"user\") {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n}\n\n/**\n * Build one Cursor system-message JSON blob per system prompt. When no system\n * prompt is provided, returns a single default greeting so we never emit an\n * empty `rootPromptMessagesJson` head.\n *\n * Composer models get their operating prefix as its own leading blob rather\n * than concatenated into the host prompt, so Cursor's per-blob prompt cache\n * keeps the prefix stable while the host prompt changes underneath it.\n */\nexport function buildCursorSystemPromptJsons(systemPrompt: string | undefined, modelId?: string): string[] {\n\tconst trimmed = systemPrompt?.trim();\n\tconst host = trimmed\n\t\t? [JSON.stringify({ role: \"system\", content: trimmed })]\n\t\t: [JSON.stringify({ role: \"system\", content: \"You are a helpful assistant.\" })];\n\tif (modelId !== undefined && isCursorComposerModel(modelId)) {\n\t\treturn [JSON.stringify({ role: \"system\", content: CURSOR_COMPOSER_PROMPT }), ...host];\n\t}\n\treturn host;\n}\n\n/**\n * Build `ConversationStateStructure.rootPromptMessagesJson` blob IDs for the\n * system prompt plus prior conversation history, as JSON blobs matching\n * Cursor's internal Vercel-AI-SDK-shaped message format.\n *\n * Cursor's server uses `rootPromptMessagesJson` (not `turns[]`) to build the\n * actual model prompt; `turns[]` is UI/display metadata. The active user\n * message is excluded because it is sent in the action.\n */\nfunction buildRootPromptMessagesJson(\n\tmessages: Message[],\n\tsystemPromptIds: Uint8Array[],\n\tblobStore: Map<string, Uint8Array>,\n\tactiveUserMessageIndex = findLastUserMessageIndex(messages),\n): Uint8Array[] {\n\tconst entries: Uint8Array[] = [...systemPromptIds];\n\tconst pushJson = (obj: unknown) => {\n\t\tconst bytes = new TextEncoder().encode(JSON.stringify(obj));\n\t\tentries.push(storeCursorBlob(blobStore, bytes));\n\t};\n\n\tfor (let i = 0; i < messages.length; i++) {\n\t\tif (i === activeUserMessageIndex) break;\n\t\tconst msg = messages[i];\n\t\tif (msg.role === \"user\") {\n\t\t\tconst content = buildCursorRootPromptContent(msg.content);\n\t\t\tif (content.length === 0) continue;\n\t\t\tpushJson({ role: \"user\", content });\n\t\t} else if (msg.role === \"assistant\") {\n\t\t\tconst content = buildCursorAssistantContent(msg);\n\t\t\tif (content.length === 0) continue;\n\t\t\tpushJson({ role: \"assistant\", content });\n\t\t} else if (msg.role === \"toolResult\") {\n\t\t\t// Emit even when the result text is empty: the assistant `tool-call`\n\t\t\t// is already in history, so dropping the pair would replay an\n\t\t\t// orphaned call.\n\t\t\tpushJson({\n\t\t\t\trole: \"tool\",\n\t\t\t\tid: msg.toolCallId,\n\t\t\t\tcontent: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"tool-result\",\n\t\t\t\t\t\ttoolName: msg.toolName,\n\t\t\t\t\t\ttoolCallId: msg.toolCallId,\n\t\t\t\t\t\tresult: toolResultToText(msg),\n\t\t\t\t\t\t...(msg.isError ? { isError: true } : {}),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t});\n\t\t}\n\t}\n\n\treturn entries;\n}\n\nfunction isPlainRecord(value: unknown): value is Record<string, unknown> {\n\tif (value === null || typeof value !== \"object\" || Array.isArray(value)) return false;\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn prototype === Object.prototype || prototype === null;\n}\n\nfunction isJsonValue(value: unknown): value is PbJsonValue {\n\tif (value === null || typeof value === \"string\" || typeof value === \"boolean\") return true;\n\tif (typeof value === \"number\") return Number.isFinite(value);\n\tif (Array.isArray(value)) return value.every(isJsonValue);\n\tif (!isPlainRecord(value)) return false;\n\tfor (const key in value) {\n\t\tif (!isJsonValue(value[key])) return false;\n\t}\n\treturn true;\n}\n\nfunction encodeCursorMcpArguments(toolCall: ToolCall): Record<string, Uint8Array> {\n\tconst encoded: Record<string, Uint8Array> = {};\n\tfor (const name in toolCall.arguments) {\n\t\tconst value = toolCall.arguments[name];\n\t\tif (value === undefined) continue;\n\t\tif (!isJsonValue(value)) {\n\t\t\tthrow new Error(`Cursor tool argument ${toolCall.name}.${name} is not JSON-serializable`);\n\t\t}\n\t\tencoded[name] = toBinary(ValueSchema, fromJson(ValueSchema, value));\n\t}\n\treturn encoded;\n}\n\nfunction createCursorMcpResult(result: ToolResultMessage) {\n\tif (result.isError) {\n\t\treturn create(McpToolResultSchema, {\n\t\t\tresult: {\n\t\t\t\tcase: \"error\",\n\t\t\t\tvalue: create(McpToolErrorSchema, { error: toolResultToText(result) }),\n\t\t\t},\n\t\t});\n\t}\n\treturn create(McpToolResultSchema, {\n\t\tresult: {\n\t\t\tcase: \"success\",\n\t\t\tvalue: create(McpSuccessSchema, {\n\t\t\t\tcontent: result.content.map((item) =>\n\t\t\t\t\titem.type === \"text\"\n\t\t\t\t\t\t? create(McpToolResultContentItemSchema, {\n\t\t\t\t\t\t\t\tcontent: { case: \"text\", value: create(McpTextContentSchema, { text: item.text }) },\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t: create(McpToolResultContentItemSchema, {\n\t\t\t\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\t\t\tcase: \"image\",\n\t\t\t\t\t\t\t\t\tvalue: create(McpImageContentSchema, {\n\t\t\t\t\t\t\t\t\t\tdata: Uint8Array.from(Uint8Array.from(atob(item.data), (c) => c.charCodeAt(0))),\n\t\t\t\t\t\t\t\t\t\tmimeType: item.mimeType,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t}),\n\t\t},\n\t});\n}\n\nfunction createCursorToolCallStep(toolCall: ToolCall, result: ToolResultMessage | undefined) {\n\tconst mcpCall = create(McpToolCallSchema, {\n\t\targs: create(McpArgsSchema, {\n\t\t\tname: toolCall.name,\n\t\t\targs: encodeCursorMcpArguments(toolCall),\n\t\t\ttoolCallId: toolCall.id,\n\t\t\tproviderIdentifier: \"pi-agent\",\n\t\t\ttoolName: toolCall.name,\n\t\t}),\n\t\t...(result ? { result: createCursorMcpResult(result) } : {}),\n\t});\n\treturn create(ConversationStepSchema, {\n\t\tmessage: {\n\t\t\tcase: \"toolCall\",\n\t\t\tvalue: create(ToolCallSchema, {\n\t\t\t\ttool: { case: \"mcpToolCall\", value: mcpCall },\n\t\t\t\ttoolCallId: toolCall.id,\n\t\t\t}),\n\t\t},\n\t});\n}\n\n/**\n * Convert context.messages to Cursor's ConversationTurnStructure blob IDs.\n * Groups messages into turns: each turn is a user message followed by the\n * assistant's response. Excludes the active user message (which goes in the\n * action).\n */\nfunction buildConversationTurns(\n\tmessages: Message[],\n\tblobStore: Map<string, Uint8Array>,\n\tactiveUserMessageIndex = findLastUserMessageIndex(messages),\n): Uint8Array[] {\n\tconst turns: Uint8Array[] = [];\n\tconst historyEnd = activeUserMessageIndex >= 0 ? activeUserMessageIndex : messages.length;\n\tconst toolResults = new Map<string, ToolResultMessage>();\n\tconst pairedToolCallIds = new Set<string>();\n\tfor (let index = 0; index < historyEnd; index++) {\n\t\tconst message = messages[index];\n\t\tif (message.role === \"toolResult\") {\n\t\t\ttoolResults.set(message.toolCallId, message);\n\t\t} else if (message.role === \"assistant\") {\n\t\t\tfor (const item of message.content) {\n\t\t\t\tif (item.type === \"toolCall\") pairedToolCallIds.add(item.id);\n\t\t\t}\n\t\t}\n\t}\n\n\tlet i = 0;\n\twhile (i < messages.length) {\n\t\tconst msg = messages[i];\n\t\tif (msg.role !== \"user\") {\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\t\tif (i === activeUserMessageIndex) break;\n\n\t\tconst userText = extractUserMessageText(msg);\n\t\tif (userText.length === 0 && !hasUserMessageImages(msg)) {\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst userMessage = createCursorUserMessage(\n\t\t\tmsg.content,\n\t\t\tuserText,\n\t\t\tdeterministicUuid(`u:${turns.length}:${cursorUserContentKey(msg.content)}`),\n\t\t);\n\t\tconst userMessageBlobId = storeCursorBlob(blobStore, toBinary(UserMessageSchema, userMessage));\n\t\tconst stepBlobIds: Uint8Array[] = [];\n\t\ti++;\n\n\t\twhile (i < messages.length && messages[i].role !== \"user\") {\n\t\t\tconst stepMsg = messages[i];\n\t\t\tif (stepMsg.role === \"assistant\") {\n\t\t\t\tfor (const item of stepMsg.content) {\n\t\t\t\t\tlet step: ConversationStep;\n\t\t\t\t\tif (item.type === \"text\") {\n\t\t\t\t\t\tif (!item.text) continue;\n\t\t\t\t\t\tstep = create(ConversationStepSchema, {\n\t\t\t\t\t\t\tmessage: {\n\t\t\t\t\t\t\t\tcase: \"assistantMessage\",\n\t\t\t\t\t\t\t\tvalue: create(AssistantMessageSchema, { text: item.text }),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t} else if (item.type === \"thinking\") {\n\t\t\t\t\t\t// Foreign/hidden reasoning never leaks into Cursor's turn\n\t\t\t\t\t\t// history as native thinking.\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} else if (item.type === \"toolCall\") {\n\t\t\t\t\t\tstep = createCursorToolCallStep(item, toolResults.get(item.id));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tstepBlobIds.push(storeCursorBlob(blobStore, toBinary(ConversationStepSchema, step)));\n\t\t\t\t}\n\t\t\t} else if (stepMsg.role === \"toolResult\" && !pairedToolCallIds.has(stepMsg.toolCallId)) {\n\t\t\t\tconst text = toolResultToText(stepMsg);\n\t\t\t\tif (text) {\n\t\t\t\t\tconst prefix = stepMsg.isError ? \"[Tool Error]\" : \"[Tool Result]\";\n\t\t\t\t\tconst step = create(ConversationStepSchema, {\n\t\t\t\t\t\tmessage: {\n\t\t\t\t\t\t\tcase: \"assistantMessage\",\n\t\t\t\t\t\t\tvalue: create(AssistantMessageSchema, { text: `${prefix}\\n${text}` }),\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t\tstepBlobIds.push(storeCursorBlob(blobStore, toBinary(ConversationStepSchema, step)));\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\n\t\tconst agentTurn = create(AgentConversationTurnStructureSchema, {\n\t\t\tuserMessage: userMessageBlobId,\n\t\t\tsteps: stepBlobIds,\n\t\t});\n\t\tconst turn = create(ConversationTurnStructureSchema, {\n\t\t\tturn: {\n\t\t\t\tcase: \"agentConversationTurn\",\n\t\t\t\tvalue: agentTurn,\n\t\t\t},\n\t\t});\n\t\tturns.push(storeCursorBlob(blobStore, toBinary(ConversationTurnStructureSchema, turn)));\n\t}\n\n\treturn turns;\n}\n\n/** Exported for tests: decodes Cursor history blobs built from conversation messages. */\nexport function buildCursorHistoryForTest(\n\tmessages: Message[],\n\tactiveUserMessageIndex = findLastUserMessageIndex(messages),\n): {\n\trootPromptMessagesJson: unknown[];\n\tturnUserMessagesJson: unknown[];\n\tturnStepMessagesJson: unknown[][];\n} {\n\tconst blobStore = new Map<string, Uint8Array>();\n\tconst rootPromptMessagesJson = buildRootPromptMessagesJson(messages, [], blobStore, activeUserMessageIndex).map(\n\t\t(blobId) => JSON.parse(new TextDecoder().decode(readCursorBlob(blobStore, blobId))),\n\t);\n\tconst turnUserMessagesJson: unknown[] = [];\n\tconst turnStepMessagesJson: unknown[][] = [];\n\tfor (const turnBlobId of buildConversationTurns(messages, blobStore, activeUserMessageIndex)) {\n\t\tconst turn = fromBinary(ConversationTurnStructureSchema, readCursorBlob(blobStore, turnBlobId));\n\t\tif (turn.turn.case !== \"agentConversationTurn\") {\n\t\t\tcontinue;\n\t\t}\n\t\tconst userMessage = fromBinary(UserMessageSchema, readCursorBlob(blobStore, turn.turn.value.userMessage));\n\t\tturnUserMessagesJson.push(toJson(UserMessageSchema, userMessage));\n\t\tturnStepMessagesJson.push(\n\t\t\tturn.turn.value.steps.map((stepBlobId) => {\n\t\t\t\tconst step = fromBinary(ConversationStepSchema, readCursorBlob(blobStore, stepBlobId));\n\t\t\t\treturn toJson(ConversationStepSchema, step);\n\t\t\t}),\n\t\t);\n\t}\n\treturn { rootPromptMessagesJson, turnUserMessagesJson, turnStepMessagesJson };\n}\n\nfunction createCursorUserMessage(\n\tcontent: string | (TextContent | ImageContent)[],\n\ttext: string,\n\tmessageId = randomUUID() as string,\n) {\n\tconst images = typeof content === \"string\" ? [] : extractImages(content);\n\treturn create(UserMessageSchema, {\n\t\ttext,\n\t\tmessageId,\n\t\t...(images.length > 0\n\t\t\t? {\n\t\t\t\t\tselectedContext: create(SelectedContextSchema, {\n\t\t\t\t\t\tselectedImages: images,\n\t\t\t\t\t}),\n\t\t\t\t}\n\t\t\t: {}),\n\t});\n}\n\nfunction extractImages(content: (TextContent | ImageContent)[]) {\n\treturn content\n\t\t.filter((item): item is ImageContent => item.type === \"image\")\n\t\t.map((image) =>\n\t\t\tcreate(SelectedImageSchema, {\n\t\t\t\tuuid: randomUUID(),\n\t\t\t\tmimeType: image.mimeType,\n\t\t\t\tdataOrBlobId: {\n\t\t\t\t\tcase: \"data\",\n\t\t\t\t\tvalue: Uint8Array.from(atob(image.data), (c) => c.charCodeAt(0)),\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n}\n\nexport function measureCursorHistorySerializedBytes(\n\tmessages: Message[],\n\tactiveUserMessageIndex = findLastUserMessageIndex(messages),\n): number {\n\treturn buildCursorHistoryWireBytesForTest(messages, activeUserMessageIndex).reduce(\n\t\t(total, bytes) => total + bytes.byteLength,\n\t\t0,\n\t);\n}\nexport function buildCursorHistoryWireBytesForTest(\n\tmessages: Message[],\n\tactiveUserMessageIndex = findLastUserMessageIndex(messages),\n): Uint8Array[] {\n\tconst blobStore = new Map<string, Uint8Array>();\n\tbuildRootPromptMessagesJson(messages, [], blobStore, activeUserMessageIndex);\n\tbuildConversationTurns(messages, blobStore, activeUserMessageIndex);\n\treturn [...blobStore.values()];\n}\n"]}
|
|
@@ -193,7 +193,7 @@ export declare function buildMcpToolDefinitions(tools: Tool[] | undefined): McpT
|
|
|
193
193
|
*/
|
|
194
194
|
export declare function buildCursorSystemPromptJsons(systemPrompt: string | undefined, modelId?: string): string[];
|
|
195
195
|
/** Returns the serialized byte cost of Cursor's complete stored history representation. */
|
|
196
|
-
export { buildCursorHistoryWireBytesForTest, measureCursorHistorySerializedBytes
|
|
196
|
+
export { buildCursorHistoryWireBytesForTest, measureCursorHistorySerializedBytes } from "./cursor-agent/measure.ts";
|
|
197
197
|
/** Exported for tests: decodes Cursor history blobs built from conversation messages. */
|
|
198
198
|
export declare function buildCursorHistoryForTest(messages: Message[], activeUserMessageIndex?: number): {
|
|
199
199
|
rootPromptMessagesJson: unknown[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cursor-agent.d.ts","sourceRoot":"","sources":["../../src/api/cursor-agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AAMpC,OAAO,KAAK,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,EAAE,OAAO,EAAE,EAAE,CAAC;CAClC,CAsBA;AAoND,MAAM,WAAW,qBAAqB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,CAAC,MAAM,GAAG,OAAO,CAAC,EAAE,CAAC;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,OAAO,CAAC;CACvB;AAED;;;;;;GAMG;AACH,wBAAsB,uBAAuB,CAAC,OAAO,EAAE;IACtD,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,WAAW,CAAC;CACrB,GAAG,OAAO,CAAC,qBAAqB,EAAE,GAAG,IAAI,CAAC,CAqG1C"}
|
|
@@ -23,7 +23,6 @@ import { CURSOR_COMPOSER_PROMPT, isCursorComposerModel } from "../cursor/compose
|
|
|
23
23
|
import { calculateCost } from "../models.js";
|
|
24
24
|
import { registerSessionResourceCleanup } from "../session-resources.js";
|
|
25
25
|
import { clearStreamingPartialJson, kCursorExecResolved, kStreamingBlockIndex, kStreamingBlockKind, kStreamingEnvelopeId, kStreamingLastParseLen, kStreamingPartialJson, } from "../utils/block-symbols.js";
|
|
26
|
-
import { recordCursorContextLimit } from "../utils/cursor-context-limit.js";
|
|
27
26
|
import { AssistantMessageEventStream } from "../utils/event-stream.js";
|
|
28
27
|
import { providerHeadersToRecord } from "../utils/headers.js";
|
|
29
28
|
import { parseJsonWithRepair, parseStreamingJson } from "../utils/json-parse.js";
|
|
@@ -681,9 +680,6 @@ export const stream = (model, context, options) => {
|
|
|
681
680
|
openBlockState = state;
|
|
682
681
|
const onConversationCheckpoint = (checkpoint) => {
|
|
683
682
|
attemptSawCheckpoint = true;
|
|
684
|
-
// The server states this model's real ceiling here; the catalog only
|
|
685
|
-
// guesses it. The first checkpoint of a conversation reports 0.
|
|
686
|
-
recordCursorContextLimit(model.id, checkpoint.tokenDetails?.maxTokens);
|
|
687
683
|
conversationStateCache.set(conversationId, checkpoint);
|
|
688
684
|
};
|
|
689
685
|
const healthFailThresholdMs = options?.streamHealthFailThresholdMs ?? CURSOR_STREAM_HEALTH_FAIL_THRESHOLD_MS;
|
|
@@ -3609,7 +3605,7 @@ function buildConversationTurns(messages, blobStore, activeUserMessageIndex = fi
|
|
|
3609
3605
|
return turns;
|
|
3610
3606
|
}
|
|
3611
3607
|
/** Returns the serialized byte cost of Cursor's complete stored history representation. */
|
|
3612
|
-
export { buildCursorHistoryWireBytesForTest, measureCursorHistorySerializedBytes
|
|
3608
|
+
export { buildCursorHistoryWireBytesForTest, measureCursorHistorySerializedBytes } from "./cursor-agent/measure.js";
|
|
3613
3609
|
/** Exported for tests: decodes Cursor history blobs built from conversation messages. */
|
|
3614
3610
|
export function buildCursorHistoryForTest(messages, activeUserMessageIndex = findLastUserMessageIndex(messages)) {
|
|
3615
3611
|
const blobStore = new Map();
|