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
|
@@ -23,11 +23,11 @@ const receipts = new WeakSet();
|
|
|
23
23
|
export function isEventWaitYieldReceipt(value) {
|
|
24
24
|
return typeof value === 'object' && value !== null && receipts.has(value);
|
|
25
25
|
}
|
|
26
|
-
/**
|
|
26
|
+
/** Host composition seam; exposed only with supported sources and valid Goal control. */
|
|
27
27
|
export function buildEventWaitTool(register) {
|
|
28
28
|
return {
|
|
29
29
|
name: EVENT_WAIT_TOOL_NAME,
|
|
30
|
-
description: '
|
|
30
|
+
description: 'Wait for a background Bash task in this Session and end this Turn. Requires an active Goal and direct tools. Use resource {providerId: "shell_run", connectionId: null, resourceType: "background_task", resourceId: the canonical maka://runtime/background-tasks/... ref}, condition {typeId: "terminal", version: 1, parameters: {}} and an explicit timeoutMs. Host continues the existing Goal when the task becomes terminal or the wait expires. Terminal does not mean command success or Goal achievement: inspect the result with Read. Expiry or cancelling the wait does not stop the task.',
|
|
31
31
|
parameters: z
|
|
32
32
|
.object({
|
|
33
33
|
resource: z
|
|
@@ -329,6 +329,27 @@ export function canReplaceHistoryCompactCheckpoint(current, candidate) {
|
|
|
329
329
|
(!current.source || sameHistoryCompactSourceCoverage(current.source, candidate.source)));
|
|
330
330
|
}
|
|
331
331
|
export function matchHistoryCompactCheckpointPrefix(checkpoint, events) {
|
|
332
|
+
const match = matchHistoryCompactCheckpointPrefixExactly(checkpoint, events);
|
|
333
|
+
if (match.reason === undefined ||
|
|
334
|
+
match.reason === 'invalid_checkpoint' ||
|
|
335
|
+
checkpoint.source?.policyVersion !== 'maka.compactable_runtime_event_projection.v3')
|
|
336
|
+
return match;
|
|
337
|
+
// v3 checkpoints written before #6263 did not count encrypted-only thinking.
|
|
338
|
+
// Locate that sealed boundary by identity, then verify the historical source
|
|
339
|
+
// exactly. Never trim the successor tail using the historical event count.
|
|
340
|
+
const throughIndex = events.findIndex((event) => event.id === checkpoint.coverage.through.runtimeEventId);
|
|
341
|
+
if (throughIndex < 0)
|
|
342
|
+
return match;
|
|
343
|
+
const prefix = events.slice(0, throughIndex + 1);
|
|
344
|
+
const historical = prefix.filter((event) => event.content?.kind !== 'thinking' || event.content.text.length > 0);
|
|
345
|
+
if (historical.length === prefix.length)
|
|
346
|
+
return match;
|
|
347
|
+
const historicalMatch = matchHistoryCompactCheckpointPrefixExactly(checkpoint, historical);
|
|
348
|
+
return historicalMatch.reason === undefined
|
|
349
|
+
? { ...historicalMatch, successorRuntimeEvents: events.slice(throughIndex + 1) }
|
|
350
|
+
: match;
|
|
351
|
+
}
|
|
352
|
+
function matchHistoryCompactCheckpointPrefixExactly(checkpoint, events) {
|
|
332
353
|
if (!validateHistoryCompactCheckpointShape(checkpoint)) {
|
|
333
354
|
return {
|
|
334
355
|
coveredEventCount: 0,
|
|
@@ -542,7 +563,17 @@ function effectiveDigestEvent(event) {
|
|
|
542
563
|
}
|
|
543
564
|
/** True when the event carries model-visible content the compact projection counts. */
|
|
544
565
|
export function isHistoryCompactContentEvent(event) {
|
|
545
|
-
|
|
566
|
+
if (event.modelVisibility === 'hidden')
|
|
567
|
+
return false;
|
|
568
|
+
// A Responses reasoning item can carry only encrypted content. Text sizing
|
|
569
|
+
// does not decide whether that payload exists; route admission still runs
|
|
570
|
+
// when the compacted history is materialized for the selected model.
|
|
571
|
+
if (event.content?.kind === 'thinking') {
|
|
572
|
+
const openai = event.content.providerOptions?.openai;
|
|
573
|
+
if (nonEmpty(openai?.itemId) && nonEmpty(openai?.reasoningEncryptedContent))
|
|
574
|
+
return true;
|
|
575
|
+
}
|
|
576
|
+
return estimateRuntimeEventChars(event) > 0;
|
|
546
577
|
}
|
|
547
578
|
function validHistoryCompactProviderState(value) {
|
|
548
579
|
if (!value || typeof value !== 'object')
|
|
@@ -180,6 +180,13 @@ export async function planHistoryCompaction(input) {
|
|
|
180
180
|
if (!boundary.ok || !hasSafeCoverage)
|
|
181
181
|
return noSafeSpan();
|
|
182
182
|
const coveredRuntimeEvents = input.orderedEvents.slice(0, boundary.coveredCount);
|
|
183
|
+
// The live context is reattached after a fold. Summarizing just that
|
|
184
|
+
// metadata and the pinned user anchor cannot free useful history.
|
|
185
|
+
if (phase === 'mid_turn' &&
|
|
186
|
+
!coveredRuntimeEvents.some((event) => event.id !== input.headAnchor?.runtimeEventId &&
|
|
187
|
+
!(event.content?.kind === 'text' && event.content.runtimeContextName !== undefined))) {
|
|
188
|
+
return noSafeSpan();
|
|
189
|
+
}
|
|
183
190
|
const tailRuntimeEvents = input.orderedEvents.slice(boundary.coveredCount);
|
|
184
191
|
// One transition view per pass: the same loaded snapshot judges the
|
|
185
192
|
// previous checkpoint's currency and produces the effective view the
|
|
@@ -337,12 +337,13 @@ function claudeThinkingOptions(modelId, level) {
|
|
|
337
337
|
* those paths an omitted parameter already means no extended thinking, while
|
|
338
338
|
* the lowest effort would switch adaptive thinking on. That holds for Claude,
|
|
339
339
|
* not for every Anthropic Messages route: Kimi's K3 and kimi-for-coding think
|
|
340
|
-
* by default when no level is sent.
|
|
340
|
+
* by default when no level is sent. K3 can declare an explicit `none` effort;
|
|
341
|
+
* when it does, the provider builder maps `'off'` to disabled thinking.
|
|
341
342
|
*
|
|
342
|
-
*
|
|
343
|
-
* provider
|
|
344
|
-
* dynamic on Gemini 3). So this returns the model's
|
|
345
|
-
* instead, which the wire builders send explicitly.
|
|
343
|
+
* When a model declares effort levels but no `none`, a dropped `'off'` omits
|
|
344
|
+
* the effort parameter and the provider runs its default reasoning (medium on
|
|
345
|
+
* GPT-5, GPT-6 and o3, dynamic on Gemini 3). So this returns the model's
|
|
346
|
+
* lowest declared level instead, which the wire builders send explicitly.
|
|
346
347
|
*/
|
|
347
348
|
export function leastReasoningThinkingLevel(connection, modelId, runtime = resolveModelRuntime(connection, modelId)) {
|
|
348
349
|
const variants = thinkingVariantsForConnection(connection, modelId);
|
|
@@ -376,8 +377,18 @@ function buildThinkingProviderOptions(connection, modelId, thinkingLevel, runtim
|
|
|
376
377
|
}
|
|
377
378
|
return buildFamilyWire(connection, modelId, level, thinkingOptions, runtime);
|
|
378
379
|
case 'kimi-coding-plan': {
|
|
379
|
-
if (!level || level === '
|
|
380
|
+
if (!level || level === 'on')
|
|
380
381
|
return {};
|
|
382
|
+
if (level === 'off') {
|
|
383
|
+
// A refreshed Kimi Code catalog may declare `none`. Omitting the
|
|
384
|
+
// control leaves K3 at its default reasoning level, so send the
|
|
385
|
+
// provider's explicit disabled-thinking wire when that choice exists.
|
|
386
|
+
if (!thinkingOptions?.efforts?.includes('none'))
|
|
387
|
+
return {};
|
|
388
|
+
return runtime.wire === 'openai-chat'
|
|
389
|
+
? { kimiCodingPlan: { reasoningEffort: 'none' } }
|
|
390
|
+
: { anthropic: { thinking: { type: 'disabled' } } };
|
|
391
|
+
}
|
|
381
392
|
if (runtime.wire === 'openai-chat') {
|
|
382
393
|
// The kimiCodingPlan provider-options namespace is the
|
|
383
394
|
// openai-compatible adapter name; ai-sdk resolves its camelCase
|
|
@@ -418,6 +429,15 @@ function buildThinkingProviderOptions(connection, modelId, thinkingLevel, runtim
|
|
|
418
429
|
if (level === 'off' && thinkingOptions?.offBehavior === 'anthropic-thinking-disabled') {
|
|
419
430
|
reasoning = { thinking: { type: 'disabled' } };
|
|
420
431
|
}
|
|
432
|
+
else if ((connection.providerType === 'MiniMax' || connection.providerType === 'MiniMax-cn') &&
|
|
433
|
+
(modelId === 'MiniMax-M3.1-Flash' || (modelId === 'MiniMax-M3' && level === 'on'))) {
|
|
434
|
+
reasoning = {
|
|
435
|
+
thinking: { type: 'adaptive' },
|
|
436
|
+
...(modelId === 'MiniMax-M3.1-Flash'
|
|
437
|
+
? { effort: level && level !== 'off' && level !== 'on' ? level : 'max' }
|
|
438
|
+
: {}),
|
|
439
|
+
};
|
|
440
|
+
}
|
|
421
441
|
else if (summarizedThinking) {
|
|
422
442
|
reasoning = summarizedThinking;
|
|
423
443
|
}
|
|
@@ -550,9 +550,10 @@ function toModelInfo(model) {
|
|
|
550
550
|
assertOptionalArray(model.input_modalities, 'model input_modalities');
|
|
551
551
|
assertOptionalArray(model.output_modalities, 'model output_modalities');
|
|
552
552
|
assertOptionalArray(model.tags, 'model tags');
|
|
553
|
+
assertOptionalArray(model.supported_features, 'model supported_features');
|
|
553
554
|
const providers = providerObjectArray(model.providers, 'model providers');
|
|
554
555
|
const contextWindow = providerTokenLimit(model.context_length) ?? providerTokenLimit(model.context_window);
|
|
555
|
-
const maxOutputTokens = providerTokenLimit(model.max_tokens);
|
|
556
|
+
const maxOutputTokens = providerTokenLimit(model.max_output_length) ?? providerTokenLimit(model.max_tokens);
|
|
556
557
|
const capabilities = {};
|
|
557
558
|
if (model.input_modalities?.includes('image'))
|
|
558
559
|
capabilities.vision = true;
|
|
@@ -568,6 +569,9 @@ function toModelInfo(model) {
|
|
|
568
569
|
capabilities.reasoning = true;
|
|
569
570
|
if (model.tags?.includes('tool-use'))
|
|
570
571
|
capabilities.functionCalling = true;
|
|
572
|
+
if (model.supported_features) {
|
|
573
|
+
capabilities.functionCalling = model.supported_features.includes('tools');
|
|
574
|
+
}
|
|
571
575
|
// `output_modalities` was validated above and then dropped, so a relay that
|
|
572
576
|
// advertised an image-only model handed back a row indistinguishable from a
|
|
573
577
|
// chat model's. Declared output that names modalities but not text is the
|
|
@@ -593,6 +597,9 @@ function toModelInfo(model) {
|
|
|
593
597
|
...(model.display_name || model.name ? { displayName: model.display_name ?? model.name } : {}),
|
|
594
598
|
...(contextWindow === undefined ? {} : { contextWindow }),
|
|
595
599
|
...(maxOutputTokens === undefined ? {} : { maxOutputTokens }),
|
|
600
|
+
...(model.supported_features
|
|
601
|
+
? { structuredOutput: model.supported_features.includes('structured_outputs') }
|
|
602
|
+
: {}),
|
|
596
603
|
...(Object.keys(capabilities).length ? { capabilities } : {}),
|
|
597
604
|
};
|
|
598
605
|
}
|
|
@@ -611,13 +611,16 @@ export function buildRuntimeEventModelReplayPlan(events, options = {}) {
|
|
|
611
611
|
diagnostics.push(diagnostic(event, 'unsupported_content', 'RuntimeEvent content kind is not model-replayable', { kind: event.content.kind }));
|
|
612
612
|
continue;
|
|
613
613
|
}
|
|
614
|
-
|
|
614
|
+
const runtimeContextName = event.role === 'system' && event.author === 'host' && event.content.kind === 'text'
|
|
615
|
+
? event.content.runtimeContextName
|
|
616
|
+
: undefined;
|
|
617
|
+
if (event.role === 'system' && !includeSystemEvents && runtimeContextName === undefined) {
|
|
615
618
|
diagnostics.push(diagnostic(event, 'system_runtime_fact_diagnostic_only', 'system RuntimeEvent content is diagnostic-only unless system replay is enabled'));
|
|
616
619
|
continue;
|
|
617
620
|
}
|
|
618
621
|
switch (event.content.kind) {
|
|
619
622
|
case 'text': {
|
|
620
|
-
const role = modelTextRole(event.role);
|
|
623
|
+
const role = runtimeContextName !== undefined ? 'user' : modelTextRole(event.role);
|
|
621
624
|
if (!role) {
|
|
622
625
|
diagnostics.push(diagnostic(event, 'unsupported_role', 'text RuntimeEvent role is not model-replayable', {
|
|
623
626
|
role: event.role,
|
|
@@ -636,6 +639,7 @@ export function buildRuntimeEventModelReplayPlan(events, options = {}) {
|
|
|
636
639
|
? buildSteeringEnvelope(formatTextWithInlineRefs(event.content))
|
|
637
640
|
: formatTextWithInlineRefs(event.content),
|
|
638
641
|
...(steeringReplay ? { steering: { eventId: event.id } } : {}),
|
|
642
|
+
...(runtimeContextName !== undefined ? { runtimeContextName } : {}),
|
|
639
643
|
...(event.content.attachments ? { attachments: event.content.attachments } : {}),
|
|
640
644
|
...(event.content.providerOptions !== undefined
|
|
641
645
|
? {
|
|
@@ -807,7 +811,13 @@ export function buildRuntimeEventModelReplayPlan(events, options = {}) {
|
|
|
807
811
|
content: item.content,
|
|
808
812
|
providerOptions: steeringProviderOptions(item.steering.eventId),
|
|
809
813
|
}
|
|
810
|
-
: {
|
|
814
|
+
: {
|
|
815
|
+
role: item.role,
|
|
816
|
+
content: item.content,
|
|
817
|
+
...(item.runtimeContextName !== undefined
|
|
818
|
+
? { providerOptions: runtimeContextProviderOptions(item.runtimeContextName) }
|
|
819
|
+
: {}),
|
|
820
|
+
});
|
|
811
821
|
return {
|
|
812
822
|
items,
|
|
813
823
|
textMessages,
|
|
@@ -815,6 +825,9 @@ export function buildRuntimeEventModelReplayPlan(events, options = {}) {
|
|
|
815
825
|
hasProviderNativeSemantics: items.some((item) => item.kind !== 'text'),
|
|
816
826
|
};
|
|
817
827
|
}
|
|
828
|
+
export function runtimeContextProviderOptions(name) {
|
|
829
|
+
return { makaRuntimeContext: { name } };
|
|
830
|
+
}
|
|
818
831
|
function modelTextRole(role) {
|
|
819
832
|
switch (role) {
|
|
820
833
|
case 'user':
|
|
@@ -48,7 +48,10 @@ export function buildOpenAiCodexHistoryCompactor(options) {
|
|
|
48
48
|
// Codex: summarize the portable checkpoint plus its tail, without
|
|
49
49
|
// resurrecting the already-folded source history (#6154).
|
|
50
50
|
const replayEvents = canContinuePrevious && !isProviderHistoryCompactCheckpoint(previous)
|
|
51
|
-
? projectHistoryCompactCheckpointReplay(previous,
|
|
51
|
+
? projectHistoryCompactCheckpointReplay(previous,
|
|
52
|
+
// The projection finds a mid-turn head anchor by identity. A
|
|
53
|
+
// historical event count can cut it off after reasoning admission.
|
|
54
|
+
input.source.foldedRuntimeEvents, events)
|
|
52
55
|
: events;
|
|
53
56
|
const providerReasoningReplayEventIds = compatibleProviderReasoningReplayEventIds(events, input.source.invocations, options.providerStateIdentity, options.modelId, input.runId);
|
|
54
57
|
const projectedMessages = openAiCodexCompactionMessages(replayEvents, providerReasoningReplayEventIds);
|
|
@@ -127,7 +130,9 @@ export function shouldFallbackFromOpenAiCodexHistoryCompaction(error, abortSigna
|
|
|
127
130
|
return false;
|
|
128
131
|
if (!(error instanceof HistoryCompactSummarizerError))
|
|
129
132
|
return false;
|
|
130
|
-
|
|
133
|
+
// Capacity errors must reach the planner's same-route accepted-prefix
|
|
134
|
+
// retry, which preserves native compaction and the uncovered tail.
|
|
135
|
+
if (error.reason === 'invalid_provider_state')
|
|
131
136
|
return true;
|
|
132
137
|
if (error.reason !== 'provider_error')
|
|
133
138
|
return false;
|
|
@@ -17,8 +17,10 @@
|
|
|
17
17
|
* under the License.
|
|
18
18
|
*/
|
|
19
19
|
import { randomUUID } from 'node:crypto';
|
|
20
|
+
import { truncateUtf8 } from '@maka/core/diagnostic-log';
|
|
20
21
|
import { redactSecrets } from '@maka/core/redaction';
|
|
21
22
|
import { AsyncEventQueue } from './async-queue.js';
|
|
23
|
+
import { MAX_EXECUTOR_COMPLETION_TEXT_BYTES } from './plugin-executor-service.js';
|
|
22
24
|
/** Converts a small plugin executor contract into Maka's existing Run event stream. */
|
|
23
25
|
export class PluginExecutorBackend {
|
|
24
26
|
kind = 'plugin-executor';
|
|
@@ -51,7 +53,7 @@ export class PluginExecutorBackend {
|
|
|
51
53
|
const queue = new AsyncEventQueue();
|
|
52
54
|
const messageId = this.#newId();
|
|
53
55
|
const producer = this.#produce(input, messageId, abort.signal, queue).finally(() => queue.close());
|
|
54
|
-
const active = { abort, settled: producer.then(() => undefined) };
|
|
56
|
+
const active = { abort, settled: producer.then(() => undefined), queue };
|
|
55
57
|
this.#active.add(active);
|
|
56
58
|
let acknowledged = false;
|
|
57
59
|
try {
|
|
@@ -90,11 +92,22 @@ export class PluginExecutorBackend {
|
|
|
90
92
|
this.#active.delete(active);
|
|
91
93
|
}
|
|
92
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Cancel execution and wait for its queued events to be consumed or the consumer
|
|
97
|
+
* to detach. Keep consuming send() while stopping: awaiting stop() inside that
|
|
98
|
+
* consumer loop prevents progress. Start it without awaiting in the loop, then
|
|
99
|
+
* await it after the loop exits.
|
|
100
|
+
*/
|
|
93
101
|
async stop(reason) {
|
|
94
102
|
const active = [...this.#active];
|
|
95
103
|
for (const execution of active)
|
|
96
104
|
execution.abort.abort(new Error(reason));
|
|
97
|
-
await Promise.allSettled(active.map((execution) =>
|
|
105
|
+
await Promise.allSettled(active.map(async (execution) => {
|
|
106
|
+
await execution.settled;
|
|
107
|
+
// Runtime may seal the ledger when stop returns. Provider settlement
|
|
108
|
+
// alone does not mean its queued final updates have been persisted.
|
|
109
|
+
await execution.queue.waitUntilConsumedThroughCurrent();
|
|
110
|
+
}));
|
|
98
111
|
}
|
|
99
112
|
async respondToSandboxBoundary(_response) {
|
|
100
113
|
throw new Error('Plugin executor does not expose Maka sandbox-boundary requests');
|
|
@@ -111,6 +124,9 @@ export class PluginExecutorBackend {
|
|
|
111
124
|
async #produce(input, messageId, signal, queue) {
|
|
112
125
|
const turnId = input.turnId;
|
|
113
126
|
let thinkingText = '';
|
|
127
|
+
let outputText = '';
|
|
128
|
+
let outputBytes = 0;
|
|
129
|
+
let outputTruncated = false;
|
|
114
130
|
const toolUseIds = new Map();
|
|
115
131
|
const toolOutputSequences = new Map();
|
|
116
132
|
let result;
|
|
@@ -140,6 +156,21 @@ export class PluginExecutorBackend {
|
|
|
140
156
|
onEvent: (event) => {
|
|
141
157
|
if (event.type === 'thinking_delta')
|
|
142
158
|
thinkingText += event.text;
|
|
159
|
+
if (event.type === 'output_delta' && !outputTruncated) {
|
|
160
|
+
// Bound even a single oversized delta before retaining it. Live
|
|
161
|
+
// delivery and the provider's final result remain authoritative.
|
|
162
|
+
const chunk = event.text.slice(0, MAX_EXECUTOR_COMPLETION_TEXT_BYTES + 1);
|
|
163
|
+
outputText += chunk;
|
|
164
|
+
outputBytes += Buffer.byteLength(chunk, 'utf8');
|
|
165
|
+
if (outputBytes > MAX_EXECUTOR_COMPLETION_TEXT_BYTES) {
|
|
166
|
+
// A surrogate pair split across deltas uses fewer bytes joined.
|
|
167
|
+
outputBytes = Buffer.byteLength(outputText, 'utf8');
|
|
168
|
+
if (outputBytes > MAX_EXECUTOR_COMPLETION_TEXT_BYTES) {
|
|
169
|
+
outputText = truncateUtf8(outputText, MAX_EXECUTOR_COMPLETION_TEXT_BYTES, '\n[Response truncated]');
|
|
170
|
+
outputTruncated = true;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
143
174
|
this.#publishOutputEvent(turnId, messageId, event, toolUseIds, toolOutputSequences, queue);
|
|
144
175
|
},
|
|
145
176
|
onPermissionRequest: (request) => this.#requestPermission(input, request, signal, toolUseIds, queue),
|
|
@@ -150,6 +181,22 @@ export class PluginExecutorBackend {
|
|
|
150
181
|
failure = error;
|
|
151
182
|
}
|
|
152
183
|
this.#closeOptionalOutput(turnId, messageId, thinkingText, toolUseIds, queue);
|
|
184
|
+
// Deltas are only live presentation. Close the interrupted text before the
|
|
185
|
+
// terminal event seals the ledger, including updates drained during cancel.
|
|
186
|
+
// Successful results keep their provider-authoritative completion text.
|
|
187
|
+
// Like successful completions, history stores one text block after tool
|
|
188
|
+
// results; it does not preserve the live text/tool interleaving.
|
|
189
|
+
if (outputText && (failed || result?.status !== 'completed')) {
|
|
190
|
+
queue.push({
|
|
191
|
+
type: 'text_complete',
|
|
192
|
+
id: this.#newId(),
|
|
193
|
+
turnId,
|
|
194
|
+
ts: this.#now(),
|
|
195
|
+
messageId,
|
|
196
|
+
text: outputText,
|
|
197
|
+
interrupted: true,
|
|
198
|
+
});
|
|
199
|
+
}
|
|
153
200
|
if (failed) {
|
|
154
201
|
if (signal.aborted)
|
|
155
202
|
this.#publishCancellation(turnId, { status: 'cancelled', source: 'caller' }, queue);
|
|
@@ -23,7 +23,7 @@ import { isExecutorId } from '@maka/core/executor-id';
|
|
|
23
23
|
import { Service } from './plugin-kernel.js';
|
|
24
24
|
import { MakaPluginRuntimeError, pluginIdentity, registerPluginContribution, } from './plugin-runtime.js';
|
|
25
25
|
import { PluginScopeRegistry } from './plugin-scope-registry.js';
|
|
26
|
-
const MAX_EXECUTOR_COMPLETION_TEXT_BYTES = 256 * 1024;
|
|
26
|
+
export const MAX_EXECUTOR_COMPLETION_TEXT_BYTES = 256 * 1024;
|
|
27
27
|
class ExecutorRetiredAbort extends Error {
|
|
28
28
|
constructor(executorId) {
|
|
29
29
|
super(`Executor was retired: ${executorId}`);
|
|
@@ -127,6 +127,15 @@ export class PluginExecutorService extends Service {
|
|
|
127
127
|
? [...this.registry.visible(scopeSessionId).values()]
|
|
128
128
|
: [...this.registry.entries('profile')];
|
|
129
129
|
const selected = entries.filter((entry) => !entry.retired && (!input.executorId || entry.provider.id === input.executorId));
|
|
130
|
+
if (input.listOnly)
|
|
131
|
+
return selected.map(({ provider }) => ({
|
|
132
|
+
id: provider.id,
|
|
133
|
+
displayName: provider.displayName?.trim() || provider.id,
|
|
134
|
+
readiness: 'unavailable',
|
|
135
|
+
models: [],
|
|
136
|
+
supportsAttachments: false,
|
|
137
|
+
supportsModelChange: false,
|
|
138
|
+
}));
|
|
130
139
|
if (input.executorId && !selected.length)
|
|
131
140
|
return [
|
|
132
141
|
{
|
|
@@ -170,9 +179,9 @@ export class PluginExecutorService extends Service {
|
|
|
170
179
|
}
|
|
171
180
|
})));
|
|
172
181
|
}
|
|
173
|
-
invalidateCatalog() {
|
|
182
|
+
invalidateCatalog(executorId) {
|
|
174
183
|
for (const entry of this.registry.entries('profile')) {
|
|
175
|
-
if (!entry.retired)
|
|
184
|
+
if (!entry.retired && (!executorId || entry.provider.id === executorId))
|
|
176
185
|
entry.provider.invalidateCatalog?.();
|
|
177
186
|
}
|
|
178
187
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
* or more contributor license agreements. See the NOTICE file
|
|
4
|
+
* distributed with this work for additional information
|
|
5
|
+
* regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
* to you under the Apache License, Version 2.0 (the
|
|
7
|
+
* "License"); you may not use this file except in compliance
|
|
8
|
+
* with the License. You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
|
13
|
+
* software distributed under the License is distributed on an
|
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
* KIND, either express or implied. See the License for the
|
|
16
|
+
* specific language governing permissions and limitations
|
|
17
|
+
* under the License.
|
|
18
|
+
*/
|
|
19
|
+
import { runtimeContextProviderOptions } from './model-history.js';
|
|
20
|
+
/** Compare only host-tagged context still present in the effective model history.
|
|
21
|
+
* Compaction may remove a snapshot; in that case the current value is sent again.
|
|
22
|
+
*/
|
|
23
|
+
export function changedRuntimeContexts(contexts, messages) {
|
|
24
|
+
const latest = new Map();
|
|
25
|
+
for (const message of messages) {
|
|
26
|
+
const name = message.providerOptions?.makaRuntimeContext?.name;
|
|
27
|
+
if (message.role !== 'user' || typeof name !== 'string')
|
|
28
|
+
continue;
|
|
29
|
+
const text = typeof message.content === 'string'
|
|
30
|
+
? message.content
|
|
31
|
+
: message.content
|
|
32
|
+
.filter((part) => part.type === 'text')
|
|
33
|
+
.map((part) => part.text)
|
|
34
|
+
.join('');
|
|
35
|
+
latest.set(name, text);
|
|
36
|
+
}
|
|
37
|
+
const changes = [];
|
|
38
|
+
for (const context of contexts) {
|
|
39
|
+
const text = `Runtime context (${context.name}; host metadata, not a user request; later updates supersede earlier values):\n${context.text}`;
|
|
40
|
+
if (latest.get(context.name) === text)
|
|
41
|
+
continue;
|
|
42
|
+
changes.push({ name: context.name, text });
|
|
43
|
+
latest.set(context.name, text);
|
|
44
|
+
}
|
|
45
|
+
return changes;
|
|
46
|
+
}
|
|
47
|
+
export function runtimeContextMessage(context) {
|
|
48
|
+
return {
|
|
49
|
+
role: 'user',
|
|
50
|
+
content: context.text,
|
|
51
|
+
providerOptions: runtimeContextProviderOptions(context.name),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
@@ -638,6 +638,9 @@ export function classifyRuntimeEventTerminalFact(invocation, events) {
|
|
|
638
638
|
function projectText(event, state, messages) {
|
|
639
639
|
if (event.content?.kind !== 'text')
|
|
640
640
|
return false;
|
|
641
|
+
// Claimed by model replay only; internal context has no transcript row.
|
|
642
|
+
if (event.role === 'system' && event.content.runtimeContextName !== undefined)
|
|
643
|
+
return true;
|
|
641
644
|
if (event.role === 'user') {
|
|
642
645
|
const message = projectRuntimeEventUserMessage(event, stableMessageId(event, state, 'user'));
|
|
643
646
|
if (!message)
|