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
|
@@ -0,0 +1,166 @@
|
|
|
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 { validateToolLedgerEventLane } from '@maka/core/tool-ledger-scanner';
|
|
20
|
+
import { canonicalToolArgsHash } from '@maka/core/tool-args-identity';
|
|
21
|
+
import { parseShellRunResourceRef } from '@maka/runtime/shell-run-contract';
|
|
22
|
+
export const SHELL_RUN_WAIT_SOURCE = Object.freeze({
|
|
23
|
+
providerId: 'shell_run',
|
|
24
|
+
resourceType: 'background_task',
|
|
25
|
+
conditionType: 'terminal',
|
|
26
|
+
conditionVersion: 1,
|
|
27
|
+
});
|
|
28
|
+
export function validateShellRunWait(wait) {
|
|
29
|
+
const target = parseShellRunResourceRef(wait.resource.resourceId);
|
|
30
|
+
if (!target ||
|
|
31
|
+
wait.resource.providerId !== SHELL_RUN_WAIT_SOURCE.providerId ||
|
|
32
|
+
wait.resource.resourceType !== SHELL_RUN_WAIT_SOURCE.resourceType ||
|
|
33
|
+
wait.resource.connectionId !== null ||
|
|
34
|
+
wait.condition.typeId !== SHELL_RUN_WAIT_SOURCE.conditionType ||
|
|
35
|
+
wait.condition.version !== 1 ||
|
|
36
|
+
Object.keys(wait.condition.parameters).length !== 0)
|
|
37
|
+
throw new TypeError('Unsupported background task condition');
|
|
38
|
+
return target.shellRunId;
|
|
39
|
+
}
|
|
40
|
+
/** Reads the same Host's stores. Neither a reference nor the wait is an access credential. */
|
|
41
|
+
export class ShellRunEventWaitAccess {
|
|
42
|
+
shellRuns;
|
|
43
|
+
events;
|
|
44
|
+
constructor(shellRuns, events) {
|
|
45
|
+
this.shellRuns = shellRuns;
|
|
46
|
+
this.events = events;
|
|
47
|
+
}
|
|
48
|
+
async authorize(wait, signal) {
|
|
49
|
+
const result = await this.read(wait, signal);
|
|
50
|
+
return result.kind === 'allowed' ? { kind: 'allowed', context: null } : result;
|
|
51
|
+
}
|
|
52
|
+
async read(wait, signal) {
|
|
53
|
+
const taskId = validateShellRunWait(wait);
|
|
54
|
+
signal.throwIfAborted();
|
|
55
|
+
let task;
|
|
56
|
+
try {
|
|
57
|
+
task = await this.shellRuns.readShellRun(wait.sessionId, taskId);
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
if (error instanceof Error && 'code' in error && error.code === 'ENOENT')
|
|
61
|
+
return { kind: 'revoked', reason: 'shell_run_missing' };
|
|
62
|
+
throw error;
|
|
63
|
+
}
|
|
64
|
+
if (task.sessionId !== wait.sessionId || task.shellRunId !== taskId || !task.sourceRunId)
|
|
65
|
+
return { kind: 'revoked', reason: 'shell_run_identity_invalid' };
|
|
66
|
+
if (task.visibility === 'user')
|
|
67
|
+
return { kind: 'revoked', reason: 'shell_run_access_revoked' };
|
|
68
|
+
const invocation = await this.events.readRunInvocation(wait.sessionId, task.sourceRunId);
|
|
69
|
+
if (!invocation ||
|
|
70
|
+
invocation.turnId !== task.sourceTurnId ||
|
|
71
|
+
invocation.opening.route.provenance !== 'runtime' ||
|
|
72
|
+
invocation.opening.route.backendKind !== 'ai-sdk')
|
|
73
|
+
return { kind: 'revoked', reason: 'shell_run_provenance_invalid' };
|
|
74
|
+
const proof = await this.events.readToolProvenanceEvents(wait.sessionId, task.sourceRunId, task.sourceToolCallId, { maxRecords: 8, maxBytes: 2 * 1024 * 1024 });
|
|
75
|
+
signal.throwIfAborted();
|
|
76
|
+
if (proof.status !== 'complete')
|
|
77
|
+
return { kind: 'revoked', reason: 'shell_run_provenance_unavailable' };
|
|
78
|
+
const facts = proof.records;
|
|
79
|
+
const calls = facts.filter((e) => e.content?.kind === 'function_call');
|
|
80
|
+
const dispatches = facts.filter((e) => e.actions?.toolDispatch);
|
|
81
|
+
const outcomes = facts.filter((e) => e.content?.kind === 'function_response');
|
|
82
|
+
const call = calls[0]?.content, dispatch = dispatches[0]?.actions?.toolDispatch, outcome = outcomes[0]?.content;
|
|
83
|
+
if (calls.length !== 1 ||
|
|
84
|
+
dispatches.length !== 1 ||
|
|
85
|
+
outcomes.length !== 1 ||
|
|
86
|
+
call?.kind !== 'function_call' ||
|
|
87
|
+
outcome?.kind !== 'function_response' ||
|
|
88
|
+
!dispatch ||
|
|
89
|
+
facts.some((e) => !validateToolLedgerEventLane(e).ok ||
|
|
90
|
+
e.partial ||
|
|
91
|
+
e.sessionId !== wait.sessionId ||
|
|
92
|
+
e.runId !== task.sourceRunId ||
|
|
93
|
+
e.turnId !== task.sourceTurnId ||
|
|
94
|
+
e.invocationId !== invocation.invocationId) ||
|
|
95
|
+
call.id !== task.sourceToolCallId ||
|
|
96
|
+
outcome.id !== call.id ||
|
|
97
|
+
dispatch.providerToolCallId !== call.id ||
|
|
98
|
+
call.name !== 'Bash' ||
|
|
99
|
+
outcome.name !== 'Bash' ||
|
|
100
|
+
dispatch.toolName !== 'Bash' ||
|
|
101
|
+
call.providerExecuted === true ||
|
|
102
|
+
outcome.providerExecuted === true ||
|
|
103
|
+
dispatch.protocol !== 't1_after_preflight_v1' ||
|
|
104
|
+
dispatch.canonicalArgsHash !== canonicalToolArgsHash('Bash', call.args) ||
|
|
105
|
+
outcomes[0]?.refs?.operationId !== dispatch.operationId ||
|
|
106
|
+
facts.indexOf(calls[0]) >= facts.indexOf(dispatches[0]) ||
|
|
107
|
+
facts.indexOf(dispatches[0]) >= facts.indexOf(outcomes[0]) ||
|
|
108
|
+
!isBackgroundCall(call.args) ||
|
|
109
|
+
!isTaskResult(outcome.result, wait.resource.resourceId))
|
|
110
|
+
return { kind: 'revoked', reason: 'shell_run_provenance_invalid' };
|
|
111
|
+
// Proof reads may suspend. Recheck the live resource binding after them;
|
|
112
|
+
// a registration-time snapshot cannot authorize a later admission.
|
|
113
|
+
let current;
|
|
114
|
+
try {
|
|
115
|
+
current = await this.shellRuns.readShellRun(wait.sessionId, taskId);
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
if (error instanceof Error && 'code' in error && error.code === 'ENOENT')
|
|
119
|
+
return { kind: 'revoked', reason: 'shell_run_missing' };
|
|
120
|
+
throw error;
|
|
121
|
+
}
|
|
122
|
+
signal.throwIfAborted();
|
|
123
|
+
if (current.visibility === 'user')
|
|
124
|
+
return { kind: 'revoked', reason: 'shell_run_access_revoked' };
|
|
125
|
+
if (current.sessionId !== task.sessionId ||
|
|
126
|
+
current.shellRunId !== task.shellRunId ||
|
|
127
|
+
current.sourceRunId !== task.sourceRunId ||
|
|
128
|
+
current.sourceTurnId !== task.sourceTurnId ||
|
|
129
|
+
current.sourceToolCallId !== task.sourceToolCallId ||
|
|
130
|
+
current.startedAt !== task.startedAt)
|
|
131
|
+
return { kind: 'revoked', reason: 'shell_run_identity_invalid' };
|
|
132
|
+
task = current;
|
|
133
|
+
// Canonical immutable T2 retains the original outcome even after its model
|
|
134
|
+
// projection is archived/pruned. Never authorize from a placeholder or UI row.
|
|
135
|
+
const { sessionId, shellRunId, sourceRunId, sourceTurnId, sourceToolCallId, startedAt, status, completedAt, exitCode, failureMessage, } = task;
|
|
136
|
+
return {
|
|
137
|
+
kind: 'allowed',
|
|
138
|
+
fact: {
|
|
139
|
+
sessionId,
|
|
140
|
+
shellRunId,
|
|
141
|
+
sourceRunId,
|
|
142
|
+
sourceTurnId,
|
|
143
|
+
sourceToolCallId,
|
|
144
|
+
startedAt,
|
|
145
|
+
status,
|
|
146
|
+
...(completedAt === undefined ? {} : { completedAt }),
|
|
147
|
+
...(exitCode === undefined ? {} : { exitCode }),
|
|
148
|
+
...(failureMessage === undefined ? {} : { failureMessage }),
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
function isBackgroundCall(value) {
|
|
154
|
+
return (typeof value === 'object' &&
|
|
155
|
+
value !== null &&
|
|
156
|
+
'run_in_background' in value &&
|
|
157
|
+
value.run_in_background === true);
|
|
158
|
+
}
|
|
159
|
+
function isTaskResult(value, ref) {
|
|
160
|
+
return (typeof value === 'object' &&
|
|
161
|
+
value !== null &&
|
|
162
|
+
'kind' in value &&
|
|
163
|
+
value.kind === 'shell_run' &&
|
|
164
|
+
'ref' in value &&
|
|
165
|
+
value.ref === ref);
|
|
166
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
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 { createHash } from 'node:crypto';
|
|
20
|
+
import { isTerminalShellRunStatus } from '@maka/core/shell-run';
|
|
21
|
+
import { SHELL_RUN_WAIT_SOURCE, validateShellRunWait, } from './shell-run-event-wait-access.js';
|
|
22
|
+
export class ShellRunEventWaitAdapter {
|
|
23
|
+
access;
|
|
24
|
+
manager;
|
|
25
|
+
providerId = SHELL_RUN_WAIT_SOURCE.providerId;
|
|
26
|
+
resourceType = SHELL_RUN_WAIT_SOURCE.resourceType;
|
|
27
|
+
conditionType = SHELL_RUN_WAIT_SOURCE.conditionType;
|
|
28
|
+
conditionVersion = SHELL_RUN_WAIT_SOURCE.conditionVersion;
|
|
29
|
+
reconciliation = 'snapshot';
|
|
30
|
+
constructor(access, manager) {
|
|
31
|
+
this.access = access;
|
|
32
|
+
this.manager = manager;
|
|
33
|
+
}
|
|
34
|
+
validate(wait) {
|
|
35
|
+
validateShellRunWait(wait);
|
|
36
|
+
}
|
|
37
|
+
async read(input) {
|
|
38
|
+
const result = await this.access.read(input.wait, input.signal);
|
|
39
|
+
// The next access check cancels and pauses on confirmed revocation. A read
|
|
40
|
+
// racing that check must not fabricate a terminal outcome in the meantime.
|
|
41
|
+
if (result.kind === 'revoked')
|
|
42
|
+
return { kind: 'unknown', reason: result.reason };
|
|
43
|
+
const fact = result.fact;
|
|
44
|
+
if (!isTerminalShellRunStatus(fact.status))
|
|
45
|
+
return { kind: 'pending' };
|
|
46
|
+
const digest = createHash('sha256').update(JSON.stringify(fact)).digest('hex');
|
|
47
|
+
const receiptKey = `shell-run/terminal-v1/${fact.shellRunId}/${digest}`;
|
|
48
|
+
return {
|
|
49
|
+
kind: fact.status === 'orphaned' ? 'source_unavailable' : 'satisfied',
|
|
50
|
+
receiptKey,
|
|
51
|
+
eventKey: receiptKey,
|
|
52
|
+
evidenceRefs: [input.wait.resource.resourceId],
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
async subscribe(input, changed) {
|
|
56
|
+
this.validate(input.wait);
|
|
57
|
+
return this.manager.subscribeChanges(input.wait.sessionId, input.wait.resource.resourceId, input.signal, changed);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -225,6 +225,7 @@ export class SkillCatalogRepository {
|
|
|
225
225
|
const publicationNamespace = await readPublicationNamespace(root);
|
|
226
226
|
return buildSnapshot({
|
|
227
227
|
projectRoot,
|
|
228
|
+
workspaceSkillDirectory: join(root, 'skills'),
|
|
228
229
|
scan,
|
|
229
230
|
managedSourcesRoot: this.#managedSourcesRoot,
|
|
230
231
|
publicationNamespace,
|
|
@@ -601,7 +602,7 @@ async function buildSnapshot(input) {
|
|
|
601
602
|
publicationNamespace: input.publicationNamespace,
|
|
602
603
|
effectiveMigration,
|
|
603
604
|
}));
|
|
604
|
-
const model = freezeModelSnapshot(revision, input.projectRoot, input.scan, effectiveMigration);
|
|
605
|
+
const model = freezeModelSnapshot(revision, input.projectRoot, input.workspaceSkillDirectory, input.scan, effectiveMigration);
|
|
605
606
|
return Object.freeze({
|
|
606
607
|
revision,
|
|
607
608
|
projectRoot: input.projectRoot,
|
|
@@ -965,7 +966,7 @@ function canonicalRevisionFacts(input) {
|
|
|
965
966
|
},
|
|
966
967
|
};
|
|
967
968
|
}
|
|
968
|
-
function freezeModelSnapshot(revision, projectRoot, scan, migration) {
|
|
969
|
+
function freezeModelSnapshot(revision, projectRoot, workspaceSkillDirectory, scan, migration) {
|
|
969
970
|
const inventory = scan.inventory.filter(hasDurableSkillIdentity).map((skill) => {
|
|
970
971
|
const preference = migration === null ? undefined : getSkillRuntimePreference(migration, skill);
|
|
971
972
|
const enabled = preference?.enabled ?? skill.enabled;
|
|
@@ -987,6 +988,7 @@ function freezeModelSnapshot(revision, projectRoot, scan, migration) {
|
|
|
987
988
|
return Object.freeze({
|
|
988
989
|
revision,
|
|
989
990
|
projectRoot,
|
|
991
|
+
workspaceSkillDirectory,
|
|
990
992
|
inventory: Object.freeze(inventory),
|
|
991
993
|
diagnostics: Object.freeze(diagnostics),
|
|
992
994
|
discoveryDiagnostics: Object.freeze(discoveryDiagnostics),
|
|
@@ -27,6 +27,7 @@ import { MAX_ATTACHMENT_BYTES, MAX_ATTACHMENT_COUNT } from '@maka/core/attachmen
|
|
|
27
27
|
import { LATEST_CONTEXT_PROJECTION_TYPE, supersedesLatestContext, } from '@maka/core/agent-run';
|
|
28
28
|
import { encodeCanonicalRuntimeEvent } from '@maka/core/canonical-runtime-event';
|
|
29
29
|
import { isOrchestrationMode, isTurnOrchestrationSource, } from '@maka/core/orchestration';
|
|
30
|
+
import { decodeEventWaitProvenance } from '@maka/core/event-wait-delivery';
|
|
30
31
|
import { validateGenericToolLedgerAppend } from '@maka/core/tool-ledger-scanner';
|
|
31
32
|
export const SAFE_ID_PATTERN = /^[A-Za-z0-9_-]{1,128}$/;
|
|
32
33
|
export const ROOT_TURN_ADMISSION_SCHEMA_VERSION = 1;
|
|
@@ -211,7 +212,7 @@ export function assertNoReservedToolLedgerFact(event) {
|
|
|
211
212
|
if (validation.ok)
|
|
212
213
|
return;
|
|
213
214
|
if (validation.code === 'reserved_recovery_fact') {
|
|
214
|
-
throw new Error('
|
|
215
|
+
throw new Error('Historical tool recovery facts are read-only');
|
|
215
216
|
}
|
|
216
217
|
if (validation.code === 'reserved_tool_boundary_fact') {
|
|
217
218
|
throw new Error('Durable tool facts require the atomic tool boundary writer');
|
|
@@ -768,12 +769,22 @@ export function normalizeRootExecutionDescriptor(value) {
|
|
|
768
769
|
return Object.freeze({ kind: 'legacy_automation', automationId: value.automationId });
|
|
769
770
|
}
|
|
770
771
|
if (value.kind === 'goal') {
|
|
771
|
-
if (!hasExactKeys(value, [
|
|
772
|
+
if (!hasExactKeys(value, [
|
|
773
|
+
'kind',
|
|
774
|
+
'goalId',
|
|
775
|
+
...(value.eventWait === undefined ? [] : ['eventWait']),
|
|
776
|
+
]) ||
|
|
772
777
|
typeof value.goalId !== 'string' ||
|
|
773
778
|
!isSafeId(value.goalId)) {
|
|
774
779
|
throw new Error('Invalid root execution descriptor');
|
|
775
780
|
}
|
|
776
|
-
return Object.freeze({
|
|
781
|
+
return Object.freeze({
|
|
782
|
+
kind: 'goal',
|
|
783
|
+
goalId: value.goalId,
|
|
784
|
+
...(value.eventWait === undefined
|
|
785
|
+
? {}
|
|
786
|
+
: { eventWait: decodeEventWaitProvenance(value.eventWait) }),
|
|
787
|
+
});
|
|
777
788
|
}
|
|
778
789
|
if (value.kind === 'agent_graph_supervisor_wake') {
|
|
779
790
|
if (!hasExactKeys(value, ['kind', 'graphId', 'wakeId', 'attemptId']) ||
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
* specific language governing permissions and limitations
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
|
+
import { admitGoalWait } from './event-wait-bridge.js';
|
|
20
|
+
import { readBridgeGoal, readBridgeWait, writeBridgeSnapshot, assertBridgeSession, } from './sqlite-event-wait-bridge.js';
|
|
19
21
|
import { resolve } from 'node:path';
|
|
20
22
|
import { isDeepStrictEqual } from 'node:util';
|
|
21
23
|
import { decodeAgentRunEvent, decodeRuntimeEvent } from './execution-record-codec.js';
|
|
@@ -283,6 +285,14 @@ class SqliteAgentRunStore {
|
|
|
283
285
|
throw new Error(`Root source message identity belongs to both ${String(proof.turn_id)} and ${admission.turnId}`);
|
|
284
286
|
}
|
|
285
287
|
}
|
|
288
|
+
if (admission.execution.kind === 'goal' && admission.execution.eventWait) {
|
|
289
|
+
const db = this.#lease.database;
|
|
290
|
+
assertBridgeSession(db, admission.sessionId);
|
|
291
|
+
const wait = readBridgeWait(db, admission.sessionId, admission.execution.eventWait.waitId);
|
|
292
|
+
if (!wait)
|
|
293
|
+
throw new Error('Event wait missing at admission');
|
|
294
|
+
writeBridgeSnapshot(db, admitGoalWait(admission, readBridgeGoal(db, admission.sessionId), wait));
|
|
295
|
+
}
|
|
286
296
|
this.#lease.database
|
|
287
297
|
.prepare(`
|
|
288
298
|
INSERT INTO core_root_turn_admissions(
|
|
@@ -338,6 +338,7 @@ class CodexRolloutConverter {
|
|
|
338
338
|
fallbackCwd;
|
|
339
339
|
limits;
|
|
340
340
|
messages = [];
|
|
341
|
+
sourceImages = [];
|
|
341
342
|
failedTurnIds = new Set();
|
|
342
343
|
activeTurnId;
|
|
343
344
|
activeTurnIsExplicit = false;
|
|
@@ -420,11 +421,26 @@ class CodexRolloutConverter {
|
|
|
420
421
|
if (text.length === 0)
|
|
421
422
|
return;
|
|
422
423
|
this.firstUserText ??= text;
|
|
424
|
+
const id = stringField(item, 'client_id') ??
|
|
425
|
+
stringField(item, 'id') ??
|
|
426
|
+
generatedCodexId(this.expectedSessionId, 'user', record.line);
|
|
427
|
+
if (Array.isArray(item?.content)) {
|
|
428
|
+
for (const part of item.content) {
|
|
429
|
+
const image = asRecord(part);
|
|
430
|
+
if (stringField(image, 'type')?.toLowerCase() !== 'local_image')
|
|
431
|
+
continue;
|
|
432
|
+
const path = stringField(image, 'path') ?? '';
|
|
433
|
+
// Source descriptors share the converted-output budget with messages.
|
|
434
|
+
this.convertedBytes += Buffer.byteLength(JSON.stringify({ messageId: id, path }));
|
|
435
|
+
if (this.convertedBytes > this.limits.maxConvertedBytes) {
|
|
436
|
+
throw new ExternalSessionLimitError('converted_bytes', this.limits.maxConvertedBytes, 'Codex image references exceed the converted Session limit');
|
|
437
|
+
}
|
|
438
|
+
this.sourceImages.push({ messageId: id, path });
|
|
439
|
+
}
|
|
440
|
+
}
|
|
423
441
|
this.append({
|
|
424
442
|
type: 'user',
|
|
425
|
-
id
|
|
426
|
-
stringField(item, 'id') ??
|
|
427
|
-
generatedCodexId(this.expectedSessionId, 'user', record.line),
|
|
443
|
+
id,
|
|
428
444
|
turnId: this.ensureTurnId(record.line),
|
|
429
445
|
ts: this.timestampFor(record),
|
|
430
446
|
...codexUserContent(text),
|
|
@@ -630,6 +646,7 @@ class CodexRolloutConverter {
|
|
|
630
646
|
sourceSessionId: this.expectedSessionId,
|
|
631
647
|
metadata: { name, cwd: this.metaCwd || this.fallbackCwd },
|
|
632
648
|
messages: this.messages,
|
|
649
|
+
...(this.sourceImages.length > 0 ? { sourceImages: this.sourceImages } : {}),
|
|
633
650
|
};
|
|
634
651
|
}
|
|
635
652
|
timestampFor(record) {
|
|
@@ -23,7 +23,7 @@ import { dirname, join, resolve } from 'node:path';
|
|
|
23
23
|
import { backup, DatabaseSync } from 'node:sqlite';
|
|
24
24
|
import { isCanonicalStorageRef } from '@maka/core/events';
|
|
25
25
|
import { discoverMarkedStorageRoot, resolveStorageRoot, runWithStorageRootLease, tryAcquireInteractiveRootOwner, } from './root-authority.js';
|
|
26
|
-
import { migrateSqliteContextOffloadDatabase, SQLITE_CONTEXT_OFFLOAD_SCHEMA_VERSION, } from './sqlite-context-offload-schema.js';
|
|
26
|
+
import { migrateSqliteContextOffloadDatabase, SQLITE_CONTEXT_OFFLOAD_SCHEMA_VERSION, validateSqliteContextOffloadSchema, } from './sqlite-context-offload-schema.js';
|
|
27
27
|
import { CONTEXT_OFFLOAD_DATABASE_NAME, CONTEXT_OFFLOAD_VALUES_DIRECTORY_NAME, } from './sqlite-context-offload-store.js';
|
|
28
28
|
import { syncDirectoryChain, syncFile } from './stable-storage.js';
|
|
29
29
|
import { SQLITE_SESSION_MESSAGE_CHUNK_MARKER } from './sqlite-session-metadata-schema.js';
|
|
@@ -187,6 +187,7 @@ export async function validateContextSnapshot(root, sessionIds) {
|
|
|
187
187
|
if (context.prepare('PRAGMA user_version').get()?.user_version !==
|
|
188
188
|
SQLITE_CONTEXT_OFFLOAD_SCHEMA_VERSION)
|
|
189
189
|
throw new Error('Unsupported context snapshot schema');
|
|
190
|
+
validateSqliteContextOffloadSchema(context);
|
|
190
191
|
if (context.prepare('PRAGMA integrity_check').get()?.integrity_check !== 'ok' ||
|
|
191
192
|
context.prepare('PRAGMA foreign_key_check').get())
|
|
192
193
|
throw new Error('Invalid context snapshot database');
|
|
@@ -43,6 +43,9 @@ export async function openInteractiveEventWaitAuthorityForWrite(lease, repositor
|
|
|
43
43
|
'reserveSourceDispatch',
|
|
44
44
|
'completeSourceDispatch',
|
|
45
45
|
'commit',
|
|
46
|
+
'registerGoalWait',
|
|
47
|
+
'settleGoalWait',
|
|
48
|
+
'queueGoalWait',
|
|
46
49
|
'close',
|
|
47
50
|
].some((k) => typeof Reflect.get(repository, k) !== 'function')) {
|
|
48
51
|
throw new TypeError('Execution persistence requires an eventWaitStore');
|
|
@@ -125,6 +128,18 @@ export async function openInteractiveEventWaitAuthorityForWrite(lease, repositor
|
|
|
125
128
|
const normalized = normalizeEventWaitCommit(input);
|
|
126
129
|
return run(() => repository.commit(normalized));
|
|
127
130
|
},
|
|
131
|
+
registerGoalWait: (input) => {
|
|
132
|
+
const captured = structuredClone(input);
|
|
133
|
+
return run(() => repository.registerGoalWait(captured));
|
|
134
|
+
},
|
|
135
|
+
settleGoalWait: (input) => {
|
|
136
|
+
const captured = structuredClone(input);
|
|
137
|
+
return run(() => repository.settleGoalWait(captured));
|
|
138
|
+
},
|
|
139
|
+
queueGoalWait: (input) => {
|
|
140
|
+
const captured = structuredClone(input);
|
|
141
|
+
return run(() => repository.queueGoalWait(captured));
|
|
142
|
+
},
|
|
128
143
|
close: () => (closeTask ??= (async () => {
|
|
129
144
|
closed = true;
|
|
130
145
|
writers.delete(writer);
|
|
@@ -215,7 +230,9 @@ export function normalizeEventWaitCommit(input) {
|
|
|
215
230
|
};
|
|
216
231
|
}
|
|
217
232
|
export function validateEventWaitStatusPage(input) {
|
|
218
|
-
exactInput(input, ['status', 'limit'], ['afterWaitId']);
|
|
233
|
+
exactInput(input, ['status', 'limit'], ['afterWaitId', 'deliveryOutstanding']);
|
|
234
|
+
if (input.deliveryOutstanding !== undefined && input.deliveryOutstanding !== true)
|
|
235
|
+
throw new TypeError('Invalid delivery filter');
|
|
219
236
|
if (!['waiting', 'resolved', 'expired', 'cancelled'].includes(input.status))
|
|
220
237
|
throw new TypeError('Invalid event wait status');
|
|
221
238
|
validateEventWaitPage({
|