@sema-agent/core 7.54.1 → 7.56.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 +950 -0
- package/dist/agents/agent-transcript-tool.js +2 -1
- package/dist/agents/builtin-agents.d.ts +12 -14
- package/dist/agents/cascade.js +1 -1
- package/dist/agents/cc-peer-directory.d.ts +36 -0
- package/dist/agents/cc-peer-directory.js +139 -0
- package/dist/agents/cc-peer-wire.d.ts +105 -0
- package/dist/agents/cc-peer-wire.js +98 -0
- package/dist/agents/cc-uds-peer-channel.d.ts +40 -0
- package/dist/agents/cc-uds-peer-channel.js +457 -0
- package/dist/agents/child-model-seat.d.ts +0 -11
- package/dist/agents/child-model-seat.js +0 -3
- package/dist/agents/cross-session-envelope.d.ts +4 -1
- package/dist/agents/cross-session-envelope.js +8 -1
- package/dist/agents/cross-session-judge.d.ts +2 -2
- package/dist/agents/list-agents-tool.d.ts +3 -1
- package/dist/agents/list-agents-tool.js +9 -8
- package/dist/agents/observer.d.ts +4 -5
- package/dist/agents/observer.js +2 -1
- package/dist/agents/peer-admission.d.ts +6 -0
- package/dist/agents/peer-admission.js +4 -1
- package/dist/agents/peer-directory.d.ts +65 -13
- package/dist/agents/peer-directory.js +90 -25
- package/dist/agents/peer-notices.d.ts +1 -1
- package/dist/agents/peer-session-drain.d.ts +3 -1
- package/dist/agents/peer-session-drain.js +3 -2
- package/dist/agents/read-inbox-tool.js +2 -1
- package/dist/agents/repair-loop.js +2 -2
- package/dist/agents/retain-ledger.d.ts +1 -1
- package/dist/agents/roster-store.d.ts +1 -1
- package/dist/agents/send-message-tool.d.ts +10 -0
- package/dist/agents/send-message-tool.js +37 -8
- package/dist/agents/subagent.d.ts +39 -82
- package/dist/agents/subagent.js +109 -106
- package/dist/agents/tool-filter.d.ts +31 -46
- package/dist/agents/tool-filter.js +13 -33
- package/dist/agents/verify.d.ts +6 -5
- package/dist/agents/verify.js +3 -3
- package/dist/brain/anthropic.js +43 -81
- package/dist/brain/errors.d.ts +15 -0
- package/dist/brain/errors.js +10 -0
- package/dist/brain/media-degrade.d.ts +18 -7
- package/dist/brain/media-degrade.js +13 -2
- package/dist/brain/model-capability.d.ts +37 -0
- package/dist/brain/model-capability.js +34 -0
- package/dist/brain/model-presets.d.ts +6 -12
- package/dist/brain/model-presets.js +1 -6
- package/dist/brain/open-responses.js +27 -35
- package/dist/brain/openai.js +30 -98
- package/dist/brain/provider-dialect.d.ts +39 -3
- package/dist/brain/provider-dialect.js +28 -0
- package/dist/brain/reasoning-request.d.ts +96 -0
- package/dist/brain/reasoning-request.js +174 -0
- package/dist/brain/reasoning.d.ts +12 -12
- package/dist/brain/reasoning.js +4 -3
- package/dist/brain/request-params.d.ts +62 -9
- package/dist/brain/request-params.js +42 -7
- package/dist/brain/retry.d.ts +1 -1
- package/dist/brain/route-adjudicator.d.ts +15 -0
- package/dist/brain/route-adjudicator.js +15 -0
- package/dist/brain/status-sink.d.ts +20 -0
- package/dist/brain/status-sink.js +7 -0
- package/dist/brain/stream-engine.js +6 -5
- package/dist/brain/stream-shared.d.ts +1 -1
- package/dist/core/a2a.d.ts +2 -1
- package/dist/core/a2a.js +19 -13
- package/dist/core/advisor-verdict.d.ts +120 -0
- package/dist/core/advisor-verdict.js +92 -0
- package/dist/core/agent-definition.d.ts +17 -8
- package/dist/core/allow-entry.d.ts +69 -36
- package/dist/core/allow-entry.js +81 -52
- package/dist/core/allow-rule-shadow.d.ts +10 -3
- package/dist/core/approval-object.d.ts +2 -1
- package/dist/core/approval-object.js +6 -6
- package/dist/core/ask-origin.d.ts +127 -29
- package/dist/core/ask-origin.js +87 -25
- package/dist/core/ask-question.d.ts +51 -8
- package/dist/core/ask-question.js +12 -7
- package/dist/core/ask-unresolvable-notice.d.ts +8 -3
- package/dist/core/ask-unresolvable-notice.js +16 -2
- package/dist/core/auto-compaction.d.ts +11 -8
- package/dist/core/auto-compaction.js +4 -2
- package/dist/core/auto-mode-arming.d.ts +2 -2
- package/dist/core/auto-mode-defaults.d.ts +8 -8
- package/dist/core/auto-mode-prompt-assets.d.ts +3 -3
- package/dist/core/auto-mode-prompt.d.ts +1 -1
- package/dist/core/auto-mode.d.ts +17 -9
- package/dist/core/auto-mode.js +9 -6
- package/dist/core/background-agent-store.d.ts +3 -3
- package/dist/core/canonical-json.d.ts +1 -1
- package/dist/core/canonical-json.js +2 -2
- package/dist/core/checkpoint-generation.d.ts +53 -0
- package/dist/core/checkpoint-generation.js +35 -0
- package/dist/core/checkpoint-queries.d.ts +180 -0
- package/dist/core/checkpoint-queries.js +272 -0
- package/dist/core/checkpoint-requirements.d.ts +19 -4
- package/dist/core/checkpoint-requirements.js +8 -14
- package/dist/core/checkpoint-store.d.ts +165 -72
- package/dist/core/checkpoint-store.js +79 -82
- package/dist/core/child-clamp-seats.d.ts +6 -0
- package/dist/core/child-clamp-seats.js +3 -16
- package/dist/core/compliance.d.ts +2 -2
- package/dist/core/context-edit.d.ts +6 -7
- package/dist/core/cross-boundary-taint.d.ts +11 -4
- package/dist/core/cross-boundary-taint.js +3 -3
- package/dist/core/decision-receipt.d.ts +37 -3
- package/dist/core/decision-receipt.js +19 -19
- package/dist/core/delegation-not-started.d.ts +6 -0
- package/dist/core/delegation-not-started.js +17 -0
- package/dist/core/effective-path-target.d.ts +1 -1
- package/dist/core/engine-attestation.d.ts +93 -0
- package/dist/core/engine-attestation.js +70 -0
- package/dist/core/engine-capabilities.d.ts +4 -1
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +45 -12
- package/dist/core/exec-output-tail.d.ts +1 -1
- package/dist/core/file-history-retention.d.ts +1 -1
- package/dist/core/file-history-store.d.ts +147 -21
- package/dist/core/file-history-store.js +58 -32
- package/dist/core/gate-fold.d.ts +1 -1
- package/dist/core/gate-fold.js +24 -11
- package/dist/core/gate-lanes.js +81 -68
- package/dist/core/gate-outcome.d.ts +40 -6
- package/dist/core/gate-outcome.js +56 -0
- package/dist/core/governance-codes.d.ts +17 -3
- package/dist/core/governance-codes.js +16 -0
- package/dist/core/hands-band.d.ts +1 -1
- package/dist/core/hooks.d.ts +21 -20
- package/dist/core/hooks.js +3 -1
- package/dist/core/host-floor.d.ts +128 -0
- package/dist/core/host-floor.js +206 -0
- package/dist/core/host-target.d.ts +84 -0
- package/dist/core/host-target.js +92 -0
- package/dist/core/image-downsample.d.ts +1 -1
- package/dist/core/lsp-diagnostics.d.ts +4 -4
- package/dist/core/lsp.d.ts +3 -3
- package/dist/core/mailbox-store.d.ts +4 -0
- package/dist/core/mcp-connection-pool.d.ts +18 -2
- package/dist/core/mcp-connection-pool.js +53 -6
- package/dist/core/mcp-failure.d.ts +23 -4
- package/dist/core/mcp-failure.js +26 -11
- package/dist/core/mcp-listing-drift.d.ts +10 -0
- package/dist/core/mcp-listing-drift.js +6 -0
- package/dist/core/mcp-server-link.d.ts +173 -0
- package/dist/core/mcp-server-link.js +127 -0
- package/dist/core/mcp-server-spec.d.ts +4 -2
- package/dist/core/mcp-session-end.d.ts +26 -0
- package/dist/core/mcp-session-end.js +29 -0
- package/dist/core/mcp-startup-request.d.ts +17 -0
- package/dist/core/mcp-startup-request.js +17 -0
- package/dist/core/mcp.d.ts +17 -13
- package/dist/core/mcp.js +240 -189
- package/dist/core/media-byte-cap.d.ts +1 -1
- package/dist/core/memory-engine/delegation-settlement.js +15 -24
- package/dist/core/memory-engine/engine.d.ts +9 -9
- package/dist/core/memory-engine/engine.js +4 -4
- package/dist/core/memory-engine/layout.d.ts +60 -8
- package/dist/core/memory-engine/layout.js +65 -6
- package/dist/core/memory-engine/provenance-wording.d.ts +1 -1
- package/dist/core/memory-engine/tools.js +4 -1
- package/dist/core/mode-policy.d.ts +1 -1
- package/dist/core/model-seat.d.ts +10 -3
- package/dist/core/mods/classic-events.d.ts +67 -0
- package/dist/core/mods/classic-events.js +1 -0
- package/dist/core/mods/dollar.d.ts +13 -0
- package/dist/core/mods/extension-call.d.ts +31 -0
- package/dist/core/mods/extension-call.js +43 -0
- package/dist/core/mods/kernel/dispatch.d.ts +20 -3
- package/dist/core/mods/kernel/dispatch.js +140 -69
- package/dist/core/mods/kernel/events.d.ts +47 -11
- package/dist/core/mods/kernel/events.js +66 -42
- package/dist/core/mods/kernel/index.d.ts +4 -4
- package/dist/core/mods/kernel/index.js +2 -2
- package/dist/core/mods/kernel/receive.d.ts +39 -5
- package/dist/core/mods/kernel/receive.js +290 -17
- package/dist/core/mods/kernel/registration.d.ts +33 -2
- package/dist/core/mods/kernel/registration.js +6 -7
- package/dist/core/mods/kernel/site-rules.d.ts +44 -16
- package/dist/core/mods/kernel/site-rules.js +24 -42
- package/dist/core/mods/spec-seats.d.ts +69 -0
- package/dist/core/mods/spec-seats.js +114 -0
- package/dist/core/mods/stations.d.ts +28 -8
- package/dist/core/mods/stations.js +29 -13
- package/dist/core/mods/tool-call.d.ts +79 -0
- package/dist/core/mods/tool-call.js +152 -0
- package/dist/core/namespaced-rule-name.d.ts +44 -24
- package/dist/core/namespaced-rule-name.js +50 -43
- package/dist/core/output-style.d.ts +1 -1
- package/dist/core/param-rule-reach.d.ts +15 -0
- package/dist/core/param-rule-reach.js +30 -0
- package/dist/core/parent-spec-seat.d.ts +13 -1
- package/dist/core/parent-spec-seat.js +6 -0
- package/dist/core/park-selfcheck.js +1 -0
- package/dist/core/pause-registry.d.ts +16 -5
- package/dist/core/pause-registry.js +6 -2
- package/dist/core/peer-channel.d.ts +70 -0
- package/dist/core/peer-channel.js +1 -0
- package/dist/core/permission-rule-consent.d.ts +30 -5
- package/dist/core/permission-rule-consent.js +147 -50
- package/dist/core/permission-rule-model.d.ts +245 -65
- package/dist/core/permission-rule-model.js +421 -107
- package/dist/core/permission-rule-org.d.ts +6 -2
- package/dist/core/permission-rule-org.js +7 -3
- package/dist/core/permission-rule-provider.d.ts +6 -2
- package/dist/core/permission-rule-provider.js +41 -11
- package/dist/core/permission-rule-store.d.ts +22 -26
- package/dist/core/permission-rule-store.js +12 -6
- package/dist/core/permission-rule-sync.d.ts +11 -2
- package/dist/core/permission-rule-sync.js +11 -3
- package/dist/core/permission-rule-syntax.d.ts +5 -4
- package/dist/core/permission-rule-syntax.js +2 -2
- package/dist/core/permission-rules.d.ts +53 -15
- package/dist/core/permission-rules.js +125 -100
- package/dist/core/persisted-rule-arms.d.ts +6 -4
- package/dist/core/persisted-rule-arms.js +10 -12
- package/dist/core/present-plan-tool.js +3 -1
- package/dist/core/principal-name.d.ts +20 -0
- package/dist/core/principal-name.js +22 -0
- package/dist/core/prompt-section-seat.js +4 -6
- package/dist/core/protocol-http-auth.d.ts +26 -5
- package/dist/core/protocol-http-auth.js +137 -4
- package/dist/core/protocol-naming.d.ts +2 -2
- package/dist/core/read-only-shell-table.d.ts +1 -1
- package/dist/core/read-only-shell.d.ts +1 -1
- package/dist/core/retired-keys.d.ts +16 -0
- package/dist/core/retired-keys.js +16 -4
- package/dist/core/rewrite-rejudge.d.ts +60 -0
- package/dist/core/rewrite-rejudge.js +36 -0
- package/dist/core/roles.d.ts +34 -3
- package/dist/core/roles.js +66 -53
- package/dist/core/rule-lane-reads.d.ts +20 -15
- package/dist/core/rule-lane-reads.js +45 -17
- package/dist/core/rule-offer-read.d.ts +53 -0
- package/dist/core/rule-offer-read.js +146 -0
- package/dist/core/rule-owner.d.ts +46 -0
- package/dist/core/rule-owner.js +29 -0
- package/dist/core/runner/advisor-instructions.d.ts +70 -0
- package/dist/core/runner/advisor-instructions.js +61 -0
- package/dist/core/runner/advisor-tool.d.ts +33 -0
- package/dist/core/runner/advisor-tool.js +112 -0
- package/dist/core/runner/announce-once-ledger.d.ts +18 -26
- package/dist/core/runner/announce-once-ledger.js +19 -46
- package/dist/core/runner/approval-feedback.js +6 -3
- package/dist/core/runner/assemble-result.d.ts +2 -1
- package/dist/core/runner/assemble-result.js +1 -1
- package/dist/core/runner/call-hook-stations.d.ts +3 -2
- package/dist/core/runner/caller-roster.d.ts +21 -2
- package/dist/core/runner/caller-roster.js +38 -0
- package/dist/core/runner/capability-withheld-seat.d.ts +5 -0
- package/dist/core/runner/capability-withheld-seat.js +24 -0
- package/dist/core/runner/classifier-ladder.d.ts +33 -13
- package/dist/core/runner/classifier-ladder.js +15 -14
- package/dist/core/runner/compaction-restate.d.ts +10 -6
- package/dist/core/runner/compaction-restate.js +9 -3
- package/dist/core/runner/construction-doors.js +3 -0
- package/dist/core/runner/contracts.d.ts +40 -33
- package/dist/core/runner/conversation-segment.d.ts +28 -0
- package/dist/core/runner/conversation-segment.js +42 -0
- package/dist/core/runner/cross-boundary-lane.d.ts +21 -16
- package/dist/core/runner/cross-boundary-lane.js +58 -34
- package/dist/core/runner/decide-continuation.d.ts +7 -4
- package/dist/core/runner/decide-continuation.js +2 -2
- package/dist/core/runner/denial-limit-arms.d.ts +4 -4
- package/dist/core/runner/denial-limit-arms.js +1 -1
- package/dist/core/runner/derived-route-fallback.d.ts +24 -24
- package/dist/core/runner/derived-route-fallback.js +9 -7
- package/dist/core/runner/file-history-request.d.ts +18 -0
- package/dist/core/runner/file-history-request.js +21 -13
- package/dist/core/runner/file-history-restore.d.ts +45 -0
- package/dist/core/runner/file-history-restore.js +46 -0
- package/dist/core/runner/gate-exit.d.ts +9 -3
- package/dist/core/runner/gate-exit.js +11 -5
- package/dist/core/runner/image.d.ts +7 -17
- package/dist/core/runner/image.js +9 -60
- package/dist/core/runner/initial-run-state.js +1 -1
- package/dist/core/runner/permission-rule-lanes.d.ts +6 -6
- package/dist/core/runner/permission-rule-lanes.js +38 -15
- package/dist/core/runner/person-path-rows.d.ts +12 -9
- package/dist/core/runner/person-path-rows.js +19 -8
- package/dist/core/runner/prepare-advisor.d.ts +63 -0
- package/dist/core/runner/prepare-advisor.js +77 -0
- package/dist/core/runner/prepare-ask-lane.d.ts +2 -2
- package/dist/core/runner/prepare-ask-lane.js +5 -2
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -6
- package/dist/core/runner/prepare-caps-and-workflow.js +5 -4
- package/dist/core/runner/prepare-config-doors.d.ts +31 -38
- package/dist/core/runner/prepare-config-doors.js +57 -34
- package/dist/core/runner/prepare-defer-classify.d.ts +4 -3
- package/dist/core/runner/prepare-defer-classify.js +7 -8
- package/dist/core/runner/prepare-delegation-surface.d.ts +2 -2
- package/dist/core/runner/prepare-delegation-surface.js +1 -1
- package/dist/core/runner/prepare-file-history.d.ts +48 -8
- package/dist/core/runner/prepare-file-history.js +41 -73
- package/dist/core/runner/prepare-gate-stations.d.ts +2 -5
- package/dist/core/runner/prepare-gate-stations.js +12 -8
- package/dist/core/runner/prepare-hands-readface.d.ts +2 -8
- package/dist/core/runner/prepare-hands-readface.js +15 -14
- package/dist/core/runner/prepare-inherited-gate.d.ts +11 -7
- package/dist/core/runner/prepare-inherited-gate.js +8 -6
- package/dist/core/runner/prepare-memory-engine-session.js +1 -1
- package/dist/core/runner/prepare-park-ask.js +12 -12
- package/dist/core/runner/prepare-policy-chain.d.ts +7 -4
- package/dist/core/runner/prepare-policy-chain.js +68 -81
- package/dist/core/runner/prepare-project-context.d.ts +5 -2
- package/dist/core/runner/prepare-project-context.js +6 -3
- package/dist/core/runner/prepare-prompt-assembly.d.ts +5 -7
- package/dist/core/runner/prepare-prompt-assembly.js +10 -8
- package/dist/core/runner/prepare-prompt-inputs.d.ts +11 -9
- package/dist/core/runner/prepare-prompt-inputs.js +4 -6
- package/dist/core/runner/prepare-protocol-tools.d.ts +4 -2
- package/dist/core/runner/prepare-protocol-tools.js +5 -4
- package/dist/core/runner/prepare-safety-scan.d.ts +9 -12
- package/dist/core/runner/prepare-safety-scan.js +8 -23
- package/dist/core/runner/prepare-suspend-saga.d.ts +2 -0
- package/dist/core/runner/prepare-suspend-saga.js +5 -6
- package/dist/core/runner/prepare-task.d.ts +1 -1
- package/dist/core/runner/prepare-task.js +41 -35
- package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +7 -4
- package/dist/core/runner/prepare-tool-disclosure-mount.js +24 -18
- package/dist/core/runner/prepare-turn-wiring.d.ts +0 -4
- package/dist/core/runner/prepare-turn-wiring.js +2 -7
- package/dist/core/runner/prepare-wiring-manifest.d.ts +11 -4
- package/dist/core/runner/prepare-wiring-manifest.js +3 -3
- package/dist/core/runner/resume-admission.js +1 -1
- package/dist/core/runner/resume-apply.js +11 -12
- package/dist/core/runner/resume-checkpoint-screen.js +3 -0
- package/dist/core/runner/resume-claim.d.ts +4 -2
- package/dist/core/runner/resume-claim.js +15 -8
- package/dist/core/runner/resume-policy-outcome.js +1 -1
- package/dist/core/runner/retired-runner-deps.js +2 -1
- package/dist/core/runner/rewind-files.d.ts +15 -0
- package/dist/core/runner/rewind-files.js +132 -0
- package/dist/core/runner/run-attachment-seats.js +2 -2
- package/dist/core/runner/run-brain-sinks.d.ts +4 -1
- package/dist/core/runner/run-brain-sinks.js +4 -2
- package/dist/core/runner/run-compaction-machinery.d.ts +1 -1
- package/dist/core/runner/run-compaction-machinery.js +2 -12
- package/dist/core/runner/run-git-lane.d.ts +1 -0
- package/dist/core/runner/run-harness-handlers.js +14 -7
- package/dist/core/runner/run-leg.d.ts +1 -1
- package/dist/core/runner/run-leg.js +43 -18
- package/dist/core/runner/run-settle-and-teardown.js +3 -2
- package/dist/core/runner/run-telemetry-and-budget-seats.js +1 -1
- package/dist/core/runner/run-turn-boundary.d.ts +1 -0
- package/dist/core/runner/run-turn-boundary.js +15 -22
- package/dist/core/runner/runtask.d.ts +3 -0
- package/dist/core/runner/runtask.js +8 -9
- package/dist/core/runner/session-read-file-states.d.ts +15 -0
- package/dist/core/runner/session-read-file-states.js +28 -0
- package/dist/core/runner/session-rule-policy.d.ts +22 -21
- package/dist/core/runner/session-rule-policy.js +17 -31
- package/dist/core/runner/shell-env-withheld.d.ts +33 -0
- package/dist/core/runner/shell-env-withheld.js +51 -0
- package/dist/core/runner/side-call-account.d.ts +32 -8
- package/dist/core/runner/side-call-account.js +23 -1
- package/dist/core/runner/skills-seat.js +6 -2
- package/dist/core/runner/stream-settle-backstop.js +1 -1
- package/dist/core/runner/strict-output-schema.d.ts +1 -1
- package/dist/core/runner/sub-agent-deny-lists.js +4 -6
- package/dist/core/runner/synthetic-tools.d.ts +16 -13
- package/dist/core/runner/synthetic-tools.js +8 -3
- package/dist/core/runner/tool-disclosure.d.ts +10 -12
- package/dist/core/runner/tool-disclosure.js +3 -4
- package/dist/core/runner/tool-end-body.d.ts +1 -1
- package/dist/core/runner/tool-end-body.js +10 -9
- package/dist/core/runner/tool-face-overlay.d.ts +2 -1
- package/dist/core/runner/tool-face-overlay.js +17 -1
- package/dist/core/runner/tool-not-executed.d.ts +5 -0
- package/dist/core/runner/tool-not-executed.js +11 -0
- package/dist/core/runner/tool-occurrence.d.ts +8 -0
- package/dist/core/runner/tool-occurrence.js +7 -0
- package/dist/core/runner/tool-progress-lane.d.ts +2 -2
- package/dist/core/runner/tool-turn-repair-seat.d.ts +3 -2
- package/dist/core/runner/turn-attachments.d.ts +91 -80
- package/dist/core/runner/turn-attachments.js +62 -37
- package/dist/core/runner-deps.d.ts +42 -42
- package/dist/core/runtime-caps.d.ts +4 -4
- package/dist/core/safety-axis-vocab.d.ts +6 -4
- package/dist/core/safety-axis-vocab.js +6 -5
- package/dist/core/safety-merge-corpus.js +26 -2
- package/dist/core/same-plain-value.d.ts +40 -0
- package/dist/core/same-plain-value.js +49 -0
- package/dist/core/scheduler.d.ts +1 -1
- package/dist/core/secret-env.d.ts +26 -3
- package/dist/core/secret-env.js +44 -8
- package/dist/core/select-model.js +3 -3
- package/dist/core/sensitive-path-policy.d.ts +1 -1
- package/dist/core/sensitive-path-policy.js +1 -1
- package/dist/core/session-policy-store.d.ts +102 -35
- package/dist/core/session-policy-store.js +210 -48
- package/dist/core/session-reconcile.d.ts +2 -2
- package/dist/core/session-store.d.ts +106 -37
- package/dist/core/session-store.js +165 -91
- package/dist/core/session.d.ts +101 -57
- package/dist/core/session.js +53 -0
- package/dist/core/shared-memory/tools.js +3 -1
- package/dist/core/shared-memory/types.d.ts +1 -1
- package/dist/core/shell-read-silence.d.ts +11 -12
- package/dist/core/shell-read-silence.js +9 -5
- package/dist/core/shell-run-candidates.js +3 -1
- package/dist/core/shell-wrapper-projection.js +1 -1
- package/dist/core/shell-wrapper-table.d.ts +14 -7
- package/dist/core/shell-wrapper-table.js +5 -4
- package/dist/core/side-query.d.ts +10 -0
- package/dist/core/side-query.js +15 -1
- package/dist/core/skill-grant.d.ts +7 -2
- package/dist/core/skill-grant.js +5 -0
- package/dist/core/skills-directory.js +6 -2
- package/dist/core/store-contracts/checkpoint-store-contract.d.ts +11 -1
- package/dist/core/store-contracts/checkpoint-store-contract.js +168 -3
- package/dist/core/store-contracts/file-history-store-contract.js +74 -4
- package/dist/core/store-contracts/peer-directory-contract.d.ts +7 -2
- package/dist/core/store-contracts/peer-directory-contract.js +14 -2
- package/dist/core/store-contracts/session-policy-store-contract.d.ts +7 -0
- package/dist/core/store-contracts/session-policy-store-contract.js +130 -0
- package/dist/core/store-contracts/session-repo-contract.js +176 -0
- package/dist/core/store-contracts/session-store-contract.d.ts +6 -8
- package/dist/core/store-contracts/session-store-contract.js +361 -51
- package/dist/core/store-contracts/workflow-journal-store-contract.js +26 -1
- package/dist/core/stub-env.d.ts +2 -0
- package/dist/core/stub-env.js +1 -0
- package/dist/core/surrogate-safe-slice.d.ts +3 -3
- package/dist/core/synthetic-read-verdict.js +3 -3
- package/dist/core/task-event.d.ts +42 -8
- package/dist/core/task-notification.d.ts +19 -15
- package/dist/core/task-registry-agent.d.ts +4 -4
- package/dist/core/task-registry-shared.d.ts +4 -4
- package/dist/core/task-registry-shared.js +1 -0
- package/dist/core/task-registry.d.ts +13 -4
- package/dist/core/task-registry.js +14 -2
- package/dist/core/task-result.d.ts +21 -3
- package/dist/core/task-spec.d.ts +69 -64
- package/dist/core/task-stream.d.ts +6 -6
- package/dist/core/task-tool-shape.d.ts +4 -4
- package/dist/core/tighten-task-spec.d.ts +1 -1
- package/dist/core/tighten-task-spec.js +2 -1
- package/dist/core/tool-catalog-entries.d.ts +36 -2
- package/dist/core/tool-catalog-entries.js +69 -43
- package/dist/core/tool-check-reading.d.ts +11 -0
- package/dist/core/tool-check-reading.js +11 -6
- package/dist/core/tool-conformance.js +1 -0
- package/dist/core/tool-errors.d.ts +2 -2
- package/dist/core/tool-face-reader.js +5 -3
- package/dist/core/tool-face.d.ts +21 -2
- package/dist/core/tool-face.js +1 -1
- package/dist/core/tool-model-gate.d.ts +5 -5
- package/dist/core/tool-name-aliases.d.ts +29 -8
- package/dist/core/tool-name-aliases.js +22 -4
- package/dist/core/tool-name-readings.d.ts +10 -43
- package/dist/core/tool-name-readings.js +2 -11
- package/dist/core/tool-policy.d.ts +85 -196
- package/dist/core/tool-policy.js +150 -175
- package/dist/core/tool-registry.d.ts +14 -7
- package/dist/core/tool-registry.js +17 -7
- package/dist/core/tool-result-store.js +5 -1
- package/dist/core/tool-roster.d.ts +57 -33
- package/dist/core/tool-roster.js +56 -68
- package/dist/core/tool-spec-members.js +8 -3
- package/dist/core/tool-spec.d.ts +53 -31
- package/dist/core/tools.js +51 -10
- package/dist/core/trace.d.ts +6 -2
- package/dist/core/types.d.ts +1 -1
- package/dist/core/untrusted-egress.d.ts +1 -1
- package/dist/core/untrusted-text.d.ts +1 -1
- package/dist/core/user-attachment.d.ts +8 -1
- package/dist/core/user-attachment.js +64 -4
- package/dist/core/warm-resume.d.ts +1 -1
- package/dist/core/wiring-manifest.d.ts +58 -0
- package/dist/core/wiring-manifest.js +14 -5
- package/dist/core/workflow-journal-store.d.ts +62 -0
- package/dist/core/workflow-journal-store.js +78 -2
- package/dist/core/workflow-run-store.d.ts +6 -0
- package/dist/core/workflow-run-store.js +2 -0
- package/dist/engine/compaction/compaction.d.ts +9 -9
- package/dist/engine/compaction/compaction.js +3 -2
- package/dist/engine/execution-env/node-execution-env.d.ts +26 -8
- package/dist/engine/execution-env/node-execution-env.js +54 -24
- package/dist/engine/harness/agent-harness.d.ts +39 -9
- package/dist/engine/harness/agent-harness.js +87 -33
- package/dist/engine/harness/types.d.ts +58 -9
- package/dist/engine/harness/types.js +12 -1
- package/dist/engine/llm/types.d.ts +36 -19
- package/dist/engine/llm/validation.d.ts +4 -1
- package/dist/engine/llm/validation.js +13 -1
- package/dist/engine/loop/agent-loop.d.ts +23 -1
- package/dist/engine/loop/agent-loop.js +26 -34
- package/dist/engine/loop/types.d.ts +31 -19
- package/dist/engine/lsp/node-lsp-manager.d.ts +2 -2
- package/dist/engine/session/memory-repo.d.ts +18 -12
- package/dist/engine/session/memory-repo.js +24 -9
- package/dist/engine/session/parent-chain-guard.d.ts +3 -2
- package/dist/engine/session/parent-chain-guard.js +1 -1
- package/dist/engine/session/repo-utils.d.ts +32 -3
- package/dist/engine/session/repo-utils.js +50 -5
- package/dist/index.d.ts +47 -23
- package/dist/index.js +35 -17
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/internal/harness.d.ts +3 -3
- package/dist/internal/harness.js +2 -2
- package/dist/internal/llm.d.ts +2 -2
- package/dist/internal/llm.js +1 -1
- package/dist/orchestration/goal.js +2 -2
- package/dist/orchestration/run-workflow-tool.d.ts +8 -6
- package/dist/orchestration/run-workflow-tool.js +10 -6
- package/dist/orchestration/workflow-size-guideline.d.ts +4 -4
- package/dist/orchestration/workflow-types.d.ts +18 -0
- package/dist/orchestration/workflow-types.js +6 -0
- package/dist/orchestration/workflow.d.ts +5 -13
- package/dist/orchestration/workflow.js +57 -49
- package/dist/prompt-assembly/artifact.d.ts +2 -2
- package/dist/prompt-assembly/artifact.js +5 -3
- package/dist/prompt-assembly/assemble.d.ts +3 -2
- package/dist/prompt-assembly/assemble.js +1 -1
- package/dist/prompt-assembly/catalog/schema.d.ts +43 -12
- package/dist/prompt-assembly/catalog/schema.js +34 -2
- package/dist/prompt-assembly/catalog/sections.js +0 -1
- package/dist/prompt-assembly/composer.d.ts +3 -1
- package/dist/prompt-assembly/composer.js +1 -1
- package/dist/prompt-assembly/event-registry.js +2 -0
- package/dist/prompt-assembly/overlay.js +3 -3
- package/dist/prompt-assembly/renderers.d.ts +1 -1
- package/dist/prompt-assembly/renderers.js +0 -3
- package/dist/prompt-assembly/role-base.d.ts +15 -0
- package/dist/prompt-assembly/role-base.js +9 -0
- package/dist/prompt-assembly/select.d.ts +39 -14
- package/dist/prompt-assembly/select.js +47 -16
- package/dist/prompt-assembly/sugar.d.ts +17 -11
- package/dist/prompt-assembly/sugar.js +8 -3
- package/dist/prompt-assembly/tool-catalog.d.ts +39 -2
- package/dist/prompt-assembly/tool-catalog.js +117 -4
- package/dist/prompt-assembly/turn-snapshot.d.ts +4 -10
- package/dist/prompt-assembly/turn-snapshot.js +0 -3
- package/dist/prompt-assembly/types.d.ts +0 -7
- package/dist/prompts/default.d.ts +14 -14
- package/dist/scenarios/full-body.d.ts +15 -15
- package/dist/scenarios/full-body.js +4 -3
- package/dist/shell/lex.js +10 -1
- package/dist/stores/file/adoption/adopt.d.ts +4 -3
- package/dist/stores/file/adoption/adopt.js +27 -33
- package/dist/stores/file/adoption/marker.d.ts +6 -13
- package/dist/stores/file/adoption/marker.js +9 -17
- package/dist/stores/file/checkpoint-store.d.ts +24 -0
- package/dist/stores/file/checkpoint-store.js +45 -7
- package/dist/stores/file/file-history-store.d.ts +20 -19
- package/dist/stores/file/file-history-store.js +157 -141
- package/dist/stores/file/fs-atomic.d.ts +15 -0
- package/dist/stores/file/fs-atomic.js +89 -14
- package/dist/stores/file/index.d.ts +1 -1
- package/dist/stores/file/index.js +2 -1
- package/dist/stores/file/mailbox-store.d.ts +3 -0
- package/dist/stores/file/mailbox-store.js +3 -1
- package/dist/stores/file/permission-rule-adopt.d.ts +1 -1
- package/dist/stores/file/permission-rule-adopt.js +18 -18
- package/dist/stores/file/permission-rule-store.d.ts +18 -2
- package/dist/stores/file/permission-rule-store.js +31 -18
- package/dist/stores/file/session-policy-store.d.ts +3 -3
- package/dist/stores/file/session-store.d.ts +54 -16
- package/dist/stores/file/session-store.js +114 -85
- package/dist/stores/file/workflow-journal-store.d.ts +10 -4
- package/dist/stores/file/workflow-journal-store.js +28 -13
- package/dist/tools/artifact/artifact-text.d.ts +1 -1
- package/dist/tools/artifact/artifact-tool.js +5 -3
- package/dist/tools/fs/bash-program-position.d.ts +19 -2
- package/dist/tools/fs/bash-program-position.js +56 -9
- package/dist/tools/fs/bash-readonly-classifier.d.ts +3 -3
- package/dist/tools/fs/fs-bash.d.ts +2 -2
- package/dist/tools/fs/fs-bash.js +8 -6
- package/dist/tools/fs/fs-glob.d.ts +86 -0
- package/dist/tools/fs/fs-glob.js +226 -0
- package/dist/tools/fs/fs-read.js +14 -14
- package/dist/tools/fs/fs-search-tools.js +7 -7
- package/dist/tools/fs/fs-shared.d.ts +8 -8
- package/dist/tools/fs/gh-rate-limit.d.ts +1 -1
- package/dist/tools/fs/notebook.d.ts +2 -2
- package/dist/tools/fs/pattern-kill-guard.d.ts +22 -0
- package/dist/tools/fs/pattern-kill-guard.js +397 -0
- package/dist/tools/fs/pdf.d.ts +9 -6
- package/dist/tools/fs/pdf.js +3 -3
- package/dist/tools/fs/program-read-model.d.ts +57 -7
- package/dist/tools/fs/program-read-model.js +11 -1
- package/dist/tools/fs/program-read-model.rows.js +78 -21
- package/dist/tools/fs/read-deny-home.js +3 -2
- package/dist/tools/fs/read-deny.d.ts +29 -7
- package/dist/tools/fs/read-deny.js +63 -22
- package/dist/tools/fs/removal-targets.d.ts +18 -8
- package/dist/tools/fs/removal-targets.js +47 -20
- package/dist/tools/fs/safety.d.ts +9 -9
- package/dist/tools/fs/search.d.ts +16 -6
- package/dist/tools/fs/search.js +20 -26
- package/dist/tools/fs/shell-read-argv.js +89 -12
- package/dist/tools/fs/shell-read-bindings.d.ts +31 -0
- package/dist/tools/fs/shell-read-bindings.js +41 -0
- package/dist/tools/fs/shell-read-check.js +12 -20
- package/dist/tools/fs/shell-read-environment.d.ts +5 -1
- package/dist/tools/fs/shell-read-environment.js +3 -2
- package/dist/tools/fs/shell-read-establish.d.ts +15 -0
- package/dist/tools/fs/shell-read-establish.js +19 -20
- package/dist/tools/fs/shell-read-judge.d.ts +4 -0
- package/dist/tools/fs/shell-read-judge.js +5 -2
- package/dist/tools/fs/shell-read-plan.js +24 -16
- package/dist/tools/fs/shell-read-start.d.ts +6 -1
- package/dist/tools/fs/shell-read-write-targets.d.ts +5 -1
- package/dist/tools/fs/shell-read-write-targets.js +2 -3
- package/dist/tools/fs/shell-reentry-text.d.ts +9 -0
- package/dist/tools/fs/shell-reentry-text.js +40 -2
- package/dist/tools/loop-tick.d.ts +2 -2
- package/dist/tools/scheduler-tools.js +5 -1
- package/dist/tools/task-list.d.ts +7 -7
- package/dist/tools/task-list.js +5 -1
- package/dist/tools/todo.js +65 -64
- package/dist/tools/web.d.ts +20 -15
- package/dist/tools/web.js +55 -69
- package/dist/tools/worktree.d.ts +3 -3
- package/dist/tools/worktree.js +3 -1
- package/package.json +1 -1
- package/test/export-surface.snapshot.json +5894 -5638
- package/wire-changes/core@7.55.0.json +3318 -0
- package/wire-changes/core@7.56.0.json +3891 -0
- package/wire-changes/mods-kernel@7.56.0.json +303 -0
- package/dist/core/store-contracts/session-store-incarnation-contract.d.ts +0 -39
- package/dist/core/store-contracts/session-store-incarnation-contract.js +0 -95
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ActorAssertion, AssistantMessage, ImageContent, Model, TextContent, UserMessage, UserMessageAttachment } from "../llm/index.js";
|
|
2
2
|
import { type ToolTurnRepair } from "../llm/index.js";
|
|
3
|
-
import { type ExecutedToolCallOutcome } from "../loop/agent-loop.js";
|
|
3
|
+
import { runToolCall, type ExecutedToolCallOutcome } from "../loop/agent-loop.js";
|
|
4
4
|
import type { HaltRemainingDirective } from "../loop/types.js";
|
|
5
5
|
import type { AgentMessage, AgentTool, AgentToolCall, LoopMalformedToolUseRecovery, LoopThinkingOnlyRecovery, LoopTruncatedOutputRecovery, QueueMode, ThinkingLevel } from "../loop/types.js";
|
|
6
6
|
import { type EngineSegment } from "../../core/untrusted-text.js";
|
|
@@ -174,6 +174,8 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
174
174
|
private readonly seatCutSources;
|
|
175
175
|
private trailingBatchEndedOn?;
|
|
176
176
|
private turnCutConsumed?;
|
|
177
|
+
private readonly committedEntryIds;
|
|
178
|
+
private readonly answerSources;
|
|
177
179
|
/** backlog #389 — one-way latch set by {@link abort}. Read by `drainQueuedMessages`: no boundary may
|
|
178
180
|
* hand a queued frame to the model once the run is unwinding, and — crucially — none may SPLICE one
|
|
179
181
|
* out of the queue either (that would delete the terminal undrained account the abort path owes it). */
|
|
@@ -308,6 +310,8 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
308
310
|
private maxOutputTokensPerCall?;
|
|
309
311
|
private stallTimeoutsPerCall?;
|
|
310
312
|
private abortResultDetails?;
|
|
313
|
+
private executeTool?;
|
|
314
|
+
private activeRun?;
|
|
311
315
|
private loopTrace?;
|
|
312
316
|
private onToolInputValidationFault?;
|
|
313
317
|
private onToolMediaRefused?;
|
|
@@ -347,6 +351,12 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
347
351
|
private createTurnState;
|
|
348
352
|
private createContext;
|
|
349
353
|
private createStreamFn;
|
|
354
|
+
/** May a drain take this frame now? The one predicate of the drain, the immediate re-check and {@link pendingInjectionCount}.
|
|
355
|
+
* A person's or caller's frame always may. An engine-authored frame is held — a drained steer makes a request — under
|
|
356
|
+
* the human-halt hold ({@link engineInjectionsHeld}), and an ADVISORY is held where the loop's own work owes no request
|
|
357
|
+
* (`continuing` false): it rides a request, never makes one; a notification's payload is an event and may continue a
|
|
358
|
+
* run. Held frames stay queued: later input drains past them, an owed drain takes them, else they end with the run. */
|
|
359
|
+
private isDrainable;
|
|
350
360
|
private drainQueuedMessages;
|
|
351
361
|
/** #389 — drop these frames from the in-flight account (they went back on a queue, or they landed). */
|
|
352
362
|
private unbookInFlight;
|
|
@@ -371,7 +381,7 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
371
381
|
private validateToolNames;
|
|
372
382
|
private flushPendingSessionWrites;
|
|
373
383
|
/**
|
|
374
|
-
* #506 ㋐ — write the transcript's record of a TERMINAL provider failure
|
|
384
|
+
* #506 ㋐ — write the transcript's record of a TERMINAL provider failure.
|
|
375
385
|
*
|
|
376
386
|
* A SEPARATE object, never the live frame: `failure` is the engine's terminal error shell and every
|
|
377
387
|
* other consumer of it (the run result, failover, telemetry, usage accounting) reads its real
|
|
@@ -466,7 +476,7 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
466
476
|
* no frame whose consumption could make the cut self-defeating, so the seat's own liveness is
|
|
467
477
|
* the only guard. The cut settles exactly as every S1 cut does: finished tool calls keep
|
|
468
478
|
* their REAL results, never-started ones settle as paired interrupted results, the
|
|
469
|
-
*
|
|
479
|
+
* the interruption marker lands.
|
|
470
480
|
*
|
|
471
481
|
* Returns `{ turnCut, accepted }` — `turnCut` `true` iff THIS call aborted a live turn seat (an
|
|
472
482
|
* in-flight provider stream / tool batch will settle as interrupted; the completion-race arm is
|
|
@@ -489,7 +499,7 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
489
499
|
* consults the latch at its own boundary, so the stop is provably in place when the forced
|
|
490
500
|
* boundary arrives (the enqueue-then-abort discipline, one lane over).
|
|
491
501
|
*
|
|
492
|
-
* Queued injection frames are deliberately NOT touched (
|
|
502
|
+
* Queued injection frames are deliberately NOT touched (the reference's `control_request:"interrupt"`
|
|
493
503
|
* keeps the queue and answers `still_queued` — see {@link abort}'s recorded ruling): whatever
|
|
494
504
|
* the queues hold settles by the run's ordinary terminal contract for accepted-but-undelivered
|
|
495
505
|
* input (durable park when a suspend seat exists, else the loud undrained accounts).
|
|
@@ -503,6 +513,15 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
503
513
|
* the loop takes the run-terminal path and never reports that settlement, so the consumption is recorded here, the
|
|
504
514
|
* only point that can see the causation (synchronous, single-threaded). A LATER abort is the run's own ending. */
|
|
505
515
|
private cutSeat;
|
|
516
|
+
/** The entry ids of the committed messages an answer `prompt()` returned was read from, in conversation order: the
|
|
517
|
+
* final assistant message, or every member of the continuation chain merged into it (members never appended — an
|
|
518
|
+
* empty failure — have no id). Bound to the returned object, so a prompt that rejects, or one overlapping another,
|
|
519
|
+
* hands its caller nothing to misread. Empty for `undefined` (no answer, read from nothing); `undefined` when the
|
|
520
|
+
* sources are not this harness's to state — an object it did not return, or an answer read from a message the
|
|
521
|
+
* transcript held before the run began whose append this harness never saw. */
|
|
522
|
+
answerEntryIdsOf(answer: AssistantMessage | undefined): readonly string[] | undefined;
|
|
523
|
+
/** Record what an answer was read from (the append receipts of its source messages) and hand the answer back. */
|
|
524
|
+
private answeredFrom;
|
|
506
525
|
/** The harness's statement of what this run's halt (and its stop siblings) did — {@link HaltConsumption}. Readable
|
|
507
526
|
* during the run and after `prompt()` settled (cleared by the NEXT prompt). */
|
|
508
527
|
haltConsumption(): HaltConsumption;
|
|
@@ -516,10 +535,10 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
516
535
|
private noteTurnCutConsumed;
|
|
517
536
|
/**
|
|
518
537
|
* design/373 §3.3 (the final-commit-point double check) — how many queued injection frames a
|
|
519
|
-
* boundary drain could deliver RIGHT NOW
|
|
520
|
-
*
|
|
521
|
-
*
|
|
522
|
-
*
|
|
538
|
+
* boundary drain could deliver RIGHT NOW where the loop's own work owes none ({@link isDrainable}, `continuing` false):
|
|
539
|
+
* what could continue the run (an unwinding run drains nothing — its frames belong to the terminal account).
|
|
540
|
+
* Synchronous and side-effect-free by contract: the loop reads it between its last drain and the terminal
|
|
541
|
+
* commit, with zero awaits.
|
|
523
542
|
*/
|
|
524
543
|
pendingInjectionCount(): number;
|
|
525
544
|
/** design/373 §3.4-3 — the pre-request re-check's drain half (see the loop-config seam): sweep
|
|
@@ -544,6 +563,17 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
544
563
|
finalizeToolCall(toolCall: AgentToolCall, args: unknown, executed: ExecutedToolCallOutcome): Promise<ExecutedToolCallOutcome & {
|
|
545
564
|
toolCall: AgentToolCall;
|
|
546
565
|
}>;
|
|
566
|
+
/**
|
|
567
|
+
* A call the host makes while a run is running (an extension's `$.tool.call`): the loop's own per-call pipeline
|
|
568
|
+
* ({@link runToolCall}) under the run's config and current roster — announced, judged at the gate, executed through the
|
|
569
|
+
* execution seat, finalized and closed on the run's event stream — with no model message carrying it and nothing added
|
|
570
|
+
* to the transcript. `admit` reads the tool the name resolves to before anything is announced; its throw is the caller's.
|
|
571
|
+
* Throws when no run is running or the run mounts no tool of that name.
|
|
572
|
+
*/
|
|
573
|
+
callTool(toolCall: AgentToolCall, signal: AbortSignal | undefined, admit: (tool: AgentTool) => void): Promise<Awaited<ReturnType<typeof runToolCall>>["finalized"]>;
|
|
574
|
+
/** Whether the loop would run this call beside others (`isBatchSafeToolCall`, the partitioner's own predicate) on the running
|
|
575
|
+
* prompt's roster — false for a name it does not mount, and when no prompt is running. */
|
|
576
|
+
isBatchSafe(toolName: string, args: unknown): boolean;
|
|
547
577
|
getModel(): Model;
|
|
548
578
|
/** The ref that chose the CURRENT model — {@link getModel}'s companion (a word re-resolves, an object pins). */
|
|
549
579
|
getModelRef(): import("../../core/model-seat.js").ModelRef;
|
|
@@ -607,7 +637,7 @@ export declare class AgentHarness<TSkill extends Skill = Skill, TPromptTemplate
|
|
|
607
637
|
followUp: number;
|
|
608
638
|
};
|
|
609
639
|
/**
|
|
610
|
-
* backlog #389 (
|
|
640
|
+
* backlog #389 (`control_request:"interrupt"`) — an interrupt does
|
|
611
641
|
* NOT destroy accepted user input. CC's default keeps the queue and answers `still_queued`; only an
|
|
612
642
|
* explicit `cancel_queued` cancels, with a per-uuid `cancelled` receipt. This harness had the opposite
|
|
613
643
|
* polarity: both queues were emptied unconditionally and the contents handed back on a result object
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createAssistantMessageEventStream, ensureToolTurnInvariants, snapshotActorAssertion, stripEngineMetadata, userAttachmentOf } from "../llm/index.js";
|
|
2
|
-
import { finalizeToolOutcome, runAgentLoop } from "../loop/agent-loop.js";
|
|
1
|
+
import { createAssistantMessageEventStream, ensureToolTurnInvariants, findToolByName, snapshotActorAssertion, stripEngineMetadata, userAttachmentOf } from "../llm/index.js";
|
|
2
|
+
import { finalizeToolOutcome, isBatchSafeToolCall, runAgentLoop, runToolCall } from "../loop/agent-loop.js";
|
|
3
3
|
import { resolveAgentCoreStreamFn } from "../loop/runtime-deps.js";
|
|
4
4
|
import { normalizeEngineSegments } from "../../core/untrusted-text.js";
|
|
5
5
|
import { isCredentialHeaderName } from "../../core/secret-env.js";
|
|
@@ -43,6 +43,9 @@ function createTrailingMessage(seed) {
|
|
|
43
43
|
}
|
|
44
44
|
const engineNotePayloads = new WeakMap();
|
|
45
45
|
const engineAuthoredInjections = new WeakSet();
|
|
46
|
+
function isEngineAdvisory(m) {
|
|
47
|
+
return engineAuthoredInjections.has(m) && !engineNotePayloads.has(m);
|
|
48
|
+
}
|
|
46
49
|
const userInputParkRecords = new WeakMap();
|
|
47
50
|
const drainedFromLane = new WeakMap();
|
|
48
51
|
const immediateClassInjections = new WeakSet();
|
|
@@ -205,6 +208,8 @@ export class AgentHarness {
|
|
|
205
208
|
seatCutSources = new WeakMap();
|
|
206
209
|
trailingBatchEndedOn;
|
|
207
210
|
turnCutConsumed;
|
|
211
|
+
committedEntryIds = new WeakMap();
|
|
212
|
+
answerSources = new WeakMap();
|
|
208
213
|
aborting = false;
|
|
209
214
|
drainedPendingInjection = [];
|
|
210
215
|
runAbortController;
|
|
@@ -292,6 +297,8 @@ export class AgentHarness {
|
|
|
292
297
|
maxOutputTokensPerCall;
|
|
293
298
|
stallTimeoutsPerCall;
|
|
294
299
|
abortResultDetails;
|
|
300
|
+
executeTool;
|
|
301
|
+
activeRun;
|
|
295
302
|
loopTrace;
|
|
296
303
|
onToolInputValidationFault;
|
|
297
304
|
onToolMediaRefused;
|
|
@@ -328,6 +335,7 @@ export class AgentHarness {
|
|
|
328
335
|
this.maxOutputTokensPerCall = options.maxOutputTokensPerCall;
|
|
329
336
|
this.stallTimeoutsPerCall = options.stallTimeoutsPerCall;
|
|
330
337
|
this.abortResultDetails = options.abortResultDetails;
|
|
338
|
+
this.executeTool = options.executeTool;
|
|
331
339
|
this.loopTrace = options.loopTrace;
|
|
332
340
|
this.onToolInputValidationFault = options.onToolInputValidationFault;
|
|
333
341
|
this.onToolMediaRefused = options.onToolMediaRefused;
|
|
@@ -548,28 +556,34 @@ export class AgentHarness {
|
|
|
548
556
|
});
|
|
549
557
|
};
|
|
550
558
|
}
|
|
551
|
-
|
|
552
|
-
|
|
559
|
+
isDrainable(m, continuing) {
|
|
560
|
+
if (!engineAuthoredInjections.has(m))
|
|
561
|
+
return true;
|
|
562
|
+
if (this.engineInjectionsHeld?.() === true)
|
|
563
|
+
return false;
|
|
564
|
+
return continuing || !isEngineAdvisory(m);
|
|
565
|
+
}
|
|
566
|
+
async drainQueuedMessages(queue, mode, continuing) {
|
|
553
567
|
if (this.aborting)
|
|
554
568
|
return [];
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
569
|
+
const messages = [];
|
|
570
|
+
let first;
|
|
571
|
+
let selecting = true;
|
|
572
|
+
for (let i = 0; i < queue.length; i++) {
|
|
573
|
+
const m = queue[i];
|
|
574
|
+
if (!this.isDrainable(m, continuing))
|
|
575
|
+
continue;
|
|
576
|
+
if (!isEngineAdvisory(m)) {
|
|
577
|
+
if (!selecting)
|
|
560
578
|
continue;
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
let count = mode === "all" ? queue.length : 1;
|
|
567
|
-
if (mode !== "all" && queue.length > 1 && engineNotePayloads.has(queue[0])) {
|
|
568
|
-
count = 1;
|
|
569
|
-
while (count < queue.length && engineNotePayloads.has(queue[count]))
|
|
570
|
-
count++;
|
|
579
|
+
if (mode !== "all" && first !== undefined && !(engineNotePayloads.has(first) && engineNotePayloads.has(m))) {
|
|
580
|
+
selecting = false;
|
|
581
|
+
continue;
|
|
582
|
+
}
|
|
583
|
+
first ??= m;
|
|
571
584
|
}
|
|
572
|
-
messages
|
|
585
|
+
messages.push(...queue.splice(i, 1));
|
|
586
|
+
i--;
|
|
573
587
|
}
|
|
574
588
|
if (messages.length === 0) {
|
|
575
589
|
return messages;
|
|
@@ -641,6 +655,7 @@ export class AgentHarness {
|
|
|
641
655
|
...(this.maxOutputTokensPerCall !== undefined ? { maxTokensPerCall: this.maxOutputTokensPerCall } : {}),
|
|
642
656
|
...(this.stallTimeoutsPerCall !== undefined ? { stallTimeoutsPerCall: this.stallTimeoutsPerCall } : {}),
|
|
643
657
|
...(this.abortResultDetails !== undefined ? { abortResultDetails: this.abortResultDetails } : {}),
|
|
658
|
+
...(this.executeTool !== undefined ? { executeTool: this.executeTool } : {}),
|
|
644
659
|
...(this.onToolInputValidationFault !== undefined ? { onToolInputValidationFault: this.onToolInputValidationFault } : {}),
|
|
645
660
|
...(this.onToolMediaRefused !== undefined ? { onToolMediaRefused: this.onToolMediaRefused } : {}),
|
|
646
661
|
...(this.resilience !== undefined ? { resilience: this.resilience } : {}),
|
|
@@ -682,9 +697,9 @@ export class AgentHarness {
|
|
|
682
697
|
return result;
|
|
683
698
|
},
|
|
684
699
|
afterToolCall: ({ toolCall, args, result, isError }) => this.afterToolCallHook(toolCall, args, result, isError),
|
|
685
|
-
prepareNextTurn: async () => {
|
|
700
|
+
prepareNextTurn: async ({ continues }) => {
|
|
686
701
|
await this.flushPendingSessionWrites();
|
|
687
|
-
await this.emitHook({ type: "turn_boundary", model: this.model });
|
|
702
|
+
await this.emitHook({ type: "turn_boundary", model: this.model, continues });
|
|
688
703
|
const nextTurnState = await this.createTurnState();
|
|
689
704
|
setTurnState(nextTurnState);
|
|
690
705
|
return {
|
|
@@ -693,7 +708,7 @@ export class AgentHarness {
|
|
|
693
708
|
thinkingLevel: nextTurnState.thinkingLevel,
|
|
694
709
|
};
|
|
695
710
|
},
|
|
696
|
-
getSteeringMessages: async () => this.drainQueuedMessages(this.steerQueue, this.steeringQueueMode),
|
|
711
|
+
getSteeringMessages: async (continuing) => this.drainQueuedMessages(this.steerQueue, this.steeringQueueMode, continuing),
|
|
697
712
|
publishTurnInterruptSeat: (seat) => {
|
|
698
713
|
if (seat !== undefined) {
|
|
699
714
|
this.lastPublishedSeat = seat;
|
|
@@ -705,7 +720,7 @@ export class AgentHarness {
|
|
|
705
720
|
recheckImmediateInjections: async (pending) => this.absorbImmediateSteering(pending),
|
|
706
721
|
pendingInjectionCount: () => this.pendingInjectionCount(),
|
|
707
722
|
getFollowUpMessages: async () => {
|
|
708
|
-
const queued = await this.drainQueuedMessages(this.followUpQueue, this.followUpQueueMode);
|
|
723
|
+
const queued = await this.drainQueuedMessages(this.followUpQueue, this.followUpQueueMode, false);
|
|
709
724
|
if (queued.length > 0)
|
|
710
725
|
return queued;
|
|
711
726
|
return this.stopGate ? await this.stopGate() : queued;
|
|
@@ -825,6 +840,7 @@ export class AgentHarness {
|
|
|
825
840
|
let entryId;
|
|
826
841
|
if (!isEmptyFailureAssistant(event.message)) {
|
|
827
842
|
entryId = await this.session.appendMessage(event.message);
|
|
843
|
+
this.committedEntryIds.set(event.message, entryId);
|
|
828
844
|
this.settleInjectedFrame(event.message, entryId);
|
|
829
845
|
if (entryId !== undefined && event.message.role === "toolResult" && typeof event.message.toolCallId === "string") {
|
|
830
846
|
try {
|
|
@@ -934,9 +950,12 @@ export class AgentHarness {
|
|
|
934
950
|
const setTurnState = (nextTurnState) => {
|
|
935
951
|
activeTurnState = nextTurnState;
|
|
936
952
|
};
|
|
953
|
+
const loopConfig = this.createLoopConfig(getTurnState, setTurnState, beforeResult?.systemPrompt);
|
|
954
|
+
const emitRunEvent = (event) => this.handleAgentEvent(event, abortController.signal);
|
|
955
|
+
this.activeRun = { config: loopConfig, context: () => this.createContext(getTurnState(), beforeResult?.systemPrompt), emit: emitRunEvent, signal: abortController.signal };
|
|
937
956
|
const runResultPromise = (async () => {
|
|
938
957
|
try {
|
|
939
|
-
return await runAgentLoop(takePrompts, this.createContext(turnState, beforeResult?.systemPrompt),
|
|
958
|
+
return await runAgentLoop(takePrompts, this.createContext(turnState, beforeResult?.systemPrompt), loopConfig, emitRunEvent, abortController.signal, this.createStreamFn(getTurnState), undefined, this.loopTrace, {
|
|
940
959
|
...(options?.settleUnansweredToolCalls !== undefined
|
|
941
960
|
? {
|
|
942
961
|
settle: {
|
|
@@ -966,13 +985,14 @@ export class AgentHarness {
|
|
|
966
985
|
for (let i = newMessages.length - 1; i >= 0; i--) {
|
|
967
986
|
const message = newMessages[i];
|
|
968
987
|
if (message.role === "assistant") {
|
|
969
|
-
|
|
988
|
+
const answer = mergeTruncatedOutputChain(newMessages, i);
|
|
989
|
+
return this.answeredFrom(answer.message, answer.members);
|
|
970
990
|
}
|
|
971
991
|
}
|
|
972
992
|
if (this.stopRequested || abortController.signal.aborted)
|
|
973
993
|
return undefined;
|
|
974
994
|
if (this.trailingBatchEndedOn !== undefined)
|
|
975
|
-
return this.trailingBatchEndedOn;
|
|
995
|
+
return this.answeredFrom(this.trailingBatchEndedOn, [this.trailingBatchEndedOn]);
|
|
976
996
|
throw new AgentHarnessError("invalid_state", "AgentHarness prompt completed without an assistant message");
|
|
977
997
|
}
|
|
978
998
|
finally {
|
|
@@ -981,6 +1001,7 @@ export class AgentHarness {
|
|
|
981
1001
|
}
|
|
982
1002
|
finally {
|
|
983
1003
|
this.runAbortController = undefined;
|
|
1004
|
+
this.activeRun = undefined;
|
|
984
1005
|
}
|
|
985
1006
|
}
|
|
986
1007
|
}
|
|
@@ -1136,6 +1157,21 @@ export class AgentHarness {
|
|
|
1136
1157
|
if (runQuietBefore && this.runAbortController?.signal.aborted === true)
|
|
1137
1158
|
this.turnCutConsumed = { source };
|
|
1138
1159
|
}
|
|
1160
|
+
answerEntryIdsOf(answer) {
|
|
1161
|
+
return answer === undefined ? [] : this.answerSources.get(answer);
|
|
1162
|
+
}
|
|
1163
|
+
answeredFrom(answer, members) {
|
|
1164
|
+
const ids = [];
|
|
1165
|
+
for (const m of members) {
|
|
1166
|
+
const id = this.committedEntryIds.get(m);
|
|
1167
|
+
if (id !== undefined)
|
|
1168
|
+
ids.push(id);
|
|
1169
|
+
else if (this.runHistory?.has(m) === true)
|
|
1170
|
+
return answer;
|
|
1171
|
+
}
|
|
1172
|
+
this.answerSources.set(answer, ids);
|
|
1173
|
+
return answer;
|
|
1174
|
+
}
|
|
1139
1175
|
haltConsumption() {
|
|
1140
1176
|
const turnCut = this.turnCutConsumed?.source;
|
|
1141
1177
|
return {
|
|
@@ -1160,20 +1196,18 @@ export class AgentHarness {
|
|
|
1160
1196
|
pendingInjectionCount() {
|
|
1161
1197
|
if (this.aborting)
|
|
1162
1198
|
return 0;
|
|
1163
|
-
const
|
|
1164
|
-
const drainable = (q) => held ? q.filter((m) => !engineAuthoredInjections.has(m)).length : q.length;
|
|
1199
|
+
const drainable = (q) => q.filter((m) => this.isDrainable(m, false)).length;
|
|
1165
1200
|
return drainable(this.steerQueue) + drainable(this.followUpQueue);
|
|
1166
1201
|
}
|
|
1167
1202
|
async absorbImmediateSteering(pending) {
|
|
1168
1203
|
if (this.aborting)
|
|
1169
1204
|
return pending;
|
|
1170
|
-
const held = this.engineInjectionsHeld?.() === true;
|
|
1171
1205
|
const taken = [];
|
|
1172
1206
|
for (let i = 0; i < this.steerQueue.length; i++) {
|
|
1173
1207
|
const m = this.steerQueue[i];
|
|
1174
1208
|
if (!immediateClassInjections.has(m))
|
|
1175
1209
|
break;
|
|
1176
|
-
if (
|
|
1210
|
+
if (!this.isDrainable(m, true))
|
|
1177
1211
|
continue;
|
|
1178
1212
|
taken.push(...this.steerQueue.splice(i, 1));
|
|
1179
1213
|
i--;
|
|
@@ -1237,6 +1271,23 @@ export class AgentHarness {
|
|
|
1237
1271
|
finalizeToolCall(toolCall, args, executed) {
|
|
1238
1272
|
return finalizeToolOutcome(toolCall, executed, (result, isError) => this.afterToolCallHook(toolCall, args, result, isError), this.onToolMediaRefused);
|
|
1239
1273
|
}
|
|
1274
|
+
async callTool(toolCall, signal, admit) {
|
|
1275
|
+
const run = this.activeRun;
|
|
1276
|
+
if (run === undefined)
|
|
1277
|
+
throw new AgentHarnessError("invalid_state", "a host's tool call runs inside a running prompt, and none is running");
|
|
1278
|
+
const context = run.context();
|
|
1279
|
+
const tool = findToolByName(context.tools, toolCall.name);
|
|
1280
|
+
if (tool === undefined)
|
|
1281
|
+
throw new AgentHarnessError("invalid_state", `no tool named "${toolCall.name}" in this run (it has ${(context.tools ?? []).map((t) => t.name).join(", ") || "none"})`);
|
|
1282
|
+
admit(tool);
|
|
1283
|
+
const both = signal !== undefined ? AbortSignal.any([signal, run.signal]) : run.signal;
|
|
1284
|
+
return (await runToolCall(context, undefined, toolCall, run.config, both, run.emit)).finalized;
|
|
1285
|
+
}
|
|
1286
|
+
isBatchSafe(toolName, args) {
|
|
1287
|
+
const tools = this.activeRun?.context().tools;
|
|
1288
|
+
const tool = findToolByName(tools, toolName);
|
|
1289
|
+
return tool !== undefined && isBatchSafeToolCall(tool, { type: "toolCall", id: "", name: toolName, arguments: (typeof args === "object" && args !== null ? args : {}) });
|
|
1290
|
+
}
|
|
1240
1291
|
getModel() {
|
|
1241
1292
|
return this.model;
|
|
1242
1293
|
}
|
|
@@ -1456,6 +1507,7 @@ function mergeTruncatedOutputChain(messages, lastAssistantIndex) {
|
|
|
1456
1507
|
const last = messages[lastAssistantIndex];
|
|
1457
1508
|
const lastText = last.content.map((c) => (c.type === "text" ? c.text : "")).join("");
|
|
1458
1509
|
const parts = [];
|
|
1510
|
+
const members = [last];
|
|
1459
1511
|
let i = lastAssistantIndex;
|
|
1460
1512
|
while (i - 2 >= 0) {
|
|
1461
1513
|
const mid = messages[i - 1];
|
|
@@ -1470,18 +1522,20 @@ function mergeTruncatedOutputChain(messages, lastAssistantIndex) {
|
|
|
1470
1522
|
if (!step)
|
|
1471
1523
|
break;
|
|
1472
1524
|
parts.unshift(head.content.map((c) => (c.type === "text" ? c.text : "")).join(""));
|
|
1525
|
+
members.unshift(head);
|
|
1473
1526
|
i = i - 2;
|
|
1474
1527
|
}
|
|
1475
1528
|
if (parts.length === 0) {
|
|
1476
|
-
return last;
|
|
1529
|
+
return { message: last, members };
|
|
1477
1530
|
}
|
|
1478
|
-
|
|
1531
|
+
const message = {
|
|
1479
1532
|
...last,
|
|
1480
1533
|
content: [
|
|
1481
1534
|
{ type: "text", text: parts.join("") + lastText },
|
|
1482
1535
|
...last.content.filter((c) => c.type !== "text"),
|
|
1483
1536
|
],
|
|
1484
1537
|
};
|
|
1538
|
+
return { message, members };
|
|
1485
1539
|
}
|
|
1486
1540
|
function toLintErrorObject(value, fallbackMessage) {
|
|
1487
1541
|
if (value instanceof Error) {
|
|
@@ -2,6 +2,7 @@ import type { PromptEpochDescriptor } from "../../prompt-assembly/epoch.js";
|
|
|
2
2
|
import type { DocumentContent, ImageContent, Model, SimpleStreamOptions, TextContent, Transport } from "../llm/index.js";
|
|
3
3
|
import type { AfterToolCallResult, AgentEvent, AgentMessage, AgentTool, BeforeToolCallResult, QueueMode, ThinkingLevel } from "../loop/types.js";
|
|
4
4
|
import type { AgentCoreRuntimeDeps } from "../loop/runtime-deps.js";
|
|
5
|
+
import type { SecretEnvFinding } from "../../core/secret-env.js";
|
|
5
6
|
/** Result of a fallible operation. Expected failures are returned as `ok: false` instead of thrown. */
|
|
6
7
|
export type Result<TValue, TError> = {
|
|
7
8
|
ok: true;
|
|
@@ -103,7 +104,11 @@ export interface WriteReceipt {
|
|
|
103
104
|
created: boolean;
|
|
104
105
|
}
|
|
105
106
|
/** Stable, backend-independent file error codes returned by {@link FileSystem} file operations. */
|
|
106
|
-
export type FileErrorCode = "aborted" | "not_found" | "permission_denied" | "not_directory" | "is_directory"
|
|
107
|
+
export type FileErrorCode = "aborted" | "not_found" | "permission_denied" | "not_directory" | "is_directory"
|
|
108
|
+
/** A name this filesystem cannot hold (POSIX `ENAMETOOLONG` for a path component past `NAME_MAX`) — nothing can be there, and
|
|
109
|
+
* a program that opens it fails the same way: an absence as conclusive as `not_found`. A path past `PATH_MAX` whose
|
|
110
|
+
* components are short is not this word (such a file may exist, reached from a directory below it). */
|
|
111
|
+
| "name_too_long" | "invalid" | "not_supported"
|
|
107
112
|
/** Exclusive create refused because the path already exists ({@link FileSystem.writeFileExclusive},
|
|
108
113
|
* POSIX `O_EXCL` shape). Discriminable so a caller can distinguish "lost the create race" from a
|
|
109
114
|
* write failure and give honest guidance instead of overwriting. */
|
|
@@ -194,7 +199,7 @@ export declare class ExecutionError extends Error {
|
|
|
194
199
|
* TB triple-fake-green report (2026-07-13) — output produced BEFORE the failure, for the
|
|
195
200
|
* ran-then-cut codes (`timeout` / `liveness_no_output` / `aborted` / `callback_error`; the last is a command that
|
|
196
201
|
* started and was then killed because a host-side output callback failed — its completion was
|
|
197
|
-
* never observed, but its captured output is real work).
|
|
202
|
+
* never observed, but its captured output is real work). Reference behavior (BashTask settle): a
|
|
198
203
|
* timed-out command keeps ALL captured stdout/stderr and only APPENDS a "Command timed out after
|
|
199
204
|
* X" line — discarding 600s of build logs forces the model to rerun blind. Optional: envs that
|
|
200
205
|
* cannot capture partial output simply omit these; never-started codes
|
|
@@ -325,7 +330,7 @@ export interface ExecutionEnvExecOptions {
|
|
|
325
330
|
*/
|
|
326
331
|
detachSignal?: AbortSignal;
|
|
327
332
|
/**
|
|
328
|
-
* RB-198 F1 (form-one audit
|
|
333
|
+
* RB-198 F1 (form-one audit) — when this command's OWN timeout
|
|
329
334
|
* fires, an env that supports detach ADOPTS the running child as a background process (the same
|
|
330
335
|
* mechanism `detachSignal` uses) instead of killing it, settling the exec with
|
|
331
336
|
* `detached: {shellId, cause:"timeout"}` — a non-idempotent long command survives its own timeout
|
|
@@ -550,6 +555,11 @@ export interface ExecutionEnv extends FileSystem, Shell {
|
|
|
550
555
|
readonly homeDir?: string;
|
|
551
556
|
/** #1554 — the `CDPATH` entries the shell child receives (`[]` = none), or `"unknown"` when the adapter cannot say. */
|
|
552
557
|
readonly cdPath: readonly string[] | "unknown";
|
|
558
|
+
/** #1963 — the entries of the environment the shell child inherits that it does NOT receive: the findings of the one
|
|
559
|
+
* composition its spawns read (`inheritedHostEnv(policy, findings)`), less the keys the adapter's explicit grants
|
|
560
|
+
* re-supply — names and rules, never a value. `[]` = none withheld, or none inherited (a shell environment built
|
|
561
|
+
* rather than inherited from this process); `"unknown"` = the adapter cannot say. A read: it announces nothing. */
|
|
562
|
+
readonly withheldEnv: readonly SecretEnvFinding[] | "unknown";
|
|
553
563
|
}
|
|
554
564
|
/** Base fields shared by append-only session tree entries. */
|
|
555
565
|
export interface SessionTreeEntryBase {
|
|
@@ -665,6 +675,14 @@ export interface AnnouncedListingSnapshot {
|
|
|
665
675
|
models?: string[];
|
|
666
676
|
mcpFailed?: AnnouncedMcpFailure[];
|
|
667
677
|
advisories?: string[];
|
|
678
|
+
advisor?: AnnouncedAdvisorState;
|
|
679
|
+
}
|
|
680
|
+
/** What the model was told about the advisor tool, and in which SEGMENT of the conversation — the id of the branch's
|
|
681
|
+
* latest compaction entry when the telling was delivered, `null` before any. A record from another segment reads as
|
|
682
|
+
* nothing told: a compaction summarized the telling away. */
|
|
683
|
+
export interface AnnouncedAdvisorState {
|
|
684
|
+
state: "announced" | "withdrawn";
|
|
685
|
+
segment: string | null;
|
|
668
686
|
}
|
|
669
687
|
/** The same snapshot as an APPEND input (borrowed arrays; the store copies through the shape gate). */
|
|
670
688
|
export interface AnnouncedListingSnapshotInput {
|
|
@@ -673,6 +691,7 @@ export interface AnnouncedListingSnapshotInput {
|
|
|
673
691
|
models?: readonly string[];
|
|
674
692
|
mcpFailed?: ReadonlyArray<AnnouncedMcpFailure>;
|
|
675
693
|
advisories?: readonly string[];
|
|
694
|
+
advisor?: Readonly<AnnouncedAdvisorState>;
|
|
676
695
|
}
|
|
677
696
|
/**
|
|
678
697
|
* REF-D3/D4 merge target: the active EnterWorktree session (M22 live-CC anchor —
|
|
@@ -841,8 +860,8 @@ export declare function isValidModelChange(e: {
|
|
|
841
860
|
modelId?: unknown;
|
|
842
861
|
}): boolean;
|
|
843
862
|
/**
|
|
844
|
-
* #506 ㋐ — the reserved `model` value on a transcript entry NO MODEL PRODUCED.
|
|
845
|
-
* (`"<synthetic>"`,
|
|
863
|
+
* #506 ㋐ — the reserved `model` value on a transcript entry NO MODEL PRODUCED. Spelled as in the reference
|
|
864
|
+
* (`"<synthetic>"`, its own single-occurrence constant), and single-occurrence here for the
|
|
846
865
|
* same reason: the mint site and the recognition predicate must read the same literal or the entry
|
|
847
866
|
* becomes unrecognizable the first time one of them is retyped.
|
|
848
867
|
*
|
|
@@ -904,6 +923,24 @@ export interface SessionMetadata {
|
|
|
904
923
|
incarnation?: string;
|
|
905
924
|
/** Fork lineage's OCCUPANT half: the source row's `incarnation` at fork time (the occupant copied, not whoever holds `forkedFrom` later); absent = unknown. */
|
|
906
925
|
forkedFromIncarnation?: string;
|
|
926
|
+
/** WHO owns this row, recorded by the write that creates it and changed by no later write; `null` = anonymous; absent reads as `null`. */
|
|
927
|
+
owner?: string | null;
|
|
928
|
+
}
|
|
929
|
+
/**
|
|
930
|
+
* One row of {@link SessionRepo.list}: the row's metadata, plus the newest activity the repo records for the row. `lastActiveAt` is
|
|
931
|
+
* epoch ms — on the File repo its log's modification time (every write to a row is an append to its log, and {@link SessionRepo.touch}
|
|
932
|
+
* moves the same time), on the in-memory repo its last {@link SessionRepo.touch} (it never sees its sessions' writes). Absent = the repo
|
|
933
|
+
* records none; a reader then takes the row's `createdAt`. It is what the repo records, never what one process saw — so a dropped
|
|
934
|
+
* cache, a restart or another replica reads the same time, and only a later activity moves it.
|
|
935
|
+
*/
|
|
936
|
+
export type SessionRow<TMetadata extends SessionMetadata = SessionMetadata> = TMetadata & {
|
|
937
|
+
readonly lastActiveAt?: number;
|
|
938
|
+
};
|
|
939
|
+
/** One row's owner, occupant (`undefined` = unknown) and active leaf (`null` = none), read in ONE read so the three answer for one row generation. */
|
|
940
|
+
export interface SessionHead {
|
|
941
|
+
readonly owner: string | null;
|
|
942
|
+
readonly incarnation: string | undefined;
|
|
943
|
+
readonly leafId: string | null;
|
|
907
944
|
}
|
|
908
945
|
export interface JsonlSessionMetadata extends SessionMetadata {
|
|
909
946
|
cwd: string;
|
|
@@ -1050,6 +1087,8 @@ export interface SessionCreateOptions {
|
|
|
1050
1087
|
placement?: Omit<SessionPlacementRecord, "placedAt"> & {
|
|
1051
1088
|
placedAt?: number;
|
|
1052
1089
|
};
|
|
1090
|
+
/** The owner the creating write records (absent ⇒ `null`; on a fork, absent or `null` ⇒ the copied source row's); a create over an existing id records nothing. */
|
|
1091
|
+
owner?: string | null;
|
|
1053
1092
|
}
|
|
1054
1093
|
export interface SessionForkOptions {
|
|
1055
1094
|
entryId?: string;
|
|
@@ -1059,7 +1098,12 @@ export interface SessionForkOptions {
|
|
|
1059
1098
|
export interface SessionRepo<TMetadata extends SessionMetadata = SessionMetadata, TCreateOptions extends SessionCreateOptions = SessionCreateOptions, TListOptions = void> {
|
|
1060
1099
|
create(options: TCreateOptions): Promise<Session<TMetadata>>;
|
|
1061
1100
|
open(metadata: TMetadata): Promise<Session<TMetadata>>;
|
|
1062
|
-
|
|
1101
|
+
/** Every ordinary row (placed rows are not listed), each with the newest write the repo holds for it ({@link SessionRow}), in no
|
|
1102
|
+
* promised order. The source `TtlSessionStore.list` reads; the store, not the repo, orders, filters and pages. */
|
|
1103
|
+
list(options?: TListOptions): Promise<SessionRow<TMetadata>[]>;
|
|
1104
|
+
/** Record activity on the row now: the time {@link list} answers as the row's `lastActiveAt` moves to now. A missing row is a no-op; a
|
|
1105
|
+
* fault rejects. Optional: a repo without it records only what its writes record. */
|
|
1106
|
+
touch?(sessionId: string): Promise<void>;
|
|
1063
1107
|
delete(metadata: TMetadata): Promise<void>;
|
|
1064
1108
|
/** A fork is a NEW row: `options.id` equal to the source's id is refused (`invalid_fork_target`) — onto its source it would mint a new occupant over the source's own transcript. */
|
|
1065
1109
|
fork(source: TMetadata, options: SessionForkOptions & TCreateOptions): Promise<Session<TMetadata>>;
|
|
@@ -1070,10 +1114,11 @@ export interface SessionRepo<TMetadata extends SessionMetadata = SessionMetadata
|
|
|
1070
1114
|
* Optional — a backend that supports cross-backend session export/migration implements it.
|
|
1071
1115
|
*/
|
|
1072
1116
|
exportEntries?(sessionId: string): Promise<SessionTreeEntry[]>;
|
|
1117
|
+
/** The row's {@link SessionHead} in one read (`undefined` = no row); `TtlSessionStore` has a head read and an ownership pair only over a repo that has this. */
|
|
1118
|
+
headOf?(sessionId: string): Promise<SessionHead | undefined>;
|
|
1073
1119
|
/**
|
|
1074
|
-
* 2c session-sync: write a verbatim entry log (produced by {@link exportEntries} on another backend) into
|
|
1075
|
-
*
|
|
1076
|
-
* from the bundle). The log MUST be passed through `validateEntriesForImport` first (the single fail-closed
|
|
1120
|
+
* 2c session-sync: write a verbatim entry log (produced by {@link exportEntries} on another backend) into `sessionId` (the log is
|
|
1121
|
+
* replaced, never the row: an existing row keeps its metadata whole; an absent id is a new row recording `owner`, `undefined` ⇒ `null` — the caller's principal, never the bundle's). The log MUST be passed through `validateEntriesForImport` first (the single fail-closed
|
|
1077
1122
|
* invariant gate); a durable backend persists THAT function's output, it does not re-implement the checks.
|
|
1078
1123
|
* Optional.
|
|
1079
1124
|
*
|
|
@@ -1160,6 +1205,8 @@ export interface TurnBoundaryEvent {
|
|
|
1160
1205
|
type: "turn_boundary";
|
|
1161
1206
|
/** The model that will run the next turn (authoritative under a mid-task model switch). */
|
|
1162
1207
|
model: Model;
|
|
1208
|
+
/** The loop's continuation fact, as defined at {@link import("../loop/types.js").PrepareNextTurnContext.continues}. */
|
|
1209
|
+
continues: boolean;
|
|
1163
1210
|
}
|
|
1164
1211
|
export interface BeforeProviderRequestEvent {
|
|
1165
1212
|
type: "before_provider_request";
|
|
@@ -1442,6 +1489,8 @@ export interface AgentHarnessOptions<TSkill extends Skill = Skill, TPromptTempla
|
|
|
1442
1489
|
* texts themselves never change.
|
|
1443
1490
|
*/
|
|
1444
1491
|
abortResultDetails?: () => Record<string, unknown> | undefined;
|
|
1492
|
+
/** The host's station around one tool execution, forwarded verbatim to the loop config (`AgentLoopConfig.executeTool`). */
|
|
1493
|
+
executeTool?: import("../loop/types.js").AgentLoopConfig["executeTool"];
|
|
1445
1494
|
/**
|
|
1446
1495
|
* C2: the loop's recovery/terminal trace sink, forwarded to `runAgentLoop`'s trace
|
|
1447
1496
|
* parameter (previously test-only — never passed in production, so the loop's six self-heal
|
|
@@ -212,7 +212,17 @@ export function normalizeAnnouncedListing(v) {
|
|
|
212
212
|
const models = arm(src.models);
|
|
213
213
|
const mcpFailed = failureArm(src.mcpFailed);
|
|
214
214
|
const advisories = arm(src.advisories);
|
|
215
|
-
|
|
215
|
+
const advisorArm = (a) => {
|
|
216
|
+
if (a === undefined)
|
|
217
|
+
return undefined;
|
|
218
|
+
if (typeof a !== "object" || a === null)
|
|
219
|
+
return null;
|
|
220
|
+
const { state, segment } = a;
|
|
221
|
+
const segmentOk = segment === null || (typeof segment === "string" && segment.length <= ANNOUNCED_LISTING_MAX_NAME_CHARS);
|
|
222
|
+
return (state === "announced" || state === "withdrawn") && segmentOk ? { state, segment: segment } : null;
|
|
223
|
+
};
|
|
224
|
+
const advisor = advisorArm(src.advisor);
|
|
225
|
+
if (agents === null || skills === null || models === null || mcpFailed === null || advisories === null || advisor === null)
|
|
216
226
|
return undefined;
|
|
217
227
|
return {
|
|
218
228
|
...(agents !== undefined ? { agents } : {}),
|
|
@@ -220,5 +230,6 @@ export function normalizeAnnouncedListing(v) {
|
|
|
220
230
|
...(models !== undefined ? { models } : {}),
|
|
221
231
|
...(mcpFailed !== undefined ? { mcpFailed } : {}),
|
|
222
232
|
...(advisories !== undefined ? { advisories } : {}),
|
|
233
|
+
...(advisor !== undefined ? { advisor } : {}),
|
|
223
234
|
};
|
|
224
235
|
}
|