@sema-agent/core 7.67.2 → 7.68.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 (505) hide show
  1. package/CHANGELOG.md +1533 -0
  2. package/README.md +18 -9
  3. package/README.zh-CN.md +16 -8
  4. package/dist/agents/agent-definition.d.ts +1 -1
  5. package/dist/agents/agent-definition.js +4 -1
  6. package/dist/agents/cascade.d.ts +2 -2
  7. package/dist/agents/cascade.js +3 -1
  8. package/dist/agents/cumulative-stats.d.ts +2 -1
  9. package/dist/agents/cumulative-stats.js +4 -1
  10. package/dist/agents/list-agents-tool.d.ts +30 -0
  11. package/dist/agents/list-agents-tool.js +45 -3
  12. package/dist/agents/peer-admission.d.ts +2 -2
  13. package/dist/agents/peer-session-drain.d.ts +2 -0
  14. package/dist/agents/peer-session-drain.js +1 -0
  15. package/dist/agents/repair-loop.js +3 -1
  16. package/dist/agents/retain-ledger.d.ts +61 -8
  17. package/dist/agents/retain-ledger.js +25 -3
  18. package/dist/agents/roster-store.d.ts +4 -2
  19. package/dist/agents/send-message-tool.d.ts +1 -1
  20. package/dist/agents/send-message-tool.js +20 -15
  21. package/dist/agents/subagent-steps.js +2 -10
  22. package/dist/agents/subagent.d.ts +3 -0
  23. package/dist/agents/subagent.js +106 -76
  24. package/dist/agents/tool-filter.d.ts +20 -11
  25. package/dist/agents/tool-filter.js +8 -4
  26. package/dist/agents/verify.d.ts +3 -1
  27. package/dist/agents/verify.js +2 -0
  28. package/dist/brain/anthropic.js +4 -4
  29. package/dist/brain/errors.d.ts +20 -0
  30. package/dist/brain/errors.js +114 -0
  31. package/dist/brain/open-responses.js +3 -1
  32. package/dist/brain/openai.js +3 -1
  33. package/dist/brain/provider-message.d.ts +5 -3
  34. package/dist/brain/provider-message.js +35 -8
  35. package/dist/brain/reasoning-request.d.ts +73 -19
  36. package/dist/brain/reasoning-request.js +164 -72
  37. package/dist/brain/reasoning-stamp.d.ts +26 -0
  38. package/dist/brain/reasoning-stamp.js +10 -0
  39. package/dist/brain/reasoning.d.ts +95 -162
  40. package/dist/brain/reasoning.js +31 -86
  41. package/dist/brain/route-adjudicator.d.ts +9 -7
  42. package/dist/brain/route-adjudicator.js +12 -10
  43. package/dist/brain/status-sink.d.ts +19 -64
  44. package/dist/brain/status-sink.js +5 -21
  45. package/dist/brain/stream-engine.d.ts +11 -2
  46. package/dist/brain/stream-engine.js +10 -0
  47. package/dist/core/a2a.d.ts +17 -5
  48. package/dist/core/a2a.js +11 -3
  49. package/dist/core/allow-entry.d.ts +35 -15
  50. package/dist/core/allow-entry.js +47 -60
  51. package/dist/core/ask-headline.d.ts +68 -0
  52. package/dist/core/ask-headline.js +23 -0
  53. package/dist/core/ask-origin.d.ts +36 -8
  54. package/dist/core/ask-origin.js +17 -10
  55. package/dist/core/ask-question.d.ts +34 -7
  56. package/dist/core/ask-question.js +10 -1
  57. package/dist/core/ask-unresolvable-notice.d.ts +7 -0
  58. package/dist/core/ask-unresolvable-notice.js +9 -3
  59. package/dist/core/auto-strip.d.ts +53 -0
  60. package/dist/core/auto-strip.js +76 -0
  61. package/dist/core/background-agent-store.d.ts +45 -5
  62. package/dist/core/background-agent-store.js +69 -15
  63. package/dist/core/background-shell.d.ts +2 -2
  64. package/dist/core/caller-text.js +2 -2
  65. package/dist/core/canonical-json.d.ts +13 -0
  66. package/dist/core/canonical-json.js +7 -0
  67. package/dist/core/checkpoint-features.d.ts +66 -20
  68. package/dist/core/checkpoint-features.js +12 -1
  69. package/dist/core/checkpoint-generation.d.ts +1 -1
  70. package/dist/core/checkpoint-queries.d.ts +1 -1
  71. package/dist/core/checkpoint-queries.js +4 -1
  72. package/dist/core/checkpoint-requirements.d.ts +25 -1
  73. package/dist/core/checkpoint-requirements.js +5 -1
  74. package/dist/core/checkpoint-row-verdict.d.ts +1 -0
  75. package/dist/core/checkpoint-row-verdict.js +4 -0
  76. package/dist/core/checkpoint-store.d.ts +66 -38
  77. package/dist/core/checkpoint-store.js +15 -6
  78. package/dist/core/child-clamp-seats.d.ts +6 -0
  79. package/dist/core/child-clamp-seats.js +1 -0
  80. package/dist/core/config-refusal-codes.d.ts +1 -1
  81. package/dist/core/config-refusal-codes.js +1 -0
  82. package/dist/core/delegation-frames.d.ts +9 -12
  83. package/dist/core/delegation-frames.js +9 -8
  84. package/dist/core/engine-capabilities.d.ts +21 -8
  85. package/dist/core/engine-capabilities.js +1 -1
  86. package/dist/core/engine-notice.d.ts +147 -34
  87. package/dist/core/engine-notice.js +27 -16
  88. package/dist/core/engine-storage-backend.d.ts +2 -1
  89. package/dist/core/env-budget.js +3 -3
  90. package/dist/core/env-knob-announce.d.ts +10 -10
  91. package/dist/core/env-knob-announce.js +3 -6
  92. package/dist/core/file-history-store.d.ts +29 -4
  93. package/dist/core/file-history-store.js +13 -0
  94. package/dist/core/frame-settlement.d.ts +2 -1
  95. package/dist/core/gate-fold.js +1 -1
  96. package/dist/core/gate-lanes.js +56 -49
  97. package/dist/core/governance-codes.d.ts +39 -3
  98. package/dist/core/governance-codes.js +61 -3
  99. package/dist/core/hooks.d.ts +29 -11
  100. package/dist/core/hooks.js +5 -2
  101. package/dist/core/human-input-projection.js +3 -3
  102. package/dist/core/input-author.d.ts +17 -3
  103. package/dist/core/input-author.js +15 -3
  104. package/dist/core/leg-identity.d.ts +10 -28
  105. package/dist/core/leg-identity.js +1 -21
  106. package/dist/core/lsp.d.ts +18 -13
  107. package/dist/core/lsp.js +30 -22
  108. package/dist/core/mailbox-store.d.ts +1 -1
  109. package/dist/core/mailbox-store.js +4 -4
  110. package/dist/core/mcp-connection-pool.d.ts +93 -4
  111. package/dist/core/mcp-connection-pool.js +104 -1
  112. package/dist/core/mcp-failure.d.ts +38 -12
  113. package/dist/core/mcp-failure.js +9 -13
  114. package/dist/core/mcp-probe.d.ts +4 -3
  115. package/dist/core/mcp-server-link.d.ts +4 -2
  116. package/dist/core/mcp-server-link.js +4 -5
  117. package/dist/core/mcp-server-spec.d.ts +3 -3
  118. package/dist/core/mcp-server-unavailable-notice.d.ts +22 -8
  119. package/dist/core/mcp-server-unavailable-notice.js +18 -4
  120. package/dist/core/mcp.d.ts +40 -6
  121. package/dist/core/mcp.js +39 -13
  122. package/dist/core/memory-engine/content-origin.js +2 -2
  123. package/dist/core/memory-engine/control-objects.d.ts +2 -4
  124. package/dist/core/memory-engine/control-objects.js +2 -10
  125. package/dist/core/memory-engine/delegation-settlement.js +6 -1
  126. package/dist/core/memory-engine/dual-root.js +3 -0
  127. package/dist/core/memory-engine/engine.d.ts +6 -4
  128. package/dist/core/memory-engine/engine.js +32 -29
  129. package/dist/core/memory-engine/file-backend.d.ts +20 -5
  130. package/dist/core/memory-engine/file-backend.js +21 -31
  131. package/dist/core/memory-engine/frontmatter.d.ts +2 -0
  132. package/dist/core/memory-engine/frontmatter.js +4 -0
  133. package/dist/core/memory-engine/layout.d.ts +114 -20
  134. package/dist/core/memory-engine/layout.js +340 -22
  135. package/dist/core/memory-engine/memory-deployment.d.ts +7 -5
  136. package/dist/core/memory-engine/mount-failed-notice.d.ts +19 -7
  137. package/dist/core/memory-engine/mount-failed-notice.js +43 -10
  138. package/dist/core/memory-engine/sync-client.js +4 -5
  139. package/dist/core/model-fallbacks.d.ts +5 -1
  140. package/dist/core/model-fallbacks.js +3 -3
  141. package/dist/core/model-receipt.d.ts +2 -1
  142. package/dist/core/model-receipt.js +12 -1
  143. package/dist/core/mods/kernel/dispatch.d.ts +2 -2
  144. package/dist/core/mods/kernel/dispatch.js +14 -6
  145. package/dist/core/mods/kernel/events.d.ts +8 -5
  146. package/dist/core/mods/kernel/events.js +2 -2
  147. package/dist/core/mods/kernel/index.d.ts +1 -1
  148. package/dist/core/mods/kernel/registration.d.ts +9 -0
  149. package/dist/core/mods/package.js +1 -1
  150. package/dist/core/mods/session-append.d.ts +4 -2
  151. package/dist/core/mods/session-append.js +3 -0
  152. package/dist/core/mods/stations.d.ts +7 -11
  153. package/dist/core/mods/stations.js +4 -7
  154. package/dist/core/mods/tool-call.d.ts +10 -8
  155. package/dist/core/mods/tool-call.js +15 -18
  156. package/dist/core/mounted-mcp.d.ts +0 -4
  157. package/dist/core/mounted-mcp.js +1 -1
  158. package/dist/core/park-noun.d.ts +24 -0
  159. package/dist/core/park-noun.js +21 -0
  160. package/dist/core/park-resumability.d.ts +60 -0
  161. package/dist/core/park-resumability.js +30 -0
  162. package/dist/core/permission-rule-provider.d.ts +24 -2
  163. package/dist/core/permission-rule-provider.js +11 -8
  164. package/dist/core/permission-rule-store.d.ts +8 -1
  165. package/dist/core/permission-rule-store.js +2 -3
  166. package/dist/core/permission-rules.d.ts +2 -1
  167. package/dist/core/permission-rules.js +8 -4
  168. package/dist/core/persisted-rule-arms.d.ts +3 -0
  169. package/dist/core/persisted-rule-arms.js +2 -1
  170. package/dist/core/present-plan-tool.d.ts +47 -3
  171. package/dist/core/present-plan-tool.js +62 -4
  172. package/dist/core/principal-name.d.ts +1 -1
  173. package/dist/core/principal-name.js +5 -5
  174. package/dist/core/process-identity.js +10 -5
  175. package/dist/core/protocol-http-auth.d.ts +30 -9
  176. package/dist/core/protocol-http-auth.js +113 -59
  177. package/dist/core/read-only-shell.js +9 -5
  178. package/dist/core/redaction-marks.d.ts +4 -26
  179. package/dist/core/redaction-marks.js +9 -21
  180. package/dist/core/remote-env.d.ts +43 -16
  181. package/dist/core/remote-env.js +1 -1
  182. package/dist/core/request-copy-projection.d.ts +1 -1
  183. package/dist/core/request-copy-projection.js +40 -50
  184. package/dist/core/resume-config-judge.js +1 -1
  185. package/dist/core/resume-startup-cause.d.ts +35 -18
  186. package/dist/core/resume-startup-cause.js +13 -10
  187. package/dist/core/retention.d.ts +167 -25
  188. package/dist/core/retention.js +100 -20
  189. package/dist/core/roles.d.ts +6 -0
  190. package/dist/core/roles.js +11 -5
  191. package/dist/core/rule-lane-reads.d.ts +3 -0
  192. package/dist/core/rule-lane-reads.js +5 -1
  193. package/dist/core/rule-store-fault.d.ts +70 -0
  194. package/dist/core/rule-store-fault.js +102 -0
  195. package/dist/core/runner/advertised-writable-dirs.js +16 -31
  196. package/dist/core/runner/announce-once-ledger.d.ts +19 -2
  197. package/dist/core/runner/announce-once-ledger.js +24 -2
  198. package/dist/core/runner/assemble-result.d.ts +6 -0
  199. package/dist/core/runner/assemble-result.js +1 -1
  200. package/dist/core/runner/auto-strip-notice.d.ts +36 -0
  201. package/dist/core/runner/auto-strip-notice.js +59 -0
  202. package/dist/core/runner/branch-window.d.ts +3 -0
  203. package/dist/core/runner/branch-window.js +37 -0
  204. package/dist/core/runner/caller-roster.d.ts +8 -3
  205. package/dist/core/runner/capability-withheld-seat.js +3 -9
  206. package/dist/core/runner/clock-and-limits.d.ts +22 -1
  207. package/dist/core/runner/clock-and-limits.js +30 -0
  208. package/dist/core/runner/contracts.d.ts +58 -35
  209. package/dist/core/runner/credential-refusal-seat.d.ts +2 -0
  210. package/dist/core/runner/credential-refusal-seat.js +47 -0
  211. package/dist/core/runner/cross-boundary-lane.js +6 -4
  212. package/dist/core/runner/decide-continuation.js +1 -1
  213. package/dist/core/runner/file-history-restore.d.ts +53 -2
  214. package/dist/core/runner/file-history-restore.js +29 -10
  215. package/dist/core/runner/forward-sink.d.ts +14 -1
  216. package/dist/core/runner/forward-sink.js +14 -12
  217. package/dist/core/runner/gate-exit.d.ts +8 -7
  218. package/dist/core/runner/gate-exit.js +13 -13
  219. package/dist/core/runner/git-status-frame.js +2 -4
  220. package/dist/core/runner/initial-run-state.js +1 -1
  221. package/dist/core/runner/main-call-account.d.ts +3 -1
  222. package/dist/core/runner/main-call-account.js +5 -3
  223. package/dist/core/runner/mcp-redial.d.ts +2 -5
  224. package/dist/core/runner/mcp-redial.js +2 -2
  225. package/dist/core/runner/nested-memory-content.d.ts +7 -1
  226. package/dist/core/runner/nested-memory-content.js +73 -13
  227. package/dist/core/runner/nested-memory-lane.d.ts +44 -19
  228. package/dist/core/runner/nested-memory-lane.js +152 -76
  229. package/dist/core/runner/park-commit.js +3 -1
  230. package/dist/core/runner/permission-rule-lanes.d.ts +8 -2
  231. package/dist/core/runner/permission-rule-lanes.js +29 -3
  232. package/dist/core/runner/person-path-rows.d.ts +3 -11
  233. package/dist/core/runner/person-path-rows.js +21 -24
  234. package/dist/core/runner/prepare-acquire-reconcile.js +3 -1
  235. package/dist/core/runner/prepare-artifact.d.ts +1 -1
  236. package/dist/core/runner/prepare-artifact.js +20 -14
  237. package/dist/core/runner/prepare-ask-lane.d.ts +9 -6
  238. package/dist/core/runner/prepare-ask-lane.js +6 -5
  239. package/dist/core/runner/prepare-boundary-parks.d.ts +7 -1
  240. package/dist/core/runner/prepare-boundary-parks.js +27 -24
  241. package/dist/core/runner/prepare-caps-and-workflow.d.ts +5 -2
  242. package/dist/core/runner/prepare-caps-and-workflow.js +4 -3
  243. package/dist/core/runner/prepare-config-doors.d.ts +9 -24
  244. package/dist/core/runner/prepare-config-doors.js +58 -41
  245. package/dist/core/runner/prepare-context-lane.d.ts +2 -2
  246. package/dist/core/runner/prepare-context-lane.js +3 -5
  247. package/dist/core/runner/prepare-defer-classify.d.ts +1 -1
  248. package/dist/core/runner/prepare-defer-classify.js +1 -1
  249. package/dist/core/runner/prepare-delegation-surface.d.ts +2 -2
  250. package/dist/core/runner/prepare-delegation-surface.js +3 -2
  251. package/dist/core/runner/prepare-file-history.d.ts +62 -26
  252. package/dist/core/runner/prepare-file-history.js +117 -46
  253. package/dist/core/runner/prepare-gate-stations.d.ts +4 -0
  254. package/dist/core/runner/prepare-gate-stations.js +6 -5
  255. package/dist/core/runner/prepare-hands-readface.d.ts +9 -4
  256. package/dist/core/runner/prepare-hands-readface.js +8 -4
  257. package/dist/core/runner/prepare-inherited-gate.d.ts +11 -4
  258. package/dist/core/runner/prepare-inherited-gate.js +6 -6
  259. package/dist/core/runner/prepare-listings.d.ts +1 -1
  260. package/dist/core/runner/prepare-listings.js +1 -1
  261. package/dist/core/runner/prepare-memory.js +2 -2
  262. package/dist/core/runner/prepare-offload-wrappers.d.ts +1 -1
  263. package/dist/core/runner/prepare-offload-wrappers.js +1 -1
  264. package/dist/core/runner/prepare-park-ask.d.ts +10 -3
  265. package/dist/core/runner/prepare-park-ask.js +7 -9
  266. package/dist/core/runner/prepare-policy-chain.d.ts +18 -9
  267. package/dist/core/runner/prepare-policy-chain.js +18 -13
  268. package/dist/core/runner/prepare-project-context.d.ts +1 -1
  269. package/dist/core/runner/prepare-project-context.js +5 -3
  270. package/dist/core/runner/prepare-prompt-assembly.js +2 -1
  271. package/dist/core/runner/prepare-prompt-inputs.d.ts +2 -2
  272. package/dist/core/runner/prepare-prompt-inputs.js +1 -1
  273. package/dist/core/runner/prepare-protocol-tools.d.ts +4 -5
  274. package/dist/core/runner/prepare-protocol-tools.js +7 -7
  275. package/dist/core/runner/prepare-question-face.d.ts +4 -2
  276. package/dist/core/runner/prepare-run-refs.d.ts +7 -2
  277. package/dist/core/runner/prepare-run-refs.js +8 -7
  278. package/dist/core/runner/prepare-safety-scan.d.ts +4 -3
  279. package/dist/core/runner/prepare-suspend-saga.d.ts +3 -7
  280. package/dist/core/runner/prepare-suspend-saga.js +4 -3
  281. package/dist/core/runner/prepare-task.js +66 -53
  282. package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +3 -2
  283. package/dist/core/runner/prepare-tool-disclosure-mount.js +2 -1
  284. package/dist/core/runner/prepare-turn-wiring.d.ts +3 -1
  285. package/dist/core/runner/prepare-turn-wiring.js +1 -1
  286. package/dist/core/runner/prepare-wiring-manifest.d.ts +9 -4
  287. package/dist/core/runner/prepare-wiring-manifest.js +14 -6
  288. package/dist/core/runner/prepare-workspace-restore.d.ts +4 -4
  289. package/dist/core/runner/prepare-workspace-restore.js +15 -6
  290. package/dist/core/runner/remote-env-retry.d.ts +3 -3
  291. package/dist/core/runner/restore-seat.d.ts +41 -0
  292. package/dist/core/runner/restore-seat.js +38 -0
  293. package/dist/core/runner/resume-admission.js +1 -1
  294. package/dist/core/runner/resume-apply.js +4 -3
  295. package/dist/core/runner/resume-checkpoint-screen.js +2 -1
  296. package/dist/core/runner/resume-internals-and-config.js +2 -1
  297. package/dist/core/runner/resume-preflight.js +2 -1
  298. package/dist/core/runner/rewind-files.js +22 -6
  299. package/dist/core/runner/rule-store-unreadable-notice.d.ts +8 -0
  300. package/dist/core/runner/rule-store-unreadable-notice.js +11 -0
  301. package/dist/core/runner/run-brain-sinks.d.ts +3 -6
  302. package/dist/core/runner/run-brain-sinks.js +6 -6
  303. package/dist/core/runner/run-compaction-machinery.d.ts +2 -2
  304. package/dist/core/runner/run-git-lane.d.ts +2 -0
  305. package/dist/core/runner/run-git-lane.js +2 -1
  306. package/dist/core/runner/run-harness-handlers.js +5 -4
  307. package/dist/core/runner/run-identity-wiring.js +20 -12
  308. package/dist/core/runner/run-leg.js +31 -72
  309. package/dist/core/runner/run-notification-lane.d.ts +3 -0
  310. package/dist/core/runner/run-notification-lane.js +2 -4
  311. package/dist/core/runner/run-reasoning-seat.d.ts +5 -6
  312. package/dist/core/runner/run-reasoning-seat.js +13 -18
  313. package/dist/core/runner/run-settle-and-teardown.js +13 -9
  314. package/dist/core/runner/run-terminal-adoption.js +4 -8
  315. package/dist/core/runner/run-turn-boundary.js +6 -3
  316. package/dist/core/runner/runtask.d.ts +9 -4
  317. package/dist/core/runner/runtask.js +29 -22
  318. package/dist/core/runner/session-rule-policy.d.ts +11 -1
  319. package/dist/core/runner/shell-env-withheld.js +2 -7
  320. package/dist/core/runner/side-call-account.d.ts +5 -6
  321. package/dist/core/runner/side-call-account.js +2 -2
  322. package/dist/core/runner/stream-lifecycle-verbs.d.ts +3 -0
  323. package/dist/core/runner/stream-lifecycle-verbs.js +5 -3
  324. package/dist/core/runner/stream-settle-backstop.js +4 -6
  325. package/dist/core/runner/stream-steer-verb.d.ts +1 -1
  326. package/dist/core/runner/stream-steer-verb.js +4 -4
  327. package/dist/core/runner/sub-agent-deny-lists.d.ts +8 -3
  328. package/dist/core/runner/sub-agent-deny-lists.js +7 -4
  329. package/dist/core/runner/teardown-bounded.d.ts +7 -0
  330. package/dist/core/runner/teardown-bounded.js +7 -0
  331. package/dist/core/runner/terminal-account.js +41 -13
  332. package/dist/core/runner/terminal-projection.d.ts +1 -5
  333. package/dist/core/runner/tool-end-body.d.ts +9 -3
  334. package/dist/core/runner/tool-end-body.js +6 -3
  335. package/dist/core/runner/tool-output-projection.d.ts +13 -4
  336. package/dist/core/runner/tool-output-projection.js +10 -14
  337. package/dist/core/runner/turn-attachments.d.ts +3 -2
  338. package/dist/core/runner/turn-attachments.js +12 -5
  339. package/dist/core/runner-deps.d.ts +6 -6
  340. package/dist/core/runtime-caps.d.ts +2 -1
  341. package/dist/core/secret-env.d.ts +20 -3
  342. package/dist/core/secret-env.js +13 -15
  343. package/dist/core/session-checkout.d.ts +115 -15
  344. package/dist/core/session-checkout.js +435 -136
  345. package/dist/core/session-policy-store.js +21 -3
  346. package/dist/core/session-reconcile.js +1 -0
  347. package/dist/core/session-store.js +2 -0
  348. package/dist/core/session.d.ts +11 -1
  349. package/dist/core/shell-run-candidates.d.ts +1 -0
  350. package/dist/core/shell-run-candidates.js +1 -1
  351. package/dist/core/shutdown-debug.d.ts +6 -5
  352. package/dist/core/shutdown-debug.js +5 -1
  353. package/dist/core/skill-grant.js +4 -1
  354. package/dist/core/skills-directory.js +5 -3
  355. package/dist/core/spec-contract.d.ts +1 -1
  356. package/dist/core/store-contracts/checkpoint-store-contract.js +2 -7
  357. package/dist/core/store-contracts/file-history-store-contract.js +26 -2
  358. package/dist/core/store-contracts/session-deletion-cascade-contract.js +130 -14
  359. package/dist/core/store-contracts/task-list-store-contract.d.ts +2 -1
  360. package/dist/core/store-contracts/task-list-store-contract.js +28 -1
  361. package/dist/core/task-event.d.ts +48 -27
  362. package/dist/core/task-notification.d.ts +15 -9
  363. package/dist/core/task-notification.js +12 -0
  364. package/dist/core/task-registry-agent.d.ts +24 -22
  365. package/dist/core/task-registry-agent.js +65 -46
  366. package/dist/core/task-registry-shared.d.ts +17 -5
  367. package/dist/core/task-registry.d.ts +17 -6
  368. package/dist/core/task-registry.js +6 -1
  369. package/dist/core/task-result.d.ts +71 -25
  370. package/dist/core/task-spec-members.d.ts +0 -1
  371. package/dist/core/task-spec-members.js +1 -1
  372. package/dist/core/task-spec.d.ts +60 -52
  373. package/dist/core/task-stream.d.ts +45 -12
  374. package/dist/core/terminal-cause.d.ts +45 -8
  375. package/dist/core/terminal-cause.js +5 -0
  376. package/dist/core/tool-card-bound.d.ts +32 -0
  377. package/dist/core/tool-card-bound.js +33 -0
  378. package/dist/core/tool-catalog-entries.d.ts +9 -0
  379. package/dist/core/tool-catalog-entries.js +48 -0
  380. package/dist/core/tool-errors.d.ts +4 -3
  381. package/dist/core/tool-face.d.ts +3 -3
  382. package/dist/core/tool-mount-facts.d.ts +3 -2
  383. package/dist/core/tool-mount-facts.js +1 -1
  384. package/dist/core/tool-mount-static.js +7 -5
  385. package/dist/core/tool-policy.d.ts +21 -19
  386. package/dist/core/tool-policy.js +5 -6
  387. package/dist/core/tool-registry.d.ts +3 -1
  388. package/dist/core/tool-registry.js +15 -1
  389. package/dist/core/tool-result-store.d.ts +9 -3
  390. package/dist/core/tool-result-store.js +14 -1
  391. package/dist/core/tool-roster.d.ts +6 -0
  392. package/dist/core/tool-roster.js +18 -0
  393. package/dist/core/tool-spec.d.ts +17 -8
  394. package/dist/core/trace.d.ts +35 -31
  395. package/dist/core/types.d.ts +2 -2
  396. package/dist/core/untrusted-egress.d.ts +19 -7
  397. package/dist/core/untrusted-egress.js +26 -7
  398. package/dist/core/untrusted-text.d.ts +6 -18
  399. package/dist/core/untrusted-text.js +11 -4
  400. package/dist/core/user-attachment.d.ts +9 -6
  401. package/dist/core/user-attachment.js +12 -10
  402. package/dist/core/user-row-origin.d.ts +44 -25
  403. package/dist/core/user-row-origin.js +30 -20
  404. package/dist/core/wiring-manifest.d.ts +26 -7
  405. package/dist/core/wiring-manifest.js +14 -11
  406. package/dist/core/workspace-snapshot.d.ts +3 -1
  407. package/dist/core/workspace-snapshot.js +1 -0
  408. package/dist/engine/execution-env/node-execution-env.d.ts +23 -16
  409. package/dist/engine/execution-env/node-execution-env.js +127 -67
  410. package/dist/engine/harness/agent-harness.d.ts +4 -5
  411. package/dist/engine/harness/agent-harness.js +2 -7
  412. package/dist/engine/harness/types.d.ts +51 -19
  413. package/dist/engine/harness/types.js +28 -1
  414. package/dist/engine/llm/types.d.ts +26 -14
  415. package/dist/engine/llm/types.js +2 -2
  416. package/dist/engine/loop/agent-loop.d.ts +2 -2
  417. package/dist/engine/loop/agent-loop.js +51 -275
  418. package/dist/engine/loop/types.d.ts +0 -18
  419. package/dist/engine/session/import-validate.d.ts +3 -0
  420. package/dist/engine/session/import-validate.js +34 -2
  421. package/dist/engine/session/repo-utils.d.ts +42 -4
  422. package/dist/engine/session/repo-utils.js +33 -5
  423. package/dist/engine/session/session.d.ts +41 -14
  424. package/dist/engine/session/session.js +96 -25
  425. package/dist/index.d.ts +21 -16
  426. package/dist/index.js +16 -10
  427. package/dist/orchestration/run-spec.d.ts +1 -1
  428. package/dist/orchestration/run-workflow-tool.d.ts +12 -9
  429. package/dist/orchestration/run-workflow-tool.js +15 -19
  430. package/dist/orchestration/workflow-governance.js +13 -21
  431. package/dist/orchestration/workflow-observe.d.ts +4 -3
  432. package/dist/orchestration/workflow-primitives.d.ts +1 -1
  433. package/dist/orchestration/workflow-record-artifact.d.ts +14 -0
  434. package/dist/orchestration/workflow-record-artifact.js +32 -0
  435. package/dist/orchestration/workflow-script-store.d.ts +9 -0
  436. package/dist/orchestration/workflow-script-store.js +20 -1
  437. package/dist/orchestration/workflow-types.d.ts +33 -3
  438. package/dist/orchestration/workflow.d.ts +24 -14
  439. package/dist/orchestration/workflow.js +52 -23
  440. package/dist/prompt-assembly/artifact.js +4 -8
  441. package/dist/prompt-assembly/catalog/engine.d.ts +263 -0
  442. package/dist/prompt-assembly/catalog/engine.js +30 -0
  443. package/dist/prompt-assembly/catalog/index.d.ts +1 -1
  444. package/dist/prompt-assembly/catalog/index.js +2 -2
  445. package/dist/prompt-assembly/catalog/locales/zh-Hans/engine.d.ts +1 -1
  446. package/dist/prompt-assembly/catalog/locales/zh-Hans/engine.js +29 -0
  447. package/dist/prompt-assembly/epoch.js +6 -8
  448. package/dist/prompt-assembly/turn-snapshot.js +8 -9
  449. package/dist/stores/file/background-agent-store.js +5 -6
  450. package/dist/stores/file/checkpoint-store.d.ts +0 -4
  451. package/dist/stores/file/checkpoint-store.js +7 -3
  452. package/dist/stores/file/file-history-store.d.ts +8 -0
  453. package/dist/stores/file/file-history-store.js +72 -0
  454. package/dist/stores/file/fs-atomic.js +17 -12
  455. package/dist/stores/file/index.js +11 -5
  456. package/dist/stores/file/mailbox-store.js +13 -4
  457. package/dist/stores/file/permission-rule-store.js +14 -13
  458. package/dist/stores/file/shared-ledger.d.ts +4 -0
  459. package/dist/stores/file/shared-ledger.js +4 -0
  460. package/dist/stores/file/task-list-store.js +12 -3
  461. package/dist/stores/file/workflow-run-store.js +1 -0
  462. package/dist/tools/fs/bash-program-position.d.ts +4 -2
  463. package/dist/tools/fs/bash-program-position.js +1 -1
  464. package/dist/tools/fs/bash-readonly-classifier.js +1 -1
  465. package/dist/tools/fs/bound-open.d.ts +97 -0
  466. package/dist/tools/fs/bound-open.js +103 -0
  467. package/dist/tools/fs/containment-face.d.ts +2 -2
  468. package/dist/tools/fs/fs-pdf.d.ts +7 -1
  469. package/dist/tools/fs/fs-pdf.js +31 -23
  470. package/dist/tools/fs/fs-read.d.ts +24 -17
  471. package/dist/tools/fs/fs-read.js +84 -53
  472. package/dist/tools/fs/fs-shared.d.ts +14 -12
  473. package/dist/tools/fs/fs-shared.js +5 -4
  474. package/dist/tools/fs/fs-write.d.ts +2 -2
  475. package/dist/tools/fs/fs-write.js +20 -12
  476. package/dist/tools/fs/index.d.ts +4 -4
  477. package/dist/tools/fs/index.js +2 -2
  478. package/dist/tools/fs/notebook.d.ts +1 -1
  479. package/dist/tools/fs/pdf.d.ts +12 -3
  480. package/dist/tools/fs/pdf.js +22 -9
  481. package/dist/tools/fs/read-deny-home.d.ts +3 -2
  482. package/dist/tools/fs/read-deny-home.js +8 -11
  483. package/dist/tools/fs/safety.d.ts +3 -2
  484. package/dist/tools/fs/shell-read-check.js +10 -9
  485. package/dist/tools/monitor.d.ts +6 -5
  486. package/dist/tools/task-list.d.ts +16 -6
  487. package/dist/tools/task-list.js +4 -0
  488. package/dist/tools/web.d.ts +9 -1
  489. package/dist/tools/web.js +8 -3
  490. package/dist/tools/worktree.d.ts +7 -5
  491. package/dist/tools/worktree.js +4 -3
  492. package/package.json +4 -3
  493. package/test/export-surface.snapshot.json +93 -7
  494. package/wire-changes/core-stores-sql@7.67.3.json +39 -0
  495. package/wire-changes/core-stores-sql@7.68.0.json +39 -0
  496. package/wire-changes/core@7.67.3.json +65 -0
  497. package/wire-changes/core@7.68.0.json +4257 -0
  498. package/wire-changes/mods-kernel@7.67.3.json +39 -0
  499. package/wire-changes/mods-kernel@7.68.0.json +129 -0
  500. package/wire-changes/primitives@7.67.3.json +39 -0
  501. package/wire-changes/primitives@7.68.0.json +253 -0
  502. package/wire-changes/wiki-gate@7.67.3.json +39 -0
  503. package/wire-changes/wiki-gate@7.68.0.json +39 -0
  504. package/dist/core/runner/credential-origin-seat.d.ts +0 -2
  505. package/dist/core/runner/credential-origin-seat.js +0 -20
