@sema-agent/core 7.71.0 → 7.72.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.
Files changed (158) hide show
  1. package/CHANGELOG.md +193 -0
  2. package/dist/agents/cross-session-ref.d.ts +2 -2
  3. package/dist/agents/cross-session-ref.js +7 -2
  4. package/dist/agents/inherited-tool-pool.d.ts +4 -1
  5. package/dist/agents/inherited-tool-pool.js +7 -5
  6. package/dist/agents/send-message-tool.js +6 -2
  7. package/dist/agents/subagent.js +5 -1
  8. package/dist/agents/verify.js +1 -0
  9. package/dist/core/a2a.d.ts +24 -3
  10. package/dist/core/a2a.js +27 -8
  11. package/dist/core/agent-state.d.ts +28 -7
  12. package/dist/core/agent-state.js +19 -6
  13. package/dist/core/approval-object.d.ts +7 -3
  14. package/dist/core/approval-object.js +30 -9
  15. package/dist/core/checkpoint-features.d.ts +13 -3
  16. package/dist/core/checkpoint-features.js +34 -5
  17. package/dist/core/checkpoint-requirements.d.ts +14 -1
  18. package/dist/core/checkpoint-row-verdict.d.ts +1 -1
  19. package/dist/core/checkpoint-row-verdict.js +3 -3
  20. package/dist/core/checkpoint-store.d.ts +4 -0
  21. package/dist/core/effective-path-target.d.ts +19 -0
  22. package/dist/core/effective-path-target.js +95 -38
  23. package/dist/core/engine-notice.d.ts +4 -1
  24. package/dist/core/engine-version.js +1 -1
  25. package/dist/core/file-history-store.d.ts +15 -4
  26. package/dist/core/file-history-store.js +53 -23
  27. package/dist/core/gate-fold.js +3 -1
  28. package/dist/core/governance-codes.d.ts +4 -1
  29. package/dist/core/governance-codes.js +4 -0
  30. package/dist/core/judged-read.d.ts +57 -0
  31. package/dist/core/judged-read.js +1 -0
  32. package/dist/core/mcp-host-seat.d.ts +5 -0
  33. package/dist/core/mcp-host-seat.js +7 -1
  34. package/dist/core/mcp.js +3 -1
  35. package/dist/core/memory-engine/index.d.ts +1 -1
  36. package/dist/core/memory-engine/index.js +1 -1
  37. package/dist/core/memory-engine/layout.js +6 -4
  38. package/dist/core/memory-engine/scope-contract.d.ts +59 -6
  39. package/dist/core/memory-engine/scope-contract.js +90 -25
  40. package/dist/core/mounted-mcp.d.ts +7 -2
  41. package/dist/core/mounted-mcp.js +10 -1
  42. package/dist/core/param-rule-reach.d.ts +8 -3
  43. package/dist/core/param-rule-reach.js +9 -1
  44. package/dist/core/parent-spec-seat.d.ts +11 -1
  45. package/dist/core/parent-spec-seat.js +14 -0
  46. package/dist/core/peer-registration.d.ts +52 -0
  47. package/dist/core/peer-registration.js +37 -0
  48. package/dist/core/peer-seat.d.ts +3 -1
  49. package/dist/core/permission-rule-model.js +1 -1
  50. package/dist/core/runner/chain-mismatch.d.ts +32 -0
  51. package/dist/core/runner/chain-mismatch.js +29 -0
  52. package/dist/core/runner/changes-history.d.ts +1 -0
  53. package/dist/core/runner/changes-history.js +2 -2
  54. package/dist/core/runner/contracts.d.ts +3 -0
  55. package/dist/core/runner/file-history-restore.d.ts +3 -1
  56. package/dist/core/runner/file-history-restore.js +9 -6
  57. package/dist/core/runner/loaded-skills.d.ts +2 -0
  58. package/dist/core/runner/loaded-skills.js +10 -0
  59. package/dist/core/runner/person-path-rows.d.ts +2 -4
  60. package/dist/core/runner/person-path-rows.js +2 -3
  61. package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -0
  62. package/dist/core/runner/prepare-caps-and-workflow.js +7 -2
  63. package/dist/core/runner/prepare-file-history.js +1 -1
  64. package/dist/core/runner/prepare-hands-readface.d.ts +5 -0
  65. package/dist/core/runner/prepare-hands-readface.js +24 -21
  66. package/dist/core/runner/prepare-inherited-gate.d.ts +2 -2
  67. package/dist/core/runner/prepare-inherited-gate.js +1 -1
  68. package/dist/core/runner/prepare-memory-engine-session.d.ts +2 -2
  69. package/dist/core/runner/prepare-memory-engine-session.js +2 -2
  70. package/dist/core/runner/prepare-memory.js +3 -15
  71. package/dist/core/runner/prepare-project-context.d.ts +1 -1
  72. package/dist/core/runner/prepare-project-context.js +3 -7
  73. package/dist/core/runner/prepare-protocol-tools.d.ts +5 -0
  74. package/dist/core/runner/prepare-protocol-tools.js +2 -2
  75. package/dist/core/runner/prepare-task.js +20 -16
  76. package/dist/core/runner/prepare-wiring-manifest.d.ts +2 -0
  77. package/dist/core/runner/prepare-wiring-manifest.js +4 -3
  78. package/dist/core/runner/read-session-changes.js +1 -1
  79. package/dist/core/runner/resume-checkpoint-screen.d.ts +8 -7
  80. package/dist/core/runner/resume-checkpoint-screen.js +7 -6
  81. package/dist/core/runner/rewind-files.js +3 -2
  82. package/dist/core/runner/run-leg.js +6 -2
  83. package/dist/core/runner/terminal-account.d.ts +4 -0
  84. package/dist/core/runner/terminal-account.js +7 -2
  85. package/dist/core/runner/tool-face-overlay.d.ts +2 -11
  86. package/dist/core/runner/tool-face-overlay.js +39 -0
  87. package/dist/core/runner/trim-stretch.js +7 -2
  88. package/dist/core/scheduler.d.ts +47 -7
  89. package/dist/core/scheduler.js +19 -7
  90. package/dist/core/secret-env.d.ts +7 -0
  91. package/dist/core/secret-env.js +1 -1
  92. package/dist/core/sensitive-path-policy.js +14 -7
  93. package/dist/core/shell-read-silence.js +1 -0
  94. package/dist/core/store-contracts/checkpoint-store-contract.js +7 -0
  95. package/dist/core/task-event.d.ts +4 -3
  96. package/dist/core/task-notification.d.ts +2 -1
  97. package/dist/core/task-spec.d.ts +13 -5
  98. package/dist/core/tool-catalog-entries.js +2 -0
  99. package/dist/core/tool-face-reader.js +1 -1
  100. package/dist/core/tool-face.d.ts +7 -0
  101. package/dist/core/tool-face.js +1 -0
  102. package/dist/core/tool-mount-facts.d.ts +4 -2
  103. package/dist/core/tool-mount-facts.js +3 -3
  104. package/dist/core/tool-mount-plan.d.ts +4 -2
  105. package/dist/core/tool-mount-plan.js +5 -5
  106. package/dist/core/tool-mount-static.d.ts +1 -1
  107. package/dist/core/tool-mount-static.js +25 -13
  108. package/dist/core/tool-registry.d.ts +33 -1
  109. package/dist/core/tool-registry.js +33 -0
  110. package/dist/core/tool-roster.d.ts +16 -0
  111. package/dist/core/tool-roster.js +6 -0
  112. package/dist/core/tool-spec.d.ts +4 -2
  113. package/dist/core/tools.d.ts +6 -0
  114. package/dist/core/tools.js +1 -1
  115. package/dist/core/wiring-manifest.d.ts +66 -12
  116. package/dist/core/wiring-manifest.js +37 -1
  117. package/dist/engine/harness/messages.d.ts +1 -1
  118. package/dist/engine/harness/messages.js +2 -1
  119. package/dist/engine/loop/types.d.ts +2 -0
  120. package/dist/engine/session/session.js +1 -1
  121. package/dist/index.d.ts +11 -7
  122. package/dist/index.js +9 -6
  123. package/dist/orchestration/workflow.js +2 -1
  124. package/dist/stores/file/adoption/marker.d.ts +2 -27
  125. package/dist/stores/file/adoption/marker.js +12 -0
  126. package/dist/stores/file/index.d.ts +1 -1
  127. package/dist/stores/file/index.js +1 -1
  128. package/dist/tools/artifact/artifact-tool.js +11 -6
  129. package/dist/tools/fs/file-read-check.d.ts +45 -11
  130. package/dist/tools/fs/file-read-check.js +200 -57
  131. package/dist/tools/fs/judged-reads.d.ts +51 -0
  132. package/dist/tools/fs/judged-reads.js +68 -0
  133. package/dist/tools/fs/safety.d.ts +8 -0
  134. package/dist/tools/fs/safety.js +12 -1
  135. package/dist/tools/fs/shell-read-check.d.ts +16 -3
  136. package/dist/tools/fs/shell-read-check.js +4 -1
  137. package/dist/tools/fs/shell-read-establish.js +13 -3
  138. package/dist/tools/scheduler-store-move.d.ts +74 -0
  139. package/dist/tools/scheduler-store-move.js +103 -0
  140. package/dist/tools/scheduler-tools.d.ts +43 -29
  141. package/dist/tools/scheduler-tools.js +161 -118
  142. package/package.json +2 -2
  143. package/test/export-surface.snapshot.json +47 -3
  144. package/wire-changes/answers/core-stores-sql@7.72.0.json +12 -0
  145. package/wire-changes/answers/core@7.72.0.json +84 -0
  146. package/wire-changes/answers/mods-kernel@7.72.0.json +7 -0
  147. package/wire-changes/answers/primitives@7.72.0.json +6 -0
  148. package/wire-changes/answers/wiki-gate@7.72.0.json +7 -0
  149. package/wire-changes/core-stores-sql@7.71.1.json +40 -0
  150. package/wire-changes/core-stores-sql@7.72.0.json +215 -0
  151. package/wire-changes/core@7.71.1.json +118 -0
  152. package/wire-changes/core@7.72.0.json +2426 -0
  153. package/wire-changes/mods-kernel@7.71.1.json +40 -0
  154. package/wire-changes/mods-kernel@7.72.0.json +147 -0
  155. package/wire-changes/primitives@7.71.1.json +40 -0
  156. package/wire-changes/primitives@7.72.0.json +143 -0
  157. package/wire-changes/wiki-gate@7.71.1.json +40 -0
  158. package/wire-changes/wiki-gate@7.72.0.json +145 -0
