@sema-agent/core 7.52.0 → 7.54.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 +470 -0
- package/LICENSE +3 -1
- package/README.md +3 -1
- package/dist/agents/cross-session-envelope.d.ts +8 -0
- package/dist/agents/cross-session-envelope.js +6 -0
- package/dist/agents/cross-session-judge.d.ts +21 -1
- package/dist/agents/cross-session-judge.js +8 -0
- package/dist/agents/cross-session-ref.d.ts +5 -0
- package/dist/agents/cross-session-ref.js +1 -0
- package/dist/agents/org-delivery-gate.d.ts +122 -0
- package/dist/agents/org-delivery-gate.js +69 -0
- package/dist/agents/peer-held-queue.d.ts +9 -4
- package/dist/agents/peer-held-queue.js +6 -5
- package/dist/agents/peer-session-drain.d.ts +35 -6
- package/dist/agents/peer-session-drain.js +271 -182
- package/dist/agents/read-inbox-tool.d.ts +7 -0
- package/dist/agents/read-inbox-tool.js +5 -1
- package/dist/agents/send-message-tool.js +3 -4
- package/dist/agents/subagent.d.ts +6 -5
- package/dist/agents/subagent.js +117 -83
- package/dist/agents/tool-filter.d.ts +25 -4
- package/dist/agents/tool-filter.js +13 -3
- package/dist/brain/anthropic.d.ts +6 -1
- package/dist/brain/anthropic.js +4 -4
- package/dist/brain/model-presets.js +2 -1
- package/dist/brain/route-adjudicator.d.ts +6 -0
- package/dist/brain/routing.d.ts +24 -1
- package/dist/brain/routing.js +54 -19
- package/dist/brain/timeout.js +5 -4
- package/dist/core/a2a.d.ts +5 -2
- package/dist/core/a2a.js +33 -14
- package/dist/core/allow-entry.d.ts +3 -1
- package/dist/core/allow-entry.js +3 -2
- package/dist/core/approval-object.d.ts +87 -0
- package/dist/core/approval-object.js +85 -0
- package/dist/core/arg-summary.d.ts +3 -2
- package/dist/core/arg-summary.js +17 -11
- package/dist/core/ask-origin.d.ts +43 -27
- package/dist/core/ask-origin.js +20 -11
- package/dist/core/ask-question.d.ts +0 -1
- package/dist/core/ask-question.js +4 -67
- package/dist/core/ask-unresolvable-notice.d.ts +3 -2
- package/dist/core/auto-compaction.d.ts +106 -50
- package/dist/core/auto-compaction.js +69 -53
- package/dist/core/auto-mode-prompt.d.ts +4 -2
- package/dist/core/auto-mode-prompt.js +4 -3
- package/dist/core/canonical-json.d.ts +69 -0
- package/dist/core/canonical-json.js +130 -8
- package/dist/core/checkpoint-requirements.d.ts +13 -7
- package/dist/core/checkpoint-requirements.js +4 -1
- package/dist/core/checkpoint-store.d.ts +60 -36
- package/dist/core/checkpoint-store.js +7 -6
- package/dist/core/child-clamp-seats.d.ts +45 -6
- package/dist/core/child-clamp-seats.js +56 -4
- package/dist/core/compliance.js +3 -1
- package/dist/core/consolidate-scope.d.ts +1 -1
- package/dist/core/cross-boundary-taint.d.ts +213 -0
- package/dist/core/cross-boundary-taint.js +196 -0
- package/dist/core/decision-receipt.d.ts +44 -1
- package/dist/core/decision-receipt.js +16 -0
- package/dist/core/effective-path-target.d.ts +28 -6
- package/dist/core/effective-path-target.js +28 -2
- package/dist/core/engine-notice.d.ts +47 -4
- package/dist/core/engine-notice.js +17 -1
- package/dist/core/engine-storage-backend.d.ts +73 -0
- package/dist/core/engine-storage-backend.js +1 -0
- package/dist/core/file-history-store.d.ts +6 -2
- package/dist/core/file-history-store.js +1 -0
- package/dist/core/gate-fold.js +13 -4
- package/dist/core/gate-lanes.js +41 -34
- package/dist/core/gate-outcome.d.ts +18 -9
- package/dist/core/governance-codes.d.ts +9 -2
- package/dist/core/governance-codes.js +9 -0
- package/dist/core/hands-band-screen.d.ts +7 -0
- package/dist/core/hands-band-screen.js +32 -0
- package/dist/core/hooks.d.ts +21 -19
- package/dist/core/hooks.js +6 -5
- package/dist/core/locked-config.d.ts +110 -31
- package/dist/core/locked-config.js +155 -42
- package/dist/core/lsp.d.ts +1 -1
- package/dist/core/mcp-probe.js +1 -1
- package/dist/core/mcp-server-spec.d.ts +152 -17
- package/dist/core/mcp-server-spec.js +223 -40
- package/dist/core/mcp.d.ts +21 -14
- package/dist/core/mcp.js +59 -54
- package/dist/core/memory-engine/engine.d.ts +14 -19
- package/dist/core/memory-engine/engine.js +9 -6
- package/dist/core/memory-engine/export-bundle.d.ts +1 -1
- package/dist/core/memory-engine/export-bundle.js +1 -1
- package/dist/core/memory-engine/file-backend.d.ts +2 -6
- package/dist/core/memory-engine/file-backend.js +1 -12
- package/dist/core/memory.d.ts +3 -3
- package/dist/core/mode-policy.d.ts +16 -26
- package/dist/core/mode-policy.js +5 -18
- package/dist/core/mods/kernel/dispatch.js +13 -15
- package/dist/core/mods/kernel/events.d.ts +9 -6
- package/dist/core/mods/kernel/events.js +2 -2
- package/dist/core/mods/kernel/receive.d.ts +41 -11
- package/dist/core/mods/kernel/receive.js +124 -54
- package/dist/core/mods/kernel/site-rules.d.ts +80 -15
- package/dist/core/mods/kernel/site-rules.js +232 -40
- package/dist/core/mods/stations.d.ts +0 -6
- package/dist/core/mods/stations.js +0 -7
- package/dist/core/mounted-mcp.d.ts +57 -0
- package/dist/core/mounted-mcp.js +71 -2
- package/dist/core/own-property-receipt.d.ts +13 -0
- package/dist/core/own-property-receipt.js +3 -1
- package/dist/core/parent-spec-seat.d.ts +12 -15
- package/dist/core/parent-spec-seat.js +14 -6
- package/dist/core/pause-registry.d.ts +35 -1
- package/dist/core/pause-registry.js +10 -0
- package/dist/core/permission-rule-consent.d.ts +18 -5
- package/dist/core/permission-rule-consent.js +13 -8
- package/dist/core/permission-rule-model.d.ts +87 -15
- package/dist/core/permission-rule-model.js +87 -8
- package/dist/core/permission-rule-org.d.ts +200 -33
- package/dist/core/permission-rule-org.js +217 -91
- package/dist/core/permission-rule-session.js +2 -2
- package/dist/core/permission-rule-store.d.ts +8 -0
- package/dist/core/permission-rule-store.js +1 -0
- package/dist/core/permission-rule-sync.js +3 -2
- package/dist/core/permission-rules.d.ts +7 -1
- package/dist/core/permission-rules.js +37 -8
- package/dist/core/read-only-shell.d.ts +1 -1
- package/dist/core/read-only-shell.js +30 -9
- package/dist/core/remote-env.d.ts +41 -1
- package/dist/core/remote-env.js +18 -0
- package/dist/core/resume-startup-cause.d.ts +18 -0
- package/dist/core/resume-startup-cause.js +12 -0
- package/dist/core/retention.js +7 -2
- package/dist/core/retired-keys.d.ts +8 -2
- package/dist/core/retired-keys.js +12 -1
- package/dist/core/roles.js +60 -10
- package/dist/core/rule-lane-reads.js +1 -1
- package/dist/core/runner/approval-feedback.d.ts +46 -0
- package/dist/core/runner/approval-feedback.js +41 -0
- package/dist/core/runner/compaction-call-options.d.ts +3 -3
- package/dist/core/runner/compaction-call-options.js +2 -2
- package/dist/core/runner/contracts.d.ts +34 -41
- package/dist/core/runner/cross-boundary-lane.d.ts +87 -0
- package/dist/core/runner/cross-boundary-lane.js +190 -0
- package/dist/core/runner/decide-continuation.d.ts +4 -4
- package/dist/core/runner/decide-continuation.js +3 -1
- package/dist/core/runner/gate-exit.d.ts +32 -12
- package/dist/core/runner/gate-exit.js +77 -34
- package/dist/core/runner/inherited-ask-grants.js +2 -2
- package/dist/core/runner/mcp-redial.d.ts +52 -10
- package/dist/core/runner/mcp-redial.js +38 -9
- package/dist/core/runner/permission-rule-lanes.d.ts +5 -2
- package/dist/core/runner/permission-rule-lanes.js +22 -10
- package/dist/core/runner/person-path-rows.d.ts +5 -3
- package/dist/core/runner/person-path-rows.js +2 -2
- package/dist/core/runner/prepare-acquire-reconcile.d.ts +3 -4
- package/dist/core/runner/prepare-acquire-reconcile.js +3 -3
- package/dist/core/runner/prepare-ask-lane.js +3 -3
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +6 -5
- package/dist/core/runner/prepare-caps-and-workflow.js +3 -3
- package/dist/core/runner/prepare-config-doors.d.ts +58 -15
- package/dist/core/runner/prepare-config-doors.js +167 -146
- package/dist/core/runner/prepare-context-lane.js +6 -3
- package/dist/core/runner/prepare-defer-classify.js +4 -7
- package/dist/core/runner/prepare-delegation-surface.d.ts +5 -4
- package/dist/core/runner/prepare-delegation-surface.js +8 -7
- package/dist/core/runner/prepare-execution-env.d.ts +1 -2
- package/dist/core/runner/prepare-execution-env.js +2 -1
- package/dist/core/runner/prepare-gate-stations.d.ts +2 -0
- package/dist/core/runner/prepare-gate-stations.js +4 -3
- package/dist/core/runner/prepare-hands-readface.d.ts +3 -3
- package/dist/core/runner/prepare-hands-readface.js +3 -2
- package/dist/core/runner/prepare-inherited-gate.d.ts +2 -0
- package/dist/core/runner/prepare-inherited-gate.js +3 -2
- package/dist/core/runner/prepare-listings.d.ts +1 -1
- package/dist/core/runner/prepare-listings.js +4 -2
- package/dist/core/runner/prepare-memory-engine-session.d.ts +0 -6
- package/dist/core/runner/prepare-memory-engine-session.js +19 -6
- package/dist/core/runner/prepare-memory.d.ts +3 -2
- package/dist/core/runner/prepare-memory.js +6 -2
- package/dist/core/runner/prepare-offload-wrappers.d.ts +4 -4
- package/dist/core/runner/prepare-offload-wrappers.js +2 -1
- package/dist/core/runner/prepare-park-ask.d.ts +1 -1
- package/dist/core/runner/prepare-park-ask.js +9 -3
- package/dist/core/runner/prepare-policy-chain.d.ts +1 -1
- package/dist/core/runner/prepare-policy-chain.js +14 -19
- package/dist/core/runner/prepare-project-context.d.ts +1 -1
- package/dist/core/runner/prepare-project-context.js +6 -4
- package/dist/core/runner/prepare-prompt-assembly.d.ts +1 -1
- package/dist/core/runner/prepare-prompt-assembly.js +20 -16
- package/dist/core/runner/prepare-prompt-inputs.d.ts +12 -6
- package/dist/core/runner/prepare-prompt-inputs.js +6 -3
- package/dist/core/runner/prepare-protocol-tools.d.ts +7 -5
- package/dist/core/runner/prepare-protocol-tools.js +19 -12
- package/dist/core/runner/prepare-question-face.d.ts +4 -2
- package/dist/core/runner/prepare-question-face.js +4 -3
- package/dist/core/runner/prepare-safety-scan.d.ts +7 -2
- package/dist/core/runner/prepare-safety-scan.js +34 -27
- package/dist/core/runner/prepare-suspend-saga.d.ts +2 -2
- package/dist/core/runner/prepare-suspend-saga.js +6 -2
- package/dist/core/runner/prepare-task.js +22 -19
- package/dist/core/runner/prepare-turn-wiring.d.ts +10 -5
- package/dist/core/runner/prepare-turn-wiring.js +14 -49
- package/dist/core/runner/prepare-wiring-manifest.d.ts +10 -5
- package/dist/core/runner/prepare-wiring-manifest.js +9 -6
- package/dist/core/runner/prepare-workspace-restore.js +2 -2
- package/dist/core/runner/resume-admission.d.ts +4 -1
- package/dist/core/runner/resume-admission.js +16 -14
- package/dist/core/runner/resume-apply.js +4 -4
- package/dist/core/runner/resume-internals-and-config.d.ts +3 -3
- package/dist/core/runner/resume-internals-and-config.js +3 -8
- package/dist/core/runner/resume-policy-outcome.d.ts +2 -2
- package/dist/core/runner/resume-policy-outcome.js +18 -15
- package/dist/core/runner/resume-preflight.js +2 -2
- package/dist/core/runner/resume-review-outcome.js +3 -3
- package/dist/core/runner/retired-runner-deps.d.ts +5 -6
- package/dist/core/runner/retired-runner-deps.js +1 -4
- package/dist/core/runner/run-leg.js +97 -43
- package/dist/core/runner/run-recovery-lanes.js +5 -3
- package/dist/core/runner/run-settle-and-teardown.js +2 -0
- package/dist/core/runner/run-terminal-adoption.js +21 -9
- package/dist/core/runner/run-turn-boundary.js +9 -3
- package/dist/core/runner/runtask.js +1 -1
- package/dist/core/runner/session-file-state-replay.d.ts +5 -2
- package/dist/core/runner/session-file-state-replay.js +3 -2
- package/dist/core/runner/skills-seat.d.ts +15 -0
- package/dist/core/runner/skills-seat.js +57 -0
- package/dist/core/runner/stream-steer-verb.js +2 -2
- package/dist/core/runner/sub-agent-deny-lists.d.ts +13 -11
- package/dist/core/runner/sub-agent-deny-lists.js +7 -5
- package/dist/core/runner/synthetic-tools.d.ts +5 -2
- package/dist/core/runner/synthetic-tools.js +2 -12
- package/dist/core/runner/tool-face-overlay.d.ts +24 -6
- package/dist/core/runner/tool-face-overlay.js +24 -15
- package/dist/core/runner-deps.d.ts +37 -22
- package/dist/core/session-policy-store.d.ts +19 -0
- package/dist/core/session-policy-store.js +22 -2
- package/dist/core/session-store.d.ts +35 -16
- package/dist/core/session-store.js +20 -12
- package/dist/core/{shell-lexer.d.ts → shell-run-candidates.d.ts} +36 -12
- package/dist/core/{shell-lexer.js → shell-run-candidates.js} +145 -225
- package/dist/core/shell-wrapper-table.d.ts +5 -3
- package/dist/core/shell-wrapper-table.js +1 -1
- package/dist/core/store-contracts/checkpoint-store-contract.js +2 -2
- package/dist/core/store-contracts/mailbox-store-contract.js +13 -0
- package/dist/core/store-contracts/session-store-contract.d.ts +49 -0
- package/dist/core/store-contracts/session-store-contract.js +639 -0
- package/dist/core/store-contracts/session-store-incarnation-contract.d.ts +12 -0
- package/dist/core/store-contracts/session-store-incarnation-contract.js +5 -2
- package/dist/core/task-event.d.ts +44 -6
- package/dist/core/task-notification.js +2 -2
- package/dist/core/task-registry-agent.js +1 -0
- package/dist/core/task-registry-shared.d.ts +5 -0
- package/dist/core/task-registry.d.ts +7 -0
- package/dist/core/task-registry.js +17 -0
- package/dist/core/task-result.d.ts +1 -1
- package/dist/core/task-spec.d.ts +7 -7
- package/dist/core/tighten-task-spec.d.ts +6 -4
- package/dist/core/tighten-task-spec.js +2 -2
- package/dist/core/tool-catalog-entries.d.ts +1 -1
- package/dist/core/tool-catalog-entries.js +52 -52
- package/dist/core/tool-face-reader.d.ts +49 -0
- package/dist/core/tool-face-reader.js +94 -0
- package/dist/core/tool-face.d.ts +17 -8
- package/dist/core/tool-face.js +1 -0
- package/dist/core/tool-policy.d.ts +67 -23
- package/dist/core/tool-policy.js +72 -60
- package/dist/core/tool-roster.d.ts +46 -28
- package/dist/core/tool-roster.js +91 -14
- package/dist/core/tool-spec-members.js +2 -2
- package/dist/core/tool-spec.d.ts +20 -4
- package/dist/core/tools.js +2 -0
- package/dist/core/trace.d.ts +24 -2
- package/dist/core/types.d.ts +3 -3
- package/dist/core/types.js +1 -1
- package/dist/core/untrusted-text.d.ts +23 -0
- package/dist/core/untrusted-text.js +10 -10
- package/dist/core/user-attachment.d.ts +56 -2
- package/dist/core/user-attachment.js +139 -56
- package/dist/core/wiring-manifest.d.ts +4 -2
- package/dist/engine/compaction/compaction.d.ts +2 -2
- package/dist/engine/compaction/utils.d.ts +2 -2
- package/dist/engine/harness/agent-harness.js +2 -1
- package/dist/engine/harness/types.d.ts +10 -4
- package/dist/engine/llm/types.d.ts +7 -2
- package/dist/engine/llm/types.js +2 -1
- package/dist/engine/loop/agent-loop.d.ts +12 -1
- package/dist/engine/loop/agent-loop.js +17 -5
- package/dist/engine/loop/types.d.ts +7 -1
- package/dist/engine/session/repo-utils.d.ts +5 -0
- package/dist/engine/session/repo-utils.js +9 -0
- package/dist/engine/session/storage-base.js +2 -2
- package/dist/index.d.ts +37 -17
- package/dist/index.js +31 -14
- package/dist/internal/harness.d.ts +1 -0
- package/dist/internal/harness.js +1 -0
- package/dist/internal/llm.d.ts +1 -1
- package/dist/internal/llm.js +1 -1
- package/dist/orchestration/goal.d.ts +24 -1
- package/dist/orchestration/goal.js +3 -2
- package/dist/orchestration/run-workflow-tool.d.ts +3 -0
- package/dist/orchestration/run-workflow-tool.js +1 -0
- package/dist/orchestration/workflow-governance.d.ts +1 -1
- package/dist/orchestration/workflow.d.ts +3 -0
- package/dist/orchestration/workflow.js +2 -1
- package/dist/prompt-assembly/artifact-store.d.ts +44 -9
- package/dist/prompt-assembly/artifact-store.js +38 -12
- package/dist/prompt-assembly/artifact.d.ts +12 -11
- package/dist/prompt-assembly/artifact.js +52 -21
- package/dist/prompt-assembly/assemble.d.ts +2 -0
- package/dist/prompt-assembly/assemble.js +2 -1
- package/dist/prompt-assembly/catalog/index.js +2 -1
- package/dist/prompt-assembly/catalog/memory.d.ts +13 -0
- package/dist/prompt-assembly/catalog/memory.js +6 -0
- package/dist/prompt-assembly/catalog/schema.d.ts +19 -2
- package/dist/prompt-assembly/catalog/schema.js +3 -0
- package/dist/prompt-assembly/composer.d.ts +2 -0
- package/dist/prompt-assembly/composer.js +1 -1
- package/dist/prompt-assembly/overlay.d.ts +21 -11
- package/dist/prompt-assembly/overlay.js +57 -19
- package/dist/prompt-assembly/select.d.ts +21 -6
- package/dist/prompt-assembly/select.js +41 -4
- package/dist/prompts/default.d.ts +1 -12
- package/dist/prompts/default.js +0 -3
- package/dist/shell/lex.d.ts +87 -8
- package/dist/shell/lex.js +283 -49
- package/dist/stores/file/index.d.ts +8 -6
- package/dist/stores/file/permission-rule-store.d.ts +1 -1
- package/dist/stores/file/permission-rule-store.js +2 -1
- package/dist/tools/artifact/artifact-tool.js +14 -3
- package/dist/tools/fs/bash-program-position.d.ts +3 -15
- package/dist/tools/fs/bash-program-position.js +3 -10
- package/dist/tools/fs/bash-readonly-classifier.js +2 -0
- package/dist/tools/fs/fs-bash.d.ts +3 -3
- package/dist/tools/fs/fs-bash.js +72 -101
- package/dist/tools/fs/fs-read.d.ts +12 -0
- package/dist/tools/fs/fs-read.js +10 -9
- package/dist/tools/fs/fs-shared.d.ts +27 -31
- package/dist/tools/fs/fs-shared.js +12 -15
- package/dist/tools/fs/fs-write.js +1 -1
- package/dist/tools/fs/index.js +2 -2
- package/dist/tools/fs/read-deny-home.d.ts +1 -1
- package/dist/tools/fs/read-deny-home.js +5 -4
- package/dist/tools/fs/read-deny.d.ts +16 -3
- package/dist/tools/fs/read-deny.js +12 -9
- package/dist/tools/fs/safety.d.ts +7 -6
- package/dist/tools/fs/shell-read-bindings.d.ts +5 -3
- package/dist/tools/fs/shell-read-bindings.js +15 -16
- package/dist/tools/fs/shell-read-device.js +1 -1
- package/dist/tools/fs/shell-read-plan.js +36 -47
- package/dist/tools/fs/shell-read-word.d.ts +1 -6
- package/dist/tools/fs/shell-read-word.js +2 -20
- package/dist/tools/fs/shell-reentry-text.js +1 -1
- package/dist/tools/web.d.ts +2 -2
- package/package.json +4 -1
- package/test/export-surface.snapshot.json +5651 -5457
- package/wire-changes/core@7.53.0.json +1968 -0
- package/wire-changes/core@7.54.0.json +2870 -0
- package/dist/core/shell-scan.d.ts +0 -60
- package/dist/core/shell-scan.js +0 -183
|
@@ -34,8 +34,30 @@
|
|
|
34
34
|
* refused and disclosed — identity comparison alone cannot catch it, and an in-memory-only mark would
|
|
35
35
|
* accept revision N−1 after a restart. Signature / predecessor chaining belongs to the privilege-
|
|
36
36
|
* separation ticket; the high-water mark is the floor that needs no key distribution.
|
|
37
|
+
*
|
|
38
|
+
* ## One reading of a row
|
|
39
|
+
*
|
|
40
|
+
* A snapshot is installed and served on its ENVELOPE ({@link validateOrgSnapshot}: revision, observation
|
|
41
|
+
* time, a rules list) and the anti-rollback fence; what its rows say never decides which snapshot is in
|
|
42
|
+
* force. Whether the rules are a list is judged in ONE place ({@link listRefusalOf}) for the partition and for
|
|
43
|
+
* every store that hands a resolution over — rules that are not a list, or that carry more places than a rule set may
|
|
44
|
+
* (the same cap the rule compiler holds a set to), are governance nobody can read (the
|
|
45
|
+
* partition refuses the snapshot; the org lane answers unavailable), never a policy of zero rows — and ONE reader
|
|
46
|
+
* ({@link orgRuleListOf}) copies the whole list in one receipt: a member of a row that cannot be read is left out of
|
|
47
|
+
* that row's copy alone, and every row is judged on its copy. A snapshot the partition holds — fetched or read back
|
|
48
|
+
* from its persistence — is that same copy ({@link orgSnapshotCopyOf}). Every row is then read by ONE reader
|
|
49
|
+
* ({@link readOrgRules}), the same for every store that hands a resolution over, on its policy members
|
|
50
|
+
* ({@link ORG_ROW_POLICY_MEMBERS}): a row is READ when its behavior is `deny` or `ask` and its text is a shell command
|
|
51
|
+
* rule under that behavior. Any other row — another grammar's rule, a shell rule the validator refuses, a row
|
|
52
|
+
* with no text, a behavior this layer has no bucket for — is UNREADABLE, and stands at its strictest
|
|
53
|
+
* reading over the calls it may reach ({@link OrgRowReach}): an `ask` row asks a person, every other row
|
|
54
|
+
* refuses. Readable deny and ask rows hold as published beside it. One unreadable row therefore never
|
|
55
|
+
* takes the rest of the policy down with it, and never turns a published deny into a question; the
|
|
56
|
+
* snapshot is served DEGRADED, and every resolution and every adjudication over it names the unreadable
|
|
57
|
+
* rows ({@link describeUnreadableOrgRows}).
|
|
37
58
|
*/
|
|
38
|
-
import { type PersistedRule, type RuleRejectCode } from "./permission-rule-model.js";
|
|
59
|
+
import { type ParsedRule, type PersistedRule, type RuleRejectCode } from "./permission-rule-model.js";
|
|
60
|
+
import type { DenyFace } from "../tools/fs/read-deny.js";
|
|
39
61
|
import type { PermissionRuleStore } from "./permission-rule-provider.js";
|
|
40
62
|
/** One org rule. There is structurally no allow bucket (design/179 §9: the org layer only tightens). */
|
|
41
63
|
export interface OrgPermissionRule {
|
|
@@ -171,42 +193,183 @@ export declare const UNGOVERNED_ORG_RESOLUTION: Readonly<OrgRuleResolution>;
|
|
|
171
193
|
* bound is refused loudly, never coerced.
|
|
172
194
|
*/
|
|
173
195
|
export declare function createOrgRulePartition(cfg: OrgRulePartitionConfig): OrgRulePartition;
|
|
196
|
+
/** Whether two snapshots carry the same POLICY: row for row, the same policy members ({@link ORG_ROW_POLICY_MEMBERS}) — never
|
|
197
|
+
* observation metadata, never a member no judgment reads (which a copy may carry or leave out). The ONE test of "the same
|
|
198
|
+
* revision, the same content": the partition's equal-revision guard asks it of two snapshots it holds in one form
|
|
199
|
+
* ({@link orgSnapshotCopyOf}), and a persistence backend asks it of what it stores. */
|
|
200
|
+
export declare function sameOrgPolicyContent(a: OrgRuleSnapshot, b: OrgRuleSnapshot): boolean;
|
|
174
201
|
/**
|
|
175
|
-
* Which
|
|
176
|
-
* that can match nothing on this build. Empty ⟺ every rule is enforceable.
|
|
202
|
+
* Which calls an UNREADABLE row may reach — the calls its strictest reading stands over.
|
|
177
203
|
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
204
|
+
* `"every"` when the row names no tool this layer can place: no rule text, a head the rule syntax cannot read, the lone
|
|
205
|
+
* `*`, or a tool with no rule grammar (a misspelled tool name and a tool this build does not know look the same, and
|
|
206
|
+
* both may be the shell). Otherwise the rule WORD it names — a shell tool's head is the command word, as a call's is —
|
|
207
|
+
* and, for a tool whose path rules speak for a face ({@link PATH_RULE_FACES}), the faces of the column its strictest
|
|
208
|
+
* behavior reads: such a row reaches what a readable rule of its tool could reach, and nothing else.
|
|
209
|
+
*/
|
|
210
|
+
export type OrgRowReach = "every" | {
|
|
211
|
+
readonly words: readonly string[];
|
|
212
|
+
readonly faces: readonly DenyFace[];
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* A row the layer cannot read: its text (as published; the rendering of the scalar its `rule` holds when that is not a string;
|
|
216
|
+
* `<unreadable>` when it holds none — a structure is no value, {@link orgRowPolicyOf}), its 1-based place in the
|
|
217
|
+
* snapshot, why (`code`, and `detail` for a row whose shape — not its text — is at fault), the behavior it stands at, and
|
|
218
|
+
* the calls it reaches. `behavior` is the row's STRICTEST reading: `ask` only when the row says `ask`, `deny` for a row
|
|
219
|
+
* that says `deny` and for one whose behavior cannot be read.
|
|
220
|
+
*/
|
|
221
|
+
export interface UnreadableOrgRow {
|
|
222
|
+
readonly kind: "unreadable";
|
|
223
|
+
readonly index: number;
|
|
224
|
+
readonly rule: string;
|
|
225
|
+
readonly code: RuleRejectCode;
|
|
226
|
+
readonly detail?: string;
|
|
227
|
+
readonly behavior: "deny" | "ask";
|
|
228
|
+
readonly reach: OrgRowReach;
|
|
229
|
+
}
|
|
230
|
+
/** A row the layer reads: a shell command rule under the behavior it publishes. */
|
|
231
|
+
export interface ReadOrgRow {
|
|
232
|
+
readonly kind: "read";
|
|
233
|
+
readonly index: number;
|
|
234
|
+
readonly rule: string;
|
|
235
|
+
readonly behavior: "deny" | "ask";
|
|
236
|
+
readonly parsed: ParsedRule;
|
|
237
|
+
}
|
|
238
|
+
/** One call as the org layer judges it: the rule words it answers to (`laneToolNamesOf`; one word is enough), its shell
|
|
239
|
+
* command when it is the shell tool's, and the face of its path target when it has one (`callPathFaceOf`). */
|
|
240
|
+
export interface OrgRuleCall {
|
|
241
|
+
readonly tool: string | readonly string[];
|
|
242
|
+
readonly command?: string;
|
|
243
|
+
readonly face?: DenyFace;
|
|
244
|
+
}
|
|
245
|
+
/** Every row of a snapshot read once, and the one judgment of a call against them. */
|
|
246
|
+
export interface OrgRulesReading {
|
|
247
|
+
readonly rows: readonly (ReadOrgRow | UnreadableOrgRow)[];
|
|
248
|
+
readonly unreadable: readonly UnreadableOrgRow[];
|
|
249
|
+
verdictFor(call: OrgRuleCall): OrgRuleVerdict | undefined;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* The members of an org row the layer reads to judge a call — the row's POLICY. A row IS these members: every reader holds and
|
|
253
|
+
* judges a row as its policy ({@link orgRowPolicyOf}), and two rows with the same policy members are the same policy
|
|
254
|
+
* ({@link sameOrgPolicyContent}). Any other member a row carries is never judged, held, served or persisted (the receipt reads
|
|
255
|
+
* each of a row's own members once — a getter on one runs once — and copies none of what it holds beyond a scalar).
|
|
256
|
+
*/
|
|
257
|
+
export declare const ORG_ROW_POLICY_MEMBERS: readonly ["rule", "behavior"];
|
|
258
|
+
/** A JSON scalar — the only value a member the partition keeps holds as data. */
|
|
259
|
+
type Scalar = string | number | boolean | null;
|
|
260
|
+
type ScalarMembers<K extends string> = {
|
|
261
|
+
[P in K]?: Scalar;
|
|
262
|
+
};
|
|
263
|
+
type OrgRowPolicy = Readonly<ScalarMembers<(typeof ORG_ROW_POLICY_MEMBERS)[number]>>;
|
|
264
|
+
/**
|
|
265
|
+
* The envelope's rules LIST, read once: `refused` when it is not a list of at most the cap's places ({@link listRefusalOf} —
|
|
266
|
+
* judged before the list is received, so an oversized or sparse list builds no row) or cannot be received at all;
|
|
267
|
+
* otherwise its rows, each as its policy ({@link orgRowPolicyOf}) — the list received whole in one receipt
|
|
268
|
+
* ({@link ORG_RULES_RECEIPT}), so a row's member that cannot be read is that row's alone, a row that cannot be read at all (and
|
|
269
|
+
* a hole) is a row with nothing in it (`{}`: no rule text, read at its strictest reading) and the rows beside it are untouched.
|
|
270
|
+
* The ONE reader of the list — the partition holds a snapshot's rows as these, fetched and read back alike
|
|
271
|
+
* ({@link orgSnapshotCopyOf}), and every reading of rows ({@link readOrgRules}) reads them through it — so no store's rows can be
|
|
272
|
+
* read two ways, and no row can take the reading of another down with it.
|
|
273
|
+
*/
|
|
274
|
+
export declare function orgRuleListOf(rules: unknown): {
|
|
275
|
+
readonly rows: readonly OrgRowPolicy[];
|
|
276
|
+
} | {
|
|
277
|
+
readonly refused: string;
|
|
278
|
+
};
|
|
279
|
+
/** A snapshot the partition holds whose rules the list judgment refused: the envelope it carried and the words it was refused in,
|
|
280
|
+
* judged ONCE, on the list as it stood at the receipt. It has no `rules` at all (so no reading can take it for a table of zero
|
|
281
|
+
* rows) and keeps none of the caller's value (a list past the cap is a live array, and the partition awaits its persistence
|
|
282
|
+
* between the receipt and the validator, so a source that shrank the list it handed over in between would otherwise be admitted,
|
|
283
|
+
* uncopied and mutable, on a judgment it no longer meets). It is never installed or served. */
|
|
284
|
+
export interface RefusedOrgSnapshot extends Omit<OrgRuleSnapshot, "rules"> {
|
|
285
|
+
readonly refused: string;
|
|
286
|
+
}
|
|
287
|
+
/** What the partition holds of one snapshot, fetched or read back: one that can be installed, or the refusal of one that cannot.
|
|
288
|
+
* Read it by its shape — `rules` is on the first arm only, and {@link validateOrgSnapshot} is the one way from a held snapshot to an
|
|
289
|
+
* installable one. */
|
|
290
|
+
export type HeldOrgSnapshot = OrgRuleSnapshot | RefusedOrgSnapshot;
|
|
291
|
+
/** A snapshot as the partition holds it — fetched from the source or read back from its persistence alike: its envelope's members
|
|
292
|
+
* ({@link ORG_SNAPSHOT_ENVELOPE_MEMBERS} through {@link scalarMembersOf}; anything else it carries is never read or kept), its
|
|
293
|
+
* rows as the one list reader reads them (each row its policy) — so a snapshot read back reads, and compares, exactly as the one
|
|
294
|
+
* fetched, and what is persisted is never larger than these. Rules the list judgment refuses (not a list, a Proxy, past the cap)
|
|
295
|
+
* are held as that refusal alone ({@link RefusedOrgSnapshot}; the list judgment runs no code of the value's); such a snapshot — and
|
|
296
|
+
* one that is not an object, whose envelope has no members — is never installed or served. A list that cannot be received, and a
|
|
297
|
+
* Proxy snapshot (its traps would answer for the envelope), throw: an envelope that cannot be copied. Exported for the pins; the
|
|
298
|
+
* package root does not carry it. */
|
|
299
|
+
export declare function orgSnapshotCopyOf(v: unknown): HeldOrgSnapshot;
|
|
300
|
+
/**
|
|
301
|
+
* The ONE reading of an org snapshot's rows: each row read once ({@link readOrgRow}), and the one judgment of a call
|
|
302
|
+
* against them. Every reader of org rows goes through it — the partition's degraded line, the lane's adjudication,
|
|
303
|
+
* {@link orgRuleVerdictFor}, {@link unenforceableOrgRules} and the shadow view — so no two of them can read one row two ways.
|
|
304
|
+
*
|
|
305
|
+
* A call meets the rows in three answers. DENY: a readable deny reaches one of its program runs, or an unreadable row
|
|
306
|
+
* standing at deny reaches the call — the first such row in snapshot order speaks. ASK: a readable rule the call cannot be
|
|
307
|
+
* READ against (the lexer's reason — a rule that cannot be judged may be a deny, so it outranks a reached ask), else a
|
|
308
|
+
* readable ask reaching it or an unreadable row standing at ask reaching it, the first in snapshot order. Otherwise none.
|
|
309
|
+
* An unreadable row's verdict carries its reason ({@link unreadableOrgRowReason}) beside its text.
|
|
310
|
+
*
|
|
311
|
+
* The rows are read off the one list reader's copy ({@link orgRuleListOf}): rules that are not a list come back `refused` —
|
|
312
|
+
* the org's rules cannot be read, which is never a policy of zero rows — and a row is judged on what its copy holds: a policy
|
|
313
|
+
* member that could not be read is one the row does not have (no `rule` ⇒ no rule text, every call; no `behavior` ⇒ its
|
|
314
|
+
* strictest reading over the calls of the tool it names), read like any other unreadable row while the rows beside it keep
|
|
315
|
+
* their effect.
|
|
316
|
+
*/
|
|
317
|
+
export declare function readOrgRules(rules: unknown): OrgRulesReading | {
|
|
318
|
+
readonly refused: string;
|
|
319
|
+
};
|
|
320
|
+
/**
|
|
321
|
+
* Which rows of an org snapshot this layer cannot read, each with its code — the rows that stand at their strictest
|
|
322
|
+
* reading instead of as published. Empty ⟺ every row is read. Every unreadable row is reported, a row with no rule text
|
|
323
|
+
* or a behavior other than deny / ask included (its text rendered when it is not a string). Rules that are not a list, or a
|
|
324
|
+
* list past the cap, throw the one list judgment's sentence ({@link readListedOrgRules}) — never a reading of fewer rows.
|
|
182
325
|
*/
|
|
183
326
|
export declare function unenforceableOrgRules(rules: readonly OrgPermissionRule[]): Array<{
|
|
184
327
|
rule: string;
|
|
185
328
|
code: RuleRejectCode;
|
|
186
329
|
}>;
|
|
330
|
+
/** The reason an unreadable row's verdict carries — its place in the snapshot, its code, and the repair. */
|
|
331
|
+
export declare function unreadableOrgRowReason(row: Pick<UnreadableOrgRow, "index" | "code" | "detail">): string;
|
|
332
|
+
/** The ONE clause for an org verdict that carries an `unreadable` reason — a rule the call could not be read against, or
|
|
333
|
+
* a row this layer cannot read — on a refusal and on a question alike. */
|
|
334
|
+
export declare function orgUnreadableClause(reason: string): string;
|
|
335
|
+
/**
|
|
336
|
+
* The ONE line naming a snapshot's unreadable rows (count, the first {@link DISCLOSED_UNREADABLE_ROWS} by place, text and
|
|
337
|
+
* code, the rest summarized), or `undefined` when every row is read. The partition puts it on every resolution that
|
|
338
|
+
* serves such a snapshot, and the org lane hands it to its operator sink on every adjudication over one, so the two seats
|
|
339
|
+
* describe one snapshot in one sentence. Each text is escaped — the characters that most often make a row unreadable are
|
|
340
|
+
* exactly the ones that do not render.
|
|
341
|
+
*/
|
|
342
|
+
export declare function describeUnreadableOrgRows(unreadable: readonly UnreadableOrgRow[], revision?: unknown): string | undefined;
|
|
187
343
|
/**
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
* and the serving path (backlog #177), so an unenforceable entry cannot reach here through the overlay
|
|
198
|
-
* — the whole snapshot is refused, or the resolution reports `unavailable`, and either way it is
|
|
199
|
-
* disclosed. A caller that hands this function a snapshot it obtained ELSEWHERE gets no such guarantee:
|
|
200
|
-
* the skip is silent, and naming the dead entries is that caller's job — {@link unenforceableOrgRules}
|
|
201
|
-
* is the shared way to do it.
|
|
344
|
+
* Envelope validation of one held snapshot — what the staleness bound and the anti-rollback fence need to judge it. Answers
|
|
345
|
+
* the snapshot as an installable one, or the words it is refused in: a finite revision, a finite observation time not in the
|
|
346
|
+
* future beyond the skew allowance, and rules that are a LIST ({@link listRefusalOf}, judged at the receipt — a held snapshot
|
|
347
|
+
* whose list was refused there is answered in those words). The rows inside are not judged here: a row this layer cannot
|
|
348
|
+
* read is read as such by {@link readOrgRules}, and never takes the rest of the snapshot down with it.
|
|
349
|
+
*
|
|
350
|
+
* Run on BOTH the fetch path (before install) and the serving path (before a persisted snapshot adjudicates), so the
|
|
351
|
+
* two cannot diverge on what an installable snapshot is — see backlog #177. The only way from a {@link HeldOrgSnapshot} to an
|
|
352
|
+
* installable {@link OrgRuleSnapshot}: install and serve read the `admitted` arm.
|
|
202
353
|
*/
|
|
203
|
-
export declare function
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
*
|
|
354
|
+
export declare function validateOrgSnapshot(s: HeldOrgSnapshot, nowMs: number): {
|
|
355
|
+
readonly admitted: OrgRuleSnapshot;
|
|
356
|
+
} | {
|
|
357
|
+
readonly refused: string;
|
|
358
|
+
};
|
|
359
|
+
/**
|
|
360
|
+
* design/182 §7.2 — which org rule speaks for this call, if any: {@link readOrgRules}'s judgment, over a snapshot read for
|
|
361
|
+
* this call alone. Matching uses the SAME parser and the SAME tightening reach the personal deny/ask rows use
|
|
362
|
+
* ({@link programRunReachOf}: an interpreter-headed prefix deny like `Bash(node:*)` is a legitimately wide tightening and
|
|
363
|
+
* matches; a segment hit is a hit; a call the lexer cannot read against a rule is an ASK with the reason — fail closed,
|
|
364
|
+
* never silence), and a row this layer cannot read stands at its strictest reading over the calls it may reach. A caller
|
|
365
|
+
* judging many calls against one snapshot reads it once with {@link readOrgRules} instead. Rules that are not a list, or a
|
|
366
|
+
* list past the cap, throw the one list judgment's sentence ({@link readListedOrgRules}) — never a verdict over fewer rows.
|
|
367
|
+
*/
|
|
368
|
+
export declare function orgRuleVerdictFor(rules: readonly OrgPermissionRule[], call: OrgRuleCall): OrgRuleVerdict | undefined;
|
|
369
|
+
/** The org layer's answer for one call: which rule spoke, with what behavior — and, when the rule could not be judged
|
|
370
|
+
* against the call, why (`unreadable`): either the call could not be READ against it (the lexer's reason; `behavior` is
|
|
371
|
+
* then `ask` — the org published a rule that may reach this call, and nobody can say), or the row is not one this layer
|
|
372
|
+
* reads ({@link unreadableOrgRowReason}; `behavior` is the row's strictest reading). */
|
|
210
373
|
export interface OrgRuleVerdict {
|
|
211
374
|
readonly behavior: "deny" | "ask";
|
|
212
375
|
readonly rule: string;
|
|
@@ -234,14 +397,18 @@ export interface OrgRuleVerdict {
|
|
|
234
397
|
* either way. org ASK rules do not shadow: the personal lane never consumes a `requiresRealApproval`
|
|
235
398
|
* ask, so the two never actually meet on one call.
|
|
236
399
|
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
*
|
|
400
|
+
* An UNREADABLE row standing at deny refuses every call it reaches ({@link readOrgRules}), so it shadows every personal
|
|
401
|
+
* rule of a tool it reaches — by the rule word, or by the face that tool's calls are on — exactly as the gate refuses
|
|
402
|
+
* those calls; one standing at ask does not shadow, as a readable ask does not.
|
|
403
|
+
*
|
|
404
|
+
* design/382 §2.6 — no READABLE org row reaches a Read directory rule in this version: the org layer has no Read
|
|
405
|
+
* grammar, and the rule's `command` is a PATH that must not be fed to the shell lane's segment reader as though it
|
|
406
|
+
* were a command line.
|
|
241
407
|
*/
|
|
242
408
|
export declare function orgRuleShadows(orgRules: readonly OrgPermissionRule[], rule: Pick<PersistedRule, "tool" | "command">): boolean;
|
|
243
|
-
/** The shadow predicate with the org
|
|
409
|
+
/** The shadow predicate with the org rows read ONCE — what a read over many rows uses. */
|
|
244
410
|
export declare function compileOrgShadowPredicate(orgRules: readonly OrgPermissionRule[]): (rule: Pick<PersistedRule, "tool" | "command">) => boolean;
|
|
245
411
|
/** Does this store carry a write face? Re-exported convenience for org-ticket integrations that need to
|
|
246
412
|
* distinguish a read-only projection from a writable personal bucket without importing the writer seam. */
|
|
247
413
|
export declare function isWritablePermissionRuleStore(store: PermissionRuleStore): boolean;
|
|
414
|
+
export {};
|