@@ -92,7 +92,7 @@ async function gateToolWrite(hook, tool, path, key, content) {
92
92
  return undefined;
93
93
  }
94
94
  const rootOf = (seat) => (typeof seat === "function" ? seat() : seat);
95
- export function createEditFileTool(env, state, rootCanonical, cwdRef, additionalRoots, beforeWrite, trackEdit, onEdited, writeFace, writeDeny) {
95
+ export function createEditFileTool(env, state, rootCanonical, cwdRef, additionalRoots, beforeWrite, trackEdit, onEdited, writeFace, writeDeny, readDeny) {
96
96
  return defineTool({
97
97
  name: "Edit",
98
98
  ...toolFace("edit"),
@@ -187,13 +187,14 @@ export function createEditFileTool(env, state, rootCanonical, cwdRef, additional
187
187
  return errorResult(`Error (Edit): cannot write "${path}": ${envErrorDetail(write.error.message)}`);
188
188
  }
189
189
  const createdNorm = normalizeFileText(created);
190
- state.set(r.key, { hash: sha256(createdNorm), totalLines: countLines(createdNorm), truncated: false, lastReadAt: Date.now() });
190
+ const contentSha256 = sha256(createdNorm);
191
+ state.set(r.key, { hash: contentSha256, totalLines: countLines(createdNorm), truncated: false, lastReadAt: Date.now() });
191
192
  return {
192
193
  content: `Created ${path} (${countLines(createdNorm)} lines).`,
193
- details: { type: "create", filePath: path, content: created },
194
+ details: { type: "create", filePath: path, content: created, contentSha256 },
194
195
  };
195
196
  }
196
- return errorResult(`Error (Edit): ${await enoentMessage(env, r.key, cwdRef?.current ?? rootOf(rootCanonical), ctx.signal)}`);
197
+ return errorResult(`Error (Edit): ${await enoentMessage(env, r.key, cwdRef?.current ?? rootOf(rootCanonical), ctx.signal, seatForCall(readDeny, ctx.toolCallId))}`);
197
198
  }
198
199
  const editInfo = await env.fileInfo(r.key, ctx.signal);
199
200
  if (editInfo.ok && editInfo.value.size > MAX_EDIT_BYTES) {
@@ -234,10 +235,11 @@ export function createEditFileTool(env, state, rootCanonical, cwdRef, additional
234
235
  if (!write.ok)
235
236
  return errorResult(`Error (Edit): cannot write "${path}": ${envErrorDetail(write.error.message)}`);
236
237
  const persistedOverwrite = persistedTextOf(encodedOverwrite);
237
- state.set(r.key, { hash: sha256(persistedOverwrite), totalLines: countLines(persistedOverwrite), truncated: false, lastReadAt: Date.now() });
238
+ const contentSha256 = sha256(persistedOverwrite);
239
+ state.set(r.key, { hash: contentSha256, totalLines: countLines(persistedOverwrite), truncated: false, lastReadAt: Date.now() });
238
240
  return {
239
241
  content: `The file ${path} has been updated successfully.${FILE_STATE_TRAILER}`,
240
- details: { type: "edit", filePath: path, originalFile: preDec.text, oldString: "", newString: newContent, replaceAll: false, edits: [{ oldString: "", newString: newContent, replaceAll: false }] },
242
+ details: { type: "edit", filePath: path, originalFile: preDec.text, oldString: "", newString: newContent, replaceAll: false, edits: [{ oldString: "", newString: newContent, replaceAll: false }], contentSha256 },
241
243
  };
242
244
  }
243
245
  const ipynb = ipynbRedirect("Edit", path);
@@ -311,7 +313,8 @@ export function createEditFileTool(env, state, rootCanonical, cwdRef, additional
311
313
  if (!write.ok)
312
314
  return errorResult(`Error (Edit): cannot write "${path}": ${envErrorDetail(write.error.message)}`);
313
315
  const persistedEdit = persistedTextOf(encodedEdit);
314
- state.set(r.key, { hash: sha256(persistedEdit), totalLines: countLines(persistedEdit), truncated: false, lastReadAt: Date.now() });
316
+ const contentSha256 = sha256(persistedEdit);
317
+ state.set(r.key, { hash: contentSha256, totalLines: countLines(persistedEdit), truncated: false, lastReadAt: Date.now() });
315
318
  const a0 = appliedEdits[0];
316
319
  return {
317
320
  content: batch
@@ -325,6 +328,7 @@ export function createEditFileTool(env, state, rootCanonical, cwdRef, additional
325
328
  originalFile: original,
326
329
  edits: appliedEdits,
327
330
  ...(batch ? {} : { oldString: a0.oldString, newString: a0.newString, replaceAll: a0.replaceAll }),
331
+ contentSha256,
328
332
  },
329
333
  };
330
334
  },
@@ -401,10 +405,11 @@ export function createWriteFileTool(env, state, rootCanonical, cwdRef, additiona
401
405
  if (!write.ok)
402
406
  return errorResult(`Error (Write): cannot write "${path}": ${envErrorDetail(write.error.message)}`);
403
407
  const persistedWrite = persistedTextOf(encodedWrite);
404
- state.set(r.key, { hash: sha256(persistedWrite), totalLines: countLines(persistedWrite), truncated: false, lastReadAt: Date.now() });
408
+ const contentSha256 = sha256(persistedWrite);
409
+ state.set(r.key, { hash: contentSha256, totalLines: countLines(persistedWrite), truncated: false, lastReadAt: Date.now() });
405
410
  return {
406
411
  content: `The file ${path} has been updated successfully.${FILE_STATE_TRAILER}`,
407
- details: { type: "update", filePath: path, content: persistedWrite, originalFile },
412
+ details: { type: "update", filePath: path, content: persistedWrite, originalFile, contentSha256 },
408
413
  };
409
414
  }
410
415
  const gatedCreate = await gateToolWrite(beforeWrite, "Write", path, r.key, content);
@@ -417,11 +422,12 @@ export function createWriteFileTool(env, state, rootCanonical, cwdRef, additiona
417
422
  if (!write.ok)
418
423
  return errorResult(`Error (Write): cannot write "${path}": ${envErrorDetail(write.error.message)}`);
419
424
  const totalLines = countLines(content);
420
- state.set(r.key, { hash: sha256(normalizeFileText(content)), totalLines, truncated: false, lastReadAt: Date.now() });
425
+ const contentSha256 = sha256(normalizeFileText(content));
426
+ state.set(r.key, { hash: contentSha256, totalLines, truncated: false, lastReadAt: Date.now() });
421
427
  void originalFile;
422
428
  return {
423
429
  content: `File created successfully at: ${path}${FILE_STATE_TRAILER}`,
424
- details: { type: "create", filePath: path, content },
430
+ details: { type: "create", filePath: path, content, contentSha256 },
425
431
  };
426
432
  },
427
433
  });
@@ -625,7 +631,8 @@ export function createNotebookEditTool(env, state, rootCanonical, cwdRef, additi
625
631
  const w = await envFinalWrite(env, r.key, encodeTextForFile(updated, decodedNb.encoding, decodedNb.endings), ctx.signal, { track: trackedNb, edited: { hook: onEdited, tool: "NotebookEdit", path: notebook_path } });
626
632
  if (!w.ok)
627
633
  return errorResult(`Error (NotebookEdit): cannot write "${notebook_path}": ${envErrorDetail(w.error.message)}`);
628
- state.set(r.key, { hash: sha256(updated), totalLines: countLines(updated), truncated: false, lastReadAt: Date.now() });
634
+ const contentSha256 = sha256(updated);
635
+ state.set(r.key, { hash: contentSha256, totalLines: countLines(updated), truncated: false, lastReadAt: Date.now() });
629
636
  const nbDetails = {
630
637
  type: "notebook-edit",
631
638
  notebookPath: notebook_path,
@@ -635,6 +642,7 @@ export function createNotebookEditTool(env, state, rootCanonical, cwdRef, additi
635
642
  newSource: new_source,
636
643
  ...(oldSource !== undefined ? { oldSource } : {}),
637
644
  originalFile: nbText,
645
+ contentSha256,
638
646
  };
639
647
  if (g === "delete")
640
648
  return { content: `Deleted cell ${cell_id}`, details: nbDetails };
@@ -120,8 +120,8 @@ export interface HandsToolkitOptions {
120
120
  bashMaxTimeoutMs?: number;
121
121
  /** Structured sink for the timeout-cap discard announcements both shell legs emit at mount (see
122
122
  * {@link import("../../core/types.js").EngineNotice} / `RunnerDeps.onNotice`). Wired, it REPLACES
123
- * their `console.warn` line (a forwarding host must not show every fact twice); absent, the
124
- * console line prints verbatim (last-resort loudness). Threaded per toolkit build — never a
123
+ * their process line (a forwarding host must not show every fact twice); absent, the process's
124
+ * default seat, else the line verbatim (last-resort loudness). Threaded per toolkit build — never a
125
125
  * global. */
126
126
  onNotice?: (n: import("../../core/types.js").EngineNotice) => void;
127
127
  /** See createBashTool's taskOpts.oneShot for the full contract: this run has no later turn for an async background
@@ -224,7 +224,7 @@ export interface HandsToolkitOptions {
224
224
  * for that placement before they judge anything. A placement that fails leaves the home-anchored rows held anywhere.
225
225
  * Carrying both is the engine's own handoff of ONE placement — its home views travel with it — so
226
226
  * `readDenyHomes` must then be the very list that placement returned: any other list (a copy) holds the home-anchored
227
- * rows at every location and is named on `console.warn`. */
227
+ * rows at every location and is named as `config.read_deny_home` (`kind: "placement_lost"`) on the process's default seat. */
228
228
  readDenyHomeLinks?: ReadonlyMap<string, readonly string[]>;
229
229
  /** The permission-rule rows of the deny table ({@link import("./read-deny.js").PathRuleDenyRow} — rows already bound, e.g. a
230
230
  * policy's `toolPolicyPathRules(policies, anchors)` deny rows, or rows built by hand): the read-face rows join the structured
@@ -237,7 +237,7 @@ export interface HandsToolkitOptions {
237
237
  * roots containment judgment — the deny set, the UNC out-of-set refusal and the special-file type
238
238
  * gates run in both faces. Beside `readOnly: true` the mount wins: this seat is deps-shaped (a
239
239
  * deployment default, not a per-call assertion), so its "open" CLAMPS to "roots" and the clamp is
240
- * ANNOUNCED (`config.read_face_deployment_clamped`, through `onNotice` / `console.warn`) — the loud
240
+ * ANNOUNCED (`config.read_face_deployment_clamped`, through `onNotice`, else the default seat or the process line) — the loud
241
241
  * refusal belongs to the TASK seat (`TaskSpec.readFace`), the one genuine per-call contradiction.
242
242
  * Never affects the write faces — {@link writeFace} is a separate seat with its own default. */
243
243
  readFace?: ContainmentFace;
@@ -88,7 +88,7 @@ export function createHandsToolkit(env, readFileState, rootCanonical, opts = {})
88
88
  afterPlacement(createReadFileTool(env, readFileState, rootCanonical, readCwd, readFaceRoots, opts.imageProcessor, opts.pdfModelCapabilities, bgOutputReadExemption, readDeny, readFace, opts.reminderMark, opts.reminderDisclosureCounts, reader)),
89
89
  ];
90
90
  if (handsWriteHalfMounts({ readOnly })) {
91
- tools.push(createEditFileTool(env, readFileState, opts.writeRoot ?? rootCanonical, cwdRef, additionalRoots, opts.beforeWrite, opts.trackFileEdit, opts.onFileEdited, writeFaceOf, writeDeny), createWriteFileTool(env, readFileState, opts.writeRoot ?? rootCanonical, cwdRef, additionalRoots, opts.beforeWrite, opts.trackFileEdit, opts.onFileEdited, writeFaceOf, writeDeny), createNotebookEditTool(env, readFileState, opts.writeRoot ?? rootCanonical, cwdRef, additionalRoots, opts.beforeWrite, opts.trackFileEdit, opts.onFileEdited, writeFaceOf, writeDeny));
91
+ tools.push(createEditFileTool(env, readFileState, opts.writeRoot ?? rootCanonical, cwdRef, additionalRoots, opts.beforeWrite, opts.trackFileEdit, opts.onFileEdited, writeFaceOf, writeDeny, readDeny), createWriteFileTool(env, readFileState, opts.writeRoot ?? rootCanonical, cwdRef, additionalRoots, opts.beforeWrite, opts.trackFileEdit, opts.onFileEdited, writeFaceOf, writeDeny), createNotebookEditTool(env, readFileState, opts.writeRoot ?? rootCanonical, cwdRef, additionalRoots, opts.beforeWrite, opts.trackFileEdit, opts.onFileEdited, writeFaceOf, writeDeny));
92
92
  const keptBytes = opts.toolResultBytes;
93
93
  if (keptBytes?.bytesOf !== undefined)
94
94
  tools.push(createSaveToolResultTool(env, keptBytes, opts.writeRoot ?? rootCanonical, cwdRef, additionalRoots, opts.beforeWrite, opts.trackFileEdit, opts.onFileEdited, writeFaceOf, writeDeny));
@@ -147,7 +147,7 @@ function bandOwnTables(env, opts) {
147
147
  const carried = readDenyHomes !== undefined && opts.readDenyHomeLinks !== undefined;
148
148
  const carriedViews = carried ? placementViewsOf(opts.readDenyHomes) : undefined;
149
149
  if (carried && carriedViews === undefined)
150
- sayPlacementLost();
150
+ sayPlacementLost(opts.onNotice);
151
151
  const placesNothing = !unplaced.entries.some((e) => readDenyRowAnchor(e.pattern) !== "none");
152
152
  const late = carried || placesNothing ? undefined : readDenyPlacedLater(carryHomeViews(unplaced, homeViewsAt(env, [])), () => placeReadDenyAtHome(env, compileAt, readDenyHomes));
153
153
  const readDeny = late?.matcher ??
@@ -91,5 +91,5 @@ export interface NotebookRender {
91
91
  export declare function renderNotebookCells(cells: readonly NotebookCell[], imageBase64Budget: number): NotebookRender;
92
92
  /** Wire-card projection of a cell: base64 replaced by a length marker so the `details` card never
93
93
  * carries raw image bytes (they ride the model-facing content blocks; an oversized card would be
94
- * omitted whole by the card projector's 4×cap and blind the shell). */
94
+ * left off `structured` by the card projector's 4×cap, leaving the shell only its skeleton — the path). */
95
95
  export declare function stripNotebookImageData(cell: NotebookCell): NotebookCell;
@@ -16,6 +16,7 @@
16
16
  * degradation when poppler is absent — never a fake success.
17
17
  */
18
18
  import type { ExecutionEnv, ReadFloor } from "../../internal/harness-types.js";
19
+ import type { ReadObject } from "./bound-open.js";
19
20
  /** Max pages a single `pages` request may span (CC `PDF_MAX_PAGES_PER_READ`). */
20
21
  export declare const PDF_MAX_PAGES_PER_READ = 20;
21
22
  /** Above this page count a whole-PDF read is refused and `pages` is required (CC `PDF_AT_MENTION_INLINE_THRESHOLD`). */
@@ -37,6 +38,14 @@ export declare function parsePdfPageRange(pages: string): PdfPageRange | undefin
37
38
  * nothing matches (page tree inside compressed object streams — modern writers), NEVER a guess.
38
39
  */
39
40
  export declare function countPdfPagesFromBytes(bytes: Uint8Array): number | undefined;
41
+ /** What a poppler program reads the PDF from: the bytes of a held object — the program's standard input (`-`), so it opens
42
+ * no path — or, where the reader holds nothing, the by-name simulation's key, read by name only after its judgment is asked
43
+ * again right before the start ({@link ReadObject.byName}). */
44
+ export type PdfInput = {
45
+ readonly held: Uint8Array;
46
+ } | {
47
+ readonly byName: NonNullable<ReadObject["byName"]>;
48
+ };
40
49
  /** Max chars of a failed poppler call's stderr/stdout kept in the reported error. */
41
50
  export declare const PDF_EXEC_ERROR_PREVIEW_CHARS = 400;
42
51
  /** Bound a poppler exec failure's captured stream to {@link PDF_EXEC_ERROR_PREVIEW_CHARS}, marking the cut
@@ -48,7 +57,7 @@ export declare function previewExecStream(s: string): string;
48
57
  * when the tool is absent/fails and the bytes were already read. `undefined` = unknown (fail-open,
49
58
  * matching CC's `getPDFPageCount → null`).
50
59
  */
51
- export declare function getPdfPageCount(env: ExecutionEnv, absPath: string, bytes: Uint8Array | undefined, signal?: AbortSignal, readFloor?: ReadFloor): Promise<number | undefined>;
60
+ export declare function getPdfPageCount(env: ExecutionEnv, input: PdfInput, bytes: Uint8Array | undefined, signal?: AbortSignal, readFloor?: ReadFloor): Promise<number | undefined>;
52
61
  /** How many leading pages the vision fallback (level 2) renders for a whole-PDF read on a model without
53
62
  * document input — conservative per-request budget; the note directs the model to `pages` for more. */
54
63
  export declare const PDF_FALLBACK_RENDER_PAGES = 5;
@@ -107,7 +116,7 @@ export type PdfTextResult = {
107
116
  * read back over the env seam so it works against remote envs too. `toolMissing` distinguishes
108
117
  * "install poppler" from a real extraction failure.
109
118
  */
110
- export declare function extractPdfTextLayer(env: ExecutionEnv, absPath: string, range?: {
119
+ export declare function extractPdfTextLayer(env: ExecutionEnv, input: PdfInput, range?: {
111
120
  first: number;
112
121
  last: number;
113
122
  }, signal?: AbortSignal, readFloor?: ReadFloor): Promise<PdfTextResult>;
@@ -131,4 +140,4 @@ export type PdfExtractResult = {
131
140
  * 120s timeout). Runs through the ExecutionEnv seam (temp dir + exec + readBinaryFile), so it works
132
141
  * wherever the env does. `toolMissing` distinguishes "install poppler" from a real extraction failure.
133
142
  */
134
- export declare function extractPdfPagesAsImages(env: ExecutionEnv, absPath: string, first: number, last: number, signal?: AbortSignal, readFloor?: ReadFloor): Promise<PdfExtractResult>;
143
+ export declare function extractPdfPagesAsImages(env: ExecutionEnv, input: PdfInput, first: number, last: number, signal?: AbortSignal, readFloor?: ReadFloor): Promise<PdfExtractResult>;
@@ -28,16 +28,23 @@ export function countPdfPagesFromBytes(bytes) {
28
28
  function shellQuote(arg) {
29
29
  return `'${arg.replaceAll("'", `'\\''`)}'`;
30
30
  }
31
+ async function startOn(input, signal) {
32
+ if ("held" in input)
33
+ return { ok: true, file: "-", stdin: { stdinFrom: input.held } };
34
+ const still = await input.byName.check(signal);
35
+ return still.ok ? { ok: true, file: shellQuote(input.byName.key), stdin: {} } : { ok: false, error: envErrorDetail(still.error.message) };
36
+ }
31
37
  export const PDF_EXEC_ERROR_PREVIEW_CHARS = 400;
32
38
  export function previewExecStream(s) {
33
39
  return s.length > PDF_EXEC_ERROR_PREVIEW_CHARS
34
40
  ? `${s.slice(0, PDF_EXEC_ERROR_PREVIEW_CHARS)} …[${s.length - PDF_EXEC_ERROR_PREVIEW_CHARS} chars truncated]`
35
41
  : s;
36
42
  }
37
- export async function getPdfPageCount(env, absPath, bytes, signal, readFloor) {
43
+ export async function getPdfPageCount(env, input, bytes, signal, readFloor) {
38
44
  try {
39
- const r = await env.exec(`pdfinfo ${shellQuote(absPath)}`, { timeout: 10, abortSignal: signal, ...(readFloor !== undefined ? { readFloor } : {}) });
40
- if (r.ok && r.value.exitCode === 0) {
45
+ const on = await startOn(input, signal);
46
+ const r = on.ok ? await env.exec(`pdfinfo ${on.file}`, { timeout: 10, abortSignal: signal, ...on.stdin, ...(readFloor !== undefined ? { readFloor } : {}) }) : undefined;
47
+ if (r?.ok === true && r.value.exitCode === 0) {
41
48
  const m = /^Pages:\s+(\d+)/m.exec(r.value.stdout);
42
49
  if (m) {
43
50
  const n = Number.parseInt(m[1], 10);
@@ -68,7 +75,7 @@ export function pdfCutWords(cut) {
68
75
  return { clause: `timed out after ${cut.sec}s`, noun: "timeout" };
69
76
  return { clause: cut.sec !== undefined ? `was cut after producing no output for ${cut.sec}s` : "was cut for producing no output", noun: "cut" };
70
77
  }
71
- export async function extractPdfTextLayer(env, absPath, range, signal, readFloor) {
78
+ export async function extractPdfTextLayer(env, input, range, signal, readFloor) {
72
79
  const tmp = await env.createTempDir("sema-pdf-text-", signal);
73
80
  if (!tmp.ok)
74
81
  return { ok: false, toolMissing: false, error: `cannot create a temp dir for text extraction: ${envErrorDetail(tmp.error.message)}` };
@@ -77,9 +84,12 @@ export async function extractPdfTextLayer(env, absPath, range, signal, readFloor
77
84
  const outR = await env.joinPath([dir, "out.txt"], signal);
78
85
  if (!outR.ok)
79
86
  return { ok: false, toolMissing: false, error: envErrorDetail(outR.error.message) };
87
+ const on = await startOn(input, signal);
88
+ if (!on.ok)
89
+ return { ok: false, toolMissing: false, error: on.error };
80
90
  const rangeArgs = range ? `-f ${range.first} -l ${range.last} ` : "";
81
- const cmd = `pdftotext -layout ${rangeArgs}${shellQuote(absPath)} ${shellQuote(outR.value)}`;
82
- const r = await env.exec(cmd, { timeout: PDF_EXEC_TIMEOUT_SEC, abortSignal: signal, ...(readFloor !== undefined ? { readFloor } : {}) });
91
+ const cmd = `pdftotext -layout ${rangeArgs}${on.file} ${shellQuote(outR.value)}`;
92
+ const r = await env.exec(cmd, { timeout: PDF_EXEC_TIMEOUT_SEC, abortSignal: signal, ...on.stdin, ...(readFloor !== undefined ? { readFloor } : {}) });
83
93
  if (!r.ok) {
84
94
  if (isTimeCutCode(r.error.code)) {
85
95
  const cut = cutOf(r.error);
@@ -126,7 +136,7 @@ async function listRenderedJpegs(env, dir, signal) {
126
136
  .sort(),
127
137
  };
128
138
  }
129
- export async function extractPdfPagesAsImages(env, absPath, first, last, signal, readFloor) {
139
+ export async function extractPdfPagesAsImages(env, input, first, last, signal, readFloor) {
130
140
  const tmp = await env.createTempDir("sema-pdf-pages-", signal);
131
141
  if (!tmp.ok)
132
142
  return { ok: false, toolMissing: false, error: `cannot create a temp dir for page extraction: ${envErrorDetail(tmp.error.message)}` };
@@ -135,8 +145,11 @@ export async function extractPdfPagesAsImages(env, absPath, first, last, signal,
135
145
  const prefixR = await env.joinPath([dir, "page"], signal);
136
146
  if (!prefixR.ok)
137
147
  return { ok: false, toolMissing: false, error: envErrorDetail(prefixR.error.message) };
138
- const cmd = `pdftoppm -jpeg -r 100 -f ${first} -l ${last} ${shellQuote(absPath)} ${shellQuote(prefixR.value)}`;
139
- const r = await env.exec(cmd, { timeout: PDF_EXEC_TIMEOUT_SEC, abortSignal: signal, ...(readFloor !== undefined ? { readFloor } : {}) });
148
+ const on = await startOn(input, signal);
149
+ if (!on.ok)
150
+ return { ok: false, toolMissing: false, error: on.error };
151
+ const cmd = `pdftoppm -jpeg -r 100 -f ${first} -l ${last} ${on.file} ${shellQuote(prefixR.value)}`;
152
+ const r = await env.exec(cmd, { timeout: PDF_EXEC_TIMEOUT_SEC, abortSignal: signal, ...on.stdin, ...(readFloor !== undefined ? { readFloor } : {}) });
140
153
  if (!r.ok) {
141
154
  if (isTimeCutCode(r.error.code)) {
142
155
  const cut = cutOf(r.error);
@@ -1,5 +1,6 @@
1
1
  import type { ExecutionEnv } from "../../internal/harness-types.js";
2
2
  import { type PathFamily } from "./safety.js";
3
+ import { type EngineNotice } from "../../core/engine-notice.js";
3
4
  import { type ReadDenyMatcher, type WriteDenyMatcher } from "./read-deny.js";
4
5
  /** The one bound every probe of an AUXILIARY home shares within one placement (see the module head): long enough for a
5
6
  * local directory's canonical spelling, its chain of identities and its rows' heads, short enough that a hung home
@@ -156,8 +157,8 @@ export declare function carryReadFace(homes: readonly string[], face: CarriedRea
156
157
  * which each judgment takes the latest — with the home views `homeViews` (default: the current judge's). */
157
158
  export declare function readDenyOver(current: () => PlacedReadDenyMatcher, homeViews?: HomeViewSource): PlacedReadDenyMatcher;
158
159
  /** The line a mount says when the engine handed it a home list that is not its placement's (an engine defect, said every
159
- * time: no latch). */
160
- export declare function sayPlacementLost(): void;
160
+ * time: no latch), on the band's own notice seat when it holds one. */
161
+ export declare function sayPlacementLost(onNotice: ((notice: EngineNotice) => void) | undefined): void;
161
162
  /** The home views over a home list fixed now — a mount that places nothing itself (a toolkit handed its placement, or
162
163
  * one whose table has no home-anchored row) and the public shell judgment (the `readDenyHomes` its boundary's rows were
163
164
  * compiled under): the declared home, and every entry of `homes` that is not the declared home as an auxiliary home,
@@ -2,6 +2,7 @@ import { userInfo } from "node:os";
2
2
  import { canonicalizeTarget, isAbsoluteForFamily, joinForFamily, normalizeAbsPathLexically, pathFamilyOf } from "./safety.js";
3
3
  import { DEFAULT_GATE_AWAIT_TIMEOUT_MS, withGateTimeout } from "../../core/gate-bounded-await.js";
4
4
  import { thrownText } from "../../core/thrown-value.js";
5
+ import { deliverEngineNotice } from "../../core/engine-notice.js";
5
6
  import { agentConfigDirTail } from "../../core/agent-config-dir.js";
6
7
  import { validatePath } from "../../core/effective-path-target.js";
7
8
  import { readDenyPatternRun, readDenyRowAnchor, readDenyRunHead } from "./read-deny.js";
@@ -12,11 +13,7 @@ function sayOnce(kind, line) {
12
13
  if (said.has(kind))
13
14
  return;
14
15
  said.add(kind);
15
- try {
16
- console.warn(line);
17
- }
18
- catch {
19
- }
16
+ deliverEngineNotice(undefined, { code: "config.read_deny_home", message: line, detail: { kind } });
20
17
  }
21
18
  function isNoAccountRow(e) {
22
19
  try {
@@ -396,12 +393,12 @@ export function readDenyOver(current, homeViews) {
396
393
  homeViews: homeViews ?? { views: (signal) => current().homeViews.views(signal) },
397
394
  };
398
395
  }
399
- export function sayPlacementLost() {
400
- try {
401
- console.warn("read-deny homes: this tool band was handed a home list that is not the placement's own (an engine defect) — its home-anchored read-deny rows hold their run at every location, and only the declared home's views are read.");
402
- }
403
- catch {
404
- }
396
+ export function sayPlacementLost(onNotice) {
397
+ deliverEngineNotice(onNotice, {
398
+ code: "config.read_deny_home",
399
+ message: "read-deny homes: this tool band was handed a home list that is not the placement's own (an engine defect) — its home-anchored read-deny rows hold their run at every location, and only the declared home's views are read.",
400
+ detail: { kind: "placement_lost" },
401
+ });
405
402
  }
406
403
  function readAuxiliaryHomes(env, homes, opts, signal) {
407
404
  const declared = declaredHomeOf(env);
@@ -59,8 +59,9 @@ export interface ReadEntry {
59
59
  * system-prompt lane of this leg (the one meaning: today the memory engine's materialized index; an
60
60
  * instruction file is never seeded — the instruction-file lane's frame records its own entry): the file passes
61
61
  * read-before-edit. Any real
62
- * Read / edit write-back records a FRESH entry without this flag. (Whether a request carries a Read of the file
63
- * as the "already in your context" sentence is the request projection's, against the leg's seed table.)
62
+ * Read / edit write-back records a FRESH entry without this flag. (Whether a request carries an attachment frame
63
+ * of the file as the "already in your context" sentence is the request projection's, against the leg's seed table;
64
+ * a Read of it is its contents.)
64
65
  * Optional/additive: absent = normal entry. */
65
66
  seededFromContext?: boolean;
66
67
  /** The WITNESS SET: every transmission that still carries the body this entry stands for — each tool call whose RESULT
@@ -312,10 +312,10 @@ function refusalOf(tool, fold, boundary, paths) {
312
312
  return { sentence, details: findingDetails(fold.finding, paths) };
313
313
  }
314
314
  const DENIED_THROUGH_NOTE = {
315
- home: "The word was judged as spelled with the environment's declared home: the command may rebind HOME before it, or hands " +
316
- "the program a literal ~ it may expand itself — the shell may open another file, and a deny row is refused wherever the command may read it.",
317
- floor: "The working directory at this word is not settled — a move before it may fail or is one this boundary does not follow — " +
318
- "so the word was also judged where the command stood before that move (a bare cd stands it in the declared home).",
315
+ home: "(The path was also checked with this environment's home directory standing in for ~ and HOME, because the command may " +
316
+ "change HOME first, or hand a literal ~ to a program that expands it itself.)",
317
+ floor: "(The command changes directory before this path in a way the engine cannot follow, so the path was also checked from " +
318
+ "where the command stood before that change; a bare cd counts as the home directory.)",
319
319
  };
320
320
  function deniedThrough(read, boundary) {
321
321
  if (read.established === "unestablishable" && read.candidate.bases === "unmodelled")
@@ -325,14 +325,15 @@ function deniedThrough(read, boundary) {
325
325
  return "home";
326
326
  return undefined;
327
327
  }
328
+ const DENY_OUTLET = "To get past it, the pattern has to be removed where it is set (this deployment's deny patterns, or a deny rule in the " +
329
+ "permission settings); the agent cannot lift it and no approval does.";
328
330
  function writeDenyRefusalNote() {
329
331
  const names = operandWriterNames();
330
- return `The boundary judges this command's write targets — its output redirections and the operands of ${names.slice(0, -1).join(", ")} and ${names.at(-1)} — against the write deny list; a denied write is refused here rather than escalated.`;
332
+ return `The command was not run. Its output redirections and the files ${names.slice(0, -1).join(", ")} and ${names.at(-1)} write are checked against the write deny list. ${DENY_OUTLET}`;
331
333
  }
332
- const DENY_REFUSAL_NOTE = "The read boundary judges the paths this command names — as written and, where a filesystem can be consulted, where " +
333
- "they resolve and what a pattern among them matches — and refuses a deny-listed one here rather than escalating it; " +
334
- "a file the command reaches without naming it is judged only where a segment deny row (built in, or the deployment's " +
335
- "own pattern) reaches into the tree a recursive read walks.";
334
+ const DENY_REFUSAL_NOTE = "The command was not run, and nothing was read. Paths a command names are checked against this list, as written and " +
335
+ "where they lead; a file it reaches without naming it, for example inside a folder it searches, is checked only where " +
336
+ `a deny rule covers that folder. ${DENY_OUTLET}`;
336
337
  function verdictOf(tool, seat, fold, judged, boundary) {
337
338
  const redirectsOnly = fold.finding === "outside_roots" && fold.unestablished !== true && outsideFindingsAreRedirections(judged);
338
339
  const disposition = decideShellRead(fold.finding, seat, { redirectsOnly, narrowedReadFace: fold.unplacedRead === true && boundary.face !== "open" });
@@ -33,11 +33,12 @@
33
33
  * SHELL FACE, so the `Bash(<command>)` rules, the shell seat, the read station and the removal guard judge its `command`
34
34
  * as they judge Bash's — Monitor is never a policy side-door around a gated Bash.
35
35
  *
36
- * 深对比残差 M17 CLOSED (2026-07-09 live-CC probe, docs/cc-probe-198/live-schema-monitor-worktree-2026-07-09.json):
37
- * the deep-dive bundle showed a `command? + ws?:{url,protocols}` dual-mode schema; the LIVE current-CC schema is
38
- * shell-single-mode ({command, description, persistent, timeout_ms} — no ws branch anywhere in desc or schema).
39
- * sema's shell-single-mode Monitor is therefore aligned with current CC — do NOT port a WebSocket event-source
40
- * branch off the stale bundle. (Full-desc density diff vs the live guidance card remains P1, a separate item.)
36
+ * Event sources: this tool supplies ONE source, the shell `command`. The reference's `Monitor` input has a second arm,
37
+ * `ws?: { url; protocols? }` — a WebSocket whose text frames are events, not combined with `command`
38
+ * (`MonitorInput` (sdk-tools-321.d.ts:2968-2988)) — and a default session of the reference lists it: `Monitor` is a deferred
39
+ * tool there, so the schema is in the requests that follow a tool search, not in the first request's tool list. Not
40
+ * supplying the `ws` arm is this engine's own choice (divergence register entry `monitor-ws-source-not-ported`), not an
41
+ * alignment with the reference. (Full-desc density diff vs the live guidance card remains P1, a separate item.)
41
42
  */
42
43
  import type { AgentTool, ExecutionEnv } from "../internal/harness-types.js";
43
44
  import { type MonitorTimers, type TaskRegistry } from "../core/task-registry.js";
@@ -85,7 +85,8 @@ export declare function admitTaskListItem(item: TaskListItem, id: string): TaskL
85
85
  * high-water mark is MONOTONIC ACROSS REOPENS for any backend that outlives one wrapper
86
86
  * instance: a restart/reconnect must never re-mint an id the backend has already handed out
87
87
  * (the conformance suite's durable tier pins exactly this — a counter that resets while the
88
- * rows survive makes every receipt lie and every subsequent update miss).
88
+ * rows survive makes every receipt lie and every subsequent update miss). The one reset is
89
+ * `drop`, which erases the rows with the counter, so no receipt survives to point at a re-minted id.
89
90
  * - Value semantics: `get`/`list` return detached copies; `set` stores a detached copy. Callers
90
91
  * mutate their copy and write it back — a live-reference store would alias already-emitted events.
91
92
  * - ENTRY SHAPE ({@link TASK_LIST_ITEM_ROW_SHAPE}, the one reading every backend makes): `set` stores the item the table admits —
@@ -93,11 +94,12 @@ export declare function admitTaskListItem(item: TaskListItem, id: string): TaskL
93
94
  * ({@link TASK_LIST_ROW_MALFORMED_CODE}) before anything is written. A stored entry that does not read (another writer's, an
94
95
  * earlier release's) is `list`ed as a {@link DamagedTaskListItem} — its id and verdict — in its place, and `get` of it refuses in
95
96
  * the same code; `delete` removes it by its id. The tools count such an entry as open, so it keeps blocking what depends on it.
96
- * - RB-274: `list` is ordered by ID (numeric ascending), not by write order. The tool lane always
97
- * allocates before it sets, so the two coincide there — but a store shared with an OUTSIDE writer
98
- * (a real CC instance on the same directory) can set an id out of order, and then the backends
99
- * disagreed: memory replayed its Map's insertion order while file/cc read the id order back off
100
- * disk. Ordering is part of the contract, not each backend's incidental iteration order.
97
+ * - RB-274: `list` is ordered by ID — {@link compareTaskIds}: numeric ids ascending, any other id after them, lexicographically —
98
+ * not by write order. The tool lane always allocates before it sets, so the two coincide there — but a store shared with an
99
+ * OUTSIDE writer (a real CC instance on the same directory) can set an id out of order, and then the backends disagreed.
100
+ * Ordering is part of the contract, not each backend's incidental iteration order: every bundled backend sorts with
101
+ * `compareTaskIds` (the file store's key order is not the contract's order for an id that is not a canonical integer), and a
102
+ * store twin sorts with it too (it is a package-root export).
101
103
  *
102
104
  * @contract task_list.partition_is_root_session — a deployment that mounts a TaskListStore per session keys it by the
103
105
  * delegation tree's ROOT session: every child of the tree (spawned live, or revived by a host verb after a durable park)
@@ -116,6 +118,14 @@ export interface TaskListStore {
116
118
  * in-process per-store promise chain, which is exactly right for the bundled memory store (its
117
119
  * backend IS this object) and wrong for anything shared wider — implement `mutate` there. */
118
120
  mutate?<T>(fn: (tx: TaskListStore) => Promise<T>): Promise<T>;
121
+ /**
122
+ * Erase the whole list — every entry, a damaged one included, and the id high-water: the next `allocateId` answers `"1"`, as on a
123
+ * list never written. The session-tree cascade's leg for the list a deployment mounted under a session's id
124
+ * (`task_list.partition_is_root_session`; {@link import("../core/retention.js").RETENTION_CASCADE}): the ids it reserved belonged to
125
+ * that session's tree, which goes with it. Idempotent (an empty list stays empty); a store fault throws. OPTIONAL: absent ⇒ this
126
+ * store's lists outlive the sessions they were mounted for, and the deployment owns that gap.
127
+ */
128
+ drop?(): void | Promise<void>;
119
129
  }
120
130
  /** the clone policy behind the detached-copy contract: metadata must be JSON-shaped
121
131
  * (structuredClone would accept — and SHARE — SharedArrayBuffer backing memory, and throws opaquely
@@ -145,6 +145,10 @@ export function createMemoryTaskListStore() {
145
145
  delete: (id) => tasks.delete(id),
146
146
  list: () => [...tasks.entries()].sort(([a], [b]) => compareTaskIds(a, b)).map(([id, t]) => snapEntry(listStoredTaskListEntry(t, id))),
147
147
  allocateId: () => String(nextId++),
148
+ drop: () => {
149
+ tasks.clear();
150
+ nextId = 1;
151
+ },
148
152
  };
149
153
  }
150
154
  const storeChains = new WeakMap();
@@ -186,7 +186,15 @@ export type WebFetchSummarizerSeat = Pick<RunnerDeps, "brain" | "modelFallback">
186
186
  * The request goes out on the engine's model lane, like every other model call the engine makes: when `model` is a
187
187
  * catalog entry with a `fallbacks` chain, a failure the seat's `modelFallback` gate admits moves the request to the next
188
188
  * entry, and the summary is that entry's text. The seat is read once, here — a member it does not take, a `brain` that is
189
- * not a Brain and a bad `modelFallback` are refused when the summarizer is built, not on the first page.
189
+ * not a Brain and a bad `modelFallback` are refused when the summarizer is built, not on the first page. So is `model`: it is
190
+ * received at the model door, as the Model a task, a role or a tier names is, and the lane reads the chain off the snapshot the
191
+ * door answers — the catalog's own entry (a Runner's catalog holds it under its word) carries its chain; a Model that is not
192
+ * that entry has none, and one that declares `fallbacks` is refused (`config.model_fallback_invalid`), never answered by a
193
+ * request that silently walks nothing. The Brain is asked on the door's snapshot; `modelOriginOf` answers the caller's object.
194
+ *
195
+ * The request is answer-only: on a model whose wire spells `off` (the wire family's disable key, or a deployment-declared off
196
+ * spelling; `thinkingOffSpelled`) it asks for thinking off, as the auto-mode classifier's seat does; on a model whose wire
197
+ * cannot spell it, or names no dialect, it asks for nothing and the provider's default governs.
190
198
  */
191
199
  export declare function createWebFetchSummarizer(seat: WebFetchSummarizerSeat, model: Model, options?: WebFetchSummarizerOptions): (content: string, prompt: string, signal?: AbortSignal) => Promise<string | {
192
200
  text: string;
package/dist/tools/web.js CHANGED
@@ -13,8 +13,10 @@ import { pdfMagicMatches } from "../core/image-admission.js";
13
13
  import { mountRuleFace, toolFace } from "../core/tool-catalog-entries.js";
14
14
  import { codedRefusal, thrownText } from "../core/thrown-value.js";
15
15
  import { optionKeys, receiptRefusal, receiveMembers } from "../core/own-property-receipt.js";
16
+ import { receiveModel } from "../core/model-receipt.js";
16
17
  import { modelLaneBrainOf } from "../core/runner/model-lane-seat.js";
17
18
  import { completeOf } from "../brain/brain-faces.js";
19
+ import { lowestReasoningSeat } from "../brain/reasoning-request.js";
18
20
  import { isBrain } from "../brain/routing.js";
19
21
  const MAX_REDIRECTS = 10;
20
22
  const MAX_URL_LENGTH = 2048;
@@ -705,7 +707,9 @@ export function createWebFetchSummarizer(seat, model, options = {}) {
705
707
  throw receiptRefusal("createWebFetchSummarizer's seat.brain is absent or is not a Brain (an object with a `stream` function) — refused when the summarizer is built rather than wired without one");
706
708
  }
707
709
  const complete = completeOf(modelLaneBrainOf(held));
708
- const maxContentChars = resolveSummaryInputChars(model, options.maxContentChars);
710
+ const asked = receiveModel(model, "createWebFetchSummarizer's model", "the summarizer's Model", " The summarizer takes the catalog's own entry — the Model the catalog door received for that word, which is where the chain is recorded — not a copy of it.");
711
+ const summaryTier = lowestReasoningSeat(asked) === "off" ? "off" : undefined;
712
+ const maxContentChars = resolveSummaryInputChars(asked, options.maxContentChars);
709
713
  return async (content, prompt, signal) => {
710
714
  const promptOverflow = Math.max(0, prompt.length - SUMMARY_PROMPT_ALLOWANCE_CHARS);
711
715
  const budget = promptOverflow === 0 ? maxContentChars : Math.max(SUMMARY_MIN_CONTENT_PER_CALL, maxContentChars - promptOverflow);
@@ -713,13 +717,14 @@ export function createWebFetchSummarizer(seat, model, options = {}) {
713
717
  const truncated = inputTruncated ? content.slice(0, budget) + "\n\n[Content truncated due to length...]" : content;
714
718
  const userPrompt = `\nWeb page content:\n---\n${truncated}\n---\n\n${prompt}\n\n` + WEBFETCH_SUMMARY_GROUNDING_CLAUSE + "\n" + WEBFETCH_SUMMARY_GUIDELINES;
715
719
  const context = { messages: [{ role: "user", content: userPrompt, timestamp: Date.now() }] };
716
- const auth = await options.getApiKeyAndHeaders?.(model);
720
+ const auth = await options.getApiKeyAndHeaders?.(asked);
717
721
  const callOptions = {
718
722
  signal,
723
+ ...(summaryTier !== undefined ? { reasoning: summaryTier } : {}),
719
724
  ...(auth?.apiKey !== undefined ? { apiKey: auth.apiKey } : {}),
720
725
  ...(auth?.headers !== undefined ? { headers: auth.headers } : {}),
721
726
  };
722
- const msg = await complete(model, context, callOptions);
727
+ const msg = await complete(asked, context, callOptions);
723
728
  if (msg.stopReason === "error" || msg.stopReason === "aborted") {
724
729
  throw new Error(msg.errorMessage ?? `summarizer stopped with ${msg.stopReason}`);
725
730
  }
@@ -90,14 +90,16 @@ export declare function currentCheckoutOf(session: WorktreeSessionRef | undefine
90
90
  readonly canonical: string;
91
91
  }): string;
92
92
  /** A leg's write-location seat (the EnterWorktree session; empty until the worktree mount seeds it) and its readers, minted
93
- * before any write-root reader: `writeLocation` ({@link currentCheckoutOf} over the seat) and `checkout` — the write location
94
- * when it is in a managed tree (a switch, a task root that IS one, or a task root below one — a session's tree with the task
95
- * root in `pkg/`): the tree's canonical identity and the spelling the leg's paths carry it under, for the write-protection
96
- * judge's current-tree reading (`WriteProtectionCompileOptions.checkoutOf`). */
93
+ * before any write-root reader: `writeLocation` ({@link currentCheckoutOf} over the seat) and `checkout` — every managed tree a
94
+ * write root of the leg is in: the write location's (a switch, a task root that IS one, or a task root below one — a session's
95
+ * tree with the task root in `pkg/`) and each of `writeRoots`' (the leg's other declared write roots, canonical — an
96
+ * additional directory in its repository's session tree). Each tree is read off the root's own path, never off a record: its
97
+ * canonical identity and the spelling the leg's paths carry it under, for the write-protection judge's current-tree reading
98
+ * (`WriteProtectionCompileOptions.checkoutOf`). A root that CONTAINS a tree is in none (only "the root is in the tree" counts). */
97
99
  export declare function writeLocationOf(taskRoot: {
98
100
  readonly spelled: string;
99
101
  readonly canonical: string;
100
- }): {
102
+ }, writeRoots?: readonly string[]): {
101
103
  readonly seat: WorktreeSessionRef;
102
104
  readonly writeLocation: () => string;
103
105
  readonly checkout: () => ReadonlyArray<ManagedCheckoutView> | undefined;
@@ -13,14 +13,15 @@ export function currentCheckoutOf(session, taskRoot) {
13
13
  return taskRoot.canonical + dir.slice(spelled.length);
14
14
  return dir;
15
15
  }
16
- export function writeLocationOf(taskRoot) {
16
+ export function writeLocationOf(taskRoot, writeRoots = []) {
17
17
  const seat = {};
18
18
  const writeLocation = () => currentCheckoutOf(seat, taskRoot);
19
19
  const checkout = () => {
20
20
  const views = [];
21
- for (const [at, kind] of [[writeLocation(), "canonical"], [seat.current?.worktreeDir ?? taskRoot.spelled, "spelled"]]) {
21
+ const spellings = [[writeLocation(), "canonical"], [seat.current?.worktreeDir ?? taskRoot.spelled, "spelled"], ...writeRoots.flatMap((root) => [[root, "canonical"], [root, "spelled"]])];
22
+ for (const [at, kind] of spellings) {
22
23
  const tree = managedTreeAt(at);
23
- if (tree !== undefined)
24
+ if (tree !== undefined && !views.some((v) => v.root === tree.root && v.kind === kind))
24
25
  views.push({ root: tree.root, base: tree.base, kind });
25
26
  }
26
27
  return views.length > 0 ? views : undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sema-agent/core",
3
- "version": "7.67.2",
3
+ "version": "7.68.0",
4
4
  "description": "Stateless, task-oriented AI agent core",
5
5
  "type": "module",
6
6
  "license": "BUSL-1.1",
@@ -109,6 +109,7 @@
109
109
  "gate:backlog-ledger": "node scripts/verify-backlog-ledger.mjs",
110
110
  "gate:changelog-coverage": "node scripts/verify-changelog-coverage.mjs",
111
111
  "gate:changelog-released-blocks": "node scripts/verify-changelog-released-blocks.mjs",
112
+ "gate:changelog-breaking": "node scripts/verify-changelog-breaking.mjs",
112
113
  "gate:child-clamp-seats": "node scripts/verify-child-clamp-seats.mjs",
113
114
  "gate:spawn-sites": "node scripts/verify-spawn-sites.mjs",
114
115
  "gate:point-free-callbacks": "node scripts/verify-point-free-callbacks.mjs",
@@ -131,9 +132,9 @@
131
132
  "dependencies": {
132
133
  "@modelcontextprotocol/client": "2.4.0",
133
134
  "@modelcontextprotocol/core": "2.4.0",
134
- "@sema-agent/primitives": "7.67.2",
135
+ "@sema-agent/primitives": "7.68.0",
135
136
  "typebox": "1.1.39",
136
- "undici": "7.30.0"
137
+ "undici": "7.30.2"
137
138
  },
138
139
  "optionalDependencies": {
139
140
  "sharp": "^0.35.0"