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
|
@@ -611,13 +611,16 @@ export function buildRuntimeEventModelReplayPlan(events, options = {}) {
|
|
|
611
611
|
diagnostics.push(diagnostic(event, 'unsupported_content', 'RuntimeEvent content kind is not model-replayable', { kind: event.content.kind }));
|
|
612
612
|
continue;
|
|
613
613
|
}
|
|
614
|
-
|
|
614
|
+
const runtimeContextName = event.role === 'system' && event.author === 'host' && event.content.kind === 'text'
|
|
615
|
+
? event.content.runtimeContextName
|
|
616
|
+
: undefined;
|
|
617
|
+
if (event.role === 'system' && !includeSystemEvents && runtimeContextName === undefined) {
|
|
615
618
|
diagnostics.push(diagnostic(event, 'system_runtime_fact_diagnostic_only', 'system RuntimeEvent content is diagnostic-only unless system replay is enabled'));
|
|
616
619
|
continue;
|
|
617
620
|
}
|
|
618
621
|
switch (event.content.kind) {
|
|
619
622
|
case 'text': {
|
|
620
|
-
const role = modelTextRole(event.role);
|
|
623
|
+
const role = runtimeContextName !== undefined ? 'user' : modelTextRole(event.role);
|
|
621
624
|
if (!role) {
|
|
622
625
|
diagnostics.push(diagnostic(event, 'unsupported_role', 'text RuntimeEvent role is not model-replayable', {
|
|
623
626
|
role: event.role,
|
|
@@ -636,6 +639,7 @@ export function buildRuntimeEventModelReplayPlan(events, options = {}) {
|
|
|
636
639
|
? buildSteeringEnvelope(formatTextWithInlineRefs(event.content))
|
|
637
640
|
: formatTextWithInlineRefs(event.content),
|
|
638
641
|
...(steeringReplay ? { steering: { eventId: event.id } } : {}),
|
|
642
|
+
...(runtimeContextName !== undefined ? { runtimeContextName } : {}),
|
|
639
643
|
...(event.content.attachments ? { attachments: event.content.attachments } : {}),
|
|
640
644
|
...(event.content.providerOptions !== undefined
|
|
641
645
|
? {
|
|
@@ -807,7 +811,13 @@ export function buildRuntimeEventModelReplayPlan(events, options = {}) {
|
|
|
807
811
|
content: item.content,
|
|
808
812
|
providerOptions: steeringProviderOptions(item.steering.eventId),
|
|
809
813
|
}
|
|
810
|
-
: {
|
|
814
|
+
: {
|
|
815
|
+
role: item.role,
|
|
816
|
+
content: item.content,
|
|
817
|
+
...(item.runtimeContextName !== undefined
|
|
818
|
+
? { providerOptions: runtimeContextProviderOptions(item.runtimeContextName) }
|
|
819
|
+
: {}),
|
|
820
|
+
});
|
|
811
821
|
return {
|
|
812
822
|
items,
|
|
813
823
|
textMessages,
|
|
@@ -815,6 +825,9 @@ export function buildRuntimeEventModelReplayPlan(events, options = {}) {
|
|
|
815
825
|
hasProviderNativeSemantics: items.some((item) => item.kind !== 'text'),
|
|
816
826
|
};
|
|
817
827
|
}
|
|
828
|
+
export function runtimeContextProviderOptions(name) {
|
|
829
|
+
return { makaRuntimeContext: { name } };
|
|
830
|
+
}
|
|
818
831
|
function modelTextRole(role) {
|
|
819
832
|
switch (role) {
|
|
820
833
|
case 'user':
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
import { HistoryCompactSummarizerError } from './history-compact-error.js';
|
|
20
20
|
import { nonEmpty } from './context-budget-helpers.js';
|
|
21
|
-
import { canContinueHistoryCompactCheckpointForModel, historyCompactCheckpointToModelMessage, isProviderHistoryCompactCheckpoint, } from './history-compact-checkpoint.js';
|
|
21
|
+
import { canContinueHistoryCompactCheckpointForModel, historyCompactCheckpointToModelMessage, isProviderHistoryCompactCheckpoint, projectHistoryCompactCheckpointReplay, } from './history-compact-checkpoint.js';
|
|
22
22
|
import { admitProviderReasoningReplayItems, buildRuntimeEventModelReplayPlan, buildRuntimeEventReplayTimeline, compatibleProviderReasoningReplayEventIds, } from './model-history.js';
|
|
23
23
|
import { withProviderStreamTracking } from './provider-request-telemetry.js';
|
|
24
24
|
import { effectiveReplayToolResultOutput } from './durable-tool-result-projection.js';
|
|
@@ -40,14 +40,22 @@ export function buildOpenAiCodexHistoryCompactor(options) {
|
|
|
40
40
|
try {
|
|
41
41
|
const previous = input.previousCheckpoint;
|
|
42
42
|
const canContinuePrevious = previous &&
|
|
43
|
-
isProviderHistoryCompactCheckpoint(previous) &&
|
|
44
43
|
canContinueHistoryCompactCheckpointForModel(previous, { providerType: 'openai-codex' }, options.connectionId, options.modelId);
|
|
45
44
|
const events = canContinuePrevious
|
|
46
45
|
? (input.newlyFoldedRuntimeEvents ?? [])
|
|
47
46
|
: input.source.foldedRuntimeEvents;
|
|
47
|
+
// Match ordinary replay after a text-compacted session switches to
|
|
48
|
+
// Codex: summarize the portable checkpoint plus its tail, without
|
|
49
|
+
// resurrecting the already-folded source history (#6154).
|
|
50
|
+
const replayEvents = canContinuePrevious && !isProviderHistoryCompactCheckpoint(previous)
|
|
51
|
+
? projectHistoryCompactCheckpointReplay(previous,
|
|
52
|
+
// The projection finds a mid-turn head anchor by identity. A
|
|
53
|
+
// historical event count can cut it off after reasoning admission.
|
|
54
|
+
input.source.foldedRuntimeEvents, events)
|
|
55
|
+
: events;
|
|
48
56
|
const providerReasoningReplayEventIds = compatibleProviderReasoningReplayEventIds(events, input.source.invocations, options.providerStateIdentity, options.modelId, input.runId);
|
|
49
|
-
const projectedMessages = openAiCodexCompactionMessages(
|
|
50
|
-
if (canContinuePrevious) {
|
|
57
|
+
const projectedMessages = openAiCodexCompactionMessages(replayEvents, providerReasoningReplayEventIds);
|
|
58
|
+
if (canContinuePrevious && isProviderHistoryCompactCheckpoint(previous)) {
|
|
51
59
|
projectedMessages.unshift(historyCompactCheckpointToModelMessage(previous));
|
|
52
60
|
}
|
|
53
61
|
// Whether this input fits the compaction endpoint is its own answer;
|
|
@@ -122,7 +130,9 @@ export function shouldFallbackFromOpenAiCodexHistoryCompaction(error, abortSigna
|
|
|
122
130
|
return false;
|
|
123
131
|
if (!(error instanceof HistoryCompactSummarizerError))
|
|
124
132
|
return false;
|
|
125
|
-
|
|
133
|
+
// Capacity errors must reach the planner's same-route accepted-prefix
|
|
134
|
+
// retry, which preserves native compaction and the uncovered tail.
|
|
135
|
+
if (error.reason === 'invalid_provider_state')
|
|
126
136
|
return true;
|
|
127
137
|
if (error.reason !== 'provider_error')
|
|
128
138
|
return false;
|
|
@@ -63,7 +63,6 @@ export function buildSubmitPlanTool(planStore, sourceExecutionId) {
|
|
|
63
63
|
risks: z.array(boundedTextSchema('Plan risk')).max(PLAN_MAX_RISKS).optional(),
|
|
64
64
|
})
|
|
65
65
|
.refine(isPlanProposalLifecycleAdmissible, 'Plan proposal cannot fit its execution lifecycle projection'),
|
|
66
|
-
recoveryMode: 'idempotent',
|
|
67
66
|
impl: async (input, context) => {
|
|
68
67
|
const result = await planStore.submitProposal({
|
|
69
68
|
operationId: planToolOperationId('submit', context),
|
|
@@ -90,7 +89,6 @@ export function buildUpdatePlanTool(planStore, executionId) {
|
|
|
90
89
|
steps: z.array(executionStepSchema).min(1).max(PLAN_MAX_STEPS),
|
|
91
90
|
explanation: boundedTextSchema('Plan progress explanation').optional(),
|
|
92
91
|
}),
|
|
93
|
-
recoveryMode: 'idempotent',
|
|
94
92
|
impl: async (input, context) => {
|
|
95
93
|
const result = await planStore.updateExecution({
|
|
96
94
|
operationId: planToolOperationId('update', context),
|
|
@@ -109,7 +107,6 @@ export function buildCancelPlanTool(planStore, executionId) {
|
|
|
109
107
|
parameters: z.object({
|
|
110
108
|
reason: boundedTextSchema('Plan cancellation reason', PLAN_LIFECYCLE_REASON_MAX_BYTES),
|
|
111
109
|
}),
|
|
112
|
-
recoveryMode: 'idempotent',
|
|
113
110
|
impl: async ({ reason }, context) => {
|
|
114
111
|
const result = await planStore.cancelExecution({
|
|
115
112
|
operationId: planToolOperationId('cancel', context),
|
|
@@ -17,8 +17,10 @@
|
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
19
|
import { randomUUID } from 'node:crypto';
|
|
20
|
+
import { truncateUtf8 } from '@maka/core/diagnostic-log';
|
|
20
21
|
import { redactSecrets } from '@maka/core/redaction';
|
|
21
22
|
import { AsyncEventQueue } from './async-queue.js';
|
|
23
|
+
import { MAX_EXECUTOR_COMPLETION_TEXT_BYTES } from './plugin-executor-service.js';
|
|
22
24
|
/** Converts a small plugin executor contract into Maka's existing Run event stream. */
|
|
23
25
|
export class PluginExecutorBackend {
|
|
24
26
|
kind = 'plugin-executor';
|
|
@@ -51,7 +53,7 @@ export class PluginExecutorBackend {
|
|
|
51
53
|
const queue = new AsyncEventQueue();
|
|
52
54
|
const messageId = this.#newId();
|
|
53
55
|
const producer = this.#produce(input, messageId, abort.signal, queue).finally(() => queue.close());
|
|
54
|
-
const active = { abort, settled: producer.then(() => undefined) };
|
|
56
|
+
const active = { abort, settled: producer.then(() => undefined), queue };
|
|
55
57
|
this.#active.add(active);
|
|
56
58
|
let acknowledged = false;
|
|
57
59
|
try {
|
|
@@ -90,11 +92,22 @@ export class PluginExecutorBackend {
|
|
|
90
92
|
this.#active.delete(active);
|
|
91
93
|
}
|
|
92
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Cancel execution and wait for its queued events to be consumed or the consumer
|
|
97
|
+
* to detach. Keep consuming send() while stopping: awaiting stop() inside that
|
|
98
|
+
* consumer loop prevents progress. Start it without awaiting in the loop, then
|
|
99
|
+
* await it after the loop exits.
|
|
100
|
+
*/
|
|
93
101
|
async stop(reason) {
|
|
94
102
|
const active = [...this.#active];
|
|
95
103
|
for (const execution of active)
|
|
96
104
|
execution.abort.abort(new Error(reason));
|
|
97
|
-
await Promise.allSettled(active.map((execution) =>
|
|
105
|
+
await Promise.allSettled(active.map(async (execution) => {
|
|
106
|
+
await execution.settled;
|
|
107
|
+
// Runtime may seal the ledger when stop returns. Provider settlement
|
|
108
|
+
// alone does not mean its queued final updates have been persisted.
|
|
109
|
+
await execution.queue.waitUntilConsumedThroughCurrent();
|
|
110
|
+
}));
|
|
98
111
|
}
|
|
99
112
|
async respondToSandboxBoundary(_response) {
|
|
100
113
|
throw new Error('Plugin executor does not expose Maka sandbox-boundary requests');
|
|
@@ -111,6 +124,9 @@ export class PluginExecutorBackend {
|
|
|
111
124
|
async #produce(input, messageId, signal, queue) {
|
|
112
125
|
const turnId = input.turnId;
|
|
113
126
|
let thinkingText = '';
|
|
127
|
+
let outputText = '';
|
|
128
|
+
let outputBytes = 0;
|
|
129
|
+
let outputTruncated = false;
|
|
114
130
|
const toolUseIds = new Map();
|
|
115
131
|
const toolOutputSequences = new Map();
|
|
116
132
|
let result;
|
|
@@ -140,6 +156,21 @@ export class PluginExecutorBackend {
|
|
|
140
156
|
onEvent: (event) => {
|
|
141
157
|
if (event.type === 'thinking_delta')
|
|
142
158
|
thinkingText += event.text;
|
|
159
|
+
if (event.type === 'output_delta' && !outputTruncated) {
|
|
160
|
+
// Bound even a single oversized delta before retaining it. Live
|
|
161
|
+
// delivery and the provider's final result remain authoritative.
|
|
162
|
+
const chunk = event.text.slice(0, MAX_EXECUTOR_COMPLETION_TEXT_BYTES + 1);
|
|
163
|
+
outputText += chunk;
|
|
164
|
+
outputBytes += Buffer.byteLength(chunk, 'utf8');
|
|
165
|
+
if (outputBytes > MAX_EXECUTOR_COMPLETION_TEXT_BYTES) {
|
|
166
|
+
// A surrogate pair split across deltas uses fewer bytes joined.
|
|
167
|
+
outputBytes = Buffer.byteLength(outputText, 'utf8');
|
|
168
|
+
if (outputBytes > MAX_EXECUTOR_COMPLETION_TEXT_BYTES) {
|
|
169
|
+
outputText = truncateUtf8(outputText, MAX_EXECUTOR_COMPLETION_TEXT_BYTES, '\n[Response truncated]');
|
|
170
|
+
outputTruncated = true;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
143
174
|
this.#publishOutputEvent(turnId, messageId, event, toolUseIds, toolOutputSequences, queue);
|
|
144
175
|
},
|
|
145
176
|
onPermissionRequest: (request) => this.#requestPermission(input, request, signal, toolUseIds, queue),
|
|
@@ -150,6 +181,22 @@ export class PluginExecutorBackend {
|
|
|
150
181
|
failure = error;
|
|
151
182
|
}
|
|
152
183
|
this.#closeOptionalOutput(turnId, messageId, thinkingText, toolUseIds, queue);
|
|
184
|
+
// Deltas are only live presentation. Close the interrupted text before the
|
|
185
|
+
// terminal event seals the ledger, including updates drained during cancel.
|
|
186
|
+
// Successful results keep their provider-authoritative completion text.
|
|
187
|
+
// Like successful completions, history stores one text block after tool
|
|
188
|
+
// results; it does not preserve the live text/tool interleaving.
|
|
189
|
+
if (outputText && (failed || result?.status !== 'completed')) {
|
|
190
|
+
queue.push({
|
|
191
|
+
type: 'text_complete',
|
|
192
|
+
id: this.#newId(),
|
|
193
|
+
turnId,
|
|
194
|
+
ts: this.#now(),
|
|
195
|
+
messageId,
|
|
196
|
+
text: outputText,
|
|
197
|
+
interrupted: true,
|
|
198
|
+
});
|
|
199
|
+
}
|
|
153
200
|
if (failed) {
|
|
154
201
|
if (signal.aborted)
|
|
155
202
|
this.#publishCancellation(turnId, { status: 'cancelled', source: 'caller' }, queue);
|
|
@@ -23,7 +23,7 @@ import { isExecutorId } from '@maka/core/executor-id';
|
|
|
23
23
|
import { Service } from './plugin-kernel.js';
|
|
24
24
|
import { MakaPluginRuntimeError, pluginIdentity, registerPluginContribution, } from './plugin-runtime.js';
|
|
25
25
|
import { PluginScopeRegistry } from './plugin-scope-registry.js';
|
|
26
|
-
const MAX_EXECUTOR_COMPLETION_TEXT_BYTES = 256 * 1024;
|
|
26
|
+
export const MAX_EXECUTOR_COMPLETION_TEXT_BYTES = 256 * 1024;
|
|
27
27
|
class ExecutorRetiredAbort extends Error {
|
|
28
28
|
constructor(executorId) {
|
|
29
29
|
super(`Executor was retired: ${executorId}`);
|
|
@@ -127,6 +127,15 @@ export class PluginExecutorService extends Service {
|
|
|
127
127
|
? [...this.registry.visible(scopeSessionId).values()]
|
|
128
128
|
: [...this.registry.entries('profile')];
|
|
129
129
|
const selected = entries.filter((entry) => !entry.retired && (!input.executorId || entry.provider.id === input.executorId));
|
|
130
|
+
if (input.listOnly)
|
|
131
|
+
return selected.map(({ provider }) => ({
|
|
132
|
+
id: provider.id,
|
|
133
|
+
displayName: provider.displayName?.trim() || provider.id,
|
|
134
|
+
readiness: 'unavailable',
|
|
135
|
+
models: [],
|
|
136
|
+
supportsAttachments: false,
|
|
137
|
+
supportsModelChange: false,
|
|
138
|
+
}));
|
|
130
139
|
if (input.executorId && !selected.length)
|
|
131
140
|
return [
|
|
132
141
|
{
|
|
@@ -170,9 +179,9 @@ export class PluginExecutorService extends Service {
|
|
|
170
179
|
}
|
|
171
180
|
})));
|
|
172
181
|
}
|
|
173
|
-
invalidateCatalog() {
|
|
182
|
+
invalidateCatalog(executorId) {
|
|
174
183
|
for (const entry of this.registry.entries('profile')) {
|
|
175
|
-
if (!entry.retired)
|
|
184
|
+
if (!entry.retired && (!executorId || entry.provider.id === executorId))
|
|
176
185
|
entry.provider.invalidateCatalog?.();
|
|
177
186
|
}
|
|
178
187
|
}
|
|
@@ -38,6 +38,7 @@ const PROVIDER_UNAVAILABLE_PROVIDER_CODES = new Set([
|
|
|
38
38
|
const OPENAI_CODEX_EDGE_REJECTION_CODE = 'openai_codex_edge_rejection';
|
|
39
39
|
// Node, TLS, and undici codes that identify transport failures before an HTTP response.
|
|
40
40
|
const TRANSPORT_FAILURE_CODES = new Set([
|
|
41
|
+
'ERR_HTTP2_STREAM_ERROR',
|
|
41
42
|
'ECONNRESET',
|
|
42
43
|
'ECONNREFUSED',
|
|
43
44
|
'ETIMEDOUT',
|
|
@@ -52,6 +53,7 @@ const TRANSPORT_FAILURE_CODES = new Set([
|
|
|
52
53
|
// Unlike pre-response failures, require an explicit interruption code here:
|
|
53
54
|
// neither SDK retryability nor arbitrary TLS/undici errors prove a transient cut.
|
|
54
55
|
const RESPONSE_TRANSPORT_FAILURE_CODES = new Set([
|
|
56
|
+
'ERR_HTTP2_STREAM_ERROR',
|
|
55
57
|
'ECONNRESET',
|
|
56
58
|
'EPIPE',
|
|
57
59
|
'ETIMEDOUT',
|
|
@@ -42,7 +42,6 @@ export function resolveRuntimeRecovery(events) {
|
|
|
42
42
|
decisions,
|
|
43
43
|
issues,
|
|
44
44
|
hasCorruption,
|
|
45
|
-
requiresReconciliation: !hasCorruption && decisions.some((decision) => decision.status === 'indeterminate'),
|
|
46
45
|
};
|
|
47
46
|
}
|
|
48
47
|
function decisionFromOperation(operation, toolBoundaryProtocol, eventOrder) {
|
|
@@ -91,6 +90,8 @@ function decisionFromOperation(operation, toolBoundaryProtocol, eventOrder) {
|
|
|
91
90
|
if (operation.reconcileEvents.length === 0 && operation.decisionEvents.length === 0) {
|
|
92
91
|
return decision;
|
|
93
92
|
}
|
|
93
|
+
// Historical bundles remain authoritative when reading an existing ledger.
|
|
94
|
+
// New uncertain calls are sealed as outcome_unknown, never reconciled.
|
|
94
95
|
const recovery = interpretScannedToolRecovery(operation, eventOrder);
|
|
95
96
|
if (recovery.kind !== 'valid') {
|
|
96
97
|
decision.status = 'corruption';
|
|
@@ -0,0 +1,53 @@
|
|
|
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 { runtimeContextProviderOptions } from './model-history.js';
|
|
20
|
+
/** Compare only host-tagged context still present in the effective model history.
|
|
21
|
+
* Compaction may remove a snapshot; in that case the current value is sent again.
|
|
22
|
+
*/
|
|
23
|
+
export function changedRuntimeContexts(contexts, messages) {
|
|
24
|
+
const latest = new Map();
|
|
25
|
+
for (const message of messages) {
|
|
26
|
+
const name = message.providerOptions?.makaRuntimeContext?.name;
|
|
27
|
+
if (message.role !== 'user' || typeof name !== 'string')
|
|
28
|
+
continue;
|
|
29
|
+
const text = typeof message.content === 'string'
|
|
30
|
+
? message.content
|
|
31
|
+
: message.content
|
|
32
|
+
.filter((part) => part.type === 'text')
|
|
33
|
+
.map((part) => part.text)
|
|
34
|
+
.join('');
|
|
35
|
+
latest.set(name, text);
|
|
36
|
+
}
|
|
37
|
+
const changes = [];
|
|
38
|
+
for (const context of contexts) {
|
|
39
|
+
const text = `Runtime context (${context.name}; host metadata, not a user request; later updates supersede earlier values):\n${context.text}`;
|
|
40
|
+
if (latest.get(context.name) === text)
|
|
41
|
+
continue;
|
|
42
|
+
changes.push({ name: context.name, text });
|
|
43
|
+
latest.set(context.name, text);
|
|
44
|
+
}
|
|
45
|
+
return changes;
|
|
46
|
+
}
|
|
47
|
+
export function runtimeContextMessage(context) {
|
|
48
|
+
return {
|
|
49
|
+
role: 'user',
|
|
50
|
+
content: context.text,
|
|
51
|
+
providerOptions: runtimeContextProviderOptions(context.name),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
@@ -638,6 +638,9 @@ export function classifyRuntimeEventTerminalFact(invocation, events) {
|
|
|
638
638
|
function projectText(event, state, messages) {
|
|
639
639
|
if (event.content?.kind !== 'text')
|
|
640
640
|
return false;
|
|
641
|
+
// Claimed by model replay only; internal context has no transcript row.
|
|
642
|
+
if (event.role === 'system' && event.content.runtimeContextName !== undefined)
|
|
643
|
+
return true;
|
|
641
644
|
if (event.role === 'user') {
|
|
642
645
|
const message = projectRuntimeEventUserMessage(event, stableMessageId(event, state, 'user'));
|
|
643
646
|
if (!message)
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
19
|
import { promises as fs } from 'node:fs';
|
|
20
|
-
import { resolve } from 'node:path';
|
|
20
|
+
import { basename, join, resolve } from 'node:path';
|
|
21
21
|
import { realpathAllowMissing } from './path-containment.js';
|
|
22
22
|
import { MAX_SANDBOX_BOUNDARY_PATH_CHARS, validateSandboxBoundaryExpansion, } from '@maka/core/sandbox-boundary';
|
|
23
23
|
/**
|
|
@@ -59,8 +59,14 @@ export async function normalizeSandboxBoundaryExpansion(expansion, cwd) {
|
|
|
59
59
|
if (normalized.scope === 'exact' && normalized.targetType === 'directory') {
|
|
60
60
|
throw new SandboxBoundaryDeclarationError('An exact sandbox boundary cannot target a directory; use subtree for directory access.');
|
|
61
61
|
}
|
|
62
|
+
// Reading a linked worktree's admin directory is not enough to read the repository, so a
|
|
63
|
+
// read subtree widens to the shared Git directory it points at. A write boundary keeps the
|
|
64
|
+
// exact path the caller asked for.
|
|
65
|
+
const commonDir = normalized.access === 'read' && normalized.scope === 'subtree'
|
|
66
|
+
? await linkedWorktreeCommonDir(normalized.enforcementPath)
|
|
67
|
+
: undefined;
|
|
62
68
|
return {
|
|
63
|
-
path: normalized.enforcementPath,
|
|
69
|
+
path: commonDir ?? normalized.enforcementPath,
|
|
64
70
|
access: normalized.access,
|
|
65
71
|
scope: normalized.scope,
|
|
66
72
|
};
|
|
@@ -73,6 +79,77 @@ export async function normalizeSandboxBoundaryExpansion(expansion, cwd) {
|
|
|
73
79
|
throw new SandboxBoundaryDeclarationError(normalized.message);
|
|
74
80
|
return normalized.expansion;
|
|
75
81
|
}
|
|
82
|
+
/** `commondir` holds one short relative path; anything larger is not a pointer we will follow. */
|
|
83
|
+
const MAX_GIT_COMMON_DIR_POINTER_CHARS = 1024;
|
|
84
|
+
/**
|
|
85
|
+
* Resolve a linked worktree's admin directory to the repository's shared Git directory.
|
|
86
|
+
*
|
|
87
|
+
* `.git/worktrees/<name>` keeps only that worktree's HEAD, index and reflog; refs, objects,
|
|
88
|
+
* `config` and `info/exclude` live in the directory named by its `commondir` file. A read boundary
|
|
89
|
+
* on the admin directory alone leaves `git status` and `git log` unable to read the repository
|
|
90
|
+
* they belong to, so the request is widened to that shared directory before it is approved.
|
|
91
|
+
*
|
|
92
|
+
* The pointer is repository-controlled text found inside a path the caller asked for, so it is
|
|
93
|
+
* followed only when the target really is this repository's shared directory: it must hold
|
|
94
|
+
* `objects` and `refs` as real directories, reached through no symlink, and the requested admin
|
|
95
|
+
* directory must sit at `<target>/worktrees/<name>`. Anything else leaves the boundary exactly as
|
|
96
|
+
* requested, rather than widening it into a temp directory, an ancestor, or another repository's
|
|
97
|
+
* `.git` that only looks like a common directory.
|
|
98
|
+
*/
|
|
99
|
+
async function linkedWorktreeCommonDir(adminPath) {
|
|
100
|
+
const pointer = join(adminPath, 'commondir');
|
|
101
|
+
try {
|
|
102
|
+
if ((await realTargetTypeFor(pointer)) !== 'file')
|
|
103
|
+
return undefined;
|
|
104
|
+
const raw = await fs.readFile(pointer, 'utf8');
|
|
105
|
+
if (raw.length > MAX_GIT_COMMON_DIR_POINTER_CHARS)
|
|
106
|
+
return undefined;
|
|
107
|
+
const target = raw.trim();
|
|
108
|
+
if (!target || target.includes('\0'))
|
|
109
|
+
return undefined;
|
|
110
|
+
const resolved = await realpathAllowMissing(resolve(adminPath, target));
|
|
111
|
+
if (!(await isGitCommonDir(resolved)))
|
|
112
|
+
return undefined;
|
|
113
|
+
// Git's own contract for a linked worktree is that the admin directory lives at
|
|
114
|
+
// `<commondir>/worktrees/<name>`. Proving that relationship is what stops a directory that
|
|
115
|
+
// merely looks like a Git directory - a temp dir, an ancestor, another repository's `.git` -
|
|
116
|
+
// from replacing the subtree the caller actually asked for.
|
|
117
|
+
const [ownAdmin, requestedAdmin] = await Promise.all([
|
|
118
|
+
fs.realpath(join(resolved, 'worktrees', basename(adminPath))),
|
|
119
|
+
fs.realpath(adminPath),
|
|
120
|
+
]);
|
|
121
|
+
return ownAdmin === requestedAdmin ? resolved : undefined;
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
return undefined;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
async function isGitCommonDir(path) {
|
|
128
|
+
if ((await realTargetTypeFor(path)) !== 'directory')
|
|
129
|
+
return false;
|
|
130
|
+
return ((await realTargetTypeFor(join(path, 'objects'))) === 'directory' &&
|
|
131
|
+
(await realTargetTypeFor(join(path, 'refs'))) === 'directory');
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* `lstat`-backed {@link targetTypeFor}: a symlink is not proof that a repository layout is real, so
|
|
135
|
+
* the `commondir` marker and the entries that qualify its target are inspected without following
|
|
136
|
+
* links.
|
|
137
|
+
*/
|
|
138
|
+
async function realTargetTypeFor(path) {
|
|
139
|
+
try {
|
|
140
|
+
const stat = await fs.lstat(path);
|
|
141
|
+
if (stat.isFile())
|
|
142
|
+
return 'file';
|
|
143
|
+
if (stat.isDirectory())
|
|
144
|
+
return 'directory';
|
|
145
|
+
return 'other';
|
|
146
|
+
}
|
|
147
|
+
catch (error) {
|
|
148
|
+
if (isMissingPathError(error))
|
|
149
|
+
return 'missing';
|
|
150
|
+
throw error;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
76
153
|
async function targetTypeFor(path) {
|
|
77
154
|
try {
|
|
78
155
|
const stat = await fs.stat(path);
|