maka-agent 0.2.2-dev.92.20261019 → 0.2.2-dev.97.20261024
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +7 -7
- package/README.md +78 -18
- package/README.zh-CN.md +73 -15
- package/THIRD_PARTY_NOTICES.txt +12 -12
- package/dist/pi-goal.js +13 -0
- package/dist/pi-tui-runner.js +44 -1
- package/dist/run-command-core.js +111 -70
- package/dist/run-session-command.js +91 -15
- package/dist/run-turn-outcome.js +2 -33
- package/dist/runtime-host-session-channel.js +3 -1
- package/dist/runtime-host-session-driver.js +5 -0
- package/dist/tui-copy-catalog.js +24 -0
- package/native/runtime-host-windows-task-launcher/prebuilds/win32-x64/maka-runtime-host-task-launcher.exe +0 -0
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/docs/docs/api/Client.md +2 -0
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/core/connect.js +10 -4
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/core/symbols.js +1 -0
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/dispatcher/agent.js +6 -2
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/dispatcher/client-h1.js +0 -2
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/dispatcher/client-h2.js +0 -4
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/dispatcher/client.js +3 -2
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/dispatcher/dispatcher-base.js +12 -0
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/handler/cache-handler.js +48 -0
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/handler/deduplication-handler.js +57 -13
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/handler/redirect-handler.js +8 -1
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/interceptor/decompress.js +15 -5
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/cookies/index.js +3 -1
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/cookies/parse.js +138 -137
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/cookies/util.js +21 -2
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/eventsource/eventsource-stream.js +90 -9
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/eventsource/eventsource.js +4 -1
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/fetch/index.js +3 -3
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/infra/index.js +14 -0
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +5 -5
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/websocket/receiver.js +13 -0
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/package.json +1 -1
- package/node_modules/@maka/acp-executor-plugin/dist/acp-catalog-store.js +87 -0
- package/node_modules/@maka/acp-executor-plugin/dist/acp-catalog.js +98 -21
- package/node_modules/@maka/acp-executor-plugin/dist/index.js +90 -14
- package/node_modules/@maka/acp-executor-plugin/dist/plugin.mjs +3997 -56
- package/node_modules/@maka/core/dist/assistant-turn-ids.js +34 -0
- package/node_modules/@maka/core/dist/event-wait.js +28 -10
- package/node_modules/@maka/core/dist/executor-catalog.js +3 -1
- package/node_modules/@maka/core/dist/model-catalog.js +19 -1
- package/node_modules/@maka/core/dist/model-metadata.generated.js +4 -14
- package/node_modules/@maka/core/dist/model-metadata.js +42 -1
- package/node_modules/@maka/core/dist/models-dev-projection.js +32 -1
- package/node_modules/@maka/core/dist/provider-registry.js +16 -2
- package/node_modules/@maka/core/dist/runtime-event.js +8 -0
- package/node_modules/@maka/core/dist/session-checkin.js +31 -0
- package/node_modules/@maka/core/dist/usage-stats/types.js +1 -0
- package/node_modules/@maka/core/package.json +2 -0
- package/node_modules/@maka/eval/node_modules/undici/README.md +25 -3
- package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/CacheStore.md +24 -9
- package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/Client.md +11 -6
- package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/Dispatcher.md +3 -0
- package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/Errors.md +76 -1
- package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/H2CClient.md +3 -2
- package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/Interceptors.md +28 -8
- package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/RedirectHandler.md +13 -10
- package/node_modules/@maka/eval/node_modules/undici/docs/docs/index.md +12 -12
- package/node_modules/@maka/eval/node_modules/undici/docs/docs/type-map.json +66 -66
- package/node_modules/@maka/eval/node_modules/undici/lib/cache/memory-cache-store.js +48 -13
- package/node_modules/@maka/eval/node_modules/undici/lib/cache/sqlite-cache-store.js +83 -5
- package/node_modules/@maka/eval/node_modules/undici/lib/core/connect.js +10 -4
- package/node_modules/@maka/eval/node_modules/undici/lib/core/constants.js +12 -1
- package/node_modules/@maka/eval/node_modules/undici/lib/core/errors.js +38 -1
- package/node_modules/@maka/eval/node_modules/undici/lib/core/request.js +16 -1
- package/node_modules/@maka/eval/node_modules/undici/lib/core/symbols.js +2 -0
- package/node_modules/@maka/eval/node_modules/undici/lib/core/util.js +26 -1
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/agent.js +6 -2
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/client-h1.js +116 -80
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/client-h2.js +124 -17
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/client.js +4 -1
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/dispatcher-base.js +3 -2
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +20 -3
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/parser-h1.js +1064 -0
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/pool-base.js +85 -31
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/pool.js +11 -8
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/proxy-agent.js +18 -8
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/retry-agent.js +10 -0
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/round-robin-pool.js +15 -5
- package/node_modules/@maka/eval/node_modules/undici/lib/handler/cache-handler.js +153 -15
- package/node_modules/@maka/eval/node_modules/undici/lib/handler/deduplication-handler.js +112 -51
- package/node_modules/@maka/eval/node_modules/undici/lib/handler/redirect-handler.js +28 -8
- package/node_modules/@maka/eval/node_modules/undici/lib/handler/retry-handler.js +44 -11
- package/node_modules/@maka/eval/node_modules/undici/lib/interceptor/cache.js +11 -3
- package/node_modules/@maka/eval/node_modules/undici/lib/interceptor/decompress.js +22 -9
- package/node_modules/@maka/eval/node_modules/undici/lib/interceptor/dns.js +11 -0
- package/node_modules/@maka/eval/node_modules/undici/lib/interceptor/response-error.js +72 -28
- package/node_modules/@maka/eval/node_modules/undici/lib/milo/LICENSE.md +7 -0
- package/node_modules/@maka/eval/node_modules/undici/lib/milo/no-simd.js +1002 -0
- package/node_modules/@maka/eval/node_modules/undici/lib/milo/simd.js +1002 -0
- package/node_modules/@maka/eval/node_modules/undici/lib/mock/mock-agent.js +11 -0
- package/node_modules/@maka/eval/node_modules/undici/lib/mock/snapshot-recorder.js +3 -2
- package/node_modules/@maka/eval/node_modules/undici/lib/mock/snapshot-utils.js +3 -2
- package/node_modules/@maka/eval/node_modules/undici/lib/util/cache.js +11 -5
- package/node_modules/@maka/eval/node_modules/undici/lib/web/cookies/util.js +19 -2
- package/node_modules/@maka/eval/node_modules/undici/lib/web/eventsource/eventsource-stream.js +69 -15
- package/node_modules/@maka/eval/node_modules/undici/lib/web/eventsource/eventsource.js +25 -2
- package/node_modules/@maka/eval/node_modules/undici/lib/web/fetch/body.js +47 -38
- package/node_modules/@maka/eval/node_modules/undici/lib/web/fetch/formdata-parser.js +12 -4
- package/node_modules/@maka/eval/node_modules/undici/lib/web/fetch/headers.js +2 -2
- package/node_modules/@maka/eval/node_modules/undici/lib/web/fetch/index.js +8 -4
- package/node_modules/@maka/eval/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +5 -5
- package/node_modules/@maka/eval/node_modules/undici/lib/web/websocket/receiver.js +25 -4
- package/node_modules/@maka/eval/node_modules/undici/package.json +9 -7
- package/node_modules/@maka/mcp/package.json +1 -1
- package/node_modules/@maka/runtime/dist/ai-sdk-compaction.js +22 -9
- package/node_modules/@maka/runtime/dist/ai-sdk-message-projection.js +10 -1
- package/node_modules/@maka/runtime/dist/ai-sdk-turn.js +101 -127
- package/node_modules/@maka/runtime/dist/event-wait-tool.js +2 -2
- package/node_modules/@maka/runtime/dist/history-compact-checkpoint.js +32 -1
- package/node_modules/@maka/runtime/dist/history-compaction.js +7 -0
- package/node_modules/@maka/runtime/dist/model-factory.js +26 -6
- package/node_modules/@maka/runtime/dist/model-fetcher.js +8 -1
- package/node_modules/@maka/runtime/dist/model-history.js +16 -3
- package/node_modules/@maka/runtime/dist/openai-codex-history-compactor.js +7 -2
- package/node_modules/@maka/runtime/dist/plugin-executor-backend.js +49 -2
- package/node_modules/@maka/runtime/dist/plugin-executor-service.js +12 -3
- package/node_modules/@maka/runtime/dist/runtime-context.js +53 -0
- package/node_modules/@maka/runtime/dist/runtime-event-read-model.js +3 -0
- package/node_modules/@maka/runtime/dist/session-checkin.js +331 -0
- package/node_modules/@maka/runtime/dist/session-event-runtime-mapper.js +7 -0
- package/node_modules/@maka/runtime/dist/shell-run-manager.js +34 -0
- package/node_modules/@maka/runtime/dist/telemetry/builtin-pricing.js +21 -2
- package/node_modules/@maka/runtime/dist/tool-runtime.js +8 -0
- package/node_modules/@maka/runtime/dist/workers/filesystem-worker.mjs +50 -1
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/docs/docs/api/Client.md +2 -0
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/core/connect.js +10 -4
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/core/symbols.js +1 -0
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/dispatcher/agent.js +6 -2
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/dispatcher/client-h1.js +0 -2
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/dispatcher/client-h2.js +0 -4
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/dispatcher/client.js +3 -2
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/dispatcher/dispatcher-base.js +12 -0
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/handler/cache-handler.js +48 -0
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/handler/deduplication-handler.js +57 -13
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/handler/redirect-handler.js +8 -1
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/interceptor/decompress.js +15 -5
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/cookies/index.js +3 -1
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/cookies/parse.js +138 -137
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/cookies/util.js +21 -2
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/eventsource/eventsource-stream.js +90 -9
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/eventsource/eventsource.js +4 -1
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/fetch/index.js +3 -3
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/infra/index.js +14 -0
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +5 -5
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/websocket/receiver.js +13 -0
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/package.json +1 -1
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/package.json +1 -1
- package/node_modules/@maka/runtime/node_modules/undici/README.md +25 -3
- package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/CacheStore.md +24 -9
- package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/Client.md +11 -6
- package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/Dispatcher.md +3 -0
- package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/Errors.md +76 -1
- package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/H2CClient.md +3 -2
- package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/Interceptors.md +28 -8
- package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/RedirectHandler.md +13 -10
- package/node_modules/@maka/runtime/node_modules/undici/docs/docs/index.md +12 -12
- package/node_modules/@maka/runtime/node_modules/undici/docs/docs/type-map.json +66 -66
- package/node_modules/@maka/runtime/node_modules/undici/lib/cache/memory-cache-store.js +48 -13
- package/node_modules/@maka/runtime/node_modules/undici/lib/cache/sqlite-cache-store.js +83 -5
- package/node_modules/@maka/runtime/node_modules/undici/lib/core/connect.js +10 -4
- package/node_modules/@maka/runtime/node_modules/undici/lib/core/constants.js +12 -1
- package/node_modules/@maka/runtime/node_modules/undici/lib/core/errors.js +38 -1
- package/node_modules/@maka/runtime/node_modules/undici/lib/core/request.js +16 -1
- package/node_modules/@maka/runtime/node_modules/undici/lib/core/symbols.js +2 -0
- package/node_modules/@maka/runtime/node_modules/undici/lib/core/util.js +26 -1
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/agent.js +6 -2
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/client-h1.js +116 -80
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/client-h2.js +124 -17
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/client.js +4 -1
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/dispatcher-base.js +3 -2
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +20 -3
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/parser-h1.js +1064 -0
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/pool-base.js +85 -31
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/pool.js +11 -8
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/proxy-agent.js +18 -8
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/retry-agent.js +10 -0
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/round-robin-pool.js +15 -5
- package/node_modules/@maka/runtime/node_modules/undici/lib/handler/cache-handler.js +153 -15
- package/node_modules/@maka/runtime/node_modules/undici/lib/handler/deduplication-handler.js +112 -51
- package/node_modules/@maka/runtime/node_modules/undici/lib/handler/redirect-handler.js +28 -8
- package/node_modules/@maka/runtime/node_modules/undici/lib/handler/retry-handler.js +44 -11
- package/node_modules/@maka/runtime/node_modules/undici/lib/interceptor/cache.js +11 -3
- package/node_modules/@maka/runtime/node_modules/undici/lib/interceptor/decompress.js +22 -9
- package/node_modules/@maka/runtime/node_modules/undici/lib/interceptor/dns.js +11 -0
- package/node_modules/@maka/runtime/node_modules/undici/lib/interceptor/response-error.js +72 -28
- package/node_modules/@maka/runtime/node_modules/undici/lib/milo/LICENSE.md +7 -0
- package/node_modules/@maka/runtime/node_modules/undici/lib/milo/no-simd.js +1002 -0
- package/node_modules/@maka/runtime/node_modules/undici/lib/milo/simd.js +1002 -0
- package/node_modules/@maka/runtime/node_modules/undici/lib/mock/mock-agent.js +11 -0
- package/node_modules/@maka/runtime/node_modules/undici/lib/mock/snapshot-recorder.js +3 -2
- package/node_modules/@maka/runtime/node_modules/undici/lib/mock/snapshot-utils.js +3 -2
- package/node_modules/@maka/runtime/node_modules/undici/lib/util/cache.js +11 -5
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/cookies/util.js +19 -2
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/eventsource/eventsource-stream.js +69 -15
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/eventsource/eventsource.js +25 -2
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/fetch/body.js +47 -38
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/fetch/formdata-parser.js +12 -4
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/fetch/headers.js +2 -2
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/fetch/index.js +8 -4
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +5 -5
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/websocket/receiver.js +25 -4
- package/node_modules/@maka/runtime/node_modules/undici/package.json +9 -7
- package/node_modules/@maka/runtime/package.json +2 -0
- package/node_modules/@maka/runtime-host/dist/assistant/bot/bridge.js +8 -0
- package/node_modules/@maka/runtime-host/dist/assistant/bot/capabilities.js +1 -0
- package/node_modules/@maka/runtime-host/dist/assistant/bot/controller.js +64 -13
- package/node_modules/@maka/runtime-host/dist/assistant/bot/host.js +11 -2
- package/node_modules/@maka/runtime-host/dist/assistant/bot/store.js +71 -2
- package/node_modules/@maka/runtime-host/dist/assistant/bot/turn-ids.js +38 -0
- package/node_modules/@maka/runtime-host/dist/assistant/index-initiative/assistant.js +7 -0
- package/node_modules/@maka/runtime-host/dist/assistant/index-initiative/controller.js +193 -32
- package/node_modules/@maka/runtime-host/dist/assistant/index-initiative/discovery-capabilities.js +69 -0
- package/node_modules/@maka/runtime-host/dist/assistant/index-initiative/host.js +15 -28
- package/node_modules/@maka/runtime-host/dist/assistant/index-initiative/notebook.js +286 -0
- package/node_modules/@maka/runtime-host/dist/assistant/index-initiative/prompt.js +31 -6
- package/node_modules/@maka/runtime-host/dist/assistant/index-initiative/store.js +18 -1
- package/node_modules/@maka/runtime-host/dist/assistant/memory-network/controller.js +1 -1
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/condition-observer.js +94 -0
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/condition-store.js +253 -0
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/condition.js +133 -0
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/controller.js +27 -14
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/delegation.js +35 -5
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/delivery.js +1 -1
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/host.js +16 -2
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/matter.js +13 -0
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/prompt.js +7 -5
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/review.js +1 -1
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/settlement-context.js +126 -0
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/store.js +92 -6
- package/node_modules/@maka/runtime-host/dist/assistant/proactive-matters/tools.js +87 -23
- package/node_modules/@maka/runtime-host/dist/assistant/service.js +49 -5
- package/node_modules/@maka/runtime-host/dist/protocol/goal.js +119 -1
- package/node_modules/@maka/runtime-host/dist/protocol/index.js +7 -1
- package/node_modules/@maka/runtime-host/dist/protocol/operations.js +8 -1
- package/node_modules/@maka/runtime-host/dist/protocol/personal-assistant.js +1 -0
- package/node_modules/@maka/runtime-host/dist/protocol/plugin-platform.js +7 -1
- package/node_modules/@maka/runtime-host/dist/protocol/session-checkin.js +133 -0
- package/node_modules/@maka/runtime-host/dist/server/canonical-session-projection.js +3 -2
- package/node_modules/@maka/runtime-host/dist/server/event-wait-manager.js +63 -12
- package/node_modules/@maka/runtime-host/dist/server/event-wait-observation-store.js +19 -0
- package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +123 -11
- package/node_modules/@maka/runtime-host/dist/server/execution-model-authority.js +47 -3
- package/node_modules/@maka/runtime-host/dist/server/goal-coordinator.js +126 -4
- package/node_modules/@maka/runtime-host/dist/server/goal-event-waits.js +58 -19
- package/node_modules/@maka/runtime-host/dist/server/goal-projection.js +24 -3
- package/node_modules/@maka/runtime-host/dist/server/index.js +2 -0
- package/node_modules/@maka/runtime-host/dist/server/interactive-run-composer.js +44 -2
- package/node_modules/@maka/runtime-host/dist/server/personal-assistant-workspace.js +78 -0
- package/node_modules/@maka/runtime-host/dist/server/session-catalog-coordinator.js +73 -3
- package/node_modules/@maka/runtime-host/dist/server/session-checkin.js +257 -0
- package/node_modules/@maka/runtime-host/dist/server/session-checkpoint-coordinator.js +282 -0
- package/node_modules/@maka/runtime-host/dist/server/session-checkpoint-publication.js +250 -0
- package/node_modules/@maka/runtime-host/dist/server/shell-run-event-wait-access.js +166 -0
- package/node_modules/@maka/runtime-host/dist/server/shell-run-event-wait-adapter.js +59 -0
- package/node_modules/@maka/runtime-host/dist/server/skill-catalog-repository.js +4 -2
- package/node_modules/@maka/storage/dist/context-offload-snapshot.js +2 -1
- package/node_modules/@maka/storage/dist/execution-stores.js +36 -1
- package/node_modules/@maka/storage/dist/local-execution-persistence.js +26 -0
- package/node_modules/@maka/storage/dist/production-session-snapshot.js +14 -6
- package/node_modules/@maka/storage/dist/runtime-event-persistence.js +1 -0
- package/node_modules/@maka/storage/dist/session-bundle-policy.js +86 -16
- package/node_modules/@maka/storage/dist/session-checkpoint-publication-store.js +204 -0
- package/node_modules/@maka/storage/dist/snapshot-operation-gate.js +65 -0
- package/node_modules/@maka/storage/dist/sqlite-context-offload-schema.js +3 -3
- package/node_modules/@maka/storage/dist/sqlite-context-offload-store.js +4 -2
- package/node_modules/@maka/storage/dist/sqlite-reclamation-checkpoint.js +37 -0
- package/node_modules/@maka/storage/dist/sqlite-runtime-store.js +31 -0
- package/node_modules/@maka/storage/package.json +3 -0
- package/node_modules/@modelcontextprotocol/client/dist/index-B-4n9P0J.d.mts.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/index-J2FaQ-KY.d.cts.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/index.cjs +76 -22
- package/node_modules/@modelcontextprotocol/client/dist/index.d.cts.map +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/index.d.mts.map +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/index.mjs +76 -22
- package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.cjs +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.mjs +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/{src-oZBjf3U1.cjs → src-DpAS0jfg.cjs} +105 -8
- package/node_modules/@modelcontextprotocol/client/dist/{src-xKF0PJN-.mjs → src-WCy6ifGf.mjs} +88 -9
- package/node_modules/@modelcontextprotocol/client/dist/stdio.cjs +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/stdio.mjs +1 -1
- package/node_modules/@modelcontextprotocol/client/node_modules/@modelcontextprotocol/core/package.json +2 -2
- package/node_modules/@modelcontextprotocol/client/package.json +5 -5
- package/node_modules/fast-uri/.github/workflows/release.yml +35 -0
- package/node_modules/fast-uri/README.md +8 -0
- package/node_modules/fast-uri/index.js +98 -18
- package/node_modules/fast-uri/lib/utils.js +52 -0
- package/node_modules/fast-uri/package.json +1 -1
- package/node_modules/follow-redirects/index.js +10 -1
- package/node_modules/follow-redirects/package.json +1 -1
- package/node_modules/ip-address/README.md +104 -104
- package/node_modules/ip-address/dist/ipv4.js +7 -0
- package/node_modules/ip-address/dist/ipv6.js +7 -4
- package/node_modules/ip-address/dist/v6/constants.js +3 -0
- package/node_modules/ip-address/package.json +2 -1
- package/node_modules/undici/README.md +25 -3
- package/node_modules/undici/docs/docs/api/CacheStore.md +24 -9
- package/node_modules/undici/docs/docs/api/Client.md +11 -6
- package/node_modules/undici/docs/docs/api/Dispatcher.md +3 -0
- package/node_modules/undici/docs/docs/api/Errors.md +76 -1
- package/node_modules/undici/docs/docs/api/H2CClient.md +3 -2
- package/node_modules/undici/docs/docs/api/Interceptors.md +28 -8
- package/node_modules/undici/docs/docs/api/RedirectHandler.md +13 -10
- package/node_modules/undici/docs/docs/index.md +12 -12
- package/node_modules/undici/docs/docs/type-map.json +66 -66
- package/node_modules/undici/lib/cache/memory-cache-store.js +48 -13
- package/node_modules/undici/lib/cache/sqlite-cache-store.js +83 -5
- package/node_modules/undici/lib/core/connect.js +10 -4
- package/node_modules/undici/lib/core/constants.js +12 -1
- package/node_modules/undici/lib/core/errors.js +38 -1
- package/node_modules/undici/lib/core/request.js +16 -1
- package/node_modules/undici/lib/core/symbols.js +2 -0
- package/node_modules/undici/lib/core/util.js +26 -1
- package/node_modules/undici/lib/dispatcher/agent.js +6 -2
- package/node_modules/undici/lib/dispatcher/client-h1.js +116 -80
- package/node_modules/undici/lib/dispatcher/client-h2.js +124 -17
- package/node_modules/undici/lib/dispatcher/client.js +4 -1
- package/node_modules/undici/lib/dispatcher/dispatcher-base.js +3 -2
- package/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +20 -3
- package/node_modules/undici/lib/dispatcher/parser-h1.js +1064 -0
- package/node_modules/undici/lib/dispatcher/pool-base.js +85 -31
- package/node_modules/undici/lib/dispatcher/pool.js +11 -8
- package/node_modules/undici/lib/dispatcher/proxy-agent.js +18 -8
- package/node_modules/undici/lib/dispatcher/retry-agent.js +10 -0
- package/node_modules/undici/lib/dispatcher/round-robin-pool.js +15 -5
- package/node_modules/undici/lib/handler/cache-handler.js +153 -15
- package/node_modules/undici/lib/handler/deduplication-handler.js +112 -51
- package/node_modules/undici/lib/handler/redirect-handler.js +28 -8
- package/node_modules/undici/lib/handler/retry-handler.js +44 -11
- package/node_modules/undici/lib/interceptor/cache.js +11 -3
- package/node_modules/undici/lib/interceptor/decompress.js +22 -9
- package/node_modules/undici/lib/interceptor/dns.js +11 -0
- package/node_modules/undici/lib/interceptor/response-error.js +72 -28
- package/node_modules/undici/lib/milo/LICENSE.md +7 -0
- package/node_modules/undici/lib/milo/no-simd.js +1002 -0
- package/node_modules/undici/lib/milo/simd.js +1002 -0
- package/node_modules/undici/lib/mock/mock-agent.js +11 -0
- package/node_modules/undici/lib/mock/snapshot-recorder.js +3 -2
- package/node_modules/undici/lib/mock/snapshot-utils.js +3 -2
- package/node_modules/undici/lib/util/cache.js +11 -5
- package/node_modules/undici/lib/web/cookies/util.js +19 -2
- package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +69 -15
- package/node_modules/undici/lib/web/eventsource/eventsource.js +25 -2
- package/node_modules/undici/lib/web/fetch/body.js +47 -38
- package/node_modules/undici/lib/web/fetch/formdata-parser.js +12 -4
- package/node_modules/undici/lib/web/fetch/headers.js +2 -2
- package/node_modules/undici/lib/web/fetch/index.js +8 -4
- package/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +5 -5
- package/node_modules/undici/lib/web/websocket/receiver.js +25 -4
- package/node_modules/undici/package.json +9 -7
- package/node_modules/zod/package.json +1 -1
- package/node_modules/zod/v4/core/compile.cjs +8 -0
- package/node_modules/zod/v4/core/compile.js +8 -0
- package/node_modules/zod/v4/core/schemas.cjs +30 -0
- package/node_modules/zod/v4/core/schemas.js +30 -0
- package/node_modules/zod/v4/core/util.cjs +15 -0
- package/node_modules/zod/v4/core/util.js +14 -0
- package/node_modules/zod/v4/core/versions.cjs +1 -1
- package/node_modules/zod/v4/core/versions.js +1 -1
- package/package.json +2 -2
- package/node_modules/@modelcontextprotocol/client/dist/index-D_CiY-T3.d.cts.map +0 -1
- package/node_modules/@modelcontextprotocol/client/dist/index-D_QDtbiv.d.mts.map +0 -1
package/dist/run-command-core.js
CHANGED
|
@@ -23,7 +23,7 @@ import { resolve } from 'node:path';
|
|
|
23
23
|
import { isThinkingLevel } from '@maka/core/model-thinking';
|
|
24
24
|
import { normalizeUserSessionName } from '@maka/core/session-name';
|
|
25
25
|
import { selectMakaRunSession } from './run-session-selection.js';
|
|
26
|
-
import {
|
|
26
|
+
import { RuntimeHostOperationError } from '@maka/runtime-host/client';
|
|
27
27
|
import { resolveMakaWorkspaceRoot } from './workspace-root.js';
|
|
28
28
|
const VALUE_FLAGS = new Set([
|
|
29
29
|
'session',
|
|
@@ -38,7 +38,6 @@ const VALUE_FLAGS = new Set([
|
|
|
38
38
|
'host',
|
|
39
39
|
'project',
|
|
40
40
|
]);
|
|
41
|
-
const REPEATABLE_VALUE_FLAGS = new Set();
|
|
42
41
|
const BOOLEAN_FLAGS = new Set([
|
|
43
42
|
'continue',
|
|
44
43
|
'yolo',
|
|
@@ -48,6 +47,7 @@ const BOOLEAN_FLAGS = new Set([
|
|
|
48
47
|
'json',
|
|
49
48
|
'status',
|
|
50
49
|
'result',
|
|
50
|
+
'recap',
|
|
51
51
|
'queue',
|
|
52
52
|
'steer',
|
|
53
53
|
'stop',
|
|
@@ -72,20 +72,17 @@ export function parseMakaRunArgs(argv) {
|
|
|
72
72
|
if (!literal && arg.startsWith('--')) {
|
|
73
73
|
const name = arg.slice(2);
|
|
74
74
|
if (BOOLEAN_FLAGS.has(name) || (name === 'resume' && selectsSession)) {
|
|
75
|
-
if (booleanFlags.has(name))
|
|
76
|
-
return { kind: 'error', message: `option repeated: ${arg}` };
|
|
77
75
|
booleanFlags.add(name);
|
|
78
76
|
continue;
|
|
79
77
|
}
|
|
80
78
|
if (!VALUE_FLAGS.has(name))
|
|
81
79
|
return { kind: 'error', message: `unknown option: ${arg}` };
|
|
82
|
-
if (!REPEATABLE_VALUE_FLAGS.has(name) && flags.has(name)) {
|
|
83
|
-
return { kind: 'error', message: `option repeated: ${arg}` };
|
|
84
|
-
}
|
|
85
80
|
const value = argv[index + 1];
|
|
86
81
|
if (value === undefined || value.startsWith('--')) {
|
|
87
82
|
return { kind: 'error', message: `option ${arg} needs a value` };
|
|
88
83
|
}
|
|
84
|
+
if (flags.has(name) && flags.get(name) !== value)
|
|
85
|
+
return { kind: 'error', message: `conflicting values for ${arg}` };
|
|
89
86
|
flags.set(name, value);
|
|
90
87
|
index += 1;
|
|
91
88
|
continue;
|
|
@@ -108,8 +105,9 @@ export function parseMakaRunArgs(argv) {
|
|
|
108
105
|
if (booleanFlags.has('queue') && booleanFlags.has('steer')) {
|
|
109
106
|
return { kind: 'error', message: '--queue and --steer cannot be used together' };
|
|
110
107
|
}
|
|
111
|
-
const actions = Number(booleanFlags.has('status')) +
|
|
108
|
+
const actions = Number(booleanFlags.has('status') && !booleanFlags.has('recap')) +
|
|
112
109
|
Number(booleanFlags.has('result')) +
|
|
110
|
+
Number(booleanFlags.has('recap')) +
|
|
113
111
|
Number(flags.has('answer')) +
|
|
114
112
|
Number(resumeExecution) +
|
|
115
113
|
Number(booleanFlags.has('stop')) +
|
|
@@ -118,7 +116,7 @@ export function parseMakaRunArgs(argv) {
|
|
|
118
116
|
if (actions > 1)
|
|
119
117
|
return {
|
|
120
118
|
kind: 'error',
|
|
121
|
-
message: 'choose one
|
|
119
|
+
message: 'choose one Session action, or combine --status with --recap',
|
|
122
120
|
};
|
|
123
121
|
if ((booleanFlags.has('approve') || booleanFlags.has('deny')) && booleanFlags.has('yolo'))
|
|
124
122
|
return {
|
|
@@ -134,14 +132,34 @@ export function parseMakaRunArgs(argv) {
|
|
|
134
132
|
message: '--session cannot be combined with --continue or --project',
|
|
135
133
|
};
|
|
136
134
|
}
|
|
135
|
+
if (sessionId) {
|
|
136
|
+
const override = ['cwd', 'timeout', 'graph'].find((name) => flags.has(name) || booleanFlags.has(name));
|
|
137
|
+
if (override)
|
|
138
|
+
return {
|
|
139
|
+
kind: 'error',
|
|
140
|
+
message: `--${override} cannot be used with --session; use saved settings or legacy --resume <id> for run configuration`,
|
|
141
|
+
};
|
|
142
|
+
if (flags.has('max-steps') &&
|
|
143
|
+
(!positional.length || actions || booleanFlags.has('queue') || booleanFlags.has('steer')))
|
|
144
|
+
return {
|
|
145
|
+
kind: 'error',
|
|
146
|
+
message: '--max-steps requires a Session prompt without --queue/--steer',
|
|
147
|
+
};
|
|
148
|
+
}
|
|
137
149
|
if (actions && positional.length)
|
|
138
150
|
return { kind: 'error', message: 'session actions do not accept a prompt' };
|
|
139
151
|
if ((booleanFlags.has('queue') || booleanFlags.has('steer')) && (!positional.length || actions)) {
|
|
140
152
|
return { kind: 'error', message: '--queue and --steer require a prompt' };
|
|
141
153
|
}
|
|
142
|
-
if ((booleanFlags.has('status') ||
|
|
154
|
+
if ((booleanFlags.has('status') ||
|
|
155
|
+
booleanFlags.has('result') ||
|
|
156
|
+
booleanFlags.has('recap') ||
|
|
157
|
+
booleanFlags.has('stop')) &&
|
|
143
158
|
(booleanFlags.has('wait') || booleanFlags.has('no-wait'))) {
|
|
144
|
-
return {
|
|
159
|
+
return {
|
|
160
|
+
kind: 'error',
|
|
161
|
+
message: '--status, --result, --recap and --stop do not accept wait options',
|
|
162
|
+
};
|
|
145
163
|
}
|
|
146
164
|
if (booleanFlags.has('graph') && booleanFlags.has('no-wait')) {
|
|
147
165
|
return { kind: 'error', message: '--graph must wait for its final result' };
|
|
@@ -202,6 +220,7 @@ export function parseMakaRunArgs(argv) {
|
|
|
202
220
|
...(booleanFlags.has('json') ? { json: true } : {}),
|
|
203
221
|
...(booleanFlags.has('status') ? { status: true } : {}),
|
|
204
222
|
...(booleanFlags.has('result') ? { result: true } : {}),
|
|
223
|
+
...(booleanFlags.has('recap') ? { recap: true } : {}),
|
|
205
224
|
...(resumeExecution ? { resumeExecution: true } : {}),
|
|
206
225
|
...(booleanFlags.has('stop') ? { stop: true } : {}),
|
|
207
226
|
...(booleanFlags.has('approve')
|
|
@@ -240,7 +259,10 @@ export async function runMakaTextCliCore(argv, adapter, overrides = {}) {
|
|
|
240
259
|
return 0;
|
|
241
260
|
}
|
|
242
261
|
if (parsed.kind === 'error') {
|
|
243
|
-
|
|
262
|
+
const optionArgs = argv.includes('--') ? argv.slice(0, argv.indexOf('--')) : argv;
|
|
263
|
+
writeRunError(parsed.message, deps, optionArgs.includes('--json'));
|
|
264
|
+
if (!optionArgs.includes('--json'))
|
|
265
|
+
deps.writeStderr(`Run \`${deps.cliCommand()} run --help\` for usage.\n`);
|
|
244
266
|
return 2;
|
|
245
267
|
}
|
|
246
268
|
if (parsed.options.sessionId) {
|
|
@@ -252,7 +274,7 @@ export async function runMakaTextCliCore(argv, adapter, overrides = {}) {
|
|
|
252
274
|
if (options.prompt !== undefined || options.stdinPrompt)
|
|
253
275
|
options.prompt = await resolveRunPrompt(options, deps);
|
|
254
276
|
const result = await deps.runSession(options, deps);
|
|
255
|
-
writeSessionResult(result, deps, options.json === true);
|
|
277
|
+
writeSessionResult(result, deps, options.json === true || options.status === true);
|
|
256
278
|
const returnsTaskOutcome = options.prompt !== undefined ||
|
|
257
279
|
options.answers !== undefined ||
|
|
258
280
|
options.resumeExecution ||
|
|
@@ -262,7 +284,7 @@ export async function runMakaTextCliCore(argv, adapter, overrides = {}) {
|
|
|
262
284
|
return result.status === 'failed' && returnsTaskOutcome ? 1 : 0;
|
|
263
285
|
}
|
|
264
286
|
catch (error) {
|
|
265
|
-
deps.
|
|
287
|
+
writeRunError(error, deps, parsed.options.json === true, parsed.options.sessionId);
|
|
266
288
|
return error instanceof RunSessionInterrupted ? 130 : 1;
|
|
267
289
|
}
|
|
268
290
|
}
|
|
@@ -294,11 +316,11 @@ export async function runMakaTextCliCore(argv, adapter, overrides = {}) {
|
|
|
294
316
|
});
|
|
295
317
|
}
|
|
296
318
|
catch (error) {
|
|
297
|
-
deps.
|
|
319
|
+
writeRunError(error, deps, parsed.options.json === true, parsed.options.sessionId);
|
|
298
320
|
return 2;
|
|
299
321
|
}
|
|
300
322
|
let outcome;
|
|
301
|
-
let
|
|
323
|
+
let unavailableSandboxRequest = false;
|
|
302
324
|
let context;
|
|
303
325
|
try {
|
|
304
326
|
context = await deps.createContext({
|
|
@@ -327,14 +349,12 @@ export async function runMakaTextCliCore(argv, adapter, overrides = {}) {
|
|
|
327
349
|
...(parsed.options.hostProfileId ? { hostProfileId: parsed.options.hostProfileId } : {}),
|
|
328
350
|
...(parsed.options.projectId ? { projectId: parsed.options.projectId } : {}),
|
|
329
351
|
runOutcomeObserver: (result) => {
|
|
330
|
-
if (result.sandboxBoundary === 'unresolved')
|
|
331
|
-
boundaryFailure = true;
|
|
332
352
|
outcome = result;
|
|
333
353
|
},
|
|
334
354
|
});
|
|
335
355
|
}
|
|
336
356
|
catch (error) {
|
|
337
|
-
deps.
|
|
357
|
+
writeRunError(error, deps, parsed.options.json === true, parsed.options.sessionId);
|
|
338
358
|
return 2;
|
|
339
359
|
}
|
|
340
360
|
let session;
|
|
@@ -370,7 +390,7 @@ export async function runMakaTextCliCore(argv, adapter, overrides = {}) {
|
|
|
370
390
|
}
|
|
371
391
|
catch (error) {
|
|
372
392
|
await context.close();
|
|
373
|
-
deps.
|
|
393
|
+
writeRunError(error, deps, parsed.options.json === true, parsed.options.sessionId);
|
|
374
394
|
return 2;
|
|
375
395
|
}
|
|
376
396
|
let interrupted = false;
|
|
@@ -416,20 +436,12 @@ export async function runMakaTextCliCore(argv, adapter, overrides = {}) {
|
|
|
416
436
|
: {}),
|
|
417
437
|
})) {
|
|
418
438
|
if (event.type === 'sandbox_boundary_request') {
|
|
419
|
-
|
|
420
|
-
deps.writeStderr('maka run: sandbox boundary expansion is unavailable in non-interactive mode\n');
|
|
439
|
+
unavailableSandboxRequest = true;
|
|
421
440
|
await context.runtime.respondToSandboxBoundary(session.id, {
|
|
422
441
|
requestId: event.requestId,
|
|
423
442
|
decision: 'deny',
|
|
424
443
|
});
|
|
425
444
|
}
|
|
426
|
-
const sandboxFailureReason = sessionEventSandboxBoundaryFailureReason(event);
|
|
427
|
-
if (sandboxFailureReason) {
|
|
428
|
-
boundaryFailure = true;
|
|
429
|
-
deps.writeStderr(sandboxFailureReason === 'requires_bypass'
|
|
430
|
-
? 'maka run: sandbox bypass requires an explicit --yolo\n'
|
|
431
|
-
: 'maka run: sandbox boundary expansion is unavailable in non-interactive mode\n');
|
|
432
|
-
}
|
|
433
445
|
}
|
|
434
446
|
graphActivity?.release();
|
|
435
447
|
if (parsed.options.graph && outcome?.status === 'completed') {
|
|
@@ -443,7 +455,7 @@ export async function runMakaTextCliCore(argv, adapter, overrides = {}) {
|
|
|
443
455
|
graphActivity?.release();
|
|
444
456
|
await stopPromise?.catch(() => undefined);
|
|
445
457
|
if (!interrupted && !timedOut && !question) {
|
|
446
|
-
deps.
|
|
458
|
+
writeRunError(error, deps, parsed.options.json === true, session.id);
|
|
447
459
|
}
|
|
448
460
|
}
|
|
449
461
|
finally {
|
|
@@ -455,7 +467,7 @@ export async function runMakaTextCliCore(argv, adapter, overrides = {}) {
|
|
|
455
467
|
if (interrupted)
|
|
456
468
|
return 130;
|
|
457
469
|
if (timedOut) {
|
|
458
|
-
|
|
470
|
+
writeRunError(`timed out after ${parsed.options.timeoutMs}ms`, deps, parsed.options.json === true, session.id);
|
|
459
471
|
return 1;
|
|
460
472
|
}
|
|
461
473
|
if (question) {
|
|
@@ -464,10 +476,12 @@ export async function runMakaTextCliCore(argv, adapter, overrides = {}) {
|
|
|
464
476
|
}
|
|
465
477
|
if (streamFailed)
|
|
466
478
|
return 1;
|
|
467
|
-
if (
|
|
479
|
+
if (unavailableSandboxRequest) {
|
|
480
|
+
writeRunError('sandbox boundary expansion is unavailable in non-interactive mode', deps, parsed.options.json === true, session.id);
|
|
468
481
|
return 1;
|
|
482
|
+
}
|
|
469
483
|
if (!outcome) {
|
|
470
|
-
|
|
484
|
+
writeRunError('runtime produced no outcome', deps, parsed.options.json === true, session.id);
|
|
471
485
|
return 1;
|
|
472
486
|
}
|
|
473
487
|
if (outcome.status === 'running') {
|
|
@@ -487,12 +501,24 @@ export async function runMakaTextCliCore(argv, adapter, overrides = {}) {
|
|
|
487
501
|
return 0;
|
|
488
502
|
}
|
|
489
503
|
export function writeSessionResult(result, deps, json) {
|
|
490
|
-
if (
|
|
491
|
-
deps.writeStdout(`${JSON.stringify(result)}\n`);
|
|
492
|
-
else
|
|
493
|
-
deps.writeStdout(withTrailingNewline(result.finalOutput));
|
|
494
|
-
if (result.status === 'failed' && result.error)
|
|
504
|
+
if (result.error && result.recap === undefined && !json) {
|
|
495
505
|
deps.writeStderr(`maka run: ${result.error}\n`);
|
|
506
|
+
return;
|
|
507
|
+
}
|
|
508
|
+
const text = result.recap ?? (result.status === 'completed' ? result.finalOutput : undefined);
|
|
509
|
+
deps.writeStdout(json || text === undefined ? `${JSON.stringify(result)}\n` : withTrailingNewline(text));
|
|
510
|
+
}
|
|
511
|
+
function writeRunError(error, deps, json, sessionId) {
|
|
512
|
+
const message = errorMessage(error);
|
|
513
|
+
if (json) {
|
|
514
|
+
deps.writeStdout(`${JSON.stringify({
|
|
515
|
+
...(sessionId ? { sessionId } : {}),
|
|
516
|
+
error: message,
|
|
517
|
+
...(error instanceof RuntimeHostOperationError ? { code: error.code } : {}),
|
|
518
|
+
})}\n`);
|
|
519
|
+
}
|
|
520
|
+
else
|
|
521
|
+
deps.writeStderr(`maka run: ${message}\n`);
|
|
496
522
|
}
|
|
497
523
|
async function resolveRunPrompt(options, deps) {
|
|
498
524
|
const shouldReadStdin = options.stdinPrompt || !deps.stdinIsTTY();
|
|
@@ -515,44 +541,59 @@ async function canonicalDirectory(input) {
|
|
|
515
541
|
function makaRunHelpText(cliCommand) {
|
|
516
542
|
return [
|
|
517
543
|
`Usage: ${cliCommand} run [PROMPT] [options]`,
|
|
518
|
-
` ${cliCommand}
|
|
544
|
+
` ${cliCommand} run --session <id> [PROMPT | ACTION] [options]`,
|
|
519
545
|
'',
|
|
520
|
-
'
|
|
521
|
-
|
|
522
|
-
|
|
546
|
+
'Ordinary runs wait and print the final answer. For parent-agent coordination:',
|
|
547
|
+
` ${cliCommand} run "Inspect this project" --no-wait`,
|
|
548
|
+
` ${cliCommand} run --session <id> --wait --json`,
|
|
523
549
|
'',
|
|
524
|
-
'
|
|
525
|
-
' --
|
|
526
|
-
' --
|
|
527
|
-
' --
|
|
528
|
-
' --
|
|
529
|
-
'
|
|
530
|
-
'
|
|
531
|
-
'
|
|
532
|
-
' --
|
|
533
|
-
' --
|
|
534
|
-
' --session <session-id> Select a Session (without a prompt: show its status)',
|
|
535
|
-
' --wait Wait for this message/current Turn; return input/approval early',
|
|
536
|
-
' --no-wait Submit and return (Host-owned execution only)',
|
|
537
|
-
' --status Read current Session status without executing',
|
|
550
|
+
'Execution and output:',
|
|
551
|
+
' --no-wait Submit and return a JSON receipt (persistent Host required)',
|
|
552
|
+
' --wait Wait for this message/current Turn (default for prompts)',
|
|
553
|
+
' --json Return JSON, including final answers and recaps',
|
|
554
|
+
' --host <profile-id> Use the same saved Host profile for every Session call',
|
|
555
|
+
'',
|
|
556
|
+
'Session actions (--session <id>; model settings below persist before the action):',
|
|
557
|
+
' [no action] Show status, or save supplied model settings without running',
|
|
558
|
+
' --status Read status, pending questions/approvals, and execution boundary',
|
|
559
|
+
' --recap Summarize recorded progress with a separate model call',
|
|
538
560
|
' --result Read the latest Turn result without waiting',
|
|
539
|
-
' --stop Request stop for the current Turn (no --yolo needed)',
|
|
540
561
|
' --answer <json-array> Answer the current AskUser, e.g. ["Yes",null]',
|
|
541
|
-
' --approve
|
|
542
|
-
'
|
|
543
|
-
' --
|
|
544
|
-
' --
|
|
545
|
-
'
|
|
546
|
-
'
|
|
547
|
-
' --
|
|
548
|
-
' --
|
|
549
|
-
' --
|
|
562
|
+
' --approve / --deny Decide the single pending sandbox expansion',
|
|
563
|
+
' PROMPT Queue a new Turn; --steer targets ongoing execution',
|
|
564
|
+
' --resume Safely continue stopped execution',
|
|
565
|
+
' --stop Request stop for the current Turn',
|
|
566
|
+
'',
|
|
567
|
+
'Model settings (creation or persistent Session updates):',
|
|
568
|
+
' --connection <slug> Select a model connection; otherwise keep the saved account',
|
|
569
|
+
' --model <id> Select a model; otherwise keep the saved model',
|
|
570
|
+
' --thinking <level> off|on|minimal|low|medium|high|xhigh|max|default',
|
|
571
|
+
'',
|
|
572
|
+
'Run settings (creation or legacy --resume <id>):',
|
|
573
|
+
' --cwd <path> Working directory (default: current directory)',
|
|
574
|
+
' --timeout <seconds> Invocation timeout',
|
|
575
|
+
' --max-steps <count> Tool-step cap; also supported for an idle Session prompt',
|
|
576
|
+
' --project <project-id> Select an existing Project on a remote Host',
|
|
577
|
+
' --graph Run in Graph Mode and wait for graph completion',
|
|
578
|
+
' --yolo Explicitly grant full access, including on Session execution',
|
|
579
|
+
'',
|
|
580
|
+
'Input and compatibility:',
|
|
581
|
+
' - Read the prompt from stdin; piped stdin otherwise adds context',
|
|
582
|
+
' --queue Explicit spelling of the default Session prompt placement',
|
|
583
|
+
' --steer Deliver this prompt to ongoing execution',
|
|
584
|
+
' --resume <session-id> Legacy blocking selector; permits run-setting overrides',
|
|
585
|
+
' --continue Legacy selector for the latest compatible task in cwd',
|
|
586
|
+
` ${cliCommand} -p [PROMPT] Alias for run`,
|
|
550
587
|
' -h, --help Show help',
|
|
551
588
|
'',
|
|
552
|
-
'
|
|
553
|
-
'
|
|
554
|
-
'
|
|
555
|
-
'--
|
|
589
|
+
'Receipts, status, and pending interactions are JSON without an extra --json.',
|
|
590
|
+
'Check status, not just exit 0: needs_input/needs_approval require a caller decision.',
|
|
591
|
+
'finalOutput is a task result; recap is progress; submission is admission; configuration is saved settings.',
|
|
592
|
+
'Combine --status --recap for a JSON snapshot with both state and progress.',
|
|
593
|
+
'--status/--result/--recap/--stop do not accept wait flags. Recap consumes model usage.',
|
|
594
|
+
'Errors are brief text on stderr by default; --json returns structured errors on stdout.',
|
|
595
|
+
'Session controls inherit bypass access too; a read-only prompt does not restrict it.',
|
|
596
|
+
'Legacy --resume <id> requires --yolo for bypass. --approve/--deny do not switch to bypass.',
|
|
556
597
|
].join('\n');
|
|
557
598
|
}
|
|
558
599
|
function defaultMakaRunEnvironmentDeps() {
|
|
@@ -17,26 +17,30 @@
|
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
19
|
import { isInteractionAnswerValidForRequest } from '@maka/core/interaction';
|
|
20
|
+
import { abortable, readRuntimeHostConnectionCatalog, } from '@maka/runtime-host/client';
|
|
20
21
|
import { updateRuntimeHostSession } from './runtime-host-session-update.js';
|
|
21
22
|
import { RuntimeHostSessionChannel } from './runtime-host-session-channel.js';
|
|
22
23
|
import { RunSessionInterrupted } from './run-session-result.js';
|
|
23
24
|
import { TurnOutcomeClassifier, acceptStoredTurn } from './run-turn-outcome.js';
|
|
25
|
+
/** Session controls that must verify ownership before mutating a Host-owned Turn. */
|
|
26
|
+
export function sessionControlRequiresExecutionBoundary(options) {
|
|
27
|
+
return (options.prompt !== undefined ||
|
|
28
|
+
options.answers !== undefined ||
|
|
29
|
+
options.resumeExecution === true ||
|
|
30
|
+
options.sandboxDecision !== undefined ||
|
|
31
|
+
options.stop === true);
|
|
32
|
+
}
|
|
24
33
|
/** Session commands observe Host-owned execution; they never publish client MCP. */
|
|
25
34
|
export async function runMakaSessionCommand(connection, options, env, allowDetach = true) {
|
|
26
35
|
const sessionId = options.sessionId;
|
|
27
36
|
const executing = options.prompt !== undefined || options.answers !== undefined || options.resumeExecution;
|
|
28
37
|
const decidingSandbox = options.sandboxDecision !== undefined;
|
|
38
|
+
const controllingTurn = sessionControlRequiresExecutionBoundary(options);
|
|
29
39
|
if ((executing || decidingSandbox) && !allowDetach)
|
|
30
40
|
throw new Error('Session control execution requires a persistent installation; use the blocking legacy run path for temporary npx invocations');
|
|
31
41
|
// Never silently discard options that the old turn.start path supports.
|
|
32
|
-
if (options.graph ||
|
|
33
|
-
|
|
34
|
-
options.model ||
|
|
35
|
-
options.thinking !== undefined ||
|
|
36
|
-
options.cwd ||
|
|
37
|
-
options.projectId ||
|
|
38
|
-
options.timeoutMs) {
|
|
39
|
-
throw new Error('Session commands use the saved configuration; use the blocking legacy --resume <id> path for configuration, cwd, timeout or Graph options');
|
|
42
|
+
if (options.graph || options.cwd || options.projectId || options.timeoutMs) {
|
|
43
|
+
throw new Error('Session workspace, timeout and Graph overrides require the blocking legacy --resume <id> path');
|
|
40
44
|
}
|
|
41
45
|
if (options.maxSteps !== undefined &&
|
|
42
46
|
(options.prompt === undefined || options.placement !== undefined)) {
|
|
@@ -54,13 +58,45 @@ export async function runMakaSessionCommand(connection, options, env, allowDetac
|
|
|
54
58
|
};
|
|
55
59
|
try {
|
|
56
60
|
assertActive();
|
|
61
|
+
const configured = options.model !== undefined ||
|
|
62
|
+
options.connection !== undefined ||
|
|
63
|
+
options.thinking !== undefined
|
|
64
|
+
? await configureSessionModel(connection, options, assertActive)
|
|
65
|
+
: undefined;
|
|
66
|
+
const configuration = configured
|
|
67
|
+
? {
|
|
68
|
+
connection: configured.llmConnectionSlug,
|
|
69
|
+
model: configured.model,
|
|
70
|
+
thinking: configured.thinkingLevel ?? null,
|
|
71
|
+
}
|
|
72
|
+
: undefined;
|
|
57
73
|
let target = observer.snapshot.rootTurn?.turnId;
|
|
74
|
+
if (options.recap) {
|
|
75
|
+
const result = await abortable(() => connection.request('session.recap.generate', {
|
|
76
|
+
sessionId,
|
|
77
|
+
effectId: env.newId(),
|
|
78
|
+
reason: 'manual',
|
|
79
|
+
}), cancelled.signal);
|
|
80
|
+
assertActive();
|
|
81
|
+
if (result.kind === 'failed')
|
|
82
|
+
throw new Error(`Session recap failed: ${result.errorClass}`);
|
|
83
|
+
const executionBoundary = options.status
|
|
84
|
+
? await connection.request('session.execution_boundary.query', { sessionId })
|
|
85
|
+
: undefined;
|
|
86
|
+
assertActive();
|
|
87
|
+
return {
|
|
88
|
+
...observer.status(),
|
|
89
|
+
recap: result.text,
|
|
90
|
+
...(configuration ? { configuration } : {}),
|
|
91
|
+
...(executionBoundary ? { executionBoundary } : {}),
|
|
92
|
+
};
|
|
93
|
+
}
|
|
58
94
|
let messageId;
|
|
59
95
|
let submission;
|
|
60
96
|
let admittedQueueRevision;
|
|
61
97
|
let admittedQueueEpoch;
|
|
62
98
|
let fullAccess = false;
|
|
63
|
-
if (
|
|
99
|
+
if (controllingTurn) {
|
|
64
100
|
const boundary = await connection.request('session.execution_boundary.query', { sessionId });
|
|
65
101
|
assertActive();
|
|
66
102
|
if (boundary.kind === 'external')
|
|
@@ -212,7 +248,11 @@ export async function runMakaSessionCommand(connection, options, env, allowDetac
|
|
|
212
248
|
sessionId,
|
|
213
249
|
});
|
|
214
250
|
assertActive();
|
|
215
|
-
return {
|
|
251
|
+
return {
|
|
252
|
+
...observer.status(),
|
|
253
|
+
executionBoundary,
|
|
254
|
+
...(configuration ? { configuration } : {}),
|
|
255
|
+
};
|
|
216
256
|
}
|
|
217
257
|
if (options.noWait) {
|
|
218
258
|
if (submission !== 'queued' && submission !== 'steering')
|
|
@@ -281,6 +321,44 @@ export async function runMakaSessionCommand(connection, options, env, allowDetac
|
|
|
281
321
|
function terminal(status) {
|
|
282
322
|
return status === 'completed' || status === 'failed' || status === 'cancelled';
|
|
283
323
|
}
|
|
324
|
+
async function configureSessionModel(connection, options, assertActive) {
|
|
325
|
+
const selected = options.connection !== undefined
|
|
326
|
+
? (await readRuntimeHostConnectionCatalog(connection)).connections.find((candidate) => candidate.slug === options.connection)
|
|
327
|
+
: undefined;
|
|
328
|
+
if (options.connection !== undefined && !selected)
|
|
329
|
+
throw new Error(`Runtime Host model connection is unavailable: ${options.connection}`);
|
|
330
|
+
return updateRuntimeHostSession(connection, options.sessionId, (current) => {
|
|
331
|
+
const changesModel = options.model !== undefined || options.connection !== undefined;
|
|
332
|
+
let patch = options.thinking !== undefined ? { thinkingLevel: options.thinking } : {};
|
|
333
|
+
if (changesModel) {
|
|
334
|
+
if (current.executorId && !selected) {
|
|
335
|
+
patch = { ...patch, executorConfig: { model: options.model } };
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
const connectionId = selected?.connectionId ?? current.llmConnectionId;
|
|
339
|
+
if (!connectionId)
|
|
340
|
+
throw new Error('Model selection requires an explicit --connection');
|
|
341
|
+
const changesTarget = connectionId !== current.llmConnectionId ||
|
|
342
|
+
(options.model ?? current.model) !== current.model;
|
|
343
|
+
patch = {
|
|
344
|
+
...patch,
|
|
345
|
+
...(changesTarget && options.thinking === undefined ? { thinkingLevel: null } : {}),
|
|
346
|
+
modelTarget: {
|
|
347
|
+
kind: 'explicit',
|
|
348
|
+
connectionId,
|
|
349
|
+
connectionSlug: selected?.slug ?? current.llmConnectionSlug,
|
|
350
|
+
model: options.model ?? current.model,
|
|
351
|
+
},
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
return connection.request('session.configuration.update', {
|
|
356
|
+
sessionId: options.sessionId,
|
|
357
|
+
expectedRevision: current.revision,
|
|
358
|
+
patch,
|
|
359
|
+
});
|
|
360
|
+
}, { operation: 'session.configuration.update', assertRequestAllowed: assertActive });
|
|
361
|
+
}
|
|
284
362
|
class SessionRunObserver {
|
|
285
363
|
#connection;
|
|
286
364
|
#sessionId;
|
|
@@ -407,14 +485,14 @@ class SessionRunObserver {
|
|
|
407
485
|
return result.landmarks.at(-1)?.turnId;
|
|
408
486
|
}
|
|
409
487
|
async result(turnId) {
|
|
410
|
-
const classifier = new TurnOutcomeClassifier(turnId
|
|
488
|
+
const classifier = new TurnOutcomeClassifier(turnId);
|
|
411
489
|
await this.#channel.replayTranscript(async (messages) => {
|
|
412
490
|
acceptStoredTurn(classifier, messages, turnId);
|
|
413
491
|
}, this.#signal);
|
|
414
492
|
const outcome = classifier.outcome('pending');
|
|
415
493
|
if (!outcome)
|
|
416
494
|
return undefined;
|
|
417
|
-
if (outcome.status === 'completed'
|
|
495
|
+
if (outcome.status === 'completed') {
|
|
418
496
|
return {
|
|
419
497
|
sessionId: this.#sessionId,
|
|
420
498
|
status: 'completed',
|
|
@@ -424,9 +502,7 @@ class SessionRunObserver {
|
|
|
424
502
|
return {
|
|
425
503
|
sessionId: this.#sessionId,
|
|
426
504
|
status: 'failed',
|
|
427
|
-
error: outcome.
|
|
428
|
-
? 'Turn encountered an unresolved sandbox boundary'
|
|
429
|
-
: (outcome.failure?.message ?? outcome.failure?.class ?? 'Turn failed'),
|
|
505
|
+
error: outcome.failure?.message ?? outcome.failure?.class ?? 'Turn failed',
|
|
430
506
|
};
|
|
431
507
|
}
|
|
432
508
|
changed(version) {
|
package/dist/run-turn-outcome.js
CHANGED
|
@@ -16,28 +16,20 @@
|
|
|
16
16
|
* specific language governing permissions and limitations
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
|
-
import { isDeepStrictEqual } from 'node:util';
|
|
20
19
|
import { failureClassFromCompleteStopReason } from '@maka/core/events';
|
|
21
20
|
export class TurnOutcomeClassifier {
|
|
22
21
|
#outcomeId;
|
|
23
|
-
#recoverStoredRetries;
|
|
24
|
-
#calls = new Map();
|
|
25
22
|
#unresolvedSandboxFailures = new Set();
|
|
26
23
|
#finalOutput;
|
|
27
24
|
#finalOutputFromLive = false;
|
|
28
25
|
#terminal;
|
|
29
|
-
constructor(outcomeId
|
|
26
|
+
constructor(outcomeId) {
|
|
30
27
|
this.#outcomeId = outcomeId;
|
|
31
|
-
this.#recoverStoredRetries = options.recoverStoredRetries === true;
|
|
32
28
|
}
|
|
33
29
|
accept(observation) {
|
|
34
30
|
switch (observation?.kind) {
|
|
35
31
|
case undefined:
|
|
36
32
|
return;
|
|
37
|
-
case 'tool_call':
|
|
38
|
-
if (this.#recoverStoredRetries)
|
|
39
|
-
this.#calls.set(observation.call.id, observation.call);
|
|
40
|
-
return;
|
|
41
33
|
case 'output':
|
|
42
34
|
// A subscriber is delivered in Host order, so the stream's last answer
|
|
43
35
|
// is the Turn's last answer. A transcript read stops wherever the Host
|
|
@@ -57,27 +49,6 @@ export class TurnOutcomeClassifier {
|
|
|
57
49
|
if (observation.outcome === 'sandbox_failure') {
|
|
58
50
|
this.#unresolvedSandboxFailures.add(observation.toolUseId);
|
|
59
51
|
}
|
|
60
|
-
if (observation.outcome === 'success' && this.#recoverStoredRetries) {
|
|
61
|
-
const retry = this.#calls.get(observation.toolUseId);
|
|
62
|
-
for (const id of this.#unresolvedSandboxFailures) {
|
|
63
|
-
const failed = this.#calls.get(id);
|
|
64
|
-
// Full durable arguments and a different provider step distinguish
|
|
65
|
-
// a retry from an unrelated success or a same-step parallel sibling.
|
|
66
|
-
// One successful retry reconciles one failed call, never all failures.
|
|
67
|
-
if (retry?.stepId &&
|
|
68
|
-
failed?.stepId &&
|
|
69
|
-
retry.stepId !== failed.stepId &&
|
|
70
|
-
retry.toolName === failed.toolName &&
|
|
71
|
-
retry.args !== undefined &&
|
|
72
|
-
failed.args !== undefined &&
|
|
73
|
-
isDeepStrictEqual(retry.args, failed.args)) {
|
|
74
|
-
this.#unresolvedSandboxFailures.delete(id);
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
// Blocking run keeps its original denial protection. Session results
|
|
80
|
-
// opt into durable retry evidence, since their boundary can be approved.
|
|
81
52
|
return;
|
|
82
53
|
}
|
|
83
54
|
}
|
|
@@ -129,8 +100,6 @@ export function observationFromSessionEvent(event) {
|
|
|
129
100
|
return event.type === 'tool_result' ? observationFromToolResult(event) : undefined;
|
|
130
101
|
}
|
|
131
102
|
function observationFromStoredMessage(message) {
|
|
132
|
-
if (message.type === 'tool_call')
|
|
133
|
-
return { kind: 'tool_call', call: message };
|
|
134
103
|
if (message.type === 'assistant' && message.text.trim().length > 0) {
|
|
135
104
|
return { kind: 'output', text: message.text, source: 'stored' };
|
|
136
105
|
}
|
|
@@ -152,7 +121,7 @@ function observationFromStoredMessage(message) {
|
|
|
152
121
|
status: 'failed',
|
|
153
122
|
failure: {
|
|
154
123
|
class: message.errorClass ?? 'runtime_error',
|
|
155
|
-
message: message.failureMessage ?? 'Turn failed',
|
|
124
|
+
message: message.failureMessage ?? message.errorClass ?? 'Turn failed',
|
|
156
125
|
},
|
|
157
126
|
};
|
|
158
127
|
}
|
|
@@ -1005,5 +1005,7 @@ function runChannelOperation(operation, signal, discard) {
|
|
|
1005
1005
|
function sameGoalProjection(a, b) {
|
|
1006
1006
|
if (a === null || b === null)
|
|
1007
1007
|
return a === b;
|
|
1008
|
-
return a.goalId === b.goalId &&
|
|
1008
|
+
return (a.goalId === b.goalId &&
|
|
1009
|
+
a.revision === b.revision &&
|
|
1010
|
+
JSON.stringify(a.eventWait) === JSON.stringify(b.eventWait));
|
|
1009
1011
|
}
|
|
@@ -996,6 +996,11 @@ class RuntimeHostMakaSessionDriverImpl {
|
|
|
996
996
|
this.#todoChangeListeners.add(listener);
|
|
997
997
|
return () => this.#todoChangeListeners.delete(listener);
|
|
998
998
|
}
|
|
999
|
+
async cancelGoalEventWait(input) {
|
|
1000
|
+
if (input.sessionId !== this.#sessionId)
|
|
1001
|
+
throw new Error('Wait belongs to another Session');
|
|
1002
|
+
return this.#request('goal.event-wait.cancel', input);
|
|
1003
|
+
}
|
|
999
1004
|
async controlGoal(action) {
|
|
1000
1005
|
const sessionId = this.#sessionId;
|
|
1001
1006
|
if (!sessionId)
|