@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
@@ -6,8 +6,8 @@
6
6
  * face declares at most one of the two); an
7
7
  * `approvalCard` must find the keys the card needs; a `ruleFace` may only name scalar keys; `family`
8
8
  * must be a member of the closed set; every `resultCards` entry must live under the tool's own card namespace.
9
- * A failing overlay does NOT mount — the tool mounts BARE (no
10
- * face) and the leg announces `config.tool_face_invalid` once per tool; a `toolFaces` key naming a
9
+ * A failing overlay does NOT mount, and neither does its tool (mounted bare it would drop the protection the overlay declares) —
10
+ * the leg announces `config.tool_face_invalid` once per tool; a `toolFaces` key naming a
11
11
  * tool the listing does not carry announces `config.tool_face_undeclared` once per name. Never a
12
12
  * silent partial application: an overlay is one declaration, applied whole or not at all.
13
13
  *
@@ -31,15 +31,6 @@ export interface FaceTool {
31
31
  }
32
32
  /** Why an overlay is refused — a closed reason list, each a distinct declaration mistake. */
33
33
  export declare function toolFaceProblem(face: McpToolFace, schema: AgentTool["parameters"], tool?: FaceTool): string | undefined;
34
- /**
35
- * The one judge of a face. With the tool's materialized `schema` it is {@link toolFaceProblem}: the declaration against the
36
- * schema it rides on. With no schema it is the same judge over the DECLARATION ALONE (`readToolFaces`, `core/tool-face-reader.ts`): every
37
- * check that needs the schema's keys (a path target's `param` / `patternParam`, an approval card's required keys, the names a summary or a
38
- * rule face lists) waits for the listing; the closed words, the bounds and the cross-member rules do not need it and are the same
39
- * checks, in the same order, with the same sentences. A face this judges is a well-typed one (the reader types it first). A tool that
40
- * holds its card namespace (`tool.cardId`) has its `resultCards` held to it here too, so a caller's face and a server's face are
41
- * judged by this one function, not by a rule beside it.
42
- */
43
34
  export declare function faceProblem(face: McpToolFace, schema: AgentTool["parameters"] | undefined, tool?: FaceTool): string | undefined;
