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
package/dist/run-command-core.js
CHANGED
|
@@ -16,15 +16,18 @@
|
|
|
16
16
|
* specific language governing permissions and limitations
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
|
+
import { RunQuestionAvailable, RunSessionInterrupted, } from './run-session-result.js';
|
|
19
20
|
import { randomUUID } from 'node:crypto';
|
|
20
21
|
import { realpath, stat } from 'node:fs/promises';
|
|
21
22
|
import { resolve } from 'node:path';
|
|
22
23
|
import { isThinkingLevel } from '@maka/core/model-thinking';
|
|
23
24
|
import { normalizeUserSessionName } from '@maka/core/session-name';
|
|
24
25
|
import { selectMakaRunSession } from './run-session-selection.js';
|
|
25
|
-
import {
|
|
26
|
+
import { RuntimeHostOperationError } from '@maka/runtime-host/client';
|
|
26
27
|
import { resolveMakaWorkspaceRoot } from './workspace-root.js';
|
|
27
28
|
const VALUE_FLAGS = new Set([
|
|
29
|
+
'session',
|
|
30
|
+
'answer',
|
|
28
31
|
'cwd',
|
|
29
32
|
'connection',
|
|
30
33
|
'model',
|
|
@@ -35,13 +38,29 @@ const VALUE_FLAGS = new Set([
|
|
|
35
38
|
'host',
|
|
36
39
|
'project',
|
|
37
40
|
]);
|
|
38
|
-
const
|
|
39
|
-
|
|
41
|
+
const BOOLEAN_FLAGS = new Set([
|
|
42
|
+
'continue',
|
|
43
|
+
'yolo',
|
|
44
|
+
'graph',
|
|
45
|
+
'wait',
|
|
46
|
+
'no-wait',
|
|
47
|
+
'json',
|
|
48
|
+
'status',
|
|
49
|
+
'result',
|
|
50
|
+
'recap',
|
|
51
|
+
'queue',
|
|
52
|
+
'steer',
|
|
53
|
+
'stop',
|
|
54
|
+
'approve',
|
|
55
|
+
'deny',
|
|
56
|
+
]);
|
|
40
57
|
export function parseMakaRunArgs(argv) {
|
|
41
58
|
const positional = [];
|
|
42
59
|
const flags = new Map();
|
|
43
60
|
const booleanFlags = new Set();
|
|
44
61
|
let literal = false;
|
|
62
|
+
const optionArgs = argv.includes('--') ? argv.slice(0, argv.indexOf('--')) : argv;
|
|
63
|
+
const selectsSession = optionArgs.includes('--session');
|
|
45
64
|
for (let index = 0; index < argv.length; index += 1) {
|
|
46
65
|
const arg = argv[index];
|
|
47
66
|
if (!literal && (arg === '--help' || arg === '-h'))
|
|
@@ -52,21 +71,18 @@ export function parseMakaRunArgs(argv) {
|
|
|
52
71
|
}
|
|
53
72
|
if (!literal && arg.startsWith('--')) {
|
|
54
73
|
const name = arg.slice(2);
|
|
55
|
-
if (BOOLEAN_FLAGS.has(name)) {
|
|
56
|
-
if (booleanFlags.has(name))
|
|
57
|
-
return { kind: 'error', message: `option repeated: ${arg}` };
|
|
74
|
+
if (BOOLEAN_FLAGS.has(name) || (name === 'resume' && selectsSession)) {
|
|
58
75
|
booleanFlags.add(name);
|
|
59
76
|
continue;
|
|
60
77
|
}
|
|
61
78
|
if (!VALUE_FLAGS.has(name))
|
|
62
79
|
return { kind: 'error', message: `unknown option: ${arg}` };
|
|
63
|
-
if (!REPEATABLE_VALUE_FLAGS.has(name) && flags.has(name)) {
|
|
64
|
-
return { kind: 'error', message: `option repeated: ${arg}` };
|
|
65
|
-
}
|
|
66
80
|
const value = argv[index + 1];
|
|
67
81
|
if (value === undefined || value.startsWith('--')) {
|
|
68
82
|
return { kind: 'error', message: `option ${arg} needs a value` };
|
|
69
83
|
}
|
|
84
|
+
if (flags.has(name) && flags.get(name) !== value)
|
|
85
|
+
return { kind: 'error', message: `conflicting values for ${arg}` };
|
|
70
86
|
flags.set(name, value);
|
|
71
87
|
index += 1;
|
|
72
88
|
continue;
|
|
@@ -79,6 +95,92 @@ export function parseMakaRunArgs(argv) {
|
|
|
79
95
|
if (positional.length > 1) {
|
|
80
96
|
return { kind: 'error', message: 'maka run accepts at most one positional prompt' };
|
|
81
97
|
}
|
|
98
|
+
const sessionId = flags.get('session');
|
|
99
|
+
const resumeExecution = booleanFlags.has('resume');
|
|
100
|
+
if (sessionId !== undefined && !sessionId.trim())
|
|
101
|
+
return { kind: 'error', message: '--session requires a non-empty Session ID' };
|
|
102
|
+
if (booleanFlags.has('wait') && booleanFlags.has('no-wait')) {
|
|
103
|
+
return { kind: 'error', message: '--wait and --no-wait cannot be used together' };
|
|
104
|
+
}
|
|
105
|
+
if (booleanFlags.has('queue') && booleanFlags.has('steer')) {
|
|
106
|
+
return { kind: 'error', message: '--queue and --steer cannot be used together' };
|
|
107
|
+
}
|
|
108
|
+
const actions = Number(booleanFlags.has('status') && !booleanFlags.has('recap')) +
|
|
109
|
+
Number(booleanFlags.has('result')) +
|
|
110
|
+
Number(booleanFlags.has('recap')) +
|
|
111
|
+
Number(flags.has('answer')) +
|
|
112
|
+
Number(resumeExecution) +
|
|
113
|
+
Number(booleanFlags.has('stop')) +
|
|
114
|
+
Number(booleanFlags.has('approve')) +
|
|
115
|
+
Number(booleanFlags.has('deny'));
|
|
116
|
+
if (actions > 1)
|
|
117
|
+
return {
|
|
118
|
+
kind: 'error',
|
|
119
|
+
message: 'choose one Session action, or combine --status with --recap',
|
|
120
|
+
};
|
|
121
|
+
if ((booleanFlags.has('approve') || booleanFlags.has('deny')) && booleanFlags.has('yolo'))
|
|
122
|
+
return {
|
|
123
|
+
kind: 'error',
|
|
124
|
+
message: '--approve/--deny answer only the current sandbox request; do not combine with --yolo',
|
|
125
|
+
};
|
|
126
|
+
if (!sessionId && (actions || booleanFlags.has('queue') || booleanFlags.has('steer'))) {
|
|
127
|
+
return { kind: 'error', message: 'session operations require --session <session-id>' };
|
|
128
|
+
}
|
|
129
|
+
if (sessionId && (booleanFlags.has('continue') || flags.has('project'))) {
|
|
130
|
+
return {
|
|
131
|
+
kind: 'error',
|
|
132
|
+
message: '--session cannot be combined with --continue or --project',
|
|
133
|
+
};
|
|
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
|
+
}
|
|
149
|
+
if (actions && positional.length)
|
|
150
|
+
return { kind: 'error', message: 'session actions do not accept a prompt' };
|
|
151
|
+
if ((booleanFlags.has('queue') || booleanFlags.has('steer')) && (!positional.length || actions)) {
|
|
152
|
+
return { kind: 'error', message: '--queue and --steer require a prompt' };
|
|
153
|
+
}
|
|
154
|
+
if ((booleanFlags.has('status') ||
|
|
155
|
+
booleanFlags.has('result') ||
|
|
156
|
+
booleanFlags.has('recap') ||
|
|
157
|
+
booleanFlags.has('stop')) &&
|
|
158
|
+
(booleanFlags.has('wait') || booleanFlags.has('no-wait'))) {
|
|
159
|
+
return {
|
|
160
|
+
kind: 'error',
|
|
161
|
+
message: '--status, --result, --recap and --stop do not accept wait options',
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
if (booleanFlags.has('graph') && booleanFlags.has('no-wait')) {
|
|
165
|
+
return { kind: 'error', message: '--graph must wait for its final result' };
|
|
166
|
+
}
|
|
167
|
+
let answers;
|
|
168
|
+
if (flags.has('answer')) {
|
|
169
|
+
try {
|
|
170
|
+
const value = JSON.parse(flags.get('answer'));
|
|
171
|
+
if (!Array.isArray(value) ||
|
|
172
|
+
value.length === 0 ||
|
|
173
|
+
value.some((v) => v !== null && typeof v !== 'string'))
|
|
174
|
+
throw new Error();
|
|
175
|
+
answers = value;
|
|
176
|
+
}
|
|
177
|
+
catch {
|
|
178
|
+
return {
|
|
179
|
+
kind: 'error',
|
|
180
|
+
message: '--answer expects a JSON array of strings or null, e.g. ["Yes"]',
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
}
|
|
82
184
|
const prompt = positional[0];
|
|
83
185
|
const timeout = flags.get('timeout');
|
|
84
186
|
const maxSteps = flags.get('max-steps');
|
|
@@ -112,6 +214,26 @@ export function parseMakaRunArgs(argv) {
|
|
|
112
214
|
return {
|
|
113
215
|
kind: 'run',
|
|
114
216
|
options: {
|
|
217
|
+
...(sessionId !== undefined ? { sessionId } : {}),
|
|
218
|
+
...(booleanFlags.has('wait') ? { wait: true } : {}),
|
|
219
|
+
...(booleanFlags.has('no-wait') ? { noWait: true } : {}),
|
|
220
|
+
...(booleanFlags.has('json') ? { json: true } : {}),
|
|
221
|
+
...(booleanFlags.has('status') ? { status: true } : {}),
|
|
222
|
+
...(booleanFlags.has('result') ? { result: true } : {}),
|
|
223
|
+
...(booleanFlags.has('recap') ? { recap: true } : {}),
|
|
224
|
+
...(resumeExecution ? { resumeExecution: true } : {}),
|
|
225
|
+
...(booleanFlags.has('stop') ? { stop: true } : {}),
|
|
226
|
+
...(booleanFlags.has('approve')
|
|
227
|
+
? { sandboxDecision: 'allow' }
|
|
228
|
+
: booleanFlags.has('deny')
|
|
229
|
+
? { sandboxDecision: 'deny' }
|
|
230
|
+
: {}),
|
|
231
|
+
...(answers ? { answers } : {}),
|
|
232
|
+
...(booleanFlags.has('steer')
|
|
233
|
+
? { placement: 'current_turn' }
|
|
234
|
+
: booleanFlags.has('queue')
|
|
235
|
+
? { placement: 'next_turn' }
|
|
236
|
+
: {}),
|
|
115
237
|
...(prompt !== undefined && prompt !== '-' ? { prompt } : {}),
|
|
116
238
|
stdinPrompt: prompt === '-',
|
|
117
239
|
...(flags.get('cwd') !== undefined ? { cwd: flags.get('cwd') } : {}),
|
|
@@ -137,9 +259,35 @@ export async function runMakaTextCliCore(argv, adapter, overrides = {}) {
|
|
|
137
259
|
return 0;
|
|
138
260
|
}
|
|
139
261
|
if (parsed.kind === 'error') {
|
|
140
|
-
|
|
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`);
|
|
141
266
|
return 2;
|
|
142
267
|
}
|
|
268
|
+
if (parsed.options.sessionId) {
|
|
269
|
+
try {
|
|
270
|
+
if (!deps.runSession)
|
|
271
|
+
throw new Error('Session operations are unavailable in this CLI runtime');
|
|
272
|
+
const options = { ...parsed.options };
|
|
273
|
+
// Queries and answers must not block reading an unrelated stdin stream.
|
|
274
|
+
if (options.prompt !== undefined || options.stdinPrompt)
|
|
275
|
+
options.prompt = await resolveRunPrompt(options, deps);
|
|
276
|
+
const result = await deps.runSession(options, deps);
|
|
277
|
+
writeSessionResult(result, deps, options.json === true || options.status === true);
|
|
278
|
+
const returnsTaskOutcome = options.prompt !== undefined ||
|
|
279
|
+
options.answers !== undefined ||
|
|
280
|
+
options.resumeExecution ||
|
|
281
|
+
options.sandboxDecision !== undefined ||
|
|
282
|
+
options.wait ||
|
|
283
|
+
options.result;
|
|
284
|
+
return result.status === 'failed' && returnsTaskOutcome ? 1 : 0;
|
|
285
|
+
}
|
|
286
|
+
catch (error) {
|
|
287
|
+
writeRunError(error, deps, parsed.options.json === true, parsed.options.sessionId);
|
|
288
|
+
return error instanceof RunSessionInterrupted ? 130 : 1;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
143
291
|
let prompt;
|
|
144
292
|
let selection;
|
|
145
293
|
const workspaceRoot = deps.workspaceRoot();
|
|
@@ -168,14 +316,15 @@ export async function runMakaTextCliCore(argv, adapter, overrides = {}) {
|
|
|
168
316
|
});
|
|
169
317
|
}
|
|
170
318
|
catch (error) {
|
|
171
|
-
deps.
|
|
319
|
+
writeRunError(error, deps, parsed.options.json === true, parsed.options.sessionId);
|
|
172
320
|
return 2;
|
|
173
321
|
}
|
|
174
322
|
let outcome;
|
|
175
|
-
let
|
|
323
|
+
let unavailableSandboxRequest = false;
|
|
176
324
|
let context;
|
|
177
325
|
try {
|
|
178
326
|
context = await deps.createContext({
|
|
327
|
+
...(parsed.options.noWait ? { noWait: true } : {}),
|
|
179
328
|
workspaceRoot,
|
|
180
329
|
cwd: selection.cwd,
|
|
181
330
|
...(selection.kind === 'existing' || parsed.options.connection
|
|
@@ -200,14 +349,12 @@ export async function runMakaTextCliCore(argv, adapter, overrides = {}) {
|
|
|
200
349
|
...(parsed.options.hostProfileId ? { hostProfileId: parsed.options.hostProfileId } : {}),
|
|
201
350
|
...(parsed.options.projectId ? { projectId: parsed.options.projectId } : {}),
|
|
202
351
|
runOutcomeObserver: (result) => {
|
|
203
|
-
if (result.sandboxBoundary === 'unresolved')
|
|
204
|
-
boundaryFailure = true;
|
|
205
352
|
outcome = result;
|
|
206
353
|
},
|
|
207
354
|
});
|
|
208
355
|
}
|
|
209
356
|
catch (error) {
|
|
210
|
-
deps.
|
|
357
|
+
writeRunError(error, deps, parsed.options.json === true, parsed.options.sessionId);
|
|
211
358
|
return 2;
|
|
212
359
|
}
|
|
213
360
|
let session;
|
|
@@ -243,12 +390,13 @@ export async function runMakaTextCliCore(argv, adapter, overrides = {}) {
|
|
|
243
390
|
}
|
|
244
391
|
catch (error) {
|
|
245
392
|
await context.close();
|
|
246
|
-
deps.
|
|
393
|
+
writeRunError(error, deps, parsed.options.json === true, parsed.options.sessionId);
|
|
247
394
|
return 2;
|
|
248
395
|
}
|
|
249
396
|
let interrupted = false;
|
|
250
397
|
let timedOut = false;
|
|
251
398
|
let streamFailed = false;
|
|
399
|
+
let question;
|
|
252
400
|
let stopPromise;
|
|
253
401
|
let resolveStopSignal;
|
|
254
402
|
const stopSignal = new Promise((resolve) => {
|
|
@@ -288,20 +436,12 @@ export async function runMakaTextCliCore(argv, adapter, overrides = {}) {
|
|
|
288
436
|
: {}),
|
|
289
437
|
})) {
|
|
290
438
|
if (event.type === 'sandbox_boundary_request') {
|
|
291
|
-
|
|
292
|
-
deps.writeStderr('maka run: sandbox boundary expansion is unavailable in non-interactive mode\n');
|
|
439
|
+
unavailableSandboxRequest = true;
|
|
293
440
|
await context.runtime.respondToSandboxBoundary(session.id, {
|
|
294
441
|
requestId: event.requestId,
|
|
295
442
|
decision: 'deny',
|
|
296
443
|
});
|
|
297
444
|
}
|
|
298
|
-
const sandboxFailureReason = sessionEventSandboxBoundaryFailureReason(event);
|
|
299
|
-
if (sandboxFailureReason) {
|
|
300
|
-
boundaryFailure = true;
|
|
301
|
-
deps.writeStderr(sandboxFailureReason === 'requires_bypass'
|
|
302
|
-
? 'maka run: sandbox bypass requires an explicit --yolo\n'
|
|
303
|
-
: 'maka run: sandbox boundary expansion is unavailable in non-interactive mode\n');
|
|
304
|
-
}
|
|
305
445
|
}
|
|
306
446
|
graphActivity?.release();
|
|
307
447
|
if (parsed.options.graph && outcome?.status === 'completed') {
|
|
@@ -310,11 +450,12 @@ export async function runMakaTextCliCore(argv, adapter, overrides = {}) {
|
|
|
310
450
|
await stopPromise;
|
|
311
451
|
}
|
|
312
452
|
catch (error) {
|
|
313
|
-
|
|
453
|
+
question = error instanceof RunQuestionAvailable ? error : undefined;
|
|
454
|
+
streamFailed = !question;
|
|
314
455
|
graphActivity?.release();
|
|
315
456
|
await stopPromise?.catch(() => undefined);
|
|
316
|
-
if (!interrupted && !timedOut) {
|
|
317
|
-
deps.
|
|
457
|
+
if (!interrupted && !timedOut && !question) {
|
|
458
|
+
writeRunError(error, deps, parsed.options.json === true, session.id);
|
|
318
459
|
}
|
|
319
460
|
}
|
|
320
461
|
finally {
|
|
@@ -326,25 +467,59 @@ export async function runMakaTextCliCore(argv, adapter, overrides = {}) {
|
|
|
326
467
|
if (interrupted)
|
|
327
468
|
return 130;
|
|
328
469
|
if (timedOut) {
|
|
329
|
-
|
|
470
|
+
writeRunError(`timed out after ${parsed.options.timeoutMs}ms`, deps, parsed.options.json === true, session.id);
|
|
330
471
|
return 1;
|
|
331
472
|
}
|
|
473
|
+
if (question) {
|
|
474
|
+
writeSessionResult(question.result(), deps, true);
|
|
475
|
+
return 0;
|
|
476
|
+
}
|
|
332
477
|
if (streamFailed)
|
|
333
478
|
return 1;
|
|
334
|
-
if (
|
|
479
|
+
if (unavailableSandboxRequest) {
|
|
480
|
+
writeRunError('sandbox boundary expansion is unavailable in non-interactive mode', deps, parsed.options.json === true, session.id);
|
|
335
481
|
return 1;
|
|
482
|
+
}
|
|
336
483
|
if (!outcome) {
|
|
337
|
-
|
|
484
|
+
writeRunError('runtime produced no outcome', deps, parsed.options.json === true, session.id);
|
|
338
485
|
return 1;
|
|
339
486
|
}
|
|
487
|
+
if (outcome.status === 'running') {
|
|
488
|
+
writeSessionResult({ sessionId: session.id, status: 'running', submission: 'started' }, deps, true);
|
|
489
|
+
return 0;
|
|
490
|
+
}
|
|
340
491
|
if (outcome.status !== 'completed' || outcome.finalOutput === undefined) {
|
|
341
492
|
const detail = outcome.failure?.message ?? outcome.failure?.class ?? 'runtime failure';
|
|
342
|
-
|
|
493
|
+
if (parsed.options.json) {
|
|
494
|
+
writeSessionResult({ sessionId: session.id, status: 'failed', error: detail }, deps, true);
|
|
495
|
+
}
|
|
496
|
+
else
|
|
497
|
+
deps.writeStderr(`maka run: ${detail}\n`);
|
|
343
498
|
return 1;
|
|
344
499
|
}
|
|
345
|
-
|
|
500
|
+
writeSessionResult({ sessionId: session.id, status: 'completed', finalOutput: outcome.finalOutput }, deps, parsed.options.json === true);
|
|
346
501
|
return 0;
|
|
347
502
|
}
|
|
503
|
+
export function writeSessionResult(result, deps, json) {
|
|
504
|
+
if (result.error && result.recap === undefined && !json) {
|
|
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`);
|
|
522
|
+
}
|
|
348
523
|
async function resolveRunPrompt(options, deps) {
|
|
349
524
|
const shouldReadStdin = options.stdinPrompt || !deps.stdinIsTTY();
|
|
350
525
|
const stdin = shouldReadStdin ? await deps.readStdin() : '';
|
|
@@ -366,26 +541,59 @@ async function canonicalDirectory(input) {
|
|
|
366
541
|
function makaRunHelpText(cliCommand) {
|
|
367
542
|
return [
|
|
368
543
|
`Usage: ${cliCommand} run [PROMPT] [options]`,
|
|
369
|
-
` ${cliCommand}
|
|
544
|
+
` ${cliCommand} run --session <id> [PROMPT | ACTION] [options]`,
|
|
370
545
|
'',
|
|
371
|
-
'
|
|
372
|
-
|
|
373
|
-
|
|
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`,
|
|
374
549
|
'',
|
|
375
|
-
'
|
|
376
|
-
' --
|
|
377
|
-
' --
|
|
378
|
-
' --
|
|
379
|
-
' --
|
|
380
|
-
'
|
|
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',
|
|
560
|
+
' --result Read the latest Turn result without waiting',
|
|
561
|
+
' --answer <json-array> Answer the current AskUser, e.g. ["Yes",null]',
|
|
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',
|
|
381
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)',
|
|
382
574
|
' --timeout <seconds> Invocation timeout',
|
|
383
|
-
' --max-steps <count> Tool-step cap',
|
|
384
|
-
' --
|
|
385
|
-
' --
|
|
386
|
-
' --
|
|
387
|
-
'
|
|
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`,
|
|
388
587
|
' -h, --help Show help',
|
|
588
|
+
'',
|
|
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.',
|
|
389
597
|
].join('\n');
|
|
390
598
|
}
|
|
391
599
|
function defaultMakaRunEnvironmentDeps() {
|