agentfootprint 9.112.2 → 9.113.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 (261) hide show
  1. package/CHANGELOG.md +296 -0
  2. package/CLAUDE.md +1 -0
  3. package/dist/adapters/observability/audit.js +8 -0
  4. package/dist/adapters/observability/audit.js.map +1 -1
  5. package/dist/adapters/observability/otel.js +44 -2
  6. package/dist/adapters/observability/otel.js.map +1 -1
  7. package/dist/adapters/observability/xray.js +19 -0
  8. package/dist/adapters/observability/xray.js.map +1 -1
  9. package/dist/adapters/types.js.map +1 -1
  10. package/dist/core/Agent.js +11 -1
  11. package/dist/core/Agent.js.map +1 -1
  12. package/dist/core/agent/composeRequest.js +19 -11
  13. package/dist/core/agent/composeRequest.js.map +1 -1
  14. package/dist/core/agent/coverage/absent.js +163 -7
  15. package/dist/core/agent/coverage/absent.js.map +1 -1
  16. package/dist/core/agent/coverage/answer.js +3 -1
  17. package/dist/core/agent/coverage/answer.js.map +1 -1
  18. package/dist/core/agent/coverage/read.js +15 -11
  19. package/dist/core/agent/coverage/read.js.map +1 -1
  20. package/dist/core/agent/findings/ledger.js +27 -5
  21. package/dist/core/agent/findings/ledger.js.map +1 -1
  22. package/dist/core/agent/findings/offer.js +29 -9
  23. package/dist/core/agent/findings/offer.js.map +1 -1
  24. package/dist/core/agent/findings/serve.js +76 -7
  25. package/dist/core/agent/findings/serve.js.map +1 -1
  26. package/dist/core/agent/findings/types.js.map +1 -1
  27. package/dist/core/agent/findings/unsettled.js +276 -0
  28. package/dist/core/agent/findings/unsettled.js.map +1 -0
  29. package/dist/core/agent/stages/callLLM.js +30 -8
  30. package/dist/core/agent/stages/callLLM.js.map +1 -1
  31. package/dist/core/agent/stages/route.js +10 -2
  32. package/dist/core/agent/stages/route.js.map +1 -1
  33. package/dist/core/agent/stages/toolCalls.js +247 -31
  34. package/dist/core/agent/stages/toolCalls.js.map +1 -1
  35. package/dist/core/agent/stages/window.js +5 -2
  36. package/dist/core/agent/stages/window.js.map +1 -1
  37. package/dist/core/agent/toolResultCap.js +0 -0
  38. package/dist/core/agent/toolResultCap.js.map +1 -1
  39. package/dist/core/agent/window/ledgerFactPins.js +13 -2
  40. package/dist/core/agent/window/ledgerFactPins.js.map +1 -1
  41. package/dist/core/agent/window/toolNames.js +17 -2
  42. package/dist/core/agent/window/toolNames.js.map +1 -1
  43. package/dist/core/checkin.js +5 -1
  44. package/dist/core/checkin.js.map +1 -1
  45. package/dist/core/runCheckpoint.js +26 -2
  46. package/dist/core/runCheckpoint.js.map +1 -1
  47. package/dist/esm/adapters/observability/audit.d.ts +8 -0
  48. package/dist/esm/adapters/observability/audit.js +8 -0
  49. package/dist/esm/adapters/observability/audit.js.map +1 -1
  50. package/dist/esm/adapters/observability/otel.d.ts +17 -2
  51. package/dist/esm/adapters/observability/otel.js +44 -2
  52. package/dist/esm/adapters/observability/otel.js.map +1 -1
  53. package/dist/esm/adapters/observability/xray.d.ts +8 -0
  54. package/dist/esm/adapters/observability/xray.js +19 -0
  55. package/dist/esm/adapters/observability/xray.js.map +1 -1
  56. package/dist/esm/adapters/types.d.ts +49 -0
  57. package/dist/esm/adapters/types.js.map +1 -1
  58. package/dist/esm/core/Agent.js +11 -1
  59. package/dist/esm/core/Agent.js.map +1 -1
  60. package/dist/esm/core/agent/composeRequest.d.ts +10 -7
  61. package/dist/esm/core/agent/composeRequest.js +19 -11
  62. package/dist/esm/core/agent/composeRequest.js.map +1 -1
  63. package/dist/esm/core/agent/coverage/absent.d.ts +31 -4
  64. package/dist/esm/core/agent/coverage/absent.js +160 -6
  65. package/dist/esm/core/agent/coverage/absent.js.map +1 -1
  66. package/dist/esm/core/agent/coverage/answer.js +3 -1
  67. package/dist/esm/core/agent/coverage/answer.js.map +1 -1
  68. package/dist/esm/core/agent/coverage/index.d.ts +1 -1
  69. package/dist/esm/core/agent/coverage/read.d.ts +9 -1
  70. package/dist/esm/core/agent/coverage/read.js +16 -12
  71. package/dist/esm/core/agent/coverage/read.js.map +1 -1
  72. package/dist/esm/core/agent/coverage/types.d.ts +42 -0
  73. package/dist/esm/core/agent/findings/ledger.d.ts +23 -6
  74. package/dist/esm/core/agent/findings/ledger.js +27 -5
  75. package/dist/esm/core/agent/findings/ledger.js.map +1 -1
  76. package/dist/esm/core/agent/findings/offer.d.ts +23 -6
  77. package/dist/esm/core/agent/findings/offer.js +27 -8
  78. package/dist/esm/core/agent/findings/offer.js.map +1 -1
  79. package/dist/esm/core/agent/findings/serve.d.ts +19 -6
  80. package/dist/esm/core/agent/findings/serve.js +77 -8
  81. package/dist/esm/core/agent/findings/serve.js.map +1 -1
  82. package/dist/esm/core/agent/findings/types.d.ts +81 -1
  83. package/dist/esm/core/agent/findings/types.js.map +1 -1
  84. package/dist/esm/core/agent/findings/unsettled.d.ts +121 -0
  85. package/dist/esm/core/agent/findings/unsettled.js +271 -0
  86. package/dist/esm/core/agent/findings/unsettled.js.map +1 -0
  87. package/dist/esm/core/agent/stages/callLLM.js +30 -8
  88. package/dist/esm/core/agent/stages/callLLM.js.map +1 -1
  89. package/dist/esm/core/agent/stages/route.js +10 -2
  90. package/dist/esm/core/agent/stages/route.js.map +1 -1
  91. package/dist/esm/core/agent/stages/toolCalls.d.ts +90 -2
  92. package/dist/esm/core/agent/stages/toolCalls.js +244 -31
  93. package/dist/esm/core/agent/stages/toolCalls.js.map +1 -1
  94. package/dist/esm/core/agent/stages/window.js +5 -2
  95. package/dist/esm/core/agent/stages/window.js.map +1 -1
  96. package/dist/esm/core/agent/toolResultCap.d.ts +4 -1
  97. package/dist/esm/core/agent/toolResultCap.js +0 -0
  98. package/dist/esm/core/agent/toolResultCap.js.map +1 -1
  99. package/dist/esm/core/agent/types.d.ts +5 -0
  100. package/dist/esm/core/agent/window/ledgerFactPins.d.ts +10 -1
  101. package/dist/esm/core/agent/window/ledgerFactPins.js +13 -2
  102. package/dist/esm/core/agent/window/ledgerFactPins.js.map +1 -1
  103. package/dist/esm/core/agent/window/strategy.d.ts +2 -1
  104. package/dist/esm/core/agent/window/toolNames.d.ts +16 -1
  105. package/dist/esm/core/agent/window/toolNames.js +17 -2
  106. package/dist/esm/core/agent/window/toolNames.js.map +1 -1
  107. package/dist/esm/core/checkin.js +5 -1
  108. package/dist/esm/core/checkin.js.map +1 -1
  109. package/dist/esm/core/runCheckpoint.js +26 -2
  110. package/dist/esm/core/runCheckpoint.js.map +1 -1
  111. package/dist/esm/events/payloads.d.ts +76 -1
  112. package/dist/esm/index.d.ts +2 -2
  113. package/dist/esm/index.js.map +1 -1
  114. package/dist/esm/lib/bug-report/transcript.d.ts +5 -0
  115. package/dist/esm/lib/bug-report/transcript.js +1 -0
  116. package/dist/esm/lib/bug-report/transcript.js.map +1 -1
  117. package/dist/esm/lib/semantics/projection.js +1 -0
  118. package/dist/esm/lib/semantics/projection.js.map +1 -1
  119. package/dist/esm/lib/time-travel/receipt.d.ts +4 -3
  120. package/dist/esm/lib/time-travel/receipt.js +4 -3
  121. package/dist/esm/lib/time-travel/receipt.js.map +1 -1
  122. package/dist/esm/lib/time-travel/servedView.js +13 -9
  123. package/dist/esm/lib/time-travel/servedView.js.map +1 -1
  124. package/dist/esm/lib/trace-toolpack/traceToolpack.js +130 -17
  125. package/dist/esm/lib/trace-toolpack/traceToolpack.js.map +1 -1
  126. package/dist/esm/memory/causal/evidenceRecorder.d.ts +2 -0
  127. package/dist/esm/memory/causal/evidenceRecorder.js +13 -0
  128. package/dist/esm/memory/causal/evidenceRecorder.js.map +1 -1
  129. package/dist/esm/recorders/observability/AgentThinkingTraceRecorder.d.ts +2 -0
  130. package/dist/esm/recorders/observability/AgentThinkingTraceRecorder.js +11 -0
  131. package/dist/esm/recorders/observability/AgentThinkingTraceRecorder.js.map +1 -1
  132. package/dist/esm/recorders/observability/BoundaryRecorder.d.ts +10 -1
  133. package/dist/esm/recorders/observability/BoundaryRecorder.js +9 -1
  134. package/dist/esm/recorders/observability/BoundaryRecorder.js.map +1 -1
  135. package/dist/esm/recorders/observability/FlowchartRecorder.d.ts +4 -1
  136. package/dist/esm/recorders/observability/FlowchartRecorder.js +13 -1
  137. package/dist/esm/recorders/observability/FlowchartRecorder.js.map +1 -1
  138. package/dist/esm/recorders/observability/LiveStateRecorder.d.ts +2 -0
  139. package/dist/esm/recorders/observability/LiveStateRecorder.js +9 -0
  140. package/dist/esm/recorders/observability/LiveStateRecorder.js.map +1 -1
  141. package/dist/esm/recorders/observability/RouteRecorder.js +5 -0
  142. package/dist/esm/recorders/observability/RouteRecorder.js.map +1 -1
  143. package/dist/esm/recorders/observability/StatusRecorder.js +7 -0
  144. package/dist/esm/recorders/observability/StatusRecorder.js.map +1 -1
  145. package/dist/esm/recorders/observability/ToolChoiceRecorder.js +5 -0
  146. package/dist/esm/recorders/observability/ToolChoiceRecorder.js.map +1 -1
  147. package/dist/esm/recorders/observability/commentary/commentaryTemplates.js +18 -2
  148. package/dist/esm/recorders/observability/commentary/commentaryTemplates.js.map +1 -1
  149. package/dist/esm/recorders/observability/status/statusTemplates.js +5 -0
  150. package/dist/esm/recorders/observability/status/statusTemplates.js.map +1 -1
  151. package/dist/esm/security/extractSequence.d.ts +36 -5
  152. package/dist/esm/security/extractSequence.js +99 -26
  153. package/dist/esm/security/extractSequence.js.map +1 -1
  154. package/dist/index.js.map +1 -1
  155. package/dist/lib/bug-report/transcript.js +1 -0
  156. package/dist/lib/bug-report/transcript.js.map +1 -1
  157. package/dist/lib/semantics/projection.js +1 -0
  158. package/dist/lib/semantics/projection.js.map +1 -1
  159. package/dist/lib/time-travel/receipt.js +4 -3
  160. package/dist/lib/time-travel/receipt.js.map +1 -1
  161. package/dist/lib/time-travel/servedView.js +13 -9
  162. package/dist/lib/time-travel/servedView.js.map +1 -1
  163. package/dist/lib/trace-toolpack/traceToolpack.js +130 -17
  164. package/dist/lib/trace-toolpack/traceToolpack.js.map +1 -1
  165. package/dist/memory/causal/evidenceRecorder.js +13 -0
  166. package/dist/memory/causal/evidenceRecorder.js.map +1 -1
  167. package/dist/recorders/observability/AgentThinkingTraceRecorder.js +11 -0
  168. package/dist/recorders/observability/AgentThinkingTraceRecorder.js.map +1 -1
  169. package/dist/recorders/observability/BoundaryRecorder.js +9 -1
  170. package/dist/recorders/observability/BoundaryRecorder.js.map +1 -1
  171. package/dist/recorders/observability/FlowchartRecorder.js +13 -1
  172. package/dist/recorders/observability/FlowchartRecorder.js.map +1 -1
  173. package/dist/recorders/observability/LiveStateRecorder.js +9 -0
  174. package/dist/recorders/observability/LiveStateRecorder.js.map +1 -1
  175. package/dist/recorders/observability/RouteRecorder.js +5 -0
  176. package/dist/recorders/observability/RouteRecorder.js.map +1 -1
  177. package/dist/recorders/observability/StatusRecorder.js +7 -0
  178. package/dist/recorders/observability/StatusRecorder.js.map +1 -1
  179. package/dist/recorders/observability/ToolChoiceRecorder.js +5 -0
  180. package/dist/recorders/observability/ToolChoiceRecorder.js.map +1 -1
  181. package/dist/recorders/observability/commentary/commentaryTemplates.js +18 -2
  182. package/dist/recorders/observability/commentary/commentaryTemplates.js.map +1 -1
  183. package/dist/recorders/observability/status/statusTemplates.js +5 -0
  184. package/dist/recorders/observability/status/statusTemplates.js.map +1 -1
  185. package/dist/security/extractSequence.js +99 -26
  186. package/dist/security/extractSequence.js.map +1 -1
  187. package/dist/types/adapters/observability/audit.d.ts +8 -0
  188. package/dist/types/adapters/observability/audit.d.ts.map +1 -1
  189. package/dist/types/adapters/observability/otel.d.ts +17 -2
  190. package/dist/types/adapters/observability/otel.d.ts.map +1 -1
  191. package/dist/types/adapters/observability/xray.d.ts +8 -0
  192. package/dist/types/adapters/observability/xray.d.ts.map +1 -1
  193. package/dist/types/adapters/types.d.ts +49 -0
  194. package/dist/types/adapters/types.d.ts.map +1 -1
  195. package/dist/types/core/Agent.d.ts.map +1 -1
  196. package/dist/types/core/agent/composeRequest.d.ts +10 -7
  197. package/dist/types/core/agent/composeRequest.d.ts.map +1 -1
  198. package/dist/types/core/agent/coverage/absent.d.ts +31 -4
  199. package/dist/types/core/agent/coverage/absent.d.ts.map +1 -1
  200. package/dist/types/core/agent/coverage/answer.d.ts.map +1 -1
  201. package/dist/types/core/agent/coverage/index.d.ts +1 -1
  202. package/dist/types/core/agent/coverage/index.d.ts.map +1 -1
  203. package/dist/types/core/agent/coverage/read.d.ts +9 -1
  204. package/dist/types/core/agent/coverage/read.d.ts.map +1 -1
  205. package/dist/types/core/agent/coverage/types.d.ts +42 -0
  206. package/dist/types/core/agent/coverage/types.d.ts.map +1 -1
  207. package/dist/types/core/agent/findings/ledger.d.ts +23 -6
  208. package/dist/types/core/agent/findings/ledger.d.ts.map +1 -1
  209. package/dist/types/core/agent/findings/offer.d.ts +23 -6
  210. package/dist/types/core/agent/findings/offer.d.ts.map +1 -1
  211. package/dist/types/core/agent/findings/serve.d.ts +19 -6
  212. package/dist/types/core/agent/findings/serve.d.ts.map +1 -1
  213. package/dist/types/core/agent/findings/types.d.ts +81 -1
  214. package/dist/types/core/agent/findings/types.d.ts.map +1 -1
  215. package/dist/types/core/agent/findings/unsettled.d.ts +122 -0
  216. package/dist/types/core/agent/findings/unsettled.d.ts.map +1 -0
  217. package/dist/types/core/agent/stages/callLLM.d.ts.map +1 -1
  218. package/dist/types/core/agent/stages/route.d.ts.map +1 -1
  219. package/dist/types/core/agent/stages/toolCalls.d.ts +90 -2
  220. package/dist/types/core/agent/stages/toolCalls.d.ts.map +1 -1
  221. package/dist/types/core/agent/stages/window.d.ts.map +1 -1
  222. package/dist/types/core/agent/toolResultCap.d.ts +4 -1
  223. package/dist/types/core/agent/toolResultCap.d.ts.map +1 -1
  224. package/dist/types/core/agent/types.d.ts +5 -0
  225. package/dist/types/core/agent/types.d.ts.map +1 -1
  226. package/dist/types/core/agent/window/ledgerFactPins.d.ts +10 -1
  227. package/dist/types/core/agent/window/ledgerFactPins.d.ts.map +1 -1
  228. package/dist/types/core/agent/window/strategy.d.ts +2 -1
  229. package/dist/types/core/agent/window/strategy.d.ts.map +1 -1
  230. package/dist/types/core/agent/window/toolNames.d.ts +16 -1
  231. package/dist/types/core/agent/window/toolNames.d.ts.map +1 -1
  232. package/dist/types/core/checkin.d.ts.map +1 -1
  233. package/dist/types/core/runCheckpoint.d.ts.map +1 -1
  234. package/dist/types/events/payloads.d.ts +76 -1
  235. package/dist/types/events/payloads.d.ts.map +1 -1
  236. package/dist/types/index.d.ts +2 -2
  237. package/dist/types/index.d.ts.map +1 -1
  238. package/dist/types/lib/bug-report/transcript.d.ts +5 -0
  239. package/dist/types/lib/bug-report/transcript.d.ts.map +1 -1
  240. package/dist/types/lib/semantics/projection.d.ts.map +1 -1
  241. package/dist/types/lib/time-travel/receipt.d.ts +4 -3
  242. package/dist/types/lib/time-travel/receipt.d.ts.map +1 -1
  243. package/dist/types/lib/time-travel/servedView.d.ts.map +1 -1
  244. package/dist/types/lib/trace-toolpack/traceToolpack.d.ts.map +1 -1
  245. package/dist/types/memory/causal/evidenceRecorder.d.ts +2 -0
  246. package/dist/types/memory/causal/evidenceRecorder.d.ts.map +1 -1
  247. package/dist/types/recorders/observability/AgentThinkingTraceRecorder.d.ts +2 -0
  248. package/dist/types/recorders/observability/AgentThinkingTraceRecorder.d.ts.map +1 -1
  249. package/dist/types/recorders/observability/BoundaryRecorder.d.ts +10 -1
  250. package/dist/types/recorders/observability/BoundaryRecorder.d.ts.map +1 -1
  251. package/dist/types/recorders/observability/FlowchartRecorder.d.ts +4 -1
  252. package/dist/types/recorders/observability/FlowchartRecorder.d.ts.map +1 -1
  253. package/dist/types/recorders/observability/LiveStateRecorder.d.ts +2 -0
  254. package/dist/types/recorders/observability/LiveStateRecorder.d.ts.map +1 -1
  255. package/dist/types/recorders/observability/RouteRecorder.d.ts.map +1 -1
  256. package/dist/types/recorders/observability/ToolChoiceRecorder.d.ts.map +1 -1
  257. package/dist/types/recorders/observability/commentary/commentaryTemplates.d.ts.map +1 -1
  258. package/dist/types/recorders/observability/status/statusTemplates.d.ts.map +1 -1
  259. package/dist/types/security/extractSequence.d.ts +36 -5
  260. package/dist/types/security/extractSequence.d.ts.map +1 -1
  261. package/package.json +1 -1
