@sema-agent/core 7.51.1 → 7.52.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 (372) hide show
  1. package/CHANGELOG.md +550 -2
  2. package/dist/agents/agent-transcript-tool.d.ts +1 -1
  3. package/dist/agents/cascade.js +4 -0
  4. package/dist/agents/cumulative-stats.d.ts +3 -0
  5. package/dist/agents/cumulative-stats.js +3 -0
  6. package/dist/agents/list-agents-tool.d.ts +1 -1
  7. package/dist/agents/read-inbox-tool.d.ts +1 -1
  8. package/dist/agents/repair-loop.js +4 -0
  9. package/dist/agents/send-message-tool.d.ts +11 -16
  10. package/dist/agents/send-message-tool.js +11 -13
  11. package/dist/agents/subagent.d.ts +5 -0
  12. package/dist/agents/subagent.js +7 -4
  13. package/dist/agents/tool-filter.d.ts +40 -13
  14. package/dist/agents/tool-filter.js +28 -14
  15. package/dist/bench/metrics.d.ts +1 -0
  16. package/dist/brain/anthropic.js +16 -12
  17. package/dist/brain/model-presets.d.ts +4 -5
  18. package/dist/brain/model-presets.js +4 -4
  19. package/dist/brain/open-responses.js +16 -12
  20. package/dist/brain/openai.js +16 -12
  21. package/dist/brain/request-params.d.ts +12 -33
  22. package/dist/brain/request-params.js +5 -2
  23. package/dist/brain/request-route.d.ts +9 -8
  24. package/dist/brain/request-route.js +1 -0
  25. package/dist/brain/route-adjudicator.d.ts +117 -47
  26. package/dist/brain/route-adjudicator.js +171 -42
  27. package/dist/brain/route-conformance.js +2 -2
  28. package/dist/brain/status-sink.d.ts +18 -0
  29. package/dist/brain/status-sink.js +7 -0
  30. package/dist/core/allow-entry.d.ts +42 -8
  31. package/dist/core/allow-entry.js +24 -17
  32. package/dist/core/auto-compaction.d.ts +23 -20
  33. package/dist/core/auto-compaction.js +37 -16
  34. package/dist/core/auto-promote.d.ts +2 -1
  35. package/dist/core/auto-promote.js +2 -2
  36. package/dist/core/caller-tool-name.d.ts +9 -0
  37. package/dist/core/caller-tool-name.js +13 -0
  38. package/dist/core/checkpoint-requirements.d.ts +7 -1
  39. package/dist/core/checkpoint-requirements.js +2 -0
  40. package/dist/core/checkpoint-store.d.ts +36 -12
  41. package/dist/core/checkpoint-store.js +1 -1
  42. package/dist/core/child-clamp-seats.d.ts +6 -0
  43. package/dist/core/child-clamp-seats.js +2 -1
  44. package/dist/core/credential-vocabulary.d.ts +33 -8
  45. package/dist/core/credential-vocabulary.js +32 -7
  46. package/dist/core/decision-receipt.d.ts +2 -2
  47. package/dist/core/delegation-frames.d.ts +9 -2
  48. package/dist/core/delegation-name.d.ts +18 -0
  49. package/dist/core/delegation-name.js +47 -0
  50. package/dist/core/engine-capabilities.d.ts +8 -1
  51. package/dist/core/engine-capabilities.js +1 -1
  52. package/dist/core/engine-notice.d.ts +36 -19
  53. package/dist/core/frontmatter-fence.d.ts +10 -0
  54. package/dist/core/frontmatter-fence.js +6 -0
  55. package/dist/core/gate-fold.js +5 -23
  56. package/dist/core/gate-lanes.js +356 -270
  57. package/dist/core/governance-codes.d.ts +9 -4
  58. package/dist/core/governance-codes.js +9 -3
  59. package/dist/core/hooks.d.ts +276 -734
  60. package/dist/core/hooks.js +97 -192
  61. package/dist/{tools/fs → core}/image-admission.d.ts +21 -3
  62. package/dist/{tools/fs → core}/image-admission.js +24 -6
  63. package/dist/core/locked-config.d.ts +26 -5
  64. package/dist/core/locked-config.js +31 -6
  65. package/dist/core/mcp-connection-pool.d.ts +4 -1
  66. package/dist/core/mcp-connection-pool.js +7 -2
  67. package/dist/core/mcp-probe.d.ts +12 -9
  68. package/dist/core/mcp-probe.js +2 -2
  69. package/dist/core/mcp-server-spec.d.ts +53 -7
  70. package/dist/core/mcp-server-spec.js +84 -1
  71. package/dist/core/mcp.d.ts +11 -7
  72. package/dist/core/mcp.js +27 -9
  73. package/dist/core/memory-engine/data-plane.js +5 -1
  74. package/dist/core/memory-engine/distiller.js +16 -2
  75. package/dist/core/memory-engine/engine.d.ts +8 -11
  76. package/dist/core/memory-engine/engine.js +9 -5
  77. package/dist/core/memory-engine/frontmatter.d.ts +6 -0
  78. package/dist/core/memory-engine/frontmatter.js +19 -16
  79. package/dist/core/memory.d.ts +2 -2
  80. package/dist/core/mode-policy.d.ts +4 -0
  81. package/dist/core/mode-policy.js +7 -5
  82. package/dist/core/model-seat.d.ts +4 -1
  83. package/dist/core/mods/dollar.d.ts +109 -0
  84. package/dist/core/mods/dollar.js +154 -0
  85. package/dist/core/mods/host.d.ts +23 -0
  86. package/dist/core/mods/host.js +21 -0
  87. package/dist/core/mods/kernel/budget.d.ts +43 -0
  88. package/dist/core/mods/kernel/budget.js +83 -0
  89. package/dist/core/mods/kernel/dispatch.d.ts +100 -0
  90. package/dist/core/mods/kernel/dispatch.js +701 -0
  91. package/dist/core/mods/kernel/events.d.ts +242 -0
  92. package/dist/core/mods/kernel/events.js +210 -0
  93. package/dist/core/mods/kernel/index.d.ts +6 -0
  94. package/dist/core/mods/kernel/index.js +5 -0
  95. package/dist/core/mods/kernel/receive.d.ts +65 -0
  96. package/dist/core/mods/kernel/receive.js +123 -0
  97. package/dist/core/mods/kernel/registration.d.ts +131 -0
  98. package/dist/core/mods/kernel/registration.js +102 -0
  99. package/dist/core/mods/kernel/site-rules.d.ts +84 -0
  100. package/dist/core/mods/kernel/site-rules.js +104 -0
  101. package/dist/core/mods/stations.d.ts +350 -0
  102. package/dist/core/mods/stations.js +444 -0
  103. package/dist/core/own-property-receipt.js +11 -23
  104. package/dist/core/parent-spec-seat.d.ts +18 -7
  105. package/dist/core/parent-spec-seat.js +6 -2
  106. package/dist/core/path-identity.js +2 -1
  107. package/dist/core/permission-rule-syntax.d.ts +15 -0
  108. package/dist/core/permission-rule-syntax.js +24 -16
  109. package/dist/core/permission-rules.d.ts +7 -1
  110. package/dist/core/permission-rules.js +26 -15
  111. package/dist/core/prompt-section-seat.d.ts +15 -27
  112. package/dist/core/prompt-section-seat.js +73 -40
  113. package/dist/core/protocol-http-auth.d.ts +3 -1
  114. package/dist/core/protocol-http-auth.js +2 -0
  115. package/dist/core/reminder-mint.d.ts +2 -2
  116. package/dist/core/remote-env.d.ts +24 -12
  117. package/dist/core/remote-env.js +1 -0
  118. package/dist/core/resume-startup-cause.d.ts +16 -1
  119. package/dist/core/resume-startup-cause.js +4 -1
  120. package/dist/core/retired-keys.d.ts +4 -0
  121. package/dist/core/retired-keys.js +3 -0
  122. package/dist/core/runner/announce-once-ledger.d.ts +31 -1
  123. package/dist/core/runner/announce-once-ledger.js +22 -0
  124. package/dist/core/runner/assemble-result.d.ts +9 -0
  125. package/dist/core/runner/assemble-result.js +3 -1
  126. package/dist/core/runner/call-hook-stations.d.ts +23 -27
  127. package/dist/core/runner/call-hook-stations.js +58 -42
  128. package/dist/core/runner/caller-stop-gate.d.ts +25 -0
  129. package/dist/core/runner/caller-stop-gate.js +7 -0
  130. package/dist/core/runner/compaction-seams.d.ts +8 -22
  131. package/dist/core/runner/compaction-seams.js +28 -53
  132. package/dist/core/runner/construction-doors.js +11 -1
  133. package/dist/core/runner/contracts.d.ts +85 -83
  134. package/dist/core/runner/credential-origin-seat.d.ts +2 -0
  135. package/dist/core/runner/credential-origin-seat.js +19 -0
  136. package/dist/core/runner/extra-body-dropped-seat.d.ts +2 -6
  137. package/dist/core/runner/gate-exit.d.ts +47 -36
  138. package/dist/core/runner/gate-exit.js +8 -2
  139. package/dist/core/runner/image.js +1 -2
  140. package/dist/core/runner/inline-image.js +1 -1
  141. package/dist/core/runner/notice-seat-input.d.ts +11 -0
  142. package/dist/core/runner/notice-seat-input.js +1 -0
  143. package/dist/core/runner/person-path-rows.js +1 -0
  144. package/dist/core/runner/prepare-acquire-reconcile.js +5 -1
  145. package/dist/core/runner/prepare-ask-lane.d.ts +5 -7
  146. package/dist/core/runner/prepare-ask-lane.js +6 -15
  147. package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -2
  148. package/dist/core/runner/prepare-caps-and-workflow.js +25 -8
  149. package/dist/core/runner/prepare-config-doors.d.ts +5 -0
  150. package/dist/core/runner/prepare-config-doors.js +9 -0
  151. package/dist/core/runner/prepare-defer-classify.js +3 -4
  152. package/dist/core/runner/prepare-gate-stations.d.ts +8 -11
  153. package/dist/core/runner/prepare-gate-stations.js +11 -10
  154. package/dist/core/runner/prepare-inherited-gate.d.ts +8 -12
  155. package/dist/core/runner/prepare-inherited-gate.js +8 -21
  156. package/dist/core/runner/prepare-memory-engine-session.js +1 -1
  157. package/dist/core/runner/prepare-park-ask.js +10 -14
  158. package/dist/core/runner/prepare-policy-chain.d.ts +18 -16
  159. package/dist/core/runner/prepare-policy-chain.js +98 -101
  160. package/dist/core/runner/prepare-project-context.js +7 -10
  161. package/dist/core/runner/prepare-prompt-assembly.d.ts +45 -40
  162. package/dist/core/runner/prepare-prompt-assembly.js +134 -101
  163. package/dist/core/runner/prepare-prompt-inputs.d.ts +18 -19
  164. package/dist/core/runner/prepare-prompt-inputs.js +5 -7
  165. package/dist/core/runner/prepare-protocol-tools.d.ts +6 -4
  166. package/dist/core/runner/prepare-protocol-tools.js +2 -2
  167. package/dist/core/runner/prepare-safety-scan.js +6 -10
  168. package/dist/core/runner/prepare-suspend-saga.d.ts +6 -0
  169. package/dist/core/runner/prepare-suspend-saga.js +7 -5
  170. package/dist/core/runner/prepare-task.js +33 -15
  171. package/dist/core/runner/prepare-turn-wiring.d.ts +13 -15
  172. package/dist/core/runner/prepare-turn-wiring.js +29 -27
  173. package/dist/core/runner/prepare-wiring-manifest.d.ts +5 -6
  174. package/dist/core/runner/prepare-wiring-manifest.js +7 -7
  175. package/dist/core/runner/resume-apply.d.ts +5 -2
  176. package/dist/core/runner/resume-apply.js +24 -42
  177. package/dist/core/runner/resume-checkpoint-screen.d.ts +1 -0
  178. package/dist/core/runner/resume-checkpoint-screen.js +9 -1
  179. package/dist/core/runner/resume-preflight.js +38 -16
  180. package/dist/core/runner/retired-runner-deps.js +3 -1
  181. package/dist/core/runner/run-brain-sinks.d.ts +3 -2
  182. package/dist/core/runner/run-brain-sinks.js +5 -1
  183. package/dist/core/runner/run-compaction-machinery.d.ts +7 -1
  184. package/dist/core/runner/run-compaction-machinery.js +7 -33
  185. package/dist/core/runner/run-harness-handlers.js +4 -2
  186. package/dist/core/runner/run-identity-wiring.d.ts +3 -1
  187. package/dist/core/runner/run-identity-wiring.js +3 -2
  188. package/dist/core/runner/run-leg.js +62 -84
  189. package/dist/core/runner/run-notification-lane.js +1 -0
  190. package/dist/core/runner/run-recovery-lanes.d.ts +3 -0
  191. package/dist/core/runner/run-recovery-lanes.js +11 -10
  192. package/dist/core/runner/run-settle-and-teardown.js +9 -28
  193. package/dist/core/runner/run-stop-and-final-verify.js +18 -25
  194. package/dist/core/runner/run-terminal-adoption.d.ts +3 -0
  195. package/dist/core/runner/run-terminal-adoption.js +33 -22
  196. package/dist/core/runner/run-tool-mount-facts.js +5 -3
  197. package/dist/core/runner/run-turn-boundary.js +23 -34
  198. package/dist/core/runner/runtask.d.ts +6 -7
  199. package/dist/core/runner/runtask.js +14 -72
  200. package/dist/core/runner/session-rule-policy.d.ts +6 -4
  201. package/dist/core/runner/session-rule-policy.js +17 -10
  202. package/dist/core/runner/side-call-account.d.ts +68 -0
  203. package/dist/core/runner/side-call-account.js +61 -0
  204. package/dist/core/runner/stream-halt-verbs.js +12 -17
  205. package/dist/core/runner/stream-lifecycle-verbs.js +8 -5
  206. package/dist/core/runner/stream-steer-verb.d.ts +1 -1
  207. package/dist/core/runner/stream-steer-verb.js +20 -38
  208. package/dist/core/runner/sub-agent-deny-lists.d.ts +121 -22
  209. package/dist/core/runner/sub-agent-deny-lists.js +228 -71
  210. package/dist/core/runner/tool-end-body.d.ts +5 -6
  211. package/dist/core/runner/tool-end-body.js +6 -4
  212. package/dist/core/runner/tool-not-executed.d.ts +15 -0
  213. package/dist/core/runner/tool-not-executed.js +30 -0
  214. package/dist/core/runner/tool-occurrence.d.ts +8 -7
  215. package/dist/core/runner/tool-occurrence.js +5 -5
  216. package/dist/core/runner/tool-result-media-seat.d.ts +1 -1
  217. package/dist/core/runner-deps.d.ts +20 -28
  218. package/dist/core/safety-merge-corpus.js +18 -2
  219. package/dist/core/secret-env.d.ts +93 -20
  220. package/dist/core/secret-env.js +192 -38
  221. package/dist/core/session-policy-store.d.ts +93 -17
  222. package/dist/core/session-policy-store.js +178 -25
  223. package/dist/core/session-reconcile.d.ts +4 -0
  224. package/dist/core/session-reconcile.js +2 -1
  225. package/dist/core/shell-read-silence.js +3 -32
  226. package/dist/core/side-query.d.ts +5 -3
  227. package/dist/core/skill-grant.d.ts +3 -2
  228. package/dist/core/skill-grant.js +17 -9
  229. package/dist/core/skills-directory.d.ts +31 -11
  230. package/dist/core/skills-directory.js +655 -104
  231. package/dist/core/task-event.d.ts +13 -3
  232. package/dist/core/task-result.d.ts +8 -0
  233. package/dist/core/task-spec.d.ts +20 -19
  234. package/dist/core/task-stream.d.ts +14 -4
  235. package/dist/core/tighten-task-spec.d.ts +4 -3
  236. package/dist/core/tighten-task-spec.js +2 -4
  237. package/dist/core/tool-check-reading.d.ts +74 -0
  238. package/dist/core/tool-check-reading.js +80 -0
  239. package/dist/core/tool-policy.d.ts +59 -18
  240. package/dist/core/tool-policy.js +77 -12
  241. package/dist/core/tool-registry.d.ts +20 -0
  242. package/dist/core/tool-registry.js +4 -0
  243. package/dist/core/tool-spec.d.ts +10 -6
  244. package/dist/core/tools.js +2 -0
  245. package/dist/core/trace.d.ts +51 -32
  246. package/dist/core/types.d.ts +2 -1
  247. package/dist/core/types.js +1 -0
  248. package/dist/core/unc-spelling.d.ts +10 -0
  249. package/dist/core/unc-spelling.js +3 -0
  250. package/dist/core/untrusted-egress.d.ts +8 -0
  251. package/dist/core/untrusted-egress.js +4 -1
  252. package/dist/core/user-attachment.d.ts +12 -2
  253. package/dist/core/user-attachment.js +17 -2
  254. package/dist/core/wiring-manifest.d.ts +14 -13
  255. package/dist/core/wiring-manifest.js +2 -2
  256. package/dist/engine/compaction/utils.js +1 -2
  257. package/dist/engine/execution-env/node-execution-env.d.ts +4 -3
  258. package/dist/engine/execution-env/symlink-chain.js +1 -1
  259. package/dist/engine/harness/agent-harness.d.ts +1 -1
  260. package/dist/engine/harness/agent-harness.js +3 -3
  261. package/dist/engine/harness/types.d.ts +17 -16
  262. package/dist/engine/harness/types.js +7 -1
  263. package/dist/engine/llm/types.d.ts +12 -7
  264. package/dist/engine/loop/agent-loop.js +1 -1
  265. package/dist/engine/loop/types.d.ts +1 -1
  266. package/dist/engine/lsp/node-lsp-manager.d.ts +2 -2
  267. package/dist/engine/session/import-validate.js +3 -10
  268. package/dist/engine/session/session.d.ts +4 -4
  269. package/dist/engine/session/session.js +4 -4
  270. package/dist/index.d.ts +24 -17
  271. package/dist/index.js +15 -12
  272. package/dist/internal/harness.d.ts +1 -1
  273. package/dist/internal/harness.js +1 -1
  274. package/dist/orchestration/run-spec.d.ts +4 -6
  275. package/dist/orchestration/run-spec.js +39 -63
  276. package/dist/orchestration/run-workflow-tool.js +1 -2
  277. package/dist/orchestration/workflow.d.ts +11 -3
  278. package/dist/orchestration/workflow.js +11 -2
  279. package/dist/prompt-assembly/artifact-store.d.ts +37 -56
  280. package/dist/prompt-assembly/artifact-store.js +31 -49
  281. package/dist/prompt-assembly/artifact.d.ts +89 -76
  282. package/dist/prompt-assembly/artifact.js +167 -146
  283. package/dist/prompt-assembly/assemble.d.ts +34 -29
  284. package/dist/prompt-assembly/assemble.js +33 -220
  285. package/dist/prompt-assembly/bands.d.ts +20 -0
  286. package/dist/prompt-assembly/bands.js +18 -0
  287. package/dist/prompt-assembly/catalog/constitution.d.ts +23 -0
  288. package/dist/prompt-assembly/catalog/constitution.js +69 -0
  289. package/dist/prompt-assembly/catalog/core-behavior.d.ts +9 -0
  290. package/dist/prompt-assembly/catalog/core-behavior.js +85 -0
  291. package/dist/prompt-assembly/catalog/index.d.ts +11 -0
  292. package/dist/prompt-assembly/catalog/index.js +59 -0
  293. package/dist/prompt-assembly/catalog/modes.d.ts +15 -0
  294. package/dist/prompt-assembly/catalog/modes.js +137 -0
  295. package/dist/prompt-assembly/catalog/role.d.ts +10 -0
  296. package/dist/prompt-assembly/catalog/role.js +157 -0
  297. package/dist/prompt-assembly/catalog/schema.d.ts +124 -0
  298. package/dist/prompt-assembly/catalog/schema.js +25 -0
  299. package/dist/prompt-assembly/catalog/sections.d.ts +9 -0
  300. package/dist/prompt-assembly/catalog/sections.js +98 -0
  301. package/dist/prompt-assembly/catalog/team.d.ts +4 -0
  302. package/dist/prompt-assembly/catalog/team.js +258 -0
  303. package/dist/prompt-assembly/composer.d.ts +24 -28
  304. package/dist/prompt-assembly/composer.js +124 -46
  305. package/dist/prompt-assembly/epoch.d.ts +89 -79
  306. package/dist/prompt-assembly/epoch.js +115 -142
  307. package/dist/prompt-assembly/explain.d.ts +58 -34
  308. package/dist/prompt-assembly/explain.js +21 -24
  309. package/dist/prompt-assembly/overlay.d.ts +127 -0
  310. package/dist/prompt-assembly/overlay.js +301 -0
  311. package/dist/prompt-assembly/renderers.d.ts +21 -0
  312. package/dist/prompt-assembly/renderers.js +39 -0
  313. package/dist/prompt-assembly/section-usage.d.ts +3 -3
  314. package/dist/prompt-assembly/section-usage.js +1 -1
  315. package/dist/prompt-assembly/select.d.ts +56 -0
  316. package/dist/prompt-assembly/select.js +69 -0
  317. package/dist/prompt-assembly/sugar.d.ts +31 -0
  318. package/dist/prompt-assembly/sugar.js +20 -0
  319. package/dist/prompt-assembly/turn-snapshot.d.ts +3 -2
  320. package/dist/prompt-assembly/types.d.ts +45 -148
  321. package/dist/prompts/coordinator.d.ts +2 -21
  322. package/dist/prompts/coordinator.js +3 -255
  323. package/dist/prompts/cowork.d.ts +27 -16
  324. package/dist/prompts/cowork.js +2 -23
  325. package/dist/prompts/default.d.ts +38 -500
  326. package/dist/prompts/default.js +20 -285
  327. package/dist/prompts/supervisor.d.ts +6 -71
  328. package/dist/prompts/supervisor.js +6 -117
  329. package/dist/stores/file/session-policy-store.d.ts +3 -3
  330. package/dist/tools/fs/bash-readonly-classifier.d.ts +6 -5
  331. package/dist/tools/fs/dir-entries.d.ts +4 -2
  332. package/dist/tools/fs/dir-entries.js +16 -4
  333. package/dist/tools/fs/fs-bash.d.ts +1 -1
  334. package/dist/tools/fs/fs-bash.js +22 -11
  335. package/dist/tools/fs/fs-pdf.js +17 -13
  336. package/dist/tools/fs/fs-read.js +4 -3
  337. package/dist/tools/fs/fs-shared.d.ts +1 -10
  338. package/dist/tools/fs/fs-shared.js +3 -4
  339. package/dist/tools/fs/fs-write.js +2 -1
  340. package/dist/tools/fs/notebook.js +1 -1
  341. package/dist/tools/fs/pdf.d.ts +20 -10
  342. package/dist/tools/fs/pdf.js +19 -10
  343. package/dist/tools/fs/program-read-model.d.ts +68 -8
  344. package/dist/tools/fs/program-read-model.js +112 -33
  345. package/dist/tools/fs/program-read-model.rows.js +30 -10
  346. package/dist/tools/fs/read-deny-home.d.ts +25 -9
  347. package/dist/tools/fs/read-deny-home.js +28 -27
  348. package/dist/tools/fs/read-deny.d.ts +41 -11
  349. package/dist/tools/fs/read-deny.js +51 -5
  350. package/dist/tools/fs/safety.d.ts +4 -26
  351. package/dist/tools/fs/safety.js +10 -32
  352. package/dist/tools/fs/search.js +15 -10
  353. package/dist/tools/fs/shell-read-argv.d.ts +3 -2
  354. package/dist/tools/fs/shell-read-argv.js +118 -38
  355. package/dist/tools/fs/shell-read-establish.d.ts +5 -5
  356. package/dist/tools/fs/shell-read-establish.js +11 -61
  357. package/dist/tools/fs/shell-read-identity.js +6 -3
  358. package/dist/tools/fs/shell-read-judge.d.ts +13 -15
  359. package/dist/tools/fs/shell-read-judge.js +18 -4
  360. package/dist/tools/fs/shell-read-plan.d.ts +2 -2
  361. package/dist/tools/web.js +1 -1
  362. package/package.json +13 -1
  363. package/test/export-surface.snapshot.json +256 -99
  364. package/wire-changes/core@7.51.1.json +5 -5
  365. package/wire-changes/core@7.51.2.json +293 -0
  366. package/wire-changes/core@7.52.0.json +5859 -0
  367. package/dist/core/hook-seats.d.ts +0 -66
  368. package/dist/core/hook-seats.js +0 -37
  369. package/dist/prompt-assembly/packs/sema-default.d.ts +0 -2
  370. package/dist/prompt-assembly/packs/sema-default.js +0 -147
  371. package/dist/prompts/simple-sections.d.ts +0 -58
  372. package/dist/prompts/simple-sections.js +0 -43
