@sema-agent/core 7.72.0 → 7.73.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 +319 -0
- package/dist/agents/inherited-tool-pool.d.ts +26 -1
- package/dist/agents/inherited-tool-pool.js +46 -2
- package/dist/agents/parked-resume-drive.d.ts +10 -0
- package/dist/agents/parked-resume-drive.js +9 -0
- package/dist/agents/retain-ledger.d.ts +3 -0
- package/dist/agents/send-message-tool.js +1 -0
- package/dist/agents/send-user-message-tool.d.ts +12 -0
- package/dist/agents/send-user-message-tool.js +67 -0
- package/dist/agents/subagent-steps.d.ts +9 -0
- package/dist/agents/subagent-steps.js +38 -0
- package/dist/agents/subagent.d.ts +2 -0
- package/dist/agents/subagent.js +43 -12
- package/dist/agents/verify.js +23 -8
- package/dist/agents/yield-adoption.js +3 -1
- package/dist/brain/anthropic.js +14 -9
- package/dist/brain/open-responses.js +4 -5
- package/dist/brain/openai.js +30 -23
- package/dist/brain/stream-engine.js +159 -151
- package/dist/core/actions-digest.d.ts +43 -0
- package/dist/core/actions-digest.js +22 -0
- package/dist/core/allow-entry.js +3 -3
- package/dist/core/auto-mode.d.ts +7 -9
- package/dist/core/auto-mode.js +114 -8
- package/dist/core/checkpoint-features.d.ts +3 -2
- package/dist/core/checkpoint-features.js +1 -1
- package/dist/core/checkpoint-rekey.d.ts +1 -1
- package/dist/core/checkpoint-rekey.js +6 -1
- package/dist/core/checkpoint-requirements.d.ts +23 -3
- package/dist/core/checkpoint-requirements.js +5 -1
- package/dist/core/checkpoint-row-verdict.js +7 -1
- package/dist/core/checkpoint-store.d.ts +24 -2
- package/dist/core/checkpoint-store.js +1 -0
- package/dist/core/child-clamp-seats.d.ts +15 -0
- package/dist/core/child-clamp-seats.js +15 -0
- package/dist/core/delegation-frames.d.ts +1 -0
- package/dist/core/delegation-frames.js +1 -1
- package/dist/core/engine-capabilities.d.ts +5 -1
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +30 -22
- package/dist/core/engine-version.js +1 -1
- package/dist/core/entries-not-applied.d.ts +19 -7
- package/dist/core/entries-not-applied.js +33 -1
- package/dist/core/governance-codes.d.ts +7 -1
- package/dist/core/governance-codes.js +13 -5
- package/dist/core/hooks.d.ts +3 -0
- package/dist/core/hooks.js +1 -0
- package/dist/core/host-instance.d.ts +23 -0
- package/dist/core/host-instance.js +69 -0
- package/dist/core/instruction-preview.d.ts +63 -0
- package/dist/core/instruction-preview.js +406 -0
- package/dist/core/leg-budget.d.ts +26 -0
- package/dist/core/leg-budget.js +9 -0
- package/dist/core/leg-identity.d.ts +51 -1
- package/dist/core/leg-identity.js +45 -2
- package/dist/core/manager-launch-check.d.ts +48 -0
- package/dist/core/manager-launch-check.js +64 -0
- package/dist/core/mcp-call-meta.d.ts +2 -2
- package/dist/core/mcp-injection-drop.d.ts +20 -10
- package/dist/core/mcp-injection-drop.js +9 -3
- package/dist/core/mcp-server-spec.d.ts +2 -1
- package/dist/core/member-outcome.d.ts +3 -2
- package/dist/core/member-outcome.js +1 -1
- package/dist/core/memory-engine/deletion-record.d.ts +46 -0
- package/dist/core/memory-engine/deletion-record.js +96 -0
- package/dist/core/memory-engine/engine.js +24 -16
- package/dist/core/memory-engine/file-backend.js +7 -5
- package/dist/core/memory-engine/projection-ledger.d.ts +1 -1
- package/dist/core/memory-engine/projection-ledger.js +1 -1
- package/dist/core/memory-engine/scope-contract.d.ts +18 -13
- package/dist/core/memory-engine/scope-contract.js +18 -18
- package/dist/core/memory-engine/sync-client.js +26 -6
- package/dist/core/memory-engine/sync.d.ts +20 -2
- package/dist/core/memory-engine/sync.js +18 -17
- package/dist/core/mode-policy.d.ts +21 -6
- package/dist/core/mode-policy.js +15 -6
- package/dist/core/own-property-receipt.js +11 -4
- package/dist/core/parent-spec-seat.d.ts +13 -11
- package/dist/core/parent-spec-seat.js +13 -9
- package/dist/core/peer-seat.js +3 -3
- package/dist/core/peer-task-store.d.ts +365 -0
- package/dist/core/peer-task-store.js +682 -0
- package/dist/core/permission-rule-consent.js +6 -11
- package/dist/core/permission-rule-model.d.ts +27 -0
- package/dist/core/permission-rule-model.js +33 -5
- package/dist/core/permission-rule-provider.d.ts +35 -33
- package/dist/core/permission-rule-provider.js +38 -295
- package/dist/core/permission-rule-store.d.ts +181 -8
- package/dist/core/permission-rule-store.js +420 -17
- package/dist/core/permission-rule-sync.js +15 -1
- package/dist/core/project-seat.d.ts +55 -0
- package/dist/core/project-seat.js +96 -0
- package/dist/core/protocol-http-auth.d.ts +3 -2
- package/dist/core/protocol-http-auth.js +26 -18
- package/dist/core/remote-env.d.ts +4 -4
- package/dist/core/retired-keys.js +1 -0
- package/dist/core/rule-offer-read.d.ts +1 -1
- package/dist/core/rule-offer-read.js +32 -4
- package/dist/core/run-ledger-seat.d.ts +66 -0
- package/dist/core/run-ledger-seat.js +70 -0
- package/dist/core/run-ledger.d.ts +332 -0
- package/dist/core/run-ledger.js +550 -0
- package/dist/core/runner/checkpoint-scope.d.ts +13 -3
- package/dist/core/runner/checkpoint-scope.js +12 -4
- package/dist/core/runner/construction-doors.js +6 -0
- package/dist/core/runner/contracts.d.ts +21 -5
- package/dist/core/runner/delegation-owner.d.ts +30 -0
- package/dist/core/runner/delegation-owner.js +20 -4
- package/dist/core/runner/finish-reason-seat.js +4 -2
- package/dist/core/runner/leg-frame.js +3 -0
- package/dist/core/runner/nested-memory-lane.d.ts +22 -5
- package/dist/core/runner/nested-memory-lane.js +91 -30
- package/dist/core/runner/person-path-rows.d.ts +21 -16
- package/dist/core/runner/person-path-rows.js +80 -15
- package/dist/core/runner/prepare-caps-and-workflow.js +98 -88
- package/dist/core/runner/prepare-config-doors.d.ts +1 -0
- package/dist/core/runner/prepare-config-doors.js +5 -3
- package/dist/core/runner/prepare-context-lane.js +1 -0
- package/dist/core/runner/prepare-delegation-surface.d.ts +3 -0
- package/dist/core/runner/prepare-delegation-surface.js +6 -0
- package/dist/core/runner/prepare-execution-env.d.ts +3 -3
- package/dist/core/runner/prepare-hands-readface.d.ts +5 -2
- package/dist/core/runner/prepare-hands-readface.js +12 -1
- package/dist/core/runner/prepare-inherited-gate.d.ts +6 -3
- package/dist/core/runner/prepare-inherited-gate.js +13 -5
- package/dist/core/runner/prepare-run-refs.d.ts +1 -1
- package/dist/core/runner/prepare-run-refs.js +3 -2
- package/dist/core/runner/prepare-suspend-saga.d.ts +6 -2
- package/dist/core/runner/prepare-suspend-saga.js +4 -2
- package/dist/core/runner/prepare-task.js +36 -27
- package/dist/core/runner/prepare-turn-wiring.d.ts +4 -3
- package/dist/core/runner/prepare-turn-wiring.js +2 -1
- package/dist/core/runner/prepare-wiring-manifest.d.ts +3 -1
- package/dist/core/runner/prepare-wiring-manifest.js +5 -2
- package/dist/core/runner/resume-apply.js +11 -5
- package/dist/core/runner/resume-review-outcome.d.ts +3 -0
- package/dist/core/runner/resume-review-outcome.js +24 -1
- package/dist/core/runner/run-harness-handlers.js +3 -0
- package/dist/core/runner/run-identity-wiring.js +3 -2
- package/dist/core/runner/run-leg.js +3 -0
- package/dist/core/runner/run-notification-lane.js +20 -1
- package/dist/core/runner/run-settle-and-teardown.js +21 -12
- package/dist/core/runner/run-stop-and-final-verify.js +6 -0
- package/dist/core/runner/run-telemetry-and-budget-seats.js +1 -1
- package/dist/core/runner/runtask.d.ts +6 -2
- package/dist/core/runner/runtask.js +21 -9
- package/dist/core/runner/shell-env-withheld.d.ts +3 -2
- package/dist/core/runner/shell-env-withheld.js +1 -2
- package/dist/core/runner/stop-tail-notice.d.ts +10 -2
- package/dist/core/runner/stop-tail-notice.js +9 -2
- package/dist/core/runner/stream-settle-backstop.d.ts +1 -0
- package/dist/core/runner/stream-settle-backstop.js +1 -0
- package/dist/core/runner/task-start-doors.js +6 -3
- package/dist/core/runner/terminal-account.d.ts +6 -1
- package/dist/core/runner/terminal-account.js +16 -1
- package/dist/core/runner/unreadable-person-rows.d.ts +2 -1
- package/dist/core/runner-deps.d.ts +13 -10
- package/dist/core/secret-env.d.ts +53 -37
- package/dist/core/secret-env.js +44 -47
- package/dist/core/session-checkout.d.ts +3 -0
- package/dist/core/session-checkout.js +1 -0
- package/dist/core/session-store.d.ts +12 -6
- package/dist/core/session-store.js +26 -6
- package/dist/core/session.d.ts +31 -8
- package/dist/core/store-contracts/checkpoint-store-contract.js +10 -0
- package/dist/core/store-contracts/peer-task-store-contract.d.ts +21 -0
- package/dist/core/store-contracts/peer-task-store-contract.js +516 -0
- package/dist/core/store-contracts/session-store-contract.d.ts +15 -2
- package/dist/core/store-contracts/session-store-contract.js +87 -3
- package/dist/core/store-contracts/workflow-journal-store-contract.d.ts +19 -1
- package/dist/core/store-contracts/workflow-journal-store-contract.js +89 -1
- package/dist/core/task-event.d.ts +10 -3
- package/dist/core/task-notification.d.ts +96 -10
- package/dist/core/task-notification.js +129 -5
- package/dist/core/task-registry-shared.d.ts +12 -1
- package/dist/core/task-registry-shared.js +3 -1
- package/dist/core/task-registry-workflow.d.ts +1 -1
- package/dist/core/task-registry-workflow.js +9 -1
- package/dist/core/task-registry.d.ts +39 -2
- package/dist/core/task-registry.js +76 -12
- package/dist/core/task-result.d.ts +13 -0
- package/dist/core/task-spec-members.d.ts +3 -1
- package/dist/core/task-spec-members.js +11 -3
- package/dist/core/task-spec.d.ts +48 -22
- package/dist/core/tool-catalog-entries.js +2 -0
- package/dist/core/tool-mount-facts.d.ts +1 -1
- package/dist/core/tool-mount-facts.js +1 -0
- package/dist/core/tool-mount-plan.d.ts +3 -1
- package/dist/core/tool-mount-plan.js +6 -0
- package/dist/core/tool-mount-static.d.ts +1 -1
- package/dist/core/tool-mount-static.js +4 -2
- package/dist/core/tool-result-store.d.ts +19 -2
- package/dist/core/tool-result-store.js +51 -2
- package/dist/core/tool-spec.d.ts +9 -2
- package/dist/core/user-attachment.d.ts +5 -1
- package/dist/core/user-attachment.js +14 -7
- package/dist/core/wiring-manifest.d.ts +26 -20
- package/dist/core/wiring-manifest.js +7 -3
- package/dist/core/workflow-journal-store.d.ts +53 -10
- package/dist/core/workflow-journal-store.js +27 -4
- package/dist/core/workflow-run-store-contract.js +16 -0
- package/dist/core/workflow-run-store.d.ts +9 -7
- package/dist/core/workflow-run-store.js +4 -1
- package/dist/engine/execution-env/node-execution-env.js +3 -1
- package/dist/engine/harness/types.d.ts +24 -1
- package/dist/engine/harness/types.js +10 -0
- package/dist/engine/llm/types.d.ts +5 -7
- package/dist/engine/lsp/node-lsp-manager.js +2 -1
- package/dist/engine/session/import-validate.js +6 -1
- package/dist/engine/session/session.d.ts +15 -2
- package/dist/engine/session/session.js +34 -4
- package/dist/index.d.ts +18 -7
- package/dist/index.js +13 -4
- package/dist/orchestration/run-workflow-tool.js +40 -32
- package/dist/orchestration/workflow-park-adoption.d.ts +51 -12
- package/dist/orchestration/workflow-park-adoption.js +47 -12
- package/dist/orchestration/workflow-stop.d.ts +128 -0
- package/dist/orchestration/workflow-stop.js +156 -0
- package/dist/orchestration/workflow.d.ts +30 -6
- package/dist/orchestration/workflow.js +117 -55
- package/dist/prompts/manager-recipe.d.ts +18 -0
- package/dist/prompts/manager-recipe.js +24 -0
- package/dist/stores/file/permission-rule-store.d.ts +3 -1
- package/dist/stores/file/permission-rule-store.js +0 -1
- package/dist/stores/file/workflow-journal-store.d.ts +16 -3
- package/dist/stores/file/workflow-journal-store.js +93 -5
- package/dist/stores/file/workflow-run-store.d.ts +1 -1
- package/dist/tools/fs/file-write-check.js +9 -3
- package/dist/tools/fs/index.d.ts +8 -7
- package/dist/tools/fs/index.js +4 -4
- package/dist/tools/fs/read-deny-home.d.ts +1 -1
- package/dist/tools/fs/read-deny-home.js +5 -5
- package/dist/tools/fs/read-deny.d.ts +33 -8
- package/dist/tools/fs/read-deny.js +114 -25
- package/dist/tools/fs/safety.d.ts +4 -1
- package/dist/tools/fs/safety.js +4 -2
- package/dist/tools/fs/shell-read-check.d.ts +9 -2
- package/dist/tools/fs/shell-read-check.js +96 -14
- package/dist/tools/fs/shell-read-establish.d.ts +9 -0
- package/dist/tools/fs/shell-read-establish.js +21 -11
- package/dist/tools/fs/shell-read-judge.d.ts +13 -1
- package/dist/tools/fs/shell-read-judge.js +26 -7
- package/dist/tools/fs/shell-read-plan.d.ts +5 -0
- package/dist/tools/fs/shell-read-write-targets.js +17 -9
- package/package.json +2 -2
- package/test/export-surface.snapshot.json +131 -1
- package/wire-changes/answers/core-stores-sql@7.73.0.json +28 -0
- package/wire-changes/answers/core@7.73.0.json +216 -0
- package/wire-changes/answers/mods-kernel@7.73.0.json +7 -0
- package/wire-changes/answers/primitives@7.73.0.json +12 -0
- package/wire-changes/answers/wiki-gate@7.73.0.json +7 -0
- package/wire-changes/core-stores-sql@7.73.0.json +326 -0
- package/wire-changes/core@7.73.0.json +6480 -0
- package/wire-changes/mods-kernel@7.73.0.json +147 -0
- package/wire-changes/primitives@7.73.0.json +227 -0
- package/wire-changes/wiki-gate@7.73.0.json +145 -0
|
@@ -23,10 +23,16 @@ export function createFileWriteStation(opts) {
|
|
|
23
23
|
return null;
|
|
24
24
|
return (async () => {
|
|
25
25
|
const r = await opts.contain(spelled, signal, callOpts.toolCallId);
|
|
26
|
-
if (r.ok
|
|
26
|
+
if (r.ok)
|
|
27
27
|
return VOUCH;
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
if (r.violation.code === "path_not_in_root") {
|
|
29
|
+
const details = violationDetails(r.violation);
|
|
30
|
+
return { disposition: "refuse", finding: "outside_roots", face: "write", sentence: violationText(call.toolName, r.violation), ...(details !== undefined ? { details } : {}) };
|
|
31
|
+
}
|
|
32
|
+
if (r.violation.code === "write_path_denied") {
|
|
33
|
+
return { disposition: "refuse", finding: "deny_hit", face: "write", sentence: violationText(call.toolName, r.violation), ...(r.violation.echoed !== undefined ? { echoed: r.violation.echoed } : {}) };
|
|
34
|
+
}
|
|
35
|
+
return VOUCH;
|
|
30
36
|
})();
|
|
31
37
|
},
|
|
32
38
|
unanswered: () => VOUCH,
|
package/dist/tools/fs/index.d.ts
CHANGED
|
@@ -180,13 +180,14 @@ export interface HandsToolkitOptions {
|
|
|
180
180
|
* roster (the Runner mounts Monitor, this band never does). `false` drops the gh rate-limit hint's
|
|
181
181
|
* Monitor clause; absent ⇒ the full wording. */
|
|
182
182
|
monitorToolActive?: boolean;
|
|
183
|
-
/** ADDITIONS to the
|
|
184
|
-
* (
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
183
|
+
/** ADDITIONS to the sensitive-path deny set ({@link import("./read-deny.js").READ_FACE_DEFAULT_DENY_ENTRIES}):
|
|
184
|
+
* judged on BOTH the read faces (Read/Grep/Glob/RepoMap and their traversals) and the write faces
|
|
185
|
+
* (Write/Edit/NotebookEdit/SaveToolResult; this band's Bash meets them only through a caller-supplied shell
|
|
186
|
+
* station, which judges literal write operands) in every containment mode. Built-in tiers
|
|
187
|
+
* stay read-only (their write side is the write-protection table). Add-only: additions union with the active
|
|
188
|
+
* built-ins, `[]` ≡ absent (union identity), and additions never remove a built-in — the one removal channel
|
|
189
|
+
* is the deployment's built-in configuration ({@link readDenyBuiltinTiers} / {@link readDenyBuiltinExclude}).
|
|
190
|
+
* Bad entry shapes throw at wiring time. */
|
|
190
191
|
readDenyPatterns?: readonly ReadDenyEntry[];
|
|
191
192
|
/** The deployment's built-in-table TIER selection ({@link import("./read-deny.js").ReadDenyBuiltinConfig}
|
|
192
193
|
* `tiers` key) — the switch for the built-in table:
|
package/dist/tools/fs/index.js
CHANGED
|
@@ -91,12 +91,12 @@ export function createHandsToolkit(env, readFileState, rootCanonical, opts = {})
|
|
|
91
91
|
afterPlacement(createReadFileTool(env, readFileState, rootCanonical, readCwd, readFaceRoots, opts.imageProcessor, opts.pdfModelCapabilities, bgOutputReadExemption, readDeny, readFace, opts.reminderMark, opts.reminderDisclosureCounts, reader)),
|
|
92
92
|
];
|
|
93
93
|
if (handsWriteHalfMounts({ readOnly })) {
|
|
94
|
-
tools.push(createEditFileTool(env, readFileState, opts.writeRoot ?? rootCanonical, cwdRef, additionalRoots, opts.beforeWrite, opts.trackFileEdit, opts.onFileEdited, writeFaceOf, writeDeny, readDeny, opts.readFirstWaiver), createWriteFileTool(env, readFileState, opts.writeRoot ?? rootCanonical, cwdRef, additionalRoots, opts.beforeWrite, opts.trackFileEdit, opts.onFileEdited, writeFaceOf, writeDeny, opts.readFirstWaiver), createNotebookEditTool(env, readFileState, opts.writeRoot ?? rootCanonical, cwdRef, additionalRoots, opts.beforeWrite, opts.trackFileEdit, opts.onFileEdited, writeFaceOf, writeDeny));
|
|
94
|
+
tools.push(afterPlacement(createEditFileTool(env, readFileState, opts.writeRoot ?? rootCanonical, cwdRef, additionalRoots, opts.beforeWrite, opts.trackFileEdit, opts.onFileEdited, writeFaceOf, writeDeny, readDeny, opts.readFirstWaiver)), afterPlacement(createWriteFileTool(env, readFileState, opts.writeRoot ?? rootCanonical, cwdRef, additionalRoots, opts.beforeWrite, opts.trackFileEdit, opts.onFileEdited, writeFaceOf, writeDeny, opts.readFirstWaiver)), afterPlacement(createNotebookEditTool(env, readFileState, opts.writeRoot ?? rootCanonical, cwdRef, additionalRoots, opts.beforeWrite, opts.trackFileEdit, opts.onFileEdited, writeFaceOf, writeDeny)));
|
|
95
95
|
const keptBytes = opts.toolResultBytes;
|
|
96
96
|
if (opts.writeContainmentSeat !== undefined)
|
|
97
97
|
opts.writeContainmentSeat.current = writeContainmentOf(env, opts.writeRoot ?? rootCanonical, cwdRef, additionalRoots, writeDeny, writeFaceOf);
|
|
98
98
|
if (keptBytes?.bytesOf !== undefined)
|
|
99
|
-
tools.push(createSaveToolResultTool(env, keptBytes, opts.writeRoot ?? rootCanonical, cwdRef, additionalRoots, opts.beforeWrite, opts.trackFileEdit, opts.onFileEdited, writeFaceOf, writeDeny));
|
|
99
|
+
tools.push(afterPlacement(createSaveToolResultTool(env, keptBytes, opts.writeRoot ?? rootCanonical, cwdRef, additionalRoots, opts.beforeWrite, opts.trackFileEdit, opts.onFileEdited, writeFaceOf, writeDeny)));
|
|
100
100
|
}
|
|
101
101
|
tools.push(afterPlacement(createGrepTool(env, rootCanonical, readFaceRoots, readDeny, readFace, cwdRef, readAdmission, outsideRemedy)), afterPlacement(createGlobTool(env, rootCanonical, readFaceRoots, readDeny, readFace, cwdRef, readAdmission, outsideRemedy)), afterPlacement(createRepoMapTool(env, rootCanonical, readFaceRoots, readDeny, readFace, cwdRef, readAdmission, outsideRemedy)));
|
|
102
102
|
if (includeShell) {
|
|
@@ -171,7 +171,7 @@ function bandOwnTables(env, opts) {
|
|
|
171
171
|
return await tool.execute(...args);
|
|
172
172
|
},
|
|
173
173
|
};
|
|
174
|
-
const writeDenyCompiled = compileWriteDeny(
|
|
175
|
-
const writeDeny = writeDenyCompiled.
|
|
174
|
+
const writeDenyCompiled = compileWriteDeny(readDeny);
|
|
175
|
+
const writeDeny = writeDenyCompiled.hasRows ? carryHomeViews(writeDenyCompiled, readDeny.homeViews) : undefined;
|
|
176
176
|
return { readDeny, writeDeny, afterPlacement };
|
|
177
177
|
}
|
|
@@ -171,7 +171,7 @@ export declare function homeViewsAt(env: HomeViewEnv, homes: readonly string[]):
|
|
|
171
171
|
/** The home views of one judgment, off the judge it judges with: the views of the judge's placement. A judge that
|
|
172
172
|
* carries none (one built outside a mount) reads the declared home alone. */
|
|
173
173
|
export declare function homeViewsOf(env: HomeViewEnv, judge: HomeViewsCarrier | undefined, signal?: AbortSignal): HomeViews;
|
|
174
|
-
/** A judge with the home views `source` gives it. */
|
|
174
|
+
/** A judge with the home views `source` gives it, preserving getters (live projections) and non-enumerable identity (`id`). */
|
|
175
175
|
export declare function carryHomeViews<T extends object>(judge: T, source: HomeViewSource): T & {
|
|
176
176
|
readonly homeViews: HomeViewSource;
|
|
177
177
|
};
|
|
@@ -397,6 +397,9 @@ export function readDenyOver(current, homeViews) {
|
|
|
397
397
|
get compiledSegments() {
|
|
398
398
|
return current().compiledSegments;
|
|
399
399
|
},
|
|
400
|
+
get tableRows() {
|
|
401
|
+
return current().tableRows;
|
|
402
|
+
},
|
|
400
403
|
homeViews: homeViews ?? { views: (signal) => current().homeViews.views(signal) },
|
|
401
404
|
};
|
|
402
405
|
}
|
|
@@ -418,11 +421,8 @@ export function homeViewsOf(env, judge, signal) {
|
|
|
418
421
|
return (judge?.homeViews ?? homeViewsAt(env, [])).views(signal, env);
|
|
419
422
|
}
|
|
420
423
|
export function carryHomeViews(judge, source) {
|
|
421
|
-
const
|
|
422
|
-
|
|
423
|
-
if (typeof id === "string")
|
|
424
|
-
Object.defineProperty(carried, "id", { value: id, enumerable: false });
|
|
425
|
-
return carried;
|
|
424
|
+
const descriptors = Object.getOwnPropertyDescriptors(judge);
|
|
425
|
+
return Object.defineProperties({}, { ...descriptors, homeViews: { value: source, enumerable: true, writable: true, configurable: true } });
|
|
426
426
|
}
|
|
427
427
|
export async function placeReadDenyAtHome(env, compile, homes, signal, places) {
|
|
428
428
|
const entries = compile([]).entries;
|
|
@@ -152,13 +152,17 @@ export declare function segmentGuardRow(pat: CompiledSegmentPattern, columns: {
|
|
|
152
152
|
readonly tier?: string;
|
|
153
153
|
}): PathGuardRow;
|
|
154
154
|
/**
|
|
155
|
-
* The WRITE face of the deny table: the
|
|
156
|
-
*
|
|
157
|
-
*
|
|
155
|
+
* The WRITE face of the deny table: every row of the one deny table whose faces include `write` — deployment / task
|
|
156
|
+
* `readDenyPatterns` additions (`faces: ["read", "write"]`) and `Read(…)` / `Edit(…)` rule rows — judged for
|
|
157
|
+
* file write tools (`Write`, `Edit`, `NotebookEdit`, `SaveToolResult`) and shell write targets (a redirection, `tee`,
|
|
158
|
+
* `sed -i`, `cp` / `mv` / `touch` / `mkdir` / `rm` operands). Built-in read-deny tiers stay `faces: ["read"]`. Same row
|
|
159
|
+
* type and judgment ({@link judgePathRows}) as the read face.
|
|
158
160
|
*/
|
|
159
161
|
export interface WriteDenyMatcher {
|
|
160
162
|
/** Which face this judge is — the write tools' path resolution reads it to word and code the refusal as a write. */
|
|
161
163
|
readonly face: "write";
|
|
164
|
+
/** True iff the write projection holds at least one row (a `readDenyPatterns` addition or a write-facing rule row). */
|
|
165
|
+
readonly hasRows: boolean;
|
|
162
166
|
readonly ruleRows: readonly PathRuleDenyRow[];
|
|
163
167
|
matchPath(path: string): ReadDenyHit | null;
|
|
164
168
|
/** The target judgment the read face makes, on this face's rows: canonical key, lexical view, the leaf chain's hops. */
|
|
@@ -168,13 +172,26 @@ export interface WriteDenyMatcher {
|
|
|
168
172
|
}): ReadDenyHit | null;
|
|
169
173
|
/** The table ONE call judges with ({@link ReadDenyMatcher.forCall}). */
|
|
170
174
|
forCall?(toolCallId: string | undefined): WriteDenyMatcher;
|
|
171
|
-
/** Is the row a hit named (its rule text) a row that guards the READ face too — a `
|
|
172
|
-
* paths are not written because their reads are denied — rather than a
|
|
173
|
-
* says which of the two refused ({@link readDenySentence}'s `readRow`). Absent ⇒
|
|
175
|
+
/** Is the row a hit named (its pattern or rule text) a row that guards the READ face too — a `readDenyPatterns` addition
|
|
176
|
+
* or a `Read(…)` rule, whose paths are not written because their reads are denied — rather than a write-only row (`Edit(…)`)?
|
|
177
|
+
* The refusal's sentence says which of the two refused ({@link readDenySentence}'s `readRow`). Absent ⇒ none. */
|
|
174
178
|
guardsReads?(pattern: string): boolean;
|
|
179
|
+
/** The write-facing segment row the absolute directory `scope` names or contains ({@link ReadDenyMatcher.rowUnderRoot}),
|
|
180
|
+
* judged on locations alone without enumerating disk (used for subtree removal / rename operations). */
|
|
181
|
+
rowUnderRoot?(scope: string): ReadDenyRootHit | null;
|
|
182
|
+
/** A write-facing row that lies AT or BELOW `path` ({@link ReadDenyMatcher.rowAtOrBelow}): segment rows are judged per row;
|
|
183
|
+
* non-enumerable rule rows answer for any path. */
|
|
184
|
+
rowAtOrBelow?(path: string): ReadDenyHit | null;
|
|
185
|
+
/** The write-facing segment rows no location places (an unanchored row: its match may start in any folder), in table order —
|
|
186
|
+
* the rows a recursive removal's subtree is searched for by name, since {@link rowUnderRoot} cannot place them below an
|
|
187
|
+
* operand that does not spell them. */
|
|
188
|
+
readonly unanchoredRows?: readonly string[];
|
|
189
|
+
/** The first {@link unanchoredRows} row whose leading named segment (its first segment that is not stars only) the ONE
|
|
190
|
+
* directory entry name `name` matches, folded as that row folds; null where none. */
|
|
191
|
+
rowLedByName?(name: string): string | null;
|
|
175
192
|
}
|
|
176
|
-
/**
|
|
177
|
-
export declare function compileWriteDeny(
|
|
193
|
+
/** Project the write face (`faces.includes("write")`) out of one compiled deny table ({@link compileReadDeny}). */
|
|
194
|
+
export declare function compileWriteDeny(table: ReadDenyMatcher): WriteDenyMatcher;
|
|
178
195
|
/** One compiled ripgrep glob flag for the traversal legs (`--iglob` = case-insensitive entry). */
|
|
179
196
|
export interface ReadDenyRgGlob {
|
|
180
197
|
flag: "--glob" | "--iglob";
|
|
@@ -243,6 +260,9 @@ export interface ReadDenyMatcher {
|
|
|
243
260
|
* OS confinement translates the table from (read-floor.ts); the rule rows are {@link ruleRows}. Absent on a hand-built
|
|
244
261
|
* matcher: such a table has no confinement. */
|
|
245
262
|
readonly compiledSegments?: readonly CompiledSegmentPattern[];
|
|
263
|
+
/** Every compiled row of this table (built-in tiers, additions, placements, and rule rows across both faces),
|
|
264
|
+
* each carrying its `faces` column — the one source {@link compileWriteDeny} projects the write face from. */
|
|
265
|
+
readonly tableRows?: readonly PathGuardRow[];
|
|
246
266
|
/** The table's identity, minted once where {@link compileReadDeny} compiles it: a compiled table never changes its
|
|
247
267
|
* judgment, so two tables with one `id` judge every path alike. Not enumerable: a spread copy (which may replace the
|
|
248
268
|
* judgment) has none; the copy that only carries other home views (`carryHomeViews`) keeps it. Absent on a hand-built
|
|
@@ -326,6 +346,11 @@ export interface ReadDenyFinding {
|
|
|
326
346
|
* alone. The sentence then says the search below the folder is refused for a location it holds, and that no file need be
|
|
327
347
|
* there — naming a row as what "the target matches" would send the reader looking for a file that may not exist. */
|
|
328
348
|
readonly under?: true;
|
|
349
|
+
/** On the write face, a recursive REMOVAL whose subtree was searched by name for an unanchored row
|
|
350
|
+
* ({@link WriteDenyMatcher.rowLedByName}) and FOUND below it: `found` — the entry the search found, which the sentence names. */
|
|
351
|
+
readonly lookup?: {
|
|
352
|
+
readonly found: string;
|
|
353
|
+
};
|
|
329
354
|
}
|
|
330
355
|
/**
|
|
331
356
|
* The deny finding minted ONCE as both of its faces: the sentence ({@link readDenySentence}) and the literals that sentence
|
|
@@ -150,15 +150,80 @@ function denyTargetViews(canonicalKey, lexicalView, opts) {
|
|
|
150
150
|
views.push({ path: hop, kind: "hop" });
|
|
151
151
|
return { views };
|
|
152
152
|
}
|
|
153
|
-
export function compileWriteDeny(
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
153
|
+
export function compileWriteDeny(table) {
|
|
154
|
+
if (table === null || typeof table !== "object" || !Array.isArray(table.tableRows)) {
|
|
155
|
+
throw new TypeError("compileWriteDeny: expected a table compiled by compileReadDeny (missing tableRows) — pass the compiled table, not a separate rule list.");
|
|
156
|
+
}
|
|
157
|
+
let cachedSource;
|
|
158
|
+
let cached;
|
|
159
|
+
const projected = () => {
|
|
160
|
+
const source = table.tableRows;
|
|
161
|
+
if (!Array.isArray(source)) {
|
|
162
|
+
throw new TypeError("compileWriteDeny: the table carries no compiled tableRows to project.");
|
|
163
|
+
}
|
|
164
|
+
if (cached === undefined || cachedSource !== source) {
|
|
165
|
+
const rows = source.filter((r) => r.faces.includes("write"));
|
|
166
|
+
const ruleRows = [];
|
|
167
|
+
const writeSegments = [];
|
|
168
|
+
for (const r of rows) {
|
|
169
|
+
if ("rule" in r)
|
|
170
|
+
ruleRows.push(r.rule);
|
|
171
|
+
else if ("compiledSegment" in r)
|
|
172
|
+
writeSegments.push(r.compiledSegment);
|
|
173
|
+
}
|
|
174
|
+
const readRows = new Set(rows.filter((r) => r.faces.includes("read")).map((r) => r.name));
|
|
175
|
+
cachedSource = source;
|
|
176
|
+
cached = { rows, ruleRows, writeSegments, readRows };
|
|
177
|
+
}
|
|
178
|
+
return cached;
|
|
160
179
|
};
|
|
161
|
-
|
|
180
|
+
projected();
|
|
181
|
+
return {
|
|
182
|
+
face: "write",
|
|
183
|
+
get hasRows() {
|
|
184
|
+
return projected().rows.length > 0;
|
|
185
|
+
},
|
|
186
|
+
get ruleRows() {
|
|
187
|
+
return projected().ruleRows;
|
|
188
|
+
},
|
|
189
|
+
matchPath: (path) => {
|
|
190
|
+
const hit = denyTableHit(projected().rows, { views: [{ path, kind: "lexical" }] });
|
|
191
|
+
return hit === null ? null : { pattern: hit.pattern };
|
|
192
|
+
},
|
|
193
|
+
matchTarget: (canonicalKey, lexicalView, opts) => denyTableHit(projected().rows, denyTargetViews(canonicalKey, lexicalView, opts)),
|
|
194
|
+
guardsReads: (pattern) => projected().readRows.has(pattern),
|
|
195
|
+
rowUnderRoot: (scope) => {
|
|
196
|
+
const { writeSegments } = projected();
|
|
197
|
+
if (writeSegments.length === 0 || !isAbsoluteForFamily("own", scope))
|
|
198
|
+
return null;
|
|
199
|
+
return rowNamedByRootOf(writeSegments, normalizeAbsPathLexically(scope));
|
|
200
|
+
},
|
|
201
|
+
rowAtOrBelow: (path) => {
|
|
202
|
+
const { writeSegments, ruleRows } = projected();
|
|
203
|
+
const hit = rowAtOrBelowOf(writeSegments, path);
|
|
204
|
+
if (hit !== null)
|
|
205
|
+
return { pattern: hit };
|
|
206
|
+
return ruleRows.length === 0 ? null : { pattern: ruleRows[0].rule };
|
|
207
|
+
},
|
|
208
|
+
get unanchoredRows() {
|
|
209
|
+
return projected().writeSegments.filter(unanchoredRow).map((pat) => pat.raw);
|
|
210
|
+
},
|
|
211
|
+
rowLedByName: (name) => rowLedByNameOf(projected().writeSegments, name),
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
function unanchoredRow(pat) {
|
|
215
|
+
return pat.anchors === undefined && pat.rootedOnly !== true;
|
|
216
|
+
}
|
|
217
|
+
function rowLedByNameOf(rows, name) {
|
|
218
|
+
const readings = foldedViewsOf([[name]]);
|
|
219
|
+
for (const pat of rows) {
|
|
220
|
+
if (!unanchoredRow(pat))
|
|
221
|
+
continue;
|
|
222
|
+
const lead = pat.segments.find((s) => !s.anything);
|
|
223
|
+
if (lead === undefined || readings(pat.fold).some((view) => lead.test(view[0])))
|
|
224
|
+
return pat.raw;
|
|
225
|
+
}
|
|
226
|
+
return null;
|
|
162
227
|
}
|
|
163
228
|
export function seatForCall(seat, toolCallId) {
|
|
164
229
|
const forCall = seat?.forCall;
|
|
@@ -196,21 +261,34 @@ export function readDenyRefusal(finding) {
|
|
|
196
261
|
const write = finding.face === "write";
|
|
197
262
|
const canonicalNote = finding.canonical !== undefined && finding.canonical !== finding.target ? `(canonical target: "${fitMiddle(finding.canonical, READ_DENY_SENTENCE_PART_MAX)}") ` : "";
|
|
198
263
|
const lexicalHit = finding.matchedView !== undefined && finding.matchedView !== (finding.canonical ?? finding.target);
|
|
199
|
-
const under = finding.under === true
|
|
200
|
-
const frame = `${finding.action ?? (under ? "searching below" : write ? "writing" : "reading")} "${fitMiddle(finding.target, READ_DENY_SENTENCE_PART_MAX)}" ${canonicalNote}is refused:`;
|
|
264
|
+
const under = finding.under === true;
|
|
265
|
+
const frame = `${finding.action ?? (under && !write ? "searching below" : write ? "writing" : "reading")} "${fitMiddle(finding.target, READ_DENY_SENTENCE_PART_MAX)}" ${canonicalNote}is refused:`;
|
|
201
266
|
const pattern = fitMiddle(finding.pattern, READ_DENY_SENTENCE_PART_MAX);
|
|
202
267
|
const echoed = Object.freeze([
|
|
203
268
|
Object.freeze({ kind: "path", value: finding.target, ...(finding.canonical !== undefined && finding.canonical !== finding.target ? { canonical: finding.canonical } : {}) }),
|
|
204
269
|
...(lexicalHit ? [Object.freeze({ kind: "path", value: finding.matchedView })] : []),
|
|
205
270
|
Object.freeze({ kind: "pattern", value: finding.pattern }),
|
|
206
271
|
]);
|
|
272
|
+
if (write && finding.lookup !== undefined) {
|
|
273
|
+
const row = finding.readRow === true ? `the read deny row "${pattern}"` : sensitivePathDenyList(pattern, "write");
|
|
274
|
+
const found = finding.lookup.found;
|
|
275
|
+
const held = `it holds "${fitMiddle(found, READ_DENY_SENTENCE_PART_MAX)}", a name ${row} starts with, and a recursive removal removes everything below it`;
|
|
276
|
+
const quoted = [echoed[0], Object.freeze({ kind: "path", value: found }), echoed.at(-1)];
|
|
277
|
+
return { sentence: `${frame} ${held}. ${finding.readRow === true ? READ_ROW_WRITE_SCOPE : WRITE_DENY_SCOPE}`, echoed: Object.freeze(quoted) };
|
|
278
|
+
}
|
|
207
279
|
if (write && finding.readRow === true) {
|
|
208
|
-
const reaches =
|
|
280
|
+
const reaches = under
|
|
281
|
+
? lexicalHit
|
|
282
|
+
? `the requested path's spelling ("${fitMiddle(finding.matchedView, READ_DENY_SENTENCE_PART_MAX)}") holds a location the read deny row "${pattern}" denies reading`
|
|
283
|
+
: `that path holds a location the read deny row "${pattern}" denies reading`
|
|
284
|
+
: lexicalHit
|
|
285
|
+
? `the path passes through "${fitMiddle(finding.matchedView, READ_DENY_SENTENCE_PART_MAX)}", which the read deny row "${pattern}" denies reading`
|
|
286
|
+
: `the target is a path the read deny row "${pattern}" denies reading`;
|
|
209
287
|
return { sentence: `${frame} ${reaches} — a path whose reads are denied is not written either. ${READ_ROW_WRITE_SCOPE}`, echoed };
|
|
210
288
|
}
|
|
211
289
|
if (under) {
|
|
212
290
|
const holder = lexicalHit ? `the requested path's spelling ("${fitMiddle(finding.matchedView, READ_DENY_SENTENCE_PART_MAX)}")` : "that path";
|
|
213
|
-
return { sentence: `${frame} ${holder} holds a location on ${sensitivePathDenyList(pattern)} — locations are checked, not which files exist, so no such file need be there. ${SENSITIVE_PATH_DENY_SCOPE}`, echoed };
|
|
291
|
+
return { sentence: `${frame} ${holder} holds a location on ${sensitivePathDenyList(pattern, write ? "write" : "read")} — locations are checked, not which files exist, so no such file need be there. ${write ? WRITE_DENY_SCOPE : SENSITIVE_PATH_DENY_SCOPE}`, echoed };
|
|
214
292
|
}
|
|
215
293
|
const judged = lexicalHit ? `the requested path's spelling ("${fitMiddle(finding.matchedView, READ_DENY_SENTENCE_PART_MAX)}") matches` : "the target matches";
|
|
216
294
|
return { sentence: `${frame} ${judged} ${sensitivePathDenyList(pattern, write ? "write" : "read")}. ${write ? WRITE_DENY_SCOPE : SENSITIVE_PATH_DENY_SCOPE}`, echoed };
|
|
@@ -618,8 +696,9 @@ export function compileReadDeny(additions = [], layer = "additions", builtin, ru
|
|
|
618
696
|
const ruleRows = rules.filter((r) => r.faces.includes("read"));
|
|
619
697
|
const normalized = [];
|
|
620
698
|
const seen = new Set();
|
|
699
|
+
const entryKey = (e) => `${e.caseSensitive ? "s" : "i"}:${e.pattern}`;
|
|
621
700
|
const push = (e) => {
|
|
622
|
-
const key =
|
|
701
|
+
const key = entryKey(e);
|
|
623
702
|
if (seen.has(key))
|
|
624
703
|
return;
|
|
625
704
|
seen.add(key);
|
|
@@ -629,14 +708,16 @@ export function compileReadDeny(additions = [], layer = "additions", builtin, ru
|
|
|
629
708
|
for (const row of resolveReadDenyBuiltins(builtin)) {
|
|
630
709
|
const e = normalizeEntry(row.pattern, "built-in");
|
|
631
710
|
push(e);
|
|
632
|
-
|
|
633
|
-
|
|
711
|
+
const k = entryKey(e);
|
|
712
|
+
if (!columns.has(k))
|
|
713
|
+
columns.set(k, { origin: "builtin", tier: row.tier });
|
|
634
714
|
}
|
|
635
715
|
for (const entry of additions) {
|
|
636
716
|
const e = normalizeEntry(entry, layer);
|
|
637
717
|
push(e);
|
|
638
|
-
|
|
639
|
-
|
|
718
|
+
const k = entryKey(e);
|
|
719
|
+
const prev = columns.get(k);
|
|
720
|
+
columns.set(k, { origin: "addition", ...(prev?.tier !== undefined ? { tier: prev.tier } : {}) });
|
|
640
721
|
}
|
|
641
722
|
const homeSegments = [...new Set(checkedReadDenyHomes(homes))].flatMap(homeAnchorSegments);
|
|
642
723
|
const compiled = normalized.map((e) => {
|
|
@@ -664,16 +745,23 @@ export function compileReadDeny(additions = [], layer = "additions", builtin, ru
|
|
|
664
745
|
return;
|
|
665
746
|
const c = compiled[i];
|
|
666
747
|
const rest = c.segments.slice(readDenyRunHead(run));
|
|
748
|
+
const key = entryKey(e);
|
|
667
749
|
for (const location of new Set(checkedReadDenyHomes(locations, "readDenyHomeLinks"))) {
|
|
668
|
-
linkedPlacements.push({ raw: e.pattern, segments: rest, fold: c.fold, anchors: homeAnchorSegments(location).map((segs) => foldSegments(c.fold, segs)), rootedOnly: true });
|
|
750
|
+
linkedPlacements.push({ pat: { raw: e.pattern, segments: rest, fold: c.fold, anchors: homeAnchorSegments(location).map((segs) => foldSegments(c.fold, segs)), rootedOnly: true }, key });
|
|
669
751
|
}
|
|
670
752
|
});
|
|
671
|
-
const
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
753
|
+
const judgedEntries = [
|
|
754
|
+
...compiled.map((pat, i) => ({ pat, key: entryKey(normalized[i]) })),
|
|
755
|
+
...linkedPlacements,
|
|
756
|
+
];
|
|
757
|
+
const judged = judgedEntries.map((x) => x.pat);
|
|
758
|
+
const segmentRows = judgedEntries.map(({ pat, key }) => {
|
|
759
|
+
const col = columns.get(key) ?? { origin: "addition" };
|
|
760
|
+
const faces = col.origin === "addition" ? ["read", "write"] : ["read"];
|
|
761
|
+
return Object.assign(segmentGuardRow(pat, { faces, polarity: "deny", exemptible: false, fold: pat.fold === "ascii" ? "ascii" : "exact", origin: col.origin, ...(col.tier !== undefined ? { tier: col.tier } : {}) }), { compiledSegment: pat });
|
|
675
762
|
});
|
|
676
|
-
const
|
|
763
|
+
const allTableRows = Object.freeze([...segmentRows, ...rules.map(ruleGuardRow)]);
|
|
764
|
+
const readTableRows = allTableRows.filter((r) => r.faces.includes("read"));
|
|
677
765
|
const rgExclusionGlobs = [];
|
|
678
766
|
const rgProbeGlobs = [];
|
|
679
767
|
for (const row of segmentRows) {
|
|
@@ -698,20 +786,21 @@ export function compileReadDeny(additions = [], layer = "additions", builtin, ru
|
|
|
698
786
|
return rowNamedByRootOf(judged, normalizeAbsPathLexically(scope));
|
|
699
787
|
};
|
|
700
788
|
const matchPath = (path, opts) => {
|
|
701
|
-
const hit = denyTableHit(
|
|
789
|
+
const hit = denyTableHit(readTableRows, { views: [{ path, kind: "lexical", ...(opts?.aliasResolved === true ? { aliasResolved: true } : {}) }] });
|
|
702
790
|
return hit === null ? null : { pattern: hit.pattern };
|
|
703
791
|
};
|
|
704
792
|
const table = {
|
|
705
793
|
entries: normalized,
|
|
706
794
|
...(ruleRows.length > 0 ? { ruleRows } : {}),
|
|
707
795
|
matchPath,
|
|
708
|
-
matchTarget: (canonicalKey, lexicalView, opts) => denyTableHit(
|
|
796
|
+
matchTarget: (canonicalKey, lexicalView, opts) => denyTableHit(readTableRows, denyTargetViews(canonicalKey, lexicalView, opts)),
|
|
709
797
|
rgExclusionGlobs,
|
|
710
798
|
rgProbeGlobs,
|
|
711
799
|
unexcludableUnder,
|
|
712
800
|
rowUnderRoot,
|
|
713
801
|
rowAtOrBelow,
|
|
714
802
|
compiledSegments: Object.freeze([...judged]),
|
|
803
|
+
tableRows: allTableRows,
|
|
715
804
|
};
|
|
716
805
|
Object.defineProperty(table, "id", { value: `rdt-${randomUUID()}`, enumerable: false });
|
|
717
806
|
return table;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type DenyFace } from "./read-deny.js";
|
|
2
|
+
import type { RefusalEcho } from "../../core/refusal-echo.js";
|
|
2
3
|
import { type HomeViewSource } from "./read-deny-home.js";
|
|
3
4
|
import type { AssertAllKeysHandled } from "../../core/ask-origin.js";
|
|
4
5
|
import type { ExecutionEnv } from "../../internal/harness-types.js";
|
|
@@ -110,10 +111,12 @@ export interface FsViolation {
|
|
|
110
111
|
/** Set ONLY on `path_not_in_root` — the containment roots in effect (primary first,
|
|
111
112
|
* then additionalDirectories), canonical form. */
|
|
112
113
|
roots?: readonly string[];
|
|
113
|
-
/** Set
|
|
114
|
+
/** Set on `read_path_denied` and `write_path_denied` — the deny-list pattern (verbatim entry text)
|
|
114
115
|
* the judged target matched. Absent on the refusal of a deny judgment that could not finish (a home view nobody could
|
|
115
116
|
* read, read-deny-home.ts `HomeView.unread`): no row matched, so none is named and no deny card is minted. */
|
|
116
117
|
pattern?: string;
|
|
118
|
+
/** The literals quoted by a deny refusal sentence, minted with the sentence ({@link readDenyRefusal}). */
|
|
119
|
+
echoed?: readonly RefusalEcho[];
|
|
117
120
|
message: string;
|
|
118
121
|
}
|
|
119
122
|
/**
|
package/dist/tools/fs/safety.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
-
import {
|
|
2
|
+
import { readDenyRefusal } from "./read-deny.js";
|
|
3
3
|
import { envErrorDetail } from "./env-error-detail.js";
|
|
4
4
|
import { homeViewsOf, homeViewUnreadSentence } from "./read-deny-home.js";
|
|
5
5
|
import { skipsRootsContainment } from "./containment-face.js";
|
|
@@ -524,13 +524,15 @@ export async function resolveKey(env, rootCanonical, path, signal, baseCwd, addi
|
|
|
524
524
|
}
|
|
525
525
|
}
|
|
526
526
|
if (hit !== null) {
|
|
527
|
+
const refusal = readDenyRefusal({ target: path, canonical: key, pattern: hit.pattern, ...(hit.matchedView !== undefined ? { matchedView: hit.matchedView } : {}), ...(write ? { face: "write", ...(readDeny.guardsReads?.(hit.pattern) === true ? { readRow: true } : {}) } : {}) });
|
|
527
528
|
return {
|
|
528
529
|
ok: false,
|
|
529
530
|
violation: {
|
|
530
531
|
code: write ? "write_path_denied" : "read_path_denied",
|
|
531
|
-
message:
|
|
532
|
+
message: refusal.sentence,
|
|
532
533
|
target: key,
|
|
533
534
|
pattern: hit.pattern,
|
|
535
|
+
echoed: refusal.echoed,
|
|
534
536
|
},
|
|
535
537
|
};
|
|
536
538
|
}
|
|
@@ -248,6 +248,11 @@ export interface ShellReadStationOptions {
|
|
|
248
248
|
* questions name no directory to add — a card offering one would offer what nothing grants. Absent ⇒ offered. */
|
|
249
249
|
readonly offersReadRootGrant?: false;
|
|
250
250
|
}
|
|
251
|
+
/** The bound of ONE recursive removal's subtree search ({@link applyRemovalSearch}) — its own, shorter than the gate's outer
|
|
252
|
+
* wait (`DEFAULT_GATE_AWAIT_TIMEOUT_MS`); and the folders it lists at most. Either reached ⇒ the search did not finish: a
|
|
253
|
+
* check that did not finish, asked like any other ({@link applyRemovalSearch}). */
|
|
254
|
+
export declare const SUBTREE_SEARCH_MS = 2000;
|
|
255
|
+
export declare const SUBTREE_SEARCH_DIRS = 16384;
|
|
251
256
|
/** What a consumer hands {@link judgeShellRead}: the command as written, the environment whose filesystem
|
|
252
257
|
* answers where its words land (symlinks resolved, patterns expanded — a `NodeExecutionEnv` over a real
|
|
253
258
|
* directory is what the gate itself runs on), the boundary it is judged against, and the trust-policy seat
|
|
@@ -305,8 +310,10 @@ export interface ShellReadJudgment {
|
|
|
305
310
|
* home and the account home the account database answers once, for this call (`readDenyHomesOf`'s homes). Every home
|
|
306
311
|
* beside the declared one waits at most a short bound of its own.
|
|
307
312
|
*
|
|
308
|
-
* It carries NO deadline
|
|
309
|
-
*
|
|
313
|
+
* It carries NO deadline but one: a recursive removal's subtree search answers under its own short bound
|
|
314
|
+
* ({@link SUBTREE_SEARCH_MS}), as the extra homes above do — a search that ran out is the search's own refusal, not a
|
|
315
|
+
* silence. Bounding the judgment's other environment-facing waits and substituting a fail-closed verdict is the
|
|
316
|
+
* gate FOLD's policy on the gate's one deadline seat; the station holds no other on either entry, and a
|
|
310
317
|
* second default here would decide the same number twice and turn a slow-but-correct filesystem's true
|
|
311
318
|
* answer into a fail-closed one unasked. A consumer wanting that posture races its own deadline and reads
|
|
312
319
|
* the row the gate's fallback reads: `SHELL_READ_DECISION.unanswered[seat]`.
|