@sema-agent/core 7.67.3 → 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 (496) hide show
  1. package/CHANGELOG.md +1516 -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/open-responses.js +3 -1
  30. package/dist/brain/openai.js +3 -1
  31. package/dist/brain/reasoning-request.d.ts +73 -19
  32. package/dist/brain/reasoning-request.js +164 -72
  33. package/dist/brain/reasoning-stamp.d.ts +26 -0
  34. package/dist/brain/reasoning-stamp.js +10 -0
  35. package/dist/brain/reasoning.d.ts +95 -162
  36. package/dist/brain/reasoning.js +31 -86
  37. package/dist/brain/route-adjudicator.d.ts +9 -7
  38. package/dist/brain/route-adjudicator.js +12 -10
  39. package/dist/brain/status-sink.d.ts +19 -64
  40. package/dist/brain/status-sink.js +5 -21
  41. package/dist/brain/stream-engine.d.ts +11 -2
  42. package/dist/brain/stream-engine.js +10 -0
  43. package/dist/core/a2a.d.ts +17 -5
  44. package/dist/core/a2a.js +11 -3
  45. package/dist/core/allow-entry.d.ts +35 -15
  46. package/dist/core/allow-entry.js +47 -60
  47. package/dist/core/ask-headline.d.ts +68 -0
  48. package/dist/core/ask-headline.js +23 -0
  49. package/dist/core/ask-origin.d.ts +36 -8
  50. package/dist/core/ask-origin.js +17 -10
  51. package/dist/core/ask-question.d.ts +34 -7
  52. package/dist/core/ask-question.js +10 -1
  53. package/dist/core/ask-unresolvable-notice.d.ts +7 -0
  54. package/dist/core/ask-unresolvable-notice.js +9 -3
  55. package/dist/core/auto-strip.d.ts +53 -0
  56. package/dist/core/auto-strip.js +76 -0
  57. package/dist/core/background-agent-store.d.ts +45 -5
  58. package/dist/core/background-agent-store.js +69 -15
  59. package/dist/core/background-shell.d.ts +2 -2
  60. package/dist/core/caller-text.js +2 -2
  61. package/dist/core/canonical-json.d.ts +13 -0
  62. package/dist/core/canonical-json.js +7 -0
  63. package/dist/core/checkpoint-features.d.ts +66 -20
  64. package/dist/core/checkpoint-features.js +12 -1
  65. package/dist/core/checkpoint-generation.d.ts +1 -1
  66. package/dist/core/checkpoint-queries.d.ts +1 -1
  67. package/dist/core/checkpoint-queries.js +4 -1
  68. package/dist/core/checkpoint-requirements.d.ts +25 -1
  69. package/dist/core/checkpoint-requirements.js +5 -1
  70. package/dist/core/checkpoint-row-verdict.d.ts +1 -0
  71. package/dist/core/checkpoint-row-verdict.js +4 -0
  72. package/dist/core/checkpoint-store.d.ts +66 -38
  73. package/dist/core/checkpoint-store.js +15 -6
  74. package/dist/core/child-clamp-seats.d.ts +6 -0
  75. package/dist/core/child-clamp-seats.js +1 -0
  76. package/dist/core/config-refusal-codes.d.ts +1 -1
  77. package/dist/core/config-refusal-codes.js +1 -0
  78. package/dist/core/delegation-frames.d.ts +9 -12
  79. package/dist/core/delegation-frames.js +9 -8
  80. package/dist/core/engine-capabilities.d.ts +21 -8
  81. package/dist/core/engine-capabilities.js +1 -1
  82. package/dist/core/engine-notice.d.ts +147 -34
  83. package/dist/core/engine-notice.js +27 -16
  84. package/dist/core/engine-storage-backend.d.ts +2 -1
  85. package/dist/core/env-budget.js +3 -3
  86. package/dist/core/env-knob-announce.d.ts +10 -10
  87. package/dist/core/env-knob-announce.js +3 -6
  88. package/dist/core/file-history-store.d.ts +29 -4
  89. package/dist/core/file-history-store.js +13 -0
  90. package/dist/core/frame-settlement.d.ts +2 -1
  91. package/dist/core/gate-fold.js +1 -1
  92. package/dist/core/gate-lanes.js +56 -49
  93. package/dist/core/governance-codes.d.ts +39 -3
  94. package/dist/core/governance-codes.js +61 -3
  95. package/dist/core/hooks.d.ts +29 -11
  96. package/dist/core/hooks.js +5 -2
  97. package/dist/core/human-input-projection.js +3 -3
  98. package/dist/core/input-author.d.ts +17 -3
  99. package/dist/core/input-author.js +15 -3
  100. package/dist/core/leg-identity.d.ts +10 -28
  101. package/dist/core/leg-identity.js +1 -21
  102. package/dist/core/lsp.d.ts +18 -13
  103. package/dist/core/lsp.js +30 -22
  104. package/dist/core/mailbox-store.d.ts +1 -1
  105. package/dist/core/mailbox-store.js +4 -4
  106. package/dist/core/mcp-connection-pool.d.ts +93 -4
  107. package/dist/core/mcp-connection-pool.js +104 -1
  108. package/dist/core/mcp-failure.d.ts +38 -12
  109. package/dist/core/mcp-failure.js +9 -13
  110. package/dist/core/mcp-probe.d.ts +4 -3
  111. package/dist/core/mcp-server-link.d.ts +4 -2
  112. package/dist/core/mcp-server-link.js +4 -5
  113. package/dist/core/mcp-server-spec.d.ts +3 -3
  114. package/dist/core/mcp-server-unavailable-notice.d.ts +22 -8
  115. package/dist/core/mcp-server-unavailable-notice.js +18 -4
  116. package/dist/core/mcp.d.ts +40 -6
  117. package/dist/core/mcp.js +39 -13
  118. package/dist/core/memory-engine/content-origin.js +2 -2
  119. package/dist/core/memory-engine/control-objects.d.ts +2 -4
  120. package/dist/core/memory-engine/control-objects.js +2 -10
  121. package/dist/core/memory-engine/delegation-settlement.js +6 -1
  122. package/dist/core/memory-engine/dual-root.js +3 -0
  123. package/dist/core/memory-engine/engine.d.ts +6 -4
  124. package/dist/core/memory-engine/engine.js +32 -29
  125. package/dist/core/memory-engine/file-backend.d.ts +20 -5
  126. package/dist/core/memory-engine/file-backend.js +21 -31
  127. package/dist/core/memory-engine/frontmatter.d.ts +2 -0
  128. package/dist/core/memory-engine/frontmatter.js +4 -0
  129. package/dist/core/memory-engine/layout.d.ts +114 -20
  130. package/dist/core/memory-engine/layout.js +340 -22
  131. package/dist/core/memory-engine/memory-deployment.d.ts +7 -5
  132. package/dist/core/memory-engine/mount-failed-notice.d.ts +19 -7
  133. package/dist/core/memory-engine/mount-failed-notice.js +43 -10
  134. package/dist/core/memory-engine/sync-client.js +4 -5
  135. package/dist/core/model-fallbacks.d.ts +5 -1
  136. package/dist/core/model-fallbacks.js +3 -3
  137. package/dist/core/model-receipt.d.ts +2 -1
  138. package/dist/core/model-receipt.js +12 -1
  139. package/dist/core/mods/kernel/dispatch.d.ts +2 -2
  140. package/dist/core/mods/kernel/dispatch.js +14 -6
  141. package/dist/core/mods/kernel/events.d.ts +8 -5
  142. package/dist/core/mods/kernel/events.js +2 -2
  143. package/dist/core/mods/kernel/index.d.ts +1 -1
  144. package/dist/core/mods/kernel/registration.d.ts +9 -0
  145. package/dist/core/mods/package.js +1 -1
  146. package/dist/core/mods/session-append.d.ts +4 -2
  147. package/dist/core/mods/session-append.js +3 -0
  148. package/dist/core/mods/stations.d.ts +7 -11
  149. package/dist/core/mods/stations.js +4 -7
  150. package/dist/core/mods/tool-call.d.ts +10 -8
  151. package/dist/core/mods/tool-call.js +15 -18
  152. package/dist/core/mounted-mcp.d.ts +0 -4
  153. package/dist/core/mounted-mcp.js +1 -1
  154. package/dist/core/park-noun.d.ts +24 -0
  155. package/dist/core/park-noun.js +21 -0
  156. package/dist/core/park-resumability.d.ts +60 -0
  157. package/dist/core/park-resumability.js +30 -0
  158. package/dist/core/permission-rule-provider.d.ts +24 -2
  159. package/dist/core/permission-rule-provider.js +11 -8
  160. package/dist/core/permission-rule-store.d.ts +8 -1
  161. package/dist/core/permission-rule-store.js +2 -3
  162. package/dist/core/permission-rules.d.ts +2 -1
  163. package/dist/core/permission-rules.js +8 -4
  164. package/dist/core/persisted-rule-arms.d.ts +3 -0
  165. package/dist/core/persisted-rule-arms.js +2 -1
  166. package/dist/core/present-plan-tool.d.ts +47 -3
  167. package/dist/core/present-plan-tool.js +62 -4
  168. package/dist/core/principal-name.d.ts +1 -1
  169. package/dist/core/principal-name.js +5 -5
  170. package/dist/core/process-identity.js +10 -5
  171. package/dist/core/protocol-http-auth.d.ts +20 -14
  172. package/dist/core/protocol-http-auth.js +70 -50
  173. package/dist/core/read-only-shell.js +9 -5
  174. package/dist/core/redaction-marks.d.ts +4 -26
  175. package/dist/core/redaction-marks.js +9 -21
  176. package/dist/core/remote-env.d.ts +43 -16
  177. package/dist/core/remote-env.js +1 -1
  178. package/dist/core/request-copy-projection.d.ts +1 -1
  179. package/dist/core/request-copy-projection.js +40 -50
  180. package/dist/core/resume-config-judge.js +1 -1
  181. package/dist/core/resume-startup-cause.d.ts +35 -18
  182. package/dist/core/resume-startup-cause.js +13 -10
  183. package/dist/core/retention.d.ts +167 -25
  184. package/dist/core/retention.js +100 -20
  185. package/dist/core/roles.d.ts +6 -0
  186. package/dist/core/roles.js +11 -5
  187. package/dist/core/rule-lane-reads.d.ts +3 -0
  188. package/dist/core/rule-lane-reads.js +5 -1
  189. package/dist/core/rule-store-fault.d.ts +70 -0
  190. package/dist/core/rule-store-fault.js +102 -0
  191. package/dist/core/runner/advertised-writable-dirs.js +16 -31
  192. package/dist/core/runner/announce-once-ledger.d.ts +19 -2
  193. package/dist/core/runner/announce-once-ledger.js +24 -2
  194. package/dist/core/runner/assemble-result.d.ts +6 -0
  195. package/dist/core/runner/assemble-result.js +1 -1
  196. package/dist/core/runner/auto-strip-notice.d.ts +36 -0
  197. package/dist/core/runner/auto-strip-notice.js +59 -0
  198. package/dist/core/runner/branch-window.d.ts +3 -0
  199. package/dist/core/runner/branch-window.js +37 -0
  200. package/dist/core/runner/caller-roster.d.ts +8 -3
  201. package/dist/core/runner/capability-withheld-seat.js +3 -9
  202. package/dist/core/runner/clock-and-limits.d.ts +22 -1
  203. package/dist/core/runner/clock-and-limits.js +30 -0
  204. package/dist/core/runner/contracts.d.ts +58 -35
  205. package/dist/core/runner/credential-refusal-seat.d.ts +2 -0
  206. package/dist/core/runner/credential-refusal-seat.js +47 -0
  207. package/dist/core/runner/cross-boundary-lane.js +6 -4
  208. package/dist/core/runner/decide-continuation.js +1 -1
  209. package/dist/core/runner/file-history-restore.d.ts +53 -2
  210. package/dist/core/runner/file-history-restore.js +29 -10
  211. package/dist/core/runner/forward-sink.d.ts +14 -1
  212. package/dist/core/runner/forward-sink.js +14 -12
  213. package/dist/core/runner/gate-exit.d.ts +8 -7
  214. package/dist/core/runner/gate-exit.js +13 -13
  215. package/dist/core/runner/git-status-frame.js +2 -4
  216. package/dist/core/runner/initial-run-state.js +1 -1
  217. package/dist/core/runner/main-call-account.d.ts +3 -1
  218. package/dist/core/runner/main-call-account.js +5 -3
  219. package/dist/core/runner/mcp-redial.d.ts +2 -5
  220. package/dist/core/runner/mcp-redial.js +2 -2
  221. package/dist/core/runner/nested-memory-content.d.ts +7 -1
  222. package/dist/core/runner/nested-memory-content.js +73 -13
  223. package/dist/core/runner/nested-memory-lane.d.ts +44 -19
  224. package/dist/core/runner/nested-memory-lane.js +152 -76
  225. package/dist/core/runner/park-commit.js +3 -1
  226. package/dist/core/runner/permission-rule-lanes.d.ts +8 -2
  227. package/dist/core/runner/permission-rule-lanes.js +29 -3
  228. package/dist/core/runner/person-path-rows.d.ts +3 -11
  229. package/dist/core/runner/person-path-rows.js +21 -24
  230. package/dist/core/runner/prepare-acquire-reconcile.js +3 -1
  231. package/dist/core/runner/prepare-artifact.d.ts +1 -1
  232. package/dist/core/runner/prepare-artifact.js +20 -14
  233. package/dist/core/runner/prepare-ask-lane.d.ts +9 -6
  234. package/dist/core/runner/prepare-ask-lane.js +6 -5
  235. package/dist/core/runner/prepare-boundary-parks.d.ts +7 -1
  236. package/dist/core/runner/prepare-boundary-parks.js +27 -24
  237. package/dist/core/runner/prepare-caps-and-workflow.d.ts +5 -2
  238. package/dist/core/runner/prepare-caps-and-workflow.js +4 -3
  239. package/dist/core/runner/prepare-config-doors.d.ts +9 -24
  240. package/dist/core/runner/prepare-config-doors.js +58 -41
  241. package/dist/core/runner/prepare-context-lane.d.ts +2 -2
  242. package/dist/core/runner/prepare-context-lane.js +3 -5
  243. package/dist/core/runner/prepare-defer-classify.d.ts +1 -1
  244. package/dist/core/runner/prepare-defer-classify.js +1 -1
  245. package/dist/core/runner/prepare-delegation-surface.d.ts +2 -2
  246. package/dist/core/runner/prepare-delegation-surface.js +3 -2
  247. package/dist/core/runner/prepare-file-history.d.ts +62 -26
  248. package/dist/core/runner/prepare-file-history.js +117 -46
  249. package/dist/core/runner/prepare-gate-stations.d.ts +4 -0
  250. package/dist/core/runner/prepare-gate-stations.js +6 -5
  251. package/dist/core/runner/prepare-hands-readface.d.ts +9 -4
  252. package/dist/core/runner/prepare-hands-readface.js +8 -4
  253. package/dist/core/runner/prepare-inherited-gate.d.ts +11 -4
  254. package/dist/core/runner/prepare-inherited-gate.js +6 -6
  255. package/dist/core/runner/prepare-listings.d.ts +1 -1
  256. package/dist/core/runner/prepare-listings.js +1 -1
  257. package/dist/core/runner/prepare-memory.js +2 -2
  258. package/dist/core/runner/prepare-offload-wrappers.d.ts +1 -1
  259. package/dist/core/runner/prepare-offload-wrappers.js +1 -1
  260. package/dist/core/runner/prepare-park-ask.d.ts +10 -3
  261. package/dist/core/runner/prepare-park-ask.js +7 -9
  262. package/dist/core/runner/prepare-policy-chain.d.ts +18 -9
  263. package/dist/core/runner/prepare-policy-chain.js +18 -13
  264. package/dist/core/runner/prepare-project-context.d.ts +1 -1
  265. package/dist/core/runner/prepare-project-context.js +5 -3
  266. package/dist/core/runner/prepare-prompt-assembly.js +2 -1
  267. package/dist/core/runner/prepare-prompt-inputs.d.ts +2 -2
  268. package/dist/core/runner/prepare-prompt-inputs.js +1 -1
  269. package/dist/core/runner/prepare-protocol-tools.d.ts +4 -5
  270. package/dist/core/runner/prepare-protocol-tools.js +7 -7
  271. package/dist/core/runner/prepare-question-face.d.ts +4 -2
  272. package/dist/core/runner/prepare-run-refs.d.ts +7 -2
  273. package/dist/core/runner/prepare-run-refs.js +8 -7
  274. package/dist/core/runner/prepare-safety-scan.d.ts +4 -3
  275. package/dist/core/runner/prepare-suspend-saga.d.ts +3 -7
  276. package/dist/core/runner/prepare-suspend-saga.js +4 -3
  277. package/dist/core/runner/prepare-task.js +66 -53
  278. package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +3 -2
  279. package/dist/core/runner/prepare-tool-disclosure-mount.js +2 -1
  280. package/dist/core/runner/prepare-turn-wiring.d.ts +3 -1
  281. package/dist/core/runner/prepare-turn-wiring.js +1 -1
  282. package/dist/core/runner/prepare-wiring-manifest.d.ts +9 -4
  283. package/dist/core/runner/prepare-wiring-manifest.js +14 -6
  284. package/dist/core/runner/prepare-workspace-restore.d.ts +4 -4
  285. package/dist/core/runner/prepare-workspace-restore.js +15 -6
  286. package/dist/core/runner/remote-env-retry.d.ts +3 -3
  287. package/dist/core/runner/restore-seat.d.ts +41 -0
  288. package/dist/core/runner/restore-seat.js +38 -0
  289. package/dist/core/runner/resume-admission.js +1 -1
  290. package/dist/core/runner/resume-apply.js +4 -3
  291. package/dist/core/runner/resume-checkpoint-screen.js +2 -1
  292. package/dist/core/runner/resume-internals-and-config.js +2 -1
  293. package/dist/core/runner/resume-preflight.js +2 -1
  294. package/dist/core/runner/rewind-files.js +22 -6
  295. package/dist/core/runner/rule-store-unreadable-notice.d.ts +8 -0
  296. package/dist/core/runner/rule-store-unreadable-notice.js +11 -0
  297. package/dist/core/runner/run-brain-sinks.d.ts +3 -6
  298. package/dist/core/runner/run-brain-sinks.js +6 -6
  299. package/dist/core/runner/run-compaction-machinery.d.ts +2 -2
  300. package/dist/core/runner/run-git-lane.d.ts +2 -0
  301. package/dist/core/runner/run-git-lane.js +2 -1
  302. package/dist/core/runner/run-harness-handlers.js +5 -4
  303. package/dist/core/runner/run-identity-wiring.js +20 -12
  304. package/dist/core/runner/run-leg.js +31 -72
  305. package/dist/core/runner/run-notification-lane.d.ts +3 -0
  306. package/dist/core/runner/run-notification-lane.js +2 -4
  307. package/dist/core/runner/run-reasoning-seat.d.ts +5 -6
  308. package/dist/core/runner/run-reasoning-seat.js +13 -18
  309. package/dist/core/runner/run-settle-and-teardown.js +13 -9
  310. package/dist/core/runner/run-terminal-adoption.js +4 -8
  311. package/dist/core/runner/run-turn-boundary.js +6 -3
  312. package/dist/core/runner/runtask.d.ts +9 -4
  313. package/dist/core/runner/runtask.js +29 -22
  314. package/dist/core/runner/session-rule-policy.d.ts +11 -1
  315. package/dist/core/runner/shell-env-withheld.js +2 -7
  316. package/dist/core/runner/side-call-account.d.ts +5 -6
  317. package/dist/core/runner/side-call-account.js +2 -2
  318. package/dist/core/runner/stream-lifecycle-verbs.d.ts +3 -0
  319. package/dist/core/runner/stream-lifecycle-verbs.js +5 -3
  320. package/dist/core/runner/stream-settle-backstop.js +4 -6
  321. package/dist/core/runner/stream-steer-verb.d.ts +1 -1
  322. package/dist/core/runner/stream-steer-verb.js +4 -4
  323. package/dist/core/runner/sub-agent-deny-lists.d.ts +8 -3
  324. package/dist/core/runner/sub-agent-deny-lists.js +7 -4
  325. package/dist/core/runner/teardown-bounded.d.ts +7 -0
  326. package/dist/core/runner/teardown-bounded.js +7 -0
  327. package/dist/core/runner/terminal-account.js +41 -13
  328. package/dist/core/runner/terminal-projection.d.ts +1 -5
  329. package/dist/core/runner/tool-end-body.d.ts +9 -3
  330. package/dist/core/runner/tool-end-body.js +6 -3
  331. package/dist/core/runner/tool-output-projection.d.ts +13 -4
  332. package/dist/core/runner/tool-output-projection.js +10 -14
  333. package/dist/core/runner/turn-attachments.d.ts +3 -2
  334. package/dist/core/runner/turn-attachments.js +12 -5
  335. package/dist/core/runner-deps.d.ts +6 -6
  336. package/dist/core/runtime-caps.d.ts +2 -1
  337. package/dist/core/secret-env.d.ts +20 -3
  338. package/dist/core/secret-env.js +13 -15
  339. package/dist/core/session-checkout.d.ts +115 -15
  340. package/dist/core/session-checkout.js +435 -136
  341. package/dist/core/session-policy-store.js +21 -3
  342. package/dist/core/session-reconcile.js +1 -0
  343. package/dist/core/session-store.js +2 -0
  344. package/dist/core/session.d.ts +11 -1
  345. package/dist/core/shell-run-candidates.d.ts +1 -0
  346. package/dist/core/shell-run-candidates.js +1 -1
  347. package/dist/core/shutdown-debug.d.ts +6 -5
  348. package/dist/core/shutdown-debug.js +5 -1
  349. package/dist/core/skill-grant.js +4 -1
  350. package/dist/core/skills-directory.js +5 -3
  351. package/dist/core/spec-contract.d.ts +1 -1
  352. package/dist/core/store-contracts/checkpoint-store-contract.js +2 -7
  353. package/dist/core/store-contracts/file-history-store-contract.js +26 -2
  354. package/dist/core/store-contracts/session-deletion-cascade-contract.js +130 -14
  355. package/dist/core/store-contracts/task-list-store-contract.d.ts +2 -1
  356. package/dist/core/store-contracts/task-list-store-contract.js +28 -1
  357. package/dist/core/task-event.d.ts +48 -27
  358. package/dist/core/task-notification.d.ts +15 -9
  359. package/dist/core/task-notification.js +12 -0
  360. package/dist/core/task-registry-agent.d.ts +24 -22
  361. package/dist/core/task-registry-agent.js +65 -46
  362. package/dist/core/task-registry-shared.d.ts +17 -5
  363. package/dist/core/task-registry.d.ts +17 -6
  364. package/dist/core/task-registry.js +6 -1
  365. package/dist/core/task-result.d.ts +71 -25
  366. package/dist/core/task-spec-members.d.ts +0 -1
  367. package/dist/core/task-spec-members.js +1 -1
  368. package/dist/core/task-spec.d.ts +60 -52
  369. package/dist/core/task-stream.d.ts +45 -12
  370. package/dist/core/terminal-cause.d.ts +45 -8
  371. package/dist/core/terminal-cause.js +5 -0
  372. package/dist/core/tool-card-bound.d.ts +32 -0
  373. package/dist/core/tool-card-bound.js +33 -0
  374. package/dist/core/tool-catalog-entries.d.ts +9 -0
  375. package/dist/core/tool-catalog-entries.js +48 -0
  376. package/dist/core/tool-errors.d.ts +4 -3
  377. package/dist/core/tool-face.d.ts +3 -3
  378. package/dist/core/tool-mount-facts.d.ts +3 -2
  379. package/dist/core/tool-mount-facts.js +1 -1
  380. package/dist/core/tool-mount-static.js +7 -5
  381. package/dist/core/tool-policy.d.ts +21 -19
  382. package/dist/core/tool-policy.js +5 -6
  383. package/dist/core/tool-registry.d.ts +3 -1
  384. package/dist/core/tool-registry.js +15 -1
  385. package/dist/core/tool-result-store.d.ts +9 -3
  386. package/dist/core/tool-result-store.js +14 -1
  387. package/dist/core/tool-roster.d.ts +6 -0
  388. package/dist/core/tool-roster.js +18 -0
  389. package/dist/core/tool-spec.d.ts +17 -8
  390. package/dist/core/trace.d.ts +35 -31
  391. package/dist/core/types.d.ts +2 -2
  392. package/dist/core/untrusted-egress.d.ts +10 -9
  393. package/dist/core/untrusted-egress.js +9 -9
  394. package/dist/core/untrusted-text.d.ts +0 -18
  395. package/dist/core/untrusted-text.js +7 -3
  396. package/dist/core/user-attachment.d.ts +9 -6
  397. package/dist/core/user-attachment.js +12 -10
  398. package/dist/core/user-row-origin.d.ts +44 -25
  399. package/dist/core/user-row-origin.js +30 -20
  400. package/dist/core/wiring-manifest.d.ts +26 -7
  401. package/dist/core/wiring-manifest.js +14 -11
  402. package/dist/core/workspace-snapshot.d.ts +3 -1
  403. package/dist/core/workspace-snapshot.js +1 -0
  404. package/dist/engine/execution-env/node-execution-env.d.ts +23 -16
  405. package/dist/engine/execution-env/node-execution-env.js +127 -67
  406. package/dist/engine/harness/agent-harness.d.ts +4 -5
  407. package/dist/engine/harness/agent-harness.js +2 -7
  408. package/dist/engine/harness/types.d.ts +51 -19
  409. package/dist/engine/harness/types.js +28 -1
  410. package/dist/engine/llm/types.d.ts +26 -14
  411. package/dist/engine/llm/types.js +2 -2
  412. package/dist/engine/loop/agent-loop.d.ts +2 -2
  413. package/dist/engine/loop/agent-loop.js +51 -275
  414. package/dist/engine/loop/types.d.ts +0 -18
  415. package/dist/engine/session/import-validate.d.ts +3 -0
  416. package/dist/engine/session/import-validate.js +34 -2
  417. package/dist/engine/session/repo-utils.d.ts +42 -4
  418. package/dist/engine/session/repo-utils.js +33 -5
  419. package/dist/engine/session/session.d.ts +41 -14
  420. package/dist/engine/session/session.js +96 -25
  421. package/dist/index.d.ts +21 -16
  422. package/dist/index.js +16 -10
  423. package/dist/orchestration/run-spec.d.ts +1 -1
  424. package/dist/orchestration/run-workflow-tool.d.ts +12 -9
  425. package/dist/orchestration/run-workflow-tool.js +15 -19
  426. package/dist/orchestration/workflow-governance.js +13 -21
  427. package/dist/orchestration/workflow-observe.d.ts +4 -3
  428. package/dist/orchestration/workflow-primitives.d.ts +1 -1
  429. package/dist/orchestration/workflow-record-artifact.d.ts +14 -0
  430. package/dist/orchestration/workflow-record-artifact.js +32 -0
  431. package/dist/orchestration/workflow-script-store.d.ts +9 -0
  432. package/dist/orchestration/workflow-script-store.js +20 -1
  433. package/dist/orchestration/workflow-types.d.ts +33 -3
  434. package/dist/orchestration/workflow.d.ts +24 -14
  435. package/dist/orchestration/workflow.js +52 -23
  436. package/dist/prompt-assembly/artifact.js +4 -8
  437. package/dist/prompt-assembly/catalog/engine.d.ts +263 -0
  438. package/dist/prompt-assembly/catalog/engine.js +30 -0
  439. package/dist/prompt-assembly/catalog/index.d.ts +1 -1
  440. package/dist/prompt-assembly/catalog/index.js +2 -2
  441. package/dist/prompt-assembly/catalog/locales/zh-Hans/engine.d.ts +1 -1
  442. package/dist/prompt-assembly/catalog/locales/zh-Hans/engine.js +29 -0
  443. package/dist/prompt-assembly/epoch.js +6 -8
  444. package/dist/prompt-assembly/turn-snapshot.js +8 -9
  445. package/dist/stores/file/background-agent-store.js +5 -6
  446. package/dist/stores/file/checkpoint-store.d.ts +0 -4
  447. package/dist/stores/file/checkpoint-store.js +7 -3
  448. package/dist/stores/file/file-history-store.d.ts +8 -0
  449. package/dist/stores/file/file-history-store.js +72 -0
  450. package/dist/stores/file/fs-atomic.js +17 -12
  451. package/dist/stores/file/index.js +11 -5
  452. package/dist/stores/file/mailbox-store.js +13 -4
  453. package/dist/stores/file/permission-rule-store.js +14 -13
  454. package/dist/stores/file/shared-ledger.d.ts +4 -0
  455. package/dist/stores/file/shared-ledger.js +4 -0
  456. package/dist/stores/file/task-list-store.js +12 -3
  457. package/dist/stores/file/workflow-run-store.js +1 -0
  458. package/dist/tools/fs/bash-program-position.d.ts +4 -2
  459. package/dist/tools/fs/bash-program-position.js +1 -1
  460. package/dist/tools/fs/bash-readonly-classifier.js +1 -1
  461. package/dist/tools/fs/bound-open.d.ts +97 -0
  462. package/dist/tools/fs/bound-open.js +103 -0
  463. package/dist/tools/fs/containment-face.d.ts +2 -2
  464. package/dist/tools/fs/fs-pdf.d.ts +7 -1
  465. package/dist/tools/fs/fs-pdf.js +31 -23
  466. package/dist/tools/fs/fs-read.d.ts +24 -17
  467. package/dist/tools/fs/fs-read.js +84 -53
  468. package/dist/tools/fs/fs-shared.d.ts +14 -12
  469. package/dist/tools/fs/fs-shared.js +5 -4
  470. package/dist/tools/fs/fs-write.d.ts +2 -2
  471. package/dist/tools/fs/fs-write.js +20 -12
  472. package/dist/tools/fs/index.d.ts +4 -4
  473. package/dist/tools/fs/index.js +2 -2
  474. package/dist/tools/fs/notebook.d.ts +1 -1
  475. package/dist/tools/fs/pdf.d.ts +12 -3
  476. package/dist/tools/fs/pdf.js +22 -9
  477. package/dist/tools/fs/read-deny-home.d.ts +3 -2
  478. package/dist/tools/fs/read-deny-home.js +8 -11
  479. package/dist/tools/fs/safety.d.ts +3 -2
  480. package/dist/tools/fs/shell-read-check.js +10 -9
  481. package/dist/tools/monitor.d.ts +6 -5
  482. package/dist/tools/task-list.d.ts +16 -6
  483. package/dist/tools/task-list.js +4 -0
  484. package/dist/tools/web.d.ts +9 -1
  485. package/dist/tools/web.js +8 -3
  486. package/dist/tools/worktree.d.ts +7 -5
  487. package/dist/tools/worktree.js +4 -3
  488. package/package.json +4 -3
  489. package/test/export-surface.snapshot.json +93 -7
  490. package/wire-changes/core-stores-sql@7.68.0.json +39 -0
  491. package/wire-changes/core@7.68.0.json +4257 -0
  492. package/wire-changes/mods-kernel@7.68.0.json +129 -0
  493. package/wire-changes/primitives@7.68.0.json +253 -0
  494. package/wire-changes/wiki-gate@7.68.0.json +39 -0
  495. package/dist/core/runner/credential-origin-seat.d.ts +0 -2
  496. package/dist/core/runner/credential-origin-seat.js +0 -20
