@namzu/sdk 49.0.0 → 50.0.0
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/CHANGELOG.md +507 -0
- package/README.md +137 -125
- package/dist/agents/QueryAgent.d.ts.map +1 -1
- package/dist/agents/QueryAgent.js +1 -0
- package/dist/agents/QueryAgent.js.map +1 -1
- package/dist/agents/examples/SupervisorAgent.d.ts.map +1 -1
- package/dist/agents/examples/SupervisorAgent.js +1 -0
- package/dist/agents/examples/SupervisorAgent.js.map +1 -1
- package/dist/agents/runAgent.d.ts +2 -0
- package/dist/agents/runAgent.d.ts.map +1 -1
- package/dist/agents/runAgent.js +1 -0
- package/dist/agents/runAgent.js.map +1 -1
- package/dist/authorization/shell-lexer.d.ts.map +1 -1
- package/dist/authorization/shell-lexer.js +16 -1
- package/dist/authorization/shell-lexer.js.map +1 -1
- package/dist/bridge/acp/permission.d.ts +8 -2
- package/dist/bridge/acp/permission.d.ts.map +1 -1
- package/dist/bridge/acp/permission.js +1 -0
- package/dist/bridge/acp/permission.js.map +1 -1
- package/dist/bridge/acp/server.d.ts +25 -1
- package/dist/bridge/acp/server.d.ts.map +1 -1
- package/dist/bridge/acp/server.js +205 -21
- package/dist/bridge/acp/server.js.map +1 -1
- package/dist/bridge/acp/tasks.d.ts +5 -0
- package/dist/bridge/acp/tasks.d.ts.map +1 -0
- package/dist/bridge/acp/tasks.js +19 -0
- package/dist/bridge/acp/tasks.js.map +1 -0
- package/dist/bridge/acp/update.d.ts.map +1 -1
- package/dist/bridge/acp/update.js +148 -13
- package/dist/bridge/acp/update.js.map +1 -1
- package/dist/config/runtime.d.ts +31 -31
- package/dist/connector/mcp/adapter.d.ts.map +1 -1
- package/dist/connector/mcp/adapter.js +11 -4
- package/dist/connector/mcp/adapter.js.map +1 -1
- package/dist/connector/mcp/client.d.ts.map +1 -1
- package/dist/connector/mcp/client.js +6 -3
- package/dist/connector/mcp/client.js.map +1 -1
- package/dist/constants/acp/index.d.ts +3 -0
- package/dist/constants/acp/index.d.ts.map +1 -1
- package/dist/constants/acp/index.js +3 -0
- package/dist/constants/acp/index.js.map +1 -1
- package/dist/contracts/a2a.d.ts +80 -80
- package/dist/contracts/schemas.d.ts +2 -2
- package/dist/contracts/session/schemas.d.ts +10 -10
- package/dist/manager/agent/lifecycle.d.ts +11 -0
- package/dist/manager/agent/lifecycle.d.ts.map +1 -1
- package/dist/manager/agent/lifecycle.js +178 -3
- package/dist/manager/agent/lifecycle.js.map +1 -1
- package/dist/manager/plan/lifecycle.d.ts +7 -8
- package/dist/manager/plan/lifecycle.d.ts.map +1 -1
- package/dist/manager/plan/lifecycle.js +7 -8
- package/dist/manager/plan/lifecycle.js.map +1 -1
- package/dist/manager/resident/consumption.d.ts +8 -8
- package/dist/manager/resident/learning-cycle.d.ts +2 -2
- package/dist/manager/resident/learning-observation.d.ts +12 -12
- package/dist/manager/resident/learning.d.ts +82 -82
- package/dist/manager/resident/outbox.d.ts +8 -8
- package/dist/manager/resident/proposal.d.ts +2 -2
- package/dist/manager/resident/store.d.ts +10 -10
- package/dist/manager/session/attribution.d.ts +1 -0
- package/dist/manager/session/attribution.d.ts.map +1 -1
- package/dist/manager/session/attribution.js +9 -1
- package/dist/manager/session/attribution.js.map +1 -1
- package/dist/manager/session/streamed-message-identity.d.ts +6 -0
- package/dist/manager/session/streamed-message-identity.d.ts.map +1 -0
- package/dist/manager/session/streamed-message-identity.js +14 -0
- package/dist/manager/session/streamed-message-identity.js.map +1 -0
- package/dist/manager/session/turn-recorder.d.ts.map +1 -1
- package/dist/manager/session/turn-recorder.js +4 -3
- package/dist/manager/session/turn-recorder.js.map +1 -1
- package/dist/pals/activity/causality.d.ts +23 -0
- package/dist/pals/activity/causality.d.ts.map +1 -0
- package/dist/pals/activity/causality.js +205 -0
- package/dist/pals/activity/causality.js.map +1 -0
- package/dist/pals/activity/projection.d.ts +5 -0
- package/dist/pals/activity/projection.d.ts.map +1 -0
- package/dist/pals/activity/projection.js +79 -0
- package/dist/pals/activity/projection.js.map +1 -0
- package/dist/pals/activity/source.d.ts +16 -0
- package/dist/pals/activity/source.d.ts.map +1 -0
- package/dist/pals/activity/source.js +235 -0
- package/dist/pals/activity/source.js.map +1 -0
- package/dist/pals/activity/subscription-policy.d.ts +38 -0
- package/dist/pals/activity/subscription-policy.d.ts.map +1 -0
- package/dist/pals/activity/subscription-policy.js +183 -0
- package/dist/pals/activity/subscription-policy.js.map +1 -0
- package/dist/pals/activity/subscription-schema.d.ts +353 -0
- package/dist/pals/activity/subscription-schema.d.ts.map +1 -0
- package/dist/pals/activity/subscription-schema.js +24 -0
- package/dist/pals/activity/subscription-schema.js.map +1 -0
- package/dist/pals/activity/subscription-store.d.ts +25 -0
- package/dist/pals/activity/subscription-store.d.ts.map +1 -0
- package/dist/pals/activity/subscription-store.js +152 -0
- package/dist/pals/activity/subscription-store.js.map +1 -0
- package/dist/pals/activity/subscription-types.d.ts +42 -0
- package/dist/pals/activity/subscription-types.d.ts.map +1 -0
- package/dist/pals/activity/subscription-types.js +2 -0
- package/dist/pals/activity/subscription-types.js.map +1 -0
- package/dist/pals/activity/subscriptions.d.ts +32 -0
- package/dist/pals/activity/subscriptions.d.ts.map +1 -0
- package/dist/pals/activity/subscriptions.js +151 -0
- package/dist/pals/activity/subscriptions.js.map +1 -0
- package/dist/pals/activity/types.d.ts +77 -0
- package/dist/pals/activity/types.d.ts.map +1 -0
- package/dist/pals/activity/types.js +2 -0
- package/dist/pals/activity/types.js.map +1 -0
- package/dist/pals/channels/ingress.d.ts +9 -0
- package/dist/pals/channels/ingress.d.ts.map +1 -0
- package/dist/pals/channels/ingress.js +131 -0
- package/dist/pals/channels/ingress.js.map +1 -0
- package/dist/pals/channels/routes.d.ts +20 -0
- package/dist/pals/channels/routes.d.ts.map +1 -0
- package/dist/pals/channels/routes.js +111 -0
- package/dist/pals/channels/routes.js.map +1 -0
- package/dist/pals/channels/routing.d.ts +37 -0
- package/dist/pals/channels/routing.d.ts.map +1 -0
- package/dist/pals/channels/routing.js +150 -0
- package/dist/pals/channels/routing.js.map +1 -0
- package/dist/pals/channels/schema.d.ts +234 -0
- package/dist/pals/channels/schema.d.ts.map +1 -0
- package/dist/pals/channels/schema.js +94 -0
- package/dist/pals/channels/schema.js.map +1 -0
- package/dist/pals/channels/types.d.ts +115 -0
- package/dist/pals/channels/types.d.ts.map +1 -0
- package/dist/pals/channels/types.js +2 -0
- package/dist/pals/channels/types.js.map +1 -0
- package/dist/pals/communication/broker.d.ts +8 -0
- package/dist/pals/communication/broker.d.ts.map +1 -0
- package/dist/pals/communication/broker.js +121 -0
- package/dist/pals/communication/broker.js.map +1 -0
- package/dist/pals/communication/dispatch.d.ts +4 -0
- package/dist/pals/communication/dispatch.d.ts.map +1 -0
- package/dist/pals/communication/dispatch.js +57 -0
- package/dist/pals/communication/dispatch.js.map +1 -0
- package/dist/pals/communication/inbound.d.ts +9 -0
- package/dist/pals/communication/inbound.d.ts.map +1 -0
- package/dist/pals/communication/inbound.js +155 -0
- package/dist/pals/communication/inbound.js.map +1 -0
- package/dist/pals/communication/ingress-dispatch.d.ts +5 -0
- package/dist/pals/communication/ingress-dispatch.d.ts.map +1 -0
- package/dist/pals/communication/ingress-dispatch.js +51 -0
- package/dist/pals/communication/ingress-dispatch.js.map +1 -0
- package/dist/pals/communication/ingress-inbound.d.ts +9 -0
- package/dist/pals/communication/ingress-inbound.d.ts.map +1 -0
- package/dist/pals/communication/ingress-inbound.js +222 -0
- package/dist/pals/communication/ingress-inbound.js.map +1 -0
- package/dist/pals/communication/ingress-schema.d.ts +7829 -0
- package/dist/pals/communication/ingress-schema.d.ts.map +1 -0
- package/dist/pals/communication/ingress-schema.js +479 -0
- package/dist/pals/communication/ingress-schema.js.map +1 -0
- package/dist/pals/communication/ingress-types.d.ts +187 -0
- package/dist/pals/communication/ingress-types.d.ts.map +1 -0
- package/dist/pals/communication/ingress-types.js +73 -0
- package/dist/pals/communication/ingress-types.js.map +1 -0
- package/dist/pals/communication/operator.d.ts +75 -0
- package/dist/pals/communication/operator.d.ts.map +1 -0
- package/dist/pals/communication/operator.js +217 -0
- package/dist/pals/communication/operator.js.map +1 -0
- package/dist/pals/communication/policy.d.ts +41 -0
- package/dist/pals/communication/policy.d.ts.map +1 -0
- package/dist/pals/communication/policy.js +138 -0
- package/dist/pals/communication/policy.js.map +1 -0
- package/dist/pals/communication/schema.d.ts +2000 -0
- package/dist/pals/communication/schema.d.ts.map +1 -0
- package/dist/pals/communication/schema.js +170 -0
- package/dist/pals/communication/schema.js.map +1 -0
- package/dist/pals/communication/store.d.ts +61 -0
- package/dist/pals/communication/store.d.ts.map +1 -0
- package/dist/pals/communication/store.js +450 -0
- package/dist/pals/communication/store.js.map +1 -0
- package/dist/pals/communication/tools.d.ts +23 -0
- package/dist/pals/communication/tools.d.ts.map +1 -0
- package/dist/pals/communication/tools.js +107 -0
- package/dist/pals/communication/tools.js.map +1 -0
- package/dist/pals/communication/types.d.ts +168 -0
- package/dist/pals/communication/types.d.ts.map +1 -0
- package/dist/pals/communication/types.js +24 -0
- package/dist/pals/communication/types.js.map +1 -0
- package/dist/pals/communication/verify.d.ts +22 -0
- package/dist/pals/communication/verify.d.ts.map +1 -0
- package/dist/pals/communication/verify.js +142 -0
- package/dist/pals/communication/verify.js.map +1 -0
- package/dist/pals/lifecycle.d.ts +37 -0
- package/dist/pals/lifecycle.d.ts.map +1 -0
- package/dist/pals/lifecycle.js +22 -0
- package/dist/pals/lifecycle.js.map +1 -0
- package/dist/pals/prompt.d.ts +30 -0
- package/dist/pals/prompt.d.ts.map +1 -0
- package/dist/pals/prompt.js +65 -0
- package/dist/pals/prompt.js.map +1 -0
- package/dist/pals/reference-images.d.ts +44 -0
- package/dist/pals/reference-images.d.ts.map +1 -0
- package/dist/pals/reference-images.js +248 -0
- package/dist/pals/reference-images.js.map +1 -0
- package/dist/pals/runtime.d.ts +46 -0
- package/dist/pals/runtime.d.ts.map +1 -0
- package/dist/pals/runtime.js +624 -0
- package/dist/pals/runtime.js.map +1 -0
- package/dist/pals/store.d.ts +26 -0
- package/dist/pals/store.d.ts.map +1 -0
- package/dist/pals/store.js +334 -0
- package/dist/pals/store.js.map +1 -0
- package/dist/pals/types.d.ts +145 -0
- package/dist/pals/types.d.ts.map +1 -0
- package/dist/pals/types.js +2 -0
- package/dist/pals/types.js.map +1 -0
- package/dist/peers/envelope.js +1 -1
- package/dist/peers/envelope.js.map +1 -1
- package/dist/peers/protocol.d.ts +83 -83
- package/dist/peers/record.d.ts +10 -10
- package/dist/plugin/shell-hook.d.ts.map +1 -1
- package/dist/plugin/shell-hook.js +7 -2
- package/dist/plugin/shell-hook.js.map +1 -1
- package/dist/process/kill-tree.d.ts.map +1 -1
- package/dist/process/kill-tree.js +9 -1
- package/dist/process/kill-tree.js.map +1 -1
- package/dist/provider/errors.d.ts +19 -0
- package/dist/provider/errors.d.ts.map +1 -1
- package/dist/provider/errors.js +123 -2
- package/dist/provider/errors.js.map +1 -1
- package/dist/public-runtime.d.ts +41 -13
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +35 -7
- package/dist/public-runtime.js.map +1 -1
- package/dist/public-tools.d.ts +8 -3
- package/dist/public-tools.d.ts.map +1 -1
- package/dist/public-tools.js +8 -3
- package/dist/public-tools.js.map +1 -1
- package/dist/public-types.d.ts +27 -7
- package/dist/public-types.d.ts.map +1 -1
- package/dist/registry/tool/presentation.d.ts +1 -0
- package/dist/registry/tool/presentation.d.ts.map +1 -1
- package/dist/registry/tool/presentation.js +9 -7
- package/dist/registry/tool/presentation.js.map +1 -1
- package/dist/runtime/harness-session/index.d.ts +5 -0
- package/dist/runtime/harness-session/index.d.ts.map +1 -0
- package/dist/runtime/harness-session/index.js +928 -0
- package/dist/runtime/harness-session/index.js.map +1 -0
- package/dist/runtime/harness-session/journal.d.ts +37 -0
- package/dist/runtime/harness-session/journal.d.ts.map +1 -0
- package/dist/runtime/harness-session/journal.js +177 -0
- package/dist/runtime/harness-session/journal.js.map +1 -0
- package/dist/runtime/harness-session/saved-view.d.ts +8 -0
- package/dist/runtime/harness-session/saved-view.d.ts.map +1 -0
- package/dist/runtime/harness-session/saved-view.js +112 -0
- package/dist/runtime/harness-session/saved-view.js.map +1 -0
- package/dist/runtime/jobs/awaited-jobs.d.ts +2 -1
- package/dist/runtime/jobs/awaited-jobs.d.ts.map +1 -1
- package/dist/runtime/jobs/awaited-jobs.js +2 -1
- package/dist/runtime/jobs/awaited-jobs.js.map +1 -1
- package/dist/runtime/jobs/registry.d.ts +56 -1
- package/dist/runtime/jobs/registry.d.ts.map +1 -1
- package/dist/runtime/jobs/registry.js +351 -34
- package/dist/runtime/jobs/registry.js.map +1 -1
- package/dist/runtime/query/abandon-turn.d.ts +12 -1
- package/dist/runtime/query/abandon-turn.d.ts.map +1 -1
- package/dist/runtime/query/abandon-turn.js +3 -1
- package/dist/runtime/query/abandon-turn.js.map +1 -1
- package/dist/runtime/query/checkpoint.d.ts +4 -0
- package/dist/runtime/query/checkpoint.d.ts.map +1 -1
- package/dist/runtime/query/checkpoint.js +10 -0
- package/dist/runtime/query/checkpoint.js.map +1 -1
- package/dist/runtime/query/durable-inbound.d.ts +5 -0
- package/dist/runtime/query/durable-inbound.d.ts.map +1 -0
- package/dist/runtime/query/durable-inbound.js +89 -0
- package/dist/runtime/query/durable-inbound.js.map +1 -0
- package/dist/runtime/query/events.d.ts +4 -0
- package/dist/runtime/query/events.d.ts.map +1 -1
- package/dist/runtime/query/events.js +22 -5
- package/dist/runtime/query/events.js.map +1 -1
- package/dist/runtime/query/executor/tool-call-admission.d.ts +5 -1
- package/dist/runtime/query/executor/tool-call-admission.d.ts.map +1 -1
- package/dist/runtime/query/executor/tool-call-admission.js +85 -13
- package/dist/runtime/query/executor/tool-call-admission.js.map +1 -1
- package/dist/runtime/query/executor.d.ts +41 -18
- package/dist/runtime/query/executor.d.ts.map +1 -1
- package/dist/runtime/query/executor.js +227 -114
- package/dist/runtime/query/executor.js.map +1 -1
- package/dist/runtime/query/index.d.ts +3 -0
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/index.js +21 -4
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/runtime/query/iteration/index.d.ts +18 -6
- package/dist/runtime/query/iteration/index.d.ts.map +1 -1
- package/dist/runtime/query/iteration/index.js +144 -67
- package/dist/runtime/query/iteration/index.js.map +1 -1
- package/dist/runtime/query/iteration/outstanding-work.d.ts +9 -5
- package/dist/runtime/query/iteration/outstanding-work.d.ts.map +1 -1
- package/dist/runtime/query/iteration/outstanding-work.js +61 -6
- package/dist/runtime/query/iteration/outstanding-work.js.map +1 -1
- package/dist/runtime/query/iteration/phases/context.d.ts +4 -0
- package/dist/runtime/query/iteration/phases/context.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/context.js.map +1 -1
- package/dist/runtime/query/iteration/phases/tool-review.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/tool-review.js +99 -16
- package/dist/runtime/query/iteration/phases/tool-review.js.map +1 -1
- package/dist/runtime/query/observation-context.d.ts +2 -2
- package/dist/runtime/query/observation-context.d.ts.map +1 -1
- package/dist/runtime/query/observation-context.js +20 -13
- package/dist/runtime/query/observation-context.js.map +1 -1
- package/dist/runtime/query/prepare-turn.js +2 -2
- package/dist/runtime/query/prepare-turn.js.map +1 -1
- package/dist/runtime/query/prompt-cache.d.ts +1 -0
- package/dist/runtime/query/prompt-cache.d.ts.map +1 -1
- package/dist/runtime/query/prompt-cache.js +2 -0
- package/dist/runtime/query/prompt-cache.js.map +1 -1
- package/dist/runtime/query/prompt.d.ts +2 -0
- package/dist/runtime/query/prompt.d.ts.map +1 -1
- package/dist/runtime/query/prompt.js +23 -1
- package/dist/runtime/query/prompt.js.map +1 -1
- package/dist/runtime/query/repeat-call.d.ts +12 -3
- package/dist/runtime/query/repeat-call.d.ts.map +1 -1
- package/dist/runtime/query/repeat-call.js +33 -10
- package/dist/runtime/query/repeat-call.js.map +1 -1
- package/dist/runtime/query/resume-pending.d.ts +5 -6
- package/dist/runtime/query/resume-pending.d.ts.map +1 -1
- package/dist/runtime/query/resume-pending.js +30 -3
- package/dist/runtime/query/resume-pending.js.map +1 -1
- package/dist/runtime/query/resume-session.js +1 -1
- package/dist/runtime/query/resume-session.js.map +1 -1
- package/dist/runtime/query/review-policy.d.ts +8 -1
- package/dist/runtime/query/review-policy.d.ts.map +1 -1
- package/dist/runtime/query/review-policy.js +6 -0
- package/dist/runtime/query/review-policy.js.map +1 -1
- package/dist/runtime/query/saved-presentation.d.ts +13 -0
- package/dist/runtime/query/saved-presentation.d.ts.map +1 -0
- package/dist/runtime/query/saved-presentation.js +63 -0
- package/dist/runtime/query/saved-presentation.js.map +1 -0
- package/dist/runtime/query/steering.d.ts +6 -9
- package/dist/runtime/query/steering.d.ts.map +1 -1
- package/dist/runtime/query/steering.js.map +1 -1
- package/dist/runtime/query/tool-executions.d.ts +7 -3
- package/dist/runtime/query/tool-executions.d.ts.map +1 -1
- package/dist/runtime/query/tool-executions.js +89 -9
- package/dist/runtime/query/tool-executions.js.map +1 -1
- package/dist/runtime/query/tooling.d.ts +3 -1
- package/dist/runtime/query/tooling.d.ts.map +1 -1
- package/dist/runtime/query/tooling.js +3 -0
- package/dist/runtime/query/tooling.js.map +1 -1
- package/dist/scheduler/completion-inbox.d.ts +25 -1
- package/dist/scheduler/completion-inbox.d.ts.map +1 -1
- package/dist/scheduler/completion-inbox.js +102 -8
- package/dist/scheduler/completion-inbox.js.map +1 -1
- package/dist/scheduler/delegating.d.ts.map +1 -1
- package/dist/scheduler/delegating.js +5 -0
- package/dist/scheduler/delegating.js.map +1 -1
- package/dist/scheduler/local.d.ts.map +1 -1
- package/dist/scheduler/local.js +2 -0
- package/dist/scheduler/local.js.map +1 -1
- package/dist/session/summary/materialize.d.ts +10 -6
- package/dist/session/summary/materialize.d.ts.map +1 -1
- package/dist/session/summary/materialize.js +41 -8
- package/dist/session/summary/materialize.js.map +1 -1
- package/dist/store/budget/ledger.d.ts +9 -0
- package/dist/store/budget/ledger.d.ts.map +1 -1
- package/dist/store/budget/ledger.js +58 -6
- package/dist/store/budget/ledger.js.map +1 -1
- package/dist/store/evidence/index-page.d.ts +12 -12
- package/dist/store/evidence/source-text.d.ts +4 -4
- package/dist/store/session/disk.d.ts +9 -4
- package/dist/store/session/disk.d.ts.map +1 -1
- package/dist/store/session/disk.js +57 -11
- package/dist/store/session/disk.js.map +1 -1
- package/dist/store/session/memory.d.ts +5 -3
- package/dist/store/session/memory.d.ts.map +1 -1
- package/dist/store/session/memory.js +24 -7
- package/dist/store/session/memory.js.map +1 -1
- package/dist/store/session-log/core.d.ts +26 -6
- package/dist/store/session-log/core.d.ts.map +1 -1
- package/dist/store/session-log/core.js +61 -8
- package/dist/store/session-log/core.js.map +1 -1
- package/dist/store/session-log/disk.d.ts +2 -2
- package/dist/store/session-log/disk.d.ts.map +1 -1
- package/dist/store/session-log/disk.js +1 -0
- package/dist/store/session-log/disk.js.map +1 -1
- package/dist/store/session-log/fold.d.ts +7 -0
- package/dist/store/session-log/fold.d.ts.map +1 -1
- package/dist/store/session-log/fold.js +21 -0
- package/dist/store/session-log/fold.js.map +1 -1
- package/dist/store/session-log/index.d.ts +5 -3
- package/dist/store/session-log/index.d.ts.map +1 -1
- package/dist/store/session-log/index.js +3 -1
- package/dist/store/session-log/index.js.map +1 -1
- package/dist/store/session-log/memory.d.ts +1 -1
- package/dist/store/session-log/memory.d.ts.map +1 -1
- package/dist/store/session-log/memory.js +1 -0
- package/dist/store/session-log/memory.js.map +1 -1
- package/dist/store/session-log/spill.d.ts +10 -3
- package/dist/store/session-log/spill.d.ts.map +1 -1
- package/dist/store/session-log/spill.js +70 -5
- package/dist/store/session-log/spill.js.map +1 -1
- package/dist/store/session-log/structured-result.d.ts +21 -0
- package/dist/store/session-log/structured-result.d.ts.map +1 -0
- package/dist/store/session-log/structured-result.js +67 -0
- package/dist/store/session-log/structured-result.js.map +1 -0
- package/dist/store/task/disk.d.ts +11 -0
- package/dist/store/task/disk.d.ts.map +1 -1
- package/dist/store/task/disk.js +41 -2
- package/dist/store/task/disk.js.map +1 -1
- package/dist/store/task/memory.d.ts.map +1 -1
- package/dist/store/task/memory.js +15 -3
- package/dist/store/task/memory.js.map +1 -1
- package/dist/tools/admit-facts.d.ts +13 -0
- package/dist/tools/admit-facts.d.ts.map +1 -0
- package/dist/tools/admit-facts.js +142 -0
- package/dist/tools/admit-facts.js.map +1 -0
- package/dist/tools/builtins/bash.d.ts +4 -1
- package/dist/tools/builtins/bash.d.ts.map +1 -1
- package/dist/tools/builtins/bash.js +108 -22
- package/dist/tools/builtins/bash.js.map +1 -1
- package/dist/tools/builtins/browser.d.ts +10 -10
- package/dist/tools/builtins/computer-use.d.ts +90 -90
- package/dist/tools/builtins/edit.d.ts +17 -0
- package/dist/tools/builtins/edit.d.ts.map +1 -1
- package/dist/tools/builtins/edit.js +34 -0
- package/dist/tools/builtins/edit.js.map +1 -1
- package/dist/tools/builtins/file-write-result.d.ts.map +1 -1
- package/dist/tools/builtins/file-write-result.js +13 -0
- package/dist/tools/builtins/file-write-result.js.map +1 -1
- package/dist/tools/builtins/glob.d.ts.map +1 -1
- package/dist/tools/builtins/glob.js +12 -0
- package/dist/tools/builtins/glob.js.map +1 -1
- package/dist/tools/builtins/grep.d.ts.map +1 -1
- package/dist/tools/builtins/grep.js +14 -0
- package/dist/tools/builtins/grep.js.map +1 -1
- package/dist/tools/builtins/index.d.ts +2 -0
- package/dist/tools/builtins/index.d.ts.map +1 -1
- package/dist/tools/builtins/index.js +1 -0
- package/dist/tools/builtins/index.js.map +1 -1
- package/dist/tools/builtins/job.d.ts.map +1 -1
- package/dist/tools/builtins/job.js +4 -1
- package/dist/tools/builtins/job.js.map +1 -1
- package/dist/tools/builtins/lsp.d.ts +2 -2
- package/dist/tools/builtins/read-file.d.ts.map +1 -1
- package/dist/tools/builtins/read-file.js +49 -0
- package/dist/tools/builtins/read-file.js.map +1 -1
- package/dist/tools/builtins/view-image.d.ts +24 -0
- package/dist/tools/builtins/view-image.d.ts.map +1 -0
- package/dist/tools/builtins/view-image.js +385 -0
- package/dist/tools/builtins/view-image.js.map +1 -0
- package/dist/tools/builtins/wait-for-job-bounds.d.ts +2 -0
- package/dist/tools/builtins/wait-for-job-bounds.d.ts.map +1 -1
- package/dist/tools/builtins/wait-for-job-bounds.js +1 -0
- package/dist/tools/builtins/wait-for-job-bounds.js.map +1 -1
- package/dist/tools/builtins/wait-for-job.d.ts +2 -0
- package/dist/tools/builtins/wait-for-job.d.ts.map +1 -1
- package/dist/tools/builtins/wait-for-job.js +104 -6
- package/dist/tools/builtins/wait-for-job.js.map +1 -1
- package/dist/tools/builtins/write-file.d.ts.map +1 -1
- package/dist/tools/builtins/write-file.js +1 -0
- package/dist/tools/builtins/write-file.js.map +1 -1
- package/dist/tools/command-shell.d.ts +37 -2
- package/dist/tools/command-shell.d.ts.map +1 -1
- package/dist/tools/command-shell.js +100 -3
- package/dist/tools/command-shell.js.map +1 -1
- package/dist/tools/coordinator/agent.d.ts +9 -19
- package/dist/tools/coordinator/agent.d.ts.map +1 -1
- package/dist/tools/coordinator/agent.js.map +1 -1
- package/dist/tools/coordinator/index.d.ts.map +1 -1
- package/dist/tools/coordinator/index.js +127 -67
- package/dist/tools/coordinator/index.js.map +1 -1
- package/dist/tools/coordinator/wait-with-idle-bound.d.ts +2 -0
- package/dist/tools/coordinator/wait-with-idle-bound.d.ts.map +1 -1
- package/dist/tools/coordinator/wait-with-idle-bound.js +1 -1
- package/dist/tools/coordinator/wait-with-idle-bound.js.map +1 -1
- package/dist/tools/defineTool.d.ts.map +1 -1
- package/dist/tools/defineTool.js +4 -0
- package/dist/tools/defineTool.js.map +1 -1
- package/dist/tools/failure-facts.d.ts +8 -0
- package/dist/tools/failure-facts.d.ts.map +1 -0
- package/dist/tools/failure-facts.js +24 -0
- package/dist/tools/failure-facts.js.map +1 -0
- package/dist/tools/host-output.d.ts +24 -0
- package/dist/tools/host-output.d.ts.map +1 -0
- package/dist/tools/host-output.js +117 -0
- package/dist/tools/host-output.js.map +1 -0
- package/dist/tools/oem-code-pages.d.ts +8 -0
- package/dist/tools/oem-code-pages.d.ts.map +1 -0
- package/dist/tools/oem-code-pages.js +23 -0
- package/dist/tools/oem-code-pages.js.map +1 -0
- package/dist/tools/schedules/schedule-tool.d.ts.map +1 -1
- package/dist/tools/schedules/schedule-tool.js +35 -6
- package/dist/tools/schedules/schedule-tool.js.map +1 -1
- package/dist/tools/schedules/types.d.ts +23 -3
- package/dist/tools/schedules/types.d.ts.map +1 -1
- package/dist/tools/task/list.d.ts.map +1 -1
- package/dist/tools/task/list.js +14 -6
- package/dist/tools/task/list.js.map +1 -1
- package/dist/tools/task/present.d.ts.map +1 -1
- package/dist/tools/task/present.js +26 -6
- package/dist/tools/task/present.js.map +1 -1
- package/dist/tools/task/update.d.ts.map +1 -1
- package/dist/tools/task/update.js +12 -5
- package/dist/tools/task/update.js.map +1 -1
- package/dist/tools/text-window.d.ts +19 -0
- package/dist/tools/text-window.d.ts.map +1 -0
- package/dist/tools/text-window.js +83 -0
- package/dist/tools/text-window.js.map +1 -0
- package/dist/toolsets/manager.d.ts +11 -0
- package/dist/toolsets/manager.d.ts.map +1 -1
- package/dist/toolsets/manager.js +45 -1
- package/dist/toolsets/manager.js.map +1 -1
- package/dist/types/acp/index.d.ts +137 -1
- package/dist/types/acp/index.d.ts.map +1 -1
- package/dist/types/agent/base.d.ts +3 -0
- package/dist/types/agent/base.d.ts.map +1 -1
- package/dist/types/agent/manager.d.ts +8 -23
- package/dist/types/agent/manager.d.ts.map +1 -1
- package/dist/types/agent/scheduler.d.ts +10 -1
- package/dist/types/agent/scheduler.d.ts.map +1 -1
- package/dist/types/agent/task.d.ts +4 -0
- package/dist/types/agent/task.d.ts.map +1 -1
- package/dist/types/authorization/index.d.ts +30 -30
- package/dist/types/connector/mcp.d.ts +7 -0
- package/dist/types/connector/mcp.d.ts.map +1 -1
- package/dist/types/errors/catalog.d.ts.map +1 -1
- package/dist/types/errors/catalog.js +4 -2
- package/dist/types/errors/catalog.js.map +1 -1
- package/dist/types/harness/schema.d.ts +354 -0
- package/dist/types/harness/schema.d.ts.map +1 -0
- package/dist/types/harness/schema.js +203 -0
- package/dist/types/harness/schema.js.map +1 -0
- package/dist/types/harness/session.d.ts +278 -0
- package/dist/types/harness/session.d.ts.map +1 -0
- package/dist/types/harness/session.js +2 -0
- package/dist/types/harness/session.js.map +1 -0
- package/dist/types/hitl/index.d.ts +12 -0
- package/dist/types/hitl/index.d.ts.map +1 -1
- package/dist/types/hitl/index.js.map +1 -1
- package/dist/types/job/index.d.ts +47 -0
- package/dist/types/job/index.d.ts.map +1 -0
- package/dist/types/job/index.js +2 -0
- package/dist/types/job/index.js.map +1 -0
- package/dist/types/message/inbound-delivery.d.ts +44 -0
- package/dist/types/message/inbound-delivery.d.ts.map +1 -0
- package/dist/types/message/inbound-delivery.js +14 -0
- package/dist/types/message/inbound-delivery.js.map +1 -0
- package/dist/types/message/index.d.ts +4 -1
- package/dist/types/message/index.d.ts.map +1 -1
- package/dist/types/message/index.js +5 -1
- package/dist/types/message/index.js.map +1 -1
- package/dist/types/plugin/index.d.ts +6 -6
- package/dist/types/sandbox/index.d.ts +39 -2
- package/dist/types/sandbox/index.d.ts.map +1 -1
- package/dist/types/sandbox/index.js.map +1 -1
- package/dist/types/session/checkpoint.d.ts +24 -17
- package/dist/types/session/checkpoint.d.ts.map +1 -1
- package/dist/types/session/checkpoint.js +1 -0
- package/dist/types/session/checkpoint.js.map +1 -1
- package/dist/types/session/events.d.ts +23 -1
- package/dist/types/session/events.d.ts.map +1 -1
- package/dist/types/session/events.js.map +1 -1
- package/dist/types/session/records.d.ts +1514 -565
- package/dist/types/session/records.d.ts.map +1 -1
- package/dist/types/session/records.js +89 -1
- package/dist/types/session/records.js.map +1 -1
- package/dist/types/session/step.d.ts +2 -0
- package/dist/types/session/step.d.ts.map +1 -1
- package/dist/types/session/step.js.map +1 -1
- package/dist/types/session/store.d.ts +19 -10
- package/dist/types/session/store.d.ts.map +1 -1
- package/dist/types/session/tool-execution.d.ts +6 -0
- package/dist/types/session/tool-execution.d.ts.map +1 -1
- package/dist/types/structured-output/index.d.ts +12 -2
- package/dist/types/structured-output/index.d.ts.map +1 -1
- package/dist/types/summary/ref.d.ts +3 -1
- package/dist/types/summary/ref.d.ts.map +1 -1
- package/dist/types/tool/index.d.ts +32 -4
- package/dist/types/tool/index.d.ts.map +1 -1
- package/dist/types/tool/index.js.map +1 -1
- package/dist/types/tool/presentation.d.ts +106 -0
- package/dist/types/tool/presentation.d.ts.map +1 -1
- package/dist/utils/json-snapshot.d.ts +6 -2
- package/dist/utils/json-snapshot.d.ts.map +1 -1
- package/dist/utils/json-snapshot.js +19 -9
- package/dist/utils/json-snapshot.js.map +1 -1
- package/dist/utils/structured-result-json.d.ts +5 -0
- package/dist/utils/structured-result-json.d.ts.map +1 -0
- package/dist/utils/structured-result-json.js +10 -0
- package/dist/utils/structured-result-json.js.map +1 -0
- package/package.json +1 -1
- package/src/agents/QueryAgent.ts +1 -0
- package/src/agents/examples/SupervisorAgent.ts +1 -0
- package/src/agents/runAgent.ts +3 -0
- package/src/authorization/shell-lexer.ts +16 -1
- package/src/bridge/acp/permission.ts +17 -3
- package/src/bridge/acp/server.ts +271 -25
- package/src/bridge/acp/tasks.ts +23 -0
- package/src/bridge/acp/update.ts +167 -13
- package/src/connector/mcp/adapter.ts +16 -4
- package/src/connector/mcp/client.ts +6 -2
- package/src/constants/acp/index.ts +4 -0
- package/src/manager/agent/lifecycle.ts +230 -3
- package/src/manager/plan/lifecycle.ts +11 -9
- package/src/manager/session/attribution.ts +12 -2
- package/src/manager/session/streamed-message-identity.ts +21 -0
- package/src/manager/session/turn-recorder.ts +4 -3
- package/src/pals/activity/causality.ts +261 -0
- package/src/pals/activity/projection.ts +89 -0
- package/src/pals/activity/source.ts +240 -0
- package/src/pals/activity/subscription-policy.ts +230 -0
- package/src/pals/activity/subscription-schema.ts +27 -0
- package/src/pals/activity/subscription-store.ts +172 -0
- package/src/pals/activity/subscription-types.ts +48 -0
- package/src/pals/activity/subscriptions.ts +209 -0
- package/src/pals/activity/types.ts +108 -0
- package/src/pals/channels/ingress.ts +153 -0
- package/src/pals/channels/routes.ts +118 -0
- package/src/pals/channels/routing.ts +197 -0
- package/src/pals/channels/schema.ts +108 -0
- package/src/pals/channels/types.ts +156 -0
- package/src/pals/communication/broker.ts +131 -0
- package/src/pals/communication/dispatch.ts +66 -0
- package/src/pals/communication/inbound.ts +193 -0
- package/src/pals/communication/ingress-dispatch.ts +63 -0
- package/src/pals/communication/ingress-inbound.ts +269 -0
- package/src/pals/communication/ingress-schema.ts +526 -0
- package/src/pals/communication/ingress-types.ts +336 -0
- package/src/pals/communication/operator.ts +315 -0
- package/src/pals/communication/policy.ts +174 -0
- package/src/pals/communication/schema.ts +173 -0
- package/src/pals/communication/store.ts +577 -0
- package/src/pals/communication/tools.ts +139 -0
- package/src/pals/communication/types.ts +227 -0
- package/src/pals/communication/verify.ts +220 -0
- package/src/pals/lifecycle.ts +54 -0
- package/src/pals/prompt.ts +101 -0
- package/src/pals/reference-images.ts +322 -0
- package/src/pals/runtime.ts +670 -0
- package/src/pals/store.ts +369 -0
- package/src/pals/types.ts +157 -0
- package/src/peers/envelope.ts +1 -1
- package/src/plugin/shell-hook.ts +8 -2
- package/src/process/kill-tree.ts +10 -1
- package/src/provider/errors.ts +135 -2
- package/src/public-runtime.ts +117 -12
- package/src/public-tools.ts +13 -1
- package/src/public-types.ts +69 -7
- package/src/registry/tool/presentation.ts +9 -4
- package/src/runtime/harness-session/index.ts +1125 -0
- package/src/runtime/harness-session/journal.ts +209 -0
- package/src/runtime/harness-session/saved-view.ts +122 -0
- package/src/runtime/jobs/awaited-jobs.ts +2 -1
- package/src/runtime/jobs/registry.ts +397 -41
- package/src/runtime/query/abandon-turn.ts +18 -2
- package/src/runtime/query/checkpoint.ts +11 -0
- package/src/runtime/query/durable-inbound.ts +101 -0
- package/src/runtime/query/events.ts +22 -5
- package/src/runtime/query/executor/tool-call-admission.ts +125 -32
- package/src/runtime/query/executor.ts +316 -130
- package/src/runtime/query/index.ts +24 -4
- package/src/runtime/query/iteration/index.ts +218 -104
- package/src/runtime/query/iteration/outstanding-work.ts +55 -7
- package/src/runtime/query/iteration/phases/context.ts +4 -0
- package/src/runtime/query/iteration/phases/tool-review.ts +118 -21
- package/src/runtime/query/observation-context.ts +22 -16
- package/src/runtime/query/prepare-turn.ts +2 -2
- package/src/runtime/query/prompt-cache.ts +3 -0
- package/src/runtime/query/prompt.ts +32 -1
- package/src/runtime/query/repeat-call.ts +40 -10
- package/src/runtime/query/resume-pending.ts +60 -7
- package/src/runtime/query/resume-session.ts +1 -1
- package/src/runtime/query/review-policy.ts +23 -2
- package/src/runtime/query/saved-presentation.ts +70 -0
- package/src/runtime/query/steering.ts +6 -9
- package/src/runtime/query/tool-executions.ts +108 -9
- package/src/runtime/query/tooling.ts +6 -1
- package/src/scheduler/completion-inbox.ts +108 -7
- package/src/scheduler/delegating.ts +5 -0
- package/src/scheduler/local.ts +2 -0
- package/src/session/summary/materialize.ts +51 -9
- package/src/store/budget/ledger.ts +60 -5
- package/src/store/session/disk.ts +77 -10
- package/src/store/session/memory.ts +32 -7
- package/src/store/session-log/core.ts +118 -11
- package/src/store/session-log/disk.ts +9 -2
- package/src/store/session-log/fold.ts +22 -0
- package/src/store/session-log/index.ts +5 -0
- package/src/store/session-log/memory.ts +2 -1
- package/src/store/session-log/spill.ts +89 -6
- package/src/store/session-log/structured-result.ts +96 -0
- package/src/store/task/disk.ts +46 -2
- package/src/store/task/memory.ts +13 -3
- package/src/tools/admit-facts.ts +145 -0
- package/src/tools/builtins/bash.ts +132 -24
- package/src/tools/builtins/edit.ts +42 -0
- package/src/tools/builtins/file-write-result.ts +14 -0
- package/src/tools/builtins/glob.ts +12 -0
- package/src/tools/builtins/grep.ts +14 -0
- package/src/tools/builtins/index.ts +2 -0
- package/src/tools/builtins/job.ts +4 -1
- package/src/tools/builtins/read-file.ts +57 -0
- package/src/tools/builtins/view-image.ts +409 -0
- package/src/tools/builtins/wait-for-job-bounds.ts +3 -0
- package/src/tools/builtins/wait-for-job.ts +141 -32
- package/src/tools/builtins/write-file.ts +4 -2
- package/src/tools/command-shell.ts +132 -5
- package/src/tools/coordinator/agent.ts +9 -19
- package/src/tools/coordinator/index.ts +150 -75
- package/src/tools/coordinator/wait-with-idle-bound.ts +3 -1
- package/src/tools/defineTool.ts +4 -0
- package/src/tools/failure-facts.ts +24 -0
- package/src/tools/host-output.ts +136 -0
- package/src/tools/oem-code-pages.ts +22 -0
- package/src/tools/schedules/schedule-tool.ts +38 -5
- package/src/tools/schedules/types.ts +23 -3
- package/src/tools/task/list.ts +15 -7
- package/src/tools/task/present.ts +37 -7
- package/src/tools/task/update.ts +12 -5
- package/src/tools/text-window.ts +87 -0
- package/src/toolsets/manager.ts +58 -1
- package/src/types/acp/index.ts +150 -4
- package/src/types/agent/base.ts +3 -0
- package/src/types/agent/manager.ts +8 -23
- package/src/types/agent/scheduler.ts +10 -1
- package/src/types/agent/task.ts +4 -0
- package/src/types/connector/mcp.ts +7 -0
- package/src/types/errors/catalog.ts +4 -2
- package/src/types/harness/schema.ts +203 -0
- package/src/types/harness/session.ts +306 -0
- package/src/types/hitl/index.ts +17 -1
- package/src/types/job/index.ts +42 -0
- package/src/types/message/inbound-delivery.ts +63 -0
- package/src/types/message/index.ts +8 -1
- package/src/types/sandbox/index.ts +46 -0
- package/src/types/session/checkpoint.ts +4 -1
- package/src/types/session/events.ts +23 -1
- package/src/types/session/records.ts +114 -2
- package/src/types/session/step.ts +2 -0
- package/src/types/session/store.ts +23 -9
- package/src/types/session/tool-execution.ts +6 -0
- package/src/types/structured-output/index.ts +13 -2
- package/src/types/summary/ref.ts +3 -1
- package/src/types/tool/index.ts +39 -5
- package/src/types/tool/presentation.ts +121 -0
- package/src/utils/json-snapshot.ts +26 -9
- package/src/utils/structured-result-json.ts +10 -0
|
@@ -4,6 +4,7 @@ import { estimateMessageTokens } from '../../../compaction/token-estimate.js';
|
|
|
4
4
|
import { AUTO_CONTINUATION_USER_MESSAGE } from '../../../constants/continuation.js';
|
|
5
5
|
import { CHARS_PER_TOKEN } from '../../../constants/limits.js';
|
|
6
6
|
import { DEFAULT_STRUCTURED_OUTPUT_RETRIES, STRUCTURED_OUTPUT_REPROMPT, } from '../../../constants/tools/index.js';
|
|
7
|
+
import { withStreamedMessageIdentity } from '../../../manager/session/streamed-message-identity.js';
|
|
7
8
|
import { renderSkillsSection } from '../../../persona/assembler.js';
|
|
8
9
|
import { resolveProviderCapabilities } from '../../../provider/capabilities.js';
|
|
9
10
|
import { collectChatCompletion } from '../../../provider/collect-chat-completion.js';
|
|
@@ -18,14 +19,16 @@ import { classifyProviderError } from '../../../types/provider/errors.js';
|
|
|
18
19
|
import { toErrorMessage } from '../../../utils/error.js';
|
|
19
20
|
import { stableDigest } from '../../../utils/hash.js';
|
|
20
21
|
import { generateMessageId } from '../../../utils/id.js';
|
|
22
|
+
import { parseStructuredResultJson } from '../../../utils/structured-result-json.js';
|
|
21
23
|
import { createCallbackInference } from '../callback-inference.js';
|
|
24
|
+
import { deliverDurableInbound } from '../durable-inbound.js';
|
|
22
25
|
import { projectObservationContext } from '../observation-context.js';
|
|
23
26
|
import { applyLifecycleHookResults } from '../plugin-hooks.js';
|
|
24
27
|
import { diffRequestContext, snapshotRequestContext, } from '../request-context.js';
|
|
25
28
|
import { DEFAULT_MAX_REQUEST_RICH_CONTENT_BYTES, markProviderRejectedImage, projectRequestRichContent, } from '../request-rich-content.js';
|
|
26
29
|
import { formatSteeringNote, isOperatorUserMessage } from '../steering.js';
|
|
27
30
|
import { parseNativeCandidate } from './native-output.js';
|
|
28
|
-
import { holdForOutstandingWork, settleOutstandingWork } from './outstanding-work.js';
|
|
31
|
+
import { drainArrivedTaskCompletions, holdForOutstandingWork, settleOutstandingWork, } from './outstanding-work.js';
|
|
29
32
|
import { runAdvisoryPhase } from './phases/advisory.js';
|
|
30
33
|
import { runIterationCheckpoint } from './phases/checkpoint.js';
|
|
31
34
|
import { activeContextWindow, measureContext, relieveOverflow, runCompactionCheck, } from './phases/compaction.js';
|
|
@@ -90,7 +93,7 @@ export class IterationOrchestrator {
|
|
|
90
93
|
projectObservations(messages) {
|
|
91
94
|
const config = this.ctx.compactionConfig;
|
|
92
95
|
return config && config.strategy !== 'disabled' && config.deduplicateObservations !== false
|
|
93
|
-
? projectObservationContext(messages, this.ctx.tools, config.preserveToolResultsFrom)
|
|
96
|
+
? projectObservationContext(messages, this.ctx.tools, config.preserveToolResultsFrom, (call, message) => this.ctx.toolExecutor.recordedObservationKey(call, message))
|
|
94
97
|
: messages;
|
|
95
98
|
}
|
|
96
99
|
/** Rich tool blocks already reported; durable history is scanned every turn. */
|
|
@@ -112,6 +115,9 @@ export class IterationOrchestrator {
|
|
|
112
115
|
stopDeferredForOutstandingWork = false;
|
|
113
116
|
/** One current input, independent of the compactable history array. */
|
|
114
117
|
latestUserMessage;
|
|
118
|
+
initialDurableDelivered = false;
|
|
119
|
+
resumedToolResults = [];
|
|
120
|
+
toolStructuredCounterHydrated = false;
|
|
115
121
|
constructor(ctx) {
|
|
116
122
|
this.ctx = {
|
|
117
123
|
...ctx,
|
|
@@ -123,6 +129,9 @@ export class IterationOrchestrator {
|
|
|
123
129
|
ctx.checkpointMgr.setAnswerReviewAttemptsSource?.(() => this.answerReviewAttempts);
|
|
124
130
|
ctx.checkpointMgr.setStructuredReviewAttemptsSource?.(() => this.structuredReviewAttempts);
|
|
125
131
|
ctx.checkpointMgr.setNativeStructuredAttemptsSource?.(() => this.nativeStructuredAttempts);
|
|
132
|
+
ctx.checkpointMgr.setToolStructuredAttemptsSource?.(() => this.toolStructuredCounterHydrated
|
|
133
|
+
? this.toolStructuredAttempts
|
|
134
|
+
: (ctx.checkpointMgr.restoredToolStructuredAttempts ?? 0));
|
|
126
135
|
if (ctx.structuredOutput?.mode === 'native') {
|
|
127
136
|
const limit = ctx.structuredOutput.maxRetries;
|
|
128
137
|
if (limit !== undefined && (!Number.isSafeInteger(limit) || limit < 0))
|
|
@@ -132,6 +141,11 @@ export class IterationOrchestrator {
|
|
|
132
141
|
!['tool', 'native'].includes(ctx.structuredOutput.mode))
|
|
133
142
|
throw new RangeError('Unknown structuredOutput.mode');
|
|
134
143
|
const maxReviews = ctx.structuredOutput?.maxReviews;
|
|
144
|
+
const retention = ctx.structuredOutput?.toolResultRetention;
|
|
145
|
+
if (retention !== undefined && !['receipt', 'durable'].includes(retention))
|
|
146
|
+
throw new RangeError('Unknown structuredOutput.toolResultRetention');
|
|
147
|
+
if (retention === 'durable' && ctx.structuredOutput?.mode === 'native')
|
|
148
|
+
throw new RangeError('structuredOutput.toolResultRetention: durable requires tool mode');
|
|
135
149
|
if (maxReviews !== undefined && (!Number.isSafeInteger(maxReviews) || maxReviews < 0))
|
|
136
150
|
throw new RangeError('structuredOutput.maxReviews must be a nonnegative safe integer');
|
|
137
151
|
if (ctx.maxAnswerReviews !== undefined &&
|
|
@@ -208,15 +222,30 @@ export class IterationOrchestrator {
|
|
|
208
222
|
setRootSpan(span) {
|
|
209
223
|
this.ctx = { ...this.ctx, rootSpan: span };
|
|
210
224
|
}
|
|
225
|
+
/** Fresh input is recorded before guards; restored tool batches must finish first. */
|
|
226
|
+
async deliverInitialDurable() {
|
|
227
|
+
if (this.initialDurableDelivered)
|
|
228
|
+
return;
|
|
229
|
+
await deliverDurableInbound(this.ctx.recorder, this.ctx.durableInbound, this.ctx.abortController.signal);
|
|
230
|
+
this.initialDurableDelivered = true;
|
|
231
|
+
}
|
|
232
|
+
/** A restored pending batch must answer every owned call before consuming its correction. */
|
|
233
|
+
setResumedToolResults(results) {
|
|
234
|
+
this.resumedToolResults = results;
|
|
235
|
+
}
|
|
211
236
|
async *runLoop() {
|
|
212
237
|
const { turnConfig, recorder } = this.ctx;
|
|
213
238
|
const { model } = turnConfig;
|
|
214
239
|
const tracer = getTracer();
|
|
240
|
+
// Initial durable input arrives before checkpoints, plan gates or inference.
|
|
241
|
+
await this.deliverInitialDurable();
|
|
215
242
|
// Resume hydration happens after construction, before the loop starts.
|
|
216
243
|
this.latestUserMessage = this.ctx.checkpointMgr.restoredLatestUserMessage;
|
|
217
244
|
this.answerReviewAttempts = this.ctx.checkpointMgr.restoredAnswerReviewAttempts ?? 0;
|
|
218
245
|
this.structuredReviewAttempts = this.ctx.checkpointMgr.restoredStructuredReviewAttempts ?? 0;
|
|
219
246
|
this.nativeStructuredAttempts = this.ctx.checkpointMgr.restoredNativeStructuredAttempts ?? 0;
|
|
247
|
+
this.toolStructuredAttempts = this.ctx.checkpointMgr.restoredToolStructuredAttempts ?? 0;
|
|
248
|
+
this.toolStructuredCounterHydrated = true;
|
|
220
249
|
if (!this.latestUserMessage) {
|
|
221
250
|
for (const message of recorder.messages)
|
|
222
251
|
this.rememberUserMessage(message, false);
|
|
@@ -226,6 +255,9 @@ export class IterationOrchestrator {
|
|
|
226
255
|
// retained user turn encountered while scanning restored history.
|
|
227
256
|
for (const message of this.ctx.resumedInput ?? [])
|
|
228
257
|
this.rememberUserMessage(message);
|
|
258
|
+
const resumedToolResults = this.resumedToolResults;
|
|
259
|
+
this.resumedToolResults = [];
|
|
260
|
+
await this.recordToolStructuredFailure(resumedToolResults, recorder.currentIteration);
|
|
229
261
|
// What a recoverable failure pauses on when it lands before this
|
|
230
262
|
// loop wrote a checkpoint of its own: without it a 429 on the first
|
|
231
263
|
// request failed the turn, while the same 429 one request later
|
|
@@ -242,9 +274,6 @@ export class IterationOrchestrator {
|
|
|
242
274
|
// obvious moves left. It is cleared by a turn that actually
|
|
243
275
|
// succeeded, which is the evidence that the turn is no longer stuck.
|
|
244
276
|
let overflowRelieved = false;
|
|
245
|
-
const planSignal = yield* runPlanGate(this.ctx);
|
|
246
|
-
if (planSignal === 'stop')
|
|
247
|
-
return;
|
|
248
277
|
// A `finally` rather than a line at each exit, for the reason written
|
|
249
278
|
// beside `iterSpan.end()` below: this loop leaves by eight `break`s,
|
|
250
279
|
// two `return`s and a `throw`, and a rule every future edit has to
|
|
@@ -255,17 +284,20 @@ export class IterationOrchestrator {
|
|
|
255
284
|
// A `finally` also covers a generator abandoned by its consumer, which
|
|
256
285
|
// no post-loop block reaches.
|
|
257
286
|
try {
|
|
287
|
+
// Restored exhaustion precedes plan gates and any auxiliary inference.
|
|
288
|
+
if (this.stopForStructuredRetryExhaustion())
|
|
289
|
+
return;
|
|
290
|
+
const planSignal = yield* runPlanGate(this.ctx);
|
|
291
|
+
if (planSignal === 'stop')
|
|
292
|
+
return;
|
|
258
293
|
while (true) {
|
|
259
294
|
if (this.ctx.abortController.signal.aborted) {
|
|
260
295
|
recorder.setStopReason('cancelled');
|
|
261
296
|
recorder.markCancelled();
|
|
262
297
|
break;
|
|
263
298
|
}
|
|
264
|
-
if (this.
|
|
265
|
-
this.nativeStructuredAttempts > this.structuredOutputRetryLimit()) {
|
|
266
|
-
recorder.setStopReason('structured_output_failed');
|
|
299
|
+
if (this.stopForStructuredRetryExhaustion())
|
|
267
300
|
break;
|
|
268
|
-
}
|
|
269
301
|
if (this.ctx.reviewAnswer &&
|
|
270
302
|
this.answerReviewAttempts > (this.ctx.maxAnswerReviews ?? DEFAULT_ANSWER_REVIEW_LIMIT)) {
|
|
271
303
|
recorder.setStopReason('answer_rejected');
|
|
@@ -814,7 +846,7 @@ export class IterationOrchestrator {
|
|
|
814
846
|
// with the turn they belong to. Trimming therefore removes both;
|
|
815
847
|
// retaining them gives the target adapter enough evidence to
|
|
816
848
|
// validate native replay against the exact serving route.
|
|
817
|
-
const assistantMsg = createAssistantMessage(response.message.content, forceFinalize ? undefined : response.message.toolCalls, response.message.reasoning,
|
|
849
|
+
const assistantMsg = withStreamedMessageIdentity(createAssistantMessage(response.message.content, forceFinalize ? undefined : response.message.toolCalls, response.message.reasoning,
|
|
818
850
|
// Rides with the turn it belongs to, like reasoning does, so
|
|
819
851
|
// trimming or compacting the turn takes its evidence with it
|
|
820
852
|
// rather than leaving citations pointing at prose that is gone.
|
|
@@ -824,7 +856,7 @@ export class IterationOrchestrator {
|
|
|
824
856
|
...(response.message.replayState !== undefined
|
|
825
857
|
? { replayState: response.message.replayState }
|
|
826
858
|
: {}),
|
|
827
|
-
}, response.message.textParts);
|
|
859
|
+
}, response.message.textParts), messageId);
|
|
828
860
|
recorder.pushMessage(assistantMsg);
|
|
829
861
|
if (this.ctx.advisoryCtx && requestMessages) {
|
|
830
862
|
this.advisoryTurn = { iteration: iterationNum, requestMessages, response: assistantMsg };
|
|
@@ -965,7 +997,7 @@ export class IterationOrchestrator {
|
|
|
965
997
|
if (outcome === 'accepted') {
|
|
966
998
|
if (!forceFinalize) {
|
|
967
999
|
const changed = yield* holdForOutstandingWork(this.ctx, iterationNum, false, () => this.deliverInbound());
|
|
968
|
-
const inbound = this.deliverInbound();
|
|
1000
|
+
const inbound = await this.deliverInbound();
|
|
969
1001
|
if (changed || inbound > 0)
|
|
970
1002
|
continue;
|
|
971
1003
|
}
|
|
@@ -984,6 +1016,21 @@ export class IterationOrchestrator {
|
|
|
984
1016
|
}
|
|
985
1017
|
continue;
|
|
986
1018
|
}
|
|
1019
|
+
// Missing output and rejected model arguments share one durable
|
|
1020
|
+
// correction allowance, including prose cut off by the output cap.
|
|
1021
|
+
if (!forceFinalize && this.needsStructuredOutput()) {
|
|
1022
|
+
await this.recordToolStructuredCorrection(iterationNum);
|
|
1023
|
+
await this.ctx.emitEvent({
|
|
1024
|
+
type: 'iteration_completed',
|
|
1025
|
+
turnId: recorder.turnId,
|
|
1026
|
+
iteration: iterationNum,
|
|
1027
|
+
hasToolCalls: false,
|
|
1028
|
+
});
|
|
1029
|
+
yield* this.ctx.drainPending();
|
|
1030
|
+
if (this.stopForStructuredRetryExhaustion())
|
|
1031
|
+
break;
|
|
1032
|
+
continue;
|
|
1033
|
+
}
|
|
987
1034
|
const hasContent = response.message.content !== null && response.message.content.length > 0;
|
|
988
1035
|
// Auto-continuation on `stop_reason: max_tokens`. The
|
|
989
1036
|
// model hit its per-call output cap mid-text (NOT
|
|
@@ -1027,37 +1074,6 @@ export class IterationOrchestrator {
|
|
|
1027
1074
|
yield* this.ctx.drainPending();
|
|
1028
1075
|
continue;
|
|
1029
1076
|
}
|
|
1030
|
-
// The model tried to finish in prose while a structured
|
|
1031
|
-
// output was demanded. Send it back with the schema error
|
|
1032
|
-
// rather than returning an unusable result — this is the
|
|
1033
|
-
// re-prompt half, and it is bounded so a model that cannot
|
|
1034
|
-
// satisfy the schema fails loudly instead of looping.
|
|
1035
|
-
if (!forceFinalize && this.needsStructuredOutput()) {
|
|
1036
|
-
const attempt = ++this.structuredOutputAttempts;
|
|
1037
|
-
const limit = this.structuredOutputRetryLimit();
|
|
1038
|
-
if (attempt > limit) {
|
|
1039
|
-
this.ctx.log.warn('Structured output not produced within its retries', {
|
|
1040
|
-
[NAMZU.TURN_ID]: recorder.turnId,
|
|
1041
|
-
'namzu.runtime.attempts': attempt - 1,
|
|
1042
|
-
});
|
|
1043
|
-
recorder.setStopReason('structured_output_failed');
|
|
1044
|
-
break;
|
|
1045
|
-
}
|
|
1046
|
-
this.ctx.log.info('Re-prompting for structured output', {
|
|
1047
|
-
[NAMZU.TURN_ID]: recorder.turnId,
|
|
1048
|
-
'namzu.retry.attempt': attempt,
|
|
1049
|
-
'namzu.runtime.limit': limit,
|
|
1050
|
-
});
|
|
1051
|
-
recorder.pushMessage(createRuntimeContextMessage(STRUCTURED_OUTPUT_REPROMPT, 'structured-output'));
|
|
1052
|
-
await this.ctx.emitEvent({
|
|
1053
|
-
type: 'iteration_completed',
|
|
1054
|
-
turnId: recorder.turnId,
|
|
1055
|
-
iteration: iterationNum,
|
|
1056
|
-
hasToolCalls: false,
|
|
1057
|
-
});
|
|
1058
|
-
yield* this.ctx.drainPending();
|
|
1059
|
-
continue;
|
|
1060
|
-
}
|
|
1061
1077
|
// Let the host judge the ANSWER and hand back work.
|
|
1062
1078
|
//
|
|
1063
1079
|
// The stop predicate is only consulted after tools ran, so
|
|
@@ -1139,7 +1155,7 @@ export class IterationOrchestrator {
|
|
|
1139
1155
|
// After the outstanding-work hold above, so a delivery
|
|
1140
1156
|
// does not race a worker still finishing, and before the
|
|
1141
1157
|
// settle below, which is the last moment it can matter.
|
|
1142
|
-
if (!forceFinalize && this.deliverInbound() > 0) {
|
|
1158
|
+
if (!forceFinalize && (await this.deliverInbound()) > 0) {
|
|
1143
1159
|
await this.ctx.emitEvent({
|
|
1144
1160
|
type: 'iteration_completed',
|
|
1145
1161
|
turnId: recorder.turnId,
|
|
@@ -1217,6 +1233,7 @@ export class IterationOrchestrator {
|
|
|
1217
1233
|
if (reviewOutcome.decision === 'stop') {
|
|
1218
1234
|
return;
|
|
1219
1235
|
}
|
|
1236
|
+
const needsCorrection = await this.recordToolStructuredFailure(reviewOutcome.results, iterationNum);
|
|
1220
1237
|
// A tool asked for a person. The whole batch is committed; the
|
|
1221
1238
|
// turn parks here rather than asking the model what to do about
|
|
1222
1239
|
// something only the operator can do.
|
|
@@ -1226,6 +1243,18 @@ export class IterationOrchestrator {
|
|
|
1226
1243
|
if (reviewOutcome.decision === 'rejected') {
|
|
1227
1244
|
continue;
|
|
1228
1245
|
}
|
|
1246
|
+
if (needsCorrection) {
|
|
1247
|
+
await this.ctx.emitEvent({
|
|
1248
|
+
type: 'iteration_completed',
|
|
1249
|
+
turnId: recorder.turnId,
|
|
1250
|
+
iteration: iterationNum,
|
|
1251
|
+
hasToolCalls: true,
|
|
1252
|
+
});
|
|
1253
|
+
yield* this.ctx.drainPending();
|
|
1254
|
+
if (this.stopForStructuredRetryExhaustion())
|
|
1255
|
+
break;
|
|
1256
|
+
continue;
|
|
1257
|
+
}
|
|
1229
1258
|
// A successful `structured_output` call IS the answer, so the
|
|
1230
1259
|
// run ends here rather than paying for another turn whose only
|
|
1231
1260
|
// job would be to restate it — unless it shared its turn with
|
|
@@ -1267,7 +1296,7 @@ export class IterationOrchestrator {
|
|
|
1267
1296
|
break;
|
|
1268
1297
|
}
|
|
1269
1298
|
if (!forceFinalize) {
|
|
1270
|
-
const inbound = this.deliverInbound();
|
|
1299
|
+
const inbound = await this.deliverInbound();
|
|
1271
1300
|
// Tool-result steering may already have been delivered by
|
|
1272
1301
|
// runToolReview. Its candidate still answers the older input.
|
|
1273
1302
|
if (inbound > 0 || this.latestUserMessage !== operatorInputAtDispatch)
|
|
@@ -1385,7 +1414,7 @@ export class IterationOrchestrator {
|
|
|
1385
1414
|
// Placed beside the advisory phase deliberately: that is the
|
|
1386
1415
|
// established seam for putting a user message in after tool
|
|
1387
1416
|
// results and before the next turn.
|
|
1388
|
-
const unheard = this.ctx
|
|
1417
|
+
const unheard = await drainArrivedTaskCompletions(this.ctx);
|
|
1389
1418
|
if (unheard.length > 0) {
|
|
1390
1419
|
this.ctx.log.info('Delivering unawaited task completions', {
|
|
1391
1420
|
[NAMZU.TURN_ID]: recorder.turnId,
|
|
@@ -1398,7 +1427,7 @@ export class IterationOrchestrator {
|
|
|
1398
1427
|
// and never deliver it. Placed here rather than at the top of
|
|
1399
1428
|
// the next iteration so a message queued during THIS turn is
|
|
1400
1429
|
// in the history the next request is built from.
|
|
1401
|
-
this.deliverInbound();
|
|
1430
|
+
await this.deliverInbound();
|
|
1402
1431
|
await runAdvisoryPhase(this.ctx, iterationNum, response, this.getAdvisoryTurnContext());
|
|
1403
1432
|
if (this.ctx.pluginManager) {
|
|
1404
1433
|
const hookResults = await this.ctx.pluginManager.executeHooks('iteration_end', {
|
|
@@ -1610,7 +1639,7 @@ export class IterationOrchestrator {
|
|
|
1610
1639
|
extractFromUserMessage(manager, message.content, !manager.getState().task);
|
|
1611
1640
|
}
|
|
1612
1641
|
}
|
|
1613
|
-
deliverInbound() {
|
|
1642
|
+
async deliverInbound() {
|
|
1614
1643
|
const queued = this.ctx.inboundMessages?.() ?? [];
|
|
1615
1644
|
for (const message of queued) {
|
|
1616
1645
|
this.ctx.recorder.pushMessage(message);
|
|
@@ -1625,7 +1654,8 @@ export class IterationOrchestrator {
|
|
|
1625
1654
|
this.ctx.recorder.pushMessage(message);
|
|
1626
1655
|
this.rememberUserMessage(createRuntimeContextMessage(stranded, 'steering'));
|
|
1627
1656
|
}
|
|
1628
|
-
|
|
1657
|
+
const durable = await deliverDurableInbound(this.ctx.recorder, this.ctx.durableInbound, this.ctx.abortController.signal);
|
|
1658
|
+
return queued.length + (stranded ? 1 : 0) + durable;
|
|
1629
1659
|
}
|
|
1630
1660
|
recordStep(input) {
|
|
1631
1661
|
const { recorder } = this.ctx;
|
|
@@ -1658,6 +1688,7 @@ export class IterationOrchestrator {
|
|
|
1658
1688
|
toolName: tc.function.name,
|
|
1659
1689
|
output: outcome?.output ?? '',
|
|
1660
1690
|
isError: outcome?.isError ?? false,
|
|
1691
|
+
...(outcome?.skipped ? { skipped: true } : {}),
|
|
1661
1692
|
durationMs: 0,
|
|
1662
1693
|
},
|
|
1663
1694
|
];
|
|
@@ -1699,8 +1730,8 @@ export class IterationOrchestrator {
|
|
|
1699
1730
|
});
|
|
1700
1731
|
}
|
|
1701
1732
|
}
|
|
1702
|
-
/**
|
|
1703
|
-
|
|
1733
|
+
/** Model responses needing a tool-mode schema correction, separate from host reviews. */
|
|
1734
|
+
toolStructuredAttempts = 0;
|
|
1704
1735
|
nativeStructuredAttempts = 0;
|
|
1705
1736
|
structuredOutputDone = false;
|
|
1706
1737
|
pendingStructuredOutput;
|
|
@@ -1708,6 +1739,47 @@ export class IterationOrchestrator {
|
|
|
1708
1739
|
structuredOutputRetryLimit() {
|
|
1709
1740
|
return this.ctx.structuredOutput?.maxRetries ?? DEFAULT_STRUCTURED_OUTPUT_RETRIES;
|
|
1710
1741
|
}
|
|
1742
|
+
stopForStructuredRetryExhaustion() {
|
|
1743
|
+
const { recorder, abortController } = this.ctx;
|
|
1744
|
+
if (abortController.signal.aborted) {
|
|
1745
|
+
recorder.setStopReason('cancelled');
|
|
1746
|
+
recorder.markCancelled();
|
|
1747
|
+
return true;
|
|
1748
|
+
}
|
|
1749
|
+
if (!this.needsStructuredOutput())
|
|
1750
|
+
return false;
|
|
1751
|
+
const attempts = this.ctx.structuredOutput?.mode === 'native'
|
|
1752
|
+
? this.nativeStructuredAttempts
|
|
1753
|
+
: this.toolStructuredAttempts;
|
|
1754
|
+
if (attempts === 0 || !(attempts > this.structuredOutputRetryLimit()))
|
|
1755
|
+
return false;
|
|
1756
|
+
recorder.setStopReason('structured_output_failed');
|
|
1757
|
+
return true;
|
|
1758
|
+
}
|
|
1759
|
+
async recordToolStructuredFailure(results, iteration) {
|
|
1760
|
+
if (!this.needsStructuredOutput() ||
|
|
1761
|
+
this.ctx.structuredOutput?.mode === 'native' ||
|
|
1762
|
+
this.ctx.abortController.signal.aborted ||
|
|
1763
|
+
!results.some((result) => result.toolName === STRUCTURED_OUTPUT_TOOL_NAME && result.inputFailure))
|
|
1764
|
+
return false;
|
|
1765
|
+
// One model response consumes one correction, even with several invalid calls.
|
|
1766
|
+
await this.recordToolStructuredCorrection(iteration);
|
|
1767
|
+
return true;
|
|
1768
|
+
}
|
|
1769
|
+
async recordToolStructuredCorrection(iteration) {
|
|
1770
|
+
this.toolStructuredAttempts++;
|
|
1771
|
+
const { recorder } = this.ctx;
|
|
1772
|
+
recorder.pushMessage(createRuntimeContextMessage(STRUCTURED_OUTPUT_REPROMPT, 'structured-output'));
|
|
1773
|
+
// Commit the full answered batch, feedback and allowance before another request
|
|
1774
|
+
// or handoff. A failed checkpoint must not buy another correction opportunity.
|
|
1775
|
+
const checkpoint = await this.ctx.checkpointMgr.create(recorder, iteration);
|
|
1776
|
+
await this.ctx.emitEvent({
|
|
1777
|
+
type: 'checkpoint_created',
|
|
1778
|
+
turnId: recorder.turnId,
|
|
1779
|
+
checkpointId: checkpoint.id,
|
|
1780
|
+
iteration,
|
|
1781
|
+
});
|
|
1782
|
+
}
|
|
1711
1783
|
/** True while a structured output was demanded and has not arrived. */
|
|
1712
1784
|
needsStructuredOutput() {
|
|
1713
1785
|
return this.ctx.structuredOutput !== undefined && !this.structuredOutputDone;
|
|
@@ -1718,9 +1790,9 @@ export class IterationOrchestrator {
|
|
|
1718
1790
|
* Deliberately narrow. A terminal call decides the turn only when it is
|
|
1719
1791
|
* the ONLY call the model made in that turn: a model that asked for
|
|
1720
1792
|
* other work meant to see those results, and settling here would throw
|
|
1721
|
-
* away answers it requested.
|
|
1722
|
-
*
|
|
1723
|
-
*
|
|
1793
|
+
* away answers it requested. A failed or skipped terminal call also
|
|
1794
|
+
* needs another model turn: its receipt is not an executed answer.
|
|
1795
|
+
* These cases fall through to the ordinary path, and each says so in
|
|
1724
1796
|
* the log rather than quietly costing the relay the flag was set to
|
|
1725
1797
|
* avoid.
|
|
1726
1798
|
*/
|
|
@@ -1740,8 +1812,10 @@ export class IterationOrchestrator {
|
|
|
1740
1812
|
return undefined;
|
|
1741
1813
|
}
|
|
1742
1814
|
const hit = terminal[0];
|
|
1743
|
-
if (!hit || hit.isError) {
|
|
1744
|
-
this.ctx.log.info(
|
|
1815
|
+
if (!hit || hit.isError || hit.skipped) {
|
|
1816
|
+
this.ctx.log.info(hit?.skipped
|
|
1817
|
+
? 'Terminal tool was skipped — returning its receipt to the model'
|
|
1818
|
+
: 'Terminal tool failed — returning the error to the model', {
|
|
1745
1819
|
[NAMZU.TURN_ID]: this.ctx.recorder.turnId,
|
|
1746
1820
|
[GENAI.TOOL_NAME]: hit?.toolName,
|
|
1747
1821
|
});
|
|
@@ -1755,7 +1829,8 @@ export class IterationOrchestrator {
|
|
|
1755
1829
|
* The tool validates against the Zod schema before its `execute` runs,
|
|
1756
1830
|
* so reaching here successfully means the value is already valid — a
|
|
1757
1831
|
* failed parse comes back as an error result and simply does not
|
|
1758
|
-
* satisfy the demand, which sends the loop round again.
|
|
1832
|
+
* satisfy the demand, which sends the loop round again. A hook-skipped
|
|
1833
|
+
* receipt did not execute the tool and is not a candidate either.
|
|
1759
1834
|
*
|
|
1760
1835
|
* Narrow in the same way {@link terminalToolOutput} is, for its stated
|
|
1761
1836
|
* reason and one that is sharper here. The neighbour refuses a shared
|
|
@@ -1796,7 +1871,7 @@ export class IterationOrchestrator {
|
|
|
1796
1871
|
async captureStructuredOutput(results, response, reviewRequest, model) {
|
|
1797
1872
|
if (!this.needsStructuredOutput() || this.ctx.structuredOutput?.mode === 'native')
|
|
1798
1873
|
return 'absent';
|
|
1799
|
-
const hit = results.find((r) => r.toolName === STRUCTURED_OUTPUT_TOOL_NAME && !r.isError);
|
|
1874
|
+
const hit = results.find((r) => r.toolName === STRUCTURED_OUTPUT_TOOL_NAME && !r.isError && !r.skipped);
|
|
1800
1875
|
if (!hit)
|
|
1801
1876
|
return 'absent';
|
|
1802
1877
|
const callCount = response.message.toolCalls?.length ?? 0;
|
|
@@ -1809,14 +1884,16 @@ export class IterationOrchestrator {
|
|
|
1809
1884
|
}
|
|
1810
1885
|
let parsed;
|
|
1811
1886
|
try {
|
|
1812
|
-
parsed =
|
|
1887
|
+
parsed =
|
|
1888
|
+
this.ctx.structuredOutput?.toolResultRetention === 'durable'
|
|
1889
|
+
? parseStructuredResultJson(hit.structuredResultJson === undefined ? hit.output : hit.structuredResultJson)
|
|
1890
|
+
: JSON.parse(hit.output);
|
|
1813
1891
|
}
|
|
1814
1892
|
catch {
|
|
1815
|
-
//
|
|
1816
|
-
//
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
parsed = hit.output;
|
|
1893
|
+
// Screening, hooks or output budgeting can change the validated
|
|
1894
|
+
// tool's receipt. A raw-text fallback is not a structured result;
|
|
1895
|
+
// do not recover input/data that bypasses those boundaries either.
|
|
1896
|
+
throw new Error('Structured output requires an intact JSON tool result; check result transformations, increase maxToolOutputChars to fit the result, or use native mode with a capable provider');
|
|
1820
1897
|
}
|
|
1821
1898
|
return this.reviewStructuredOutput(parsed, reviewRequest, model);
|
|
1822
1899
|
}
|
|
@@ -2065,15 +2142,15 @@ export class IterationOrchestrator {
|
|
|
2065
2142
|
providerId: servedBy.providerId,
|
|
2066
2143
|
model: servedBy.model,
|
|
2067
2144
|
});
|
|
2068
|
-
const
|
|
2145
|
+
const finalMessageId = generateMessageId();
|
|
2146
|
+
const assistantMsg = withStreamedMessageIdentity(createAssistantMessage(response.message.content, undefined, response.message.reasoning, response.message.citations, {
|
|
2069
2147
|
type: 'model',
|
|
2070
2148
|
...servedBy,
|
|
2071
2149
|
...(response.message.replayState !== undefined
|
|
2072
2150
|
? { replayState: response.message.replayState }
|
|
2073
2151
|
: {}),
|
|
2074
|
-
}, response.message.textParts);
|
|
2152
|
+
}, response.message.textParts), finalMessageId);
|
|
2075
2153
|
this.ctx.recorder.pushMessage(assistantMsg);
|
|
2076
|
-
const finalMessageId = generateMessageId();
|
|
2077
2154
|
await this.ctx.emitEvent({
|
|
2078
2155
|
type: 'message_started',
|
|
2079
2156
|
turnId: this.ctx.recorder.turnId,
|