@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,10 +1,11 @@
|
|
|
1
|
+
import { principalNameOf } from "../principal-name.js";
|
|
1
2
|
import { forkGovernanceDenial, resolveDelegationEntryCaps } from "../../agents/subagent.js";
|
|
2
3
|
import { isLiveQuestionFace } from "../ask-question.js";
|
|
3
4
|
import { parentSpecSeatOf } from "../parent-spec-seat.js";
|
|
4
5
|
import { createPreToolUseConstraintPolicy } from "../hooks.js";
|
|
5
6
|
import { chainJudges, sameInstallation } from "../mods/stations.js";
|
|
6
7
|
import { childClampSeats, clampSourceOf } from "../child-clamp-seats.js";
|
|
7
|
-
import {
|
|
8
|
+
import { rowFollowsFloor } from "./session-rule-policy.js";
|
|
8
9
|
import { StubExecutionEnv } from "../stub-env.js";
|
|
9
10
|
import { durableMandateSourceOf } from "../tool-policy.js";
|
|
10
11
|
import { chainAnchorRecords } from "./child-tree.js";
|
|
@@ -16,7 +17,7 @@ import { frozenSkillGrants } from "../skill-grant.js";
|
|
|
16
17
|
import { attachRebuiltDenialTrackers, createDenialLimitStop } from "./denial-limit-arms.js";
|
|
17
18
|
import { valveLeaves } from "../../agents/tool-filter.js";
|
|
18
19
|
export function prepareInheritedGate(input) {
|
|
19
|
-
const { spec, deps, askSeat, internals, resume, sessions, sessionId, runId, hostTaskId, taskRootFinal, executionEnv, ownedEnv, lockedPreflight, pathRuleAnchors, toolFaceSnapshot, mountsCallerTool,
|
|
20
|
+
const { spec, deps, askSeat, internals, resume, sessions, sessionId, runId, hostTaskId, taskRootFinal, executionEnv, ownedEnv, lockedPreflight, pathRuleAnchors, toolFaceSnapshot, mountsCallerTool, promptLean, resolvedInteractionPosture, permissionModeSeat, handsEnabled, reportUsage, harnessRef, skillGrants, forwardEvent, subagentRetain, worktreeIsolation, requestReview, requestStopAfterTurn, enterPlanMode, reminderMark, reminderDisclosureCounts, fileHistoryEnabled, historyScope, historyRoot, historyFs, abortRun } = input;
|
|
20
21
|
const liveInheritedGate = internals?.inheritedGate;
|
|
21
22
|
const seedInheritedGate = resume?.seed.inheritedGate;
|
|
22
23
|
const inheritedAncestorRules = (() => {
|
|
@@ -30,8 +31,8 @@ export function prepareInheritedGate(input) {
|
|
|
30
31
|
return [...seedRules];
|
|
31
32
|
const merged = seedRules.map((s) => {
|
|
32
33
|
const live = liveRules.find((l) => l.sessionId === s.sessionId && l.principal === s.principal);
|
|
33
|
-
const
|
|
34
|
-
return
|
|
34
|
+
const follows = live !== undefined && rowFollowsFloor(live, s);
|
|
35
|
+
return follows && live.rev >= s.rev ? live : s;
|
|
35
36
|
});
|
|
36
37
|
const extras = liveRules.filter((l) => !seedRules.some((s) => s.sessionId === l.sessionId && s.principal === l.principal));
|
|
37
38
|
return [...merged, ...extras];
|
|
@@ -221,7 +222,7 @@ export function prepareInheritedGate(input) {
|
|
|
221
222
|
deferTools: toolFaceSnapshot.defer,
|
|
222
223
|
alwaysLoadTools: toolFaceSnapshot.alwaysLoad,
|
|
223
224
|
...(toolFaceSnapshot.restoreGated !== undefined ? { restoreGatedTools: toolFaceSnapshot.restoreGated } : {}),
|
|
224
|
-
|
|
225
|
+
...(promptLean !== undefined ? { promptLean } : {}),
|
|
225
226
|
...(spec.memoryPersistenceCapable !== undefined ? { memoryPersistenceCapable: spec.memoryPersistenceCapable } : {}),
|
|
226
227
|
get memoryCaptureOptedOut() {
|
|
227
228
|
return input.memoryEngineSession()?.captureOptOut?.optedOut() ?? false;
|
|
@@ -238,6 +239,7 @@ export function prepareInheritedGate(input) {
|
|
|
238
239
|
},
|
|
239
240
|
getApiKeyAndHeaders: spec.getApiKeyAndHeaders,
|
|
240
241
|
parentCwd: taskRootFinal,
|
|
242
|
+
...(input.hostFloor !== undefined ? { hostFloor: input.hostFloor } : {}),
|
|
241
243
|
...(fileHistoryEnabled ? { fileHistoryLineage: { scope: historyScope, root: historyRoot, fs: historyFs } } : {}),
|
|
242
244
|
reminderMark,
|
|
243
245
|
reminderDisclosureCounts,
|
|
@@ -264,7 +266,7 @@ export function prepareInheritedGate(input) {
|
|
|
264
266
|
...(sessions.fork !== undefined
|
|
265
267
|
? {
|
|
266
268
|
hostSessionFork: async () => {
|
|
267
|
-
const forked = (await sessions.fork(sessionId, spec.principal ?? null)) ?? null;
|
|
269
|
+
const forked = (await sessions.fork(sessionId, principalNameOf(spec.principal) ?? null)) ?? null;
|
|
268
270
|
if (forked === null)
|
|
269
271
|
return null;
|
|
270
272
|
return {
|
|
@@ -7,7 +7,7 @@ import { deliverEngineNotice } from "../types.js";
|
|
|
7
7
|
import { inlineUntrusted } from "../untrusted-text.js";
|
|
8
8
|
import { fileArgPath } from "../tool-registry.js";
|
|
9
9
|
import { RosterBuilder } from "../tool-roster.js";
|
|
10
|
-
import { isNotStartedDelegationResult } from "
|
|
10
|
+
import { isNotStartedDelegationResult } from "../delegation-not-started.js";
|
|
11
11
|
import { thrownText } from "../thrown-value.js";
|
|
12
12
|
export function prepareMemoryEngineSession(input) {
|
|
13
13
|
const { memoryEngineSession, internals, memoryDelegationEvidence, externalContentTargetActive, lockedPreflight, mountedMcp, sessionId, runId, deps, provenanceForChildrenRef, delegationSettlementRef, spec, envHandToolNames, roster, contentOriginWrapRef } = input;
|
|
@@ -2,22 +2,22 @@ import { callTargetReadingOf } from "../effective-path-target.js";
|
|
|
2
2
|
import { approvalTargetsOf } from "../approval-object.js";
|
|
3
3
|
import { uuidv7 } from "../../engine/session/uuid.js";
|
|
4
4
|
import { Value } from "typebox/value";
|
|
5
|
-
import { classifyQuestionOutcome, validateAskQuestions } from "../ask-question.js";
|
|
5
|
+
import { classifyQuestionOutcome, isEngineQuestionFace, validateAskQuestions } from "../ask-question.js";
|
|
6
6
|
import { hasBackgroundShell, sweepBackgroundShells, sweepRunBoundaryBackgroundShells } from "../background-shell.js";
|
|
7
7
|
import { boundInputHashOf, exactBoundInputHashOf } from "../canonical-json.js";
|
|
8
|
-
import {
|
|
9
|
-
import { buildRiskDescriptor, debitLedger, encodeAtFidelity, mintCheckpointId, mintCheckpointToken, resolveDeclaredFidelity, samePlainValue, } from "../checkpoint-store.js";
|
|
8
|
+
import { buildRiskDescriptor, debitLedger, encodeAtFidelity, mintCheckpointId, mintCheckpointToken, resolveDeclaredFidelity, } from "../checkpoint-store.js";
|
|
10
9
|
import { pauseOf } from "../pause-registry.js";
|
|
10
|
+
import { samePlainValue } from "../same-plain-value.js";
|
|
11
11
|
import { askCarryRowMembers } from "../hooks.js";
|
|
12
12
|
import { askMandateMember, ownedClearanceFacts } from "../ask-origin.js";
|
|
13
13
|
import { defaultTaskRegistry } from "../task-registry.js";
|
|
14
|
-
import { advertisedWritableRootsSeat, exemptRootsSeat, isLiveApproverSeat, licenseCovers, carriesBidiControls, describeThrown, ownArgs, refuseOutOfContractDecision, tryCloneArgs } from "../tool-policy.js";
|
|
14
|
+
import { advertisedWritableRootsSeat, bindableArgsOf, exemptRootsSeat, isLiveApproverSeat, licenseCovers, carriesBidiControls, describeThrown, ownArgs, refuseOutOfContractDecision, tryCloneArgs } from "../tool-policy.js";
|
|
15
15
|
import { InMemoryToolResultStore, ScopedToolResultStore, isVolatileOffloadStore } from "../tool-result-store.js";
|
|
16
16
|
import { raceAbort, raceSettlementAgainstSignal } from "./abort-race.js";
|
|
17
17
|
import { CONTENT_ASK_BINDING_CAP } from "./content-ask-bindings.js";
|
|
18
18
|
import { DEFAULT_UNATTENDED_APPROVAL_TTL_MS, publishCommittedSuspend, sanitizedTtlMs } from "./park-commit.js";
|
|
19
19
|
import { remoteEnvFailureNote } from "./remote-env-retry.js";
|
|
20
|
-
import { approvalCardMemberOf, callFaceSeat,
|
|
20
|
+
import { approvalCardMemberOf, callFaceSeat, parkedToolIdentity, parkedToolFace } from "../tool-roster.js";
|
|
21
21
|
import { seatOf } from "../tool-name-readings.js";
|
|
22
22
|
class ParkRefusal extends Error {
|
|
23
23
|
constructor(message, options) {
|
|
@@ -112,7 +112,7 @@ export function prepareParkAsk(input) {
|
|
|
112
112
|
};
|
|
113
113
|
const suspendAsk = parkLaneArmed && checkpointStore !== undefined
|
|
114
114
|
? async (req, postHookArgs, safety, liveFaceUnavailable, realApproval, allowRuleShadowed, askDecisionReason, probeReason, probeCause, segmentCoverage, matchedAskRule, probeMandated, carry) => {
|
|
115
|
-
const contentAsk =
|
|
115
|
+
const contentAsk = isEngineQuestionFace(req.face);
|
|
116
116
|
const syncFirstEligible = contentAsk ? contentAskRoutable(req.toolCallId) : isLiveApproverSeat(onAsk);
|
|
117
117
|
if (syncFirstEligible &&
|
|
118
118
|
runtimeCaps?.forceDurableGate !== true &&
|
|
@@ -146,12 +146,12 @@ export function prepareParkAsk(input) {
|
|
|
146
146
|
`a durable approval row must hold an inert snapshot of exactly what a human approves and a resume executes`, { cause: captured.cause });
|
|
147
147
|
}
|
|
148
148
|
const parkedArgs = captured.value;
|
|
149
|
-
const
|
|
150
|
-
if (
|
|
151
|
-
throw new ParkRefusal(
|
|
149
|
+
const bindable = bindableArgsOf(req.toolName, parkedArgs);
|
|
150
|
+
if (!bindable.ok)
|
|
151
|
+
throw new ParkRefusal(bindable.refusal);
|
|
152
152
|
const parkedHash = exactBoundInputHashOf(parkedArgs);
|
|
153
153
|
if (parkedHash === undefined)
|
|
154
|
-
throw new ParkRefusal(`the arguments of "${req.toolName}"
|
|
154
|
+
throw new ParkRefusal(`the canonical form of the arguments of "${req.toolName}" cannot be built — no approval row can be bound to them`);
|
|
155
155
|
const projectionMovedArgs = backendFidelity !== "structured-clone" && !samePlainValue(parked.value, parkedArgs);
|
|
156
156
|
if (projectionMovedArgs && basePolicyForResumeEdit === undefined) {
|
|
157
157
|
throw new ParkRefusal(`the arguments of "${req.toolName}" change shape when stored by this checkpoint backend, and no policy is wired to re-adjudicate the stored shape ` +
|
|
@@ -179,7 +179,7 @@ export function prepareParkAsk(input) {
|
|
|
179
179
|
return undefined;
|
|
180
180
|
if (reprojectedRaced.tag === "threw")
|
|
181
181
|
throw reprojectedRaced.error;
|
|
182
|
-
const reprojected = refuseOutOfContractDecision(reprojectedRaced.value);
|
|
182
|
+
const reprojected = refuseOutOfContractDecision(reprojectedRaced.value, { call: req });
|
|
183
183
|
const filedAsHeld = ownArgs(parkedArgs);
|
|
184
184
|
const rewroteTheFiledValue = reprojected.updatedInput !== undefined && !(filedAsHeld.ok && samePlainValue(reprojected.updatedInput, filedAsHeld.value));
|
|
185
185
|
if (reprojected.action === "deny" || rewroteTheFiledValue) {
|
|
@@ -188,7 +188,7 @@ export function prepareParkAsk(input) {
|
|
|
188
188
|
`refusing to file a row whose executable form nothing adjudicated`);
|
|
189
189
|
}
|
|
190
190
|
if (reprojected.action === "ask")
|
|
191
|
-
storedShapeFacts = ownedClearanceFacts(reprojected);
|
|
191
|
+
storedShapeFacts = ownedClearanceFacts(reprojected, req);
|
|
192
192
|
}
|
|
193
193
|
const rowRealApproval = realApproval ?? (storedShapeFacts?.requiresRealApproval === true ? { origin: carry?.origin ?? wordlessDemand(req.toolName) } : undefined);
|
|
194
194
|
if (offloadStore && isVolatileOffloadStore(offloadStore) && !offloadStore.isEmpty()) {
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* inherited-unavailable marker channel, the grant record, the sandbox-admission mode's arming and its three
|
|
7
7
|
* sideband maps, the source-identity and risk-axes factories, the two permission-rule lanes and the rule-offer
|
|
8
8
|
* factory, the approved-edit re-check, the inherited-constraint wrappers (the same-instance adapter and the true
|
|
9
|
-
* wrapper), the
|
|
10
|
-
*
|
|
9
|
+
* wrapper), the instrumented chain, the integrity guards, the fold, and the same-instance arbitration refresh that is the
|
|
10
|
+
* effective policy. The advised-names dedupe pair only this section reads moved with it.
|
|
11
11
|
* The interface is the dependency list the segment had implicitly.
|
|
12
12
|
*
|
|
13
13
|
* ASYNC PHASE: the stretch awaits the session-policy store (the task's own rules and each ancestor's live re-read)
|
|
@@ -42,7 +42,10 @@ import { type ModeGateSeats, type PermissionModeController } from "../mode-polic
|
|
|
42
42
|
import { type InheritedAskGrant } from "./inherited-ask-grants.js";
|
|
43
43
|
import { createRuleOffersOf, type PermissionRuleLanes } from "./permission-rule-lanes.js";
|
|
44
44
|
import type { ToolCallLike } from "../tool-registry.js";
|
|
45
|
+
import { type HostFloor } from "../host-floor.js";
|
|
45
46
|
export interface PreparePolicyChainInput {
|
|
47
|
+
/** borrowed-readonly — the deployment's host floor as the config doors compiled it: the leading narrowing layer when declared. */
|
|
48
|
+
hostFloor: HostFloor | undefined;
|
|
46
49
|
/** borrowed-readonly — the REBOUND spec. Read: `sessionId` / `principal` (the session-rule read and the lanes' identity),
|
|
47
50
|
* `durableApproval` / `checkpointStore` (the mandate-park facility test and the sandbox arming's park prerequisites), `taskId` (the late-ask observer's detail),
|
|
48
51
|
* `tools` (the names the caller mounted, for the name audit). Never mutated. */
|
|
@@ -177,7 +180,7 @@ export interface PreparePolicyChainInput {
|
|
|
177
180
|
/** borrowed-readonly — the injectable wall-clock (the inherited arms' human-wait timing). */
|
|
178
181
|
now: () => number;
|
|
179
182
|
/** borrowed-mutable — the own session-rules snapshot seat (the inherited-gate phase mints it; `inheritedGateForChildren`
|
|
180
|
-
* reads it late). Writer: THIS phase
|
|
183
|
+
* reads it late). Writer: THIS phase — the own layer's seed at prepare, then each row the layer comes to enforce. */
|
|
181
184
|
ownSessionRulesRef: {
|
|
182
185
|
current?: {
|
|
183
186
|
sessionId: string;
|
|
@@ -202,7 +205,7 @@ export interface PreparePolicyChainResult {
|
|
|
202
205
|
};
|
|
203
206
|
/** owned — the caller-facing policy layers (the wiring manifest reads their COUNT). */
|
|
204
207
|
policyLayers: ToolPolicy[];
|
|
205
|
-
/** owned — THE effective policy the gate station adjudicates with (the fold plus
|
|
208
|
+
/** owned — THE effective policy the gate station adjudicates with (the fold, plus the same-instance arbitration refresh), or undefined. */
|
|
206
209
|
effectivePolicy: ToolPolicy | undefined;
|
|
207
210
|
/** borrowed-mutable — the inherited-unavailable marker channel. Writers: the inherited arms here (mark); the gate station
|
|
208
211
|
* (the lifecycle-end sweep) and the park lane's consumers (delete on consumption). */
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { argsAsTheToolReads, withArgsReading } from "../effective-path-target.js";
|
|
2
|
+
import { outletAsk, readRejudge, rewriteChasedSentence, sameBytes } from "../rewrite-rejudge.js";
|
|
2
3
|
import { policyAskClassOf } from "../ask-class.js";
|
|
3
|
-
import { ASK_USER_QUESTION_TOOL_NAME } from "../ask-question.js";
|
|
4
|
+
import { ASK_USER_QUESTION_TOOL_NAME, isEngineQuestionFace } from "../ask-question.js";
|
|
4
5
|
import { classifierUnavailableSeat } from "./classifier-ladder.js";
|
|
5
6
|
import { resolveCheckpointStore } from "../checkpoint-store.js";
|
|
6
7
|
import { chainJudges, inheritedToolChecks, screeningInstallationsOf, standsInFor } from "../mods/stations.js";
|
|
7
|
-
import {
|
|
8
|
+
import { isCoveringRuleName, ruleNameCovers } from "../namespaced-rule-name.js";
|
|
8
9
|
import { isIsolated } from "../remote-env.js";
|
|
9
10
|
import { deliverEngineNotice } from "../engine-notice.js";
|
|
10
11
|
import { earlierGrammarNotice } from "../session-policy-store.js";
|
|
@@ -29,8 +30,9 @@ import { createPermissionRuleLanes, inheritedAskRuleEvidence, createRuleOffersOf
|
|
|
29
30
|
import { createLiveSessionRules, createSessionRulePolicy } from "./session-rule-policy.js";
|
|
30
31
|
import { policyThrowLine, reportPolicyThrow } from "./policy-throw.js";
|
|
31
32
|
import { heldBy, heldValues, seatOf, wireOf } from "../tool-name-readings.js";
|
|
33
|
+
import { hostFloorPolicy } from "../host-floor.js";
|
|
32
34
|
export async function preparePolicyChain(input) {
|
|
33
|
-
const { spec, deps, internals, sessionId, runId, hostTaskId, taskRootFinal, additionalRootsCanonical, executionEnv, lockedPreflight, pathRuleAnchors, headLeads, tools, harnessTools, selector, toolEffects, egressTools, irreversibilityTier, axisExplicitNegatives, shellGatedTools, toolMarkSources, envHandToolNames, handsCwdRef, readDenyMatcher, personRows, questionToolMounted, runtimeCaps, inheritedAncestorRules, ancestorSessionRulesRef, inheritedParentConstraints, seedInheritedGate, skillGrants, skillSpecs, allowedToolTables, frozenOnAsk, hookEnvSource, notifyOwnHookCrash, modBus, ownModChain, autoModeDecider, readFace, permissionMode, scratchpadDir, toolRosterDeltas, stopForDenialLimit, delegation, abortController, now, ownSessionRulesRef } = input;
|
|
35
|
+
const { spec, deps, internals, sessionId, runId, hostTaskId, taskRootFinal, additionalRootsCanonical, executionEnv, lockedPreflight, pathRuleAnchors, headLeads, tools, harnessTools, selector, toolEffects, egressTools, irreversibilityTier, axisExplicitNegatives, shellGatedTools, toolMarkSources, envHandToolNames, handsCwdRef, readDenyMatcher, personRows, questionToolMounted, runtimeCaps, inheritedAncestorRules, ancestorSessionRulesRef, inheritedParentConstraints, seedInheritedGate, skillGrants, skillSpecs, allowedToolTables, frozenOnAsk, hookEnvSource, notifyOwnHookCrash, modBus, ownModChain, autoModeDecider, readFace, permissionMode, scratchpadDir, toolRosterDeltas, stopForDenialLimit, delegation, abortController, now, ownSessionRulesRef, hostFloor } = input;
|
|
34
36
|
const ancestorArbitrations = new Map();
|
|
35
37
|
const arbitrateInherited = (ask, toolCallId, judged) => {
|
|
36
38
|
const verdict = arbitrateByMode(permissionMode.current, judged.classification, { origin: judged.origin, ...askMandateMember(ancestorFacts(judged.ask.action === "ask" ? judged.ask : undefined)) });
|
|
@@ -55,7 +57,7 @@ export async function preparePolicyChain(input) {
|
|
|
55
57
|
for (const g of nameGroups) {
|
|
56
58
|
for (const [kind, list] of [["deny", g.deny], ["ask", g.ask], ["allow", g.allow]]) {
|
|
57
59
|
for (const n of list ?? []) {
|
|
58
|
-
const verdict = judgeRuleToolName(n, known);
|
|
60
|
+
const verdict = judgeRuleToolName(n, known, kind);
|
|
59
61
|
const twin = verdict.kind === "current" && !inherited ? nearMissSpellingOf(n, rootFacing) : undefined;
|
|
60
62
|
const stale = verdict.kind !== "current" ? verdict : twin !== undefined ? { kind: "case_twin", twin, carrier: known.has(twin) || callerNames.has(twin) ? "run" : pool.names.has(twin) ? "pool" : "catalog" } : undefined;
|
|
61
63
|
if (stale !== undefined) {
|
|
@@ -85,7 +87,7 @@ export async function preparePolicyChain(input) {
|
|
|
85
87
|
}
|
|
86
88
|
if (known.has(n))
|
|
87
89
|
continue;
|
|
88
|
-
if (
|
|
90
|
+
if (isCoveringRuleName(n, kind) && [...known].some((k) => ruleNameCovers(n, k)))
|
|
89
91
|
continue;
|
|
90
92
|
unmatched.add(`"${n}" (${kind})`);
|
|
91
93
|
}
|
|
@@ -102,7 +104,7 @@ export async function preparePolicyChain(input) {
|
|
|
102
104
|
}
|
|
103
105
|
advisedPolicyNames.set(deps, advised);
|
|
104
106
|
try {
|
|
105
|
-
const e = new Error(`toolPolicy name audit: ${[...unmatched].join(", ")} match(es) no tool mounted this run (primary or alias) — the rule cannot fire here. Often a typo or a self-report/wire name skew (e.g. TodoWrite vs the mounted TaskCreate family; "*"
|
|
107
|
+
const e = new Error(`toolPolicy name audit: ${[...unmatched].join(", ")} match(es) no tool mounted this run (primary or alias) — the rule cannot fire here. Often a typo or a self-report/wire name skew (e.g. TodoWrite vs the mounted TaskCreate family; a "*" on a deny or ask list reaches every name its pattern matches). Advisory only: enforcement is unchanged, and a name can be legitimate for another scenario or a per-spawn tool.`);
|
|
106
108
|
e.code = "config.toolpolicy.unmatched_names";
|
|
107
109
|
deps.onError?.(e, { phase: "config", sessionId });
|
|
108
110
|
}
|
|
@@ -138,8 +140,7 @@ export async function preparePolicyChain(input) {
|
|
|
138
140
|
};
|
|
139
141
|
};
|
|
140
142
|
sessionRulePolicy = createSessionRulePolicy({ seed, read: createLiveSessionRules(store, { ...sessionRuleKey, seed }, { onUnreadable: announceSessionRulesUnreadable, onEnforced: publishOwnRules }) }, { env: executionEnv, rootPath: taskRootFinal, toolEffects, anchors: pathRuleAnchors.leg, onEarlierGrammar: announceEarlierGrammar(sessionRuleKey.sessionId) });
|
|
141
|
-
|
|
142
|
-
publishOwnRules(rules);
|
|
143
|
+
publishOwnRules(seed);
|
|
143
144
|
}
|
|
144
145
|
const ancestorRulePolicies = [];
|
|
145
146
|
for (const [position, snap] of (inheritedAncestorRules ?? []).entries()) {
|
|
@@ -153,19 +154,14 @@ export async function preparePolicyChain(input) {
|
|
|
153
154
|
rules: row,
|
|
154
155
|
});
|
|
155
156
|
};
|
|
156
|
-
ancestorRulePolicies.push(createSessionRulePolicy({
|
|
157
|
-
seed,
|
|
158
|
-
...(deps.sessionPolicyStore
|
|
159
|
-
? { read: createLiveSessionRules(deps.sessionPolicyStore, { sessionId: snap.sessionId, ...(snap.principal !== undefined ? { principal: snap.principal } : {}), seed }, { onUnreadable: announceSessionRulesUnreadable, onEnforced: publishAncestorRules }) }
|
|
160
|
-
: {}),
|
|
161
|
-
}, { env: executionEnv, rootPath: taskRootFinal, toolEffects, anchors: pathRuleAnchors.leg, onEarlierGrammar: announceEarlierGrammar(snap.sessionId) }));
|
|
157
|
+
ancestorRulePolicies.push(createSessionRulePolicy({ seed, read: createLiveSessionRules(deps.sessionPolicyStore, { sessionId: snap.sessionId, ...(snap.principal !== undefined ? { principal: snap.principal } : {}), seed }, { onUnreadable: announceSessionRulesUnreadable, onEnforced: publishAncestorRules }) }, { env: executionEnv, rootPath: taskRootFinal, toolEffects, anchors: pathRuleAnchors.leg, onEarlierGrammar: announceEarlierGrammar(snap.sessionId) }));
|
|
162
158
|
}
|
|
163
159
|
const frozenConstraintLayers = (seedInheritedGate?.constraintChain ?? [])
|
|
164
160
|
.filter((e) => !("opaque" in e))
|
|
165
161
|
.map((entry) => ({
|
|
166
162
|
check: (creq) => checkToolPolicyProjection(entry, creq) ?? { action: "allow" },
|
|
167
163
|
}));
|
|
168
|
-
const narrowingLayers = [sessionRulePolicy, ...ancestorRulePolicies, ...frozenConstraintLayers].filter((p) => p !== undefined);
|
|
164
|
+
const narrowingLayers = [hostFloor !== undefined ? hostFloorPolicy(hostFloor) : undefined, sessionRulePolicy, ...ancestorRulePolicies, ...frozenConstraintLayers].filter((p) => p !== undefined);
|
|
169
165
|
auditPolicyNames(sessionRulePolicy);
|
|
170
166
|
for (const layer of ancestorRulePolicies)
|
|
171
167
|
auditPolicyNames(layer, true);
|
|
@@ -175,6 +171,16 @@ export async function preparePolicyChain(input) {
|
|
|
175
171
|
const sameInstanceAncestorCount = policy === undefined ? 0 : (inheritedParentConstraints ?? []).reduce((n, pc) => (pc.policy === policy ? n + 1 : n), 0);
|
|
176
172
|
const sharedFirstDecision = new Map();
|
|
177
173
|
const SHARED_FIRST_DECISION_CAP = 256;
|
|
174
|
+
const staleArbitrations = new Map();
|
|
175
|
+
const noteArbitration = (toolCallId, arbitrate, stale) => {
|
|
176
|
+
const rest = (staleArbitrations.get(toolCallId) ?? []).filter((a) => a !== arbitrate);
|
|
177
|
+
if (stale)
|
|
178
|
+
rest.push(arbitrate);
|
|
179
|
+
if (rest.length > 0)
|
|
180
|
+
staleArbitrations.set(toolCallId, rest);
|
|
181
|
+
else
|
|
182
|
+
staleArbitrations.delete(toolCallId);
|
|
183
|
+
};
|
|
178
184
|
const inheritedUnavailableAsks = new Set();
|
|
179
185
|
const INHERITED_UNAVAILABLE_CAP = 256;
|
|
180
186
|
const markInheritedUnavailable = (toolCallId) => {
|
|
@@ -235,7 +241,7 @@ export async function preparePolicyChain(input) {
|
|
|
235
241
|
list.push({ cls, layer });
|
|
236
242
|
foldAskClasses.set(toolCallId, list);
|
|
237
243
|
};
|
|
238
|
-
const isDelegatedQuestion = (creq) =>
|
|
244
|
+
const isDelegatedQuestion = (creq) => isEngineQuestionFace(creq.face);
|
|
239
245
|
const sandboxBoundaryCapable = (call) => heldBy("gate.sandboxBoundary.egress", egressTools, call) || !envHandToolNames.has(wireOf("gate.sandboxBoundary.hand", call));
|
|
240
246
|
const emitSandboxAdmitted = (info) => {
|
|
241
247
|
emitTrace(deps.tracer, () => ({
|
|
@@ -261,8 +267,8 @@ export async function preparePolicyChain(input) {
|
|
|
261
267
|
};
|
|
262
268
|
const callerPolicyLayer = policy !== undefined && sameInstanceAncestorCount > 0
|
|
263
269
|
? wrapToolPolicy(policy, async (creq, csignal) => {
|
|
264
|
-
const decision = refuseOutOfContractDecision(await policy.check(creq, csignal ?? abortController.signal));
|
|
265
|
-
sharedFirstDecision.set(creq.toolCallId, decision);
|
|
270
|
+
const decision = refuseOutOfContractDecision(await policy.check(creq, csignal ?? abortController.signal), { call: creq });
|
|
271
|
+
sharedFirstDecision.set(creq.toolCallId, { decision, judged: creq.args });
|
|
266
272
|
if (sharedFirstDecision.size > SHARED_FIRST_DECISION_CAP) {
|
|
267
273
|
const oldest = sharedFirstDecision.keys().next().value;
|
|
268
274
|
if (oldest !== undefined)
|
|
@@ -303,7 +309,7 @@ export async function preparePolicyChain(input) {
|
|
|
303
309
|
const seat = seatMarksOf(call);
|
|
304
310
|
const face = readFace();
|
|
305
311
|
return {
|
|
306
|
-
...INHERITED_STATION_FACTS,
|
|
312
|
+
...INHERITED_STATION_FACTS, call: { toolCallId: call.toolCallId, toolName: call.toolName },
|
|
307
313
|
mandateMarks: { egress: seat.egress, shellGated: false, ...(seat.tier === "always" && !seat.shellGated ? { irreversibility: "always" } : {}) },
|
|
308
314
|
...(seat.sources.size > 0 ? { toolMarkSources: seat.sources } : {}),
|
|
309
315
|
...(deps.a2a?.isolatePeers === true ? { a2aIsolatePeers: true } : {}),
|
|
@@ -358,7 +364,7 @@ export async function preparePolicyChain(input) {
|
|
|
358
364
|
}
|
|
359
365
|
let re;
|
|
360
366
|
try {
|
|
361
|
-
re = refuseOutOfContractDecision(await pol.check(await withArgsReading(creq, editArgs, csignal ?? abortController.signal), csignal ?? abortController.signal));
|
|
367
|
+
re = refuseOutOfContractDecision(await pol.check(await withArgsReading(creq, editArgs, csignal ?? abortController.signal), csignal ?? abortController.signal), { call: creq });
|
|
362
368
|
}
|
|
363
369
|
catch (err) {
|
|
364
370
|
reportPolicyThrow(notifyOwnHookCrash, "an inherited parent policy's re-check of the approved edit", creq, err, csignal ?? abortController.signal);
|
|
@@ -369,13 +375,16 @@ export async function preparePolicyChain(input) {
|
|
|
369
375
|
}
|
|
370
376
|
if (re.action === "deny")
|
|
371
377
|
return vetoed(re);
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
378
|
+
const read = readRejudge(creq, editArgs, re);
|
|
379
|
+
if (read.kind === "rewritten") {
|
|
380
|
+
editArgs = read.form;
|
|
381
|
+
const { updatedInput: _form, ...verdict } = re;
|
|
382
|
+
re = outletAsk(verdict, creq.toolName, editArgs);
|
|
375
383
|
}
|
|
376
|
-
if (re.
|
|
377
|
-
editArgs
|
|
378
|
-
|
|
384
|
+
else if (re.action === "allow") {
|
|
385
|
+
return onApproval(withAttestation({ action: "allow", updatedInput: editArgs, decisionReason: "mode" }, re.attestation));
|
|
386
|
+
}
|
|
387
|
+
const judged = await judgeInheritedClassifier({ liveMode: () => permissionMode.current, autoMode: read.kind === "rewritten" ? undefined : ancestorAutoMode, ask: re, req: { ...creq, args: editArgs }, signal: csignal ?? abortController.signal, subject: "the approved edit", allowRewrite: editArgs, facts: inheritedStationFacts(creq), unavailableSeat: classifierUnavailableSeat({ station: "ancestor", ...(ancestorDecider?.timeoutMs !== undefined ? { budgetMs: ancestorDecider.timeoutMs } : {}), route: frozenApproverRoute(onAskOf), onNotice: deps.onNotice, sessionId, runId }) });
|
|
379
388
|
if (judged.kind === "allow") {
|
|
380
389
|
return onApproval(judged.result);
|
|
381
390
|
}
|
|
@@ -384,7 +393,10 @@ export async function preparePolicyChain(input) {
|
|
|
384
393
|
const { ask: editAsk } = judged;
|
|
385
394
|
re = editAsk;
|
|
386
395
|
const editArbitrated = arbitrateInherited(re, creq.toolCallId, judged);
|
|
387
|
-
|
|
396
|
+
const outletReleased = read.kind === "rewritten" && editArbitrated?.action === "allow";
|
|
397
|
+
if (outletReleased)
|
|
398
|
+
ancestorArbitrations.delete(creq.toolCallId);
|
|
399
|
+
if (editArbitrated !== undefined && !outletReleased) {
|
|
388
400
|
return onApproval(editArbitrated.action === "allow" ? { action: "allow", updatedInput: editArgs, decisionReason: "mode" } : editArbitrated);
|
|
389
401
|
}
|
|
390
402
|
const { resolved: rr, judged: settled } = await resolveInheritedAsk(judged, (j) => resolveAsk({
|
|
@@ -475,8 +487,14 @@ export async function preparePolicyChain(input) {
|
|
|
475
487
|
? { check: () => ({ action: "allow" }) }
|
|
476
488
|
: policy !== undefined && pc.policy === policy
|
|
477
489
|
? {
|
|
478
|
-
check: async (creq, csignal)
|
|
479
|
-
const
|
|
490
|
+
check: async function arbitrate(creq, csignal) {
|
|
491
|
+
const recorded = sharedFirstDecision.get(creq.toolCallId);
|
|
492
|
+
const first = recorded?.decision;
|
|
493
|
+
const stale = recorded !== undefined && !sameBytes(creq, recorded.decision.updatedInput !== undefined ? recorded.decision.updatedInput : recorded.judged, creq.args);
|
|
494
|
+
if (recorded !== undefined)
|
|
495
|
+
noteArbitration(creq.toolCallId, arbitrate, stale);
|
|
496
|
+
if (stale)
|
|
497
|
+
return { action: "allow" };
|
|
480
498
|
if (first === undefined) {
|
|
481
499
|
return {
|
|
482
500
|
action: "deny",
|
|
@@ -552,7 +570,7 @@ export async function preparePolicyChain(input) {
|
|
|
552
570
|
: wrapToolPolicy(pc.policy, async (creq, csignal) => {
|
|
553
571
|
let decision;
|
|
554
572
|
try {
|
|
555
|
-
decision = refuseOutOfContractDecision(await pc.policy.check(creq, csignal ?? abortController.signal));
|
|
573
|
+
decision = refuseOutOfContractDecision(await pc.policy.check(creq, csignal ?? abortController.signal), { call: creq });
|
|
556
574
|
}
|
|
557
575
|
catch (err) {
|
|
558
576
|
reportPolicyThrow(notifyOwnHookCrash, "an inherited parent policy", creq, err, csignal ?? abortController.signal);
|
|
@@ -581,88 +599,57 @@ export async function preparePolicyChain(input) {
|
|
|
581
599
|
const settled = await settleInstallationAsk(pc, ask, creq, csignal);
|
|
582
600
|
return settled.kind === "settled" ? settled.result : settled.resolved;
|
|
583
601
|
});
|
|
584
|
-
const rewriteCapableLayers = policy !== undefined || parentConstraintWrappers.length > 0;
|
|
585
|
-
const rewriteEmitterIndex = new Map();
|
|
586
602
|
const rewriteCapableChain = [
|
|
587
603
|
...(callerPolicyLayer !== undefined ? [callerPolicyLayer] : []),
|
|
588
604
|
...parentConstraintWrappers,
|
|
589
605
|
];
|
|
590
606
|
const callerSlotOffset = callerPolicyLayer !== undefined ? 1 : 0;
|
|
591
|
-
const sameInstanceAdapterIndices = new Set();
|
|
592
|
-
(inheritedParentConstraints ?? []).forEach((pc, j) => {
|
|
593
|
-
if (policy !== undefined && pc.policy === policy)
|
|
594
|
-
sameInstanceAdapterIndices.add(j + callerSlotOffset);
|
|
595
|
-
});
|
|
596
607
|
const instrumentedChain = rewriteCapableChain.map((layer, idx) => wrapToolPolicy(layer, async (creq, csignal) => {
|
|
597
|
-
const d = refuseOutOfContractDecision(await layer.check(creq, csignal));
|
|
598
|
-
if (d.updatedInput !== undefined)
|
|
599
|
-
rewriteEmitterIndex.set(creq.toolCallId, idx);
|
|
608
|
+
const d = refuseOutOfContractDecision(await layer.check(creq, csignal), { call: creq });
|
|
600
609
|
if (d.action === "ask") {
|
|
601
610
|
recordFoldAskClass(creq.toolCallId, idx < callerSlotOffset ? policyAskClassOf(policy) : "mandate", idx < callerSlotOffset ? "caller_policy" : "ancestor_constraint");
|
|
602
611
|
}
|
|
603
612
|
return d;
|
|
604
613
|
}));
|
|
605
614
|
const modeGateLayer = createModeGatePolicy(permissionMode, { env: executionEnv, rootPath: taskRootFinal, acceptDirs: [taskRootFinal, ...additionalRootsCanonical], roster: toolRosterDeltas, readOnlyDeclared: (name) => mountedToolDeclaresReadOnly(tools, name), ...(scratchpadDir !== undefined ? { exemptDirs: [scratchpadDir] } : {}) });
|
|
606
|
-
const policyLayers = [
|
|
607
|
-
...narrowingLayers,
|
|
608
|
-
...instrumentedChain,
|
|
609
|
-
...(rewriteCapableLayers ? narrowingLayers : []),
|
|
610
|
-
];
|
|
615
|
+
const policyLayers = [...narrowingLayers, ...instrumentedChain, ...(rewriteCapableChain.length > 0 ? narrowingLayers : [])];
|
|
611
616
|
const integrityGuardLayers = [createTranscriptIntegrityPolicy(), createUnverifiableDeletePolicy({ removalSeat: { env: executionEnv, additionalRoots: () => additionalRootsCanonical } })];
|
|
612
|
-
const guardedPolicyLayers =
|
|
613
|
-
? [...integrityGuardLayers, ...policyLayers, modeGateLayer, ...integrityGuardLayers]
|
|
614
|
-
: [...integrityGuardLayers, ...policyLayers, modeGateLayer];
|
|
617
|
+
const guardedPolicyLayers = [...integrityGuardLayers, ...policyLayers, modeGateLayer];
|
|
615
618
|
const foldedPolicy = guardedPolicyLayers.length === 1 ? guardedPolicyLayers[0] : combinePolicies(...guardedPolicyLayers);
|
|
616
|
-
const effectivePolicy = foldedPolicy !== undefined &&
|
|
619
|
+
const effectivePolicy = foldedPolicy !== undefined && sameInstanceAncestorCount > 0
|
|
617
620
|
? wrapToolPolicy(foldedPolicy, async (req, signal) => {
|
|
618
621
|
let decision;
|
|
622
|
+
let stale;
|
|
619
623
|
try {
|
|
620
624
|
decision = await foldedPolicy.check(req, signal);
|
|
621
625
|
}
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
626
|
+
finally {
|
|
627
|
+
stale = staleArbitrations.get(req.toolCallId) ?? [];
|
|
628
|
+
staleArbitrations.delete(req.toolCallId);
|
|
625
629
|
}
|
|
626
|
-
|
|
627
|
-
rewriteEmitterIndex.delete(req.toolCallId);
|
|
628
|
-
if (decision.action === "deny" || decision.updatedInput === undefined)
|
|
630
|
+
if (decision.action === "deny" || stale.length === 0)
|
|
629
631
|
return decision;
|
|
630
|
-
const
|
|
631
|
-
const
|
|
632
|
-
if (emitterIdx !== undefined && emitterIdx > 0) {
|
|
633
|
-
for (let i = emitterIdx + 1; i < rewriteCapableChain.length; i++) {
|
|
634
|
-
if (sameInstanceAdapterIndices.has(i))
|
|
635
|
-
postEmitterSameInstanceAdapters.push(rewriteCapableChain[i]);
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
const recheckLayers = [...recheckPrefix, ...postEmitterSameInstanceAdapters];
|
|
639
|
-
const finalReq = await withArgsReading(req, decision.updatedInput, signal);
|
|
632
|
+
const finalReq = decision.updatedInput !== undefined ? await withArgsReading(req, decision.updatedInput, signal) : req;
|
|
633
|
+
const carried = decision.updatedInput !== undefined ? { updatedInput: decision.updatedInput } : {};
|
|
640
634
|
let asked;
|
|
641
635
|
let revalidated;
|
|
642
636
|
try {
|
|
643
|
-
for (const
|
|
644
|
-
const d = refuseOutOfContractDecision(await
|
|
645
|
-
if (d.action === "deny")
|
|
646
|
-
return withAttestation({ ...d,
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
return {
|
|
650
|
-
action: "deny",
|
|
651
|
-
message: "policy required a rewrite during final-form re-check — the arguments that would execute were not accepted as-is (fail-closed; rewrite chains are not iterated to a fixpoint)",
|
|
652
|
-
updatedInput: decision.updatedInput,
|
|
653
|
-
};
|
|
654
|
-
}
|
|
637
|
+
for (const arbitrate of stale) {
|
|
638
|
+
const d = refuseOutOfContractDecision(await arbitrate(finalReq, signal), { call: finalReq });
|
|
639
|
+
if (d.action === "deny")
|
|
640
|
+
return withAttestation({ ...d, ...carried }, mergeAttestation(req, attestationOf(decision, req), attestationOf(d, req), "answer"));
|
|
641
|
+
if (readRejudge(finalReq, finalReq.args, d).kind === "rewritten")
|
|
642
|
+
return { action: "deny", message: rewriteChasedSentence(req.toolName), ...carried };
|
|
655
643
|
if (d.action === "ask" && asked === undefined)
|
|
656
644
|
asked = d;
|
|
657
645
|
revalidated = mergeAttestation(req, revalidated, d.attestation);
|
|
658
646
|
}
|
|
659
647
|
}
|
|
660
648
|
finally {
|
|
661
|
-
|
|
662
|
-
}
|
|
663
|
-
if (asked !== undefined && decision.action === "allow") {
|
|
664
|
-
return { ...asked, updatedInput: decision.updatedInput };
|
|
649
|
+
staleArbitrations.delete(req.toolCallId);
|
|
665
650
|
}
|
|
651
|
+
if (asked !== undefined && decision.action === "allow")
|
|
652
|
+
return { ...asked, ...carried };
|
|
666
653
|
if (decision.action === "allow")
|
|
667
654
|
return withAttestation(decision, mergeAttestation(req, attestationOf(decision, req), revalidated));
|
|
668
655
|
return decision;
|
|
@@ -13,8 +13,9 @@ export interface PrepareProjectContextInput {
|
|
|
13
13
|
deps: Pick<RunnerDeps, "loadProjectMemory" | "onError" | "sharedMemoryStores" | "onNotice" | "allowedTools">;
|
|
14
14
|
/** borrowed-readonly — the REBOUND spec (`spec′`). Read: `sessionId` (phase derivation + the
|
|
15
15
|
* continuation projections), `skills` (the roster), `userInvokedSkills` (the person's invoked skills — their
|
|
16
|
-
* rows are written here), `principal` (the shared-memory tools' trusted identity)
|
|
17
|
-
|
|
16
|
+
* rows are written here), `principal` (the shared-memory tools' trusted identity), `projectMemory` (the request's
|
|
17
|
+
* off switch for the seam — the config door's one reading). Never mutated. */
|
|
18
|
+
spec: Pick<TaskSpec, "sessionId" | "skills" | "userInvokedSkills" | "principal" | "excludeAllTools" | "projectMemory">;
|
|
18
19
|
/** borrowed-readonly — trusted internals: `agentName` (seam ctx), `inheritedSkillGrants` (the parent's captured
|
|
19
20
|
* skill grant rows, seeded as `inherited`), `inheritedAllowedTools` (the parent's request entries, seeded as this leg's
|
|
20
21
|
* own). `undefined` on a standalone prepare. */
|
|
@@ -95,6 +96,8 @@ export interface PrepareProjectContextResult {
|
|
|
95
96
|
path: string;
|
|
96
97
|
contentHash: string | null;
|
|
97
98
|
}> | undefined;
|
|
99
|
+
/** owned — `"on"` iff this phase called the deployment's seam, `"disabled"` the request turned a wired one off, `"absent"` none is wired. */
|
|
100
|
+
projectMemoryFact: NonNullable<import("../wiring-manifest.js").WiringManifest["projectMemory"]>;
|
|
98
101
|
/** owned — the RAW snapshot text (pre-compose) for the compaction lanes' instruction-file seat
|
|
99
102
|
* (`Prepared.projectInstructionContent`). */
|
|
100
103
|
projectInstructionContent: string | undefined;
|
|
@@ -22,7 +22,10 @@ export async function prepareProjectContext(input) {
|
|
|
22
22
|
let memoryBlock = memoryBlockFromEngine;
|
|
23
23
|
let instructionSources;
|
|
24
24
|
let projectInstructionContent;
|
|
25
|
-
|
|
25
|
+
const seam = deps.loadProjectMemory;
|
|
26
|
+
const loadProjectMemory = seam && spec.projectMemory === undefined ? seam : undefined;
|
|
27
|
+
const projectMemoryFact = loadProjectMemory ? "on" : seam ? "disabled" : "absent";
|
|
28
|
+
if (loadProjectMemory) {
|
|
26
29
|
let projectMemoryPhase = spec.sessionId ? "resume" : "fresh";
|
|
27
30
|
if (spec.sessionId) {
|
|
28
31
|
try {
|
|
@@ -47,7 +50,7 @@ export async function prepareProjectContext(input) {
|
|
|
47
50
|
}
|
|
48
51
|
let loaded = null;
|
|
49
52
|
try {
|
|
50
|
-
loaded = await Promise.resolve(
|
|
53
|
+
loaded = await Promise.resolve(loadProjectMemory.call(deps, {
|
|
51
54
|
cwd: taskRootFinal,
|
|
52
55
|
handsEnabled,
|
|
53
56
|
isSubagent: delegation.isNonForkChild,
|
|
@@ -158,5 +161,5 @@ export async function prepareProjectContext(input) {
|
|
|
158
161
|
?
|
|
159
162
|
{ entries: [], seedAnnounced: true, budget: skillListingBudget }
|
|
160
163
|
: undefined;
|
|
161
|
-
return { memoryBlock, instructionSources, projectInstructionContent, skillSpecs, skillSeatOf, skillsListing, sharedMemoryPairMounted, memoryEnginePairMounted };
|
|
164
|
+
return { memoryBlock, instructionSources, projectMemoryFact, projectInstructionContent, skillSpecs, skillSeatOf, skillsListing, sharedMemoryPairMounted, memoryEnginePairMounted };
|
|
162
165
|
}
|
|
@@ -3,7 +3,7 @@ import type { Model } from "../../internal/llm.js";
|
|
|
3
3
|
import { assemblePrompt, type AssembledPrompt } from "../../prompt-assembly/assemble.js";
|
|
4
4
|
import { type CenterAdoption } from "../../prompt-assembly/artifact.js";
|
|
5
5
|
import { type RunPromptIdentity } from "../../prompt-assembly/epoch.js";
|
|
6
|
-
import type { HostForm, HostRole } from "../../prompt-assembly/catalog/schema.js";
|
|
6
|
+
import type { HostForm, HostRole, PromptTraitName } from "../../prompt-assembly/catalog/schema.js";
|
|
7
7
|
import type { SourcedOverlay } from "../../prompt-assembly/overlay.js";
|
|
8
8
|
import { type EnvironmentFacts } from "../../prompts/default.js";
|
|
9
9
|
import { type LegModBus } from "../mods/stations.js";
|
|
@@ -47,15 +47,13 @@ export interface PreparePromptAssemblyInput {
|
|
|
47
47
|
memoryBlock: string | undefined;
|
|
48
48
|
/** borrowed-readonly — the environment facts; `date` is the assembly's date, the block builder re-renders on a date change. */
|
|
49
49
|
envFacts: EnvironmentFacts;
|
|
50
|
-
/** borrowed-readonly — the
|
|
51
|
-
|
|
52
|
-
/** borrowed-readonly — the fable mitigations switch (a runtime fact of the assembly). */
|
|
53
|
-
fableMitigations: boolean;
|
|
50
|
+
/** borrowed-readonly — the run's effective prompt traits (a selector value of the assembly). */
|
|
51
|
+
promptTraits: ReadonlySet<PromptTraitName>;
|
|
54
52
|
/** borrowed-readonly — the run's ONE tool roster, read only: the assembly receives DETACHED copies, the audit and the
|
|
55
53
|
* manifest read it in place. Never mutated here. */
|
|
56
54
|
tools: readonly AgentTool[];
|
|
57
|
-
/** borrowed-readonly — the task model: `
|
|
58
|
-
model: Pick<Model, "id"
|
|
55
|
+
/** borrowed-readonly — the task model: `id` (the compose event's `model`). */
|
|
56
|
+
model: Pick<Model, "id">;
|
|
59
57
|
/** borrowed-readonly — the acquired session id (every operator line's attribution). */
|
|
60
58
|
sessionId: string;
|
|
61
59
|
/** borrowed-readonly — the once-per-session ledger's operator sink (the collision audit's two lines). */
|