@@ -267,11 +267,15 @@ export interface PostCompactEvent extends ClassicEventBase {
267
267
  }
268
268
  /** `classic.PermissionDenied`'s `e` (CC-exact fields + the gate outcome) — raised when the gate's adjudicate chain
269
269
  * DENY-SHORT-CIRCUITS a call (a policy deny, a tighten whose ask resolved to deny, the plan-mode write-deny, the
270
- * compliance deny) and on the engine's fail-closed refusal of a failed PreToolUse screening (`source:"hook"`); NOT on a
271
- * PreToolUse handler's own deny (that is the handler's decision, and this event attributes the ENGINE's) nor on a
272
- * durable suspend. Observe-only. `identity` is present on every ENGINE emission; absent only when a host drives
273
- * {@link runToolGate} without `ToolGateInput.identity`. (CC raises its PermissionDenied from the auto-mode classifier's
274
- * refusals alone; sema's trigger surface is deliberately WIDER — a divergence, not a parity claim.) */
270
+ * compliance deny), on the engine's fail-closed refusal of a failed PreToolUse screening (`source:"hook"`), and on every
271
+ * refusal of a parked call's resumed execution (the durable decide's own refusal, and each re-check that vetoes an
272
+ * approval: the approved call's re-screen, the policy, org, rule, skill, read and cross-boundary re-checks); NOT on a
273
+ * PreToolUse handler's own deny of a call no person approved — phase 1, and its look at a policy's rewrite (that is the
274
+ * handler's decision, and this event attributes the ENGINE's — the reference's form: it never raises for a hook's deny) —
275
+ * nor on a durable suspend. Observe-only. `identity` is present on
276
+ * every ENGINE emission; absent only when a host drives {@link runToolGate} without `ToolGateInput.identity`. (CC raises its
277
+ * PermissionDenied from the auto-mode classifier's refusals alone; sema's trigger surface is deliberately WIDER — a
278
+ * divergence, not a parity claim.) */
275
279
  export interface PermissionDeniedPayload extends ClassicEventBase {
276
280
  readonly toolName: string;
277
281
  /** The FINAL (post-rewrite) args the chain adjudicated — what would have executed; not necessarily the model's
@@ -680,7 +684,7 @@ export interface ToolGateResult {
680
684
  * tool through the run's own one-shot binding (the gate never carries the answer itself).
681
685
  * · `unavailable` — nobody was reachable and NOTHING was shown (the {@link
682
686
  * import("./ask-question.js").QuestionUnavailable} contract). Only this arm may be re-routed — the
683
- * gate parks the question for a later human, or answers the honest "it was NOT shown" refusal.
687
+ * gate parks the question for a later human, or refuses it ("no live face answered it").
684
688
  * · `delivery_failure` — delivery was attempted and failed. NEVER re-routed: the question may already
685
689
  * have been rendered to a person, so parking it would put one question in front of two deciders. It
686
690
  * is reported to the model through the tool's own coded-failure / degrade exits.
@@ -794,6 +798,11 @@ export interface PersistedRuleUnreadable {
794
798
  * tightens to a real-approval ask of the same class — also the gate's reading of a lane answer it cannot read (the reason
795
799
  * then names this seat and the failed field). Both carry the origin `rule_store_unavailable`. */
796
800
  readonly reason?: string;
801
+ /** WHY a store form could not read, when the lane knows: one fault per partition it could not read — the sources it took out and a
802
+ * reason of the closed set ({@link RULE_STORE_FAULT_REASONS}) — which the gate puts into the question's sentence (the partition and
803
+ * the cause; never a path). Read as the store form only (`reason` absent); an answer whose faults are not that shape reads as an
804
+ * unreadable store that states no cause — the answer's meaning does not change. */
805
+ readonly faults?: readonly import("./rule-store-fault.js").RuleStoreFault[];
797
806
  }
