@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 { snapshotActorAssertion } from "../../internal/llm.js";
|
|
2
2
|
import { redactThenCut } from "../../agents/subagent-steps.js";
|
|
3
|
-
import {
|
|
3
|
+
import { isEngineQuestionFace } from "../ask-question.js";
|
|
4
4
|
import { CheckpointError, readPendingSteerQueue, realApprovalOrgFact, remainingBudgetMicroUsd } from "../checkpoint-store.js";
|
|
5
5
|
import { normalizePersistedRuleHit } from "../rule-lane-reads.js";
|
|
6
6
|
import { decidersNote, SETTLEMENT_NOBODY_JUDGED } from "../gate-outcome.js";
|
|
@@ -21,14 +21,16 @@ import { hasDestroy } from "../remote-env.js";
|
|
|
21
21
|
import { advertisedWritableRootsSeat, attestationOf, exemptRootsSeat, humanRefusalSentence, licenseCovers, ownedReading, policyCannotAnswer, policyRefusalMessage, refuseOutOfContractDecision } from "../tool-policy.js";
|
|
22
22
|
import { failedJudgmentDeny } from "./policy-throw.js";
|
|
23
23
|
import { pathDenialCardOf } from "../../tools/fs/safety.js";
|
|
24
|
-
import { callFaceSeat, parkedRowLiveFace, rosterEntryNamed } from "../tool-roster.js";
|
|
24
|
+
import { callFaceSeat, parkedRowLiveFace, rosterEntryNamed, rowMember } from "../tool-roster.js";
|
|
25
25
|
import { deliverEngineNotice } from "../types.js";
|
|
26
26
|
import { delimitUntrusted, inlineUntrusted, REVIEWER_NOTE_MAX_BODY, sanitizeUntrustedText } from "../untrusted-text.js";
|
|
27
27
|
import { errorCodeOf } from "./terminal-account.js";
|
|
28
28
|
import { DEFAULT_PRECALL_OUTPUT_TOKENS, platformLimitTerminal } from "./clock-and-limits.js";
|
|
29
29
|
import { legContextOverlayOption } from "./compaction-call-options.js";
|
|
30
30
|
import { mintOutputStyleReminder, owedPostureText } from "./compaction-restate.js";
|
|
31
|
-
import {
|
|
31
|
+
import { advisorFrameText, registerAdvisorReceipt } from "./advisor-instructions.js";
|
|
32
|
+
import { resumeContinuation } from "./decide-continuation.js";
|
|
33
|
+
import { editRewrittenSentence, sameBytes } from "../rewrite-rejudge.js";
|
|
32
34
|
import { approvalWordsOf, owedApprovalWords, withApprovalWords } from "./approval-feedback.js";
|
|
33
35
|
import { chainCannotJudge } from "./call-hook-stations.js";
|
|
34
36
|
import { settleExecutionRecord } from "./execution-record.js";
|
|
@@ -45,12 +47,11 @@ import { settleTeardownLeg } from "./teardown-bounded.js";
|
|
|
45
47
|
import { announceToolCall, emitSettled, toolResultMsg } from "./tool-end-body.js";
|
|
46
48
|
import { rowDetailsOf, withRowNotExecuted } from "./tool-not-executed.js";
|
|
47
49
|
import { announceListingTruncation } from "../skill-listing-budget.js";
|
|
48
|
-
import { attachmentEnvelopeTags, collectDateChange, commitAgentListing, commitSkillsListing, reduceToolEnd, renderAgentListingFrame, renderOrphanedBackgroundTasks, renderSkillsListingFrame, stampWriteAnchor } from "./turn-attachments.js";
|
|
49
|
-
import { flushOwedAnnouncedSnapshot } from "./announce-once-ledger.js";
|
|
50
|
+
import { attachmentEnvelopeTags, collectDateChange, commitAgentListing, commitSkillsListing, owedMcpUnavailable, reduceToolEnd, renderAgentListingFrame, renderOrphanedBackgroundTasks, renderSkillsListingFrame, stampWriteAnchor } from "./turn-attachments.js";
|
|
51
|
+
import { flushOwedAnnouncedSnapshot, settleMcpUnavailable } from "./announce-once-ledger.js";
|
|
50
52
|
import { thrownMarksOf } from "../thrown-value.js";
|
|
51
53
|
import { egressThrownText, egressValue } from "../untrusted-egress.js";
|
|
52
54
|
import { ruleSourcePhrase } from "../rule-denial-sentence.js";
|
|
53
|
-
import { wireOf } from "../tool-name-readings.js";
|
|
54
55
|
export async function runLeg(input) {
|
|
55
56
|
const { spec, queue, prepared, resume, rs, entryActor, effectiveTimeoutMs, timeout, pushContent, ident, emitCommitted, writeFamilyOf, startedToolCallIds, announceWorkspaceMove, withBrainSinks, flushGitMirror, loopLatch, notificationLane, unsubscribeTaskNotifications, unsubGitRetry, unsubBoundary, unsub, runner, next } = input;
|
|
56
57
|
let final;
|
|
@@ -163,6 +164,12 @@ export async function runLeg(input) {
|
|
|
163
164
|
const outputStyleWrapped = mintOutputStyleReminder(prepared);
|
|
164
165
|
if (outputStyleWrapped !== undefined)
|
|
165
166
|
continuation += "\n\n" + outputStyleWrapped;
|
|
167
|
+
const unavailableResume = owedMcpUnavailable(prepared, rs.attach.attachmentsCfg);
|
|
168
|
+
if (unavailableResume !== undefined)
|
|
169
|
+
continuation += "\n\n" + mintSystemReminder(sanitizeUntrustedText(unavailableResume.body, attachmentEnvelopeTags("mcp_unavailable")), prepared.reminderMark);
|
|
170
|
+
const advisorResumeFrame = advisorFrameText(prepared);
|
|
171
|
+
if (advisorResumeFrame !== undefined)
|
|
172
|
+
continuation += "\n\n" + advisorResumeFrame;
|
|
166
173
|
const engineSegments = continuation.length > 0 ? [{ start: 0, end: continuation.length }] : [];
|
|
167
174
|
const parkedSteers = readPendingSteerQueue(resume.cp.state);
|
|
168
175
|
const resumeFrames = [
|
|
@@ -254,6 +261,7 @@ export async function runLeg(input) {
|
|
|
254
261
|
if (!prepared.abortController.signal.aborted) {
|
|
255
262
|
if (resume !== undefined)
|
|
256
263
|
resume.decisionDelivered = true;
|
|
264
|
+
registerAdvisorReceipt(prepared, continuation);
|
|
257
265
|
if (gitResumeDelivered !== undefined) {
|
|
258
266
|
const delivered = gitResumeDelivered;
|
|
259
267
|
prepared.gitStatusRef.protectedText = delivered.wrapped;
|
|
@@ -272,6 +280,10 @@ export async function runLeg(input) {
|
|
|
272
280
|
const preview = redactThenCut(prepared.outputStyleFrame, 220);
|
|
273
281
|
prepared.frameReceipts.pending.push({ source: "output_style", text: continuation, commit: () => void (queue.push({ type: "steering_injected", source: "output_style", preview, ...ident() }), (rs.attach.attachmentsInjected += 1)) });
|
|
274
282
|
}
|
|
283
|
+
if (postureText !== undefined)
|
|
284
|
+
prepared.frameReceipts.pending.push({ source: "posture", text: continuation, commit: () => undefined });
|
|
285
|
+
if (unavailableResume !== undefined)
|
|
286
|
+
prepared.frameReceipts.pending.push({ source: "mcp_unavailable", text: continuation, commit: () => void (settleMcpUnavailable(prepared, unavailableResume.entries), queue.push({ type: "steering_injected", source: "mcp_unavailable", preview: redactThenCut(unavailableResume.body, 220), ...ident() }), (rs.attach.attachmentsInjected += 1)) });
|
|
275
287
|
if (approvalFrames.length > 0) {
|
|
276
288
|
prepared.frameReceipts.pending.push({
|
|
277
289
|
source: "approval_feedback",
|
|
@@ -354,6 +366,9 @@ export async function runLeg(input) {
|
|
|
354
366
|
const dateFrame = legToday !== undefined ? collectDateChange(rs.attach.dateState, legToday) : undefined;
|
|
355
367
|
if (dateFrame !== undefined)
|
|
356
368
|
firstFrames.push({ source: "date_change", body: dateFrame.body, commit: () => void (rs.attach.dateState.announcedDate = legToday), disclose: () => undefined });
|
|
369
|
+
const unavailable = owedMcpUnavailable(prepared, rs.attach.attachmentsCfg);
|
|
370
|
+
if (unavailable !== undefined)
|
|
371
|
+
firstFrames.push({ source: "mcp_unavailable", body: unavailable.body, commit: () => settleMcpUnavailable(prepared, unavailable.entries), disclose: () => undefined });
|
|
357
372
|
if (rs.attach.attachState !== undefined) {
|
|
358
373
|
const attach = rs.attach.attachState;
|
|
359
374
|
if (rs.attach.agentListingOn && prepared.agentListing !== undefined) {
|
|
@@ -396,6 +411,9 @@ export async function runLeg(input) {
|
|
|
396
411
|
if (firstFrames.length > 0) {
|
|
397
412
|
effectiveObjective = `${firstFrames.map((f) => mintSystemReminder(sanitizeUntrustedText(f.body, attachmentEnvelopeTags(f.source)), prepared.reminderMark)).join("\n")}\n${effectiveObjective}`;
|
|
398
413
|
}
|
|
414
|
+
const advisorFrame = advisorFrameText(prepared);
|
|
415
|
+
if (advisorFrame !== undefined)
|
|
416
|
+
effectiveObjective = `${advisorFrame}\n${effectiveObjective}`;
|
|
399
417
|
const postureText = await owedPostureText(prepared, "always");
|
|
400
418
|
if (postureText !== undefined)
|
|
401
419
|
effectiveObjective = `${postureText}\n${effectiveObjective}`;
|
|
@@ -440,7 +458,7 @@ export async function runLeg(input) {
|
|
|
440
458
|
}
|
|
441
459
|
else {
|
|
442
460
|
const images = spec.images
|
|
443
|
-
? await Promise.all(spec.images.map((img) => toImageContent(img,
|
|
461
|
+
? await Promise.all(spec.images.map((img) => toImageContent(img, prepared.hostFloor)))
|
|
444
462
|
: undefined;
|
|
445
463
|
if (gitLegDelivered !== undefined) {
|
|
446
464
|
const delivered = gitLegDelivered;
|
|
@@ -470,6 +488,9 @@ export async function runLeg(input) {
|
|
|
470
488
|
},
|
|
471
489
|
});
|
|
472
490
|
}
|
|
491
|
+
if (postureText !== undefined)
|
|
492
|
+
prepared.frameReceipts.pending.push({ source: "posture", text: effectiveObjective, commit: () => undefined });
|
|
493
|
+
registerAdvisorReceipt(prepared, effectiveObjective);
|
|
473
494
|
const enginePrefixChars = effectiveObjective.length - projectedObjective.length;
|
|
474
495
|
if (!prepared.abortController.signal.aborted) {
|
|
475
496
|
prepared.attachmentDelivery.stage(objectiveInputId, attachmentFrames);
|
|
@@ -557,7 +578,7 @@ async function resolvePendingCall(runner, prepared, resume, emit, emitCommitted,
|
|
|
557
578
|
const { outcome } = resume;
|
|
558
579
|
if (pendingAction.kind !== "tool_approval" || outcome.gate !== "policy_ask")
|
|
559
580
|
return;
|
|
560
|
-
const mounted = () => { const
|
|
581
|
+
const mounted = () => { const roster = prepared.toolRosterDeltas.current; const entry = roster === undefined ? undefined : rosterEntryNamed(roster, pendingAction.toolName); const tool = entry?.name === pendingAction.toolName ? rowMember(entry) : undefined; return tool === undefined ? {} : { tool, entry }; };
|
|
561
582
|
const reopen = (miss) => { throw Object.assign(new Error(miss.message), { code: miss.code }); };
|
|
562
583
|
const liveTool = mounted().tool;
|
|
563
584
|
const atSession = outcome.decision === "allow" ? judgeApprovalObject(pendingAction, { tool: mounted().entry }, "session") : "match";
|
|
@@ -567,7 +588,7 @@ async function resolvePendingCall(runner, prepared, resume, emit, emitCommitted,
|
|
|
567
588
|
if (decidedGate === undefined) {
|
|
568
589
|
throw new CheckpointError("checkpoint.invalid_outcome", "pending action reached the resolver with no settlement record on its decision (gateOutcome) — refusing to execute or settle a decision that carries no record");
|
|
569
590
|
}
|
|
570
|
-
const humanRewrite =
|
|
591
|
+
const humanRewrite = isEngineQuestionFace(parkedRowLiveFace(prepared.toolRosterDeltas.current, pendingAction)) ? undefined : outcome.updatedInput;
|
|
571
592
|
const reading = liveTool === undefined ? undefined : ownedReading((a) => readToolCallArguments(liveTool, { type: "toolCall", id: pendingAction.toolCallId, name: pendingAction.toolName, arguments: {} }, a));
|
|
572
593
|
const beltFace = () => { const f = parkedRowLiveFace(prepared.toolRosterDeltas.current, pendingAction); if (f !== undefined && reading !== undefined)
|
|
573
594
|
stampArgsReading(f, reading); return f; };
|
|
@@ -639,9 +660,14 @@ async function resolvePendingCall(runner, prepared, resume, emit, emitCommitted,
|
|
|
639
660
|
emitCommitted(await prepared.session.appendMessage(resultRow(hookDenial, true)), "toolResult", pendingAction.toolCallId);
|
|
640
661
|
return;
|
|
641
662
|
}
|
|
642
|
-
const rescreened =
|
|
663
|
+
const rescreened = screened !== undefined ? tryRead(screened.args) : undefined;
|
|
643
664
|
if (rescreened?.unread !== undefined)
|
|
644
665
|
return settleUnreadable(rescreened.unread.error, "the arguments a PreToolUse hook rewrote it to");
|
|
666
|
+
if (humanRewrite !== undefined && rescreened !== undefined && !sameBytes({}, resolvedArgs, rescreened.args)) {
|
|
667
|
+
const text = formatHookFeedback(`${editRewrittenSentence(pendingAction.toolName)}, which a PreToolUse hook wrote — this approval is spent; the call has to be re-issued.`, prepared.reminderMark);
|
|
668
|
+
await settleEnd(true, { content: text, details: { editRewritten: { acceptableForm: rescreened.args } } }, "hook");
|
|
669
|
+
return emitCommitted(await prepared.session.appendMessage(resultRow(text, true)), "toolResult", pendingAction.toolCallId);
|
|
670
|
+
}
|
|
645
671
|
const executedArgs = rescreened !== undefined ? rescreened.args : resolvedArgs;
|
|
646
672
|
const unseen = !licenseCovers(pendingAction.boundInputHash, executedArgs);
|
|
647
673
|
let beltReading;
|
|
@@ -674,19 +700,18 @@ async function resolvePendingCall(runner, prepared, resume, emit, emitCommitted,
|
|
|
674
700
|
if (unseen && prepared.basePolicyForResumeEdit) {
|
|
675
701
|
const rechecked = refuseOutOfContractDecision(await beltCheck((signal) => prepared.basePolicyForResumeEdit.check(beltReq(), signal), "the deployment's tool policy re-checking a resumed call"));
|
|
676
702
|
const personUnanswered = policyCannotAnswer(rechecked, outcome.hostDecision.decidedBy);
|
|
677
|
-
const
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
if (beltUnsafe) {
|
|
703
|
+
const rewrite = rechecked.updatedInput !== undefined ? tryRead(rechecked.updatedInput) : undefined;
|
|
704
|
+
const rewrote = rewrite !== undefined && (rewrite.unread !== undefined || !sameBytes({}, rewrite.args, executedArgs));
|
|
705
|
+
if (rechecked.action === "deny" || rewrote || personUnanswered) {
|
|
681
706
|
const why = rechecked.action === "deny"
|
|
682
707
|
? (rechecked.message ? `: ${rechecked.message}` : "")
|
|
683
708
|
: personUnanswered
|
|
684
709
|
? " (the call as it would run requires a person's approval, and this decision was the deployment's policy)"
|
|
685
710
|
: " (the policy rewrote these bytes to a value that was not approved)";
|
|
686
711
|
const editedDenial = formatHookFeedback(`${outcome.updatedInput !== undefined ? "The approver EDITED this call's input; the edited call" : "A PreToolUse hook REWROTE this approved call's input; the rewritten call"} is refused by the deployment's tool policy and was not executed${why}.`, prepared.reminderMark);
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
emitCommitted(
|
|
712
|
+
const outlet = rechecked.action !== "deny" && !personUnanswered && humanRewrite !== undefined && rewrite?.unread === undefined && rewrite !== undefined ? { details: { editRewritten: { acceptableForm: rewrite.args } } } : denialCard(rechecked);
|
|
713
|
+
await settleEnd(true, { content: editedDenial, ...outlet }, "policy");
|
|
714
|
+
emitCommitted(await prepared.session.appendMessage(resultRow(editedDenial, true)), "toolResult", pendingAction.toolCallId);
|
|
690
715
|
return;
|
|
691
716
|
}
|
|
692
717
|
}
|
|
@@ -828,7 +853,7 @@ async function resolvePendingCall(runner, prepared, resume, emit, emitCommitted,
|
|
|
828
853
|
const finalize = (executed) => prepared.harness.finalizeToolCall({ type: "toolCall", id: pendingAction.toolCallId, name: spelledName, arguments: executedArgs }, executedArgs, executed);
|
|
829
854
|
let res;
|
|
830
855
|
try {
|
|
831
|
-
res = await tool.execute(pendingAction.toolCallId, args, prepared.abortController.signal);
|
|
856
|
+
res = await (prepared.toolCallStation ?? ((_c, run) => run()))({ toolCallId: pendingAction.toolCallId, toolName: tool.name, args }, () => tool.execute(pendingAction.toolCallId, args, prepared.abortController.signal), prepared.abortController.signal);
|
|
832
857
|
}
|
|
833
858
|
catch (err) {
|
|
834
859
|
const execError = `Error: ${egressThrownText("same-principal", err)}`;
|
|
@@ -21,7 +21,7 @@ import { resumeDecisionWasNegative } from "./decide-continuation.js";
|
|
|
21
21
|
import { drainForwardedFramesBeforeDone, forwardsSubagentEvents } from "./prepare-run-refs.js";
|
|
22
22
|
import { generatePromptSuggestions } from "./prompt-suggestions.js";
|
|
23
23
|
import { settleTeardownLeg } from "./teardown-bounded.js";
|
|
24
|
-
import { owedDateAnchor } from "./
|
|
24
|
+
import { owedDateAnchor } from "./conversation-segment.js";
|
|
25
25
|
import { autoRunConsolidationFromRecommendation, autoRunOnRecommendationEffective, scopeHasUnconsumedRecommendation } from "./memory-consolidation-driver.js";
|
|
26
26
|
import { amendTerminal, terminalProjection } from "./terminal-projection.js";
|
|
27
27
|
import { mintCompactedEvent } from "../auto-compaction.js";
|
|
@@ -96,6 +96,7 @@ export async function runSettleAndTeardown(input) {
|
|
|
96
96
|
editedFiles: prepared.editedFilesSnapshot(),
|
|
97
97
|
haltedOnUserRejection: prepared.batchHaltRef.current !== undefined,
|
|
98
98
|
haltConsumption: prepared.harness.haltConsumption(),
|
|
99
|
+
answerEntryIds: prepared.harness.answerEntryIdsOf(final),
|
|
99
100
|
strandedHumanAnswers,
|
|
100
101
|
remoteEnvFailures: prepared.remoteEnvFailures,
|
|
101
102
|
effectiveReadFace: prepared.effectiveReadFace,
|
|
@@ -283,7 +284,7 @@ export async function runSettleAndTeardown(input) {
|
|
|
283
284
|
if (writeDateAnchor !== undefined)
|
|
284
285
|
await settleTeardownLeg(writeDateAnchor, "date anchor (settle leg)", (e) => runner.deps.onError?.(e, { phase: "degraded", sessionId: prepared.sessionId }));
|
|
285
286
|
if (prepared.crossBoundary !== undefined)
|
|
286
|
-
await prepared.crossBoundary.settle();
|
|
287
|
+
await prepared.crossBoundary.settle(() => defaultTaskRegistry.owedDeliveries({ ...prepared.registryAccess, sessionId: prepared.sessionId }));
|
|
287
288
|
const ownedEnvDying = prepared.ownedEnv !== undefined &&
|
|
288
289
|
hasDestroy(prepared.ownedEnv) &&
|
|
289
290
|
isIsolated(prepared.ownedEnv) &&
|
|
@@ -40,7 +40,7 @@ export function runTelemetryAndBudgetSeats(input) {
|
|
|
40
40
|
rs.telemetry.pricingConfigured = isModelPriced(prepared.model, runner.deps.pricing);
|
|
41
41
|
if (spec.limits?.degrade) {
|
|
42
42
|
try {
|
|
43
|
-
rs.degrade.degradeToModel = resolveModel(spec.limits.degrade.to, modelCatalog);
|
|
43
|
+
rs.degrade.degradeToModel = resolveModel(spec.limits.degrade.to, modelCatalog, "TaskSpec.limits.degrade.to");
|
|
44
44
|
}
|
|
45
45
|
catch (e) {
|
|
46
46
|
runner.deps.onError?.(e, { phase: "degraded", sessionId: prepared.sessionId });
|
|
@@ -29,6 +29,7 @@ export interface RunTurnBoundaryInput {
|
|
|
29
29
|
export interface RunTurnBoundaryResult {
|
|
30
30
|
(event: {
|
|
31
31
|
model: Model;
|
|
32
|
+
continues: boolean;
|
|
32
33
|
}): Promise<undefined>;
|
|
33
34
|
}
|
|
34
35
|
export declare function createTurnBoundary(input: RunTurnBoundaryInput): RunTurnBoundaryResult;
|
|
@@ -13,7 +13,7 @@ import { droppedToolDigest, withAnnounceDigests } from "./announce-once-ledger.j
|
|
|
13
13
|
import { formatDiagnosticsBlock, withholdListedDiagnostics } from "../lsp-diagnostics.js";
|
|
14
14
|
import { workflowSizeGuidelineChangeNotice } from "../../orchestration/workflow-size-guideline.js";
|
|
15
15
|
import { awaitChargeWithSlowDisclosure, discloseUnevaluableWindow, ENV_DUE_GOVERNANCE_READ_BUDGET_MS, GOVERNANCE_READ_STALLED, LIMIT_APPROACH_DEFAULT_THRESHOLDS, limitApproachFrames, platformLimitTerminal, raceUntilDeadline } from "./clock-and-limits.js";
|
|
16
|
-
import { appendBoundaryFrames, compactionRestateOptions } from "./compaction-restate.js";
|
|
16
|
+
import { appendBoundaryFrames, compactionRestateOptions, frameCarried } from "./compaction-restate.js";
|
|
17
17
|
import { COMPACTION_FREED_EPSILON, COMPACTION_REGROWTH_FACTOR, MAX_CONSECUTIVE_COMPACTION_FAILURES } from "./compaction-knobs.js";
|
|
18
18
|
import { compactionHookOptions, recordCompactionReuse, seamCCompactionOptions } from "./compaction-seams.js";
|
|
19
19
|
import { contextUsageSections } from "../../prompt-assembly/section-usage.js";
|
|
@@ -27,6 +27,7 @@ export function createTurnBoundary(input) {
|
|
|
27
27
|
let finalVerifySeenAtLastBoundary = 0;
|
|
28
28
|
let legContinues = true;
|
|
29
29
|
const boundaryPass = async (event) => {
|
|
30
|
+
const turnOwesRequest = event.continues;
|
|
30
31
|
let boundarySteered = false;
|
|
31
32
|
const noNextRequest = () => prepared.stopRequestedRef.current || deps.loopLatch.userHalted;
|
|
32
33
|
const walltimeHit = walltimeMonotonicDeadline !== undefined && performance.now() >= walltimeMonotonicDeadline;
|
|
@@ -149,7 +150,7 @@ export function createTurnBoundary(input) {
|
|
|
149
150
|
if (approachCfg !== false &&
|
|
150
151
|
rs.counters.approachNoticesSent < LIMIT_APPROACH_DEFAULT_THRESHOLDS.length &&
|
|
151
152
|
prepared.suspendForResource === undefined &&
|
|
152
|
-
|
|
153
|
+
turnOwesRequest &&
|
|
153
154
|
prepared.batchHaltRef.current === undefined &&
|
|
154
155
|
!boundarySteered &&
|
|
155
156
|
!prepared.abortController.signal.aborted) {
|
|
@@ -199,9 +200,10 @@ export function createTurnBoundary(input) {
|
|
|
199
200
|
emitTrace(rs.telemetry.tracer, () => ({ kind: "review.dropped", version: 1, taskId: rs.telemetry.taskId, ts: Date.now() }));
|
|
200
201
|
}
|
|
201
202
|
if (!noNextRequest() && !prepared.abortController.signal.aborted)
|
|
202
|
-
await appendBoundaryFrames(prepared,
|
|
203
|
+
await appendBoundaryFrames(prepared, turnOwesRequest);
|
|
203
204
|
if (prepared.lspDiagnostics &&
|
|
204
205
|
!prepared.lspDiagnostics.registry.isEmpty() &&
|
|
206
|
+
turnOwesRequest &&
|
|
205
207
|
!prepared.abortController.signal.aborted &&
|
|
206
208
|
prepared.batchHaltRef.current === undefined) {
|
|
207
209
|
const files = await withholdListedDiagnostics(prepared.lspDiagnostics.registry.drain(prepared.lspDiagnostics.runIdent), prepared.lspDiagnostics.withheldOf);
|
|
@@ -219,6 +221,7 @@ export function createTurnBoundary(input) {
|
|
|
219
221
|
rs.attach.instrState !== undefined ||
|
|
220
222
|
rs.attach.sizeGuidelineState !== undefined ||
|
|
221
223
|
rs.attach.attachState !== undefined) &&
|
|
224
|
+
turnOwesRequest &&
|
|
222
225
|
!boundarySteered &&
|
|
223
226
|
prepared.batchHaltRef.current === undefined &&
|
|
224
227
|
!noNextRequest() &&
|
|
@@ -252,12 +255,10 @@ export function createTurnBoundary(input) {
|
|
|
252
255
|
const pendingTools = tdRef !== undefined && tdRef.pending.length > 0 ? [...tdRef.pending] : undefined;
|
|
253
256
|
const pendingRemovedTools = tdRef !== undefined && tdRef.pendingRemoved.length > 0 ? [...tdRef.pendingRemoved] : undefined;
|
|
254
257
|
const pendingReaddedTools = tdRef !== undefined && tdRef.pendingReadded.length > 0 ? [...tdRef.pendingReadded] : undefined;
|
|
255
|
-
const
|
|
256
|
-
const mcpToolsDelta = pendingRemovedTools !== undefined || pendingReaddedTools !== undefined || pendingFailedMcp !== undefined
|
|
258
|
+
const mcpToolsDelta = pendingRemovedTools !== undefined || pendingReaddedTools !== undefined
|
|
257
259
|
? {
|
|
258
260
|
...(pendingRemovedTools !== undefined ? { removed: pendingRemovedTools } : {}),
|
|
259
261
|
...(pendingReaddedTools !== undefined ? { readded: pendingReaddedTools } : {}),
|
|
260
|
-
...(pendingFailedMcp !== undefined ? { failedServers: pendingFailedMcp } : {}),
|
|
261
262
|
}
|
|
262
263
|
: undefined;
|
|
263
264
|
const mcpInstructionsOn = rs.attach.attachmentsCfg?.mcpInstructions === true;
|
|
@@ -265,21 +266,20 @@ export function createTurnBoundary(input) {
|
|
|
265
266
|
const mcpAdds = mcpInstructionsOn && mcpDelta.pendingAdds.length > 0 ? [...mcpDelta.pendingAdds] : undefined;
|
|
266
267
|
const mcpRemovals = mcpInstructionsOn && mcpDelta.pendingRemovals.length > 0 ? [...mcpDelta.pendingRemovals] : undefined;
|
|
267
268
|
const mcpDropped = mcpInstructionsOn && prepared.mcp.droppedTools.length > 0 ? selectMcpDroppedBatch(prepared.mcp.droppedTools) : undefined;
|
|
268
|
-
const budgetUsdOn = rs.attach.attachmentsCfg?.budgetUsd === true && rs.budget.maxCostMicroUsd !== undefined
|
|
269
|
+
const budgetUsdOn = rs.attach.attachmentsCfg?.budgetUsd === true && rs.budget.maxCostMicroUsd !== undefined;
|
|
269
270
|
const totalTokensDeclared = rs.attach.attachmentsCfg?.totalTokensReminder;
|
|
270
271
|
const totalTokensMode = rs.attach.attachmentsCfg?.totalTokensReminderMode ?? TOTAL_TOKENS_REMINDER_DEFAULT_MODE;
|
|
271
272
|
const totalTokensArmedByDefault = totalTokensDeclared === undefined &&
|
|
272
273
|
eventDefaultOn("total_tokens_reminder") &&
|
|
273
274
|
totalTokensMode !== "fixed" &&
|
|
274
275
|
totalTokensMode !== "infinite";
|
|
275
|
-
const totalTokensOn =
|
|
276
|
+
const totalTokensOn = totalTokensDeclared === true || totalTokensArmedByDefault;
|
|
276
277
|
const toolSearchReminderOn = rs.attach.attachmentsCfg?.toolSearchReminder === true && prepared.deferredToolNames !== undefined;
|
|
277
278
|
const undiscoveredTools = toolSearchReminderOn
|
|
278
279
|
? [...prepared.deferredToolNames].filter((n) => !prepared.activeTools.has(n)).sort()
|
|
279
280
|
: undefined;
|
|
280
|
-
const
|
|
281
|
-
const
|
|
282
|
-
const skillsListingDue = rs.attach.skillsListingOn && prepared.skillsListing !== undefined && !receiptPending("skills_listing");
|
|
281
|
+
const agentListingDue = rs.attach.agentListingOn && prepared.agentListing !== undefined && !frameCarried(prepared.frameReceipts, "agent_listing");
|
|
282
|
+
const skillsListingDue = rs.attach.skillsListingOn && prepared.skillsListing !== undefined && !frameCarried(prepared.frameReceipts, "skills_listing");
|
|
283
283
|
const listingBudget = prepared.skillsListing?.budget ?? prepared.agentListing?.budget;
|
|
284
284
|
due.push(...collectDueAttachments(rs.attach.attachState, {
|
|
285
285
|
turn: stats.turns,
|
|
@@ -302,7 +302,7 @@ export function createTurnBoundary(input) {
|
|
|
302
302
|
skillsListing: rs.attach.skillsListingOn,
|
|
303
303
|
mcpInstructions: mcpInstructionsOn,
|
|
304
304
|
},
|
|
305
|
-
...(prepared.outputStyleFrame !== undefined &&
|
|
305
|
+
...(prepared.outputStyleFrame !== undefined && !frameCarried(prepared.frameReceipts, "output_style") ? { outputStyle: prepared.outputStyleFrame } : {}),
|
|
306
306
|
...(undiscoveredTools !== undefined && undiscoveredTools.length > 0
|
|
307
307
|
? { undiscoveredTools, deferDirectCall: prepared.deferDirectCall }
|
|
308
308
|
: {}),
|
|
@@ -357,13 +357,6 @@ export function createTurnBoundary(input) {
|
|
|
357
357
|
ref.pendingRemoved.splice(0, pendingRemovedTools.length);
|
|
358
358
|
if (pendingReaddedTools !== undefined)
|
|
359
359
|
ref.pendingReadded.splice(0, pendingReaddedTools.length);
|
|
360
|
-
if (pendingFailedMcp !== undefined) {
|
|
361
|
-
ref.pendingFailed.splice(0, pendingFailedMcp.length);
|
|
362
|
-
if (!noNextRequest()) {
|
|
363
|
-
prepared.announcedListingsRef.mcpFailed = [...(prepared.announcedListingsRef.mcpFailed ?? []), ...pendingFailedMcp];
|
|
364
|
-
announcedOnceDirty = true;
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
360
|
}
|
|
368
361
|
}
|
|
369
362
|
if ((mcpAdds !== undefined || mcpRemovals !== undefined) &&
|
|
@@ -412,7 +405,7 @@ export function createTurnBoundary(input) {
|
|
|
412
405
|
if (announcedOnceDirty)
|
|
413
406
|
prepared.frameReceipts.listingSnapshotOwed = true;
|
|
414
407
|
}
|
|
415
|
-
if (rs.attach.dateState !== undefined &&
|
|
408
|
+
if (rs.attach.dateState !== undefined && !frameCarried(prepared.frameReceipts, "date_change")) {
|
|
416
409
|
const today = prepared.dateChange.today();
|
|
417
410
|
const cand = collectDateChange(rs.attach.dateState, today);
|
|
418
411
|
if (cand !== undefined) {
|
|
@@ -420,7 +413,7 @@ export function createTurnBoundary(input) {
|
|
|
420
413
|
receiptCommits.push({ source: "date_change", commit: () => void (rs.attach.dateState.announcedDate = today) });
|
|
421
414
|
}
|
|
422
415
|
}
|
|
423
|
-
if (rs.attach.sizeGuidelineState !== undefined
|
|
416
|
+
if (rs.attach.sizeGuidelineState !== undefined) {
|
|
424
417
|
const guideline = rs.attach.sizeGuidelineState.current();
|
|
425
418
|
if (guideline !== rs.attach.sizeGuidelineState.announcedGuideline) {
|
|
426
419
|
due.splice(due.length > 0 && due[0].source === "date_change" ? 1 : 0, 0, {
|
|
@@ -430,7 +423,7 @@ export function createTurnBoundary(input) {
|
|
|
430
423
|
rs.attach.sizeGuidelineState.announcedGuideline = guideline;
|
|
431
424
|
}
|
|
432
425
|
}
|
|
433
|
-
if (rs.attach.instrState !== undefined && rs.attach.instrProbe !== undefined
|
|
426
|
+
if (rs.attach.instrState !== undefined && rs.attach.instrProbe !== undefined) {
|
|
434
427
|
let probed = null;
|
|
435
428
|
try {
|
|
436
429
|
const PROBE_CEILING_MS = 2_000;
|
|
@@ -8,6 +8,7 @@ import type { AgentDefinition, ModelRef, ModelRoles, RunnerDeps, TaskEvent, Task
|
|
|
8
8
|
import { type ContextSettings, type ContextWindowOverlay } from "../context-settings.js";
|
|
9
9
|
import type { ResumeRun, ResumeTaskConfig, RunInternals, RunnerSelfSeat } from "./contracts.js";
|
|
10
10
|
export type { ResumeTaskConfig } from "./contracts.js";
|
|
11
|
+
import type { RewindFilesRequest, RewindFilesResult } from "../file-history-store.js";
|
|
11
12
|
/**
|
|
12
13
|
* A stateless task runner. Holds shared deps (the external brain, model catalog) and an
|
|
13
14
|
* in-memory session store so that passing a `sessionId` continues a prior conversation.
|
|
@@ -133,6 +134,8 @@ export declare class Runner implements RunnerSelfSeat {
|
|
|
133
134
|
* the same model resolution as tasks, returns real usage/model. No session, no tool execution, no
|
|
134
135
|
* policy gate, no accounting — caller-trusted. */
|
|
135
136
|
sideQuery(spec: SideQuerySpec): Promise<SideQueryResult>;
|
|
137
|
+
/** The out-of-run code-only rewind, no model call and no session entry — the contract is {@link rewindSessionFiles}'s (refused while a leg of this Runner holds or awaits the session's lock). */
|
|
138
|
+
rewindFiles(request: RewindFilesRequest): Promise<RewindFilesResult>;
|
|
136
139
|
/** Run a task and stream live events; await `.result()` for the final TaskResult. `resume` (internal)
|
|
137
140
|
* drives a durable resume through the same loop instead of a fresh objective prompt.
|
|
138
141
|
* `internals` (internal) is a TRUSTED run-scoped channel for live per-task state the
|
|
@@ -7,7 +7,7 @@ import { createRapidRefillState } from "../auto-compaction.js";
|
|
|
7
7
|
import { boundInputHashOf } from "../canonical-json.js";
|
|
8
8
|
import { emitTrace } from "../trace.js";
|
|
9
9
|
import { emitTaskOutcome } from "../task-outcome.js";
|
|
10
|
-
import { runWithReasoningWireFacts } from "../../brain/status-sink.js";
|
|
10
|
+
import { runWithCapabilityWithheld, runWithReasoningWireFacts } from "../../brain/status-sink.js";
|
|
11
11
|
import { expandTiers } from "../roles.js";
|
|
12
12
|
import { announceReadDenySwap, screenSwappableDeps } from "../swappable-deps.js";
|
|
13
13
|
import { runSideQuery } from "../side-query.js";
|
|
@@ -62,6 +62,7 @@ import { runStopAndFinalVerify } from "./run-stop-and-final-verify.js";
|
|
|
62
62
|
import { runRecoveryLanes } from "./run-recovery-lanes.js";
|
|
63
63
|
import { runGitLane } from "./run-git-lane.js";
|
|
64
64
|
import { deploymentCanRerootChild } from "./child-tree.js";
|
|
65
|
+
import { rewindSessionFiles } from "./rewind-files.js";
|
|
65
66
|
import { thrownText } from "../thrown-value.js";
|
|
66
67
|
export class Runner {
|
|
67
68
|
deps;
|
|
@@ -160,11 +161,8 @@ export class Runner {
|
|
|
160
161
|
await prev.catch(() => { });
|
|
161
162
|
return () => {
|
|
162
163
|
release();
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
this.sessionLocks.delete(sessionId);
|
|
166
|
-
}
|
|
167
|
-
});
|
|
164
|
+
if (this.sessionLocks.get(sessionId) === chain)
|
|
165
|
+
this.sessionLocks.delete(sessionId);
|
|
168
166
|
};
|
|
169
167
|
}
|
|
170
168
|
swapDeps(next) {
|
|
@@ -233,8 +231,9 @@ export class Runner {
|
|
|
233
231
|
announceReadDenySwap(this.deps.onNotice, seats, this.deps);
|
|
234
232
|
}
|
|
235
233
|
sideQuery(spec) {
|
|
236
|
-
return runWithReasoningWireFacts(() => { }, () => runSideQuery(spec, { brain: this.deps.brain, models: this.deps.models, roles: this.deps.roles }));
|
|
234
|
+
return runWithReasoningWireFacts(() => { }, () => runWithCapabilityWithheld(() => { }, () => runSideQuery(spec, { brain: this.deps.brain, models: this.deps.models, roles: this.deps.roles })));
|
|
237
235
|
}
|
|
236
|
+
rewindFiles(request) { return rewindSessionFiles({ deps: this.deps, sessions: this.sessions, readStates: this.sessionReadStates, sessionBusy: (id) => this.sessionLocks.has(id), takeSessionLock: (id) => this.acquireSessionLock(id) }, request); }
|
|
238
237
|
runTaskStream(spec, resume, internals) {
|
|
239
238
|
if (resume !== undefined && (typeof resume !== "object" || resume.outcome === undefined)) {
|
|
240
239
|
throw new TypeError("runTaskStream: `resume` must be a ResumeRun carrying `outcome` — got a value without one. " +
|
|
@@ -403,7 +402,7 @@ export class Runner {
|
|
|
403
402
|
const { effectiveTimeoutMs, walltimeMonotonicDeadline, timeout, pushContent, ownCommittedTailRef, emitCommitted } = runClockAndContent({ spec, prepared, queue, internals, rs, ident, parentToolCallId, startedToolCallIds });
|
|
404
403
|
const toolProgress = createToolProgressLane(pushContent, ident, prepared.toolOccurrences);
|
|
405
404
|
prepared.toolProgressRef.current = toolProgress;
|
|
406
|
-
const { withBrainSinks, withLegRequestSinks } = runBrainSinks({ queue, internals, rs, ident, observeReasoningWireFacts, notice: { onNotice: this.deps.onNotice, sessionId: prepared.sessionId, runId: prepared.runId } });
|
|
405
|
+
const { withBrainSinks, withLegRequestSinks } = runBrainSinks({ queue, internals, rs, ident, observeReasoningWireFacts, notice: { onNotice: this.deps.onNotice, sessionId: prepared.sessionId, runId: prepared.runId }, announced: prepared });
|
|
407
406
|
const toolLabels = new Map(prepared.tools.flatMap((t) => (t.label !== undefined && t.label !== t.name ? [[t.name, t.label]] : [])));
|
|
408
407
|
for (const orphan of prepared.wakeRecovered) {
|
|
409
408
|
emitSettled(prepared.toolOccurrences, { toolCallId: orphan.toolCallId, spelledName: orphan.toolName, ...(toolLabels.has(orphan.toolName) ? { label: toolLabels.get(orphan.toolName) } : {}), args: orphan.args }, reconciledEnd(orphan), { push: (f) => queue.push({ ...f, ...ident() }), structured: prepared.structuredProjector, mediaByteCapBytes: this.deps.mediaByteCapBytes });
|
|
@@ -502,7 +501,7 @@ export class Runner {
|
|
|
502
501
|
token, cp, resumeSignal, recheckGovernanceWindow, store, runner: this.depsSeat,
|
|
503
502
|
locallyClaimedTokens: this.locallyClaimedTokens, parentConstraintRegistry: this.parentConstraintRegistry, suspendedEnvReaps: this.suspendedEnvReaps,
|
|
504
503
|
next: () => resumeClaim({
|
|
505
|
-
token, cp, store, outcomeForStore,
|
|
504
|
+
token, cp, store, outcomeForStore, holder: internals?.holder,
|
|
506
505
|
locallyClaimedTokens: this.locallyClaimedTokens, parentConstraintRegistry: this.parentConstraintRegistry,
|
|
507
506
|
next: () => this.resumeHandoff({ token, cp, store, config, internals, resumeInternals, plainPolicyOutcome, redeemedAnswer, outcomeForStore, wakeMessage, wakeHookContext, legMods, resumeSignal }),
|
|
508
507
|
}),
|
|
@@ -39,7 +39,22 @@ import type { ReadFileState } from "../../tools/fs/safety.js";
|
|
|
39
39
|
*/
|
|
40
40
|
export declare class SessionReadFileStates {
|
|
41
41
|
private readonly seats;
|
|
42
|
+
/**
|
|
43
|
+
* The ONE handoff of "which files did a file-history restore of this session move" to the read state that
|
|
44
|
+
* must stop vouching for their old bytes — written by every restore (the run's restore seat and the
|
|
45
|
+
* out-of-run `Runner.rewindFiles`), read by the next leg's read face, which checks each path against the disk
|
|
46
|
+
* after every seeding rung and settles the batch only once its own map is adopted as the seat. A leg that
|
|
47
|
+
* throws before adopting, or skips the adoption, leaves the batch for the next one. Bounded like the seats
|
|
48
|
+
* (LRU over session ids): a dropped batch costs a refusal whose wording blames an outside edit, never an admission.
|
|
49
|
+
*/
|
|
50
|
+
private readonly restored;
|
|
42
51
|
private static readonly CAP;
|
|
52
|
+
/** Record the ABSOLUTE paths a restore of `sessionId`'s history wrote, deleted or failed to write. */
|
|
53
|
+
noteRestored(sessionId: string, absPaths: readonly string[]): void;
|
|
54
|
+
/** The paths still owed a read-state check on `sessionId` — a copy; nothing is cleared by reading. */
|
|
55
|
+
pendingRestored(sessionId: string): readonly string[];
|
|
56
|
+
/** Clear exactly the paths a leg checked and then adopted over; a path noted since stays owed. */
|
|
57
|
+
settleRestored(sessionId: string, checked: readonly string[]): void;
|
|
43
58
|
/** The session's seat row, or undefined (cross-process / evicted / first turn) ⇒ caller replays.
|
|
44
59
|
* The caller must verify the anchor against the session's CURRENT branch before using `state`. */
|
|
45
60
|
get(sessionId: string): {
|
|
@@ -1,6 +1,34 @@
|
|
|
1
1
|
export class SessionReadFileStates {
|
|
2
2
|
seats = new Map();
|
|
3
|
+
restored = new Map();
|
|
3
4
|
static CAP = 1024;
|
|
5
|
+
noteRestored(sessionId, absPaths) {
|
|
6
|
+
if (absPaths.length === 0)
|
|
7
|
+
return;
|
|
8
|
+
const batch = this.restored.get(sessionId) ?? new Set();
|
|
9
|
+
for (const p of absPaths)
|
|
10
|
+
batch.add(p);
|
|
11
|
+
this.restored.delete(sessionId);
|
|
12
|
+
this.restored.set(sessionId, batch);
|
|
13
|
+
while (this.restored.size > SessionReadFileStates.CAP) {
|
|
14
|
+
const oldest = this.restored.keys().next().value;
|
|
15
|
+
if (oldest === undefined)
|
|
16
|
+
break;
|
|
17
|
+
this.restored.delete(oldest);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
pendingRestored(sessionId) {
|
|
21
|
+
return [...(this.restored.get(sessionId) ?? [])];
|
|
22
|
+
}
|
|
23
|
+
settleRestored(sessionId, checked) {
|
|
24
|
+
const batch = this.restored.get(sessionId);
|
|
25
|
+
if (batch === undefined)
|
|
26
|
+
return;
|
|
27
|
+
for (const p of checked)
|
|
28
|
+
batch.delete(p);
|
|
29
|
+
if (batch.size === 0)
|
|
30
|
+
this.restored.delete(sessionId);
|
|
31
|
+
}
|
|
4
32
|
get(sessionId) {
|
|
5
33
|
const seat = this.seats.get(sessionId);
|
|
6
34
|
if (seat !== undefined) {
|
|
@@ -52,18 +52,27 @@ export declare function isWithin(root: string, p: string): boolean;
|
|
|
52
52
|
export interface SessionRuleSource {
|
|
53
53
|
/** The prepare-time snapshot: the audit's view, and the floor no live read may loosen. */
|
|
54
54
|
seed: SessionPermissionRules;
|
|
55
|
-
/** The
|
|
56
|
-
* ⇒ the seed is the whole source. */
|
|
55
|
+
/** The live read, asked at every judgment and bounded by the gate's own signal; `toolCallId` names the call being
|
|
56
|
+
* judged. Absent ⇒ the seed is the whole source. */
|
|
57
57
|
read?: (toolCallId: string, signal?: AbortSignal) => Promise<SessionPermissionRules>;
|
|
58
58
|
}
|
|
59
|
+
/** May `row` follow `floor` by rev at all (the one reading of the live reader below and of the checkpoint/live merge): a floor
|
|
60
|
+
* at rev 0 has enforced no row and has no lineage to defend; above it only the floor's own lineage ({@link continuesLineage}). */
|
|
61
|
+
export declare function rowFollowsFloor(row: {
|
|
62
|
+
gen?: number;
|
|
63
|
+
}, floor: {
|
|
64
|
+
rev: number;
|
|
65
|
+
gen?: number;
|
|
66
|
+
}): boolean;
|
|
59
67
|
/**
|
|
60
68
|
* The LIVE half of {@link SessionRuleSource}: re-read `(sessionId, principal)` from the store on each
|
|
61
|
-
* adjudicated call, floored by `seed`.
|
|
69
|
+
* adjudicated call, floored by `seed`. An ABSENT store is a source that cannot answer — a delegated leg on a
|
|
70
|
+
* runner wired without the store its ancestors' rules live in — and takes the arm a throwing store takes.
|
|
62
71
|
*
|
|
63
72
|
* ONE law, two consumers (this task's own session rules and each inherited ancestor's), where the policy
|
|
64
73
|
* chain used to carry a hand-written live-preferring read for ancestors only and a frozen snapshot for the
|
|
65
|
-
* task's own rules. Direction, unchanged from that read and stated once here: a whole-row replacement
|
|
66
|
-
*
|
|
74
|
+
* task's own rules. Direction, unchanged from that read and stated once here: a whole-row replacement includes RELAXATION
|
|
75
|
+
* — any post-prepare write the store's judge accepted propagates in BOTH directions (the replace is the delete port);
|
|
67
76
|
* what the floor forbids is an UNAUTHORIZED loosening (a lagging replica, a deleted row, an unreachable
|
|
68
77
|
* store), and nothing task-side can edit the rules row itself.
|
|
69
78
|
*
|
|
@@ -80,30 +89,22 @@ export interface SessionRuleSource {
|
|
|
80
89
|
* recreated row is another generation and is never compared to the enforced one, whatever its rev, and
|
|
81
90
|
* a backend without lineages (gen 0 throughout) keeps the `>` protection above.
|
|
82
91
|
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* the leading (original args) and trailing (rewritten args) passes must judge ONE set of rules.
|
|
89
|
-
*
|
|
90
|
-
* Two bounds keep a handed entry from ever being a STALE one, because `toolCallId` is not always unique —
|
|
91
|
-
* the turn-boundary read-visibility query reuses one synthetic id for every path it screens and for every
|
|
92
|
-
* turn of the run. The entry is taken ONCE, and a claimed snapshot is served only while its `rev` still
|
|
93
|
-
* stands at the enforced floor; a claim from a later adjudication, whose floor has moved on, falls through
|
|
94
|
-
* to a fresh read. A real call's id is the provider's: unique within one assistant response only (`brain/tool-call-id.ts`).
|
|
92
|
+
* Every ask is a store read, and nothing is kept between asks. Not by call id: a provider's id is unique within one
|
|
93
|
+
* assistant response only (`brain/tool-call-id.ts`) and the visibility probes share one synthetic id, so a read kept
|
|
94
|
+
* under it served a later call an earlier call's snapshot. Nor between the two passes of one judgment: the fold's
|
|
95
|
+
* trailing narrowing pass runs after a caller policy that may have waited on a person, and judges the rules as they
|
|
96
|
+
* stand then.
|
|
95
97
|
*/
|
|
96
|
-
export declare function createLiveSessionRules(store: SessionPolicyStore, floor: {
|
|
98
|
+
export declare function createLiveSessionRules(store: SessionPolicyStore | undefined, floor: {
|
|
97
99
|
sessionId: string;
|
|
98
100
|
principal?: string;
|
|
99
101
|
seed: StoredSessionRules;
|
|
100
102
|
}, hooks?: {
|
|
101
103
|
/** A rule source this layer could not read, once per distinct reason. */
|
|
102
104
|
onUnreadable?: (reason: string) => void;
|
|
103
|
-
/** The store row this layer now enforces, each time the floor ADVANCES
|
|
104
|
-
* empty seed: it reports rows the store actually served, which is what a child may inherit. */
|
|
105
|
+
/** The store row this layer now enforces, each time the floor ADVANCES — never for the seed (its holder has it). */
|
|
105
106
|
onEnforced?: (row: StoredSessionRules) => void;
|
|
106
|
-
}):
|
|
107
|
+
}): NonNullable<SessionRuleSource["read"]>;
|
|
107
108
|
/**
|
|
108
109
|
* Build the per-session deny-narrowing policy. For each tool call:
|
|
109
110
|
* - `toolDeny` → deny the calls its entries reach — the one list matcher's deny reading (`judgeAllowEntries`): a tool name
|