@@ -10,7 +10,10 @@
10
10
  * payload so footprintjs captures a checkpoint.
11
11
  * • `resume` runs after the consumer supplies the human's answer.
12
12
  * Treats that answer as the paused tool's result, appends to
13
- * history, then continues the ReAct iteration loop.
13
+ * history, then continues the ReAct iteration loop. Calls the model
14
+ * batched AFTER the paused one were never dispatched; every resume
15
+ * path settles them with one fixed sentence each, a bracket and a
16
+ * count, and runs none of them ("── The batch settlement (9.113.0)").
14
17
  *
15
18
  * Dispatch resolution order (9.92.0 — DISPATCH FOLLOWS THE OFFER):
16
19
  * 0. A name on THIS epoch's wire resolves to the party whose contract the
@@ -71,7 +74,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
71
74
  return result;
72
75
  };
73
76
  Object.defineProperty(exports, "__esModule", { value: true });
74
- exports.buildToolCallsHandler = exports.composeReadSkillRefusal = exports.unknownToolResult = exports.notServedResult = exports.atMountedCursor = void 0;
77
+ exports.buildToolCallsHandler = exports.producerCorpusOf = exports.notDispatchedResult = exports.pausedBatchOf = exports.composeReadSkillRefusal = exports.unknownToolResult = exports.notServedResult = exports.atMountedCursor = void 0;
75
78
  const codeRunnerTool_js_1 = require("../../codeRunnerTool.js");