44
35
  export interface ApplyToolFacesInput {
45
36
  /** The materialized tools of ONE server (namespaced names). */
@@ -22,6 +22,24 @@ export const APPROVAL_CARD_REQUIRED_KEYS = Object.freeze({
22
22
  export function toolFaceProblem(face, schema, tool) {
23
23
  return faceProblem(face, schema, tool);
24
24
  }
25
+ function schemaPropertyOf(schema, name) {
26
+ const props = schema?.properties;
27
+ return props !== null && typeof props === "object" && Object.hasOwn(props, name) ? props[name] : undefined;
28
+ }
29
+ function schemaTakesOnlyStrings(node) {
30
+ if (node === null || typeof node !== "object")
31
+ return false;
32
+ const s = node;
33
+ const t = s["type"];
34
+ const listOnly = (v, each) => Array.isArray(v) && v.length > 0 && v.every(each);
35
+ return (t === "string" ||
36
+ listOnly(t, (x) => x === "string") ||
37
+ (Array.isArray(s["allOf"]) && s["allOf"].some(schemaTakesOnlyStrings)) ||
38
+ listOnly(s["anyOf"], schemaTakesOnlyStrings) ||
39
+ listOnly(s["oneOf"], schemaTakesOnlyStrings) ||
40
+ typeof s["const"] === "string" ||
41
+ listOnly(s["enum"], (e) => typeof e === "string"));
42
+ }
25
43
  export function faceProblem(face, schema, tool) {
26
44
  const bound = schema === undefined ? undefined : inputKeysOf(schema);
27
45
  const top = bound === undefined ? undefined : new Set(bound.keys.map((k) => k.name));
@@ -59,6 +77,27 @@ export function faceProblem(face, schema, tool) {
59
77
  if (absent !== "base")
60
78
  return `pathTarget.patternParam is declared but pathTarget.absent is ${JSON.stringify(absent ?? "none")} — the pattern base is only ever read for an absent slot, so this declaration would be inert`;
61
79
  }
80
+ const each = face.pathTarget.each;
81
+ if (each !== undefined && typeof each !== "boolean")
82
+ return `pathTarget.each is ${typeof each}, not a boolean (true, or absent)`;
83
+ if (each === true && face.pathTarget.access !== "read")
84
+ return `pathTarget.each needs pathTarget.access "read" — a slot that names several targets is a read's; a write names one file`;
85
+ const slotType = bound?.keys.find((k) => k.name === face.pathTarget.param)?.type;
86
+ if (each === true && slotType !== undefined && slotType !== "array" && slotType !== "mixed")
87
+ return `pathTarget.each is declared but the schema types pathTarget.param as ${slotType}: a slot that names several targets takes a string or a list of strings`;
88
+ if (each !== true && face.pathTarget.access === "read" && schema !== undefined) {
89
+ for (const name of [face.pathTarget.param, ...(face.pathTarget.aliases ?? [])]) {
90
+ const node = schemaPropertyOf(schema, name);
91
+ if (node === undefined || schemaTakesOnlyStrings(node))
92
+ continue;
93
+ const t = bound?.keys.find((k) => k.name === name)?.type;
94
+ if (t === "array")
95
+ return `pathTarget ${callerText(name)} is a list in the tool's schema but pathTarget.each is not declared: the slot would never be read as a target — declare each: true to have every element judged`;
96
+ if (t === "mixed")
97
+ return `pathTarget ${callerText(name)} may carry a value that is not a string in the tool's schema (a union, an untyped slot, or a form this door does not read as strings only) but pathTarget.each is not declared — a read target that names one file takes a string: type it a string, or declare each: true for a string or a list of strings`;
98
+ return `pathTarget ${callerText(name)} is typed ${t ?? "something other than a string"} in the tool's schema, but a read target names a file by a string — type it a string`;
99
+ }
100
+ }
62
101
  const long = overlong("pathTarget.param", [face.pathTarget.param]) ??
63
102
  overlong("pathTarget.aliases", face.pathTarget.aliases ?? []) ??
64
103
  overlong("pathTarget.patternParam", patternParam === undefined ? [] : [patternParam]);
@@ -2,14 +2,19 @@ import { CONTEXT_TRIM_NOTICE, roomShortfallOf } from "../context-guard.js";
2
2
  import { messageRole } from "../message-utils.js";
3
3
  import { isPersonsWordsRow } from "../user-row-origin.js";
4
4
  import { createMessagesOmittedSeat } from "./messages-omitted-seat.js";
5
+ function rowKeyOf(row) {
6
+ if (row === undefined)
7
+ return "";
8
+ const own = row;
9
+ return messageRole(row) === "compactionSummary" && typeof own.entryId === "string" ? `compactionSummary#${own.entryId}` : `${messageRole(row)}:${String(own.timestamp)}`;
10
+ }
5
11
  export function createTrimStretch(ids) {
6
12
  const announce = createMessagesOmittedSeat(ids);
7
13
  let start;
8
14
  let head;
9
15
  return {
10
16
  begin(view) {
11
- const first = view[0];
12
- const key = first !== undefined ? `${messageRole(first)}:${String(first.timestamp)}` : "";
17
+ const key = rowKeyOf(view[0]);
13
18
  if (head !== undefined && key !== head) {
14
19
  start = undefined;
15
20
  announce(0);
@@ -84,12 +84,13 @@ export interface ScheduledIntent {
84
84
  */
85
85
  export interface SchedulerContext {
86
86
  /**
87
- * 越界隔离键(cancel/list 只能操作同 scope 排的)。由 Runner 填,且**按被操作 intent 的 lifetime 分叉**
88
- * (ruled 2026-08-03):`lifetime:"session"` 的意图用会话链(sessionId ?? 隔离格 ?? taskId ?? 匿名工作区,`sessionLaneScopeOf`);
89
- * durable 意图用跨会话稳定身份(`scopeKeyOf`:隔离格,缺则匿名工作区 `ANONYMOUS_SCOPE`)——否则 durable job 会被钉死在排它的那个会话里,
90
- * 后续会话 cancel/list 一律 `not_found`(任务照常触发却再也删不掉)。backend 侧无需分辨腿别:照旧只按
91
- * 收到的 `scope` 隔离即可;**同一 daemon 上两类键共存**,一次 `list` 只回本 scope 的行(工具壳自己并两腿)。
92
- * ⚠️ 部署面:本分叉之前写下的 durable 行仍带旧的会话键,一次性重铸键归 backend 半场,engine 不做迁移。
87
+ * 越界隔离键(cancel/list 只能操作同 scope 排的)= lane 名 + `:` + 主人,由引擎铸(`schedulerLanesOf`):session lane
88
+ * `session:<sessionId>`(会话层任务与唤醒条目);durable lane `durable:<隔离格>`(`scopeKeyOf`:隔离格,缺则匿名工作区,即
89
+ * `durable:default`)——耐久任务活过排它的会话,后续会话照样列得出、停得掉。lane 名不含 `:`,两条 lane 的键永不相等:
90
+ * 某人的主体名恰是另一会话的号时,双方互不可见。backend 侧无需分辨 lane:照旧只按收到的 `scope` 隔离,把它当不透明的串。
91
+ * 7.72.0 之前写下的行是裸键(只有主人):后端用 `migrateSchedulerStore` 把它们放到 lane 键下 —— 整店迁一次(与 `scopeKeys: "lane"`
92
+ * 同一次写落下),或保留盘上形、每次读时在端口换算;回滚用 `rollbackSchedulerStore`;后端没声明 `scopeKeys: "lane"` 时引擎不对它说话
93
+ * (两条路与读时换算的义务见 {@link SchedulerCapability.schedulerCapabilities.scopeKeys})。
93
94
  */
94
95
  scope: string;
95
96
  /** 排程者身份;daemon 触发时原样传给 runTask(防权限抬升)。 */
@@ -192,6 +193,23 @@ export interface SchedulerCapability {
192
193
  * accept refuses the scheduler tools' mount (`config.invalid_argument`). Immutable for the backend's lifetime, like the bits above.
193
194
  */
194
195
  readonly timeZone?: string;
196
+ /**
197
+ * Which keys this backend takes and answers at its port: `"lane"` = the backend takes and answers lane keys at its verbs
198
+ * ({@link SchedulerContext.scope}, `session:<id>` / `durable:<scope>`, 7.72.0 — every row it lists, cancels or fires is filed, as the
199
+ * engine sees it, under exactly one lane key; how the backend keeps its rows is its own business); `"bare"` = it answers keys as a
200
+ * release before 7.72.0 filed them. The engine speaks to a backend only in lane keys, so only `"lane"` mounts the scheduler tools and
201
+ * is read by the host readers — absent, `"bare"` or any other value mounts nothing (the operator is told, `config.scheduler_store_unmoved`,
202
+ * when the seam is otherwise mounted) and the readers answer `unsupported`, before the backend is asked. A backend gets there either by moving its store once (`migrateSchedulerStore`,
203
+ * writing `moved` and the declaration in one write) or by keeping bare keys stored and placing each row at the port on every read with
204
+ * the same function, which answers each row with one lane key or one refusal and nothing more. Such a backend must: hand it the whole store
205
+ * on each read (it sees a shared lane key only among the rows of one call); keep every refused row out of every verb — listed, cancelled,
206
+ * fired — and report it to the operator; store each row written through the port so that it reads back under the lane key it was written
207
+ * with (the intent's `lifetime` / `mode` as written and the key's lane as `lane`; a durable row under its owner as its stored key; a
208
+ * session row with its `sessionId`, under one bare key for every row of that session lane); and declare `"lane"` as its own
209
+ * constant — it then never meets the readers' refusal or the notice, which name the store move. Immutable for the backend's lifetime,
210
+ * like the bits above.
211
+ */
212
+ readonly scopeKeys?: SchedulerScopeKeys;
195
213
  };
196
214
  /**
197
215
  * 持久化一个未来意图。`intent` = 模型可控(无身份);`ctx` = Runner-held 可信上下文(principal/scope/...)。返回不透明
@@ -210,7 +228,29 @@ export interface SchedulerCapability {
210
228
  /** 列**本 scope** 已排意图(self-discovery + 防重复排)。范围 = `ctx.scope`,非全局。 */
211
229
  list(ctx: SchedulerContext): Promise<Result<ScheduledTaskSummary[], SchedulerError>>;
212
230
  }
231
+ /** The two key forms a scheduler backend declares at its port ({@link SchedulerCapability.schedulerCapabilities.scopeKeys}). */
232
+ export type SchedulerScopeKeys = "lane" | "bare";
233
+ /** Whether a scheduler declaration says the backend answers lane keys at its port — the one reading of {@link SchedulerScopeKeys} the engine acts on. */
234
+ export declare function declaresLaneKeys(capabilities: unknown): boolean;
235
+ /** A declared `scopeKeys` as an account names it: a word of {@link SchedulerScopeKeys} as written, any other value as the refusal describer
236
+ * writes it (a host's string is never echoed). */
237
+ export declare function describeScopeKeys(value: unknown): string;
238
+ /**
239
+ * One reading of an env's scheduler declaration — `schedulerCapabilities` read once, the seam's methods judged once: `"none"` (no seam, or
240
+ * one that does not declare `supported: true`), `"unmoved"` (it does, but does not declare `scopeKeys: "lane"`) or `"mounted"`. A leg reads
241
+ * it once and hands the reading to every judge of its own (the mount facts, the tools, the notice), so a backend whose declaration is a getter
242
+ * is asked once per leg and the leg never acts on two answers.
243
+ */
244
+ export type SchedulerReading = {
245
+ readonly kind: "none";
246
+ } | {
247
+ readonly kind: "unmoved" | "mounted";
248
+ readonly seam: ExecutionEnv & SchedulerCapability;
249
+ readonly capabilities: SchedulerCapability["schedulerCapabilities"];
250
+ };
251
+ export declare function readSchedulerDeclaration(env: ExecutionEnv): SchedulerReading;
213
252
  /**
214
- * 结构 + 语义检测:`env` 是否暴露 scheduler 能力且声明 `supported:true`。挂载门控用此(对齐 `hasBackgroundShell`)。
253
+ * 结构 + 语义检测:`env` 是否暴露 scheduler 能力、声明 `supported:true`,且声明端口收发 lane 键(`scopeKeys: "lane"`)。挂载门控用此
254
+ * (对齐 `hasBackgroundShell`);一条腿的准备读的是 {@link readSchedulerDeclaration} 的同一个读数。
215
255
  */
216
256
  export declare function hasScheduler(env: ExecutionEnv): env is ExecutionEnv & SchedulerCapability;
@@ -1,3 +1,4 @@
1
+ import { describeRejectedValue } from "./tool-search-setting.js";
1
2
  export class SchedulerError extends Error {
2
3
  code;
3
4
  cause;
@@ -8,12 +9,23 @@ export class SchedulerError extends Error {
8
9
  this.name = "SchedulerError";
9
10
  }
10
11
  }
11
- export function hasScheduler(env) {
12
+ const SCOPE_KEYS = ["lane", "bare"];
13
+ export function declaresLaneKeys(capabilities) {
14
+ return typeof capabilities === "object" && capabilities !== null && capabilities.scopeKeys === "lane";
15
+ }
16
+ export function describeScopeKeys(value) {
17
+ return SCOPE_KEYS.includes(value) ? value : describeRejectedValue(value);
18
+ }
19
+ export function readSchedulerDeclaration(env) {
12
20
  const e = env;
13
- return (typeof e.schedule === "function" &&
14
- typeof e.cancel === "function" &&
15
- typeof e.list === "function" &&
16
- typeof e.schedulerCapabilities === "object" &&
17
- e.schedulerCapabilities !== null &&
18
- e.schedulerCapabilities.supported === true);
21
+ if (typeof e.schedule !== "function" || typeof e.cancel !== "function" || typeof e.list !== "function")
22
+ return { kind: "none" };
23
+ const capabilities = e.schedulerCapabilities;
24
+ if (typeof capabilities !== "object" || capabilities === null || capabilities.supported !== true)
25
+ return { kind: "none" };
26
+ const held = capabilities;
27
+ return { kind: declaresLaneKeys(held) ? "mounted" : "unmoved", seam: env, capabilities: held };
28
+ }
29
+ export function hasScheduler(env) {
30
+ return readSchedulerDeclaration(env).kind === "mounted";
19
31
  }
@@ -26,6 +26,13 @@
26
26
  import { type RedactionConfidence, type RedactionSource } from "@sema-agent/primitives";
27
27
  import { type EngineNotice } from "./engine-notice.js";
28
28
  import type { ToolAxesSurface } from "./mcp-server-spec.js";
29
+ /** THE namespace rule: is `name` a credential slot of the engine's own namespace? A name there with a credential word in any
30
+ * segment (`SEMA_MODEL_KEY_<entry>`, `SEMA_WEBSEARCH_KEY_<provider>`) is the engine's own credential by construction, read only
31
+ * inside this process, so neither `"scrub"` nor `"all"` hands it to a child (an allow list naming it does: that is the host's
32
+ * own statement). It judges by segment, so a path or count setting with a credential word in its name is caught too (KL-1099a).
33
+ * Read by the name judgment ({@link sensitiveNameKind}, the `"scrub"` policy) and by the `"all"` policy's arm ({@link policyArm}),
34
+ * and exported from the package root: a host judging a name it hands a child itself asks the question the `"all"` arm asks. */
35
+ export declare function isNamespaceCredentialName(name: string): boolean;
29
36
  /** Does a value carry a credential? A URL userinfo (after every `scheme://`, and a leading `//`) with a password or a
30
37
  * token-like user; a userinfo with no `//` in front of it the vocabulary reads; a credential assignment; a webhook URL; a Sonar login; a
31
38
  * private-key header; an `Authorization` header, `token …`, `Bearer …` or `Basic …` with credential-shaped content (the
@@ -18,7 +18,7 @@ const ENV_NAMES = envNameView();
18
18
  const ENV_VALUES = envValueView();
19
19
  const OTEL_ENV_RE = /^(?:INPUT_)?OTEL_/i;
20
20
  const SEMA_NAMESPACE_SECRET_RE = ENV_NAMES.anySegmentUnder("SEMA_");
21
- function isNamespaceCredentialName(name) {
21
+ export function isNamespaceCredentialName(name) {
22
22
  return SEMA_NAMESPACE_SECRET_RE.test(name);
23
23
  }
24
24
  const BUNDLER_SETTINGS = ["BUILD", "LOCAL", "MIRROR", "PATH", "WITH", "WITHOUT", "CACHE", "DISABLE", "IGNORE", "ONLY"];
@@ -1,7 +1,7 @@
1
1
  import { homedir } from "node:os";
2
2
  import { isAbsolute, resolve } from "node:path";
3
3
  import { dataRootSpelling } from "./data-root.js";
4
- import { anchorSpelling, canonicalizeTarget, expandHomeTilde, isAbsoluteForFamily, isWinFormPath, pathFamilyOf, writeTargetPath } from "../tools/fs/safety.js";
4
+ import { anchorSpelling, canonicalizeTarget, expandHomeTilde, isAbsoluteForFamily, isWinFormPath, pathFamilyOf, targetPathsOf } from "../tools/fs/safety.js";
5
5
  import { spelledExemptionOf } from "./write-protect.js";
6
6
  import { compileSegmentPattern, READ_FACE_BUILTIN_DENY_TABLE, readDenyPatternRun, SEGMENT_FOLDS, segmentGuardRow } from "../tools/fs/read-deny.js";
7
7
  import { guardHitReachClause, guardHitVia, judgePathRows, spelledViews } from "./path-guard-rows.js";
@@ -205,9 +205,16 @@ export function createSensitivePathPolicy(opts) {
205
205
  if (guardedByName !== undefined ? !heldBy("policy.sensitivePathGuardedByName", guardedByName, req) : !isProtectedWrite(req))
206
206
  return { action: "allow" };
207
207
  const protective = protectivePathTargetOf(req);
208
- const path = writeTargetPath(req, protective);
209
- if (typeof path !== "string" || path.length === 0)
210
- return { action: "allow" };
208
+ for (const path of targetPathsOf(req, protective)) {
209
+ const refused = await judgeOne(req, protective, path, signal);
210
+ if (refused !== undefined)
211
+ return refused;
212
+ }
213
+ return { action: "allow" };
214
+ },
215
+ };
216
+ async function judgeOne(req, protective, path, signal) {
217
+ {
211
218
  const judged = await judgeTarget(path, family(req.cwd), pathTargetBaseOf(protective, { root: opts.rootPath, cwd: req.cwd }), req.exemptRoots ?? unstampedRoots, signal);
212
219
  if (judged.kind === "unresolved") {
213
220
  return { action: "deny", message: `write to "${path}" is refused (target_unresolved): where it leads on disk could not be determined, so the sensitive-path list cannot tell whether it is a guarded path — ${judged.cause}`, decisionReason: "safety" };
@@ -222,7 +229,7 @@ export function createSensitivePathPolicy(opts) {
222
229
  decisionReason: "safety",
223
230
  };
224
231
  }
225
- return { action: "allow" };
226
- },
227
- };
232
+ return undefined;
233
+ }
234
+ }
228
235
  }
@@ -25,6 +25,7 @@ const MEMBER_KINDS = {
25
25
  askRule: "word",
26
26
  askRuleOfPolicy: "mark",
27
27
  admit: "admission",
28
+ cause: "record",
28
29
  };
29
30
  const VERDICT_MEMBERS = Object.keys(MEMBER_KINDS);
30
31
  const OWNED_DATA_MODE = Object.freeze({ accessors: "refuse", depth: 8, others: "refuse", isProxy: (v) => types.isProxy(v) });
@@ -451,6 +451,13 @@ export async function checkpointStoreContract(make, runAssertion, options = {})
451
451
  const fetchBack = (await store.get(fetchRow.token)).pendingAction;
452
452
  assert.deepEqual(fetchBack.hostTarget, { param: "url" }, "the row's hostTarget must survive the round-trip verbatim (dropped, a resume of the parked fetch reads a face that moved and is vetoed, and its pre-claim recheck judges the catalog's slot for the NAME)");
453
453
  assert.equal("hostTarget" in bareBack, false, "an absent hostTarget must stay OMITTED");
454
+ const listRow = createCheckpointFixture({ token: mintCheckpointToken(), sessionId: "id-list" });
455
+ const listed = { pathTarget: { param: "paths", aliases: [], access: "read", skillScopeEligible: false, each: true }, targets: { protective: ["/srv/work/a.txt", null], declared: ["/srv/work/a.txt", null] } };
456
+ Object.assign(listRow.pendingAction, { ...group, family: "file-read", ...listed });
457
+ await store.put(listRow.token, listRow);
458
+ const listBack = (await store.get(listRow.token)).pendingAction;
459
+ assert.deepEqual(listBack.pathTarget, listed.pathTarget, "the row's pathTarget.each must survive the round-trip (dropped, the face the resume reads moved and the approval is vetoed)");
460
+ assert.deepEqual(listBack.targets, listed.targets, "the row's list of landings must survive the round-trip in order, its nulls kept (dropped or reshaped, the resume cannot tell where each element landed)");
454
461
  });
455
462
  run("previewWithheld three-form matrix: a row's spelling survives + projects; absent stays absent; an out-of-contract spelling reads as absent", async () => {
456
463
  const store = make();
@@ -1554,9 +1554,10 @@ export type TaskEvent = ({
1554
1554
  tree?: string;
1555
1555
  }>;
1556
1556
  /** This leg's project identity, decided ONCE at leg start and fixed for the leg: `marker` = the checkout's
1557
- * `.sema/project` (a `TaskSpec.projectId`, when given, equals it); `declared` = `TaskSpec.projectId` in a checkout
1558
- * that carries no marker. ABSENT = no marker and no declaration, or the marker could not be read (the deployment's
1559
- * `onError` was told which file and why). */
1557
+ * `.sema/project` (a `TaskSpec.projectId`, when given, equals it); `declared` = the number this leg was given —
1558
+ * by its host's `TaskSpec.projectId`, or, for a delegated child that declared nothing and whose own workspace
1559
+ * has no marker, the verdict of the leg that spawned it. ABSENT = none of the three, or the marker could not be
1560
+ * read (the deployment's `onError` was told which file and why). */
1560
1561
  project?: {
1561
1562
  id: string;
1562
1563
  source: "marker" | "declared";
@@ -2,6 +2,7 @@ import type { MailboxAppendMessage, MailboxStore } from "./mailbox-store.js";
2
2
  import { type EngineNotice } from "./engine-notice.js";
3
3
  import type { DelegationUnreviewed } from "./classifier-unavailable-arm.js";
4
4
  import type { TaskEvent } from "./task-event.js";
5
+ import type { SemaTaskType } from "./task-registry-shared.js";
5
6
  import { ONE_SHOT_WAIT_CEILING_DEFAULT_MS } from "../config/defaults.js";
6
7
  export { ONE_SHOT_WAIT_CEILING_DEFAULT_MS };
7
8
  /** The TERMINAL words of {@link TaskNotificationStatus}: the one table every "is this frame a completion?"
@@ -67,7 +68,7 @@ export interface TaskNotificationPayload {
67
68
  * externally injected event, and the input type ({@link ExternalNotificationInput}) deliberately has
68
69
  * no `task_type` field, so an outside producer can never wear an internal lane's type (a caller-declared
69
70
  * "background_bash completed" impersonating a real child). */
70
- task_type: "background_bash" | "workflow" | "background_agent" | "monitor" | "external";
71
+ task_type: SemaTaskType | "external";
71
72
  toolUseId?: string;
72
73
  status: TaskNotificationStatus;
73
74
  /** design/135 G2 (Monitor): the batched stdout lines of ONE `status:"event"` notification (lines that
@@ -285,11 +285,19 @@ export interface TaskSpec {
285
285
  /** Reuse an existing in-memory session for chat continuity; omit to start fresh. */
286
286
  sessionId?: string;
287
287
  /**
288
- * The project the host files this session under — a project UUID (the id a `.sema/project` marker carries; send it on
289
- * every leg). The engine has ONE judge of a leg's project identity: when the leg's checkout carries a marker, the marker
290
- * decides and this value must EQUAL it (else the leg is refused, `config.project_identity_mismatch`); in a checkout with
291
- * no marker this value IS the identity. Not a UUID ⇒ `config.project_id_invalid`. The verdict rides
292
- * `workspace_changed.project`; read it there rather than re-deriving it. Memory keys only by the marker.
288
+ * Project UUID the host declares for this leg (`.sema/project` id). Decided once at prepare: a valid marker decides and this value must EQUAL it
289
+ * (`config.project_identity_mismatch`); without a marker this value IS the identity; an unreadable marker refuses (`config.memory_project_marker` /
290
+ * `config.memory_project_marker_nested`); non-UUID ⇒ `config.project_id_invalid`. Every new leg (resume, wake, delegated child, fork) is judged afresh
291
+ * from the declaration handed to it; a delegated child with no declaration and no workspace marker inherits its parent leg's verdict as a default.
292
+ * Host duty: everything chosen by project for a leg must be picked at the same moment from the same value as this declaration. Read the verdict from
293
+ * `wiring_manifest.manifest.project` (every prepared leg, including legs with no workspace snapshot) or `workspace_changed.project` (absent on legs
294
+ * that emit no `workspace_changed` frame); a marker that could not be read arrives as `wiring_manifest.manifest.projectMarkerUnreadable` (`{ reason, markerPath? }`,
295
+ * never present beside `project` — leave stored project rows untouched on it). Limits: only prepared legs emit a manifest (a refused leg has no manifest;
296
+ * refusal detail rides `terminal.detail`), and a delegated child's manifest rides the child's own stream, never forwarded onto the parent's. Under `scopeContract: "v2"`, `proj:` / `userproj:`
297
+ * write keys are checked against this verdict (`config.memory_project_identity`; mount dirs stay marker-only). Coded details ride `terminal.detail = { kind: "coded", detail }`
298
+ * (`PROJECT_IDENTITY_REFUSAL_KINDS`): `{ kind: "mismatch", declared, marker, markerPath }`, `{ kind: "marker_unreadable", markerPath?, reason }`
299
+ * (`PROJECT_MARKER_UNREADABLE_REASONS`: `"io_error"` | `"unparseable"` | `"not_uuid"` | `"nested"` carry `markerPath` for a marker at the task root itself, not above it; `"repo_root_unreadable"` omits it),
300
+ * `{ kind: "write_project_mismatch", writeScope, writeProjectId, verdictProjectId, verdictSource }`, `{ kind: "write_without_verdict", writeScope, writeProjectId }`.
293
301
  */
294
302
  projectId?: string;
295
303
  /**
@@ -182,6 +182,7 @@ export const ENGINE_CARDS = Object.freeze({
182
182
  read_path_denied: "src/tools/fs/safety.ts",
183
183
  readonly_out_of_root: "src/tools/fs/shell-read-check.ts",
184
184
  read_unestablished: "src/tools/fs/shell-read-check.ts",
185
+ read_targets_refused: "src/tools/fs/shell-read-check.ts",
185
186
  bash_self_kill_refused: "src/tools/fs/pattern-kill-guard.ts",
186
187
  bash: "src/tools/fs/fs-shared.ts",
187
188
  });
@@ -202,6 +203,7 @@ export const CARD_SKELETONS = Object.freeze({
202
203
  bash_self_kill_refused: ["code", "finding", "pid", "relation"],
203
204
  readonly_out_of_root: ["code"],
204
205
  read_unestablished: ["code"],
206
+ read_targets_refused: ["code"],
205
207
  path_not_in_root: ["code", "target"],
206
208
  read_path_denied: ["code", "target", "pattern"],
207
209
  artifact: ["action", "plane", "code", "invalidArguments", "url", "path", "bytes", "mediaType", "ref.url", "ref.slug", "ref.version"],
@@ -5,7 +5,7 @@ import { strayMembersOf } from "./own-property-receipt.js";
5
5
  import { faceProblem } from "./runner/tool-face-overlay.js";
6
6
  import { inlineUntrusted } from "./untrusted-text.js";
7
7
  const TOOL_FACE_MEMBERS = { family: true, pathTarget: true, hostTarget: true, renderHints: true, ruleFace: true };
8
- const PATH_TARGET_KINDS = { param: "string", aliases: "list", access: "string", skillScopeEligible: "boolean", base: "string", absent: "string", patternParam: "string" };
8
+ const PATH_TARGET_KINDS = { param: "string", aliases: "list", access: "string", skillScopeEligible: "boolean", base: "string", absent: "string", patternParam: "string", each: "boolean" };
9
9
  const PATH_TARGET_REQUIRED = ["param", "access"];
10
10
  const HOST_TARGET_KINDS = { param: "string" };
11
11
  const HOST_TARGET_REQUIRED = ["param"];
@@ -118,6 +118,13 @@ export interface ToolCallPathTarget {
118
118
  * relative pattern leaves the base alone.
119
119
  */
120
120
  patternParam?: string;
121
+ /**
122
+ * `true` ⇔ the slot names SEVERAL read targets: the call's value there is a string or a list of strings, each one a target
123
+ * judged exactly as a single one is. Only on `access: "read"`. Absent ⇒ the slot names one target, a string. A read target
124
+ * the engine does not catalog is judged by the file read station on this declaration, element by element, and its tool reads
125
+ * through {@link import("./tool-spec.js").ToolExecuteContext.judgedReads}.
126
+ */
127
+ each?: true;
121
128
  }
122
129
  /** The DECLARATION spelling of {@link ToolCallPathTarget}: what a catalog row, a `ToolSpec` or an MCP
123
130
  * overlay writes. `skillScopeEligible` is narrowed to `true` — a declaration says "eligible" or says
@@ -14,6 +14,7 @@ export function pathTargetSlotOnly(pt) {
14
14
  access: pt.access,
15
15
  ...(pt.aliases !== undefined ? { aliases: pt.aliases } : {}),
16
16
  ...(pt.skillScopeEligible !== undefined ? { skillScopeEligible: pt.skillScopeEligible } : {}),
17
+ ...(pt.each === true ? { each: true } : {}),
17
18
  };
18
19
  }
19
20
  export const TOOL_WIRE_NAME_MAX_CHARS = 128;
@@ -9,6 +9,7 @@
9
9
  * phase's point) are not here: the phase that computes one states it beside the judgment that reads it.
10
10
  */
11
11
  import type { ExecutionEnv } from "../internal/harness-types.js";
12
+ import { type SchedulerReading } from "./scheduler.js";
12
13
  import type { ApprovalParkNotResumable } from "./park-resumability.js";
13
14
  import type { ToolMountFact, ToolMountIdentity } from "./tool-mount-plan.js";
14
15
  import type { RunnerDeps, TaskSpec } from "./types.js";
@@ -57,5 +58,6 @@ export declare function legSeatMountFacts(deps: Pick<RunnerDeps, "onQuestion" |
57
58
  * a background lane, both read from its `execute` where the factory bound them ({@link delegationHasBackgroundLane}): a copy whose face
58
59
  * dropped `run_in_background` still launches in the background by default, and a synchronous one whose face gained it does not. */
59
60
  export declare function backgroundAgentsFact(callerTools: readonly unknown[], leaves: (identity: ToolMountIdentity) => boolean): boolean;
60
- /** The execution environment's reach: hands at all, a target its shell faces reach, the two daemon capabilities. */
61
- export declare function envMountFacts(handsEnabled: boolean, env: ExecutionEnv): ToolMountFacts;
61
+ /** The execution environment's reach: hands at all, a target its shell faces reach, the two daemon capabilities. A leg hands in the
62
+ * scheduler reading it took ({@link readSchedulerDeclaration}), so the declaration is read once per leg; a static reader takes its own. */
63
+ export declare function envMountFacts(handsEnabled: boolean, env: ExecutionEnv, scheduler?: SchedulerReading): ToolMountFacts;
@@ -1,7 +1,7 @@
1
1
  import { workflowsCapability } from "../orchestration/workflow-script-runner.js";
2
2
  import { hasBackgroundShell } from "./background-shell.js";
3
3
  import { performsIo } from "./remote-env.js";
4
- import { hasScheduler } from "./scheduler.js";
4
+ import { readSchedulerDeclaration } from "./scheduler.js";
5
5
  import { durableParkOptInDeclared } from "./tool-policy.js";
6
6
  import { memoryEngineOpens, normalizeMemorySpec } from "./memory.js";
7
7
  import { DEFAULT_TOOL_RESULT_THRESHOLD_CHARS } from "./tool-result-store.js";
@@ -50,11 +50,11 @@ export function legSeatMountFacts(deps, spec, leg) {
50
50
  export function backgroundAgentsFact(callerTools, leaves) {
51
51
  return callerTools.some((t) => delegationHasBackgroundLane(t) && leaves(t));
52
52
  }
53
- export function envMountFacts(handsEnabled, env) {
53
+ export function envMountFacts(handsEnabled, env, scheduler = readSchedulerDeclaration(env)) {
54
54
  return {
55
55
  "env.hands": handsEnabled,
56
56
  "env.performsIo": performsIo(env) === true,
57
57
  "env.backgroundShell": hasBackgroundShell(env),
58
- "env.scheduler": hasScheduler(env),
58
+ "env.scheduler": scheduler.kind === "mounted",
59
59
  };
60
60
  }
@@ -156,9 +156,10 @@ export interface ToolMountPlannedMember {
156
156
  * The plan the rows give over a reading's facts: each catalog row is a member (holds), a conditional member (open) or an
157
157
  * absent definition (fails); the reading's members add the family members a reader knows by name (each under its own
158
158
  * condition and the valve); its families the listings it only knows by peer; `executionEnv` its answer to whether the leg
159
- * needs an environment.
159
+ * needs an environment — read by the caller ({@link readExecutionEnv}), once, at the moment the leg reads it, over the facts the
160
+ * leg holds then (a fact the leg states after it decides is not yet stated), and carried here.
160
161
  */
161
- export declare function planToolMounts(reading: ExecutionEnvReading): ToolMountPlan;
162
+ export declare function planToolMounts(reading: ExecutionEnvReading, executionEnv: ToolMountPlanExecutionEnv): ToolMountPlan;
162
163
  /** Whether a leg needs an execution environment: a consumer of it mounts or a need beside the tools holds (`needed`), one
163
164
  * of them is open (`conditional`), or neither (`unneeded`). */
164
165
  export declare const EXECUTION_ENV_NEEDS: readonly ["needed", "conditional", "unneeded"];
@@ -193,6 +194,7 @@ export interface ExecutionEnvReading {
193
194
  readonly families: readonly {
194
195
  readonly family: ToolMountPlanFamily;
195
196
  readonly writesPath: boolean;
197
+ readonly readsPath?: boolean;
196
198
  }[];
197
199
  readonly writeProtected: boolean;
198
200
  readonly asks: ExecutionEnvAskReading;
@@ -230,7 +230,7 @@ export function mountRowVerdict(id, facts, leaves) {
230
230
  throw mismatch(`the row "${id}" asked ${v.why.join(", ")}, which was never stated`);
231
231
  return v.value;
232
232
  }
233
- export function planToolMounts(reading) {
233
+ export function planToolMounts(reading, executionEnv) {
234
234
  const { src, members } = reading;
235
235
  const families = reading.families.map((f) => f.family);
236
236
  const row = rowVerdicts(src);
@@ -253,7 +253,7 @@ export function planToolMounts(reading) {
253
253
  }
254
254
  const kept = dedupeLaterWins(out);
255
255
  const named = new Set(kept.map((m) => m.name));
256
- return { half: "static", members: kept, families: [...families], absent: absent.filter((a) => !named.has(a.name)), executionEnv: readExecutionEnv(reading) };
256
+ return { half: "static", members: kept, families: [...families], absent: absent.filter((a) => !named.has(a.name)), executionEnv };
257
257
  }
258
258
  export const EXECUTION_ENV_NEEDS = Object.freeze(["needed", "conditional", "unneeded"]);
259
259
  export const EXECUTION_ENV_ASKS = Object.freeze(["workspace", "attachment_paths", "plan_file", "restore_files", "checkout", "restore", "compaction_restore", "caller_placement", "delegation", "mods", "memory", "park_lane"]);
@@ -274,7 +274,7 @@ export function readExecutionEnv(r) {
274
274
  const p = placementOf(evaluateMountCond(memberCond(m), withEnv, rowWith));
275
275
  const q = placementOf(evaluateMountCond(memberCond(m), without, rowWithout));
276
276
  callable.push(p);
277
- if (p !== q || (r.writeProtected && writesProtectedPath([m.identity.name, ...(m.identity.aliases ?? [])], m.pathTarget)))
277
+ if (p !== q || m.pathTarget?.access === "read" || (r.writeProtected && writesProtectedPath([m.identity.name, ...(m.identity.aliases ?? [])], m.pathTarget)))
278
278
  consume(m.identity.name, p);
279
279
  }
280
280
  for (const rule of TOOL_MOUNT_RULES) {
@@ -286,8 +286,8 @@ export function readExecutionEnv(r) {
286
286
  if (p !== q || rule.envHand === true || (r.writeProtected && writesProtectedPath(namesOf(e), e.face.pathTarget)))
287
287
  consume(e.name, p);
288
288
  }
289
- for (const { family, writesPath } of r.families)
290
- if (r.writeProtected && writesPath)
289
+ for (const { family, writesPath, readsPath } of r.families)
290
+ if ((r.writeProtected && writesPath) || readsPath === true)
291
291
  consume(`${family.source}:${family.peer}`, "conditional");
292
292
  const delegators = [finalCond(RULE_BY_ID.get("workflow")), ...r.members.filter((m) => m.delegates === true).map(memberCond)].map((c) => placementOf(evaluateMountCond(c, withEnv, rowWith)));
293
293
  const canCall = !callable.some((p) => p !== "absent") ? false : callable.includes("mounted") ? true : undefined;
@@ -55,4 +55,4 @@ export declare function readLegExecutionEnv(input: LegExecutionEnvInput): ToolMo
55
55
  * peers' families, evaluated over the facts read above. Refuses a spec prepare would refuse at the same doors. Whether the
56
56
  * leg needs an execution environment reads the session's own needs as open unless `statement` says the session is new.
57
57
  */
58
- export declare function planStaticToolMounts(deps: StaticToolPlanDeps, spec: StaticToolPlanSpec, statement?: StaticWiringStatement): ToolMountPlan;
58
+ export declare function planStaticToolMounts(deps: StaticToolPlanDeps, handed: StaticToolPlanSpec, statement?: StaticWiringStatement): ToolMountPlan;