@sema-agent/core 7.62.0 → 7.64.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 +936 -0
- package/dist/agents/cc-peer-directory.js +1 -0
- package/dist/agents/cc-peer-wire.d.ts +4 -0
- package/dist/agents/cc-peer-wire.js +1 -0
- package/dist/agents/cc-uds-peer-channel.js +5 -0
- package/dist/agents/cross-session-judge.d.ts +3 -1
- package/dist/agents/cross-session-judge.js +4 -1
- package/dist/agents/peer-directory.d.ts +8 -0
- package/dist/agents/peer-directory.js +4 -0
- package/dist/agents/peer-held-queue.d.ts +9 -3
- package/dist/agents/peer-held-queue.js +12 -9
- package/dist/agents/peer-idle.d.ts +20 -1
- package/dist/agents/peer-idle.js +23 -12
- package/dist/agents/peer-notice-route.d.ts +16 -5
- package/dist/agents/peer-notice-route.js +11 -9
- package/dist/agents/peer-notices.d.ts +25 -8
- package/dist/agents/peer-notices.js +6 -1
- package/dist/agents/peer-session-drain.d.ts +32 -6
- package/dist/agents/peer-session-drain.js +100 -26
- package/dist/agents/send-message-tool.d.ts +7 -0
- package/dist/agents/send-message-tool.js +18 -6
- package/dist/agents/subagent-transcript-placement.d.ts +23 -0
- package/dist/agents/subagent-transcript-placement.js +14 -0
- package/dist/agents/subagent.js +102 -54
- package/dist/brain/route-adjudicator.js +9 -4
- package/dist/core/allow-entry.d.ts +4 -0
- package/dist/core/approval-object.js +1 -1
- package/dist/core/arg-summary.js +1 -1
- package/dist/core/ask-origin.d.ts +1 -1
- package/dist/core/ask-origin.js +2 -2
- package/dist/core/ask-question.d.ts +2 -2
- package/dist/core/ask-unresolvable-notice.d.ts +13 -4
- package/dist/core/ask-unresolvable-notice.js +10 -3
- package/dist/core/auto-compaction.d.ts +7 -5
- package/dist/core/background-agent-store.d.ts +7 -0
- package/dist/core/background-agent-store.js +3 -0
- package/dist/core/canonical-json.d.ts +23 -13
- package/dist/core/canonical-json.js +4 -4
- package/dist/core/checkpoint-queries.d.ts +50 -4
- package/dist/core/checkpoint-queries.js +42 -17
- package/dist/core/checkpoint-requirements.d.ts +3 -3
- package/dist/core/checkpoint-requirements.js +2 -1
- package/dist/core/checkpoint-row-verdict.d.ts +15 -4
- package/dist/core/checkpoint-row-verdict.js +22 -2
- package/dist/core/checkpoint-store.d.ts +28 -11
- package/dist/core/checkpoint-store.js +45 -4
- package/dist/core/compliance.d.ts +6 -2
- package/dist/core/compliance.js +3 -3
- package/dist/core/context-settings.d.ts +40 -9
- package/dist/core/context-settings.js +32 -10
- package/dist/core/engine-attestation.d.ts +27 -7
- package/dist/core/engine-attestation.js +5 -1
- package/dist/core/engine-notice.d.ts +43 -5
- package/dist/core/extension-requester.d.ts +9 -0
- package/dist/core/extension-requester.js +7 -0
- package/dist/core/file-history-store.d.ts +28 -0
- package/dist/core/file-history-store.js +48 -5
- package/dist/core/fs-write-gate-policy.js +1 -1
- package/dist/core/gate-fold.js +2 -0
- package/dist/core/gate-lanes.js +2 -0
- package/dist/core/gate-outcome.d.ts +39 -2
- package/dist/core/gate-outcome.js +20 -1
- package/dist/core/git-worktree-env.d.ts +62 -3
- package/dist/core/git-worktree-env.js +91 -30
- package/dist/core/governance-codes.d.ts +9 -3
- package/dist/core/governance-codes.js +17 -3
- package/dist/core/leg-identity.d.ts +19 -1
- package/dist/core/leg-identity.js +12 -0
- package/dist/core/mailbox-store.d.ts +39 -4
- package/dist/core/mailbox-store.js +14 -2
- package/dist/core/memory-engine/consolidation-driver.d.ts +32 -17
- package/dist/core/memory-engine/consolidation-driver.js +99 -98
- package/dist/core/memory-engine/consolidation.d.ts +74 -10
- package/dist/core/memory-engine/consolidation.js +183 -11
- package/dist/core/memory-engine/control-objects.d.ts +25 -0
- package/dist/core/memory-engine/control-objects.js +151 -0
- package/dist/core/memory-engine/control-plane-adoption.d.ts +48 -0
- package/dist/core/memory-engine/control-plane-adoption.js +159 -0
- package/dist/core/memory-engine/data-plane.d.ts +8 -4
- package/dist/core/memory-engine/data-plane.js +11 -6
- package/dist/core/memory-engine/delegation-settlement.d.ts +58 -40
- package/dist/core/memory-engine/delegation-settlement.js +270 -85
- package/dist/core/memory-engine/dual-root.d.ts +12 -6
- package/dist/core/memory-engine/dual-root.js +11 -7
- package/dist/core/memory-engine/engine.d.ts +136 -58
- package/dist/core/memory-engine/engine.js +491 -394
- package/dist/core/memory-engine/entry-scan.d.ts +8 -0
- package/dist/core/memory-engine/entry-scan.js +3 -0
- package/dist/core/memory-engine/file-backend.d.ts +62 -60
- package/dist/core/memory-engine/file-backend.js +122 -198
- package/dist/core/memory-engine/index.d.ts +8 -7
- package/dist/core/memory-engine/index.js +7 -6
- package/dist/core/memory-engine/landing-admission.d.ts +5 -3
- package/dist/core/memory-engine/landing-admission.js +3 -3
- package/dist/core/memory-engine/layout.d.ts +127 -46
- package/dist/core/memory-engine/layout.js +264 -109
- package/dist/core/memory-engine/memory-backend-contract.d.ts +26 -1
- package/dist/core/memory-engine/memory-backend-contract.js +476 -0
- package/dist/core/memory-engine/memory-deployment.d.ts +42 -11
- package/dist/core/memory-engine/memory-deployment.js +54 -15
- package/dist/core/memory-engine/origin-clearance.d.ts +12 -3
- package/dist/core/memory-engine/origin-clearance.js +68 -9
- package/dist/core/memory-engine/scope-contract.d.ts +52 -11
- package/dist/core/memory-engine/scope-contract.js +68 -19
- package/dist/core/memory-engine/session-write-home.d.ts +37 -2
- package/dist/core/memory-engine/session-write-home.js +38 -11
- package/dist/core/memory-engine/sync-client.d.ts +3 -1
- package/dist/core/memory-engine/sync-client.js +7 -0
- package/dist/core/memory-engine/sync-report.d.ts +3 -2
- package/dist/core/memory-engine/sync-report.js +6 -2
- package/dist/core/memory-engine/tools.d.ts +2 -2
- package/dist/core/memory-engine/tools.js +10 -10
- package/dist/core/memory-engine/types.d.ts +155 -19
- package/dist/core/memory-engine/types.js +2 -0
- package/dist/core/memory.js +15 -6
- package/dist/core/mode-policy.js +3 -3
- package/dist/core/mods/agent-stations.d.ts +18 -0
- package/dist/core/mods/agent-stations.js +8 -6
- package/dist/core/mods/extension-call.d.ts +4 -0
- package/dist/core/mods/extension-call.js +8 -0
- package/dist/core/mods/stations.d.ts +20 -1
- package/dist/core/mods/stations.js +21 -2
- package/dist/core/mods/tool-call.js +3 -4
- package/dist/core/parent-spec-seat.d.ts +2 -2
- package/dist/core/park-selfcheck.js +2 -2
- package/dist/core/pause-registry.d.ts +2 -0
- package/dist/core/pause-registry.js +3 -0
- package/dist/core/peer-channel.d.ts +5 -0
- package/dist/core/permission-rule-consent.d.ts +26 -8
- package/dist/core/permission-rule-consent.js +76 -36
- package/dist/core/permission-rule-store.d.ts +72 -13
- package/dist/core/permission-rule-store.js +29 -8
- package/dist/core/read-only-shell.js +3 -2
- package/dist/core/redaction-marks.d.ts +8 -0
- package/dist/core/redaction-marks.js +6 -0
- package/dist/core/refusal-echo.d.ts +20 -0
- package/dist/core/refusal-echo.js +33 -0
- package/dist/core/remote-env.d.ts +12 -1
- package/dist/core/remote-env.js +3 -0
- package/dist/core/retention.d.ts +180 -10
- package/dist/core/retention.js +45 -0
- package/dist/core/retired-keys.d.ts +5 -0
- package/dist/core/retired-keys.js +3 -0
- package/dist/core/rule-offer-read.d.ts +0 -4
- package/dist/core/rule-offer-read.js +2 -18
- package/dist/core/runner/child-tree.d.ts +29 -3
- package/dist/core/runner/child-tree.js +39 -16
- package/dist/core/runner/classifier-ladder.d.ts +7 -1
- package/dist/core/runner/classifier-ladder.js +4 -2
- package/dist/core/runner/compact-session.js +10 -7
- package/dist/core/runner/compaction-call-options.d.ts +7 -7
- package/dist/core/runner/compaction-call-options.js +3 -2
- package/dist/core/runner/contracts.d.ts +39 -11
- package/dist/core/runner/delegation-owner.d.ts +10 -3
- package/dist/core/runner/delegation-owner.js +4 -1
- package/dist/core/runner/gate-exit.d.ts +6 -0
- package/dist/core/runner/gate-exit.js +13 -4
- package/dist/core/runner/inherited-ask-grants.js +1 -1
- package/dist/core/runner/memory-consolidation-driver.d.ts +10 -5
- package/dist/core/runner/memory-consolidation-driver.js +12 -9
- package/dist/core/runner/memory-consolidation-write-judge.d.ts +2 -1
- package/dist/core/runner/memory-consolidation-write-judge.js +3 -2
- package/dist/core/runner/person-path-rows.d.ts +8 -3
- package/dist/core/runner/person-path-rows.js +5 -1
- package/dist/core/runner/placement-fence.d.ts +12 -0
- package/dist/core/runner/placement-fence.js +20 -6
- package/dist/core/runner/prepare-ask-lane.js +5 -5
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +7 -2
- package/dist/core/runner/prepare-caps-and-workflow.js +7 -4
- package/dist/core/runner/prepare-config-doors.js +4 -0
- package/dist/core/runner/prepare-delegation-surface.d.ts +3 -0
- package/dist/core/runner/prepare-delegation-surface.js +2 -2
- package/dist/core/runner/prepare-execution-env.js +17 -6
- package/dist/core/runner/prepare-gate-stations.d.ts +5 -0
- package/dist/core/runner/prepare-gate-stations.js +5 -5
- package/dist/core/runner/prepare-hands-readface.d.ts +2 -1
- package/dist/core/runner/prepare-hands-readface.js +5 -4
- package/dist/core/runner/prepare-inherited-gate.d.ts +13 -9
- package/dist/core/runner/prepare-inherited-gate.js +12 -6
- package/dist/core/runner/prepare-memory-engine-session.d.ts +2 -4
- package/dist/core/runner/prepare-memory-engine-session.js +4 -4
- package/dist/core/runner/prepare-memory.d.ts +7 -2
- package/dist/core/runner/prepare-memory.js +41 -39
- package/dist/core/runner/prepare-park-ask.js +4 -3
- package/dist/core/runner/prepare-policy-chain.js +7 -7
- package/dist/core/runner/prepare-prompt-inputs.js +1 -1
- package/dist/core/runner/prepare-task.js +26 -18
- package/dist/core/runner/prepare-wiring-manifest.d.ts +3 -1
- package/dist/core/runner/prepare-wiring-manifest.js +3 -2
- package/dist/core/runner/prepare-workspace-restore.js +3 -6
- package/dist/core/runner/resume-admission.d.ts +2 -2
- package/dist/core/runner/resume-admission.js +2 -23
- package/dist/core/runner/role-resolution-table.d.ts +98 -0
- package/dist/core/runner/role-resolution-table.js +62 -0
- package/dist/core/runner/run-compaction-machinery.js +2 -2
- package/dist/core/runner/run-identity-wiring.js +12 -9
- package/dist/core/runner/run-leg.js +9 -5
- package/dist/core/runner/run-notification-lane.js +22 -22
- package/dist/core/runner/run-recovery-lanes.js +3 -3
- package/dist/core/runner/run-settle-and-teardown.js +3 -2
- package/dist/core/runner/run-terminal-adoption.js +1 -1
- package/dist/core/runner/run-turn-boundary.js +14 -15
- package/dist/core/runner/runtask.js +1 -1
- package/dist/core/runner/terminal-account.js +1 -1
- package/dist/core/runner/tool-occurrence.d.ts +4 -2
- package/dist/core/runner/tool-occurrence.js +2 -2
- package/dist/core/runner-deps.d.ts +7 -3
- package/dist/core/secret-env.d.ts +1 -1
- package/dist/core/secret-env.js +4 -4
- package/dist/core/session-checkout.d.ts +168 -0
- package/dist/core/session-checkout.js +579 -0
- package/dist/core/session-store.d.ts +12 -4
- package/dist/core/session-store.js +23 -3
- package/dist/core/session.d.ts +16 -2
- package/dist/core/session.js +3 -0
- package/dist/core/shell-read-silence.js +8 -0
- package/dist/core/store-contracts/checkpoint-store-contract.d.ts +0 -12
- package/dist/core/store-contracts/checkpoint-store-contract.js +6 -7
- package/dist/core/store-contracts/peer-directory-contract.js +8 -1
- package/dist/core/store-contracts/session-store-contract.js +39 -0
- package/dist/core/task-event.d.ts +30 -5
- package/dist/core/task-notification.d.ts +119 -32
- package/dist/core/task-notification.js +186 -100
- package/dist/core/task-registry-agent.d.ts +25 -2
- package/dist/core/task-registry-agent.js +56 -22
- package/dist/core/task-registry-shared.d.ts +33 -11
- package/dist/core/task-registry.d.ts +33 -9
- package/dist/core/task-registry.js +36 -18
- package/dist/core/task-spec-members.js +1 -1
- package/dist/core/task-spec.d.ts +27 -2
- package/dist/core/tool-errors.d.ts +14 -6
- package/dist/core/tool-errors.js +1 -1
- package/dist/core/tool-policy.d.ts +32 -13
- package/dist/core/tool-policy.js +27 -17
- package/dist/core/tool-result-store.d.ts +20 -0
- package/dist/core/tool-spec.d.ts +42 -19
- package/dist/core/trace.d.ts +3 -2
- package/dist/core/types.d.ts +1 -1
- package/dist/core/untrusted-egress.d.ts +15 -4
- package/dist/core/untrusted-egress.js +23 -22
- package/dist/core/workflow-journal-store.d.ts +11 -0
- package/dist/core/workflow-journal-store.js +7 -0
- package/dist/core/workflow-run-store.d.ts +9 -0
- package/dist/core/workflow-run-store.js +6 -0
- package/dist/core/workspace-snapshot.d.ts +3 -1
- package/dist/core/workspace-snapshot.js +1 -0
- package/dist/engine/compaction/compaction.d.ts +2 -1
- package/dist/engine/harness/types.d.ts +67 -1
- package/dist/engine/harness/types.js +108 -0
- package/dist/engine/session/import-validate.js +6 -1
- package/dist/engine/session/session.d.ts +30 -1
- package/dist/engine/session/session.js +48 -1
- package/dist/index.d.ts +12 -7
- package/dist/index.js +12 -7
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/orchestration/run-workflow-tool.d.ts +8 -1
- package/dist/orchestration/run-workflow-tool.js +8 -0
- package/dist/orchestration/workflow-types.d.ts +2 -1
- package/dist/orchestration/workflow.d.ts +6 -0
- package/dist/orchestration/workflow.js +5 -2
- package/dist/stores/file/checkpoint-store.d.ts +6 -0
- package/dist/stores/file/checkpoint-store.js +4 -1
- package/dist/stores/file/file-history-store.d.ts +13 -0
- package/dist/stores/file/file-history-store.js +75 -13
- package/dist/stores/file/index.d.ts +11 -1
- package/dist/stores/file/index.js +7 -11
- package/dist/stores/file/permission-rule-store.d.ts +23 -0
- package/dist/stores/file/permission-rule-store.js +75 -7
- package/dist/stores/file/session-store.js +2 -1
- package/dist/stores/file/tool-result-store.d.ts +14 -0
- package/dist/stores/file/tool-result-store.js +39 -2
- package/dist/stores/file/workflow-journal-store.d.ts +4 -0
- package/dist/stores/file/workflow-journal-store.js +17 -0
- package/dist/stores/file/workflow-run-store.d.ts +3 -0
- package/dist/stores/file/workflow-run-store.js +15 -0
- package/dist/tools/fs/bash-program-position.js +3 -3
- package/dist/tools/fs/program-read-model.d.ts +34 -10
- package/dist/tools/fs/program-read-model.js +37 -7
- package/dist/tools/fs/program-read-model.rows.js +13 -2
- package/dist/tools/fs/read-deny.d.ts +28 -3
- package/dist/tools/fs/read-deny.js +18 -2
- package/dist/tools/fs/removal-targets.js +3 -3
- package/dist/tools/fs/safety.d.ts +2 -0
- package/dist/tools/fs/safety.js +1 -1
- package/dist/tools/fs/shell-read-argv.d.ts +8 -1
- package/dist/tools/fs/shell-read-argv.js +34 -29
- package/dist/tools/fs/shell-read-bindings.d.ts +2 -0
- package/dist/tools/fs/shell-read-bindings.js +5 -1
- package/dist/tools/fs/shell-read-brace.d.ts +18 -0
- package/dist/tools/fs/shell-read-brace.js +79 -0
- package/dist/tools/fs/shell-read-check.d.ts +8 -2
- package/dist/tools/fs/shell-read-check.js +16 -14
- package/dist/tools/fs/shell-read-establish.js +23 -16
- package/dist/tools/fs/shell-read-judge.d.ts +11 -0
- package/dist/tools/fs/shell-read-judge.js +3 -3
- package/dist/tools/fs/shell-read-plan.d.ts +10 -0
- package/dist/tools/fs/shell-read-plan.js +189 -93
- package/dist/tools/fs/shell-read-start.d.ts +19 -9
- package/dist/tools/fs/shell-read-start.js +20 -12
- package/dist/tools/fs/shell-read-word.d.ts +10 -0
- package/dist/tools/fs/shell-read-word.js +9 -5
- package/dist/tools/fs/shell-read-workdir.d.ts +26 -7
- package/dist/tools/fs/shell-read-workdir.js +73 -12
- package/dist/tools/fs/shell-read-write-targets.js +13 -8
- package/dist/tools/worktree.d.ts +3 -2
- package/dist/tools/worktree.js +7 -35
- package/package.json +3 -2
- package/test/export-surface.snapshot.json +135 -11
- package/wire-changes/core-stores-sql@7.63.0.json +30 -0
- package/wire-changes/core-stores-sql@7.64.0.json +30 -0
- package/wire-changes/core@7.63.0.json +3523 -0
- package/wire-changes/core@7.64.0.json +2653 -0
- package/wire-changes/mods-kernel@7.63.0.json +30 -0
- package/wire-changes/mods-kernel@7.64.0.json +30 -0
- package/wire-changes/primitives@7.63.0.json +445 -0
- package/wire-changes/primitives@7.64.0.json +30 -0
- package/dist/core/credential-vocabulary.d.ts +0 -176
- package/dist/core/credential-vocabulary.js +0 -190
- package/dist/core/redaction-passes.d.ts +0 -82
- package/dist/core/redaction-passes.js +0 -377
|
@@ -64,6 +64,24 @@ export interface StoredRules {
|
|
|
64
64
|
* partition that cannot be read: every call is asked about until a read succeeds.
|
|
65
65
|
*/
|
|
66
66
|
export declare const PERMISSION_RULES_LATER_GRAMMAR_CODE = "permission_rules.later_grammar";
|
|
67
|
+
/**
|
|
68
|
+
* The code a file bucket's refusal carries when the bucket is DETERMINISTICALLY unreadable: the same bytes will be refused the same
|
|
69
|
+
* way on every read until a person repairs or removes them — a link or a file that is not a regular file, bytes that are not JSON, a
|
|
70
|
+
* shape that is not a schema-4 bucket, a checksum that does not match, a rule-grammar stamp that is no whole number, a row whose
|
|
71
|
+
* behavior word is outside the set, or a store directory this engine refuses to use. Every face refuses the bucket whole with it
|
|
72
|
+
* (reads answer zero rules and disclose; a write refuses), so a caller tells "this bucket cannot be read and a retry reads the same" from
|
|
73
|
+
* a read that failed ({@link PERMISSION_RULES_UNREADABLE_BUCKET_CODE}) and from a bucket a newer engine wrote
|
|
74
|
+
* ({@link PERMISSION_RULES_LATER_GRAMMAR_CODE}). Decide by the code, never by the sentence.
|
|
75
|
+
*/
|
|
76
|
+
export declare const PERMISSION_RULES_DAMAGED_BUCKET_CODE = "permission_rules.bucket_damaged";
|
|
77
|
+
/**
|
|
78
|
+
* The code a file bucket's refusal carries when reading it FAILED — the filesystem answered with an error (`EIO`, `EACCES`, …) rather
|
|
79
|
+
* than with bytes this engine judged — so a retry may read it. The system error's name rides on the refusal as its own member `errno`
|
|
80
|
+
* (a string, as the system gave it: `"EIO"`, `"EACCES"`), absent when the failure carried none; it is not part of `code`, which has one
|
|
81
|
+
* vocabulary. A caller that must not act on a bucket it could not read (it is not known to be empty) refuses on this code and may try
|
|
82
|
+
* again; one that meets {@link PERMISSION_RULES_DAMAGED_BUCKET_CODE} has a bucket that will not read until a person acts.
|
|
83
|
+
*/
|
|
84
|
+
export declare const PERMISSION_RULES_UNREADABLE_BUCKET_CODE = "permission_rules.bucket_unreadable";
|
|
67
85
|
/**
|
|
68
86
|
* The durable partition's read face: read-only, already anchored to a single owner. Rows carry the two
|
|
69
87
|
* durable scopes only (`global` = the `user` source, `project` = the `project` source); a session row
|
|
@@ -596,11 +614,19 @@ export type RemovalLiveness = (typeof REMOVAL_LIVENESS_WORDS)[number];
|
|
|
596
614
|
* What a terminal write FAILURE may claim about the bytes — the failure half of the honesty
|
|
597
615
|
* {@link RemovalLiveness} keeps on the success half, spelled ONCE and read by every write entry here.
|
|
598
616
|
*
|
|
599
|
-
*
|
|
617
|
+
* ONE reading: the word answers "has the store ITSELF settled whether anything this call wrote stands?".
|
|
618
|
+
*
|
|
619
|
+
* `"no"` = it has, and nothing does: a face that cannot write at all, a target the type face refuses,
|
|
600
620
|
* a read that failed before any write, a refused preflight, an epoch seal, a compare-and-set that lost
|
|
601
|
-
* every attempt. Each of those is the store saying nothing landed, so saying it is a fact.
|
|
602
|
-
*
|
|
603
|
-
*
|
|
621
|
+
* every attempt. Each of those is the store saying nothing landed, so saying it is a fact. The same word
|
|
622
|
+
* covers a write that DID land and that a read which SUCCEEDED then finds removed (a redemption walk's
|
|
623
|
+
* `dot_removed`): the add's dot is in the raw state under its tombstone, the rule does not stand, and the
|
|
624
|
+
* store has said so — the word is about whether the call's rule stands, never about the history of the
|
|
625
|
+
* bytes, and a retry of the same ticket re-reads the same tombstone (a new consent is what lands it).
|
|
626
|
+
* `"unknown"` = it has not: the apply THREW, which proves nothing either way (a backend can commit and
|
|
627
|
+
* then lose its acknowledgement), or the read-back that would have settled it could not be taken. A
|
|
628
|
+
* settled absence is never `unknown`: that word would send the caller to reconcile with `list()` for an
|
|
629
|
+
* answer the store already gave.
|
|
604
630
|
*
|
|
605
631
|
* The word exists because the caller's two branches — retry, or reconcile with `list()` — are not
|
|
606
632
|
* derivable from the failure PROSE. A consumer reading the strength out of the sentence is parsing a
|
|
@@ -608,6 +634,38 @@ export type RemovalLiveness = (typeof REMOVAL_LIVENESS_WORDS)[number];
|
|
|
608
634
|
*/
|
|
609
635
|
export declare const RULE_WRITE_COMMITTED_WORDS: readonly ["no", "unknown"];
|
|
610
636
|
export type RuleWriteCommitted = (typeof RULE_WRITE_COMMITTED_WORDS)[number];
|
|
637
|
+
/**
|
|
638
|
+
* WHY a redemption was refused — the cause, spelled once and read by every refused row: the single-ticket leg, the
|
|
639
|
+
* member table of a batch walk, and the landing under both. A refusal carries a `reason` for a person AND one of these
|
|
640
|
+
* words, so a consumer that has to branch on the cause reads a word and never the start of a sentence. One word per
|
|
641
|
+
* CAUSE, every place that refuses names one, and there is deliberately no catch-all: a refusal nobody classified is a
|
|
642
|
+
* compile error at the place that mints it, never an `other`.
|
|
643
|
+
*
|
|
644
|
+
* It rides beside {@link RuleWriteCommitted}, and the two answer different questions. The code says what stopped the
|
|
645
|
+
* redemption; `committed` says what may be claimed about the bytes. The same code can carry both words (`store_read`:
|
|
646
|
+
* a read before any write says `no`, a read-back after one that could not be taken says `unknown`).
|
|
647
|
+
*
|
|
648
|
+
* - `unsupported.layer_root` — an import record's global rule written from `/`, which no stored row can hold
|
|
649
|
+
* - `ticket_invalid` — the ticket does not name a candidate (unparseable, or an index the record has none at)
|
|
650
|
+
* - `record_missing` — no approval record is stored under the ticket's id
|
|
651
|
+
* - `wrong_principal` — the record belongs to another owner than the caller
|
|
652
|
+
* - `record_schema_stale` — the record predates the current form, so the decision it carried is not read
|
|
653
|
+
* - `not_confirmed` — the record is still pending; nobody has said yes
|
|
654
|
+
* - `record_malformed` — the record fails the structural precondition, or is settled but names no chosen offer
|
|
655
|
+
* - `not_chosen` — the candidate is outside the offer the person chose
|
|
656
|
+
* - `parse_rejected` — the candidate's rule text no longer passes the one validator
|
|
657
|
+
* - `store_unavailable` — the owner's store cannot be resolved, or has no write face
|
|
658
|
+
* - `record_changed` — the record moved under this redemption and the dot it needed is not there
|
|
659
|
+
* - `withheld` — held back because the batch's deny/ask members do not all stand, and an allow may not stand wider
|
|
660
|
+
* - `store_read` — a store read failed: the permission-rule store's, or the approval record's (before the write: `no`; the read-back after it: `unknown`)
|
|
661
|
+
* - `store_write` — the write threw, answered unreadably, or was reported landed with no trace of its dot; or the approval record's compare-and-set that records the dot, or the dot's allocation, threw (`unknown`)
|
|
662
|
+
* - `session_ended` — a session-scope rule whose session has ended; a late redemption cannot revive it
|
|
663
|
+
* - `occ` — every optimistic-concurrency attempt lost its compare-and-set
|
|
664
|
+
* - `dot_removed` — the member's redeemed dot is no longer live in the store (the rule was removed since); its
|
|
665
|
+
* `committed` is `no`, the store having settled that the rule does not stand ({@link RuleWriteCommitted})
|
|
666
|
+
*/
|
|
667
|
+
export declare const RULE_REFUSAL_CODES: readonly ["unsupported.layer_root", "ticket_invalid", "record_missing", "wrong_principal", "record_schema_stale", "not_confirmed", "record_malformed", "not_chosen", "parse_rejected", "store_unavailable", "record_changed", "withheld", "store_read", "store_write", "session_ended", "occ", "dot_removed"];
|
|
668
|
+
export type RuleRefusalCode = (typeof RULE_REFUSAL_CODES)[number];
|
|
611
669
|
/**
|
|
612
670
|
* The result of a removal.
|
|
613
671
|
*
|
|
@@ -639,8 +697,8 @@ export type RemoveResult =
|
|
|
639
697
|
}
|
|
640
698
|
/** Terminal failure, in one of two strengths — word for word the dual of {@link AddResult}'s, and
|
|
641
699
|
* `committed` is the word for it ({@link RuleWriteCommitted}), so the strength is READ, not parsed out
|
|
642
|
-
* of the sentence. When the STORE answered every attempt (the
|
|
643
|
-
* landed: `committed: "no"`, and the read-back confirms it in the text. When the apply THREW, a missing
|
|
700
|
+
* of the sentence (the one reading is {@link RuleWriteCommitted}'s). When the STORE answered every attempt (the
|
|
701
|
+
* compare-and-set simply lost), nothing landed: `committed: "no"`, and the read-back confirms it in the text. When the apply THREW, a missing
|
|
644
702
|
* tombstone cannot tell a write that never landed from one whose evidence a paired collection erased
|
|
645
703
|
* (`collectBelowFrontier` recycles a tombstone together with the adds it covered), so that outcome is
|
|
646
704
|
* `committed: "unknown"`, reported INDETERMINATE, and the caller reconciles with `list()` rather than
|
|
@@ -683,14 +741,14 @@ export type RuleAddLanding = {
|
|
|
683
741
|
landed: true;
|
|
684
742
|
rev: number;
|
|
685
743
|
}
|
|
686
|
-
/** `committed` is what the caller may CLAIM afterwards
|
|
687
|
-
*
|
|
688
|
-
*
|
|
689
|
-
* THREW, which proves nothing either way: a backend can commit and then lose its acknowledgement. */
|
|
744
|
+
/** `committed` is what the caller may CLAIM afterwards, read as {@link RuleWriteCommitted} reads it (defined there, once).
|
|
745
|
+
* `code` is the cause ({@link RuleRefusalCode}); this path mints five of them (`withheld`, `store_read`,
|
|
746
|
+
* `store_write`, `session_ended`, `occ`), so a door never reads the cause out of `reason`. */
|
|
690
747
|
| {
|
|
691
748
|
landed: false;
|
|
692
749
|
reason: string;
|
|
693
750
|
committed: RuleWriteCommitted;
|
|
751
|
+
code: RuleRefusalCode;
|
|
694
752
|
};
|
|
695
753
|
/**
|
|
696
754
|
* Land ONE add — the terminal write both doors take (the consent protocol's redemption and the
|
|
@@ -733,10 +791,11 @@ export type AddResult =
|
|
|
733
791
|
status: "no-op";
|
|
734
792
|
rev: number;
|
|
735
793
|
}
|
|
736
|
-
/** Terminal failure, in one of two strengths the `error` text distinguishes
|
|
794
|
+
/** Terminal failure, in one of two strengths the `error` text distinguishes (read as {@link RuleWriteCommitted}
|
|
795
|
+
* reads them). When the STORE answered
|
|
737
796
|
* (a read that failed before any write, a refused preflight, an epoch seal, a compare-and-set that
|
|
738
|
-
* lost every attempt) nothing landed and the text says so plainly. When the apply THREW
|
|
739
|
-
* may have committed and lost its acknowledgement: the read-back asks the raw face, where an add
|
|
797
|
+
* lost every attempt) nothing landed and the text says so plainly. When the apply THREW (or reported a landing
|
|
798
|
+
* that could not be witnessed), the write may have committed and lost its acknowledgement: the read-back asks the raw face, where an add
|
|
740
799
|
* survives the tombstone a concurrent removal laid on it — but a sync collection can erase even
|
|
741
800
|
* that, so a dot it cannot find is reported INDETERMINATE rather than as a confirmed nothing, and
|
|
742
801
|
* the caller reconciles with `list()` instead of retrying blind (a blind retry mints a fresh dot and
|
|
@@ -5,6 +5,8 @@ import { readRuleOwner } from "./rule-owner.js";
|
|
|
5
5
|
import { thrownText } from "./thrown-value.js";
|
|
6
6
|
import { validatePath } from "./effective-path-target.js";
|
|
7
7
|
export const PERMISSION_RULES_LATER_GRAMMAR_CODE = "permission_rules.later_grammar";
|
|
8
|
+
export const PERMISSION_RULES_DAMAGED_BUCKET_CODE = "permission_rules.bucket_damaged";
|
|
9
|
+
export const PERMISSION_RULES_UNREADABLE_BUCKET_CODE = "permission_rules.bucket_unreadable";
|
|
8
10
|
export function isRuleRevision(rev) {
|
|
9
11
|
return typeof rev === "number" && Number.isSafeInteger(rev) && rev >= 0;
|
|
10
12
|
}
|
|
@@ -467,6 +469,25 @@ export async function ruleStoreChecksum(payload) {
|
|
|
467
469
|
}
|
|
468
470
|
export const REMOVAL_LIVENESS_WORDS = Object.freeze(["yes", "no", "unknown"]);
|
|
469
471
|
export const RULE_WRITE_COMMITTED_WORDS = Object.freeze(["no", "unknown"]);
|
|
472
|
+
export const RULE_REFUSAL_CODES = Object.freeze([
|
|
473
|
+
"unsupported.layer_root",
|
|
474
|
+
"ticket_invalid",
|
|
475
|
+
"record_missing",
|
|
476
|
+
"wrong_principal",
|
|
477
|
+
"record_schema_stale",
|
|
478
|
+
"not_confirmed",
|
|
479
|
+
"record_malformed",
|
|
480
|
+
"not_chosen",
|
|
481
|
+
"parse_rejected",
|
|
482
|
+
"store_unavailable",
|
|
483
|
+
"record_changed",
|
|
484
|
+
"withheld",
|
|
485
|
+
"store_read",
|
|
486
|
+
"store_write",
|
|
487
|
+
"session_ended",
|
|
488
|
+
"occ",
|
|
489
|
+
"dot_removed",
|
|
490
|
+
]);
|
|
470
491
|
function resolveRuleWriter(store) {
|
|
471
492
|
let w;
|
|
472
493
|
try {
|
|
@@ -641,35 +662,35 @@ export async function landRuleAdd(args) {
|
|
|
641
662
|
rev = snapshot.rev;
|
|
642
663
|
const refusal = await args.preflight?.(snapshot);
|
|
643
664
|
if (refusal !== undefined)
|
|
644
|
-
return { landed: false, reason: refusal, committed: "no" };
|
|
665
|
+
return { landed: false, reason: refusal, committed: "no", code: "withheld" };
|
|
645
666
|
}
|
|
646
667
|
catch (err) {
|
|
647
|
-
return { landed: false, reason: `could not read the permission-rule store: ${errText(err)}`, committed: "no" };
|
|
668
|
+
return { landed: false, reason: `could not read the permission-rule store: ${errText(err)}`, committed: "no", code: "store_read" };
|
|
648
669
|
}
|
|
649
670
|
let res;
|
|
650
671
|
try {
|
|
651
672
|
res = await args.writer.apply(args.delta, { expectedRev: rev });
|
|
652
673
|
}
|
|
653
674
|
catch (err) {
|
|
654
|
-
return { landed: false, reason: `the permission-rule store refused the write: ${errText(err)}`, committed: "unknown" };
|
|
675
|
+
return { landed: false, reason: `the permission-rule store refused the write: ${errText(err)}`, committed: "unknown", code: "store_write" };
|
|
655
676
|
}
|
|
656
677
|
const reading = readRuleWriteOutcome(res);
|
|
657
678
|
if (reading.kind === "refused")
|
|
658
|
-
return { landed: false, reason: SESSION_ENDED_REFUSAL, committed: "no" };
|
|
679
|
+
return { landed: false, reason: SESSION_ENDED_REFUSAL, committed: "no", code: "session_ended" };
|
|
659
680
|
if (reading.kind === "unreadable")
|
|
660
|
-
return { landed: false, reason: `the permission-rule store answered the write unreadably: ${reading.why}`, committed: "unknown" };
|
|
681
|
+
return { landed: false, reason: `the permission-rule store answered the write unreadably: ${reading.why}`, committed: "unknown", code: "store_write" };
|
|
661
682
|
if (reading.kind === "landed") {
|
|
662
683
|
const witness = await witnessRuleAdd(args.store, args.writer, args.delta);
|
|
663
684
|
if ("unreadable" in witness) {
|
|
664
|
-
return { landed: false, reason: `the permission-rule store reported a landing at revision ${String(reading.rev)}, and the read-back that would have witnessed it could not be taken (${witness.unreadable})`, committed: "unknown" };
|
|
685
|
+
return { landed: false, reason: `the permission-rule store reported a landing at revision ${String(reading.rev)}, and the read-back that would have witnessed it could not be taken (${witness.unreadable})`, committed: "unknown", code: "store_read" };
|
|
665
686
|
}
|
|
666
687
|
if (!witness.seen) {
|
|
667
|
-
return { landed: false, reason: `the permission-rule store reported a landing at revision ${String(reading.rev)}, and a read-back of this add's own dot finds no trace of it — a revision says the ANSWER was well formed, not that a row exists, so nothing here can say the write landed`, committed: "unknown" };
|
|
688
|
+
return { landed: false, reason: `the permission-rule store reported a landing at revision ${String(reading.rev)}, and a read-back of this add's own dot finds no trace of it — a revision says the ANSWER was well formed, not that a row exists, so nothing here can say the write landed`, committed: "unknown", code: "store_write" };
|
|
668
689
|
}
|
|
669
690
|
return { landed: true, rev: reading.rev };
|
|
670
691
|
}
|
|
671
692
|
}
|
|
672
|
-
return { landed: false, reason: `optimistic-concurrency retries exhausted after ${RULE_ADD_MAX_ATTEMPTS} attempts`, committed: "no" };
|
|
693
|
+
return { landed: false, reason: `optimistic-concurrency retries exhausted after ${RULE_ADD_MAX_ATTEMPTS} attempts`, committed: "no", code: "occ" };
|
|
673
694
|
}
|
|
674
695
|
export async function addPersistedRule(opts) {
|
|
675
696
|
const behavior = opts.behavior;
|
|
@@ -3,6 +3,7 @@ import { lexedWordOf, readShellCommand } from "./shell-run-candidates.js";
|
|
|
3
3
|
import { unlistedReaderSentence } from "../tools/fs/bash-readonly-classifier.js";
|
|
4
4
|
import { descriptorsOfPlan, newLineDescriptors, standardDeviceUnrebound } from "../tools/fs/shell-read-device.js";
|
|
5
5
|
import { planShellReads } from "../tools/fs/shell-read-plan.js";
|
|
6
|
+
import { programKeyOf } from "../tools/fs/program-read-model.js";
|
|
6
7
|
import { writesOnlyStandardDevices } from "../tools/fs/shell-read-write-targets.js";
|
|
7
8
|
import { FIND_ACTION_PRIMARIES, FIND_NEWER_PRIMARY, FIND_VALUE_PRIMARIES, FLAG_VALUE_ACCEPTS, READ_ONLY_BARE_ONLY, READ_ONLY_BARE_PROGRAMS, READ_ONLY_COMMAND_TABLE, READ_ONLY_ENV_NAMES, READ_ONLY_EXACT_FORMS, READ_ONLY_GLOB_PROGRAMS, XARGS_READ_ONLY_TARGETS, dockerRetargetDanger, } from "./read-only-shell-table.js";
|
|
8
9
|
const NOT = (reason) => ({ readOnly: false, reason });
|
|
@@ -182,7 +183,7 @@ function segmentVerdict(seg, line, bindings, readers) {
|
|
|
182
183
|
return unlisted;
|
|
183
184
|
if (run.some((w) => expansionKind(w) === "glob"))
|
|
184
185
|
return GLOB_PROGRAMS.has(program) ? READ_ONLY : NOT(`\`${program}\` with a glob argument — the glob may name anything`);
|
|
185
|
-
if (DEVICE_WRITERS.has(program) && writesOnlyStandardDevices(program, words.slice(1), bindings()))
|
|
186
|
+
if (DEVICE_WRITERS.has(programKeyOf(program)) && writesOnlyStandardDevices(program, words.slice(1), bindings()))
|
|
186
187
|
return READ_ONLY;
|
|
187
188
|
const structural = structuralReading(words);
|
|
188
189
|
if (structural !== null)
|
|
@@ -192,7 +193,7 @@ function segmentVerdict(seg, line, bindings, readers) {
|
|
|
192
193
|
export function lineDescriptorsOfText(command) {
|
|
193
194
|
return descriptorsOfPlan(planShellReads(command, { readers: new Set(), cwd: "/", roots: [] }));
|
|
194
195
|
}
|
|
195
|
-
const DEVICE_WRITERS = new Set(["tee", "cp"]);
|
|
196
|
+
const DEVICE_WRITERS = new Set(["tee", "cp", "dd"]);
|
|
196
197
|
function structuralReading(words) {
|
|
197
198
|
const program = words[0];
|
|
198
199
|
if (BARE_ONLY.has(program))
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SecretNotation } from "@sema-agent/primitives";
|
|
1
2
|
/** The marks, by what they stand for. `whole` is the bare mark (a span removed whole — a credential value, a floor, a
|
|
2
3
|
* depth cut); the others name the shape that was withheld: `credentials` a URL's userinfo, `url` a whole URL, `path` an
|
|
3
4
|
* absolute filesystem path. A mark the engine writes is exactly one of these four. Frozen: the table is exported to hosts, and every
|
|
@@ -10,6 +11,13 @@ export declare const REDACTION_MARKS: Readonly<{
|
|
|
10
11
|
}>;
|
|
11
12
|
/** The bare mark — what a host compares against to tell that the engine withheld a value. */
|
|
12
13
|
export declare const REDACTION_MARK: "[redacted]";
|
|
14
|
+
/** The engine's notation for the credential renderer (`renderSecrets`): a credential value is the bare mark, a URL userinfo
|
|
15
|
+
* the credentials mark, and a text no reading can afford is the bare mark whole. Built from the table, so it follows it. */
|
|
16
|
+
export declare const REDACTION_NOTATION: SecretNotation;
|
|
17
|
+
/** The spelling a request-route rendering writes for a withheld query value or URL user (`«redacted»`) — shown to a person
|
|
18
|
+
* in a refusal or a route display, never written by a redaction pass. It is not a member of {@link REDACTION_MARKS}: the
|
|
19
|
+
* marks the readers below recognize are that table's four, and this spelling is not one of them. */
|
|
20
|
+
export declare const WITHHELD_VALUE_MARK = "\u00ABredacted\u00BB";
|
|
13
21
|
/** Where the marks sit in `s`, one [start, end) span at a time, leftmost first. Lazy: a reader that stops early (a display cut stops
|
|
14
22
|
* at its bound) pays for the marks it looked at, not for every mark an input of a million of them holds. */
|
|
15
23
|
export declare function eachRedactionMarkerSpan(s: string): Generator<[number, number], void, undefined>;
|
|
@@ -5,6 +5,12 @@ export const REDACTION_MARKS = Object.freeze({
|
|
|
5
5
|
path: "[redacted-path]",
|
|
6
6
|
});
|
|
7
7
|
export const REDACTION_MARK = REDACTION_MARKS.whole;
|
|
8
|
+
export const REDACTION_NOTATION = Object.freeze({
|
|
9
|
+
value: REDACTION_MARKS.whole,
|
|
10
|
+
byKind: Object.freeze({ "url-credentials": REDACTION_MARKS.credentials }),
|
|
11
|
+
overStrip: REDACTION_MARKS.whole,
|
|
12
|
+
});
|
|
13
|
+
export const WITHHELD_VALUE_MARK = "«redacted»";
|
|
8
14
|
const escapeLiteral = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
9
15
|
const REDACTION_MARKER_RE = new RegExp(Object.values(REDACTION_MARKS).map(escapeLiteral).join("|"), "g");
|
|
10
16
|
export function* eachRedactionMarkerSpan(s) {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** What a quoted span of a refusal sentence IS: a file path, a command line, or a deny/rule pattern. */
|
|
2
|
+
export declare const REFUSAL_ECHO_KINDS: readonly ["path", "command", "pattern"];
|
|
3
|
+
export type RefusalEchoKind = (typeof REFUSAL_ECHO_KINDS)[number];
|
|
4
|
+
/** Membership test for {@link RefusalEchoKind}. */
|
|
5
|
+
export declare function isRefusalEchoKind(v: unknown): v is RefusalEchoKind;
|
|
6
|
+
/**
|
|
7
|
+
* One literal the sentence quotes, in the order the sentence quotes them. `value` is the literal as the refusing judge
|
|
8
|
+
* held it — the sentence elides the middle of a long one, this member never does. `canonical` stands on a `path` whose
|
|
9
|
+
* canonical target the sentence also names because the two differ.
|
|
10
|
+
*/
|
|
11
|
+
export interface RefusalEcho {
|
|
12
|
+
readonly kind: RefusalEchoKind;
|
|
13
|
+
readonly value: string;
|
|
14
|
+
readonly canonical?: string;
|
|
15
|
+
}
|
|
16
|
+
/** The defects of `v` read as a list of {@link RefusalEcho} (an empty list is a clean one): a dense non-empty array holding nothing
|
|
17
|
+
* but its elements (no hole, no member of its own beside them — a method name or a symbol on the array is read by nobody here and
|
|
18
|
+
* JSON drops it), of records that hold exactly `kind` (a member of the set), `value` (a non-empty string) and, on a `path`, an
|
|
19
|
+
* optional non-empty `canonical`. Reads the list by index alone: no method of a caller's array is ever called. */
|
|
20
|
+
export declare function refusalEchoDefects(v: unknown): string[];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { strayMembersOf } from "./own-property-receipt.js";
|
|
2
|
+
const ECHO_MEMBERS = Object.freeze(["kind", "value", "canonical"]);
|
|
3
|
+
const ECHO_WORDS = Object.freeze({ subject: "an echo", unit: "member", moment: "at the gate record" });
|
|
4
|
+
export const REFUSAL_ECHO_KINDS = Object.freeze(["path", "command", "pattern"]);
|
|
5
|
+
const KIND_SET = new Set(REFUSAL_ECHO_KINDS);
|
|
6
|
+
export function isRefusalEchoKind(v) {
|
|
7
|
+
return KIND_SET.has(v);
|
|
8
|
+
}
|
|
9
|
+
export function refusalEchoDefects(v) {
|
|
10
|
+
if (!Array.isArray(v) || v.length === 0)
|
|
11
|
+
return ["echoed is not a non-empty list"];
|
|
12
|
+
const out = [];
|
|
13
|
+
if (Reflect.ownKeys(v).length !== v.length + 1)
|
|
14
|
+
out.push("echoed holds a hole or a member that is no element");
|
|
15
|
+
for (let i = 0; i < v.length; i++) {
|
|
16
|
+
const e = v[i];
|
|
17
|
+
if (typeof e !== "object" || e === null || Array.isArray(e)) {
|
|
18
|
+
out.push(`echoed[${i}] is not an object`);
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
const r = e;
|
|
22
|
+
if (!isRefusalEchoKind(r.kind))
|
|
23
|
+
out.push(`echoed[${i}].kind is outside the closed set`);
|
|
24
|
+
if (typeof r.value !== "string" || r.value === "")
|
|
25
|
+
out.push(`echoed[${i}].value is not a non-empty string`);
|
|
26
|
+
if (r.canonical !== undefined && (typeof r.canonical !== "string" || r.canonical === "" || r.kind !== "path"))
|
|
27
|
+
out.push(`echoed[${i}].canonical stands only on a path, as a non-empty string`);
|
|
28
|
+
const stray = strayMembersOf(r, ECHO_WORDS, ECHO_MEMBERS);
|
|
29
|
+
if (stray !== undefined)
|
|
30
|
+
out.push(`echoed[${i}]: ${stray.sentence}`);
|
|
31
|
+
}
|
|
32
|
+
return out;
|
|
33
|
+
}
|
|
@@ -512,7 +512,11 @@ export interface ExecutionEnvFactoryContext {
|
|
|
512
512
|
* main session's cwd. A single-user/TOC factory SHOULD root the child env here (unless `isolation`
|
|
513
513
|
* requests a worktree — that wins); a multi-tenant/TOB factory minting isolated containers may ignore
|
|
514
514
|
* it. Absent on top-level tasks. Static shared-`executionEnv` deployments need nothing — the child
|
|
515
|
-
* already shares the parent env (and its cwd).
|
|
515
|
+
* already shares the parent env (and its cwd). When the parent works in a managed tree (a session's own
|
|
516
|
+
* tree), the child MUST be rooted at this hint or inside that tree: an env the factory roots elsewhere on
|
|
517
|
+
* the host — the base checkout the tree isolates, another tree — is refused before the child's first turn
|
|
518
|
+
* (`workspace.isolation_unavailable`, `factory_ignored_hint`); a declared sandbox off the host's disk
|
|
519
|
+
* (`hostLocalPaths: false` with `isolation: true`) is another namespace and is not judged.
|
|
516
520
|
*/
|
|
517
521
|
parentCwd?: string;
|
|
518
522
|
/**
|
|
@@ -746,6 +750,13 @@ export declare function declaredHostLocalPaths(env: Pick<ExecutionEnv, "capabili
|
|
|
746
750
|
* engine never presents a path it cannot vouch for as a host path. Total: it never throws.
|
|
747
751
|
*/
|
|
748
752
|
export declare function pathsAreHostLocal(env: Pick<ExecutionEnv, "capabilities">): boolean;
|
|
753
|
+
/**
|
|
754
|
+
* Is this environment a DECLARED sandbox off the host's disk — its paths another namespace's (`hostLocalPaths: false`) and its
|
|
755
|
+
* containment its own job (`isolation: true`)? The one reading that exempts an environment from comparing its paths with the
|
|
756
|
+
* caller's: the worktree request's guard and a delegated child's caller-tree floor both take it. Only the two declarations
|
|
757
|
+
* together earn it; an undeclared or non-isolated environment off the host's disk (an SSH host, a device) does not. Total.
|
|
758
|
+
*/
|
|
759
|
+
export declare function isDeclaredSandboxOffHost(env: Pick<ExecutionEnv, "capabilities">): boolean;
|
|
749
760
|
/**
|
|
750
761
|
* Does content this environment produces come from outside the deployment's trust boundary
|
|
751
762
|
* ({@link ExecutionEnvCapabilities.externalContentTarget})? Three states: `true`, `false`, or `"undeclared"` (absent, not a
|
package/dist/core/remote-env.js
CHANGED
|
@@ -188,6 +188,9 @@ export function declaredHostLocalPaths(env) {
|
|
|
188
188
|
export function pathsAreHostLocal(env) {
|
|
189
189
|
return declaredHostLocalPaths(env) === true;
|
|
190
190
|
}
|
|
191
|
+
export function isDeclaredSandboxOffHost(env) {
|
|
192
|
+
return declaredHostLocalPaths(env) === false && isIsolated(env);
|
|
193
|
+
}
|
|
191
194
|
export function targetIsExternal(env) {
|
|
192
195
|
return declaredCapability(env, "externalContentTarget") ?? UNDECLARED_CAPABILITY_READING.externalContentTarget.reads;
|
|
193
196
|
}
|
package/dist/core/retention.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import type { EngineStorageBackend } from "./engine-storage-backend.js";
|
|
2
|
+
import type { MemoryStore } from "./memory.js";
|
|
3
|
+
import type { WorkflowRunStore } from "./workflow-run-store.js";
|
|
1
4
|
/** A store's retention declaration: `"managed"` = this store's rows are deleted on schedule by the
|
|
2
5
|
* deployment; `"none"` = nothing deletes them on schedule. Absent ⇒ read fail-closed as `"none"`. */
|
|
3
6
|
export type RetentionDeclaration = "managed" | "none";
|
|
@@ -30,7 +33,7 @@ export interface RetentionPolicy {
|
|
|
30
33
|
/**
|
|
31
34
|
* The executor that deletes the rows of the stores declaring `retention: "managed"` — a backend's
|
|
32
35
|
* `retention` member (contract TYPE — core ships no implementation; the server half consumes this.
|
|
33
|
-
*
|
|
36
|
+
* The legs it calls, store by store and in order, are {@link RETENTION_CASCADE}). A deployment
|
|
34
37
|
* that declares a store managed runs one over that store's rows. Every method is expected to be:
|
|
35
38
|
* - **tenant-domain scoped**: work is enumerated and executed per retention domain (tenant/scope),
|
|
36
39
|
* never as one global sweep;
|
|
@@ -45,7 +48,10 @@ export interface RetentionPolicy {
|
|
|
45
48
|
* therefore the CALL's three counts, deliberately not an audit row. Where the deletion and the
|
|
46
49
|
* sweep's context live on two sides — a SQL backend writes the deletion, the deployment holds the op —
|
|
47
50
|
* the deployment writes the audit row through the backend's `audit` transaction hook, inside the
|
|
48
|
-
* deleting transaction, from the receipt it is handed there
|
|
51
|
+
* deleting transaction, from the receipt it is handed there;
|
|
52
|
+
* - **bounded by its call**: each call carries its own `cutoffMs`, computed by the party that runs the
|
|
53
|
+
* sweep (from its own horizon, e.g. a host's cleanup period in days) — an executor never reads
|
|
54
|
+
* {@link RetentionPolicy.maxAgeDays}, which is the startup check's to judge.
|
|
49
55
|
*/
|
|
50
56
|
export interface ManagedRetentionCapability {
|
|
51
57
|
/** Enumerate the retention domains (tenant/scope keys) this store holds data for. */
|
|
@@ -60,7 +66,8 @@ export interface ManagedRetentionCapability {
|
|
|
60
66
|
/** Lineage-aware transcript/session deletion: a session tree is deleted only when no live
|
|
61
67
|
* reference (fork child, background child, workflow run, pending checkpoint) still points into
|
|
62
68
|
* it — references are re-checked inside the deletion transaction, never assumed from a prior
|
|
63
|
-
* scan; {@link RETENTION_CASCADE_EXEMPT} is never deleted with one.
|
|
69
|
+
* scan; {@link RETENTION_CASCADE_EXEMPT} is never deleted with one. What one session's deletion
|
|
70
|
+
* erases, and in which order, is {@link RETENTION_CASCADE}'s session-tree legs. */
|
|
64
71
|
deleteExpiredSessions(input: {
|
|
65
72
|
domain: string;
|
|
66
73
|
cutoffMs: number;
|
|
@@ -72,6 +79,176 @@ export interface ManagedRetentionCapability {
|
|
|
72
79
|
cutoffMs: number;
|
|
73
80
|
}): Promise<RetentionReceipt>;
|
|
74
81
|
}
|
|
82
|
+
/** @contract retention.cascade_domains — the executor's three destructive operations, one domain each: checkpoint expiry
|
|
83
|
+
* (`expireCheckpoints`), session-tree deletion (`deleteExpiredSessions`) and orphan tool-result deletion
|
|
84
|
+
* (`deleteOrphanToolResults`). Every leg of {@link RETENTION_CASCADE} belongs to exactly one of them, and each has a leg. */
|
|
85
|
+
export declare const RETENTION_CASCADE_DOMAINS: readonly ["checkpoints", "session-trees", "orphan-tool-results"];
|
|
86
|
+
/** One of {@link RETENTION_CASCADE_DOMAINS}. */
|
|
87
|
+
export type RetentionCascadeDomain = (typeof RETENTION_CASCADE_DOMAINS)[number];
|
|
88
|
+
/** @contract retention.governance_records_outlive_the_purge — the pollution marker dir, the capture
|
|
89
|
+
* opt-out record dir and the lineage ledger are governance FACTS about content that exists, not
|
|
90
|
+
* session data: deleting them makes a one-way privacy record revocable. */
|
|
91
|
+
export declare const RETENTION_CASCADE_EXEMPT: readonly ["session-pollution", "session-capture-optout", "lineage.json"];
|
|
92
|
+
/** The stores {@link RETENTION_CASCADE} covers, by seat name: every store member of {@link EngineStorageBackend}, the memory
|
|
93
|
+
* store the bundled file backend carries beside them, and the workflow-run store a deployment constructs itself. */
|
|
94
|
+
export type RetentionCascadeStores = Omit<EngineStorageBackend, "retention" | "dispose"> & {
|
|
95
|
+
readonly memoryStore: MemoryStore;
|
|
96
|
+
readonly workflowRunStore: WorkflowRunStore;
|
|
97
|
+
};
|
|
98
|
+
/** One leg of a store's row: the store method a domain's operation calls on it. */
|
|
99
|
+
export interface RetentionCascadeLeg<S = {
|
|
100
|
+
readonly [verb: string]: unknown;
|
|
101
|
+
}> {
|
|
102
|
+
readonly domain: RetentionCascadeDomain;
|
|
103
|
+
/** The store's method — a member of its interface (checked by the table's type). */
|
|
104
|
+
readonly verb: Extract<keyof S, string>;
|
|
105
|
+
/** What the call is given and what it removes. */
|
|
106
|
+
readonly selects: string;
|
|
107
|
+
/** A session-tree leg's place in one session's erasure (ascending; unique across the table). Present on a
|
|
108
|
+
* `"session-trees"` leg, absent on the other two domains' legs, whose operations each call one leg. */
|
|
109
|
+
readonly step?: number;
|
|
110
|
+
/** A fence the leg's store runs before the session's first step, where the store carries it (absent there ⇒ no fence). */
|
|
111
|
+
readonly fence?: Extract<keyof S, string>;
|
|
112
|
+
}
|
|
113
|
+
/** A store's one row: the legs that erase its rows, or why none do. */
|
|
114
|
+
export type RetentionCascadeRow<S = {
|
|
115
|
+
readonly [verb: string]: unknown;
|
|
116
|
+
}> = {
|
|
117
|
+
readonly legs: readonly RetentionCascadeLeg<S>[];
|
|
118
|
+
} | {
|
|
119
|
+
readonly exempt: string;
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* @contract retention.cascade_table — what deleting a session erases, as one table: every store the engine persists in has exactly one
|
|
123
|
+
* row (typed complete against {@link RetentionCascadeStores}), either the legs that erase its rows (domain, verb, what the verb selects,
|
|
124
|
+
* and for a session-tree leg its step) or an exemption naming why its rows are not session data. A session tree is erased child
|
|
125
|
+
* sessions first; within one session every leg's fence runs before the first step, then the steps ascend and the session row's leg
|
|
126
|
+
* is last — a leg that fails leaves the row, so a retry runs the cascade again from its first step and converges. A leg that finds
|
|
127
|
+
* what it erases through another store's rows runs before that store's leg (the journals before the runs, the background agents'
|
|
128
|
+
* boxes before their rows), so a retry still finds them. A workflow run
|
|
129
|
+
* started in a deleted session goes with it, journal included: a later resume of that run from another session is refused
|
|
130
|
+
* `workflow.park_truth_unreadable` with `detail.reason: "record_missing"`, the word an absent prior record already answers. The run
|
|
131
|
+
* store is what indexes runs by session, so a deployment that wires a journal store without one leaves its journals out of reach.
|
|
132
|
+
*/
|
|
133
|
+
export declare const RETENTION_CASCADE: {
|
|
134
|
+
workflowJournalStore: {
|
|
135
|
+
legs: {
|
|
136
|
+
domain: "session-trees";
|
|
137
|
+
step: number;
|
|
138
|
+
verb: "deleteRun";
|
|
139
|
+
selects: string;
|
|
140
|
+
}[];
|
|
141
|
+
};
|
|
142
|
+
workflowRunStore: {
|
|
143
|
+
legs: {
|
|
144
|
+
domain: "session-trees";
|
|
145
|
+
step: number;
|
|
146
|
+
verb: "deleteBySession";
|
|
147
|
+
selects: string;
|
|
148
|
+
}[];
|
|
149
|
+
};
|
|
150
|
+
backgroundAgentStore: {
|
|
151
|
+
legs: {
|
|
152
|
+
domain: "session-trees";
|
|
153
|
+
step: number;
|
|
154
|
+
verb: "delete";
|
|
155
|
+
selects: string;
|
|
156
|
+
}[];
|
|
157
|
+
};
|
|
158
|
+
rosterStore: {
|
|
159
|
+
legs: {
|
|
160
|
+
domain: "session-trees";
|
|
161
|
+
step: number;
|
|
162
|
+
verb: "releaseAgent";
|
|
163
|
+
selects: string;
|
|
164
|
+
}[];
|
|
165
|
+
};
|
|
166
|
+
checkpointStore: {
|
|
167
|
+
legs: ({
|
|
168
|
+
domain: "session-trees";
|
|
169
|
+
step: number;
|
|
170
|
+
verb: "deleteSessionCheckpoints";
|
|
171
|
+
selects: string;
|
|
172
|
+
} | {
|
|
173
|
+
domain: "checkpoints";
|
|
174
|
+
verb: "reap";
|
|
175
|
+
selects: string;
|
|
176
|
+
step?: undefined;
|
|
177
|
+
})[];
|
|
178
|
+
};
|
|
179
|
+
toolResultStore: {
|
|
180
|
+
legs: ({
|
|
181
|
+
domain: "session-trees";
|
|
182
|
+
step: number;
|
|
183
|
+
verb: "deleteBySession";
|
|
184
|
+
selects: string;
|
|
185
|
+
} | {
|
|
186
|
+
domain: "orphan-tool-results";
|
|
187
|
+
verb: "deleteUnattributable";
|
|
188
|
+
selects: string;
|
|
189
|
+
step?: undefined;
|
|
190
|
+
})[];
|
|
191
|
+
};
|
|
192
|
+
sessionPolicyStore: {
|
|
193
|
+
legs: {
|
|
194
|
+
domain: "session-trees";
|
|
195
|
+
step: number;
|
|
196
|
+
verb: "deleteBySession";
|
|
197
|
+
selects: string;
|
|
198
|
+
}[];
|
|
199
|
+
};
|
|
200
|
+
fileHistoryStore: {
|
|
201
|
+
legs: {
|
|
202
|
+
domain: "session-trees";
|
|
203
|
+
step: number;
|
|
204
|
+
verb: "deleteBySession";
|
|
205
|
+
selects: string;
|
|
206
|
+
}[];
|
|
207
|
+
};
|
|
208
|
+
mailboxStore: {
|
|
209
|
+
legs: ({
|
|
210
|
+
domain: "session-trees";
|
|
211
|
+
step: number;
|
|
212
|
+
verb: "drop";
|
|
213
|
+
selects: string;
|
|
214
|
+
fence?: undefined;
|
|
215
|
+
} | {
|
|
216
|
+
domain: "session-trees";
|
|
217
|
+
step: number;
|
|
218
|
+
verb: "drop";
|
|
219
|
+
fence: "retireRecipient";
|
|
220
|
+
selects: string;
|
|
221
|
+
})[];
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
* @contract retention.image_bytes_live_in_the_session_store — a transcript's image bytes have one holder, the engine's session store:
|
|
225
|
+
* they ride the session's log entries, so the session row's leg deletes them. A host that keeps a transcript of its own keeps a
|
|
226
|
+
* reference to them (session id, entry id, block index), never a second copy.
|
|
227
|
+
*/
|
|
228
|
+
sessionStore: {
|
|
229
|
+
legs: ({
|
|
230
|
+
domain: "session-trees";
|
|
231
|
+
step: number;
|
|
232
|
+
verb: "delete";
|
|
233
|
+
selects: string;
|
|
234
|
+
} | {
|
|
235
|
+
domain: "checkpoints";
|
|
236
|
+
verb: "unpin";
|
|
237
|
+
selects: string;
|
|
238
|
+
step?: undefined;
|
|
239
|
+
})[];
|
|
240
|
+
};
|
|
241
|
+
usageWindowStore: {
|
|
242
|
+
exempt: string;
|
|
243
|
+
};
|
|
244
|
+
memoryStore: {
|
|
245
|
+
exempt: string;
|
|
246
|
+
};
|
|
247
|
+
};
|
|
248
|
+
/** One session's erasure in order — {@link RETENTION_CASCADE}'s session-tree legs, ascending by step (the one reading of the order). */
|
|
249
|
+
export declare const RETENTION_SESSION_TREE_STEPS: readonly (RetentionCascadeLeg & {
|
|
250
|
+
readonly store: keyof RetentionCascadeStores;
|
|
251
|
+
})[];
|
|
75
252
|
/**
|
|
76
253
|
* The three counts one destructive retention call produced. NOT an audit row and deliberately
|
|
77
254
|
* identity-free (see the capability's `audited` clause): a scheduler that needs to tell two
|
|
@@ -79,13 +256,6 @@ export interface ManagedRetentionCapability {
|
|
|
79
256
|
* own occurrence id, operation, and timestamp inside the deleting transaction. Adding those here
|
|
80
257
|
* would ask a return value to know its own call context.
|
|
81
258
|
*/
|
|
82
|
-
/** @contract retention.cascade_domains — a managed-retention cascade deletes checkpoint rows,
|
|
83
|
-
* session trees (transcripts and lineage) and orphan tool results; nothing else is session data. */
|
|
84
|
-
export declare const RETENTION_CASCADE_DOMAINS: readonly ["checkpoints", "session-trees", "orphan-tool-results"];
|
|
85
|
-
/** @contract retention.governance_records_outlive_the_purge — the pollution marker dir, the capture
|
|
86
|
-
* opt-out record dir and the lineage ledger are governance FACTS about content that exists, not
|
|
87
|
-
* session data: deleting them makes a one-way privacy record revocable. */
|
|
88
|
-
export declare const RETENTION_CASCADE_EXEMPT: readonly ["session-pollution", "session-capture-optout", "lineage.json"];
|
|
89
259
|
export interface RetentionReceipt {
|
|
90
260
|
domain: string;
|
|
91
261
|
/** Rows destroyed by THIS call (idempotent retries count already-gone rows as 0, not errors). */
|