@sema-agent/core 7.47.0 → 7.49.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 +472 -0
- package/README.md +2 -2
- package/dist/agents/cascade.d.ts +2 -5
- package/dist/agents/child-failure.d.ts +20 -0
- package/dist/agents/child-failure.js +28 -0
- package/dist/agents/cross-session-ref.d.ts +11 -3
- package/dist/agents/cross-session-ref.js +6 -0
- package/dist/agents/cumulative-stats.d.ts +12 -15
- package/dist/agents/cumulative-stats.js +1 -1
- package/dist/agents/extra-tool-names.js +1 -1
- package/dist/agents/inherited-tool-pool.d.ts +17 -13
- package/dist/agents/inherited-tool-pool.js +4 -3
- package/dist/agents/peer-session-drain.d.ts +3 -2
- package/dist/agents/peer-session-drain.js +5 -4
- package/dist/agents/send-message-tool.js +2 -9
- package/dist/agents/subagent.d.ts +10 -29
- package/dist/agents/subagent.js +65 -53
- package/dist/agents/suspend-guard.d.ts +1 -1
- package/dist/agents/tool-filter.d.ts +76 -65
- package/dist/agents/tool-filter.js +122 -92
- package/dist/agents/verify.d.ts +4 -7
- package/dist/agents/verify.js +6 -7
- package/dist/bench/metrics.d.ts +1 -2
- package/dist/brain/anthropic.js +133 -79
- package/dist/brain/errors.d.ts +53 -6
- package/dist/brain/errors.js +22 -2
- package/dist/brain/input-too-long.d.ts +40 -19
- package/dist/brain/input-too-long.js +3 -16
- package/dist/brain/open-responses.js +19 -10
- package/dist/brain/openai.js +123 -32
- package/dist/brain/provider-dialect.d.ts +214 -0
- package/dist/brain/provider-dialect.js +186 -0
- package/dist/brain/request-params.d.ts +27 -8
- package/dist/brain/request-params.js +7 -12
- package/dist/brain/request-route.d.ts +84 -0
- package/dist/brain/request-route.js +41 -0
- package/dist/brain/retry.d.ts +8 -0
- package/dist/brain/retry.js +10 -4
- package/dist/brain/route-adjudicator.d.ts +7 -0
- package/dist/brain/route-adjudicator.js +5 -1
- package/dist/brain/status-sink.d.ts +20 -0
- package/dist/brain/status-sink.js +11 -0
- package/dist/brain/stream-engine.d.ts +52 -1
- package/dist/brain/stream-engine.js +81 -24
- package/dist/brain/stream-shared.d.ts +57 -11
- package/dist/brain/stream-shared.js +28 -2
- package/dist/core/a2a.d.ts +1 -0
- package/dist/core/agent-config-dir.js +3 -2
- package/dist/core/allow-entry.d.ts +21 -12
- package/dist/core/allow-entry.js +39 -32
- package/dist/core/arg-summary.d.ts +17 -24
- package/dist/core/arg-summary.js +169 -68
- package/dist/core/ask-origin.d.ts +42 -24
- package/dist/core/ask-origin.js +18 -13
- package/dist/core/auto-mode-prompt-assets.d.ts +2 -2
- package/dist/core/auto-mode-prompt-assets.js +1 -1
- package/dist/core/auto-mode-prompt.d.ts +11 -1
- package/dist/core/auto-mode-prompt.js +13 -10
- package/dist/core/auto-mode-rebuild.d.ts +7 -0
- package/dist/core/auto-mode-rebuild.js +4 -1
- package/dist/core/canonical-json.d.ts +3 -0
- package/dist/core/canonical-json.js +2 -1
- package/dist/core/checkpoint-requirements.d.ts +892 -0
- package/dist/core/checkpoint-requirements.js +333 -0
- package/dist/core/checkpoint-store.d.ts +95 -66
- package/dist/core/checkpoint-store.js +14 -26
- package/dist/core/child-clamp-seats.d.ts +228 -69
- package/dist/core/child-clamp-seats.js +211 -17
- package/dist/core/classifier-unavailable-arm.d.ts +5 -1
- package/dist/core/classifier-unavailable-arm.js +3 -3
- package/dist/core/compliance.d.ts +3 -0
- package/dist/core/compliance.js +9 -4
- package/dist/core/credential-vocabulary.d.ts +140 -0
- package/dist/core/credential-vocabulary.js +131 -0
- package/dist/core/decision-receipt.js +1 -1
- package/dist/core/effective-path-target.d.ts +73 -16
- package/dist/core/effective-path-target.js +63 -33
- package/dist/core/engine-notice.d.ts +32 -7
- package/dist/core/file-history-store.js +2 -2
- package/dist/core/fs-write-gate-policy.d.ts +4 -0
- package/dist/core/fs-write-gate-policy.js +22 -5
- package/dist/core/gate-bounded-await.d.ts +28 -13
- package/dist/core/gate-bounded-await.js +41 -4
- package/dist/core/gate-fold.d.ts +1 -1
- package/dist/core/gate-fold.js +24 -25
- package/dist/core/gate-lanes.js +16 -15
- package/dist/core/gate-outcome.d.ts +20 -5
- package/dist/core/gate-outcome.js +5 -0
- package/dist/core/governance-codes.d.ts +11 -4
- package/dist/core/governance-codes.js +14 -3
- package/dist/core/hooks.d.ts +4 -0
- package/dist/core/locked-config.d.ts +8 -0
- package/dist/core/locked-config.js +14 -2
- package/dist/core/lsp.js +3 -5
- package/dist/core/mailbox-store.d.ts +3 -4
- package/dist/core/mcp-connection-pool.d.ts +75 -0
- package/dist/core/mcp-connection-pool.js +128 -0
- package/dist/core/mcp-failure.d.ts +2 -1
- package/dist/core/mcp-failure.js +13 -2
- package/dist/core/mcp-server-spec.d.ts +1 -1
- package/dist/core/mcp.d.ts +4 -0
- package/dist/core/mcp.js +70 -43
- package/dist/core/memory-engine/content-origin.js +2 -14
- package/dist/core/memory-engine/engine.d.ts +32 -22
- package/dist/core/memory-engine/engine.js +103 -55
- package/dist/core/memory-engine/file-backend.d.ts +13 -30
- package/dist/core/memory-engine/file-backend.js +37 -252
- package/dist/core/memory-engine/index.d.ts +1 -1
- package/dist/core/memory-engine/index.js +1 -1
- package/dist/core/memory-engine/layout.d.ts +139 -9
- package/dist/core/memory-engine/layout.js +350 -7
- package/dist/core/memory-engine/scope-contract.d.ts +10 -0
- package/dist/core/memory-engine/scope-contract.js +8 -0
- package/dist/core/memory-engine/session-incarnation.d.ts +14 -4
- package/dist/core/memory-engine/session-incarnation.js +5 -2
- package/dist/core/memory-engine/types.d.ts +10 -1
- package/dist/core/memory.js +5 -17
- package/dist/core/model-seat.d.ts +4 -4
- package/dist/core/model-seat.js +1 -1
- package/dist/core/mounted-mcp.d.ts +57 -0
- package/dist/core/mounted-mcp.js +19 -0
- package/dist/core/namespaced-rule-name.d.ts +29 -0
- package/dist/core/namespaced-rule-name.js +52 -0
- package/dist/core/park-selfcheck.d.ts +1 -1
- package/dist/core/park-selfcheck.js +16 -6
- package/dist/core/path-guard-rows.d.ts +99 -0
- package/dist/core/path-guard-rows.js +45 -0
- package/dist/core/path-identity.d.ts +22 -16
- package/dist/core/path-identity.js +10 -10
- package/dist/core/path-rule-binding.d.ts +2 -1
- package/dist/core/path-rule-binding.js +3 -1
- package/dist/core/pause-registry.d.ts +16 -2
- package/dist/core/pause-registry.js +6 -0
- package/dist/core/permission-rule-consent.js +0 -7
- package/dist/core/permission-rule-model.d.ts +68 -24
- package/dist/core/permission-rule-model.js +105 -24
- package/dist/core/permission-rule-store.js +2 -2
- package/dist/core/permission-rules.d.ts +3 -30
- package/dist/core/permission-rules.js +4 -54
- package/dist/core/read-root-candidate.d.ts +1 -3
- package/dist/core/read-root-candidate.js +4 -15
- package/dist/core/real-approval.d.ts +4 -3
- package/dist/core/retired-keys.d.ts +13 -0
- package/dist/core/retired-keys.js +14 -0
- package/dist/core/roles.d.ts +2 -3
- package/dist/core/roles.js +15 -6
- package/dist/core/runner/assemble-result.d.ts +0 -7
- package/dist/core/runner/assemble-result.js +19 -31
- package/dist/core/runner/caller-roster.d.ts +78 -0
- package/dist/core/runner/caller-roster.js +219 -0
- package/dist/core/runner/checkpoint-scope.d.ts +16 -16
- package/dist/core/runner/checkpoint-scope.js +2 -2
- package/dist/core/runner/child-tree.js +2 -2
- package/dist/core/runner/contracts.d.ts +68 -35
- package/dist/core/runner/decide-continuation.d.ts +51 -3
- package/dist/core/runner/decide-continuation.js +76 -21
- package/dist/core/runner/denial-limit-arms.d.ts +17 -5
- package/dist/core/runner/denial-limit-arms.js +11 -9
- package/dist/core/runner/extra-body-dropped-seat.d.ts +8 -0
- package/dist/core/runner/extra-body-dropped-seat.js +22 -0
- package/dist/core/runner/finish-reason-seat.d.ts +9 -0
- package/dist/core/runner/finish-reason-seat.js +40 -0
- package/dist/core/runner/gate-exit.d.ts +44 -32
- package/dist/core/runner/gate-exit.js +112 -25
- package/dist/core/runner/inherited-ask-grants.js +6 -4
- package/dist/core/runner/mcp-redial.d.ts +3 -3
- package/dist/core/runner/mcp-redial.js +3 -4
- package/dist/core/runner/park-commit.d.ts +1 -1
- package/dist/core/runner/permission-rule-lanes.d.ts +1 -2
- package/dist/core/runner/permission-rule-lanes.js +5 -4
- package/dist/core/runner/prepare-artifact.d.ts +4 -0
- package/dist/core/runner/prepare-artifact.js +2 -1
- package/dist/core/runner/prepare-ask-lane.d.ts +2 -0
- package/dist/core/runner/prepare-ask-lane.js +12 -6
- package/dist/core/runner/prepare-boundary-parks.d.ts +5 -8
- package/dist/core/runner/prepare-boundary-parks.js +4 -7
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +11 -15
- package/dist/core/runner/prepare-caps-and-workflow.js +19 -27
- package/dist/core/runner/prepare-config-doors.d.ts +9 -9
- package/dist/core/runner/prepare-config-doors.js +10 -5
- package/dist/core/runner/prepare-defer-classify.d.ts +2 -2
- package/dist/core/runner/prepare-defer-classify.js +5 -3
- package/dist/core/runner/prepare-delegation-surface.d.ts +1 -1
- package/dist/core/runner/prepare-delegation-surface.js +3 -3
- package/dist/core/runner/prepare-gate-stations.d.ts +4 -4
- package/dist/core/runner/prepare-gate-stations.js +9 -7
- package/dist/core/runner/prepare-hands-readface.d.ts +7 -7
- package/dist/core/runner/prepare-hands-readface.js +7 -7
- package/dist/core/runner/prepare-inherited-gate.d.ts +7 -6
- package/dist/core/runner/prepare-inherited-gate.js +14 -15
- package/dist/core/runner/prepare-listings.d.ts +7 -24
- package/dist/core/runner/prepare-listings.js +4 -5
- package/dist/core/runner/prepare-memory-engine-session.d.ts +2 -0
- package/dist/core/runner/prepare-memory-engine-session.js +4 -3
- package/dist/core/runner/prepare-memory.d.ts +6 -0
- package/dist/core/runner/prepare-memory.js +13 -13
- package/dist/core/runner/prepare-offload-wrappers.d.ts +5 -0
- package/dist/core/runner/prepare-offload-wrappers.js +3 -3
- package/dist/core/runner/prepare-park-ask.d.ts +7 -8
- package/dist/core/runner/prepare-park-ask.js +17 -10
- package/dist/core/runner/prepare-policy-chain.js +24 -44
- package/dist/core/runner/prepare-project-context.d.ts +1 -1
- package/dist/core/runner/prepare-project-context.js +3 -4
- package/dist/core/runner/prepare-protocol-tools.d.ts +9 -3
- package/dist/core/runner/prepare-protocol-tools.js +3 -4
- package/dist/core/runner/prepare-run-refs.d.ts +3 -0
- package/dist/core/runner/prepare-run-refs.js +2 -1
- package/dist/core/runner/prepare-safety-scan.d.ts +4 -8
- package/dist/core/runner/prepare-safety-scan.js +1 -2
- package/dist/core/runner/prepare-suspend-saga.d.ts +7 -1
- package/dist/core/runner/prepare-suspend-saga.js +28 -12
- package/dist/core/runner/prepare-task.d.ts +1 -1
- package/dist/core/runner/prepare-task.js +67 -56
- package/dist/core/runner/prepare-wiring-manifest.d.ts +11 -10
- package/dist/core/runner/prepare-wiring-manifest.js +5 -8
- package/dist/core/runner/resume-apply.js +7 -14
- package/dist/core/runner/resume-checkpoint-screen.js +11 -4
- package/dist/core/runner/resume-internals-and-config.js +2 -2
- package/dist/core/runner/resume-policy-outcome.js +5 -32
- package/dist/core/runner/resume-review-outcome.js +4 -1
- package/dist/core/runner/retired-runner-deps.d.ts +6 -0
- package/dist/core/runner/retired-runner-deps.js +10 -1
- package/dist/core/runner/run-brain-sinks.d.ts +4 -0
- package/dist/core/runner/run-brain-sinks.js +5 -2
- package/dist/core/runner/run-harness-handlers.js +27 -34
- package/dist/core/runner/run-leg.d.ts +0 -2
- package/dist/core/runner/run-leg.js +32 -33
- package/dist/core/runner/run-terminal-adoption.js +4 -3
- package/dist/core/runner/runtask.js +8 -8
- package/dist/core/runner/session-rule-policy.js +5 -5
- package/dist/core/runner/stream-settle-backstop.js +7 -4
- package/dist/core/runner/sub-agent-deny-lists.d.ts +51 -12
- package/dist/core/runner/sub-agent-deny-lists.js +111 -80
- package/dist/core/runner/terminal-account.d.ts +48 -0
- package/dist/core/runner/terminal-account.js +186 -0
- package/dist/core/runner/tool-end-body.d.ts +54 -17
- package/dist/core/runner/tool-end-body.js +27 -2
- package/dist/core/runner/tool-face-overlay.d.ts +3 -1
- package/dist/core/runner/tool-face-overlay.js +6 -4
- package/dist/core/runner/tool-occurrence.d.ts +106 -0
- package/dist/core/runner/tool-occurrence.js +123 -0
- package/dist/core/runner/tool-progress-lane.d.ts +16 -8
- package/dist/core/runner/tool-progress-lane.js +25 -34
- package/dist/core/runner/turn-attachments.d.ts +1 -1
- package/dist/core/runner/write-protection-station.d.ts +21 -9
- package/dist/core/runner/write-protection-station.js +20 -17
- package/dist/core/runner-deps.d.ts +12 -22
- package/dist/core/safety-axis-vocab.d.ts +1 -1
- package/dist/core/safety-merge-corpus.d.ts +1 -1
- package/dist/core/secret-env.d.ts +16 -5
- package/dist/core/secret-env.js +23 -63
- package/dist/core/sensitive-path-policy.d.ts +19 -18
- package/dist/core/sensitive-path-policy.js +73 -49
- package/dist/core/session-policy-store.d.ts +6 -3
- package/dist/core/session-policy-store.js +28 -10
- package/dist/core/session-reconcile.d.ts +3 -0
- package/dist/core/session-reconcile.js +5 -4
- package/dist/core/session-store.d.ts +5 -0
- package/dist/core/session-store.js +12 -0
- package/dist/core/session.d.ts +13 -0
- package/dist/core/shared-memory/normalize.d.ts +17 -4
- package/dist/core/shared-memory/normalize.js +7 -7
- package/dist/core/shell-lexer.js +5 -4
- package/dist/core/shell-wrapper-table.d.ts +2 -2
- package/dist/core/shell-wrapper-table.js +1 -1
- package/dist/core/skill-grant.js +1 -1
- package/dist/core/store-contracts/checkpoint-store-contract.js +13 -0
- package/dist/core/store-contracts/mailbox-store-contract.d.ts +7 -14
- package/dist/core/store-contracts/session-store-incarnation-contract.d.ts +27 -0
- package/dist/core/store-contracts/session-store-incarnation-contract.js +92 -0
- package/dist/core/stub-env.d.ts +2 -0
- package/dist/core/stub-env.js +1 -0
- package/dist/core/synthetic-read-verdict.js +2 -2
- package/dist/core/task-event.d.ts +59 -5
- package/dist/core/task-result.d.ts +1 -1
- package/dist/core/task-spec.d.ts +42 -9
- package/dist/core/terminal-cause.d.ts +94 -11
- package/dist/core/tighten-task-spec.d.ts +5 -4
- package/dist/core/tighten-task-spec.js +20 -25
- package/dist/core/tool-catalog-entries.d.ts +5 -7
- package/dist/core/tool-catalog-entries.js +14 -15
- package/dist/core/tool-face.d.ts +47 -0
- package/dist/core/tool-face.js +5 -0
- package/dist/core/tool-model-gate.d.ts +5 -5
- package/dist/core/tool-name-aliases.d.ts +35 -10
- package/dist/core/tool-name-aliases.js +15 -0
- package/dist/core/tool-name-list.d.ts +30 -0
- package/dist/core/tool-name-list.js +55 -0
- package/dist/core/tool-name-readings.d.ts +1 -9
- package/dist/core/tool-name-readings.js +1 -3
- package/dist/core/tool-policy.d.ts +195 -85
- package/dist/core/tool-policy.js +165 -381
- package/dist/core/tool-registry.d.ts +44 -1
- package/dist/core/tool-registry.js +26 -0
- package/dist/core/tool-roster.d.ts +19 -1
- package/dist/core/tool-roster.js +21 -2
- package/dist/core/tool-spec-members.d.ts +45 -0
- package/dist/core/tool-spec-members.js +169 -0
- package/dist/core/tool-spec.d.ts +46 -8
- package/dist/core/tools.d.ts +6 -2
- package/dist/core/tools.js +8 -4
- package/dist/core/untrusted-egress.js +29 -26
- package/dist/core/untrusted-text.d.ts +13 -10
- package/dist/core/untrusted-text.js +6 -44
- package/dist/core/workflow-journal-store.d.ts +4 -1
- package/dist/core/write-protect.d.ts +65 -29
- package/dist/core/write-protect.js +235 -177
- package/dist/engine/compaction/compaction.d.ts +2 -2
- package/dist/engine/execution-env/node-execution-env.d.ts +5 -23
- package/dist/engine/execution-env/node-execution-env.js +16 -38
- package/dist/engine/execution-env/symlink-chain.d.ts +23 -0
- package/dist/engine/execution-env/symlink-chain.js +32 -0
- package/dist/engine/harness/types.d.ts +7 -0
- package/dist/engine/llm/tool-turns.d.ts +3 -0
- package/dist/engine/llm/tool-turns.js +1 -0
- package/dist/engine/llm/types.d.ts +59 -23
- package/dist/engine/loop/agent-loop.js +16 -2
- package/dist/engine/session/memory-repo.js +11 -3
- package/dist/engine/session/repo-utils.d.ts +8 -0
- package/dist/engine/session/repo-utils.js +13 -0
- package/dist/index.d.ts +20 -23
- package/dist/index.js +17 -20
- package/dist/internal/harness.d.ts +1 -1
- package/dist/internal/harness.js +1 -1
- package/dist/internal/llm.d.ts +2 -2
- package/dist/internal/llm.js +1 -1
- package/dist/orchestration/governance-baseline-validity.js +1 -1
- package/dist/orchestration/run-spec.js +3 -3
- package/dist/orchestration/run-workflow-tool.d.ts +16 -35
- package/dist/orchestration/run-workflow-tool.js +38 -78
- package/dist/orchestration/workflow-governance.d.ts +21 -25
- package/dist/orchestration/workflow-governance.js +38 -78
- package/dist/orchestration/workflow-primitives.d.ts +7 -22
- package/dist/orchestration/workflow-primitives.js +5 -12
- package/dist/orchestration/workflow-types.d.ts +1 -1
- package/dist/orchestration/workflow.d.ts +61 -11
- package/dist/orchestration/workflow.js +191 -119
- package/dist/prompt-assembly/types.d.ts +1 -1
- package/dist/scenarios/full-body.d.ts +1 -1
- package/dist/shell/lex.d.ts +0 -21
- package/dist/shell/lex.js +278 -70
- package/dist/shell/shell-words.d.ts +35 -0
- package/dist/shell/shell-words.js +65 -0
- package/dist/stores/file/checkpoint-store.d.ts +5 -5
- package/dist/stores/file/checkpoint-store.js +5 -2
- package/dist/stores/file/index.d.ts +0 -8
- package/dist/stores/file/index.js +0 -12
- package/dist/stores/file/session-store.d.ts +3 -0
- package/dist/stores/file/session-store.js +44 -19
- package/dist/tools/artifact/artifact-tool.js +2 -0
- package/dist/tools/fs/bash-program-position.d.ts +17 -3
- package/dist/tools/fs/bash-program-position.js +25 -10
- package/dist/tools/fs/bash-readonly-classifier.d.ts +1 -1
- package/dist/tools/fs/bash-readonly-classifier.js +8 -7
- package/dist/tools/fs/containment-face.d.ts +4 -0
- package/dist/tools/fs/containment-face.js +3 -0
- package/dist/tools/fs/fs-shared.d.ts +10 -0
- package/dist/tools/fs/fs-shared.js +18 -0
- package/dist/tools/fs/fs-write.js +4 -2
- package/dist/tools/fs/index.d.ts +3 -2
- package/dist/tools/fs/index.js +2 -2
- package/dist/tools/fs/program-read-model.d.ts +99 -23
- package/dist/tools/fs/program-read-model.js +129 -55
- package/dist/tools/fs/program-read-model.rows.d.ts +0 -14
- package/dist/tools/fs/program-read-model.rows.js +18 -10
- package/dist/tools/fs/read-deny-home.d.ts +35 -30
- package/dist/tools/fs/read-deny-home.js +45 -38
- package/dist/tools/fs/read-deny.d.ts +35 -27
- package/dist/tools/fs/read-deny.js +126 -92
- package/dist/tools/fs/removal-targets.d.ts +56 -23
- package/dist/tools/fs/removal-targets.js +74 -87
- package/dist/tools/fs/safety.d.ts +29 -22
- package/dist/tools/fs/safety.js +17 -11
- package/dist/tools/fs/search.js +10 -8
- package/dist/tools/fs/shell-read-argv.d.ts +4 -7
- package/dist/tools/fs/shell-read-argv.js +6 -8
- package/dist/tools/fs/shell-read-bindings.d.ts +203 -46
- package/dist/tools/fs/shell-read-bindings.js +488 -144
- package/dist/tools/fs/shell-read-builtins.d.ts +35 -0
- package/dist/tools/fs/shell-read-builtins.js +43 -0
- package/dist/tools/fs/shell-read-check.d.ts +15 -1
- package/dist/tools/fs/shell-read-check.js +51 -42
- package/dist/tools/fs/shell-read-establish.js +9 -10
- package/dist/tools/fs/shell-read-functions.d.ts +22 -0
- package/dist/tools/fs/shell-read-functions.js +29 -0
- package/dist/tools/fs/shell-read-judge.d.ts +48 -18
- package/dist/tools/fs/shell-read-judge.js +33 -4
- package/dist/tools/fs/shell-read-plan.d.ts +13 -20
- package/dist/tools/fs/shell-read-plan.js +200 -194
- package/dist/tools/fs/shell-read-start.d.ts +80 -0
- package/dist/tools/fs/shell-read-start.js +99 -0
- package/dist/tools/fs/shell-read-word.d.ts +35 -6
- package/dist/tools/fs/shell-read-word.js +89 -9
- package/dist/tools/fs/shell-read-workdir.d.ts +156 -0
- package/dist/tools/fs/shell-read-workdir.js +281 -0
- package/dist/tools/fs/shell-read-write-targets.d.ts +5 -2
- package/dist/tools/fs/shell-read-write-targets.js +14 -5
- package/dist/tools/fs/shell-reentry-text.d.ts +26 -26
- package/dist/tools/fs/shell-reentry-text.js +31 -34
- package/dist/tools/task-list.d.ts +1 -2
- package/dist/tools/web.js +1 -1
- package/package.json +4 -1
- package/test/export-surface.snapshot.json +107 -143
- package/wire-changes/core@7.48.0.json +252 -0
- package/wire-changes/core@7.49.0.json +4765 -0
- package/dist/agents/teacher.d.ts +0 -159
- package/dist/agents/teacher.js +0 -577
- package/dist/agents/team.d.ts +0 -226
- package/dist/agents/team.js +0 -257
- package/dist/core/strategy-store.d.ts +0 -238
- package/dist/core/strategy-store.js +0 -253
- package/dist/orchestration/builtin-workflows.d.ts +0 -133
- package/dist/orchestration/builtin-workflows.js +0 -159
- package/dist/scenarios/env.d.ts +0 -40
- package/dist/scenarios/env.js +0 -39
- package/dist/scenarios/scenario-registry.d.ts +0 -110
- package/dist/scenarios/scenario-registry.js +0 -140
- package/dist/scenarios/teacher-quickstart.d.ts +0 -40
- package/dist/scenarios/teacher-quickstart.js +0 -12
- package/dist/stores/cc/lockfile.d.ts +0 -10
- package/dist/stores/cc/lockfile.js +0 -98
- package/dist/stores/cc/mailbox-store.d.ts +0 -20
- package/dist/stores/cc/mailbox-store.js +0 -255
- package/dist/stores/cc/roster-adapter.d.ts +0 -12
- package/dist/stores/cc/roster-adapter.js +0 -117
- package/dist/stores/cc/sidecar-transcript.d.ts +0 -97
- package/dist/stores/cc/sidecar-transcript.js +0 -264
- package/dist/stores/cc/task-list-store.d.ts +0 -2
- package/dist/stores/cc/task-list-store.js +0 -125
- package/dist/stores/file/strategy-store.d.ts +0 -97
- package/dist/stores/file/strategy-store.js +0 -341
|
@@ -15,51 +15,54 @@ export declare function declaredReadDenyHomes(env: Pick<ExecutionEnv, "homeDir">
|
|
|
15
15
|
* gave no answer, or where the declared home's own probe did not answer (ask again later). */
|
|
16
16
|
export declare function readDenyHomesOf(env: Pick<ExecutionEnv, "homeDir" | "canonicalPath">, signal?: AbortSignal): Promise<string[]>;
|
|
17
17
|
/**
|
|
18
|
-
* Where
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* (`canonicalizeTarget`: the longest existing prefix resolved, the rest rejoined); a location
|
|
22
|
-
*
|
|
23
|
-
*
|
|
18
|
+
* Where a table's deny rows LEAD past the places their own runs anchor them, keyed by the row's pattern — the `linked`
|
|
19
|
+
* argument of `compileReadDeny`. ONE constructor for every anchor ({@link ReadDenyRowAnchor}): the rows the anchor
|
|
20
|
+
* places, each row's LITERAL HEAD ({@link literalHeadOf}) spelled under each of the anchor's places and resolved the way the
|
|
21
|
+
* read faces mint their keys (`canonicalizeTarget`: the longest existing prefix resolved, the rest rejoined); a location
|
|
22
|
+
* that differs from the spellings the row is already anchored at is where one of the head's segments is a link (`~/.sema`
|
|
23
|
+
* into a dotfiles directory, `/app` a link to `/data/app`), and the row is placed there too.
|
|
24
|
+
* · a head that resolves to its own spelling at an anchored place adds nothing (the row is already placed there);
|
|
24
25
|
* · a head under a spelling that is no directory (a segment of it is a file, a symlink to a file, a device node or a
|
|
25
26
|
* socket — the environment answers `not_directory` for the head) has nothing below it: an answer that adds nothing;
|
|
26
27
|
* · any other head that cannot be resolved (an unanswered or refused probe — a directory the probe may not enter — a
|
|
27
|
-
* probe that throws) adds nothing, and the answer is not WHOLE (`whole: false`): the row stays
|
|
28
|
-
*
|
|
29
|
-
* · a row whose head is empty (`~/.sema.*`) has no location to resolve and adds nothing;
|
|
28
|
+
* probe that throws) adds nothing, and the answer is not WHOLE (`whole: false`): the row stays at the places its run
|
|
29
|
+
* anchors until the mount places again;
|
|
30
30
|
* · the heads are resolved together, so one placement waits at most one probe bound — or, with `deadline` (an absolute
|
|
31
31
|
* time), each head until then: a head still unresolved at the deadline is a head that did not answer;
|
|
32
32
|
* · read per placement — a link created afterwards is followed from the next placement on.
|
|
33
33
|
*/
|
|
34
|
-
export declare function
|
|
34
|
+
export declare function readDenyLinksOf(env: ExecutionEnv, entries: readonly {
|
|
35
35
|
readonly pattern: string;
|
|
36
36
|
readonly caseSensitive?: boolean;
|
|
37
|
-
}[],
|
|
37
|
+
}[], anchor: ReadDenyRowAnchor, signal?: AbortSignal, deadline?: number): Promise<{
|
|
38
38
|
readonly linked: Map<string, string[]>;
|
|
39
39
|
readonly whole: boolean;
|
|
40
40
|
}>;
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
42
|
+
* Which rows one placement reads, and where their heads are spelled:
|
|
43
|
+
* · `home` — the home-anchored rows (`~/…`), under each home; the row's run anchors it there;
|
|
44
|
+
* · `root` — the ROOTED rows (`/app/config-lkg.json`, {@link isRootedReadDenyPattern}), under the filesystem root; the run
|
|
45
|
+
* anchors it there. A root is no home: read whether or not a home answered;
|
|
46
|
+
* · `unanchored` — the rows that open with the configuration directory's name (`~/.sema/…`, {@link agentConfigDirTail})
|
|
47
|
+
* under each spelling of the root the host declares for that directory (`RunnerDeps.agentConfigDir`): the head BELOW
|
|
48
|
+
* the directory name, a head that ends at it (`~/.sema/*.json`, `~/.sema`) the root itself. The row's run does not
|
|
49
|
+
* anchor it there (it is anchored at the homes), so every location — the spelling itself and where it leads — is one
|
|
50
|
+
* the row is placed at in addition; the row's name in every refusal is unchanged.
|
|
51
|
+
* A home or rooted row whose head is empty (`~/.sema.*`, `/*.json`) has no location to resolve and adds nothing.
|
|
51
52
|
*/
|
|
52
|
-
export
|
|
53
|
-
readonly
|
|
54
|
-
readonly
|
|
55
|
-
}
|
|
56
|
-
readonly
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
export type ReadDenyRowAnchor = {
|
|
54
|
+
readonly at: "home";
|
|
55
|
+
readonly homes: readonly string[];
|
|
56
|
+
} | {
|
|
57
|
+
readonly at: "root";
|
|
58
|
+
} | {
|
|
59
|
+
readonly at: "unanchored";
|
|
60
|
+
readonly roots: readonly string[];
|
|
61
|
+
};
|
|
59
62
|
/** Where an absolute location LEADS in one environment — resolved the way the read and write faces mint their keys
|
|
60
63
|
* (`canonicalizeTarget`: the longest existing prefix resolved, the rest rejoined). `undefined` when the environment
|
|
61
64
|
* does not answer (a refused or failed probe, one that throws). The one resolution a deny row's placement reads: a
|
|
62
|
-
*
|
|
65
|
+
* deny row's head ({@link readDenyLinksOf}) and a rule row's head ({@link whereItsAnsweredPrefixLeads}). */
|
|
63
66
|
export declare function whereItLeads(env: ExecutionEnv, at: string, family?: PathFamily, signal?: AbortSignal): Promise<string | undefined>;
|
|
64
67
|
/** {@link whereItLeads} with a floor: where the environment does not answer for `at` (a probe that fails), the longest
|
|
65
68
|
* prefix it does answer for is resolved and the rest rejoined — a rule row's head below a base that resolves is never
|
|
@@ -133,12 +136,14 @@ export declare function carryHomeViews<T extends object>(judge: T, source: HomeV
|
|
|
133
136
|
* · the HOME SET — `homes` when the mount carries a list (the account is not asked and no home is added), else the
|
|
134
137
|
* declared home and the account lookup's answer ({@link declaredReadDenyHomes}); every home of the set is anchored at
|
|
135
138
|
* its spelling and, where the environment answered one, its canonical spelling — one rule for both forms;
|
|
136
|
-
* · the DECLARED home's canonical spelling under the tree's gate bound, and its rows' heads ({@link
|
|
139
|
+
* · the DECLARED home's canonical spelling under the tree's gate bound, and its rows' heads ({@link readDenyLinksOf}):
|
|
137
140
|
* a declared home, or a head under it, that did not answer leaves the placement not WHOLE — and an account lookup
|
|
138
141
|
* with no answer, or a declared home that did not answer, places nothing: the rows are held anywhere (`compile([])`)
|
|
139
142
|
* rather than at a spelling that may miss the home's canonical one;
|
|
140
143
|
* · each AUXILIARY home (see the module head) read once under {@link AUXILIARY_HOME_PROBE_MS} — its spellings, its
|
|
141
|
-
* chain, its rows' heads — at the same time; whatever of it did not answer costs that home alone and never `whole
|
|
144
|
+
* chain, its rows' heads — at the same time; whatever of it did not answer costs that home alone and never `whole`;
|
|
145
|
+
* · the ROOTED rows' heads ({@link readDenyLinksOf}), read whether or not a home answered: a head that did not answer
|
|
146
|
+
* leaves the placement not WHOLE, and a placement that held the rows anywhere still places them.
|
|
142
147
|
* `compile` is the mount's own compile; the rows' patterns are read off its compile at no home. */
|
|
143
148
|
export declare function placeReadDenyAtHome(env: ExecutionEnv, compile: (homes: readonly string[], linked?: ReadonlyMap<string, readonly string[]>) => ReadDenyMatcher, homes?: readonly string[], signal?: AbortSignal, configRoot?: string): Promise<{
|
|
144
149
|
readonly matcher: PlacedReadDenyMatcher;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { userInfo } from "node:os";
|
|
2
|
-
import { canonicalizeTarget,
|
|
2
|
+
import { canonicalizeTarget, isAbsoluteForFamily, joinForFamily, normalizeAbsPathLexically, pathFamilyOf } from "./safety.js";
|
|
3
3
|
import { DEFAULT_GATE_AWAIT_TIMEOUT_MS, withGateTimeout } from "../../core/gate-bounded-await.js";
|
|
4
4
|
import { thrownText } from "../../core/thrown-value.js";
|
|
5
5
|
import { agentConfigDirTail } from "../../core/agent-config-dir.js";
|
|
6
|
-
import {
|
|
6
|
+
import { validatePath } from "../../core/effective-path-target.js";
|
|
7
|
+
import { isRootedReadDenyPattern, readDenyPatternRun, readDenyRunHead } from "./read-deny.js";
|
|
7
8
|
export const AUXILIARY_HOME_PROBE_MS = 2_000;
|
|
8
9
|
const said = new Set();
|
|
9
10
|
function sayOnce(kind, line) {
|
|
@@ -36,8 +37,9 @@ function valueText(v) {
|
|
|
36
37
|
function accountHomeOf() {
|
|
37
38
|
try {
|
|
38
39
|
const home = userInfo().homedir;
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
const valid = validatePath(home, { intent: "validate-coordinate" });
|
|
41
|
+
if (valid !== undefined)
|
|
42
|
+
return { state: "home", home: valid };
|
|
41
43
|
sayOnce("bad_value", `read-deny homes: the account home lookup answered ${valueText(home)}, not an absolute path — home-anchored read-deny rows are placed under the environment's declared home only.`);
|
|
42
44
|
return { state: "none" };
|
|
43
45
|
}
|
|
@@ -49,8 +51,7 @@ function accountHomeOf() {
|
|
|
49
51
|
}
|
|
50
52
|
}
|
|
51
53
|
function declaredHomeOf(env) {
|
|
52
|
-
|
|
53
|
-
return home !== undefined && isAbsolutePathForm(home) ? home : undefined;
|
|
54
|
+
return validatePath(env.homeDir, { intent: "validate-coordinate" });
|
|
54
55
|
}
|
|
55
56
|
function declaredReadDenyHomesAnswered(env) {
|
|
56
57
|
const home = declaredHomeOf(env);
|
|
@@ -105,39 +106,43 @@ function sayAuxiliary(what, subject = "auxiliary") {
|
|
|
105
106
|
}
|
|
106
107
|
sayOnce("auxiliary", `read-deny homes: a home beside the environment's declared home did not answer its probes within ${AUXILIARY_HOME_PROBE_MS} ms (${what}) — its home-anchored read-deny rows sit at its spelling only, and a path through an alias of it is judged as spelled, until the next placement.`);
|
|
107
108
|
}
|
|
108
|
-
export async function
|
|
109
|
-
|
|
110
|
-
for (const { pattern, caseSensitive } of entries) {
|
|
111
|
-
const { homeAnchored, run } = readDenyPatternRun(pattern);
|
|
112
|
-
if (!homeAnchored)
|
|
113
|
-
continue;
|
|
114
|
-
const head = run.split("/").filter(Boolean).slice(0, readDenyRunHead(run)).join("/");
|
|
115
|
-
if (head.length === 0)
|
|
116
|
-
continue;
|
|
117
|
-
const spelled = homes.map((home) => normalizeAbsPathLexically(joinForFamily(pathFamilyOf({ root: home }), home, head)));
|
|
118
|
-
rows.push({ pattern, caseSensitive: caseSensitive === true, spelled, anchored: spelled });
|
|
119
|
-
}
|
|
120
|
-
return await linkedLocationsOf(env, rows, signal, deadline);
|
|
109
|
+
export async function readDenyLinksOf(env, entries, anchor, signal, deadline) {
|
|
110
|
+
return await linkedLocationsOf(env, anchoredRowsOf(entries, anchor), signal, deadline);
|
|
121
111
|
}
|
|
122
|
-
|
|
123
|
-
|
|
112
|
+
const ROOT = "/";
|
|
113
|
+
function literalHeadOf(run) {
|
|
114
|
+
return run.split("/").filter(Boolean).slice(0, readDenyRunHead(run)).join("/");
|
|
124
115
|
}
|
|
125
|
-
function
|
|
116
|
+
function anchoredRowsOf(entries, anchor) {
|
|
117
|
+
const places = anchor.at === "home" ? anchor.homes : anchor.at === "root" ? [ROOT] : anchor.roots;
|
|
126
118
|
const rows = [];
|
|
127
119
|
for (const { pattern, caseSensitive } of entries) {
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
if (tail === undefined)
|
|
120
|
+
const head = rowHeadOf(pattern, caseSensitive === true, anchor);
|
|
121
|
+
if (head === undefined)
|
|
131
122
|
continue;
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
rows.push({ pattern, caseSensitive: caseSensitive === true, spelled, anchored: [] });
|
|
123
|
+
const spelled = places.map((place) => normalizeAbsPathLexically(head.length === 0 ? place : joinForFamily(pathFamilyOf({ root: place }), place, head)));
|
|
124
|
+
rows.push({ pattern, caseSensitive: caseSensitive === true, spelled, anchored: anchor.at === "unanchored" ? [] : spelled });
|
|
135
125
|
}
|
|
136
126
|
return rows;
|
|
137
127
|
}
|
|
128
|
+
function rowHeadOf(pattern, caseSensitive, anchor) {
|
|
129
|
+
if (anchor.at === "root") {
|
|
130
|
+
const head = isRootedReadDenyPattern(pattern) ? literalHeadOf(pattern) : "";
|
|
131
|
+
return head.length > 0 ? head : undefined;
|
|
132
|
+
}
|
|
133
|
+
const { homeAnchored, run } = readDenyPatternRun(pattern);
|
|
134
|
+
if (!homeAnchored)
|
|
135
|
+
return undefined;
|
|
136
|
+
if (anchor.at === "unanchored") {
|
|
137
|
+
const tail = agentConfigDirTail(run, caseSensitive);
|
|
138
|
+
return tail === undefined ? undefined : literalHeadOf(tail);
|
|
139
|
+
}
|
|
140
|
+
const head = literalHeadOf(run);
|
|
141
|
+
return head.length > 0 ? head : undefined;
|
|
142
|
+
}
|
|
138
143
|
function configRootSpelledLinks(entries, roots) {
|
|
139
144
|
const out = new Map();
|
|
140
|
-
for (const { pattern, spelled } of
|
|
145
|
+
for (const { pattern, spelled } of anchoredRowsOf(entries, { at: "unanchored", roots }))
|
|
141
146
|
out.set(pattern, [...new Set(spelled)]);
|
|
142
147
|
return out;
|
|
143
148
|
}
|
|
@@ -242,9 +247,7 @@ async function readAuxiliaryHome(env, home, opts, signal) {
|
|
|
242
247
|
typeof identity === "function" ? chainAbove(env, identity, spelled.canonical, signal, deadline) : Promise.resolve({ ancestors: [], whole: true }),
|
|
243
248
|
opts.entries === undefined
|
|
244
249
|
? Promise.resolve({ linked: new Map(), whole: true })
|
|
245
|
-
: opts.configRoot === true
|
|
246
|
-
? readDenyConfigRootLinksOf(env, opts.entries, place, signal, deadline)
|
|
247
|
-
: readDenyHomeLinksOf(env, opts.entries, place, signal, deadline),
|
|
250
|
+
: readDenyLinksOf(env, opts.entries, opts.configRoot === true ? { at: "unanchored", roots: place } : { at: "home", homes: place }, signal, deadline),
|
|
248
251
|
]);
|
|
249
252
|
reading = { place, chain, linked: heads.linked, answered: chain.whole && heads.whole };
|
|
250
253
|
}
|
|
@@ -320,7 +323,7 @@ function homeViewSourceOver(env, auxiliary) {
|
|
|
320
323
|
};
|
|
321
324
|
return {
|
|
322
325
|
async of(path, opts) {
|
|
323
|
-
if (typeof identity !== "function" || (declared === undefined && auxiliary.length === 0) || !
|
|
326
|
+
if (typeof identity !== "function" || (declared === undefined && auxiliary.length === 0) || !isAbsoluteForFamily("own", path))
|
|
324
327
|
return undefined;
|
|
325
328
|
const spelled = normalizeAbsPathLexically(path);
|
|
326
329
|
const view = await viewOf(spelled, opts?.leaf === "file");
|
|
@@ -348,7 +351,7 @@ export function sayPlacementLost() {
|
|
|
348
351
|
}
|
|
349
352
|
function readAuxiliaryHomes(env, homes, opts, signal) {
|
|
350
353
|
const declared = declaredHomeOf(env);
|
|
351
|
-
return [...new Set(homes.filter((h) =>
|
|
354
|
+
return [...new Set(homes.filter((h) => isAbsoluteForFamily("own", h) && !isDeclared(declared, h)))].map((home) => readAuxiliaryHome(env, home, opts, signal));
|
|
352
355
|
}
|
|
353
356
|
export function homeViewsAt(env, homes) {
|
|
354
357
|
return homeViewSourceOver(env, readAuxiliaryHomes(env, homes, {}));
|
|
@@ -363,8 +366,12 @@ export async function placeReadDenyAtHome(env, compile, homes, signal, configRoo
|
|
|
363
366
|
const entries = compile([]).entries;
|
|
364
367
|
const declared = declaredHomeOf(env);
|
|
365
368
|
const relocated = configRoot === undefined ? undefined : readAuxiliaryHome(env, configRoot, { entries, configRoot: true }, signal);
|
|
369
|
+
const rooted = readDenyLinksOf(env, entries, { at: "root" }, signal);
|
|
366
370
|
const heldAnywhere = async (whole) => {
|
|
367
|
-
const linked =
|
|
371
|
+
const linked = new Map();
|
|
372
|
+
for (const map of [(await relocated)?.linked, (await rooted).linked])
|
|
373
|
+
for (const [pattern, locations] of map ?? [])
|
|
374
|
+
linked.set(pattern, locations);
|
|
368
375
|
return placementOf(carryHomeViews(linked.size === 0 ? compile([]) : compile([], linked), homeViewSourceOver(env, relocated === undefined ? [] : [relocated])), [], linked, whole);
|
|
369
376
|
};
|
|
370
377
|
const listed = homes === undefined ? declaredReadDenyHomesAnswered(env) : { homes, whole: true };
|
|
@@ -379,15 +386,15 @@ export async function placeReadDenyAtHome(env, compile, homes, signal, configRoo
|
|
|
379
386
|
declaredAt = [...new Set([...own, ...ownSpellings.spellings])];
|
|
380
387
|
}
|
|
381
388
|
const auxiliary = readAuxiliaryHomes(env, listed.homes, { entries }, signal);
|
|
382
|
-
const [heads, readings, root] = await Promise.all([
|
|
389
|
+
const [heads, readings, root, rootedHeads] = await Promise.all([readDenyLinksOf(env, entries, { at: "home", homes: declaredAt }, signal), Promise.all(auxiliary), relocated, rooted]);
|
|
383
390
|
const at = [...new Set([...declaredAt, ...readings.flatMap((r) => r.place)])];
|
|
384
391
|
const linked = new Map();
|
|
385
|
-
for (const map of [heads.linked, ...readings.map((r) => r.linked), ...(root === undefined ? [] : [root.linked])]) {
|
|
392
|
+
for (const map of [heads.linked, ...readings.map((r) => r.linked), ...(root === undefined ? [] : [root.linked]), rootedHeads.linked]) {
|
|
386
393
|
for (const [pattern, locations] of map)
|
|
387
394
|
linked.set(pattern, [...new Set([...(linked.get(pattern) ?? []), ...locations])]);
|
|
388
395
|
}
|
|
389
396
|
const matcher = linked.size === 0 ? compile(at) : compile(at, linked);
|
|
390
|
-
return placementOf(carryHomeViews(matcher, homeViewSourceOver(env, relocated === undefined ? auxiliary : [...auxiliary, relocated])), at, linked, heads.whole);
|
|
397
|
+
return placementOf(carryHomeViews(matcher, homeViewSourceOver(env, relocated === undefined ? auxiliary : [...auxiliary, relocated])), at, linked, heads.whole && rootedHeads.whole);
|
|
391
398
|
}
|
|
392
399
|
export function readDenyPlacedLater(unplaced, place) {
|
|
393
400
|
let current = unplaced;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type PathGuardFold, type PathGuardRow, type PathRowsHit, type TargetViews } from "../../core/path-guard-rows.js";
|
|
1
2
|
/**
|
|
2
3
|
* One deny entry: a `/`-separated run of path SEGMENTS. `*` matches any run of non-separator
|
|
3
4
|
* characters within one segment and is the ONLY metacharacter (everything else is literal). The run
|
|
@@ -5,7 +6,10 @@
|
|
|
5
6
|
* unless the pattern opens with the HOME word ({@link READ_DENY_HOME_WORD}): `~/<run>` matches only where
|
|
6
7
|
* the run starts right below the execution environment's home directory (`~/.sema/settings.json` is the
|
|
7
8
|
* home's file, never a project's `.sema/settings.json`). Only a FIRST segment that is exactly `~` is the
|
|
8
|
-
* word; `~user` and a `~` further along are literal segments.
|
|
9
|
+
* word; `~user` and a `~` further along are literal segments. A pattern that opens with `/` (and is not home-anchored)
|
|
10
|
+
* is ROOTED, the same kind of anchor with the filesystem root as its place: `/app/config-lkg.json` names the file
|
|
11
|
+
* at exactly that location, never a project's `app/config-lkg.json` — the run must start at the first segment of an
|
|
12
|
+
* absolute path (a path that is not absolute is not placed, and the row does not judge it).
|
|
9
13
|
* String shorthand ≡ `{ pattern }`. Matching is ASCII-case-insensitive by default (a case-insensitive
|
|
10
14
|
* filesystem serves `.SSH` and `.ssh` as the same directory); `caseSensitive: true` opts a single
|
|
11
15
|
* entry out. Unicode normalization (NFC/NFD) and volume-level case semantics are NOT modeled (v1
|
|
@@ -83,28 +87,12 @@ export type PathRowReach = {
|
|
|
83
87
|
export interface JudgedPathRow extends PathRuleDenyRow {
|
|
84
88
|
readonly reach?: (absolutePath: string) => PathRowReach;
|
|
85
89
|
}
|
|
86
|
-
/** A call's target as a judgment reads it: the absolute spellings of its views (lexical, canonical, the leaf chain's hops —
|
|
87
|
-
* any order the caller holds), or `unreadable` when the call names a target this reading cannot locate. */
|
|
88
|
-
export interface TargetViews {
|
|
89
|
-
readonly spellings: readonly string[];
|
|
90
|
-
readonly unreadable?: string;
|
|
91
|
-
}
|
|
92
|
-
/** What {@link pathRowsReach} found: the row, the view it met there (absent on an unreadable hold), and — when nothing was
|
|
93
|
-
* reached and some row could not be judged — the reason of the first such row. */
|
|
94
|
-
export interface PathRowsHit<R> {
|
|
95
|
-
readonly row: R;
|
|
96
|
-
readonly view?: string;
|
|
97
|
-
readonly unreadable?: string;
|
|
98
|
-
}
|
|
99
90
|
/**
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
* row that cannot be judged (or a target that cannot be read) is held and answered only when no row reaches. `allow`: a
|
|
104
|
-
* row admits the call only when it admits EVERY view (a link out of an allowed directory is not admitted through its
|
|
105
|
-
* spelling); an unreadable target is admitted by nothing.
|
|
91
|
+
* Rule rows judged by THE one judgment ({@link judgePathRows}): each rule row read as a guarded row whose reach over a view
|
|
92
|
+
* is the rule's own reach over the view's spelling (never exemptible — a rule says exactly where it reaches). Same rows
|
|
93
|
+
* outer, views inner, same tighten / allow law as every other row; the hit names the rule row itself.
|
|
106
94
|
*/
|
|
107
|
-
export declare function
|
|
95
|
+
export declare function judgeRuleRows<R extends JudgedPathRow>(rows: readonly R[], views: TargetViews, direction: "tighten" | "allow"): PathRowsHit<R> | undefined;
|
|
108
96
|
/** The locations a row is also judged at (each leading part of its HEAD: the anchor's children down to the head itself,
|
|
109
97
|
* a share's root for a UNC head) — what a leg resolves once, for every row whose head it holds. */
|
|
110
98
|
export declare function ruleHeadParts(rows: readonly Pick<PathRuleDenyRow, "head">[]): string[];
|
|
@@ -126,10 +114,23 @@ export declare function rowsWhereTheyLead<R extends JudgedPathRow>(rows: readonl
|
|
|
126
114
|
export declare function locationLeadsTo(path: string, leads: ReadonlyMap<string, string | undefined>): string | undefined;
|
|
127
115
|
/** {@link rowsWhereTheyLead} with each part resolved by `leadsTo` (the leg's resolution; each part once). */
|
|
128
116
|
export declare function withRuleRowsWhereTheyLead<R extends JudgedPathRow>(rows: readonly R[], leadsTo: (head: string) => Promise<string | undefined>): Promise<R[]>;
|
|
117
|
+
/** A rule row as a row of the one table: its name is the rule text, its reach the rule's own over a view's spelling. */
|
|
118
|
+
export declare function ruleGuardRow<R extends JudgedPathRow>(rule: R): PathGuardRow & {
|
|
119
|
+
readonly rule: R;
|
|
120
|
+
};
|
|
121
|
+
/** A compiled segment-glob row as a row of the one table (`faces`, `polarity`, `exemptible` and `origin` are the table's). */
|
|
122
|
+
export declare function segmentGuardRow(pat: CompiledSegmentPattern, columns: {
|
|
123
|
+
readonly faces: readonly DenyFace[];
|
|
124
|
+
readonly polarity: "deny" | "ask";
|
|
125
|
+
readonly exemptible: boolean;
|
|
126
|
+
readonly fold: PathGuardFold;
|
|
127
|
+
readonly origin: PathGuardRow["origin"];
|
|
128
|
+
readonly tier?: string;
|
|
129
|
+
}): PathGuardRow;
|
|
129
130
|
/**
|
|
130
131
|
* The WRITE face of the deny table: the rule rows whose faces include `write` — the judge the shell station reads for a
|
|
131
132
|
* command's write targets (a redirection, `tee`, `sed -i`, `cp` / `mv` / `touch` / `mkdir` / `rm` operands). Same row
|
|
132
|
-
* type, same judgment ({@link
|
|
133
|
+
* type, same judgment ({@link judgePathRows}) as the read face's rows; a hit names the row by its rule text.
|
|
133
134
|
*/
|
|
134
135
|
export interface WriteDenyMatcher {
|
|
135
136
|
/** Which face this judge is — the write tools' path resolution reads it to word and code the refusal as a write. */
|
|
@@ -384,8 +385,9 @@ export interface CompiledSegmentPattern {
|
|
|
384
385
|
/** The segment lists of the directories the run is ANCHORED at (folded as the pattern folds): the run must start
|
|
385
386
|
* right after one of them. Absent = the run matches anywhere. */
|
|
386
387
|
anchors?: readonly (readonly string[])[];
|
|
387
|
-
/** Judged in a ROOTED view only: an extra location of a home-anchored row (where its literal head leads)
|
|
388
|
-
*
|
|
388
|
+
/** Judged in a ROOTED view only: an extra location of a home-anchored row (where its literal head leads), or a row that is
|
|
389
|
+
* itself rooted (anchored at the filesystem root, {@link ReadDenyEntry}). A view that is not rooted cannot be placed: a
|
|
390
|
+
* home-anchored row's own run is held anywhere in it (the row cannot be placed, so it holds wider); these two judge it not. */
|
|
389
391
|
rootedOnly?: true;
|
|
390
392
|
}
|
|
391
393
|
/**
|
|
@@ -408,6 +410,12 @@ export declare function compileSegmentPattern(raw: string, fold: "none" | "ascii
|
|
|
408
410
|
export declare function matchSegmentPatterns(path: string, compiled: readonly CompiledSegmentPattern[], opts?: {
|
|
409
411
|
readonly aliasResolved?: boolean;
|
|
410
412
|
}): string | null;
|
|
413
|
+
/** One entry's refusal under the deny list's entry law ({@link normalizeEntry}, the compiler's own), or `undefined` when the
|
|
414
|
+
* entry is lawful — the law read without compiling, for a door that judges a list before anything folds it. */
|
|
415
|
+
export declare function readDenyEntryProblem(entry: unknown, layer: string): string | undefined;
|
|
416
|
+
/** Is a canonical pattern ROOTED — placed at the filesystem root ({@link ReadDenyEntry})? Only {@link canonicalReadDenyPattern}
|
|
417
|
+
* puts a leading `/` on a canonical pattern, so the text is the whole answer. */
|
|
418
|
+
export declare function isRootedReadDenyPattern(canonical: string): boolean;
|
|
411
419
|
/**
|
|
412
420
|
* the PURE validation/canonicality predicate over a PERSISTED deny entry (checkpoint v9
|
|
413
421
|
* face section), for the resume pre-CAS ladder: it must refuse BEFORE the approval CAS everything
|
|
@@ -437,9 +445,9 @@ export declare function checkedReadDenyHomes(homes: unknown, seat?: string): rea
|
|
|
437
445
|
* spellings only — any other shape refuses loudly, naming `readDenyHomes`. EMPTY = the environment declares no
|
|
438
446
|
* home: a home-anchored entry then matches its run anywhere — a row that cannot be placed holds wider, never narrower.
|
|
439
447
|
*
|
|
440
|
-
* `linked` — where a home-anchored row's LITERAL HEAD ({@link readDenyRunHead}) really leads, keyed by the row's
|
|
441
|
-
* pattern: the canonical locations a mount resolved (`
|
|
442
|
-
* head's segments is a link (`~/.sema` linked into a dotfiles directory). The row is placed at each location too —
|
|
448
|
+
* `linked` — where a home-anchored or a rooted row's LITERAL HEAD ({@link readDenyRunHead}) really leads, keyed by the row's
|
|
449
|
+
* pattern: the canonical locations a mount resolved (`readDenyLinksOf`, read-deny-home.ts) where
|
|
450
|
+
* one of the head's segments is a link (`~/.sema` linked into a dotfiles directory; `/app` a link to `/data/app`). The row is placed at each location too —
|
|
443
451
|
* the same row, the same name in every refusal — with the rest of its run matched below it. The read faces judge
|
|
444
452
|
* canonical keys, so every spelling that reaches the linked file meets the row there. Absolute locations only.
|
|
445
453
|
*/
|