@sema-agent/core 7.60.0 → 7.62.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 +917 -0
- package/README.md +2 -2
- package/dist/agents/agent-transcript-tool.d.ts +2 -2
- package/dist/agents/agent-transcript-tool.js +1 -1
- package/dist/agents/cascade.d.ts +71 -12
- package/dist/agents/cascade.js +61 -21
- package/dist/agents/composition-allowance.d.ts +53 -0
- package/dist/agents/composition-allowance.js +49 -0
- package/dist/agents/composition-placement.d.ts +29 -0
- package/dist/agents/composition-placement.js +24 -0
- package/dist/agents/cumulative-stats.d.ts +4 -0
- package/dist/agents/cumulative-stats.js +3 -0
- package/dist/agents/inherited-tool-pool.d.ts +5 -3
- package/dist/agents/inherited-tool-pool.js +2 -2
- package/dist/agents/list-agents-tool.d.ts +1 -1
- package/dist/agents/peer-held-queue.d.ts +27 -4
- package/dist/agents/peer-held-queue.js +81 -36
- package/dist/agents/peer-notice-route.d.ts +1 -1
- package/dist/agents/peer-notice-route.js +4 -3
- package/dist/agents/peer-notices.d.ts +4 -4
- package/dist/agents/peer-notices.js +8 -4
- package/dist/agents/peer-session-drain.d.ts +8 -1
- package/dist/agents/peer-session-drain.js +49 -10
- package/dist/agents/repair-loop.js +16 -6
- package/dist/agents/retain-ledger.js +3 -1
- package/dist/agents/roster-store.d.ts +1 -1
- package/dist/agents/roster-store.js +7 -4
- package/dist/agents/send-message-tool.d.ts +8 -10
- package/dist/agents/send-message-tool.js +43 -23
- package/dist/agents/subagent-completion-gate.d.ts +35 -0
- package/dist/agents/subagent-completion-gate.js +62 -0
- package/dist/agents/subagent-steps.d.ts +7 -6
- package/dist/agents/subagent.d.ts +36 -41
- package/dist/agents/subagent.js +245 -200
- package/dist/agents/suspend-guard.d.ts +47 -16
- package/dist/agents/suspend-guard.js +13 -4
- package/dist/agents/verify.d.ts +41 -14
- package/dist/agents/verify.js +41 -30
- package/dist/brain/anthropic.js +1 -0
- package/dist/brain/errors.d.ts +7 -1
- package/dist/brain/errors.js +6 -0
- package/dist/brain/failover.js +2 -1
- package/dist/brain/open-responses.js +1 -0
- package/dist/brain/openai.js +1 -0
- package/dist/brain/provider-dialect.d.ts +10 -0
- package/dist/brain/provider-dialect.js +13 -2
- package/dist/brain/stream-engine.d.ts +3 -0
- package/dist/brain/stream-engine.js +4 -0
- package/dist/core/agent-state.d.ts +1 -1
- package/dist/core/allow-entry.d.ts +59 -23
- package/dist/core/allow-entry.js +131 -38
- package/dist/core/ask-origin.d.ts +79 -0
- package/dist/core/ask-origin.js +76 -0
- package/dist/core/ask-question.d.ts +19 -13
- package/dist/core/ask-question.js +8 -2
- package/dist/core/auto-compaction.d.ts +2 -0
- package/dist/core/auto-compaction.js +2 -1
- package/dist/core/auto-mode.js +3 -5
- package/dist/core/background-agent-store.d.ts +7 -5
- package/dist/core/background-agent-store.js +12 -11
- package/dist/core/checkpoint-features.d.ts +722 -0
- package/dist/core/checkpoint-features.js +98 -0
- package/dist/core/checkpoint-requirements.d.ts +33 -5
- package/dist/core/checkpoint-requirements.js +18 -5
- package/dist/core/checkpoint-row-verdict.d.ts +99 -0
- package/dist/core/checkpoint-row-verdict.js +225 -0
- package/dist/core/checkpoint-store.d.ts +107 -738
- package/dist/core/checkpoint-store.js +45 -143
- package/dist/core/child-clamp-seats.d.ts +3 -2
- package/dist/core/child-clamp-seats.js +4 -3
- package/dist/core/closest-name.d.ts +13 -0
- package/dist/core/closest-name.js +35 -0
- package/dist/core/context-settings.js +3 -5
- package/dist/core/cross-boundary-taint.d.ts +1 -1
- package/dist/core/decision-receipt.d.ts +14 -1
- package/dist/core/decision-receipt.js +6 -3
- package/dist/core/delegation-frames.d.ts +13 -9
- package/dist/core/effective-path-target.js +2 -3
- package/dist/core/engine-attestation.d.ts +11 -1
- package/dist/core/engine-attestation.js +2 -0
- package/dist/core/engine-notice.d.ts +68 -21
- package/dist/core/engine-notice.js +9 -2
- package/dist/core/file-history-retention.d.ts +8 -0
- package/dist/core/file-history-retention.js +14 -11
- package/dist/core/file-history-store.d.ts +31 -1
- package/dist/core/file-history-store.js +31 -2
- package/dist/core/frame-settlement.d.ts +10 -0
- package/dist/core/frame-settlement.js +6 -1
- package/dist/core/fs-write-gate-policy.d.ts +3 -3
- package/dist/core/fs-write-gate-policy.js +8 -7
- package/dist/core/gate-fold.js +4 -3
- package/dist/core/gate-lanes.js +7 -4
- package/dist/core/gate-outcome.d.ts +40 -1
- package/dist/core/gate-outcome.js +10 -0
- package/dist/core/git-worktree-env.d.ts +7 -3
- package/dist/core/git-worktree-env.js +16 -13
- package/dist/core/governance-codes.d.ts +14 -4
- package/dist/core/governance-codes.js +19 -4
- package/dist/core/hooks.d.ts +25 -4
- package/dist/core/hooks.js +11 -4
- package/dist/core/host-floor.js +3 -5
- package/dist/core/human-input-projection.d.ts +1 -0
- package/dist/core/human-input-projection.js +3 -0
- package/dist/core/image-admission.d.ts +47 -7
- package/dist/core/image-admission.js +35 -4
- package/dist/core/input-author.d.ts +36 -0
- package/dist/core/input-author.js +39 -0
- package/dist/core/leg-identity.d.ts +62 -0
- package/dist/core/leg-identity.js +18 -0
- package/dist/core/locked-config.d.ts +4 -3
- package/dist/core/locked-config.js +5 -3
- package/dist/core/lsp.d.ts +5 -3
- package/dist/core/lsp.js +3 -2
- package/dist/core/mailbox-store.d.ts +85 -10
- package/dist/core/mailbox-store.js +31 -10
- package/dist/core/mcp-connection-pool.d.ts +6 -20
- package/dist/core/mcp-connection-pool.js +10 -28
- package/dist/core/mcp-failure.d.ts +76 -15
- package/dist/core/mcp-failure.js +60 -33
- package/dist/core/mcp-host-seat.d.ts +92 -53
- package/dist/core/mcp-host-seat.js +225 -46
- package/dist/core/mcp-probe.js +2 -2
- package/dist/core/mcp-server-link.d.ts +18 -6
- package/dist/core/mcp-server-link.js +19 -4
- package/dist/core/mcp-server-spec.d.ts +2 -1
- package/dist/core/mcp-session-end.d.ts +1 -2
- package/dist/core/mcp-session-end.js +1 -1
- package/dist/core/mcp.d.ts +6 -49
- package/dist/core/mcp.js +115 -111
- package/dist/core/media-byte-cap.d.ts +21 -46
- package/dist/core/media-byte-cap.js +55 -55
- package/dist/core/member-group.d.ts +7 -0
- package/dist/core/member-group.js +35 -0
- package/dist/core/memory-engine/consolidation-driver.d.ts +1 -1
- package/dist/core/memory-engine/consolidation.d.ts +1 -1
- package/dist/core/memory-engine/consolidation.js +7 -1
- package/dist/core/memory-engine/dual-root.d.ts +31 -0
- package/dist/core/memory-engine/dual-root.js +59 -11
- package/dist/core/memory-engine/engine.js +27 -24
- package/dist/core/memory-engine/file-backend.d.ts +13 -0
- package/dist/core/memory-engine/file-backend.js +35 -15
- package/dist/core/memory-engine/layout.d.ts +3 -0
- package/dist/core/memory-engine/layout.js +13 -3
- package/dist/core/memory-engine/memory-deployment.d.ts +110 -0
- package/dist/core/memory-engine/memory-deployment.js +182 -0
- package/dist/core/memory-engine/sync-client.d.ts +39 -18
- package/dist/core/memory-engine/sync-client.js +72 -14
- package/dist/core/memory-engine/sync-report.d.ts +7 -4
- package/dist/core/memory-engine/sync.d.ts +9 -1
- package/dist/core/memory-vector.d.ts +1 -1
- package/dist/core/memory.d.ts +10 -10
- package/dist/core/mode-policy.d.ts +8 -8
- package/dist/core/mode-policy.js +8 -6
- package/dist/core/mods/agent-stations.d.ts +39 -4
- package/dist/core/mods/agent-stations.js +59 -10
- package/dist/core/mods/classic-events.d.ts +9 -1
- package/dist/core/mods/dollar.d.ts +94 -1
- package/dist/core/mods/dollar.js +13 -1
- package/dist/core/mods/extension-call.d.ts +15 -1
- package/dist/core/mods/extension-call.js +7 -2
- package/dist/core/mods/kernel/dispatch.d.ts +4 -3
- package/dist/core/mods/kernel/dispatch.js +4 -4
- package/dist/core/mods/kernel/events.d.ts +14 -3
- package/dist/core/mods/kernel/events.js +18 -15
- package/dist/core/mods/kernel/registration.d.ts +3 -0
- package/dist/core/mods/kernel/registration.js +5 -0
- package/dist/core/mods/kernel/site-rules.d.ts +6 -3
- package/dist/core/mods/kernel/site-rules.js +10 -2
- package/dist/core/mods/lifecycle-stations.d.ts +36 -4
- package/dist/core/mods/lifecycle-stations.js +44 -9
- package/dist/core/mods/session-append.d.ts +118 -0
- package/dist/core/mods/session-append.js +318 -0
- package/dist/core/mods/session-compact.d.ts +48 -0
- package/dist/core/mods/session-compact.js +194 -0
- package/dist/core/mods/session-receive.d.ts +93 -0
- package/dist/core/mods/session-receive.js +138 -0
- package/dist/core/mods/session-send.d.ts +72 -0
- package/dist/core/mods/session-send.js +88 -0
- package/dist/core/mods/stations.d.ts +88 -21
- package/dist/core/mods/stations.js +149 -11
- package/dist/core/mods/tool-call.d.ts +2 -0
- package/dist/core/mods/tool-call.js +4 -4
- package/dist/core/output-style.js +3 -4
- package/dist/core/own-property-receipt.d.ts +68 -2
- package/dist/core/own-property-receipt.js +45 -2
- package/dist/core/park-selfcheck.js +4 -2
- package/dist/core/path-identity.d.ts +11 -0
- package/dist/core/path-identity.js +4 -0
- package/dist/core/path-rule-binding.d.ts +3 -1
- package/dist/core/path-rule-binding.js +3 -1
- package/dist/core/peer-seat.d.ts +3 -3
- package/dist/core/peer-seat.js +20 -8
- package/dist/core/permission-rule-consent.d.ts +21 -5
- package/dist/core/permission-rule-consent.js +21 -1
- package/dist/core/permission-rule-model.d.ts +34 -11
- package/dist/core/permission-rule-model.js +47 -10
- package/dist/core/permission-rule-org.d.ts +1 -1
- package/dist/core/permission-rule-provider.js +4 -1
- package/dist/core/permission-rules.d.ts +4 -0
- package/dist/core/permission-rules.js +11 -16
- package/dist/core/read-root-candidate.js +1 -1
- package/dist/core/remote-env.d.ts +74 -26
- package/dist/core/remote-env.js +20 -0
- package/dist/core/resume-startup-cause.d.ts +5 -4
- package/dist/core/retention-policy.d.ts +24 -23
- package/dist/core/retention-policy.js +36 -2
- package/dist/core/retention.d.ts +4 -1
- package/dist/core/retired-keys.d.ts +4 -4
- package/dist/core/row-admission.d.ts +10 -0
- package/dist/core/row-admission.js +5 -0
- package/dist/core/runner/advisor-instructions.d.ts +2 -1
- package/dist/core/runner/advisor-instructions.js +2 -1
- package/dist/core/runner/announce-once-ledger.d.ts +4 -4
- package/dist/core/runner/assemble-result.d.ts +13 -3
- package/dist/core/runner/assemble-result.js +12 -7
- package/dist/core/runner/caller-roster.d.ts +12 -9
- package/dist/core/runner/caller-roster.js +5 -2
- package/dist/core/runner/checkpoint-scope.d.ts +16 -1
- package/dist/core/runner/checkpoint-scope.js +21 -0
- package/dist/core/runner/compact-session.js +18 -3
- package/dist/core/runner/compaction-call-options.d.ts +1 -1
- package/dist/core/runner/compaction-restate.d.ts +2 -2
- package/dist/core/runner/compaction-restate.js +4 -3
- package/dist/core/runner/construction-doors.d.ts +2 -2
- package/dist/core/runner/construction-doors.js +2 -2
- package/dist/core/runner/contracts.d.ts +116 -34
- package/dist/core/runner/cross-boundary-lane.d.ts +1 -1
- package/dist/core/runner/decide-continuation.d.ts +4 -2
- package/dist/core/runner/decide-continuation.js +7 -4
- package/dist/core/runner/delegation-owner.d.ts +43 -0
- package/dist/core/runner/delegation-owner.js +59 -0
- package/dist/core/runner/denial-limit-arms.d.ts +15 -21
- package/dist/core/runner/denial-limit-arms.js +17 -10
- package/dist/core/runner/expire-settle.d.ts +44 -0
- package/dist/core/runner/expire-settle.js +55 -0
- package/dist/core/runner/git-status-frame.d.ts +3 -3
- package/dist/core/runner/git-status-frame.js +2 -1
- package/dist/core/runner/halt-attribution.d.ts +2 -1
- package/dist/core/runner/halt-attribution.js +2 -1
- package/dist/core/runner/lineage-reroot-view.d.ts +56 -0
- package/dist/core/runner/lineage-reroot-view.js +108 -0
- package/dist/core/runner/local-claims.d.ts +17 -0
- package/dist/core/runner/local-claims.js +18 -0
- package/dist/core/runner/media-removed-seat.d.ts +46 -0
- package/dist/core/runner/media-removed-seat.js +88 -0
- package/dist/core/runner/park-commit.d.ts +2 -2
- package/dist/core/runner/permission-rule-lanes.d.ts +7 -2
- package/dist/core/runner/permission-rule-lanes.js +28 -9
- package/dist/core/runner/person-path-rows.d.ts +15 -0
- package/dist/core/runner/person-path-rows.js +27 -4
- package/dist/core/runner/placement-fence.d.ts +26 -0
- package/dist/core/runner/placement-fence.js +38 -0
- package/dist/core/runner/prepare-acquire-reconcile.d.ts +4 -1
- package/dist/core/runner/prepare-acquire-reconcile.js +7 -2
- package/dist/core/runner/prepare-ask-lane.d.ts +6 -12
- package/dist/core/runner/prepare-ask-lane.js +4 -4
- package/dist/core/runner/prepare-boundary-parks.d.ts +4 -1
- package/dist/core/runner/prepare-boundary-parks.js +2 -2
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +3 -0
- package/dist/core/runner/prepare-caps-and-workflow.js +2 -1
- package/dist/core/runner/prepare-config-doors.d.ts +6 -6
- package/dist/core/runner/prepare-config-doors.js +19 -21
- package/dist/core/runner/prepare-context-lane.d.ts +6 -2
- package/dist/core/runner/prepare-context-lane.js +13 -13
- package/dist/core/runner/prepare-delegation-surface.d.ts +9 -9
- package/dist/core/runner/prepare-delegation-surface.js +4 -5
- package/dist/core/runner/prepare-execution-env.d.ts +5 -2
- package/dist/core/runner/prepare-execution-env.js +7 -4
- package/dist/core/runner/prepare-gate-stations.d.ts +19 -14
- package/dist/core/runner/prepare-gate-stations.js +6 -4
- package/dist/core/runner/prepare-hands-readface.d.ts +6 -6
- package/dist/core/runner/prepare-hands-readface.js +32 -11
- package/dist/core/runner/prepare-inherited-gate.d.ts +8 -0
- package/dist/core/runner/prepare-inherited-gate.js +10 -3
- package/dist/core/runner/prepare-lsp.d.ts +3 -0
- package/dist/core/runner/prepare-lsp.js +2 -2
- package/dist/core/runner/prepare-park-ask.d.ts +5 -2
- package/dist/core/runner/prepare-park-ask.js +4 -5
- package/dist/core/runner/prepare-policy-chain.d.ts +10 -21
- package/dist/core/runner/prepare-policy-chain.js +16 -25
- package/dist/core/runner/prepare-project-context.d.ts +2 -2
- package/dist/core/runner/prepare-prompt-inputs.d.ts +5 -4
- package/dist/core/runner/prepare-prompt-inputs.js +3 -2
- package/dist/core/runner/prepare-question-face.d.ts +6 -4
- package/dist/core/runner/prepare-question-face.js +2 -2
- package/dist/core/runner/prepare-run-refs.d.ts +3 -0
- package/dist/core/runner/prepare-run-refs.js +2 -2
- package/dist/core/runner/prepare-suspend-saga.d.ts +11 -7
- package/dist/core/runner/prepare-suspend-saga.js +17 -7
- package/dist/core/runner/prepare-task.d.ts +1 -1
- package/dist/core/runner/prepare-task.js +61 -30
- package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +6 -0
- package/dist/core/runner/prepare-tool-disclosure-mount.js +3 -1
- package/dist/core/runner/prepare-wiring-manifest.d.ts +3 -0
- package/dist/core/runner/prepare-wiring-manifest.js +2 -1
- package/dist/core/runner/prepare-workspace-restore.d.ts +5 -0
- package/dist/core/runner/prepare-workspace-restore.js +10 -6
- package/dist/core/runner/read-root-grant.d.ts +1 -1
- package/dist/core/runner/read-root-grant.js +2 -1
- package/dist/core/runner/resume-admission.d.ts +8 -6
- package/dist/core/runner/resume-admission.js +23 -6
- package/dist/core/runner/resume-apply.d.ts +4 -0
- package/dist/core/runner/resume-apply.js +14 -5
- package/dist/core/runner/resume-checkpoint-screen.d.ts +9 -0
- package/dist/core/runner/resume-checkpoint-screen.js +4 -84
- package/dist/core/runner/resume-claim.d.ts +8 -3
- package/dist/core/runner/resume-claim.js +28 -12
- package/dist/core/runner/resume-internals-and-config.d.ts +2 -2
- package/dist/core/runner/resume-internals-and-config.js +10 -1
- package/dist/core/runner/resume-preflight.d.ts +3 -2
- package/dist/core/runner/resume-preflight.js +13 -26
- package/dist/core/runner/retired-runner-deps.js +2 -0
- package/dist/core/runner/run-git-lane.d.ts +2 -0
- package/dist/core/runner/run-git-lane.js +6 -2
- package/dist/core/runner/run-harness-handlers.d.ts +2 -0
- package/dist/core/runner/run-harness-handlers.js +5 -4
- package/dist/core/runner/run-identity-wiring.d.ts +2 -2
- package/dist/core/runner/run-identity-wiring.js +14 -5
- package/dist/core/runner/run-leg.d.ts +3 -3
- package/dist/core/runner/run-leg.js +64 -36
- package/dist/core/runner/run-notification-lane.js +20 -2
- package/dist/core/runner/run-recovery-lanes.js +3 -2
- package/dist/core/runner/run-settle-and-teardown.js +12 -9
- package/dist/core/runner/run-stop-and-final-verify.js +2 -1
- package/dist/core/runner/run-telemetry-and-budget-seats.d.ts +1 -1
- package/dist/core/runner/run-terminal-adoption.d.ts +1 -1
- package/dist/core/runner/run-terminal-adoption.js +26 -17
- package/dist/core/runner/run-turn-boundary.js +34 -18
- package/dist/core/runner/runtask.d.ts +18 -3
- package/dist/core/runner/runtask.js +33 -17
- package/dist/core/runner/session-rule-policy.d.ts +1 -1
- package/dist/core/runner/session-rule-policy.js +6 -1
- package/dist/core/runner/shell-env-withheld.d.ts +1 -1
- package/dist/core/runner/steering-preview.d.ts +9 -0
- package/dist/core/runner/steering-preview.js +5 -0
- package/dist/core/runner/stream-halt-verbs.d.ts +1 -14
- package/dist/core/runner/stream-halt-verbs.js +4 -3
- package/dist/core/runner/stream-reap.d.ts +7 -6
- package/dist/core/runner/stream-reap.js +13 -16
- package/dist/core/runner/stream-settle-backstop.d.ts +3 -2
- package/dist/core/runner/stream-settle-backstop.js +5 -3
- package/dist/core/runner/stream-steer-verb.d.ts +5 -2
- package/dist/core/runner/stream-steer-verb.js +16 -7
- package/dist/core/runner/terminal-account.d.ts +11 -1
- package/dist/core/runner/terminal-account.js +20 -0
- package/dist/core/runner/terminal-projection.d.ts +8 -2
- package/dist/core/runner/terminal-projection.js +2 -2
- package/dist/core/runner/tool-disclosure.d.ts +3 -0
- package/dist/core/runner/tool-disclosure.js +5 -2
- package/dist/core/runner/tool-end-body.d.ts +3 -3
- package/dist/core/runner/tool-end-body.js +1 -1
- package/dist/core/runner/tool-face-overlay.js +2 -0
- package/dist/core/runner/tool-output-projection.d.ts +3 -3
- package/dist/core/runner/tool-output-projection.js +7 -6
- package/dist/core/runner/tool-table-view.d.ts +56 -0
- package/dist/core/runner/tool-table-view.js +51 -0
- package/dist/core/runner/turn-attachments.d.ts +8 -2
- package/dist/core/runner/turn-attachments.js +2 -2
- package/dist/core/runner/void-verifier-pause.d.ts +33 -0
- package/dist/core/runner/void-verifier-pause.js +41 -0
- package/dist/core/runner-deps.d.ts +26 -27
- package/dist/core/secret-env.d.ts +19 -16
- package/dist/core/secret-env.js +45 -27
- package/dist/core/session-log-transfer.js +9 -10
- package/dist/core/session-policy-store.d.ts +1 -1
- package/dist/core/session-policy-store.js +5 -2
- package/dist/core/session-reconcile.d.ts +3 -2
- package/dist/core/session-reconcile.js +7 -4
- package/dist/core/session-store.d.ts +3 -1
- package/dist/core/session-store.js +10 -8
- package/dist/core/session.d.ts +16 -5
- package/dist/core/shell-confinement.d.ts +37 -0
- package/dist/core/shell-confinement.js +56 -0
- package/dist/core/skill-grant.js +1 -1
- package/dist/core/store-contracts/checkpoint-store-contract.d.ts +8 -2
- package/dist/core/store-contracts/checkpoint-store-contract.js +83 -2
- package/dist/core/store-contracts/file-history-store-contract.d.ts +5 -2
- package/dist/core/store-contracts/file-history-store-contract.js +25 -1
- package/dist/core/store-contracts/mailbox-store-contract.d.ts +12 -5
- package/dist/core/store-contracts/mailbox-store-contract.js +156 -9
- package/dist/core/store-contracts/session-store-contract.js +22 -8
- package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
- package/dist/core/store-contracts/tool-result-store-contract.js +30 -0
- package/dist/core/task-event.d.ts +24 -9
- package/dist/core/task-limits.d.ts +5 -0
- package/dist/core/task-notification.d.ts +89 -12
- package/dist/core/task-notification.js +89 -14
- package/dist/core/task-registry-agent.d.ts +32 -50
- package/dist/core/task-registry-agent.js +36 -56
- package/dist/core/task-registry-monitor.d.ts +1 -1
- package/dist/core/task-registry-monitor.js +15 -60
- package/dist/core/task-registry-shared.d.ts +22 -112
- package/dist/core/task-registry-shared.js +3 -41
- package/dist/core/task-registry-workflow.js +5 -21
- package/dist/core/task-registry.d.ts +32 -62
- package/dist/core/task-registry.js +30 -110
- package/dist/core/task-result.d.ts +29 -12
- package/dist/core/task-spec-members.d.ts +39 -0
- package/dist/core/task-spec-members.js +92 -0
- package/dist/core/task-spec.d.ts +11 -11
- package/dist/core/task-tool-shape.d.ts +7 -57
- package/dist/core/task-tool-shape.js +7 -66
- package/dist/core/terminal-cause.d.ts +36 -6
- package/dist/core/terminal-cause.js +1 -0
- package/dist/core/tool-catalog-entries.js +2 -5
- package/dist/core/tool-check-reading.js +16 -10
- package/dist/core/tool-conformance.js +1 -2
- package/dist/core/tool-errors.d.ts +6 -3
- package/dist/core/tool-errors.js +2 -0
- package/dist/core/tool-face-reader.js +3 -2
- package/dist/core/tool-face.d.ts +8 -5
- package/dist/core/tool-face.js +1 -1
- package/dist/core/tool-name-aliases.d.ts +5 -29
- package/dist/core/tool-name-aliases.js +9 -5
- package/dist/core/tool-name-readings.d.ts +14 -3
- package/dist/core/tool-name-readings.js +2 -0
- package/dist/core/tool-policy.d.ts +109 -18
- package/dist/core/tool-policy.js +84 -14
- package/dist/core/tool-result-store.d.ts +23 -0
- package/dist/core/tool-result-store.js +3 -2
- package/dist/core/tool-roster.d.ts +4 -4
- package/dist/core/tool-spec.d.ts +23 -6
- package/dist/core/trace.d.ts +18 -1
- package/dist/core/types.d.ts +1 -1
- package/dist/core/types.js +1 -1
- package/dist/core/user-attachment.js +26 -21
- package/dist/core/workflow-journal-store.d.ts +1 -1
- package/dist/core/workflow-run-store.d.ts +2 -0
- package/dist/core/workflow-run-store.js +6 -5
- package/dist/core/workflow-settled-run.d.ts +5 -0
- package/dist/core/workflow-settled-run.js +7 -0
- package/dist/engine/execution-env/node-execution-env.d.ts +37 -9
- package/dist/engine/execution-env/node-execution-env.js +221 -22
- package/dist/engine/harness/agent-harness.d.ts +65 -18
- package/dist/engine/harness/agent-harness.js +90 -23
- package/dist/engine/harness/messages.d.ts +4 -3
- package/dist/engine/harness/messages.js +2 -2
- package/dist/engine/harness/types.d.ts +52 -7
- package/dist/engine/llm/media-removed.d.ts +14 -0
- package/dist/engine/llm/media-removed.js +9 -0
- package/dist/engine/llm/rejected-images.d.ts +35 -25
- package/dist/engine/llm/rejected-images.js +59 -10
- package/dist/engine/llm/types.d.ts +24 -3
- package/dist/engine/llm/types.js +7 -3
- package/dist/engine/loop/agent-loop.d.ts +6 -1
- package/dist/engine/loop/agent-loop.js +20 -11
- package/dist/engine/loop/types.d.ts +12 -3
- package/dist/engine/session/import-validate.js +7 -0
- package/dist/engine/session/parent-chain-guard.d.ts +3 -3
- package/dist/engine/session/parent-chain-guard.js +1 -1
- package/dist/engine/session/path-to-root.d.ts +18 -3
- package/dist/engine/session/path-to-root.js +15 -1
- package/dist/engine/session/repo-utils.d.ts +12 -1
- package/dist/engine/session/repo-utils.js +41 -0
- package/dist/engine/session/session.js +1 -1
- package/dist/engine/session/storage-base.d.ts +20 -0
- package/dist/engine/session/storage-base.js +28 -9
- package/dist/fixtures/index.d.ts +7 -5
- package/dist/fixtures/index.js +5 -3
- package/dist/index.d.ts +29 -18
- package/dist/index.js +19 -11
- package/dist/internal/harness-types.d.ts +2 -0
- package/dist/internal/harness.d.ts +4 -3
- package/dist/internal/harness.js +3 -2
- package/dist/internal/llm.d.ts +2 -1
- package/dist/internal/llm.js +1 -0
- package/dist/orchestration/goal.d.ts +6 -2
- package/dist/orchestration/goal.js +6 -3
- package/dist/orchestration/run-workflow-tool.d.ts +14 -17
- package/dist/orchestration/run-workflow-tool.js +43 -50
- package/dist/orchestration/workflow-types.d.ts +2 -2
- package/dist/orchestration/workflow.d.ts +7 -0
- package/dist/orchestration/workflow.js +10 -12
- package/dist/stores/file/background-agent-store.js +18 -15
- package/dist/stores/file/checkpoint-store.d.ts +2 -0
- package/dist/stores/file/checkpoint-store.js +13 -9
- package/dist/stores/file/file-history-store.js +3 -2
- package/dist/stores/file/fs-atomic.d.ts +0 -22
- package/dist/stores/file/fs-atomic.js +0 -17
- package/dist/stores/file/index.d.ts +7 -12
- package/dist/stores/file/index.js +25 -12
- package/dist/stores/file/ledger-tuning.d.ts +23 -0
- package/dist/stores/file/ledger-tuning.js +21 -0
- package/dist/stores/file/mailbox-store.js +42 -22
- package/dist/stores/file/memory-store.js +3 -2
- package/dist/stores/file/permission-rule-adopt.js +24 -21
- package/dist/stores/file/permission-rule-store.js +6 -3
- package/dist/stores/file/session-policy-store.js +3 -2
- package/dist/stores/file/session-store.d.ts +26 -7
- package/dist/stores/file/session-store.js +59 -35
- package/dist/stores/file/tool-result-store.d.ts +11 -0
- package/dist/stores/file/tool-result-store.js +57 -3
- package/dist/stores/file/usage-window-store.js +3 -2
- package/dist/stores/file/workflow-journal-store.d.ts +0 -2
- package/dist/stores/file/workflow-journal-store.js +3 -18
- package/dist/stores/file/workflow-run-store.d.ts +1 -1
- package/dist/stores/file/workflow-run-store.js +15 -10
- package/dist/tools/fs/bash-program-position.d.ts +3 -2
- package/dist/tools/fs/bash-program-position.js +7 -7
- package/dist/tools/fs/dead-cwd.d.ts +5 -5
- package/dist/tools/fs/dead-cwd.js +4 -11
- package/dist/tools/fs/fs-bash-background-text.d.ts +6 -0
- package/dist/tools/fs/fs-bash-background-text.js +6 -0
- package/dist/tools/fs/fs-bash.d.ts +3 -18
- package/dist/tools/fs/fs-bash.js +37 -124
- package/dist/tools/fs/fs-pdf.js +8 -6
- package/dist/tools/fs/fs-read.js +2 -2
- package/dist/tools/fs/fs-shared.d.ts +28 -3
- package/dist/tools/fs/fs-shared.js +15 -0
- package/dist/tools/fs/index.d.ts +1 -1
- package/dist/tools/fs/index.js +4 -14
- package/dist/tools/fs/pdf.d.ts +4 -4
- package/dist/tools/fs/pdf.js +6 -6
- package/dist/tools/fs/read-deny-home.js +8 -1
- package/dist/tools/fs/read-deny.d.ts +26 -2
- package/dist/tools/fs/read-deny.js +9 -2
- package/dist/tools/fs/read-floor.d.ts +13 -5
- package/dist/tools/fs/read-floor.js +206 -2
- package/dist/tools/fs/removal-targets.js +2 -2
- package/dist/tools/fs/search.d.ts +3 -2
- package/dist/tools/fs/search.js +6 -6
- package/dist/tools/fs/shell-read-argv.d.ts +4 -2
- package/dist/tools/fs/shell-read-argv.js +14 -3
- package/dist/tools/fs/shell-read-bindings.d.ts +18 -2
- package/dist/tools/fs/shell-read-bindings.js +148 -68
- package/dist/tools/fs/shell-read-check.js +20 -4
- package/dist/tools/fs/shell-read-establish.js +25 -9
- package/dist/tools/fs/shell-read-functions.js +2 -2
- package/dist/tools/fs/shell-read-identity.d.ts +3 -1
- package/dist/tools/fs/shell-read-identity.js +4 -2
- package/dist/tools/fs/shell-read-judge.d.ts +7 -1
- package/dist/tools/fs/shell-read-judge.js +1 -1
- package/dist/tools/fs/shell-read-object-path.d.ts +59 -0
- package/dist/tools/fs/shell-read-object-path.js +119 -0
- package/dist/tools/fs/shell-read-plan.d.ts +8 -0
- package/dist/tools/fs/shell-read-plan.js +47 -30
- package/dist/tools/fs/shell-read-start.d.ts +66 -13
- package/dist/tools/fs/shell-read-start.js +89 -17
- package/dist/tools/fs/shell-read-workdir.d.ts +29 -8
- package/dist/tools/fs/shell-read-workdir.js +31 -8
- package/dist/tools/monitor.d.ts +8 -7
- package/dist/tools/monitor.js +12 -10
- package/dist/tools/worktree.d.ts +5 -1
- package/dist/tools/worktree.js +20 -17
- package/package.json +6 -3
- package/test/export-surface.snapshot.json +112 -42
- package/wire-changes/core-stores-sql@7.61.0.json +480 -0
- package/wire-changes/core-stores-sql@7.62.0.json +30 -0
- package/wire-changes/core@7.61.0.json +4405 -0
- package/wire-changes/core@7.62.0.json +2181 -0
- package/wire-changes/mods-kernel@7.61.0.json +65 -0
- package/wire-changes/mods-kernel@7.62.0.json +42 -0
- package/wire-changes/primitives@7.61.0.json +30 -0
- package/wire-changes/primitives@7.62.0.json +30 -0
- package/dist/core/consolidate-scope.d.ts +0 -93
- package/dist/core/consolidate-scope.js +0 -98
- package/dist/core/runner/image-removed-seat.d.ts +0 -12
- package/dist/core/runner/image-removed-seat.js +0 -19
- package/dist/core/runner/memory-consolidation.d.ts +0 -109
- package/dist/core/runner/memory-consolidation.js +0 -251
|
@@ -10,6 +10,8 @@ const ATTESTATION_GROUP_OF = {
|
|
|
10
10
|
guards: "guards",
|
|
11
11
|
pathDenial: "pathDenial",
|
|
12
12
|
bindingRefusal: "bindingRefusal",
|
|
13
|
+
genericQuestion: "genericQuestion",
|
|
14
|
+
receivedAskReasons: "receivedAskReasons",
|
|
13
15
|
};
|
|
14
16
|
const ATTESTATION_MEMBERS = Object.keys(ATTESTATION_GROUP_OF);
|
|
15
17
|
const groupLead = (g) => ATTESTATION_MEMBERS.find((k) => ATTESTATION_GROUP_OF[k] === g);
|
|
@@ -107,6 +107,28 @@ export interface EngineNotice {
|
|
|
107
107
|
* target (`IMAGE_ADMISSION.soft.targetBytes`), because the run has no image processor (`RunnerDeps.imageProcessor`
|
|
108
108
|
* is `false`, or sharp did not resolve). ONCE PER RUN, at the first such image wherever it entered (a tool's result,
|
|
109
109
|
* the task's images, an attachment). `detail: { bytes, targetBytes, sessionId, runId }`.
|
|
110
|
+
* - `"fs.staging_file_left"` — a whole-file replace (`NodeExecutionEnv.writeFile`) whose write itself SUCCEEDED could not
|
|
111
|
+
* remove the staged sibling it had written (the in-place rewrite after a refused rename, or after a refused staging open):
|
|
112
|
+
* the file is still on disk, up to the whole content. Audience `operator`. `detail: { path }`, the staged path. Seat-only:
|
|
113
|
+
* an environment with no `onNotice` seat says nothing (a failed write carries the same sentence in its error instead).
|
|
114
|
+
* ONCE PER LEFT FILE.
|
|
115
|
+
* - `"fs.staging_file_swept"` — a whole-file replace (`NodeExecutionEnv.writeFile`) removed the staged siblings of its target
|
|
116
|
+
* that a process which no longer runs had left behind (a process killed mid-write runs no cleanup): exactly the names the
|
|
117
|
+
* replace itself would mint for this target, under a pid that is gone, plain files with one name. A running writer's staged
|
|
118
|
+
* file is never touched. Audience `operator`. `detail: { count }` — how many, no names. Seat-only (an environment with no
|
|
119
|
+
* `onNotice` seat says nothing). ONCE PER WRITE THAT REMOVED ANY.
|
|
120
|
+
* - `"session.lineage_rerooted"` — the session this run continues has a log whose replay dropped records it could not read, and this
|
|
121
|
+
* says what the run lost. Two forms, told apart by `detail.break`: `true` — the branch the run reads broke at a parent the log does
|
|
122
|
+
* not hold, and the run continues from the entry that names that parent (the branch ends there, as a bounded window ends at its floor)
|
|
123
|
+
* instead of failing; `false` — the branch is whole (the log's last records were unreadable and its head fell back to the last one
|
|
124
|
+
* still readable, or the damage sat off the branch) and the run continues from `leaf`. A break the replay cannot account for (it
|
|
125
|
+
* dropped nothing) is refused `corrupt_session`, never re-rooted. Audience `user`. `detail: { break, recordsDropped, recordsTotal, leaf,
|
|
126
|
+
* entriesOnPath, sessionId, runId }` and, when `break` is `true`, `{ missingParentId, rootedAt, entriesCut }` — the replay's count
|
|
127
|
+
* (records, not entries), the entry the run continues from (`null` = nothing of the log is readable), the branch's length, the parent
|
|
128
|
+
* not in the log, the entry the branch starts at, and how many entries the log holds that do not descend from `rootedAt` (the history
|
|
129
|
+
* above the break and its side branches). Counts and entry ids only, never a record's words. ONCE PER PREPARED LEG for a whole branch,
|
|
130
|
+
* once per break for a broken one (and then the whole-branch form is not said), at the first read that met it — said when the acquire
|
|
131
|
+
* has settled on the attempt that holds, so an attempt that lost a write race and was run again is not described.
|
|
110
132
|
* - `"workflow.governance_key_stripped"` (#235) — the fields of an LLM-authored workflow `agent(spec)`
|
|
111
133
|
* that did NOT cross the governed default-deny whitelist: an unrecognized/control-plane field, or a
|
|
112
134
|
* `readFace` value that is not the containment-tightening one. The spawn PROCEEDS on the deployment
|
|
@@ -288,7 +310,8 @@ export interface EngineNotice {
|
|
|
288
310
|
* consecutive, sessionId?, runId? }` — `model` the retired rung's id, `to` the model the walk now starts at,
|
|
289
311
|
* `rung` its ladder position, `consecutive` the count that tripped it (the configured bound). Once per retired
|
|
290
312
|
* rung per run (the retirement is the dedup); only a rung with a rung behind it can retire, so a one-rung ladder
|
|
291
|
-
* (`classifierFallback: "none"`) never mints it. Audience `
|
|
313
|
+
* (`classifierFallback: "none"`) never mints it. Audience `user`: the rest of the user's run is judged by another
|
|
314
|
+
* model, the same consequence `classifier.unavailable` tells the user.
|
|
292
315
|
* - `"classifier.role_defaulted"` (`src/core/runner/classifier-ladder.ts`, the seat resolver) — no
|
|
293
316
|
* `classifier` role names a model, so another model STANDS IN for the seat. `detail: { model, reason,
|
|
294
317
|
* thinkingOffSpelled, sessionId?, runId? }` — `reason` ∈ `tier_below_main` (the nearest directly-bound
|
|
@@ -405,13 +428,26 @@ export interface EngineNotice {
|
|
|
405
428
|
* the run proceeds on the repaired request. Audience `operator`; `detail: { repairs: [{ form, toolCallIds }],
|
|
406
429
|
* sessionId, runId }`. ONCE PER RUN PER (form, calls) — the same broken turn is repaired on every request of
|
|
407
430
|
* the run and announced on the first. Absent ⇒ every request of the run already had the structure.
|
|
408
|
-
* - `"context.
|
|
409
|
-
*
|
|
410
|
-
* message
|
|
411
|
-
* (`
|
|
412
|
-
*
|
|
413
|
-
*
|
|
414
|
-
*
|
|
431
|
+
* - `"context.media_removed"` (#2874, #2988) — media left the model's view of a request while the transcript keeps it;
|
|
432
|
+
* each block's slot holds `[<image|document> N removed: <why>]` (`engine/llm/media-removed.ts`, N its ordinal among
|
|
433
|
+
* its message's blocks of that type). Audience `user`; `detail: { reason, images, documents, sessionId, runId }`,
|
|
434
|
+
* `reason` closed (`MEDIA_REMOVED_REASONS`):
|
|
435
|
+
* · `rejected_by_provider` — the provider refused a request because an image in it could not be processed (the
|
|
436
|
+
* failed turn's `errorKind: "image_unprocessable"`), so the request view removed the images of the newest message
|
|
437
|
+
* still carrying any (`engine/llm/rejected-images.ts`); the turn was re-sent without them and every later request
|
|
438
|
+
* of the session reads the same removal. `images` how many were removed from that message, `documents` 0. ONCE PER
|
|
439
|
+
* RUN PER REFUSAL; a refusal recorded before the run began is not announced again.
|
|
440
|
+
* · `media_budget` — the request's media no longer fit its limits (`IMAGE_ADMISSION.request`: the media-block count,
|
|
441
|
+
* the deployment's base64 budget `RunnerDeps.mediaBudgetBase64Chars`), so the oldest blocks were left out
|
|
442
|
+
* (`media-byte-cap.ts`). `images` / `documents` count the blocks this notice is the first to tell of: ONCE PER
|
|
443
|
+
* SESSION PER BLOCK, by the digest of its bytes (the session's announced record — bounded and best effort, so a
|
|
444
|
+
* block may be told again by a later run, never left untold); a request that was not sent tells of none.
|
|
445
|
+
* - `"context.tool_schema_removed"` (#2681) — the provider refused a request because of one tool's input schema and
|
|
446
|
+
* located the tool (the failed turn's `errorKind: "tool_schema_refused"`, `refusedTool`), so the turn was re-sent with
|
|
447
|
+
* that tool's parameters replaced by an empty object schema, and every later request built from a transcript the
|
|
448
|
+
* refusal's record stands in sends it so (`engine/llm/rejected-images.ts`; MCP and A2A tools only, at most 8 per such
|
|
449
|
+
* transcript; a compaction that summarizes the record away returns the schema until the provider refuses it again).
|
|
450
|
+
* The model can still call the tool. Audience `user`; `detail: { tool, sessionId, runId }`. ONCE PER REFUSAL.
|
|
415
451
|
* - `"task.tool_turn_incomplete"` (#1230) — the person's line for a tool turn the model was handed incomplete, beside
|
|
416
452
|
* the note the model itself reads. `detail.cause` (closed `TOOL_TURN_INCOMPLETE_CAUSES`): `truncated` — calls whose
|
|
417
453
|
* arguments were cut before they parsed, dropped (they did not run); `unnamed` — calls that arrived with no tool
|
|
@@ -482,17 +518,21 @@ export interface EngineNotice {
|
|
|
482
518
|
* empty table or an environment that keeps the floor (the Stub of a run without hands keeps it by refusing every
|
|
483
519
|
* start). Once per run — each delegated child on its own environment — and once per construction of a library-direct
|
|
484
520
|
* band that compiles its own table; `detail: { rowCount, sessionId?, runId? }` (the two ids on a run's notice).
|
|
521
|
+
* - `"config.read_floor_confinement_unavailable"` — a Node environment was asked to confine its starts to the floor
|
|
522
|
+
* (`readFloorConfinement: "os"`) and this host cannot (not macOS, or the seatbelt base does not apply here): the
|
|
523
|
+
* environment declares it does not keep the floor, and the run's own judgment (`config.read_deny_floor_unkept`)
|
|
524
|
+
* follows. Once per construction, at construction; `detail: { reason }`.
|
|
485
525
|
* - `"config.secret_env_scrubbed"` (#1081) — the D1 fail-closed `scrub` policy, or the deployment's
|
|
486
526
|
* own credentials (`declareWithheldEnv`: a declared name, or a value equal to a declared or engine-held
|
|
487
527
|
* credential value), withheld one or more keys from a spawned child's environment (a tool's shell, an
|
|
488
528
|
* oracle gate, or a language server).
|
|
489
529
|
* Once per PROCESS, shared by every scrub site ({@link import("./secret-env.js").announceSecretEnvScrub});
|
|
490
530
|
* `detail: { names, ownCredentials? }` — every withheld key's name, never a value; `ownCredentials`, present
|
|
491
|
-
* only when one was withheld, the subset that is the
|
|
531
|
+
* only when one was withheld, the subset that is the engine's own credentials, by name or by value, whichever
|
|
492
532
|
* rule withheld it (withheld under any policy, `"all"` included).
|
|
493
533
|
* - `"inherit_env.names_withheld"` (#1963) — the same fact for the person whose run drives a tool shell: the variables
|
|
494
534
|
* of the engine's environment that shell does not receive (`ExecutionEnv.withheldEnv`), the scrub's half (the run's
|
|
495
|
-
* `inheritEnv` hands them on) and the
|
|
535
|
+
* `inheritEnv` hands them on) and the engine's own credentials (no policy does). Audience `user`. Read as each
|
|
496
536
|
* call to the engine's own shell tool starts on a root leg (the answer can grow during a run: a credential the engine
|
|
497
537
|
* takes in when it first routes a model is withheld from the next child); once per SESSION per name set (the
|
|
498
538
|
* session's announced record). `detail: { state, names?, ownCredentials?, sessionId, runId? }` — `state` `"withheld"`
|
|
@@ -503,8 +543,8 @@ export interface EngineNotice {
|
|
|
503
543
|
* such as `EMPTY`, fewer than eight characters, one character repeated): it is used as given, but a variable holding
|
|
504
544
|
* the same string is not withheld from a spawned child. Once per PROCESS per value
|
|
505
545
|
* ({@link import("./secret-env.js").holdOwnCredentialValues}); `detail: { reason }` — the kind, never the value. Delivered
|
|
506
|
-
* to `RunnerDeps.onNotice` from the `new Runner` receipt; the intakes with no
|
|
507
|
-
* a request's route reading, a peer's dial, a directly built distiller seat)
|
|
546
|
+
* to `RunnerDeps.onNotice` from the `new Runner` receipt; the intakes with no seat in hand (a brain's construction,
|
|
547
|
+
* a request's route reading, a peer's dial, a directly built distiller seat) go to the default seat ({@link setDefaultEngineNoticeSeat}), else `console.warn`.
|
|
508
548
|
* - `"config.cross_boundary_posture_undeclared"` — a run whose tree executes on a target device (armed) on a deployment that
|
|
509
549
|
* configured no `RunnerDeps.crossBoundaryPosture`: the permissive `"single_user"` reading is in force. Once per run;
|
|
510
550
|
* `detail: { sessionId, runId, taint }` — `taint` lists the tree's taint bits
|
|
@@ -639,13 +679,13 @@ export interface EngineNotice {
|
|
|
639
679
|
* them apart reads that key; one that only cares "a turn was cut" reads neither):
|
|
640
680
|
* · the STEER-NOW lane (design/373) — a caller-provenance steer with `priority: "now"` cut
|
|
641
681
|
* the turn and the run CONTINUES with the steer at the queue head.
|
|
642
|
-
* `detail: { inputId, sessionId, runId, actorId?, taskId
|
|
682
|
+
* `detail: { inputId, sessionId, runId, actorId?, taskId }`, NO `cause` key — `inputId` is
|
|
643
683
|
* the steer's own correlation key (the `human_input` frame's id) and `actorId` the caller's
|
|
644
684
|
* asserted identity when one rode the steer.
|
|
645
685
|
* · the BARE-HALT lane (#504, {@link TaskStream.halt}) — the person's Esc-form stop cut the
|
|
646
686
|
* turn and the run does NOT continue: it collects to a clean, resumable
|
|
647
687
|
* `status:"completed"` ending carrying {@link TaskResult.haltedByUser}.
|
|
648
|
-
* `detail: { cause: "user_halt", sessionId, runId, taskId
|
|
688
|
+
* `detail: { cause: "user_halt", sessionId, runId, taskId }` — no `inputId` and no
|
|
649
689
|
* `actorId`, because no text entered the model and the verb carries no caller identity. A
|
|
650
690
|
* consumer keying `detail.inputId` off this row must treat it as ABSENT on this lane.
|
|
651
691
|
* Fence tension: this notice asserts THE CUT only — when the cut
|
|
@@ -677,7 +717,7 @@ export interface EngineNotice {
|
|
|
677
717
|
* for it (a brain minting its own `aborted` final beside a late halt, a natural completion the halt
|
|
678
718
|
* arrived too late to prevent, an approval park whose commit won the race and whose abort owned the
|
|
679
719
|
* ending); once per such run, at the result's settlement. Either way the notice is the halt's trace
|
|
680
|
-
* beside the verb receipt. `detail: { sessionId, runId, taskId
|
|
720
|
+
* beside the verb receipt. `detail: { sessionId, runId, taskId }` — `runId` is the run whose ending
|
|
681
721
|
* the halt failed to claim. Audience `"user"`. A REFUSED halt (typed `steering.not_running` throw)
|
|
682
722
|
* mints nothing: the refusal itself is the loud answer.
|
|
683
723
|
*
|
|
@@ -691,7 +731,7 @@ export interface EngineNotice {
|
|
|
691
731
|
* Minted only for a value that reads as an APPROVAL — an unconsumed
|
|
692
732
|
* deny/refusal is an ordinary release and leaves no trace, and an unconsumed REJECTION goes to
|
|
693
733
|
* `onError(phase:"hook")` instead (a failing callback, not an answer). One notice per
|
|
694
|
-
* unconsumed approval; `detail: { toolName, toolCallId, sessionId, runId, taskId
|
|
734
|
+
* unconsumed approval; `detail: { toolName, toolCallId, sessionId, runId, taskId }`. Audience `"user"`
|
|
695
735
|
* (whoever answered the card is the one entitled to hear the answer ran nothing); a host may
|
|
696
736
|
* forward it on its own wire.
|
|
697
737
|
*
|
|
@@ -706,7 +746,7 @@ export interface EngineNotice {
|
|
|
706
746
|
* the stop's only trace. Minted once per such run, after the terminal arbitration (so it never
|
|
707
747
|
* claims a completed ending the terminal did not give — a budget ceiling crossed by the last
|
|
708
748
|
* turn's own spend still fails the run and mints nothing here); `detail: { sessionId, runId,
|
|
709
|
-
* taskId
|
|
749
|
+
* taskId, origin }` with `origin` ∈ `"interrupt"` (the verb) | `"walltime"` | `"turns"` |
|
|
710
750
|
* `"signal"` (every other run-level abort: the task's own `signal`, a parent's cancel, a
|
|
711
751
|
* `destroy()`, a refused preempt — the leg names the three it can tell apart and files the rest
|
|
712
752
|
* here). Audience `"user"`. A stop that arrives AFTER the loop's end but before `done` aborted no
|
|
@@ -718,7 +758,7 @@ export interface EngineNotice {
|
|
|
718
758
|
* - `"approval.read_root_granted"` / `"approval.read_root_grant_rejected"` — an approver's `readRootGrant`
|
|
719
759
|
* (`AskOutcome`). GRANTED: it equalled the card's `readRootCandidate.dir` beside `allow: true`; this run's READ
|
|
720
760
|
* directories now include it (never the write roots; this run only); `detail: { dir, covers?, root, toolName,
|
|
721
|
-
* toolCallId, sessionId, runId, taskId
|
|
761
|
+
* toolCallId, sessionId, runId, taskId }`, `root` = the canonical spelling held. REJECTED: nothing changed,
|
|
722
762
|
* the verdict stands; `detail: { reason, offered?, requested?, …same ids }`, `reason` ∈ `on_refusal` |
|
|
723
763
|
* `not_a_string` | `no_candidate` | `mismatch` | `unresolvable` | `resolves_elsewhere` | `admits_artifact_store`
|
|
724
764
|
* (the directory contains the wired local artifact store, lies inside it or is it) | `no_read_roots`. Once per
|
|
@@ -764,7 +804,7 @@ export interface EngineNotice {
|
|
|
764
804
|
* same fact is the entry's own `human_input` account with `delivery: "blocked"` — the two share
|
|
765
805
|
* the inputId, so "accepted at park, screened at redelivery" is auditable end to end. Audience
|
|
766
806
|
* `"user"` (the person whose instruction was withheld is the one entitled to re-issue it);
|
|
767
|
-
* `detail: { inputId?, sessionId, runId, taskId
|
|
807
|
+
* `detail: { inputId?, sessionId, runId, taskId }` — `inputId` is the parked entry's stored
|
|
768
808
|
* correlation key (OPTIONAL: a row parked without one exists), and `runId` names the resume leg
|
|
769
809
|
* that withheld it, so a session resumed twice does not report two withholdings as one.
|
|
770
810
|
*
|
|
@@ -1076,7 +1116,10 @@ export interface EngineNotice {
|
|
|
1076
1116
|
code: string;
|
|
1077
1117
|
/** The exact human-readable line the unwired build prints via `console.warn` — same words, one text. */
|
|
1078
1118
|
message: string;
|
|
1079
|
-
/** Machine-readable facts of the notice (knob names, arriving values, values in force).
|
|
1119
|
+
/** Machine-readable facts of the notice (knob names, arriving values, values in force). On a notice a leg raises about
|
|
1120
|
+
* itself, `detail.taskId` is that leg's own task id — the one value its prepare minted (`Prepared.taskId`: a background
|
|
1121
|
+
* sub-agent's registry task id, else the host's declared `TaskSpec.taskId`, else the leg's session id) — read the same way by
|
|
1122
|
+
* every such code; the per-code shapes below list it where a code carries it. */
|
|
1080
1123
|
detail?: Record<string, unknown>;
|
|
1081
1124
|
/** The owning session, when the notice HAS one — an ATTRIBUTION/correlation key, never a
|
|
1082
1125
|
* projection permission: whether a notice may be surfaced onto that session's user-facing
|
|
@@ -1089,6 +1132,9 @@ export interface EngineNotice {
|
|
|
1089
1132
|
* Optional and absent for process/config-scoped codes. */
|
|
1090
1133
|
sessionId?: string;
|
|
1091
1134
|
}
|
|
1135
|
+
/** Install the process's default notice seat, for what the engine says where no seat is in hand (a brain's construction, a route reading, a peer's dial): a second call replaces it,
|
|
1136
|
+
* `undefined` removes it (such notices then print on `console.warn`), a seat a station holds always wins, anything but a function or `undefined` is refused (`config.invalid_argument`). */
|
|
1137
|
+
export declare function setDefaultEngineNoticeSeat(seat: ((notice: EngineNotice) => void) | undefined): void;
|
|
1092
1138
|
/** Test seam (mirrors `__resetBashTimeoutAnnouncements`): never called by production code. */
|
|
1093
1139
|
export declare function __resetMalformedNoticeSeatAnnouncement(): void;
|
|
1094
1140
|
/**
|
|
@@ -1108,7 +1154,8 @@ export declare function __resetMalformedNoticeSeatAnnouncement(): void;
|
|
|
1108
1154
|
* · a PRESENT NON-function seat is a bad deployment value, and #123 (loud-bad-value law) forbids
|
|
1109
1155
|
* folding it to silence: the notice itself falls back to `console.warn` (no line is lost), and the
|
|
1110
1156
|
* seat defect — the one fact every fallback would otherwise repeat — is announced once per process.
|
|
1111
|
-
* · an ABSENT seat
|
|
1157
|
+
* · an ABSENT seat goes to the default seat a host installed ({@link setDefaultEngineNoticeSeat}; a function seat as above, and
|
|
1158
|
+
* a present seat — non-function included — never falls through to it), else prints the historic `console.warn` line verbatim.
|
|
1112
1159
|
*/
|
|
1113
1160
|
export declare function deliverEngineNotice(onNotice: ((notice: EngineNotice) => void) | undefined, notice: EngineNotice): void;
|
|
1114
1161
|
/**
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { egressAccount, egressText } from "./untrusted-egress.js";
|
|
2
|
+
let defaultNoticeSeat;
|
|
3
|
+
export function setDefaultEngineNoticeSeat(seat) {
|
|
4
|
+
if (seat !== undefined && typeof seat !== "function")
|
|
5
|
+
throw Object.assign(new Error(`setDefaultEngineNoticeSeat: the seat must be a function, or undefined to remove it (got ${seat === null ? "null" : typeof seat})`), { code: "config.invalid_argument" });
|
|
6
|
+
defaultNoticeSeat = seat;
|
|
7
|
+
}
|
|
2
8
|
let malformedNoticeSeatAnnounced = false;
|
|
3
9
|
export function __resetMalformedNoticeSeatAnnouncement() {
|
|
4
10
|
malformedNoticeSeatAnnounced = false;
|
|
@@ -12,9 +18,10 @@ export function deliverEngineNotice(onNotice, notice) {
|
|
|
12
18
|
if (notice.sessionId === undefined && typeof notice.detail?.["sessionId"] === "string") {
|
|
13
19
|
notice = { ...notice, sessionId: notice.detail["sessionId"] };
|
|
14
20
|
}
|
|
15
|
-
|
|
21
|
+
const seat = onNotice === undefined ? defaultNoticeSeat : onNotice;
|
|
22
|
+
if (typeof seat === "function") {
|
|
16
23
|
try {
|
|
17
|
-
const r =
|
|
24
|
+
const r = seat(notice);
|
|
18
25
|
if (typeof r?.then === "function") {
|
|
19
26
|
r.then(undefined, () => {
|
|
20
27
|
});
|
|
@@ -51,6 +51,14 @@ export interface FileHistoryRetentionPolicy {
|
|
|
51
51
|
*/
|
|
52
52
|
keep?: number | "unbounded";
|
|
53
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* The retention door's reading of a policy: received by the receipt law with this door's one knob as the member it takes
|
|
56
|
+
* (a plain object read once off its own descriptors; a misspelled knob refused by name, `config.retention_policy_invalid`),
|
|
57
|
+
* its knob judged as {@link resolveFileHistoryRetention} judges it, and handed back as the frozen copy a store then
|
|
58
|
+
* holds — so a composition that receives the policy ahead of the store it configures hands that store the copy, and the
|
|
59
|
+
* caller's object is read once. Absent ⇒ `undefined` (the engine default applies).
|
|
60
|
+
*/
|
|
61
|
+
export declare function receiveFileHistoryRetention(label: string, policy: FileHistoryRetentionPolicy | undefined): Readonly<FileHistoryRetentionPolicy> | undefined;
|
|
54
62
|
/**
|
|
55
63
|
* The retention door: resolve a deployment's policy to a boundary cap, or REFUSE loudly.
|
|
56
64
|
*
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { optionKeys, receiveMembers } from "./own-property-receipt.js";
|
|
2
|
+
import { refuseRetentionPolicy, retentionKnobRefusal } from "./retention-policy.js";
|
|
2
3
|
export const DEFAULT_FILE_HISTORY_BOUNDARY_KEEP = 100;
|
|
3
|
-
const
|
|
4
|
-
export function
|
|
4
|
+
const FILE_HISTORY_RETENTION_KNOBS = optionKeys()({ keep: 0 });
|
|
5
|
+
export function receiveFileHistoryRetention(label, policy) {
|
|
5
6
|
if (policy === undefined)
|
|
6
|
-
return
|
|
7
|
+
return undefined;
|
|
7
8
|
if (typeof policy !== "object" || policy === null || Array.isArray(policy)) {
|
|
8
|
-
refuseRetentionPolicy(label, "retention", policy, `an object of retention knobs (${
|
|
9
|
-
}
|
|
10
|
-
const unknown = Object.keys(policy).filter((k) => !KNOWN_KNOBS.has(k));
|
|
11
|
-
if (unknown.length > 0) {
|
|
12
|
-
const first = unknown[0];
|
|
13
|
-
refuseRetentionPolicy(label, `retention.${first}`, policy[first], `omitted — ${JSON.stringify(first)} is not a retention knob (the only knob is "keep"), and a misspelled one would leave the engine default in force while the operator believes their own number is`);
|
|
9
|
+
refuseRetentionPolicy(label, "retention", policy, `an object of retention knobs (${FILE_HISTORY_RETENTION_KNOBS.join(", ")}) or omitted`);
|
|
14
10
|
}
|
|
15
|
-
const
|
|
11
|
+
const copy = receiveMembers(policy, { subject: `${label}.retention`, unit: "retention knob", moment: "at construction" }, FILE_HISTORY_RETENTION_KNOBS, retentionKnobRefusal);
|
|
12
|
+
boundaryKeepOf(label, copy.keep);
|
|
13
|
+
return copy;
|
|
14
|
+
}
|
|
15
|
+
export function resolveFileHistoryRetention(label, policy) {
|
|
16
|
+
return boundaryKeepOf(label, receiveFileHistoryRetention(label, policy)?.keep);
|
|
17
|
+
}
|
|
18
|
+
function boundaryKeepOf(label, keep) {
|
|
16
19
|
if (keep === undefined)
|
|
17
20
|
return DEFAULT_FILE_HISTORY_BOUNDARY_KEEP;
|
|
18
21
|
if (keep === "unbounded")
|
|
@@ -597,7 +597,37 @@ export interface FileHistoryStore {
|
|
|
597
597
|
*/
|
|
598
598
|
exportHistory?(scope: string): Promise<FileHistoryExportResult>;
|
|
599
599
|
importHistory?(scope: string, data: FileHistoryExport, srcGetBlob: (hash: string) => Promise<Uint8Array | undefined>): Promise<FileHistoryResult>;
|
|
600
|
+
/**
|
|
601
|
+
* The store's blob exchange — how another machine's bytes come in ahead of an import, go out to a puller, and are
|
|
602
|
+
* asked about — as one optional member group ({@link FileHistoryBlobExchange}): present ⇒ all three of its members;
|
|
603
|
+
* absent ⇒ this store exchanges no blobs (it can still import, from a source the caller reads). Read through
|
|
604
|
+
* {@link fileHistoryBlobExchangeOf}, which refuses a group with a member missing. A puller hands
|
|
605
|
+
* `blobExchange.get` to {@link importHistory} as its `srcGetBlob`.
|
|
606
|
+
*/
|
|
607
|
+
readonly blobExchange?: FileHistoryBlobExchange;
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* {@link FileHistoryStore.blobExchange}: one capability, three members.
|
|
611
|
+
*
|
|
612
|
+
* - `put(hash, bytes)` stores bytes under their content address. The store checks the address itself — bytes whose
|
|
613
|
+
* sha256 is not `hash` are refused (`adopt_failed`, `permanence: "terminal"`) and nothing is stored — and records
|
|
614
|
+
* the blob present the same way a capture records one, so bytes no history references yet are kept like any other
|
|
615
|
+
* unreferenced blob: until the orphan sweep's grace window runs out. Idempotent.
|
|
616
|
+
* - `get(hash)` answers the bytes, or `undefined` when the store does not hold them.
|
|
617
|
+
* - `has(hashes)` answers which of `hashes` the store holds, from its own index — no bytes are read.
|
|
618
|
+
*/
|
|
619
|
+
export interface FileHistoryBlobExchange {
|
|
620
|
+
put(hash: string, bytes: Uint8Array): Promise<FileHistoryResult>;
|
|
621
|
+
get(hash: string): Promise<Uint8Array | undefined>;
|
|
622
|
+
has(hashes: readonly string[]): Promise<ReadonlySet<string>>;
|
|
600
623
|
}
|
|
624
|
+
/**
|
|
625
|
+
* The store's blob exchange, read as one capability: `undefined` when the store carries no `blobExchange`; its three
|
|
626
|
+
* members, bound, when it carries the whole group; a refusal (`config.invalid_argument`) when the group is not an
|
|
627
|
+
* object or a member is missing or not a function. A store that still carries the retired `syncBlobFaces` marker is
|
|
628
|
+
* refused too: the capability is the group's presence, and a second word for it is a second reading.
|
|
629
|
+
*/
|
|
630
|
+
export declare function fileHistoryBlobExchangeOf(store: FileHistoryStore): FileHistoryBlobExchange | undefined;
|
|
601
631
|
/**
|
|
602
632
|
* design/381 §3 + §10 T-5 — the FENCING judge for a boundary-capture attempt, exposed as a
|
|
603
633
|
* direct-callable function (the G6b grey-box seat) and used by every in-tree backend as the single
|
|
@@ -852,7 +882,7 @@ export declare class InMemoryFileHistoryStore implements FileHistoryStore {
|
|
|
852
882
|
* (adversarial round): two concurrent captures can lease the same new hash, and the first
|
|
853
883
|
* attempt's release must not strip the second attempt's liveness. */
|
|
854
884
|
private readonly inFlightBlobs;
|
|
855
|
-
constructor(
|
|
885
|
+
constructor(options?: InMemoryFileHistoryStoreOptions);
|
|
856
886
|
/**
|
|
857
887
|
* The RETENTION pass, run after a boundary commits (design/381 §片2 — see {@link FileHistoryStore.reap}
|
|
858
888
|
* for why the backend owns this rather than the host). Boundaries are an insertion-ordered map
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { readMember, thrownText } from "./thrown-value.js";
|
|
3
|
+
import { readMemberGroup } from "./member-group.js";
|
|
3
4
|
import { isAbsoluteForFamily, isWinFormPath, pathFamilyOf, relativeInEveryFamily } from "../tools/fs/safety.js";
|
|
4
5
|
import { fileHistoryBoundariesToKeep, resolveFileHistoryRetention } from "./file-history-retention.js";
|
|
6
|
+
import { optionKeys, receiveOptions } from "./own-property-receipt.js";
|
|
5
7
|
const normSlash = (p) => p.replace(/\\/g, "/");
|
|
6
8
|
const stripTrailSep = (p) => (isWinFormPath(p) ? p.replace(/[\\/]+$/, "") : p.replace(/\/+$/, ""));
|
|
7
9
|
const foldDrive = (p) => (/^[A-Za-z]:(\/|$)/.test(p) ? p[0].toLowerCase() + p.slice(1) : p);
|
|
@@ -244,6 +246,31 @@ function judgeFileHistoryEnvelope(data) {
|
|
|
244
246
|
}
|
|
245
247
|
return { ok: true };
|
|
246
248
|
}
|
|
249
|
+
const BLOB_EXCHANGE_MEMBERS = Object.freeze(["put", "get", "has"]);
|
|
250
|
+
export function fileHistoryBlobExchangeOf(store) {
|
|
251
|
+
const owner = "FileHistoryStore.blobExchange";
|
|
252
|
+
let marker;
|
|
253
|
+
let group;
|
|
254
|
+
try {
|
|
255
|
+
marker = Reflect.get(store, "syncBlobFaces");
|
|
256
|
+
group = store.blobExchange;
|
|
257
|
+
}
|
|
258
|
+
catch (cause) {
|
|
259
|
+
throw invalidBlobExchange(`${owner} could not be read (${thrownText(cause)}).`);
|
|
260
|
+
}
|
|
261
|
+
if (marker !== undefined)
|
|
262
|
+
throw invalidBlobExchange(`FileHistoryStore carries the retired syncBlobFaces marker — the blob exchange is the ${owner} group (put / get / has): present means the capability, absent means none.`);
|
|
263
|
+
if (group === undefined)
|
|
264
|
+
return undefined;
|
|
265
|
+
if (typeof group !== "object" || group === null)
|
|
266
|
+
throw invalidBlobExchange(`${owner} must be an object with put / get / has (got ${group === null ? "null" : typeof group}).`);
|
|
267
|
+
return readMemberGroup(owner, group, BLOB_EXCHANGE_MEMBERS, true);
|
|
268
|
+
}
|
|
269
|
+
function invalidBlobExchange(message) {
|
|
270
|
+
const e = new Error(message);
|
|
271
|
+
e.code = "config.invalid_argument";
|
|
272
|
+
return e;
|
|
273
|
+
}
|
|
247
274
|
export function boundaryPublishVerdict(attempt) {
|
|
248
275
|
return attempt.aborted ? { publish: false, reason: "aborted" } : { publish: true };
|
|
249
276
|
}
|
|
@@ -412,13 +439,15 @@ async function applyRecordedMode(env, absPath, opts, currentMode) {
|
|
|
412
439
|
const r = await env.setFileMode(absPath, want & 0o7777, opts.signal);
|
|
413
440
|
return r.ok ? "applied" : "unpreserved";
|
|
414
441
|
}
|
|
442
|
+
const IN_MEMORY_FILE_HISTORY_STORE_OPTION_KEYS = optionKeys()({ retention: 0 });
|
|
415
443
|
export class InMemoryFileHistoryStore {
|
|
416
444
|
scopes = new Map();
|
|
417
445
|
boundaryKeep;
|
|
418
446
|
blobs = new Map();
|
|
419
447
|
inFlightBlobs = new Map();
|
|
420
|
-
constructor(
|
|
421
|
-
|
|
448
|
+
constructor(options) {
|
|
449
|
+
const opts = receiveOptions(options, "InMemoryFileHistoryStore", IN_MEMORY_FILE_HISTORY_STORE_OPTION_KEYS);
|
|
450
|
+
this.boundaryKeep = resolveFileHistoryRetention("InMemoryFileHistoryStore", opts.retention);
|
|
422
451
|
}
|
|
423
452
|
applyBoundaryRetention(scope, justCommitted) {
|
|
424
453
|
if (this.boundaryKeep === null)
|
|
@@ -40,6 +40,13 @@ export interface FrameSettlement {
|
|
|
40
40
|
* host decided what the model reads, so the consumer settles the record as the host's decision (terminal),
|
|
41
41
|
* discloses it loudly, and never hands it over again. */
|
|
42
42
|
readonly hostWithheld: Set<string>;
|
|
43
|
+
/** Awaited keys whose frame the session's receiving station did not hand over ({@link settleConsumedFrame}): an
|
|
44
|
+
* extension consumed it, or a handler there failed — key → who (an extension's name, or `engine`) and why. The consumer
|
|
45
|
+
* settles the record as that decision (terminal), tells its sender, and never hands it over again. */
|
|
46
|
+
readonly consumed: Map<string, {
|
|
47
|
+
readonly by: string;
|
|
48
|
+
readonly reason: string;
|
|
49
|
+
}>;
|
|
43
50
|
/** Compactions that LANDED this run and have not been consumed by a settlement pass yet, in landing
|
|
44
51
|
* order. Recorded only while {@link FrameSettlement.wantsEffects} says a record could still be
|
|
45
52
|
* broken by one, and cleared by the consumer's LOCAL settlement half — which needs no lease, so an
|
|
@@ -63,6 +70,9 @@ export interface FrameSettlement {
|
|
|
63
70
|
wantsEffects?: () => boolean;
|
|
64
71
|
}
|
|
65
72
|
export declare function createFrameSettlement(): FrameSettlement;
|
|
73
|
+
/** The receiving station did not hand the frame keyed `key` over: its ask is answered now, as consumed (only an ask some
|
|
74
|
+
* consumer registered is answered — a frame nobody awaits leaves nothing behind). */
|
|
75
|
+
export declare function settleConsumedFrame(seam: FrameSettlement, key: string, by: string, reason: string): void;
|
|
66
76
|
/** The carrier key of a TOOL RESULT (the `ReadInbox` pull face): its own domain, so it can never
|
|
67
77
|
* collide with an injection queue dedup key. One tool result can carry SEVERAL frames, each asked for
|
|
68
78
|
* under its own key with this carrier. */
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
export function createFrameSettlement() {
|
|
2
|
-
return { awaiting: new Map(), receipts: new Map(), withheld: new Set(), hostRewritten: new Set(), hostWithheld: new Set(), compactions: [] };
|
|
2
|
+
return { awaiting: new Map(), receipts: new Map(), withheld: new Set(), hostRewritten: new Set(), hostWithheld: new Set(), consumed: new Map(), compactions: [] };
|
|
3
|
+
}
|
|
4
|
+
export function settleConsumedFrame(seam, key, by, reason) {
|
|
5
|
+
if (!seam.awaiting.delete(key))
|
|
6
|
+
return;
|
|
7
|
+
seam.consumed.set(key, Object.freeze({ by, reason }));
|
|
3
8
|
}
|
|
4
9
|
export function toolResultReceiptKey(toolCallId) {
|
|
5
10
|
return `tool_result:${toolCallId}`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExecutionEnv } from "../internal/harness-types.js";
|
|
2
|
-
import type { PermissionResult, ToolPolicy } from "./tool-policy.js";
|
|
2
|
+
import type { PermissionResult, ToolCallRequest, ToolPolicy } from "./tool-policy.js";
|
|
3
3
|
import { type PathGuardRow } from "./path-guard-rows.js";
|
|
4
4
|
/** One write domain SOURCE as an allow row of the one table: it reaches every location at or below one of its admitted keys.
|
|
5
5
|
* The write gate's three sources, and a session rule's `allowDirs` (the confinement that admits a write only inside them). */
|
|
@@ -39,8 +39,8 @@ export interface FsWriteGatePolicyOptions {
|
|
|
39
39
|
defaultWrite: "ask" | "allow";
|
|
40
40
|
/** The ask the default verdict mints in place of the gate's ordinary write question — a permission mode's own
|
|
41
41
|
* sentence over the resolved `path`, with the gate's domain note (a configured domain that was not honored) to
|
|
42
|
-
* append when there is one. Read only where `defaultWrite` is `"ask"`. */
|
|
43
|
-
defaultAsk?: (path: string, note: string | undefined) => PermissionResult;
|
|
42
|
+
* append when there is one, and the call it answers. Read only where `defaultWrite` is `"ask"`. */
|
|
43
|
+
defaultAsk?: (path: string, note: string | undefined, call: ToolCallRequest) => PermissionResult;
|
|
44
44
|
/**
|
|
45
45
|
* Session-exemption lookup ("allow all for this session" grants recorded by the deployment's approval
|
|
46
46
|
* surface). Consulted ONCE per covered write, after the domain checks and immediately BEFORE the gate
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { canonicalizeTarget, lexicalViewOf, pathFamilyOf, writeTargetPath } from "../tools/fs/safety.js";
|
|
2
|
+
import { attest } from "./engine-attestation.js";
|
|
2
3
|
import { isWithin } from "./runner/session-rule-policy.js";
|
|
3
4
|
import { swallowedFenceRoot } from "./runner/advertised-writable-dirs.js";
|
|
4
5
|
import { declaredPathTargetOf, isProtectedWrite } from "./tool-registry.js";
|
|
@@ -51,9 +52,6 @@ export function createFsWriteGatePolicy(opts) {
|
|
|
51
52
|
const rootLexical = absoluteRootOf(rootPath, env.cwd);
|
|
52
53
|
assertExemptDirsDoNotCoverRoot(exemptDirs, rootLexical);
|
|
53
54
|
const guardedCapable = env.writeFileGuarded !== undefined;
|
|
54
|
-
const advisory = guardedCapable
|
|
55
|
-
? ""
|
|
56
|
-
: " (advisory adjudication: this environment provides no guarded write, so approval is judged before a separate, non-atomic write step)";
|
|
57
55
|
return {
|
|
58
56
|
async check(req, signal) {
|
|
59
57
|
if (!isProtectedWrite(req))
|
|
@@ -68,11 +66,11 @@ export function createFsWriteGatePolicy(opts) {
|
|
|
68
66
|
const declared = declaredPathTargetOf(req);
|
|
69
67
|
const path = declared === undefined ? undefined : writeTargetPath(req, declared);
|
|
70
68
|
if (path === undefined) {
|
|
71
|
-
return ask(`write tool "${req.toolName}" requires approval: the call has no resolvable path target to confine${declared === undefined ? " (the tool declares no path target)" : ""}
|
|
69
|
+
return ask(`write tool "${req.toolName}" requires approval: the call has no resolvable path target to confine${declared === undefined ? " (the tool declares no path target)" : ""}`);
|
|
72
70
|
}
|
|
73
71
|
const canon = await canonicalizeTarget(env, path, signal, pathFamilyOf({ root: rootPath, cwd: req.cwd ?? env.cwd }), pathTargetBaseOf(declared, { root: rootPath, cwd: req.cwd }));
|
|
74
72
|
if (!canon.ok) {
|
|
75
|
-
return ask(`write to "${path}" requires approval: its real target could not be resolved (${canon.message})
|
|
73
|
+
return ask(`write to "${path}" requires approval: its real target could not be resolved (${canon.message})`);
|
|
76
74
|
}
|
|
77
75
|
const advertised = req.advertisedWritableRoots ?? [];
|
|
78
76
|
const targetViews = { views: [{ path: canon.key, kind: "canonical" }] };
|
|
@@ -132,8 +130,11 @@ export function createFsWriteGatePolicy(opts) {
|
|
|
132
130
|
return { action: "allow" };
|
|
133
131
|
const note = refusedDomain === undefined ? undefined : ` — note: the configured write domain ${refusedDomain} was not honored; a domain that holds the root would exempt every write under it`;
|
|
134
132
|
if (opts.defaultAsk !== undefined)
|
|
135
|
-
return opts.defaultAsk(path, note);
|
|
136
|
-
|
|
133
|
+
return opts.defaultAsk(path, note, req);
|
|
134
|
+
if (note !== undefined)
|
|
135
|
+
return ask(`approve write to "${path}"?${note}`);
|
|
136
|
+
const generic = `approve write to "${path}"?`;
|
|
137
|
+
return attest(ask(generic), req, { genericQuestion: generic });
|
|
137
138
|
},
|
|
138
139
|
};
|
|
139
140
|
}
|
package/dist/core/gate-fold.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { inlineUntrusted } from "./untrusted-text.js";
|
|
1
|
+
import { inlineUntrusted, PROBE_REASON_MAX } from "./untrusted-text.js";
|
|
2
2
|
import { markTightenMessage } from "./safety-axis-vocab.js";
|
|
3
|
-
import {
|
|
3
|
+
import { normalizeProbeCause } from "./checkpoint-features.js";
|
|
4
4
|
import { normalizeReadRootCandidate } from "./read-root-candidate.js";
|
|
5
5
|
import { engineFailClosedExit, hookDenyExit, settledScreenExit, takeInheritedScreen } from "./runner/gate-exit.js";
|
|
6
6
|
import { noteRewrite, POLICY_AUTHOR, readRejudge, screenRewrite } from "./rewrite-rejudge.js";
|
|
@@ -12,7 +12,7 @@ import { failedJudgmentDeny } from "./runner/policy-throw.js";
|
|
|
12
12
|
import { thrownText } from "./thrown-value.js";
|
|
13
13
|
import { argsAsTheToolReads } from "./effective-path-target.js";
|
|
14
14
|
import { foldHookAsk, refuseOutOfContractDecision } from "./tool-policy.js";
|
|
15
|
-
import { withProbeMandate } from "./ask-origin.js";
|
|
15
|
+
import { withChainAskReasons, withProbeMandate } from "./ask-origin.js";
|
|
16
16
|
import { applyUnansweredSilence, readStationAnswer, silencedBy } from "./shell-read-silence.js";
|
|
17
17
|
import { asksUnstated, permissionSeatAt, unstatedAskMessage } from "./mode-policy.js";
|
|
18
18
|
export async function runGateFold(pass) {
|
|
@@ -40,6 +40,7 @@ export async function runGateFold(pass) {
|
|
|
40
40
|
if (attributed !== undefined)
|
|
41
41
|
pass.classifierRound = attributed;
|
|
42
42
|
}
|
|
43
|
+
pass.decision = withChainAskReasons(pass.decision, pass.req);
|
|
43
44
|
const rewritten = pass.screening !== undefined && pass.decision.action !== "deny" ? readRejudge(pass.req, pass.currentInput, pass.decision) : undefined;
|
|
44
45
|
if (pass.screening !== undefined && rewritten?.kind === "rewritten") {
|
|
45
46
|
const second = await screenRewrite(pass.screening, pass.req, rewritten.form, `the rewritten call to "${toolName}"`);
|
package/dist/core/gate-lanes.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { argsAsTheToolReads, withArgsReading } from "./effective-path-target.js";
|
|
2
2
|
import { attest, attestationOf, bindableArgsOf, decisionText, foldHookAsk, refusalOf, refuseOutOfContractDecision } from "./tool-policy.js";
|
|
3
3
|
import { APPROVER_AUTHOR, extensionAuthors, noteRewrite, outletAsk, POLICY_AUTHOR, readRejudge, rewriteChasedSentence, screenRewrite } from "./rewrite-rejudge.js";
|
|
4
|
-
import { arbitrateByMode, classifyAsk, decisionAskClassesOf, dontAskRefusalMessage, fileCommandOptionsSentence, persistedRuleMandateOf, safetyAxisOf, stampAskOrigin } from "./ask-origin.js";
|
|
4
|
+
import { arbitrateByMode, askReasonsOf, classifyAsk, joinAskReasons, decisionAskClassesOf, dontAskRefusalMessage, fileCommandOptionsSentence, persistedRuleMandateOf, safetyAxisOf, stampAskOrigin, withChainAskReasons } from "./ask-origin.js";
|
|
5
5
|
import { classifierParseFailureDenyMessage, denialLimitFallbackMessage, rungDidNotRule, unarmedWindow } from "./auto-mode.js";
|
|
6
6
|
import { classifierNoRulingArm, settleNoRulingAsk } from "./classifier-unavailable-arm.js";
|
|
7
7
|
import { SETTLEMENT_NOBODY_JUDGED } from "./gate-outcome.js";
|
|
@@ -24,7 +24,8 @@ import { readOrgRuleLane, readPersistedRuleLane } from "./rule-lane-reads.js";
|
|
|
24
24
|
import { traceHookCrash } from "./gate-crash-trace.js";
|
|
25
25
|
import { createGateDeadline, awaitWriteProtectionJudgment, withGateTimeout } from "./gate-bounded-await.js";
|
|
26
26
|
import { readStationAnswer } from "./shell-read-silence.js";
|
|
27
|
-
import {
|
|
27
|
+
import { judgedInputOf, raiseToolCheck } from "./mods/stations.js";
|
|
28
|
+
import { agentIdOf } from "./leg-identity.js";
|
|
28
29
|
import { extensionAllowOf, readToolChecks } from "./tool-check-reading.js";
|
|
29
30
|
import { policyThrowLine, reportPolicyThrow } from "./runner/policy-throw.js";
|
|
30
31
|
function parkWith(suspendAsk, parkArgs, carry) {
|
|
@@ -60,6 +61,7 @@ export async function runGateLanes(pass) {
|
|
|
60
61
|
...(d.action === "ask" && d.askClass !== undefined && d.classes !== undefined ? { askClass: d.askClass, classes: d.classes } : {}),
|
|
61
62
|
...(d.action === "ask" && d.mandated === true ? { mandated: true, ...(d.mandate !== undefined ? { mandate: d.mandate } : {}) } : {}),
|
|
62
63
|
...(d.action === "ask" && d.authoredBy === "deployment" ? { authoredBy: "deployment" } : {}),
|
|
64
|
+
...askReasonsOf(d),
|
|
63
65
|
});
|
|
64
66
|
const parkAsk = async (d, req, args, safety, liveFaceUnavailable, org) => {
|
|
65
67
|
if (suspendAsk === undefined || d.action !== "ask")
|
|
@@ -649,7 +651,7 @@ export async function runGateLanes(pass) {
|
|
|
649
651
|
if (attributed !== undefined)
|
|
650
652
|
pass.classifierRound = attributed;
|
|
651
653
|
const read = ledger.fromDecision(recheck);
|
|
652
|
-
recheck = read.decision;
|
|
654
|
+
recheck = withChainAskReasons(read.decision, { toolCallId, toolName });
|
|
653
655
|
if (recheck.action === "deny" && read.deniedBy !== undefined) {
|
|
654
656
|
editDenied = recheck;
|
|
655
657
|
pass.deniedBy = read.deniedBy;
|
|
@@ -751,7 +753,8 @@ export async function runGateLanes(pass) {
|
|
|
751
753
|
const rra = carried.requiresRealApproval === true ? { requiresRealApproval: true } : {};
|
|
752
754
|
const call = { toolCallId, toolName };
|
|
753
755
|
const folded = new Set([...(editDecision.action === "ask" ? (attestationOf(editDecision, call)?.foldedClasses ?? []) : []), ...decisionAskClassesOf(carried, call), ...(carried.classes ?? [])]);
|
|
754
|
-
|
|
756
|
+
const askReasons = editDecision.action === "ask" ? joinAskReasons(editDecision.askReasons, carried.askReasons) : undefined;
|
|
757
|
+
editDecision = stampEditAsk(editDecision.action === "ask" ? attest({ ...editDecision, ...rra, ...(askReasons !== undefined ? { askReasons } : {}) }, call, { foldedClasses: [...folded] }) : carried);
|
|
755
758
|
carriedOwnAsk = undefined;
|
|
756
759
|
}
|
|
757
760
|
const editRead = await checkTool(editDecision, editArgs, editOrg.org, undefined);
|