@sema-agent/core 7.54.1 → 7.56.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (621) hide show
  1. package/CHANGELOG.md +950 -0
  2. package/dist/agents/agent-transcript-tool.js +2 -1
  3. package/dist/agents/builtin-agents.d.ts +12 -14
  4. package/dist/agents/cascade.js +1 -1
  5. package/dist/agents/cc-peer-directory.d.ts +36 -0
  6. package/dist/agents/cc-peer-directory.js +139 -0
  7. package/dist/agents/cc-peer-wire.d.ts +105 -0
  8. package/dist/agents/cc-peer-wire.js +98 -0
  9. package/dist/agents/cc-uds-peer-channel.d.ts +40 -0
  10. package/dist/agents/cc-uds-peer-channel.js +457 -0
  11. package/dist/agents/child-model-seat.d.ts +0 -11
  12. package/dist/agents/child-model-seat.js +0 -3
  13. package/dist/agents/cross-session-envelope.d.ts +4 -1
  14. package/dist/agents/cross-session-envelope.js +8 -1
  15. package/dist/agents/cross-session-judge.d.ts +2 -2
  16. package/dist/agents/list-agents-tool.d.ts +3 -1
  17. package/dist/agents/list-agents-tool.js +9 -8
  18. package/dist/agents/observer.d.ts +4 -5
  19. package/dist/agents/observer.js +2 -1
  20. package/dist/agents/peer-admission.d.ts +6 -0
  21. package/dist/agents/peer-admission.js +4 -1
  22. package/dist/agents/peer-directory.d.ts +65 -13
  23. package/dist/agents/peer-directory.js +90 -25
  24. package/dist/agents/peer-notices.d.ts +1 -1
  25. package/dist/agents/peer-session-drain.d.ts +3 -1
  26. package/dist/agents/peer-session-drain.js +3 -2
  27. package/dist/agents/read-inbox-tool.js +2 -1
  28. package/dist/agents/repair-loop.js +2 -2
  29. package/dist/agents/retain-ledger.d.ts +1 -1
  30. package/dist/agents/roster-store.d.ts +1 -1
  31. package/dist/agents/send-message-tool.d.ts +10 -0
  32. package/dist/agents/send-message-tool.js +37 -8
  33. package/dist/agents/subagent.d.ts +39 -82
  34. package/dist/agents/subagent.js +109 -106
  35. package/dist/agents/tool-filter.d.ts +31 -46
  36. package/dist/agents/tool-filter.js +13 -33
  37. package/dist/agents/verify.d.ts +6 -5
  38. package/dist/agents/verify.js +3 -3
  39. package/dist/brain/anthropic.js +43 -81
  40. package/dist/brain/errors.d.ts +15 -0
  41. package/dist/brain/errors.js +10 -0
  42. package/dist/brain/media-degrade.d.ts +18 -7
  43. package/dist/brain/media-degrade.js +13 -2
  44. package/dist/brain/model-capability.d.ts +37 -0
  45. package/dist/brain/model-capability.js +34 -0
  46. package/dist/brain/model-presets.d.ts +6 -12
  47. package/dist/brain/model-presets.js +1 -6
  48. package/dist/brain/open-responses.js +27 -35
  49. package/dist/brain/openai.js +30 -98
  50. package/dist/brain/provider-dialect.d.ts +39 -3
  51. package/dist/brain/provider-dialect.js +28 -0
  52. package/dist/brain/reasoning-request.d.ts +96 -0
  53. package/dist/brain/reasoning-request.js +174 -0
  54. package/dist/brain/reasoning.d.ts +12 -12
  55. package/dist/brain/reasoning.js +4 -3
  56. package/dist/brain/request-params.d.ts +62 -9
  57. package/dist/brain/request-params.js +42 -7
  58. package/dist/brain/retry.d.ts +1 -1
  59. package/dist/brain/route-adjudicator.d.ts +15 -0
  60. package/dist/brain/route-adjudicator.js +15 -0
  61. package/dist/brain/status-sink.d.ts +20 -0
  62. package/dist/brain/status-sink.js +7 -0
  63. package/dist/brain/stream-engine.js +6 -5
  64. package/dist/brain/stream-shared.d.ts +1 -1
  65. package/dist/core/a2a.d.ts +2 -1
  66. package/dist/core/a2a.js +19 -13
  67. package/dist/core/advisor-verdict.d.ts +120 -0
  68. package/dist/core/advisor-verdict.js +92 -0
  69. package/dist/core/agent-definition.d.ts +17 -8
  70. package/dist/core/allow-entry.d.ts +69 -36
  71. package/dist/core/allow-entry.js +81 -52
  72. package/dist/core/allow-rule-shadow.d.ts +10 -3
  73. package/dist/core/approval-object.d.ts +2 -1
  74. package/dist/core/approval-object.js +6 -6
  75. package/dist/core/ask-origin.d.ts +127 -29
  76. package/dist/core/ask-origin.js +87 -25
  77. package/dist/core/ask-question.d.ts +51 -8
  78. package/dist/core/ask-question.js +12 -7
  79. package/dist/core/ask-unresolvable-notice.d.ts +8 -3
  80. package/dist/core/ask-unresolvable-notice.js +16 -2
  81. package/dist/core/auto-compaction.d.ts +11 -8
  82. package/dist/core/auto-compaction.js +4 -2
  83. package/dist/core/auto-mode-arming.d.ts +2 -2
  84. package/dist/core/auto-mode-defaults.d.ts +8 -8
  85. package/dist/core/auto-mode-prompt-assets.d.ts +3 -3
  86. package/dist/core/auto-mode-prompt.d.ts +1 -1
  87. package/dist/core/auto-mode.d.ts +17 -9
  88. package/dist/core/auto-mode.js +9 -6
  89. package/dist/core/background-agent-store.d.ts +3 -3
  90. package/dist/core/canonical-json.d.ts +1 -1
  91. package/dist/core/canonical-json.js +2 -2
  92. package/dist/core/checkpoint-generation.d.ts +53 -0
  93. package/dist/core/checkpoint-generation.js +35 -0
  94. package/dist/core/checkpoint-queries.d.ts +180 -0
  95. package/dist/core/checkpoint-queries.js +272 -0
  96. package/dist/core/checkpoint-requirements.d.ts +19 -4
  97. package/dist/core/checkpoint-requirements.js +8 -14
  98. package/dist/core/checkpoint-store.d.ts +165 -72
  99. package/dist/core/checkpoint-store.js +79 -82
  100. package/dist/core/child-clamp-seats.d.ts +6 -0
  101. package/dist/core/child-clamp-seats.js +3 -16
  102. package/dist/core/compliance.d.ts +2 -2
  103. package/dist/core/context-edit.d.ts +6 -7
  104. package/dist/core/cross-boundary-taint.d.ts +11 -4
  105. package/dist/core/cross-boundary-taint.js +3 -3
  106. package/dist/core/decision-receipt.d.ts +37 -3
  107. package/dist/core/decision-receipt.js +19 -19
  108. package/dist/core/delegation-not-started.d.ts +6 -0
  109. package/dist/core/delegation-not-started.js +17 -0
  110. package/dist/core/effective-path-target.d.ts +1 -1
  111. package/dist/core/engine-attestation.d.ts +93 -0
  112. package/dist/core/engine-attestation.js +70 -0
  113. package/dist/core/engine-capabilities.d.ts +4 -1
  114. package/dist/core/engine-capabilities.js +1 -1
  115. package/dist/core/engine-notice.d.ts +45 -12
  116. package/dist/core/exec-output-tail.d.ts +1 -1
  117. package/dist/core/file-history-retention.d.ts +1 -1
  118. package/dist/core/file-history-store.d.ts +147 -21
  119. package/dist/core/file-history-store.js +58 -32
  120. package/dist/core/gate-fold.d.ts +1 -1
  121. package/dist/core/gate-fold.js +24 -11
  122. package/dist/core/gate-lanes.js +81 -68
  123. package/dist/core/gate-outcome.d.ts +40 -6
  124. package/dist/core/gate-outcome.js +56 -0
  125. package/dist/core/governance-codes.d.ts +17 -3
  126. package/dist/core/governance-codes.js +16 -0
  127. package/dist/core/hands-band.d.ts +1 -1
  128. package/dist/core/hooks.d.ts +21 -20
  129. package/dist/core/hooks.js +3 -1
  130. package/dist/core/host-floor.d.ts +128 -0
  131. package/dist/core/host-floor.js +206 -0
  132. package/dist/core/host-target.d.ts +84 -0
  133. package/dist/core/host-target.js +92 -0
  134. package/dist/core/image-downsample.d.ts +1 -1
  135. package/dist/core/lsp-diagnostics.d.ts +4 -4
  136. package/dist/core/lsp.d.ts +3 -3
  137. package/dist/core/mailbox-store.d.ts +4 -0
  138. package/dist/core/mcp-connection-pool.d.ts +18 -2
  139. package/dist/core/mcp-connection-pool.js +53 -6
  140. package/dist/core/mcp-failure.d.ts +23 -4
  141. package/dist/core/mcp-failure.js +26 -11
  142. package/dist/core/mcp-listing-drift.d.ts +10 -0
  143. package/dist/core/mcp-listing-drift.js +6 -0
  144. package/dist/core/mcp-server-link.d.ts +173 -0
  145. package/dist/core/mcp-server-link.js +127 -0
  146. package/dist/core/mcp-server-spec.d.ts +4 -2
  147. package/dist/core/mcp-session-end.d.ts +26 -0
  148. package/dist/core/mcp-session-end.js +29 -0
  149. package/dist/core/mcp-startup-request.d.ts +17 -0
  150. package/dist/core/mcp-startup-request.js +17 -0
  151. package/dist/core/mcp.d.ts +17 -13
  152. package/dist/core/mcp.js +240 -189
  153. package/dist/core/media-byte-cap.d.ts +1 -1
  154. package/dist/core/memory-engine/delegation-settlement.js +15 -24
  155. package/dist/core/memory-engine/engine.d.ts +9 -9
  156. package/dist/core/memory-engine/engine.js +4 -4
  157. package/dist/core/memory-engine/layout.d.ts +60 -8
  158. package/dist/core/memory-engine/layout.js +65 -6
  159. package/dist/core/memory-engine/provenance-wording.d.ts +1 -1
  160. package/dist/core/memory-engine/tools.js +4 -1
  161. package/dist/core/mode-policy.d.ts +1 -1
  162. package/dist/core/model-seat.d.ts +10 -3
  163. package/dist/core/mods/classic-events.d.ts +67 -0
  164. package/dist/core/mods/classic-events.js +1 -0
  165. package/dist/core/mods/dollar.d.ts +13 -0
  166. package/dist/core/mods/extension-call.d.ts +31 -0
  167. package/dist/core/mods/extension-call.js +43 -0
  168. package/dist/core/mods/kernel/dispatch.d.ts +20 -3
  169. package/dist/core/mods/kernel/dispatch.js +140 -69
  170. package/dist/core/mods/kernel/events.d.ts +47 -11
  171. package/dist/core/mods/kernel/events.js +66 -42
  172. package/dist/core/mods/kernel/index.d.ts +4 -4
  173. package/dist/core/mods/kernel/index.js +2 -2
  174. package/dist/core/mods/kernel/receive.d.ts +39 -5
  175. package/dist/core/mods/kernel/receive.js +290 -17
  176. package/dist/core/mods/kernel/registration.d.ts +33 -2
  177. package/dist/core/mods/kernel/registration.js +6 -7
  178. package/dist/core/mods/kernel/site-rules.d.ts +44 -16
  179. package/dist/core/mods/kernel/site-rules.js +24 -42
  180. package/dist/core/mods/spec-seats.d.ts +69 -0
  181. package/dist/core/mods/spec-seats.js +114 -0
  182. package/dist/core/mods/stations.d.ts +28 -8
  183. package/dist/core/mods/stations.js +29 -13
  184. package/dist/core/mods/tool-call.d.ts +79 -0
  185. package/dist/core/mods/tool-call.js +152 -0
  186. package/dist/core/namespaced-rule-name.d.ts +44 -24
  187. package/dist/core/namespaced-rule-name.js +50 -43
  188. package/dist/core/output-style.d.ts +1 -1
  189. package/dist/core/param-rule-reach.d.ts +15 -0
  190. package/dist/core/param-rule-reach.js +30 -0
  191. package/dist/core/parent-spec-seat.d.ts +13 -1
  192. package/dist/core/parent-spec-seat.js +6 -0
  193. package/dist/core/park-selfcheck.js +1 -0
  194. package/dist/core/pause-registry.d.ts +16 -5
  195. package/dist/core/pause-registry.js +6 -2
  196. package/dist/core/peer-channel.d.ts +70 -0
  197. package/dist/core/peer-channel.js +1 -0
  198. package/dist/core/permission-rule-consent.d.ts +30 -5
  199. package/dist/core/permission-rule-consent.js +147 -50
  200. package/dist/core/permission-rule-model.d.ts +245 -65
  201. package/dist/core/permission-rule-model.js +421 -107
  202. package/dist/core/permission-rule-org.d.ts +6 -2
  203. package/dist/core/permission-rule-org.js +7 -3
  204. package/dist/core/permission-rule-provider.d.ts +6 -2
  205. package/dist/core/permission-rule-provider.js +41 -11
  206. package/dist/core/permission-rule-store.d.ts +22 -26
  207. package/dist/core/permission-rule-store.js +12 -6
  208. package/dist/core/permission-rule-sync.d.ts +11 -2
  209. package/dist/core/permission-rule-sync.js +11 -3
  210. package/dist/core/permission-rule-syntax.d.ts +5 -4
  211. package/dist/core/permission-rule-syntax.js +2 -2
  212. package/dist/core/permission-rules.d.ts +53 -15
  213. package/dist/core/permission-rules.js +125 -100
  214. package/dist/core/persisted-rule-arms.d.ts +6 -4
  215. package/dist/core/persisted-rule-arms.js +10 -12
  216. package/dist/core/present-plan-tool.js +3 -1
  217. package/dist/core/principal-name.d.ts +20 -0
  218. package/dist/core/principal-name.js +22 -0
  219. package/dist/core/prompt-section-seat.js +4 -6
  220. package/dist/core/protocol-http-auth.d.ts +26 -5
  221. package/dist/core/protocol-http-auth.js +137 -4
  222. package/dist/core/protocol-naming.d.ts +2 -2
  223. package/dist/core/read-only-shell-table.d.ts +1 -1
  224. package/dist/core/read-only-shell.d.ts +1 -1
  225. package/dist/core/retired-keys.d.ts +16 -0
  226. package/dist/core/retired-keys.js +16 -4
  227. package/dist/core/rewrite-rejudge.d.ts +60 -0
  228. package/dist/core/rewrite-rejudge.js +36 -0
  229. package/dist/core/roles.d.ts +34 -3
  230. package/dist/core/roles.js +66 -53
  231. package/dist/core/rule-lane-reads.d.ts +20 -15
  232. package/dist/core/rule-lane-reads.js +45 -17
  233. package/dist/core/rule-offer-read.d.ts +53 -0
  234. package/dist/core/rule-offer-read.js +146 -0
  235. package/dist/core/rule-owner.d.ts +46 -0
  236. package/dist/core/rule-owner.js +29 -0
  237. package/dist/core/runner/advisor-instructions.d.ts +70 -0
  238. package/dist/core/runner/advisor-instructions.js +61 -0
  239. package/dist/core/runner/advisor-tool.d.ts +33 -0
  240. package/dist/core/runner/advisor-tool.js +112 -0
  241. package/dist/core/runner/announce-once-ledger.d.ts +18 -26
  242. package/dist/core/runner/announce-once-ledger.js +19 -46
  243. package/dist/core/runner/approval-feedback.js +6 -3
  244. package/dist/core/runner/assemble-result.d.ts +2 -1
  245. package/dist/core/runner/assemble-result.js +1 -1
  246. package/dist/core/runner/call-hook-stations.d.ts +3 -2
  247. package/dist/core/runner/caller-roster.d.ts +21 -2
  248. package/dist/core/runner/caller-roster.js +38 -0
  249. package/dist/core/runner/capability-withheld-seat.d.ts +5 -0
  250. package/dist/core/runner/capability-withheld-seat.js +24 -0
  251. package/dist/core/runner/classifier-ladder.d.ts +33 -13
  252. package/dist/core/runner/classifier-ladder.js +15 -14
  253. package/dist/core/runner/compaction-restate.d.ts +10 -6
  254. package/dist/core/runner/compaction-restate.js +9 -3
  255. package/dist/core/runner/construction-doors.js +3 -0
  256. package/dist/core/runner/contracts.d.ts +40 -33
  257. package/dist/core/runner/conversation-segment.d.ts +28 -0
  258. package/dist/core/runner/conversation-segment.js +42 -0
  259. package/dist/core/runner/cross-boundary-lane.d.ts +21 -16
  260. package/dist/core/runner/cross-boundary-lane.js +58 -34
  261. package/dist/core/runner/decide-continuation.d.ts +7 -4
  262. package/dist/core/runner/decide-continuation.js +2 -2
  263. package/dist/core/runner/denial-limit-arms.d.ts +4 -4
  264. package/dist/core/runner/denial-limit-arms.js +1 -1
  265. package/dist/core/runner/derived-route-fallback.d.ts +24 -24
  266. package/dist/core/runner/derived-route-fallback.js +9 -7
  267. package/dist/core/runner/file-history-request.d.ts +18 -0
  268. package/dist/core/runner/file-history-request.js +21 -13
  269. package/dist/core/runner/file-history-restore.d.ts +45 -0
  270. package/dist/core/runner/file-history-restore.js +46 -0
  271. package/dist/core/runner/gate-exit.d.ts +9 -3
  272. package/dist/core/runner/gate-exit.js +11 -5
  273. package/dist/core/runner/image.d.ts +7 -17
  274. package/dist/core/runner/image.js +9 -60
  275. package/dist/core/runner/initial-run-state.js +1 -1
  276. package/dist/core/runner/permission-rule-lanes.d.ts +6 -6
  277. package/dist/core/runner/permission-rule-lanes.js +38 -15
  278. package/dist/core/runner/person-path-rows.d.ts +12 -9
  279. package/dist/core/runner/person-path-rows.js +19 -8
  280. package/dist/core/runner/prepare-advisor.d.ts +63 -0
  281. package/dist/core/runner/prepare-advisor.js +77 -0
  282. package/dist/core/runner/prepare-ask-lane.d.ts +2 -2
  283. package/dist/core/runner/prepare-ask-lane.js +5 -2
  284. package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -6
  285. package/dist/core/runner/prepare-caps-and-workflow.js +5 -4
  286. package/dist/core/runner/prepare-config-doors.d.ts +31 -38
  287. package/dist/core/runner/prepare-config-doors.js +57 -34
  288. package/dist/core/runner/prepare-defer-classify.d.ts +4 -3
  289. package/dist/core/runner/prepare-defer-classify.js +7 -8
  290. package/dist/core/runner/prepare-delegation-surface.d.ts +2 -2
  291. package/dist/core/runner/prepare-delegation-surface.js +1 -1
  292. package/dist/core/runner/prepare-file-history.d.ts +48 -8
  293. package/dist/core/runner/prepare-file-history.js +41 -73
  294. package/dist/core/runner/prepare-gate-stations.d.ts +2 -5
  295. package/dist/core/runner/prepare-gate-stations.js +12 -8
  296. package/dist/core/runner/prepare-hands-readface.d.ts +2 -8
  297. package/dist/core/runner/prepare-hands-readface.js +15 -14
  298. package/dist/core/runner/prepare-inherited-gate.d.ts +11 -7
  299. package/dist/core/runner/prepare-inherited-gate.js +8 -6
  300. package/dist/core/runner/prepare-memory-engine-session.js +1 -1
  301. package/dist/core/runner/prepare-park-ask.js +12 -12
  302. package/dist/core/runner/prepare-policy-chain.d.ts +7 -4
  303. package/dist/core/runner/prepare-policy-chain.js +68 -81
  304. package/dist/core/runner/prepare-project-context.d.ts +5 -2
  305. package/dist/core/runner/prepare-project-context.js +6 -3
  306. package/dist/core/runner/prepare-prompt-assembly.d.ts +5 -7
  307. package/dist/core/runner/prepare-prompt-assembly.js +10 -8
  308. package/dist/core/runner/prepare-prompt-inputs.d.ts +11 -9
  309. package/dist/core/runner/prepare-prompt-inputs.js +4 -6
  310. package/dist/core/runner/prepare-protocol-tools.d.ts +4 -2
  311. package/dist/core/runner/prepare-protocol-tools.js +5 -4
  312. package/dist/core/runner/prepare-safety-scan.d.ts +9 -12
  313. package/dist/core/runner/prepare-safety-scan.js +8 -23
  314. package/dist/core/runner/prepare-suspend-saga.d.ts +2 -0
  315. package/dist/core/runner/prepare-suspend-saga.js +5 -6
  316. package/dist/core/runner/prepare-task.d.ts +1 -1
  317. package/dist/core/runner/prepare-task.js +41 -35
  318. package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +7 -4
  319. package/dist/core/runner/prepare-tool-disclosure-mount.js +24 -18
  320. package/dist/core/runner/prepare-turn-wiring.d.ts +0 -4
  321. package/dist/core/runner/prepare-turn-wiring.js +2 -7
  322. package/dist/core/runner/prepare-wiring-manifest.d.ts +11 -4
  323. package/dist/core/runner/prepare-wiring-manifest.js +3 -3
  324. package/dist/core/runner/resume-admission.js +1 -1
  325. package/dist/core/runner/resume-apply.js +11 -12
  326. package/dist/core/runner/resume-checkpoint-screen.js +3 -0
  327. package/dist/core/runner/resume-claim.d.ts +4 -2
  328. package/dist/core/runner/resume-claim.js +15 -8
  329. package/dist/core/runner/resume-policy-outcome.js +1 -1
  330. package/dist/core/runner/retired-runner-deps.js +2 -1
  331. package/dist/core/runner/rewind-files.d.ts +15 -0
  332. package/dist/core/runner/rewind-files.js +132 -0
  333. package/dist/core/runner/run-attachment-seats.js +2 -2
  334. package/dist/core/runner/run-brain-sinks.d.ts +4 -1
  335. package/dist/core/runner/run-brain-sinks.js +4 -2
  336. package/dist/core/runner/run-compaction-machinery.d.ts +1 -1
  337. package/dist/core/runner/run-compaction-machinery.js +2 -12
  338. package/dist/core/runner/run-git-lane.d.ts +1 -0
  339. package/dist/core/runner/run-harness-handlers.js +14 -7
  340. package/dist/core/runner/run-leg.d.ts +1 -1
  341. package/dist/core/runner/run-leg.js +43 -18
  342. package/dist/core/runner/run-settle-and-teardown.js +3 -2
  343. package/dist/core/runner/run-telemetry-and-budget-seats.js +1 -1
  344. package/dist/core/runner/run-turn-boundary.d.ts +1 -0
  345. package/dist/core/runner/run-turn-boundary.js +15 -22
  346. package/dist/core/runner/runtask.d.ts +3 -0
  347. package/dist/core/runner/runtask.js +8 -9
  348. package/dist/core/runner/session-read-file-states.d.ts +15 -0
  349. package/dist/core/runner/session-read-file-states.js +28 -0
  350. package/dist/core/runner/session-rule-policy.d.ts +22 -21
  351. package/dist/core/runner/session-rule-policy.js +17 -31
  352. package/dist/core/runner/shell-env-withheld.d.ts +33 -0
  353. package/dist/core/runner/shell-env-withheld.js +51 -0
  354. package/dist/core/runner/side-call-account.d.ts +32 -8
  355. package/dist/core/runner/side-call-account.js +23 -1
  356. package/dist/core/runner/skills-seat.js +6 -2
  357. package/dist/core/runner/stream-settle-backstop.js +1 -1
  358. package/dist/core/runner/strict-output-schema.d.ts +1 -1
  359. package/dist/core/runner/sub-agent-deny-lists.js +4 -6
  360. package/dist/core/runner/synthetic-tools.d.ts +16 -13
  361. package/dist/core/runner/synthetic-tools.js +8 -3
  362. package/dist/core/runner/tool-disclosure.d.ts +10 -12
  363. package/dist/core/runner/tool-disclosure.js +3 -4
  364. package/dist/core/runner/tool-end-body.d.ts +1 -1
  365. package/dist/core/runner/tool-end-body.js +10 -9
  366. package/dist/core/runner/tool-face-overlay.d.ts +2 -1
  367. package/dist/core/runner/tool-face-overlay.js +17 -1
  368. package/dist/core/runner/tool-not-executed.d.ts +5 -0
  369. package/dist/core/runner/tool-not-executed.js +11 -0
  370. package/dist/core/runner/tool-occurrence.d.ts +8 -0
  371. package/dist/core/runner/tool-occurrence.js +7 -0
  372. package/dist/core/runner/tool-progress-lane.d.ts +2 -2
  373. package/dist/core/runner/tool-turn-repair-seat.d.ts +3 -2
  374. package/dist/core/runner/turn-attachments.d.ts +91 -80
  375. package/dist/core/runner/turn-attachments.js +62 -37
  376. package/dist/core/runner-deps.d.ts +42 -42
  377. package/dist/core/runtime-caps.d.ts +4 -4
  378. package/dist/core/safety-axis-vocab.d.ts +6 -4
  379. package/dist/core/safety-axis-vocab.js +6 -5
  380. package/dist/core/safety-merge-corpus.js +26 -2
  381. package/dist/core/same-plain-value.d.ts +40 -0
  382. package/dist/core/same-plain-value.js +49 -0
  383. package/dist/core/scheduler.d.ts +1 -1
  384. package/dist/core/secret-env.d.ts +26 -3
  385. package/dist/core/secret-env.js +44 -8
  386. package/dist/core/select-model.js +3 -3
  387. package/dist/core/sensitive-path-policy.d.ts +1 -1
  388. package/dist/core/sensitive-path-policy.js +1 -1
  389. package/dist/core/session-policy-store.d.ts +102 -35
  390. package/dist/core/session-policy-store.js +210 -48
  391. package/dist/core/session-reconcile.d.ts +2 -2
  392. package/dist/core/session-store.d.ts +106 -37
  393. package/dist/core/session-store.js +165 -91
  394. package/dist/core/session.d.ts +101 -57
  395. package/dist/core/session.js +53 -0
  396. package/dist/core/shared-memory/tools.js +3 -1
  397. package/dist/core/shared-memory/types.d.ts +1 -1
  398. package/dist/core/shell-read-silence.d.ts +11 -12
  399. package/dist/core/shell-read-silence.js +9 -5
  400. package/dist/core/shell-run-candidates.js +3 -1
  401. package/dist/core/shell-wrapper-projection.js +1 -1
  402. package/dist/core/shell-wrapper-table.d.ts +14 -7
  403. package/dist/core/shell-wrapper-table.js +5 -4
  404. package/dist/core/side-query.d.ts +10 -0
  405. package/dist/core/side-query.js +15 -1
  406. package/dist/core/skill-grant.d.ts +7 -2
  407. package/dist/core/skill-grant.js +5 -0
  408. package/dist/core/skills-directory.js +6 -2
  409. package/dist/core/store-contracts/checkpoint-store-contract.d.ts +11 -1
  410. package/dist/core/store-contracts/checkpoint-store-contract.js +168 -3
  411. package/dist/core/store-contracts/file-history-store-contract.js +74 -4
  412. package/dist/core/store-contracts/peer-directory-contract.d.ts +7 -2
  413. package/dist/core/store-contracts/peer-directory-contract.js +14 -2
  414. package/dist/core/store-contracts/session-policy-store-contract.d.ts +7 -0
  415. package/dist/core/store-contracts/session-policy-store-contract.js +130 -0
  416. package/dist/core/store-contracts/session-repo-contract.js +176 -0
  417. package/dist/core/store-contracts/session-store-contract.d.ts +6 -8
  418. package/dist/core/store-contracts/session-store-contract.js +361 -51
  419. package/dist/core/store-contracts/workflow-journal-store-contract.js +26 -1
  420. package/dist/core/stub-env.d.ts +2 -0
  421. package/dist/core/stub-env.js +1 -0
  422. package/dist/core/surrogate-safe-slice.d.ts +3 -3
  423. package/dist/core/synthetic-read-verdict.js +3 -3
  424. package/dist/core/task-event.d.ts +42 -8
  425. package/dist/core/task-notification.d.ts +19 -15
  426. package/dist/core/task-registry-agent.d.ts +4 -4
  427. package/dist/core/task-registry-shared.d.ts +4 -4
  428. package/dist/core/task-registry-shared.js +1 -0
  429. package/dist/core/task-registry.d.ts +13 -4
  430. package/dist/core/task-registry.js +14 -2
  431. package/dist/core/task-result.d.ts +21 -3
  432. package/dist/core/task-spec.d.ts +69 -64
  433. package/dist/core/task-stream.d.ts +6 -6
  434. package/dist/core/task-tool-shape.d.ts +4 -4
  435. package/dist/core/tighten-task-spec.d.ts +1 -1
  436. package/dist/core/tighten-task-spec.js +2 -1
  437. package/dist/core/tool-catalog-entries.d.ts +36 -2
  438. package/dist/core/tool-catalog-entries.js +69 -43
  439. package/dist/core/tool-check-reading.d.ts +11 -0
  440. package/dist/core/tool-check-reading.js +11 -6
  441. package/dist/core/tool-conformance.js +1 -0
  442. package/dist/core/tool-errors.d.ts +2 -2
  443. package/dist/core/tool-face-reader.js +5 -3
  444. package/dist/core/tool-face.d.ts +21 -2
  445. package/dist/core/tool-face.js +1 -1
  446. package/dist/core/tool-model-gate.d.ts +5 -5
  447. package/dist/core/tool-name-aliases.d.ts +29 -8
  448. package/dist/core/tool-name-aliases.js +22 -4
  449. package/dist/core/tool-name-readings.d.ts +10 -43
  450. package/dist/core/tool-name-readings.js +2 -11
  451. package/dist/core/tool-policy.d.ts +85 -196
  452. package/dist/core/tool-policy.js +150 -175
  453. package/dist/core/tool-registry.d.ts +14 -7
  454. package/dist/core/tool-registry.js +17 -7
  455. package/dist/core/tool-result-store.js +5 -1
  456. package/dist/core/tool-roster.d.ts +57 -33
  457. package/dist/core/tool-roster.js +56 -68
  458. package/dist/core/tool-spec-members.js +8 -3
  459. package/dist/core/tool-spec.d.ts +53 -31
  460. package/dist/core/tools.js +51 -10
  461. package/dist/core/trace.d.ts +6 -2
  462. package/dist/core/types.d.ts +1 -1
  463. package/dist/core/untrusted-egress.d.ts +1 -1
  464. package/dist/core/untrusted-text.d.ts +1 -1
  465. package/dist/core/user-attachment.d.ts +8 -1
  466. package/dist/core/user-attachment.js +64 -4
  467. package/dist/core/warm-resume.d.ts +1 -1
  468. package/dist/core/wiring-manifest.d.ts +58 -0
  469. package/dist/core/wiring-manifest.js +14 -5
  470. package/dist/core/workflow-journal-store.d.ts +62 -0
  471. package/dist/core/workflow-journal-store.js +78 -2
  472. package/dist/core/workflow-run-store.d.ts +6 -0
  473. package/dist/core/workflow-run-store.js +2 -0
  474. package/dist/engine/compaction/compaction.d.ts +9 -9
  475. package/dist/engine/compaction/compaction.js +3 -2
  476. package/dist/engine/execution-env/node-execution-env.d.ts +26 -8
  477. package/dist/engine/execution-env/node-execution-env.js +54 -24
  478. package/dist/engine/harness/agent-harness.d.ts +39 -9
  479. package/dist/engine/harness/agent-harness.js +87 -33
  480. package/dist/engine/harness/types.d.ts +58 -9
  481. package/dist/engine/harness/types.js +12 -1
  482. package/dist/engine/llm/types.d.ts +36 -19
  483. package/dist/engine/llm/validation.d.ts +4 -1
  484. package/dist/engine/llm/validation.js +13 -1
  485. package/dist/engine/loop/agent-loop.d.ts +23 -1
  486. package/dist/engine/loop/agent-loop.js +26 -34
  487. package/dist/engine/loop/types.d.ts +31 -19
  488. package/dist/engine/lsp/node-lsp-manager.d.ts +2 -2
  489. package/dist/engine/session/memory-repo.d.ts +18 -12
  490. package/dist/engine/session/memory-repo.js +24 -9
  491. package/dist/engine/session/parent-chain-guard.d.ts +3 -2
  492. package/dist/engine/session/parent-chain-guard.js +1 -1
  493. package/dist/engine/session/repo-utils.d.ts +32 -3
  494. package/dist/engine/session/repo-utils.js +50 -5
  495. package/dist/index.d.ts +47 -23
  496. package/dist/index.js +35 -17
  497. package/dist/internal/harness-types.d.ts +1 -1
  498. package/dist/internal/harness.d.ts +3 -3
  499. package/dist/internal/harness.js +2 -2
  500. package/dist/internal/llm.d.ts +2 -2
  501. package/dist/internal/llm.js +1 -1
  502. package/dist/orchestration/goal.js +2 -2
  503. package/dist/orchestration/run-workflow-tool.d.ts +8 -6
  504. package/dist/orchestration/run-workflow-tool.js +10 -6
  505. package/dist/orchestration/workflow-size-guideline.d.ts +4 -4
  506. package/dist/orchestration/workflow-types.d.ts +18 -0
  507. package/dist/orchestration/workflow-types.js +6 -0
  508. package/dist/orchestration/workflow.d.ts +5 -13
  509. package/dist/orchestration/workflow.js +57 -49
  510. package/dist/prompt-assembly/artifact.d.ts +2 -2
  511. package/dist/prompt-assembly/artifact.js +5 -3
  512. package/dist/prompt-assembly/assemble.d.ts +3 -2
  513. package/dist/prompt-assembly/assemble.js +1 -1
  514. package/dist/prompt-assembly/catalog/schema.d.ts +43 -12
  515. package/dist/prompt-assembly/catalog/schema.js +34 -2
  516. package/dist/prompt-assembly/catalog/sections.js +0 -1
  517. package/dist/prompt-assembly/composer.d.ts +3 -1
  518. package/dist/prompt-assembly/composer.js +1 -1
  519. package/dist/prompt-assembly/event-registry.js +2 -0
  520. package/dist/prompt-assembly/overlay.js +3 -3
  521. package/dist/prompt-assembly/renderers.d.ts +1 -1
  522. package/dist/prompt-assembly/renderers.js +0 -3
  523. package/dist/prompt-assembly/role-base.d.ts +15 -0
  524. package/dist/prompt-assembly/role-base.js +9 -0
  525. package/dist/prompt-assembly/select.d.ts +39 -14
  526. package/dist/prompt-assembly/select.js +47 -16
  527. package/dist/prompt-assembly/sugar.d.ts +17 -11
  528. package/dist/prompt-assembly/sugar.js +8 -3
  529. package/dist/prompt-assembly/tool-catalog.d.ts +39 -2
  530. package/dist/prompt-assembly/tool-catalog.js +117 -4
  531. package/dist/prompt-assembly/turn-snapshot.d.ts +4 -10
  532. package/dist/prompt-assembly/turn-snapshot.js +0 -3
  533. package/dist/prompt-assembly/types.d.ts +0 -7
  534. package/dist/prompts/default.d.ts +14 -14
  535. package/dist/scenarios/full-body.d.ts +15 -15
  536. package/dist/scenarios/full-body.js +4 -3
  537. package/dist/shell/lex.js +10 -1
  538. package/dist/stores/file/adoption/adopt.d.ts +4 -3
  539. package/dist/stores/file/adoption/adopt.js +27 -33
  540. package/dist/stores/file/adoption/marker.d.ts +6 -13
  541. package/dist/stores/file/adoption/marker.js +9 -17
  542. package/dist/stores/file/checkpoint-store.d.ts +24 -0
  543. package/dist/stores/file/checkpoint-store.js +45 -7
  544. package/dist/stores/file/file-history-store.d.ts +20 -19
  545. package/dist/stores/file/file-history-store.js +157 -141
  546. package/dist/stores/file/fs-atomic.d.ts +15 -0
  547. package/dist/stores/file/fs-atomic.js +89 -14
  548. package/dist/stores/file/index.d.ts +1 -1
  549. package/dist/stores/file/index.js +2 -1
  550. package/dist/stores/file/mailbox-store.d.ts +3 -0
  551. package/dist/stores/file/mailbox-store.js +3 -1
  552. package/dist/stores/file/permission-rule-adopt.d.ts +1 -1
  553. package/dist/stores/file/permission-rule-adopt.js +18 -18
  554. package/dist/stores/file/permission-rule-store.d.ts +18 -2
  555. package/dist/stores/file/permission-rule-store.js +31 -18
  556. package/dist/stores/file/session-policy-store.d.ts +3 -3
  557. package/dist/stores/file/session-store.d.ts +54 -16
  558. package/dist/stores/file/session-store.js +114 -85
  559. package/dist/stores/file/workflow-journal-store.d.ts +10 -4
  560. package/dist/stores/file/workflow-journal-store.js +28 -13
  561. package/dist/tools/artifact/artifact-text.d.ts +1 -1
  562. package/dist/tools/artifact/artifact-tool.js +5 -3
  563. package/dist/tools/fs/bash-program-position.d.ts +19 -2
  564. package/dist/tools/fs/bash-program-position.js +56 -9
  565. package/dist/tools/fs/bash-readonly-classifier.d.ts +3 -3
  566. package/dist/tools/fs/fs-bash.d.ts +2 -2
  567. package/dist/tools/fs/fs-bash.js +8 -6
  568. package/dist/tools/fs/fs-glob.d.ts +86 -0
  569. package/dist/tools/fs/fs-glob.js +226 -0
  570. package/dist/tools/fs/fs-read.js +14 -14
  571. package/dist/tools/fs/fs-search-tools.js +7 -7
  572. package/dist/tools/fs/fs-shared.d.ts +8 -8
  573. package/dist/tools/fs/gh-rate-limit.d.ts +1 -1
  574. package/dist/tools/fs/notebook.d.ts +2 -2
  575. package/dist/tools/fs/pattern-kill-guard.d.ts +22 -0
  576. package/dist/tools/fs/pattern-kill-guard.js +397 -0
  577. package/dist/tools/fs/pdf.d.ts +9 -6
  578. package/dist/tools/fs/pdf.js +3 -3
  579. package/dist/tools/fs/program-read-model.d.ts +57 -7
  580. package/dist/tools/fs/program-read-model.js +11 -1
  581. package/dist/tools/fs/program-read-model.rows.js +78 -21
  582. package/dist/tools/fs/read-deny-home.js +3 -2
  583. package/dist/tools/fs/read-deny.d.ts +29 -7
  584. package/dist/tools/fs/read-deny.js +63 -22
  585. package/dist/tools/fs/removal-targets.d.ts +18 -8
  586. package/dist/tools/fs/removal-targets.js +47 -20
  587. package/dist/tools/fs/safety.d.ts +9 -9
  588. package/dist/tools/fs/search.d.ts +16 -6
  589. package/dist/tools/fs/search.js +20 -26
  590. package/dist/tools/fs/shell-read-argv.js +89 -12
  591. package/dist/tools/fs/shell-read-bindings.d.ts +31 -0
  592. package/dist/tools/fs/shell-read-bindings.js +41 -0
  593. package/dist/tools/fs/shell-read-check.js +12 -20
  594. package/dist/tools/fs/shell-read-environment.d.ts +5 -1
  595. package/dist/tools/fs/shell-read-environment.js +3 -2
  596. package/dist/tools/fs/shell-read-establish.d.ts +15 -0
  597. package/dist/tools/fs/shell-read-establish.js +19 -20
  598. package/dist/tools/fs/shell-read-judge.d.ts +4 -0
  599. package/dist/tools/fs/shell-read-judge.js +5 -2
  600. package/dist/tools/fs/shell-read-plan.js +24 -16
  601. package/dist/tools/fs/shell-read-start.d.ts +6 -1
  602. package/dist/tools/fs/shell-read-write-targets.d.ts +5 -1
  603. package/dist/tools/fs/shell-read-write-targets.js +2 -3
  604. package/dist/tools/fs/shell-reentry-text.d.ts +9 -0
  605. package/dist/tools/fs/shell-reentry-text.js +40 -2
  606. package/dist/tools/loop-tick.d.ts +2 -2
  607. package/dist/tools/scheduler-tools.js +5 -1
  608. package/dist/tools/task-list.d.ts +7 -7
  609. package/dist/tools/task-list.js +5 -1
  610. package/dist/tools/todo.js +65 -64
  611. package/dist/tools/web.d.ts +20 -15
  612. package/dist/tools/web.js +55 -69
  613. package/dist/tools/worktree.d.ts +3 -3
  614. package/dist/tools/worktree.js +3 -1
  615. package/package.json +1 -1
  616. package/test/export-surface.snapshot.json +5894 -5638
  617. package/wire-changes/core@7.55.0.json +3318 -0
  618. package/wire-changes/core@7.56.0.json +3891 -0
  619. package/wire-changes/mods-kernel@7.56.0.json +303 -0
  620. package/dist/core/store-contracts/session-store-incarnation-contract.d.ts +0 -39
  621. package/dist/core/store-contracts/session-store-incarnation-contract.js +0 -95