@@ -0,0 +1,350 @@
1
+ import type { ExecutionEnv } from "../../internal/harness-types.js";
2
+ import type { AssistantMessage, Message, Model, Usage } from "../../internal/llm.js";
3
+ import type { CwdRef } from "../../tools/fs/fs-shared.js";
4
+ import { type PermissionResult, type ToolCallRequest } from "../tool-policy.js";
5
+ import type { HookInvocationIdentity, PermissionDeniedPayload } from "../hooks.js";
6
+ import type { PermissionMode } from "../ask-origin.js";
7
+ import type { RunnerDeps } from "../runner-deps.js";
8
+ import type { TaskSpec } from "../task-spec.js";
9
+ import { type ModBus, type ModMountedHandler, type ModDispatchOutcome, type ModEventName, type ModEventPayload, type ModRegistration } from "./kernel/index.js";
10
+ import { type SourcedOverlay } from "../../prompt-assembly/overlay.js";
11
+ import type { BandId } from "../../prompt-assembly/catalog/schema.js";
12
+ import type { ModParticipant } from "./kernel/dispatch.js";
13
+ import { type EngineDollar, type ModelCompleteRequest, type ModelCompleteResult, type ModSeatView } from "./dollar.js";
14
+ /**
15
+ * What the engine's core answers at the bottom of every classic chain: the engine itself has nothing to add.
16
+ * Frozen and empty, so it reads as "no opinion" in every classic station's answer form, and a handler that
17
+ * builds on it (`{ ...(await next(e)), additionalContext }`) builds a well-formed answer.
18
+ */
19
+ export declare const ENGINE_CORE_ANSWER: Readonly<Record<string, never>>;
20
+ /** The classic chains' bottom. */
21
+ export declare function engineCore(): Readonly<Record<string, never>>;
22
+ /** The leg's bus seat, as the stations read it. */
23
+ export type LegModBus = Pick<ModBus, "hasHandlers" | "dispatch">;
24
+ /**
25
+ * The id a delegated leg's events carry as `agentId` (the leg's task id — the key its `task_progress` frames
26
+ * and its parent's fleet row use). A top-level leg carries none.
27
+ */
28
+ export declare function agentIdOf(identity: HookInvocationIdentity | undefined): string | undefined;
29
+ /**
30
+ * The stop event a leg raises when its run would otherwise end: `classic.SubagentStop` on a delegated child's leg — the
31
+ * delegation fact, which a child resumed from its checkpoint keeps — else `classic.Stop`. Not the leg kind: a resumed
32
+ * leg's kind reads `"resume"` whoever it runs as.
33
+ */
34
+ export declare function stopEventOf(identity: Pick<HookInvocationIdentity, "isDelegatedChild"> | undefined): "classic.Stop" | "classic.SubagentStop";
35
+ /**
36
+ * The args as an observation carries them: the kernel's detached copy (a structured clone, or a shallow copy for a
37
+ * graph the clone refuses), so an observer editing what it was handed cannot move the live args later frames and audit
38
+ * records share. A non-object value (immutable) is handed as is.
39
+ */
40
+ export declare function detachedArgsOf(args: unknown): unknown;
41
+ /**
42
+ * The args as a judging handler receives them: the gate pass's own immutable value ({@link ownArgs} — the value itself when
43
+ * the gate already took it, which is every call the gate raises an event over), so the bytes a handler judges are the bytes
44
+ * that run — an in-place edit throws instead of moving what executes, or what a handler further down judges (a rewrite is
45
+ * an answer's `updatedInput`). A graph the copy refuses is handed as is (the gate refuses such args at its entry).
46
+ */
47
+ export declare function judgedInputOf(args: unknown): unknown;
48
+ /** One link of a leg's chain as a constraint entry names it: a registration the leg's admission mounted, with the handlers it hung. */
49
+ export interface ModChainLink {
50
+ readonly registration: ModRegistration<EngineDollar>;
51
+ readonly handlers: readonly ModMountedHandler[];
52
+ }
53
+ /**
54
+ * A bus's chain identity: the registrations its admission MOUNTED (a refused one judges nothing there), in run order, each
55
+ * with the handlers it actually hung (pattern, matcher, observe, `.catch`, in hang order). Two legs that offered the same
56
+ * registrations but admitted — or hung — differently are different chains: an inherited entry collapses into a child's phase
57
+ * 1 only when the child mounted the very same. A handler's code is not compared (each leg's `register` builds its own
58
+ * closures); what it was hung on is. Every engine admission records it once ({@link chainOfBus}).
59
+ */
60
+ export declare function admittedChainOf(bus: Pick<ModBus, "records" | "mounted">, spec: Pick<TaskSpec, "mods">, deps: Pick<RunnerDeps, "mods">): readonly ModChainLink[];
61
+ /** The chain identity a bus's admission recorded, or `undefined` for a bus no engine admission mounted (its chain cannot be
62
+ * read, so it is the same chain as none). */
63
+ export declare function chainOfBus(bus: object): readonly ModChainLink[] | undefined;
64
+ /** Whether two chains are the same links: the same registration objects, in the same order, having hung the same handlers. */
65
+ export declare function sameModChain(a: readonly ModChainLink[], b: readonly ModChainLink[]): boolean;
66
+ /**
67
+ * Whether the leg's chain JUDGES a tool call: a judging handler on either event a call is judged on — `classic.PreToolUse`
68
+ * (the gate's phase 1) or `tool.check` (the gate's verdict read). Such a chain is what a leg hands its children as a
69
+ * screening constraint, and what a child's own gate stands in for when it mounted the same.
70
+ */
71
+ export declare function chainJudges(bus: LegModBus): boolean;
72
+ /** Record what the constraint mint minted `policy` over. */
73
+ export declare function recordScreeningChain(policy: object, chain: LegModBus): void;
74
+ /** The chain a screening constraint was minted over, or `undefined` when the mint did not make this object. */
75
+ export declare function screeningChainOf(policy: object): LegModBus | undefined;
76
+ /** How an inherited installation's question is settled: under the context its installation froze (its approver, its durable
77
+ * mandates, its classifier — the settlement its `classic.PreToolUse` ask takes in the fold), never at this leg's approver. An
78
+ * allow carrying `updatedInput` is a person's approval of an edit; an ask is one the settlement floated (the call is marked for
79
+ * the park). */
80
+ export type InstallationAskSettlement = (ask: Extract<PermissionResult, {
81
+ action: "ask";
82
+ }>, call: ToolCallRequest, signal: AbortSignal | undefined) => Promise<PermissionResult>;
83
+ /** An inherited installation as a leg's gate raises `tool.check` on it: the bus that mounted that chain, which of its handlers
84
+ * judge here, and how its question is settled. */
85
+ export interface InheritedToolCheck {
86
+ readonly bus: LegModBus;
87
+ readonly judges: (p: ModParticipant) => boolean;
88
+ readonly settle: InstallationAskSettlement;
89
+ }
90
+ /** An inherited chain entry as its installation identity reads it: the policy (whose mint names the bus, whose admission names
91
+ * the chain), the approver it froze, its two durable mandates, the environment it was installed against, its classifier. */
92
+ export interface InstallationEntry {
93
+ readonly policy: object;
94
+ readonly onAsk?: unknown;
95
+ readonly durableMandate?: boolean;
96
+ readonly contentMandate?: boolean;
97
+ readonly hookEnv?: unknown;
98
+ readonly autoMode?: {
99
+ readonly decider: unknown;
100
+ };
101
+ }
102
+ /** A leg's own installation context: its chain identity, its frozen approver, its two durable mandates, the environment its
103
+ * phase 1 runs in, its classifier instance. */
104
+ export interface LegInstallation {
105
+ readonly chain: readonly ModChainLink[];
106
+ readonly onAsk: unknown;
107
+ readonly durableMandate: boolean;
108
+ readonly contentMandate: boolean;
109
+ readonly hookEnv: unknown;
110
+ readonly decider: unknown;
111
+ }
112
+ /**
113
+ * Whether an inherited entry IS a leg's installation — the ONE installation identity. The chain is read off the entry's own
114
+ * bus (the one its policy was minted over, as that bus's admission recorded it), never off a list the entry carries: an entry
115
+ * whose policy the mint did not make, or whose bus no engine admission mounted, is no leg's installation. The rest is the
116
+ * context its questions are settled in: the same approver ({@link askApproverIdentity}), the same two durable mandates, the
117
+ * same environment, the same classifier instance. Readers: chain assembly (a leg already on the chain is not appended again)
118
+ * and {@link standsInFor} (the fold's pass-through and the `tool.check` raise).
119
+ */
120
+ export declare function sameInstallation(pc: InstallationEntry, leg: LegInstallation): boolean;
121
+ /**
122
+ * Whether a leg's own gate stands in for an inherited entry: the leg's chain judges, and the entry is the leg's installation
123
+ * settled with no durable mandate — its phase 1 then judges the call with the same chain, and its questions go to the same
124
+ * approver under no mandate, so the entry adds nothing on either judging event. The fold's pass-through for the entry's
125
+ * `classic.PreToolUse` and the skip of its `tool.check` raise are this one test (an entry it does not hold for is judged under
126
+ * its own context on both: a second judgment, never a lost one).
127
+ */
128
+ export declare function standsInFor(pc: InstallationEntry, leg: Omit<LegInstallation, "durableMandate" | "contentMandate">, legChainJudges: boolean): boolean;
129
+ /** An inherited screening installation as the carrier check reads it: the bus its policy was minted over (absent when the mint
130
+ * did not make the policy) and the chain the entry declares (its `mods`; absent when it declares none). The declaration is read
131
+ * for one thing — a guard the leg cannot raise ({@link unraisableGuardsOf}); identity is read off the bus ({@link sameInstallation}). */
132
+ export interface ScreeningInstallation {
133
+ readonly bus: LegModBus | undefined;
134
+ readonly chain: readonly ModChainLink[] | undefined;
135
+ }
136
+ /** The screening installations among a chain's entries, in the chain's order: every entry whose policy the mint made or that
137
+ * declares a chain. */
138
+ export declare function screeningInstallationsOf(entries: ReadonlyArray<{
139
+ readonly policy: object;
140
+ readonly mods?: readonly ModChainLink[];
141
+ }>): readonly ScreeningInstallation[];
142
+ /** Why an inherited chain cannot hold its guards, or `undefined`: an entry that names a judging `tool.check` handler beside a
143
+ * policy the mint did not make has no bus to raise that guard on. Read where the chain enters a leg — before a resume's claim
144
+ * and at the leg's prepare — so it is refused, never run without the guard. */
145
+ export declare function unraisableGuardsOf(installations: readonly ScreeningInstallation[]): string | undefined;
146
+ /**
147
+ * The inherited installations a leg's gate raises `tool.check` on after its own bus — the rule's one home. Every entry whose
148
+ * policy the mint made is one installation, raised whole in the chain's order (the order its `classic.PreToolUse` folds in),
149
+ * except one the leg's own gate stands in for (`standsIn` — the fold's pass-through test, {@link standsInFor}). Raised whole
150
+ * because a handler's answer depends on the chain it sits in (an outer handler may answer without calling `next`, or rule on
151
+ * what an inner one answered), so a registration the leg also mounts in a chain of its own judges again inside the ancestor's
152
+ * chain, as the PreToolUse constraint judges it (a second judgment, never a lost one). Each carries its entry's settlement of a
153
+ * question (`settleOf`): an installation's `ask` goes where its PreToolUse ask goes. Observe handlers never take part (a
154
+ * constraint carries no observer). An entry that cannot raise its guard is refused (`config.mods_invalid`, {@link unraisableGuardsOf}).
155
+ */
156
+ export declare function inheritedToolChecks<E extends InstallationEntry & {
157
+ readonly mods?: readonly ModChainLink[];
158
+ }>(entries: readonly E[], standsIn: (pc: E) => boolean, settleOf: (pc: E) => InstallationAskSettlement): readonly InheritedToolCheck[];
159
+ /** The members every classic `e` of a leg carries: the identity envelope, the delegated leg's `agentId`, the leg's observed mode. */
160
+ export declare function classicEventBase(identity: HookInvocationIdentity | undefined, permissionMode?: PermissionMode): ModEventPayload;
161
+ /**
162
+ * Raise an observation event (a skip-on-failure event whose answer no station reads): no handler, no dispatch.
163
+ * Its failures are the bus's to report; a rejected dispatch (an engine fault, never a handler's) is swallowed —
164
+ * an observation must never change what it observes.
165
+ */
166
+ export declare function observeClassic(bus: LegModBus, event: ModEventName, e: ModEventPayload, signal: AbortSignal | undefined): Promise<void>;
167
+ /**
168
+ * Raise a classic event whose answer the station reads: `undefined` when no handler hangs on it (the station
169
+ * runs as if the bus were not there), else the dispatch outcome. A rejection is an engine fault, never a
170
+ * handler's (handlers fail into the outcome); a decision station fails closed on it, an observation swallows it.
171
+ */
172
+ export declare function dispatchClassic(bus: LegModBus, event: ModEventName, e: ModEventPayload, options: {
173
+ readonly signal?: AbortSignal;
174
+ readonly checkAnswer?: (answer: unknown) => string | undefined;
175
+ }): Promise<ModDispatchOutcome | undefined>;
176
+ /** The answer form of a classic event whose answer is an object of optional string members (`block`, `additionalContext`, …). */
177
+ export declare function stringMembersAnswer(event: string, members: readonly string[]): (answer: unknown) => string | undefined;
178
+ /** The string members of an answer the station reads (a member of any other type reads as absent — the answer check has already refused it). */
179
+ export declare function stringMembersOf<M extends string>(answer: unknown, members: readonly M[]): {
180
+ [K in M]?: string;
181
+ };
182
+ /** The clause a fail-closed station puts in its sentence for the handler that failed it: `crashed (extension "x" threw boom)`. */
183
+ export declare function failedHandlerClause(f: Extract<ModDispatchOutcome, {
184
+ kind: "failed";
185
+ }>): string;
186
+ /**
187
+ * The PermissionDenied station: the leg's `classic.PermissionDenied` handlers, then a host's own raw observer (a host
188
+ * driving the tool gate itself) as one more observe handler of the same event on a bus of its own — so every observer
189
+ * of a deny runs under that station's columns (the handler's budget, skipped on a failure, a short grace past an
190
+ * abort) and none can hold the deny it reports. The raw observer's failure goes to `onHostObserverFailure`.
191
+ */
192
+ export declare function observePermissionDenied(input: {
193
+ readonly legBus: LegModBus | undefined;
194
+ readonly hostObserver: ((payload: PermissionDeniedPayload) => void | Promise<void>) | undefined;
195
+ readonly payload: PermissionDeniedPayload;
196
+ readonly signal: AbortSignal | undefined;
197
+ readonly onHostObserverFailure: (err: Error) => void;
198
+ }): Promise<void>;
199
+ /** What a `classic.UserPromptSubmit` screen came to, as the four entrances read it. */
200
+ export type PromptScreen = {
201
+ readonly kind: "answered";
202
+ readonly block?: string;
203
+ readonly additionalContext?: string;
204
+ } | Extract<ModDispatchOutcome, {
205
+ kind: "failed";
206
+ }> | {
207
+ readonly kind: "aborted";
208
+ };
209
+ /**
210
+ * Raise `classic.UserPromptSubmit` (undefined when no handler hangs on it). A decision event: a handler that throws,
211
+ * runs past its budget or breaks the site's contract ends the screen `failed`, and every entrance fails closed on it;
212
+ * a cancelled screen ends `aborted` at once. A dispatch the engine itself could not run is `failed` too.
213
+ */
214
+ export declare function screenUserPrompt(bus: LegModBus, e: ModEventPayload, signal: AbortSignal | undefined): Promise<PromptScreen | undefined>;
215
+ /** The three words a `tool.check` verdict speaks. */
216
+ export declare const TOOL_CHECK_DECISIONS: readonly ["allow", "ask", "deny"];
217
+ export type ToolCheckDecision = (typeof TOOL_CHECK_DECISIONS)[number];
218
+ /**
219
+ * The gate's standing verdict as the bottom of the `tool.check` chain answers it — what a handler reads from `next(e)`.
220
+ * Never `deny` (a standing refusal raises nothing). On an ask: its classes, and `mandated` — true when an `allow`
221
+ * answer cannot clear it at this point of the gate. `ceiling` mirrors `e.ceiling`. Read-only metadata: the gate reads
222
+ * the answer's `decision` and `reason` and nothing else of it.
223
+ */
224
+ export interface ToolCheckProjection {
225
+ readonly decision: "allow" | "ask";
226
+ readonly reason?: string;
227
+ readonly classes?: readonly string[];
228
+ readonly mandated?: boolean;
229
+ readonly ceiling?: "ask";
230
+ }
231
+ /** What one `tool.check` raise came to: the chain's verdict (`by` = the registration whose answer the chain returned;
232
+ * absent when no handler spoke and the gate's own verdict came back up), a handler's failure, or a cancel. */
233
+ export type ToolCheckOutcome = {
234
+ readonly kind: "answered";
235
+ readonly decision: ToolCheckDecision;
236
+ readonly reason?: string;
237
+ readonly by?: string;
238
+ } | Extract<ModDispatchOutcome, {
239
+ kind: "failed";
240
+ }> | {
241
+ readonly kind: "aborted";
242
+ };
243
+ /**
244
+ * Raise `tool.check` over the gate's standing verdict (undefined when no handler hangs on it — nothing is raised). A
245
+ * refusing event: a handler that throws, runs past its budget or answers out of the site's form ends the raise
246
+ * `failed`, a cancel ends it `aborted`, and the gate refuses the call on either. A dispatch the engine itself could not
247
+ * run is `failed` too. `judges` = which handlers take part (absent ⇒ every handler on the bus: the leg's own raise; an
248
+ * inherited installation's raise passes its {@link InheritedToolCheck.judges}).
249
+ */
250
+ export declare function raiseToolCheck(bus: LegModBus, e: ModEventPayload, projection: ToolCheckProjection, signal: AbortSignal | undefined, judges?: (p: ModParticipant) => boolean): Promise<ToolCheckOutcome | undefined>;
251
+ /** What a `prompt.compose` raise came to: each source class's overlays in application order, and the operator lines
252
+ * for every handler whose answer was skipped. */
253
+ export interface PromptComposeOutcome {
254
+ readonly deploy: readonly SourcedOverlay[];
255
+ readonly task: readonly SourcedOverlay[];
256
+ readonly warnings: readonly string[];
257
+ }
258
+ /**
259
+ * Raise `prompt.compose` — the collection point of the deploy and task source classes' overlays — over the leg's
260
+ * bus (nothing is raised when no handler hangs on it). A collecting event: a handler's contribution is what its
261
+ * answer adds after what its `next(e)` returned, and what `next(e)` returned must stand unchanged, in order, at the
262
+ * head of its answer — a handler that answers without its `next(e)` (or before it returned), rewrites or removes a
263
+ * lower contribution, or adds an overlay the band table does not grant its seat's class (or one that carries locked
264
+ * text, or one that is not data), is skipped, and what is below it stands (runs in its place, when it never called
265
+ * `next`). The engine records, at each handler's boundary, the overlays as it validated them and who contributed
266
+ * each (the registration and its seat: the deployment seat is the deploy class, the task seat the task class); what
267
+ * applies is that record, never the answer read again. Each class applies its contributions in chain order, so a
268
+ * later registration's overlay on the same target wins.
269
+ *
270
+ * `lowerAdds` — the entries the classes below deploy already added (the only entries a deploy `drop` may name
271
+ * besides a built-in section).
272
+ */
273
+ export declare function raisePromptCompose(bus: LegModBus, e: ModEventPayload, options: {
274
+ readonly lowerAdds: ReadonlyMap<string, BandId>;
275
+ readonly signal?: AbortSignal;
276
+ }): Promise<PromptComposeOutcome>;
277
+ /** The seats behind the engine facade, bound once the leg has them. Every member is read at its call. */
278
+ export interface LegFacadeSeats {
279
+ readonly exec: ModSeatView["env"]["exec"];
280
+ complete(request: ModelCompleteRequest, signal: AbortSignal): Promise<ModelCompleteResult>;
281
+ readonly sessionId: string;
282
+ /** The run's account of side model calls ({@link ModSeatView.book}). */
283
+ book: ModSeatView["book"];
284
+ cwd(): string;
285
+ root(): string;
286
+ model(): string;
287
+ messages(): readonly Message[];
288
+ now(): number;
289
+ tools(): readonly string[];
290
+ agents(): readonly string[];
291
+ }
292
+ /** The leg's admitted bus, its chain identity (the one its admission recorded, {@link chainOfBus}) and the binding of the
293
+ * facade its `$` reaches. */
294
+ export interface LegMods {
295
+ readonly bus: ModBus;
296
+ readonly chain: readonly ModChainLink[];
297
+ /** Bind the engine facade once the leg is prepared. Until then a `$` call throws, naming the method. */
298
+ bindFacade(seats: LegFacadeSeats): void;
299
+ }
300
+ /**
301
+ * Admit the leg's bus: both seats (`RunnerDeps.mods`, `TaskSpec.mods`), screened and put to `plugin.register`.
302
+ * Called once per leg, at that leg's own prepare (a delegated child and a resumed leg each admit their own);
303
+ * each refused registration becomes one `mods.registration_refused` notice. Throws `config.mods_invalid` for a
304
+ * registration the kernel cannot take.
305
+ */
306
+ export declare function admitLegMods(input: {
307
+ readonly spec: Pick<TaskSpec, "mods">;
308
+ readonly deps: Pick<RunnerDeps, "mods" | "onError" | "onNotice">;
309
+ readonly sessionId: string;
310
+ }): Promise<LegMods>;
311
+ /** What a leg hands {@link legFacadeSeats}: the seats it already has. */
312
+ export interface LegFacadeInput {
313
+ readonly deps: Pick<RunnerDeps, "brain" | "models" | "now">;
314
+ readonly spec: Pick<TaskSpec, "getApiKeyAndHeaders">;
315
+ readonly sessionId: string;
316
+ readonly model: Model;
317
+ readonly executionEnv: Pick<ExecutionEnv, "exec">;
318
+ readonly taskRoot: string;
319
+ readonly cwdRef: CwdRef | undefined;
320
+ /** The leg's latest model request as recorded at the provider seam (the session's messages as the model last saw them). */
321
+ readonly lastBrainContext: () => {
322
+ readonly messages: readonly Message[];
323
+ } | undefined;
324
+ readonly activeTools: ReadonlySet<string>;
325
+ readonly agentListing: {
326
+ readonly entries: ReadonlyArray<{
327
+ readonly name: string;
328
+ }>;
329
+ } | undefined;
330
+ /** The run's one account of side model calls (the same entry the classifier's side calls book on), handed the model a
331
+ * `$.model.complete` call resolved to, the usage its reply reported (absent ⇒ none reported) and the reply's
332
+ * diagnostics when it carried any (a degraded brain's fallback is priced by them). */
333
+ readonly book: (model: Model, reply: {
334
+ readonly usage: Usage | undefined;
335
+ readonly diagnostics?: AssistantMessage["diagnostics"];
336
+ }) => void;
337
+ }
338
+ /** The engine facade's seats over a prepared leg — each one a seat the leg already has (no new capability). */
339
+ export declare function legFacadeSeats(input: LegFacadeInput): LegFacadeSeats;
340
+ /**
341
+ * A chain admitted outside any leg — what a host rebuilds to re-supply an inherited screening entry on a fresh Runner
342
+ * (a cross-process resume hands back `createPreToolUseConstraintPolicy(chain, env)` over the same registrations). The
343
+ * same admission a leg runs (both seats, `plugin.register`); no leg exists, so its `$` facade is never bound and a `$`
344
+ * call throws. Handler failures go to `onError` (absent ⇒ unreported). Its chain identity is recorded as a leg's is
345
+ * ({@link chainOfBus}), so an entry minted over it is read by what it mounted — whatever list the entry carries.
346
+ */
347
+ export declare function admitModChain(seats: {
348
+ readonly deployment?: readonly ModRegistration<EngineDollar>[];
349
+ readonly task?: readonly ModRegistration<EngineDollar>[];
350
+ }, onError?: (err: Error) => void): Promise<ModBus>;