maka-agent 0.2.2-dev.92.20261019 → 0.2.2-dev.98.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
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require('./lib/utils')
|
|
3
|
+
const { normalizeIPv6, removeDotSegments, removeDotSegmentsRelative, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require('./lib/utils')
|
|
4
4
|
const { SCHEMES, getSchemeHandler } = require('./lib/schemes')
|
|
5
5
|
|
|
6
6
|
const VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u
|
|
7
7
|
const MALFORMED_SCHEME_ERROR = 'URI scheme is malformed.'
|
|
8
|
+
const MALFORMED_HOST_ERROR = 'URI host is malformed.'
|
|
9
|
+
// ASCII characters outside the RFC 3986 reg-name set (unreserved, sub-delims
|
|
10
|
+
// and "%" for pct-encoded): C0 controls, space, DEL, and "#/:<>?@[\]^`{|}.
|
|
11
|
+
const FORBIDDEN_DOMAIN_HOST_CHARACTER = /[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u
|
|
8
12
|
|
|
9
13
|
/**
|
|
14
|
+
* RFC 3986 section 3.1 does not allow percent-encoding in a scheme, so the
|
|
15
|
+
* scheme is validated as-is and never decoded. Decoding would let inert input
|
|
16
|
+
* such as `%6Aavascript:` become a live `javascript:` scheme.
|
|
17
|
+
*
|
|
10
18
|
* @param {string} scheme
|
|
11
19
|
* @returns {string}
|
|
12
20
|
*/
|
|
13
|
-
function
|
|
14
|
-
const
|
|
15
|
-
if (!VALID_SCHEME.test(
|
|
21
|
+
function validateScheme (scheme) {
|
|
22
|
+
const stringScheme = String(scheme)
|
|
23
|
+
if (!VALID_SCHEME.test(stringScheme)) {
|
|
16
24
|
throw new TypeError(MALFORMED_SCHEME_ERROR)
|
|
17
25
|
}
|
|
18
|
-
return
|
|
26
|
+
return stringScheme
|
|
19
27
|
}
|
|
20
28
|
|
|
21
29
|
/**
|
|
@@ -76,6 +84,12 @@ function resolve (baseURI, relativeURI, options) {
|
|
|
76
84
|
const resolvedHost = resolved.host
|
|
77
85
|
const resolvedHostIsIP = resolvedHost !== undefined && resolvedHost !== '' &&
|
|
78
86
|
(isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6)
|
|
87
|
+
// Inputs are parsed scheme-neutrally, so delimiters and controls in a domain
|
|
88
|
+
// host are only detected here, once the final scheme is known. They always
|
|
89
|
+
// fail closed, including in percent-encoded hosts.
|
|
90
|
+
if (hasForbiddenDomainHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP)) {
|
|
91
|
+
throw new Error(MALFORMED_HOST_ERROR)
|
|
92
|
+
}
|
|
79
93
|
canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP)
|
|
80
94
|
// Percent escapes in an ASCII reg-name are encoded data. The WHATWG hostname
|
|
81
95
|
// parser can reject them even though fast-uri preserves them safely as RFC
|
|
@@ -133,14 +147,17 @@ function resolveComponent (base, relative, options, skipNormalization) {
|
|
|
133
147
|
if (relative.path[0] === '/') {
|
|
134
148
|
target.path = removeDotSegments(relative.path)
|
|
135
149
|
} else {
|
|
136
|
-
|
|
150
|
+
const baseHasAuthority = base.userinfo !== undefined || base.host !== undefined || base.port !== undefined
|
|
151
|
+
if (baseHasAuthority && !base.path) {
|
|
137
152
|
target.path = '/' + relative.path
|
|
138
153
|
} else if (!base.path) {
|
|
139
154
|
target.path = relative.path
|
|
140
155
|
} else {
|
|
141
156
|
target.path = base.path.slice(0, base.path.lastIndexOf('/') + 1) + relative.path
|
|
142
157
|
}
|
|
143
|
-
target.path =
|
|
158
|
+
target.path = base.scheme === undefined && !baseHasAuthority && target.path[0] !== '/'
|
|
159
|
+
? removeDotSegmentsRelative(target.path)
|
|
160
|
+
: removeDotSegments(target.path)
|
|
144
161
|
}
|
|
145
162
|
target.query = relative.query
|
|
146
163
|
}
|
|
@@ -196,7 +213,7 @@ function serialize (cmpts, opts) {
|
|
|
196
213
|
const uriTokens = []
|
|
197
214
|
|
|
198
215
|
if (component.scheme) {
|
|
199
|
-
component.scheme =
|
|
216
|
+
component.scheme = validateScheme(component.scheme)
|
|
200
217
|
}
|
|
201
218
|
|
|
202
219
|
// find scheme handler
|
|
@@ -206,7 +223,11 @@ function serialize (cmpts, opts) {
|
|
|
206
223
|
if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options)
|
|
207
224
|
|
|
208
225
|
const hasAuthority = component.userinfo !== undefined || component.host !== undefined || component.port !== undefined
|
|
209
|
-
|
|
226
|
+
// A reference with no emitted scheme is path-noscheme: a bare ':' in its
|
|
227
|
+
// first path segment would reparse as a scheme (RFC 3986 3.3/4.2). Enforced
|
|
228
|
+
// under skipEscape too (resolve()), so the reapply below gates on this flag.
|
|
229
|
+
const schemelessReference = (component.scheme === undefined || options.reference === 'suffix') && !hasAuthority
|
|
230
|
+
const pathNoScheme = !options.skipEscape && schemelessReference
|
|
210
231
|
|
|
211
232
|
if (component.path !== undefined) {
|
|
212
233
|
if (!options.skipEscape) {
|
|
@@ -218,7 +239,7 @@ function serialize (cmpts, opts) {
|
|
|
218
239
|
|
|
219
240
|
if (options.reference !== 'suffix' && component.scheme) {
|
|
220
241
|
// Scheme handlers may replace the scheme during serialization.
|
|
221
|
-
component.scheme =
|
|
242
|
+
component.scheme = validateScheme(component.scheme)
|
|
222
243
|
uriTokens.push(component.scheme, ':')
|
|
223
244
|
}
|
|
224
245
|
|
|
@@ -238,13 +259,18 @@ function serialize (cmpts, opts) {
|
|
|
238
259
|
let s = component.path
|
|
239
260
|
|
|
240
261
|
if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
|
|
241
|
-
|
|
262
|
+
// A relative-path reference keeps its unresolvable leading ".." segments
|
|
263
|
+
// and must never become root-relative (RFC 3986 section 5.2.4 applies to
|
|
264
|
+
// merged target paths, not to the reference itself).
|
|
265
|
+
s = schemelessReference && s[0] !== '/'
|
|
266
|
+
? removeDotSegmentsRelative(s)
|
|
267
|
+
: removeDotSegments(s)
|
|
242
268
|
}
|
|
243
269
|
|
|
244
270
|
// Dot-segment removal can expose a colon that was not originally in the
|
|
245
271
|
// first segment (for example, "./a:b"). Reapply path-noscheme encoding so
|
|
246
272
|
// the serialized relative reference cannot be reparsed as a URI scheme.
|
|
247
|
-
if (
|
|
273
|
+
if (schemelessReference) {
|
|
248
274
|
s = serializePathEncoding(s, true)
|
|
249
275
|
}
|
|
250
276
|
|
|
@@ -359,6 +385,11 @@ function hasMalformedComponentPercentEncoding (matches) {
|
|
|
359
385
|
* @returns {boolean} whether host conversion failed
|
|
360
386
|
*/
|
|
361
387
|
function canonicalizeHost (parsed, options, schemeHandler, isIP) {
|
|
388
|
+
if (hasForbiddenDomainHost(parsed, options, schemeHandler, isIP)) {
|
|
389
|
+
parsed.error = parsed.error || MALFORMED_HOST_ERROR
|
|
390
|
+
return true
|
|
391
|
+
}
|
|
392
|
+
|
|
362
393
|
if (
|
|
363
394
|
!options.unicodeSupport &&
|
|
364
395
|
(!schemeHandler || !schemeHandler.unicodeSupport) &&
|
|
@@ -368,16 +399,62 @@ function canonicalizeHost (parsed, options, schemeHandler, isIP) {
|
|
|
368
399
|
isIP === false &&
|
|
369
400
|
nonSimpleDomain(parsed.host)
|
|
370
401
|
) {
|
|
402
|
+
let url
|
|
371
403
|
try {
|
|
372
|
-
|
|
404
|
+
url = new URL('http://' + parsed.host)
|
|
373
405
|
} catch (e) {
|
|
374
406
|
parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e
|
|
375
407
|
return true
|
|
376
408
|
}
|
|
409
|
+
// The WHATWG parser must have read the whole input as a host. Anything
|
|
410
|
+
// else means it found a delimiter fast-uri did not, so its hostname would
|
|
411
|
+
// describe a different authority.
|
|
412
|
+
if (!isHostOnlyURL(url)) {
|
|
413
|
+
parsed.error = parsed.error || MALFORMED_HOST_ERROR
|
|
414
|
+
return true
|
|
415
|
+
}
|
|
416
|
+
parsed.host = url.hostname
|
|
377
417
|
}
|
|
378
418
|
return false
|
|
379
419
|
}
|
|
380
420
|
|
|
421
|
+
/**
|
|
422
|
+
* Whether a domain host contains an ASCII character that RFC 3986 does not
|
|
423
|
+
* allow in a reg-name (unreserved, sub-delims, or pct-encoded). Such a host is
|
|
424
|
+
* rejected instead of being handed to the WHATWG URL parser, which would treat
|
|
425
|
+
* "@" as a userinfo delimiter (silently dropping the data before it) and strip
|
|
426
|
+
* TAB, LF, and CR. Non-ASCII characters remain allowed for IDNs.
|
|
427
|
+
*
|
|
428
|
+
* @param {import('./types/index').URIComponent} parsed
|
|
429
|
+
* @param {import('./types/index').Options} options
|
|
430
|
+
* @param {{ domainHost?: boolean }|undefined} schemeHandler
|
|
431
|
+
* @param {boolean} isIP
|
|
432
|
+
* @returns {boolean}
|
|
433
|
+
*/
|
|
434
|
+
function hasForbiddenDomainHost (parsed, options, schemeHandler, isIP) {
|
|
435
|
+
return Boolean(
|
|
436
|
+
parsed.host &&
|
|
437
|
+
isIP === false &&
|
|
438
|
+
!isIPLiteral(parsed.host) &&
|
|
439
|
+
(options.domainHost || (schemeHandler && schemeHandler.domainHost)) &&
|
|
440
|
+
FORBIDDEN_DOMAIN_HOST_CHARACTER.test(parsed.host)
|
|
441
|
+
)
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* @param {URL} url
|
|
446
|
+
* @returns {boolean}
|
|
447
|
+
*/
|
|
448
|
+
function isHostOnlyURL (url) {
|
|
449
|
+
return url.username === '' &&
|
|
450
|
+
url.password === '' &&
|
|
451
|
+
url.port === '' &&
|
|
452
|
+
url.pathname === '/' &&
|
|
453
|
+
url.search === '' &&
|
|
454
|
+
url.hash === '' &&
|
|
455
|
+
url.hostname !== ''
|
|
456
|
+
}
|
|
457
|
+
|
|
381
458
|
/**
|
|
382
459
|
* @param {string} uri
|
|
383
460
|
* @param {import('./types/index').Options} [opts]
|
|
@@ -460,9 +537,8 @@ function parseWithStatus (uri, opts) {
|
|
|
460
537
|
parsed.fragment = matches[8]
|
|
461
538
|
|
|
462
539
|
if (parsed.scheme !== undefined) {
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
parsed.scheme = decodedScheme.toLowerCase()
|
|
540
|
+
if (VALID_SCHEME.test(parsed.scheme)) {
|
|
541
|
+
parsed.scheme = parsed.scheme.toLowerCase()
|
|
466
542
|
} else {
|
|
467
543
|
parsed.error = parsed.error || MALFORMED_SCHEME_ERROR
|
|
468
544
|
malformedScheme = true
|
|
@@ -496,7 +572,7 @@ function parseWithStatus (uri, opts) {
|
|
|
496
572
|
parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase()
|
|
497
573
|
|
|
498
574
|
if (malformedIPLiteral) {
|
|
499
|
-
parsed.error = parsed.error ||
|
|
575
|
+
parsed.error = parsed.error || MALFORMED_HOST_ERROR
|
|
500
576
|
malformedAuthorityOrPort = true
|
|
501
577
|
}
|
|
502
578
|
} else {
|
|
@@ -533,7 +609,11 @@ function parseWithStatus (uri, opts) {
|
|
|
533
609
|
// pass only restores uppercase hex in escapes that remain encoded.
|
|
534
610
|
host = normalizePercentEncoding(host.toLowerCase())
|
|
535
611
|
}
|
|
536
|
-
|
|
612
|
+
// Resolution parses both inputs with the internal `null` scheme before
|
|
613
|
+
// the effective scheme is known. Keep raw host delimiters for that step
|
|
614
|
+
// so resolve() can reject them for domain-host schemes; the resolved
|
|
615
|
+
// authority is encoded when it is serialized.
|
|
616
|
+
parsed.host = isIP || options.scheme !== 'null' ? reescapeHostDelimiters(host, isIP) : host
|
|
537
617
|
}
|
|
538
618
|
|
|
539
619
|
if (!schemeHandler || (schemeHandler && !schemeHandler.skipNormalize)) {
|
|
@@ -345,6 +345,57 @@ function removeDotSegments (path) {
|
|
|
345
345
|
return output.join('')
|
|
346
346
|
}
|
|
347
347
|
|
|
348
|
+
/**
|
|
349
|
+
* Removes dot segments from the path of a relative reference (a path that does
|
|
350
|
+
* not start with "/") without changing what it resolves to against any base.
|
|
351
|
+
* Unlike `removeDotSegments`, leading ".." segments that cannot be collapsed
|
|
352
|
+
* are kept, the result never becomes root-relative, and a result that would be
|
|
353
|
+
* empty or start with an empty segment is prefixed with "." (an empty path
|
|
354
|
+
* means "same document" and a leading "//" would introduce an authority).
|
|
355
|
+
*
|
|
356
|
+
* @param {string} path
|
|
357
|
+
* @returns {string}
|
|
358
|
+
*/
|
|
359
|
+
function removeDotSegmentsRelative (path) {
|
|
360
|
+
if (path === '' || path[0] === '/') {
|
|
361
|
+
return removeDotSegments(path)
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
const segments = path.split('/')
|
|
365
|
+
const last = segments.length - 1
|
|
366
|
+
/** @type {string[]} */
|
|
367
|
+
const output = []
|
|
368
|
+
let trailingDirectory = false
|
|
369
|
+
|
|
370
|
+
for (let i = 0; i <= last; i++) {
|
|
371
|
+
const segment = segments[i]
|
|
372
|
+
if (segment === '.' || segment === '..') {
|
|
373
|
+
if (segment === '..') {
|
|
374
|
+
if (output.length !== 0 && output[output.length - 1] !== '..') {
|
|
375
|
+
output.pop()
|
|
376
|
+
} else {
|
|
377
|
+
output.push('..')
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
trailingDirectory = i === last
|
|
381
|
+
} else {
|
|
382
|
+
output.push(segment)
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
if (trailingDirectory && output[output.length - 1] !== '..') {
|
|
387
|
+
output.push('')
|
|
388
|
+
}
|
|
389
|
+
if (output.length === 0 || output[0] === '' || output[0].includes(':')) {
|
|
390
|
+
// An empty path, a leading empty segment ("//"), or a first segment
|
|
391
|
+
// containing ":" (which would be mistaken for a scheme, RFC 3986 section
|
|
392
|
+
// 4.2) must stay behind a "." segment so the reference keeps its meaning.
|
|
393
|
+
output.unshift('.')
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
return output.join('/')
|
|
397
|
+
}
|
|
398
|
+
|
|
348
399
|
/**
|
|
349
400
|
* Re-escape RFC 3986 gen-delims that must not appear literally in the host.
|
|
350
401
|
* After the URI regex parses, these characters cannot be literal in the host
|
|
@@ -740,6 +791,7 @@ module.exports = {
|
|
|
740
791
|
encodeFragment,
|
|
741
792
|
escapePreservingEscapes,
|
|
742
793
|
removeDotSegments,
|
|
794
|
+
removeDotSegmentsRelative,
|
|
743
795
|
isIPv4,
|
|
744
796
|
isUUID,
|
|
745
797
|
normalizeIPv6,
|
|
@@ -302,6 +302,15 @@ RedirectableRequest.prototype._sanitizeOptions = function (options) {
|
|
|
302
302
|
if (!options.headers) {
|
|
303
303
|
options.headers = {};
|
|
304
304
|
}
|
|
305
|
+
// Convert [header1, value1, header2, value2, …] to object
|
|
306
|
+
else if (Array.isArray(options.headers)) {
|
|
307
|
+
var headerList = options.headers;
|
|
308
|
+
options.headers = {};
|
|
309
|
+
for (var i = 0; i < headerList.length; i += 2) {
|
|
310
|
+
options.headers[headerList[i]] = headerList[i + 1];
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
// Ensure sensitive headers are always present
|
|
305
314
|
if (!isArray(options.sensitiveHeaders)) {
|
|
306
315
|
options.sensitiveHeaders = [];
|
|
307
316
|
}
|
|
@@ -701,7 +710,7 @@ function isURL(value) {
|
|
|
701
710
|
}
|
|
702
711
|
|
|
703
712
|
function escapeRegex(regex) {
|
|
704
|
-
return regex.replace(/[\]\\/()
|
|
713
|
+
return regex.replace(/[[\]\\/()*+?.^$|]/g, "\\$&");
|
|
705
714
|
}
|
|
706
715
|
|
|
707
716
|
// Exports
|