maka-agent 0.2.1-dev.91.20261018 → 0.2.2-dev.97.20261024
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DISCLAIMER-WIP +1 -1
- package/LICENSE +15 -11
- package/README.md +173 -1
- package/README.zh-CN.md +156 -0
- package/THIRD_PARTY_NOTICES.txt +12 -12
- package/dist/cli-core.js +1 -0
- package/dist/pi-goal.js +13 -0
- package/dist/pi-tui-runner.js +44 -1
- package/dist/run-command-core.js +256 -48
- package/dist/run-session-command.js +534 -0
- package/dist/run-session-result.js +38 -0
- package/dist/run-turn-outcome.js +174 -0
- package/dist/runtime-host-cli.js +32 -17
- package/dist/runtime-host-run-command.js +53 -165
- package/dist/runtime-host-run-mcp.js +3 -0
- package/dist/runtime-host-session-channel.js +3 -1
- package/dist/runtime-host-session-driver.js +5 -0
- package/dist/runtime-host-setup-command.js +114 -7
- package/dist/tui-copy-catalog.js +24 -0
- package/native/runtime-host-windows-task-launcher/prebuilds/win32-x64/maka-runtime-host-task-launcher.exe +0 -0
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/docs/docs/api/Client.md +2 -0
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/core/connect.js +10 -4
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/core/symbols.js +1 -0
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/dispatcher/agent.js +6 -2
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/dispatcher/client-h1.js +0 -2
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/dispatcher/client-h2.js +0 -4
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/dispatcher/client.js +3 -2
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/dispatcher/dispatcher-base.js +12 -0
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/handler/cache-handler.js +48 -0
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/handler/deduplication-handler.js +57 -13
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/handler/redirect-handler.js +8 -1
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/interceptor/decompress.js +15 -5
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/cookies/index.js +3 -1
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/cookies/parse.js +138 -137
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/cookies/util.js +21 -2
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/eventsource/eventsource-stream.js +90 -9
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/eventsource/eventsource.js +4 -1
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/fetch/index.js +3 -3
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/infra/index.js +14 -0
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +5 -5
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/websocket/receiver.js +13 -0
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/package.json +1 -1
- package/node_modules/@maka/acp-executor-plugin/dist/acp-catalog-store.js +87 -0
- package/node_modules/@maka/acp-executor-plugin/dist/acp-catalog.js +98 -21
- package/node_modules/@maka/acp-executor-plugin/dist/index.js +90 -14
- package/node_modules/@maka/acp-executor-plugin/dist/plugin.mjs +3997 -56
- package/node_modules/@maka/core/dist/assistant-turn-ids.js +34 -0
- package/node_modules/@maka/core/dist/bot-chat-settings.js +10 -1
- package/node_modules/@maka/core/dist/event-wait-delivery.js +67 -0
- package/node_modules/@maka/core/dist/event-wait.js +75 -10
- package/node_modules/@maka/core/dist/executor-catalog.js +3 -1
- package/node_modules/@maka/core/dist/goal.js +54 -2
- package/node_modules/@maka/core/dist/model-catalog.js +19 -1
- package/node_modules/@maka/core/dist/model-metadata.generated.js +4 -14
- package/node_modules/@maka/core/dist/model-metadata.js +42 -1
- package/node_modules/@maka/core/dist/models-dev-projection.js +32 -1
- package/node_modules/@maka/core/dist/provider-registry.js +16 -2
- package/node_modules/@maka/core/dist/runtime-event-store.js +0 -1
- package/node_modules/@maka/core/dist/runtime-event.js +24 -2
- package/node_modules/@maka/core/dist/runtime-invocation.js +10 -0
- package/node_modules/@maka/core/dist/session-checkin.js +31 -0
- package/node_modules/@maka/core/dist/tool-ledger-scanner.js +1 -9
- package/node_modules/@maka/core/dist/tool-recovery-bundle.js +1 -14
- package/node_modules/@maka/core/dist/turn-origin.js +14 -2
- package/node_modules/@maka/core/dist/usage-stats/types.js +1 -0
- package/node_modules/@maka/core/package.json +3 -0
- package/node_modules/@maka/eval/node_modules/undici/README.md +25 -3
- package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/CacheStore.md +24 -9
- package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/Client.md +11 -6
- package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/Dispatcher.md +3 -0
- package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/Errors.md +76 -1
- package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/H2CClient.md +3 -2
- package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/Interceptors.md +28 -8
- package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/RedirectHandler.md +13 -10
- package/node_modules/@maka/eval/node_modules/undici/docs/docs/index.md +12 -12
- package/node_modules/@maka/eval/node_modules/undici/docs/docs/type-map.json +66 -66
- package/node_modules/@maka/eval/node_modules/undici/lib/cache/memory-cache-store.js +48 -13
- package/node_modules/@maka/eval/node_modules/undici/lib/cache/sqlite-cache-store.js +83 -5
- package/node_modules/@maka/eval/node_modules/undici/lib/core/connect.js +10 -4
- package/node_modules/@maka/eval/node_modules/undici/lib/core/constants.js +12 -1
- package/node_modules/@maka/eval/node_modules/undici/lib/core/errors.js +38 -1
- package/node_modules/@maka/eval/node_modules/undici/lib/core/request.js +16 -1
- package/node_modules/@maka/eval/node_modules/undici/lib/core/symbols.js +2 -0
- package/node_modules/@maka/eval/node_modules/undici/lib/core/util.js +26 -1
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/agent.js +6 -2
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/client-h1.js +116 -80
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/client-h2.js +124 -17
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/client.js +4 -1
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/dispatcher-base.js +3 -2
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +20 -3
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/parser-h1.js +1064 -0
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/pool-base.js +85 -31
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/pool.js +11 -8
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/proxy-agent.js +18 -8
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/retry-agent.js +10 -0
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/round-robin-pool.js +15 -5
- package/node_modules/@maka/eval/node_modules/undici/lib/handler/cache-handler.js +153 -15
- package/node_modules/@maka/eval/node_modules/undici/lib/handler/deduplication-handler.js +112 -51
- package/node_modules/@maka/eval/node_modules/undici/lib/handler/redirect-handler.js +28 -8
- package/node_modules/@maka/eval/node_modules/undici/lib/handler/retry-handler.js +44 -11
- package/node_modules/@maka/eval/node_modules/undici/lib/interceptor/cache.js +11 -3
- package/node_modules/@maka/eval/node_modules/undici/lib/interceptor/decompress.js +22 -9
- package/node_modules/@maka/eval/node_modules/undici/lib/interceptor/dns.js +11 -0
- package/node_modules/@maka/eval/node_modules/undici/lib/interceptor/response-error.js +72 -28
- package/node_modules/@maka/eval/node_modules/undici/lib/milo/LICENSE.md +7 -0
- package/node_modules/@maka/eval/node_modules/undici/lib/milo/no-simd.js +1002 -0
- package/node_modules/@maka/eval/node_modules/undici/lib/milo/simd.js +1002 -0
- package/node_modules/@maka/eval/node_modules/undici/lib/mock/mock-agent.js +11 -0
- package/node_modules/@maka/eval/node_modules/undici/lib/mock/snapshot-recorder.js +3 -2
- package/node_modules/@maka/eval/node_modules/undici/lib/mock/snapshot-utils.js +3 -2
- package/node_modules/@maka/eval/node_modules/undici/lib/util/cache.js +11 -5
- package/node_modules/@maka/eval/node_modules/undici/lib/web/cookies/util.js +19 -2
- package/node_modules/@maka/eval/node_modules/undici/lib/web/eventsource/eventsource-stream.js +69 -15
- package/node_modules/@maka/eval/node_modules/undici/lib/web/eventsource/eventsource.js +25 -2
- package/node_modules/@maka/eval/node_modules/undici/lib/web/fetch/body.js +47 -38
- package/node_modules/@maka/eval/node_modules/undici/lib/web/fetch/formdata-parser.js +12 -4
- package/node_modules/@maka/eval/node_modules/undici/lib/web/fetch/headers.js +2 -2
- package/node_modules/@maka/eval/node_modules/undici/lib/web/fetch/index.js +8 -4
- package/node_modules/@maka/eval/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +5 -5
- package/node_modules/@maka/eval/node_modules/undici/lib/web/websocket/receiver.js +25 -4
- package/node_modules/@maka/eval/node_modules/undici/package.json +9 -7
- package/node_modules/@maka/mcp/package.json +1 -1
- package/node_modules/@maka/runtime/dist/agent-run.js +5 -1
- package/node_modules/@maka/runtime/dist/agent-swarm-status-tool.js +0 -1
- package/node_modules/@maka/runtime/dist/ai-sdk-compaction.js +29 -15
- package/node_modules/@maka/runtime/dist/ai-sdk-message-projection.js +10 -1
- package/node_modules/@maka/runtime/dist/ai-sdk-turn.js +125 -131
- package/node_modules/@maka/runtime/dist/bots/bot-registry.js +19 -3
- package/node_modules/@maka/runtime/dist/bots/feishu-bridge.js +178 -6
- package/node_modules/@maka/runtime/dist/bots/wechat-bridge.js +163 -9
- package/node_modules/@maka/runtime/dist/context-budget-policy.js +9 -2
- package/node_modules/@maka/runtime/dist/event-wait-tool.js +69 -0
- package/node_modules/@maka/runtime/dist/goal-continuation.js +195 -117
- package/node_modules/@maka/runtime/dist/goal-state.js +8 -0
- package/node_modules/@maka/runtime/dist/history-compact-checkpoint.js +34 -4
- package/node_modules/@maka/runtime/dist/history-compaction.js +7 -0
- package/node_modules/@maka/runtime/dist/memory-extraction.js +0 -2
- package/node_modules/@maka/runtime/dist/model-factory.js +26 -6
- package/node_modules/@maka/runtime/dist/model-fetcher.js +8 -1
- package/node_modules/@maka/runtime/dist/model-history.js +16 -3
- package/node_modules/@maka/runtime/dist/openai-codex-history-compactor.js +15 -5
- package/node_modules/@maka/runtime/dist/plan-tools.js +0 -3
- package/node_modules/@maka/runtime/dist/plugin-executor-backend.js +49 -2
- package/node_modules/@maka/runtime/dist/plugin-executor-service.js +12 -3
- package/node_modules/@maka/runtime/dist/provider-error-classification.js +2 -0
- package/node_modules/@maka/runtime/dist/recovery-resolver.js +2 -1
- package/node_modules/@maka/runtime/dist/runtime-context.js +53 -0
- package/node_modules/@maka/runtime/dist/runtime-event-read-model.js +3 -0
- package/node_modules/@maka/runtime/dist/sandbox-boundary-path.js +79 -2
- package/node_modules/@maka/runtime/dist/session-checkin.js +331 -0
- package/node_modules/@maka/runtime/dist/session-event-runtime-mapper.js +7 -0
- package/node_modules/@maka/runtime/dist/session-manager.js +5 -1
- package/node_modules/@maka/runtime/dist/shell-run-manager.js +34 -0
- package/node_modules/@maka/runtime/dist/stream-graph-supervisor-tools.js +0 -3
- package/node_modules/@maka/runtime/dist/telemetry/builtin-pricing.js +21 -2
- package/node_modules/@maka/runtime/dist/tool-runtime.js +11 -2
- package/node_modules/@maka/runtime/dist/workers/filesystem-worker.mjs +50 -1
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/docs/docs/api/Client.md +2 -0
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/core/connect.js +10 -4
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/core/symbols.js +1 -0
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/dispatcher/agent.js +6 -2
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/dispatcher/client-h1.js +0 -2
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/dispatcher/client-h2.js +0 -4
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/dispatcher/client.js +3 -2
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/dispatcher/dispatcher-base.js +12 -0
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/handler/cache-handler.js +48 -0
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/handler/deduplication-handler.js +57 -13
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/handler/redirect-handler.js +8 -1
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/interceptor/decompress.js +15 -5
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/cookies/index.js +3 -1
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/cookies/parse.js +138 -137
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/cookies/util.js +21 -2
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/eventsource/eventsource-stream.js +90 -9
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/eventsource/eventsource.js +4 -1
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/fetch/index.js +3 -3
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/infra/index.js +14 -0
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +5 -5
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/websocket/receiver.js +13 -0
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/package.json +1 -1
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/package.json +1 -1
- package/node_modules/@maka/runtime/node_modules/undici/README.md +25 -3
- package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/CacheStore.md +24 -9
- package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/Client.md +11 -6
- package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/Dispatcher.md +3 -0
- package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/Errors.md +76 -1
- package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/H2CClient.md +3 -2
- package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/Interceptors.md +28 -8
- package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/RedirectHandler.md +13 -10
- package/node_modules/@maka/runtime/node_modules/undici/docs/docs/index.md +12 -12
- package/node_modules/@maka/runtime/node_modules/undici/docs/docs/type-map.json +66 -66
- package/node_modules/@maka/runtime/node_modules/undici/lib/cache/memory-cache-store.js +48 -13
- package/node_modules/@maka/runtime/node_modules/undici/lib/cache/sqlite-cache-store.js +83 -5
- package/node_modules/@maka/runtime/node_modules/undici/lib/core/connect.js +10 -4
- package/node_modules/@maka/runtime/node_modules/undici/lib/core/constants.js +12 -1
- package/node_modules/@maka/runtime/node_modules/undici/lib/core/errors.js +38 -1
- package/node_modules/@maka/runtime/node_modules/undici/lib/core/request.js +16 -1
- package/node_modules/@maka/runtime/node_modules/undici/lib/core/symbols.js +2 -0
- package/node_modules/@maka/runtime/node_modules/undici/lib/core/util.js +26 -1
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/agent.js +6 -2
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/client-h1.js +116 -80
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/client-h2.js +124 -17
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/client.js +4 -1
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/dispatcher-base.js +3 -2
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +20 -3
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/parser-h1.js +1064 -0
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/pool-base.js +85 -31
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/pool.js +11 -8
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/proxy-agent.js +18 -8
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/retry-agent.js +10 -0
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/round-robin-pool.js +15 -5
- package/node_modules/@maka/runtime/node_modules/undici/lib/handler/cache-handler.js +153 -15
- package/node_modules/@maka/runtime/node_modules/undici/lib/handler/deduplication-handler.js +112 -51
- package/node_modules/@maka/runtime/node_modules/undici/lib/handler/redirect-handler.js +28 -8
- package/node_modules/@maka/runtime/node_modules/undici/lib/handler/retry-handler.js +44 -11
- package/node_modules/@maka/runtime/node_modules/undici/lib/interceptor/cache.js +11 -3
- package/node_modules/@maka/runtime/node_modules/undici/lib/interceptor/decompress.js +22 -9
- package/node_modules/@maka/runtime/node_modules/undici/lib/interceptor/dns.js +11 -0
- package/node_modules/@maka/runtime/node_modules/undici/lib/interceptor/response-error.js +72 -28
- package/node_modules/@maka/runtime/node_modules/undici/lib/milo/LICENSE.md +7 -0
- package/node_modules/@maka/runtime/node_modules/undici/lib/milo/no-simd.js +1002 -0
- package/node_modules/@maka/runtime/node_modules/undici/lib/milo/simd.js +1002 -0
- package/node_modules/@maka/runtime/node_modules/undici/lib/mock/mock-agent.js +11 -0
- package/node_modules/@maka/runtime/node_modules/undici/lib/mock/snapshot-recorder.js +3 -2
- package/node_modules/@maka/runtime/node_modules/undici/lib/mock/snapshot-utils.js +3 -2
- package/node_modules/@maka/runtime/node_modules/undici/lib/util/cache.js +11 -5
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/cookies/util.js +19 -2
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/eventsource/eventsource-stream.js +69 -15
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/eventsource/eventsource.js +25 -2
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/fetch/body.js +47 -38
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/fetch/formdata-parser.js +12 -4
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/fetch/headers.js +2 -2
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/fetch/index.js +8 -4
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +5 -5
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/websocket/receiver.js +25 -4
- package/node_modules/@maka/runtime/node_modules/undici/package.json +9 -7
- package/node_modules/@maka/runtime/package.json +3 -0
- package/node_modules/@maka/runtime-host/dist/assistant/bot/bridge.js +8 -0
- package/node_modules/@maka/runtime-host/dist/assistant/bot/capabilities.js +1 -0
- package/node_modules/@maka/runtime-host/dist/assistant/bot/controller.js +92 -22
- package/node_modules/@maka/runtime-host/dist/assistant/bot/host.js +11 -2
- package/node_modules/@maka/runtime-host/dist/assistant/bot/store.js +71 -2
- package/node_modules/@maka/runtime-host/dist/assistant/bot/turn-ids.js +38 -0
- package/node_modules/@maka/runtime-host/dist/assistant/index-initiative/assistant.js +7 -0
- package/node_modules/@maka/runtime-host/dist/assistant/index-initiative/controller.js +193 -32
- package/node_modules/@maka/runtime-host/dist/assistant/index-initiative/discovery-capabilities.js +69 -0
- package/node_modules/@maka/runtime-host/dist/assistant/index-initiative/host.js +15 -28
- package/node_modules/@maka/runtime-host/dist/assistant/index-initiative/notebook.js +286 -0
- package/node_modules/@maka/runtime-host/dist/assistant/index-initiative/prompt.js +31 -6
- package/node_modules/@maka/runtime-host/dist/assistant/index-initiative/store.js +18 -1
- package/node_modules/@maka/runtime-host/dist/assistant/memory-network/controller.js +203 -71
- package/node_modules/@maka/runtime-host/dist/assistant/memory-network/host.js +21 -5
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/condition-observer.js +94 -0
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/condition-store.js +253 -0
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/condition.js +133 -0
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/controller.js +27 -14
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/delegation.js +37 -5
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/delivery.js +1 -1
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/host.js +16 -2
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/matter.js +13 -0
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/prompt.js +7 -5
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/review.js +68 -14
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/settlement-context.js +126 -0
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/store.js +92 -6
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/tools.js +93 -23
- package/node_modules/@maka/runtime-host/dist/assistant/service.js +72 -16
- package/node_modules/@maka/runtime-host/dist/client/host-profile.js +30 -1
- package/node_modules/@maka/runtime-host/dist/client/ssh-operator-activation.js +9 -2
- package/node_modules/@maka/runtime-host/dist/protocol/goal.js +119 -1
- package/node_modules/@maka/runtime-host/dist/protocol/index.js +10 -3
- package/node_modules/@maka/runtime-host/dist/protocol/operations.js +8 -1
- package/node_modules/@maka/runtime-host/dist/protocol/personal-assistant.js +1 -0
- package/node_modules/@maka/runtime-host/dist/protocol/plugin-platform.js +7 -1
- package/node_modules/@maka/runtime-host/dist/protocol/session-checkin.js +133 -0
- package/node_modules/@maka/runtime-host/dist/server/agent-settings-tools.js +0 -1
- package/node_modules/@maka/runtime-host/dist/server/canonical-session-projection.js +3 -2
- package/node_modules/@maka/runtime-host/dist/server/event-wait-manager.js +151 -20
- package/node_modules/@maka/runtime-host/dist/server/event-wait-observation-store.js +19 -0
- package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +127 -11
- package/node_modules/@maka/runtime-host/dist/server/execution-model-authority.js +47 -3
- package/node_modules/@maka/runtime-host/dist/server/execution-model-composition.js +11 -0
- package/node_modules/@maka/runtime-host/dist/server/external-session-coordinator.js +5 -2
- package/node_modules/@maka/runtime-host/dist/server/goal-coordinator.js +343 -53
- package/node_modules/@maka/runtime-host/dist/server/goal-event-waits.js +457 -0
- package/node_modules/@maka/runtime-host/dist/server/goal-execution-coordinator.js +23 -6
- package/node_modules/@maka/runtime-host/dist/server/goal-projection.js +24 -3
- package/node_modules/@maka/runtime-host/dist/server/hosted-execution-recovery.js +5 -1
- package/node_modules/@maka/runtime-host/dist/server/index.js +2 -0
- package/node_modules/@maka/runtime-host/dist/server/interactive-run-composer.js +44 -2
- package/node_modules/@maka/runtime-host/dist/server/personal-assistant-workspace.js +78 -0
- package/node_modules/@maka/runtime-host/dist/server/root-turn-coordinator.js +8 -0
- package/node_modules/@maka/runtime-host/dist/server/session-catalog-coordinator.js +73 -3
- package/node_modules/@maka/runtime-host/dist/server/session-checkin.js +257 -0
- package/node_modules/@maka/runtime-host/dist/server/session-checkpoint-coordinator.js +282 -0
- package/node_modules/@maka/runtime-host/dist/server/session-checkpoint-publication.js +250 -0
- package/node_modules/@maka/runtime-host/dist/server/shell-run-event-wait-access.js +166 -0
- package/node_modules/@maka/runtime-host/dist/server/shell-run-event-wait-adapter.js +59 -0
- package/node_modules/@maka/runtime-host/dist/server/skill-catalog-repository.js +4 -2
- package/node_modules/@maka/storage/dist/agent-run-store-contract.js +14 -3
- package/node_modules/@maka/storage/dist/agent-run-store.js +10 -0
- package/node_modules/@maka/storage/dist/codex-session-adapter.js +20 -3
- package/node_modules/@maka/storage/dist/context-offload-snapshot.js +2 -1
- package/node_modules/@maka/storage/dist/event-wait-authority.js +18 -1
- package/node_modules/@maka/storage/dist/event-wait-bridge.js +336 -0
- package/node_modules/@maka/storage/dist/execution-stores.js +39 -1
- package/node_modules/@maka/storage/dist/external-session-images.js +131 -0
- package/node_modules/@maka/storage/dist/external-session-importer.js +12 -2
- package/node_modules/@maka/storage/dist/goal-authority.js +2 -0
- package/node_modules/@maka/storage/dist/local-execution-persistence.js +27 -1
- package/node_modules/@maka/storage/dist/operational-state-store.js +1 -1
- package/node_modules/@maka/storage/dist/production-session-snapshot.js +14 -6
- package/node_modules/@maka/storage/dist/runtime-event-persistence.js +1 -0
- package/node_modules/@maka/storage/dist/session-bundle-policy.js +116 -16
- package/node_modules/@maka/storage/dist/session-checkpoint-publication-store.js +204 -0
- package/node_modules/@maka/storage/dist/session-store.js +37 -8
- package/node_modules/@maka/storage/dist/snapshot-operation-gate.js +65 -0
- package/node_modules/@maka/storage/dist/sqlite-context-offload-schema.js +3 -3
- package/node_modules/@maka/storage/dist/sqlite-context-offload-store.js +4 -2
- package/node_modules/@maka/storage/dist/sqlite-event-wait-authority.js +81 -8
- package/node_modules/@maka/storage/dist/sqlite-event-wait-bridge.js +94 -0
- package/node_modules/@maka/storage/dist/sqlite-reclamation-checkpoint.js +37 -0
- package/node_modules/@maka/storage/dist/sqlite-runtime-schema.js +7 -8
- package/node_modules/@maka/storage/dist/sqlite-runtime-store.js +38 -162
- package/node_modules/@maka/storage/dist/sqlite-workflow-schema.js +7 -4
- package/node_modules/@maka/storage/dist/tool-commit-validation.js +1 -1
- package/node_modules/@maka/storage/package.json +4 -0
- package/node_modules/@modelcontextprotocol/client/dist/index-B-4n9P0J.d.mts.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/index-J2FaQ-KY.d.cts.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/index.cjs +76 -22
- package/node_modules/@modelcontextprotocol/client/dist/index.d.cts.map +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/index.d.mts.map +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/index.mjs +76 -22
- package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.cjs +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.mjs +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/{src-oZBjf3U1.cjs → src-DpAS0jfg.cjs} +105 -8
- package/node_modules/@modelcontextprotocol/client/dist/{src-xKF0PJN-.mjs → src-WCy6ifGf.mjs} +88 -9
- package/node_modules/@modelcontextprotocol/client/dist/stdio.cjs +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/stdio.mjs +1 -1
- package/node_modules/@modelcontextprotocol/client/node_modules/@modelcontextprotocol/core/package.json +2 -2
- package/node_modules/@modelcontextprotocol/client/package.json +5 -5
- package/node_modules/fast-uri/.github/workflows/release.yml +35 -0
- package/node_modules/fast-uri/README.md +8 -0
- package/node_modules/fast-uri/index.js +98 -18
- package/node_modules/fast-uri/lib/utils.js +52 -0
- package/node_modules/fast-uri/package.json +1 -1
- package/node_modules/follow-redirects/index.js +10 -1
- package/node_modules/follow-redirects/package.json +1 -1
- package/node_modules/ip-address/README.md +104 -104
- package/node_modules/ip-address/dist/ipv4.js +7 -0
- package/node_modules/ip-address/dist/ipv6.js +7 -4
- package/node_modules/ip-address/dist/v6/constants.js +3 -0
- package/node_modules/ip-address/package.json +2 -1
- package/node_modules/undici/README.md +25 -3
- package/node_modules/undici/docs/docs/api/CacheStore.md +24 -9
- package/node_modules/undici/docs/docs/api/Client.md +11 -6
- package/node_modules/undici/docs/docs/api/Dispatcher.md +3 -0
- package/node_modules/undici/docs/docs/api/Errors.md +76 -1
- package/node_modules/undici/docs/docs/api/H2CClient.md +3 -2
- package/node_modules/undici/docs/docs/api/Interceptors.md +28 -8
- package/node_modules/undici/docs/docs/api/RedirectHandler.md +13 -10
- package/node_modules/undici/docs/docs/index.md +12 -12
- package/node_modules/undici/docs/docs/type-map.json +66 -66
- package/node_modules/undici/lib/cache/memory-cache-store.js +48 -13
- package/node_modules/undici/lib/cache/sqlite-cache-store.js +83 -5
- package/node_modules/undici/lib/core/connect.js +10 -4
- package/node_modules/undici/lib/core/constants.js +12 -1
- package/node_modules/undici/lib/core/errors.js +38 -1
- package/node_modules/undici/lib/core/request.js +16 -1
- package/node_modules/undici/lib/core/symbols.js +2 -0
- package/node_modules/undici/lib/core/util.js +26 -1
- package/node_modules/undici/lib/dispatcher/agent.js +6 -2
- package/node_modules/undici/lib/dispatcher/client-h1.js +116 -80
- package/node_modules/undici/lib/dispatcher/client-h2.js +124 -17
- package/node_modules/undici/lib/dispatcher/client.js +4 -1
- package/node_modules/undici/lib/dispatcher/dispatcher-base.js +3 -2
- package/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +20 -3
- package/node_modules/undici/lib/dispatcher/parser-h1.js +1064 -0
- package/node_modules/undici/lib/dispatcher/pool-base.js +85 -31
- package/node_modules/undici/lib/dispatcher/pool.js +11 -8
- package/node_modules/undici/lib/dispatcher/proxy-agent.js +18 -8
- package/node_modules/undici/lib/dispatcher/retry-agent.js +10 -0
- package/node_modules/undici/lib/dispatcher/round-robin-pool.js +15 -5
- package/node_modules/undici/lib/handler/cache-handler.js +153 -15
- package/node_modules/undici/lib/handler/deduplication-handler.js +112 -51
- package/node_modules/undici/lib/handler/redirect-handler.js +28 -8
- package/node_modules/undici/lib/handler/retry-handler.js +44 -11
- package/node_modules/undici/lib/interceptor/cache.js +11 -3
- package/node_modules/undici/lib/interceptor/decompress.js +22 -9
- package/node_modules/undici/lib/interceptor/dns.js +11 -0
- package/node_modules/undici/lib/interceptor/response-error.js +72 -28
- package/node_modules/undici/lib/milo/LICENSE.md +7 -0
- package/node_modules/undici/lib/milo/no-simd.js +1002 -0
- package/node_modules/undici/lib/milo/simd.js +1002 -0
- package/node_modules/undici/lib/mock/mock-agent.js +11 -0
- package/node_modules/undici/lib/mock/snapshot-recorder.js +3 -2
- package/node_modules/undici/lib/mock/snapshot-utils.js +3 -2
- package/node_modules/undici/lib/util/cache.js +11 -5
- package/node_modules/undici/lib/web/cookies/util.js +19 -2
- package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +69 -15
- package/node_modules/undici/lib/web/eventsource/eventsource.js +25 -2
- package/node_modules/undici/lib/web/fetch/body.js +47 -38
- package/node_modules/undici/lib/web/fetch/formdata-parser.js +12 -4
- package/node_modules/undici/lib/web/fetch/headers.js +2 -2
- package/node_modules/undici/lib/web/fetch/index.js +8 -4
- package/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +5 -5
- package/node_modules/undici/lib/web/websocket/receiver.js +25 -4
- package/node_modules/undici/package.json +9 -7
- package/node_modules/zod/package.json +1 -1
- package/node_modules/zod/v4/core/compile.cjs +8 -0
- package/node_modules/zod/v4/core/compile.js +8 -0
- package/node_modules/zod/v4/core/schemas.cjs +30 -0
- package/node_modules/zod/v4/core/schemas.js +30 -0
- package/node_modules/zod/v4/core/util.cjs +15 -0
- package/node_modules/zod/v4/core/util.js +14 -0
- package/node_modules/zod/v4/core/versions.cjs +1 -1
- package/node_modules/zod/v4/core/versions.js +1 -1
- package/package.json +2 -2
- package/node_modules/@modelcontextprotocol/client/dist/index-D_CiY-T3.d.cts.map +0 -1
- package/node_modules/@modelcontextprotocol/client/dist/index-D_QDtbiv.d.mts.map +0 -1
|
@@ -57,6 +57,7 @@ import { SESSION_REVISION_OPERATION_SPECS } from './session-revision.js';
|
|
|
57
57
|
import { SESSION_BUNDLE_OPERATION_SPECS } from './session-bundle.js';
|
|
58
58
|
import { SESSION_RETIREMENT_OPERATION_SPECS } from './session-retirement.js';
|
|
59
59
|
import { PROMPT_SUGGESTION_OPERATION_SPECS } from './prompt-suggestions.js';
|
|
60
|
+
import { SESSION_CHECKIN_OPERATION_SPECS } from './session-checkin.js';
|
|
60
61
|
import { SESSION_EFFECT_OPERATION_SPECS } from './session-effects.js';
|
|
61
62
|
import { SKILL_CATALOG_OPERATION_SPECS } from './skill-catalog.js';
|
|
62
63
|
import { STORAGE_RETENTION_OPERATION_SPECS } from './storage-retention.js';
|
|
@@ -98,6 +99,7 @@ export * from './session-turns.js';
|
|
|
98
99
|
export * from './session-todo.js';
|
|
99
100
|
export * from './session-effects.js';
|
|
100
101
|
export * from './prompt-suggestions.js';
|
|
102
|
+
export * from './session-checkin.js';
|
|
101
103
|
export * from './skill-catalog.js';
|
|
102
104
|
export * from './storage-retention.js';
|
|
103
105
|
export * from './storage-usage.js';
|
|
@@ -105,7 +107,10 @@ export * from './usage-pricing.js';
|
|
|
105
107
|
export * from './web-search.js';
|
|
106
108
|
export * from './recall.js';
|
|
107
109
|
export * from './workspace.js';
|
|
108
|
-
export const HOST_OPERATION_SPECS = composeOperationSpecMaps(HOST_BOOTSTRAP_OPERATION_SPECS, HOST_RESOURCE_OPERATION_SPECS, PEER_MESH_OPERATION_SPECS, HOSTED_EXECUTION_OPERATION_SPECS, ACCESS_AUTHORITY_OPERATION_SPECS, SESSION_COLLABORATION_OPERATION_SPECS, AGENT_GRAPH_OPERATION_SPECS, GOAL_OPERATION_SPECS, TURN_OPERATION_SPECS, CONTEXT_OPERATION_SPECS, CONNECTION_EFFECT_OPERATION_SPECS, DAILY_REVIEW_OPERATION_SPECS, EXECUTION_INSPECT_OPERATION_SPECS, EXTERNAL_SESSION_OPERATION_SPECS, RUNTIME_POLICY_OPERATION_SPECS, RUNTIME_RESOURCE_OPERATION_SPECS, SCHEDULED_TASK_OPERATION_SPECS, PLAN_OPERATION_SPECS, PROJECT_CATALOG_OPERATION_SPECS, MESSAGE_OPERATION_SPECS, SESSION_TODO_OPERATION_SPECS, INTERACTION_OPERATION_SPECS, SESSION_CONTINUITY_OPERATION_SPECS, SESSION_TRANSCRIPT_OPERATION_SPECS, SESSION_TURNS_OPERATION_SPECS, SESSION_CATALOG_OPERATION_SPECS, SESSION_EFFECT_OPERATION_SPECS,
|
|
110
|
+
export const HOST_OPERATION_SPECS = composeOperationSpecMaps(HOST_BOOTSTRAP_OPERATION_SPECS, HOST_RESOURCE_OPERATION_SPECS, PEER_MESH_OPERATION_SPECS, HOSTED_EXECUTION_OPERATION_SPECS, ACCESS_AUTHORITY_OPERATION_SPECS, SESSION_COLLABORATION_OPERATION_SPECS, AGENT_GRAPH_OPERATION_SPECS, GOAL_OPERATION_SPECS, TURN_OPERATION_SPECS, CONTEXT_OPERATION_SPECS, CONNECTION_EFFECT_OPERATION_SPECS, DAILY_REVIEW_OPERATION_SPECS, EXECUTION_INSPECT_OPERATION_SPECS, EXTERNAL_SESSION_OPERATION_SPECS, RUNTIME_POLICY_OPERATION_SPECS, RUNTIME_RESOURCE_OPERATION_SPECS, SCHEDULED_TASK_OPERATION_SPECS, PLAN_OPERATION_SPECS, PROJECT_CATALOG_OPERATION_SPECS, MESSAGE_OPERATION_SPECS, SESSION_TODO_OPERATION_SPECS, INTERACTION_OPERATION_SPECS, SESSION_CONTINUITY_OPERATION_SPECS, SESSION_TRANSCRIPT_OPERATION_SPECS, SESSION_TURNS_OPERATION_SPECS, SESSION_CATALOG_OPERATION_SPECS, SESSION_EFFECT_OPERATION_SPECS,
|
|
111
|
+
// One argument for both: the disjoint-key check across every map passed here
|
|
112
|
+
// already sits at TypeScript's type instantiation depth limit.
|
|
113
|
+
{ ...PROMPT_SUGGESTION_OPERATION_SPECS, ...SESSION_CHECKIN_OPERATION_SPECS }, SESSION_REVISION_OPERATION_SPECS, SESSION_BUNDLE_OPERATION_SPECS, SESSION_RETIREMENT_OPERATION_SPECS, ARTIFACT_OPERATION_SPECS, SKILL_CATALOG_OPERATION_SPECS, USAGE_PRICING_OPERATION_SPECS, STORAGE_USAGE_OPERATION_SPECS, STORAGE_RETENTION_OPERATION_SPECS, composeOperationSpecMaps(MEMORY_OPERATION_SPECS, PERSONAL_ASSISTANT_OPERATION_SPECS), OAUTH_OPERATION_SPECS, EXTERNAL_AGENT_SETUP_OPERATION_SPECS, CLIENT_CAPABILITY_OPERATION_SPECS, WEB_SEARCH_OPERATION_SPECS, NETWORK_PROXY_OPERATION_SPECS, RECALL_OPERATION_SPECS, CONFIGURATION_OPERATION_SPECS, WORKHUB_COORDINATION_OPERATION_SPECS, PLUGIN_PLATFORM_OPERATION_SPECS);
|
|
109
114
|
// Remote credentials are fail-closed: adding a protocol operation does not
|
|
110
115
|
// grant it to remote owners until this policy is deliberately updated.
|
|
111
116
|
export const REMOTE_OWNER_OPERATION_GRANTS = Object.freeze([
|
|
@@ -152,6 +157,7 @@ export const REMOTE_OWNER_OPERATION_GRANTS = Object.freeze([
|
|
|
152
157
|
'external-session.source.query',
|
|
153
158
|
'goal.arm',
|
|
154
159
|
'goal.control',
|
|
160
|
+
'goal.event-wait.cancel',
|
|
155
161
|
'goal.query',
|
|
156
162
|
'host.diagnostics.query',
|
|
157
163
|
'host.resources.query',
|
|
@@ -197,6 +203,7 @@ export const REMOTE_OWNER_OPERATION_GRANTS = Object.freeze([
|
|
|
197
203
|
'scheduled-task.query',
|
|
198
204
|
'session.branch.create',
|
|
199
205
|
'session.catalog.query',
|
|
206
|
+
'session.checkin.generate',
|
|
200
207
|
'session.configuration.update',
|
|
201
208
|
'session.create',
|
|
202
209
|
'session.execution_boundary.query',
|
|
@@ -93,13 +93,19 @@ export const PLUGIN_PLATFORM_OPERATION_SPECS = {
|
|
|
93
93
|
decodeInput: (value) => {
|
|
94
94
|
const record = requireRecord(value, 'Executor query');
|
|
95
95
|
if (record.kind === 'catalog') {
|
|
96
|
-
const input = requireShapedRecord(record, 'Executor catalog', ['kind', 'cwd'], ['refresh']);
|
|
96
|
+
const input = requireShapedRecord(record, 'Executor catalog', ['kind', 'cwd'], ['refresh', 'executorId', 'listOnly']);
|
|
97
97
|
if (input.refresh !== undefined && typeof input.refresh !== 'boolean')
|
|
98
98
|
throw invalidProtocolFrame('Invalid executor refresh flag');
|
|
99
|
+
if (input.listOnly !== undefined && typeof input.listOnly !== 'boolean')
|
|
100
|
+
throw invalidProtocolFrame('Invalid executor inventory flag');
|
|
99
101
|
return {
|
|
100
102
|
kind: 'catalog',
|
|
101
103
|
cwd: requireString(input.cwd, 'cwd', 4096),
|
|
102
104
|
...(input.refresh ? { refresh: true } : {}),
|
|
105
|
+
...(input.executorId !== undefined
|
|
106
|
+
? { executorId: requireId(input.executorId, 'executorId') }
|
|
107
|
+
: {}),
|
|
108
|
+
...(input.listOnly ? { listOnly: true } : {}),
|
|
103
109
|
};
|
|
104
110
|
}
|
|
105
111
|
const input = requireExactRecord(record, 'Executor conversation', ['kind', 'sessionId']);
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
* or more contributor license agreements. See the NOTICE file
|
|
4
|
+
* distributed with this work for additional information
|
|
5
|
+
* regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
* to you under the Apache License, Version 2.0 (the
|
|
7
|
+
* "License"); you may not use this file except in compliance
|
|
8
|
+
* with the License. You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
|
13
|
+
* software distributed under the License is distributed on an
|
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
* KIND, either express or implied. See the License for the
|
|
16
|
+
* specific language governing permissions and limitations
|
|
17
|
+
* under the License.
|
|
18
|
+
*/
|
|
19
|
+
import { CHECKIN_INSTRUCTION_MAX_CHARS, CHECKIN_MAX_CARDS, CHECKIN_QUOTE_MAX_CHARS, CHECKIN_TITLE_MAX_CHARS, isCheckinCardAction, isCheckinEvidenceSource, } from '@maka/core/session-checkin';
|
|
20
|
+
import { requireCount, requireEntityId, requireExactRecord, requireRecord, requireShapedRecord, } from './codec.js';
|
|
21
|
+
import { invalidProtocolFrame } from './errors.js';
|
|
22
|
+
import { defineOperation } from './operation-spec.js';
|
|
23
|
+
const SESSION_NAME_MAX_BYTES = 1024;
|
|
24
|
+
const SESSION_CHECKIN_FAILURE_CLASSES = [
|
|
25
|
+
'aborted',
|
|
26
|
+
'timeout',
|
|
27
|
+
'configuration',
|
|
28
|
+
'provider',
|
|
29
|
+
'invalid_response',
|
|
30
|
+
'unknown',
|
|
31
|
+
];
|
|
32
|
+
export const SESSION_CHECKIN_OPERATION_SPECS = {
|
|
33
|
+
'session.checkin.generate': defineOperation({
|
|
34
|
+
mode: 'command',
|
|
35
|
+
availability: 'ready',
|
|
36
|
+
errors: [
|
|
37
|
+
'host_not_ready',
|
|
38
|
+
'host_draining',
|
|
39
|
+
'operation_unavailable',
|
|
40
|
+
'operation_conflict',
|
|
41
|
+
'internal_failure',
|
|
42
|
+
],
|
|
43
|
+
decodeInput: decodeSessionCheckinGenerateInput,
|
|
44
|
+
decodeOutput: decodeSessionCheckinGenerateResult,
|
|
45
|
+
assertOutputForInput: (input, output) => {
|
|
46
|
+
if (input.effectId !== output.effectId) {
|
|
47
|
+
throw invalidProtocolFrame('Session check-in changed effect identity');
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
}),
|
|
51
|
+
};
|
|
52
|
+
export function decodeSessionCheckinGenerateInput(value) {
|
|
53
|
+
const input = requireExactRecord(value, 'Session check-in input', ['effectId', 'since']);
|
|
54
|
+
return {
|
|
55
|
+
effectId: requireEntityId(input.effectId, 'effectId'),
|
|
56
|
+
since: input.since === null ? null : requireCount(input.since, 'Session check-in since'),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export function decodeSessionCheckinGenerateResult(value) {
|
|
60
|
+
const result = requireRecord(value, 'Session check-in result');
|
|
61
|
+
if (result.kind === 'empty') {
|
|
62
|
+
const empty = requireExactRecord(result, 'Empty Session check-in', ['kind', 'effectId']);
|
|
63
|
+
return { kind: 'empty', effectId: requireEntityId(empty.effectId, 'effectId') };
|
|
64
|
+
}
|
|
65
|
+
if (result.kind === 'failed') {
|
|
66
|
+
const failed = requireExactRecord(result, 'Failed Session check-in', [
|
|
67
|
+
'kind',
|
|
68
|
+
'effectId',
|
|
69
|
+
'errorClass',
|
|
70
|
+
]);
|
|
71
|
+
if (!SESSION_CHECKIN_FAILURE_CLASSES.includes(failed.errorClass)) {
|
|
72
|
+
throw invalidProtocolFrame('Invalid Session check-in failure class');
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
kind: 'failed',
|
|
76
|
+
effectId: requireEntityId(failed.effectId, 'effectId'),
|
|
77
|
+
errorClass: failed.errorClass,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
const generated = requireExactRecord(result, 'Generated Session check-in', [
|
|
81
|
+
'kind',
|
|
82
|
+
'effectId',
|
|
83
|
+
'cards',
|
|
84
|
+
'dropped',
|
|
85
|
+
]);
|
|
86
|
+
if (generated.kind !== 'generated')
|
|
87
|
+
throw invalidProtocolFrame('Invalid Session check-in kind');
|
|
88
|
+
if (!Array.isArray(generated.cards) || generated.cards.length > CHECKIN_MAX_CARDS) {
|
|
89
|
+
throw invalidProtocolFrame('Invalid Session check-in cards');
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
kind: 'generated',
|
|
93
|
+
effectId: requireEntityId(generated.effectId, 'effectId'),
|
|
94
|
+
cards: generated.cards.map(decodeCheckinCard),
|
|
95
|
+
dropped: requireCount(generated.dropped, 'Session check-in dropped count'),
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function decodeCheckinCard(value) {
|
|
99
|
+
const card = requireShapedRecord(value, 'Session check-in card', ['sessionId', 'sessionRevision', 'sessionName', 'title', 'evidence', 'action'], ['instruction']);
|
|
100
|
+
const evidence = requireExactRecord(card.evidence, 'Session check-in evidence', [
|
|
101
|
+
'source',
|
|
102
|
+
'quote',
|
|
103
|
+
]);
|
|
104
|
+
if (!isCheckinCardAction(card.action) || !isCheckinEvidenceSource(evidence.source)) {
|
|
105
|
+
throw invalidProtocolFrame('Invalid Session check-in card');
|
|
106
|
+
}
|
|
107
|
+
if (typeof card.sessionName !== 'string' ||
|
|
108
|
+
Buffer.byteLength(card.sessionName) > SESSION_NAME_MAX_BYTES) {
|
|
109
|
+
throw invalidProtocolFrame('Invalid Session check-in Session name');
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
sessionId: requireEntityId(card.sessionId, 'sessionId'),
|
|
113
|
+
sessionRevision: requireCount(card.sessionRevision, 'Session check-in revision'),
|
|
114
|
+
sessionName: card.sessionName,
|
|
115
|
+
title: requireChars(card.title, 'Session check-in title', CHECKIN_TITLE_MAX_CHARS),
|
|
116
|
+
evidence: {
|
|
117
|
+
source: evidence.source,
|
|
118
|
+
quote: requireChars(evidence.quote, 'Session check-in quote', CHECKIN_QUOTE_MAX_CHARS),
|
|
119
|
+
},
|
|
120
|
+
action: card.action,
|
|
121
|
+
...(card.instruction !== undefined
|
|
122
|
+
? {
|
|
123
|
+
instruction: requireChars(card.instruction, 'Session check-in instruction', CHECKIN_INSTRUCTION_MAX_CHARS),
|
|
124
|
+
}
|
|
125
|
+
: {}),
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function requireChars(value, label, maxChars) {
|
|
129
|
+
if (typeof value !== 'string' || !value.trim() || Array.from(value).length > maxChars) {
|
|
130
|
+
throw invalidProtocolFrame(`Invalid ${label}`);
|
|
131
|
+
}
|
|
132
|
+
return value;
|
|
133
|
+
}
|
|
@@ -46,7 +46,6 @@ export function buildHostAgentSettingsTools(authority) {
|
|
|
46
46
|
'This never returns credentials, network proxy details, native client settings, or Bot settings.',
|
|
47
47
|
parameters: z.object({}).strict(),
|
|
48
48
|
categoryHint: 'read',
|
|
49
|
-
recoveryMode: 'replay_safe',
|
|
50
49
|
impl: async () => projectSettings((await authority.read()).policy),
|
|
51
50
|
};
|
|
52
51
|
const updateTool = {
|
|
@@ -60,9 +60,10 @@ export class CanonicalSessionProjectionReader {
|
|
|
60
60
|
rootTurn = await readCanonicalTurnSnapshot(this.#stores, durableAdmission);
|
|
61
61
|
}
|
|
62
62
|
const interactions = projectSessionInteractions(await this.#stores.interactionStore.listSessionPending(sessionId), await this.#stores.sessionStore.listPendingSandboxBoundaryRequests(sessionId));
|
|
63
|
-
//
|
|
63
|
+
// Keep the Session lane across the asynchronous Goal/wait read and the
|
|
64
|
+
// final queue projection; neither read can authorize a second admission.
|
|
65
|
+
const goal = await this.#readGoal(sessionId);
|
|
64
66
|
const queue = this.#messages.projection(sessionId);
|
|
65
|
-
const goal = this.#readGoal(sessionId);
|
|
66
67
|
const session = {
|
|
67
68
|
sessionId: header.id,
|
|
68
69
|
metadataRevision,
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
19
|
import { randomUUID } from 'node:crypto';
|
|
20
|
-
import { decodeEventWaitRecord, EVENT_WAIT_LIMITS, } from '@maka/core/event-wait';
|
|
20
|
+
import { decodeEventWaitRecord, decodeObservedEventWaitRecord, EVENT_WAIT_LIMITS, } from '@maka/core/event-wait';
|
|
21
21
|
import { authenticateInteractiveEventWaitAuthorityWriter, EVENT_WAIT_OBSERVATION_HINT_LIMIT, EVENT_WAIT_PAGE_LIMIT, eventWaitSourceKey, } from '@maka/storage/event-wait-authority';
|
|
22
22
|
import { StorageRootAuthorityError } from '@maka/storage/root-authority';
|
|
23
23
|
const systemClock = {
|
|
@@ -76,12 +76,14 @@ const addTime = (now, delay) => Math.min(Number.MAX_SAFE_INTEGER, now + delay);
|
|
|
76
76
|
* Ready candidates normally use durable observation age. Failed preparations get a bounded
|
|
77
77
|
* traversal by immutable ID, so neither failed writes nor cache capacity can pin selection.
|
|
78
78
|
*/
|
|
79
|
-
export class
|
|
79
|
+
export class HostEventWaitObserver {
|
|
80
80
|
#store;
|
|
81
81
|
#options;
|
|
82
82
|
#clock;
|
|
83
83
|
#policy;
|
|
84
84
|
#flights = new Map();
|
|
85
|
+
/** Registration/delivery authorization shares observation capacity and source facts. */
|
|
86
|
+
#accessFlights = new Set();
|
|
85
87
|
#subscriptions = new Map();
|
|
86
88
|
#cooldowns = new Map();
|
|
87
89
|
/** Dispatch preparation is serialized per source, independently of in-flight reads. */
|
|
@@ -102,7 +104,7 @@ export class HostEventWaitManager {
|
|
|
102
104
|
#closed = false;
|
|
103
105
|
#ready = false;
|
|
104
106
|
constructor(options) {
|
|
105
|
-
this.#store =
|
|
107
|
+
this.#store = options.store;
|
|
106
108
|
this.#options = options;
|
|
107
109
|
this.#clock = options.clock ?? systemClock;
|
|
108
110
|
this.#policy = { ...DEFAULT_EVENT_WAIT_OBSERVATION_POLICY, ...options.policy };
|
|
@@ -111,7 +113,9 @@ export class HostEventWaitManager {
|
|
|
111
113
|
if (!Number.isFinite(value) || value < 0 || value > 1)
|
|
112
114
|
throw new TypeError('Invalid wait jitter');
|
|
113
115
|
}
|
|
114
|
-
else if (!Number.isSafeInteger(value) ||
|
|
116
|
+
else if (!Number.isSafeInteger(value) ||
|
|
117
|
+
value < 1 ||
|
|
118
|
+
(name !== 'maxLifetimeMs' && value > 2_147_483_647))
|
|
115
119
|
throw new TypeError(`Invalid wait policy: ${name}`);
|
|
116
120
|
}
|
|
117
121
|
if (this.#policy.pageSize > EVENT_WAIT_PAGE_LIMIT ||
|
|
@@ -125,13 +129,72 @@ export class HostEventWaitManager {
|
|
|
125
129
|
EVENT_WAIT_OBSERVATION_HINT_LIMIT)
|
|
126
130
|
throw new TypeError('Inconsistent event wait policy');
|
|
127
131
|
}
|
|
132
|
+
#decode(value) {
|
|
133
|
+
return (this.#options.decodeRecord ?? decodeObservedEventWaitRecord)(value);
|
|
134
|
+
}
|
|
128
135
|
/** Validates the supported template only; PR3 owns registration authorization and yield. */
|
|
129
136
|
validate(wait) {
|
|
130
|
-
const record =
|
|
137
|
+
const record = this.#decode(wait);
|
|
131
138
|
if (record.deadlineAt - record.createdAt > this.#policy.maxLifetimeMs)
|
|
132
139
|
throw new TypeError('Event wait exceeds maximum lifetime');
|
|
133
140
|
this.#options.adapters.validate(record);
|
|
134
141
|
}
|
|
142
|
+
/** Bounded source access outside observation; no wait attempt or work Turn is charged. */
|
|
143
|
+
async checkSourceAccess(wait, parent, authorize) {
|
|
144
|
+
const unknown = { kind: 'unknown', reason: 'authorization_unavailable' };
|
|
145
|
+
const source = sourceKey(wait);
|
|
146
|
+
const occupied = this.#occupiedFlights();
|
|
147
|
+
if (this.#closed ||
|
|
148
|
+
parent.aborted ||
|
|
149
|
+
this.#pendingCooldowns.size >= this.#policy.maxSourceCooldowns ||
|
|
150
|
+
this.#sourceCooldown(source) > this.#clock.now() ||
|
|
151
|
+
occupied.size >= this.#policy.maxConcurrent ||
|
|
152
|
+
[...occupied].filter((f) => f.source === source).length >= this.#policy.maxPerSource)
|
|
153
|
+
return unknown;
|
|
154
|
+
const flight = {
|
|
155
|
+
controller: new AbortController(),
|
|
156
|
+
source,
|
|
157
|
+
sessionId: wait.sessionId,
|
|
158
|
+
waitId: wait.waitId,
|
|
159
|
+
claimed: false,
|
|
160
|
+
cooldownUntil: 0,
|
|
161
|
+
retryAfterUntil: 0,
|
|
162
|
+
task: Promise.resolve(),
|
|
163
|
+
};
|
|
164
|
+
this.#accessFlights.add(flight);
|
|
165
|
+
const abort = () => flight.controller.abort();
|
|
166
|
+
parent.addEventListener('abort', abort, { once: true });
|
|
167
|
+
const task = (async () => {
|
|
168
|
+
const cooldown = await this.#store.readSourceCooldown({
|
|
169
|
+
providerId: wait.resource.providerId,
|
|
170
|
+
connectionId: wait.resource.connectionId,
|
|
171
|
+
});
|
|
172
|
+
if (this.#closed ||
|
|
173
|
+
flight.controller.signal.aborted ||
|
|
174
|
+
Math.max(cooldown ?? 0, this.#sourceCooldown(source)) > this.#clock.now())
|
|
175
|
+
return unknown;
|
|
176
|
+
try {
|
|
177
|
+
// Expired waits still need delivery authorization, so the source deadline
|
|
178
|
+
// does not bound this separate request. #call retains the request timeout.
|
|
179
|
+
return ((await this.#tryAuthorize(wait, flight, Number.MAX_SAFE_INTEGER, authorize))?.access ??
|
|
180
|
+
unknown);
|
|
181
|
+
}
|
|
182
|
+
catch (error) {
|
|
183
|
+
if (error instanceof SourceCooldownWriteError || error instanceof StorageRootAuthorityError)
|
|
184
|
+
throw error;
|
|
185
|
+
return unknown;
|
|
186
|
+
}
|
|
187
|
+
})();
|
|
188
|
+
flight.task = task.then(() => undefined, () => undefined);
|
|
189
|
+
try {
|
|
190
|
+
return await task;
|
|
191
|
+
}
|
|
192
|
+
finally {
|
|
193
|
+
parent.removeEventListener('abort', abort);
|
|
194
|
+
this.#accessFlights.delete(flight);
|
|
195
|
+
// #call retains interrupted requests in #lingering until late facts settle.
|
|
196
|
+
}
|
|
197
|
+
}
|
|
135
198
|
start() {
|
|
136
199
|
if (this.#closed)
|
|
137
200
|
return Promise.reject(new Error('Event wait manager is closed'));
|
|
@@ -174,7 +237,11 @@ export class HostEventWaitManager {
|
|
|
174
237
|
#occupiedFlights() {
|
|
175
238
|
// One observation owns one slot even while its interrupted request and checkpoint
|
|
176
239
|
// persistence overlap. Keep that slot until both the flight and its late work retire.
|
|
177
|
-
return new Set([
|
|
240
|
+
return new Set([
|
|
241
|
+
...this.#flights.values(),
|
|
242
|
+
...this.#accessFlights,
|
|
243
|
+
...this.#lingering.values(),
|
|
244
|
+
]);
|
|
178
245
|
}
|
|
179
246
|
async #scanPage() {
|
|
180
247
|
// Session cleanup can remove waits without calling cancel(). Include polling-only
|
|
@@ -355,7 +422,8 @@ export class HostEventWaitManager {
|
|
|
355
422
|
}
|
|
356
423
|
}
|
|
357
424
|
async #observe(snapshot, flight) {
|
|
358
|
-
|
|
425
|
+
const projectionBefore = snapshot.record;
|
|
426
|
+
let r = projectionBefore;
|
|
359
427
|
if (r.status !== 'waiting' || this.#closed)
|
|
360
428
|
return;
|
|
361
429
|
const cooldown = await this.#store.readSourceCooldown({
|
|
@@ -405,7 +473,9 @@ export class HostEventWaitManager {
|
|
|
405
473
|
outcome: 'checking',
|
|
406
474
|
cursor: previous?.cursor ?? null,
|
|
407
475
|
eventKey: previous?.eventKey ?? null,
|
|
408
|
-
|
|
476
|
+
// Reconnecting projections still need the last completed observation's
|
|
477
|
+
// diagnostic while this reservation's source request is in flight.
|
|
478
|
+
reason: previous?.reason ?? null,
|
|
409
479
|
};
|
|
410
480
|
const claim = await this.#commit(snapshot, { ...r, updatedAt: now, observation: reserved });
|
|
411
481
|
if (this.#closed || flight.controller.signal.aborted)
|
|
@@ -496,7 +566,10 @@ export class HostEventWaitManager {
|
|
|
496
566
|
!subscriptionPending &&
|
|
497
567
|
!this.#subscriptions.get(r.waitId)?.controller.signal.aborted)
|
|
498
568
|
this.#detach(r.waitId);
|
|
499
|
-
await this.#finish(snapshot, result, {
|
|
569
|
+
await this.#finish(snapshot, result, {
|
|
570
|
+
retryAfterUntil: flight.retryAfterUntil,
|
|
571
|
+
projectionBefore,
|
|
572
|
+
});
|
|
500
573
|
}
|
|
501
574
|
#validateAccess(access) {
|
|
502
575
|
if (!access || !['allowed', 'revoked', 'unknown'].includes(access.kind))
|
|
@@ -515,7 +588,7 @@ export class HostEventWaitManager {
|
|
|
515
588
|
}
|
|
516
589
|
}
|
|
517
590
|
/** Null defers dispatch to the caller without starting an authorization request. */
|
|
518
|
-
async #tryAuthorize(r, flight) {
|
|
591
|
+
async #tryAuthorize(r, flight, deadline = r.deadlineAt, authorize = this.#options.authorize) {
|
|
519
592
|
const recordCooldown = async (checked) => {
|
|
520
593
|
if (!checked || this.#closed)
|
|
521
594
|
return;
|
|
@@ -525,12 +598,12 @@ export class HostEventWaitManager {
|
|
|
525
598
|
await this.#recordSourceCooldown(r, checked.access);
|
|
526
599
|
}
|
|
527
600
|
};
|
|
528
|
-
const checked = await this.#call(flight,
|
|
601
|
+
const checked = await this.#call(flight, deadline, (signal) => {
|
|
529
602
|
// Recheck at actual dispatch; cooldown can change after the timer wakes or
|
|
530
603
|
// before #call invokes this callback. Active flights retain it across cache eviction.
|
|
531
604
|
if (flight.retryAfterUntil > this.#clock.now())
|
|
532
605
|
return Promise.resolve(null);
|
|
533
|
-
return
|
|
606
|
+
return authorize(structuredClone(r), signal).then((access) => ({ access }));
|
|
534
607
|
}, recordCooldown);
|
|
535
608
|
// Shared facts outlive a cancelled wait, including cancellation during the
|
|
536
609
|
// handoff from #call. Normal and late results use the same validation/persistence
|
|
@@ -753,15 +826,30 @@ export class HostEventWaitManager {
|
|
|
753
826
|
(!Number.isSafeInteger(result.retryAfterMs) || result.retryAfterMs < 0))
|
|
754
827
|
throw new TypeError('Invalid retry delay');
|
|
755
828
|
const now = Math.max(r.updatedAt, this.#clock.now());
|
|
756
|
-
|
|
829
|
+
// Registration and delivery authorization may have no observation checkpoint.
|
|
830
|
+
// Validate the prospective fields without writing an attempt or changing the wait.
|
|
831
|
+
const observation = r.observation ?? {
|
|
832
|
+
schemaVersion: 1,
|
|
833
|
+
attempts: 1,
|
|
834
|
+
lastAttemptAt: now,
|
|
835
|
+
lastObservedAt: now,
|
|
836
|
+
nextObserveAt: now,
|
|
837
|
+
nextPollAt: now,
|
|
838
|
+
consecutiveErrors: 0,
|
|
839
|
+
outcome: 'checking',
|
|
840
|
+
cursor: null,
|
|
841
|
+
eventKey: null,
|
|
842
|
+
reason: null,
|
|
843
|
+
};
|
|
844
|
+
this.#decode({
|
|
757
845
|
...r,
|
|
758
846
|
updatedAt: now,
|
|
759
847
|
observation: {
|
|
760
|
-
...
|
|
848
|
+
...observation,
|
|
761
849
|
outcome: result.kind,
|
|
762
850
|
lastObservedAt: now,
|
|
763
|
-
cursor: result.cursor ??
|
|
764
|
-
eventKey: result.eventKey ??
|
|
851
|
+
cursor: result.cursor ?? observation.cursor,
|
|
852
|
+
eventKey: result.eventKey ?? observation.eventKey,
|
|
765
853
|
reason: result.kind === 'unknown' ? result.reason : null,
|
|
766
854
|
},
|
|
767
855
|
...(result.kind === 'pending' || result.kind === 'unknown'
|
|
@@ -881,7 +969,7 @@ export class HostEventWaitManager {
|
|
|
881
969
|
},
|
|
882
970
|
};
|
|
883
971
|
}
|
|
884
|
-
const committed = await this.#commit(snapshot, record);
|
|
972
|
+
const committed = await this.#commit(snapshot, record, options.projectionBefore);
|
|
885
973
|
if (!committed || committed.record.status !== 'waiting')
|
|
886
974
|
this.#detach(r.waitId);
|
|
887
975
|
return committed;
|
|
@@ -1018,7 +1106,7 @@ export class HostEventWaitManager {
|
|
|
1018
1106
|
finishHandoff();
|
|
1019
1107
|
}
|
|
1020
1108
|
}
|
|
1021
|
-
async #commit(snapshot, record) {
|
|
1109
|
+
async #commit(snapshot, record, projectionBefore = snapshot.record) {
|
|
1022
1110
|
if (this.#closed)
|
|
1023
1111
|
return null;
|
|
1024
1112
|
const result = await this.#store.commit({
|
|
@@ -1026,7 +1114,23 @@ export class HostEventWaitManager {
|
|
|
1026
1114
|
expectedAuthorityRevision: snapshot.authorityRevision,
|
|
1027
1115
|
record,
|
|
1028
1116
|
});
|
|
1029
|
-
|
|
1117
|
+
if (result.kind !== 'committed')
|
|
1118
|
+
return null;
|
|
1119
|
+
const after = result.snapshot.record;
|
|
1120
|
+
// Compare durable semantics before the attempt, not its temporary checking
|
|
1121
|
+
// reservation. Cache eviction must not turn unchanged polling into activity.
|
|
1122
|
+
if ((after.status !== 'waiting' || after.observation?.outcome !== 'checking') &&
|
|
1123
|
+
(projectionBefore.status !== after.status ||
|
|
1124
|
+
projectionBefore.observation?.outcome !== after.observation?.outcome ||
|
|
1125
|
+
projectionBefore.observation?.reason !== after.observation?.reason)) {
|
|
1126
|
+
try {
|
|
1127
|
+
this.#options.onChanged?.(after);
|
|
1128
|
+
}
|
|
1129
|
+
catch {
|
|
1130
|
+
/* Projection hints are best effort. */
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
return result.snapshot;
|
|
1030
1134
|
}
|
|
1031
1135
|
async #expire(snapshot) {
|
|
1032
1136
|
if (this.#closed || snapshot.record.status !== 'waiting')
|
|
@@ -1105,7 +1209,7 @@ export class HostEventWaitManager {
|
|
|
1105
1209
|
}
|
|
1106
1210
|
#cool(source, until, owner) {
|
|
1107
1211
|
// Prepared reads retain new source facts even if their cache entry is evicted.
|
|
1108
|
-
for (const flight of this.#
|
|
1212
|
+
for (const flight of this.#occupiedFlights()) {
|
|
1109
1213
|
if (flight.source === source && flight !== owner) {
|
|
1110
1214
|
flight.cooldownUntil = Math.max(flight.cooldownUntil, until);
|
|
1111
1215
|
// An owner marks ordinary read spacing. Source-reported Retry-After has no
|
|
@@ -1160,6 +1264,8 @@ export class HostEventWaitManager {
|
|
|
1160
1264
|
this.#timer = undefined;
|
|
1161
1265
|
for (const flight of this.#flights.values())
|
|
1162
1266
|
flight.controller.abort();
|
|
1267
|
+
for (const flight of this.#accessFlights)
|
|
1268
|
+
flight.controller.abort();
|
|
1163
1269
|
for (const waitId of this.#subscriptions.keys())
|
|
1164
1270
|
this.#detach(waitId);
|
|
1165
1271
|
this.#close = (async () => {
|
|
@@ -1170,6 +1276,7 @@ export class HostEventWaitManager {
|
|
|
1170
1276
|
this.#start,
|
|
1171
1277
|
this.#scan,
|
|
1172
1278
|
...[...this.#flights.values()].map((v) => v.task),
|
|
1279
|
+
...[...this.#accessFlights].map((v) => v.task),
|
|
1173
1280
|
...this.#lateResults,
|
|
1174
1281
|
]),
|
|
1175
1282
|
new Promise((resolve) => {
|
|
@@ -1184,3 +1291,27 @@ export class HostEventWaitManager {
|
|
|
1184
1291
|
return this.#close;
|
|
1185
1292
|
}
|
|
1186
1293
|
}
|
|
1294
|
+
export class HostEventWaitManager extends HostEventWaitObserver {
|
|
1295
|
+
checkSourceAccess(wait, signal, authorize) {
|
|
1296
|
+
return super.checkSourceAccess(wait, signal, (record, signal) => authorize(decodeEventWaitRecord(record), signal));
|
|
1297
|
+
}
|
|
1298
|
+
constructor(options) {
|
|
1299
|
+
const store = authenticateInteractiveEventWaitAuthorityWriter(options.store);
|
|
1300
|
+
super({
|
|
1301
|
+
...options,
|
|
1302
|
+
decodeRecord: decodeEventWaitRecord,
|
|
1303
|
+
authorize: (wait, signal) => options.authorize(decodeEventWaitRecord(wait), signal),
|
|
1304
|
+
onChanged: (wait) => options.onChanged?.(decodeEventWaitRecord(wait)),
|
|
1305
|
+
store: {
|
|
1306
|
+
read: (input) => store.read(input),
|
|
1307
|
+
listByStatus: (input) => store.listByStatus(input),
|
|
1308
|
+
listForObservation: (input) => store.listForObservation(input),
|
|
1309
|
+
readSourceCooldown: (input) => store.readSourceCooldown(input),
|
|
1310
|
+
extendSourceCooldown: (input) => store.extendSourceCooldown(input),
|
|
1311
|
+
reserveSourceDispatch: (input) => store.reserveSourceDispatch(input),
|
|
1312
|
+
completeSourceDispatch: (input) => store.completeSourceDispatch(input),
|
|
1313
|
+
commit: (input) => store.commit({ ...input, record: decodeEventWaitRecord(input.record) }),
|
|
1314
|
+
},
|
|
1315
|
+
});
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
* or more contributor license agreements. See the NOTICE file
|
|
4
|
+
* distributed with this work for additional information
|
|
5
|
+
* regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
* to you under the Apache License, Version 2.0 (the
|
|
7
|
+
* "License"); you may not use this file except in compliance
|
|
8
|
+
* with the License. You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
|
13
|
+
* software distributed under the License is distributed on an
|
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
* KIND, either express or implied. See the License for the
|
|
16
|
+
* specific language governing permissions and limitations
|
|
17
|
+
* under the License.
|
|
18
|
+
*/
|
|
19
|
+
export {};
|