@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,4 +1,4 @@
|
|
|
1
|
-
import { getToolContract } from "../../prompt-assembly/tool-catalog.js";
|
|
1
|
+
import { getToolContract, mountDescriptionVariant } from "../../prompt-assembly/tool-catalog.js";
|
|
2
2
|
import { FULL_SHELL_CONTRACT_ID } from "../../tools/fs/index.js";
|
|
3
3
|
import { ASK_USER_QUESTION_TOOL_NAME } from "../ask-question.js";
|
|
4
4
|
import { MEMORY_ENGINE_TOOL_NAMES } from "../memory-engine/tools.js";
|
|
@@ -17,7 +17,7 @@ function memoryGroupRetractionSet(builtinDeferPairNames, engineTrioInPlay) {
|
|
|
17
17
|
return new Set([...builtinDeferPairNames, ...(engineTrioInPlay ? MEMORY_ENGINE_TOOL_NAMES : [])]);
|
|
18
18
|
}
|
|
19
19
|
export function prepareDeferClassify(input) {
|
|
20
|
-
const { spec, deps, roster, toolFaceSnapshot, handsEnabled, fullShellReachable,
|
|
20
|
+
const { spec, deps, roster, toolFaceSnapshot, handsEnabled, fullShellReachable, promptTraits, model, mcp, a2a, sharedMemoryPairMounted, memoryEnginePairMounted, memoryRecallSegment, onceLedger, sessionId } = input;
|
|
21
21
|
const tools = roster.tools;
|
|
22
22
|
let memoryBlock = input.memoryBlock;
|
|
23
23
|
const leaves = valveLeaves(spec, toolFaceSnapshot.selector);
|
|
@@ -32,12 +32,11 @@ export function prepareDeferClassify(input) {
|
|
|
32
32
|
throw e;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
35
|
+
for (let i = 0; i < tools.length; i++) {
|
|
36
|
+
const t = tools[i];
|
|
37
|
+
const face = mountDescriptionVariant(t, promptTraits);
|
|
38
|
+
if (face !== t)
|
|
39
|
+
roster.replaceAt(i, face);
|
|
41
40
|
}
|
|
42
41
|
const protocolToolNames = [...mcp.tools, ...a2a.tools].filter((t) => protocolOf(t.name) !== undefined).map((t) => t.name);
|
|
43
42
|
const mcpAlwaysLoadNames = mcp.tools
|
|
@@ -32,9 +32,9 @@ export interface PrepareDelegationSurfaceInput {
|
|
|
32
32
|
* `handsReadOnly` is NOT read here (the hands mount decided the surface). Never mutated. */
|
|
33
33
|
spec: Pick<TaskSpec, "tools" | "oneShot" | "retainBackgroundProcesses" | "excludeAllTools">;
|
|
34
34
|
/** borrowed-readonly — the deployment seats the mounts read: `workflowRunStore` / `backgroundAgentStore` / `mailboxStore` (the
|
|
35
|
-
* read/kill faces and the tier-3 revival seams), `rosterStore`, `peerLane`, `peerDirectory`, `onNotice`,
|
|
35
|
+
* read/kill faces and the tier-3 revival seams), `rosterStore`, `peerLane`, `peerDirectory`, `peerChannel`, `onNotice`,
|
|
36
36
|
* `onBackgroundChildEvent`, `tracer`. */
|
|
37
|
-
deps: Pick<RunnerDeps, "workflowRunStore" | "backgroundAgentStore" | "mailboxStore" | "rosterStore" | "peerLane" | "peerDirectory" | "principalInboxConsumer" | "onNotice" | "onBackgroundChildEvent" | "tracer">;
|
|
37
|
+
deps: Pick<RunnerDeps, "workflowRunStore" | "backgroundAgentStore" | "mailboxStore" | "rosterStore" | "peerLane" | "peerDirectory" | "peerChannel" | "principalInboxConsumer" | "onNotice" | "onBackgroundChildEvent" | "tracer">;
|
|
38
38
|
/** borrowed-readonly — the trusted spawn-side channel: `parentNotify` (the delegated-child door), the uplink / sibling /
|
|
39
39
|
* identity seats the SendMessage mount forwards, `onTaskNotification`, `onSubagentSpawn`. Never mutated. */
|
|
40
40
|
internals: Pick<RunInternals, "parentNotify" | "parentPeerRef" | "uplinkSessionId" | "parentRetainLedger" | "explicitAgentName" | "parentTaskId" | "parentSessionId" | "peerSelfRef" | "peerInboundChainRef" | "onTaskNotification" | "onSubagentSpawn"> | undefined;
|
|
@@ -56,7 +56,7 @@ export function prepareDelegationSurface(input) {
|
|
|
56
56
|
...(deps.backgroundAgentStore !== undefined ? { agentStore: deps.backgroundAgentStore } : {}),
|
|
57
57
|
...(deps.mailboxStore !== undefined ? { mailbox: deps.mailboxStore } : {}),
|
|
58
58
|
...(reviveSpawn !== undefined ? { reviveSpawn } : {}),
|
|
59
|
-
...(peerLaneActive ? peerLaneSendMessageSeats({ peerDirectory: deps.peerDirectory, sessionId, scope: taskScope, ...(internals?.explicitAgentName !== undefined ? { name: internals.explicitAgentName } : {}), refs: peerLaneRefs, listingMounted: listAgentsMountable({ leaves, specTools: spec.tools ?? [] }) }) : {}),
|
|
59
|
+
...(peerLaneActive ? peerLaneSendMessageSeats({ peerDirectory: deps.peerDirectory, ...(deps.peerChannel !== undefined ? { peerChannel: deps.peerChannel } : {}), sessionId, scope: taskScope, ...(internals?.explicitAgentName !== undefined ? { name: internals.explicitAgentName } : {}), refs: peerLaneRefs, listingMounted: listAgentsMountable({ leaves, specTools: spec.tools ?? [] }) }) : {}),
|
|
60
60
|
onNotifyError: (f) => emitTrace(deps.tracer, () => ({ kind: "observer.notify_failed", version: 1, taskId: hostTaskId, site: f.site, message: f.error.message, ts: Date.now() })),
|
|
61
61
|
onTranscriptIntegrityGap: (handle, scope) => deliverEngineNotice(deps.onNotice, {
|
|
62
62
|
code: "delegation.transcript_integrity",
|
|
@@ -14,15 +14,18 @@
|
|
|
14
14
|
*
|
|
15
15
|
* The request door (the bad-value doors and every refusal the request decides alone) lives in
|
|
16
16
|
* `./file-history-request.ts` and runs BEFORE the session is acquired; this phase receives its resolution.
|
|
17
|
-
* The module-level helpers below the phase (`
|
|
18
|
-
* the refusal's epoch-tail wording helper, `adoptForkedFileHistory` with its per-store carry memo,
|
|
17
|
+
* The module-level helpers below the phase (`adoptForkedFileHistory` with its per-store carry memo,
|
|
19
18
|
* `createFileHistoryBoundarySeat`, `resolveFileHistoryCoordinates` / `resolveFileHistoryScope` /
|
|
20
19
|
* `fileHistoryFilesystemIdentity`, `childScopeRewindRefusal`) moved with it unchanged; the two the test
|
|
21
|
-
* suite reaches through the driver are re-exported from there.
|
|
20
|
+
* suite reaches through the driver are re-exported from there. The restore itself and the reading of its
|
|
21
|
+
* answer live in `./file-history-restore.ts`, shared with the out-of-run rewind (`./rewind-files.ts`), which
|
|
22
|
+
* also reaches down here for the coordinates and the fork carry — a rewind outside a run is the same history
|
|
23
|
+
* operation as the one this phase runs.
|
|
22
24
|
*/
|
|
23
25
|
import type { ExecutionEnv } from "../../internal/harness.js";
|
|
24
26
|
import type { StoredSession } from "../../engine/session/session.js";
|
|
25
27
|
import type { RunnerDeps, TaskResult, TaskSpec, TrackFileEditHook } from "../types.js";
|
|
28
|
+
import type { FileHistoryStore } from "../file-history-store.js";
|
|
26
29
|
import type { FileHistoryBoundarySeat, RunInternals } from "./contracts.js";
|
|
27
30
|
import type { FileHistoryRequest } from "./file-history-request.js";
|
|
28
31
|
export interface PrepareFileHistoryInput {
|
|
@@ -36,8 +39,9 @@ export interface PrepareFileHistoryInput {
|
|
|
36
39
|
* acquired: every refusal the request and the deployment's seats decide on their own has already thrown. */
|
|
37
40
|
request: FileHistoryRequest;
|
|
38
41
|
/** borrowed-readonly — the trusted lineage a delegating parent handed this run (absent for a root run
|
|
39
|
-
* and for a host's own fork), read for the recording-scope decision only
|
|
40
|
-
|
|
42
|
+
* and for a host's own fork), read for the recording-scope decision only; and the Runner's session
|
|
43
|
+
* read-state seats, whose restore channel the restore writes the paths it moved into. */
|
|
44
|
+
internals: Pick<RunInternals, "fileHistoryLineage" | "sessionReadStates"> | undefined;
|
|
41
45
|
/** borrowed-readonly — the run's resolved env (owned or static or the stub); every history verb runs
|
|
42
46
|
* against ITS filesystem ops. Never rebound or destroyed here. */
|
|
43
47
|
executionEnv: ExecutionEnv;
|
|
@@ -60,9 +64,6 @@ export interface PrepareFileHistoryResult {
|
|
|
60
64
|
/** borrowed-readonly — the turn-start boundary seat runtask drives; `undefined` when not live or when
|
|
61
65
|
* this run records into its ROOT session's scope (a child mints no boundaries). */
|
|
62
66
|
fileHistoryBoundary: FileHistoryBoundarySeat | undefined;
|
|
63
|
-
/** borrowed-readonly — the absolute paths the restore MUTATED (empty when no restore ran), for the
|
|
64
|
-
* read-face phase's read-state invalidation. */
|
|
65
|
-
restoredFilePaths: string[];
|
|
66
67
|
/** borrowed-mutable — the non-fatal rewind disclosures (`TaskResult.rewindNotes`). Mutation owners after
|
|
67
68
|
* this call: none — every push happens inside this phase; the driver only reads it into `Prepared`. */
|
|
68
69
|
rewindNotes: NonNullable<TaskResult["rewindNotes"]>;
|
|
@@ -79,6 +80,45 @@ export interface PrepareFileHistoryResult {
|
|
|
79
80
|
historyFs: string;
|
|
80
81
|
}
|
|
81
82
|
export declare function prepareFileHistory(input: PrepareFileHistoryInput): Promise<PrepareFileHistoryResult>;
|
|
83
|
+
/**
|
|
84
|
+
* Carry a forked session's file history from its parent scope (the seat §5 names).
|
|
85
|
+
* Never throws and never fails the turn: a store that cannot carry leaves the fork with an empty
|
|
86
|
+
* history, which is DEGRADED (a pre-fork boundary is not restorable from the new session) and not
|
|
87
|
+
* wrong (nothing is silently mis-restored — the restore seat answers "no boundary" honestly).
|
|
88
|
+
*/
|
|
89
|
+
export declare function adoptForkedFileHistory(store: FileHistoryStore, session: {
|
|
90
|
+
getMetadata(): Promise<{
|
|
91
|
+
forkedFrom?: string;
|
|
92
|
+
}>;
|
|
93
|
+
}, sessionId: string, onError: RunnerDeps["onError"]): Promise<void>;
|
|
94
|
+
/**
|
|
95
|
+
* The run's two file-history COORDINATES, resolved once where store/env/root meet (module-level per
|
|
96
|
+
* the body ratchet):
|
|
97
|
+
* - `historyRoot` — ONE canonical root coordinate for every history verb: capture keys (rel-under-root
|
|
98
|
+
* vs absolute, DV-6) must agree with the canonical containment keys the hands band mints — a
|
|
99
|
+
* symlinked root spelling (macOS /var → /private/var) would otherwise record in-root files as
|
|
100
|
+
* absolute and un-tether them from the root they live in.
|
|
101
|
+
* - `historyScope` — WHICH scope this run's first-touch records land in. A top-level run owns its own
|
|
102
|
+
* (its sessionId). A delegated child that was handed a {@link RunInternals.fileHistoryLineage} and
|
|
103
|
+
* runs on the SAME canonical root records into the lineage's scope — the root session's — so the
|
|
104
|
+
* edits a child makes on the user's behalf are part of the ONE history the user rewinds from
|
|
105
|
+
* (before this, a child's first touch minted its baseline in a scope no rewind ever read, and the
|
|
106
|
+
* parent's own later first touch of that file recorded the child-modified bytes as pristine). A
|
|
107
|
+
* child on a DIFFERENT root keeps its own scope: keys are root-relative and carry no root, so a
|
|
108
|
+
* record minted under a worktree re-joined against the root session's tree would converge a file
|
|
109
|
+
* that run never edited — the structural out-of-scope guarantee the store contract opens with.
|
|
110
|
+
* Same-tree equality is judged on TWO coordinates, both minted here: the CANONICAL root spelling
|
|
111
|
+
* both sides minted their keys against, and the FILESYSTEM the env is a view of
|
|
112
|
+
* ({@link fileHistoryFilesystemIdentity}) — a path string alone is not a tree (two per-task
|
|
113
|
+
* sandboxes can both spell `/workspace` and hold unrelated files).
|
|
114
|
+
* With no live history store there is nothing to coordinate: own scope, uncanonicalized root, no
|
|
115
|
+
* filesystem identity (nothing reads any of them).
|
|
116
|
+
*/
|
|
117
|
+
export declare function resolveFileHistoryCoordinates(enabled: boolean, env: ExecutionEnv, taskRoot: string, lineage: RunInternals["fileHistoryLineage"], sessionId: string): Promise<{
|
|
118
|
+
historyRoot: string;
|
|
119
|
+
historyScope: string;
|
|
120
|
+
historyFs: string;
|
|
121
|
+
}>;
|
|
82
122
|
/** The ONE reading of {@link RunInternals.fileHistoryLineage} (see {@link resolveFileHistoryCoordinates}):
|
|
83
123
|
* the lineage's scope iff BOTH tree coordinates match; otherwise the run's own session. */
|
|
84
124
|
export declare function resolveFileHistoryScope(lineage: RunInternals["fileHistoryLineage"], historyRoot: string, historyFs: string, sessionId: string): string;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { NodeExecutionEnv } from "../../engine/execution-env/node-execution-env.js";
|
|
2
2
|
import { isRemoteExecutionEnv } from "../remote-env.js";
|
|
3
|
-
import {
|
|
3
|
+
import { FILE_HISTORY_ERROR_CODES, FileHistoryStoreError } from "../file-history-store.js";
|
|
4
|
+
import { readMember, thrownText } from "../thrown-value.js";
|
|
5
|
+
import { isGovernanceRetryClass } from "../governance-codes.js";
|
|
6
|
+
import { fileHistoryRestoreLedgerLine, settleFileHistoryRestore } from "./file-history-restore.js";
|
|
4
7
|
export async function prepareFileHistory(input) {
|
|
5
8
|
const { deps, spec, request, internals, executionEnv, taskRootFinal, handsEnabled, sessionId, session, abortController } = input;
|
|
6
9
|
const rewindNotes = [];
|
|
@@ -43,27 +46,10 @@ export async function prepareFileHistory(input) {
|
|
|
43
46
|
});
|
|
44
47
|
}
|
|
45
48
|
}
|
|
46
|
-
let restoredFilePaths = [];
|
|
47
49
|
if (rewindTarget !== undefined && fileHistoryStore !== undefined && handsEnabled) {
|
|
48
|
-
const historyStore = fileHistoryStore;
|
|
49
|
-
if (rewindBefore && !(await historyStore.canRestore(sessionId, rewindTarget)))
|
|
50
|
-
throw beforeWithoutBoundaryRefusal(rewindTarget, sessionId);
|
|
51
|
-
const restoreRoot = historyRoot;
|
|
52
50
|
const restoreSignal = spec.signal ? AbortSignal.any([abortController.signal, spec.signal]) : abortController.signal;
|
|
53
|
-
const restored = await
|
|
54
|
-
const ledgerLine =
|
|
55
|
-
if (restored.outcome === "failed") {
|
|
56
|
-
if (restored.error?.code === "not_found") {
|
|
57
|
-
if (rewindBefore)
|
|
58
|
-
throw beforeWithoutBoundaryRefusal(rewindTarget, sessionId);
|
|
59
|
-
const e = new Error(`rewind-files: no file-history boundary exists for entry "${rewindTarget}" on session "${sessionId}" — the working tree was NOT rewound. ${rewindRefusalTail()}`);
|
|
60
|
-
e.code = "rewind_snapshot.unresolvable";
|
|
61
|
-
throw e;
|
|
62
|
-
}
|
|
63
|
-
const e = new Error(`rewind-files restore failed (${restored.error?.code ?? "restore_failed"}): ${restored.error?.message ?? "unknown"} — ledger: ${ledgerLine(restored)}`);
|
|
64
|
-
e.code = "rewind.restore_failed";
|
|
65
|
-
throw e;
|
|
66
|
-
}
|
|
51
|
+
const restored = await settleFileHistoryRestore({ store: fileHistoryStore, sessionId, target: rewindTarget, before: rewindBefore, env: executionEnv, root: historyRoot, signal: restoreSignal, readStates: internals?.sessionReadStates });
|
|
52
|
+
const ledgerLine = fileHistoryRestoreLedgerLine;
|
|
67
53
|
if (restored.outcome === "partial") {
|
|
68
54
|
if (spec.acceptPartialRestore === true) {
|
|
69
55
|
rewindNotes.push({
|
|
@@ -77,22 +63,21 @@ export async function prepareFileHistory(input) {
|
|
|
77
63
|
throw e;
|
|
78
64
|
}
|
|
79
65
|
}
|
|
80
|
-
restoredFilePaths = restoredAbsPathsOf(restored, restoreRoot);
|
|
81
66
|
}
|
|
82
67
|
const trackFileEdit = fileHistoryEnabled
|
|
83
68
|
? async (req) => {
|
|
84
|
-
const r = await fileHistoryStore.trackEdit(historyScope, req.key, executionEnv, historyRoot, req.signal);
|
|
69
|
+
const r = await answerOf(() => fileHistoryStore.trackEdit(historyScope, req.key, executionEnv, historyRoot, req.signal), "track_failed");
|
|
85
70
|
if (r.ok) {
|
|
86
71
|
if (!r.minted)
|
|
87
72
|
return { ok: true };
|
|
88
73
|
return {
|
|
89
74
|
ok: true,
|
|
90
75
|
annul: async (proof) => {
|
|
91
|
-
const a = await fileHistoryStore.annulTrack(historyScope, req.key, historyRoot, proof === "verify" ? { env: executionEnv, ...(req.signal !== undefined ? { signal: req.signal } : {}) } : undefined);
|
|
76
|
+
const a = await answerOf(() => fileHistoryStore.annulTrack(historyScope, req.key, historyRoot, proof === "verify" ? { env: executionEnv, ...(req.signal !== undefined ? { signal: req.signal } : {}) } : undefined), "track_failed");
|
|
92
77
|
if (a.ok)
|
|
93
78
|
return;
|
|
94
79
|
try {
|
|
95
|
-
deps.onError?.(new
|
|
80
|
+
deps.onError?.(new FileHistoryStoreError(a.error, `file-history could not retract the first-touch record for "${req.key}" after its edit failed to land (${a.error.code}: ${a.error.message}) — the path stays tracked, so a rewind to a boundary below it may converge bytes this engine never wrote`, "thrown" in a ? a.thrown : undefined), { phase: "rewind", sessionId });
|
|
96
81
|
}
|
|
97
82
|
catch {
|
|
98
83
|
}
|
|
@@ -101,40 +86,21 @@ export async function prepareFileHistory(input) {
|
|
|
101
86
|
}
|
|
102
87
|
if (onTrackFailure === "proceed-unprotected") {
|
|
103
88
|
try {
|
|
104
|
-
deps.onError?.(new
|
|
89
|
+
deps.onError?.(new FileHistoryStoreError(r.error, `file-history first-touch backup for "${req.key}" failed (${r.error.code}: ${r.error.message}) — proceeding UNPROTECTED per RunnerDeps.onTrackFailure: the pristine promise for this path is void, and only in this process's memory (no durable trace exists, so after a process restart the next edit can still mint already-modified bytes as pristine v1)`, "thrown" in r ? r.thrown : undefined), { phase: "rewind", sessionId });
|
|
105
90
|
}
|
|
106
91
|
catch {
|
|
107
92
|
}
|
|
108
93
|
return { ok: true };
|
|
109
94
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
refusal: `Error (${req.tool}): the edit was refused because its first-touch file-history backup could not be persisted (${r.error.code}: ${r.error.message}). Proceeding would leave "${req.path}" with no durable pristine record — after the history store recovers, a retried edit would mint already-modified bytes as the pristine baseline. Retry when the file-history store is healthy.`,
|
|
113
|
-
};
|
|
95
|
+
const lead = r.error.permanence === "terminal" ? "The history store reports this failure as permanent: do not retry this edit until the store is fixed." : "Retry when the file-history store is healthy.";
|
|
96
|
+
return { ok: false, refusal: `Error (${req.tool}): the edit was refused because its first-touch file-history backup could not be persisted (${r.error.code}). ${lead} Proceeding would leave the file with no durable pristine record. ${r.error.message}` };
|
|
114
97
|
}
|
|
115
98
|
: undefined;
|
|
116
99
|
const fileHistoryBoundary = fileHistoryEnabled && historyScope === sessionId
|
|
117
100
|
? createFileHistoryBoundarySeat({ store: fileHistoryStore, sessionId, env: executionEnv, root: historyRoot, onError: deps.onError })
|
|
118
101
|
: undefined;
|
|
119
102
|
const fileHistoryFact = fileHistoryEnabled ? "on" : "disabled";
|
|
120
|
-
return { trackFileEdit, fileHistoryBoundary,
|
|
121
|
-
}
|
|
122
|
-
function restoredAbsPathsOf(restored, root) {
|
|
123
|
-
const out = [];
|
|
124
|
-
for (const key of [...restored.filesChanged, ...restored.failed.map((f) => f.path)]) {
|
|
125
|
-
const abs = resolveTrackKey(root, key);
|
|
126
|
-
if (abs.ok)
|
|
127
|
-
out.push(abs.abs);
|
|
128
|
-
}
|
|
129
|
-
return out;
|
|
130
|
-
}
|
|
131
|
-
function rewindRefusalTail() {
|
|
132
|
-
return `Boundaries are keyed by a turn's INITIAL entry and exist only for turns that recorded history (a RunnerDeps.fileHistoryStore wired, capture on, and the run's file history not disabled); a boundary from the retired whole-tree snapshot era is not restorable by this seat, and reaped boundaries have none.`;
|
|
133
|
-
}
|
|
134
|
-
function beforeWithoutBoundaryRefusal(target, sessionId) {
|
|
135
|
-
const e = new Error(`rewind-files: entry "${target}" has no file-history boundary on session "${sessionId}" — a before-restore needs the target's own boundary and never crosses into an earlier turn, so the working tree was NOT rewound. ${rewindRefusalTail()}`);
|
|
136
|
-
e.code = "rewind_snapshot.unresolvable";
|
|
137
|
-
return e;
|
|
103
|
+
return { trackFileEdit, fileHistoryBoundary, rewindNotes, fileHistoryEnabled, fileHistoryFact, historyScope, historyRoot, historyFs };
|
|
138
104
|
}
|
|
139
105
|
const FILE_HISTORY_BOUNDARY_TIMEOUT_MS = 30_000;
|
|
140
106
|
const FILE_HISTORY_LIVENESS_MEMO = new WeakMap();
|
|
@@ -147,7 +113,22 @@ function toldAlready(sink, arm) {
|
|
|
147
113
|
return false;
|
|
148
114
|
}
|
|
149
115
|
const FILE_HISTORY_CARRY_MEMO = new WeakMap();
|
|
150
|
-
|
|
116
|
+
function answerOf(call, code) {
|
|
117
|
+
const unanswered = (message, thrown) => ({ ok: false, error: { code, message }, ...(thrown === undefined ? {} : { thrown }) });
|
|
118
|
+
return Promise.resolve().then(call).then((r) => {
|
|
119
|
+
const ok = readMember(r, "ok");
|
|
120
|
+
if (ok === true)
|
|
121
|
+
return { ok: true, minted: readMember(r, "minted") === true };
|
|
122
|
+
const error = readMember(r, "error"), stated = readMember(error, "code"), message = readMember(error, "message"), permanence = readMember(error, "permanence");
|
|
123
|
+
if (ok !== false || typeof stated !== "string")
|
|
124
|
+
return unanswered("the history store answered something that is not a result");
|
|
125
|
+
const text = typeof message === "string" ? message : "(the history store gave no message)", known = FILE_HISTORY_ERROR_CODES.find((c) => c === stated);
|
|
126
|
+
if (known === undefined)
|
|
127
|
+
return unanswered(`the history store answered a code outside the closed set (${JSON.stringify(stated)}): ${text}`);
|
|
128
|
+
return { ok: false, error: { code: known, message: text, ...(isGovernanceRetryClass(permanence) ? { permanence } : {}) } };
|
|
129
|
+
}, (value) => unanswered(`the history store threw: ${thrownText(value)}`, { value }));
|
|
130
|
+
}
|
|
131
|
+
export async function adoptForkedFileHistory(store, session, sessionId, onError) {
|
|
151
132
|
const memo = FILE_HISTORY_CARRY_MEMO.get(store) ?? { settled: new Set(), disclosed: new Set(), inFlight: new Map() };
|
|
152
133
|
FILE_HISTORY_CARRY_MEMO.set(store, memo);
|
|
153
134
|
const discloseOnce = (err) => {
|
|
@@ -156,6 +137,7 @@ async function adoptForkedFileHistory(store, session, sessionId, onError) {
|
|
|
156
137
|
memo.disclosed.add(sessionId);
|
|
157
138
|
onError?.(err, { phase: "rewind", sessionId });
|
|
158
139
|
};
|
|
140
|
+
const threw = (err) => new FileHistoryStoreError({ code: "adopt_failed" }, `file-history fork carry could not run: ${thrownText(err)} — the parent's history was not carried into this session (the run itself proceeds)`, { value: err });
|
|
159
141
|
try {
|
|
160
142
|
if (memo.settled.has(sessionId))
|
|
161
143
|
return;
|
|
@@ -167,13 +149,13 @@ async function adoptForkedFileHistory(store, session, sessionId, onError) {
|
|
|
167
149
|
return await shared;
|
|
168
150
|
if (memo.settled.has(sessionId))
|
|
169
151
|
return;
|
|
170
|
-
const attempt = store.adoptScope(forkedFrom, sessionId).then((carried) => {
|
|
152
|
+
const attempt = answerOf(() => store.adoptScope(forkedFrom, sessionId), "adopt_failed").then((carried) => {
|
|
171
153
|
if (carried.ok || carried.error.code === "conflict") {
|
|
172
154
|
memo.settled.add(sessionId);
|
|
173
155
|
return;
|
|
174
156
|
}
|
|
175
|
-
discloseOnce(new
|
|
176
|
-
}
|
|
157
|
+
discloseOnce(new FileHistoryStoreError(carried.error, `file-history fork carry from session "${forkedFrom}" failed (${carried.error.code}): ${carried.error.message} — the parent's history was not carried, so boundaries recorded before the fork are not restorable from this session (the run itself proceeds; the carry is retried on this session's next turn)`, "thrown" in carried ? carried.thrown : undefined));
|
|
158
|
+
});
|
|
177
159
|
memo.inFlight.set(sessionId, attempt);
|
|
178
160
|
try {
|
|
179
161
|
await attempt;
|
|
@@ -184,7 +166,7 @@ async function adoptForkedFileHistory(store, session, sessionId, onError) {
|
|
|
184
166
|
}
|
|
185
167
|
catch (err) {
|
|
186
168
|
try {
|
|
187
|
-
discloseOnce(err);
|
|
169
|
+
discloseOnce(threw(err));
|
|
188
170
|
}
|
|
189
171
|
catch {
|
|
190
172
|
}
|
|
@@ -206,30 +188,16 @@ function createFileHistoryBoundarySeat(opts) {
|
|
|
206
188
|
resolve({ ok: false });
|
|
207
189
|
}, FILE_HISTORY_BOUNDARY_TIMEOUT_MS);
|
|
208
190
|
});
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
work = opts.store.snapshot(opts.sessionId, entryId, opts.env, opts.root, ac.signal);
|
|
212
|
-
}
|
|
213
|
-
catch (err) {
|
|
214
|
-
work = Promise.resolve({ ok: false, error: { code: "snapshot_failed", message: `history store threw synchronously: ${err.message}` } });
|
|
215
|
-
}
|
|
216
|
-
work.catch(() => { });
|
|
191
|
+
const work = answerOf(() => opts.store.snapshot(opts.sessionId, entryId, opts.env, opts.root, ac.signal), "snapshot_failed");
|
|
192
|
+
const disclose = (failure, what, thrown) => new FileHistoryStoreError(failure, `file-history ${what} — this turn has no boundary and cannot be rewound to (the turn itself proceeds)`, thrown);
|
|
217
193
|
inFlight = Promise.race([
|
|
218
|
-
work.then((r) => (r.ok ? undefined : `boundary capture failed (${r.error.code}): ${r.error.message}
|
|
219
|
-
timeout.then(() => `boundary capture timed out after ${FILE_HISTORY_BOUNDARY_TIMEOUT_MS / 1000}s (fenced — the attempt can never publish)`),
|
|
194
|
+
work.then((r) => (r.ok ? undefined : disclose(r.error, `boundary capture failed (${r.error.code}): ${r.error.message}`, "thrown" in r ? r.thrown : undefined))),
|
|
195
|
+
timeout.then(() => disclose({ code: "aborted" }, `boundary capture timed out after ${FILE_HISTORY_BOUNDARY_TIMEOUT_MS / 1000}s (fenced — the attempt can never publish)`)),
|
|
220
196
|
])
|
|
221
197
|
.then((failure) => {
|
|
222
|
-
if (failure !== undefined) {
|
|
223
|
-
try {
|
|
224
|
-
opts.onError?.(new Error(`file-history ${failure} — this turn has no boundary and cannot be rewound to (the turn itself proceeds)`), { phase: "rewind", sessionId: opts.sessionId });
|
|
225
|
-
}
|
|
226
|
-
catch {
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
})
|
|
230
|
-
.catch((err) => {
|
|
231
198
|
try {
|
|
232
|
-
|
|
199
|
+
if (failure !== undefined)
|
|
200
|
+
opts.onError?.(failure, { phase: "rewind", sessionId: opts.sessionId });
|
|
233
201
|
}
|
|
234
202
|
catch {
|
|
235
203
|
}
|
|
@@ -242,7 +210,7 @@ function createFileHistoryBoundarySeat(opts) {
|
|
|
242
210
|
},
|
|
243
211
|
};
|
|
244
212
|
}
|
|
245
|
-
async function resolveFileHistoryCoordinates(enabled, env, taskRoot, lineage, sessionId) {
|
|
213
|
+
export async function resolveFileHistoryCoordinates(enabled, env, taskRoot, lineage, sessionId) {
|
|
246
214
|
if (!enabled)
|
|
247
215
|
return { historyRoot: taskRoot, historyScope: sessionId, historyFs: "" };
|
|
248
216
|
const canonRoot = await env.canonicalPath(taskRoot);
|
|
@@ -34,7 +34,7 @@ import type { InheritedToolCheck, LegModBus } from "../mods/stations.js";
|
|
|
34
34
|
import { type HookEnvCapabilities, type HookInvocationIdentity } from "../hooks.js";
|
|
35
35
|
import type { ToolPolicy } from "../tool-policy.js";
|
|
36
36
|
import { type GateOutcome } from "../gate-outcome.js";
|
|
37
|
-
import type { RunnerDeps, TaskSpec
|
|
37
|
+
import type { RunnerDeps, TaskSpec } from "../types.js";
|
|
38
38
|
import { type WiringManifest } from "../wiring-manifest.js";
|
|
39
39
|
import type { WriteProtectionCheck } from "../write-protect.js";
|
|
40
40
|
import type { ShellReadCheck } from "../../tools/fs/shell-read-check.js";
|
|
@@ -82,9 +82,6 @@ export interface PrepareGateStationsInput {
|
|
|
82
82
|
tools: readonly AgentTool[];
|
|
83
83
|
/** borrowed-readonly — the leg's delta seat: its current roster is the face source for every gated call. */
|
|
84
84
|
toolRosterDeltas: ToolRosterDeltaSeat;
|
|
85
|
-
/** borrowed-mutable — the effect collection. Writer here: the final-roster sync fills MISSING entries from each
|
|
86
|
-
* first-party tool's declared effect (never overrides a scanned one); the plan-mode deny reads it per call. */
|
|
87
|
-
toolEffects: Map<string, ToolEffect>;
|
|
88
85
|
/** borrowed-readonly — the deployment seats these stations read, as a Pick over the SAME `deps` object (receiver
|
|
89
86
|
* preserved for `deps.onError?.()`): the write-protection table and its data root, the tracer, the error face, and
|
|
90
87
|
* the notice sink (the gate's unresolvable-ask exit delivers `delegation.ask_unresolvable` through it). */
|
|
@@ -111,7 +108,7 @@ export interface PrepareGateStationsInput {
|
|
|
111
108
|
complianceDenies: ReadonlySet<ComplianceCapability>;
|
|
112
109
|
/** borrowed-mutable — the built harness. Writer here: `on("tool_call")` / `on("tool_result")` — the registrations this
|
|
113
110
|
* phase exists for, in this order, after the driver's boundary-lease handler. */
|
|
114
|
-
harness: Pick<AgentHarness, "on">;
|
|
111
|
+
harness: Pick<AgentHarness, "on" | "isBatchSafe">;
|
|
115
112
|
/** borrowed-mutable — the blocked/suspended call ids (`Prepared.blockedToolCalls`). Writers here: the head-of-evaluation
|
|
116
113
|
* hygiene `delete`, the two short-circuits' and the gate outcome's `add`, the `tool_result` station's one-shot `delete`. */
|
|
117
114
|
blockedToolCalls: Set<string>;
|
|
@@ -10,9 +10,11 @@ import { askUnresolvableNotice } from "../ask-unresolvable-notice.js";
|
|
|
10
10
|
import { approvalRouteOf } from "../wiring-manifest.js";
|
|
11
11
|
import { classifierUnavailableSeat } from "./classifier-ladder.js";
|
|
12
12
|
import { PATH_CONFINABLE_WRITE_TOOLS } from "./session-rule-policy.js";
|
|
13
|
-
import { callFaceSeat, rosterToolName,
|
|
13
|
+
import { callFaceSeat, rosterToolName, toolCallFaceOf } from "../tool-roster.js";
|
|
14
14
|
import { heldBy, heldValues, seatOf, wireOf } from "../tool-name-readings.js";
|
|
15
15
|
import { createApprovedCallScreen, createToolResultStation } from "./call-hook-stations.js";
|
|
16
|
+
import { extensionCallOf } from "../mods/extension-call.js";
|
|
17
|
+
import { extensionCallOverlap } from "../mods/tool-call.js";
|
|
16
18
|
const PEER_MESSAGE_NAMES = new Set([SEND_MESSAGE_TOOL_NAME]);
|
|
17
19
|
function screenGateResult(result) {
|
|
18
20
|
if (result.suspend !== undefined)
|
|
@@ -46,7 +48,7 @@ export function maybeHumanRejectionHalt(input) {
|
|
|
46
48
|
};
|
|
47
49
|
}
|
|
48
50
|
export function prepareGateStations(input) {
|
|
49
|
-
const { askLane, parkAsk, tools, toolRosterDeltas,
|
|
51
|
+
const { askLane, parkAsk, tools, toolRosterDeltas, deps, toolCallGateArmedRef, effectivePolicy, egressTools, irreversibleTools, spec, complianceDenies, harness, blockedToolCalls, inheritedAskGrants, inheritedUnavailableAsks, foldAskClasses, ancestorSandboxAdmissions, preToolContexts, toolOccurrences, batchHaltRef, blockedTracked, hookIdentity, reminderMark, hostTaskId, sessionId, handsCwdRef, stampCallTarget, hookEnvFace, writeProtectionCheck, shellReadCheck, crossBoundaryCheck, readFace, irreversibilityTier, reversibilityProbes, abortController, shellGatedTools, autoModeDecider, autoModeDenialTracking, askRoute, permissionMode, toolMarkSources, a2aIsolatePeers, ancestorArbitrations, runId, stopForDenialLimit, permissionRuleLane, permissionRuleOrgLane, questionToolMounted, sandboxAdmissionArmed, sandboxBoundaryCapable, emitSandboxAdmitted, delegation, frameSettlement, seatInputsFor, modBus, inheritedToolChecks } = input;
|
|
50
52
|
const releasesAnnounced = new Map();
|
|
51
53
|
const onModeReleased = (info) => {
|
|
52
54
|
const table = info.readUnestablished === true ? input.readDenyInForce(info.toolCallId) : undefined;
|
|
@@ -72,11 +74,6 @@ export function prepareGateStations(input) {
|
|
|
72
74
|
if (askLane !== undefined && parkAsk !== undefined) {
|
|
73
75
|
const { adjudicate, resolveAskBound, notifyPermissionDenied, notifyHookError } = askLane;
|
|
74
76
|
const { resolveContentAsk, suspendAsk } = parkAsk;
|
|
75
|
-
for (const t of survivorsByName(tools).values()) {
|
|
76
|
-
const eff = t.effect;
|
|
77
|
-
if (eff !== undefined && !toolEffects.has(t.name))
|
|
78
|
-
toolEffects.set(t.name, eff);
|
|
79
|
-
}
|
|
80
77
|
const writeProtectionArmed = writeProtectionCheck !== undefined && tools.some((t) => PATH_CONFINABLE_WRITE_TOOLS.has(t.name));
|
|
81
78
|
toolCallGateArmedRef.armed =
|
|
82
79
|
effectivePolicy !== undefined ||
|
|
@@ -128,7 +125,7 @@ export function prepareGateStations(input) {
|
|
|
128
125
|
toolFaceOf: (name) => toolCallFaceOf(toolRosterDeltas.current, name === e.toolName ? called.toolName : name),
|
|
129
126
|
adjudicate,
|
|
130
127
|
resolveAsk: (...args) => toolOccurrences.whileAwaitingUser(args[1].toolCallId, () => resolveAskBound(...args)),
|
|
131
|
-
suspendAsk,
|
|
128
|
+
...(extensionCallOf(modBus, e.toolCallId) === undefined ? { suspendAsk } : {}),
|
|
132
129
|
resolveContentAsk: (...args) => toolOccurrences.whileAwaitingUser(args[0].toolCallId, () => resolveContentAsk(...args)),
|
|
133
130
|
egress: heldBy("gate.egress", egressTools, call),
|
|
134
131
|
peerMessage: heldBy("gate.peerMessage", PEER_MESSAGE_NAMES, call),
|
|
@@ -241,6 +238,13 @@ export function prepareGateStations(input) {
|
|
|
241
238
|
}
|
|
242
239
|
return { block: true, reason: result.reason, ...details };
|
|
243
240
|
}
|
|
241
|
+
const overlap = result.suspend === undefined && extensionCallOf(modBus, e.toolCallId) !== undefined ? extensionCallOverlap({ occurrences: toolOccurrences, toolCallId: e.toolCallId, toolName: e.toolName, args: result.finalInput ?? e.input, batchSafe: (n, a) => harness.isBatchSafe(n, a) }) : undefined;
|
|
242
|
+
if (overlap !== undefined) {
|
|
243
|
+
toolOccurrences.refuse(e.toolCallId, "hook");
|
|
244
|
+
if (blockedTracked)
|
|
245
|
+
blockedToolCalls.add(e.toolCallId);
|
|
246
|
+
return { block: true, reason: formatHookFeedback(overlap, reminderMark) };
|
|
247
|
+
}
|
|
244
248
|
if (result.suspend === undefined)
|
|
245
249
|
toolOccurrences.release(e.toolCallId);
|
|
246
250
|
return result.updatedInput !== undefined ? { updatedInput: result.updatedInput } : undefined;
|
|
@@ -96,7 +96,8 @@ export interface PrepareHandsReadFaceInput {
|
|
|
96
96
|
deps: Pick<RunnerDeps, "onError" | "onNotice" | "tracer" | "readDenyPatterns" | "readDenyBuiltinTiers" | "readDenyBuiltinExclude" | "agentConfigDir" | "readFace" | "writeFace" | "permissionRuleStore" | "hands">;
|
|
97
97
|
/** borrowed-readonly — the trusted spawn-side seats the band forwards: the finished-command
|
|
98
98
|
* notification lane, the mid-flight detach hub, and the Runner's per-session
|
|
99
|
-
* read-state seats (absent on a standalone prepare ⇒ the transcript-replay rung
|
|
99
|
+
* read-state seats and their restore channel (absent on a standalone prepare ⇒ the transcript-replay rung
|
|
100
|
+
* covers alone, and no restore is owed a check — the channel is the Runner's). */
|
|
100
101
|
internals: Pick<RunInternals, "onTaskNotification" | "detachHub" | "sessionReadStates"> | undefined;
|
|
101
102
|
/** borrowed-mutable — the harness seat, read LIVE by the band's queued-human-input predicate (the shell's
|
|
102
103
|
* auto-backgrounding leg asks it mid-command). Late-bound: the band is built here, the harness later. */
|
|
@@ -110,13 +111,6 @@ export interface PrepareHandsReadFaceInput {
|
|
|
110
111
|
};
|
|
111
112
|
/** borrowed-mutable — the leg's occurrence table; writer here: the shell read station's refused-admission callback. */
|
|
112
113
|
toolOccurrences: ToolOccurrenceTable;
|
|
113
|
-
/** borrowed-readonly — ABSOLUTE paths this prepare's restore wrote, deleted,
|
|
114
|
-
* or failed to write. Every read-state seed above describes the PRE-restore tree, so these keys are
|
|
115
|
-
* dropped from the map: the engine replaced those bytes itself, and a surviving entry makes the
|
|
116
|
-
* next refusal blame "the user or a linter" for the engine's own write. Absent (the common case)
|
|
117
|
-
* when no file restore ran. Fail-closed by construction — dropping a read record only ever
|
|
118
|
-
* produces refusals. */
|
|
119
|
-
restoredFilePaths?: readonly string[];
|
|
120
114
|
/** borrowed-readonly — the memory write gate the memory phase minted (it runs BEFORE this phase: the memory root
|
|
121
115
|
* must be known before the toolkit compiles), composed into the band's beforeWrite below; undefined for a
|
|
122
116
|
* memory-less run (every write passes the engine half). */
|
|
@@ -260,22 +260,23 @@ export async function prepareHandsMount(input) {
|
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
}
|
|
263
|
+
const restoredOwed = sessionSeats?.pendingRestored(sessionId) ?? [];
|
|
264
|
+
for (const abs of restoredOwed) {
|
|
265
|
+
const k = await judgeKey(abs);
|
|
266
|
+
if (k === undefined)
|
|
267
|
+
continue;
|
|
268
|
+
const entry = readFileState.get(k);
|
|
269
|
+
if (entry === undefined || entry.seededFromContext === true)
|
|
270
|
+
continue;
|
|
271
|
+
const cur = await executionEnv.readTextFile(abs);
|
|
272
|
+
if (cur.ok && entry.hash === sha256(normalizeFileText(cur.value)))
|
|
273
|
+
continue;
|
|
274
|
+
readFileState.delete(k);
|
|
276
275
|
}
|
|
277
|
-
if (seatLeafId !== undefined)
|
|
276
|
+
if (seatLeafId !== undefined) {
|
|
278
277
|
sessionSeats?.adopt(sessionId, readFileState, seatLeafId);
|
|
278
|
+
sessionSeats?.settleRestored(sessionId, restoredOwed);
|
|
279
|
+
}
|
|
279
280
|
sealReadStateSeat =
|
|
280
281
|
sessionSeats !== undefined && seatLeafId !== undefined
|
|
281
282
|
? (ownCommittedTailEntryId) => {
|
|
@@ -43,7 +43,7 @@ import { type ChildClampSource } from "../child-clamp-seats.js";
|
|
|
43
43
|
import type { LockedPreflight } from "../locked-config.js";
|
|
44
44
|
import type { OwnOrgAdmissionVerdict } from "../memory-admission.js";
|
|
45
45
|
import type { DelegationContentSafety } from "../memory-engine/delegation-provenance.js";
|
|
46
|
-
import {
|
|
46
|
+
import type { SessionPermissionRules } from "../session-policy-store.js";
|
|
47
47
|
import type { SessionStore } from "../session.js";
|
|
48
48
|
import { type OnAsk, type ToolPolicy } from "../tool-policy.js";
|
|
49
49
|
import type { PathRuleBases } from "../permission-rule-model.js";
|
|
@@ -62,6 +62,8 @@ export interface PrepareInheritedGateInput {
|
|
|
62
62
|
checkpointSeat: import("../checkpoint-seat.js").CheckpointSeat | undefined;
|
|
63
63
|
/** borrowed-readonly — this leg's checkpoint scope (the driver's one `checkpointScopeOf` derivation): the ctx's `checkpointScopeForChildren`, which every delegation lane copies into its children's internals. */
|
|
64
64
|
checkpointScope: string;
|
|
65
|
+
/** borrowed-readonly — the deployment's host floor as the config doors compiled it (`RunnerDeps.hostFloor`): the ctx's `hostFloor`, absent when none is declared. */
|
|
66
|
+
hostFloor: import("../host-floor.js").HostFloor | undefined;
|
|
65
67
|
/** borrowed-readonly — the deployment seats: `autoMode.denialLimit` (the rebuilt trackers' bounds), `memoryScopeAdmission` /
|
|
66
68
|
* `deploymentMemoryScopes` / `compliancePostureResolver` (the governed-provenance bit), `onError` (the screening-face crash
|
|
67
69
|
* lane), `onNotice` (the stop seat's notice), `executionEnv` (the hook-env identity predicate), `delegationEntryCaps` (resolved
|
|
@@ -109,8 +111,8 @@ export interface PrepareInheritedGateInput {
|
|
|
109
111
|
mountsCallerTool: (tool: ToolSpec) => boolean;
|
|
110
112
|
/** borrowed-readonly — the ctx's `mountedMcp` seat: the MCP surface the run mounts right now (call-time; the roster is minted after this phase). Present iff the run declared a server. */
|
|
111
113
|
mountedMcp?: () => import("../mounted-mcp.js").MountedMcp;
|
|
112
|
-
/** borrowed-readonly — the
|
|
113
|
-
|
|
114
|
+
/** borrowed-readonly — the task-level lean switch (ctx seat; absent ⇒ no key). */
|
|
115
|
+
promptLean: ToolExecuteContext["promptLean"];
|
|
114
116
|
/** borrowed-readonly — the resolved interaction posture (ctx seat; absent ⇒ no key). */
|
|
115
117
|
resolvedInteractionPosture: ToolExecuteContext["interactionPosture"];
|
|
116
118
|
/** borrowed-readonly — the task's own permission-mode key, screened and snapshotted before the first await (undefined =
|
|
@@ -160,7 +162,8 @@ export interface PrepareInheritedGateInput {
|
|
|
160
162
|
/** borrowed-readonly — LATE-BOUND: the per-principal entitlements the caps phase resolves after this one; read only inside
|
|
161
163
|
* `inheritedGateForChildren` (the two mandate tests), at spawn time. */
|
|
162
164
|
runtimeCaps: () => RuntimeCaps | undefined;
|
|
163
|
-
/** borrowed-readonly — the leg
|
|
165
|
+
/** borrowed-readonly — what the leg hands its descendants of its mods bus (`LegMods.handedDown`: without the skills' own
|
|
166
|
+
* registrations): the chain assembly mints this leg's screening entry over its `classic.PreToolUse` chain. */
|
|
164
167
|
modBus: LegModBus;
|
|
165
168
|
/** borrowed-readonly — this leg's chain identity as its admission recorded it (`chainOfBus`) — the installation identity's chain term. */
|
|
166
169
|
ownModChain: readonly ModChainLink[];
|
|
@@ -228,9 +231,10 @@ export interface PrepareInheritedGateResult {
|
|
|
228
231
|
orgGovernedProvenance: boolean;
|
|
229
232
|
/** owned — the operator's shell floor in force (the spec's, or the chain's); undefined = no floor. */
|
|
230
233
|
effectiveShellGate: ShellGateDoctrine | undefined;
|
|
231
|
-
/** borrowed-mutable — THIS task's own session-rule snapshot for its children's chain
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
+
/** borrowed-mutable — THIS task's own session-rule snapshot for its children's chain: present iff the leg enforces its
|
|
235
|
+
* own session-rule layer (a store is wired and the task carries its own sessionId), from prepare on. Writer (R-3): the
|
|
236
|
+
* policy-chain station — the layer's seed (the empty rev-0 row when the session has none), then each row it comes to
|
|
237
|
+
* enforce. Read by `inheritedGateForChildren` at spawn time. */
|
|
234
238
|
ownSessionRulesRef: {
|
|
235
239
|
current?: {
|
|
236
240
|
sessionId: string;
|