76
79
  const footprintjs_1 = require("footprintjs");
77
80
  const types_js_1 = require("../../../adapters/types.js");
@@ -101,6 +104,7 @@ const reserved_js_1 = require("../findings/reserved.js");
101
104
  const offer_js_1 = require("../findings/offer.js");
102
105
  const ledger_js_2 = require("../findings/ledger.js");
103
106
  const contingent_js_1 = require("../findings/contingent.js");
107
+ const unsettled_js_1 = require("../findings/unsettled.js");
104
108
  const evidenceIndex_js_1 = require("../evidence/evidenceIndex.js");
105
109
  const repeatedCall_js_1 = require("../repeatedCall.js");
106
110
  const toolArgsValidation_js_1 = require("../toolArgsValidation.js");
@@ -478,6 +482,130 @@ function argsForPausedCall(scope, toolCallId, peel = false) {
478
482
  function appendBatchResult(scope, entry) {
479
483
  scope.toolResults = [...(scope.toolResults ?? []), entry];
480
484
  }
485
+ /**
486
+ * THE PAUSED BATCH (9.113.0) — the turn that proposed the paused call, and
487
+ * the calls on it that a pause left un-dispatched.
488
+ *
489
+ * The batch loop in `execute` dispatches a turn's calls one at a time, in the
490
+ * order the model proposed them, and every pause RETURNS from inside it: the
491
+ * checkpoint is taken on call k, and calls k+1..N were never reached — no
492
+ * gate judged them, no tool ran, no bracket opened. The resume paths used to
493
+ * answer call k and stop, so the next request carried N `tool_use` blocks and
494
+ * fewer `tool_result`s (a provider builds results only from `role: 'tool'`
495
+ * messages), and `iteration_end` counted one call.
496
+ *
497
+ * READ FROM `history`, NEVER CARRIED. Every pause site commits
498
+ * `scope.history = newHistory` before it returns, so the assistant turn that
499
+ * proposed the batch is on the checkpoint — and it is the very message a
500
+ * provider turns into the `tool_use` blocks the settlement must answer. It is
501
+ * therefore the one owner of "which calls does the next request carry", and
502
+ * the checkpoint gains no key: a checkpoint written before this release
503
+ * settles the same way. The window never removes the turn holding the paused
504
+ * call (`../window/turns.ts` · `refusalFor`, its `paused-tool` arm).
505
+ *
506
+ * The LATEST turn proposing the id is the paused one — the pause site commits
507
+ * that turn last, and a provider may reuse an id across turns. No such turn:
508
+ * `size: 0` and nothing to settle, the only answer a missing turn supports.
509
+ *
510
+ * A call after the paused one that history ALREADY answers — a `role: 'tool'`
511
+ * message for its id after that turn — is not un-dispatched, whoever wrote
512
+ * the answer. No library door writes one before the resume; a checkpoint is
513
+ * data, though, and an app may have patched results into a stored one.
514
+ * Settling such a call again would put a second result for its id on the
515
+ * next request, a shape a provider rejects.
516
+ */
517
+ function pausedBatchOf(history, pausedToolCallId) {
518
+ for (let i = history.length - 1; i >= 0; i--) {
519
+ const message = history[i];
520
+ if (message?.role !== 'assistant')
521
+ continue;
522
+ const proposed = message.toolCalls ?? [];
523
+ const at = proposed.findIndex((call) => call.id === pausedToolCallId);
524
+ if (at < 0)
525
+ continue;
526
+ const answered = new Set(history.slice(i + 1).flatMap((m) => (m.role === 'tool' ? [m.toolCallId] : [])));
527
+ return {
528
+ size: proposed.length,
529
+ undispatched: proposed.slice(at + 1).filter((call) => !answered.has(call.id)),
530
+ };
531
+ }
532
+ return { size: 0, undispatched: [] };
533
+ }
534
+ exports.pausedBatchOf = pausedBatchOf;
535
+ // LENS · tool-result · persistent-history
536
+ // reads: toolName ← the un-dispatched call on the paused turn (`pausedBatchOf`); paused ← scope.pausedToolName + scope.pausedToolCallId, the checkpoint's own carriers
537
+ // law: may omit, never deny; every clause anchored to the call it was composed on; names no destination.
538
+ /**
539
+ * What a call the paused batch never dispatched gets back (9.113.0) — ONE
540
+ * fixed sentence, on all four resume paths.
541
+ *
542
+ * Every clause is a past fact about one finished event, anchored by name: the
543
+ * call this result answers ("that call"), the call the run paused on (by id
544
+ * and by tool), and the resume. It names no destination. The design page's draft
545
+ * (`docs/design/2026-09-honest-answer-ledger.md`, § 5.5, "The batch
546
+ * settlement") ended "propose it again if still needed" — an instruction about a LATER call,
547
+ * re-read on every call after this one, the tool-less wrap-up included.
548
+ * Whether the call is still needed is the model's to judge from the facts;
549
+ * the surfaces recomposed per request (the tool list, the system prompt) own
550
+ * the present tense. Precedents: the 9.86.1 resumed-call refusal in this file
551
+ * ("was not executed on that call, and the resumed dispatch had no second
552
+ * checkpoint…") and `../selfCallNotice.ts` · `selfCallNotice`.
553
+ *
554
+ * "The run paused ON call …", never "call … paused the run": on two of the
555
+ * four doors the pause was a gate's, not the call's — a middleware's `ask`, a
556
+ * credential's consent need — and on all four the run paused AT that call.
557
+ *
558
+ * The sentence is for the MODEL. The same fact as data rides the settled
559
+ * message as `LLMMessage.notDispatched` and both of its brackets as
560
+ * `notDispatched` (`notDispatchedMarker`), and a reader asking "did this call
561
+ * run?" reads that — never this text.
562
+ *
563
+ * Exported for the producer registry (`test/modelFacingSurfaces.test.ts`).
564
+ */
565
+ function notDispatchedResult(toolName, paused) {
566
+ return (`Tool '${toolName}' was not executed on that call: the run paused on call ` +
567
+ `'${paused.toolCallId}' to '${paused.toolName}', earlier in the same batch, and resumed ` +
568
+ `without executing the calls that followed it in that batch.`);
569
+ }
570
+ exports.notDispatchedResult = notDispatchedResult;
571
+ /**
572
+ * The same fact as DATA (9.113.0) — the ONE composer of the settlement's
573
+ * marker, `{ pausedCall: { toolCallId, toolName } }`. The settled call's
574
+ * history message (`LLMMessage.notDispatched`) and both of its brackets
575
+ * (`ToolStartPayload.notDispatched`, `ToolEndPayload.notDispatched`) each take
576
+ * a fresh copy from here, so the three carriers can never disagree and no
577
+ * reader holds an object another reader holds.
578
+ */
579
+ function notDispatchedMarker(paused) {
580
+ return { pausedCall: { toolCallId: paused.toolCallId, toolName: paused.toolName } };
581
+ }
582
+ /**
583
+ * The empty-lookup check's PRODUCER CORPUS (9.77.0) — every `role: 'tool'`
584
+ * RESULT in `history` from a tool the judged one names in `argumentsFrom`,
585
+ * as the run served it. The caller hands the history the judged call was
586
+ * served (the call itself is pushed after it), so a producer called earlier in
587
+ * the same batch is already in it — which is right: the model can only have
588
+ * taken a value from a result it had already been served.
589
+ *
590
+ * A message the batch settlement wrote (9.113.0) is no result: its ground
591
+ * never ran, so it produced nothing to take a value from. Read off the marker
592
+ * (`../findings/offer.ts` · `isResultMessage`), never the sentence.
593
+ *
594
+ * Exported for its unit test (`test/integrity/emptyLookup.test.ts`).
595
+ */
596
+ function producerCorpusOf(history, argumentsFrom) {
597
+ const produced = [];
598
+ for (const message of history) {
599
+ if (!(0, offer_js_1.isResultMessage)(message))
600
+ continue;
601
+ const name = message.toolName;
602
+ if (typeof name !== 'string' || !argumentsFrom.includes(name))
603
+ continue;
604
+ produced.push({ toolName: name, text: message.content });
605
+ }
606
+ return produced;
607
+ }
608
+ exports.producerCorpusOf = producerCorpusOf;
481
609
  /**
482
610
  * The judge's turn on ONE landed result (9.104.0) — called at the five
483
611
  * places a result joins the batch (the execute loop and the four resume
@@ -740,6 +868,13 @@ function buildToolCallsHandler(deps) {
740
868
  checked,
741
869
  ...(notChecked.length > 0 && { notChecked }),
742
870
  ...(cannotCover.length > 0 && { cannotCover }),
871
+ // The suggestion, as declared (9.113.0): the sentence, and the
872
+ // typed tool as a copy (`tryInsteadToolOfAbsence`). The EVENT only:
873
+ // it is advice about a call not yet made, not ground the answer
874
+ // stands on, so the tracked row below and the block composed from
875
+ // it never carry it.
876
+ ...(facts.tryInstead !== undefined && { tryInstead: facts.tryInstead }),
877
+ ...(facts.tryInsteadTool !== undefined && { tryInsteadTool: facts.tryInsteadTool }),
743
878
  });
744
879
  }
745
880
  else {
@@ -807,20 +942,9 @@ function buildToolCallsHandler(deps) {
807
942
  ledger?.note('empty-lookup', 'write', 'not-applicable');
808
943
  return;
809
944
  }
810
- // The producer corpus: every earlier `role: 'tool'` message from a tool
811
- // THIS tool declares as one of its grounds. `history` here excludes the
812
- // call being judged (it is pushed after), and a producer called earlier
813
- // in the same batch is already in it — which is right: the model can only
814
- // have taken a value from a result it had already been served.
815
- const produced = [];
816
- for (const message of history) {
817
- if (message.role !== 'tool')
818
- continue;
819
- const name = message.toolName;
820
- if (typeof name !== 'string' || !argumentsFrom.includes(name))
821
- continue;
822
- produced.push({ toolName: name, text: message.content });
823
- }
945
+ // The producer corpus: the earlier RESULTS from a tool THIS tool declares
946
+ // as one of its grounds — never a settled message (`producerCorpusOf`).
947
+ const produced = producerCorpusOf(history, argumentsFrom);
824
948
  const { findings, disposition } = (0, check_js_1.emptyLookupOf)({
825
949
  toolName: call.toolName,
826
950
  toolCallId: call.toolCallId,
@@ -2029,6 +2153,68 @@ function buildToolCallsHandler(deps) {
2029
2153
  (0, ledger_js_1.recordDecisions)(scope, verdict.decisions);
2030
2154
  return verdict.kind === 'deny' ? verdict.reason : verdict.result;
2031
2155
  };
2156
+ const settleBatch = (answered, paused) => {
2157
+ const batch = pausedBatchOf(answered, paused.toolCallId);
2158
+ if (batch.undispatched.length === 0)
2159
+ return { history: answered, settled: [], size: batch.size, paused };
2160
+ const settled = batch.undispatched.map((call) => ({
2161
+ call,
2162
+ result: notDispatchedResult(call.name, paused),
2163
+ }));
2164
+ return {
2165
+ history: [
2166
+ ...answered,
2167
+ ...settled.map(({ call, result }) => ({
2168
+ role: 'tool',
2169
+ content: result,
2170
+ toolCallId: call.id,
2171
+ toolName: call.name,
2172
+ notDispatched: notDispatchedMarker(paused),
2173
+ })),
2174
+ ],
2175
+ settled,
2176
+ size: batch.size,
2177
+ paused,
2178
+ };
2179
+ };
2180
+ /**
2181
+ * Each settled sibling's bracket, after the paused call's own `tool_end` —
2182
+ * the ONE site that stamps `notDispatched` on the stream: `tool_start` with
2183
+ * the args the call would have run with (the batch loop's peel, so
2184
+ * `_findings` never shows on a bracket), then `tool_end` carrying the
2185
+ * sentence and `durationMs: 0`. Both carry the marker the history message
2186
+ * carries (`notDispatchedMarker`), and no other bracket in the library ever
2187
+ * does.
2188
+ *
2189
+ * No `error`. It says a call FAILED — the tool threw, or the call itself
2190
+ * could not run as written (an args rejection, a `wants` block, a consent
2191
+ * the tool needed and did not get, an unknown name). A settled call did not
2192
+ * fail: the library decided not to dispatch it, as it does for a call a
2193
+ * permission policy denies or halts, and those brackets carry no `error`
2194
+ * either. Stamped here, it would register a tool failure in every
2195
+ * error-rate reader (a span status, a dashboard, an alert) on every
2196
+ * mid-batch pause, and say a second, false thing beside the marker, which
2197
+ * is the one owner of why there is no result (`src/core/README.md` · "One
2198
+ * owner of 'never dispatched' — in history and on the stream", the reader
2199
+ * table). No `status` either: that field is the TOOL's own word.
2200
+ */
2201
+ const bracketSettled = (scope, settlement) => {
2202
+ for (const { call, result } of settlement.settled) {
2203
+ (0, typedEmit_js_1.typedEmit)(scope, 'agentfootprint.stream.tool_start', {
2204
+ toolName: call.name,
2205
+ toolCallId: call.id,
2206
+ args: peelCall(call).args,
2207
+ parallelCount: settlement.size,
2208
+ notDispatched: notDispatchedMarker(settlement.paused),
2209
+ });
2210
+ (0, typedEmit_js_1.typedEmit)(scope, 'agentfootprint.stream.tool_end', {
2211
+ toolCallId: call.id,
2212
+ result,
2213
+ durationMs: 0,
2214
+ notDispatched: notDispatchedMarker(settlement.paused),
2215
+ });
2216
+ }
2217
+ };
2032
2218
  // Resolve a tool's declared credential (declare-and-push) and execute it,
2033
2219
  // emitting the same credential.* events as the main loop. Used by the
2034
2220
  // check-in RESUME path when a human APPROVES — the tool never ran at pause
@@ -2354,15 +2540,24 @@ function buildToolCallsHandler(deps) {
2354
2540
  // came from (9.102.0; before, only the last batch resolved and an
2355
2541
  // offered older id filed as `unknownId`). Read through the same
2356
2542
  // per-call peel the loop below applies (a tool that owns the name
2357
- // declares nothing). Gated: unarmed, not one line runs.
2543
+ // declares nothing). A ruled-out standing whose result THIS door
2544
+ // recorded as an absence (`declareCoverage`'s rows on
2545
+ // `coverageDeclared`, never a second reading of a return) AND the
2546
+ // model was served as one (the served string — the door records the
2547
+ // return before the after-tool chain, the ceiling and placement act,
2548
+ // so a denied, refused or ticketed result files nothing) gets its
2549
+ // `unsettled-by-absence` row immediately after it, in the same write,
2550
+ // worded from what was served (9.113.0, `findings/unsettled.ts`; the
2551
+ // key is read only for such a standing); the standing rows pass
2552
+ // through untouched. Gated: unarmed, not one line runs.
2358
2553
  if (deps.findings === true) {
2359
2554
  const known = (0, offer_js_1.knownResults)([...(scope.history ?? [])], [...(scope.toolResults ?? [])]);
2360
- (0, ledger_js_2.recordFindings)(scope, toolCalls.flatMap((tc) => {
2555
+ (0, ledger_js_2.recordFindings)(scope, (0, unsettled_js_1.withUnsettledRows)(toolCalls.flatMap((tc) => {
2361
2556
  const declared = peelCall(tc).findings;
2362
2557
  return declared?.previous !== undefined
2363
2558
  ? (0, ledger_js_2.standingRowsFrom)(known, declared, { toolCallId: tc.id }, iteration)
2364
2559
  : [];
2365
- }));
2560
+ }), known, () => [...(scope.coverageDeclared ?? [])]));
2366
2561
  }
2367
2562
  scope.toolResults = [];
2368
2563
  // ── THE TOWERS AT DISPATCH (9.110.0) — one corpus per batch ────────
@@ -3934,10 +4129,13 @@ function buildToolCallsHandler(deps) {
3934
4129
  askResultStr += applyToolEffects(scope, { toolName, toolCallId, iteration }, resumeEnvelope, askTransition);
3935
4130
  emitTransitionConflict(scope, iteration, askTransition);
3936
4131
  }
3937
- const askHistory = [
4132
+ // The batch settlement (9.113.0): the answered call's result, then the
4133
+ // siblings the pause left un-dispatched, each settled — never run.
4134
+ const askSettlement = settleBatch([
3938
4135
  ...scope.history,
3939
4136
  { role: 'tool', content: askResultStr, toolCallId, toolName },
3940
- ];
4137
+ ], { toolName, toolCallId });
4138
+ const askHistory = askSettlement.history;
3941
4139
  scope.history = askHistory;
3942
4140
  scope.lastToolResult = {
3943
4141
  toolName,
@@ -3958,10 +4156,14 @@ function buildToolCallsHandler(deps) {
3958
4156
  ...(error === true && { error: true }),
3959
4157
  ...(resumeEnvelope?.status !== undefined && { status: resumeEnvelope.status }),
3960
4158
  });
4159
+ bracketSettled(scope, askSettlement);
3961
4160
  (0, typedEmit_js_1.typedEmit)(scope, 'agentfootprint.agent.iteration_end', {
3962
4161
  turnIndex: 0,
3963
4162
  iterIndex: iteration,
3964
- toolCallCount: 1,
4163
+ // The brackets THIS leg closed: the answered call's, plus one per
4164
+ // settled sibling. The calls before the paused one closed theirs on
4165
+ // the leg that paused, which ended in a checkpoint, not here.
4166
+ toolCallCount: 1 + askSettlement.settled.length,
3965
4167
  history: askHistory,
3966
4168
  });
3967
4169
  scope.iteration = iteration + 1;
@@ -4078,10 +4280,12 @@ function buildToolCallsHandler(deps) {
4078
4280
  decisionResultStr += applyToolEffects(scope, { toolName, toolCallId, iteration }, resumeEnvelope, decisionTransition);
4079
4281
  emitTransitionConflict(scope, iteration, decisionTransition);
4080
4282
  }
4081
- const decisionHistory = [
4283
+ // The batch settlement (9.113.0) — the ask path's twin.
4284
+ const decisionSettlement = settleBatch([
4082
4285
  ...scope.history,
4083
4286
  { role: 'tool', content: decisionResultStr, toolCallId, toolName },
4084
- ];
4287
+ ], { toolName, toolCallId });
4288
+ const decisionHistory = decisionSettlement.history;
4085
4289
  scope.history = decisionHistory;
4086
4290
  // Drives `on-tool-return` triggers, same as the execute path.
4087
4291
  scope.lastToolResult = {
@@ -4103,10 +4307,12 @@ function buildToolCallsHandler(deps) {
4103
4307
  ...(error === true && { error: true }),
4104
4308
  ...(resumeEnvelope?.status !== undefined && { status: resumeEnvelope.status }),
4105
4309
  });
4310
+ bracketSettled(scope, decisionSettlement);
4106
4311
  (0, typedEmit_js_1.typedEmit)(scope, 'agentfootprint.agent.iteration_end', {
4107
4312
  turnIndex: 0,
4108
4313
  iterIndex: iteration,
4109
- toolCallCount: 1,
4314
+ // The brackets this leg closed — see the ask path's twin.
4315
+ toolCallCount: 1 + decisionSettlement.settled.length,
4110
4316
  history: decisionHistory,
4111
4317
  });
4112
4318
  scope.iteration = iteration + 1;
@@ -4188,10 +4394,12 @@ function buildToolCallsHandler(deps) {
4188
4394
  consentResultStr += applyToolEffects(scope, { toolName, toolCallId, iteration }, consentEnvelope, consentTransition);
4189
4395
  emitTransitionConflict(scope, iteration, consentTransition);
4190
4396
  }
4191
- const consentHistory = [
4397
+ // The batch settlement (9.113.0) — the ask path's twin.
4398
+ const consentSettlement = settleBatch([
4192
4399
  ...scope.history,
4193
4400
  { role: 'tool', content: consentResultStr, toolCallId, toolName },
4194
- ];
4401
+ ], { toolName, toolCallId });
4402
+ const consentHistory = consentSettlement.history;
4195
4403
  scope.history = consentHistory;
4196
4404
  scope.lastToolResult = {
4197
4405
  toolName,
@@ -4212,10 +4420,12 @@ function buildToolCallsHandler(deps) {
4212
4420
  ...(error === true && { error: true }),
4213
4421
  ...(consentEnvelope?.status !== undefined && { status: consentEnvelope.status }),
4214
4422
  });
4423
+ bracketSettled(scope, consentSettlement);
4215
4424
  (0, typedEmit_js_1.typedEmit)(scope, 'agentfootprint.agent.iteration_end', {
4216
4425
  turnIndex: 0,
4217
4426
  iterIndex: iteration,
4218
- toolCallCount: 1,
4427
+ // The brackets this leg closed — see the ask path's twin.
4428
+ toolCallCount: 1 + consentSettlement.settled.length,
4219
4429
  history: consentHistory,
4220
4430
  });
4221
4431
  scope.iteration = iteration + 1;
@@ -4293,7 +4503,10 @@ function buildToolCallsHandler(deps) {
4293
4503
  if (deps.stepPlanFor) {
4294
4504
  resultStr += applyStepReturn(scope, { toolName, toolCallId, iteration });
4295
4505
  }
4296
- const newHistory = [
4506
+ // The batch settlement (9.113.0) — the door a `requestInput` answer
4507
+ // comes back through, and the one most likely to meet a batch: a tool
4508
+ // that asks a person mid-lookup, batched with the lookups after it.
4509
+ const pauseSettlement = settleBatch([
4297
4510
  ...scope.history,
4298
4511
  {
4299
4512
  role: 'tool',
@@ -4301,7 +4514,8 @@ function buildToolCallsHandler(deps) {
4301
4514
  toolCallId,
4302
4515
  toolName,
4303
4516
  },
4304
- ];
4517
+ ], { toolName, toolCallId });
4518
+ const newHistory = pauseSettlement.history;
4305
4519
  scope.history = newHistory;
4306
4520
  // Drives `on-tool-return` triggers, same as every other dispatch path.
4307
4521
  scope.lastToolResult = { toolName, result: resultStr };
@@ -4317,10 +4531,12 @@ function buildToolCallsHandler(deps) {
4317
4531
  result: pauseCapped.result,
4318
4532
  durationMs: Date.now() - startMs,
4319
4533
  });
4534
+ bracketSettled(scope, pauseSettlement);
4320
4535
  (0, typedEmit_js_1.typedEmit)(scope, 'agentfootprint.agent.iteration_end', {
4321
4536
  turnIndex: 0,
4322
4537
  iterIndex: iteration,
4323
- toolCallCount: 1,
4538
+ // The brackets this leg closed — see the ask path's twin.
4539
+ toolCallCount: 1 + pauseSettlement.settled.length,
4324
4540
  // Plain local array — see the matching note on the execute path.
4325
4541
  history: newHistory,
4326
4542
  });