maka-agent 0.2.2-dev.92.20261019 → 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/LICENSE +7 -7
- package/README.md +78 -18
- package/README.zh-CN.md +73 -15
- package/THIRD_PARTY_NOTICES.txt +12 -12
- package/dist/pi-goal.js +13 -0
- package/dist/pi-tui-runner.js +44 -1
- package/dist/run-command-core.js +111 -70
- package/dist/run-session-command.js +91 -15
- package/dist/run-turn-outcome.js +2 -33
- package/dist/runtime-host-session-channel.js +3 -1
- package/dist/runtime-host-session-driver.js +5 -0
- 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/event-wait.js +28 -10
- package/node_modules/@maka/core/dist/executor-catalog.js +3 -1
- 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.js +8 -0
- package/node_modules/@maka/core/dist/session-checkin.js +31 -0
- package/node_modules/@maka/core/dist/usage-stats/types.js +1 -0
- package/node_modules/@maka/core/package.json +2 -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/ai-sdk-compaction.js +22 -9
- package/node_modules/@maka/runtime/dist/ai-sdk-message-projection.js +10 -1
- package/node_modules/@maka/runtime/dist/ai-sdk-turn.js +101 -127
- package/node_modules/@maka/runtime/dist/event-wait-tool.js +2 -2
- package/node_modules/@maka/runtime/dist/history-compact-checkpoint.js +32 -1
- package/node_modules/@maka/runtime/dist/history-compaction.js +7 -0
- 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 +7 -2
- 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/runtime-context.js +53 -0
- package/node_modules/@maka/runtime/dist/runtime-event-read-model.js +3 -0
- 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/shell-run-manager.js +34 -0
- package/node_modules/@maka/runtime/dist/telemetry/builtin-pricing.js +21 -2
- package/node_modules/@maka/runtime/dist/tool-runtime.js +8 -0
- 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 +2 -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 +64 -13
- 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 +1 -1
- 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 +35 -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 +1 -1
- 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 +87 -23
- package/node_modules/@maka/runtime-host/dist/assistant/service.js +49 -5
- package/node_modules/@maka/runtime-host/dist/protocol/goal.js +119 -1
- package/node_modules/@maka/runtime-host/dist/protocol/index.js +7 -1
- 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/canonical-session-projection.js +3 -2
- package/node_modules/@maka/runtime-host/dist/server/event-wait-manager.js +63 -12
- 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 +123 -11
- package/node_modules/@maka/runtime-host/dist/server/execution-model-authority.js +47 -3
- package/node_modules/@maka/runtime-host/dist/server/goal-coordinator.js +126 -4
- package/node_modules/@maka/runtime-host/dist/server/goal-event-waits.js +58 -19
- package/node_modules/@maka/runtime-host/dist/server/goal-projection.js +24 -3
- 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/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/context-offload-snapshot.js +2 -1
- package/node_modules/@maka/storage/dist/execution-stores.js +36 -1
- package/node_modules/@maka/storage/dist/local-execution-persistence.js +26 -0
- 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 +86 -16
- package/node_modules/@maka/storage/dist/session-checkpoint-publication-store.js +204 -0
- 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-reclamation-checkpoint.js +37 -0
- package/node_modules/@maka/storage/dist/sqlite-runtime-store.js +31 -0
- package/node_modules/@maka/storage/package.json +3 -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
|
@@ -92,220 +92,221 @@ function parseSetCookie (header) {
|
|
|
92
92
|
* @param {Object.<string, unknown>} [cookieAttributeList={}]
|
|
93
93
|
*/
|
|
94
94
|
function parseUnparsedAttributes (unparsedAttributes, cookieAttributeList = {}) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
95
|
+
while (true) {
|
|
96
|
+
// 1. If the unparsed-attributes string is empty, skip the rest of
|
|
97
|
+
// these steps.
|
|
98
|
+
if (unparsedAttributes.length === 0) {
|
|
99
|
+
return cookieAttributeList
|
|
100
|
+
}
|
|
100
101
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
// 2. Discard the first character of the unparsed-attributes (which
|
|
103
|
+
// will be a %x3B (";") character).
|
|
104
|
+
assert(unparsedAttributes[0] === ';')
|
|
105
|
+
unparsedAttributes = unparsedAttributes.slice(1)
|
|
105
106
|
|
|
106
|
-
|
|
107
|
+
let cookieAv = ''
|
|
107
108
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
// 3. If the remaining unparsed-attributes contains a %x3B (";")
|
|
110
|
+
// character:
|
|
111
|
+
if (unparsedAttributes.includes(';')) {
|
|
111
112
|
// 1. Consume the characters of the unparsed-attributes up to, but
|
|
112
113
|
// not including, the first %x3B (";") character.
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
114
|
+
cookieAv = collectASequenceOfCodePointsFast(
|
|
115
|
+
';',
|
|
116
|
+
unparsedAttributes,
|
|
117
|
+
{ position: 0 }
|
|
118
|
+
)
|
|
119
|
+
unparsedAttributes = unparsedAttributes.slice(cookieAv.length)
|
|
120
|
+
} else {
|
|
120
121
|
// Otherwise:
|
|
121
122
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
123
|
+
// 1. Consume the remainder of the unparsed-attributes.
|
|
124
|
+
cookieAv = unparsedAttributes
|
|
125
|
+
unparsedAttributes = ''
|
|
126
|
+
}
|
|
126
127
|
|
|
127
|
-
|
|
128
|
+
// Let the cookie-av string be the characters consumed in this step.
|
|
128
129
|
|
|
129
|
-
|
|
130
|
-
|
|
130
|
+
let attributeName = ''
|
|
131
|
+
let attributeValue = ''
|
|
131
132
|
|
|
132
|
-
|
|
133
|
-
|
|
133
|
+
// 4. If the cookie-av string contains a %x3D ("=") character:
|
|
134
|
+
if (cookieAv.includes('=')) {
|
|
134
135
|
// 1. The (possibly empty) attribute-name string consists of the
|
|
135
136
|
// characters up to, but not including, the first %x3D ("=")
|
|
136
137
|
// character, and the (possibly empty) attribute-value string
|
|
137
138
|
// consists of the characters after the first %x3D ("=")
|
|
138
139
|
// character.
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
140
|
+
const position = { position: 0 }
|
|
141
|
+
|
|
142
|
+
attributeName = collectASequenceOfCodePointsFast(
|
|
143
|
+
'=',
|
|
144
|
+
cookieAv,
|
|
145
|
+
position
|
|
146
|
+
)
|
|
147
|
+
attributeValue = cookieAv.slice(position.position + 1)
|
|
148
|
+
} else {
|
|
148
149
|
// Otherwise:
|
|
149
150
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
151
|
+
// 1. The attribute-name string consists of the entire cookie-av
|
|
152
|
+
// string, and the attribute-value string is empty.
|
|
153
|
+
attributeName = cookieAv
|
|
154
|
+
}
|
|
154
155
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
156
|
+
// 5. Remove any leading or trailing WSP characters from the attribute-
|
|
157
|
+
// name string and the attribute-value string.
|
|
158
|
+
attributeName = attributeName.trim()
|
|
159
|
+
attributeValue = attributeValue.trim()
|
|
159
160
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
161
|
+
// 6. If the attribute-value is longer than 1024 octets, ignore the
|
|
162
|
+
// cookie-av string and return to Step 1 of this algorithm.
|
|
163
|
+
if (attributeValue.length > maxAttributeValueSize) {
|
|
164
|
+
continue
|
|
165
|
+
}
|
|
165
166
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
167
|
+
// 7. Process the attribute-name and attribute-value according to the
|
|
168
|
+
// requirements in the following subsections. (Notice that
|
|
169
|
+
// attributes with unrecognized attribute-names are ignored.)
|
|
170
|
+
const attributeNameLowercase = attributeName.toLowerCase()
|
|
170
171
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
172
|
+
// https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.1
|
|
173
|
+
// If the attribute-name case-insensitively matches the string
|
|
174
|
+
// "Expires", the user agent MUST process the cookie-av as follows.
|
|
175
|
+
if (attributeNameLowercase === 'expires') {
|
|
175
176
|
// 1. Let the expiry-time be the result of parsing the attribute-value
|
|
176
177
|
// as cookie-date (see Section 5.1.1).
|
|
177
|
-
|
|
178
|
+
const expiryTime = new Date(attributeValue)
|
|
178
179
|
|
|
179
|
-
|
|
180
|
-
|
|
180
|
+
// 2. If the attribute-value failed to parse as a cookie date, ignore
|
|
181
|
+
// the cookie-av.
|
|
181
182
|
|
|
182
|
-
|
|
183
|
-
|
|
183
|
+
cookieAttributeList.expires = expiryTime
|
|
184
|
+
} else if (attributeNameLowercase === 'max-age') {
|
|
184
185
|
// https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.2
|
|
185
186
|
// If the attribute-name case-insensitively matches the string "Max-
|
|
186
187
|
// Age", the user agent MUST process the cookie-av as follows.
|
|
187
188
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
189
|
+
// 1. If the first character of the attribute-value is not a DIGIT or a
|
|
190
|
+
// "-" character, ignore the cookie-av.
|
|
191
|
+
const charCode = attributeValue.charCodeAt(0)
|
|
191
192
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
if ((charCode < 48 || charCode > 57) && attributeValue[0] !== '-') {
|
|
194
|
+
continue
|
|
195
|
+
}
|
|
195
196
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
197
|
+
// 2. If the remainder of attribute-value contains a non-DIGIT
|
|
198
|
+
// character, ignore the cookie-av.
|
|
199
|
+
if (!/^\d+$/.test(attributeValue)) {
|
|
200
|
+
continue
|
|
201
|
+
}
|
|
201
202
|
|
|
202
|
-
|
|
203
|
-
|
|
203
|
+
// 3. Let delta-seconds be the attribute-value converted to an integer.
|
|
204
|
+
const deltaSeconds = Number(attributeValue)
|
|
204
205
|
|
|
205
|
-
|
|
206
|
-
|
|
206
|
+
// 4. Let cookie-age-limit be the maximum age of the cookie (which
|
|
207
|
+
// SHOULD be 400 days or less, see Section 4.1.2.2).
|
|
207
208
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
209
|
+
// 5. Set delta-seconds to the smaller of its present value and cookie-
|
|
210
|
+
// age-limit.
|
|
211
|
+
// deltaSeconds = Math.min(deltaSeconds * 1000, maxExpiresMs)
|
|
211
212
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
213
|
+
// 6. If delta-seconds is less than or equal to zero (0), let expiry-
|
|
214
|
+
// time be the earliest representable date and time. Otherwise, let
|
|
215
|
+
// the expiry-time be the current date and time plus delta-seconds
|
|
216
|
+
// seconds.
|
|
217
|
+
// const expiryTime = deltaSeconds <= 0 ? Date.now() : Date.now() + deltaSeconds
|
|
217
218
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
219
|
+
// 7. Append an attribute to the cookie-attribute-list with an
|
|
220
|
+
// attribute-name of Max-Age and an attribute-value of expiry-time.
|
|
221
|
+
cookieAttributeList.maxAge = deltaSeconds
|
|
222
|
+
} else if (attributeNameLowercase === 'domain') {
|
|
222
223
|
// https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.3
|
|
223
224
|
// If the attribute-name case-insensitively matches the string "Domain",
|
|
224
225
|
// the user agent MUST process the cookie-av as follows.
|
|
225
226
|
|
|
226
|
-
|
|
227
|
-
|
|
227
|
+
// 1. Let cookie-domain be the attribute-value.
|
|
228
|
+
let cookieDomain = attributeValue
|
|
228
229
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
230
|
+
// 2. If cookie-domain starts with %x2E ("."), let cookie-domain be
|
|
231
|
+
// cookie-domain without its leading %x2E (".").
|
|
232
|
+
if (cookieDomain[0] === '.') {
|
|
233
|
+
cookieDomain = cookieDomain.slice(1)
|
|
234
|
+
}
|
|
234
235
|
|
|
235
|
-
|
|
236
|
-
|
|
236
|
+
// 3. Convert the cookie-domain to lower case.
|
|
237
|
+
cookieDomain = cookieDomain.toLowerCase()
|
|
237
238
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
239
|
+
// 4. Append an attribute to the cookie-attribute-list with an
|
|
240
|
+
// attribute-name of Domain and an attribute-value of cookie-domain.
|
|
241
|
+
cookieAttributeList.domain = cookieDomain
|
|
242
|
+
} else if (attributeNameLowercase === 'path') {
|
|
242
243
|
// https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.4
|
|
243
244
|
// If the attribute-name case-insensitively matches the string "Path",
|
|
244
245
|
// the user agent MUST process the cookie-av as follows.
|
|
245
246
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
247
|
+
// 1. If the attribute-value is empty or if the first character of the
|
|
248
|
+
// attribute-value is not %x2F ("/"):
|
|
249
|
+
let cookiePath = ''
|
|
250
|
+
if (attributeValue.length === 0 || attributeValue[0] !== '/') {
|
|
250
251
|
// 1. Let cookie-path be the default-path.
|
|
251
|
-
|
|
252
|
-
|
|
252
|
+
cookiePath = '/'
|
|
253
|
+
} else {
|
|
253
254
|
// Otherwise:
|
|
254
255
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
256
|
+
// 1. Let cookie-path be the attribute-value.
|
|
257
|
+
cookiePath = attributeValue
|
|
258
|
+
}
|
|
258
259
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
260
|
+
// 2. Append an attribute to the cookie-attribute-list with an
|
|
261
|
+
// attribute-name of Path and an attribute-value of cookie-path.
|
|
262
|
+
cookieAttributeList.path = cookiePath
|
|
263
|
+
} else if (attributeNameLowercase === 'secure') {
|
|
263
264
|
// https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.5
|
|
264
265
|
// If the attribute-name case-insensitively matches the string "Secure",
|
|
265
266
|
// the user agent MUST append an attribute to the cookie-attribute-list
|
|
266
267
|
// with an attribute-name of Secure and an empty attribute-value.
|
|
267
268
|
|
|
268
|
-
|
|
269
|
-
|
|
269
|
+
cookieAttributeList.secure = true
|
|
270
|
+
} else if (attributeNameLowercase === 'httponly') {
|
|
270
271
|
// https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.6
|
|
271
272
|
// If the attribute-name case-insensitively matches the string
|
|
272
273
|
// "HttpOnly", the user agent MUST append an attribute to the cookie-
|
|
273
274
|
// attribute-list with an attribute-name of HttpOnly and an empty
|
|
274
275
|
// attribute-value.
|
|
275
276
|
|
|
276
|
-
|
|
277
|
-
|
|
277
|
+
cookieAttributeList.httpOnly = true
|
|
278
|
+
} else if (attributeNameLowercase === 'samesite') {
|
|
278
279
|
// https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4.7
|
|
279
280
|
// If the attribute-name case-insensitively matches the string
|
|
280
281
|
// "SameSite", the user agent MUST process the cookie-av as follows:
|
|
281
282
|
|
|
282
|
-
|
|
283
|
+
const attributeValueLowercase = attributeValue.toLowerCase()
|
|
283
284
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
285
|
+
// 1. If cookie-av's attribute-value is a case-insensitive match for
|
|
286
|
+
// "None", append an attribute to the cookie-attribute-list with an
|
|
287
|
+
// attribute-name of "SameSite" and an attribute-value of "None".
|
|
288
|
+
if (attributeValueLowercase === 'none') {
|
|
289
|
+
cookieAttributeList.sameSite = 'None'
|
|
290
|
+
} else if (attributeValueLowercase === 'strict') {
|
|
290
291
|
// 2. If cookie-av's attribute-value is a case-insensitive match for
|
|
291
292
|
// "Strict", append an attribute to the cookie-attribute-list with
|
|
292
293
|
// an attribute-name of "SameSite" and an attribute-value of
|
|
293
294
|
// "Strict".
|
|
294
|
-
|
|
295
|
-
|
|
295
|
+
cookieAttributeList.sameSite = 'Strict'
|
|
296
|
+
} else if (attributeValueLowercase === 'lax') {
|
|
296
297
|
// 3. If cookie-av's attribute-value is a case-insensitive match for
|
|
297
298
|
// "Lax", append an attribute to the cookie-attribute-list with an
|
|
298
299
|
// attribute-name of "SameSite" and an attribute-value of "Lax".
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
300
|
+
cookieAttributeList.sameSite = 'Lax'
|
|
301
|
+
}
|
|
302
|
+
} else {
|
|
303
|
+
cookieAttributeList.unparsed ??= []
|
|
303
304
|
|
|
304
|
-
|
|
305
|
-
|
|
305
|
+
cookieAttributeList.unparsed.push(`${attributeName}=${attributeValue}`)
|
|
306
|
+
}
|
|
306
307
|
|
|
307
308
|
// 8. Return to Step 1 of this algorithm.
|
|
308
|
-
|
|
309
|
+
}
|
|
309
310
|
}
|
|
310
311
|
|
|
311
312
|
module.exports = {
|
|
@@ -315,8 +315,27 @@ function stringify (cookie) {
|
|
|
315
315
|
out.push(`Path=${cookie.path}`)
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
-
|
|
319
|
-
|
|
318
|
+
// A numeric 0 is the Unix epoch, not an absent value -- the same reason the
|
|
319
|
+
// Max-Age check above tests the type rather than truthiness.
|
|
320
|
+
//
|
|
321
|
+
// expires is Date | number, so the "Invalid Date" check only guards the Date
|
|
322
|
+
// form. A number that is not a valid time value (NaN, +/-Infinity, or outside
|
|
323
|
+
// the Date range) would otherwise reach toIMFDate, which splices undefined and
|
|
324
|
+
// NaN into the header value instead of failing.
|
|
325
|
+
if (cookie.expires != null) {
|
|
326
|
+
const expiresMs = cookie.expires instanceof Date
|
|
327
|
+
? cookie.expires.getTime()
|
|
328
|
+
: cookie.expires
|
|
329
|
+
|
|
330
|
+
// The largest time value a Date can represent, in milliseconds, i.e.
|
|
331
|
+
// 100,000,000 days either side of the epoch (ECMA-262 Date Time Values).
|
|
332
|
+
// Anything within it is safe for toIMFDate to format; anything beyond it
|
|
333
|
+
// produces an invalid Date and must be ignored instead.
|
|
334
|
+
const maxTimeValue = 8640000000000000
|
|
335
|
+
|
|
336
|
+
if (typeof expiresMs === 'number' && Number.isFinite(expiresMs) && Math.abs(expiresMs) <= maxTimeValue) {
|
|
337
|
+
out.push(`Expires=${toIMFDate(cookie.expires)}`)
|
|
338
|
+
}
|
|
320
339
|
}
|
|
321
340
|
|
|
322
341
|
if (cookie.sameSite) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use strict'
|
|
2
|
+
const buffer = require('node:buffer')
|
|
2
3
|
const { Transform } = require('node:stream')
|
|
3
4
|
const { isASCIINumber, isValidLastEventId } = require('./util')
|
|
4
5
|
|
|
@@ -23,11 +24,19 @@ const COLON = 0x3A
|
|
|
23
24
|
*/
|
|
24
25
|
const SPACE = 0x20
|
|
25
26
|
|
|
27
|
+
const defaultMaxEventSize = buffer.kStringMaxLength
|
|
28
|
+
|
|
26
29
|
const DATA = Buffer.from('data')
|
|
27
30
|
const EVENT = Buffer.from('event')
|
|
28
31
|
const ID = Buffer.from('id')
|
|
29
32
|
const RETRY = Buffer.from('retry')
|
|
30
33
|
|
|
34
|
+
// Each data field creates a string node, and each unconsumed input chunk keeps
|
|
35
|
+
// a Buffer wrapper. The absolute ceiling protects the large default byte limit.
|
|
36
|
+
const minParserItems = 1024
|
|
37
|
+
const maxParserItems = 131072
|
|
38
|
+
const bytesPerParserItem = 128
|
|
39
|
+
|
|
31
40
|
function isASCIINumberBytes (buffer, start) {
|
|
32
41
|
if (start >= buffer.length) {
|
|
33
42
|
return false
|
|
@@ -66,6 +75,12 @@ function isFieldName (line, length, field) {
|
|
|
66
75
|
return true
|
|
67
76
|
}
|
|
68
77
|
|
|
78
|
+
function createMaxEventSizeExceededError () {
|
|
79
|
+
const error = new Error('EventSource message size exceeded')
|
|
80
|
+
error.aborted = false
|
|
81
|
+
return error
|
|
82
|
+
}
|
|
83
|
+
|
|
69
84
|
/**
|
|
70
85
|
* @typedef {object} EventSourceStreamEvent
|
|
71
86
|
* @type {object}
|
|
@@ -114,6 +129,13 @@ class EventSourceStream extends Transform {
|
|
|
114
129
|
pos = 0
|
|
115
130
|
lineChunkIndex = 0
|
|
116
131
|
linePos = 0
|
|
132
|
+
lineLength = 0
|
|
133
|
+
eventSize = 0
|
|
134
|
+
eventFieldSizes = { data: 0, event: 0, id: 0, retry: 0 }
|
|
135
|
+
dataLineCount = 0
|
|
136
|
+
maxEventSize
|
|
137
|
+
maxDataLines
|
|
138
|
+
maxBufferedChunks
|
|
117
139
|
|
|
118
140
|
event = {
|
|
119
141
|
data: undefined,
|
|
@@ -125,6 +147,7 @@ class EventSourceStream extends Transform {
|
|
|
125
147
|
/**
|
|
126
148
|
* @param {object} options
|
|
127
149
|
* @param {boolean} [options.readableObjectMode]
|
|
150
|
+
* @param {number} [options.maxEventSize]
|
|
128
151
|
* @param {eventSourceSettings} [options.eventSourceSettings]
|
|
129
152
|
* @param {(chunk: any, encoding?: BufferEncoding | undefined) => boolean} [options.push]
|
|
130
153
|
*/
|
|
@@ -136,6 +159,12 @@ class EventSourceStream extends Transform {
|
|
|
136
159
|
super(options)
|
|
137
160
|
|
|
138
161
|
this.state = options.eventSourceSettings || {}
|
|
162
|
+
this.maxEventSize = options.maxEventSize ?? defaultMaxEventSize
|
|
163
|
+
const parserItemLimit = this.maxEventSize > 0
|
|
164
|
+
? Math.min(maxParserItems, Math.max(minParserItems, Math.floor(this.maxEventSize / bytesPerParserItem)))
|
|
165
|
+
: 0
|
|
166
|
+
this.maxDataLines = parserItemLimit
|
|
167
|
+
this.maxBufferedChunks = parserItemLimit
|
|
139
168
|
if (options.push) {
|
|
140
169
|
this.push = options.push
|
|
141
170
|
}
|
|
@@ -153,6 +182,14 @@ class EventSourceStream extends Transform {
|
|
|
153
182
|
return
|
|
154
183
|
}
|
|
155
184
|
|
|
185
|
+
// A leading line ending can immediately release the currently buffered
|
|
186
|
+
// line, even when it uses the final allowed chunk slot.
|
|
187
|
+
if (this.maxEventSize > 0 &&
|
|
188
|
+
this.chunks.length >= this.maxBufferedChunks &&
|
|
189
|
+
chunk[0] !== LF && chunk[0] !== CR) {
|
|
190
|
+
callback(createMaxEventSizeExceededError())
|
|
191
|
+
return
|
|
192
|
+
}
|
|
156
193
|
this.chunks.push(chunk)
|
|
157
194
|
|
|
158
195
|
// Strip leading byte-order-mark if we opened the stream and started
|
|
@@ -231,7 +268,12 @@ class EventSourceStream extends Transform {
|
|
|
231
268
|
|
|
232
269
|
// In any case, we can process the line as we reached an
|
|
233
270
|
// end-of-line character
|
|
234
|
-
|
|
271
|
+
try {
|
|
272
|
+
this.parseLine(this.readLine(), this.event)
|
|
273
|
+
} catch (error) {
|
|
274
|
+
callback(error)
|
|
275
|
+
return
|
|
276
|
+
}
|
|
235
277
|
this.consumeCurrentByte()
|
|
236
278
|
// A line was processed and this could be the end of the event. We need
|
|
237
279
|
// to check if the next line is empty to determine if the event is
|
|
@@ -240,12 +282,25 @@ class EventSourceStream extends Transform {
|
|
|
240
282
|
continue
|
|
241
283
|
}
|
|
242
284
|
|
|
285
|
+
// readLine() is only called after CR or LF. Reject an unfinished line
|
|
286
|
+
// before it can retain an unbounded number of decoded chunks. The seven
|
|
287
|
+
// extra bytes allow the longest field prefix ("event: " or "retry: ").
|
|
288
|
+
if (this.maxEventSize > 0 && ++this.lineLength > this.maxEventSize + 7) {
|
|
289
|
+
callback(createMaxEventSizeExceededError())
|
|
290
|
+
return
|
|
291
|
+
}
|
|
243
292
|
this.advanceCursor()
|
|
244
293
|
}
|
|
245
294
|
|
|
246
295
|
callback()
|
|
247
296
|
}
|
|
248
297
|
|
|
298
|
+
_destroy (error, callback) {
|
|
299
|
+
this.chunks.length = 0
|
|
300
|
+
this.clearEvent()
|
|
301
|
+
super._destroy(error, callback)
|
|
302
|
+
}
|
|
303
|
+
|
|
249
304
|
/**
|
|
250
305
|
* @param {Buffer} line
|
|
251
306
|
* @param {EventSourceStreamEvent} event
|
|
@@ -282,6 +337,13 @@ class EventSourceStream extends Transform {
|
|
|
282
337
|
}
|
|
283
338
|
|
|
284
339
|
if (isFieldName(line, fieldLength, DATA)) {
|
|
340
|
+
if (this.maxEventSize > 0 && this.dataLineCount >= this.maxDataLines) {
|
|
341
|
+
throw createMaxEventSizeExceededError()
|
|
342
|
+
}
|
|
343
|
+
const valueBytes = line.length - valueStart
|
|
344
|
+
const dataSize = this.eventFieldSizes.data + (event.data === undefined ? 0 : 1) + valueBytes
|
|
345
|
+
this.setEventFieldSize('data', dataSize)
|
|
346
|
+
|
|
285
347
|
const value = line.toString('utf8', valueStart)
|
|
286
348
|
|
|
287
349
|
if (event.data === undefined) {
|
|
@@ -289,11 +351,13 @@ class EventSourceStream extends Transform {
|
|
|
289
351
|
} else {
|
|
290
352
|
event.data += `\n${value}`
|
|
291
353
|
}
|
|
354
|
+
this.dataLineCount++
|
|
292
355
|
return
|
|
293
356
|
}
|
|
294
357
|
|
|
295
358
|
if (isFieldName(line, fieldLength, RETRY)) {
|
|
296
359
|
if (isASCIINumberBytes(line, valueStart)) {
|
|
360
|
+
this.setEventFieldSize('retry', line.length - valueStart)
|
|
297
361
|
event.retry = line.toString('utf8', valueStart)
|
|
298
362
|
}
|
|
299
363
|
return
|
|
@@ -301,20 +365,29 @@ class EventSourceStream extends Transform {
|
|
|
301
365
|
|
|
302
366
|
if (isFieldName(line, fieldLength, ID)) {
|
|
303
367
|
if (isValidLastEventIdBytes(line, valueStart)) {
|
|
368
|
+
this.setEventFieldSize('id', line.length - valueStart)
|
|
304
369
|
event.id = line.toString('utf8', valueStart)
|
|
305
370
|
}
|
|
306
371
|
return
|
|
307
372
|
}
|
|
308
373
|
|
|
309
374
|
if (isFieldName(line, fieldLength, EVENT)) {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
event.event = value
|
|
375
|
+
if (valueStart < line.length) {
|
|
376
|
+
this.setEventFieldSize('event', line.length - valueStart)
|
|
377
|
+
event.event = line.toString('utf8', valueStart)
|
|
314
378
|
}
|
|
315
379
|
}
|
|
316
380
|
}
|
|
317
381
|
|
|
382
|
+
setEventFieldSize (field, size) {
|
|
383
|
+
const eventSize = this.eventSize - this.eventFieldSizes[field] + size
|
|
384
|
+
if (this.maxEventSize > 0 && eventSize > this.maxEventSize) {
|
|
385
|
+
throw createMaxEventSizeExceededError()
|
|
386
|
+
}
|
|
387
|
+
this.eventSize = eventSize
|
|
388
|
+
this.eventFieldSizes[field] = size
|
|
389
|
+
}
|
|
390
|
+
|
|
318
391
|
/**
|
|
319
392
|
* @param {EventSourceStreamEvent} event
|
|
320
393
|
*/
|
|
@@ -345,6 +418,12 @@ class EventSourceStream extends Transform {
|
|
|
345
418
|
this.event.event = undefined
|
|
346
419
|
this.event.id = undefined
|
|
347
420
|
this.event.retry = undefined
|
|
421
|
+
this.eventSize = 0
|
|
422
|
+
this.dataLineCount = 0
|
|
423
|
+
this.eventFieldSizes.data = 0
|
|
424
|
+
this.eventFieldSizes.event = 0
|
|
425
|
+
this.eventFieldSizes.id = 0
|
|
426
|
+
this.eventFieldSizes.retry = 0
|
|
348
427
|
}
|
|
349
428
|
|
|
350
429
|
hasPendingEvent () {
|
|
@@ -380,14 +459,16 @@ class EventSourceStream extends Transform {
|
|
|
380
459
|
syncLineStartToCursor () {
|
|
381
460
|
this.lineChunkIndex = this.chunkIndex
|
|
382
461
|
this.linePos = this.pos
|
|
462
|
+
this.lineLength = 0
|
|
383
463
|
this.dropConsumedChunks()
|
|
384
464
|
}
|
|
385
465
|
|
|
386
466
|
dropConsumedChunks () {
|
|
387
|
-
|
|
388
|
-
this.
|
|
389
|
-
this.
|
|
390
|
-
this.
|
|
467
|
+
if (this.lineChunkIndex > 0) {
|
|
468
|
+
const consumed = this.lineChunkIndex
|
|
469
|
+
this.chunks.splice(0, consumed)
|
|
470
|
+
this.lineChunkIndex = 0
|
|
471
|
+
this.chunkIndex -= consumed
|
|
391
472
|
}
|
|
392
473
|
|
|
393
474
|
if (this.chunkIndex === this.chunks.length) {
|
package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/eventsource/eventsource.js
CHANGED
|
@@ -10,6 +10,7 @@ const { createFastMessageEvent } = require('../websocket/events')
|
|
|
10
10
|
const { isNetworkError } = require('../fetch/response')
|
|
11
11
|
const { kEnumerableProperty } = require('../../core/util')
|
|
12
12
|
const { environmentSettingsObject } = require('../fetch/util')
|
|
13
|
+
const { getGlobalDispatcher } = require('../../global')
|
|
13
14
|
|
|
14
15
|
let experimentalWarned = false
|
|
15
16
|
|
|
@@ -292,6 +293,7 @@ class EventSource extends EventTarget {
|
|
|
292
293
|
|
|
293
294
|
const eventSourceStream = new EventSourceStream({
|
|
294
295
|
eventSourceSettings: this.#state,
|
|
296
|
+
maxEventSize: this.#dispatcher.eventSourceOptions?.maxEventSize,
|
|
295
297
|
push: (event) => {
|
|
296
298
|
this.dispatchEvent(createFastMessageEvent(
|
|
297
299
|
event.type,
|
|
@@ -476,7 +478,8 @@ webidl.converters.EventSourceInitDict = webidl.dictionaryConverter([
|
|
|
476
478
|
},
|
|
477
479
|
{
|
|
478
480
|
key: 'dispatcher', // undici only
|
|
479
|
-
converter: webidl.converters.any
|
|
481
|
+
converter: webidl.converters.any,
|
|
482
|
+
defaultValue: () => getGlobalDispatcher()
|
|
480
483
|
},
|
|
481
484
|
{
|
|
482
485
|
key: 'node', // undici only
|
|
@@ -2215,8 +2215,6 @@ async function httpNetworkFetch (
|
|
|
2215
2215
|
}
|
|
2216
2216
|
const location = headersList.get('location', true)
|
|
2217
2217
|
|
|
2218
|
-
this.body = new Readable({ read: resume })
|
|
2219
|
-
|
|
2220
2218
|
const willFollow = location && request.redirect === 'follow' &&
|
|
2221
2219
|
redirectStatusSet.has(status)
|
|
2222
2220
|
|
|
@@ -2234,7 +2232,7 @@ async function httpNetworkFetch (
|
|
|
2234
2232
|
// CVE fix similar to urllib3 (GHSA-gm62-xv2j-4w53) and curl (CVE-2022-32206).
|
|
2235
2233
|
const maxContentEncodings = 5
|
|
2236
2234
|
if (codings.length > maxContentEncodings) {
|
|
2237
|
-
|
|
2235
|
+
this.abort(new Error(`too many content-encodings in response: ${codings.length}, maximum allowed is ${maxContentEncodings}`))
|
|
2238
2236
|
return true
|
|
2239
2237
|
}
|
|
2240
2238
|
|
|
@@ -2272,6 +2270,8 @@ async function httpNetworkFetch (
|
|
|
2272
2270
|
}
|
|
2273
2271
|
}
|
|
2274
2272
|
|
|
2273
|
+
this.body = new Readable({ read: resume })
|
|
2274
|
+
|
|
2275
2275
|
const onError = this.onError.bind(this)
|
|
2276
2276
|
|
|
2277
2277
|
resolve({
|