@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
|
@@ -6,7 +6,9 @@ import { isAutoModeFallbackCause, readDenialLimitFallback } from "./auto-mode.js
|
|
|
6
6
|
import { isAskOrigin, isPersistedRuleMandate } from "./ask-origin.js";
|
|
7
7
|
import { readBoundBinding } from "./skill-grant-binding.js";
|
|
8
8
|
import { checkpointExecutionRecorded, executionRecordDisposition, ExecutionOutcomeConflictError, } from "./checkpoint-execution-record.js";
|
|
9
|
+
import { checkpointHolderMatches, checkpointOccMatches, checkpointRevOf } from "./checkpoint-generation.js";
|
|
9
10
|
import { parkedApprovalCardOf } from "./pause-registry.js";
|
|
11
|
+
import { checkpointDeadlinePassed, deleteSessionRowsAtStart, readCheckpointOverdueQuery, readCheckpointSessionQuery, selectOverduePage, selectSessionPage } from "./checkpoint-queries.js";
|
|
10
12
|
import { renderUntrustedCommandText, stripFormatCharacters } from "./permission-rule-model.js";
|
|
11
13
|
import { egressText } from "./untrusted-egress.js";
|
|
12
14
|
import { steerReplayRefusal } from "./steer-replay.js";
|
|
@@ -50,17 +52,19 @@ export function normalizeProbeCause(value) {
|
|
|
50
52
|
};
|
|
51
53
|
}
|
|
52
54
|
export function riskSeverity(axes) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (
|
|
58
|
-
return
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
55
|
+
return readRiskAxes(axes).tier;
|
|
56
|
+
}
|
|
57
|
+
function readRiskAxes(axes) {
|
|
58
|
+
const word = (v) => (v === undefined ? "absent" : v === null ? "null" : Array.isArray(v) ? "an array" : typeof v === "object" ? "an object" : `a ${typeof v}`);
|
|
59
|
+
if (!isPlainRecord(axes))
|
|
60
|
+
return { tier: undefined, problem: `${word(axes)}${typeof axes === "object" && axes !== null && !Array.isArray(axes) ? " that is not a plain record" : ""}` };
|
|
61
|
+
const damaged = [];
|
|
62
|
+
const mark = (name, v) => (v === undefined || typeof v === "boolean" ? v === true : (damaged.push(`\`${name}\` mark is ${word(v)}`), false));
|
|
63
|
+
const egress = mark("egress", axes.egress);
|
|
64
|
+
const irreversible = mark("irreversible", axes.irreversible);
|
|
65
|
+
const shell = mark("shell", axes.shell);
|
|
66
|
+
const proven = irreversible && egress ? 5 : irreversible ? 4 : egress || shell ? 3 : 2;
|
|
67
|
+
return damaged.length === 0 ? { tier: proven } : { tier: proven === 2 ? undefined : proven, problem: `a record whose ${damaged.join(" and ")}, not a boolean` };
|
|
64
68
|
}
|
|
65
69
|
const SUMMARY_CMD_MAX = 200;
|
|
66
70
|
const SUMMARY_VALUE_MAX = 120;
|
|
@@ -248,9 +252,34 @@ export function remainingTokens(ledger) {
|
|
|
248
252
|
return Math.max(0, total - (spent ?? 0));
|
|
249
253
|
}
|
|
250
254
|
export { REOPEN_REASONS } from "./resume-startup-cause.js";
|
|
251
|
-
export function
|
|
252
|
-
const
|
|
253
|
-
const
|
|
255
|
+
export function checkpointIndexFacts(cp) {
|
|
256
|
+
const gate = cp.gate;
|
|
257
|
+
const card = parkedApprovalCardOf(gate);
|
|
258
|
+
const tool = cp.pendingAction.kind === "tool_approval" ? cp.pendingAction : undefined;
|
|
259
|
+
return {
|
|
260
|
+
token: cp.token,
|
|
261
|
+
scope: cp.scope,
|
|
262
|
+
sessionId: cp.sessionId,
|
|
263
|
+
version: checkpointVersionOf(cp),
|
|
264
|
+
gateKind: gate.kind,
|
|
265
|
+
approvalCard: card.kind === "card" ? card.card : card.kind === "unknown_word" && typeof card.word === "string" ? card.word : null,
|
|
266
|
+
toolName: tool?.toolName ?? null,
|
|
267
|
+
toolCallId: tool?.toolCallId ?? null,
|
|
268
|
+
boundInputHash: tool?.boundInputHash ?? null,
|
|
269
|
+
deadline: cp.deadline ?? null,
|
|
270
|
+
createdAt: cp.createdAt,
|
|
271
|
+
riskDescriptor: card.kind !== "not_approval" && "riskDescriptor" in gate ? (gate.riskDescriptor ?? null) : null,
|
|
272
|
+
hasBidiControls: tool?.hasBidiControls === true ? true : null,
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
export function summarizeCheckpoint(cp, disclose) {
|
|
276
|
+
const facts = checkpointIndexFacts(cp);
|
|
277
|
+
const descriptor = facts.riskDescriptor;
|
|
278
|
+
const axes = descriptor === null ? undefined : readRiskAxes(descriptor?.axes);
|
|
279
|
+
const severity = axes?.tier;
|
|
280
|
+
if (axes?.problem !== undefined) {
|
|
281
|
+
disclose?.(`checkpoint ${JSON.stringify(cp.checkpointId ?? null)} of session ${JSON.stringify(cp.sessionId)}: the risk descriptor's axes are ${axes.problem} — ${severity === undefined ? "the summary carries no severity" : `the summary's severity ${severity} is read from the valid marks`}`);
|
|
282
|
+
}
|
|
254
283
|
const cardReading = parkedApprovalCardOf(cp.gate);
|
|
255
284
|
const tool = cp.pendingAction.kind === "tool_approval" ? cp.pendingAction : undefined;
|
|
256
285
|
let toolInput;
|
|
@@ -266,21 +295,22 @@ export function summarizeCheckpoint(cp) {
|
|
|
266
295
|
}
|
|
267
296
|
}
|
|
268
297
|
const hasBidi = tool !== undefined &&
|
|
269
|
-
(
|
|
298
|
+
(facts.hasBidiControls === true ||
|
|
270
299
|
carriesBidiControls([toolInput, tool.preview], { maxNodes: BIDI_BACKFILL_MAX_NODES, maxChars: BIDI_BACKFILL_MAX_CHARS }));
|
|
271
300
|
return {
|
|
272
|
-
token:
|
|
301
|
+
token: facts.token,
|
|
273
302
|
...(cp.checkpointId !== undefined ? { checkpointId: cp.checkpointId } : {}),
|
|
274
|
-
sessionId:
|
|
275
|
-
scope:
|
|
276
|
-
gateKind:
|
|
303
|
+
sessionId: facts.sessionId,
|
|
304
|
+
scope: facts.scope,
|
|
305
|
+
gateKind: facts.gateKind,
|
|
277
306
|
...(severity !== undefined ? { severity } : {}),
|
|
278
307
|
...(cp.resourceLedger !== undefined ? { spentMicroUsd: cp.resourceLedger.spentMicroUsd } : {}),
|
|
279
|
-
...(
|
|
280
|
-
createdAt:
|
|
308
|
+
...(facts.deadline !== null ? { deadline: facts.deadline } : {}),
|
|
309
|
+
createdAt: facts.createdAt,
|
|
281
310
|
...(cp.sourceTaskId !== undefined ? { sourceTaskId: cp.sourceTaskId } : {}),
|
|
282
311
|
...(cp.principal !== undefined ? { principal: cp.principal } : {}),
|
|
283
|
-
...(
|
|
312
|
+
...(facts.toolCallId !== null ? { toolCallId: facts.toolCallId } : {}),
|
|
313
|
+
...(facts.toolName !== null ? { toolName: facts.toolName } : {}),
|
|
284
314
|
...(cardReading.kind === "card" ? { approvalCard: cardReading.card } : {}),
|
|
285
315
|
...(toolInput !== undefined ? { toolInput } : {}),
|
|
286
316
|
...(cp.state.workspaceHandle !== undefined
|
|
@@ -305,7 +335,7 @@ export function summarizeCheckpoint(cp) {
|
|
|
305
335
|
...(hasBidi ? { hasBidiControls: true } : {}),
|
|
306
336
|
};
|
|
307
337
|
}
|
|
308
|
-
export const CHECKPOINT_CONFIG_REFUSAL_CODES = Object.freeze(["config.spec_retired_key", "config.output_style_invalid", "config.permission_mode_invalid", "config.shell_gate_value_retired", "config.approval_reach_invalid", "config.user_invoked_skill_unknown", "config.skill_deny_unreadable", "config.user_attachment_invalid", "config.tool_face_control", "config.deps_retired_key", "config.peer_presence_invalid", "config.tool_model_gate_invalid", "config.microcompact_invalid", "config.prompt_selector_invalid", "resume_at.conflicts_resume", "resume_at.mode_without_target", "config.read_face_invalid", "config.write_face_invalid", "config.invalid_argument", "config.tool_face_invalid", "config.memory_delegation_evidence", "config.memory_provenance", "config.memory_capture_policy", "config.cross_boundary_posture", "config.auto_consolidation", "config.unknown_role", "config.tool_materialize_invalid", "config.memory_persistence_invalid", "config.tool_materialize_unreachable", "config.locked_registry", "config.locked_key", "config.mcp_content_class", "config.skill_listing_budget_invalid", "config.limit_unknown_key", "config.limit_invalid", "config.attachment_invalid", "config.usage_window_invalid", "config.brain_call_guardrail_invalid", "config.retention_policy", "config.retention_capability", "config.invalid_checkpoint_store", "config.skill_base_dir_invalid"]);
|
|
338
|
+
export const CHECKPOINT_CONFIG_REFUSAL_CODES = Object.freeze(["config.spec_retired_key", "config.output_style_invalid", "config.permission_mode_invalid", "config.shell_gate_value_retired", "config.approval_reach_invalid", "config.user_invoked_skill_unknown", "config.skill_deny_unreadable", "config.user_attachment_invalid", "config.tool_face_control", "config.deps_retired_key", "config.peer_presence_invalid", "config.tool_model_gate_invalid", "config.microcompact_invalid", "config.prompt_selector_invalid", "resume_at.conflicts_resume", "resume_at.mode_without_target", "config.read_face_invalid", "config.write_face_invalid", "config.invalid_argument", "config.tool_face_invalid", "config.memory_delegation_evidence", "config.memory_provenance", "config.memory_capture_policy", "config.cross_boundary_posture", "config.advisor_tool_invalid", "config.advisor_model_invalid", "config.auto_consolidation", "config.unknown_role", "config.tool_materialize_invalid", "config.memory_persistence_invalid", "config.tool_materialize_unreachable", "config.locked_registry", "config.locked_key", "config.mcp_content_class", "config.skill_listing_budget_invalid", "config.limit_unknown_key", "config.limit_invalid", "config.attachment_invalid", "config.usage_window_invalid", "config.brain_call_guardrail_invalid", "config.retention_policy", "config.retention_capability", "config.invalid_checkpoint_store", "config.skill_base_dir_invalid", "config.host_floor_invalid"]);
|
|
309
339
|
export const isCheckpointConfigRefusalCode = (word) => CHECKPOINT_CONFIG_REFUSAL_CODES.some((w) => w === word);
|
|
310
340
|
export class CheckpointError extends Error {
|
|
311
341
|
code;
|
|
@@ -339,56 +369,6 @@ export function encodeAtFidelity(fidelity, value) {
|
|
|
339
369
|
return { ok: false, cause: err };
|
|
340
370
|
}
|
|
341
371
|
}
|
|
342
|
-
const MAX_SAME_VALUE_DEPTH = 256;
|
|
343
|
-
export function samePlainValue(a, b) {
|
|
344
|
-
return sameValueAt(a, b, 0, new Map(), new Map());
|
|
345
|
-
}
|
|
346
|
-
function sameValueAt(a, b, depth, aToB, bToA) {
|
|
347
|
-
if (Object.is(a, b))
|
|
348
|
-
return true;
|
|
349
|
-
if (depth >= MAX_SAME_VALUE_DEPTH)
|
|
350
|
-
return false;
|
|
351
|
-
if (a === null || b === null || typeof a !== "object" || typeof b !== "object")
|
|
352
|
-
return false;
|
|
353
|
-
try {
|
|
354
|
-
const pairedWithA = aToB.get(a);
|
|
355
|
-
const pairedWithB = bToA.get(b);
|
|
356
|
-
if (pairedWithA !== undefined || pairedWithB !== undefined)
|
|
357
|
-
return pairedWithA === b && pairedWithB === a;
|
|
358
|
-
aToB.set(a, b);
|
|
359
|
-
bToA.set(b, a);
|
|
360
|
-
const proto = Object.getPrototypeOf(a);
|
|
361
|
-
if (proto !== Object.getPrototypeOf(b))
|
|
362
|
-
return false;
|
|
363
|
-
if (proto !== Object.prototype && proto !== Array.prototype)
|
|
364
|
-
return false;
|
|
365
|
-
if (Object.isExtensible(a) !== Object.isExtensible(b))
|
|
366
|
-
return false;
|
|
367
|
-
const ka = Reflect.ownKeys(a);
|
|
368
|
-
const kb = Reflect.ownKeys(b);
|
|
369
|
-
if (ka.length !== kb.length)
|
|
370
|
-
return false;
|
|
371
|
-
for (let i = 0; i < ka.length; i++) {
|
|
372
|
-
const k = ka[i];
|
|
373
|
-
if (k !== kb[i])
|
|
374
|
-
return false;
|
|
375
|
-
const da = Object.getOwnPropertyDescriptor(a, k);
|
|
376
|
-
const db = Object.getOwnPropertyDescriptor(b, k);
|
|
377
|
-
if (da === undefined || db === undefined)
|
|
378
|
-
return false;
|
|
379
|
-
if (!("value" in da) || !("value" in db))
|
|
380
|
-
return false;
|
|
381
|
-
if (da.enumerable !== db.enumerable || da.writable !== db.writable || da.configurable !== db.configurable)
|
|
382
|
-
return false;
|
|
383
|
-
if (!sameValueAt(da.value, db.value, depth + 1, aToB, bToA))
|
|
384
|
-
return false;
|
|
385
|
-
}
|
|
386
|
-
return true;
|
|
387
|
-
}
|
|
388
|
-
catch {
|
|
389
|
-
return false;
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
372
|
export function resolveCheckpointStore(spec, deps) {
|
|
393
373
|
if (Object.is(spec.checkpointStore, null))
|
|
394
374
|
throw retiredCheckpointStoreNull();
|
|
@@ -564,9 +544,6 @@ export function appendPendingSteer(state, entry) {
|
|
|
564
544
|
export function checkpointRowMatches(cp, scope, status) {
|
|
565
545
|
return cp !== undefined && cp.scope === scope && cp.status === status;
|
|
566
546
|
}
|
|
567
|
-
export function checkpointOccMatches(cp, expect) {
|
|
568
|
-
return expect === undefined || (cp.rev ?? 0) === expect.rev;
|
|
569
|
-
}
|
|
570
547
|
export class InMemoryCheckpointStore {
|
|
571
548
|
retention = "none";
|
|
572
549
|
durability = "process-local";
|
|
@@ -575,6 +552,18 @@ export class InMemoryCheckpointStore {
|
|
|
575
552
|
execution = { outcome: true };
|
|
576
553
|
cps = new Map();
|
|
577
554
|
fault = null;
|
|
555
|
+
disclose;
|
|
556
|
+
holderIsCurrent;
|
|
557
|
+
constructor(opts = {}) {
|
|
558
|
+
this.disclose = opts.disclose;
|
|
559
|
+
this.holderIsCurrent = opts.holderIsCurrent;
|
|
560
|
+
if (opts.holderIsCurrent !== undefined)
|
|
561
|
+
this.fence = Object.freeze({ holder: true });
|
|
562
|
+
const headOf = opts.sessionHeadOf;
|
|
563
|
+
if (headOf !== undefined) {
|
|
564
|
+
this.deleteSessionCheckpoints = (sessionId, guard) => deleteSessionRowsAtStart(this.cps, sessionId, guard, headOf, (token, row) => this.cps.get(token) === row && this.cps.delete(token));
|
|
565
|
+
}
|
|
566
|
+
}
|
|
578
567
|
async put(token, cp) {
|
|
579
568
|
if (this.cps.has(token)) {
|
|
580
569
|
throw new CheckpointError("checkpoint.already_exists", `checkpoint token already exists`);
|
|
@@ -592,7 +581,7 @@ export class InMemoryCheckpointStore {
|
|
|
592
581
|
claimed: false,
|
|
593
582
|
current: {
|
|
594
583
|
status: cp.status,
|
|
595
|
-
rev: cp
|
|
584
|
+
rev: checkpointRevOf(cp),
|
|
596
585
|
...(cp.resolvedOutcome !== undefined ? { resolvedOutcome: structuredClone(cp.resolvedOutcome) } : {}),
|
|
597
586
|
},
|
|
598
587
|
};
|
|
@@ -605,10 +594,13 @@ export class InMemoryCheckpointStore {
|
|
|
605
594
|
if (!checkpointOccMatches(cp, expect)) {
|
|
606
595
|
return this.claimLossFrom(cp, scope);
|
|
607
596
|
}
|
|
597
|
+
if (!checkpointHolderMatches(expect, this.holderIsCurrent)) {
|
|
598
|
+
return this.claimLossFrom(cp, scope);
|
|
599
|
+
}
|
|
608
600
|
const winner = winnerFromOutcome(outcome);
|
|
609
601
|
const winnerClone = winner ? structuredClone(winner) : undefined;
|
|
610
602
|
cp.status = "resolved";
|
|
611
|
-
cp.rev = (cp
|
|
603
|
+
cp.rev = checkpointRevOf(cp) + 1;
|
|
612
604
|
if (winnerClone)
|
|
613
605
|
cp.resolvedOutcome = winnerClone;
|
|
614
606
|
cp.reopenReason = undefined;
|
|
@@ -669,7 +661,7 @@ export class InMemoryCheckpointStore {
|
|
|
669
661
|
return false;
|
|
670
662
|
}
|
|
671
663
|
cp.status = "pending";
|
|
672
|
-
cp.rev = (cp
|
|
664
|
+
cp.rev = checkpointRevOf(cp) + 1;
|
|
673
665
|
cp.reopenReason = reason;
|
|
674
666
|
return true;
|
|
675
667
|
}
|
|
@@ -691,8 +683,7 @@ export class InMemoryCheckpointStore {
|
|
|
691
683
|
async reap(scope, cutoff) {
|
|
692
684
|
let n = 0;
|
|
693
685
|
for (const cp of this.cps.values()) {
|
|
694
|
-
|
|
695
|
-
if (cp.scope === scope && cp.status === "pending" && deadlinePassed) {
|
|
686
|
+
if (cp.scope === scope && cp.status === "pending" && checkpointDeadlinePassed(cp.deadline, cutoff)) {
|
|
696
687
|
cp.status = "expired";
|
|
697
688
|
n++;
|
|
698
689
|
}
|
|
@@ -703,7 +694,7 @@ export class InMemoryCheckpointStore {
|
|
|
703
694
|
const out = [];
|
|
704
695
|
for (const cp of this.cps.values()) {
|
|
705
696
|
if (cp.scope === scope && cp.status === "pending")
|
|
706
|
-
out.push(summarizeCheckpoint(cp));
|
|
697
|
+
out.push(summarizeCheckpoint(cp, this.disclose));
|
|
707
698
|
}
|
|
708
699
|
return out;
|
|
709
700
|
}
|
|
@@ -714,6 +705,12 @@ export class InMemoryCheckpointStore {
|
|
|
714
705
|
out.add(cp.scope);
|
|
715
706
|
return [...out];
|
|
716
707
|
}
|
|
708
|
+
async listOverdue(query) {
|
|
709
|
+
return selectOverduePage(this.cps.entries(), readCheckpointOverdueQuery(query), (cp) => summarizeCheckpoint(cp, this.disclose), this.disclose);
|
|
710
|
+
}
|
|
711
|
+
async listBySession(query) {
|
|
712
|
+
return selectSessionPage(this.cps.entries(), readCheckpointSessionQuery(query), (cp) => structuredClone(cp), this.disclose);
|
|
713
|
+
}
|
|
717
714
|
testInjectFault(mode) {
|
|
718
715
|
this.fault = mode;
|
|
719
716
|
}
|
|
@@ -131,6 +131,12 @@ export declare const CLAMP_SET: Readonly<{
|
|
|
131
131
|
readonly script: false;
|
|
132
132
|
readonly carrier: "specSeat";
|
|
133
133
|
}>;
|
|
134
|
+
projectMemory: Readonly<{
|
|
135
|
+
readonly law: "restricting";
|
|
136
|
+
readonly value: "disabled";
|
|
137
|
+
readonly script: false;
|
|
138
|
+
readonly carrier: "specSeat";
|
|
139
|
+
}>;
|
|
134
140
|
promptForm: Readonly<{
|
|
135
141
|
readonly law: "restricting";
|
|
136
142
|
readonly value: "minimal";
|
|
@@ -9,29 +9,15 @@ function complianceIdentity(cap) {
|
|
|
9
9
|
}
|
|
10
10
|
const MAX_SCRIPT_LIST_ENTRIES = 16;
|
|
11
11
|
const MAX_SCRIPT_ENTRY_CHARS = 256;
|
|
12
|
-
const MAX_SCRIPT_DENY_WILDCARDS_PER_SEGMENT = 1;
|
|
13
12
|
function assertScriptEntryLength(text, at, what, why) {
|
|
14
13
|
if (text.length > MAX_SCRIPT_ENTRY_CHARS)
|
|
15
14
|
throw new Error(`${at} is ${text.length} characters — a workflow script's ${what} is limited to ${MAX_SCRIPT_ENTRY_CHARS} (${why}).`);
|
|
16
15
|
}
|
|
17
|
-
function assertScriptDenyPatternBounded(pattern, at) {
|
|
18
|
-
assertScriptEntryLength(pattern, at, "deny pattern", "the matcher runs on every read of the child's run");
|
|
19
|
-
for (const segment of pattern.split("/")) {
|
|
20
|
-
const wildcards = segment.split("*").length - 1;
|
|
21
|
-
if (wildcards > MAX_SCRIPT_DENY_WILDCARDS_PER_SEGMENT) {
|
|
22
|
-
throw new Error(`${at} has a path segment with ${wildcards} \`*\` wildcards — a workflow script's deny pattern allows at most ` +
|
|
23
|
-
`${MAX_SCRIPT_DENY_WILDCARDS_PER_SEGMENT} per path segment (the same expressiveness the engine's built-in deny table ` +
|
|
24
|
-
`uses). Each \`*\` compiles to a greedy match, and more than one in a single segment makes the judgment cost grow ` +
|
|
25
|
-
`superlinearly with the path length, on every read the child performs. Write the intent as separate entries ` +
|
|
26
|
-
`(the set is a union, so more entries deny strictly more) or anchor it with literal segments.`);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
16
|
function readDenyScriptEntry(el, at) {
|
|
31
17
|
if (typeof el === "string") {
|
|
32
18
|
if (el.length === 0)
|
|
33
19
|
throw new Error(`${at} must be a non-empty pattern string`);
|
|
34
|
-
|
|
20
|
+
assertScriptEntryLength(el, at, "deny pattern", "the matcher runs on every read of the child's run");
|
|
35
21
|
return el;
|
|
36
22
|
}
|
|
37
23
|
if (typeof el !== "object" || el === null || Array.isArray(el))
|
|
@@ -43,7 +29,7 @@ function readDenyScriptEntry(el, at) {
|
|
|
43
29
|
throw new Error(`${at}.pattern must be a non-empty string, e.g. ".ssh" or "secrets/*.json"`);
|
|
44
30
|
if (caseSensitive !== undefined && typeof caseSensitive !== "boolean")
|
|
45
31
|
throw new Error(`${at}.caseSensitive must be a boolean`);
|
|
46
|
-
|
|
32
|
+
assertScriptEntryLength(pattern, at, "deny pattern", "the matcher runs on every read of the child's run");
|
|
47
33
|
return caseSensitive === undefined ? { pattern } : { pattern, caseSensitive };
|
|
48
34
|
}
|
|
49
35
|
function writeProtectedScriptEntry(el, at) {
|
|
@@ -101,6 +87,7 @@ export const CLAMP_SET = Object.freeze({
|
|
|
101
87
|
oneShot: Object.freeze({ law: "restricting", value: true, script: true, carrier: "specSeat" }),
|
|
102
88
|
memoryPersistenceCapable: Object.freeze({ law: "restricting", value: false, script: true, carrier: "specSeat" }),
|
|
103
89
|
fileHistory: Object.freeze({ law: "restricting", value: "disabled", script: false, carrier: "specSeat" }),
|
|
90
|
+
projectMemory: Object.freeze({ law: "restricting", value: "disabled", script: false, carrier: "specSeat" }),
|
|
104
91
|
promptForm: Object.freeze({ law: "restricting", value: "minimal", script: false, carrier: "specSeat" }),
|
|
105
92
|
memory: Object.freeze({ law: "restricting", field: "enabled", value: false, script: false, carrier: "specSeat" }),
|
|
106
93
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Closed compliance profile set (
|
|
1
|
+
/** Closed compliance profile set (policy-limits profiles). */
|
|
2
2
|
export type ComplianceProfile = "hipaa" | "zdr";
|
|
3
3
|
/** Closed capability set the ENGINE can veto end-to-end (see the module header for the entry-point
|
|
4
4
|
* map — a capability is admitted here only with its full interception story). */
|
|
@@ -17,7 +17,7 @@ export interface CompliancePosture {
|
|
|
17
17
|
additionalDenies?: readonly ComplianceCapability[];
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
|
-
* Builtin per-profile deny floors, mapped from the
|
|
20
|
+
* Builtin per-profile deny floors, mapped from the policy-limits pair table onto the
|
|
21
21
|
* capabilities this engine manages: hipaa denies `allow_web_fetch` ⇒ `web_fetch`. (CC's
|
|
22
22
|
* `allow_memory_sync` row maps onto the org-memory plane and joins this table together with the
|
|
23
23
|
* memory-admission seam; CC has no MCP/workflow rows — those stay reachable via `additionalDenies`.)
|
|
@@ -10,7 +10,7 @@ import { type ContextWindowOverlay } from "./context-settings.js";
|
|
|
10
10
|
*/
|
|
11
11
|
export declare const EDIT_FRACTION = 0.7;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Trigger geometry: the reactive autocompact trigger sits a
|
|
14
14
|
* FIXED DISTANCE below the window, not at a fixed fraction —
|
|
15
15
|
* effectiveWindow = autocompactWindow − min(maxOutputTokens, 20000) (CC `Nye`, cap `uMd`)
|
|
16
16
|
* trigger = effectiveWindow − 13000 (CC `dSo`, buffer `rMd`)
|
|
@@ -18,7 +18,7 @@ export declare const EDIT_FRACTION = 0.7;
|
|
|
18
18
|
* 167000 (83.5% of nominal), a 1M window at 967000.
|
|
19
19
|
*
|
|
20
20
|
* 1M DIVERGENCE, stated as fact rather than as an equivalence (anchoring re-check 2026-08-23): CC
|
|
21
|
-
* carries a MODEL-DEFAULT autocompact-window table (
|
|
21
|
+
* carries a MODEL-DEFAULT autocompact-window table (`claude-sonnet-5`
|
|
22
22
|
* default 967000, and since 223 a surface dimension: `remote_cowork` / `local-agent` 500000), so a
|
|
23
23
|
* 1M sonnet-5 gets 967000 as its window and 934000 as its trigger WITHOUT anyone configuring
|
|
24
24
|
* anything. We ship no such table: a model declaring only `contextWindow: 1e6` triggers at 967000
|
|
@@ -52,14 +52,14 @@ export declare function contextEditFrontier(window: number): number;
|
|
|
52
52
|
/**
|
|
53
53
|
* The `RunnerDeps.microCompact.machine` vocabulary — ONE clearing machine, switchable:
|
|
54
54
|
*
|
|
55
|
-
* - `"cc"` (default): the
|
|
55
|
+
* - `"cc"` (default): the reference's machine — keep 5, a ≥20000-token minimum-savings gate
|
|
56
56
|
* (below it the pass is a byte-identical no-op), ONE deep clear of everything beyond the keep
|
|
57
57
|
* window, the window base counts already-cleared/offloaded occurrences (they hold their keep
|
|
58
58
|
* slots), and CC's plain marker bytes.
|
|
59
59
|
* - `"off"`: no proactive frontier clearing; the machine gets its one shot at the blocking point
|
|
60
60
|
* of the guard chain instead (trace trigger `"blocking"`).
|
|
61
61
|
*
|
|
62
|
-
* WHOLE-MACHINE CROSS-CHECK against the
|
|
62
|
+
* WHOLE-MACHINE CROSS-CHECK against the reference corpus (design/374 slice 4 — the "the knob number
|
|
63
63
|
* was copied, the machine was not" disease is checked by naming the machine's parts, not the one
|
|
64
64
|
* number). CC's four load-bearing parts, each against its 250 coordinate, all verified present here:
|
|
65
65
|
* ① the ≥20000-token minimum-savings gate — {@link MIN_CLEAR_SAVINGS_TOKENS} vs `Mnn`
|
|
@@ -70,7 +70,7 @@ export declare function contextEditFrontier(window: number): number;
|
|
|
70
70
|
* re-resolved member-by-member off the 250 corpus, byte-identical (see that constant).
|
|
71
71
|
* ③ cleared-but-recoverable — CC replaces the content with a POINTER, not a void
|
|
72
72
|
* (`<persisted-output>Tool result saved to: {path}\n\nUse Read to view</persisted-output>`,
|
|
73
|
-
*
|
|
73
|
+
* cli296.js:219492: "Tool result saved to: "), which is what makes a keep window of 5 survivable at all. Ours is the same
|
|
74
74
|
* construction in this engine's carrier: the full text is offloaded first and the marker
|
|
75
75
|
* carries the store ref ({@link ContextEditOptions.offload} → {@link clearOneResult}), read
|
|
76
76
|
* back through ReadToolResult instead of a filesystem path (registered divergence D-9). The
|
|
@@ -92,8 +92,7 @@ export declare const MICRO_COMPACT_MACHINES: readonly ["off", "cc"];
|
|
|
92
92
|
export type MicroCompactMachine = (typeof MICRO_COMPACT_MACHINES)[number];
|
|
93
93
|
/**
|
|
94
94
|
* How many most-recent CANDIDATE tool results keep their content when the stale-result pass runs:
|
|
95
|
-
* 5 (
|
|
96
|
-
* the same value — zero drift across 245→250; same value again on CC 88's `timeBasedMCConfig`, i.e.
|
|
95
|
+
* 5 (the reference's hard-coded constant beside its call site; the same value in every corpus generation checked, i.e.
|
|
97
96
|
* stable across all three corpus generations, and it is a hard-coded constant upstream, not a
|
|
98
97
|
* setting). The #384 adjudication adopted 5 CONDITIONAL on the whole machine coming with it (20k
|
|
99
98
|
* gate + deep clear + re-ordered backstops); the machine carries that condition (§3.5: the gate
|
|
@@ -58,6 +58,9 @@ export interface BoundaryLegsGiven {
|
|
|
58
58
|
readonly externalContentTarget?: boolean;
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
|
+
/** What a leg's session is still owed when the leg ends: the legs each unfinished background task its access (the TaskOutput reach) delivers
|
|
62
|
+
* along, read as the poll the session's next leg — another tree — would make of it (`TaskRegistry.owedDeliveries`). */
|
|
63
|
+
export type OwedDeliveries = () => readonly BoundaryLegsGiven[];
|
|
61
64
|
declare const CROSS_BOUNDARY_TREE_TOKEN: unique symbol;
|
|
62
65
|
/** A run tree's cross-boundary IDENTITY — opaque and frozen, minted by the engine alone: a tool is handed it so a delegation or
|
|
63
66
|
* workflow lane can join its children to the same tree and a registry handle can name the tree that spawned it, compared by
|
|
@@ -88,7 +91,8 @@ export interface CrossBoundaryCheck {
|
|
|
88
91
|
/** This call's obligation under the tree's state at this moment (the station reads it on the final arguments). */
|
|
89
92
|
obligation(call: CrossBoundaryCall): CrossBoundaryObligation;
|
|
90
93
|
/** The allow exit's rule, on the bytes that run and the party that decided: re-reads the obligation; a mandate the decider cannot
|
|
91
|
-
* answer refuses; otherwise the off-target-read bit the call owes is
|
|
94
|
+
* answer refuses; otherwise the session record carrying the off-target-read bit the call owes is written, and the bit joins the
|
|
95
|
+
* tree, before it runs — a call the exit refuses joins nothing. */
|
|
92
96
|
exit(call: CrossBoundaryCall, decidedBy: HostDecider): Promise<CrossBoundaryExitRefusal | undefined>;
|
|
93
97
|
}
|
|
94
98
|
/** The gate input's seat for {@link CrossBoundaryCheck}: present on a leg whose station is ENGAGED (a posture is declared, the leg runs
|
|
@@ -183,9 +187,12 @@ export declare function crossBoundaryPostureUndeclaredNotice(at: {
|
|
|
183
187
|
readonly tree: CrossBoundaryTree;
|
|
184
188
|
}): EngineNotice;
|
|
185
189
|
/** Where a session record's write was owed: a leg's prepare, an exit before its call runs, a suspend before its row, a settle. */
|
|
186
|
-
export type CrossBoundaryRecordPhase = "prepare" | "exit" | "suspend" | "settle";
|
|
187
|
-
|
|
188
|
-
*
|
|
190
|
+
export type CrossBoundaryRecordPhase = "prepare" | "exit" | "suspend" | "settle";
|
|
191
|
+
/** The one mint of `config.cross_boundary_record_unwritten`: a session record that could not be written and refused nothing — on a tree
|
|
192
|
+
* that is not governed (no judgment reads the record), or at a governed leg's prepare / settle (no call to refuse). On a governed tree
|
|
193
|
+
* the record stays owed: a prepare's by the leg's next write, and once none lands — a settle's failure is the leg's last — the next leg
|
|
194
|
+
* reads the content after the newest record as off-target. A governed exit refuses its call and a governed suspend its row instead.
|
|
195
|
+
* Minted once per state a leg could not write. */
|
|
189
196
|
export declare function crossBoundaryRecordUnwrittenNotice(at: {
|
|
190
197
|
readonly sessionId: string;
|
|
191
198
|
readonly runId: string;
|
|
@@ -155,9 +155,9 @@ export function crossBoundaryRecordUnwrittenNotice(at) {
|
|
|
155
155
|
return {
|
|
156
156
|
code: "config.cross_boundary_record_unwritten",
|
|
157
157
|
message: `The session's cross-boundary record could not be written at ${at.phase} (${at.cause.slice(0, 300)}) — ` +
|
|
158
|
-
(at.governed
|
|
159
|
-
? "the tree is governed: the
|
|
160
|
-
:
|
|
158
|
+
(!at.governed
|
|
159
|
+
? "the tree is not governed: no judgment reads the record, so its failure refused nothing; the tree's growth, or the leg's end, writes next, and a failure of this same state is not reported again."
|
|
160
|
+
: `the tree is governed: ${at.phase === "prepare" ? "the leg's next write (an exit before its call runs, a suspend before its row, its end) owes the record again; if none lands, " : ""}the next leg on this session reads the content after its newest record as off-target, so its device calls are put to a person.`),
|
|
161
161
|
detail: { sessionId: at.sessionId, runId: at.runId, phase: at.phase, governed: at.governed, cause: at.cause.slice(0, 300) },
|
|
162
162
|
};
|
|
163
163
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AssertAllKeysHandled } from "./ask-origin.js";
|
|
2
2
|
import type { DecisionMember, PermissionResult } from "./tool-policy.js";
|
|
3
3
|
export declare const refusedOutOfContract: (message: string) => PermissionResult;
|
|
4
4
|
/** Is `d` a refusal the engine itself minted (by object identity — a look-alike `deny` a caller built is not one)? The receipt's
|
|
@@ -47,14 +47,48 @@ export declare const DECISION_MEMBER_ARMS: Readonly<{
|
|
|
47
47
|
readonly origin: readonly ["ask"];
|
|
48
48
|
readonly askClass: readonly ["ask"];
|
|
49
49
|
readonly classes: readonly ["ask"];
|
|
50
|
-
readonly guards: readonly ["ask"];
|
|
51
50
|
readonly ruleUnreadable: readonly ["ask"];
|
|
52
51
|
readonly authoredBy: readonly ["ask"];
|
|
53
|
-
readonly
|
|
52
|
+
readonly editRewritten: readonly ["ask"];
|
|
54
53
|
}>;
|
|
55
54
|
export type DecisionMemberArmsCoverTheUnion = AssertAllKeysHandled<{
|
|
56
55
|
[M in DecisionMember]: Exclude<ArmOf<M>, (typeof DECISION_MEMBER_ARMS)[M][number]>;
|
|
57
56
|
}[DecisionMember]>;
|
|
57
|
+
/**
|
|
58
|
+
* WHO writes each member of the decision union — one writer per fact, one table (fenced to the union like
|
|
59
|
+
* {@link DECISION_MEMBER_ARMS}: a member the union gains without a row is a type error):
|
|
60
|
+
* · `composer` — the policy's or hook's own statement about its question: received, and read as an input of the class derivation;
|
|
61
|
+
* · `record` — the engine's attestation record (`attestation`): taken by reference after its brand check, read for its call;
|
|
62
|
+
* · `stamp` — written by the gate after the receipt (the disclosed words of the classes the engine derives, the allow layer's
|
|
63
|
+
* and the rule lane's accounts): no composer writes one, so a decision that states one is refused by name.
|
|
64
|
+
*/
|
|
65
|
+
export declare const DECISION_MEMBER_WRITERS: Readonly<{
|
|
66
|
+
readonly action: "composer";
|
|
67
|
+
readonly updatedInput: "composer";
|
|
68
|
+
readonly message: "composer";
|
|
69
|
+
readonly decisionReason: "composer";
|
|
70
|
+
readonly attestation: "record";
|
|
71
|
+
readonly requiresRealApproval: "composer";
|
|
72
|
+
readonly denialLimitFallback: "composer";
|
|
73
|
+
readonly classifierNoRuling: "composer";
|
|
74
|
+
readonly allowRuleShadowed: "stamp";
|
|
75
|
+
readonly probeReason: "composer";
|
|
76
|
+
readonly probeCause: "composer";
|
|
77
|
+
readonly probeMandated: "composer";
|
|
78
|
+
readonly crossBoundaryMandated: "composer";
|
|
79
|
+
readonly mandated: "composer";
|
|
80
|
+
readonly mandate: "stamp";
|
|
81
|
+
readonly probeReadRootCandidate: "composer";
|
|
82
|
+
readonly matchedAskRule: "composer";
|
|
83
|
+
readonly ruleEvidence: "stamp";
|
|
84
|
+
readonly segmentCoverage: "stamp";
|
|
85
|
+
readonly origin: "stamp";
|
|
86
|
+
readonly askClass: "stamp";
|
|
87
|
+
readonly classes: "stamp";
|
|
88
|
+
readonly ruleUnreadable: "composer";
|
|
89
|
+
readonly authoredBy: "composer";
|
|
90
|
+
readonly editRewritten: "composer";
|
|
91
|
+
}>;
|
|
58
92
|
export declare const RETIRED_WINDOW_MEMBER_DENY_MESSAGE: string;
|
|
59
93
|
export declare const carriesRetiredWindow: (fallback: unknown) => boolean;
|
|
60
94
|
/**
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { types } from "node:util";
|
|
2
|
-
import {
|
|
3
|
-
import { AUTO_MODE_FALLBACK_CAUSES, isAutoModeFallbackCause } from "./auto-mode.js";
|
|
2
|
+
import { AUTO_MODE_FALLBACK_CAUSES, isAutoModeFallbackCause, isDenialLimitBound } from "./auto-mode.js";
|
|
4
3
|
import { thrownText } from "./thrown-value.js";
|
|
5
4
|
const ENGINE_REFUSALS = new WeakSet();
|
|
6
5
|
export const refusedOutOfContract = (message) => {
|
|
@@ -11,7 +10,6 @@ export const refusedOutOfContract = (message) => {
|
|
|
11
10
|
export const isEngineRefusal = (d) => typeof d === "object" && d !== null && ENGINE_REFUSALS.has(d);
|
|
12
11
|
const DECISION_REASONS = Object.freeze(["rule", "mode", "hook", "safety", "classifier", "persisted_rule", "sandbox", "org_rule", "org_unavailable", "read_only", "skill", "deployment_rule", "request_rule"]);
|
|
13
12
|
const DECISION_ACTIONS = Object.keys({ allow: 0, deny: 0, ask: 0 });
|
|
14
|
-
const GUARDS = Object.keys({ dangerous_delete: 0, unverifiable_delete: 0, unverifiable_shell_text: 0, transcript_write: 0, artifact_shared_read: 0 });
|
|
15
13
|
const RULE_UNREADABLE_WORDS = Object.keys({ content_deny: 0, content_ask: 0, persisted_call: 0, persisted_rows: 0 });
|
|
16
14
|
const AUTHORED_BY_WORDS = Object.keys({ deployment: 0 });
|
|
17
15
|
const memberOf = (words) => {
|
|
@@ -21,12 +19,6 @@ const memberOf = (words) => {
|
|
|
21
19
|
const CLOSED_MEMBERS = [
|
|
22
20
|
{ member: "action", words: DECISION_ACTIONS, has: memberOf(DECISION_ACTIONS), required: true },
|
|
23
21
|
{ member: "decisionReason", words: DECISION_REASONS, has: memberOf(DECISION_REASONS) },
|
|
24
|
-
{ member: "origin", words: ASK_ORIGINS, has: isAskOrigin },
|
|
25
|
-
{ member: "askClass", words: ASK_CLASSES, has: isAskClass },
|
|
26
|
-
{ member: "classes", words: ASK_CLASSES, has: isAskClass, list: true },
|
|
27
|
-
{ member: "foldedAskClasses", words: ASK_CLASSES, has: isAskClass, list: true },
|
|
28
|
-
{ member: "mandate", words: PERSISTED_RULE_MANDATES, has: isPersistedRuleMandate },
|
|
29
|
-
{ member: "guards", words: GUARDS, has: memberOf(GUARDS), list: true },
|
|
30
22
|
{ member: "ruleUnreadable", words: RULE_UNREADABLE_WORDS, has: memberOf(RULE_UNREADABLE_WORDS) },
|
|
31
23
|
{ member: "authoredBy", words: AUTHORED_BY_WORDS, has: memberOf(AUTHORED_BY_WORDS) },
|
|
32
24
|
{ member: "classifierNoRuling", words: AUTO_MODE_FALLBACK_CAUSES, has: isAutoModeFallbackCause },
|
|
@@ -41,8 +33,17 @@ export const DECISION_MEMBER_ARMS = Object.freeze({
|
|
|
41
33
|
action: EVERY_ARM, updatedInput: EVERY_ARM, message: EVERY_ARM, decisionReason: EVERY_ARM, attestation: EVERY_ARM,
|
|
42
34
|
requiresRealApproval: ASK, denialLimitFallback: ASK, classifierNoRuling: ASK, allowRuleShadowed: ASK, probeReason: ASK, probeCause: ASK,
|
|
43
35
|
probeMandated: ASK, crossBoundaryMandated: ASK, mandated: ASK, mandate: ASK, probeReadRootCandidate: ASK, matchedAskRule: ASK, ruleEvidence: ASK,
|
|
44
|
-
segmentCoverage: ASK, origin: ASK, askClass: ASK, classes: ASK,
|
|
36
|
+
segmentCoverage: ASK, origin: ASK, askClass: ASK, classes: ASK, ruleUnreadable: ASK, authoredBy: ASK,
|
|
37
|
+
editRewritten: ASK,
|
|
45
38
|
});
|
|
39
|
+
export const DECISION_MEMBER_WRITERS = Object.freeze({
|
|
40
|
+
action: "composer", updatedInput: "composer", message: "composer", decisionReason: "composer", attestation: "record",
|
|
41
|
+
requiresRealApproval: "composer", denialLimitFallback: "composer", classifierNoRuling: "composer", allowRuleShadowed: "stamp", probeReason: "composer",
|
|
42
|
+
probeCause: "composer", probeMandated: "composer", crossBoundaryMandated: "composer", mandated: "composer", mandate: "stamp",
|
|
43
|
+
probeReadRootCandidate: "composer", matchedAskRule: "composer", ruleEvidence: "stamp", segmentCoverage: "stamp", origin: "stamp", askClass: "stamp",
|
|
44
|
+
classes: "stamp", ruleUnreadable: "composer", authoredBy: "composer", editRewritten: "composer",
|
|
45
|
+
});
|
|
46
|
+
const STAMP_MEMBERS = Object.keys(DECISION_MEMBER_WRITERS).filter((m) => DECISION_MEMBER_WRITERS[m] === "stamp");
|
|
46
47
|
const RETIRED_WINDOW_MEMBER = "autoDenyAfterMs";
|
|
47
48
|
export const RETIRED_WINDOW_MEMBER_DENY_MESSAGE = `a permission decision's "denialLimitFallback" carries "${RETIRED_WINDOW_MEMBER}" — the decision names the counts only; ` +
|
|
48
49
|
`the auto-deny window is decided by the ask's route (a live approver arms it, every other route runs none) and cannot be ` +
|
|
@@ -59,10 +60,11 @@ const NESTED_CONTRACTS = [
|
|
|
59
60
|
{ holder: "", member: "probeCause", members: Object.keys({ code: 0, roots: 0, further: 0 }), required: Object.keys({ code: 0, roots: 0 }) },
|
|
60
61
|
{ holder: "probeCause.", member: "roots", members: OPERAND_MEMBERS, required: OPERAND_MEMBERS },
|
|
61
62
|
{ holder: "probeCause.", member: "further", members: OPERAND_MEMBERS, required: OPERAND_MEMBERS },
|
|
63
|
+
{ holder: "", member: "editRewritten", members: Object.keys({ acceptableForm: 0 }), required: Object.keys({ acceptableForm: 0 }) },
|
|
62
64
|
];
|
|
63
65
|
const nonNegativeInteger = (v) => typeof v === "number" && Number.isInteger(v) && v >= 0;
|
|
64
66
|
const NESTED_VALUE_FENCES = {
|
|
65
|
-
denialLimitFallback: { consecutive: nonNegativeInteger, total: nonNegativeInteger, limit:
|
|
67
|
+
denialLimitFallback: { consecutive: nonNegativeInteger, total: nonNegativeInteger, limit: isDenialLimitBound },
|
|
66
68
|
probeCause: { code: (v) => typeof v === "string" && v.length > 0 },
|
|
67
69
|
"probeCause.roots": { total: nonNegativeInteger },
|
|
68
70
|
"probeCause.further": { total: nonNegativeInteger },
|
|
@@ -80,7 +82,12 @@ function renderForeignValue(v) {
|
|
|
80
82
|
}
|
|
81
83
|
}
|
|
82
84
|
export function screenContractValues(contract, opts) {
|
|
83
|
-
|
|
85
|
+
const stamped = STAMP_MEMBERS.find((m) => contract[m] !== undefined);
|
|
86
|
+
if (stamped !== undefined) {
|
|
87
|
+
return refusedOutOfContract(`a permission decision carries "${stamped}" — the member is written by the gate after a policy answers (the disclosed account of what the engine's own layers found); ` +
|
|
88
|
+
`a policy states its question through its own members (requiresRealApproval, authoredBy, matchedAskRule, …); denied fail-closed rather than carrying a value the gate replaces`);
|
|
89
|
+
}
|
|
90
|
+
for (const { member, words, has, required } of CLOSED_MEMBERS) {
|
|
84
91
|
if (opts?.skip?.has(member) === true)
|
|
85
92
|
continue;
|
|
86
93
|
const v = contract[member];
|
|
@@ -89,13 +96,6 @@ export function screenContractValues(contract, opts) {
|
|
|
89
96
|
return refusedOutOfContract(`a permission decision's "${member}" is absent — the closed set is ${words.join("/")}; denied fail-closed rather than reading a word outside it as an allow`);
|
|
90
97
|
continue;
|
|
91
98
|
}
|
|
92
|
-
if (list === true) {
|
|
93
|
-
const received = receiveList(v, member, words, has);
|
|
94
|
-
if (received.kind === "refused")
|
|
95
|
-
return received.refused;
|
|
96
|
-
contract[member] = received.held;
|
|
97
|
-
continue;
|
|
98
|
-
}
|
|
99
99
|
if (has(v))
|
|
100
100
|
continue;
|
|
101
101
|
return unrecognized(member, v, words);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** The delegation factory's mint: `result`'s `details` object is a refusal before any child ran. Returns `result` as it is. */
|
|
2
|
+
export declare function notStartedResult<T extends object>(result: T): T;
|
|
3
|
+
/** An engine copy's carry: the engine's `copy` of a receipted object holds the receipt too. Anything else carries nothing. */
|
|
4
|
+
export declare function carryNotStartedReceipt(original: unknown, copy: unknown): void;
|
|
5
|
+
/** Is `result` one of the delegation tool's refusals before any child ran — by the receipt on its `details` object alone? */
|
|
6
|
+
export declare function isNotStartedDelegationResult(result: unknown): boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const NOT_STARTED_RECEIPTS = new WeakSet();
|
|
2
|
+
export function notStartedResult(result) {
|
|
3
|
+
const details = result.details;
|
|
4
|
+
if (typeof details === "object" && details !== null)
|
|
5
|
+
NOT_STARTED_RECEIPTS.add(details);
|
|
6
|
+
return result;
|
|
7
|
+
}
|
|
8
|
+
export function carryNotStartedReceipt(original, copy) {
|
|
9
|
+
if (typeof original === "object" && original !== null && typeof copy === "object" && copy !== null && NOT_STARTED_RECEIPTS.has(original))
|
|
10
|
+
NOT_STARTED_RECEIPTS.add(copy);
|
|
11
|
+
}
|
|
12
|
+
export function isNotStartedDelegationResult(result) {
|
|
13
|
+
if (typeof result !== "object" || result === null)
|
|
14
|
+
return false;
|
|
15
|
+
const details = result.details;
|
|
16
|
+
return typeof details === "object" && details !== null && NOT_STARTED_RECEIPTS.has(details);
|
|
17
|
+
}
|