@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
|
@@ -65,7 +65,7 @@ export interface ToolPathBases {
|
|
|
65
65
|
*/
|
|
66
66
|
export declare function pathTargetBaseOf(pt: Pick<ToolCallPathTarget, "base"> | undefined, bases: ToolPathBases): string | undefined;
|
|
67
67
|
/**
|
|
68
|
-
* design/116 批④ #8
|
|
68
|
+
* design/116 批④ #8 — decompose an ABSOLUTE glob pattern into a base
|
|
69
69
|
* directory + relative pattern: cut at the last separator before the first glob metachar (`* ? [ {`); a
|
|
70
70
|
* pattern with no metachar splits dirname/basename. `undefined` for a relative pattern (the caller keeps it
|
|
71
71
|
* as-is) or when no usable base can be derived; a namespace refusal ({@link win32NamespaceScreen}, run
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The engine's ATTESTATION record — the one carrier of what an engine station knows about a decision and a policy cannot
|
|
3
|
+
* state: WHO settled the call's wait and WHICH question that answered (the settlement, the ask's origin word and class set,
|
|
4
|
+
* the digest of the arguments the answer licenses), and the facts the classifier stations, the in-fold unresolvable arms,
|
|
5
|
+
* the integrity guards and the policy fold record. It rides the decision as its `attestation` member and is read through
|
|
6
|
+
* {@link attestationOf} alone; the decision object's identity carries nothing.
|
|
7
|
+
*
|
|
8
|
+
* Minted only by {@link mintAttestation} and combined only by {@link mergeAttestation}: both freeze the record and enter it
|
|
9
|
+
* in a module-private brand set, so a value a caller composed — a literal, a copy, a structured clone — is not a record, and
|
|
10
|
+
* the decision receipt refuses a decision carrying one. A record is bound to the call it was minted for (`toolCallId` +
|
|
11
|
+
* `toolName`): handed back for another call it reads as absent. A spread of a decision keeps its record, and the record still
|
|
12
|
+
* says only what the engine minted — a refusal record on an allow is a contradiction the gate's exit refuses, and a
|
|
13
|
+
* resolution's answer binds the arguments it licensed (`inputDigest`).
|
|
14
|
+
*
|
|
15
|
+
* A leaf (type-only imports): the decision module that receives a record and the class derivation that reads one for its call
|
|
16
|
+
* both depend on it, and neither depends on the other through it.
|
|
17
|
+
*/
|
|
18
|
+
import type { AskClass, AskOrigin } from "./ask-origin.js";
|
|
19
|
+
import type { ClassifierDenyCause, Settlement } from "./gate-outcome.js";
|
|
20
|
+
import type { AutoModeClassifierRound } from "./auto-mode.js";
|
|
21
|
+
import type { AskUnresolvableCause } from "./ask-unresolvable-notice.js";
|
|
22
|
+
import type { PathDenialEvidence } from "../tools/fs/safety.js";
|
|
23
|
+
import type { AskGuard } from "./tool-policy.js";
|
|
24
|
+
export interface EngineAttestation {
|
|
25
|
+
readonly toolCallId: string;
|
|
26
|
+
readonly toolName: string;
|
|
27
|
+
/** What ended the call's wait. The answer group — `settlement`, `origin`, `classes`, `inputDigest` — travels as one. */
|
|
28
|
+
readonly settlement?: Settlement;
|
|
29
|
+
/** The settled ask's origin word. */
|
|
30
|
+
readonly origin?: AskOrigin;
|
|
31
|
+
/** The settled ask's class set (`ASK_CLASSES` order), when the minting station held one. */
|
|
32
|
+
readonly classes?: readonly AskClass[];
|
|
33
|
+
/** `exactBoundInputHashOf` of the arguments the settlement licenses (an approver's edit, the snapshot shown, or the asked
|
|
34
|
+
* args); absent when they have none (outside the bindable domain) — such a record licenses no bytes. */
|
|
35
|
+
readonly inputDigest?: string;
|
|
36
|
+
/** The FORM of a classifier round that did not rule (a classifier deny's cause). */
|
|
37
|
+
readonly classifierCause?: ClassifierDenyCause;
|
|
38
|
+
/** WHICH model answered a classification, on either arm. */
|
|
39
|
+
readonly classifierRound?: AutoModeClassifierRound;
|
|
40
|
+
/** Why an in-fold deny refused an ask nobody could resolve. */
|
|
41
|
+
readonly unresolvableCause?: AskUnresolvableCause;
|
|
42
|
+
/** The classes of the OTHER asks a policy fold collapsed into this one (each contributor's classes, unioned) — so a fact the
|
|
43
|
+
* fold does not copy (a guard, an unreadable-rule fact, a bare real-approval bit) is not lost behind the ask that won the
|
|
44
|
+
* slot. Written by the policy fold and by the gate's own writers of a standing ask's carried classes; the one carrier of
|
|
45
|
+
* those classes. */
|
|
46
|
+
readonly foldedClasses?: readonly AskClass[];
|
|
47
|
+
/** WHICH integrity guards stand behind this ask — a removal of a protected location, an unverifiable recursive delete, shell
|
|
48
|
+
* text the engine cannot read (or an environment that did not answer the read station), the session-transcript write,
|
|
49
|
+
* another person's shared artifact. Engine findings (the guard policies, the read station's silence, the artifact tool's
|
|
50
|
+
* consent): the class derivation reads them as classes and as explainers of the real-approval bit, so only a record carries
|
|
51
|
+
* them. Never copied onto the approval request or the park row. */
|
|
52
|
+
readonly guards?: readonly AskGuard[];
|
|
53
|
+
/** Where a path deny row refused the call — the row, the view of the target it met, the face the call is on. The gate's
|
|
54
|
+
* exit mints the refusal's card from it; the judge that found the row is its only writer. */
|
|
55
|
+
readonly pathDenial?: PathDenialEvidence;
|
|
56
|
+
/** A seat refused the call's arguments because no approval can be bound to them: the refusal's sentence, carried by the
|
|
57
|
+
* refusal itself — the gate's deny exit reads it (the remedy it gives) instead of judging again. */
|
|
58
|
+
readonly bindingRefusal?: string;
|
|
59
|
+
}
|
|
60
|
+
/** The members a station attests — everything but the call binding. */
|
|
61
|
+
export type AttestationMembers = Omit<EngineAttestation, "toolCallId" | "toolName">;
|
|
62
|
+
/** Mint a record for `call`. Engine stations only: not re-exported from `src/index.ts`. The values are DETACHED snapshots, so a
|
|
63
|
+
* caller that later mutates the settlement object it was handed cannot rewrite what the engine attests. */
|
|
64
|
+
export declare function mintAttestation(call: {
|
|
65
|
+
toolCallId: string;
|
|
66
|
+
toolName: string;
|
|
67
|
+
}, members: AttestationMembers): EngineAttestation;
|
|
68
|
+
/** Is `v` a record the engine minted (the brand alone — no binding)? The receipt's test. */
|
|
69
|
+
export declare function isEngineAttestation(v: unknown): v is EngineAttestation;
|
|
70
|
+
/** THE read: the record `d` carries FOR `call` — a branded record bound to that call, else `undefined` (a record bound to
|
|
71
|
+
* another call is a replayed one and reads as absent). Read off the own data member, never through an accessor. */
|
|
72
|
+
export declare function attestationOf(d: unknown, call: {
|
|
73
|
+
toolCallId: string;
|
|
74
|
+
toolName: string;
|
|
75
|
+
}): EngineAttestation | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Combine two records for `call`, member GROUP by group: the later record's group stands where it has one, the earlier's
|
|
78
|
+
* fills a group the later lacks. A record not bound to `call` contributes nothing. `answer` scope is the veto's merge: the
|
|
79
|
+
* earlier record contributes ONLY its answer, and only when the later carries none — a person's yes rides a later layer's
|
|
80
|
+
* deny (invariant I3) while the refusing station's own facts stay its own.
|
|
81
|
+
*/
|
|
82
|
+
export declare function mergeAttestation(call: {
|
|
83
|
+
toolCallId: string;
|
|
84
|
+
toolName: string;
|
|
85
|
+
}, earlier: EngineAttestation | undefined, later: EngineAttestation | undefined, scope?: "all" | "answer"): EngineAttestation | undefined;
|
|
86
|
+
/** `d` with `members` attested for `call`, merged over the record it already carries for that call (the new members' groups
|
|
87
|
+
* win). Always a fresh object — the receipt hands out frozen ones. */
|
|
88
|
+
export declare function attest<T extends object>(d: T, call: {
|
|
89
|
+
toolCallId: string;
|
|
90
|
+
toolName: string;
|
|
91
|
+
}, members: AttestationMembers): T;
|
|
92
|
+
/** `d` carrying `record` (a fresh object), or `d` itself when there is no record to put on it. */
|
|
93
|
+
export declare function withAttestation<T extends object>(d: T, record: EngineAttestation | undefined): T;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
const ATTESTATION_GROUP_OF = {
|
|
2
|
+
settlement: "answer",
|
|
3
|
+
origin: "answer",
|
|
4
|
+
classes: "answer",
|
|
5
|
+
inputDigest: "answer",
|
|
6
|
+
classifierCause: "classifierCause",
|
|
7
|
+
classifierRound: "classifierRound",
|
|
8
|
+
unresolvableCause: "unresolvableCause",
|
|
9
|
+
foldedClasses: "foldedClasses",
|
|
10
|
+
guards: "guards",
|
|
11
|
+
pathDenial: "pathDenial",
|
|
12
|
+
bindingRefusal: "bindingRefusal",
|
|
13
|
+
};
|
|
14
|
+
const ATTESTATION_MEMBERS = Object.keys(ATTESTATION_GROUP_OF);
|
|
15
|
+
const groupLead = (g) => ATTESTATION_MEMBERS.find((k) => ATTESTATION_GROUP_OF[k] === g);
|
|
16
|
+
const ENGINE_ATTESTATIONS = new WeakSet();
|
|
17
|
+
function detachedMember(v) {
|
|
18
|
+
if (Array.isArray(v))
|
|
19
|
+
return Object.freeze([...v]);
|
|
20
|
+
if (typeof v !== "object" || v === null)
|
|
21
|
+
return v;
|
|
22
|
+
return Object.freeze(Object.fromEntries(Object.entries(v).map(([k, x]) => [k, typeof x === "object" && x !== null ? Object.freeze(Array.isArray(x) ? [...x] : { ...x }) : x])));
|
|
23
|
+
}
|
|
24
|
+
export function mintAttestation(call, members) {
|
|
25
|
+
const record = { toolCallId: call.toolCallId, toolName: call.toolName };
|
|
26
|
+
for (const k of ATTESTATION_MEMBERS)
|
|
27
|
+
if (members[k] !== undefined)
|
|
28
|
+
record[k] = detachedMember(members[k]);
|
|
29
|
+
const minted = Object.freeze(record);
|
|
30
|
+
ENGINE_ATTESTATIONS.add(minted);
|
|
31
|
+
return minted;
|
|
32
|
+
}
|
|
33
|
+
export function isEngineAttestation(v) {
|
|
34
|
+
return typeof v === "object" && v !== null && ENGINE_ATTESTATIONS.has(v);
|
|
35
|
+
}
|
|
36
|
+
const boundTo = (r, call) => isEngineAttestation(r) && r.toolCallId === call.toolCallId && r.toolName === call.toolName ? r : undefined;
|
|
37
|
+
export function attestationOf(d, call) {
|
|
38
|
+
if (typeof d !== "object" || d === null)
|
|
39
|
+
return undefined;
|
|
40
|
+
return boundTo(Object.getOwnPropertyDescriptor(d, "attestation")?.value, call);
|
|
41
|
+
}
|
|
42
|
+
export function mergeAttestation(call, earlier, later, scope = "all") {
|
|
43
|
+
const a = boundTo(earlier, call);
|
|
44
|
+
const b = boundTo(later, call);
|
|
45
|
+
if (a === undefined)
|
|
46
|
+
return b;
|
|
47
|
+
const members = {};
|
|
48
|
+
if (b !== undefined)
|
|
49
|
+
for (const k of ATTESTATION_MEMBERS)
|
|
50
|
+
if (b[k] !== undefined)
|
|
51
|
+
members[k] = b[k];
|
|
52
|
+
let filled = false;
|
|
53
|
+
for (const g of new Set(Object.values(ATTESTATION_GROUP_OF))) {
|
|
54
|
+
if ((scope === "answer" && g !== "answer") || members[groupLead(g)] !== undefined || a[groupLead(g)] === undefined)
|
|
55
|
+
continue;
|
|
56
|
+
for (const k of ATTESTATION_MEMBERS)
|
|
57
|
+
if (ATTESTATION_GROUP_OF[k] === g && a[k] !== undefined)
|
|
58
|
+
members[k] = a[k];
|
|
59
|
+
filled = true;
|
|
60
|
+
}
|
|
61
|
+
if (!filled)
|
|
62
|
+
return b;
|
|
63
|
+
return mintAttestation(call, members);
|
|
64
|
+
}
|
|
65
|
+
export function attest(d, call, members) {
|
|
66
|
+
return withAttestation(d, mergeAttestation(call, attestationOf(d, call), mintAttestation(call, members)));
|
|
67
|
+
}
|
|
68
|
+
export function withAttestation(d, record) {
|
|
69
|
+
return record === undefined ? d : { ...d, attestation: record };
|
|
70
|
+
}
|
|
@@ -16,7 +16,10 @@
|
|
|
16
16
|
* memory distiller's chat seat key), and `inheritedHostEnv` subtracts every entry whose value is one,
|
|
17
17
|
* compared whole, under every policy. A credential resolved per request (a per-model auth hook's answer) is not in
|
|
18
18
|
* it: the host that resolves it declares it. The same inheritance-only reading as the word above.
|
|
19
|
+
* - `mods.skill_seat` — a skill carries its own hooks: `SkillSpec.mods` registrations are admitted on every leg that loads
|
|
20
|
+
* the skill and take part only while the skill is active there (from its activation to the run's end, a park and its
|
|
21
|
+
* resume included); they are the leg's own (no delegated child dispatches them or is screened by them).
|
|
19
22
|
*/
|
|
20
|
-
export declare const ENGINE_CAPABILITIES: readonly ["inherit_env.own_credentials_withheld", "inherit_env.own_credential_values_withheld"];
|
|
23
|
+
export declare const ENGINE_CAPABILITIES: readonly ["inherit_env.own_credentials_withheld", "inherit_env.own_credential_values_withheld", "mods.skill_seat"];
|
|
21
24
|
/** One word of {@link ENGINE_CAPABILITIES}. */
|
|
22
25
|
export type EngineCapability = (typeof ENGINE_CAPABILITIES)[number];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const ENGINE_CAPABILITIES = Object.freeze(["inherit_env.own_credentials_withheld", "inherit_env.own_credential_values_withheld"]);
|
|
1
|
+
export const ENGINE_CAPABILITIES = Object.freeze(["inherit_env.own_credentials_withheld", "inherit_env.own_credential_values_withheld", "mods.skill_seat"]);
|
|
@@ -62,8 +62,8 @@ export interface EngineNotice {
|
|
|
62
62
|
* firing rule as its skills sibling below (once per delivered frame, on the carrying message's receipt).
|
|
63
63
|
* - `"permission.allowed_tool_not_granted"` — an allow list holds entries that grant (or refuse) nothing: a loaded skill's
|
|
64
64
|
* `allowed-tools` / `disallowed-tools`, the request's `TaskSpec.allowedTools`, the deployment's `RunnerDeps.allowedTools`.
|
|
65
|
-
* `*` (it voids an allow list; on a deny list it reads as nothing and the rest still refuses), `mcp__*` (no server
|
|
66
|
-
* named), a rule on a tool with no such rule form (an allow by path on a tool other than `Read` / `Edit
|
|
65
|
+
* `*` (it voids an allow list; on a deny list it reads as nothing and the rest still refuses), `mcp__*` / `mcp__*__*` (no server
|
|
66
|
+
* named), a rule on a tool with no such rule form (an allow by path on a tool other than `Read` / `Edit`),
|
|
67
67
|
* a shape the rule grammar refuses, a tool name stale against the run's roster. The run goes on and asks for those tools
|
|
68
68
|
* as usual. Audience `user`; once per prepared task for the skill and request lists (`detail.sessionId` present), once
|
|
69
69
|
* per Runner for the deployment's (at construction, no session). `detail: { sessionId?, entries: [{ source, entry,
|
|
@@ -231,6 +231,16 @@ export interface EngineNotice {
|
|
|
231
231
|
* above's keys MINUS `to` (nothing moved, and a `to` naming a model that was not used is the one lie a
|
|
232
232
|
* consumer cannot detect); `action` is the discriminator, so a reader never infers the posture from that
|
|
233
233
|
* absence. Audience `operator`, same entitlement reading as its twin. Dedup key: (code, seat) per run.
|
|
234
|
+
* - `"route.seat_detached"` (same pre-flight, the third POSTURE) — a derived seat no primary model can stand in for
|
|
235
|
+
* (the advisor tool: advising the agent with its own model is no advice) failed the pairing pre-flight, so the seat
|
|
236
|
+
* is taken off THIS run: the advisor tool is not mounted (the leg's manifest says `advisor.reason: "route_refused"`).
|
|
237
|
+
* `detail: { seat, from, cause, fixHint, action: "detached", sessionId?, runId? }` — `route.classifier_unroutable`'s
|
|
238
|
+
* keys, `action` the discriminator. Audience `operator`. Dedup key: (code, seat) per run.
|
|
239
|
+
* - `"advisor.not_attached"` (`src/core/advisor-verdict.ts`) — a task's `advisorModel` did not attach for a reason the
|
|
240
|
+
* person is told: `unknown_model`, `advisor_unranked`, `weakest_tier`, `main_unranked`, `pairing` (the advisor is on a
|
|
241
|
+
* weaker tier than the main model) or `hold_unknown` (whether the conversation switched it off could not be read).
|
|
242
|
+
* `detail: { advisorModel, mainModel, reason, sessionId, runId? }`. Root legs only (a delegated child tells nobody).
|
|
243
|
+
* Audience `user`. Dedup key: (code, reason, advisorModel, mainModel) per SESSION (the once-per-session record).
|
|
234
244
|
* - `"classifier.fallback"` (the classifier's candidate ladder, `src/core/runner/classifier-ladder.ts`)
|
|
235
245
|
* — a gated call's classification did NOT rule on the classifier seat and was re-asked on the model
|
|
236
246
|
* behind it. Sibling of `route.fallback_to_primary` one layer later: that one fires when the derived
|
|
@@ -314,6 +324,14 @@ export interface EngineNotice {
|
|
|
314
324
|
* runs. ONCE PER LEG PER (api, key set) — a deployment fact, not a request fact. Audience `operator`;
|
|
315
325
|
* `detail: { keys, api, modelId, sessionId, runId }` — `keys` the key NAMES in `extraBody`'s order (never a
|
|
316
326
|
* value), `api` the wire the adapter speaks, `modelId` the catalog id the request was sent as.
|
|
327
|
+
* - `"model.capability_downgraded"` (#1830) — a capability the session's requests used was withheld from the model
|
|
328
|
+
* they were sent to: today, images replaced by a one-line placeholder because the model's entry declares no image
|
|
329
|
+
* input (`Model.input` without `"image"`; `capabilityOf` in `brain/model-capability.ts` is the one reading, and an
|
|
330
|
+
* entry that does not declare `input` keeps its images). The message names the model and the way out (declare the
|
|
331
|
+
* image input, or switch models). Never minted for reasoning a model declares off — the reasoning resolution's
|
|
332
|
+
* drop arm (`TaskResult.effectiveReasoning.dropped`) is that fact's face. ONCE PER SESSION PER (model, capability)
|
|
333
|
+
* (the session's announced record); one report per request also becomes the operator trace `vision.placeholder`.
|
|
334
|
+
* Audience `user`; `detail: { model, capability: "image", status: "declared_off", sessionId, runId }`.
|
|
317
335
|
* - `"context.tool_turn_repaired"` (#1224) — a provider request was built from a transcript that breaks the
|
|
318
336
|
* tool-turn law, and the request view restored it (`engine/llm/tool-turns.ts`; the transcript is never
|
|
319
337
|
* rewritten): a block after an assistant's tool calls moved ahead of them (`trailing_text`), a result recorded
|
|
@@ -383,15 +401,25 @@ export interface EngineNotice {
|
|
|
383
401
|
* `detail: { problem, sessionId, runId }`.
|
|
384
402
|
* - `"config.execution_env_capability_invalid"` — a remote env DECLARES a boolean capability key
|
|
385
403
|
* (`isolation`, `suspendable`, `canonicalPathAuthoritative`) with a non-boolean value; ABSENCE is a
|
|
386
|
-
* supported reading of each and stays silent. Once per key per run; `detail: { key, valueType }`.
|
|
404
|
+
* supported reading of each and stays silent. Once per key per run; `detail: { key, valueType }`. Also minted for
|
|
405
|
+
* `withheldEnv` (key `"withheldEnv"`) when it is neither a list of findings nor `"unknown"`, read at a shell call of
|
|
406
|
+
* a root leg (once per run).
|
|
387
407
|
* - `"config.secret_env_scrubbed"` (#1081) — the D1 fail-closed `scrub` policy, or the deployment's
|
|
388
408
|
* own credentials (`declareWithheldEnv`: a declared name, or a value equal to a declared or engine-held
|
|
389
409
|
* credential value), withheld one or more keys from a spawned child's environment (a tool's shell, an
|
|
390
410
|
* oracle gate, or a language server).
|
|
391
411
|
* Once per PROCESS, shared by every scrub site ({@link import("./secret-env.js").announceSecretEnvScrub});
|
|
392
412
|
* `detail: { names, ownCredentials? }` — every withheld key's name, never a value; `ownCredentials`, present
|
|
393
|
-
* only when one was withheld, the subset
|
|
394
|
-
* `"all"` included).
|
|
413
|
+
* only when one was withheld, the subset that is the deployment's own credential, by name or by value, whichever
|
|
414
|
+
* rule withheld it (withheld under any policy, `"all"` included).
|
|
415
|
+
* - `"inherit_env.names_withheld"` (#1963) — the same fact for the person whose run drives a tool shell: the variables
|
|
416
|
+
* of the engine's environment that shell does not receive (`ExecutionEnv.withheldEnv`), the scrub's half (the run's
|
|
417
|
+
* `inheritEnv` hands them on) and the deployment's own credentials (no policy does). Audience `user`. Read as each
|
|
418
|
+
* call to the engine's own shell tool starts on a root leg (the answer can grow during a run: a credential the engine
|
|
419
|
+
* takes in when it first routes a model is withheld from the next child); once per SESSION per name set (the
|
|
420
|
+
* session's announced record). `detail: { state, names?, ownCredentials?, sessionId, runId? }` — `state` `"withheld"`
|
|
421
|
+
* carries the operator row's split (names only, never a value); `"unknown"` (the environment answered `"unknown"`)
|
|
422
|
+
* carries no names and says the engine could not determine them.
|
|
395
423
|
* - `"config.credential_not_withheld"` (#1816) — a credential value the engine was handed (a brain's key or credential
|
|
396
424
|
* header, a model entry's or a peer's credential header, a consolidation seat's key) is no credential (a placeholder
|
|
397
425
|
* such as `EMPTY`, fewer than eight characters, one character repeated): it is used as given, but a variable holding
|
|
@@ -406,8 +434,11 @@ export interface EngineNotice {
|
|
|
406
434
|
* {@link import("./cross-boundary-taint.js").crossBoundaryPostureUndeclaredNotice}. Audience `operator`.
|
|
407
435
|
* - `"config.cross_boundary_record_unwritten"` — a session's cross-boundary record the engine owed could not be written (the
|
|
408
436
|
* store threw, or answered with no entry id) and refused nothing: on a tree that is not governed no judgment reads the record;
|
|
409
|
-
*
|
|
410
|
-
*
|
|
437
|
+
* on a governed tree it stays owed — a prepare's by the leg's next write — and once none lands (a settle's failure is the leg's
|
|
438
|
+
* last write; a parked leg's suspend record landed before it) the next leg reads the content after the newest record as off-target,
|
|
439
|
+
* which the sentence says for the phase that failed. Once per state a leg could not write;
|
|
440
|
+
* `detail: { sessionId, runId, phase, governed, cause }` (`phase`: `prepare` / `exit` / `suspend` / `settle`, where that state
|
|
441
|
+
* first failed). Minted by
|
|
411
442
|
* {@link import("./cross-boundary-taint.js").crossBoundaryRecordUnwrittenNotice}. Audience `operator`.
|
|
412
443
|
* - `"config.permission_mode_unavailable"` — the permission mode a task requested is not the mode the leg runs
|
|
413
444
|
* under: the deployment denies it (`by: "operator_deny"` — `RuntimeCaps.bypassPermissions` / `autoMode` is
|
|
@@ -452,14 +483,16 @@ export interface EngineNotice {
|
|
|
452
483
|
* the first eight `{ rule, scopeRoot }`, `count` all of them; `rule` is the rule text as the store served it, through the same reading
|
|
453
484
|
* as `permission.allowed_tool_not_granted`'s `entries[].entry` (the original, not a spelling of it, when it is at most 1 024 code points;
|
|
454
485
|
* a longer one is cut to 1 024 plus the truncation mark, 1 025 in all), `scopeRoot` neutralized and bounded. Audience `user`.
|
|
455
|
-
* - `"config.session_rules_earlier_grammar"` — a session's stored permission rules (`RunnerDeps.sessionPolicyStore`)
|
|
456
|
-
*
|
|
457
|
-
* this engine's grammar reads as no rule makes those rules
|
|
486
|
+
* - `"config.session_rules_earlier_grammar"` — a session's stored permission rules (`RunnerDeps.sessionPolicyStore`) were
|
|
487
|
+
* written in an earlier rule grammar and hold entries it reads otherwise than this engine's would: an entry that grammar
|
|
488
|
+
* reads as nothing (an allow admits nothing; a `toolDeny` entry this engine's grammar reads as no rule makes those rules
|
|
489
|
+
* refuse every call until they are rewritten), or one whose meaning a later grammar revised — the entry keeps its writer's
|
|
490
|
+
* meaning, or takes this grammar's when its writer's could not read it, and the message says which, with both. The message names
|
|
458
491
|
* the session, the bucket, the entries (the first five, the rest counted), the reader's word and the way out. Audience
|
|
459
492
|
* `user`. Once per distinct entry set per bucket per rule layer (the run's own rules, each ancestor's inherited ones).
|
|
460
493
|
* `detail: { bucket, storedGrammar, entries: [{ entry, reader }], rewrite: { by, stampsGrammar }, rulesSessionId,
|
|
461
494
|
* sessionId }` — `entries` every one, `entry` through the same reading as `permission.allowed_tool_not_granted`'s;
|
|
462
|
-
* `reader` ∈ `no_rule` / `named_no_tool`; `rewrite.by` = `operator_write_without_rev`; `rulesSessionId` the session
|
|
495
|
+
* `reader` ∈ `no_rule` / `named_no_tool` / `grammar_revised`; `rewrite.by` = `operator_write_without_rev`; `rulesSessionId` the session
|
|
463
496
|
* whose rules they are (an ancestor's on a delegated child), `sessionId` the run that read them.
|
|
464
497
|
* - `"config.durable_gate_unavailable"` — a durable-approval MANDATE is in force on a leg with NO
|
|
465
498
|
* checkpoint store: the per-principal `forceDurableGate` entitlement, or the task's own
|
|
@@ -619,7 +652,7 @@ export interface EngineNotice {
|
|
|
619
652
|
* secret token never rides a notice). A DIFFERENT record already on file is not this notice — it
|
|
620
653
|
* is the `checkpoint.execution_outcome_conflict` throw (an engine defect, propagated).
|
|
621
654
|
*
|
|
622
|
-
* - `"classifier.denial_limit"` (#548,
|
|
655
|
+
* - `"classifier.denial_limit"` (#548, "too many classifier denials in headless
|
|
623
656
|
* mode") — the auto-mode classifier's DENIAL LIMIT was reached (3 consecutive blocks, or 20 in the
|
|
624
657
|
* run; `RunnerDeps.autoMode.denialLimit`) and the fallback ask it turns into was never JUDGED by
|
|
625
658
|
* anyone. Two lanes reach it. SYNCHRONOUS: no approver to go to — none wired, a blanket
|
|
@@ -58,7 +58,7 @@ export interface StreamCursorState {
|
|
|
58
58
|
acceptedBytes: number;
|
|
59
59
|
/** `tail.sourceSkippedBytes()` as of the last slice — the delta is disclosed exactly once. */
|
|
60
60
|
disclosedSkippedBytes: number;
|
|
61
|
-
/** Incremental UTF-8 decoder (
|
|
61
|
+
/** Incremental UTF-8 decoder (StringDecoder holds a split multi-byte char across
|
|
62
62
|
* reads instead of emitting replacement chars at every read boundary). */
|
|
63
63
|
decoder: StringDecoder;
|
|
64
64
|
}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*
|
|
14
14
|
* PROVENANCE OF THE DEFAULT (not a taste call, and not a JSDoc-only constraint): the reference
|
|
15
15
|
* implementation caps its own file-history at the newest 100 snapshots and evicts the rest — CC
|
|
16
|
-
*
|
|
16
|
+
* holds the cap as a module constant and applies it in the snapshot reducer
|
|
17
17
|
* (`if (E.length > R1e) R = E.slice(-R1e), <evict>(E.slice(0, E.length - R1e), R, …).catch(…)`),
|
|
18
18
|
* i.e. keep the newest N by commit order, hand the evicted ones to a best-effort eviction pass, and
|
|
19
19
|
* never let that pass fail the turn that triggered it. Its eviction unlinks a backup only when no
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { GovernanceRetryClass } from "./governance-codes.js";
|
|
1
2
|
import { type FileHistoryRetentionPolicy } from "./file-history-retention.js";
|
|
2
3
|
import type { ExecutionEnv } from "../internal/harness-types.js";
|
|
3
4
|
/** rel path of `child` under `root` in "/" form (win root) / verbatim form (posix root); null when not under.
|
|
@@ -10,14 +11,31 @@ declare function joinUnder(root: string, rel: string): string;
|
|
|
10
11
|
declare function parentDirOf(absPath: string): string | undefined;
|
|
11
12
|
/** The re-join verdict of {@link resolveTrackKey}: an absolute path to operate on, or a NAMED
|
|
12
13
|
* refusal (the fail-closed arm — a recorded key that would escape `root` is never coerced into
|
|
13
|
-
* something writable). A-082 idx5: named so the fence can be part of the public surface. */
|
|
14
|
+
* something writable) carrying the restore ledger's class for it. A-082 idx5: named so the fence can be part of the public surface. */
|
|
14
15
|
export type FileHistoryTrackKeyResolution = {
|
|
15
16
|
ok: true;
|
|
16
17
|
abs: string;
|
|
17
18
|
} | {
|
|
18
19
|
ok: false;
|
|
19
20
|
reason: string;
|
|
21
|
+
class: "key_unresolvable";
|
|
20
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* Why a restore declined a file it could reach — the `class` of every {@link FileHistoryRestoreResult.refused}
|
|
25
|
+
* row, named by the arm that decided the refusal (the shared env half and key resolver below, or a backend's
|
|
26
|
+
* own base-unavailable arm) and copied by the backend, never re-derived from the reason text:
|
|
27
|
+
* · `link_safety` — the object at the path is not the regular file the record describes (a symlink, a
|
|
28
|
+
* directory or other kind), its parent chain no longer resolves to the recorded identity, or a guarded
|
|
29
|
+
* write found the path changed under it;
|
|
30
|
+
* · `base_unavailable` — the first touch recorded that the path's pre-edit bytes could not be read (DV-14),
|
|
31
|
+
* so there is no pristine version to write;
|
|
32
|
+
* · `key_unresolvable` — the recorded key cannot be re-joined against this root (it would escape it, or it
|
|
33
|
+
* came from another path family and is absolute or ambiguous here).
|
|
34
|
+
* Damage to the store's own records (a missing version record, a missing or corrupt blob) is not a refusal
|
|
35
|
+
* in any backend: it is a `failed` row.
|
|
36
|
+
*/
|
|
37
|
+
export declare const FILE_HISTORY_REFUSAL_CLASSES: readonly ["link_safety", "base_unavailable", "key_unresolvable"];
|
|
38
|
+
export type FileHistoryRefusalClass = (typeof FILE_HISTORY_REFUSAL_CLASSES)[number];
|
|
21
39
|
/** The path family a track key was MINTED under — the half a bare key string cannot carry. */
|
|
22
40
|
export type FileHistoryKeyFamily = "posix" | "win";
|
|
23
41
|
/**
|
|
@@ -80,21 +98,60 @@ export declare function resolveTrackKey(root: string, key: string, minted?: File
|
|
|
80
98
|
* value rather than keeping its own list. */
|
|
81
99
|
export declare const FILE_HISTORY_ERROR_CODES: readonly ["track_failed", "snapshot_failed", "restore_failed", "adopt_failed", "not_found", "aborted", "unsupported_format", "conflict"];
|
|
82
100
|
export interface FileHistoryError {
|
|
83
|
-
/** `not_found` = no boundary for that (scope, entryId)
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
101
|
+
/** `not_found` = no boundary for that (scope, entryId) — an absence, never a fault (a boundary that is there
|
|
102
|
+
* but cannot be read is the verb's `*_failed` with the fault); `aborted` = the signal fired (or the
|
|
103
|
+
* fencing discarded a timed-out attempt); `conflict` = a HISTORY-PRESERVATION law refused the call:
|
|
104
|
+
* doing it would discard or overwrite history that is not the caller's — `adoptScope` / `importHistory`
|
|
105
|
+
* onto a target that holds history of its own (the non-destructive-target law), or `annulTrack` of a
|
|
106
|
+
* record that is no longer just the caller's own mint (a boundary froze it, it grew past its first
|
|
107
|
+
* version, another edit was served it, or the proof read found the file moved or the base-unavailable
|
|
108
|
+
* marker standing). It is never a fault, and it is never "could not judge": a verb that cannot JUDGE its
|
|
109
|
+
* law (an unreadable graph, a listing that fails, a proof read that cannot re-read the path) answers its
|
|
110
|
+
* own `*_failed` (or `aborted`) with the fault. A caller reads `conflict` as "the law answered; the history
|
|
111
|
+
* stands" — the engine's fork-carry seat says nothing on it because the only verb that seat calls is
|
|
112
|
+
* `adoptScope`, whose `conflict` is the target law alone, so an adoption that failed for any OTHER
|
|
113
|
+
* reason (a corrupt source graph, a blob it cannot reach, a consumed-id ledger it cannot carry, a target
|
|
114
|
+
* whose history cannot be judged) must NOT wear this
|
|
90
115
|
* code or the failure disappears into that silence — those are `adopt_failed`, which the
|
|
91
116
|
* ADOPTION FAMILY shares: `importHistory` publishes under the same target law and answers the
|
|
92
|
-
* same code for the same non-conflict failures
|
|
117
|
+
* same code for the same non-conflict failures, and `exportHistory` answers it for a history it cannot
|
|
118
|
+
* read whole (its `unsupported_format` names a bad ENVELOPE or
|
|
93
119
|
* work its shape drove; a fault in the PUBLISH step itself — the disk refusing a good graph —
|
|
94
120
|
* answers `adopt_failed`); `unsupported_format`
|
|
95
121
|
* = a foreign-epoch or wrong-version envelope; the rest name the verb that failed. */
|
|
96
122
|
code: (typeof FILE_HISTORY_ERROR_CODES)[number];
|
|
97
123
|
message: string;
|
|
124
|
+
/** The backend's judgment of a FAULT — it could not do what it was asked — as a {@link GovernanceRetryClass}
|
|
125
|
+
* word (the words are defined there, once). Stated whenever the backend knows: from a caught error's code,
|
|
126
|
+
* or from a state it found itself (a damaged record is `terminal`). Absent when it does not know, and on an
|
|
127
|
+
* outcome that is not a fault (an absent boundary's `not_found`, the empty-target law, an abort). Every
|
|
128
|
+
* reader — the engine's edit refusal, the rewind disclosure, a failed rewind task's `terminal.detail`, a
|
|
129
|
+
* host's metrics — reads this cell, never the message text. */
|
|
130
|
+
permanence?: GovernanceRetryClass;
|
|
131
|
+
}
|
|
132
|
+
/** A fault's judgment as the member a {@link FileHistoryError} spreads in: `{ permanence }` when judged, `{}`
|
|
133
|
+
* when not — so an unjudged failure carries no `permanence` member at all. */
|
|
134
|
+
export type FileHistoryFault = {
|
|
135
|
+
readonly permanence?: GovernanceRetryClass;
|
|
136
|
+
};
|
|
137
|
+
/** The bundled backends' ONE reading of a caught value — by its `code` member only, never its message. */
|
|
138
|
+
export declare function caughtFault(caught: unknown): FileHistoryFault;
|
|
139
|
+
/** A record the backend found damaged (unparseable, the wrong shape, failing its own digest): no retry
|
|
140
|
+
* repairs it. */
|
|
141
|
+
export declare const DAMAGED_RECORD: FileHistoryFault;
|
|
142
|
+
/**
|
|
143
|
+
* The `Error` the engine hands `RunnerDeps.onError` on every `phase: "rewind"` delivery: `code` and
|
|
144
|
+
* `permanence` are the failure's own, read the same way as on a {@link FileHistoryError}; `message` is the
|
|
145
|
+
* engine's sentence about it (not the store's text). A failure the engine itself observed carries the same
|
|
146
|
+
* shape: a timed-out capture is `aborted`; a backend that threw instead of answering is the verb's own
|
|
147
|
+
* `*_failed` code with no `permanence` and the thrown value as the standard `Error.cause`.
|
|
148
|
+
*/
|
|
149
|
+
export declare class FileHistoryStoreError extends Error implements Pick<FileHistoryError, "code" | "permanence"> {
|
|
150
|
+
readonly code: FileHistoryError["code"];
|
|
151
|
+
readonly permanence?: FileHistoryError["permanence"];
|
|
152
|
+
constructor(failure: Pick<FileHistoryError, "code" | "permanence">, message: string, thrown?: {
|
|
153
|
+
value: unknown;
|
|
154
|
+
});
|
|
98
155
|
}
|
|
99
156
|
export type FileHistoryResult = {
|
|
100
157
|
ok: true;
|
|
@@ -117,6 +174,15 @@ export type FileHistoryTrackResult = {
|
|
|
117
174
|
ok: false;
|
|
118
175
|
error: FileHistoryError;
|
|
119
176
|
};
|
|
177
|
+
/** {@link FileHistoryStore.exportHistory}'s answer: the envelope, `null` = nothing to export (the one meaning of
|
|
178
|
+
* `null`), or a history that cannot be read whole — `adopt_failed` with the fault, naming what cannot be read. */
|
|
179
|
+
export type FileHistoryExportResult = {
|
|
180
|
+
ok: true;
|
|
181
|
+
history: FileHistoryExport | null;
|
|
182
|
+
} | {
|
|
183
|
+
ok: false;
|
|
184
|
+
error: FileHistoryError;
|
|
185
|
+
};
|
|
120
186
|
/**
|
|
121
187
|
* Three-state discriminant + full per-file ledger on EVERY arm (design/381 DV-15). Refusals are
|
|
122
188
|
* never folded into benign skips; `base_unavailable` (DV-14) is a refusal reason.
|
|
@@ -129,10 +195,12 @@ export type FileHistoryRestoreResult = {
|
|
|
129
195
|
filesChanged: string[];
|
|
130
196
|
/** Track keys already equal to the target (untouched — content-hash proven, never mtime). */
|
|
131
197
|
identicalSkipped: string[];
|
|
132
|
-
/** Per-file security/consistency refusals (skipped, counted, never failing the whole restore)
|
|
198
|
+
/** Per-file security/consistency refusals (skipped, counted, never failing the whole restore); `class` is
|
|
199
|
+
* the closed reading of why ({@link FileHistoryRefusalClass}), `reason` the sentence for a person. */
|
|
133
200
|
refused: Array<{
|
|
134
201
|
path: string;
|
|
135
202
|
reason: string;
|
|
203
|
+
class: FileHistoryRefusalClass;
|
|
136
204
|
}>;
|
|
137
205
|
/** Per-file operational failures (env write/remove errors, aborts after k writes). */
|
|
138
206
|
failed: Array<{
|
|
@@ -149,6 +217,34 @@ export interface FileHistoryDiffStats {
|
|
|
149
217
|
insertions: number;
|
|
150
218
|
deletions: number;
|
|
151
219
|
}
|
|
220
|
+
/** `Runner.rewindFiles`' request — the out-of-run code-only rewind (the reference's `rewind_files` control request). */
|
|
221
|
+
export interface RewindFilesRequest {
|
|
222
|
+
/** The session whose history is converged. It must exist. */
|
|
223
|
+
sessionId: string;
|
|
224
|
+
/** The boundary key: the entry id of a turn's FIRST user entry — the id space `TaskSpec.rewindFilesTo`
|
|
225
|
+
* addresses ("the files as they were when that turn began"). An entry with no boundary of its own refuses. */
|
|
226
|
+
to: string;
|
|
227
|
+
/** Preview only: the working tree is not written (a fork whose history was never carried may have its carry
|
|
228
|
+
* completed — the same carry the session's next run performs). */
|
|
229
|
+
dryRun?: boolean;
|
|
230
|
+
/** Caller cancel for the restore. */
|
|
231
|
+
signal?: AbortSignal;
|
|
232
|
+
}
|
|
233
|
+
/** `Runner.rewindFiles`' answer. A refusal is a thrown `Error` carrying a `code`. */
|
|
234
|
+
export type RewindFilesResult =
|
|
235
|
+
/** `preview: null` = no preview for this request (the backend implements no `diffStats`, or answered none);
|
|
236
|
+
* an empty `filesChanged` with zero counts = a real "nothing would change". */
|
|
237
|
+
{
|
|
238
|
+
dryRun: true;
|
|
239
|
+
preview: FileHistoryDiffStats | null;
|
|
240
|
+
}
|
|
241
|
+
/** The store's ledger as it answered: `complete`, or `partial` with every refused / failed file on it. */
|
|
242
|
+
| {
|
|
243
|
+
dryRun: false;
|
|
244
|
+
restore: FileHistoryRestoreResult & {
|
|
245
|
+
outcome: "complete" | "partial";
|
|
246
|
+
};
|
|
247
|
+
};
|
|
152
248
|
/** The line-diff bound (see {@link countRestoreLineDiff}): a pair whose edit distance exceeds this
|
|
153
249
|
* is counted as a whole-file replacement. Public so a preview UI can state what it is showing. */
|
|
154
250
|
export declare const FILE_HISTORY_DIFF_LINE_BUDGET = 2000;
|
|
@@ -302,7 +398,9 @@ export interface FileHistoryStore {
|
|
|
302
398
|
* still matches what the mint recorded (bytes still absent for an existed-not mint, still the same
|
|
303
399
|
* hash for a captured one). A file that changed keeps its record, because the alternative is
|
|
304
400
|
* deleting the only baseline of a file the agent really did modify — damage rewind could no longer
|
|
305
|
-
* reach, which is strictly worse than a stale record.
|
|
401
|
+
* reach, which is strictly worse than a stale record. Every refusal above is the history-preservation
|
|
402
|
+
* law (`conflict`, see {@link FileHistoryError.code}); a proof read that cannot re-read the path at all
|
|
403
|
+
* judged nothing, and keeps the record with `track_failed` (`aborted` when the signal fired) instead.
|
|
306
404
|
*/
|
|
307
405
|
annulTrack(scope: string, absPath: string, root: string, verify?: {
|
|
308
406
|
env: ExecutionEnv;
|
|
@@ -353,10 +451,13 @@ export interface FileHistoryStore {
|
|
|
353
451
|
* from "the env died after k writes". Restore is per-file idempotent (identical files skip), so
|
|
354
452
|
* the documented recovery for a partial outcome is: re-run the same restore; it converges. There
|
|
355
453
|
* is NO all-or-nothing guarantee and none is claimed. Task-level policy on `"partial"` lives in
|
|
356
|
-
* the CALLER (prepare defaults to fail-loud; see DV-15).
|
|
454
|
+
* the CALLER (prepare defaults to fail-loud; see DV-15). A boundary never made is `not_found` and
|
|
455
|
+
* touches NOTHING — no file read or written, an empty ledger — since the engine's refusal of a
|
|
456
|
+
* rewind without a boundary is exactly this answer (the contract kit checks the bytes).
|
|
357
457
|
*/
|
|
358
458
|
restore(scope: string, entryId: string, env: ExecutionEnv, root: string, signal?: AbortSignal): Promise<FileHistoryRestoreResult>;
|
|
359
|
-
/** Whether a boundary
|
|
459
|
+
/** Whether (scope, entryId) has a USABLE boundary: `false` both for one never made and for one that is there but
|
|
460
|
+
* cannot be read — `restore` is the verb that says which (`not_found` / `restore_failed` with the fault). */
|
|
360
461
|
canRestore(scope: string, entryId: string): Promise<boolean>;
|
|
361
462
|
/**
|
|
362
463
|
* Optional dry-run: per-file change stats for a prospective restore (CC diffStats; design/381
|
|
@@ -466,7 +567,11 @@ export interface FileHistoryStore {
|
|
|
466
567
|
* empty OR already holds a graph with the exact same import identity/digest (pure idempotent
|
|
467
568
|
* re-publish). A non-empty target with any other content ⇒ typed `conflict` refusal — atomic
|
|
468
569
|
* visibility prevents half-graphs, this law prevents publishing the WRONG complete graph over
|
|
469
|
-
* locally-grown history.
|
|
570
|
+
* locally-grown history. A target whose history cannot be judged ⇒ `adopt_failed`, before any blob is
|
|
571
|
+
* fetched; a source that cannot supply a referenced blob ⇒ `adopt_failed`. `exportHistory` answers a
|
|
572
|
+
* {@link FileHistoryExportResult}: the whole graph, `null` for nothing to export, or `adopt_failed` with the
|
|
573
|
+
* fault for a history it cannot read whole (an unreadable tracked set, boundaries that cannot be judged) —
|
|
574
|
+
* never a partial graph, and never a `null` that hides a fault.
|
|
470
575
|
*/
|
|
471
576
|
/**
|
|
472
577
|
* NO `dispose` / lifecycle verb, and that is a decision rather than an omission (design/381 slice 3,
|
|
@@ -484,7 +589,7 @@ export interface FileHistoryStore {
|
|
|
484
589
|
* sibling file store in this family offers.
|
|
485
590
|
* A deployment that needs cross-process exclusion takes the assembled backend, or brings its own.
|
|
486
591
|
*/
|
|
487
|
-
exportHistory?(scope: string): Promise<
|
|
592
|
+
exportHistory?(scope: string): Promise<FileHistoryExportResult>;
|
|
488
593
|
importHistory?(scope: string, data: FileHistoryExport, srcGetBlob: (hash: string) => Promise<Uint8Array | undefined>): Promise<FileHistoryResult>;
|
|
489
594
|
}
|
|
490
595
|
/**
|
|
@@ -550,13 +655,30 @@ export declare function captureFileBackupViaEnv(env: ExecutionEnv, absPath: stri
|
|
|
550
655
|
* refusal state that stops a later touch from minting already-modified bytes as pristine — erasing
|
|
551
656
|
* it on an ambiguous failure re-opens exactly the DV-14 hole it exists to close. It stays
|
|
552
657
|
* retractable through the `"proven"` path, which needs no evidence read at all.
|
|
658
|
+
*
|
|
659
|
+
* THREE verdicts, because a backend answers them three ways: `unchanged` retracts; `kept` is the
|
|
660
|
+
* history-preservation law keeping the record (`conflict`); `unjudged` is a read that never happened —
|
|
661
|
+
* the path could not be re-read, or the signal fired — so nothing was judged and the record stays with
|
|
662
|
+
* the verb's own failure (`track_failed`, or `aborted` when `aborted` is true), never with the law's word.
|
|
553
663
|
*/
|
|
554
|
-
export
|
|
555
|
-
|
|
664
|
+
export type FileHistoryMintProof = {
|
|
665
|
+
verdict: "unchanged";
|
|
556
666
|
} | {
|
|
557
|
-
|
|
667
|
+
verdict: "kept";
|
|
558
668
|
reason: string;
|
|
559
|
-
}
|
|
669
|
+
} | {
|
|
670
|
+
verdict: "unjudged";
|
|
671
|
+
reason: string;
|
|
672
|
+
aborted: boolean;
|
|
673
|
+
};
|
|
674
|
+
export declare function worldStillMatchesMint(env: ExecutionEnv, absPath: string, root: string, baseAvailable: boolean, mintedBlobHash: string | null, signal?: AbortSignal): Promise<FileHistoryMintProof>;
|
|
675
|
+
/** A backend's ONE mapping of a proof that did not say `unchanged` onto the annul verb's failure — the two
|
|
676
|
+
* bundled backends call it, and an out-of-tree backend reuses it with the proof read itself. */
|
|
677
|
+
export declare function annulProofFailure(proof: Exclude<FileHistoryMintProof, {
|
|
678
|
+
verdict: "unchanged";
|
|
679
|
+
}>, absPath: string): FileHistoryResult & {
|
|
680
|
+
ok: false;
|
|
681
|
+
};
|
|
560
682
|
/**
|
|
561
683
|
* DV-13's metadata rule applied to the MODE axis (design/381 slice 3), and it is a rule about
|
|
562
684
|
* EVIDENCE rather than about equality: metadata may prove two states DIFFERENT, never the same. Two
|
|
@@ -599,9 +721,13 @@ export type FileRestoreApplyOutcome =
|
|
|
599
721
|
} | {
|
|
600
722
|
outcome: "identical";
|
|
601
723
|
modeNotPreserved?: true;
|
|
602
|
-
}
|
|
724
|
+
}
|
|
725
|
+
/** Every refusal this half decides is about the object at the path (its kind, its parent chain, a guarded
|
|
726
|
+
* write's precondition), so its class is `link_safety`; a backend copies it into the ledger row. */
|
|
727
|
+
| {
|
|
603
728
|
outcome: "refused";
|
|
604
729
|
reason: string;
|
|
730
|
+
class: "link_safety";
|
|
605
731
|
} | {
|
|
606
732
|
outcome: "failed";
|
|
607
733
|
reason: string;
|
|
@@ -751,7 +877,7 @@ export declare class InMemoryFileHistoryStore implements FileHistoryStore {
|
|
|
751
877
|
diffStats(scope: string, entryId: string, env: ExecutionEnv, root: string): Promise<FileHistoryDiffStats | null>;
|
|
752
878
|
reap(scope: string, keepEntryIds: string[]): Promise<number>;
|
|
753
879
|
adoptScope(fromScope: string, toScope: string): Promise<FileHistoryResult>;
|
|
754
|
-
exportHistory(scope: string): Promise<
|
|
880
|
+
exportHistory(scope: string): Promise<FileHistoryExportResult>;
|
|
755
881
|
/** The export projection as a SYNCHRONOUS function — the import's final claim needs to compare a
|
|
756
882
|
* target's identity without yielding (see the publish step). */
|
|
757
883
|
private exportOf;
|