798
807
  /**
799
808
  * design/375 §5.2② — the CLEAN NEGATIVE that still carries the per-segment coverage table: no rule
@@ -984,7 +993,8 @@ export interface ToolGateInput extends PermissionSeatInputs, SkillGateSeats, All
984
993
  /**
985
994
  * design/174 — route a policy `ask` on the reserved question tool to this run's CONTENT-ask channel
986
995
  * before it can become a park or a refusal. Called in the `ask` branch with the FINAL post-hook,
987
- * post-policy request (the same args that will execute), and it owns everything about delivery:
996
+ * post-policy request (the same args that will execute) — and again, with the edited request, when a person's approved edit of
997
+ * that tool's call is re-judged into a question — and it owns everything about delivery:
988
998
  * validating the batch before anything is put in front of a person, calling the live face, and binding
989
999
  * the answer to this call id for the tool to pick up. It returns only WHICH of the three outcomes
990
1000
  * happened — never the answer, which travels the run's own binding.
@@ -1149,6 +1159,11 @@ export interface ToolGateInput extends PermissionSeatInputs, SkillGateSeats, All
1149
1159
  permissionMode?: () => import("./ask-origin.js").PermissionMode;
1150
1160
  /** The leg's approval-seat form (`WiringManifest.ask.form`): the deny exit's way-out clause names a declaration, never a missing approver. */