@@ -1,5 +1,5 @@
1
1
  import { anchorSpelling, canonicalizeTarget, familyFor, hasWin32AliasedComponent, isAbsoluteForFamily, normalizeAbsPathLexically, pathFamilyOf, pathIdentityOf, spellingOfIdentity, win32NamespaceScreen } from "../tools/fs/safety.js";
2
- import { declaredPathTargetOf, pathTargetValue, protectivePathTargetOf } from "./tool-registry.js";
2
+ import { declaredPathTargetOf, declaredReadValuesOf, pathTargetValue, protectivePathTargetOf } from "./tool-registry.js";
3
3
  import { leafChainMayHold, symlinkChainHops } from "./path-identity.js";
4
4
  import { DEFAULT_GATE_AWAIT_TIMEOUT_MS, withGateTimeout } from "./gate-bounded-await.js";
5
5
  import { thrownText } from "./thrown-value.js";
@@ -33,25 +33,14 @@ export function splitAbsoluteGlobPattern(pattern, tree) {
33
33
  }
34
34
  export function effectivePathTargetOf(call, pt, bases) {
35
35
  const spelling = effectivePathSpellingOf(call, pt, bases);
36
- if (spelling === undefined)
37
- return undefined;
38
- if ("refused" in spelling)
39
- return { kind: "refused", reason: spelling.refused };
40
- if (spelling.spelled !== undefined)
41
- return placeSpelling(spelling.spelled, spelling.base, bases);
42
- return spelling.base !== undefined && isAbsoluteForFamily(readingFamilyOf(bases, spelling.base), spelling.base) ? placeSpelling(spelling.base, undefined, bases) : unreadableBase(spelling.base);
36
+ return spelling === undefined ? undefined : selectionTargetOf(spelling, bases);
43
37
  }