@@ -1,5 +1,8 @@
1
1
  import { TOOL_SPEC_MEMBERS, frozenExtra, frozenMember, newCopyState } from "../tool-spec-members.js";
2
+ import { RETIRED_TOOL_SPEC_KEYS, retiredKeyOf, retiredKeyRefusal } from "../retired-keys.js";
2
3
  import { isDefineToolProduct, rebindDefineToolCtx } from "../tools.js";
4
+ import { isCatalogContract } from "../tool-catalog-entries.js";
5
+ import { attachedContractOf, computeShapeDigest, contractOriginOf, isEngineDescriptor } from "../../prompt-assembly/tool-catalog.js";
3
6
  function specArmCanConstruct(t) {
4
7
  if (typeof t !== "object" || t === null)
5
8
  return false;
@@ -17,6 +20,8 @@ function faceKeys(t) {
17
20
  const keys = new Set(Reflect.ownKeys(t).filter((k) => Object.getOwnPropertyDescriptor(t, k)?.enumerable === true));
18
21
  for (const name of TOOL_SPEC_MEMBERS)
19
22
  keys.add(name);
23
+ for (const name of Object.keys(RETIRED_TOOL_SPEC_KEYS))
24
+ keys.delete(name);
20
25
  return [...keys];
21
26
  }
22
27
  const BUILDABLE = new WeakSet();
@@ -43,9 +48,42 @@ function refuseUnreadableEntry(index, entry, cause) {
43
48
  e.code = "config.tool_mount_denied";
44
49
  throw e;
45
50
  }
51
+ function unmintedEngineClaim(face) {
52
+ const declared = face.contract?.contractId;
53
+ if (typeof declared === "string" && contractOriginOf(declared) === "core" && !isCatalogContract(face.contract))
54
+ return declared;
55
+ const carried = attachedContractOf(face);
56
+ if (carried === undefined || carried === null || typeof carried !== "object")
57
+ return undefined;
58
+ const id = carried.contractId;
59
+ if (carried.origin !== "core" && !(typeof id === "string" && contractOriginOf(id) === "core"))
60
+ return undefined;
61
+ const describesFace = isEngineDescriptor(carried) && carried.wireName === face.name && carried.shapeDigest === computeShapeDigest(face.parameters);
62
+ return describesFace ? undefined : String(id);
63
+ }
64
+ export function callerEngineContractProblem(face) {
65
+ const id = unmintedEngineClaim(face);
66
+ if (id === undefined)
67
+ return undefined;
68
+ return { code: "config.tool_face_invalid", message: `tool ${JSON.stringify(String(face.name).slice(0, 40))} declares the engine contract ${JSON.stringify(id.slice(0, 64))}, which no engine definition minted for it — a contract id under \`core.\` belongs to the engine's own definitions; declare an id of your own, or none` };
69
+ }
70
+ export function refuseRetiredMember(entry, index) {
71
+ if ((typeof entry !== "object" && typeof entry !== "function") || entry === null)
72
+ return;
73
+ let hit;
74
+ try {
75
+ hit = retiredKeyOf(entry, RETIRED_TOOL_SPEC_KEYS);
76
+ }
77
+ catch (cause) {
78
+ return refuseEntry(index, entry, cause);
79
+ }
80
+ if (hit !== undefined)
81
+ throw retiredKeyRefusal(hit, "ToolSpec");
82
+ }
46
83
  export function rosterFaceOf(t, index) {
47
84
  if ((typeof t !== "object" && typeof t !== "function") || t === null)
48
85
  return t;
86
+ refuseRetiredMember(t, index);
49
87
  try {
50
88
  const product = isDefineToolProduct(t) ? t : undefined;
51
89
  const buildable = product === undefined && specArmCanConstruct(t);
@@ -0,0 +1,5 @@
1
+ import type { Prepared } from "./contracts.js";
2
+ import type { NoticeSeatInput } from "./notice-seat-input.js";
3
+ /** The session's announced record and the leg's receipt ledger (the parked write). */
4
+ export type CapabilityWithheldRecord = Pick<Prepared, "announcedListingsRef" | "frameReceipts">;
5
+ export declare function createCapabilityWithheldScope(ids: NoticeSeatInput, announced: CapabilityWithheldRecord): <T>(fn: () => Promise<T>) => Promise<T>;
@@ -0,0 +1,24 @@
1
+ import { runWithCapabilityWithheld } from "../../brain/status-sink.js";
2
+ import { deliverEngineNotice } from "../engine-notice.js";
3
+ import { announceDigest, withAnnounceDigests } from "./announce-once-ledger.js";
4
+ const CAPABILITY_DOWNGRADED = "model.capability_downgraded";
5
+ export function createCapabilityWithheldScope(ids, announced) {
6
+ const announce = (report) => {
7
+ const digest = announceDigest(CAPABILITY_DOWNGRADED, `${report.modelId}\n${report.capability}`);
8
+ const record = announced.announcedListingsRef;
9
+ if (record.advisories?.includes(digest) === true)
10
+ return;
11
+ const why = report.cause === "declared_off"
12
+ ? `its catalog entry declares no image input (Model.input has no "image")`
13
+ : `its catalog entry does not declare image input, and images are not sent to an entry that does not`;
14
+ deliverEngineNotice(ids.onNotice, {
15
+ code: CAPABILITY_DOWNGRADED,
16
+ message: `Images in this conversation are not being sent to model "${report.modelId}": ${why}, so each image reaches the model as a one-line placeholder. ` +
17
+ `If the model reads images, declare it (input: ["text","image"]); otherwise switch to a model that reads images. Said once per conversation for this model.`,
18
+ detail: { model: report.modelId, capability: report.capability, status: report.cause, sessionId: ids.sessionId, runId: ids.runId },
19
+ });
20
+ record.advisories = withAnnounceDigests(record.advisories, [digest]);
21
+ announced.frameReceipts.listingSnapshotOwed = true;
22
+ };
23
+ return (fn) => runWithCapabilityWithheld(announce, fn);
24
+ }
@@ -99,6 +99,28 @@ export declare function classifierSeatModel(args: {
99
99
  deps: Pick<RunnerDeps, "models" | "roles" | "tiers">;
100
100
  main: Model;
101
101
  }): ClassifierSeat;
102
+ /**
103
+ * The catalog the seat is read off. The Runner expands tier bindings into the catalog at construction and
104
+ * keeps that expansion PRIVATE, so the engine reaches this seat with tier words already catalog keys — a host
105
+ * holding its own deps does not, and the tier-relative leg (which addresses the catalog BY tier word) would
106
+ * find nothing and answer `main_only`. Expanding here is idempotent: an existing catalog key SHADOWS the tier
107
+ * binding, so a second expansion over an expanded catalog changes no key.
108
+ *
109
+ * A binding naming a model the catalog no longer carries throws in the expansion — that is the BOOT error a
110
+ * deployment gets from the Runner's constructor, and a seat READ must not re-raise it: this function's whole
111
+ * posture is that a stale reference never fails the caller ({@link classifierSeatModel}'s two `catch` arms). Such a deployment
112
+ * cannot construct a Runner at all, so there is no engine answer to disagree with; the raw catalog is handed
113
+ * on and the ordinary fallbacks name the seat.
114
+ */
115
+ export declare function normalizeSeatDeps<T extends Pick<RunnerDeps, "models" | "tiers">>(deps: T): T;
116
+ /**
117
+ * The tier a model SITS on, as an index into `DEFAULT_TIER_ORDER` (0 = strongest): the LOWEST known tier whose
118
+ * expanded catalog key resolves to the same route as `model`. Read off a catalog {@link normalizeSeatDeps} expanded.
119
+ * The lowest, because a key synthesised for an unbound tier falls DOWN to the next bound one, so a model's lowest
120
+ * tier is the tier it was bound to. `undefined` when the deployment declares no tiers, or the model is on none.
121
+ * The one tier reading: the classifier seat and the advisor pairing both read it.
122
+ */
123
+ export declare function tierIndexOf(deps: Pick<RunnerDeps, "models" | "tiers">, model: Model): number | undefined;
102
124
  /**
103
125
  * The `classifier.role_defaulted` line — minted ONCE per run by the arming, AFTER the route pre-flight, so it
104
126
  * names the seat actually asked (a pre-flight swap to the main model is its own line,
@@ -157,14 +179,11 @@ export interface ClassifierUnavailableStation {
157
179
  budgetMs?: number;
158
180
  }
159
181
  /**
160
- * The classifier's REASONING SEAT, read off the model a classification is actually asked on — ONE predicate:
161
- * does the wire SPELL off ({@link thinkingOffSpelled})? Yes ⇒ `off` + the verdict-sized cap (the request pays
162
- * for the answer alone); no ⇒ `low` + the verdict cap + the low allowance (a model whose thinking the wire
163
- * cannot turn off is asked for the least it can grade, in the room that costs — CC 2.1.259 `MU`: spell off,
164
- * or leave thinking to the provider and pay 2048). A model that declares no reasoning at all is on the `low`
165
- * seat too: its wire carries nothing either way, so the request is the gateway's default, and a default-on
166
- * gateway thinks — the arm that used to read it as "never thinks" is the one the field report was about.
167
- * PER RUNG, not once per arming: the second rung is a different model with its own wire.
182
+ * The classifier's REASONING SEATS, read off the model a classification is actually asked on. The tier is the shared
183
+ * verdict ({@link lowestReasoningSeat}); the cap is the classifier's own: `off` carries the verdict-sized cap (the
184
+ * request pays for the answer alone), `low` carries the verdict cap plus the low allowance (spell off, or leave
185
+ * thinking to the provider and pay 2048). PER RUNG, not once per arming: the second rung is a different model with
186
+ * its own wire.
168
187
  *
169
188
  * The THINK seat is the RE-ASK seat ({@link classifierReplyAsksAgain}): a first attempt that produced no
170
189
  * verdict is asked once more with thinking allowed the room of CC's stage-2 classifier (8192) — an unknown
@@ -190,13 +209,14 @@ export type ClassifierSeatRequest = typeof CLASSIFIER_OFF_SEAT | typeof CLASSIFI
190
209
  * bound the engine can vouch for: a gateway may exclude reasoning tokens from `max_tokens` (a vLLM-fronted
191
210
  * Qwen gateway answered a cap of 128 with 938 output tokens and `stop`), so an over-long think is cut by the
192
211
  * round-trip timeout (`unavailable` / `timeout`), not by the cap (`parse_error` on an empty reply), and the
193
- * two are attested as the two different facts they are.
212
+ * two are attested as the two different facts they are. The seat's tier is not the classifier's to decide: it reads
213
+ * {@link lowestReasoningSeat}, and only the cap is its own.
194
214
  */
195
215
  export declare function classifierRungSeat(model: Model): typeof CLASSIFIER_OFF_SEAT | typeof CLASSIFIER_LOW_SEAT;
196
216
  /**
197
- * The user-message TAIL of each attempt — CC 2.1.259's classifier suffixes, verbatim: the FIRST attempt
217
+ * The user-message TAIL of each attempt — the reference's classifier suffixes: the FIRST attempt
198
218
  * carries the fast-mode suffix (`$ns`: the answer must begin with `<block>`, no preamble), the RE-ASK carries
199
- * the thinking-stage suffix (`Uns`: think in `<thinking>` first, then answer). The base prompt (2.1.250 `KRg`)
219
+ * the thinking-stage suffix (`Uns`: think in `<thinking>` first, then answer). The base prompt
200
220
  * already says "no preamble" once; upstream repeats it at the END of the user message, and it is the repeat
201
221
  * that lands — live 2026-09-15, a Qwen 3.8 with thinking off went from 70% tagged replies (1.2–3.9k chars of
202
222
  * "Looking at this action…" prose) to 90% at 8 output tokens with the first suffix, and the re-ask suffix
@@ -209,7 +229,7 @@ export declare const CLASSIFIER_ATTEMPT_SUFFIX: {
209
229
  /** The classifier reply's answer text — every text block joined; thinking blocks are not the verdict. */
210
230
  export declare function classifierReplyText(reply: AssistantMessage): string;
211
231
  /**
212
- * CC 2.1.259 `$Tt`: an EMPTY reply that stopped at the output cap is "unparseable" — a reply to ask for again,
232
+ * An EMPTY reply that stopped at the output cap is "unparseable" — a reply to ask for again,
213
233
  * not a refusal and not a verdict. The engine's brains report that cut two ways: `stopReason:"length"` (an
214
234
  * engine-shrunk cap) or `stopReason:"error"` with `errorKind:"length_empty"` (a static cap — the classifier's
215
235
  * own). An empty reply with any OTHER stop is CC's `policy_refusal` arm: not re-asked.
@@ -243,7 +263,7 @@ export declare function classifierReplyVerdictText(reply: AssistantMessage): str
243
263
  * ({@link classifierReplyTagOnly}), or text in which the reader finds no answer at all (`parse_error` of form
244
264
  * `missing`: prose, a thinking-only reply). Not a CONFLICT (two `<block>` answers — it carries a `yes`, and a second attempt that answered `no`
245
265
  * would erase it: the fail-closed `parse_error` it is stands) and not an empty reply with a non-cap stop
246
- * (CC's refusal arm). CC 2.1.259 `Vrr` re-asks an unparseable reply up to `maxRetries` times; sema re-asks
266
+ * (CC's refusal arm). The reference re-asks an unparseable reply up to `maxRetries` times; sema re-asks
247
267
  * ONCE, on the stage-2 room, so a rung costs at most two calls. A failed reply ({@link classifierReplyFailure})
248
268
  * is judged before this and never reaches it.
249
269
  */
@@ -1,5 +1,5 @@
1
1
  import { sameRouteIdentity } from "../../brain/route-adjudicator.js";
2
- import { thinkingOffSpelled } from "../../brain/reasoning.js";
2
+ import { lowestReasoningSeat } from "../../brain/reasoning-request.js";
3
3
  import { AUTO_MODE_CLASSIFIER_CONTRACT_BROKEN_AFTER, AUTO_MODE_CLASSIFIER_LOW_REASONING_BUDGET_TOKENS, AUTO_MODE_CLASSIFIER_MAX_TOKENS, AUTO_MODE_CLASSIFIER_THINK_BUDGET_TOKENS } from "../auto-mode-defaults.js";
4
4
  import { autoModeClassifierFallbackOf, parseAutoModeResponse } from "../auto-mode.js";
5
5
  import { classifierUnavailableDispositionOf } from "../classifier-unavailable-arm.js";
@@ -44,7 +44,7 @@ export function classifierSeatModel(args) {
44
44
  return { model: main, defaulted: "main_only" };
45
45
  }
46
46
  }
47
- function normalizeSeatDeps(deps) {
47
+ export function normalizeSeatDeps(deps) {
48
48
  if (deps.tiers === undefined)
49
49
  return deps;
50
50
  try {
@@ -54,20 +54,21 @@ function normalizeSeatDeps(deps) {
54
54
  return deps;
55
55
  }
56
56
  }
57
- function tierBelowMain(deps, main) {
57
+ export function tierIndexOf(deps, model) {
58
58
  if (deps.tiers === undefined || Object.keys(deps.tiers).length === 0 || deps.models === undefined)
59
59
  return undefined;
60
- const bound = DEFAULT_TIER_ORDER.map((tier) => deps.models?.[tier]);
61
- let mainTier = -1;
62
- for (let i = bound.length - 1; i >= 0; i--) {
63
- const m = bound[i];
64
- if (m !== undefined && sameRouteQuietly(m, main)) {
65
- mainTier = i;
66
- break;
67
- }
60
+ for (let i = DEFAULT_TIER_ORDER.length - 1; i >= 0; i--) {
61
+ const m = deps.models[DEFAULT_TIER_ORDER[i]];
62
+ if (m !== undefined && sameRouteQuietly(m, model))
63
+ return i;
68
64
  }
69
- if (mainTier < 0)
65
+ return undefined;
66
+ }
67
+ function tierBelowMain(deps, main) {
68
+ const mainTier = tierIndexOf(deps, main);
69
+ if (mainTier === undefined)
70
70
  return undefined;
71
+ const bound = DEFAULT_TIER_ORDER.map((tier) => deps.models?.[tier]);
71
72
  for (let i = mainTier + 1; i < bound.length; i++) {
72
73
  const m = bound[i];
73
74
  if (m !== undefined && !sameRouteQuietly(m, main))
@@ -79,7 +80,7 @@ export function announceClassifierRoleDefaulted(args) {
79
80
  const { seat } = args;
80
81
  if (seat.defaulted === undefined)
81
82
  return;
82
- const spelled = thinkingOffSpelled(seat.model);
83
+ const spelled = lowestReasoningSeat(seat.model) === "off";
83
84
  deliverEngineNotice(args.onNotice, {
84
85
  code: "classifier.role_defaulted",
85
86
  message: `no classifier role names a model — "${seat.model.id}" classifies this run (${seat.defaulted}); ` +
@@ -194,7 +195,7 @@ export const CLASSIFIER_OFF_SEAT = { reasoning: "off", maxTokens: AUTO_MODE_CLAS
194
195
  export const CLASSIFIER_LOW_SEAT = { reasoning: "low", maxTokens: AUTO_MODE_CLASSIFIER_MAX_TOKENS + AUTO_MODE_CLASSIFIER_LOW_REASONING_BUDGET_TOKENS };
195
196
  export const CLASSIFIER_THINK_SEAT = { reasoning: "low", maxTokens: AUTO_MODE_CLASSIFIER_MAX_TOKENS + AUTO_MODE_CLASSIFIER_THINK_BUDGET_TOKENS };
196
197
  export function classifierRungSeat(model) {
197
- return thinkingOffSpelled(model) ? CLASSIFIER_OFF_SEAT : CLASSIFIER_LOW_SEAT;
198
+ return lowestReasoningSeat(model) === "off" ? CLASSIFIER_OFF_SEAT : CLASSIFIER_LOW_SEAT;
198
199
  }
199
200
  export const CLASSIFIER_ATTEMPT_SUFFIX = {
200
201
  first: '\nErr on the side of blocking. Your ENTIRE response MUST begin with <block>. Do NOT output any analysis, reasoning, or commentary before <block>. No "Looking at..." or similar preamble.',
@@ -35,16 +35,20 @@ export declare function postureRestateOption(prepared: Prepared): Pick<MaybeComp
35
35
  * of every engine frame written at a boundary, the git frame's re-assert and the compaction itself: the run continues
36
36
  * and the failure is reported, `onError` phase `degraded`). Never throws.
37
37
  */
38
- export declare function appendOwedPosture(prepared: Pick<Prepared, "approvalPosture" | "toolRoster" | "hookIdentity" | "session" | "reminderMark" | "postureFrameRef" | "batchHaltRef">, ask: "always" | "on_change"): Promise<void>;
38
+ export declare function appendOwedPosture(prepared: Pick<Prepared, "approvalPosture" | "toolRoster" | "hookIdentity" | "session" | "reminderMark" | "postureFrameRef" | "batchHaltRef" | "frameReceipts">, ask: "always" | "on_change"): Promise<void>;
39
39
  /** The declared output style's frame as one engine-marked reminder — the one spelling every site that states it directly
40
40
  * (a resumed leg's continuation, a boundary a queued input continues) mints. */
41
41
  export declare function mintOutputStyleReminder(prepared: Pick<Prepared, "outputStyleFrame" | "reminderMark">): string | undefined;
42
+ /** Is a frame of this source already on its way to the next request (a pending receipt)? The one reading, for every
43
+ * collector that could state it again: the boundary bundle, the direct-write style lane and the posture writer. */
44
+ export declare function frameCarried(ledger: Prepared["frameReceipts"], source: Prepared["frameReceipts"]["pending"][number]["source"]): boolean;
42
45
  /**
43
46
  * The turn boundary's direct writes, for a boundary a request can follow: the owed posture, and the output style when
44
- * the turn was text-final and queued work already guarantees the next request (`pendingInjectionCount`, both lanes). The
45
- * guarantee is read synchronously, at the call, before any await — a boundary with nothing queued returns the posture's own
46
- * promise, so it reaches no await the posture did not already have.
47
+ * the turn's tool results do not go back as the next request (`turnOwesRequest` false) and queued input already
48
+ * guarantees the next one (`pendingInjectionCount`, both lanes: what can continue a run), unless that request already
49
+ * carries it ({@link frameCarried}). Both frames keep the posture's halt rule. The guarantee is read synchronously, at
50
+ * the call, before any await — a boundary with nothing queued returns the posture's own promise.
47
51
  */
48
- export declare function appendBoundaryFrames(prepared: Pick<Prepared, "approvalPosture" | "toolRoster" | "hookIdentity" | "session" | "reminderMark" | "postureFrameRef" | "batchHaltRef" | "outputStyleFrame" | "harness">, turnHadToolCalls: boolean): Promise<void>;
52
+ export declare function appendBoundaryFrames(prepared: Pick<Prepared, "approvalPosture" | "toolRoster" | "hookIdentity" | "session" | "reminderMark" | "postureFrameRef" | "batchHaltRef" | "outputStyleFrame" | "harness" | "frameReceipts">, turnOwesRequest: boolean): Promise<void>;
49
53
  /** Every post-compaction restatement the turn boundary registers, at one spread site. */
50
- export declare function compactionRestateOptions(prepared: Prepared): Pick<MaybeCompactOptions, "gitRestate" | "postureRestate">;
54
+ export declare function compactionRestateOptions(prepared: Prepared): Pick<MaybeCompactOptions, "gitRestate" | "postureRestate" | "advisorRestate">;
@@ -4,6 +4,7 @@ import { mintSystemReminder } from "../reminder-mint.js";
4
4
  import { thrownText } from "../thrown-value.js";
5
5
  import { rosterEntryNamed } from "../tool-roster.js";
6
6
  import { sanitizeUntrustedText } from "../untrusted-text.js";
7
+ import { appendAdvisorRestate } from "./advisor-instructions.js";
7
8
  import { gitRestateOption } from "./git-leg-delivery.js";
8
9
  import { attachmentEnvelopeTags } from "./turn-attachments.js";
9
10
  export function postureFactsOf(prepared) {
@@ -44,6 +45,8 @@ export function postureRestateOption(prepared) {
44
45
  };
45
46
  }
46
47
  export async function appendOwedPosture(prepared, ask) {
48
+ if (frameCarried(prepared.frameReceipts, "posture"))
49
+ return;
47
50
  const ref = prepared.postureFrameRef;
48
51
  const text = await owedPostureText(prepared, ask);
49
52
  if (text === undefined) {
@@ -88,11 +91,14 @@ async function appendOutputStyleRestate(prepared) {
88
91
  }
89
92
  }
90
93
  }
91
- export function appendBoundaryFrames(prepared, turnHadToolCalls) {
92
- const styleOwed = prepared.outputStyleFrame !== undefined && !turnHadToolCalls && prepared.harness.pendingInjectionCount() > 0;
94
+ export function frameCarried(ledger, source) {
95
+ return ledger.pending.some((r) => r.source === source);
96
+ }
97
+ export function appendBoundaryFrames(prepared, turnOwesRequest) {
98
+ const styleOwed = prepared.outputStyleFrame !== undefined && !turnOwesRequest && prepared.batchHaltRef.current === undefined && !frameCarried(prepared.frameReceipts, "output_style") && prepared.harness.pendingInjectionCount() > 0;
93
99
  const posture = appendOwedPosture(prepared, "on_change");
94
100
  return styleOwed ? posture.then(() => appendOutputStyleRestate(prepared)) : posture;
95
101
  }
96
102
  export function compactionRestateOptions(prepared) {
97
- return { ...gitRestateOption(prepared), ...postureRestateOption(prepared) };
103
+ return { ...gitRestateOption(prepared), ...postureRestateOption(prepared), ...(prepared.advisorInstruction?.mounted === true ? { advisorRestate: () => appendAdvisorRestate(prepared) } : {}) };
98
104
  }
@@ -3,6 +3,7 @@ import { checkedMediaByteCap } from "../media-byte-cap.js";
3
3
  import { receiptRefusal, receiveOwnProperties, refuseProxy } from "../own-property-receipt.js";
4
4
  import { assertNoRetiredRunnerDeps } from "./retired-runner-deps.js";
5
5
  import { copyReadDenySeat, READ_DENY_DEPLOYMENT_SEATS } from "../read-face-seats.js";
6
+ import { receiveHostFloor } from "../host-floor.js";
6
7
  import { holdOwnCredentialValues } from "../secret-env.js";
7
8
  export function retainRunnerDeps(deps) {
8
9
  const words = { subject: "RunnerDeps", unit: "seat", moment: "at new Runner" };
@@ -15,6 +16,8 @@ export function retainRunnerDeps(deps) {
15
16
  if (Object.hasOwn(retained, seat))
16
17
  Object.defineProperty(retained, seat, { value: copyReadDenySeat(Reflect.get(retained, seat)), enumerable: true, writable: true, configurable: true });
17
18
  }
19
+ if (Object.hasOwn(retained, "hostFloor"))
20
+ Object.defineProperty(retained, "hostFloor", { value: receiveHostFloor(Reflect.get(retained, "hostFloor")), enumerable: true, writable: true, configurable: true });
18
21
  let consolidationKey;
19
22
  try {
20
23
  const chat = retained.memoryConsolidationDriver?.chat;
@@ -17,7 +17,7 @@ import type { HumanReviewGateRow } from "../task-result.js";
17
17
  import type { RepairBundle } from "../../agents/repair-loop.js";
18
18
  import type { SubagentRetainLedger } from "../../agents/retain-ledger.js";
19
19
  import type { BrainCallGuardrailRef } from "../../brain/timeout.js";
20
- import type { ActiveWorktreeSession, AgentHarness, AgentMessage, AgentTool, AnnouncedListingSnapshotInput, ExecutionEnv, ThinkingLevel } from "../../internal/harness.js";
20
+ import type { ActiveWorktreeSession, AgentHarness, AgentMessage, AgentTool, AnnouncedListingSnapshotInput, AnnouncedMcpFailure, ExecutionEnv, ThinkingLevel } from "../../internal/harness.js";
21
21
  import type { Model } from "../../internal/llm.js";
22
22
  import type { WorkflowSizeGuideline } from "../../orchestration/workflow-size-guideline.js";
23
23
  import type { ToolManifestRow } from "../../prompt-assembly/tool-catalog.js";
@@ -232,9 +232,9 @@ export interface DateAnchorRead {
232
232
  export interface FrameReceipt {
233
233
  /** The carrying message's exact text (its first text block) — the receipt's match key. */
234
234
  text: string;
235
- /** Which frame this receipt settles. A boundary collector must not render a listing whose receipt is
236
- * still pending (the frame is queued, not yet in the transcript). */
237
- source: "git_status" | "agent_listing" | "skills_listing" | "date_change" | "output_style" | "approval_feedback";
235
+ /** Which frame this receipt settles. No collector renders a frame whose receipt is still pending (the frame is on
236
+ * its way, not yet in the transcript) — the one reading is `frameCarried` (compaction-restate.ts). */
237
+ source: "git_status" | "agent_listing" | "skills_listing" | "date_change" | "output_style" | "mcp_unavailable" | "posture" | "approval_feedback" | "advisor_tool";
238
238
  /** Runs inside the `message_end` walk (synchronous, never awaited): advances the run-local record
239
239
  * and parks any session write for the next serialization point. */
240
240
  commit: (entryId: string) => void;
@@ -291,6 +291,8 @@ export interface Prepared {
291
291
  * prepare emits run-scoped disclosures of its own and each must have a terminal that names it.
292
292
  */
293
293
  runId: string;
294
+ /** The deployment's host floor as the config doors compiled it (absent ⇒ none declared) — the task images' guard reads it. */
295
+ hostFloor?: import("../host-floor.js").HostFloor;
294
296
  /** The (owner, scope) key this run's registry-facing tools register rows under — (host task id, mount domain), minted once at prepare; the teardown sweeps read it and never re-derive it. */
295
297
  registryAccess: {
296
298
  readonly owner: string;
@@ -472,13 +474,15 @@ export interface Prepared {
472
474
  readonly args: unknown;
473
475
  readonly admit: () => void;
474
476
  }>;
477
+ /** The leg's `tool.call` station (`mods/tool-call.ts`) — every execution of a call passes it; absent when no handler hangs on the event. */
478
+ toolCallStation?: import("../mods/tool-call.js").ToolCallStation;
475
479
  /** The leg's shell READ STATION, re-run on a durable RESUME before an approved shell call executes: the parked leg's
476
480
  * admission died with that leg, so the resumed bytes are judged (and admitted for their pre-spawn re-establishment)
477
481
  * on THIS leg — a deny row found now vetoes, an operator's edit is judged on the `rejudge` seat. */
478
482
  shellReadCheck?: import("../../tools/fs/shell-read-check.js").ShellReadCheck;
479
483
  crossBoundary?: {
480
484
  readonly check: import("../cross-boundary-taint.js").CrossBoundaryCheck | undefined;
481
- settle(): Promise<void>;
485
+ settle(owed: import("../cross-boundary-taint.js").OwedDeliveries): Promise<void>;
482
486
  storeWaits(): number;
483
487
  };
484
488
  /** The ORG adjudication face, re-resolved on a durable RESUME before an approved
@@ -1007,6 +1011,11 @@ export interface Prepared {
1007
1011
  * calls themselves never pass through the recorded seam (they ride the separate compaction-brain
1008
1012
  * wrapper), so the snapshot is never polluted by a summary request. */
1009
1013
  lastBrainContext: () => CompactionForkContext | undefined;
1014
+ /** The same recorded request, unconditionally — the one write {@link lastBrainContext} also reads, minus its lossy-projection
1015
+ * exclusion: what the main lane last actually sent (the advisor's projection reads it). `undefined` until the first call. */
1016
+ lastSentRequest: () => CompactionForkContext | undefined;
1017
+ /** The leg's advisor-instructions seat (advisor-instructions.ts); absent when the leg neither mounts the advisor nor has told the model of it. */
1018
+ advisorInstruction?: import("./advisor-instructions.js").AdvisorInstructionSeat;
1010
1019
  /** The post-compaction restore (`MaybeCompactOptions.workingFileAttachments.restore`): re-reads the candidates through
1011
1020
  * the leg's one file reader under the run's synthetic-Read judge — the user attachment's own path read — deduplicated
1012
1021
  * against the read state the summary leaves, and mints their attachment frames (`readCompactionRestore`); a file it
@@ -1030,7 +1039,7 @@ export interface Prepared {
1030
1039
  * result from a stub hit whose original full transmission may already be summarized away. Present
1031
1040
  * only with hands. */
1032
1041
  isDedupStubResult?: (resultText: string) => boolean;
1033
- /** Wired to `MaybeCompactOptions.onApplied` by every compaction lane (CC 220 clears readFileState at its
1042
+ /** Wired to `MaybeCompactOptions.onApplied` by every compaction lane (the reference clears readFileState at its
1034
1043
  * compaction landing site, @388663). Drops every read-state entry the summary took out of view
1035
1044
  * (`readFileStateAfterSummary`); the restored files then re-register through their frames' own commits. Present
1036
1045
  * only with hands. `preserveReadState` carries the files the context the summary leaves still shows — their
@@ -1135,31 +1144,29 @@ export interface Prepared {
1135
1144
  * turn boundary. Appended by the rematerialize diff (newly-activated names only — the announced set
1136
1145
  * is seeded with prepare-time actives INCLUDING resume-reseeded ones, so a resume never replays);
1137
1146
  * DRAINED by the run loop only when the `tools_delta` attachment actually survived the byte cap.
1138
- * Present when the task has deferred tools at all — OR when a declared MCP server failed
1139
- * to connect, so the failure is announceable even on a task whose every MCP tool went missing with it.
1147
+ * Present when the task has deferred tools at all.
1140
1148
  *
1141
- * The same frame's MCP arms, filled by the SAME rematerialize seam / materialize-time
1142
- * projection and drained by the same intact-survival predicate:
1149
+ * The same frame's MCP arms, filled by the SAME rematerialize seam and drained by the same intact-survival predicate:
1143
1150
  * - `pendingRemoved`: previously-ANNOUNCED tool names that left the live roster (a RefreshMcpTools
1144
1151
  * re-splice whose server withdrew them). CC `removedNames`.
1145
1152
  * - `pendingReadded`: names in `pendingRemoved`'s history that came back on a later refresh. CC
1146
- * `readdedNames`.
1147
- * - `pendingFailed`: declared servers whose connect failed at materialize (`statuses`), name/error
1148
- * neutralized + bounded at intake, MINUS the pairs this session's record already announced (CC
1149
- * `failedMcpServers` compared against the previous attachment — a serving layer runs prepare once
1150
- * per user message, so the per-run set alone re-announced every message). */
1153
+ * `readdedNames`. */
1151
1154
  toolsDeltaRef?: {
1152
1155
  pending: string[];
1153
1156
  pendingRemoved: string[];
1154
1157
  pendingReadded: string[];
1155
- pendingFailed: Array<{
1156
- name: string;
1157
- error?: string;
1158
- }>;
1158
+ };
1159
+ /** The `mcp_unavailable` frame's pending servers: declared servers whose dial failed at materialize (`statuses`), name/error
1160
+ * neutralized + bounded at intake, MINUS the pairs this session's record already announced (a serving layer runs prepare once
1161
+ * per user message, so the per-run set alone would re-announce every message). Present when at least one is pending — a
1162
+ * task whose every MCP tool went missing with its server is exactly the one that must say so. Carried by the leg's first
1163
+ * request (a fresh leg's first message, a resumed leg's continuation) and drained by that message's receipt (`settleMcpUnavailable`). */
1164
+ mcpUnavailable?: {
1165
+ pending: AnnouncedMcpFailure[];
1159
1166
  };
1160
1167
  /** G1 通告层续批 (CC `agent_listing_delta` parity) — the mounted delegation tool's agent-type roster
1161
1168
  * (read off `ToolSpec.agentListing`, filled by createSubagentTool), plus the tool's mounted name for
1162
- * the CC-verbatim headers. [c209-C]: this seam is now the roster's ONLY model-facing carrier —
1169
+ * the roster headers. [c209-C]: this seam is now the roster's ONLY model-facing carrier —
1163
1170
  * the run loop delivers the initial full frame ON THE FIRST USER TURN (prompt-adjacent) and
1164
1171
  * boundary drift deltas after. `models` (Q4, read off `ToolSpec.agentModels`) rides the initial
1165
1172
  * frame's tail line. `seedAnnounced` = a durable-resume leg: the run loop seeds the producer's
@@ -1195,7 +1202,7 @@ export interface Prepared {
1195
1202
  * catalog change across a suspend is re-announced as a "Models available…" drift line.
1196
1203
  * `mcpFailed` / `advisories` are the once-per-SESSION arms of the same snapshot (see
1197
1204
  * announce-once-ledger.ts): seeded at prepare from the branch's record, advanced by the run loop
1198
- * on intact delivery of the tools_delta `failedServers` arm / the mcp_dropped_tools frame. */
1205
+ * on delivery of the mcp_unavailable frame / intact delivery of the mcp_dropped_tools frame. */
1199
1206
  announcedListingsRef: AnnouncedListingSnapshotInput;
1200
1207
  /** The frame-receipt ledger — the ONE commit point of every engine frame that rides a user message
1201
1208
  * (the git-status frame, the agent and skills listing frames). Always present; per leg. */
@@ -1208,10 +1215,11 @@ export interface Prepared {
1208
1215
  gitStatusRef: GitStatusLaneRef;
1209
1216
  /** The posture composition's run-local half (the newest carrier's protection slot; the row last composed for). */
1210
1217
  postureFrameRef: import("../auto-mode-directive.js").PostureFrameRef;
1211
- /** G1 通告层 — narrow post-compact getter over the process task registry: THIS run's visible
1212
- * pending/running background tasks (same owner/scope/session identity the TaskOutput/TaskStop tools
1213
- * use), as a bounded display projection (id/description/status — never handles/env/abort). Called by
1214
- * the run loop ONLY when `spec.attachments.backgroundTasks` opted in AND a compaction just landed. */
1218
+ /** G1 通告层 — narrow getter over the process task registry: THIS run's visible live background tasks
1219
+ * (pending / running / parked under the same owner/scope/session identity the TaskOutput/TaskStop tools
1220
+ * use), EVERY one (`TaskRegistry.liveTasks`), as a projection (id/description/status — never
1221
+ * handles/env/abort). Read by the post-compact listing (which caps what it renders), the resume's orphan
1222
+ * diff and the stop hook's `backgroundTasks` view. */
1215
1223
  listBackgroundTasks: () => Array<{
1216
1224
  id: string;
1217
1225
  description?: string;
@@ -1581,8 +1589,6 @@ export interface PromptFeatureFlags {
1581
1589
  writeFaceOpen: boolean;
1582
1590
  orchestrationEnabled: boolean;
1583
1591
  orchestrationDeferred: boolean;
1584
- promptProfile: "simple" | "classic";
1585
- fableMitigations: boolean;
1586
1592
  goalEnabled: boolean;
1587
1593
  awarenessEnabled: boolean;
1588
1594
  worktreeIsolated: boolean;
@@ -1790,6 +1796,10 @@ export interface RunInternals {
1790
1796
  outcome?: ResumeOutcome;
1791
1797
  inheritedGate?: InheritedGate;
1792
1798
  }>;
1799
+ /** The deployment's credential for the claim this run acts under (an opaque grant id; a TRUSTED channel like the decisions above).
1800
+ * A resume handed one carries it into its CAS as `expect.holder` (the store judges it; a superseded grant is
1801
+ * `resume.holder_superseded`, nothing applied), and so does every Workflow drive this run makes. Never inherited by children. */
1802
+ holder?: string;
1793
1803
  /**
1794
1804
  * Set ONLY by the Agent tool's fork route (`Agent(subagent_type:"fork")`, a core caller) on the
1795
1805
  * child it spawns: this run IS a forked child. `prepareTask` threads it to tool ctx as `insideFork` so the
@@ -1839,8 +1849,8 @@ export interface RunInternals {
1839
1849
  * `spec.systemPrompt ?? resolvedRole.systemPrompt ?? internals.defaultSystemPrompt` — so a deployment's
1840
1850
  * `roles.subagent.systemPrompt` / `roles.default.systemPrompt` preset still wins (pre-G1 semantics: an
1841
1851
  * unset child systemPrompt let the role preset apply; G1's first cut put SUBAGENT_PROMPT at spec level
1842
- * and silently shadowed the preset). Only when NO preset resolves does the lean SUBAGENT_PROMPT (CC 198
1843
- * general-purpose persona, pretty.js:419977) replace the full DEFAULT_SYSTEM_PROMPT constitution base.
1852
+ * and silently shadowed the preset). Only when NO preset resolves does the lean SUBAGENT_PROMPT (general-purpose
1853
+ * persona) replace the full DEFAULT_SYSTEM_PROMPT constitution base.
1844
1854
  * TRUSTED run-scoped channel (NOT a {@link TaskSpec} field), mirroring `insideFork`.
1845
1855
  */
1846
1856
  defaultSystemPrompt?: string;
@@ -2044,8 +2054,6 @@ export interface RunInternals {
2044
2054
  parentCenterArtifactDigest?: string;
2045
2055
  /** Publish provenance companion of {@link parentCenterArtifactDigest} (audit only). */
2046
2056
  parentCenterSourceRevision?: string;
2047
- /** R2 双形轴 — parent's resolved prompt profile, inherited unless the child spec overrides. */
2048
- promptProfile?: "simple" | "classic";
2049
2057
  /**
2050
2058
  * An OPT-IN, DISPLAY-ONLY event sink a deployment sets on the TOP run to
2051
2059
  * receive a subagent's live `task_progress` ticks (which otherwise stay in the child's ISOLATED stream). Threaded
@@ -2149,7 +2157,7 @@ export interface RunInternals {
2149
2157
  * Hands THIS run's notification injector back to the SPAWNER once the lane is
2150
2158
  * live (runtask calls it with its wrapped `injectTaskNotification`). The spawner stores it on the
2151
2159
  * child's registry handle so a parent/sibling SendMessage can deliver TO the RUNNING child at its
2152
- * next turn boundary (CC's in-memory `pendingMessages` pedestal, anchors/2.1.212
2160
+ * next turn boundary (the in-memory `pendingMessages` pedestal,
2153
2161
  * messaging-runtime.md §2.5). The injector outlives its run safely: once this lane is over the frame
2154
2162
  * is routed to whatever run the SESSION has live, and only a session with no live run parks it
2155
2163
  * (PendingSessionNotifications) — exactly CC's durable-mailbox posture for an idle teammate (§2.4).
@@ -2529,7 +2537,6 @@ export interface RunState {
2529
2537
  * requested id — surfaced on `turn_end.responseModel`, reset with the rest of the per-turn
2530
2538
  * bookkeeping. Same shape as `turnStopReason`: last-message-wins, absent by default. */
2531
2539
  turnResponseModel: string | undefined;
2532
- lastTurnHadToolCalls: boolean;
2533
2540
  /** B15 三期使能:postToolBatch 的本回合聚集批(每回合边界消费并重置 — 回合语义,故归 turn)。 */
2534
2541
  toolBatch: PostToolBatchCall[];
2535
2542
  };
@@ -0,0 +1,28 @@
1
+ import type { SessionTreeEntry } from "../../internal/harness-types.js";
2
+ import type { DateAnchorRead } from "./contracts.js";
3
+ /** The id of the active branch's latest compaction entry — the segment a fact is recorded for — or `null` before any. */
4
+ export declare function conversationSegmentOf(branch: ReadonlyArray<SessionTreeEntry>): string | null;
5
+ /** The custom-entry kind that carries the session's date anchor (engine-owned; never model-visible). */
6
+ export declare const DATE_ANCHOR_CUSTOM_TYPE = "engine:date-anchor";
7
+ /**
8
+ * Read the session's date anchor off the active branch: the nearest anchor entry NEWER than the nearest
9
+ * compaction, honored only when it was written for that same segment. An anchor written by a leg whose
10
+ * prefix predates a compaction that landed in between therefore reads as absent — the one rule that makes a
11
+ * compaction re-anchor the date. An unreadable branch returns undefined (the leg renders today, writes nothing).
12
+ */
13
+ export declare function readDateAnchor(session: {
14
+ getBranch(): Promise<ReadonlyArray<SessionTreeEntry>>;
15
+ }): Promise<DateAnchorRead | undefined>;
16
+ /**
17
+ * The anchor write a leg owes when it settles, or undefined: owed when prepare found no anchor for the segment
18
+ * (the leg rendered today) or the model has since been told a newer date; never after an unreadable branch.
19
+ * Best-effort — a lost write costs one re-rendered prefix or one repeated reminder next leg, never a wrong date.
20
+ */
21
+ export declare function owedDateAnchor(session: {
22
+ appendCustomEntry(customType: string, data?: unknown): Promise<string>;
23
+ }, seat: {
24
+ legDate: string;
25
+ anchor: DateAnchorRead | undefined;
26
+ } | undefined, state: {
27
+ announcedDate: string;
28
+ } | undefined): (() => Promise<void>) | undefined;
@@ -0,0 +1,42 @@
1
+ export function conversationSegmentOf(branch) {
2
+ for (let i = branch.length - 1; i >= 0; i--)
3
+ if (branch[i].type === "compaction")
4
+ return branch[i].id;
5
+ return null;
6
+ }
7
+ export const DATE_ANCHOR_CUSTOM_TYPE = "engine:date-anchor";
8
+ const ISO_DATE = /^\d{4}-\d{2}-\d{2}$/;
9
+ function normalizeDateAnchor(v) {
10
+ if (typeof v !== "object" || v === null)
11
+ return undefined;
12
+ const { prefixDate, announcedDate, segment } = v;
13
+ if (typeof prefixDate !== "string" || !ISO_DATE.test(prefixDate) || typeof announcedDate !== "string" || !ISO_DATE.test(announcedDate))
14
+ return undefined;
15
+ if (segment !== null && (typeof segment !== "string" || segment.length > 200))
16
+ return undefined;
17
+ return { prefixDate, announcedDate, segment };
18
+ }
19
+ export async function readDateAnchor(session) {
20
+ let branch;
21
+ try {
22
+ branch = await session.getBranch();
23
+ }
24
+ catch {
25
+ return undefined;
26
+ }
27
+ let found;
28
+ for (let i = branch.length - 1; i >= 0 && branch[i].type !== "compaction"; i--) {
29
+ const e = branch[i];
30
+ if (found === undefined && e.type === "custom" && e.customType === DATE_ANCHOR_CUSTOM_TYPE)
31
+ found = normalizeDateAnchor(e.data);
32
+ }
33
+ const segment = conversationSegmentOf(branch);
34
+ return { current: found !== undefined && found.segment === segment ? { prefixDate: found.prefixDate, announcedDate: found.announcedDate } : undefined, segment };
35
+ }
36
+ export function owedDateAnchor(session, seat, state) {
37
+ const read = seat?.anchor;
38
+ if (read === undefined || state === undefined || read.current?.announcedDate === state.announcedDate)
39
+ return undefined;
40
+ const data = { prefixDate: seat.legDate, announcedDate: state.announcedDate, segment: read.segment };
41
+ return () => session.appendCustomEntry(DATE_ANCHOR_CUSTOM_TYPE, data).then(() => undefined, () => undefined);
42
+ }