1151
1161
  askSeatForm?: import("./wiring-manifest.js").AskSeamForm;
1162
+ /** The leg's one fact "its parks cannot be resumed" (who says so; whether the forced gate binds it), read off the driver's derivation:
1163
+ * the deny exit names the leg's way out (`notResumableWayOut`) on every ask nobody was asked about — in place of the approver clause,
1164
+ * in the tool text and the `delegation.ask_unresolvable` notice alike — and a refused question names the leg's cause. ABSENT ⇔ the
1165
+ * leg's parks can be resumed (or a host drives the gate directly). */
1166
+ notResumable?: import("./park-resumability.js").NotResumableLeg;
1152
1167
  /** The read face the leg resolved, read per call into the class derivation (`roots` withholds the classifier from a `probe` question); absent ⇒ none resolved. */
1153
1168
  readFace?: () => import("../tools/fs/containment-face.js").ContainmentFace | undefined;
1154
1169
  /** WHO put the tool's egress / irreversibility marks on the seat ({@link import("./ask-origin.js").ToolMarkSource});
@@ -1203,6 +1218,7 @@ export interface ToolGateInput extends PermissionSeatInputs, SkillGateSeats, All
1203
1218
  parkLaneExisted: boolean;
1204
1219
  remedy?: string;
1205
1220
  remedies?: readonly import("./ask-origin.js").ApprovalRemedy[];
1221
+ notResumableWayOut?: string;
1206
1222
  }) => void;
1207
1223
  /**
1208
1224
  * design/153 §2/§7.4 (件4 复审, MED): true means this call's ask is MARKED — an inherited ancestor
@@ -1459,10 +1475,11 @@ export interface AskCarry {
1459
1475
  /** What a durable row persists of an {@link AskCarry}: the fallback member COPIED (the row never aliases
1460
1476
  * the gate's object; its window is already `0` — the gate's carry mint is the one writer of that
1461
1477
  * number), the origin word only when it is a member of the closed set, the class pair and the askers' entries only when
1462
- * well-formed, as fresh copies, the card's question through the approval-display reading (sanitized, size-bounded) and
1463
- * the written ask rule as written (a non-empty string or nothing) — the carry is typed, but the row is the boundary a
1464
- * host reads back through, the same screen the summary applies to the word. */
1465
- export declare function askCarryRowMembers(carry: AskCarry | undefined): {
1478
+ * well-formed, as fresh copies, the card's question through the approval-display reading (sanitized, size-bounded),
1479
+ * the written ask rule as written (a non-empty string or nothing) and the card's headline for the class word kept, in
1480
+ * `say`'s locale (absent ⇒ canonical) — the carry is typed, but the row is the boundary a host reads back through, the
1481
+ * same screen the summary applies to the word. */
1482
+ export declare function askCarryRowMembers(carry: AskCarry | undefined, say?: import("../prompt-assembly/engine-text.js").EngineText): {
1466
1483
  denialLimitFallback?: import("./auto-mode.js").DenialLimitFallback;
1467
1484
  classifierNoRuling?: import("./auto-mode.js").AutoModeFallbackCause;
1468
1485
  origin?: import("./ask-origin.js").AskOrigin;
@@ -1471,6 +1488,7 @@ export declare function askCarryRowMembers(carry: AskCarry | undefined): {
1471
1488
  askReasons?: readonly import("./ask-origin.js").AskReason[];
1472
1489
  cardMessage?: string;
1473
1490
  cardAskRule?: string;
1491
+ headline?: string;
1474
1492
  };
1475
1493
  /**
1476
1494
  * The design/37 **two-phase tool gate** — the single chokepoint that makes the load-bearing invariant
@@ -11,6 +11,7 @@ import { hookAskReasonOf, isAskOrigin, receiveAskReasons, screenAskClassMembers
11
11
  import { isAutoModeFallbackCause } from "./auto-mode.js";
12
12
  import { inlineUntrusted } from "./untrusted-text.js";
13
13
  import { approvalMessageOf } from "./approval-display.js";
14
+ import { askHeadlineMember } from "./ask-headline.js";
14
15
  export { formatHookFeedback } from "./reminder-mint.js";
15
16
  import { createSafeNotifier } from "./safe-notify.js";
16
17
  import { wireOf } from "./tool-name-readings.js";
@@ -244,7 +245,7 @@ export function createPreToolUseScreening(input, readSettled = (decision) => ({
244
245
  deniedReason,
245
246
  };
246
247
  }
247
- export function askCarryRowMembers(carry) {
248
+ export function askCarryRowMembers(carry, say) {
248
249
  if (carry === undefined)
249
250
  return {};
250
251
  const origin = carry.origin;
@@ -261,6 +262,7 @@ export function askCarryRowMembers(carry) {
261
262
  ...(askReasons !== undefined ? { askReasons } : {}),
262
263
  ...(cardMessage !== undefined ? { cardMessage } : {}),
263
264
  ...(typeof rule === "string" && rule.length > 0 ? { cardAskRule: rule } : {}),
265
+ ...askHeadlineMember(classed?.askClass, say),
264
266
  };
265
267
  }
266
268
  export async function runToolGate(input) {
@@ -275,7 +277,8 @@ export async function runToolGate(input) {
275
277
  const mode = input.observedPermissionMode?.();
276
278
  const seen = mode !== undefined ? { ...payload, permissionMode: mode } : payload;
277
279
  const onHostObserverFailure = (err) => void notifier.notify(() => { throw err; }, "toolGate.permissionDenied");
278
- return observePermissionDenied({ legBus: input.modBus, hostObserver: input.permissionDenied, payload: seen, signal: input.abortSignal, onHostObserverFailure });
280
+ const host = input.permissionDenied;
281
+ return observePermissionDenied({ legBus: input.modBus, ...(host !== undefined ? { host: { observe: host, onFailure: onHostObserverFailure } } : {}), payload: seen, signal: input.abortSignal });
279
282
  };
280
283
  const ledger = createSettlementLedger({ toolCallId, toolName });
281
284
  const screening = createPreToolUseScreening(input, (settled) => {
@@ -5,9 +5,9 @@ import { inlineUntrusted } from "./untrusted-text.js";
5
5
  import { formatHookFeedback } from "./reminder-mint.js";
6
6
  import { attrEscape, EXTERNAL_SOURCE_MAX } from "./task-notification.js";
7
7
  const MID_TURN_USER_INPUT_HEAD = "The user sent a new message while you were working:\n";
8
- const MID_TURN_USER_INPUT_TAIL = "\n\nThis is how a message sent mid-turn is surfaced: within the turn that is still running, often " +
9
- "alongside the next tool result, rather than as a separate conversation turn. Address the message " +
10
- "above as you continue this turn.";
8
+ const MID_TURN_USER_INPUT_TAIL = "\n\nThis is how a message sent while you were working is surfaced: next to the next tool result when you " +
9
+ "were mid-task, or as the next turn when your last reply was already complete. Address the message above, " +
10
+ "continuing what you were doing where that still applies.";
11
11
  export function frameMidTurnUserInput(projected) {
12
12
  if (isBlankInput(projected))
13
13
  return projected;
@@ -1,4 +1,5 @@
1
1
  import type { RunInternals } from "./runner/contracts.js";
2
+ import type { EngineNotice } from "./engine-notice.js";
2
3
  import type { ModFrame, ModOrigin } from "./mods/kernel/index.js";
3
4
  import type { AssertAllKeysHandled } from "./ask-origin.js";
4
5
  export declare const INPUT_AUTHORS: readonly ["operator", "parent_model", "workflow", "peer", "observer", "engine", "extension"];
@@ -113,8 +114,9 @@ export type AuthoredRelayAnswer = {
113
114
  * `drop`; a fault the verb does not answer rejects.
114
115
  */
115
116
  export type AuthoredSteer = (author: InputAuthor, text: string, call?: AuthoredRelayCall) => Promise<AuthoredRelayAnswer>;
116
- /** Where a leg's loop stands for an input: `before` — the run is live and its loop has not begun taking input (an injection
117
- * would wait out the birth window); `open` — it takes input; `over` — it will take no more. */
117
+ /** Where a leg's loop stands for an input: `before` — the loop is not taking input and has not ended: the run is starting (an
118
+ * injection would wait out the birth window), or, for an instant, the loop's last prompt has settled and its end is not yet
119
+ * recorded (`open` reads `before` there, and an input finds no boundary); `open` — it takes input; `over` — it will take no more. */
118
120
  export type InputWindow = "before" | "open" | "over";
119
121
  /** The stream's relay as the leg's `$.prompt.submit` entry reaches it: the relay, and the one fact the relay's birth-window
120
122
  * wait reads ({@link InputWindow}) — the entry refuses a call that would wait on the leg it is called from. */
@@ -133,6 +135,18 @@ export declare function bindAuthoredSteer(stream: object, steer: AuthoredSteer):
133
135
  /** The authored steer of a stream the Runner minted; `undefined` for any other object. */
134
136
  export declare function authoredSteerOf(stream: object): AuthoredSteer | undefined;
135
137
  /** The terminal account's sentence for inputs of other authors a run accepted and never delivered: they are dropped, never
136
- * carried across a pause and never counted as the person's (the caller hands it to `onError` once, `phase: "degraded"`). */
138
+ * carried across a pause and never counted as the person's (the caller hands it to `onError` once, `phase: "degraded"`).
139
+ * This is the operator's face of the loss; {@link droppedInputsNotice} is the person's. */
137
140
  export declare function droppedInputsDisclosure(authors: readonly InputAuthor[]): Error;
141
+ /** The routing keys a dropped-input notice carries: the leg's notice address (`NoticeAddress`) and its run, and the leg's task. */
142
+ export interface DroppedInputsWhere {
143
+ readonly sessionId: string;
144
+ readonly sourceSessionId?: string;
145
+ readonly agentId?: string;
146
+ readonly taskId?: string;
147
+ readonly runId: string;
148
+ }
149
+ /** The person's face of the same loss (`task.undelivered_input_dropped`): how many inputs each other author wrote that the leg
150
+ * ended without reading. `detail.authors` counts per author; the keys are where the leg's notices go. */
151
+ export declare function droppedInputsNotice(authors: readonly InputAuthor[], where: DroppedInputsWhere): EngineNotice;
138
152
  export {};
@@ -67,10 +67,22 @@ export function bindAuthoredSteer(stream, steer) {
67
67
  export function authoredSteerOf(stream) {
68
68
  return authoredSteers.get(stream);
69
69
  }
70
- export function droppedInputsDisclosure(authors) {
70
+ function countByAuthor(authors) {
71
71
  const counts = new Map();
72
72
  for (const a of authors)
73
73
  counts.set(a, (counts.get(a) ?? 0) + 1);
74
- const named = [...counts].map(([a, n]) => `${n} from ${a}`).join(", ");
75
- return new Error(`the run ended with ${authors.length} accepted input(s) it never delivered that are not the operator's (${named}): they are dropped — only an operator's input is carried across a pause or counted as the person's undelivered input`);
74
+ return counts;
75
+ }
76
+ const namedCounts = (counts) => [...counts].map(([a, n]) => `${n} from ${a}`).join(", ");
77
+ export function droppedInputsDisclosure(authors) {
78
+ return new Error(`the run ended with ${authors.length} accepted input(s) it never delivered that are not the operator's (${namedCounts(countByAuthor(authors))}): they are dropped — only an operator's input is carried across a pause or counted as the person's undelivered input`);
79
+ }
80
+ const DROPPED_INPUT_NOTICE_CODE = "task.undelivered_input_dropped";
81
+ export function droppedInputsNotice(authors, where) {
82
+ const counts = countByAuthor(authors);
83
+ return {
84
+ code: DROPPED_INPUT_NOTICE_CODE,
85
+ message: `The run ended before it read ${authors.length} accepted input(s) written by other authors (${namedCounts(counts)}): they are dropped, and no later run carries them.`,
86
+ detail: { authors: Object.fromEntries(counts), ...where },
87
+ };
76
88
  }
@@ -28,37 +28,14 @@ export declare function legTaskIdOf(spec: {
28
28
  }, internals: {
29
29
  readonly rowTaskId?: string | undefined;
30
30
  } | undefined, sessionId: string | undefined): string | undefined;
31
- /** The members of the SYNCHRONOUS-CHILD BLOCK a parked row records beside its identity, in the spelling of the run internals they are read from
32
- * ({@link import("./runner/contracts.js").RunInternals}): the spawning run's session and task, and the delegation tree's root session with
33
- * the occupant of its row. One tuple, so the mint, the resume's restore, the row's member-shape table and the summary all name the same four. */
31
+ /** The members of the SYNCHRONOUS-CHILD BLOCK a parked row of an earlier release records beside its identity: the spawning run's session
32
+ * and task, and the delegation tree's root session with the occupant of its row. One tuple, so the row's member-shape table, the summary
33
+ * and the row judge (a row holding any of them is a synchronous child's — a leg nobody resumes) name the same four. No release mints
34
+ * them any more: a synchronous child's parks are not minted (`approvalParkNotResumableOf`). */
34
35
  export declare const SYNC_CHILD_BLOCK_MEMBERS: readonly ["parentSessionId", "parentTaskId", "rootSessionId", "rootSessionIncarnation"];
35
36
  export type SyncChildBlock = {
36
37
  readonly [K in (typeof SYNC_CHILD_BLOCK_MEMBERS)[number]]?: string;
37
38
  };
38
- /**
39
- * The block a SYNCHRONOUS child's park rows record: {@link SYNC_CHILD_BLOCK_MEMBERS}, each only when it is a non-blank string — ONE
40
- * predicate, ONE mint, read at prepare and stamped on every row the leg parks (approval, `resource_limit`, `plan_review`). A synchronous
41
- * child is a delegated leg that is neither a registry row (`rowTaskId` absent: a background child's parent and root are the key and the
42
- * columns of its registry record) nor a workflow agent (`delegationTaskType` absent: a workflow's agent is a delegated leg with no row too,
43
- * but it has no synchronous parent to answer to): the one leg whose parked row is the only place a consumer can read where it came from.
44
- * A root run has no parent — its rows carry none of the four. On a resumed leg a member the live internals carry none of (a host resume
45
- * hands the leg none) is read from the parked row's own record (`recorded`): the row holds the answer once, a resume reads it and never
46
- * re-derives it. Pure over the leg's facts.
47
- */
48
- export declare function syncChildBlockOf(leg: {
49
- readonly isDelegatedChild: boolean;
50
- readonly internals: ({
51
- readonly rowTaskId?: string | undefined;
52
- readonly delegationTaskType?: string | undefined;
53
- } & SyncChildBlock) | undefined;
54
- /** The parked row's own copy on a resumed leg. */
55
- readonly recorded?: SyncChildBlock | undefined;
56
- }): {
57
- [K in (typeof SYNC_CHILD_BLOCK_MEMBERS)[number]]?: string;
58
- };
59
- /** The block a parked row recorded ({@link SYNC_CHILD_BLOCK_MEMBERS}, each only as a non-blank string), or `undefined` when it recorded none —
60
- * what a resumed leg hands the park mint as {@link syncChildBlockOf}'s `recorded`. */
61
- export declare function recordedSyncChildBlock(row: SyncChildBlock): SyncChildBlock | undefined;
62
39
  /** The facts a leg's ask source is minted from — all the leg's own, read once its session and task id are minted. */
63
40
  export interface AskSourceFacts {
64
41
  /** The leg's end-user principal (its spec's). */
@@ -75,6 +52,9 @@ export interface AskSourceFacts {
75
52
  readonly explicitAgentName?: string | undefined;
76
53
  readonly agentName?: string | undefined;
77
54
  } | undefined;
55
+ /** On a resumed leg: the attribution bit the parked row records (`CheckpointState.fromSubagent`) — what the leg's earlier asks
56
+ * carried, read back for a resume that hands no parent task. */
57
+ readonly recordedFromSubagent?: boolean;
78
58
  }
79
59
  /**
80
60
  * The leg's ask source, minted ONCE per leg and read by every face that names the issuing leg: the four `resolveAsk`
@@ -87,7 +67,9 @@ export interface AskSourceFacts {
87
67
  * - `sourceSessionId` — the leg's session: the conversation, never a task.
88
68
  * - `agentId` — {@link agentIdOf} over the leg's task id and delegation fact: present exactly on a delegated child.
89
69
  * - `fromSubagent` — the attribution discriminator: trusted `parentTaskId` presence (a directly-started workflow's agent has
90
- * none, so it carries `agentId` without it).
70
+ * none, so it carries `agentId` without it), joined with the parked row's record on a resumed leg — a resume handed no
71
+ * parent task keeps the bit its leg's earlier asks carried, and a record never takes away a parent task the resume hands.
72
+ * Every row the leg parks records the result (`CheckpointState.fromSubagent`), so the row and the leg's asks answer it once.
91
73
  * - `isDelegatedChild` — the refusal posture: the RAW delegation fact, forks included (a fork's interaction contract is
92
74
  * one-shot — "no waiting for the user" — so a stop-and-wait refusal would ask it the impossible), so `resolveAsk`'s human
93
75
  * refusal texts speak the right posture (parent thread: stop and wait for the user; delegated child: adapt or report).
@@ -5,26 +5,6 @@ export function legTaskIdOf(spec, internals, sessionId) {
5
5
  return internals?.rowTaskId ?? spec.taskId ?? sessionId;
6
6
  }
7
7
  export const SYNC_CHILD_BLOCK_MEMBERS = Object.freeze(["parentSessionId", "parentTaskId", "rootSessionId", "rootSessionIncarnation"]);
8
- export function syncChildBlockOf(leg) {
9
- if (!leg.isDelegatedChild || leg.internals?.rowTaskId !== undefined || leg.internals?.delegationTaskType !== undefined)
10
- return {};
11
- const block = {};
12
- for (const name of SYNC_CHILD_BLOCK_MEMBERS) {
13
- const value = leg.internals?.[name] ?? leg.recorded?.[name];
14
- if (typeof value === "string" && value.trim() !== "")
15
- block[name] = value;
16
- }
17
- return block;
18
- }
19
- export function recordedSyncChildBlock(row) {
20
- const block = {};
21
- for (const name of SYNC_CHILD_BLOCK_MEMBERS) {
22
- const value = row[name];
23
- if (typeof value === "string" && value.trim() !== "")
24
- block[name] = value;
25
- }
26
- return Object.keys(block).length > 0 ? block : undefined;
27
- }
28
8
  export function mintAskSourceIdentity(leg) {
29
9
  const agentId = agentIdOf({ taskId: leg.taskId, isDelegatedChild: leg.isDelegatedChild });
30
10
  const sourceAgentName = leg.internals?.explicitAgentName ?? leg.internals?.agentName;
@@ -32,7 +12,7 @@ export function mintAskSourceIdentity(leg) {
32
12
  principal: leg.principal,
33
13
  sourceSessionId: leg.sessionId,
34
14
  ...(agentId !== undefined ? { agentId } : {}),
35
- ...(leg.internals?.parentTaskId !== undefined ? { fromSubagent: true } : {}),
15
+ ...(leg.internals?.parentTaskId !== undefined || leg.recordedFromSubagent === true ? { fromSubagent: true } : {}),
36
16
  ...(sourceAgentName !== undefined ? { sourceAgentName } : {}),
37
17
  ...(leg.isDelegatedChild ? { isDelegatedChild: true } : {}),
38
18
  });
@@ -2,7 +2,8 @@ import { type RootsSeat } from "../tools/fs/safety.js";
2
2
  import { type ReadDenyMatcher } from "../tools/fs/read-deny.js";
3
3
  import type { HomeViewsCarrier } from "../tools/fs/read-deny-home.js";
4
4
  import type { ContainmentFace } from "../tools/fs/containment-face.js";
5
- import type { AgentTool, BoundFileObject, ExecutionEnv, ReadFloor } from "../internal/harness-types.js";
5
+ import type { AgentTool, ExecutionEnv, ReadFloor } from "../internal/harness-types.js";
6
+ import { type ReadObject } from "../tools/fs/bound-open.js";
6
7
  /**
7
8
  * LSP code-intelligence tool (design/64 §13.1) — the app-dev命门 (go-to-def / find-refs / hover across
8
9
  * Dart/Kotlin/TS). A single `lsp` tool with a 9-operation enum, built over a pluggable {@link LspServerManager}.
@@ -154,13 +155,14 @@ export interface LspSession {
154
155
  /** `gate` = the caller's read face at the session's file reads ({@link LspReadGate}); absent ⇒ a caller with none. */
155
156
  request(op: LspOperation, params: LspRequestParams, signal?: AbortSignal, gate?: LspReadGate): Promise<LspResult>;
156
157
  }
157
- /** What a session's read gate answered for one file: the object its judgment named, opened and HELD (the environment's
158
- * `openBound`) under the canonical key it was judged as — the session reads that object, never the name again, and closes
159
- * it — or a refusal with its reason. */
158
+ /** What a session's read gate answered for one file: the object its judgment named, opened and BOUND (the environment's
159
+ * `openBound`) under the canonical key it was judged as — or, where the environment cannot bind on that target, the one
160
+ * by-name simulation of it, judged again after every read ({@link readObjectAt}) — the session reads that object, never the
161
+ * name again, and closes it; or a refusal with its reason. */
160
162
  export type LspReadAdmission = {
161
163
  readonly ok: true;
162
164
  readonly key: string;
163
- readonly object: BoundFileObject;
165
+ readonly object: ReadObject;
164
166
  } | {
165
167
  readonly ok: false;
166
168
  readonly reason: string;
@@ -195,11 +197,12 @@ export interface LspReadFace {
195
197
  * with; with no read face the env's working directory is the only base there is. */
196
198
  export declare function lspBaseOf(readFace: LspReadFace | undefined, env?: ExecutionEnv): string | undefined;
197
199
  /** The session gate over a read face — the bound read a user attachment makes, at the session's read: the name is judged
198
- * as `Read` judges its target (a judgment that throws refuses), the object the judgment named is opened and held
199
- * (`openBound`; an environment without it cannot bind and refuses), and the name, judged again, must still land on the
200
- * held key. The admission carries the held object; the session reads only it. `authorizedKey` = the canonical key this
201
- * call's target was authorized as (the station's one-read admission already spent on it): a spelling that still lands
202
- * there passes outside the roots, nothing else does. */
200
+ * as `Read` judges its target (a judgment that throws refuses), the object the judgment named is opened and bound
201
+ * (`openBound`) — or, where the environment cannot bind on the file (no `openBound`, or `not_supported`), the one by-name
202
+ * simulation of it is taken, the name judged again after every read of it ({@link readObjectAt}) — and the name, judged
203
+ * again, must still land on that key. The admission carries the object; the session reads only it. `authorizedKey` = the
204
+ * canonical key this call's target was authorized as (the station's one-read admission already spent on it): a spelling
205
+ * that still lands there passes outside the roots, nothing else does. */
203
206
  export declare function lspReadGateOf(env: ExecutionEnv, face: LspReadFace, authorizedKey?: string): LspReadGate;
204
207
  /** Why a file the language server named is withheld: a read-deny row reaches one of its views, or its views could not be
205
208
  * read (`unreadable` — the judgment's absence word). */
@@ -288,10 +291,12 @@ export interface LspToolOptions {
288
291
  * The read face this mount reads under (needs `env`). PRESENT ⇒ every read the tool causes passes it: the `filePath`
289
292
  * target is resolved against the declared base (the tracked working directory, else the root) and fenced as `Read`
290
293
  * fences its own — containment with the station's one-read admission, the read-deny table, blocked devices; the file
291
- * preconditions (exists / a regular file / the size cap) are read from the object that judgment named, held at its key
294
+ * preconditions (exists / a regular file / the size cap) are read from the object that judgment named, bound at its key
292
295
  * (the environment's `openBound`), never from the spelling again; the session reads an opened file only from the
293
- * object the face admitted and held (an environment without `openBound` reads nothing) and closes one it does not
294
- * admit; every location or symbol in a file the deny table reaches is withheld, and the result says how many. ABSENT ⇒
296
+ * object the face admitted and bound, and closes one it does not admit. An environment that cannot bind on the file
297
+ * (no `openBound`, or `not_supported`) has both read from the one by-name simulation of that object instead — the leaf
298
+ * looked at without following a link, one bounded read, the name judged again after it; every location or symbol in a
299
+ * file the deny table reaches is withheld, and the result says how many. ABSENT ⇒
295
300
  * no read face judged this mount (a library-direct tool with no gate): a relative `filePath` resolves against
296
301
  * `env.cwd`, the preconditions and the session's reads go by name, nothing is fenced and nothing is withheld.
297
302
  */
package/dist/core/lsp.js CHANGED
@@ -9,6 +9,7 @@ import { defineTool, errorResult } from "./tools.js";
9
9
  import { toolFace } from "./tool-catalog-entries.js";
10
10
  import { thrownText } from "./thrown-value.js";
11
11
  import { envErrorDetail } from "../tools/fs/env-error-detail.js";
12
+ import { readObjectAt } from "../tools/fs/bound-open.js";
12
13
  export const LSP_OPERATIONS = [
13
14
  "goToDefinition", "findReferences", "hover", "documentSymbol", "workspaceSymbol",
14
15
  "goToImplementation", "prepareCallHierarchy", "incomingCalls", "outgoingCalls",
@@ -86,34 +87,34 @@ export function lspBaseOf(readFace, env) {
86
87
  function judgeLspRead(env, face, spelling, signal, admitted) {
87
88
  return resolveKey(env, face.rootCanonical, spelling, signal, lspBaseOf(face), face.roots, admitted, face.readDeny, face.face);
88
89
  }
89
- const LSP_UNBINDABLE = "this environment cannot bind a read to the file that was checked";
90
- export function lspReadGateOf(env, face, authorizedKey) {
90
+ function lspKeyOf(env, face, authorizedKey) {
91
91
  const exempt = authorizedKey === undefined ? undefined : (key) => key === authorizedKey;
92
- const keyOf = async (filePath, signal) => {
92
+ return async (filePath, signal) => {
93
93
  const r = await judgeLspRead(env, face, filePath, signal, exempt).catch(() => undefined);
94
94
  return r?.ok === true ? r.key : undefined;
95
95
  };
96
+ }
97
+ export function lspReadGateOf(env, face, authorizedKey) {
98
+ const keyOf = lspKeyOf(env, face, authorizedKey);
96
99
  return async (filePath, signal) => {
97
100
  await face.ready?.(undefined, signal);
98
101
  const key = await keyOf(filePath, signal);
99
102
  if (key === undefined)
100
103
  return { ok: false, reason: "the read boundary refuses this file" };
101
- if (env.openBound === undefined)
102
- return { ok: false, reason: LSP_UNBINDABLE };
103
- let held;
104
+ let opened;
104
105
  try {
105
- held = await env.openBound(key, signal);
106
+ opened = await readObjectAt(env, key, async (s) => (await keyOf(filePath, s)) === key, signal);
106
107
  }
107
108
  catch (e) {
108
109
  return { ok: false, reason: thrownText(e) };
109
110
  }
110
- if (!held.ok)
111
- return { ok: false, reason: envErrorDetail(held.error.message) };
111
+ if (!opened.ok)
112
+ return { ok: false, reason: envErrorDetail(opened.error.message) };
112
113
  if ((await keyOf(filePath, signal)) !== key) {
113
- await held.value.close();
114
+ await opened.value.close();
114
115
  return { ok: false, reason: "it resolved to a different file while it was being checked" };
115
116
  }
116
- return { ok: true, key, object: held.value };
117
+ return { ok: true, key, object: opened.value };
117
118
  };
118
119
  }
119
120
  export async function lspListedWithheld(env, face, uris, signal) {
@@ -230,22 +231,20 @@ async function withholdDenied(result, withheldOf) {
230
231
  return { result: kept, note };
231
232
  }
232
233
  const factsOfFileError = (code) => (code === "not_found" ? "missing" : code === "invalid" ? "not_a_file" : undefined);
233
- async function heldTargetFacts(env, key, signal) {
234
- if (env.openBound === undefined)
235
- return undefined;
236
- const held = await env.openBound(key, signal).catch(() => undefined);
237
- if (held === undefined)
234
+ async function heldTargetFacts(env, key, rejudge, signal) {
235
+ const opened = await readObjectAt(env, key, rejudge, signal).catch(() => undefined);
236
+ if (opened === undefined)
238
237
  return undefined;
239
- if (!held.ok)
240
- return factsOfFileError(held.error.code);
238
+ if (!opened.ok)
239
+ return factsOfFileError(opened.error.code);
241
240
  try {
242
- if (held.value.kind === "directory")
241
+ if (opened.value.kind === "directory")
243
242
  return "not_a_file";
244
- const size = await held.value.size();
243
+ const size = await opened.value.size();
245
244
  return size.ok ? { size: size.value } : undefined;
246
245
  }
247
246
  finally {
248
- await held.value.close();
247
+ await opened.value.close();
249
248
  }
250
249
  }
251
250
  async function namedTargetFacts(env, target, signal) {
@@ -317,7 +316,16 @@ export function createLspTool(manager, opts = {}) {
317
316
  judgedKey = r.key;
318
317
  gate = lspReadGateOf(opts.env, readFace, r.key);
319
318
  }
320
- const facts = opts.env === undefined ? undefined : judgedKey !== undefined ? await heldTargetFacts(opts.env, judgedKey, ctx.signal) : await namedTargetFacts(opts.env, target, ctx.signal);
319
+ let facts;
320
+ if (opts.env === undefined)
321
+ facts = undefined;
322
+ else if (judgedKey !== undefined && readFace !== undefined) {
323
+ const keyOf = lspKeyOf(opts.env, readFace, judgedKey);
324
+ const key = judgedKey;
325
+ facts = await heldTargetFacts(opts.env, key, async (s) => (await keyOf(filePath, s)) === key, ctx.signal);
326
+ }
327
+ else
328
+ facts = await namedTargetFacts(opts.env, target, ctx.signal);
321
329
  if (facts === "missing")
322
330
  return errorResult(`Error (LSP): File does not exist: ${filePath}`);
323
331
  if (facts === "not_a_file")
@@ -49,7 +49,7 @@ export declare const MAILBOX_INVALID_LEASE_OWNER_CODE = "mailbox.invalid_lease_o
49
49
  /**
50
50
  * THE one spelling judge of a name the box keeps and compares by equality — a receipt id, a lease owner, a decision move's holder: a
51
51
  * string with visible content ({@link hasVisibleContent}: the one reading of "blank" a principal's name uses too — white space and the
52
- * format characters, the joiners included, count for nothing), at most {@link NAME_MAX_CHARS} characters, and no control or
52
+ * format characters, the joiners included, count for nothing), at most {@link PRINCIPAL_NAME_MAX_CHARS} characters, and no control or
53
53
  * format character. A blank one names nothing (`"" === ""` reads two holders as the same one; so does a string of one joiner or
54
54
  * zero-width mark, which prints as nothing), a control character reads as another line wherever the name is printed, a format
55
55
  * character (zero-width, a direction override) prints as nothing or reorders what is printed, and a name of any length is kept in
@@ -2,7 +2,7 @@ import { createHash } from "node:crypto";
2
2
  import { isFiniteNumber, isListOf, isRecord, isRowCorrupt, isString, optional, required, rowShapeReader, takesExit, via } from "./row-shape.js";
3
3
  import { receiveRetentionPolicy } from "./retention-policy.js";
4
4
  import { readMemberGroup } from "./member-group.js";
5
- import { NAME_MAX_CHARS, hasVisibleContent } from "./principal-name.js";
5
+ import { PRINCIPAL_NAME_MAX_CHARS, hasVisibleContent } from "./principal-name.js";
6
6
  export const MAILBOX_DECISIONS = Object.freeze(["held", "approved", "delivered", "denied", "expired", "refused", "dropped"]);
7
7
  export function readStoredMailboxDecision(raw) {
8
8
  if (raw === undefined)
@@ -14,11 +14,11 @@ export const MAILBOX_INVALID_LEASE_OWNER_CODE = "mailbox.invalid_lease_owner";
14
14
  const CONTROL_CHARACTER = /\p{Cc}/u;
15
15
  const FORMAT_CHARACTER = /(?![\u200c\u200d])\p{Cf}/u;
16
16
  export function isMailboxNameSpelling(raw) {
17
- return typeof raw === "string" && hasVisibleContent(raw) && raw.length <= NAME_MAX_CHARS && !CONTROL_CHARACTER.test(raw) && !FORMAT_CHARACTER.test(raw);
17
+ return typeof raw === "string" && hasVisibleContent(raw) && raw.length <= PRINCIPAL_NAME_MAX_CHARS && !CONTROL_CHARACTER.test(raw) && !FORMAT_CHARACTER.test(raw);
18
18
  }
19
19
  export function assertMailboxLeaseOwner(owner) {
20
20
  if (!isMailboxNameSpelling(owner)) {
21
- throw new MailboxStoreError(MAILBOX_INVALID_LEASE_OWNER_CODE, `MailboxStore.claimLease: owner must be a string with a non-blank character and no control character, no format character, and at most ${NAME_MAX_CHARS} characters`);
21
+ throw new MailboxStoreError(MAILBOX_INVALID_LEASE_OWNER_CODE, `MailboxStore.claimLease: owner must be a string with a non-blank character and no control character, no format character, and at most ${PRINCIPAL_NAME_MAX_CHARS} characters`);
22
22
  }
23
23
  }
24
24
  export function isMailboxDecision(value) {
@@ -60,7 +60,7 @@ export function assertMailboxDecisionMove(seq, expect, next, holder) {
60
60
  if (typeof seq !== "number" || !Number.isInteger(seq) || seq < 1)
61
61
  refuse(`seq must be a positive integer (got ${String(seq)})`);
62
62
  if (holder !== undefined && !isMailboxNameSpelling(holder))
63
- refuse(`holder must be absent or a lease owner spelling — a string with a non-blank character and no control character, no format character, and at most ${NAME_MAX_CHARS} characters (got ${typeof holder === "string" ? "a string that is not one" : typeof holder})`);
63
+ refuse(`holder must be absent or a lease owner spelling — a string with a non-blank character and no control character, no format character, and at most ${PRINCIPAL_NAME_MAX_CHARS} characters (got ${typeof holder === "string" ? "a string that is not one" : typeof holder})`);
64
64
  if (expect !== undefined && !isMailboxDecision(expect))
65
65
  refuse(`expect must be absent or one of ${MAILBOX_DECISIONS.join("|")}`);
66
66
  if (!isMailboxDecision(next))