@sema-agent/core 7.55.0 → 7.56.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 (418) hide show
  1. package/CHANGELOG.md +513 -0
  2. package/dist/agents/cascade.js +1 -1
  3. package/dist/agents/cc-peer-directory.js +1 -0
  4. package/dist/agents/child-model-seat.d.ts +0 -11
  5. package/dist/agents/child-model-seat.js +0 -3
  6. package/dist/agents/list-agents-tool.d.ts +3 -1
  7. package/dist/agents/list-agents-tool.js +7 -7
  8. package/dist/agents/peer-directory.d.ts +22 -4
  9. package/dist/agents/peer-directory.js +24 -2
  10. package/dist/agents/peer-session-drain.js +2 -2
  11. package/dist/agents/repair-loop.js +2 -2
  12. package/dist/agents/send-message-tool.js +4 -4
  13. package/dist/agents/subagent.d.ts +6 -4
  14. package/dist/agents/subagent.js +64 -60
  15. package/dist/agents/tool-filter.d.ts +7 -5
  16. package/dist/agents/tool-filter.js +12 -9
  17. package/dist/agents/verify.d.ts +3 -2
  18. package/dist/agents/verify.js +3 -3
  19. package/dist/brain/anthropic.js +30 -73
  20. package/dist/brain/media-degrade.d.ts +18 -7
  21. package/dist/brain/media-degrade.js +13 -2
  22. package/dist/brain/model-capability.d.ts +37 -0
  23. package/dist/brain/model-capability.js +34 -0
  24. package/dist/brain/model-presets.d.ts +2 -8
  25. package/dist/brain/model-presets.js +1 -6
  26. package/dist/brain/open-responses.js +13 -26
  27. package/dist/brain/openai.js +14 -87
  28. package/dist/brain/reasoning-request.d.ts +96 -0
  29. package/dist/brain/reasoning-request.js +174 -0
  30. package/dist/brain/reasoning.d.ts +11 -11
  31. package/dist/brain/reasoning.js +4 -3
  32. package/dist/brain/request-params.d.ts +7 -4
  33. package/dist/brain/request-params.js +7 -4
  34. package/dist/brain/status-sink.d.ts +20 -0
  35. package/dist/brain/status-sink.js +7 -0
  36. package/dist/core/a2a.d.ts +2 -1
  37. package/dist/core/a2a.js +19 -13
  38. package/dist/core/agent-definition.d.ts +10 -0
  39. package/dist/core/allow-entry.d.ts +20 -13
  40. package/dist/core/allow-entry.js +26 -22
  41. package/dist/core/allow-rule-shadow.d.ts +3 -3
  42. package/dist/core/ask-origin.d.ts +64 -18
  43. package/dist/core/ask-origin.js +63 -23
  44. package/dist/core/ask-question.d.ts +51 -8
  45. package/dist/core/ask-question.js +3 -4
  46. package/dist/core/ask-unresolvable-notice.d.ts +8 -3
  47. package/dist/core/ask-unresolvable-notice.js +16 -2
  48. package/dist/core/checkpoint-generation.d.ts +53 -0
  49. package/dist/core/checkpoint-generation.js +35 -0
  50. package/dist/core/checkpoint-queries.d.ts +180 -0
  51. package/dist/core/checkpoint-queries.js +272 -0
  52. package/dist/core/checkpoint-requirements.d.ts +13 -1
  53. package/dist/core/checkpoint-requirements.js +4 -0
  54. package/dist/core/checkpoint-store.d.ts +88 -24
  55. package/dist/core/checkpoint-store.js +24 -9
  56. package/dist/core/cross-boundary-taint.d.ts +6 -5
  57. package/dist/core/cross-boundary-taint.js +1 -3
  58. package/dist/core/decision-receipt.d.ts +37 -3
  59. package/dist/core/decision-receipt.js +17 -17
  60. package/dist/core/delegation-not-started.d.ts +6 -0
  61. package/dist/core/delegation-not-started.js +17 -0
  62. package/dist/core/engine-attestation.d.ts +93 -0
  63. package/dist/core/engine-attestation.js +70 -0
  64. package/dist/core/engine-capabilities.d.ts +4 -1
  65. package/dist/core/engine-capabilities.js +1 -1
  66. package/dist/core/engine-notice.d.ts +30 -11
  67. package/dist/core/file-history-store.d.ts +90 -14
  68. package/dist/core/file-history-store.js +23 -15
  69. package/dist/core/gate-fold.d.ts +1 -1
  70. package/dist/core/gate-fold.js +22 -10
  71. package/dist/core/gate-lanes.js +73 -64
  72. package/dist/core/gate-outcome.d.ts +26 -5
  73. package/dist/core/gate-outcome.js +26 -0
  74. package/dist/core/governance-codes.d.ts +5 -1
  75. package/dist/core/governance-codes.js +6 -0
  76. package/dist/core/hooks.d.ts +17 -16
  77. package/dist/core/hooks.js +3 -1
  78. package/dist/core/host-floor.d.ts +128 -0
  79. package/dist/core/host-floor.js +206 -0
  80. package/dist/core/host-target.d.ts +38 -3
  81. package/dist/core/host-target.js +38 -5
  82. package/dist/core/mcp.d.ts +5 -1
  83. package/dist/core/mcp.js +67 -41
  84. package/dist/core/memory-engine/delegation-settlement.js +15 -24
  85. package/dist/core/memory-engine/engine.js +4 -4
  86. package/dist/core/memory-engine/layout.d.ts +60 -8
  87. package/dist/core/memory-engine/layout.js +65 -6
  88. package/dist/core/model-seat.d.ts +10 -3
  89. package/dist/core/mods/classic-events.d.ts +67 -0
  90. package/dist/core/mods/classic-events.js +1 -0
  91. package/dist/core/mods/dollar.d.ts +13 -0
  92. package/dist/core/mods/extension-call.d.ts +31 -0
  93. package/dist/core/mods/extension-call.js +43 -0
  94. package/dist/core/mods/kernel/dispatch.d.ts +20 -3
  95. package/dist/core/mods/kernel/dispatch.js +140 -69
  96. package/dist/core/mods/kernel/events.d.ts +47 -11
  97. package/dist/core/mods/kernel/events.js +66 -42
  98. package/dist/core/mods/kernel/index.d.ts +4 -4
  99. package/dist/core/mods/kernel/index.js +2 -2
  100. package/dist/core/mods/kernel/receive.d.ts +39 -5
  101. package/dist/core/mods/kernel/receive.js +290 -17
  102. package/dist/core/mods/kernel/registration.d.ts +33 -2
  103. package/dist/core/mods/kernel/registration.js +6 -7
  104. package/dist/core/mods/kernel/site-rules.d.ts +44 -16
  105. package/dist/core/mods/kernel/site-rules.js +24 -42
  106. package/dist/core/mods/spec-seats.d.ts +69 -0
  107. package/dist/core/mods/spec-seats.js +114 -0
  108. package/dist/core/mods/stations.d.ts +28 -8
  109. package/dist/core/mods/stations.js +29 -13
  110. package/dist/core/mods/tool-call.d.ts +79 -0
  111. package/dist/core/mods/tool-call.js +152 -0
  112. package/dist/core/namespaced-rule-name.d.ts +32 -38
  113. package/dist/core/namespaced-rule-name.js +29 -36
  114. package/dist/core/parent-spec-seat.d.ts +6 -1
  115. package/dist/core/parent-spec-seat.js +2 -0
  116. package/dist/core/park-selfcheck.js +1 -0
  117. package/dist/core/permission-rule-consent.d.ts +19 -0
  118. package/dist/core/permission-rule-consent.js +116 -26
  119. package/dist/core/permission-rule-model.d.ts +14 -3
  120. package/dist/core/permission-rule-model.js +39 -24
  121. package/dist/core/permission-rule-org.d.ts +6 -2
  122. package/dist/core/permission-rule-org.js +7 -3
  123. package/dist/core/permission-rule-provider.d.ts +5 -2
  124. package/dist/core/permission-rule-provider.js +41 -11
  125. package/dist/core/permission-rule-store.d.ts +3 -2
  126. package/dist/core/permission-rule-store.js +11 -2
  127. package/dist/core/permission-rule-sync.js +3 -2
  128. package/dist/core/permission-rule-syntax.d.ts +5 -4
  129. package/dist/core/permission-rule-syntax.js +2 -2
  130. package/dist/core/permission-rules.d.ts +4 -4
  131. package/dist/core/permission-rules.js +11 -20
  132. package/dist/core/persisted-rule-arms.d.ts +2 -2
  133. package/dist/core/persisted-rule-arms.js +10 -12
  134. package/dist/core/principal-name.d.ts +20 -0
  135. package/dist/core/principal-name.js +22 -0
  136. package/dist/core/prompt-section-seat.js +4 -6
  137. package/dist/core/protocol-http-auth.d.ts +26 -5
  138. package/dist/core/protocol-http-auth.js +137 -4
  139. package/dist/core/retired-keys.d.ts +16 -0
  140. package/dist/core/retired-keys.js +16 -4
  141. package/dist/core/rewrite-rejudge.d.ts +60 -0
  142. package/dist/core/rewrite-rejudge.js +36 -0
  143. package/dist/core/roles.d.ts +28 -1
  144. package/dist/core/roles.js +31 -19
  145. package/dist/core/rule-lane-reads.d.ts +20 -15
  146. package/dist/core/rule-lane-reads.js +45 -17
  147. package/dist/core/rule-owner.d.ts +3 -3
  148. package/dist/core/rule-owner.js +3 -2
  149. package/dist/core/runner/announce-once-ledger.d.ts +14 -0
  150. package/dist/core/runner/announce-once-ledger.js +5 -0
  151. package/dist/core/runner/assemble-result.d.ts +1 -0
  152. package/dist/core/runner/assemble-result.js +1 -1
  153. package/dist/core/runner/call-hook-stations.d.ts +3 -2
  154. package/dist/core/runner/caller-roster.d.ts +16 -4
  155. package/dist/core/runner/caller-roster.js +33 -6
  156. package/dist/core/runner/capability-withheld-seat.d.ts +5 -0
  157. package/dist/core/runner/capability-withheld-seat.js +24 -0
  158. package/dist/core/runner/classifier-ladder.d.ts +7 -9
  159. package/dist/core/runner/classifier-ladder.js +3 -3
  160. package/dist/core/runner/construction-doors.js +3 -0
  161. package/dist/core/runner/contracts.d.ts +28 -25
  162. package/dist/core/runner/cross-boundary-lane.d.ts +17 -13
  163. package/dist/core/runner/cross-boundary-lane.js +40 -27
  164. package/dist/core/runner/denial-limit-arms.d.ts +2 -2
  165. package/dist/core/runner/denial-limit-arms.js +1 -1
  166. package/dist/core/runner/file-history-request.d.ts +18 -0
  167. package/dist/core/runner/file-history-request.js +21 -13
  168. package/dist/core/runner/file-history-restore.d.ts +45 -0
  169. package/dist/core/runner/file-history-restore.js +46 -0
  170. package/dist/core/runner/gate-exit.d.ts +3 -3
  171. package/dist/core/runner/gate-exit.js +4 -3
  172. package/dist/core/runner/image.d.ts +7 -17
  173. package/dist/core/runner/image.js +9 -60
  174. package/dist/core/runner/permission-rule-lanes.d.ts +4 -4
  175. package/dist/core/runner/permission-rule-lanes.js +26 -10
  176. package/dist/core/runner/person-path-rows.d.ts +12 -9
  177. package/dist/core/runner/person-path-rows.js +18 -7
  178. package/dist/core/runner/prepare-ask-lane.d.ts +2 -2
  179. package/dist/core/runner/prepare-ask-lane.js +5 -2
  180. package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -6
  181. package/dist/core/runner/prepare-caps-and-workflow.js +4 -3
  182. package/dist/core/runner/prepare-config-doors.d.ts +29 -38
  183. package/dist/core/runner/prepare-config-doors.js +42 -25
  184. package/dist/core/runner/prepare-defer-classify.d.ts +4 -3
  185. package/dist/core/runner/prepare-defer-classify.js +7 -8
  186. package/dist/core/runner/prepare-file-history.d.ts +48 -8
  187. package/dist/core/runner/prepare-file-history.js +7 -39
  188. package/dist/core/runner/prepare-gate-stations.d.ts +1 -1
  189. package/dist/core/runner/prepare-gate-stations.js +10 -1
  190. package/dist/core/runner/prepare-hands-readface.d.ts +2 -8
  191. package/dist/core/runner/prepare-hands-readface.js +15 -14
  192. package/dist/core/runner/prepare-inherited-gate.d.ts +6 -3
  193. package/dist/core/runner/prepare-inherited-gate.js +5 -3
  194. package/dist/core/runner/prepare-memory-engine-session.js +1 -1
  195. package/dist/core/runner/prepare-park-ask.js +5 -5
  196. package/dist/core/runner/prepare-policy-chain.d.ts +6 -3
  197. package/dist/core/runner/prepare-policy-chain.js +65 -72
  198. package/dist/core/runner/prepare-prompt-assembly.d.ts +5 -7
  199. package/dist/core/runner/prepare-prompt-assembly.js +10 -8
  200. package/dist/core/runner/prepare-prompt-inputs.d.ts +11 -9
  201. package/dist/core/runner/prepare-prompt-inputs.js +3 -5
  202. package/dist/core/runner/prepare-protocol-tools.d.ts +2 -0
  203. package/dist/core/runner/prepare-protocol-tools.js +3 -3
  204. package/dist/core/runner/prepare-safety-scan.d.ts +1 -1
  205. package/dist/core/runner/prepare-safety-scan.js +0 -17
  206. package/dist/core/runner/prepare-suspend-saga.d.ts +2 -0
  207. package/dist/core/runner/prepare-suspend-saga.js +5 -6
  208. package/dist/core/runner/prepare-task.d.ts +1 -1
  209. package/dist/core/runner/prepare-task.js +29 -20
  210. package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +7 -4
  211. package/dist/core/runner/prepare-tool-disclosure-mount.js +20 -16
  212. package/dist/core/runner/prepare-turn-wiring.d.ts +0 -4
  213. package/dist/core/runner/prepare-turn-wiring.js +2 -7
  214. package/dist/core/runner/prepare-wiring-manifest.d.ts +6 -2
  215. package/dist/core/runner/prepare-wiring-manifest.js +3 -3
  216. package/dist/core/runner/resume-admission.js +1 -1
  217. package/dist/core/runner/resume-apply.js +11 -12
  218. package/dist/core/runner/resume-checkpoint-screen.js +3 -0
  219. package/dist/core/runner/resume-claim.d.ts +4 -2
  220. package/dist/core/runner/resume-claim.js +15 -8
  221. package/dist/core/runner/retired-runner-deps.js +1 -0
  222. package/dist/core/runner/rewind-files.d.ts +15 -0
  223. package/dist/core/runner/rewind-files.js +132 -0
  224. package/dist/core/runner/run-attachment-seats.js +2 -1
  225. package/dist/core/runner/run-brain-sinks.d.ts +4 -1
  226. package/dist/core/runner/run-brain-sinks.js +4 -2
  227. package/dist/core/runner/run-harness-handlers.js +12 -4
  228. package/dist/core/runner/run-leg.d.ts +1 -1
  229. package/dist/core/runner/run-leg.js +30 -18
  230. package/dist/core/runner/run-settle-and-teardown.js +2 -1
  231. package/dist/core/runner/run-turn-boundary.js +1 -10
  232. package/dist/core/runner/runtask.d.ts +3 -0
  233. package/dist/core/runner/runtask.js +8 -9
  234. package/dist/core/runner/session-read-file-states.d.ts +15 -0
  235. package/dist/core/runner/session-read-file-states.js +28 -0
  236. package/dist/core/runner/session-rule-policy.js +4 -3
  237. package/dist/core/runner/shell-env-withheld.d.ts +33 -0
  238. package/dist/core/runner/shell-env-withheld.js +51 -0
  239. package/dist/core/runner/skills-seat.js +6 -2
  240. package/dist/core/runner/stream-settle-backstop.js +1 -1
  241. package/dist/core/runner/sub-agent-deny-lists.js +4 -7
  242. package/dist/core/runner/synthetic-tools.d.ts +6 -0
  243. package/dist/core/runner/synthetic-tools.js +4 -1
  244. package/dist/core/runner/tool-disclosure.d.ts +10 -12
  245. package/dist/core/runner/tool-disclosure.js +1 -3
  246. package/dist/core/runner/tool-end-body.d.ts +1 -1
  247. package/dist/core/runner/tool-end-body.js +10 -9
  248. package/dist/core/runner/tool-not-executed.d.ts +5 -0
  249. package/dist/core/runner/tool-not-executed.js +11 -0
  250. package/dist/core/runner/tool-occurrence.d.ts +8 -0
  251. package/dist/core/runner/tool-occurrence.js +7 -0
  252. package/dist/core/runner/turn-attachments.d.ts +33 -15
  253. package/dist/core/runner/turn-attachments.js +62 -37
  254. package/dist/core/runner-deps.d.ts +5 -5
  255. package/dist/core/safety-axis-vocab.d.ts +6 -4
  256. package/dist/core/safety-axis-vocab.js +6 -5
  257. package/dist/core/safety-merge-corpus.js +11 -3
  258. package/dist/core/secret-env.d.ts +26 -3
  259. package/dist/core/secret-env.js +44 -8
  260. package/dist/core/select-model.js +3 -3
  261. package/dist/core/session-policy-store.d.ts +27 -15
  262. package/dist/core/session-policy-store.js +156 -36
  263. package/dist/core/session-store.d.ts +29 -10
  264. package/dist/core/session-store.js +51 -19
  265. package/dist/core/session.d.ts +82 -16
  266. package/dist/core/session.js +53 -0
  267. package/dist/core/shell-read-silence.d.ts +11 -12
  268. package/dist/core/shell-read-silence.js +9 -5
  269. package/dist/core/shell-run-candidates.js +3 -1
  270. package/dist/core/shell-wrapper-projection.js +1 -1
  271. package/dist/core/shell-wrapper-table.d.ts +14 -7
  272. package/dist/core/shell-wrapper-table.js +5 -4
  273. package/dist/core/side-query.js +10 -1
  274. package/dist/core/skill-grant.d.ts +7 -2
  275. package/dist/core/skill-grant.js +5 -0
  276. package/dist/core/skills-directory.js +6 -2
  277. package/dist/core/store-contracts/checkpoint-store-contract.d.ts +11 -1
  278. package/dist/core/store-contracts/checkpoint-store-contract.js +140 -2
  279. package/dist/core/store-contracts/file-history-store-contract.js +31 -1
  280. package/dist/core/store-contracts/peer-directory-contract.d.ts +7 -2
  281. package/dist/core/store-contracts/peer-directory-contract.js +14 -2
  282. package/dist/core/store-contracts/session-repo-contract.js +51 -0
  283. package/dist/core/store-contracts/session-store-contract.d.ts +2 -1
  284. package/dist/core/store-contracts/session-store-contract.js +150 -14
  285. package/dist/core/stub-env.d.ts +2 -0
  286. package/dist/core/stub-env.js +1 -0
  287. package/dist/core/synthetic-read-verdict.js +3 -3
  288. package/dist/core/task-event.d.ts +32 -4
  289. package/dist/core/task-notification.d.ts +16 -12
  290. package/dist/core/task-registry.d.ts +9 -0
  291. package/dist/core/task-registry.js +11 -1
  292. package/dist/core/task-result.d.ts +18 -0
  293. package/dist/core/task-spec.d.ts +18 -13
  294. package/dist/core/tighten-task-spec.js +2 -1
  295. package/dist/core/tool-catalog-entries.d.ts +17 -0
  296. package/dist/core/tool-catalog-entries.js +13 -2
  297. package/dist/core/tool-check-reading.d.ts +11 -0
  298. package/dist/core/tool-check-reading.js +11 -6
  299. package/dist/core/tool-model-gate.d.ts +2 -2
  300. package/dist/core/tool-name-aliases.d.ts +16 -16
  301. package/dist/core/tool-name-aliases.js +13 -19
  302. package/dist/core/tool-name-readings.d.ts +5 -35
  303. package/dist/core/tool-name-readings.js +1 -9
  304. package/dist/core/tool-policy.d.ts +68 -198
  305. package/dist/core/tool-policy.js +149 -198
  306. package/dist/core/tool-result-store.js +3 -0
  307. package/dist/core/tool-roster.d.ts +14 -19
  308. package/dist/core/tool-roster.js +11 -44
  309. package/dist/core/tool-spec-members.js +7 -2
  310. package/dist/core/tool-spec.d.ts +19 -11
  311. package/dist/core/tools.js +49 -9
  312. package/dist/core/trace.d.ts +2 -2
  313. package/dist/core/types.d.ts +1 -1
  314. package/dist/core/user-attachment.d.ts +8 -1
  315. package/dist/core/user-attachment.js +64 -4
  316. package/dist/core/wiring-manifest.d.ts +9 -0
  317. package/dist/core/wiring-manifest.js +1 -0
  318. package/dist/core/workflow-journal-store.js +1 -1
  319. package/dist/engine/compaction/compaction.js +3 -2
  320. package/dist/engine/execution-env/node-execution-env.d.ts +7 -3
  321. package/dist/engine/execution-env/node-execution-env.js +11 -2
  322. package/dist/engine/harness/agent-harness.d.ts +25 -1
  323. package/dist/engine/harness/agent-harness.js +54 -7
  324. package/dist/engine/harness/types.d.ts +29 -2
  325. package/dist/engine/llm/types.d.ts +28 -11
  326. package/dist/engine/loop/agent-loop.d.ts +22 -0
  327. package/dist/engine/loop/agent-loop.js +16 -26
  328. package/dist/engine/loop/types.d.ts +16 -6
  329. package/dist/engine/session/memory-repo.d.ts +9 -2
  330. package/dist/engine/session/memory-repo.js +11 -1
  331. package/dist/engine/session/repo-utils.d.ts +6 -5
  332. package/dist/engine/session/repo-utils.js +14 -6
  333. package/dist/index.d.ts +22 -10
  334. package/dist/index.js +15 -7
  335. package/dist/internal/harness-types.d.ts +1 -1
  336. package/dist/internal/llm.d.ts +1 -1
  337. package/dist/orchestration/run-workflow-tool.d.ts +6 -4
  338. package/dist/orchestration/run-workflow-tool.js +5 -3
  339. package/dist/orchestration/workflow.d.ts +3 -0
  340. package/dist/orchestration/workflow.js +36 -18
  341. package/dist/prompt-assembly/artifact.d.ts +2 -2
  342. package/dist/prompt-assembly/artifact.js +5 -3
  343. package/dist/prompt-assembly/assemble.d.ts +3 -2
  344. package/dist/prompt-assembly/assemble.js +1 -1
  345. package/dist/prompt-assembly/catalog/schema.d.ts +43 -12
  346. package/dist/prompt-assembly/catalog/schema.js +34 -2
  347. package/dist/prompt-assembly/catalog/sections.js +0 -1
  348. package/dist/prompt-assembly/composer.d.ts +3 -1
  349. package/dist/prompt-assembly/composer.js +1 -1
  350. package/dist/prompt-assembly/event-registry.js +1 -0
  351. package/dist/prompt-assembly/overlay.js +3 -3
  352. package/dist/prompt-assembly/renderers.d.ts +1 -1
  353. package/dist/prompt-assembly/renderers.js +0 -3
  354. package/dist/prompt-assembly/role-base.d.ts +15 -0
  355. package/dist/prompt-assembly/role-base.js +9 -0
  356. package/dist/prompt-assembly/select.d.ts +39 -14
  357. package/dist/prompt-assembly/select.js +47 -16
  358. package/dist/prompt-assembly/sugar.d.ts +17 -11
  359. package/dist/prompt-assembly/sugar.js +8 -3
  360. package/dist/prompt-assembly/tool-catalog.d.ts +37 -3
  361. package/dist/prompt-assembly/tool-catalog.js +114 -4
  362. package/dist/prompt-assembly/turn-snapshot.d.ts +4 -10
  363. package/dist/prompt-assembly/turn-snapshot.js +0 -3
  364. package/dist/prompt-assembly/types.d.ts +0 -7
  365. package/dist/scenarios/full-body.d.ts +11 -11
  366. package/dist/scenarios/full-body.js +4 -3
  367. package/dist/shell/lex.js +10 -1
  368. package/dist/stores/file/adoption/adopt.js +4 -3
  369. package/dist/stores/file/adoption/marker.js +3 -2
  370. package/dist/stores/file/checkpoint-store.d.ts +21 -0
  371. package/dist/stores/file/checkpoint-store.js +38 -6
  372. package/dist/stores/file/file-history-store.js +6 -7
  373. package/dist/stores/file/index.js +2 -1
  374. package/dist/stores/file/permission-rule-adopt.js +4 -3
  375. package/dist/stores/file/permission-rule-store.js +11 -5
  376. package/dist/stores/file/session-store.d.ts +29 -6
  377. package/dist/stores/file/session-store.js +42 -50
  378. package/dist/tools/artifact/artifact-tool.js +3 -2
  379. package/dist/tools/fs/bash-program-position.d.ts +19 -2
  380. package/dist/tools/fs/bash-program-position.js +56 -9
  381. package/dist/tools/fs/fs-bash.js +5 -5
  382. package/dist/tools/fs/fs-glob.d.ts +86 -0
  383. package/dist/tools/fs/fs-glob.js +226 -0
  384. package/dist/tools/fs/fs-read.js +14 -14
  385. package/dist/tools/fs/fs-search-tools.js +7 -7
  386. package/dist/tools/fs/pattern-kill-guard.d.ts +22 -0
  387. package/dist/tools/fs/pattern-kill-guard.js +397 -0
  388. package/dist/tools/fs/pdf.d.ts +9 -6
  389. package/dist/tools/fs/pdf.js +3 -3
  390. package/dist/tools/fs/program-read-model.d.ts +57 -7
  391. package/dist/tools/fs/program-read-model.js +11 -1
  392. package/dist/tools/fs/program-read-model.rows.js +78 -21
  393. package/dist/tools/fs/read-deny-home.js +3 -2
  394. package/dist/tools/fs/removal-targets.d.ts +17 -7
  395. package/dist/tools/fs/removal-targets.js +47 -20
  396. package/dist/tools/fs/search.d.ts +10 -0
  397. package/dist/tools/fs/search.js +20 -26
  398. package/dist/tools/fs/shell-read-argv.js +89 -12
  399. package/dist/tools/fs/shell-read-bindings.d.ts +31 -0
  400. package/dist/tools/fs/shell-read-bindings.js +41 -0
  401. package/dist/tools/fs/shell-read-check.js +6 -19
  402. package/dist/tools/fs/shell-read-environment.d.ts +5 -1
  403. package/dist/tools/fs/shell-read-environment.js +3 -2
  404. package/dist/tools/fs/shell-read-establish.d.ts +15 -0
  405. package/dist/tools/fs/shell-read-establish.js +19 -20
  406. package/dist/tools/fs/shell-read-plan.js +24 -16
  407. package/dist/tools/fs/shell-read-start.d.ts +6 -1
  408. package/dist/tools/fs/shell-read-write-targets.d.ts +5 -1
  409. package/dist/tools/fs/shell-read-write-targets.js +2 -3
  410. package/dist/tools/fs/shell-reentry-text.d.ts +9 -0
  411. package/dist/tools/fs/shell-reentry-text.js +40 -2
  412. package/dist/tools/todo.js +63 -63
  413. package/dist/tools/web.d.ts +19 -14
  414. package/dist/tools/web.js +38 -55
  415. package/package.json +1 -1
  416. package/test/export-surface.snapshot.json +143 -5
  417. package/wire-changes/core@7.56.0.json +3891 -0
  418. package/wire-changes/mods-kernel@7.56.0.json +303 -0
