@sema-agent/core 7.57.0 → 7.58.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 +385 -0
- package/dist/agents/subagent-steps.js +2 -4
- package/dist/brain/route-adjudicator.js +2 -1
- package/dist/core/a2a.d.ts +2 -1
- package/dist/core/a2a.js +23 -10
- package/dist/core/allow-entry.d.ts +2 -1
- package/dist/core/allow-entry.js +2 -1
- package/dist/core/ask-origin.d.ts +21 -2
- package/dist/core/ask-origin.js +5 -1
- package/dist/core/auto-compaction.d.ts +4 -0
- package/dist/core/auto-compaction.js +1 -1
- package/dist/core/auto-mode-directive.d.ts +29 -5
- package/dist/core/auto-mode-directive.js +38 -8
- package/dist/core/checkpoint-requirements.d.ts +7 -1
- package/dist/core/checkpoint-requirements.js +2 -0
- package/dist/core/checkpoint-store.d.ts +27 -11
- package/dist/core/checkpoint-store.js +13 -3
- package/dist/core/engine-notice.d.ts +1 -1
- package/dist/core/fs-write-gate-policy.d.ts +4 -2
- package/dist/core/fs-write-gate-policy.js +7 -3
- package/dist/core/gate-fold.js +6 -3
- package/dist/core/gate-lanes.js +11 -2
- package/dist/core/git-worktree-env.d.ts +53 -11
- package/dist/core/git-worktree-env.js +96 -12
- package/dist/core/hooks.d.ts +4 -1
- package/dist/core/hooks.js +12 -5
- package/dist/core/human-input-projection.d.ts +1 -0
- package/dist/core/human-input-projection.js +3 -0
- package/dist/core/locked-config.d.ts +15 -1
- package/dist/core/locked-config.js +38 -2
- package/dist/core/mcp-call-meta.d.ts +66 -0
- package/dist/core/mcp-call-meta.js +103 -0
- package/dist/core/mcp-connection-pool.d.ts +3 -1
- package/dist/core/mcp-connection-pool.js +3 -1
- package/dist/core/mcp-failure.d.ts +7 -1
- package/dist/core/mcp-failure.js +10 -0
- package/dist/core/mcp-probe.d.ts +4 -0
- package/dist/core/mcp-probe.js +1 -1
- package/dist/core/mcp-server-link.d.ts +5 -2
- package/dist/core/mcp-server-spec.d.ts +46 -18
- package/dist/core/mcp-server-spec.js +1 -18
- package/dist/core/mcp.d.ts +6 -14
- package/dist/core/mcp.js +77 -37
- package/dist/core/memory-engine/scope-contract.d.ts +45 -4
- package/dist/core/memory-engine/scope-contract.js +80 -11
- package/dist/core/mode-policy.d.ts +8 -5
- package/dist/core/mode-policy.js +5 -4
- package/dist/core/mods/host.js +1 -1
- package/dist/core/mods/kernel/dispatch.d.ts +3 -0
- package/dist/core/mods/kernel/dispatch.js +10 -8
- package/dist/core/mods/kernel/events.d.ts +5 -1
- package/dist/core/mods/kernel/events.js +1 -1
- package/dist/core/mods/kernel/registration.d.ts +5 -1
- package/dist/core/mods/kernel/site-rules.d.ts +3 -0
- package/dist/core/mods/kernel/site-rules.js +10 -0
- package/dist/core/mods/package.d.ts +23 -0
- package/dist/core/mods/package.js +118 -0
- package/dist/core/mods/stations.d.ts +2 -2
- package/dist/core/mods/stations.js +1 -1
- package/dist/core/mods/tool-call.d.ts +5 -1
- package/dist/core/mods/tool-call.js +12 -3
- package/dist/core/path-guard-rows.d.ts +20 -0
- package/dist/core/path-guard-rows.js +11 -0
- package/dist/core/peer-seat.d.ts +186 -0
- package/dist/core/peer-seat.js +307 -0
- package/dist/core/present-plan-tool.d.ts +10 -1
- package/dist/core/present-plan-tool.js +46 -2
- package/dist/core/protocol-http-auth.d.ts +40 -29
- package/dist/core/protocol-http-auth.js +30 -32
- package/dist/core/redaction-marks.d.ts +16 -0
- package/dist/core/redaction-marks.js +16 -0
- package/dist/core/redaction-passes.js +8 -9
- package/dist/core/retention.d.ts +41 -15
- package/dist/core/retention.js +59 -12
- package/dist/core/rewrite-rejudge.d.ts +37 -0
- package/dist/core/rewrite-rejudge.js +40 -0
- package/dist/core/run-origin.d.ts +40 -0
- package/dist/core/run-origin.js +37 -0
- package/dist/core/runner/advertised-writable-dirs.d.ts +57 -38
- package/dist/core/runner/advertised-writable-dirs.js +126 -0
- package/dist/core/runner/compaction-restate.d.ts +15 -6
- package/dist/core/runner/compaction-restate.js +28 -2
- package/dist/core/runner/contracts.d.ts +13 -5
- package/dist/core/runner/gate-exit.d.ts +18 -4
- package/dist/core/runner/gate-exit.js +5 -1
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +2 -0
- package/dist/core/runner/prepare-caps-and-workflow.js +1 -1
- package/dist/core/runner/prepare-config-doors.d.ts +8 -5
- package/dist/core/runner/prepare-config-doors.js +12 -10
- package/dist/core/runner/prepare-delegation-surface.d.ts +4 -0
- package/dist/core/runner/prepare-delegation-surface.js +15 -18
- package/dist/core/runner/prepare-gate-stations.js +1 -1
- package/dist/core/runner/prepare-hands-readface.d.ts +7 -3
- package/dist/core/runner/prepare-hands-readface.js +4 -1
- package/dist/core/runner/prepare-memory.d.ts +3 -0
- package/dist/core/runner/prepare-memory.js +19 -23
- package/dist/core/runner/prepare-policy-chain.d.ts +4 -4
- package/dist/core/runner/prepare-policy-chain.js +2 -2
- package/dist/core/runner/prepare-protocol-tools.d.ts +4 -2
- package/dist/core/runner/prepare-protocol-tools.js +3 -3
- package/dist/core/runner/prepare-suspend-saga.d.ts +2 -0
- package/dist/core/runner/prepare-suspend-saga.js +2 -1
- package/dist/core/runner/prepare-task.js +25 -12
- package/dist/core/runner/prepare-wiring-manifest.d.ts +1 -0
- package/dist/core/runner/prepare-wiring-manifest.js +2 -2
- package/dist/core/runner/prepare-workspace-restore.d.ts +3 -0
- package/dist/core/runner/prepare-workspace-restore.js +4 -4
- package/dist/core/runner/resume-admission.js +1 -1
- package/dist/core/runner/resume-checkpoint-screen.js +2 -0
- package/dist/core/runner/run-harness-handlers.d.ts +3 -4
- package/dist/core/runner/run-harness-handlers.js +1 -8
- package/dist/core/runner/run-identity-wiring.js +1 -0
- package/dist/core/runner/run-leg.js +5 -1
- package/dist/core/runner/run-notification-lane.js +3 -0
- package/dist/core/runner/terminal-account.js +3 -3
- package/dist/core/runner/tool-end-body.js +1 -0
- package/dist/core/runner/tool-occurrence.d.ts +4 -1
- package/dist/core/runner/tool-occurrence.js +2 -1
- package/dist/core/runner/write-protection-station.d.ts +8 -2
- package/dist/core/runner/write-protection-station.js +2 -0
- package/dist/core/runner-deps.d.ts +2 -2
- package/dist/core/sensitive-path-policy.js +6 -7
- package/dist/core/session-log-transfer.d.ts +24 -0
- package/dist/core/session-log-transfer.js +166 -0
- package/dist/core/session-store.d.ts +84 -19
- package/dist/core/session-store.js +162 -24
- package/dist/core/session.d.ts +92 -1
- package/dist/core/shell-read-silence.js +1 -0
- package/dist/core/steer-replay.d.ts +4 -2
- package/dist/core/steer-replay.js +2 -1
- package/dist/core/store-contracts/checkpoint-store-contract.js +17 -0
- package/dist/core/store-contracts/session-repo-contract.js +112 -5
- package/dist/core/store-contracts/session-store-contract.d.ts +4 -1
- package/dist/core/store-contracts/session-store-contract.js +236 -2
- package/dist/core/task-event.d.ts +68 -8
- package/dist/core/task-registry-shared.d.ts +2 -1
- package/dist/core/task-spec.d.ts +37 -0
- package/dist/core/task-stream.d.ts +2 -1
- package/dist/core/terminal-cause.d.ts +1 -1
- package/dist/core/tool-catalog-entries.js +1 -0
- package/dist/core/tool-result-store.d.ts +17 -10
- package/dist/core/tool-result-store.js +3 -1
- package/dist/core/types.d.ts +1 -1
- package/dist/core/untrusted-egress.d.ts +0 -2
- package/dist/core/untrusted-egress.js +10 -14
- package/dist/core/wiring-manifest.d.ts +12 -3
- package/dist/core/wiring-manifest.js +4 -3
- package/dist/core/workspace-snapshot.d.ts +44 -0
- package/dist/core/workspace-snapshot.js +34 -0
- package/dist/core/write-protect.d.ts +43 -3
- package/dist/core/write-protect.js +43 -16
- package/dist/engine/execution-env/node-execution-env.js +15 -11
- package/dist/engine/execution-env/symlink-chain.d.ts +7 -5
- package/dist/engine/harness/agent-harness.d.ts +5 -0
- package/dist/engine/harness/agent-harness.js +2 -0
- package/dist/engine/harness/types.d.ts +48 -7
- package/dist/engine/harness/types.js +5 -1
- package/dist/engine/llm/types.d.ts +12 -3
- package/dist/engine/llm/types.js +1 -1
- package/dist/engine/session/import-validate.js +3 -0
- package/dist/engine/session/memory-repo.d.ts +17 -9
- package/dist/engine/session/memory-repo.js +44 -34
- package/dist/engine/session/repo-utils.d.ts +22 -4
- package/dist/engine/session/repo-utils.js +49 -1
- package/dist/engine/session/storage-base.d.ts +10 -1
- package/dist/engine/session/storage-base.js +7 -1
- package/dist/index.d.ts +13 -6
- package/dist/index.js +10 -4
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/internal/harness.d.ts +2 -2
- package/dist/internal/harness.js +2 -2
- package/dist/stores/file/index.d.ts +4 -1
- package/dist/stores/file/index.js +4 -1
- package/dist/stores/file/session-store.d.ts +15 -8
- package/dist/stores/file/session-store.js +28 -13
- package/dist/tools/fs/fs-write.d.ts +6 -3
- package/dist/tools/fs/fs-write.js +8 -7
- package/dist/tools/fs/index.d.ts +3 -0
- package/dist/tools/fs/index.js +1 -1
- package/dist/tools/fs/safety.js +40 -8
- package/dist/tools/fs/search.js +6 -24
- package/dist/tools/fs/shell-read-check.d.ts +8 -1
- package/dist/tools/fs/shell-read-check.js +59 -15
- package/dist/tools/fs/shell-read-establish.js +2 -1
- package/dist/tools/fs/shell-read-identity.js +1 -1
- package/dist/tools/fs/shell-read-judge.d.ts +10 -1
- package/dist/tools/worktree.d.ts +42 -15
- package/dist/tools/worktree.js +60 -32
- package/package.json +4 -2
- package/test/export-surface.snapshot.json +63 -1
- package/wire-changes/core-stores-sql@7.58.0.json +29 -0
- package/wire-changes/core@7.58.0.json +2188 -0
- package/wire-changes/mods-kernel@7.58.0.json +81 -0
- package/wire-changes/primitives@7.58.0.json +29 -0
- package/dist/primitives/credential-ref.d.ts +0 -89
- package/dist/primitives/credential-ref.js +0 -125
- package/dist/primitives/index.d.ts +0 -2
- package/dist/primitives/index.js +0 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { REDACTION_MARK, REDACTION_MARKS, redactionMarkerSpans } from "./redaction-marks.js";
|
|
1
2
|
export function summarizeRedactions(findings) {
|
|
2
3
|
if (findings.length === 0)
|
|
3
4
|
return "no redactions";
|
|
@@ -34,10 +35,8 @@ function passZeroMapper(batches) {
|
|
|
34
35
|
return p;
|
|
35
36
|
};
|
|
36
37
|
}
|
|
37
|
-
const PREEXISTING_MARKER_RE = /\[redacted(?:-[a-z]+)?\]/g;
|
|
38
38
|
const FORMAT_CHAR_RE = /\p{Cf}/u;
|
|
39
39
|
const MAX_FORMAT_SLOT_SCANS = 64;
|
|
40
|
-
const REDACTED_WHOLE = "[redacted]";
|
|
41
40
|
function finding(pass, span, family) {
|
|
42
41
|
const f = { kind: pass.kind, confidence: pass.confidence, span, marker: pass.marker, source: pass.source };
|
|
43
42
|
if (family !== undefined)
|
|
@@ -96,7 +95,7 @@ function soloHits(input, passes) {
|
|
|
96
95
|
if (rescans) {
|
|
97
96
|
work -= m[0].length;
|
|
98
97
|
if (work < 0) {
|
|
99
|
-
hits.push({ start: at, end: input.length, marker: pass.marker === "" ?
|
|
98
|
+
hits.push({ start: at, end: input.length, marker: pass.marker === "" ? REDACTION_MARK : pass.marker, pass: i, family: familyAt(), matchStart: at, matchEnd: input.length });
|
|
100
99
|
break;
|
|
101
100
|
}
|
|
102
101
|
re.lastIndex = at + 1;
|
|
@@ -168,7 +167,7 @@ function renderRemovals(input, removals) {
|
|
|
168
167
|
if (r.marker !== "" && (widest === undefined || r.end - r.start > widest.end - widest.start))
|
|
169
168
|
widest = r;
|
|
170
169
|
}
|
|
171
|
-
const marker = widest?.marker ??
|
|
170
|
+
const marker = widest?.marker ?? REDACTION_MARK;
|
|
172
171
|
out += input.slice(cursor, start) + marker;
|
|
173
172
|
cursor = end;
|
|
174
173
|
edits.push({ at: start, removedLen: end - start, insertedLen: marker.length, inserted: marker, family: widest?.family, head: 0, tail: 0, pass: widest?.pass ?? sorted[i - 1].pass });
|
|
@@ -248,7 +247,7 @@ function replacedSpans(batches) {
|
|
|
248
247
|
}
|
|
249
248
|
export function runRedactionPasses(input, passes, report) {
|
|
250
249
|
if (report !== undefined && report.preexistingMarkers === undefined) {
|
|
251
|
-
report.preexistingMarkers = input.
|
|
250
|
+
report.preexistingMarkers = redactionMarkerSpans(input).length;
|
|
252
251
|
}
|
|
253
252
|
if (!FORMAT_CHAR_RE.test(input))
|
|
254
253
|
return applyPasses(input, passes, report, (pos) => pos).out;
|
|
@@ -288,7 +287,7 @@ export function runRedactionPasses(input, passes, report) {
|
|
|
288
287
|
const { batches } = applyPasses(view, passes, report, toOriginal, true);
|
|
289
288
|
const viewSpans = replacedSpans(batches);
|
|
290
289
|
if (viewSpans === undefined)
|
|
291
|
-
return
|
|
290
|
+
return REDACTION_MARK;
|
|
292
291
|
const spans = viewSpans.map((sp) => {
|
|
293
292
|
const startIdx = offsetToCharIndex.get(sp.start) ?? viewChars.length;
|
|
294
293
|
const endIdx = offsetToCharIndex.get(sp.end) ?? viewChars.length;
|
|
@@ -308,7 +307,7 @@ export function runRedactionPasses(input, passes, report) {
|
|
|
308
307
|
if (formatAtSlot[k] !== "")
|
|
309
308
|
cutOffsets.push(charStartOffsets[k]);
|
|
310
309
|
if (cutOffsets.length > MAX_FORMAT_SLOT_SCANS)
|
|
311
|
-
return
|
|
310
|
+
return REDACTION_MARK;
|
|
312
311
|
const extra = [];
|
|
313
312
|
const rawSpans = replacedSpans(applyPasses(input, passes, undefined, (pos) => pos, true).batches);
|
|
314
313
|
if (rawSpans !== undefined)
|
|
@@ -363,8 +362,8 @@ export function runRedactionPasses(input, passes, report) {
|
|
|
363
362
|
result += input.slice(cursor);
|
|
364
363
|
return result;
|
|
365
364
|
}
|
|
366
|
-
const BRACKET_MARKER = { "url-credentials":
|
|
367
|
-
const bracketMarker = (kind) => BRACKET_MARKER[kind] ??
|
|
365
|
+
const BRACKET_MARKER = { "url-credentials": REDACTION_MARKS.credentials };
|
|
366
|
+
const bracketMarker = (kind) => BRACKET_MARKER[kind] ?? REDACTION_MARK;
|
|
368
367
|
const capturesLabel = (re) => new RegExp(`${re.source}|`).exec("").length > 1;
|
|
369
368
|
export function egressPasses(groups, replacers = {}) {
|
|
370
369
|
return groups.map((rows) => {
|
package/dist/core/retention.d.ts
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
|
-
/** A store's retention
|
|
1
|
+
/** A store's retention declaration: `"managed"` = this store's rows are deleted on schedule by the
|
|
2
|
+
* deployment; `"none"` = nothing deletes them on schedule. Absent ⇒ read fail-closed as `"none"`. */
|
|
2
3
|
export type RetentionDeclaration = "managed" | "none";
|
|
3
4
|
/** The declaration face a storage implementation carries (structural — every store interface's
|
|
4
|
-
* optional `retention` field conforms).
|
|
5
|
-
* {@link
|
|
6
|
-
*
|
|
5
|
+
* optional `retention` field conforms). The word is the deployment's statement about this store's
|
|
6
|
+
* rows (see {@link RetentionDeclaration}), given by the party that runs the sweep when it constructs
|
|
7
|
+
* the store: the bundled stores take it as their `retention` option and default to `"none"`. */
|
|
7
8
|
export interface RetentionDeclaring {
|
|
8
9
|
readonly retention?: RetentionDeclaration;
|
|
9
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* The one reader of a retention declaration word — the startup validation's and every bundled store's
|
|
13
|
+
* constructor option's. `undefined` reads as `"none"`; anything but the two words is refused
|
|
14
|
+
* (`config.retention_capability`), so a typo'd declaration never silently means anything.
|
|
15
|
+
*
|
|
16
|
+
* @param name the deployment-facing name of where the word was read (a store seat, an option).
|
|
17
|
+
*/
|
|
18
|
+
export declare function readRetentionDeclaration(name: string, value: unknown): RetentionDeclaration;
|
|
10
19
|
/**
|
|
11
20
|
* The deployment's managed-retention policy ({@link import("./types.js").RunnerDeps.retentionPolicy}).
|
|
12
21
|
* Core consumes it ONLY for the startup capability validation (and exposes it to the deployment's
|
|
@@ -19,9 +28,10 @@ export interface RetentionPolicy {
|
|
|
19
28
|
maxAgeDays: number;
|
|
20
29
|
}
|
|
21
30
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* order contract).
|
|
31
|
+
* The executor that deletes the rows of the stores declaring `retention: "managed"` — a backend's
|
|
32
|
+
* `retention` member (contract TYPE — core ships no implementation; the server half consumes this.
|
|
33
|
+
* Reference implementation of the cascade: the server's session-purge order contract). A deployment
|
|
34
|
+
* that declares a store managed runs one over that store's rows. Every method is expected to be:
|
|
25
35
|
* - **tenant-domain scoped**: work is enumerated and executed per retention domain (tenant/scope),
|
|
26
36
|
* never as one global sweep;
|
|
27
37
|
* - **idempotent**: a retried invocation after a crash re-converges (already-deleted rows are
|
|
@@ -84,14 +94,8 @@ export interface RetentionReceipt {
|
|
|
84
94
|
/** Tombstones written for the deleted rows. */
|
|
85
95
|
tombstones: number;
|
|
86
96
|
}
|
|
87
|
-
/**
|
|
88
|
-
|
|
89
|
-
* every wired store must declare `retention: "managed"` — a locked policy over a store that cannot
|
|
90
|
-
* delete is refused (`config.retention_capability`), never silently accepted. Also fail-loud
|
|
91
|
-
* validates the policy value itself (`config.retention_policy`). Exported for deployments to call at
|
|
92
|
-
* their own startup; the prepare preflight re-runs it on every leg regardless.
|
|
93
|
-
*/
|
|
94
|
-
export declare function assertRetentionCapability(input: {
|
|
97
|
+
/** The stores whose words are judged, and the policy that judges them. */
|
|
98
|
+
interface RetentionWords {
|
|
95
99
|
policy: RetentionPolicy | undefined;
|
|
96
100
|
/** Whether locked-config locks the `retentionPolicy` key (locked-config.ts `LockedKey`). */
|
|
97
101
|
locked: boolean;
|
|
@@ -102,4 +106,26 @@ export declare function assertRetentionCapability(input: {
|
|
|
102
106
|
name: string;
|
|
103
107
|
store: object | undefined;
|
|
104
108
|
}>;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* The declaration half of the check — all a caller that holds no executor can judge: the policy value, every
|
|
112
|
+
* wired store's word, and, with the retention policy LOCKED and configured, every store declaring
|
|
113
|
+
* `retention: "managed"` — a locked policy over a store that cannot delete is refused
|
|
114
|
+
* (`config.retention_capability`), never silently accepted. The task-prepare preflight runs it on every leg;
|
|
115
|
+
* a deployment's own startup calls {@link assertRetentionCapability}, which runs it too.
|
|
116
|
+
*/
|
|
117
|
+
export declare function assertRetentionWords(input: RetentionWords): void;
|
|
118
|
+
/**
|
|
119
|
+
* Startup validation, the deployment's call: the declaration half ({@link assertRetentionWords}) and the
|
|
120
|
+
* declaration held to the executor the deployment runs. `executor` is required — the
|
|
121
|
+
* {@link ManagedRetentionCapability} the deployment runs over these stores' rows (a backend's `retention` member),
|
|
122
|
+
* or `null` when it runs none; `undefined` is refused (`config.retention_capability`), so a backend's absent
|
|
123
|
+
* member is never read as "judge the words alone". Locked or not, a store saying `"managed"` (its rows are deleted
|
|
124
|
+
* on schedule) beside `executor: null` is refused, and so is an executor that is not one. A `"none"` store beside
|
|
125
|
+
* an executor is not refused — a deployment may hold the executor and not run it on a store, and a locked policy
|
|
126
|
+
* refuses that store by its word.
|
|
127
|
+
*/
|
|
128
|
+
export declare function assertRetentionCapability(input: RetentionWords & {
|
|
129
|
+
executor: ManagedRetentionCapability | null;
|
|
105
130
|
}): void;
|
|
131
|
+
export {};
|
package/dist/core/retention.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { describeRejectedValue } from "./tool-search-setting.js";
|
|
2
|
+
import { thrownText } from "./thrown-value.js";
|
|
3
|
+
export function readRetentionDeclaration(name, value) {
|
|
4
|
+
if (value === undefined || value === "none")
|
|
5
|
+
return "none";
|
|
6
|
+
if (value === "managed")
|
|
7
|
+
return "managed";
|
|
8
|
+
throw codedError("config.retention_capability", `store "${name}" declares an unparseable retention value ${describeRejectedValue(value)} — expected "managed" or "none".`);
|
|
9
|
+
}
|
|
2
10
|
export const RETENTION_CASCADE_DOMAINS = Object.freeze(["checkpoints", "session-trees", "orphan-tool-results"]);
|
|
3
11
|
export const RETENTION_CASCADE_EXEMPT = Object.freeze(["session-pollution", "session-capture-optout", "lineage.json"]);
|
|
4
12
|
function codedError(code, message) {
|
|
@@ -6,8 +14,30 @@ function codedError(code, message) {
|
|
|
6
14
|
e.code = code;
|
|
7
15
|
return e;
|
|
8
16
|
}
|
|
9
|
-
|
|
10
|
-
|
|
17
|
+
const RETENTION_EXECUTOR_MEMBERS = Object.keys({
|
|
18
|
+
listRetentionDomains: true,
|
|
19
|
+
expireCheckpoints: true,
|
|
20
|
+
deleteExpiredSessions: true,
|
|
21
|
+
deleteOrphanToolResults: true,
|
|
22
|
+
});
|
|
23
|
+
function assertRetentionExecutor(executor) {
|
|
24
|
+
if ((typeof executor !== "object" && typeof executor !== "function") || executor === null) {
|
|
25
|
+
throw codedError("config.retention_capability", `the retention executor must be an object implementing ManagedRetentionCapability, or null when the deployment runs none (got ${describeRejectedValue(executor)}).`);
|
|
26
|
+
}
|
|
27
|
+
for (const member of RETENTION_EXECUTOR_MEMBERS) {
|
|
28
|
+
let value;
|
|
29
|
+
try {
|
|
30
|
+
value = executor[member];
|
|
31
|
+
}
|
|
32
|
+
catch (cause) {
|
|
33
|
+
throw codedError("config.retention_capability", `the retention executor's ${member} could not be read (${thrownText(cause)}) — it is not a ManagedRetentionCapability.`);
|
|
34
|
+
}
|
|
35
|
+
if (typeof value !== "function") {
|
|
36
|
+
throw codedError("config.retention_capability", `the retention executor's ${member} is ${describeRejectedValue(value)}, not a function — it is not a ManagedRetentionCapability.`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function readRetentionWords({ policy, stores }) {
|
|
11
41
|
const declared = policy;
|
|
12
42
|
if (declared !== undefined && (typeof declared !== "object" || declared === null || Array.isArray(declared))) {
|
|
13
43
|
throw codedError("config.retention_policy", `retentionPolicy must be an object carrying maxAgeDays (got ${declared === null ? "null" : Array.isArray(declared) ? "an array" : typeof declared}).`);
|
|
@@ -15,17 +45,34 @@ export function assertRetentionCapability(input) {
|
|
|
15
45
|
if (policy !== undefined && (!Number.isFinite(policy.maxAgeDays) || policy.maxAgeDays < 0)) {
|
|
16
46
|
throw codedError("config.retention_policy", `retentionPolicy.maxAgeDays must be a finite non-negative number of days (got ${describeRejectedValue(policy.maxAgeDays)}).`);
|
|
17
47
|
}
|
|
18
|
-
|
|
19
|
-
const r = store.retention;
|
|
20
|
-
if (r === undefined || r === "none")
|
|
21
|
-
return "none";
|
|
22
|
-
if (r === "managed")
|
|
23
|
-
return "managed";
|
|
24
|
-
throw codedError("config.retention_capability", `store "${name}" declares an unparseable retention value ${JSON.stringify(r)} — expected "managed" or "none".`);
|
|
25
|
-
};
|
|
26
|
-
const declarations = stores
|
|
48
|
+
return stores
|
|
27
49
|
.filter((s) => s.store !== undefined && s.store !== null)
|
|
28
|
-
.map(({ name, store }) => ({ name, retention:
|
|
50
|
+
.map(({ name, store }) => ({ name, retention: readRetentionDeclaration(name, store.retention) }));
|
|
51
|
+
}
|
|
52
|
+
export function assertRetentionWords(input) {
|
|
53
|
+
const { policy, locked, stores } = input;
|
|
54
|
+
const words = { policy, locked, stores };
|
|
55
|
+
refuseLockedOverNone(words, readRetentionWords(words));
|
|
56
|
+
}
|
|
57
|
+
export function assertRetentionCapability(input) {
|
|
58
|
+
const { policy, locked, stores, executor } = input;
|
|
59
|
+
const words = { policy, locked, stores };
|
|
60
|
+
if (executor === undefined) {
|
|
61
|
+
throw codedError("config.retention_capability", `executor is required — the managed-retention executor the deployment runs over these stores' rows (a backend's \`retention\` member), or null when it runs none (got undefined).`);
|
|
62
|
+
}
|
|
63
|
+
const declarations = readRetentionWords(words);
|
|
64
|
+
if (executor !== null)
|
|
65
|
+
assertRetentionExecutor(executor);
|
|
66
|
+
else {
|
|
67
|
+
const unexecuted = declarations.filter(({ retention }) => retention === "managed");
|
|
68
|
+
if (unexecuted.length > 0) {
|
|
69
|
+
throw codedError("config.retention_capability", `${unexecuted.map((s) => s.name).join(", ")} declare${unexecuted.length === 1 ? "s" : ""} retention "managed" — rows deleted on schedule by the deployment — ` +
|
|
70
|
+
`but the deployment runs no retention executor: nothing would delete them. Declare those stores "none", or wire the executor that deletes their rows.`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
refuseLockedOverNone(words, declarations);
|
|
74
|
+
}
|
|
75
|
+
function refuseLockedOverNone({ policy, locked }, declarations) {
|
|
29
76
|
if (!locked || policy === undefined)
|
|
30
77
|
return;
|
|
31
78
|
const incapable = declarations.filter(({ retention }) => retention !== "managed");
|
|
@@ -1,6 +1,43 @@
|
|
|
1
1
|
import type { PreToolUseResult } from "./hooks.js";
|
|
2
2
|
import type { PermissionResult } from "./tool-policy.js";
|
|
3
3
|
import type { PreToolUseScreening } from "./runner/gate-exit.js";
|
|
4
|
+
import type { RewriteAuthor, ToolInputRewrite } from "./task-event.js";
|
|
5
|
+
/** One gate pass's account of its rewrites: the bytes it took at its entry, and one author per adoption that changed the bytes
|
|
6
|
+
* in hand (written only through {@link noteRewrite}). */
|
|
7
|
+
export interface RewriteAccount {
|
|
8
|
+
readonly entry: unknown;
|
|
9
|
+
readonly by: RewriteAuthor[];
|
|
10
|
+
}
|
|
11
|
+
/** An adoption of `to` in place of `from`, by `authors`: they are named when the two read as other bytes. */
|
|
12
|
+
export declare function noteRewrite(account: RewriteAccount, req: {
|
|
13
|
+
readonly face?: object | undefined;
|
|
14
|
+
}, from: unknown, to: unknown, authors: readonly RewriteAuthor[]): void;
|
|
15
|
+
/** The restriction chain's and the approver's word in an account (one author each, frozen once). */
|
|
16
|
+
export declare const POLICY_AUTHOR: readonly RewriteAuthor[];
|
|
17
|
+
export declare const APPROVER_AUTHOR: readonly RewriteAuthor[];
|
|
18
|
+
/** The extensions that authored a screening's rewrite, as authors. */
|
|
19
|
+
export declare const extensionAuthors: (names: readonly string[]) => readonly RewriteAuthor[];
|
|
20
|
+
/** The call's record at the allow exit: when `ran` (the bytes the gate lets go) is not the bytes it took, `snapshot` (their frozen
|
|
21
|
+
* plain-data projection, the exit's `finalInput`) with the authors the account holds. Bytes that moved with no author named is an
|
|
22
|
+
* engine defect (an adoption that did not name itself). */
|
|
23
|
+
export declare function rewriteRecordOf(account: RewriteAccount, req: {
|
|
24
|
+
readonly face?: object | undefined;
|
|
25
|
+
readonly toolName: string;
|
|
26
|
+
}, ran: unknown, snapshot: unknown): ToolInputRewrite | undefined;
|
|
27
|
+
/** The authors of each `classic.PreToolUse` answer one dispatch received, read by the answer's identity as the station receives
|
|
28
|
+
* it: a handler is an author when its answer's `updatedInput` reads as other bytes ({@link sameBytes}, under `req`'s reading) than
|
|
29
|
+
* what its `next()` returned (the event's `input` when that carried none, or when it never called `next`); otherwise its answer
|
|
30
|
+
* carries the authors of what came up. `record` is the station's answer check (it refuses nothing); `of` reads the chain's answer. */
|
|
31
|
+
export declare function screeningAuthorship(req: {
|
|
32
|
+
readonly face?: object | undefined;
|
|
33
|
+
}): {
|
|
34
|
+
readonly record: (answer: unknown, e: {
|
|
35
|
+
readonly input?: unknown;
|
|
36
|
+
}, by: {
|
|
37
|
+
readonly plugin: string;
|
|
38
|
+
}, below: readonly unknown[]) => undefined;
|
|
39
|
+
readonly of: (answer: unknown) => readonly string[];
|
|
40
|
+
};
|
|
4
41
|
/** What a judge did with the bytes it was handed: kept them (`as_is`), or handed back another form. */
|
|
5
42
|
export type RejudgeReading = {
|
|
6
43
|
readonly kind: "as_is";
|
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
import { canonicalize } from "./canonical-json.js";
|
|
2
2
|
import { argsAsTheToolReads } from "./effective-path-target.js";
|
|
3
|
+
export function noteRewrite(account, req, from, to, authors) {
|
|
4
|
+
if (!sameBytes(req, from, to))
|
|
5
|
+
account.by.push(...authors);
|
|
6
|
+
}
|
|
7
|
+
export const POLICY_AUTHOR = Object.freeze([Object.freeze({ kind: "policy" })]);
|
|
8
|
+
export const APPROVER_AUTHOR = Object.freeze([Object.freeze({ kind: "approver" })]);
|
|
9
|
+
export const extensionAuthors = (names) => names.map((name) => Object.freeze({ kind: "extension", name }));
|
|
10
|
+
export function rewriteRecordOf(account, req, ran, snapshot) {
|
|
11
|
+
if (sameBytes(req, account.entry, ran))
|
|
12
|
+
return undefined;
|
|
13
|
+
if (account.by.length === 0)
|
|
14
|
+
throw new Error(`the arguments of "${req.toolName}" the gate lets go are not the ones it took, and no adoption named who replaced them — an engine defect`);
|
|
15
|
+
return Object.freeze({ by: Object.freeze([...account.by]), input: snapshot });
|
|
16
|
+
}
|
|
17
|
+
export function screeningAuthorship(req) {
|
|
18
|
+
const authors = new WeakMap();
|
|
19
|
+
const rewriteOf = (a) => Reflect.get(a, "updatedInput");
|
|
20
|
+
const same = (x, y) => { try {
|
|
21
|
+
return sameBytes(req, x, y);
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return false;
|
|
25
|
+
} };
|
|
26
|
+
return {
|
|
27
|
+
record: (answer, e, by, below) => {
|
|
28
|
+
if (typeof answer !== "object" || answer === null || authors.has(answer))
|
|
29
|
+
return undefined;
|
|
30
|
+
let lower;
|
|
31
|
+
for (const b of below)
|
|
32
|
+
if (typeof b === "object" && b !== null)
|
|
33
|
+
lower = b;
|
|
34
|
+
const lowerAuthors = lower !== undefined ? (authors.get(lower) ?? []) : [];
|
|
35
|
+
const lowerBytes = lower !== undefined && rewriteOf(lower) !== undefined ? rewriteOf(lower) : e.input;
|
|
36
|
+
const mine = rewriteOf(answer);
|
|
37
|
+
authors.set(answer, mine === undefined ? [] : same(lowerBytes, mine) ? lowerAuthors : [...lowerAuthors, by.plugin]);
|
|
38
|
+
return undefined;
|
|
39
|
+
},
|
|
40
|
+
of: (answer) => (typeof answer === "object" && answer !== null ? (authors.get(answer) ?? []) : []),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
3
43
|
export function sameBytes(req, a, b) {
|
|
4
44
|
return a === b || canonicalize(argsAsTheToolReads(req, a)) === canonicalize(argsAsTheToolReads(req, b));
|
|
5
45
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare const RUN_ORIGINS: readonly ["scheduled"];
|
|
2
|
+
export type RunOrigin = (typeof RUN_ORIGINS)[number];
|
|
3
|
+
/** Membership test for {@link RunOrigin}: the one a host checks the word it is about to stamp against. */
|
|
4
|
+
export declare function isRunOrigin(v: unknown): v is RunOrigin;
|
|
5
|
+
/** The checkpoint row's recorded word: absent or a member passes; anything else is a row this engine cannot resume under
|
|
6
|
+
* (`config.run_origin_invalid`). A resume's screen asks it after the row's reader requirements were judged, so a row a newer
|
|
7
|
+
* engine wrote is refused as newer first. */
|
|
8
|
+
export declare function screenRecordedRunOrigin(recorded: unknown): RunOrigin | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* THE door of the declared word, and the leg's one reading of it. `declared` is the leg's config's word — the task spec's on a
|
|
11
|
+
* fresh leg, where it is the objective's; `row` is present on a resumed leg only and carries the word its checkpoint recorded
|
|
12
|
+
* and, when the resume hands over inputs to open the leg with (a wake), the newest one's word as `opening.word`
|
|
13
|
+
* ({@link wakeOpening}). On a fresh leg absent passes as absent, a member passes, and anything else present is refused loudly
|
|
14
|
+
* (`config.run_origin_invalid`), never folded to "the host said nothing" (that silence is exactly the invisibility the word
|
|
15
|
+
* exists to end).
|
|
16
|
+
*
|
|
17
|
+
* A resume config carries NO word, any value refused: a resume hands the engine no objective, so the field would have nothing
|
|
18
|
+
* to describe — the resumed leg's word is its opening input's when a wake opened it (absent included: a message that says
|
|
19
|
+
* nothing is not the row's word), the row's otherwise. Prepare's config doors and a resume's screen before the claim call this
|
|
20
|
+
* one function, so a resume prepare would refuse is refused while the row is pending.
|
|
21
|
+
*/
|
|
22
|
+
export declare function runOriginOfLeg(declared: unknown, row?: {
|
|
23
|
+
readonly recorded: RunOrigin | undefined;
|
|
24
|
+
readonly opening?: {
|
|
25
|
+
readonly word: unknown;
|
|
26
|
+
};
|
|
27
|
+
}): RunOrigin | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* The input that opens a woken leg: the NEWEST the wake hands over — its message, else the parked entry it delivers last
|
|
30
|
+
* (`parked` in `seq` order) — so a message-bearing wake and its atomic equivalent (`setPendingSteer` then a message-less wake)
|
|
31
|
+
* give the leg the same word. `undefined` when it hands over nothing. A decision on a parked leg opens nothing: what it
|
|
32
|
+
* delivers rides along with the answer, and the leg continues the row's word.
|
|
33
|
+
*/
|
|
34
|
+
export declare function wakeOpening(parked: ReadonlyArray<{
|
|
35
|
+
readonly runOrigin?: unknown;
|
|
36
|
+
}>, message: {
|
|
37
|
+
readonly runOrigin?: unknown;
|
|
38
|
+
} | undefined): {
|
|
39
|
+
readonly word: unknown;
|
|
40
|
+
} | undefined;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { describeRejectedValue } from "./tool-search-setting.js";
|
|
2
|
+
export const RUN_ORIGINS = Object.freeze(["scheduled"]);
|
|
3
|
+
const RUN_ORIGIN_SET = new Set(RUN_ORIGINS);
|
|
4
|
+
export function isRunOrigin(v) {
|
|
5
|
+
return RUN_ORIGIN_SET.has(v);
|
|
6
|
+
}
|
|
7
|
+
const WORDS = RUN_ORIGINS.map((w) => JSON.stringify(w)).join(" | ");
|
|
8
|
+
function refusal(message) {
|
|
9
|
+
const e = new Error(message);
|
|
10
|
+
e.code = "config.run_origin_invalid";
|
|
11
|
+
return e;
|
|
12
|
+
}
|
|
13
|
+
export function screenRecordedRunOrigin(recorded) {
|
|
14
|
+
if (recorded === undefined || isRunOrigin(recorded))
|
|
15
|
+
return recorded;
|
|
16
|
+
throw refusal(`the checkpoint row's runOrigin is ${describeRejectedValue(recorded)}, not a run origin this engine knows (${WORDS}) — the row cannot be resumed under a word nobody can read`);
|
|
17
|
+
}
|
|
18
|
+
export function runOriginOfLeg(declared, row) {
|
|
19
|
+
if (row !== undefined && declared !== undefined) {
|
|
20
|
+
throw refusal(`a resume config declares runOrigin ${describeRejectedValue(declared)} — a resume carries no run origin in its config: omit the field. ` +
|
|
21
|
+
`The resumed leg reads the word of the input that opens it — a wake states it on its message (message.runOrigin) — or else the parked row's (CheckpointSummary.runOrigin)`);
|
|
22
|
+
}
|
|
23
|
+
if (declared !== undefined && !isRunOrigin(declared)) {
|
|
24
|
+
throw refusal(`runOrigin ${describeRejectedValue(declared)} is not a run origin (${WORDS}) — omit it when the task was not started by the deployment's scheduler; an unreadable declaration is refused, never read as "not stated".`);
|
|
25
|
+
}
|
|
26
|
+
if (row === undefined)
|
|
27
|
+
return declared;
|
|
28
|
+
const opening = row.opening === undefined ? undefined : { word: row.opening.word };
|
|
29
|
+
if (opening !== undefined && opening.word !== undefined && !isRunOrigin(opening.word)) {
|
|
30
|
+
throw refusal(`the input that opens this leg declares runOrigin ${describeRejectedValue(opening.word)}, not a run origin (${WORDS}) — an unreadable declaration is refused, never read as "not stated".`);
|
|
31
|
+
}
|
|
32
|
+
return opening !== undefined ? opening.word : row.recorded;
|
|
33
|
+
}
|
|
34
|
+
export function wakeOpening(parked, message) {
|
|
35
|
+
const newest = message ?? parked[parked.length - 1];
|
|
36
|
+
return newest === undefined ? undefined : { word: newest.runOrigin };
|
|
37
|
+
}
|
|
@@ -1,46 +1,37 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The advertised-writable-directory seat — ONE rule for every directory the prompt tells the model
|
|
3
|
-
* it may write with the file tools:
|
|
4
|
-
*
|
|
5
|
-
* a directory the prompt advertises as writable is a directory the root fence ADMITS; the same
|
|
6
|
-
* admission decides the hole and the teaching, so a directory the fence cannot admit is neither
|
|
7
|
-
* opened nor taught, and the skip is announced.
|
|
8
|
-
*
|
|
9
|
-
* Two advertisers share it: the deployment's scratchpad (`TaskSpec.envFacts.scratchpadDir`, spoken
|
|
10
|
-
* by the `# Environment` block) and the memory engine's write root (spoken by the `# Memory`
|
|
11
|
-
* instruction, "write to it directly with the Write tool"). Before this seat each advertiser judged
|
|
12
|
-
* on its own: the scratchpad opened its hole in the hands phase, the memory instruction checked only
|
|
13
|
-
* that a `Write` tool was mounted — and the fence refused the very path the instruction named
|
|
14
|
-
* (`path_not_in_root`), a contradictory gate that taught the model to route around the tools.
|
|
15
|
-
*
|
|
16
|
-
* Admission = fail-closed canonicalization through the SAME ExecutionEnv the fence judges with (a
|
|
17
|
-
* raw or dangling entry is never admitted — the ancestor-canonicalize fallback would let a symlinked
|
|
18
|
-
* prefix carry writes outside every root). An advertiser that OWNS its directory's creation may ask
|
|
19
|
-
* for materialization on a DEFINITIVE `not_found` (the exclusive-create marker, so a concurrently
|
|
20
|
-
* planted path is never written through); an advertiser whose directory is created elsewhere passes
|
|
21
|
-
* no marker and an absent directory narrows.
|
|
22
|
-
*
|
|
23
|
-
* A directory the fence already holds is never admitted as a HOLE in it: a candidate that resolves onto
|
|
24
|
-
* a root — or above one — would turn that whole root into the advertised, write-gate-exempt domain, so
|
|
25
|
-
* an ordinary source write inside the workspace would stop asking. One predicate
|
|
26
|
-
* ({@link swallowedFenceRoot}) states that, and the write gate's configured domains apply the same one.
|
|
27
|
-
*
|
|
28
|
-
* Reverse check (the seat's own invariant): nothing enters `roots` except through `admit`, and every
|
|
29
|
-
* caller of `admit` is an advertiser deciding its advertisement off the returned verdict — so no
|
|
30
|
-
* directory reaches the ROOTS FENCE through this seat without the prompt advertising it, and none
|
|
31
|
-
* the prompt advertises is refused by that fence.
|
|
32
|
-
*
|
|
33
|
-
* The invariant is about this seat, not about the whole write surface: under an open write face
|
|
34
|
-
* ({@link import("../../tools/fs/containment-face.js").ContainmentFace}) the roots fence judges
|
|
35
|
-
* nothing, so what the prompt advertises is a floor rather than the whole list — the `# Environment`
|
|
36
|
-
* block says so in its own line, and the advertisement stays true (these directories ARE writable).
|
|
37
|
-
*/
|
|
38
1
|
import type { ExecutionEnv } from "../../internal/harness.js";
|
|
2
|
+
/** The code a declared session plan file that cannot be held as stated refuses the run with (`TaskSpec.planFile`). */
|
|
3
|
+
export declare const PLAN_FILE_INVALID_CODE = "config.plan_file_invalid";
|
|
4
|
+
/** The coded refusal for `TaskSpec.planFile`: the value as given and why it cannot be the session's plan file. */
|
|
5
|
+
export declare function planFileInvalid(value: unknown, why: string): Error & {
|
|
6
|
+
code: string;
|
|
7
|
+
detail: {
|
|
8
|
+
planFile: unknown;
|
|
9
|
+
reason: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
/** The declared plan file's SHAPE (no I/O): a non-empty absolute string in lexical normal form, else the coded refusal. */
|
|
13
|
+
export declare function checkedPlanFileShape(value: unknown): string | undefined;
|
|
14
|
+
/** How long a plan file's path may be: the longest path a platform spells (Linux PATH_MAX) — it is told to the model whole. */
|
|
15
|
+
export declare const PLAN_PATH_MAX = 4096;
|
|
16
|
+
/** How the plan file is told to the model (the plan-exit tool, the planning frames, the post-compaction reference): whole
|
|
17
|
+
* and verbatim — {@link checkedPlanFileShape} refuses a declared path this would re-spell, so for an admitted file this is
|
|
18
|
+
* the path itself; the defusing stays as the trusted line's guard. The ONE renderer: every teller reads its answer. */
|
|
19
|
+
export declare function planFileShown(path: string): string;
|
|
20
|
+
/** The most of a plan file the plan's readers take (1 MiB): a file past it is refused, never truncated into a plan. */
|
|
21
|
+
export declare const PLAN_FILE_MAX_BYTES: number;
|
|
22
|
+
/** What the session plan file holds: its text (`undefined` = not written yet — absent, or blank), or why it could not be read. */
|
|
23
|
+
export type PlanFileReading = {
|
|
24
|
+
readonly ok: true;
|
|
25
|
+
readonly text: string | undefined;
|
|
26
|
+
} | {
|
|
27
|
+
readonly ok: false;
|
|
28
|
+
readonly reason: string;
|
|
29
|
+
};
|
|
39
30
|
export interface AdvertisedWritableDir {
|
|
40
31
|
/** The directory as the advertisement spells it. */
|
|
41
32
|
path: string;
|
|
42
33
|
/** Who advertises it — names the skip line and the trace. */
|
|
43
|
-
advertiser: "scratchpad" | "memory";
|
|
34
|
+
advertiser: "scratchpad" | "memory" | "plan";
|
|
44
35
|
/**
|
|
45
36
|
* How the directory comes to exist when the env reports it absent. The advertiser that owns the
|
|
46
37
|
* directory's creation supplies the marker file name for the atomic exclusive-create
|
|
@@ -122,6 +113,34 @@ export declare class AdvertisedWritableDirs {
|
|
|
122
113
|
/** The admitted roots, CANONICAL, in admission order, deduplicated. The hands phase folds this list into the
|
|
123
114
|
* write-capable containment allowlist before the toolkit compiles; it is not a live view after that. */
|
|
124
115
|
get roots(): readonly string[];
|
|
116
|
+
/** The session plan file as admitted — its declared spelling and its frozen canonical key (the key is also on
|
|
117
|
+
* {@link roots}) — or `undefined` when none was declared. The write-protection judge reads it to exempt exactly
|
|
118
|
+
* this file; nothing else holds a copy. */
|
|
119
|
+
get planFile(): {
|
|
120
|
+
readonly spelled: string;
|
|
121
|
+
readonly key: string;
|
|
122
|
+
} | undefined;
|
|
123
|
+
private admittedPlanFile;
|
|
124
|
+
/**
|
|
125
|
+
* Admit the session plan file (`TaskSpec.planFile`, already shape-checked by {@link checkedPlanFileShape}): a FILE, so
|
|
126
|
+
* its key is the CANONICAL PARENT joined with the declared name — frozen here like every key this seat holds, never
|
|
127
|
+
* re-resolved — and the leaf is looked at without following links. The file need not exist yet (the model creates it),
|
|
128
|
+
* and it is never materialized: its directory is the host's to create.
|
|
129
|
+
*
|
|
130
|
+
* Refusing, not skipping: the leaf is a symbolic link (admitting where it points would let the declaration exempt any
|
|
131
|
+
* file the link names), a directory or another non-file kind; the parent does not resolve, or resolves to something
|
|
132
|
+
* other than a directory; or the key would hold a root the fence already holds (the seat's one containment rule).
|
|
133
|
+
* Each throws {@link planFileInvalid} — the plan file decides what the plan-exit tool reads, so a declared file the
|
|
134
|
+
* fence narrowed away would teach a tool over a file nobody can write.
|
|
135
|
+
*/
|
|
136
|
+
admitPlanFile(spelled: string): Promise<string>;
|
|
137
|
+
/**
|
|
138
|
+
* What the admitted session plan file holds right now — the ONE reader of the plan's contents (the plan-exit tool and the
|
|
139
|
+
* post-compaction reference both read here), through the environment the fence judges with, at the key admitted (frozen,
|
|
140
|
+
* never re-resolved), the leaf looked at without following a link: a file later replaced by a link, a directory or
|
|
141
|
+
* another kind is refused with the reason, never read through.
|
|
142
|
+
*/
|
|
143
|
+
readPlanFile(signal?: AbortSignal): Promise<PlanFileReading>;
|
|
125
144
|
/** What became of an advertiser's directory: admitted, skipped (announced), or never asked (the advertiser
|
|
126
145
|
* had nothing to advertise, or decided not to). The prompt side reads this to withhold an advertisement. */
|
|
127
146
|
verdictOf(advertiser: AdvertisedWritableDir["advertiser"]): "admitted" | "skipped" | "not-asked";
|