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
|
@@ -2,14 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
const { Writable } = require('node:stream')
|
|
4
4
|
const { assertCacheKey, assertCacheValue } = require('../util/cache.js')
|
|
5
|
+
const { zstdCompressSync, zstdDecompressSync } = require('node:zlib')
|
|
5
6
|
|
|
6
7
|
let DatabaseSync
|
|
7
8
|
|
|
8
|
-
const VERSION =
|
|
9
|
+
const VERSION = 4
|
|
9
10
|
|
|
10
11
|
// 2gb
|
|
11
12
|
const MAX_ENTRY_SIZE = 2 * 1000 * 1000 * 1000
|
|
12
13
|
|
|
14
|
+
// 1MiB
|
|
15
|
+
const COMPRESS_THRESHOLD = 1024 * 1024
|
|
16
|
+
|
|
17
|
+
// zstd support landed in Node 22.19.0/23.4.0, so it may be missing even when
|
|
18
|
+
// node:sqlite is available.
|
|
19
|
+
const hasZstd = typeof zstdCompressSync === 'function' && typeof zstdDecompressSync === 'function'
|
|
20
|
+
|
|
13
21
|
/**
|
|
14
22
|
* @typedef {import('../../types/cache-interceptor.d.ts').default.CacheStore} CacheStore
|
|
15
23
|
* @implements {CacheStore}
|
|
@@ -17,6 +25,7 @@ const MAX_ENTRY_SIZE = 2 * 1000 * 1000 * 1000
|
|
|
17
25
|
* @typedef {{
|
|
18
26
|
* id: Readonly<number>,
|
|
19
27
|
* body?: Uint8Array
|
|
28
|
+
* compressed?: string
|
|
20
29
|
* statusCode: number
|
|
21
30
|
* statusMessage: string
|
|
22
31
|
* headers?: string
|
|
@@ -31,6 +40,7 @@ const MAX_ENTRY_SIZE = 2 * 1000 * 1000 * 1000
|
|
|
31
40
|
module.exports = class SqliteCacheStore {
|
|
32
41
|
#maxEntrySize = MAX_ENTRY_SIZE
|
|
33
42
|
#maxCount = Infinity
|
|
43
|
+
#compressThreshold = COMPRESS_THRESHOLD
|
|
34
44
|
|
|
35
45
|
/**
|
|
36
46
|
* @type {import('node:sqlite').DatabaseSync}
|
|
@@ -107,6 +117,17 @@ module.exports = class SqliteCacheStore {
|
|
|
107
117
|
}
|
|
108
118
|
this.#maxCount = opts.maxCount
|
|
109
119
|
}
|
|
120
|
+
|
|
121
|
+
if (opts.compressThreshold !== undefined) {
|
|
122
|
+
if (
|
|
123
|
+
typeof opts.compressThreshold !== 'number' ||
|
|
124
|
+
!Number.isInteger(opts.compressThreshold) ||
|
|
125
|
+
opts.compressThreshold < 0
|
|
126
|
+
) {
|
|
127
|
+
throw new TypeError('SqliteCacheStore options.compressThreshold must be a non-negative integer')
|
|
128
|
+
}
|
|
129
|
+
this.#compressThreshold = opts.compressThreshold
|
|
130
|
+
}
|
|
110
131
|
}
|
|
111
132
|
|
|
112
133
|
if (!DatabaseSync) {
|
|
@@ -128,6 +149,7 @@ module.exports = class SqliteCacheStore {
|
|
|
128
149
|
|
|
129
150
|
-- Data returned to the interceptor
|
|
130
151
|
body BUF NULL,
|
|
152
|
+
compressed TEXT NULL,
|
|
131
153
|
deleteAt INTEGER NOT NULL,
|
|
132
154
|
statusCode INTEGER NOT NULL,
|
|
133
155
|
statusMessage TEXT NOT NULL,
|
|
@@ -147,6 +169,7 @@ module.exports = class SqliteCacheStore {
|
|
|
147
169
|
SELECT
|
|
148
170
|
id,
|
|
149
171
|
body,
|
|
172
|
+
compressed,
|
|
150
173
|
deleteAt,
|
|
151
174
|
statusCode,
|
|
152
175
|
statusMessage,
|
|
@@ -167,6 +190,7 @@ module.exports = class SqliteCacheStore {
|
|
|
167
190
|
this.#updateValueQuery = this.#db.prepare(`
|
|
168
191
|
UPDATE cacheInterceptorV${VERSION} SET
|
|
169
192
|
body = ?,
|
|
193
|
+
compressed = ?,
|
|
170
194
|
deleteAt = ?,
|
|
171
195
|
statusCode = ?,
|
|
172
196
|
statusMessage = ?,
|
|
@@ -185,6 +209,7 @@ module.exports = class SqliteCacheStore {
|
|
|
185
209
|
url,
|
|
186
210
|
method,
|
|
187
211
|
body,
|
|
212
|
+
compressed,
|
|
188
213
|
deleteAt,
|
|
189
214
|
statusCode,
|
|
190
215
|
statusMessage,
|
|
@@ -194,7 +219,7 @@ module.exports = class SqliteCacheStore {
|
|
|
194
219
|
vary,
|
|
195
220
|
cachedAt,
|
|
196
221
|
staleAt
|
|
197
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
222
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
198
223
|
`)
|
|
199
224
|
|
|
200
225
|
this.#deleteByUrlQuery = this.#db.prepare(
|
|
@@ -237,7 +262,11 @@ module.exports = class SqliteCacheStore {
|
|
|
237
262
|
const value = this.#findValue(key)
|
|
238
263
|
return value
|
|
239
264
|
? {
|
|
240
|
-
body: value.body
|
|
265
|
+
body: value.body
|
|
266
|
+
? value.compressed === 'zstd'
|
|
267
|
+
? zstdDecompressSync(Buffer.from(value.body.buffer, value.body.byteOffset, value.body.byteLength))
|
|
268
|
+
: Buffer.from(value.body.buffer, value.body.byteOffset, value.body.byteLength)
|
|
269
|
+
: undefined,
|
|
241
270
|
statusCode: value.statusCode,
|
|
242
271
|
statusMessage: value.statusMessage,
|
|
243
272
|
headers: value.headers ? JSON.parse(value.headers) : undefined,
|
|
@@ -268,11 +297,22 @@ module.exports = class SqliteCacheStore {
|
|
|
268
297
|
return
|
|
269
298
|
}
|
|
270
299
|
|
|
300
|
+
let compressed = null
|
|
301
|
+
let storedBody = body
|
|
302
|
+
if (body && hasZstd && (size > this.#compressThreshold || isCompressibleContentType(getContentType(value.headers)))) {
|
|
303
|
+
const candidate = zstdCompressSync(body)
|
|
304
|
+
if (candidate.byteLength < body.byteLength) {
|
|
305
|
+
storedBody = candidate
|
|
306
|
+
compressed = 'zstd'
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
271
310
|
const existingValue = this.#findValue(key, true)
|
|
272
311
|
if (existingValue) {
|
|
273
312
|
// Updating an existing response, let's overwrite it
|
|
274
313
|
this.#updateValueQuery.run(
|
|
275
|
-
|
|
314
|
+
storedBody,
|
|
315
|
+
compressed,
|
|
276
316
|
value.deleteAt,
|
|
277
317
|
value.statusCode,
|
|
278
318
|
value.statusMessage,
|
|
@@ -289,7 +329,8 @@ module.exports = class SqliteCacheStore {
|
|
|
289
329
|
this.#insertValueQuery.run(
|
|
290
330
|
url,
|
|
291
331
|
key.method,
|
|
292
|
-
|
|
332
|
+
storedBody,
|
|
333
|
+
compressed,
|
|
293
334
|
value.deleteAt,
|
|
294
335
|
value.statusCode,
|
|
295
336
|
value.statusMessage,
|
|
@@ -467,3 +508,40 @@ function headerValueEquals (lhs, rhs) {
|
|
|
467
508
|
|
|
468
509
|
return lhs === rhs
|
|
469
510
|
}
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* @param {Record<string, string|string[]>|null|undefined} headers
|
|
514
|
+
* @returns {string|undefined}
|
|
515
|
+
*/
|
|
516
|
+
function getContentType (headers) {
|
|
517
|
+
if (headers == null) {
|
|
518
|
+
return undefined
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
for (const key in headers) {
|
|
522
|
+
if (key.toLowerCase() === 'content-type') {
|
|
523
|
+
const value = headers[key]
|
|
524
|
+
return Array.isArray(value) ? value[0] : value
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
return undefined
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* @param {string|undefined} contentType
|
|
533
|
+
* @returns {boolean}
|
|
534
|
+
*/
|
|
535
|
+
function isCompressibleContentType (contentType) {
|
|
536
|
+
if (contentType == null) {
|
|
537
|
+
return false
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
const type = contentType.toLowerCase()
|
|
541
|
+
|
|
542
|
+
// text/* and application/json, xml, javascript, ... are easily compressible
|
|
543
|
+
// even at smaller sizes, so ignore the compressThreshold for them.
|
|
544
|
+
return /^text\//.test(type) ||
|
|
545
|
+
/^application\/(json|xml|javascript|x-www-form-urlencoded|graphql)(\s|;|$)/.test(type) ||
|
|
546
|
+
/\+(json|xml)(\s|;|$)/.test(type)
|
|
547
|
+
}
|
|
@@ -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
|
|
|
@@ -114,7 +114,18 @@ for (let i = 0; i < wellknownHeaderNames.length; ++i) {
|
|
|
114
114
|
lowerCasedKey
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
/**
|
|
118
|
+
* Default WebSocket receive limits (see `webSocket` in Client.md). Used by
|
|
119
|
+
* DispatcherBase#webSocketOptions and by the WebSocket parser when the
|
|
120
|
+
* dispatcher doesn't provide a value, so a dispatcher without
|
|
121
|
+
* `webSocketOptions` (a custom one, or a wrapper) doesn't remove the limits.
|
|
122
|
+
*/
|
|
123
|
+
const defaultWebSocketMaxFragments = 131072
|
|
124
|
+
const defaultWebSocketMaxPayloadSize = 128 * 1024 * 1024 // 128 MB
|
|
125
|
+
|
|
117
126
|
module.exports = {
|
|
118
127
|
wellknownHeaderNames,
|
|
119
|
-
headerNameLowerCasedRecord
|
|
128
|
+
headerNameLowerCasedRecord,
|
|
129
|
+
defaultWebSocketMaxFragments,
|
|
130
|
+
defaultWebSocketMaxPayloadSize
|
|
120
131
|
}
|
|
@@ -306,6 +306,22 @@ class BalancedPoolMissingUpstreamError extends UndiciError {
|
|
|
306
306
|
}
|
|
307
307
|
}
|
|
308
308
|
|
|
309
|
+
const kWebAssemblyNotSupportedError = Symbol.for('undici.error.ERR_WEBASSEMBLY_NOT_SUPPORTED')
|
|
310
|
+
class WebAssemblyNotSupportedError extends Error {
|
|
311
|
+
constructor (message) {
|
|
312
|
+
super(message || 'WebAssembly is not supported in this environment, but is required for HTTP/1 parsing')
|
|
313
|
+
this.code = 'ERR_WEBASSEMBLY_NOT_SUPPORTED'
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
static [Symbol.hasInstance] (instance) {
|
|
317
|
+
return instance && instance[kWebAssemblyNotSupportedError] === true
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
get [kWebAssemblyNotSupportedError] () {
|
|
321
|
+
return true
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
309
325
|
const kHTTPParserError = Symbol.for('undici.error.UND_ERR_HTTP_PARSER')
|
|
310
326
|
class HTTPParserError extends Error {
|
|
311
327
|
constructor (message, code, data) {
|
|
@@ -365,13 +381,14 @@ class RequestRetryError extends UndiciError {
|
|
|
365
381
|
|
|
366
382
|
const kResponseError = Symbol.for('undici.error.UND_ERR_RESPONSE')
|
|
367
383
|
class ResponseError extends UndiciError {
|
|
368
|
-
constructor (message, code, { headers, body }) {
|
|
384
|
+
constructor (message, code, { headers, body, bodyTruncated = false }) {
|
|
369
385
|
super(message)
|
|
370
386
|
this.name = 'ResponseError'
|
|
371
387
|
this.message = message || 'Response error'
|
|
372
388
|
this.code = 'UND_ERR_RESPONSE'
|
|
373
389
|
this.statusCode = code
|
|
374
390
|
this.body = body
|
|
391
|
+
this.bodyTruncated = bodyTruncated
|
|
375
392
|
this.headers = headers
|
|
376
393
|
}
|
|
377
394
|
|
|
@@ -422,6 +439,24 @@ class ProxyConnectionError extends UndiciError {
|
|
|
422
439
|
}
|
|
423
440
|
}
|
|
424
441
|
|
|
442
|
+
const kMaxRedirectsError = Symbol.for('undici.error.UND_ERR_REDIRECT_MAX')
|
|
443
|
+
class MaxRedirectsError extends UndiciError {
|
|
444
|
+
constructor (message) {
|
|
445
|
+
super(message)
|
|
446
|
+
this.name = 'MaxRedirectsError'
|
|
447
|
+
this.message = message || 'max redirects'
|
|
448
|
+
this.code = 'UND_ERR_REDIRECT_MAX'
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
static [Symbol.hasInstance] (instance) {
|
|
452
|
+
return instance && instance[kMaxRedirectsError] === true
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
get [kMaxRedirectsError] () {
|
|
456
|
+
return true
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
|
|
425
460
|
const kMaxOriginsReachedError = Symbol.for('undici.error.UND_ERR_MAX_ORIGINS_REACHED')
|
|
426
461
|
class MaxOriginsReachedError extends UndiciError {
|
|
427
462
|
constructor (message) {
|
|
@@ -469,6 +504,7 @@ class MessageSizeExceededError extends UndiciError {
|
|
|
469
504
|
|
|
470
505
|
module.exports = {
|
|
471
506
|
AbortError,
|
|
507
|
+
WebAssemblyNotSupportedError,
|
|
472
508
|
HTTPParserError,
|
|
473
509
|
UndiciError,
|
|
474
510
|
HeadersTimeoutError,
|
|
@@ -492,6 +528,7 @@ module.exports = {
|
|
|
492
528
|
SecureProxyConnectionError,
|
|
493
529
|
ProxyConnectionError,
|
|
494
530
|
MaxOriginsReachedError,
|
|
531
|
+
MaxRedirectsError,
|
|
495
532
|
Socks5ProxyError,
|
|
496
533
|
MessageSizeExceededError
|
|
497
534
|
}
|
|
@@ -206,7 +206,12 @@ class Request {
|
|
|
206
206
|
this.body = body.byteLength ? Buffer.from(body) : null
|
|
207
207
|
} else if (typeof body === 'string') {
|
|
208
208
|
this.body = body.length ? Buffer.from(body) : null
|
|
209
|
-
} else if (isFormDataLike(body)
|
|
209
|
+
} else if (isFormDataLike(body)) {
|
|
210
|
+
if (!isUndiciFormData(body)) {
|
|
211
|
+
throw new InvalidArgumentError('body must be a FormData created by this undici package instance; FormData from other sources, such as the built-in FormData provided by Node.js, is not supported')
|
|
212
|
+
}
|
|
213
|
+
this.body = body
|
|
214
|
+
} else if (isIterable(body) || isBlobLike(body)) {
|
|
210
215
|
this.body = body
|
|
211
216
|
} else {
|
|
212
217
|
throw new InvalidArgumentError('body must be a string, a Buffer, a Readable stream, an iterable, or an async iterable')
|
|
@@ -564,4 +569,14 @@ function processHeader (request, key, val) {
|
|
|
564
569
|
}
|
|
565
570
|
}
|
|
566
571
|
|
|
572
|
+
let isFormData
|
|
573
|
+
|
|
574
|
+
function isUndiciFormData (body) {
|
|
575
|
+
if (isFormData === undefined) {
|
|
576
|
+
require('../web/fetch/formdata')
|
|
577
|
+
isFormData = require('../web/webidl').webidl.is.FormData
|
|
578
|
+
}
|
|
579
|
+
return isFormData(body)
|
|
580
|
+
}
|
|
581
|
+
|
|
567
582
|
module.exports = Request
|
|
@@ -6,6 +6,7 @@ module.exports = {
|
|
|
6
6
|
kDispatch: Symbol('dispatch'),
|
|
7
7
|
kUrl: Symbol('url'),
|
|
8
8
|
kRequestOrigin: Symbol('request origin'),
|
|
9
|
+
kRedirectCacheControl: Symbol('redirect cache control'),
|
|
9
10
|
kOriginless: Symbol('originless'),
|
|
10
11
|
kWriting: Symbol('writing'),
|
|
11
12
|
kResuming: Symbol('resuming'),
|
|
@@ -72,6 +73,7 @@ module.exports = {
|
|
|
72
73
|
kRemoteSettings: Symbol('http2session remote settings'),
|
|
73
74
|
kHTTP2Stream: Symbol('http2session client stream'),
|
|
74
75
|
kPingInterval: Symbol('ping interval'),
|
|
76
|
+
kUseMilo: Symbol('use milo'),
|
|
75
77
|
kNoProxyAgent: Symbol('no proxy agent'),
|
|
76
78
|
kHttpProxyAgent: Symbol('http proxy agent'),
|
|
77
79
|
kHttpsProxyAgent: Symbol('https proxy agent'),
|
|
@@ -387,7 +387,7 @@ function destroy (stream, err) {
|
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
389
|
|
|
390
|
-
const KEEPALIVE_TIMEOUT_EXPR = /timeout=(\d+)/
|
|
390
|
+
const KEEPALIVE_TIMEOUT_EXPR = /(?:^|,)[\t ]*timeout=(\d+)/i
|
|
391
391
|
/**
|
|
392
392
|
* @param {string} val
|
|
393
393
|
* @returns {number | null}
|
|
@@ -417,6 +417,30 @@ function bufferToLowerCasedHeaderName (value) {
|
|
|
417
417
|
return tree.lookup(value) ?? value.toString('latin1').toLowerCase()
|
|
418
418
|
}
|
|
419
419
|
|
|
420
|
+
/**
|
|
421
|
+
* Writes a header onto a plain object without going through the
|
|
422
|
+
* `Object.prototype` `__proto__` setter. Plain assignment there drops a string
|
|
423
|
+
* value and, when the value is an array, replaces the object's prototype
|
|
424
|
+
* instead of storing anything. Every other name is a normal assignment.
|
|
425
|
+
*
|
|
426
|
+
* @param {Record<string, string | string[]>} obj Accumulator to write onto
|
|
427
|
+
* @param {string} key Header name
|
|
428
|
+
* @param {string | string[]} value Header value
|
|
429
|
+
* @returns {void}
|
|
430
|
+
*/
|
|
431
|
+
function setHeader (obj, key, value) {
|
|
432
|
+
if (key === '__proto__') {
|
|
433
|
+
Object.defineProperty(obj, key, {
|
|
434
|
+
value,
|
|
435
|
+
enumerable: true,
|
|
436
|
+
configurable: true,
|
|
437
|
+
writable: true
|
|
438
|
+
})
|
|
439
|
+
} else {
|
|
440
|
+
obj[key] = value
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
|
|
420
444
|
/**
|
|
421
445
|
* @param {(Buffer | string)[]} headers
|
|
422
446
|
* @param {Record<string, string | string[]>} [obj]
|
|
@@ -984,6 +1008,7 @@ module.exports = {
|
|
|
984
1008
|
toRawHeaders,
|
|
985
1009
|
encodeRawHeaders,
|
|
986
1010
|
parseHeaders,
|
|
1011
|
+
setHeader,
|
|
987
1012
|
parseKeepAliveTimeout,
|
|
988
1013
|
destroy,
|
|
989
1014
|
bodyLength,
|
|
@@ -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()
|