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
|
@@ -194,7 +194,7 @@ export class GoalContinuationCoordinator {
|
|
|
194
194
|
return this.settleDiscardedRegistration(registration);
|
|
195
195
|
}
|
|
196
196
|
if (registration.checkpoint &&
|
|
197
|
-
!this.
|
|
197
|
+
!this.matchesExecutionCheckpoint(sessionId, turnId, registration.checkpoint, controlLease)) {
|
|
198
198
|
return this.settleDiscardedRegistration(registration);
|
|
199
199
|
}
|
|
200
200
|
return this.enqueueTurn(outcome, controlLease, registration);
|
|
@@ -205,6 +205,14 @@ export class GoalContinuationCoordinator {
|
|
|
205
205
|
? this.deps.durability.settleCurrentExecution(registration.lane.sessionId, registration.turnId)
|
|
206
206
|
: Promise.resolve();
|
|
207
207
|
}
|
|
208
|
+
gateEventWait(sessionId) {
|
|
209
|
+
const lane = this.lanes.get(sessionId);
|
|
210
|
+
if (!lane)
|
|
211
|
+
return;
|
|
212
|
+
lane.intent = undefined;
|
|
213
|
+
this.clearWaitingTimer(lane);
|
|
214
|
+
this.abortEvaluation(lane, 'Explicit event wait registered');
|
|
215
|
+
}
|
|
208
216
|
/** Revoke the current lane while allowing later turns in the same session. */
|
|
209
217
|
invalidateSession(sessionId) {
|
|
210
218
|
const lane = this.lanes.get(sessionId);
|
|
@@ -232,7 +240,7 @@ export class GoalContinuationCoordinator {
|
|
|
232
240
|
if (this.disposed) {
|
|
233
241
|
return { kind: 'unavailable', reason: 'Goal continuation is disposed.' };
|
|
234
242
|
}
|
|
235
|
-
if (!this.
|
|
243
|
+
if (!this.matchesExecutionCheckpoint(sessionId, turnId, current.checkpoint, current.controlLease) ||
|
|
236
244
|
!this.deps.goalManager.matchesControlLease(sessionId, current.controlLease)) {
|
|
237
245
|
return { kind: 'unavailable', reason: 'Durable Goal execution no longer owns the Goal.' };
|
|
238
246
|
}
|
|
@@ -265,7 +273,7 @@ export class GoalContinuationCoordinator {
|
|
|
265
273
|
* at each door.
|
|
266
274
|
*/
|
|
267
275
|
restoreDrive(lane, goal, controlLease, evaluation) {
|
|
268
|
-
if (!isDrivingGoal(goal))
|
|
276
|
+
if (!isDrivingGoal(goal) || this.deps.eventWait?.isGated(lane.sessionId))
|
|
269
277
|
return;
|
|
270
278
|
lane.intent = { checkpoint: goalCheckpoint(goal), controlLease, evaluation };
|
|
271
279
|
this.scheduleDrain(lane);
|
|
@@ -304,13 +312,16 @@ export class GoalContinuationCoordinator {
|
|
|
304
312
|
return;
|
|
305
313
|
}
|
|
306
314
|
const lane = this.laneFor(sessionId);
|
|
307
|
-
if (lane.
|
|
315
|
+
if (lane.turns.size > 0)
|
|
316
|
+
return;
|
|
317
|
+
if (lane.intent && (!pending.eventWait || !lane.intent.eventWait))
|
|
308
318
|
return;
|
|
309
319
|
lane.intent = {
|
|
310
320
|
checkpoint: pending.checkpoint,
|
|
311
321
|
controlLease: pending.controlLease,
|
|
312
322
|
...(pending.triggeringTurnId ? { triggeringTurnId: pending.triggeringTurnId } : {}),
|
|
313
323
|
recoveredPrompt: pending.prompt,
|
|
324
|
+
...(pending.eventWait ? { eventWait: pending.eventWait } : {}),
|
|
314
325
|
evaluation: {
|
|
315
326
|
met: false,
|
|
316
327
|
impossible: false,
|
|
@@ -476,7 +487,9 @@ export class GoalContinuationCoordinator {
|
|
|
476
487
|
await this.processQueuedTurn(lane, item);
|
|
477
488
|
}
|
|
478
489
|
catch (error) {
|
|
479
|
-
this.
|
|
490
|
+
if (this.deps.goalManager.matchesControlLease(lane.sessionId, item.controlLease)) {
|
|
491
|
+
this.pauseCurrentGoal(lane, `Goal continuation coordinator failed: ${errorMessage(error)}`);
|
|
492
|
+
}
|
|
480
493
|
}
|
|
481
494
|
finally {
|
|
482
495
|
if (lane.processing === item)
|
|
@@ -512,11 +525,25 @@ export class GoalContinuationCoordinator {
|
|
|
512
525
|
}
|
|
513
526
|
}
|
|
514
527
|
}
|
|
528
|
+
matchesExecutionCheckpoint(sessionId, turnId, checkpoint, controlLease) {
|
|
529
|
+
return (this.deps.goalManager.matchesActive(sessionId, checkpoint) ||
|
|
530
|
+
this.deps.eventWait?.ownsSource(sessionId, turnId, controlLease) === true);
|
|
531
|
+
}
|
|
515
532
|
async processQueuedTurn(lane, item) {
|
|
516
533
|
if (!this.deps.goalManager.matchesControlLease(lane.sessionId, item.controlLease)) {
|
|
517
534
|
return;
|
|
518
535
|
}
|
|
519
|
-
if (item.checkpoint &&
|
|
536
|
+
if (item.checkpoint &&
|
|
537
|
+
!this.matchesExecutionCheckpoint(lane.sessionId, item.turnId, item.checkpoint, item.controlLease)) {
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
if (this.deps.eventWait?.isGated(lane.sessionId)) {
|
|
541
|
+
if (item.outcome.kind === 'completed') {
|
|
542
|
+
await this.deps.eventWait.settleCompleted(lane.sessionId, item.turnId, item.controlLease);
|
|
543
|
+
}
|
|
544
|
+
else {
|
|
545
|
+
this.pauseCurrentGoal(lane, turnFailureReason(item.outcome));
|
|
546
|
+
}
|
|
520
547
|
return;
|
|
521
548
|
}
|
|
522
549
|
if (sameGoalControlLease(lane.intent?.controlLease, item.controlLease)) {
|
|
@@ -539,13 +566,23 @@ export class GoalContinuationCoordinator {
|
|
|
539
566
|
}
|
|
540
567
|
await this.processCompletion(lane, item.controlLease, goal, item.turnId);
|
|
541
568
|
}
|
|
569
|
+
commitGoalMutation(operation) {
|
|
570
|
+
return this.deps.mutateGoal ? this.deps.mutateGoal(operation) : operation(this.deps.durability);
|
|
571
|
+
}
|
|
542
572
|
async processCompletion(lane, controlLease, initialGoal, turnId) {
|
|
543
573
|
let goal = initialGoal;
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
if (!woken)
|
|
574
|
+
await this.commitGoalMutation(async () => {
|
|
575
|
+
if (this.deps.eventWait?.isGated(lane.sessionId))
|
|
547
576
|
return;
|
|
548
|
-
goal
|
|
577
|
+
if (goal.status === 'waiting') {
|
|
578
|
+
const woken = this.deps.goalManager.wakeWaiting(lane.sessionId, goalCheckpoint(goal));
|
|
579
|
+
if (woken)
|
|
580
|
+
goal = woken;
|
|
581
|
+
}
|
|
582
|
+
});
|
|
583
|
+
if (this.deps.eventWait?.isGated(lane.sessionId)) {
|
|
584
|
+
await this.deps.eventWait.settleCompleted(lane.sessionId, turnId, controlLease);
|
|
585
|
+
return;
|
|
549
586
|
}
|
|
550
587
|
if (goal.status !== 'active')
|
|
551
588
|
return;
|
|
@@ -555,98 +592,120 @@ export class GoalContinuationCoordinator {
|
|
|
555
592
|
context = await this.deps.getRecentContext(lane.sessionId);
|
|
556
593
|
}
|
|
557
594
|
catch (error) {
|
|
558
|
-
this.pauseAtCheckpoint(lane, checkpoint, `Unable to read Goal evaluation context: ${errorMessage(error)}`);
|
|
595
|
+
await this.commitGoalMutation(async () => this.pauseAtCheckpoint(lane, checkpoint, `Unable to read Goal evaluation context: ${errorMessage(error)}`));
|
|
559
596
|
return;
|
|
560
597
|
}
|
|
561
|
-
|
|
598
|
+
// Ordinary evaluator settlement uses this context read's usage snapshot.
|
|
599
|
+
// Explicit waits instead read persisted usage at the completed Turn boundary.
|
|
600
|
+
const tokensNow = this.deps.getTokenCount?.(lane.sessionId);
|
|
601
|
+
const evaluationAbort = new AbortController();
|
|
602
|
+
let evaluationTask;
|
|
603
|
+
let gated = false;
|
|
604
|
+
await this.commitGoalMutation(async () => {
|
|
605
|
+
if (!this.isCurrent(lane) || !this.deps.goalManager.matchesActive(lane.sessionId, checkpoint))
|
|
606
|
+
return;
|
|
607
|
+
if (this.deps.eventWait?.isGated(lane.sessionId)) {
|
|
608
|
+
gated = true;
|
|
609
|
+
return;
|
|
610
|
+
}
|
|
611
|
+
lane.evaluationAbort = evaluationAbort;
|
|
612
|
+
evaluationTask = evaluateGoal(this.deps.evaluator, goal.condition, context, lane.sessionId, evaluationAbort.signal);
|
|
613
|
+
});
|
|
614
|
+
if (!evaluationTask) {
|
|
615
|
+
if (gated)
|
|
616
|
+
await this.deps.eventWait.settleCompleted(lane.sessionId, turnId, controlLease);
|
|
562
617
|
return;
|
|
563
618
|
}
|
|
564
|
-
const evaluationAbort = new AbortController();
|
|
565
|
-
lane.evaluationAbort = evaluationAbort;
|
|
566
619
|
let evaluation;
|
|
567
620
|
try {
|
|
568
|
-
evaluation = await
|
|
621
|
+
evaluation = await evaluationTask;
|
|
569
622
|
}
|
|
570
623
|
finally {
|
|
571
624
|
if (lane.evaluationAbort === evaluationAbort)
|
|
572
625
|
lane.evaluationAbort = undefined;
|
|
573
626
|
}
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
627
|
+
await this.commitGoalMutation(async (durability) => {
|
|
628
|
+
if (!this.isCurrent(lane) || !this.deps.goalManager.matchesActive(lane.sessionId, checkpoint))
|
|
629
|
+
return;
|
|
630
|
+
if (this.deps.eventWait?.isGated(lane.sessionId)) {
|
|
631
|
+
gated = true;
|
|
632
|
+
return;
|
|
633
|
+
}
|
|
634
|
+
const settlementBase = {
|
|
635
|
+
checkpoint,
|
|
636
|
+
reason: evaluation.reason,
|
|
637
|
+
};
|
|
638
|
+
let settled;
|
|
639
|
+
if (evaluation.met || evaluation.impossible) {
|
|
640
|
+
settled = this.deps.goalManager.settleTurn(lane.sessionId, {
|
|
641
|
+
...settlementBase,
|
|
642
|
+
verdict: evaluation.met ? 'achieved' : 'impossible',
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
else if (evaluation.waiting) {
|
|
646
|
+
settled = this.deps.goalManager.settleTurn(lane.sessionId, {
|
|
647
|
+
...settlementBase,
|
|
648
|
+
verdict: 'continue',
|
|
649
|
+
waiting: true,
|
|
650
|
+
...(tokensNow !== undefined ? { tokensNow } : {}),
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
else {
|
|
654
|
+
settled = this.deps.goalManager.settleTurn(lane.sessionId, {
|
|
655
|
+
...settlementBase,
|
|
656
|
+
verdict: 'continue',
|
|
657
|
+
...(!evaluation.evaluatorFailed ? { madeProgress: evaluation.progress } : {}),
|
|
658
|
+
...(tokensNow !== undefined ? { tokensNow } : {}),
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
if (!settled)
|
|
662
|
+
return;
|
|
663
|
+
if (settled.status === 'achieved' || settled.status === 'impossible') {
|
|
664
|
+
lane.intent = undefined;
|
|
665
|
+
this.resetWaitingBackoff(lane);
|
|
666
|
+
this.taskGatePolicy.record({
|
|
667
|
+
sessionId: lane.sessionId,
|
|
668
|
+
turnId,
|
|
669
|
+
goalId: goal.id,
|
|
670
|
+
decision: 'evaluator_terminal',
|
|
671
|
+
taskKeys: [],
|
|
672
|
+
});
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
if (settled.status !== 'active' && settled.status !== 'waiting') {
|
|
676
|
+
lane.intent = undefined;
|
|
677
|
+
this.resetWaitingBackoff(lane);
|
|
678
|
+
const taskKeys = await this.taskGatePolicy.listActionable(lane.sessionId);
|
|
679
|
+
this.taskGatePolicy.record({
|
|
680
|
+
sessionId: lane.sessionId,
|
|
681
|
+
turnId,
|
|
682
|
+
goalId: goal.id,
|
|
683
|
+
decision: 'goal_stopped',
|
|
684
|
+
taskKeys,
|
|
685
|
+
});
|
|
686
|
+
return;
|
|
687
|
+
}
|
|
688
|
+
lane.intent = {
|
|
689
|
+
checkpoint: goalCheckpoint(settled),
|
|
690
|
+
controlLease,
|
|
691
|
+
triggeringTurnId: turnId,
|
|
692
|
+
evaluation,
|
|
693
|
+
};
|
|
694
|
+
const pendingPrompt = truncateGoalText(buildContinuationPrompt(settled, evaluation, undefined), GOAL_PENDING_PROMPT_TEXT_LIMIT);
|
|
695
|
+
await durability.recordPendingContinuation({
|
|
696
|
+
checkpoint: lane.intent.checkpoint,
|
|
697
|
+
controlLease,
|
|
698
|
+
prompt: pendingPrompt,
|
|
699
|
+
triggeringTurnId: turnId,
|
|
616
700
|
});
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
701
|
+
if (settled.status === 'waiting') {
|
|
702
|
+
lane.consecutiveWaits++;
|
|
703
|
+
return;
|
|
704
|
+
}
|
|
621
705
|
this.resetWaitingBackoff(lane);
|
|
622
|
-
const taskKeys = await this.taskGatePolicy.listActionable(lane.sessionId);
|
|
623
|
-
this.taskGatePolicy.record({
|
|
624
|
-
sessionId: lane.sessionId,
|
|
625
|
-
turnId,
|
|
626
|
-
goalId: goal.id,
|
|
627
|
-
decision: 'goal_stopped',
|
|
628
|
-
taskKeys,
|
|
629
|
-
});
|
|
630
|
-
return;
|
|
631
|
-
}
|
|
632
|
-
lane.intent = {
|
|
633
|
-
checkpoint: goalCheckpoint(settled),
|
|
634
|
-
controlLease,
|
|
635
|
-
triggeringTurnId: turnId,
|
|
636
|
-
evaluation,
|
|
637
|
-
};
|
|
638
|
-
const pendingPrompt = truncateGoalText(buildContinuationPrompt(settled, evaluation, undefined), GOAL_PENDING_PROMPT_TEXT_LIMIT);
|
|
639
|
-
await this.deps.durability.recordPendingContinuation({
|
|
640
|
-
checkpoint: lane.intent.checkpoint,
|
|
641
|
-
controlLease,
|
|
642
|
-
prompt: pendingPrompt,
|
|
643
|
-
triggeringTurnId: turnId,
|
|
644
706
|
});
|
|
645
|
-
if (
|
|
646
|
-
lane.
|
|
647
|
-
return;
|
|
648
|
-
}
|
|
649
|
-
this.resetWaitingBackoff(lane);
|
|
707
|
+
if (gated)
|
|
708
|
+
await this.deps.eventWait.settleCompleted(lane.sessionId, turnId, controlLease);
|
|
650
709
|
}
|
|
651
710
|
async tryAdmitIntent(lane, intent) {
|
|
652
711
|
if (this.handoffHeld ||
|
|
@@ -655,6 +714,11 @@ export class GoalContinuationCoordinator {
|
|
|
655
714
|
lane.intent !== intent) {
|
|
656
715
|
return;
|
|
657
716
|
}
|
|
717
|
+
if (this.deps.eventWait?.isGated(lane.sessionId) && !intent.eventWait) {
|
|
718
|
+
lane.intent = undefined;
|
|
719
|
+
this.clearWaitingTimer(lane);
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
658
722
|
if (!this.ownedGoal(lane, intent)) {
|
|
659
723
|
lane.intent = undefined;
|
|
660
724
|
return;
|
|
@@ -671,10 +735,12 @@ export class GoalContinuationCoordinator {
|
|
|
671
735
|
lane.intent = undefined;
|
|
672
736
|
return;
|
|
673
737
|
}
|
|
674
|
-
const prompt = intent.recoveredPrompt
|
|
675
|
-
?
|
|
676
|
-
:
|
|
677
|
-
|
|
738
|
+
const prompt = intent.eventWait && intent.recoveredPrompt
|
|
739
|
+
? intent.recoveredPrompt
|
|
740
|
+
: intent.recoveredPrompt
|
|
741
|
+
? attachTaskReminder(intent.recoveredPrompt, taskPlan.reminder)
|
|
742
|
+
: buildContinuationPrompt(goal, intent.evaluation, taskPlan.reminder);
|
|
743
|
+
const admission = this.deps.admitTurn(lane.sessionId, prompt, intent.checkpoint, intent.controlLease, intent.eventWait);
|
|
678
744
|
if (admission.kind === 'busy') {
|
|
679
745
|
this.watchBusyLane(lane, admission.whenIdle);
|
|
680
746
|
return;
|
|
@@ -692,11 +758,12 @@ export class GoalContinuationCoordinator {
|
|
|
692
758
|
controlLease: intent.controlLease,
|
|
693
759
|
};
|
|
694
760
|
lane.turns.set(admission.turnId, registration);
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
761
|
+
if (!intent.eventWait)
|
|
762
|
+
await this.deps.durability.recordCurrentExecution({
|
|
763
|
+
execution: admission.execution,
|
|
764
|
+
checkpoint: intent.checkpoint,
|
|
765
|
+
controlLease: intent.controlLease,
|
|
766
|
+
});
|
|
700
767
|
let completion;
|
|
701
768
|
try {
|
|
702
769
|
completion = admission.start();
|
|
@@ -710,6 +777,12 @@ export class GoalContinuationCoordinator {
|
|
|
710
777
|
return;
|
|
711
778
|
}
|
|
712
779
|
void completion.then((outcome) => {
|
|
780
|
+
if (outcome.kind === 'deferred') {
|
|
781
|
+
// No Root was admitted. The durable event outbox owns the retry;
|
|
782
|
+
// authorization waiting must not settle or charge a work Turn.
|
|
783
|
+
this.consumeTurnRegistration(registration);
|
|
784
|
+
return;
|
|
785
|
+
}
|
|
713
786
|
void this.settleRegisteredTurn(registration, outcome).catch(() => undefined);
|
|
714
787
|
}, (error) => {
|
|
715
788
|
void this.settleRegisteredTurn(registration, {
|
|
@@ -750,7 +823,11 @@ export class GoalContinuationCoordinator {
|
|
|
750
823
|
return this.deps.goalManager.get(lane.sessionId);
|
|
751
824
|
}
|
|
752
825
|
scheduleWaitingRetry(lane, goal) {
|
|
753
|
-
if (this.handoffHeld ||
|
|
826
|
+
if (this.handoffHeld ||
|
|
827
|
+
!this.isCurrent(lane) ||
|
|
828
|
+
lane.waitingTimer ||
|
|
829
|
+
!lane.intent ||
|
|
830
|
+
this.deps.eventWait?.isGated(lane.sessionId))
|
|
754
831
|
return;
|
|
755
832
|
if (!this.deps.goalManager.matches(lane.sessionId, lane.intent.checkpoint)) {
|
|
756
833
|
lane.intent = undefined;
|
|
@@ -761,25 +838,26 @@ export class GoalContinuationCoordinator {
|
|
|
761
838
|
const delayMs = waitBackoffMs(lane.consecutiveWaits);
|
|
762
839
|
const handle = this.scheduler.setTimeout(() => {
|
|
763
840
|
lane.waitingTimer = undefined;
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
.recordPendingContinuation({
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
841
|
+
void this.commitGoalMutation(async (durability) => {
|
|
842
|
+
if (!this.isCurrent(lane) || this.deps.eventWait?.isGated(lane.sessionId))
|
|
843
|
+
return;
|
|
844
|
+
if (lane.queue.length > 0) {
|
|
845
|
+
this.scheduleDrain(lane);
|
|
846
|
+
return;
|
|
847
|
+
}
|
|
848
|
+
const woken = this.deps.goalManager.wakeWaiting(lane.sessionId, checkpoint);
|
|
849
|
+
if (!woken || !lane.intent)
|
|
850
|
+
return;
|
|
851
|
+
lane.intent = { ...lane.intent, checkpoint: goalCheckpoint(woken) };
|
|
852
|
+
await durability.recordPendingContinuation({
|
|
853
|
+
checkpoint: lane.intent.checkpoint,
|
|
854
|
+
controlLease: lane.intent.controlLease,
|
|
855
|
+
prompt: lane.intent.recoveredPrompt ??
|
|
856
|
+
buildContinuationPrompt(woken, lane.intent.evaluation, undefined),
|
|
857
|
+
...(lane.intent.triggeringTurnId
|
|
858
|
+
? { triggeringTurnId: lane.intent.triggeringTurnId }
|
|
859
|
+
: {}),
|
|
860
|
+
});
|
|
783
861
|
})
|
|
784
862
|
.then(() => this.deps.durability.flush(lane.sessionId))
|
|
785
863
|
.then(() => this.scheduleDrain(lane))
|
|
@@ -184,6 +184,14 @@ export class GoalManager {
|
|
|
184
184
|
controlLease: Object.freeze({ ...controlLease }),
|
|
185
185
|
});
|
|
186
186
|
}
|
|
187
|
+
adoptAuthority(goal, controlLease) {
|
|
188
|
+
if (goal.id !== controlLease.goalId)
|
|
189
|
+
throw new Error('Invalid Goal authority');
|
|
190
|
+
this.goals.set(goal.sessionId, {
|
|
191
|
+
state: Object.freeze({ ...goal }),
|
|
192
|
+
controlLease: Object.freeze({ ...controlLease }),
|
|
193
|
+
});
|
|
194
|
+
}
|
|
187
195
|
matchesControlLease(sessionId, lease) {
|
|
188
196
|
return sameGoalControlLease(this.goals.get(sessionId)?.controlLease, lease);
|
|
189
197
|
}
|
|
@@ -214,9 +214,8 @@ export function canReplayHistoryCompactCheckpointForModel(checkpoint, connection
|
|
|
214
214
|
}
|
|
215
215
|
/** Whether this model's configured compactor can roll forward from this checkpoint value. */
|
|
216
216
|
export function canContinueHistoryCompactCheckpointForModel(checkpoint, connection, connectionId, modelId) {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
}
|
|
217
|
+
// Portable text is ordinary model context for both replay and compaction.
|
|
218
|
+
// Only opaque provider state needs a matching route.
|
|
220
219
|
return canReplayHistoryCompactCheckpointForModel(checkpoint, connection, connectionId, modelId);
|
|
221
220
|
}
|
|
222
221
|
export function historyCompactCheckpointToRuntimeEvent(checkpoint) {
|
|
@@ -330,6 +329,27 @@ export function canReplaceHistoryCompactCheckpoint(current, candidate) {
|
|
|
330
329
|
(!current.source || sameHistoryCompactSourceCoverage(current.source, candidate.source)));
|
|
331
330
|
}
|
|
332
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) {
|
|
333
353
|
if (!validateHistoryCompactCheckpointShape(checkpoint)) {
|
|
334
354
|
return {
|
|
335
355
|
coveredEventCount: 0,
|
|
@@ -543,7 +563,17 @@ function effectiveDigestEvent(event) {
|
|
|
543
563
|
}
|
|
544
564
|
/** True when the event carries model-visible content the compact projection counts. */
|
|
545
565
|
export function isHistoryCompactContentEvent(event) {
|
|
546
|
-
|
|
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;
|
|
547
577
|
}
|
|
548
578
|
function validHistoryCompactProviderState(value) {
|
|
549
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
|
|
@@ -95,7 +95,6 @@ export function buildMemoryExtractionTriggerTools(input) {
|
|
|
95
95
|
description: 'Use only when the user explicitly asks you to remember long-term information. It stores the requested memory and returns exactly what was saved.',
|
|
96
96
|
parameters: noArguments,
|
|
97
97
|
executionSemantics: 'exclusive_step',
|
|
98
|
-
recoveryMode: 'idempotent',
|
|
99
98
|
impl: async (_args, context) => {
|
|
100
99
|
const gate = await input.capabilities.gate();
|
|
101
100
|
if (!gate.allowed)
|
|
@@ -117,7 +116,6 @@ export function buildMemoryExtractionTriggerTools(input) {
|
|
|
117
116
|
name: MEMORY_EXTRACT_TOOL_NAME,
|
|
118
117
|
description: 'Use when the conversation contains durable long-term information worth preserving and the user did not explicitly ask to remember it. The extraction runs after this turn.',
|
|
119
118
|
parameters: noArguments,
|
|
120
|
-
recoveryMode: 'idempotent',
|
|
121
119
|
impl: async (_args, context) => {
|
|
122
120
|
const gate = await input.capabilities.gate();
|
|
123
121
|
if (!gate.allowed)
|
|
@@ -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
|
}
|