@@ -206,7 +206,7 @@ export async function runCascade(runner, spec, config, internals) {
206
206
  return {
207
207
  taskId: spec.taskId ?? "",
208
208
  sessionId: "",
209
- result: `runCascade: the overall wall-clock budget (totalTimeoutMs ${config.totalTimeoutMs}ms) was already spent when the ladder was entered — no rung dispatched`,
209
+ result: `runCascade: the overall wall-clock budget (totalTimeoutMs ${config.totalTimeoutMs}ms) was already spent when the ladder was entered — no rung dispatched`, resultEntryIds: [],
210
210
  terminal: { kind: "failed", code: CASCADE_NO_DISPATCH_ERROR_CODE },
211
211
  stats: { tokens: 0, turns: 0, costMicroUsd: 0 },
212
212
  cascadeOutcome: "exhausted",
@@ -107,6 +107,7 @@ export function createCcPeerDirectory(opts) {
107
107
  ...(typeof r["peerProtocol"] === "number" ? { peerProtocol: r["peerProtocol"] } : {}),
108
108
  ...(features !== undefined ? { peerFeatures: features } : {}),
109
109
  sockPath,
110
+ where: "this_machine",
110
111
  });
111
112
  if (!read.ok)
112
113
  return void skip(file, "invalid_row", read.field !== undefined ? `${read.reason}: ${read.field}` : read.reason);
@@ -18,17 +18,6 @@ export declare function deploymentStatesSubagentModel(roles: ModelRoles | undefi
18
18
  * already reflects when the parent ran on it).
19
19
  */
20
20
  export declare function deploymentSubagentThinking(roles: ModelRoles | undefined): ThinkingLevel | undefined;
21
- /**
22
- * Did the deployment STATE a system prompt for its subagents — and which? The `systemPrompt` member of an
23
- * object-form `roles.subagent` entry; a string ref, a `Model` object or an entry without the member states
24
- * none. The third axis, read off the SAME seat as {@link deploymentSubagentThinking}. It has no parent rung:
25
- * a child never inherits its PARENT's system prompt, only the deployment's statement for subagents. Which
26
- * station needs to read it: one whose default persona is written onto the spec itself (the workflow lane
27
- * frames an empty `systemPrompt` with the workflow-subagent persona, so the preset must be written first, as
28
- * a custom persona to that frame); the delegation station's default rides the trusted internals channel
29
- * below the role chain, so prepare reads the preset there without this helper.
30
- */
31
- export declare function deploymentSubagentSystemPrompt(roles: ModelRoles | undefined): string | undefined;
32
21
  /**
33
22
  * The child run's THINKING seat — {@link childModelSeat}'s sister, the same rung order on the other axis
34
23
  * (#651): an EXPLICIT level for this spawn wins (the agent definition's `thinking`; a fork's explicit is the
@@ -23,9 +23,6 @@ export function deploymentStatesSubagentModel(roles) {
23
23
  export function deploymentSubagentThinking(roles) {
24
24
  return subagentRolePresets(roles)?.thinking;
25
25
  }
26
- export function deploymentSubagentSystemPrompt(roles) {
27
- return subagentRolePresets(roles)?.systemPrompt;
28
- }
29
26
  function subagentRolePresets(roles) {
30
27
  const s = roles?.subagent;
31
28
  if (s == null || typeof s === "string")
@@ -1,7 +1,7 @@
1
1
  import { Type } from "typebox";
2
2
  import type { TaskAccess } from "../core/task-registry.js";
3
3
  import { type RosterEntry } from "./roster-store.js";
4
- import { type PeerDirectory, type PeerPresence, type PeerSessionRecord } from "./peer-directory.js";
4
+ import { type PeerDirectory, type PeerPresence, type PeerSessionRecord, type PeerSessionWhere } from "./peer-directory.js";
5
5
  import type { SubagentTranscriptTier } from "../core/wiring-manifest.js";
6
6
  import { formatAgo, type AgentState, type AgentStateSource } from "../core/agent-state.js";
7
7
  import type { CheckpointSeat } from "../core/checkpoint-seat.js";
@@ -89,6 +89,8 @@ export interface ListAgentsRow {
89
89
  cwd?: string;
90
90
  /** Peer rows: the session's self-reported presence, when it reported any. */
91
91
  presence?: PeerPresence;
92
+ /** Peer rows: where the session runs, as the directory's row says it ({@link PeerSessionWhere}). */
93
+ where?: PeerSessionWhere;
92
94
  /** What SendMessage accepts: on both AGENT lanes the registry `task_id` VERBATIM (no prefixing or
93
95
  * re-minting), never the child's session id — a different domain, tabled in INTEGRATION-CORE §1.6a.
94
96
  * Peer rows carry the `session.<id>` box handle instead. */
@@ -3,7 +3,7 @@ import { defineTool } from "../core/tools.js";
3
3
  import { inlineUntrusted } from "../core/untrusted-text.js";
4
4
  import { formatPeerNameRef } from "./cross-session-ref.js";
5
5
  import { entryAccessible } from "./roster-store.js";
6
- import { mintPeerSessionCandidates, PEER_PRESENCE_MAX_CHARS, peerSessionBoxHandle } from "./peer-directory.js";
6
+ import { listPeerDirectory, mintPeerSessionCandidates, PEER_PRESENCE_MAX_CHARS, PEER_SESSION_WHERE_LABELS, peerSessionBoxHandle } from "./peer-directory.js";
7
7
  import { PEER_LANE_DEFAULTS } from "./peer-admission.js";
8
8
  import { mountRuleFace, toolFace } from "../core/tool-catalog-entries.js";
9
9
  import { thrownText } from "../core/thrown-value.js";
@@ -45,8 +45,7 @@ const PEER_ROW_STATE = {
45
45
  function peerRowState(r) {
46
46
  if (r.liveness === "dead")
47
47
  return "offline";
48
- const tempo = r.tempo;
49
- return tempo !== undefined && Object.hasOwn(PEER_ROW_STATE, tempo) ? PEER_ROW_STATE[tempo] : "unknown";
48
+ return r.tempo !== undefined ? PEER_ROW_STATE[r.tempo] : "unknown";
50
49
  }
51
50
  function renderPresence(p) {
52
51
  const parts = [...(p.agent !== undefined ? [`agent=${inlineUntrusted(p.agent, PEER_PRESENCE_MAX_CHARS)}`] : []), ...(p.intent !== undefined ? [`intent=${inlineUntrusted(p.intent, PEER_PRESENCE_MAX_CHARS)}`] : [])];
@@ -66,7 +65,7 @@ export function createListAgentsTool(opts) {
66
65
  isConcurrencySafe: () => true,
67
66
  description: `List the agents${peers ? " and peer sessions" : ""} you can message with SendMessage. ` +
68
67
  (peers
69
- ? `Peer sessions are other sessions of this engine running for the same user, shown as \`name [ref] · state · active <N> ago · <directory> · self: agent=…, intent=…\`; send to one with its name (or \`name [ref]\` ` +
68
+ ? `Peer sessions are other sessions of this engine running for the same user, shown as \`name [ref] · state · active <N> ago · <directory> · self: agent=…, intent=… · peer session <where>\` (where it runs: ${Object.values(PEER_SESSION_WHERE_LABELS).join(", or ")}); send to one with its name (or \`name [ref]\` ` +
70
69
  `when a name is ambiguous, or its \`session.<id>\` address). By default only FRESH peers are listed (working now, or active within the last ${formatAgo(windowMs)}); ` +
71
70
  `pass includeAll: true to also list stale and offline ones. A peer that is offline or unlisted still accepts messages — they are parked ` +
72
71
  `durably in its session box and delivered when it next runs. `
@@ -84,7 +83,7 @@ export function createListAgentsTool(opts) {
84
83
  let directoryFault;
85
84
  if (opts.peerDirectory !== undefined) {
86
85
  try {
87
- peerRows = await opts.peerDirectory.listPeerSessions({ scope: opts.self.scope });
86
+ peerRows = await listPeerDirectory(opts.peerDirectory, { scope: opts.self.scope });
88
87
  }
89
88
  catch (e) {
90
89
  directoryFault = thrownText(e);
@@ -108,6 +107,7 @@ export function createListAgentsTool(opts) {
108
107
  ...(r.liveness === "live" ? { lastActiveAt: r.updatedAt } : r.diedAt !== undefined ? { offlineAt: r.diedAt } : {}),
109
108
  ...(r.cwd !== undefined ? { cwd: cwdTail(r.cwd) } : {}),
110
109
  ...(presence.agent !== undefined || presence.intent !== undefined ? { presence } : {}),
110
+ where: r.where,
111
111
  });
112
112
  }
113
113
  let registryCapped = false;
@@ -172,13 +172,13 @@ export function createListAgentsTool(opts) {
172
172
  const age = r.kind !== "peer_session" ? undefined : r.lastActiveAt !== undefined ? `active ${formatAgo(now - r.lastActiveAt)} ago` : r.offlineAt !== undefined ? `offline ${formatAgo(now - r.offlineAt)} ago` : "offline";
173
173
  const activity = r.agentState !== undefined ? agentActivityClause(r.agentState) : undefined;
174
174
  const approval = r.agentState?.approval !== undefined ? agentApprovalClause(r.agentState.approval, r.agentState.readAt) : undefined;
175
- const cols = [label, r.state, age, activity, approval, r.cwd !== undefined ? inlineUntrusted(r.cwd, 64) : undefined, r.presence !== undefined ? renderPresence(r.presence) : undefined, r.kind === "peer_session" ? "peer session" : r.kind === "roster" ? rosterLabel : "agent", r.address];
175
+ const cols = [label, r.state, age, activity, approval, r.cwd !== undefined ? inlineUntrusted(r.cwd, 64) : undefined, r.presence !== undefined ? renderPresence(r.presence) : undefined, r.kind === "peer_session" ? `peer session ${PEER_SESSION_WHERE_LABELS[r.where]}` : r.kind === "roster" ? rosterLabel : "agent", r.address];
176
176
  return cols.filter((c) => c !== undefined).join(" · ");
177
177
  });
178
178
  const finishedCount = rows.filter((r) => r.state === "finished").length;
179
179
  const header = rows.length === 0 ? "No agents or peer sessions are listed right now." : `${rows.length} listed:`;
180
180
  const finishedNote = finishedCount > 0 ? `\n(${finishedCount} finished agent(s): continuable by SendMessage only ${finishedReach} — otherwise SendMessage answers with an honest refusal)` : "";
181
- const fault = (directoryFault !== undefined ? `\n(peer-session directory unreadable: ${inlineUntrusted(directoryFault, 200)} — peer rows may be missing)` : "") +
181
+ const fault = (directoryFault !== undefined ? `\n(peer-session directory unreadable: ${inlineUntrusted(directoryFault, 200)} — no peer row is listed until its host fixes it)` : "") +
182
182
  (registryCapped ? "\n(the live task list is at its 500-row window: older background agents may be missing from this listing — address them by task_id)" : "");
183
183
  let content = `${header}${lines.length > 0 ? `\n${lines.join("\n")}` : ""}${finishedNote}${fault}`;
184
184
  if (content.length > LIST_AGENTS_MAX_RESULT_CHARS)
@@ -22,8 +22,20 @@ export declare function peerPresenceLabelValid(v: unknown): v is string | undefi
22
22
  /** Prepare's door: `TaskSpec.peerPresence` is a plain object whose `agent` / `intent` each pass {@link peerPresenceLabelValid}
23
23
  * — else `config.peer_presence_invalid`, naming the field. */
24
24
  export declare function assertPeerPresenceValue(v: unknown): void;
25
+ /**
26
+ * WHERE a peer session runs — the directory's word, like `liveness`. `this_machine` = a process on the ACCESSOR's
27
+ * machine, said only by a directory that reads that machine ({@link PeerDirectoryAccess} names a scope, not a
28
+ * machine); `hosted` = a session a hosting service runs, reached only through the store. `pid` / `procStartMs` /
29
+ * `sockPath` ride a `this_machine` row only ({@link readPeerSessionRecord}), so none of their readers reads `where` —
30
+ * for a row of plain data members: the reader does not snapshot an accessor member, which can answer differently per read.
31
+ */
32
+ export declare const PEER_SESSION_WHERE_VALUES: readonly ["this_machine", "hosted"];
33
+ export type PeerSessionWhere = (typeof PEER_SESSION_WHERE_VALUES)[number];
34
+ /** THE wording of each value — the listing's kind column and the ambiguity error read this one table. */
35
+ export declare const PEER_SESSION_WHERE_LABELS: Readonly<Record<PeerSessionWhere, string>>;
25
36
  /** The registration row. Field set = CC's load-bearing subset + sema's `scope` axis + the sema-only
26
- * liveness/tombstone members. A host writes it; every terminal reads it through {@link readPeerSessionRecord}. */
37
+ * liveness/tombstone/where members. A host writes it; every terminal reads it through {@link readPeerSessionRecord}
38
+ * (the engine: {@link listPeerDirectory}; `peerDirectoryContract` checks a directory lists only rows it accepts). */
27
39
  export interface PeerSessionRecord {
28
40
  schemaVersion: number;
29
41
  /** The session's durable identity: its box address is `session.<sessionId>` ({@link peerSessionBoxHandle}). */
@@ -52,6 +64,8 @@ export interface PeerSessionRecord {
52
64
  liveness: PeerSessionLiveness;
53
65
  /** Present iff `liveness !== "live"`: when the row was marked dead (or the tombstone was written). */
54
66
  diedAt?: number;
67
+ /** Where the session runs ({@link PeerSessionWhere}) — the directory's word, never derived from the other members. */
68
+ where: PeerSessionWhere;
55
69
  /** The host's activity word. A stale `tempo` is the host's to clear: a row that says `active` is
56
70
  * listed as fresh regardless of its age. */
57
71
  tempo?: PeerSessionTempo;
@@ -135,10 +149,10 @@ export interface PeerLivenessProbe {
135
149
  export declare const defaultPeerLivenessProbe: PeerLivenessProbe;
136
150
  /**
137
151
  * Is the row's process alive? `false` when the pid is gone, OR when the probe knows a start time and it
138
- * disagrees with the row's (PID reuse — a different process wears the number). A row with no pid has
139
- * no process to probe and is judged by its declared liveness alone.
152
+ * disagrees with the row's (PID reuse — a different process wears the number). A row with no LOCAL process
153
+ * (no pid, or not `this_machine`: its pid is not this machine's to signal) is judged by its declared liveness alone.
140
154
  */
141
- export declare function isPeerSessionProcessAlive(record: Pick<PeerSessionRecord, "pid" | "procStartMs" | "liveness">, probe?: PeerLivenessProbe): boolean;
155
+ export declare function isPeerSessionProcessAlive(record: Pick<PeerSessionRecord, "pid" | "procStartMs" | "liveness" | "where">, probe?: PeerLivenessProbe): boolean;
142
156
  export interface PeerDirectoryAccess {
143
157
  /** The accessor's scope — rows of any other scope are never returned (§10 wall). */
144
158
  scope: string;
@@ -167,6 +181,10 @@ export interface PeerDirectory {
167
181
  */
168
182
  restorePeerSession?(record: PeerSessionRecord): boolean | Promise<boolean>;
169
183
  }
184
+ /** THE engine's read of a directory: every listed row through {@link readPeerSessionRecord}. A row it refuses
185
+ * faults the WHOLE listing (thrown, so each consumer's fault arm speaks), never a partial set — refs are minted and
186
+ * names resolved over the full set, and dropping one row would change both. */
187
+ export declare function listPeerDirectory(dir: PeerDirectory, access: PeerDirectoryAccess): Promise<PeerSessionRecord[]>;
170
188
  export interface PeerSessionCandidate {
171
189
  record: PeerSessionRecord;
172
190
  /** The listing-minted ref (6..12 hex) of this row — stable across the live/dead filter because it is
@@ -19,6 +19,12 @@ export function assertPeerPresenceValue(v) {
19
19
  e.code = "config.peer_presence_invalid";
20
20
  throw e;
21
21
  }
22
+ export const PEER_SESSION_WHERE_VALUES = Object.freeze(["this_machine", "hosted"]);
23
+ function isPeerSessionWhere(v) {
24
+ return PEER_SESSION_WHERE_VALUES.some((w) => w === v);
25
+ }
26
+ export const PEER_SESSION_WHERE_LABELS = Object.freeze({ this_machine: "on this machine", hosted: "hosted by the service" });
27
+ const MACHINE_BOUND_MEMBERS = ["pid", "procStartMs", "sockPath"];
22
28
  export const SEMA_MAILBOX_FEATURE_PREFIX = "sema_mailbox_v1_";
23
29
  export function semaMailboxFeature(storeIdentity) {
24
30
  return `${SEMA_MAILBOX_FEATURE_PREFIX}${createHash("sha256").update(storeIdentity).digest("hex").slice(0, 16)}`;
@@ -109,6 +115,12 @@ export function readPeerSessionRecord(raw) {
109
115
  const inboundPosture = r["inboundPosture"];
110
116
  if (inboundPosture !== undefined && inboundPosture !== "available" && inboundPosture !== "unavailable")
111
117
  return bad("inboundPosture");
118
+ const where = r["where"];
119
+ if (!isPeerSessionWhere(where))
120
+ return bad("where");
121
+ const misplaced = where === "this_machine" ? undefined : MACHINE_BOUND_MEMBERS.find((k) => r[k] !== undefined);
122
+ if (misplaced !== undefined)
123
+ return bad(misplaced);
112
124
  const record = {
113
125
  schemaVersion: r["schemaVersion"],
114
126
  sessionId: r["sessionId"],
@@ -125,6 +137,7 @@ export function readPeerSessionRecord(raw) {
125
137
  updatedAt: r["updatedAt"],
126
138
  liveness,
127
139
  ...(r["diedAt"] !== undefined ? { diedAt: r["diedAt"] } : {}),
140
+ where,
128
141
  ...(tempo !== undefined ? { tempo } : {}),
129
142
  ...(r["entrypoint"] !== undefined ? { entrypoint: r["entrypoint"] } : {}),
130
143
  ...(r["peerProtocol"] !== undefined ? { peerProtocol: r["peerProtocol"] } : {}),
@@ -148,7 +161,7 @@ export const defaultPeerLivenessProbe = {
148
161
  export function isPeerSessionProcessAlive(record, probe = defaultPeerLivenessProbe) {
149
162
  if (record.liveness !== "live")
150
163
  return false;
151
- if (record.pid === undefined)
164
+ if (record.pid === undefined || record.where !== "this_machine")
152
165
  return true;
153
166
  if (!probe.processExists(record.pid))
154
167
  return false;
@@ -159,6 +172,15 @@ export function isPeerSessionProcessAlive(record, probe = defaultPeerLivenessPro
159
172
  }
160
173
  return true;
161
174
  }
175
+ export async function listPeerDirectory(dir, access) {
176
+ return (await dir.listPeerSessions(access)).map((raw) => {
177
+ const read = readPeerSessionRecord(raw);
178
+ if (read.ok)
179
+ return read.record;
180
+ const id = typeof raw?.sessionId === "string" ? inlineUntrusted(raw.sessionId, 80) : "(no session id)";
181
+ throw new Error(`the directory listed a row this engine cannot read (${id}: ${read.reason}${read.field !== undefined ? `: ${read.field}` : ""}); no peer row is used until its host fixes it`);
182
+ });
183
+ }
162
184
  export function mintPeerSessionCandidates(records, self) {
163
185
  const entries = records.map((record) => ({ kind: "session", id: record.sessionId.toLowerCase(), record }));
164
186
  const selfEntry = self !== undefined && !records.some((r) => r.sessionId.toLowerCase() === self.sessionId.toLowerCase()) ? { kind: "session", id: self.sessionId.toLowerCase() } : undefined;
@@ -166,7 +188,7 @@ export function mintPeerSessionCandidates(records, self) {
166
188
  }
167
189
  function describeCandidate(c) {
168
190
  const state = c.record.liveness === "live" ? "" : c.record.liveness === "dead" ? " (offline)" : " (deleted)";
169
- return `${formatPeerNameRef(inlineUntrusted(c.record.name, 64), c.ref)}${state} → ${peerSessionBoxHandle(c.record.sessionId)}`;
191
+ return `${formatPeerNameRef(inlineUntrusted(c.record.name, 64), c.ref)}${state}, ${PEER_SESSION_WHERE_LABELS[c.record.where]} → ${peerSessionBoxHandle(c.record.sessionId)}`;
170
192
  }
171
193
  export function resolvePeerSessions(records, to, self) {
172
194
  const candidates = mintPeerSessionCandidates(records, self);
@@ -7,7 +7,7 @@ import { deliverEngineNotice } from "../core/types.js";
7
7
  import { buildCrossSessionEnvelope, CrossSessionCodecError, encodePeerAddress } from "./cross-session-envelope.js";
8
8
  import { judgeCrossSessionInbound, principalInboundLayers, resolveCrossSessionInboundSetting } from "./cross-session-judge.js";
9
9
  import { judgePeerAdmission, peerAxisToken, resolvePeerLaneConfig } from "./peer-admission.js";
10
- import { isPeerSessionId, PEER_SESSION_ID_GRAMMAR, peerSessionBoxHandle } from "./peer-directory.js";
10
+ import { isPeerSessionId, listPeerDirectory, PEER_SESSION_ID_GRAMMAR, peerSessionBoxHandle } from "./peer-directory.js";
11
11
  import { inlineUntrusted } from "../core/untrusted-text.js";
12
12
  import { createListAgentsTool, LIST_AGENTS_TOOL_ALIAS, LIST_AGENTS_TOOL_NAME } from "./list-agents-tool.js";
13
13
  import { foldPermissionModeClass } from "./cross-session-judge.js";
@@ -830,7 +830,7 @@ export function bindPeerLaneDrain(harness, args) {
830
830
  if (deps.peerDirectory === undefined)
831
831
  return;
832
832
  try {
833
- const rows = await deps.peerDirectory.listPeerSessions({ scope: args.scope });
833
+ const rows = await listPeerDirectory(deps.peerDirectory, { scope: args.scope });
834
834
  rowName = rows.find((r) => r.sessionId.toLowerCase() === args.sessionId.toLowerCase())?.name;
835
835
  }
836
836
  catch {
@@ -48,7 +48,7 @@ export async function runRepairLoop(runner, implSpec, config) {
48
48
  const oracle = { tier: "none", passed: false, flaky: false, retries: 0 };
49
49
  return {
50
50
  taskId: implSpec.taskId ?? "",
51
- result: `oracle isolation check failed: ${reason}`,
51
+ result: `oracle isolation check failed: ${reason}`, resultEntryIds: [],
52
52
  terminal: { kind: "failed", code: "oracle.unprotected", message: `oracle isolation check failed: ${reason}` },
53
53
  sessionId: "",
54
54
  stats: { tokens: 0, turns: 0, costMicroUsd: 0 },
@@ -160,7 +160,7 @@ export async function runRepairLoop(runner, implSpec, config) {
160
160
  };
161
161
  const exhaustedBeforeDispatch = (message, errorCode) => ({
162
162
  taskId: implSpec.taskId ?? "",
163
- result: message ?? `repair loop: attempt budget already spent (attemptCount ${bundle.attemptCount} >= maxAttempts ${maxAttempts}) — no attempt dispatched`,
163
+ result: message ?? `repair loop: attempt budget already spent (attemptCount ${bundle.attemptCount} >= maxAttempts ${maxAttempts}) — no attempt dispatched`, resultEntryIds: [],
164
164
  terminal: { kind: "failed", code: errorCode ?? "repair.attempts_exhausted", message: message ?? `repair loop: attempt budget already spent (attemptCount ${bundle.attemptCount} >= maxAttempts ${maxAttempts}) — no attempt dispatched` },
165
165
  sessionId: implSpec.sessionId ?? "",
166
166
  stats: { tokens: 0, turns: 0, costMicroUsd: 0 },
@@ -6,7 +6,7 @@ import { announceTranscriptIntegrityGapOnce, canAccessAgentRecord, clearRevivedR
6
6
  import { uuidv7 } from "../internal/harness.js";
7
7
  import { MAILBOX_TOMBSTONED_RECIPIENT_CODE, mailboxCrossProcessMountVerdict } from "../core/mailbox-store.js";
8
8
  import { peerSendVerdictSeverity } from "./cross-session-judge.js";
9
- import { parsePeerSessionAddress, peerSessionBoxHandle, peerSessionLane, resolvePeerSessions } from "./peer-directory.js";
9
+ import { listPeerDirectory, parsePeerSessionAddress, peerSessionBoxHandle, peerSessionLane, resolvePeerSessions } from "./peer-directory.js";
10
10
  import { peerIdleMachineFor } from "./peer-idle.js";
11
11
  import { PEER_IDLE_OUTSTANDING_CAP, PEER_IDLE_SUBSCRIPTION_TTL_MS, peerIdleNoticeLabel } from "./peer-notices.js";
12
12
  import { escapeAttributeValue, escapeEnvelopeTag, isObserverTaskId, OBSERVER_SENDMESSAGE_SENDER_REFUSAL, OBSERVER_SENDMESSAGE_TARGET_REFUSAL, } from "./observer.js";
@@ -263,7 +263,7 @@ export function createSendMessageTool(opts) {
263
263
  let ownRowName;
264
264
  const resolvePeerTarget = async () => {
265
265
  try {
266
- const rows = await opts.peerDirectory.listPeerSessions({ scope: peerScope ?? "" });
266
+ const rows = await listPeerDirectory(opts.peerDirectory, { scope: peerScope ?? "" });
267
267
  if (peerSelfSessionId !== undefined)
268
268
  ownRowName = rows.find((r) => r.sessionId.toLowerCase() === peerSelfSessionId.toLowerCase())?.name;
269
269
  return resolvePeerSessions(rows, to, peerSelfSessionId !== undefined ? { sessionId: peerSelfSessionId } : undefined);
@@ -349,7 +349,7 @@ export function createSendMessageTool(opts) {
349
349
  const doorbell = opts.peerChannel !== undefined && record.sockPath !== undefined && record.liveness === "live" && (seq !== undefined || subscriptionSeq !== undefined) ? await opts.peerChannel.nudge(record.sockPath).catch(() => false) : undefined;
350
350
  let rowRestored = "present";
351
351
  try {
352
- const rowsNow = await opts.peerDirectory.listPeerSessions({ scope: peerScope });
352
+ const rowsNow = await listPeerDirectory(opts.peerDirectory, { scope: peerScope });
353
353
  const nowRow = rowsNow.find((r) => r.sessionId.toLowerCase() === record.sessionId.toLowerCase());
354
354
  if (nowRow?.liveness === "deleted")
355
355
  rowRestored = "deleted_meanwhile";
@@ -906,7 +906,7 @@ export function createSendMessageTool(opts) {
906
906
  (suggestion !== undefined ? ` Did you mean: ${suggestion}?` : "") +
907
907
  (labels.length > 0 ? ` Running background agents: ${labels.join(", ")}.` : "") +
908
908
  ` Reachable from here: ${reachable.join("; ").slice(0, 300)}.` +
909
- ` Note: a completed foreground agent is not resumable (its transcript is not retained) — spawn with run_in_background to keep an agent addressable, or launch a new agent.`,
909
+ ` Note: a completed foreground agent is not addressable (nothing retains its transcript) — name an agent or run it in the background to keep it addressable (a named agent always runs in the background), or launch a new agent.`,
910
910
  details: { error: "not_found", to, ...(suggestion !== undefined ? { suggestion } : {}) },
911
911
  isError: true,
912
912
  };
@@ -168,9 +168,6 @@ export interface SubagentWorktreeIsolation {
168
168
  /** CC "auto-cleaned if unchanged": remove the worktree when clean, keep it when the child made changes. */
169
169
  finish(worktreeDir: string): Promise<"pruned" | "kept">;
170
170
  }
171
- /** Is `result` one of the delegation tool's refusals before any child ran ({@link notStartedResult})? The brand only: the identity
172
- * of its `details` object, never what the result says. */
173
- export declare function isNotStartedDelegationResult(result: unknown): boolean;
174
171
  /**
175
172
  * Build the {@link SubagentWorktreeIsolation} helper over a base env + repo root. Called by `prepare-task`
176
173
  * (closure over the run's ExecutionEnv/taskRootPath — trusted, mirrors the scheduler/fork mounts). The
@@ -672,10 +669,15 @@ export interface SubagentToolOptions {
672
669
  allowTools?: string[];
673
670
  /** Tool-level denylist (design/38 1A), used when no `agent` is selected: the denied half of the child's own selector layer (a deny wins). */
674
671
  denyTools?: string[];
675
- /** System prompt / persona for the child. Default (since 1.259.0): the LEAN
672
+ /** System prompt / persona for the child, by TEXT — the child's own role-base statement, written on its task seat (an
673
+ * agent definition's `systemPrompt` wins over it). Default (since 1.259.0): the LEAN
676
674
  * {@link SUBAGENT_PROMPT} (agent persona + return contract), NOT the full default constitution role
677
675
  * base — pass `DEFAULT_SYSTEM_PROMPT` here explicitly to restore the pre-1.259 behavior. */
678
676
  systemPrompt?: string;
677
+ /** The child's role base by WORD (`TaskSpec.promptRole`'s closed set: `"code"` gives the children the catalog's coding
678
+ * base): the same seat as {@link systemPrompt} (text beside it replaces the base this word selects) — so a role
679
+ * preset never overtakes it. Outside the closed set ⇒ refused when the tool is built (`config.prompt_selector_invalid`). */
680
+ promptRole?: import("../prompt-assembly/catalog/schema.js").HostRole;
679
681
  /** Tool name exposed to the parent. Default "Agent". */
680
682
  name?: string;
681
683
  /** What the child is for (shown to the parent in the tool description). */