maka-agent 0.2.1-dev.91.20261018 → 0.2.2-dev.97.20261024
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/DISCLAIMER-WIP +1 -1
- package/LICENSE +15 -11
- package/README.md +173 -1
- package/README.zh-CN.md +156 -0
- package/THIRD_PARTY_NOTICES.txt +12 -12
- package/dist/cli-core.js +1 -0
- package/dist/pi-goal.js +13 -0
- package/dist/pi-tui-runner.js +44 -1
- package/dist/run-command-core.js +256 -48
- package/dist/run-session-command.js +534 -0
- package/dist/run-session-result.js +38 -0
- package/dist/run-turn-outcome.js +174 -0
- package/dist/runtime-host-cli.js +32 -17
- package/dist/runtime-host-run-command.js +53 -165
- package/dist/runtime-host-run-mcp.js +3 -0
- package/dist/runtime-host-session-channel.js +3 -1
- package/dist/runtime-host-session-driver.js +5 -0
- package/dist/runtime-host-setup-command.js +114 -7
- package/dist/tui-copy-catalog.js +24 -0
- package/native/runtime-host-windows-task-launcher/prebuilds/win32-x64/maka-runtime-host-task-launcher.exe +0 -0
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/docs/docs/api/Client.md +2 -0
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/core/connect.js +10 -4
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/core/symbols.js +1 -0
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/dispatcher/agent.js +6 -2
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/dispatcher/client-h1.js +0 -2
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/dispatcher/client-h2.js +0 -4
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/dispatcher/client.js +3 -2
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/dispatcher/dispatcher-base.js +12 -0
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/handler/cache-handler.js +48 -0
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/handler/deduplication-handler.js +57 -13
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/handler/redirect-handler.js +8 -1
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/interceptor/decompress.js +15 -5
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/cookies/index.js +3 -1
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/cookies/parse.js +138 -137
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/cookies/util.js +21 -2
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/eventsource/eventsource-stream.js +90 -9
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/eventsource/eventsource.js +4 -1
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/fetch/index.js +3 -3
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/infra/index.js +14 -0
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +5 -5
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/websocket/receiver.js +13 -0
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/package.json +1 -1
- package/node_modules/@maka/acp-executor-plugin/dist/acp-catalog-store.js +87 -0
- package/node_modules/@maka/acp-executor-plugin/dist/acp-catalog.js +98 -21
- package/node_modules/@maka/acp-executor-plugin/dist/index.js +90 -14
- package/node_modules/@maka/acp-executor-plugin/dist/plugin.mjs +3997 -56
- package/node_modules/@maka/core/dist/assistant-turn-ids.js +34 -0
- package/node_modules/@maka/core/dist/bot-chat-settings.js +10 -1
- package/node_modules/@maka/core/dist/event-wait-delivery.js +67 -0
- package/node_modules/@maka/core/dist/event-wait.js +75 -10
- package/node_modules/@maka/core/dist/executor-catalog.js +3 -1
- package/node_modules/@maka/core/dist/goal.js +54 -2
- package/node_modules/@maka/core/dist/model-catalog.js +19 -1
- package/node_modules/@maka/core/dist/model-metadata.generated.js +4 -14
- package/node_modules/@maka/core/dist/model-metadata.js +42 -1
- package/node_modules/@maka/core/dist/models-dev-projection.js +32 -1
- package/node_modules/@maka/core/dist/provider-registry.js +16 -2
- package/node_modules/@maka/core/dist/runtime-event-store.js +0 -1
- package/node_modules/@maka/core/dist/runtime-event.js +24 -2
- package/node_modules/@maka/core/dist/runtime-invocation.js +10 -0
- package/node_modules/@maka/core/dist/session-checkin.js +31 -0
- package/node_modules/@maka/core/dist/tool-ledger-scanner.js +1 -9
- package/node_modules/@maka/core/dist/tool-recovery-bundle.js +1 -14
- package/node_modules/@maka/core/dist/turn-origin.js +14 -2
- package/node_modules/@maka/core/dist/usage-stats/types.js +1 -0
- package/node_modules/@maka/core/package.json +3 -0
- package/node_modules/@maka/eval/node_modules/undici/README.md +25 -3
- package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/CacheStore.md +24 -9
- package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/Client.md +11 -6
- package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/Dispatcher.md +3 -0
- package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/Errors.md +76 -1
- package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/H2CClient.md +3 -2
- package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/Interceptors.md +28 -8
- package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/RedirectHandler.md +13 -10
- package/node_modules/@maka/eval/node_modules/undici/docs/docs/index.md +12 -12
- package/node_modules/@maka/eval/node_modules/undici/docs/docs/type-map.json +66 -66
- package/node_modules/@maka/eval/node_modules/undici/lib/cache/memory-cache-store.js +48 -13
- package/node_modules/@maka/eval/node_modules/undici/lib/cache/sqlite-cache-store.js +83 -5
- package/node_modules/@maka/eval/node_modules/undici/lib/core/connect.js +10 -4
- package/node_modules/@maka/eval/node_modules/undici/lib/core/constants.js +12 -1
- package/node_modules/@maka/eval/node_modules/undici/lib/core/errors.js +38 -1
- package/node_modules/@maka/eval/node_modules/undici/lib/core/request.js +16 -1
- package/node_modules/@maka/eval/node_modules/undici/lib/core/symbols.js +2 -0
- package/node_modules/@maka/eval/node_modules/undici/lib/core/util.js +26 -1
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/agent.js +6 -2
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/client-h1.js +116 -80
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/client-h2.js +124 -17
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/client.js +4 -1
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/dispatcher-base.js +3 -2
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +20 -3
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/parser-h1.js +1064 -0
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/pool-base.js +85 -31
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/pool.js +11 -8
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/proxy-agent.js +18 -8
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/retry-agent.js +10 -0
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/round-robin-pool.js +15 -5
- package/node_modules/@maka/eval/node_modules/undici/lib/handler/cache-handler.js +153 -15
- package/node_modules/@maka/eval/node_modules/undici/lib/handler/deduplication-handler.js +112 -51
- package/node_modules/@maka/eval/node_modules/undici/lib/handler/redirect-handler.js +28 -8
- package/node_modules/@maka/eval/node_modules/undici/lib/handler/retry-handler.js +44 -11
- package/node_modules/@maka/eval/node_modules/undici/lib/interceptor/cache.js +11 -3
- package/node_modules/@maka/eval/node_modules/undici/lib/interceptor/decompress.js +22 -9
- package/node_modules/@maka/eval/node_modules/undici/lib/interceptor/dns.js +11 -0
- package/node_modules/@maka/eval/node_modules/undici/lib/interceptor/response-error.js +72 -28
- package/node_modules/@maka/eval/node_modules/undici/lib/milo/LICENSE.md +7 -0
- package/node_modules/@maka/eval/node_modules/undici/lib/milo/no-simd.js +1002 -0
- package/node_modules/@maka/eval/node_modules/undici/lib/milo/simd.js +1002 -0
- package/node_modules/@maka/eval/node_modules/undici/lib/mock/mock-agent.js +11 -0
- package/node_modules/@maka/eval/node_modules/undici/lib/mock/snapshot-recorder.js +3 -2
- package/node_modules/@maka/eval/node_modules/undici/lib/mock/snapshot-utils.js +3 -2
- package/node_modules/@maka/eval/node_modules/undici/lib/util/cache.js +11 -5
- package/node_modules/@maka/eval/node_modules/undici/lib/web/cookies/util.js +19 -2
- package/node_modules/@maka/eval/node_modules/undici/lib/web/eventsource/eventsource-stream.js +69 -15
- package/node_modules/@maka/eval/node_modules/undici/lib/web/eventsource/eventsource.js +25 -2
- package/node_modules/@maka/eval/node_modules/undici/lib/web/fetch/body.js +47 -38
- package/node_modules/@maka/eval/node_modules/undici/lib/web/fetch/formdata-parser.js +12 -4
- package/node_modules/@maka/eval/node_modules/undici/lib/web/fetch/headers.js +2 -2
- package/node_modules/@maka/eval/node_modules/undici/lib/web/fetch/index.js +8 -4
- package/node_modules/@maka/eval/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +5 -5
- package/node_modules/@maka/eval/node_modules/undici/lib/web/websocket/receiver.js +25 -4
- package/node_modules/@maka/eval/node_modules/undici/package.json +9 -7
- package/node_modules/@maka/mcp/package.json +1 -1
- package/node_modules/@maka/runtime/dist/agent-run.js +5 -1
- package/node_modules/@maka/runtime/dist/agent-swarm-status-tool.js +0 -1
- package/node_modules/@maka/runtime/dist/ai-sdk-compaction.js +29 -15
- package/node_modules/@maka/runtime/dist/ai-sdk-message-projection.js +10 -1
- package/node_modules/@maka/runtime/dist/ai-sdk-turn.js +125 -131
- package/node_modules/@maka/runtime/dist/bots/bot-registry.js +19 -3
- package/node_modules/@maka/runtime/dist/bots/feishu-bridge.js +178 -6
- package/node_modules/@maka/runtime/dist/bots/wechat-bridge.js +163 -9
- package/node_modules/@maka/runtime/dist/context-budget-policy.js +9 -2
- package/node_modules/@maka/runtime/dist/event-wait-tool.js +69 -0
- package/node_modules/@maka/runtime/dist/goal-continuation.js +195 -117
- package/node_modules/@maka/runtime/dist/goal-state.js +8 -0
- package/node_modules/@maka/runtime/dist/history-compact-checkpoint.js +34 -4
- package/node_modules/@maka/runtime/dist/history-compaction.js +7 -0
- package/node_modules/@maka/runtime/dist/memory-extraction.js +0 -2
- package/node_modules/@maka/runtime/dist/model-factory.js +26 -6
- package/node_modules/@maka/runtime/dist/model-fetcher.js +8 -1
- package/node_modules/@maka/runtime/dist/model-history.js +16 -3
- package/node_modules/@maka/runtime/dist/openai-codex-history-compactor.js +15 -5
- package/node_modules/@maka/runtime/dist/plan-tools.js +0 -3
- package/node_modules/@maka/runtime/dist/plugin-executor-backend.js +49 -2
- package/node_modules/@maka/runtime/dist/plugin-executor-service.js +12 -3
- package/node_modules/@maka/runtime/dist/provider-error-classification.js +2 -0
- package/node_modules/@maka/runtime/dist/recovery-resolver.js +2 -1
- package/node_modules/@maka/runtime/dist/runtime-context.js +53 -0
- package/node_modules/@maka/runtime/dist/runtime-event-read-model.js +3 -0
- package/node_modules/@maka/runtime/dist/sandbox-boundary-path.js +79 -2
- package/node_modules/@maka/runtime/dist/session-checkin.js +331 -0
- package/node_modules/@maka/runtime/dist/session-event-runtime-mapper.js +7 -0
- package/node_modules/@maka/runtime/dist/session-manager.js +5 -1
- package/node_modules/@maka/runtime/dist/shell-run-manager.js +34 -0
- package/node_modules/@maka/runtime/dist/stream-graph-supervisor-tools.js +0 -3
- package/node_modules/@maka/runtime/dist/telemetry/builtin-pricing.js +21 -2
- package/node_modules/@maka/runtime/dist/tool-runtime.js +11 -2
- package/node_modules/@maka/runtime/dist/workers/filesystem-worker.mjs +50 -1
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/docs/docs/api/Client.md +2 -0
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/core/connect.js +10 -4
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/core/symbols.js +1 -0
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/dispatcher/agent.js +6 -2
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/dispatcher/client-h1.js +0 -2
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/dispatcher/client-h2.js +0 -4
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/dispatcher/client.js +3 -2
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/dispatcher/dispatcher-base.js +12 -0
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/handler/cache-handler.js +48 -0
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/handler/deduplication-handler.js +57 -13
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/handler/redirect-handler.js +8 -1
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/interceptor/decompress.js +15 -5
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/cookies/index.js +3 -1
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/cookies/parse.js +138 -137
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/cookies/util.js +21 -2
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/eventsource/eventsource-stream.js +90 -9
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/eventsource/eventsource.js +4 -1
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/fetch/index.js +3 -3
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/infra/index.js +14 -0
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +5 -5
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/websocket/receiver.js +13 -0
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/package.json +1 -1
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/package.json +1 -1
- package/node_modules/@maka/runtime/node_modules/undici/README.md +25 -3
- package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/CacheStore.md +24 -9
- package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/Client.md +11 -6
- package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/Dispatcher.md +3 -0
- package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/Errors.md +76 -1
- package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/H2CClient.md +3 -2
- package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/Interceptors.md +28 -8
- package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/RedirectHandler.md +13 -10
- package/node_modules/@maka/runtime/node_modules/undici/docs/docs/index.md +12 -12
- package/node_modules/@maka/runtime/node_modules/undici/docs/docs/type-map.json +66 -66
- package/node_modules/@maka/runtime/node_modules/undici/lib/cache/memory-cache-store.js +48 -13
- package/node_modules/@maka/runtime/node_modules/undici/lib/cache/sqlite-cache-store.js +83 -5
- package/node_modules/@maka/runtime/node_modules/undici/lib/core/connect.js +10 -4
- package/node_modules/@maka/runtime/node_modules/undici/lib/core/constants.js +12 -1
- package/node_modules/@maka/runtime/node_modules/undici/lib/core/errors.js +38 -1
- package/node_modules/@maka/runtime/node_modules/undici/lib/core/request.js +16 -1
- package/node_modules/@maka/runtime/node_modules/undici/lib/core/symbols.js +2 -0
- package/node_modules/@maka/runtime/node_modules/undici/lib/core/util.js +26 -1
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/agent.js +6 -2
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/client-h1.js +116 -80
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/client-h2.js +124 -17
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/client.js +4 -1
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/dispatcher-base.js +3 -2
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +20 -3
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/parser-h1.js +1064 -0
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/pool-base.js +85 -31
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/pool.js +11 -8
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/proxy-agent.js +18 -8
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/retry-agent.js +10 -0
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/round-robin-pool.js +15 -5
- package/node_modules/@maka/runtime/node_modules/undici/lib/handler/cache-handler.js +153 -15
- package/node_modules/@maka/runtime/node_modules/undici/lib/handler/deduplication-handler.js +112 -51
- package/node_modules/@maka/runtime/node_modules/undici/lib/handler/redirect-handler.js +28 -8
- package/node_modules/@maka/runtime/node_modules/undici/lib/handler/retry-handler.js +44 -11
- package/node_modules/@maka/runtime/node_modules/undici/lib/interceptor/cache.js +11 -3
- package/node_modules/@maka/runtime/node_modules/undici/lib/interceptor/decompress.js +22 -9
- package/node_modules/@maka/runtime/node_modules/undici/lib/interceptor/dns.js +11 -0
- package/node_modules/@maka/runtime/node_modules/undici/lib/interceptor/response-error.js +72 -28
- package/node_modules/@maka/runtime/node_modules/undici/lib/milo/LICENSE.md +7 -0
- package/node_modules/@maka/runtime/node_modules/undici/lib/milo/no-simd.js +1002 -0
- package/node_modules/@maka/runtime/node_modules/undici/lib/milo/simd.js +1002 -0
- package/node_modules/@maka/runtime/node_modules/undici/lib/mock/mock-agent.js +11 -0
- package/node_modules/@maka/runtime/node_modules/undici/lib/mock/snapshot-recorder.js +3 -2
- package/node_modules/@maka/runtime/node_modules/undici/lib/mock/snapshot-utils.js +3 -2
- package/node_modules/@maka/runtime/node_modules/undici/lib/util/cache.js +11 -5
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/cookies/util.js +19 -2
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/eventsource/eventsource-stream.js +69 -15
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/eventsource/eventsource.js +25 -2
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/fetch/body.js +47 -38
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/fetch/formdata-parser.js +12 -4
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/fetch/headers.js +2 -2
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/fetch/index.js +8 -4
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +5 -5
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/websocket/receiver.js +25 -4
- package/node_modules/@maka/runtime/node_modules/undici/package.json +9 -7
- package/node_modules/@maka/runtime/package.json +3 -0
- package/node_modules/@maka/runtime-host/dist/assistant/bot/bridge.js +8 -0
- package/node_modules/@maka/runtime-host/dist/assistant/bot/capabilities.js +1 -0
- package/node_modules/@maka/runtime-host/dist/assistant/bot/controller.js +92 -22
- package/node_modules/@maka/runtime-host/dist/assistant/bot/host.js +11 -2
- package/node_modules/@maka/runtime-host/dist/assistant/bot/store.js +71 -2
- package/node_modules/@maka/runtime-host/dist/assistant/bot/turn-ids.js +38 -0
- package/node_modules/@maka/runtime-host/dist/assistant/index-initiative/assistant.js +7 -0
- package/node_modules/@maka/runtime-host/dist/assistant/index-initiative/controller.js +193 -32
- package/node_modules/@maka/runtime-host/dist/assistant/index-initiative/discovery-capabilities.js +69 -0
- package/node_modules/@maka/runtime-host/dist/assistant/index-initiative/host.js +15 -28
- package/node_modules/@maka/runtime-host/dist/assistant/index-initiative/notebook.js +286 -0
- package/node_modules/@maka/runtime-host/dist/assistant/index-initiative/prompt.js +31 -6
- package/node_modules/@maka/runtime-host/dist/assistant/index-initiative/store.js +18 -1
- package/node_modules/@maka/runtime-host/dist/assistant/memory-network/controller.js +203 -71
- package/node_modules/@maka/runtime-host/dist/assistant/memory-network/host.js +21 -5
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/condition-observer.js +94 -0
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/condition-store.js +253 -0
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/condition.js +133 -0
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/controller.js +27 -14
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/delegation.js +37 -5
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/delivery.js +1 -1
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/host.js +16 -2
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/matter.js +13 -0
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/prompt.js +7 -5
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/review.js +68 -14
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/settlement-context.js +126 -0
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/store.js +92 -6
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/tools.js +93 -23
- package/node_modules/@maka/runtime-host/dist/assistant/service.js +72 -16
- package/node_modules/@maka/runtime-host/dist/client/host-profile.js +30 -1
- package/node_modules/@maka/runtime-host/dist/client/ssh-operator-activation.js +9 -2
- package/node_modules/@maka/runtime-host/dist/protocol/goal.js +119 -1
- package/node_modules/@maka/runtime-host/dist/protocol/index.js +10 -3
- package/node_modules/@maka/runtime-host/dist/protocol/operations.js +8 -1
- package/node_modules/@maka/runtime-host/dist/protocol/personal-assistant.js +1 -0
- package/node_modules/@maka/runtime-host/dist/protocol/plugin-platform.js +7 -1
- package/node_modules/@maka/runtime-host/dist/protocol/session-checkin.js +133 -0
- package/node_modules/@maka/runtime-host/dist/server/agent-settings-tools.js +0 -1
- package/node_modules/@maka/runtime-host/dist/server/canonical-session-projection.js +3 -2
- package/node_modules/@maka/runtime-host/dist/server/event-wait-manager.js +151 -20
- package/node_modules/@maka/runtime-host/dist/server/event-wait-observation-store.js +19 -0
- package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +127 -11
- package/node_modules/@maka/runtime-host/dist/server/execution-model-authority.js +47 -3
- package/node_modules/@maka/runtime-host/dist/server/execution-model-composition.js +11 -0
- package/node_modules/@maka/runtime-host/dist/server/external-session-coordinator.js +5 -2
- package/node_modules/@maka/runtime-host/dist/server/goal-coordinator.js +343 -53
- package/node_modules/@maka/runtime-host/dist/server/goal-event-waits.js +457 -0
- package/node_modules/@maka/runtime-host/dist/server/goal-execution-coordinator.js +23 -6
- package/node_modules/@maka/runtime-host/dist/server/goal-projection.js +24 -3
- package/node_modules/@maka/runtime-host/dist/server/hosted-execution-recovery.js +5 -1
- package/node_modules/@maka/runtime-host/dist/server/index.js +2 -0
- package/node_modules/@maka/runtime-host/dist/server/interactive-run-composer.js +44 -2
- package/node_modules/@maka/runtime-host/dist/server/personal-assistant-workspace.js +78 -0
- package/node_modules/@maka/runtime-host/dist/server/root-turn-coordinator.js +8 -0
- package/node_modules/@maka/runtime-host/dist/server/session-catalog-coordinator.js +73 -3
- package/node_modules/@maka/runtime-host/dist/server/session-checkin.js +257 -0
- package/node_modules/@maka/runtime-host/dist/server/session-checkpoint-coordinator.js +282 -0
- package/node_modules/@maka/runtime-host/dist/server/session-checkpoint-publication.js +250 -0
- package/node_modules/@maka/runtime-host/dist/server/shell-run-event-wait-access.js +166 -0
- package/node_modules/@maka/runtime-host/dist/server/shell-run-event-wait-adapter.js +59 -0
- package/node_modules/@maka/runtime-host/dist/server/skill-catalog-repository.js +4 -2
- package/node_modules/@maka/storage/dist/agent-run-store-contract.js +14 -3
- package/node_modules/@maka/storage/dist/agent-run-store.js +10 -0
- package/node_modules/@maka/storage/dist/codex-session-adapter.js +20 -3
- package/node_modules/@maka/storage/dist/context-offload-snapshot.js +2 -1
- package/node_modules/@maka/storage/dist/event-wait-authority.js +18 -1
- package/node_modules/@maka/storage/dist/event-wait-bridge.js +336 -0
- package/node_modules/@maka/storage/dist/execution-stores.js +39 -1
- package/node_modules/@maka/storage/dist/external-session-images.js +131 -0
- package/node_modules/@maka/storage/dist/external-session-importer.js +12 -2
- package/node_modules/@maka/storage/dist/goal-authority.js +2 -0
- package/node_modules/@maka/storage/dist/local-execution-persistence.js +27 -1
- package/node_modules/@maka/storage/dist/operational-state-store.js +1 -1
- package/node_modules/@maka/storage/dist/production-session-snapshot.js +14 -6
- package/node_modules/@maka/storage/dist/runtime-event-persistence.js +1 -0
- package/node_modules/@maka/storage/dist/session-bundle-policy.js +116 -16
- package/node_modules/@maka/storage/dist/session-checkpoint-publication-store.js +204 -0
- package/node_modules/@maka/storage/dist/session-store.js +37 -8
- package/node_modules/@maka/storage/dist/snapshot-operation-gate.js +65 -0
- package/node_modules/@maka/storage/dist/sqlite-context-offload-schema.js +3 -3
- package/node_modules/@maka/storage/dist/sqlite-context-offload-store.js +4 -2
- package/node_modules/@maka/storage/dist/sqlite-event-wait-authority.js +81 -8
- package/node_modules/@maka/storage/dist/sqlite-event-wait-bridge.js +94 -0
- package/node_modules/@maka/storage/dist/sqlite-reclamation-checkpoint.js +37 -0
- package/node_modules/@maka/storage/dist/sqlite-runtime-schema.js +7 -8
- package/node_modules/@maka/storage/dist/sqlite-runtime-store.js +38 -162
- package/node_modules/@maka/storage/dist/sqlite-workflow-schema.js +7 -4
- package/node_modules/@maka/storage/dist/tool-commit-validation.js +1 -1
- package/node_modules/@maka/storage/package.json +4 -0
- package/node_modules/@modelcontextprotocol/client/dist/index-B-4n9P0J.d.mts.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/index-J2FaQ-KY.d.cts.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/index.cjs +76 -22
- package/node_modules/@modelcontextprotocol/client/dist/index.d.cts.map +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/index.d.mts.map +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/index.mjs +76 -22
- package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.cjs +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.mjs +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/{src-oZBjf3U1.cjs → src-DpAS0jfg.cjs} +105 -8
- package/node_modules/@modelcontextprotocol/client/dist/{src-xKF0PJN-.mjs → src-WCy6ifGf.mjs} +88 -9
- package/node_modules/@modelcontextprotocol/client/dist/stdio.cjs +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/stdio.mjs +1 -1
- package/node_modules/@modelcontextprotocol/client/node_modules/@modelcontextprotocol/core/package.json +2 -2
- package/node_modules/@modelcontextprotocol/client/package.json +5 -5
- package/node_modules/fast-uri/.github/workflows/release.yml +35 -0
- package/node_modules/fast-uri/README.md +8 -0
- package/node_modules/fast-uri/index.js +98 -18
- package/node_modules/fast-uri/lib/utils.js +52 -0
- package/node_modules/fast-uri/package.json +1 -1
- package/node_modules/follow-redirects/index.js +10 -1
- package/node_modules/follow-redirects/package.json +1 -1
- package/node_modules/ip-address/README.md +104 -104
- package/node_modules/ip-address/dist/ipv4.js +7 -0
- package/node_modules/ip-address/dist/ipv6.js +7 -4
- package/node_modules/ip-address/dist/v6/constants.js +3 -0
- package/node_modules/ip-address/package.json +2 -1
- package/node_modules/undici/README.md +25 -3
- package/node_modules/undici/docs/docs/api/CacheStore.md +24 -9
- package/node_modules/undici/docs/docs/api/Client.md +11 -6
- package/node_modules/undici/docs/docs/api/Dispatcher.md +3 -0
- package/node_modules/undici/docs/docs/api/Errors.md +76 -1
- package/node_modules/undici/docs/docs/api/H2CClient.md +3 -2
- package/node_modules/undici/docs/docs/api/Interceptors.md +28 -8
- package/node_modules/undici/docs/docs/api/RedirectHandler.md +13 -10
- package/node_modules/undici/docs/docs/index.md +12 -12
- package/node_modules/undici/docs/docs/type-map.json +66 -66
- package/node_modules/undici/lib/cache/memory-cache-store.js +48 -13
- package/node_modules/undici/lib/cache/sqlite-cache-store.js +83 -5
- package/node_modules/undici/lib/core/connect.js +10 -4
- package/node_modules/undici/lib/core/constants.js +12 -1
- package/node_modules/undici/lib/core/errors.js +38 -1
- package/node_modules/undici/lib/core/request.js +16 -1
- package/node_modules/undici/lib/core/symbols.js +2 -0
- package/node_modules/undici/lib/core/util.js +26 -1
- package/node_modules/undici/lib/dispatcher/agent.js +6 -2
- package/node_modules/undici/lib/dispatcher/client-h1.js +116 -80
- package/node_modules/undici/lib/dispatcher/client-h2.js +124 -17
- package/node_modules/undici/lib/dispatcher/client.js +4 -1
- package/node_modules/undici/lib/dispatcher/dispatcher-base.js +3 -2
- package/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +20 -3
- package/node_modules/undici/lib/dispatcher/parser-h1.js +1064 -0
- package/node_modules/undici/lib/dispatcher/pool-base.js +85 -31
- package/node_modules/undici/lib/dispatcher/pool.js +11 -8
- package/node_modules/undici/lib/dispatcher/proxy-agent.js +18 -8
- package/node_modules/undici/lib/dispatcher/retry-agent.js +10 -0
- package/node_modules/undici/lib/dispatcher/round-robin-pool.js +15 -5
- package/node_modules/undici/lib/handler/cache-handler.js +153 -15
- package/node_modules/undici/lib/handler/deduplication-handler.js +112 -51
- package/node_modules/undici/lib/handler/redirect-handler.js +28 -8
- package/node_modules/undici/lib/handler/retry-handler.js +44 -11
- package/node_modules/undici/lib/interceptor/cache.js +11 -3
- package/node_modules/undici/lib/interceptor/decompress.js +22 -9
- package/node_modules/undici/lib/interceptor/dns.js +11 -0
- package/node_modules/undici/lib/interceptor/response-error.js +72 -28
- package/node_modules/undici/lib/milo/LICENSE.md +7 -0
- package/node_modules/undici/lib/milo/no-simd.js +1002 -0
- package/node_modules/undici/lib/milo/simd.js +1002 -0
- package/node_modules/undici/lib/mock/mock-agent.js +11 -0
- package/node_modules/undici/lib/mock/snapshot-recorder.js +3 -2
- package/node_modules/undici/lib/mock/snapshot-utils.js +3 -2
- package/node_modules/undici/lib/util/cache.js +11 -5
- package/node_modules/undici/lib/web/cookies/util.js +19 -2
- package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +69 -15
- package/node_modules/undici/lib/web/eventsource/eventsource.js +25 -2
- package/node_modules/undici/lib/web/fetch/body.js +47 -38
- package/node_modules/undici/lib/web/fetch/formdata-parser.js +12 -4
- package/node_modules/undici/lib/web/fetch/headers.js +2 -2
- package/node_modules/undici/lib/web/fetch/index.js +8 -4
- package/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +5 -5
- package/node_modules/undici/lib/web/websocket/receiver.js +25 -4
- package/node_modules/undici/package.json +9 -7
- package/node_modules/zod/package.json +1 -1
- package/node_modules/zod/v4/core/compile.cjs +8 -0
- package/node_modules/zod/v4/core/compile.js +8 -0
- package/node_modules/zod/v4/core/schemas.cjs +30 -0
- package/node_modules/zod/v4/core/schemas.js +30 -0
- package/node_modules/zod/v4/core/util.cjs +15 -0
- package/node_modules/zod/v4/core/util.js +14 -0
- package/node_modules/zod/v4/core/versions.cjs +1 -1
- package/node_modules/zod/v4/core/versions.js +1 -1
- package/package.json +2 -2
- package/node_modules/@modelcontextprotocol/client/dist/index-D_CiY-T3.d.cts.map +0 -1
- package/node_modules/@modelcontextprotocol/client/dist/index-D_QDtbiv.d.mts.map +0 -1
|
@@ -17,24 +17,27 @@
|
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
19
|
import { randomUUID } from 'node:crypto';
|
|
20
|
+
import { lstat, readFile, realpath } from 'node:fs/promises';
|
|
20
21
|
import { homedir } from 'node:os';
|
|
21
22
|
import { join, resolve } from 'node:path';
|
|
23
|
+
import { DatabaseSync } from 'node:sqlite';
|
|
22
24
|
import { isDeepStrictEqual } from 'node:util';
|
|
25
|
+
import { zstdCompressSync, zstdDecompressSync } from 'node:zlib';
|
|
23
26
|
import { truncateUtf8 } from '@maka/core/diagnostic-log';
|
|
24
27
|
import { generalizedErrorMessage } from '@maka/core/redaction';
|
|
25
28
|
import { activateRuntimeHostManagedDeployment, connectRemoteRuntimeHost, ensureRuntimeHostPeerIdentity, RuntimeHostOperationError, } from '@maka/runtime-host/client';
|
|
26
|
-
import { RuntimeHostManagedDeploymentError as RuntimeHostDeploymentAuthorityError, encodeRuntimeHostSetupFrame, isSha512PackageIntegrity, resolveRuntimeHostManagedDeployment, resolveRuntimeHostManagedDeploymentAuthority, runtimeHostManagedOperatorCommand, RUNTIME_HOST_SETUP_ERROR_CODE_MAX_BYTES, RUNTIME_HOST_SETUP_ERROR_MESSAGE_MAX_BYTES, } from '@maka/runtime-host/operator';
|
|
29
|
+
import { RuntimeHostManagedDeploymentError as RuntimeHostDeploymentAuthorityError, encodeRuntimeHostSetupFrame, isSha512PackageIntegrity, resolveRuntimeHostManagedDeployment, resolveRuntimeHostManagedDeploymentAuthority, runtimeHostManagedOperatorCommand, runtimeHostManagedOperatorModulePath, RUNTIME_HOST_SETUP_ERROR_CODE_MAX_BYTES, RUNTIME_HOST_SETUP_ERROR_MESSAGE_MAX_BYTES, } from '@maka/runtime-host/operator';
|
|
27
30
|
import { INTERACTIVE_RUNTIME_HOST_COMPOSITION_ID, RUNTIME_HOST_PROTOCOL_VERSION, } from '@maka/runtime-host/protocol';
|
|
28
31
|
import { prepareRuntimeHostAccessCredential, replaceRuntimeHostAccessCredential, revokeRuntimeHostAccessCredential, RuntimeHostAccessUnavailableError, } from './runtime-host-access-command.js';
|
|
29
32
|
import { convergeRuntimeHostManagedOperator, verifyRuntimeHostManagedOperator, isRuntimeHostDevelopmentPackageVersion, openRuntimeHostManagedPackageDeployment, prepareRuntimeHostManagedPackageDeployment, pruneRuntimeHostManagedPackages, removeRuntimeHostManagedDeployment, resolveRuntimeHostManagedPackageCliPath, resolveRuntimeHostManagedControlRoot, resolveRuntimeHostManagedDeploymentRoot, restoreRuntimeHostLegacyManagedOperator, RuntimeHostManagedDeploymentError, } from './runtime-host-managed-deployment.js';
|
|
30
33
|
import { RuntimeHostUpdatePackageError, withRuntimeHostRegistryUpdatePackage, } from './runtime-host-update-package.js';
|
|
31
34
|
import { readRuntimeHostManagedUpdatePolicy, writeRuntimeHostManagedUpdatePolicy, } from './runtime-host-update-policy-store.js';
|
|
32
35
|
import { resolveRuntimeHostRegistryUpdateCandidate, RuntimeHostUpdateDiscoveryError, } from './runtime-host-update-discovery.js';
|
|
33
|
-
import { repairStorageRootAfterRemount, resolveStorageRoot } from '@maka/storage/root-authority';
|
|
36
|
+
import { repairStorageRootAfterRemount, resolveStorageRoot, tryAcquireStateRootOwner, } from '@maka/storage/root-authority';
|
|
34
37
|
import { createPlatformRuntimeHostServiceBackend, discoverRuntimeHostLifecycleProvider, resolveRuntimeHostLifecycleProvider, } from './runtime-host-service-management-command.js';
|
|
35
38
|
import { allocateRuntimeHostLoopbackPort, allocateRuntimeHostPeerPort, effectiveRuntimeHostProjectDirectoryRoots, manageRuntimeHostService, readRuntimeHostManagedServiceConfig, removeRuntimeHostServiceFile, resolveRuntimeHostManagedServiceConfigPath, resolveRuntimeHostManagedServiceId, resolveRuntimeHostManagedProjectDirectoryRoots, RuntimeHostServiceManagerError, withRuntimeHostManagedServiceDeploymentLock, withRuntimeHostManagedServiceLifecycleLock, } from './runtime-host-service-manager.js';
|
|
36
39
|
import { expandWildcardListenAddresses } from './runtime-host-peer-management-command.js';
|
|
37
|
-
import { canDiscardRuntimeHostLifecycleDesiredArtifacts, replaceRuntimeHostLifecycle, resolveRecoverableRuntimeHostManagedDeployment, RUNTIME_HOST_READY_TIMEOUT_MS, RuntimeHostLifecycleTransactionError, } from './runtime-host-lifecycle-transaction.js';
|
|
40
|
+
import { applyRuntimeHostLifecycleTransition, canDiscardRuntimeHostLifecycleDesiredArtifacts, recoverRuntimeHostLifecycleTransition, replaceRuntimeHostLifecycle, resolveRecoverableRuntimeHostManagedDeployment, RUNTIME_HOST_READY_TIMEOUT_MS, RuntimeHostLifecycleTransactionError, } from './runtime-host-lifecycle-transaction.js';
|
|
38
41
|
import { resolveRuntimeHostManagedPeerKeyPath, resolveRuntimeHostNativePath, } from './runtime-host-peer-artifact.js';
|
|
39
42
|
import { activateRuntimeHostManagedDeploymentWithReconciliation } from './runtime-host-activation-command.js';
|
|
40
43
|
const SETUP_LOCK_TIMEOUT_MS = 5 * 60_000;
|
|
@@ -73,6 +76,8 @@ async function resolveRuntimeHostSetupPackage(options, deps) {
|
|
|
73
76
|
}
|
|
74
77
|
export async function runRuntimeHostSetupCli(options, overrides = {}) {
|
|
75
78
|
const deps = {
|
|
79
|
+
isWsl: async () => process.platform === 'linux' &&
|
|
80
|
+
/microsoft/i.test(await readFile('/proc/sys/kernel/osrelease', 'utf8')),
|
|
76
81
|
manageService: manageRuntimeHostService,
|
|
77
82
|
createBackend: createPlatformRuntimeHostServiceBackend,
|
|
78
83
|
discoverLifecycleProvider: discoverRuntimeHostLifecycleProvider,
|
|
@@ -105,6 +110,9 @@ export async function runRuntimeHostSetupCli(options, overrides = {}) {
|
|
|
105
110
|
};
|
|
106
111
|
const emit = createEmitter(options.json, deps);
|
|
107
112
|
try {
|
|
113
|
+
if (options.expectedExisting && !(await deps.isWsl())) {
|
|
114
|
+
throw new RuntimeHostSetupError('invalid_setup', 'Missing Node recovery is available only in WSL');
|
|
115
|
+
}
|
|
108
116
|
const rootId = await resolveRuntimeHostSetupRootId(options);
|
|
109
117
|
const controlRoot = resolveRuntimeHostManagedControlRoot(rootId);
|
|
110
118
|
await withRuntimeHostManagedServiceDeploymentLock(options.clientDataRoot, () => withRuntimeHostManagedServiceLifecycleLock(options.clientDataRoot, () => withRuntimeHostManagedServiceDeploymentLock(controlRoot, () => withRuntimeHostManagedServiceLifecycleLock(controlRoot, () => runRuntimeHostSetupLocked(options, deps, emit, rootId), SETUP_LOCK_TIMEOUT_MS), SETUP_LOCK_TIMEOUT_MS), SETUP_LOCK_TIMEOUT_MS), SETUP_LOCK_TIMEOUT_MS);
|
|
@@ -117,6 +125,17 @@ export async function runRuntimeHostSetupCli(options, overrides = {}) {
|
|
|
117
125
|
}
|
|
118
126
|
}
|
|
119
127
|
async function resolveRuntimeHostSetupRootId(options) {
|
|
128
|
+
if (options.expectedExisting) {
|
|
129
|
+
if (!options.reuseExistingEnvironment) {
|
|
130
|
+
throw new RuntimeHostSetupError('invalid_setup', 'Node recovery requires an existing Root and POSIX Node operator');
|
|
131
|
+
}
|
|
132
|
+
if (!(await resolveRuntimeHostManagedDeploymentAuthority(options.expectedExisting.rootId, {
|
|
133
|
+
...(options.repairRootAfterRemount ? { repairRootAfterRemount: true } : {}),
|
|
134
|
+
}))) {
|
|
135
|
+
throw new RuntimeHostSetupError('not_installed', 'The requested WSL deployment is not installed');
|
|
136
|
+
}
|
|
137
|
+
return options.expectedExisting.rootId;
|
|
138
|
+
}
|
|
120
139
|
const legacyRootPath = (await readOptionalLegacyServiceConfig(options.clientDataRoot))?.rootPath;
|
|
121
140
|
const path = resolve(options.rootPath ??
|
|
122
141
|
legacyRootPath ??
|
|
@@ -145,11 +164,16 @@ async function runRuntimeHostSetupLocked(options, deps, emit, rootId) {
|
|
|
145
164
|
}
|
|
146
165
|
const existing = await resolveRuntimeHostManagedDeploymentAuthority(rootId);
|
|
147
166
|
if (existing) {
|
|
148
|
-
const {
|
|
167
|
+
const { capability } = existing;
|
|
149
168
|
assertCanonicalSetupTarget(options.expectedTarget, rootId, capability.canonicalPath);
|
|
150
|
-
assertExpectedDeploymentGeneration(options.expectedTarget,
|
|
151
|
-
|
|
152
|
-
|
|
169
|
+
assertExpectedDeploymentGeneration(options.expectedTarget, existing.record.state === 'active'
|
|
170
|
+
? existing.record
|
|
171
|
+
: (existing.record.from ?? existing.record.to ?? undefined));
|
|
172
|
+
const config = options.expectedExisting
|
|
173
|
+
? await repairMissingWslNode(rootId, options.expectedExisting.operator, deps)
|
|
174
|
+
: (await resolveRuntimeHostManagedDeployment(rootId)).config;
|
|
175
|
+
// Ordinary discovery retains an older launcher; only explicit missing-Node
|
|
176
|
+
// recovery rewrites it, without replacing the installed package.
|
|
153
177
|
emit({
|
|
154
178
|
kind: 'existing_environment',
|
|
155
179
|
version: config.launch.package.version,
|
|
@@ -161,6 +185,9 @@ async function runRuntimeHostSetupLocked(options, deps, emit, rootId) {
|
|
|
161
185
|
});
|
|
162
186
|
return;
|
|
163
187
|
}
|
|
188
|
+
if (options.expectedExisting) {
|
|
189
|
+
throw new RuntimeHostSetupError('not_installed', 'The requested WSL deployment is not installed');
|
|
190
|
+
}
|
|
164
191
|
}
|
|
165
192
|
if (options.lifecycle === 'on_demand') {
|
|
166
193
|
await runRuntimeHostOnDemandSetupLocked(options, deps, emit);
|
|
@@ -169,6 +196,86 @@ async function runRuntimeHostSetupLocked(options, deps, emit, rootId) {
|
|
|
169
196
|
const target = await runRuntimeHostSupervisedSetupLocked(options, deps, emit);
|
|
170
197
|
await pairAndVerifyRuntimeHostSetup(options, target, deps, emit);
|
|
171
198
|
}
|
|
199
|
+
/** Called only after Desktop has proved its saved Node is missing. */
|
|
200
|
+
async function repairMissingWslNode(rootId, expected, deps) {
|
|
201
|
+
const [major, minor] = process.versions.node.split('.').map(Number);
|
|
202
|
+
if (!(major >= 24 || (major === 22 && minor >= 19)) ||
|
|
203
|
+
typeof DatabaseSync !== 'function' ||
|
|
204
|
+
typeof zstdCompressSync !== 'function' ||
|
|
205
|
+
typeof zstdDecompressSync !== 'function') {
|
|
206
|
+
throw new RuntimeHostSetupError('activation_failed', 'The Node found by the WSL login shell cannot run this Runtime Host');
|
|
207
|
+
}
|
|
208
|
+
const nodePath = await realpath(process.execPath);
|
|
209
|
+
const resolved = await resolveRuntimeHostManagedDeploymentAuthority(rootId);
|
|
210
|
+
if (!resolved)
|
|
211
|
+
throw new RuntimeHostSetupError('activation_failed', 'WSL deployment is absent or requires transaction recovery');
|
|
212
|
+
const { record } = resolved;
|
|
213
|
+
const current = record.state === 'active' ? record : record.from;
|
|
214
|
+
// Only this operation's Node-only plan may be recovered without retiring a Host.
|
|
215
|
+
if (record.state !== 'active' &&
|
|
216
|
+
(record.operation !== 'configure' ||
|
|
217
|
+
record.recovery !== 'restore_from' ||
|
|
218
|
+
!record.from ||
|
|
219
|
+
!record.to ||
|
|
220
|
+
record.from.launch.nodePath !== expected.nodePath ||
|
|
221
|
+
!isDeepStrictEqual(record.to, {
|
|
222
|
+
...record.from,
|
|
223
|
+
configRevision: record.from.configRevision + 1,
|
|
224
|
+
launch: { ...record.from.launch, nodePath: record.to.launch.nodePath },
|
|
225
|
+
})))
|
|
226
|
+
throw new RuntimeHostSetupError('activation_failed', 'WSL deployment is absent or requires transaction recovery');
|
|
227
|
+
if (!current ||
|
|
228
|
+
current.lifecycle.mode !== 'on_demand' ||
|
|
229
|
+
runtimeHostManagedOperatorModulePath(current.deploymentRoot, 'posix') !== expected.modulePath) {
|
|
230
|
+
throw new RuntimeHostSetupError('activation_failed', 'WSL Node recovery does not match the on-demand deployment');
|
|
231
|
+
}
|
|
232
|
+
// A stale Desktop binding may be retried after another repair committed.
|
|
233
|
+
if (current.launch.nodePath !== expected.nodePath) {
|
|
234
|
+
if (await missingNode(current.launch.nodePath))
|
|
235
|
+
throw new RuntimeHostSetupError('activation_failed', 'WSL deployment Node binding changed; reconnect its current profile');
|
|
236
|
+
return current;
|
|
237
|
+
}
|
|
238
|
+
const owner = await tryAcquireStateRootOwner(resolved.capability);
|
|
239
|
+
if (!owner)
|
|
240
|
+
throw new RuntimeHostSetupError('activation_failed', 'The WSL Host is still running; Node recovery will not interrupt it');
|
|
241
|
+
const lifecycle = {
|
|
242
|
+
convergeOperator: deps.convergeOperator,
|
|
243
|
+
verifyOperator: deps.verifyOperator,
|
|
244
|
+
resolveProvider: deps.resolveLifecycleProvider,
|
|
245
|
+
};
|
|
246
|
+
try {
|
|
247
|
+
if (!(await missingNode(current.launch.nodePath)))
|
|
248
|
+
throw new RuntimeHostSetupError('activation_failed', 'The saved WSL Node still exists; refusing to replace it');
|
|
249
|
+
if (record.state !== 'active')
|
|
250
|
+
await recoverRuntimeHostLifecycleTransition(owner, record, lifecycle);
|
|
251
|
+
const configured = await applyRuntimeHostLifecycleTransition(owner, {
|
|
252
|
+
operation: 'configure',
|
|
253
|
+
current,
|
|
254
|
+
desired: {
|
|
255
|
+
...current,
|
|
256
|
+
configRevision: current.configRevision + 1,
|
|
257
|
+
launch: { ...current.launch, nodePath },
|
|
258
|
+
},
|
|
259
|
+
}, lifecycle);
|
|
260
|
+
if (!configured)
|
|
261
|
+
throw new RuntimeHostSetupError('activation_failed', 'WSL Node recovery did not retain the deployment');
|
|
262
|
+
return configured;
|
|
263
|
+
}
|
|
264
|
+
finally {
|
|
265
|
+
await owner.close();
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
async function missingNode(path) {
|
|
269
|
+
try {
|
|
270
|
+
await lstat(path);
|
|
271
|
+
return false;
|
|
272
|
+
}
|
|
273
|
+
catch (error) {
|
|
274
|
+
if (error instanceof Error && 'code' in error && error.code === 'ENOENT')
|
|
275
|
+
return true;
|
|
276
|
+
throw error;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
172
279
|
async function runRuntimeHostSupervisedSetupLocked(options, deps, emit) {
|
|
173
280
|
emit({ kind: 'progress', phase: 'checking_environment' });
|
|
174
281
|
const legacyServiceId = resolveRuntimeHostManagedServiceId(options.clientDataRoot);
|
package/dist/tui-copy-catalog.js
CHANGED
|
@@ -482,7 +482,31 @@ const TUI_COPY_RESOURCES_TODO_EN = {
|
|
|
482
482
|
loading: 'Loading Todo…',
|
|
483
483
|
hint: '↑↓/PgUp/PgDn scroll · Home/End · Esc close',
|
|
484
484
|
};
|
|
485
|
+
const TUI_COPY_RESOURCES_GOAL_EN = {
|
|
486
|
+
cancelWaitBusy: 'Wait for the current action to finish, then cancel the wait.',
|
|
487
|
+
noCancellableWait: 'No cancellable event wait.',
|
|
488
|
+
waitCancelled: 'Wait cancelled. Goal paused; the background task keeps running.',
|
|
489
|
+
waitChanged: 'The wait changed or its continuation was admitted. Use /goal to inspect the current state.',
|
|
490
|
+
usage: 'Usage: /goal [pause|resume|clear|cancel-wait]',
|
|
491
|
+
};
|
|
485
492
|
export const TUI_COPY_RESOURCES = {
|
|
493
|
+
goal: resolveUiMessageCatalog(defineShippedUiMessageCatalog()({
|
|
494
|
+
en: TUI_COPY_RESOURCES_GOAL_EN,
|
|
495
|
+
'zh-CN': {
|
|
496
|
+
cancelWaitBusy: '请等待当前操作完成,再取消等待。',
|
|
497
|
+
noCancellableWait: '没有可取消的事件等待。',
|
|
498
|
+
waitCancelled: '等待已取消,目标已暂停;后台任务继续运行。',
|
|
499
|
+
waitChanged: '等待状态已变化,或后续执行已获准启动。请使用 /goal 查看当前状态。',
|
|
500
|
+
usage: '用法:/goal [pause|resume|clear|cancel-wait]',
|
|
501
|
+
},
|
|
502
|
+
'zh-TW': {
|
|
503
|
+
cancelWaitBusy: '請等待目前操作完成,再取消等待。',
|
|
504
|
+
noCancellableWait: '沒有可取消的事件等待。',
|
|
505
|
+
waitCancelled: '等待已取消,目標已暫停;背景任務繼續執行。',
|
|
506
|
+
waitChanged: '等待狀態已變更,或後續執行已獲准啟動。請使用 /goal 檢視目前狀態。',
|
|
507
|
+
usage: '用法:/goal [pause|resume|clear|cancel-wait]',
|
|
508
|
+
},
|
|
509
|
+
})),
|
|
486
510
|
todo: resolveUiMessageCatalog(defineShippedUiMessageCatalog()({
|
|
487
511
|
en: TUI_COPY_RESOURCES_TODO_EN,
|
|
488
512
|
'zh-CN': {
|
|
Binary file
|
|
@@ -27,6 +27,8 @@ Returns: `Client`
|
|
|
27
27
|
* **webSocket** `WebSocketOptions` (optional) - WebSocket-specific configuration options.
|
|
28
28
|
* **maxFragments** `number` (optional) - Default: `131072` - Maximum number of fragments in a message. Set to 0 to disable the limit.
|
|
29
29
|
* **maxPayloadSize** `number` (optional) - Default: `134217728` (128 MB) - Maximum allowed payload size in bytes for WebSocket messages. Applied to uncompressed messages, compressed frame payloads, and decompressed (permessage-deflate) messages. Set to 0 to disable the limit.
|
|
30
|
+
* **eventSource** `EventSourceOptions` (optional) - EventSource-specific configuration options.
|
|
31
|
+
* **maxEventSize** `number` (optional) - The maximum total bytes of data and metadata field values retained for a pending EventSource event. Each unfinished line is separately limited to this value plus seven syntax bytes. The number of `data:` lines per event and input chunks buffered for an unfinished line are each limited to `min(131072, max(1024, floor(maxEventSize / 128)))` to bound object overhead. Set to `0` to disable these limits. Default: `buffer.kStringMaxLength`.
|
|
30
32
|
* **pipelining** `number | null` (optional) - Default: `1` - The amount of concurrent requests to be sent over the single TCP/TLS connection according to [RFC7230](https://tools.ietf.org/html/rfc7230#section-6.3.2). Carefully consider your workload and environment before enabling concurrent requests as pipelining may reduce performance if used incorrectly. Pipelining is sensitive to network stack settings as well as head of line blocking caused by e.g. long running requests. Set to `0` to disable keep-alive connections.
|
|
31
33
|
* **connect** `ConnectOptions | Function | null` (optional) - Default: `null`.
|
|
32
34
|
* **strictContentLength** `Boolean` (optional) - Default: `true` - Whether to treat request content length mismatches as errors. If true, an error is thrown when the request content-length header doesn't match the length of the request body. **Security Warning:** Disabling this option can expose your application to HTTP Request Smuggling attacks, where mismatched content-length headers cause servers and proxies to interpret request boundaries differently. This can lead to cache poisoning, credential hijacking, and bypassing security controls. Only disable this in controlled environments where you fully trust the request source.
|
|
@@ -41,16 +41,22 @@ const SessionCache = class WeakSessionCache {
|
|
|
41
41
|
if (this._sessionCache.has(sessionKey)) {
|
|
42
42
|
this._sessionCache.delete(sessionKey)
|
|
43
43
|
} else if (this._sessionCache.size >= this._maxCachedSessions) {
|
|
44
|
+
// Make room for the new session: prefer an entry whose session has
|
|
45
|
+
// already been collected, otherwise evict the oldest one.
|
|
46
|
+
let evicted = false
|
|
44
47
|
for (const [key, ref] of this._sessionCache) {
|
|
45
48
|
if (ref.deref() === undefined) {
|
|
46
49
|
this._sessionCache.delete(key)
|
|
47
|
-
|
|
50
|
+
evicted = true
|
|
51
|
+
break
|
|
48
52
|
}
|
|
49
53
|
}
|
|
50
54
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
55
|
+
if (!evicted) {
|
|
56
|
+
const oldest = this._sessionCache.keys().next()
|
|
57
|
+
if (!oldest.done) {
|
|
58
|
+
this._sessionCache.delete(oldest.value)
|
|
59
|
+
}
|
|
54
60
|
}
|
|
55
61
|
}
|
|
56
62
|
|
|
@@ -22,7 +22,7 @@ function defaultFactory (origin, opts) {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
class Agent extends DispatcherBase {
|
|
25
|
-
constructor ({ factory = defaultFactory, maxOrigins = Infinity, connect, ...options } = {}) {
|
|
25
|
+
constructor ({ factory = defaultFactory, maxOrigins = Infinity, connect, tls, ...options } = {}) {
|
|
26
26
|
if (typeof factory !== 'function') {
|
|
27
27
|
throw new InvalidArgumentError('factory must be a function.')
|
|
28
28
|
}
|
|
@@ -41,7 +41,11 @@ class Agent extends DispatcherBase {
|
|
|
41
41
|
connect = { ...connect }
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
if (tls && typeof tls !== 'function') {
|
|
45
|
+
tls = { ...tls }
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
this[kOptions] = { ...util.deepClone(options), maxOrigins, connect, tls }
|
|
45
49
|
this[kFactory] = factory
|
|
46
50
|
this[kClients] = new Map()
|
|
47
51
|
this[kOrigins] = new Set()
|
|
@@ -928,8 +928,6 @@ function connectH1 (client, socket) {
|
|
|
928
928
|
}
|
|
929
929
|
|
|
930
930
|
function onHttpSocketError (err) {
|
|
931
|
-
assert(err.code !== 'ERR_TLS_CERT_ALTNAME_INVALID')
|
|
932
|
-
|
|
933
931
|
const parser = this[kParser]
|
|
934
932
|
|
|
935
933
|
// On Mac OS, we get an ECONNRESET even if there is a full body to be forwarded
|
|
@@ -293,8 +293,6 @@ function onHttp2SendPing (session) {
|
|
|
293
293
|
}
|
|
294
294
|
|
|
295
295
|
function onHttp2SessionError (err) {
|
|
296
|
-
assert(err.code !== 'ERR_TLS_CERT_ALTNAME_INVALID')
|
|
297
|
-
|
|
298
296
|
this[kSocket][kError] = err
|
|
299
297
|
this[kClient][kOnError](err)
|
|
300
298
|
}
|
|
@@ -436,8 +434,6 @@ function onHttp2SocketClose () {
|
|
|
436
434
|
}
|
|
437
435
|
|
|
438
436
|
function onHttp2SocketError (err) {
|
|
439
|
-
assert(err.code !== 'ERR_TLS_CERT_ALTNAME_INVALID')
|
|
440
|
-
|
|
441
437
|
this[kError] = err
|
|
442
438
|
|
|
443
439
|
this[kClient][kOnError](err)
|
|
@@ -115,7 +115,8 @@ class Client extends DispatcherBase {
|
|
|
115
115
|
initialWindowSize,
|
|
116
116
|
connectionWindowSize,
|
|
117
117
|
pingInterval,
|
|
118
|
-
webSocket
|
|
118
|
+
webSocket,
|
|
119
|
+
eventSource
|
|
119
120
|
} = {}) {
|
|
120
121
|
if (keepAlive !== undefined) {
|
|
121
122
|
throw new InvalidArgumentError('unsupported keepAlive, use pipelining=0 instead')
|
|
@@ -223,7 +224,7 @@ class Client extends DispatcherBase {
|
|
|
223
224
|
throw new InvalidArgumentError('pingInterval must be a positive integer, greater or equal to 0')
|
|
224
225
|
}
|
|
225
226
|
|
|
226
|
-
super({ webSocket })
|
|
227
|
+
super({ webSocket, eventSource })
|
|
227
228
|
|
|
228
229
|
if (typeof connect !== 'function') {
|
|
229
230
|
connect = buildConnector({
|
package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/dispatcher/dispatcher-base.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const buffer = require('node:buffer')
|
|
3
4
|
const Dispatcher = require('./dispatcher')
|
|
4
5
|
const UnwrapHandler = require('../handler/unwrap-handler')
|
|
5
6
|
const {
|
|
@@ -12,6 +13,7 @@ const { kDestroy, kClose, kClosed, kDestroyed, kDispatch } = require('../core/sy
|
|
|
12
13
|
const kOnDestroyed = Symbol('onDestroyed')
|
|
13
14
|
const kOnClosed = Symbol('onClosed')
|
|
14
15
|
const kWebSocketOptions = Symbol('webSocketOptions')
|
|
16
|
+
const kEventSourceOptions = Symbol('eventSourceOptions')
|
|
15
17
|
|
|
16
18
|
class DispatcherBase extends Dispatcher {
|
|
17
19
|
/** @type {boolean} */
|
|
@@ -32,6 +34,7 @@ class DispatcherBase extends Dispatcher {
|
|
|
32
34
|
constructor (opts) {
|
|
33
35
|
super()
|
|
34
36
|
this[kWebSocketOptions] = opts?.webSocket ?? {}
|
|
37
|
+
this[kEventSourceOptions] = opts?.eventSource ?? {}
|
|
35
38
|
}
|
|
36
39
|
|
|
37
40
|
/**
|
|
@@ -44,6 +47,15 @@ class DispatcherBase extends Dispatcher {
|
|
|
44
47
|
}
|
|
45
48
|
}
|
|
46
49
|
|
|
50
|
+
/**
|
|
51
|
+
* @returns {import('../../types/client').Client.EventSourceOptions}
|
|
52
|
+
*/
|
|
53
|
+
get eventSourceOptions () {
|
|
54
|
+
return {
|
|
55
|
+
maxEventSize: this[kEventSourceOptions].maxEventSize ?? buffer.kStringMaxLength
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
47
59
|
/** @returns {boolean} */
|
|
48
60
|
get destroyed () {
|
|
49
61
|
return this[kDestroyed]
|
package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/handler/cache-handler.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const util = require('../core/util')
|
|
4
|
+
const { kRedirectCacheControl } = require('../core/symbols')
|
|
4
5
|
const {
|
|
5
6
|
parseCacheControlHeader,
|
|
6
7
|
hasInvalidCacheControlDirective,
|
|
@@ -13,6 +14,19 @@ const { parseHttpDate } = require('../util/date.js')
|
|
|
13
14
|
|
|
14
15
|
function noop () {}
|
|
15
16
|
|
|
17
|
+
/**
|
|
18
|
+
* @param {string | URL} a
|
|
19
|
+
* @param {string | URL} b
|
|
20
|
+
* @returns {boolean}
|
|
21
|
+
*/
|
|
22
|
+
function sameOrigin (a, b) {
|
|
23
|
+
try {
|
|
24
|
+
return new URL(String(a)).origin === new URL(String(b)).origin
|
|
25
|
+
} catch {
|
|
26
|
+
return String(a) === String(b)
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
16
30
|
// Status codes that we can use some heuristics on to cache
|
|
17
31
|
const HEURISTICALLY_CACHEABLE_STATUS_CODES = [
|
|
18
32
|
200, 203, 204, 206, 300, 301, 308, 404, 405, 410, 414, 501
|
|
@@ -151,6 +165,14 @@ class CacheHandler {
|
|
|
151
165
|
*/
|
|
152
166
|
#writeStream
|
|
153
167
|
|
|
168
|
+
/**
|
|
169
|
+
* The URLs visited while following redirects, shared by reference from the
|
|
170
|
+
* redirect handler through the request context. Carries the suppressed hops'
|
|
171
|
+
* cache-control under {@link kRedirectCacheControl}.
|
|
172
|
+
* @type {URL[] | undefined}
|
|
173
|
+
*/
|
|
174
|
+
#history
|
|
175
|
+
|
|
154
176
|
/**
|
|
155
177
|
* @param {import('../../types/cache-interceptor.d.ts').default.CacheHandlerOptions} opts
|
|
156
178
|
* @param {import('../../types/cache-interceptor.d.ts').default.CacheKey} cacheKey
|
|
@@ -167,6 +189,9 @@ class CacheHandler {
|
|
|
167
189
|
onRequestStart (controller, context) {
|
|
168
190
|
this.#writeStream?.destroy()
|
|
169
191
|
this.#writeStream = undefined
|
|
192
|
+
// The redirect handler mutates this shared history as redirects are
|
|
193
|
+
// followed, allowing the cache to identify the response's actual origin.
|
|
194
|
+
this.#history = context?.history
|
|
170
195
|
this.#handler.onRequestStart?.(controller, context)
|
|
171
196
|
}
|
|
172
197
|
|
|
@@ -206,6 +231,29 @@ class CacheHandler {
|
|
|
206
231
|
return downstreamOnHeaders()
|
|
207
232
|
}
|
|
208
233
|
|
|
234
|
+
// Never store a response produced by a different origin under the original
|
|
235
|
+
// request's cache key.
|
|
236
|
+
if (this.#history && this.#history.length > 0) {
|
|
237
|
+
const finalUrl = this.#history[this.#history.length - 1]
|
|
238
|
+
if (!sameOrigin(finalUrl.origin, this.#cacheKey.origin)) {
|
|
239
|
+
return downstreamOnHeaders()
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// Preserve restrictive cache policy from suppressed redirect responses.
|
|
244
|
+
const redirectCacheControl = this.#history?.[kRedirectCacheControl]
|
|
245
|
+
if (redirectCacheControl) {
|
|
246
|
+
for (const hopCacheControl of redirectCacheControl) {
|
|
247
|
+
const hopDirectives = hopCacheControl ? parseCacheControlHeader(hopCacheControl) : {}
|
|
248
|
+
if (
|
|
249
|
+
hopDirectives['no-store'] === true ||
|
|
250
|
+
(this.#cacheType === 'shared' && hopDirectives.private === true)
|
|
251
|
+
) {
|
|
252
|
+
return downstreamOnHeaders()
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
209
257
|
const cacheControlHeader = resHeaders['cache-control']
|
|
210
258
|
const cacheControlDirectives = cacheControlHeader ? parseCacheControlHeader(cacheControlHeader) : {}
|
|
211
259
|
|
package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/handler/deduplication-handler.js
CHANGED
|
@@ -16,6 +16,7 @@ const DEFAULT_MAX_BUFFER_SIZE = 5 * 1024 * 1024
|
|
|
16
16
|
* @property {number} bufferedBytes
|
|
17
17
|
* @property {object | null} pendingTrailers
|
|
18
18
|
* @property {boolean} done
|
|
19
|
+
* @property {boolean} [pendingStart] onRequestStart deferred until the primary request's context is known
|
|
19
20
|
*/
|
|
20
21
|
|
|
21
22
|
/**
|
|
@@ -30,6 +31,20 @@ class DeduplicationHandler {
|
|
|
30
31
|
*/
|
|
31
32
|
#primaryHandler
|
|
32
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Whether the primary request has started (onRequestStart received). Until
|
|
36
|
+
* then the request context is unknown and cannot be given to waiting handlers.
|
|
37
|
+
* @type {boolean}
|
|
38
|
+
*/
|
|
39
|
+
#requestStarted = false
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The primary request context, replayed to waiting handlers so they observe
|
|
43
|
+
* the same redirect history as the primary.
|
|
44
|
+
* @type {any}
|
|
45
|
+
*/
|
|
46
|
+
#context = null
|
|
47
|
+
|
|
33
48
|
/**
|
|
34
49
|
* @type {WaitingHandler[]}
|
|
35
50
|
*/
|
|
@@ -112,20 +127,30 @@ class DeduplicationHandler {
|
|
|
112
127
|
const waitingController = waitingHandler.controller
|
|
113
128
|
|
|
114
129
|
try {
|
|
115
|
-
|
|
130
|
+
if (this.#requestStarted) {
|
|
131
|
+
// The primary request has started, so its context (including the
|
|
132
|
+
// redirect history) is known and can be delivered immediately.
|
|
133
|
+
handler.onRequestStart?.(waitingController, this.#context)
|
|
116
134
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
135
|
+
if (waitingController.aborted) {
|
|
136
|
+
waitingHandler.done = true
|
|
137
|
+
return true
|
|
138
|
+
}
|
|
121
139
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
140
|
+
if (this.#responseStarted) {
|
|
141
|
+
handler.onResponseStart?.(
|
|
142
|
+
waitingController,
|
|
143
|
+
this.#statusCode,
|
|
144
|
+
this.#headers,
|
|
145
|
+
this.#statusMessage
|
|
146
|
+
)
|
|
147
|
+
}
|
|
148
|
+
} else {
|
|
149
|
+
// The primary request has not started yet. Defer onRequestStart until
|
|
150
|
+
// its context is known, so the waiting handler observes the same
|
|
151
|
+
// redirect history as the primary (a cache handler relies on it to
|
|
152
|
+
// reject cross-origin redirect responses).
|
|
153
|
+
waitingHandler.pendingStart = true
|
|
129
154
|
}
|
|
130
155
|
} catch {
|
|
131
156
|
// Ignore errors from waiting handlers
|
|
@@ -146,6 +171,24 @@ class DeduplicationHandler {
|
|
|
146
171
|
*/
|
|
147
172
|
onRequestStart (controller, context) {
|
|
148
173
|
this.#controller = controller
|
|
174
|
+
if (!this.#requestStarted) {
|
|
175
|
+
this.#requestStarted = true
|
|
176
|
+
this.#context = context
|
|
177
|
+
// Deliver the now-known context to handlers that joined before the
|
|
178
|
+
// primary request started.
|
|
179
|
+
for (const waitingHandler of this.#waitingHandlers) {
|
|
180
|
+
if (waitingHandler.pendingStart && !waitingHandler.done && !waitingHandler.controller.aborted) {
|
|
181
|
+
waitingHandler.pendingStart = false
|
|
182
|
+
try {
|
|
183
|
+
waitingHandler.handler.onRequestStart?.(waitingHandler.controller, context)
|
|
184
|
+
} catch {
|
|
185
|
+
// Ignore errors from waiting handlers
|
|
186
|
+
waitingHandler.done = true
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
this.#pruneDoneWaitingHandlers()
|
|
191
|
+
}
|
|
149
192
|
this.#primaryHandler.onRequestStart?.(controller, context)
|
|
150
193
|
}
|
|
151
194
|
|
|
@@ -319,7 +362,8 @@ class DeduplicationHandler {
|
|
|
319
362
|
bufferedChunks: [],
|
|
320
363
|
bufferedBytes: 0,
|
|
321
364
|
pendingTrailers: null,
|
|
322
|
-
done: false
|
|
365
|
+
done: false,
|
|
366
|
+
pendingStart: false
|
|
323
367
|
}
|
|
324
368
|
|
|
325
369
|
const state = {
|
package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/handler/redirect-handler.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const util = require('../core/util')
|
|
4
|
-
const { kBodyUsed } = require('../core/symbols')
|
|
4
|
+
const { kBodyUsed, kRedirectCacheControl } = require('../core/symbols')
|
|
5
5
|
const assert = require('node:assert')
|
|
6
6
|
const { InvalidArgumentError } = require('../core/errors')
|
|
7
7
|
const EE = require('node:events')
|
|
@@ -47,6 +47,11 @@ class RedirectHandler {
|
|
|
47
47
|
this.maxRedirections = maxRedirections
|
|
48
48
|
this.handler = handler
|
|
49
49
|
this.history = []
|
|
50
|
+
// Retain cache-control from suppressed redirect hops for an outer cache.
|
|
51
|
+
Object.defineProperty(this.history, kRedirectCacheControl, {
|
|
52
|
+
value: [],
|
|
53
|
+
enumerable: false
|
|
54
|
+
})
|
|
50
55
|
|
|
51
56
|
if (util.isStream(this.opts.body)) {
|
|
52
57
|
// TODO (fix): Provide some way for the user to cache the file to e.g. /tmp
|
|
@@ -130,6 +135,8 @@ class RedirectHandler {
|
|
|
130
135
|
return
|
|
131
136
|
}
|
|
132
137
|
|
|
138
|
+
this.history[kRedirectCacheControl].push(headers['cache-control'])
|
|
139
|
+
|
|
133
140
|
const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)))
|
|
134
141
|
const path = search ? `${pathname}${search}` : pathname
|
|
135
142
|
|
package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/interceptor/decompress.js
CHANGED
|
@@ -220,9 +220,14 @@ class DecompressHandler extends DecoratorHandler {
|
|
|
220
220
|
this.#decompressedSize = decompressedSize
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
this.#controller.
|
|
223
|
+
try {
|
|
224
|
+
const result = super.onResponseData(this.#controller, chunk)
|
|
225
|
+
if (result === false && !this.#controller.paused) {
|
|
226
|
+
this.#controller.pause()
|
|
227
|
+
}
|
|
228
|
+
} catch (err) {
|
|
229
|
+
this.#fail(err)
|
|
230
|
+
return
|
|
226
231
|
}
|
|
227
232
|
}
|
|
228
233
|
} while (this.#drainRequested && !this.#terminated && !this.#controller.paused)
|
|
@@ -239,9 +244,14 @@ class DecompressHandler extends DecoratorHandler {
|
|
|
239
244
|
return
|
|
240
245
|
}
|
|
241
246
|
|
|
242
|
-
this.#terminated = true
|
|
243
247
|
this.#cleanupDecompressors()
|
|
244
|
-
|
|
248
|
+
try {
|
|
249
|
+
super.onResponseEnd(this.#controller, this.#trailers)
|
|
250
|
+
} catch (err) {
|
|
251
|
+
this.#fail(err)
|
|
252
|
+
return
|
|
253
|
+
}
|
|
254
|
+
this.#terminated = true
|
|
245
255
|
}
|
|
246
256
|
|
|
247
257
|
#onDecompressionEnd () {
|
|
@@ -32,8 +32,10 @@ function getCookies (headers) {
|
|
|
32
32
|
|
|
33
33
|
const cookie = headers.get('cookie')
|
|
34
34
|
|
|
35
|
+
// A null prototype keeps a cookie named `__proto__` from hitting the
|
|
36
|
+
// Object.prototype setter, which would silently drop it.
|
|
35
37
|
/** @type {Record<string, string>} */
|
|
36
|
-
const out = {}
|
|
38
|
+
const out = { __proto__: null }
|
|
37
39
|
|
|
38
40
|
if (!cookie) {
|
|
39
41
|
return out
|