44
- export function effectivePathSpellingOf(call, pt, bases) {
45
- if (pt === undefined)
46
- return undefined;
38
+ function absentPathSpellingOf(args, pt, bases) {
47
39
  const declaredBase = pathTargetBaseOf(pt, bases);
48
- const spelled = pathTargetValue(call.args, pt);
49
- if (spelled !== undefined)
50
- return { spelled, base: declaredBase };
51
40
  if (pathTargetResolutionOf(pt).absent === "none")
52
41
  return undefined;
53
42
  if (pt.patternParam !== undefined) {
54
- const pattern = pathTargetValue(call.args, { param: pt.patternParam });
43
+ const pattern = pathTargetValue(args, { param: pt.patternParam });
55
44
  const split = pattern === undefined ? undefined : splitAbsoluteGlobPattern(pattern, pathFamilyOf(bases));
56
45
  if (split !== undefined && "refused" in split)
57
46
  return { refused: split.refused };
@@ -60,6 +49,38 @@ export function effectivePathSpellingOf(call, pt, bases) {
60
49
  }
61
50
  return { base: declaredBase };
62
51
  }
52
+ export function effectivePathSpellingOf(call, pt, bases) {
53
+ if (pt === undefined)
54
+ return undefined;
55
+ const spelled = pathTargetValue(call.args, pt);
56
+ if (spelled !== undefined)
57
+ return { spelled, base: pathTargetBaseOf(pt, bases) };
58
+ return absentPathSpellingOf(call.args, pt, bases);
59
+ }
60
+ export function effectivePathSpellingsOf(call, pt, bases) {
61
+ if (pt === undefined)
62
+ return undefined;
63
+ const declared = declaredReadValuesOf(call);
64
+ if (declared === undefined) {
65
+ const one = effectivePathSpellingOf(call, pt, bases);
66
+ return one === undefined ? undefined : [one];
67
+ }
68
+ if (!declared.present) {
69
+ const absent = absentPathSpellingOf(call.args, declared.slot, bases);
70
+ return absent === undefined ? undefined : [absent];
71
+ }
72
+ const declaredBase = pathTargetBaseOf(declared.slot, bases);
73
+ return declared.values.map((el) => (typeof el === "string" && el.length > 0 ? { spelled: el, base: declaredBase } : { malformed: true }));
74
+ }
75
+ function selectionTargetOf(sel, bases) {
76
+ if ("malformed" in sel)
77
+ return { kind: "unreadable", reason: MALFORMED_ELEMENT };
78
+ if ("refused" in sel)
79
+ return { kind: "refused", reason: sel.refused };
80
+ if (sel.spelled !== undefined)
81
+ return placeSpelling(sel.spelled, sel.base, bases);
82
+ return sel.base !== undefined && isAbsoluteForFamily(readingFamilyOf(bases, sel.base), sel.base) ? placeSpelling(sel.base, undefined, bases) : unreadableBase(sel.base);
83
+ }
63
84
  export function placeSpelling(spelled, declaredBase, bases) {
64
85
  const family = readingFamilyOf(bases, spelled);
65
86
  const screened = win32NamespaceScreen(spelled, family);
@@ -121,10 +142,16 @@ const REREAD = new WeakMap();
121
142
  export async function readCallTarget(env, call, signal, leads) {
122
143
  const bases = { ...(call.root !== undefined ? { root: call.root } : {}), ...(call.cwd !== undefined ? { cwd: call.cwd } : {}) };
123
144
  const views = new Map();
124
- const viewOf = (pt) => {
125
- const sel = effectivePathSpellingOf(call, pt, bases);
126
- if (sel === undefined)
127
- return Promise.resolve(undefined);
145
+ const viewsOf = async (pt) => {
146
+ const sels = effectivePathSpellingsOf(call, pt, bases);
147
+ if (sels === undefined)
148
+ return undefined;
149
+ const read = await Promise.all(sels.map(viewOf));
150
+ return read.filter((v) => v !== undefined);
151
+ };
152
+ const viewOf = (sel) => {
153
+ if ("malformed" in sel)
154
+ return Promise.resolve({ kind: "unreadable", reason: MALFORMED_ELEMENT });
128
155
  if ("refused" in sel)
129
156
  return Promise.resolve({ kind: "refused", reason: sel.refused });
130
157
  const target = sel.spelled !== undefined ? { spelled: sel.spelled, base: sel.base } : sel.base !== undefined && isAbsoluteForFamily(readingFamilyOf(bases, sel.base), sel.base) ? { spelled: sel.base, base: undefined } : undefined;
@@ -141,10 +168,16 @@ export async function readCallTarget(env, call, signal, leads) {
141
168
  views.set(key, read);
142
169
  return read;
143
170
  };
144
- const protective = await viewOf(protectivePathTargetOf(call));
145
- const declared = call.face === undefined ? undefined : await viewOf(declaredPathTargetOf(call));
171
+ const protectivePt = protectivePathTargetOf(call);
172
+ const declaredPt = call.face === undefined ? undefined : declaredPathTargetOf(call);
173
+ const protectiveAll = await viewsOf(protectivePt);
174
+ const declaredAll = declaredPt === undefined ? undefined : declaredPt === protectivePt ? protectiveAll : await viewsOf(declaredPt);
175
+ const several = protectivePt?.each === true || declaredPt?.each === true || (protectiveAll !== undefined && protectiveAll.length !== 1) || (declaredAll !== undefined && declaredAll.length !== 1);
176
+ const protective = several ? undefined : protectiveAll?.[0];
177
+ const declared = several ? undefined : declaredAll?.[0];
178
+ const each = several ? Object.freeze({ ...(protectiveAll !== undefined ? { protective: Object.freeze([...protectiveAll]) } : {}), ...(declaredAll !== undefined ? { declared: Object.freeze([...declaredAll]) } : {}) }) : undefined;
146
179
  const led = leads === undefined ? undefined : [...leads].filter((e) => e[1] !== undefined && e[1] !== e[0]);
147
- const reading = Object.freeze({ ...(protective !== undefined ? { protective } : {}), ...(declared !== undefined ? { declared } : {}), ...(led !== undefined && led.length > 0 ? { leads: new Map(led) } : {}) });
180
+ const reading = Object.freeze({ ...(protective !== undefined ? { protective } : {}), ...(declared !== undefined ? { declared } : {}), ...(each !== undefined ? { each } : {}), ...(led !== undefined && led.length > 0 ? { leads: new Map(led) } : {}) });
148
181
  if (typeof call.args === "object" && call.args !== null)
149
182
  READ_FOR.set(reading, call.args);
150
183
  REREAD.set(reading, (args, rereadSignal) => readCallTarget(env, { ...call, args }, rereadSignal, leads));
@@ -197,24 +230,36 @@ export function callTargetReadingOf(req) {
197
230
  export function callTargetViewsOf(req, direction, bare = {}) {
198
231
  const reading = callTargetReadingOf(req);
199
232
  if (reading !== undefined) {
200
- const v = direction === "tighten" ? reading.protective : reading.declared;
201
- if (v === undefined || v.kind === "refused")
202
- return undefined;
203
- if (v.kind === "unreadable")
204
- return { views: [], unreadable: v.reason };
205
- if (direction === "allow" && (v.canonical === undefined || v.unread === true))
206
- return { views: [], unreadable: ALLOW_UNRESOLVED };
207
- const views = [{ path: v.lexical, kind: "lexical" }];
208
- const seen = (p) => views.some((w) => w.path === p);
209
- if (v.canonical !== undefined && !seen(v.canonical))
210
- views.push({ path: v.canonical, kind: "canonical" });
211
- for (const hop of v.hops ?? [])
212
- if (!seen(hop))
213
- views.push({ path: hop, kind: "hop" });
214
- return { views };
233
+ const several = direction === "tighten" ? reading.each?.protective : reading.each?.declared;
234
+ if (several !== undefined)
235
+ return everyTarget(several.map((v) => viewsOfOne(v, direction)));
236
+ return viewsOfOne(direction === "tighten" ? reading.protective : reading.declared, direction);
215
237
  }
216
238
  const own = req.root !== undefined || req.cwd !== undefined ? { ...(req.root !== undefined ? { root: req.root } : {}), ...(req.cwd !== undefined ? { cwd: req.cwd } : {}) } : bare;
217
- const target = effectivePathTargetOf(req, direction === "tighten" ? protectivePathTargetOf(req) : declaredPathTargetOf(req), own);
239
+ const pt = direction === "tighten" ? protectivePathTargetOf(req) : declaredPathTargetOf(req);
240
+ const sels = effectivePathSpellingsOf(req, pt, own);
241
+ if (sels === undefined)
242
+ return undefined;
243
+ return everyTarget(sels.map((sel) => lexicalViewsOf(selectionTargetOf(sel, own), direction)));
244
+ }
245
+ const MALFORMED_ELEMENT = "an element of the call's path list is not a path";
246
+ function viewsOfOne(v, direction) {
247
+ if (v === undefined || v.kind === "refused")
248
+ return undefined;
249
+ if (v.kind === "unreadable")
250
+ return { views: [], unreadable: v.reason };
251
+ if (direction === "allow" && (v.canonical === undefined || v.unread === true))
252
+ return { views: [], unreadable: ALLOW_UNRESOLVED };
253
+ const views = [{ path: v.lexical, kind: "lexical" }];
254
+ const seen = (p) => views.some((w) => w.path === p);
255
+ if (v.canonical !== undefined && !seen(v.canonical))
256
+ views.push({ path: v.canonical, kind: "canonical" });
257
+ for (const hop of v.hops ?? [])
258
+ if (!seen(hop))
259
+ views.push({ path: hop, kind: "hop" });
260
+ return { views };
261
+ }
262
+ function lexicalViewsOf(target, direction) {
218
263
  if (target === undefined || target.kind === "refused")
219
264
  return undefined;
220
265
  if (target.kind === "unreadable")
@@ -223,6 +268,18 @@ export function callTargetViewsOf(req, direction, bare = {}) {
223
268
  return { views: [], unreadable: ALLOW_UNRESOLVED };
224
269
  return { views: [{ path: spellingOfIdentity(target.identity, target.family), kind: "lexical" }] };
225
270
  }
271
+ function everyTarget(each) {
272
+ const named = each.filter((t) => t !== undefined);
273
+ if (named.length === 0)
274
+ return undefined;
275
+ const views = [];
276
+ for (const t of named)
277
+ for (const v of t.views)
278
+ if (!views.some((w) => w.path === v.path && w.kind === v.kind))
279
+ views.push(v);
280
+ const unreadable = named.find((t) => t.unreadable !== undefined)?.unreadable;
281
+ return { views, ...(unreadable !== undefined ? { unreadable } : {}) };
282
+ }
226
283
  const ALLOW_UNRESOLVED = "where the target resolves was not read, so no allow by path can speak for it";
227
284
  export function stampedCallOf(given, answer) {
228
285
  const same = (a, b) => a === b || ((d) => d !== undefined && d === exactBoundInputHashOf(given.toolName, b))(exactBoundInputHashOf(given.toolName, a));
@@ -57,7 +57,7 @@ export interface EngineNotice {
57
57
  * `tool_end.structured`; once per leg per type; `detail: { type, sessionId, runId }`.
58
58
  * - `"config.tool_face_undeclared"` / `"config.tool_face_invalid"` (design/388 §2.7) — an MCP server's
59
59
  * `toolFaces` overlay names a tool the listing does not carry / does not fit the tool's materialized
60
- * schema (the tool mounts bare); once per leg per tool; `detail: { server, tool, problem?, sessionId, runId }`.
60
+ * schema (the tool is not mounted until the overlay fits); once per leg per tool; `detail: { server, tool, problem?, sessionId, runId }`.
61
61
  * - `"agents.listing_truncated"` — the agent-type roster frame did not fit the same listing budget:
62
62
  * at least one type is listed name-only (`nameOnly`) or not at all (`dropped`). Audience `operator`.
63
63
  * `detail: { budgetBytes, total, kept, nameOnly: [name], dropped: [name], sessionId }`; the same
@@ -1452,6 +1452,9 @@ export interface EngineNotice {
1452
1452
  * seat is inert for the run (no ListAgents, peer addresses refuse with the same reason). Once per
1453
1453
  * prepared leg; `detail: { reason, code, mailboxWired, sessionId, runId }`. Audience `"operator"`
1454
1454
  * (a wiring fact; the fix is the deployment's).
1455
+ * - `"config.scheduler_store_unmoved"` — the env's scheduler backend declares `supported: true` but not
1456
+ * `schedulerCapabilities.scopeKeys: "lane"`: no scheduler tool mounts. Once per declared value per sink;
1457
+ * `detail: { declared }`. Audience `"operator"`.
1455
1458
  * - `"peer.inbound_disposition"` (design/385 §1.2④ / §4.6 / §4.4) — a message parked in THIS
1456
1459
  * session's own box was settled at the drain WITHOUT reaching the model. `detail.disposition` is
1457
1460
  * the arm (closed set `PeerInboundDisposition`): `"refused"` (this session's `crossSessionInbound`
@@ -1 +1 @@
1
- export const ENGINE_VERSION = "7.71.0";
1
+ export const ENGINE_VERSION = "7.72.0";
@@ -65,7 +65,10 @@ export type FileHistoryRefusalClass = (typeof FILE_HISTORY_REFUSAL_CLASSES)[numb
65
65
  * handed (the session's earlier leg worked there, or this fork's source did; that directory may since have been deleted), and
66
66
  * the file there no longer holds it: this rewind neither writes nor deletes it there nor at its own root ({@link
67
67
  * applyFileRestoreViaEnv}); a rewind handed the root it was recorded under (its old root: `place` with its key's directory
68
- * segments taken off) restores it. Its `place` is the file's own directory.
68
+ * segments taken off) restores it. Also, when the session being rewound is a fork (its row carries `forkedFrom` other than its
69
+ * own id), every file whose real path lies outside the rewind's root is left as it is under this class — neither written,
70
+ * deleted nor re-moded — whether inherited from its source or edited by the fork itself, so a person can restore it by hand or
71
+ * from the source session. Its `place` is the file's own directory.
69
72
  * A row is listed only when the restore moved nothing in what it speaks for — a `recorded_outside_root` row the part of its old
70
73
  * root outside the rewind's own root (no file there is written, deleted or re-moded by the same restore, under any key), a
71
74
  * `frozen_history` row its file, which no key of the same restore writes, deletes or re-modes (another key that would is held
@@ -1530,9 +1533,10 @@ export type RestoreHolds = ReadonlyMap<string, {
1530
1533
  readonly frozenKeys: readonly string[];
1531
1534
  }>;
1532
1535
  /** A view of `env` that performs every call and records the mutations a restore made through it; it holds the files `holds` names
1533
- * (a plan's, {@link FileHistoryRestorePlan.holds}) and refuses a file the plan read otherwise (`planned`, its
1534
- * {@link FileHistoryRestorePlan.states}), so the restore performs what its plan planned. */
1535
- export declare function witnessEnvOf(env: ExecutionEnv, holds?: RestoreHolds, planned?: ReadonlyMap<string, string>): {
1536
+ * (a plan's, {@link FileHistoryRestorePlan.holds}), refuses a file the plan read otherwise (`planned`, its
1537
+ * {@link FileHistoryRestorePlan.states}), and when `leaveOutsideRoot` is given (a forked session's rewind root) leaves every file
1538
+ * outside that root as it is and refuses unplaced mutations. */
1539
+ export declare function witnessEnvOf(env: ExecutionEnv, holds?: RestoreHolds, planned?: ReadonlyMap<string, string>, leaveOutsideRoot?: string): {
1536
1540
  env: ExecutionEnv;
1537
1541
  } & RestoreSeen;
1538
1542
  /** A restore as the engine answers it: its rows, each stating `outsideRoot`. */
@@ -1582,6 +1586,9 @@ export interface FileHistoryRestorePlan {
1582
1586
  * not read (the store converged a file another way, or through an env it wrapped): which file such a write lands on cannot be
1583
1587
  * told, so it cannot be held — a seat refuses the whole restore before any file moves. Absent otherwise. */
1584
1588
  readonly unheld?: readonly string[];
1589
+ /** True when the plan is for a forked session (`forkedSession`) and asked a mutation whose real path the shared restore half did
1590
+ * not read: where such a write lands cannot be told, so a seat refuses the whole restore before any file moves. Absent otherwise. */
1591
+ readonly unplacedForFork?: true;
1585
1592
  /** The plan's mutations one by one, in the order the restore asked them, with what the preview's arithmetic read of each: a
1586
1593
  * write's or a delete's current file (`current`: {@link FileHistoryPlannedCurrent}, `undefined` when it could not be read — no
1587
1594
  * lines then) and its lines (current → target; `diffStats`' `insertions` / `deletions` are their sums); a change of mode alone
@@ -1631,6 +1638,10 @@ export declare function planFileHistoryRestore(store: Pick<FileHistoryStore, "re
1631
1638
  signal?: AbortSignal;
1632
1639
  /** The rewind's options as the request states them: the word {@link UNPLACED_AT_REWIND_ROOT} is read as `root` here ({@link restoreOptionsAt}). */
1633
1640
  options?: FileHistoryRestoreOptions;
1641
+ /** Whether the session being rewound has a provenance (its row carries `forkedFrom`, other than its own id): when `true`, a
1642
+ * rewind neither writes, deletes nor re-modes any file whose real path lies outside `root` — each such file is left as it is
1643
+ * (`leftAsIs`, class `recorded_outside_root`) and an unplaced mutation is refused. Absent = `false`. */
1644
+ forkedSession?: boolean;
1634
1645
  /** Called once for each planned write (with the bytes it would write) or delete (`target` null) whose current file the arithmetic
1635
1646
  * read (`current` null: none there), in the order the restore asked them, while the plan holds those bytes — it keeps none after. */
1636
1647
  readCurrent?: (at: string, current: Uint8Array | null, target: Uint8Array | null) => void;
@@ -550,8 +550,10 @@ export async function applyFileRestoreViaEnv(env, absPath, target, opts) {
550
550
  return { outcome: "left", left: guard.left };
551
551
  if ("convergedAtItsPlace" in guard)
552
552
  return { outcome: "identical" };
553
- const hold = noteRealPath(env, absPath, joinUnder(guard.place, lastSegmentOf(absPath)));
554
- const refuseHeld = (action, reason) => ({ outcome: "refused", reason, class: "link_safety", action });
553
+ const verdict = await noteRealPath(env, absPath, joinUnder(guard.place, lastSegmentOf(absPath)), signal);
554
+ if (signal?.aborted)
555
+ return { outcome: "failed", reason: "aborted" };
556
+ const decline = (action, v) => v.kind === "left" ? { outcome: "left", left: v.left } : { outcome: "refused", reason: v.claim(), class: "link_safety", action };
555
557
  const cur = await env.readBinaryFile(absPath, signal);
556
558
  const curAbsent = !cur.ok && isAbsence(cur.error.code);
557
559
  const curHash = cur.ok ? createHash("sha256").update(cur.value).digest("hex") : undefined;
@@ -560,8 +562,8 @@ export async function applyFileRestoreViaEnv(env, absPath, target, opts) {
560
562
  if ("absent" in target) {
561
563
  if (curAbsent)
562
564
  return { outcome: "identical" };
563
- if (hold !== undefined)
564
- return refuseHeld("delete", hold());
565
+ if (verdict !== undefined)
566
+ return decline("delete", verdict);
565
567
  if (unplanned)
566
568
  return refuseUnplanned("delete");
567
569
  const rm = await env.remove(absPath, { force: true, ...(signal !== undefined ? { abortSignal: signal } : {}) });
@@ -570,9 +572,9 @@ export async function applyFileRestoreViaEnv(env, absPath, target, opts) {
570
572
  return { outcome: "applied" };
571
573
  }
572
574
  if (curHash !== undefined && curHash === target.hash) {
573
- const modeOnly = await applyRecordedMode(env, absPath, opts, guard.currentMode, hold !== undefined || unplanned);
575
+ const modeOnly = await applyRecordedMode(env, absPath, opts, guard.currentMode, verdict !== undefined || unplanned);
574
576
  if (modeOnly === "held")
575
- return hold !== undefined ? refuseHeld("write", hold()) : refuseUnplanned("write");
577
+ return verdict !== undefined ? decline("write", verdict) : refuseUnplanned("write");
576
578
  if (modeOnly === "unchanged")
577
579
  return { outcome: "identical" };
578
580
  if (modeOnly === "applied")
@@ -581,8 +583,8 @@ export async function applyFileRestoreViaEnv(env, absPath, target, opts) {
581
583
  return { outcome: "applied", modeNotPreserved: true };
582
584
  return { outcome: "identical", modeNotPreserved: true };
583
585
  }
584
- if (hold !== undefined)
585
- return refuseHeld("write", hold());
586
+ if (verdict !== undefined)
587
+ return decline("write", verdict);
586
588
  if (unplanned)
587
589
  return refuseUnplanned("write");
588
590
  const w = await writeRestoredBytes(env, absPath, target.bytes, signal);
@@ -1365,13 +1367,15 @@ function holdsOf(leftAsIs, targetOf) {
1365
1367
  function heldWriteReason(file, frozenKeys) {
1366
1368
  return `not restored: this file (${file}) also has a history an earlier version recorded through a link (${frozenKeys.join(", ")}: frozen), and a rewind writes or deletes such a file under no key — the version this key holds may not be this turn's; neither key wrote or deleted it, so it stays as it is; restore it by hand if it must be`;
1367
1369
  }
1370
+ const FORK_OUTSIDE_ROOT_LEFT_REASON = "this session was forked from another, and a fork's rewind leaves every file outside its root as it is — neither written nor deleted — it is listed here so you can restore it by hand or from the source session";
1371
+ const FORK_ROOT_UNREADABLE_REASON = "not restored: this session was forked from another, and the rewind root's real path could not be read, so whether this file lies inside the fork's root cannot be told — it was neither written nor deleted; to restore it, check that the rewind root still exists and can be reached, then rewind again — or restore the file by hand";
1368
1372
  const REAL_PATH_SEAT = Symbol("file-history restore: the real path of a mutation");
1369
- function noteRealPath(env, at, real) {
1373
+ async function noteRealPath(env, at, real, signal) {
1370
1374
  const seat = Reflect.get(env, REAL_PATH_SEAT);
1371
1375
  if (typeof seat !== "function")
1372
1376
  return undefined;
1373
- const hold = Reflect.apply(seat, undefined, [at, real]);
1374
- return typeof hold === "function" ? hold : undefined;
1377
+ const verdict = await Reflect.apply(seat, undefined, [at, real, signal]);
1378
+ return verdict !== null && typeof verdict === "object" && "kind" in verdict ? verdict : undefined;
1375
1379
  }
1376
1380
  const PLANNED_STATE_SEAT = Symbol("file-history restore: the state a plan read");
1377
1381
  function notePlannedState(env, at, state) {
@@ -1381,13 +1385,15 @@ function notePlannedState(env, at, state) {
1381
1385
  const CHANGED_SINCE_PLAN_REASON = "not restored: this file is not as the rewind's plan read it a moment before (another writer changed or removed it in between, or the version to restore is another), so it was neither written nor deleted — what is there now stays; rewind again (a preview first) to restore it as it now stands";
1382
1386
  const PLAN_READS = new Set(["absolutePath", "joinPath", "readTextFile", "readTextLines", "readBinaryFile", "fileInfo", "listDir", "canonicalPath", "readLink", "canonicalChain", "fileIdentity", "openBound", "exists"]);
1383
1387
  const PLAN_MUTATIONS = { writeFile: "write", writeFileGuarded: "write", writeFileExclusive: "write", appendFile: "write", remove: "delete", setFileMode: "mode", createDir: "none" };
1384
- function envViewOf(env, perform, holds, planned) {
1388
+ function envViewOf(env, perform, holds, planned, leaveOutsideRoot) {
1385
1389
  const mutations = [];
1386
1390
  const held = [];
1387
1391
  const reals = new Map();
1388
1392
  const asked = { issued: 0, done: 0 };
1389
1393
  const states = new Map();
1390
1394
  const occurrences = new Map();
1395
+ let rootRealPromise;
1396
+ const realRoot = (signal) => (rootRealPromise ??= placeOfDirViaEnv(env, leaveOutsideRoot, signal));
1391
1397
  const view = new Proxy(env, {
1392
1398
  get(target, prop, receiver) {
1393
1399
  if (prop === PLANNED_STATE_SEAT) {
@@ -1408,15 +1414,29 @@ function envViewOf(env, perform, holds, planned) {
1408
1414
  };
1409
1415
  }
1410
1416
  if (prop === REAL_PATH_SEAT) {
1411
- return (at, real) => {
1417
+ return async (at, real, signal) => {
1418
+ if (leaveOutsideRoot !== undefined) {
1419
+ if (signal?.aborted)
1420
+ return undefined;
1421
+ const rootReal = await realRoot(signal);
1422
+ if (rootReal === undefined)
1423
+ return { kind: "refuse", claim: () => FORK_ROOT_UNREADABLE_REASON };
1424
+ const place = parentDirOf(real) ?? real;
1425
+ if (outsideRootOf(rootReal, place)) {
1426
+ return { kind: "left", left: { class: "recorded_outside_root", place, reason: FORK_OUTSIDE_ROOT_LEFT_REASON } };
1427
+ }
1428
+ }
1412
1429
  const hold = holds?.get(foldedFile(real));
1413
1430
  if (hold === undefined) {
1414
1431
  reals.set(at, real);
1415
1432
  return undefined;
1416
1433
  }
1417
- return () => {
1418
- held.push({ at, real, file: hold.file });
1419
- return heldWriteReason(hold.file, hold.frozenKeys);
1434
+ return {
1435
+ kind: "refuse",
1436
+ claim: () => {
1437
+ held.push({ at, real, file: hold.file });
1438
+ return heldWriteReason(hold.file, hold.frozenKeys);
1439
+ },
1420
1440
  };
1421
1441
  };
1422
1442
  }
@@ -1438,8 +1458,14 @@ function envViewOf(env, perform, holds, planned) {
1438
1458
  note();
1439
1459
  return Promise.resolve({ ok: true, value: undefined });
1440
1460
  }
1441
- if (kind !== "none" && holds !== undefined && holds.size > 0 && typeof at === "string" && !reals.has(at)) {
1442
- return Promise.resolve({ ok: false, error: { code: "precondition_failed", message: `a rewind that holds files a frozen history names performs no write it cannot place, and this one (${at}) did not state where it lands` } });
1461
+ const hasHolds = holds !== undefined && holds.size > 0;
1462
+ if (kind !== "none" && (leaveOutsideRoot !== undefined || hasHolds) && typeof at === "string" && !reals.has(at)) {
1463
+ const why = hasHolds && leaveOutsideRoot !== undefined
1464
+ ? "belongs to a forked session (leaving every file outside its root as it is) and holds files a frozen history names"
1465
+ : hasHolds
1466
+ ? "holds files a frozen history names"
1467
+ : "belongs to a forked session and leaves every file outside its root as it is";
1468
+ return Promise.resolve({ ok: false, error: { code: "precondition_failed", message: `a rewind that ${why} performs no write it cannot place, and this one (${at}) did not state where it lands` } });
1443
1469
  }
1444
1470
  asked.issued++;
1445
1471
  return Promise.resolve(fn.apply(target, args)).then((r) => {
@@ -1467,8 +1493,8 @@ function envViewOf(env, perform, holds, planned) {
1467
1493
  });
1468
1494
  return { env: view, mutations, held, told: reals, asked, states };
1469
1495
  }
1470
- export function witnessEnvOf(env, holds, planned) {
1471
- return envViewOf(env, true, holds, planned);
1496
+ export function witnessEnvOf(env, holds, planned, leaveOutsideRoot) {
1497
+ return envViewOf(env, true, holds, planned, leaveOutsideRoot);
1472
1498
  }
1473
1499
  function oldRootOf(place, key) {
1474
1500
  const dirs = relativeInEveryFamily(key) ? key.split("/").length - 1 : 0;
@@ -1568,15 +1594,18 @@ export function withRewindFiles(storeAnswer, seen, root) {
1568
1594
  }
1569
1595
  export async function planFileHistoryRestore(store, input) {
1570
1596
  const options = restoreOptionsAt(input.options, input.root);
1597
+ const leaveOutsideRoot = input.forkedSession === true ? input.root : undefined;
1571
1598
  const pass = async (holds) => {
1572
- const planning = envViewOf(input.env, false, holds);
1599
+ const planning = envViewOf(input.env, false, holds, undefined, leaveOutsideRoot);
1573
1600
  const restored = await store.restore(input.scope, input.entryId, planning.env, input.root, input.signal, options);
1574
1601
  return { planning, stored: restored, answered: withRewindFiles(restored, planning, input.root) };
1575
1602
  };
1576
1603
  const first = await pass(undefined);
1577
1604
  const holds = holdsOf(first.stored.leftAsIs ?? [], rewindTargetOf(input.root));
1578
- const unread = holds.size > 0 && first.planning.mutations.some((m) => m.real === undefined);
1579
- const reaches = !unread && first.planning.mutations.some((m) => m.real !== undefined && holds.has(foldedFile(m.real)));
1605
+ const hasUnplaced = first.planning.mutations.some((m) => m.real === undefined);
1606
+ const unread = holds.size > 0 && hasUnplaced;
1607
+ const unplacedForFork = leaveOutsideRoot !== undefined && hasUnplaced;
1608
+ const reaches = !unread && !unplacedForFork && first.planning.mutations.some((m) => m.real !== undefined && holds.has(foldedFile(m.real)));
1580
1609
  const { planning, answered } = reaches ? await pass(holds) : first;
1581
1610
  let insertions = 0;
1582
1611
  let deletions = 0;
@@ -1614,6 +1643,7 @@ export async function planFileHistoryRestore(store, input) {
1614
1643
  holds,
1615
1644
  states: planning.states,
1616
1645
  ...(unread ? { unheld: [...new Set([...holds.values()].flatMap((h) => h.frozenKeys))].sort() } : {}),
1646
+ ...(unplacedForFork ? { unplacedForFork: true } : {}),
1617
1647
  changes,
1618
1648
  };
1619
1649
  }
@@ -286,8 +286,9 @@ function applyStationDisposition(pass, reading, toolName, shellGated) {
286
286
  verdict.admit?.();
287
287
  if (verdict.details !== undefined)
288
288
  pass.shellReadDetails = verdict.details;
289
+ const cause = verdict.cause !== undefined ? normalizeProbeCause(verdict.cause) : undefined;
289
290
  if (pass.decision.action === "ask")
290
- pass.decision = silencedBy(pass.decision, verdict, pass.req);
291
+ pass.decision = silencedBy(cause !== undefined && pass.decision.probeCause === undefined ? { ...pass.decision, probeCause: cause } : pass.decision, verdict, pass.req);
291
292
  if (pass.decision.action === "allow") {
292
293
  const candidate = normalizeReadRootCandidate(verdict.readRootCandidate);
293
294
  pass.decision = silencedBy({
@@ -295,6 +296,7 @@ function applyStationDisposition(pass, reading, toolName, shellGated) {
295
296
  message: shellReadAskMessage(toolName, verdict),
296
297
  decisionReason: "safety",
297
298
  ...(account !== undefined ? { probeReason: account } : {}),
299
+ ...(cause !== undefined ? { probeCause: cause } : {}),
298
300
  ...(candidate !== undefined ? { probeReadRootCandidate: candidate } : {}),
299
301
  }, verdict, pass.req);
300
302
  if (candidate !== undefined)
@@ -180,7 +180,7 @@ export type NoticeAttention = "act" | "inform" | "audit";
180
180
  * the union's catalog ({@link EngineNotice.code}). The groups below say only which family a row joins,
181
181
  * so the catalog is not written a second time here and the two cannot drift.
182
182
  */
183
- export declare const ENGINE_NOTICE_CODES: readonly ["config.autocompact_window_clamped", "config.env_timeout_discarded", "config.materialize_env_discarded", "config.models_swapped", "config.context_settings_swapped", "config.read_face_swapped", "config.read_face_deployment_clamped", "config.write_face_swapped", "config.write_face_deployment_clamped", "config.read_deny_swapped", "config.tool_model_gate_removed", "config.tool_model_gate_unknown_class", "config.tool_model_gate_env_invalid", "config.artifact_host_invalid", "config.task_root_not_canonical", "config.write_protection_target_view_absent", "config.path_view_unresolved", "config.execution_env_capability_invalid", "config.execution_env_failure_contract_broken", "config.read_deny_floor_unkept", "config.read_floor_confinement_unavailable", "config.inherit_env_declared_late", "config.command_sandbox_unavailable", "config.tool_card_undeclared", "config.tool_face_undeclared", "config.tool_face_invalid", "config.host_sink_failed", "config.seat_malformed", "config.session_delete_withheld", "config.env_knob_adjusted", "config.read_deny_home", "config.permission_rules_skipped", "config.process_start_time_unavailable", "config.data_root_spelling_split", "config.durable_gate_unavailable", "config.peer_admission_out_of_range", "config.peer_lane_unmounted", "config.secret_env_scrubbed", "inherit_env.names_withheld", "config.credential_not_withheld", "config.cross_boundary_posture_undeclared", "config.cross_boundary_record_unwritten", "config.permission_mode_unavailable", "permission.rule_store_unavailable", "permission.rule_store_unreadable_relaxed", "config.entries_not_applied", "config.session_rules_earlier_grammar", "config.session_rules_reread", "config.skill_deny_unreadable", "config.legacy_tool_name", "config.toolpolicy.unmatched_names", "config.agent.unknown_tool", "permission.allow_rule_not_used_in_auto", "permission.revival_root_policy_unrestated", "mods.registration_refused", "mods.registration_refused_deployment", "mods.display_withheld", "mods.stop_ended", "mods.stop_continue_dropped", "mods.package_key_unread", "peer.inbound_disposition", "peer.inbound_unread", "peer.notice_user_only", "peer.receipt_delivered_user_only", "peer.held_settled", "peer.held_approval_unhonored", "peer.held_decision_applied", "peer.idle_subscription", "peer.idle_subscription_declined", "classifier.denial_limit", "classifier.fallback", "classifier.seat_rate_limited", "classifier.role_defaulted", "classifier.contract_broken", "classifier.unavailable", "classifier.unavailable_handed_on", "classifier.review_skipped", "checkpoint.execution_outcome_unrecorded", "delegation.transcript_integrity", "delegation.ask_unresolvable", "delegation.resume_lane_missing", "delegation.spawn_depth_unknown", "delegation.delivery_discarded", "delegation.settlement_external", "delegation.settlement_write_failed", "delegation.durable_row_unpersisted", "delegation.parked_card_unreadable", "delegation.parked_card_id_untrusted", "delegation.agent_row_ending_unreadable", "protocol.revocation_probe_failed", "mcp.server_redialed", "mcp.authorization_required", "mcp.server_unavailable", "mcp.server_connecting", "mcp.credential_echoed", "a2a.peer_card_drift", "mcp.server_stderr", "workflow.governance_key_stripped", "workflow.agent_option_ignored", "workflow.parked_decision_unused", "workflow.parked_decision_used", "workflow.record_unwritten", "memory.session_polluted", "memory.harvest_quarantined", "memory.harvest_refused", "memory.harvest_conflict", "memory.delegation_static_mark_waived", "memory.content_class_declared", "memory.hold_opened", "memory.hold_released", "memory.hold_disposed", "memory.consolidation_recommended", "memory.consolidation_committed", "memory.consolidation_conflict", "memory.consolidation_incomplete", "memory.consolidation_refused", "memory.consolidation_withheld", "memory.restore_withheld", "memory.project_scope_absent", "memory.notice_unscoped", "route.fallback_to_primary", "route.classifier_unroutable", "route.seat_detached", "advisor.not_attached", "route.credential_origin_mismatch", "route.credential_mismatch", "route.credential_rebound", "route.response_model_mismatch", "route.tool_call_id_folded", "route.finish_reason_unknown", "route.stream_end_ignored", "route.stream_content_dropped", "route.extra_body_reserved_dropped", "model.capability_downgraded", "model.fast_mode_changed", "model.fallback", "model.fallback_side_call", "context.tool_turn_repaired", "context.media_removed", "context.tool_schema_removed", "context.messages_omitted", "instructions.withheld", "instructions.outside_root", "instructions.family_undeclared", "task.user_steer_undrained", "task.user_followup_undrained", "task.undelivered_input_dropped", "steering.parked_input_blocked", "task.turn_interrupted", "task.halt_unconsumed", "mods.turn_aborted", "mods.turn_abort_unconsumed", "task.late_approval", "task.interrupt_unconsumed", "task.wait_ceiling_reached", "task.completed_past_limit", "task.verdict_refused", "task.tool_turn_incomplete", "task.tool_turn_unrecovered", "approval.read_root_granted", "approval.read_root_grant_rejected", "approval.session_call_granted", "approval.session_call_grant_rejected", "approval.approver_defect", "memory.capture_opted_out", "memory.capture_switched_off", "memory.capture_optout_unpersisted", "memory.mount_failed", "skills.listing_truncated", "agents.listing_truncated", "tool_result.offload_put_failed", "tool_result.media_refused", "tool_result.media_persisted", "tool_result.read_refused", "artifact.owner_refused", "config.image_processor_unavailable", "fs.staging_file_left", "fs.staging_file_swept", "store.tail_segment_unjudged", "store.lock_retained", "store.lock_reclaimed_on_declaration", "store.append_log_parked", "store.tree_id_stamp_incomplete", "store.process_anchor_unavailable", "store.process_anchor_lost", "engine.debug_trace", "session.lineage_rerooted", "rewind.boundary_unrecorded", "rewind.file_left_as_is", "verify.verifier_is_implementer", "workspace.sync_failed", "memory.layer_locked_legacy", "server.model_unreachable", "permission.entry_mode_clamped", "model.context_window_assumed", "config.store_ephemeral", "memory.sync_layer_parked"];
183
+ export declare const ENGINE_NOTICE_CODES: readonly ["config.autocompact_window_clamped", "config.env_timeout_discarded", "config.materialize_env_discarded", "config.models_swapped", "config.context_settings_swapped", "config.read_face_swapped", "config.read_face_deployment_clamped", "config.write_face_swapped", "config.write_face_deployment_clamped", "config.read_deny_swapped", "config.tool_model_gate_removed", "config.tool_model_gate_unknown_class", "config.tool_model_gate_env_invalid", "config.artifact_host_invalid", "config.task_root_not_canonical", "config.write_protection_target_view_absent", "config.path_view_unresolved", "config.execution_env_capability_invalid", "config.execution_env_failure_contract_broken", "config.read_deny_floor_unkept", "config.read_floor_confinement_unavailable", "config.inherit_env_declared_late", "config.command_sandbox_unavailable", "config.tool_card_undeclared", "config.tool_face_undeclared", "config.tool_face_invalid", "config.host_sink_failed", "config.seat_malformed", "config.session_delete_withheld", "config.env_knob_adjusted", "config.read_deny_home", "config.permission_rules_skipped", "config.process_start_time_unavailable", "config.data_root_spelling_split", "config.durable_gate_unavailable", "config.peer_admission_out_of_range", "config.peer_lane_unmounted", "config.scheduler_store_unmoved", "config.secret_env_scrubbed", "inherit_env.names_withheld", "config.credential_not_withheld", "config.cross_boundary_posture_undeclared", "config.cross_boundary_record_unwritten", "config.permission_mode_unavailable", "permission.rule_store_unavailable", "permission.rule_store_unreadable_relaxed", "config.entries_not_applied", "config.session_rules_earlier_grammar", "config.session_rules_reread", "config.skill_deny_unreadable", "config.legacy_tool_name", "config.toolpolicy.unmatched_names", "config.agent.unknown_tool", "permission.allow_rule_not_used_in_auto", "permission.revival_root_policy_unrestated", "mods.registration_refused", "mods.registration_refused_deployment", "mods.display_withheld", "mods.stop_ended", "mods.stop_continue_dropped", "mods.package_key_unread", "peer.inbound_disposition", "peer.inbound_unread", "peer.notice_user_only", "peer.receipt_delivered_user_only", "peer.held_settled", "peer.held_approval_unhonored", "peer.held_decision_applied", "peer.idle_subscription", "peer.idle_subscription_declined", "classifier.denial_limit", "classifier.fallback", "classifier.seat_rate_limited", "classifier.role_defaulted", "classifier.contract_broken", "classifier.unavailable", "classifier.unavailable_handed_on", "classifier.review_skipped", "checkpoint.execution_outcome_unrecorded", "delegation.transcript_integrity", "delegation.ask_unresolvable", "delegation.resume_lane_missing", "delegation.spawn_depth_unknown", "delegation.delivery_discarded", "delegation.settlement_external", "delegation.settlement_write_failed", "delegation.durable_row_unpersisted", "delegation.parked_card_unreadable", "delegation.parked_card_id_untrusted", "delegation.agent_row_ending_unreadable", "protocol.revocation_probe_failed", "mcp.server_redialed", "mcp.authorization_required", "mcp.server_unavailable", "mcp.server_connecting", "mcp.credential_echoed", "a2a.peer_card_drift", "mcp.server_stderr", "workflow.governance_key_stripped", "workflow.agent_option_ignored", "workflow.parked_decision_unused", "workflow.parked_decision_used", "workflow.record_unwritten", "memory.session_polluted", "memory.harvest_quarantined", "memory.harvest_refused", "memory.harvest_conflict", "memory.delegation_static_mark_waived", "memory.content_class_declared", "memory.hold_opened", "memory.hold_released", "memory.hold_disposed", "memory.consolidation_recommended", "memory.consolidation_committed", "memory.consolidation_conflict", "memory.consolidation_incomplete", "memory.consolidation_refused", "memory.consolidation_withheld", "memory.restore_withheld", "memory.project_scope_absent", "memory.notice_unscoped", "route.fallback_to_primary", "route.classifier_unroutable", "route.seat_detached", "advisor.not_attached", "route.credential_origin_mismatch", "route.credential_mismatch", "route.credential_rebound", "route.response_model_mismatch", "route.tool_call_id_folded", "route.finish_reason_unknown", "route.stream_end_ignored", "route.stream_content_dropped", "route.extra_body_reserved_dropped", "model.capability_downgraded", "model.fast_mode_changed", "model.fallback", "model.fallback_side_call", "context.tool_turn_repaired", "context.media_removed", "context.tool_schema_removed", "context.messages_omitted", "instructions.withheld", "instructions.outside_root", "instructions.family_undeclared", "task.user_steer_undrained", "task.user_followup_undrained", "task.undelivered_input_dropped", "steering.parked_input_blocked", "task.turn_interrupted", "task.halt_unconsumed", "mods.turn_aborted", "mods.turn_abort_unconsumed", "task.late_approval", "task.interrupt_unconsumed", "task.wait_ceiling_reached", "task.completed_past_limit", "task.verdict_refused", "task.tool_turn_incomplete", "task.tool_turn_unrecovered", "approval.read_root_granted", "approval.read_root_grant_rejected", "approval.session_call_granted", "approval.session_call_grant_rejected", "approval.approver_defect", "memory.capture_opted_out", "memory.capture_switched_off", "memory.capture_optout_unpersisted", "memory.mount_failed", "skills.listing_truncated", "agents.listing_truncated", "tool_result.offload_put_failed", "tool_result.media_refused", "tool_result.media_persisted", "tool_result.read_refused", "artifact.owner_refused", "config.image_processor_unavailable", "fs.staging_file_left", "fs.staging_file_swept", "store.tail_segment_unjudged", "store.lock_retained", "store.lock_reclaimed_on_declaration", "store.append_log_parked", "store.tree_id_stamp_incomplete", "store.process_anchor_unavailable", "store.process_anchor_lost", "engine.debug_trace", "session.lineage_rerooted", "rewind.boundary_unrecorded", "rewind.file_left_as_is", "verify.verifier_is_implementer", "workspace.sync_failed", "memory.layer_locked_legacy", "server.model_unreachable", "permission.entry_mode_clamped", "model.context_window_assumed", "config.store_ephemeral", "memory.sync_layer_parked"];
184
184
  /** A catalogued code (see {@link ENGINE_NOTICE_CODES}); {@link NOTICE_MINTER} says who mints it. NOT the type of
185
185
  * `EngineNotice.code`, which stays `string` — a host forwarding its own notices through the same
186
186
  * sink is a supported shape, and narrowing that field would break it. */
@@ -297,6 +297,7 @@ declare const NOTICE_AUDIENCE_TABLE: {
297
297
  readonly "config.tool_face_undeclared": "operator";
298
298
  readonly "config.tool_face_invalid": "operator";
299
299
  readonly "config.peer_lane_unmounted": "operator";
300
+ readonly "config.scheduler_store_unmoved": "operator";
300
301
  readonly "config.peer_admission_out_of_range": "operator";
301
302
  readonly "config.secret_env_scrubbed": "operator";
302
303
  readonly "config.credential_not_withheld": "operator";
@@ -535,6 +536,7 @@ declare const NOTICE_ATTENTION_TABLE: {
535
536
  readonly "config.permission_rules_skipped": "act";
536
537
  readonly "config.peer_admission_out_of_range": "act";
537
538
  readonly "config.peer_lane_unmounted": "act";
539
+ readonly "config.scheduler_store_unmoved": "act";
538
540
  readonly "config.credential_not_withheld": "act";
539
541
  readonly "config.cross_boundary_posture_undeclared": "act";
540
542
  readonly "config.cross_boundary_record_unwritten": "act";
@@ -697,6 +699,7 @@ declare const NOTICE_MINTER_TABLE: {
697
699
  readonly "config.durable_gate_unavailable": "engine";
698
700
  readonly "config.peer_admission_out_of_range": "engine";
699
701
  readonly "config.peer_lane_unmounted": "engine";
702
+ readonly "config.scheduler_store_unmoved": "engine";
700
703
  readonly "config.secret_env_scrubbed": "engine";
701
704
  readonly "inherit_env.names_withheld": "engine";
702
705
  readonly "config.credential_not_withheld": "engine";
@@ -175,6 +175,7 @@ export const ENGINE_NOTICE_CODES = Object.freeze([
175
175
  "config.durable_gate_unavailable",
176
176
  "config.peer_admission_out_of_range",
177
177
  "config.peer_lane_unmounted",
178
+ "config.scheduler_store_unmoved",
178
179
  "config.secret_env_scrubbed",
179
180
  "inherit_env.names_withheld",
180
181
  "config.credential_not_withheld",
@@ -432,6 +433,7 @@ const NOTICE_AUDIENCE_TABLE = {
432
433
  "config.tool_face_undeclared": "operator",
433
434
  "config.tool_face_invalid": "operator",
434
435
  "config.peer_lane_unmounted": "operator",
436
+ "config.scheduler_store_unmoved": "operator",
435
437
  "config.peer_admission_out_of_range": "operator",
436
438
  "config.secret_env_scrubbed": "operator",
437
439
  "config.credential_not_withheld": "operator",
@@ -655,6 +657,7 @@ const NOTICE_ATTENTION_TABLE = {
655
657
  "config.permission_rules_skipped": "act",
656
658
  "config.peer_admission_out_of_range": "act",
657
659
  "config.peer_lane_unmounted": "act",
660
+ "config.scheduler_store_unmoved": "act",
658
661
  "config.credential_not_withheld": "act",
659
662
  "config.cross_boundary_posture_undeclared": "act",
660
663
  "config.cross_boundary_record_unwritten": "act",
@@ -789,6 +792,7 @@ const NOTICE_MINTER_TABLE = {
789
792
  "config.durable_gate_unavailable": "engine",
790
793
  "config.peer_admission_out_of_range": "engine",
791
794
  "config.peer_lane_unmounted": "engine",
795
+ "config.scheduler_store_unmoved": "engine",
792
796
  "config.secret_env_scrubbed": "engine",
793
797
  "inherit_env.names_withheld": "engine",
794
798
  "config.credential_not_withheld": "engine",
@@ -0,0 +1,57 @@
1
+ /**
2
+ * The judged-read port's vocabulary (`ToolExecuteContext.judgedReads`): what a caller tool that declares a read target
3
+ * (`ToolPathTarget`, `access: "read"`) is handed per call by the file read station — the one way it reads a file the model named.
4
+ */
5
+ import type { FileError, FileKind, Result } from "../internal/harness.js";
6
+ /**
7
+ * One target of a caller tool's declared read, as the file read station judged it for this call: the element's spelling, the
8
+ * canonical key the station judged it at, and the one way the tool reads it. The port holds targets only once the station's
9
+ * judgment of the WHOLE call has landed and let it through (no element refused; an outside one only when its question was
10
+ * answered yes); a call whose judgment did not land is `not_judged`. `open`
11
+ * judges the key again with the call's tables (the read-deny table, the roots — a target outside them only when the call's
12
+ * question about it was answered yes — the read face), binds the object there (`openBound`) and judges the key once more, then
13
+ * hands over the HELD object. It never resolves the spelling against a working directory that moved since the judgment. Refusals
14
+ * are results, never throws: `permission_denied` (the judgment refuses), `not_supported` (this environment cannot hold the object —
15
+ * the target is not read by name instead), `precondition_failed` (the key no longer names the object it named), any other code
16
+ * the environment's own answer.
17
+ */
18
+ export interface JudgedRead {
19
+ readonly spelled: string;
20
+ readonly key: string;
21
+ open(signal?: AbortSignal): Promise<Result<JudgedFile, FileError>>;
22
+ }
23
+ /** The object a {@link JudgedRead} holds: every answer is about it or is a refusal. A directory lists only the entries the read-deny
24
+ * table does not withhold (`omitted` counts the withheld ones). The tool closes it. */
25
+ export interface JudgedFile {
26
+ readonly key: string;
27
+ readonly identity: string;
28
+ readonly kind: "file" | "directory";
29
+ size(): Promise<Result<number, FileError>>;
30
+ /** The whole file, never more than `max` bytes (a larger file is refused, `invalid`). */
31
+ readBytes(max: number, signal?: AbortSignal): Promise<Result<Uint8Array, FileError>>;
32
+ list(signal?: AbortSignal): Promise<Result<{
33
+ readonly entries: readonly {
34
+ readonly name: string;
35
+ readonly kind: FileKind;
36
+ }[];
37
+ readonly omitted: number;
38
+ readonly more: number;
39
+ }, FileError>>;
40
+ close(): Promise<void>;
41
+ }
42
+ /**
43
+ * Why a call of a tool that declares a read target has no judged targets (CLOSED set): `no_read_station` — the leg mounts no file read
44
+ * station (a leg with no workspace): nothing on it judges a read the model names; `not_judged` — the leg's station holds no
45
+ * judgment of this whole call that let it through (a call that reached the tool without passing the gate; a judgment that does not answer before
46
+ * the gate's deadline refuses the call, `read_unestablished`, and the tool does not run). Either way the tool reads nothing. The words as a
47
+ * list: `JUDGED_READS_UNAVAILABLE`.
48
+ */
49
+ export type JudgedReadsUnavailable = "no_read_station" | "not_judged";
50
+ /** `ToolExecuteContext.judgedReads`. */
51
+ export type JudgedReads = {
52
+ readonly kind: "judged";
53
+ readonly targets: readonly JudgedRead[];
54
+ } | {
55
+ readonly kind: "unavailable";
56
+ readonly reason: JudgedReadsUnavailable;
57
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -98,6 +98,11 @@ export declare function hostSeatLine(what: string, serverLabel: string, seat: Ho
98
98
  export declare function hostSeatMissing(server: string): Error & {
99
99
  code: string;
100
100
  };
101
+ /** The same refusal as the waker reads it: the woken leg's host-transport servers (`servers`, inherited at its spawn) that this wake hands
102
+ * no seat, so each fails its dial there with {@link hostSeatMissing}. It states only what the wake knows — the server is a host pipe on
103
+ * the woken side and this leg handed no seat for it — never why this leg holds none (it may not declare the server, declare it with
104
+ * another transport, declare it without holding a seat, or run outside a Runner). */
105
+ export declare function hostSeatNotHandedLine(servers: readonly string[]): string;
101
106
  /**
102
107
  * One host row's mount under ONE deadline (the module note): `signal` aborts when `ms` (the row's startup bound; absent, the SDK's own
103
108
  * request default) has passed since the mount began — a `RequestTimeout`, which the dial reads as `timeout` — or when `run` (the run's