agentfootprint 10.9.0 → 11.0.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 (1100) hide show
  1. package/AGENTS.md +14 -4
  2. package/CAPABILITIES.md +16 -3
  3. package/README.md +115 -52
  4. package/ai-instructions/claude-code/SKILL.md +14 -4
  5. package/dist/adapters/hosting/agentCoreA2A.js +4 -0
  6. package/dist/adapters/hosting/agentCoreA2A.js.map +1 -1
  7. package/dist/adapters/hosting/firestoreSessions.js +9 -2
  8. package/dist/adapters/hosting/firestoreSessions.js.map +1 -1
  9. package/dist/adapters/hosting/googleAgentEngine.js +4 -6
  10. package/dist/adapters/hosting/googleAgentEngine.js.map +1 -1
  11. package/dist/adapters/llm/AnthropicProvider.js +4 -0
  12. package/dist/adapters/llm/AnthropicProvider.js.map +1 -1
  13. package/dist/adapters/llm/BrowserAnthropicProvider.js +4 -0
  14. package/dist/adapters/llm/BrowserAnthropicProvider.js.map +1 -1
  15. package/dist/adapters/llm/MockProvider.js +2 -0
  16. package/dist/adapters/llm/MockProvider.js.map +1 -1
  17. package/dist/ag-ui/request.js +27 -2
  18. package/dist/ag-ui/request.js.map +1 -1
  19. package/dist/ag-ui/serializer.js +21 -8
  20. package/dist/ag-ui/serializer.js.map +1 -1
  21. package/dist/answer-account/facts/howSure.js +3 -0
  22. package/dist/answer-account/facts/howSure.js.map +1 -1
  23. package/dist/answer-account/templates.js +4 -1
  24. package/dist/answer-account/templates.js.map +1 -1
  25. package/dist/answer-validation/agentChecks.js +130 -0
  26. package/dist/answer-validation/agentChecks.js.map +1 -0
  27. package/dist/answer-validation/index.js +5 -1
  28. package/dist/answer-validation/index.js.map +1 -1
  29. package/dist/answer-validation/outputSchema.js +8 -1
  30. package/dist/answer-validation/outputSchema.js.map +1 -1
  31. package/dist/answer-validation/types.js +9 -2
  32. package/dist/answer-validation/types.js.map +1 -1
  33. package/dist/answer-validation/validate.js +82 -3
  34. package/dist/answer-validation/validate.js.map +1 -1
  35. package/dist/core/Agent.js +214 -59
  36. package/dist/core/Agent.js.map +1 -1
  37. package/dist/core/RunnerBase.js +4 -0
  38. package/dist/core/RunnerBase.js.map +1 -1
  39. package/dist/core/agent/AgentBuilder.js +139 -33
  40. package/dist/core/agent/AgentBuilder.js.map +1 -1
  41. package/dist/core/agent/arguments/checks.js +1 -1
  42. package/dist/core/agent/arguments/subflow.js +1 -0
  43. package/dist/core/agent/arguments/subflow.js.map +1 -1
  44. package/dist/core/agent/assessment/assess.js +31 -0
  45. package/dist/core/agent/assessment/assess.js.map +1 -1
  46. package/dist/core/agent/assessment/compose.js +3 -0
  47. package/dist/core/agent/assessment/compose.js.map +1 -1
  48. package/dist/core/agent/assessment/reasons.js +19 -1
  49. package/dist/core/agent/assessment/reasons.js.map +1 -1
  50. package/dist/core/agent/buildAgentChart.js +7 -17
  51. package/dist/core/agent/buildAgentChart.js.map +1 -1
  52. package/dist/core/agent/buildDynamicAgentChart.js +18 -15
  53. package/dist/core/agent/buildDynamicAgentChart.js.map +1 -1
  54. package/dist/core/agent/buildToolRegistry.js +13 -0
  55. package/dist/core/agent/buildToolRegistry.js.map +1 -1
  56. package/dist/core/agent/composeRequest.js +19 -1
  57. package/dist/core/agent/composeRequest.js.map +1 -1
  58. package/dist/core/agent/evidence/answerCarriers.js +1 -1
  59. package/dist/core/agent/evidence/answerCarriers.js.map +1 -1
  60. package/dist/core/agent/evidence/evidenceIndex.js +1 -1
  61. package/dist/core/agent/evidence/evidenceIndex.js.map +1 -1
  62. package/dist/core/agent/evidence/extract.js +139 -32
  63. package/dist/core/agent/evidence/extract.js.map +1 -1
  64. package/dist/core/agent/evidence/figures.js +1 -1
  65. package/dist/core/agent/evidence/figures.js.map +1 -1
  66. package/dist/core/agent/evidence/frames.js +3 -1
  67. package/dist/core/agent/evidence/frames.js.map +1 -1
  68. package/dist/core/agent/evidence/gate.js +10 -2
  69. package/dist/core/agent/evidence/gate.js.map +1 -1
  70. package/dist/core/agent/evidence/numericRanges.js +1 -1
  71. package/dist/core/agent/evidence/numericRanges.js.map +1 -1
  72. package/dist/core/agent/evidence/recovery.js +3 -1
  73. package/dist/core/agent/evidence/recovery.js.map +1 -1
  74. package/dist/core/agent/evidence/resultCarries.js +3 -3
  75. package/dist/core/agent/evidence/resultCarries.js.map +1 -1
  76. package/dist/core/agent/findings/context.js +163 -0
  77. package/dist/core/agent/findings/context.js.map +1 -0
  78. package/dist/core/agent/findings/contingent.js +1 -1
  79. package/dist/core/agent/findings/contingent.js.map +1 -1
  80. package/dist/core/agent/findings/instruction.js +26 -0
  81. package/dist/core/agent/findings/instruction.js.map +1 -0
  82. package/dist/core/agent/findings/ledger.js +49 -0
  83. package/dist/core/agent/findings/ledger.js.map +1 -1
  84. package/dist/core/agent/findings/negativeProse.js +53 -0
  85. package/dist/core/agent/findings/negativeProse.js.map +1 -0
  86. package/dist/core/agent/findings/offer.js +9 -57
  87. package/dist/core/agent/findings/offer.js.map +1 -1
  88. package/dist/core/agent/findings/reserved.js +12 -83
  89. package/dist/core/agent/findings/reserved.js.map +1 -1
  90. package/dist/core/agent/findings/types.js +3 -2
  91. package/dist/core/agent/findings/types.js.map +1 -1
  92. package/dist/core/agent/honesty/mounts.js +6 -0
  93. package/dist/core/agent/honesty/mounts.js.map +1 -1
  94. package/dist/core/agent/nativeOutputFormat.js +19 -1
  95. package/dist/core/agent/nativeOutputFormat.js.map +1 -1
  96. package/dist/core/agent/negativeClaims/capture.js +522 -0
  97. package/dist/core/agent/negativeClaims/capture.js.map +1 -0
  98. package/dist/core/agent/negativeClaims/checkpoint.js +83 -0
  99. package/dist/core/agent/negativeClaims/checkpoint.js.map +1 -0
  100. package/dist/core/agent/negativeClaims/config.js +192 -0
  101. package/dist/core/agent/negativeClaims/config.js.map +1 -0
  102. package/dist/core/agent/negativeClaims/delivery.js +249 -0
  103. package/dist/core/agent/negativeClaims/delivery.js.map +1 -0
  104. package/dist/core/agent/negativeClaims/observe.js +38 -0
  105. package/dist/core/agent/negativeClaims/observe.js.map +1 -0
  106. package/dist/core/agent/negativeClaims/prose.js +116 -0
  107. package/dist/core/agent/negativeClaims/prose.js.map +1 -0
  108. package/dist/core/agent/negativeClaims/recheck.js +37 -0
  109. package/dist/core/agent/negativeClaims/recheck.js.map +1 -0
  110. package/dist/core/agent/outputEnforcement.js.map +1 -1
  111. package/dist/core/agent/stages/answerEvidence.js +21 -0
  112. package/dist/core/agent/stages/answerEvidence.js.map +1 -0
  113. package/dist/core/agent/stages/answerValidation.js +112 -4
  114. package/dist/core/agent/stages/answerValidation.js.map +1 -1
  115. package/dist/core/agent/stages/callLLM.js +82 -41
  116. package/dist/core/agent/stages/callLLM.js.map +1 -1
  117. package/dist/core/agent/stages/evidenceRecheck.js +16 -2
  118. package/dist/core/agent/stages/evidenceRecheck.js.map +1 -1
  119. package/dist/core/agent/stages/outputRetry.js +23 -7
  120. package/dist/core/agent/stages/outputRetry.js.map +1 -1
  121. package/dist/core/agent/stages/prepareFinal.js +6 -1
  122. package/dist/core/agent/stages/prepareFinal.js.map +1 -1
  123. package/dist/core/agent/stages/reliabilityExecution.js +3 -0
  124. package/dist/core/agent/stages/reliabilityExecution.js.map +1 -1
  125. package/dist/core/agent/stages/route.js +81 -33
  126. package/dist/core/agent/stages/route.js.map +1 -1
  127. package/dist/core/agent/stages/searchCoverage.js +121 -0
  128. package/dist/core/agent/stages/searchCoverage.js.map +1 -0
  129. package/dist/core/agent/stages/seed.js +19 -21
  130. package/dist/core/agent/stages/seed.js.map +1 -1
  131. package/dist/core/agent/stages/toolCalls.js +699 -76
  132. package/dist/core/agent/stages/toolCalls.js.map +1 -1
  133. package/dist/core/agent/toolChoice/compose.js +1 -0
  134. package/dist/core/agent/toolChoice/compose.js.map +1 -1
  135. package/dist/core/agent/toolChoice/pick.js +2 -0
  136. package/dist/core/agent/toolChoice/pick.js.map +1 -1
  137. package/dist/core/checkin.js +82 -18
  138. package/dist/core/checkin.js.map +1 -1
  139. package/dist/core/consentRequest.js +844 -0
  140. package/dist/core/consentRequest.js.map +1 -0
  141. package/dist/core/pause.js +104 -6
  142. package/dist/core/pause.js.map +1 -1
  143. package/dist/core/runCheckpoint.js +8 -1
  144. package/dist/core/runCheckpoint.js.map +1 -1
  145. package/dist/core/slots/buildToolsSlot.js +4 -24
  146. package/dist/core/slots/buildToolsSlot.js.map +1 -1
  147. package/dist/debug.js +2 -0
  148. package/dist/debug.js.map +1 -1
  149. package/dist/esm/adapters/hosting/agentCoreA2A.js +4 -0
  150. package/dist/esm/adapters/hosting/agentCoreA2A.js.map +1 -1
  151. package/dist/esm/adapters/hosting/firestoreSessions.js +9 -2
  152. package/dist/esm/adapters/hosting/firestoreSessions.js.map +1 -1
  153. package/dist/esm/adapters/hosting/googleAgentEngine.js +4 -6
  154. package/dist/esm/adapters/hosting/googleAgentEngine.js.map +1 -1
  155. package/dist/esm/adapters/llm/AnthropicProvider.d.ts +1 -0
  156. package/dist/esm/adapters/llm/AnthropicProvider.js +5 -1
  157. package/dist/esm/adapters/llm/AnthropicProvider.js.map +1 -1
  158. package/dist/esm/adapters/llm/BrowserAnthropicProvider.d.ts +1 -0
  159. package/dist/esm/adapters/llm/BrowserAnthropicProvider.js +5 -1
  160. package/dist/esm/adapters/llm/BrowserAnthropicProvider.js.map +1 -1
  161. package/dist/esm/adapters/llm/MockProvider.d.ts +2 -0
  162. package/dist/esm/adapters/llm/MockProvider.js +2 -0
  163. package/dist/esm/adapters/llm/MockProvider.js.map +1 -1
  164. package/dist/esm/ag-ui/request.d.ts +4 -1
  165. package/dist/esm/ag-ui/request.js +27 -2
  166. package/dist/esm/ag-ui/request.js.map +1 -1
  167. package/dist/esm/ag-ui/serializer.d.ts +15 -2
  168. package/dist/esm/ag-ui/serializer.js +20 -7
  169. package/dist/esm/ag-ui/serializer.js.map +1 -1
  170. package/dist/esm/answer-account/facts/howSure.js +3 -0
  171. package/dist/esm/answer-account/facts/howSure.js.map +1 -1
  172. package/dist/esm/answer-account/templates.d.ts +4 -1
  173. package/dist/esm/answer-account/templates.js +4 -1
  174. package/dist/esm/answer-account/templates.js.map +1 -1
  175. package/dist/esm/answer-validation/agentChecks.d.ts +75 -0
  176. package/dist/esm/answer-validation/agentChecks.js +125 -0
  177. package/dist/esm/answer-validation/agentChecks.js.map +1 -0
  178. package/dist/esm/answer-validation/index.d.ts +2 -1
  179. package/dist/esm/answer-validation/index.js +1 -0
  180. package/dist/esm/answer-validation/index.js.map +1 -1
  181. package/dist/esm/answer-validation/outputSchema.d.ts +18 -7
  182. package/dist/esm/answer-validation/outputSchema.js +8 -1
  183. package/dist/esm/answer-validation/outputSchema.js.map +1 -1
  184. package/dist/esm/answer-validation/types.d.ts +125 -1
  185. package/dist/esm/answer-validation/types.js +9 -2
  186. package/dist/esm/answer-validation/types.js.map +1 -1
  187. package/dist/esm/answer-validation/validate.d.ts +11 -2
  188. package/dist/esm/answer-validation/validate.js +82 -3
  189. package/dist/esm/answer-validation/validate.js.map +1 -1
  190. package/dist/esm/core/Agent.d.ts +25 -1
  191. package/dist/esm/core/Agent.js +202 -47
  192. package/dist/esm/core/Agent.js.map +1 -1
  193. package/dist/esm/core/RunnerBase.js +4 -0
  194. package/dist/esm/core/RunnerBase.js.map +1 -1
  195. package/dist/esm/core/agent/AgentBuilder.d.ts +43 -12
  196. package/dist/esm/core/agent/AgentBuilder.js +135 -29
  197. package/dist/esm/core/agent/AgentBuilder.js.map +1 -1
  198. package/dist/esm/core/agent/arguments/checks.d.ts +1 -1
  199. package/dist/esm/core/agent/arguments/checks.js +1 -1
  200. package/dist/esm/core/agent/arguments/subflow.d.ts +6 -0
  201. package/dist/esm/core/agent/arguments/subflow.js +1 -0
  202. package/dist/esm/core/agent/arguments/subflow.js.map +1 -1
  203. package/dist/esm/core/agent/assessment/assess.js +31 -0
  204. package/dist/esm/core/agent/assessment/assess.js.map +1 -1
  205. package/dist/esm/core/agent/assessment/compose.js +3 -0
  206. package/dist/esm/core/agent/assessment/compose.js.map +1 -1
  207. package/dist/esm/core/agent/assessment/reasons.js +19 -1
  208. package/dist/esm/core/agent/assessment/reasons.js.map +1 -1
  209. package/dist/esm/core/agent/assessment/types.d.ts +3 -2
  210. package/dist/esm/core/agent/buildAgentChart.d.ts +4 -12
  211. package/dist/esm/core/agent/buildAgentChart.js +7 -17
  212. package/dist/esm/core/agent/buildAgentChart.js.map +1 -1
  213. package/dist/esm/core/agent/buildDynamicAgentChart.js +18 -15
  214. package/dist/esm/core/agent/buildDynamicAgentChart.js.map +1 -1
  215. package/dist/esm/core/agent/buildToolRegistry.js +13 -0
  216. package/dist/esm/core/agent/buildToolRegistry.js.map +1 -1
  217. package/dist/esm/core/agent/composeRequest.d.ts +19 -0
  218. package/dist/esm/core/agent/composeRequest.js +17 -0
  219. package/dist/esm/core/agent/composeRequest.js.map +1 -1
  220. package/dist/esm/core/agent/evidence/answerCarriers.js +1 -1
  221. package/dist/esm/core/agent/evidence/answerCarriers.js.map +1 -1
  222. package/dist/esm/core/agent/evidence/evidenceIndex.js +1 -1
  223. package/dist/esm/core/agent/evidence/evidenceIndex.js.map +1 -1
  224. package/dist/esm/core/agent/evidence/extract.d.ts +45 -6
  225. package/dist/esm/core/agent/evidence/extract.js +136 -30
  226. package/dist/esm/core/agent/evidence/extract.js.map +1 -1
  227. package/dist/esm/core/agent/evidence/figures.js +1 -1
  228. package/dist/esm/core/agent/evidence/figures.js.map +1 -1
  229. package/dist/esm/core/agent/evidence/frames.js +4 -2
  230. package/dist/esm/core/agent/evidence/frames.js.map +1 -1
  231. package/dist/esm/core/agent/evidence/gate.d.ts +6 -0
  232. package/dist/esm/core/agent/evidence/gate.js +11 -3
  233. package/dist/esm/core/agent/evidence/gate.js.map +1 -1
  234. package/dist/esm/core/agent/evidence/numericRanges.js +1 -1
  235. package/dist/esm/core/agent/evidence/numericRanges.js.map +1 -1
  236. package/dist/esm/core/agent/evidence/recovery.d.ts +2 -0
  237. package/dist/esm/core/agent/evidence/recovery.js +3 -1
  238. package/dist/esm/core/agent/evidence/recovery.js.map +1 -1
  239. package/dist/esm/core/agent/evidence/resultCarries.d.ts +2 -2
  240. package/dist/esm/core/agent/evidence/resultCarries.js +3 -3
  241. package/dist/esm/core/agent/evidence/resultCarries.js.map +1 -1
  242. package/dist/esm/core/agent/evidence/types.d.ts +17 -0
  243. package/dist/esm/core/agent/findings/context.d.ts +13 -0
  244. package/dist/esm/core/agent/findings/context.js +158 -0
  245. package/dist/esm/core/agent/findings/context.js.map +1 -0
  246. package/dist/esm/core/agent/findings/contingent.js +1 -1
  247. package/dist/esm/core/agent/findings/contingent.js.map +1 -1
  248. package/dist/esm/core/agent/findings/instruction.d.ts +12 -0
  249. package/dist/esm/core/agent/findings/instruction.js +22 -0
  250. package/dist/esm/core/agent/findings/instruction.js.map +1 -0
  251. package/dist/esm/core/agent/findings/ledger.d.ts +3 -0
  252. package/dist/esm/core/agent/findings/ledger.js +49 -0
  253. package/dist/esm/core/agent/findings/ledger.js.map +1 -1
  254. package/dist/esm/core/agent/findings/negativeProse.d.ts +1 -0
  255. package/dist/esm/core/agent/findings/negativeProse.js +49 -0
  256. package/dist/esm/core/agent/findings/negativeProse.js.map +1 -0
  257. package/dist/esm/core/agent/findings/offer.d.ts +9 -57
  258. package/dist/esm/core/agent/findings/offer.js +9 -57
  259. package/dist/esm/core/agent/findings/offer.js.map +1 -1
  260. package/dist/esm/core/agent/findings/reserved.d.ts +7 -31
  261. package/dist/esm/core/agent/findings/reserved.js +12 -83
  262. package/dist/esm/core/agent/findings/reserved.js.map +1 -1
  263. package/dist/esm/core/agent/findings/types.d.ts +11 -4
  264. package/dist/esm/core/agent/findings/types.js +3 -2
  265. package/dist/esm/core/agent/findings/types.js.map +1 -1
  266. package/dist/esm/core/agent/honesty/mounts.d.ts +7 -0
  267. package/dist/esm/core/agent/honesty/mounts.js +6 -0
  268. package/dist/esm/core/agent/honesty/mounts.js.map +1 -1
  269. package/dist/esm/core/agent/nativeOutputFormat.d.ts +2 -1
  270. package/dist/esm/core/agent/nativeOutputFormat.js +19 -1
  271. package/dist/esm/core/agent/nativeOutputFormat.js.map +1 -1
  272. package/dist/esm/core/agent/negativeClaims/capture.d.ts +65 -0
  273. package/dist/esm/core/agent/negativeClaims/capture.js +508 -0
  274. package/dist/esm/core/agent/negativeClaims/capture.js.map +1 -0
  275. package/dist/esm/core/agent/negativeClaims/checkpoint.d.ts +7 -0
  276. package/dist/esm/core/agent/negativeClaims/checkpoint.js +79 -0
  277. package/dist/esm/core/agent/negativeClaims/checkpoint.js.map +1 -0
  278. package/dist/esm/core/agent/negativeClaims/config.d.ts +66 -0
  279. package/dist/esm/core/agent/negativeClaims/config.js +185 -0
  280. package/dist/esm/core/agent/negativeClaims/config.js.map +1 -0
  281. package/dist/esm/core/agent/negativeClaims/delivery.d.ts +24 -0
  282. package/dist/esm/core/agent/negativeClaims/delivery.js +244 -0
  283. package/dist/esm/core/agent/negativeClaims/delivery.js.map +1 -0
  284. package/dist/esm/core/agent/negativeClaims/observe.d.ts +14 -0
  285. package/dist/esm/core/agent/negativeClaims/observe.js +34 -0
  286. package/dist/esm/core/agent/negativeClaims/observe.js.map +1 -0
  287. package/dist/esm/core/agent/negativeClaims/prose.d.ts +9 -0
  288. package/dist/esm/core/agent/negativeClaims/prose.js +112 -0
  289. package/dist/esm/core/agent/negativeClaims/prose.js.map +1 -0
  290. package/dist/esm/core/agent/negativeClaims/recheck.d.ts +7 -0
  291. package/dist/esm/core/agent/negativeClaims/recheck.js +32 -0
  292. package/dist/esm/core/agent/negativeClaims/recheck.js.map +1 -0
  293. package/dist/esm/core/agent/outputEnforcement.d.ts +5 -1
  294. package/dist/esm/core/agent/outputEnforcement.js.map +1 -1
  295. package/dist/esm/core/agent/receipt/receipt.d.ts +2 -2
  296. package/dist/esm/core/agent/stages/answerEvidence.d.ts +28 -0
  297. package/dist/esm/core/agent/stages/answerEvidence.js +16 -0
  298. package/dist/esm/core/agent/stages/answerEvidence.js.map +1 -0
  299. package/dist/esm/core/agent/stages/answerValidation.d.ts +15 -3
  300. package/dist/esm/core/agent/stages/answerValidation.js +113 -5
  301. package/dist/esm/core/agent/stages/answerValidation.js.map +1 -1
  302. package/dist/esm/core/agent/stages/callLLM.d.ts +11 -2
  303. package/dist/esm/core/agent/stages/callLLM.js +85 -44
  304. package/dist/esm/core/agent/stages/callLLM.js.map +1 -1
  305. package/dist/esm/core/agent/stages/evidenceRecheck.d.ts +6 -1
  306. package/dist/esm/core/agent/stages/evidenceRecheck.js +16 -2
  307. package/dist/esm/core/agent/stages/evidenceRecheck.js.map +1 -1
  308. package/dist/esm/core/agent/stages/outputRetry.js +23 -7
  309. package/dist/esm/core/agent/stages/outputRetry.js.map +1 -1
  310. package/dist/esm/core/agent/stages/prepareFinal.js +6 -1
  311. package/dist/esm/core/agent/stages/prepareFinal.js.map +1 -1
  312. package/dist/esm/core/agent/stages/reliabilityExecution.d.ts +3 -0
  313. package/dist/esm/core/agent/stages/reliabilityExecution.js +3 -0
  314. package/dist/esm/core/agent/stages/reliabilityExecution.js.map +1 -1
  315. package/dist/esm/core/agent/stages/route.d.ts +8 -2
  316. package/dist/esm/core/agent/stages/route.js +81 -33
  317. package/dist/esm/core/agent/stages/route.js.map +1 -1
  318. package/dist/esm/core/agent/stages/searchCoverage.d.ts +94 -0
  319. package/dist/esm/core/agent/stages/searchCoverage.js +117 -0
  320. package/dist/esm/core/agent/stages/searchCoverage.js.map +1 -0
  321. package/dist/esm/core/agent/stages/seed.d.ts +10 -0
  322. package/dist/esm/core/agent/stages/seed.js +19 -21
  323. package/dist/esm/core/agent/stages/seed.js.map +1 -1
  324. package/dist/esm/core/agent/stages/toolCalls.d.ts +16 -0
  325. package/dist/esm/core/agent/stages/toolCalls.js +700 -77
  326. package/dist/esm/core/agent/stages/toolCalls.js.map +1 -1
  327. package/dist/esm/core/agent/toolChoice/compose.d.ts +2 -0
  328. package/dist/esm/core/agent/toolChoice/compose.js +1 -0
  329. package/dist/esm/core/agent/toolChoice/compose.js.map +1 -1
  330. package/dist/esm/core/agent/toolChoice/pick.d.ts +2 -0
  331. package/dist/esm/core/agent/toolChoice/pick.js +2 -0
  332. package/dist/esm/core/agent/toolChoice/pick.js.map +1 -1
  333. package/dist/esm/core/agent/toolChoice/types.d.ts +1 -1
  334. package/dist/esm/core/agent/types.d.ts +86 -5
  335. package/dist/esm/core/checkin.d.ts +83 -7
  336. package/dist/esm/core/checkin.js +77 -15
  337. package/dist/esm/core/checkin.js.map +1 -1
  338. package/dist/esm/core/consentRequest.d.ts +488 -0
  339. package/dist/esm/core/consentRequest.js +817 -0
  340. package/dist/esm/core/consentRequest.js.map +1 -0
  341. package/dist/esm/core/pause.d.ts +88 -7
  342. package/dist/esm/core/pause.js +102 -5
  343. package/dist/esm/core/pause.js.map +1 -1
  344. package/dist/esm/core/runCheckpoint.d.ts +5 -1
  345. package/dist/esm/core/runCheckpoint.js +8 -1
  346. package/dist/esm/core/runCheckpoint.js.map +1 -1
  347. package/dist/esm/core/slots/buildToolsSlot.d.ts +4 -11
  348. package/dist/esm/core/slots/buildToolsSlot.js +4 -24
  349. package/dist/esm/core/slots/buildToolsSlot.js.map +1 -1
  350. package/dist/esm/debug.d.ts +1 -1
  351. package/dist/esm/debug.js +2 -0
  352. package/dist/esm/debug.js.map +1 -1
  353. package/dist/esm/events/payloads.d.ts +145 -3
  354. package/dist/esm/events/registry.d.ts +3 -1
  355. package/dist/esm/events/registry.js +2 -0
  356. package/dist/esm/events/registry.js.map +1 -1
  357. package/dist/esm/hosting/answeredPause.d.ts +301 -0
  358. package/dist/esm/hosting/answeredPause.js +522 -0
  359. package/dist/esm/hosting/answeredPause.js.map +1 -0
  360. package/dist/esm/hosting/conformance/cases.js +81 -1
  361. package/dist/esm/hosting/conformance/cases.js.map +1 -1
  362. package/dist/esm/hosting/conformance/types.d.ts +1 -1
  363. package/dist/esm/hosting/envelope.d.ts +6 -0
  364. package/dist/esm/hosting/envelope.js +14 -0
  365. package/dist/esm/hosting/envelope.js.map +1 -1
  366. package/dist/esm/hosting/errors.d.ts +14 -2
  367. package/dist/esm/hosting/errors.js +13 -6
  368. package/dist/esm/hosting/errors.js.map +1 -1
  369. package/dist/esm/hosting/index.d.ts +2 -1
  370. package/dist/esm/hosting/index.js +3 -0
  371. package/dist/esm/hosting/index.js.map +1 -1
  372. package/dist/esm/hosting/memorySessions.js +10 -2
  373. package/dist/esm/hosting/memorySessions.js.map +1 -1
  374. package/dist/esm/hosting/processLocalStore.d.ts +20 -0
  375. package/dist/esm/hosting/processLocalStore.js +26 -0
  376. package/dist/esm/hosting/processLocalStore.js.map +1 -0
  377. package/dist/esm/hosting/protocolAdapter.d.ts +13 -0
  378. package/dist/esm/hosting/refusalStatus.d.ts +6 -0
  379. package/dist/esm/hosting/refusalStatus.js +13 -0
  380. package/dist/esm/hosting/refusalStatus.js.map +1 -1
  381. package/dist/esm/hosting/sessionWire.d.ts +8 -3
  382. package/dist/esm/hosting/sessionWire.js.map +1 -1
  383. package/dist/esm/hosting/sqliteSessions.js +27 -3
  384. package/dist/esm/hosting/sqliteSessions.js.map +1 -1
  385. package/dist/esm/hosting/standingAgent.js +70 -26
  386. package/dist/esm/hosting/standingAgent.js.map +1 -1
  387. package/dist/esm/hosting/streamHandler.d.ts +3 -1
  388. package/dist/esm/hosting/streamHandler.js +150 -32
  389. package/dist/esm/hosting/streamHandler.js.map +1 -1
  390. package/dist/esm/hosting/types.d.ts +28 -6
  391. package/dist/esm/hosting/types.js.map +1 -1
  392. package/dist/esm/index.d.ts +7 -3
  393. package/dist/esm/index.js +21 -17
  394. package/dist/esm/index.js.map +1 -1
  395. package/dist/esm/integrity/negative-claim/anchor.d.ts +9 -0
  396. package/dist/esm/integrity/negative-claim/anchor.js +120 -0
  397. package/dist/esm/integrity/negative-claim/anchor.js.map +1 -0
  398. package/dist/esm/integrity/negative-claim/citation.d.ts +34 -0
  399. package/dist/esm/integrity/negative-claim/citation.js +367 -0
  400. package/dist/esm/integrity/negative-claim/citation.js.map +1 -0
  401. package/dist/esm/integrity/negative-claim/containment.d.ts +40 -0
  402. package/dist/esm/integrity/negative-claim/containment.js +257 -0
  403. package/dist/esm/integrity/negative-claim/containment.js.map +1 -0
  404. package/dist/esm/integrity/negative-claim/derive.d.ts +17 -0
  405. package/dist/esm/integrity/negative-claim/derive.js +122 -0
  406. package/dist/esm/integrity/negative-claim/derive.js.map +1 -0
  407. package/dist/esm/integrity/negative-claim/detect.d.ts +44 -0
  408. package/dist/esm/integrity/negative-claim/detect.js +65 -0
  409. package/dist/esm/integrity/negative-claim/detect.js.map +1 -0
  410. package/dist/esm/integrity/negative-claim/judge.d.ts +41 -0
  411. package/dist/esm/integrity/negative-claim/judge.js +95 -0
  412. package/dist/esm/integrity/negative-claim/judge.js.map +1 -0
  413. package/dist/esm/integrity/negative-claim/language.d.ts +14 -0
  414. package/dist/esm/integrity/negative-claim/language.js +42 -0
  415. package/dist/esm/integrity/negative-claim/language.js.map +1 -0
  416. package/dist/esm/integrity/negative-claim/limits.d.ts +2 -0
  417. package/dist/esm/integrity/negative-claim/limits.js +3 -0
  418. package/dist/esm/integrity/negative-claim/limits.js.map +1 -0
  419. package/dist/esm/integrity/negative-claim/matcher.d.ts +51 -0
  420. package/dist/esm/integrity/negative-claim/matcher.js +164 -0
  421. package/dist/esm/integrity/negative-claim/matcher.js.map +1 -0
  422. package/dist/esm/integrity/negative-claim/noRead.d.ts +8 -0
  423. package/dist/esm/integrity/negative-claim/noRead.js +9 -0
  424. package/dist/esm/integrity/negative-claim/noRead.js.map +1 -0
  425. package/dist/esm/integrity/negative-claim/phrases.d.ts +69 -0
  426. package/dist/esm/integrity/negative-claim/phrases.js +249 -0
  427. package/dist/esm/integrity/negative-claim/phrases.js.map +1 -0
  428. package/dist/esm/integrity/negative-claim/prose.d.ts +36 -0
  429. package/dist/esm/integrity/negative-claim/prose.js +143 -0
  430. package/dist/esm/integrity/negative-claim/prose.js.map +1 -0
  431. package/dist/esm/integrity/negative-claim/readings.d.ts +81 -0
  432. package/dist/esm/integrity/negative-claim/readings.js +322 -0
  433. package/dist/esm/integrity/negative-claim/readings.js.map +1 -0
  434. package/dist/esm/integrity/negative-claim/resolve.d.ts +37 -0
  435. package/dist/esm/integrity/negative-claim/resolve.js +179 -0
  436. package/dist/esm/integrity/negative-claim/resolve.js.map +1 -0
  437. package/dist/esm/integrity/negative-claim/statement.d.ts +75 -0
  438. package/dist/esm/integrity/negative-claim/statement.js +361 -0
  439. package/dist/esm/integrity/negative-claim/statement.js.map +1 -0
  440. package/dist/esm/integrity/negative-claim/types.d.ts +144 -0
  441. package/dist/esm/integrity/negative-claim/types.js +39 -0
  442. package/dist/esm/integrity/negative-claim/types.js.map +1 -0
  443. package/dist/esm/integrity/negative-claim/units.d.ts +33 -0
  444. package/dist/esm/integrity/negative-claim/units.js +185 -0
  445. package/dist/esm/integrity/negative-claim/units.js.map +1 -0
  446. package/dist/esm/integrity/negative-claim/work.d.ts +12 -0
  447. package/dist/esm/integrity/negative-claim/work.js +19 -0
  448. package/dist/esm/integrity/negative-claim/work.js.map +1 -0
  449. package/dist/esm/integrity/unsupported-claim/check.d.ts +33 -0
  450. package/dist/esm/integrity/unsupported-claim/check.js +48 -26
  451. package/dist/esm/integrity/unsupported-claim/check.js.map +1 -1
  452. package/dist/esm/integrity/unsupported-claim/delivered.d.ts +72 -0
  453. package/dist/esm/integrity/unsupported-claim/delivered.js +98 -0
  454. package/dist/esm/integrity/unsupported-claim/delivered.js.map +1 -0
  455. package/dist/esm/integrity/unsupported-claim/evaluate.d.ts +103 -1
  456. package/dist/esm/integrity/unsupported-claim/evaluate.js +373 -0
  457. package/dist/esm/integrity/unsupported-claim/evaluate.js.map +1 -1
  458. package/dist/esm/lib/conventions.d.ts +1 -0
  459. package/dist/esm/lib/conventions.js +3 -0
  460. package/dist/esm/lib/conventions.js.map +1 -1
  461. package/dist/esm/lib/frozenCopy.d.ts +75 -0
  462. package/dist/esm/lib/frozenCopy.js +198 -0
  463. package/dist/esm/lib/frozenCopy.js.map +1 -0
  464. package/dist/esm/lib/jsonFaithful.d.ts +34 -0
  465. package/dist/esm/lib/jsonFaithful.js +111 -0
  466. package/dist/esm/lib/jsonFaithful.js.map +1 -0
  467. package/dist/esm/lib/normalize.d.ts +96 -0
  468. package/dist/esm/{tools → lib}/normalize.js +142 -6
  469. package/dist/esm/lib/normalize.js.map +1 -0
  470. package/dist/esm/lib/saidByPerson.d.ts +2 -0
  471. package/dist/esm/lib/saidByPerson.js +3 -0
  472. package/dist/esm/lib/saidByPerson.js.map +1 -1
  473. package/dist/esm/mcp/toolExtras.d.ts +10 -0
  474. package/dist/esm/mcp/toolExtras.js +11 -0
  475. package/dist/esm/mcp/toolExtras.js.map +1 -1
  476. package/dist/esm/provider-contract/nativeOutputSchema.d.ts +6 -2
  477. package/dist/esm/provider-contract/nativeOutputSchema.js +9 -2
  478. package/dist/esm/provider-contract/nativeOutputSchema.js.map +1 -1
  479. package/dist/esm/provider-contract/types.d.ts +12 -1
  480. package/dist/esm/provider-contract/types.js.map +1 -1
  481. package/dist/esm/recorders/core/CheckInRecorder.d.ts +6 -1
  482. package/dist/esm/recorders/core/CheckInRecorder.js +5 -1
  483. package/dist/esm/recorders/core/CheckInRecorder.js.map +1 -1
  484. package/dist/esm/redaction/conversation.js +6 -0
  485. package/dist/esm/redaction/conversation.js.map +1 -1
  486. package/dist/esm/redaction/knownStrings.d.ts +9 -7
  487. package/dist/esm/redaction/knownStrings.js +74 -0
  488. package/dist/esm/redaction/knownStrings.js.map +1 -1
  489. package/dist/esm/resilience/withCircuitBreaker.js +3 -0
  490. package/dist/esm/resilience/withCircuitBreaker.js.map +1 -1
  491. package/dist/esm/resilience/withFallback.js +8 -1
  492. package/dist/esm/resilience/withFallback.js.map +1 -1
  493. package/dist/esm/resilience/withRetry.js +3 -0
  494. package/dist/esm/resilience/withRetry.js.map +1 -1
  495. package/dist/esm/semantics/check.d.ts +44 -2
  496. package/dist/esm/semantics/check.js +112 -3
  497. package/dist/esm/semantics/check.js.map +1 -1
  498. package/dist/esm/semantics/cli.js +33 -3
  499. package/dist/esm/semantics/cli.js.map +1 -1
  500. package/dist/esm/semantics/coverage/absent.d.ts +19 -2
  501. package/dist/esm/semantics/coverage/absent.js +56 -52
  502. package/dist/esm/semantics/coverage/absent.js.map +1 -1
  503. package/dist/esm/semantics/coverage/among.d.ts +73 -0
  504. package/dist/esm/semantics/coverage/among.js +172 -0
  505. package/dist/esm/semantics/coverage/among.js.map +1 -0
  506. package/dist/esm/semantics/coverage/composedCoverage.d.ts +220 -0
  507. package/dist/esm/semantics/coverage/composedCoverage.js +42 -0
  508. package/dist/esm/semantics/coverage/composedCoverage.js.map +1 -0
  509. package/dist/esm/semantics/coverage/evidence.js +27 -2
  510. package/dist/esm/semantics/coverage/evidence.js.map +1 -1
  511. package/dist/esm/semantics/coverage/index.d.ts +4 -1
  512. package/dist/esm/semantics/coverage/index.js +2 -0
  513. package/dist/esm/semantics/coverage/index.js.map +1 -1
  514. package/dist/esm/semantics/coverage/ledger.d.ts +2 -1
  515. package/dist/esm/semantics/coverage/ledger.js +15 -53
  516. package/dist/esm/semantics/coverage/ledger.js.map +1 -1
  517. package/dist/esm/semantics/coverage/read.d.ts +19 -0
  518. package/dist/esm/semantics/coverage/read.js.map +1 -1
  519. package/dist/esm/semantics/coverage/recognize.d.ts +17 -1
  520. package/dist/esm/semantics/coverage/recognize.js +40 -0
  521. package/dist/esm/semantics/coverage/recognize.js.map +1 -1
  522. package/dist/esm/semantics/coverage/search/binding.d.ts +27 -0
  523. package/dist/esm/semantics/coverage/search/binding.js +42 -0
  524. package/dist/esm/semantics/coverage/search/binding.js.map +1 -0
  525. package/dist/esm/semantics/coverage/search/compose.d.ts +90 -0
  526. package/dist/esm/semantics/coverage/search/compose.js +120 -0
  527. package/dist/esm/semantics/coverage/search/compose.js.map +1 -0
  528. package/dist/esm/semantics/coverage/search/declaration.d.ts +75 -0
  529. package/dist/esm/semantics/coverage/search/declaration.js +453 -0
  530. package/dist/esm/semantics/coverage/search/declaration.js.map +1 -0
  531. package/dist/esm/semantics/coverage/search/door.d.ts +46 -0
  532. package/dist/esm/semantics/coverage/search/door.js +130 -0
  533. package/dist/esm/semantics/coverage/search/door.js.map +1 -0
  534. package/dist/esm/semantics/coverage/search/events.d.ts +42 -0
  535. package/dist/esm/semantics/coverage/search/events.js +100 -0
  536. package/dist/esm/semantics/coverage/search/events.js.map +1 -0
  537. package/dist/esm/semantics/coverage/search/facets.d.ts +52 -0
  538. package/dist/esm/semantics/coverage/search/facets.js +191 -0
  539. package/dist/esm/semantics/coverage/search/facets.js.map +1 -0
  540. package/dist/esm/semantics/coverage/search/gaps.d.ts +63 -0
  541. package/dist/esm/semantics/coverage/search/gaps.js +221 -0
  542. package/dist/esm/semantics/coverage/search/gaps.js.map +1 -0
  543. package/dist/esm/semantics/coverage/search/inEffect.d.ts +65 -0
  544. package/dist/esm/semantics/coverage/search/inEffect.js +48 -0
  545. package/dist/esm/semantics/coverage/search/inEffect.js.map +1 -0
  546. package/dist/esm/semantics/coverage/search/resultFacts.d.ts +42 -0
  547. package/dist/esm/semantics/coverage/search/resultFacts.js +100 -0
  548. package/dist/esm/semantics/coverage/search/resultFacts.js.map +1 -0
  549. package/dist/esm/semantics/coverage/search/review.d.ts +36 -0
  550. package/dist/esm/semantics/coverage/search/review.js +89 -0
  551. package/dist/esm/semantics/coverage/search/review.js.map +1 -0
  552. package/dist/esm/semantics/coverage/search/served.d.ts +51 -0
  553. package/dist/esm/semantics/coverage/search/served.js +130 -0
  554. package/dist/esm/semantics/coverage/search/served.js.map +1 -0
  555. package/dist/esm/semantics/coverage/search/span.d.ts +34 -0
  556. package/dist/esm/semantics/coverage/search/span.js +61 -0
  557. package/dist/esm/semantics/coverage/search/span.js.map +1 -0
  558. package/dist/esm/semantics/coverage/search/statementText.d.ts +46 -0
  559. package/dist/esm/semantics/coverage/search/statementText.js +102 -0
  560. package/dist/esm/semantics/coverage/search/statementText.js.map +1 -0
  561. package/dist/esm/semantics/coverage/search/types.d.ts +120 -0
  562. package/dist/esm/semantics/coverage/search/types.js +11 -0
  563. package/dist/esm/semantics/coverage/search/types.js.map +1 -0
  564. package/dist/esm/semantics/coverage/search/valueWords.d.ts +22 -0
  565. package/dist/esm/semantics/coverage/search/valueWords.js +32 -0
  566. package/dist/esm/semantics/coverage/search/valueWords.js.map +1 -0
  567. package/dist/esm/semantics/coverage/types.d.ts +163 -0
  568. package/dist/esm/semantics/described.js +3 -1
  569. package/dist/esm/semantics/described.js.map +1 -1
  570. package/dist/esm/semantics/envelope.js +26 -2
  571. package/dist/esm/semantics/envelope.js.map +1 -1
  572. package/dist/esm/semantics/index.d.ts +2 -1
  573. package/dist/esm/semantics/index.js.map +1 -1
  574. package/dist/esm/semantics/overclaim.d.ts +105 -0
  575. package/dist/esm/semantics/overclaim.js +397 -0
  576. package/dist/esm/semantics/overclaim.js.map +1 -0
  577. package/dist/esm/semantics/types.d.ts +13 -0
  578. package/dist/esm/semantics/types.js.map +1 -1
  579. package/dist/esm/time/forms.js +1 -1
  580. package/dist/esm/time/textForms.js +1 -1
  581. package/dist/esm/time-travel/servedView.d.ts +2 -2
  582. package/dist/esm/time-travel/servedView.js +52 -160
  583. package/dist/esm/time-travel/servedView.js.map +1 -1
  584. package/dist/esm/tools/declare.d.ts +1 -1
  585. package/dist/esm/tools/declare.js +2 -2
  586. package/dist/esm/tools/declare.js.map +1 -1
  587. package/dist/esm/tools/hostFilled.d.ts +20 -1
  588. package/dist/esm/tools/hostFilled.js +46 -1
  589. package/dist/esm/tools/hostFilled.js.map +1 -1
  590. package/dist/esm/tools/searchOf.d.ts +60 -0
  591. package/dist/esm/tools/searchOf.js +97 -0
  592. package/dist/esm/tools/searchOf.js.map +1 -0
  593. package/dist/esm/tools/tools.d.ts +49 -0
  594. package/dist/esm/tools/tools.js +76 -1
  595. package/dist/esm/tools/tools.js.map +1 -1
  596. package/dist/esm/trace-toolpack/causeCapture.d.ts +17 -0
  597. package/dist/esm/trace-toolpack/causeCapture.js +96 -0
  598. package/dist/esm/trace-toolpack/causeCapture.js.map +1 -0
  599. package/dist/esm/trace-toolpack/causeControl.d.ts +6 -0
  600. package/dist/esm/trace-toolpack/causeControl.js +45 -0
  601. package/dist/esm/trace-toolpack/causeControl.js.map +1 -0
  602. package/dist/esm/trace-toolpack/causeReader.js +11 -9
  603. package/dist/esm/trace-toolpack/causeReader.js.map +1 -1
  604. package/dist/esm/trace-toolpack/causeResponse.d.ts +3 -2
  605. package/dist/esm/trace-toolpack/causeResponse.js +27 -7
  606. package/dist/esm/trace-toolpack/causeResponse.js.map +1 -1
  607. package/dist/esm/trace-toolpack/causeSnapshot.d.ts +6 -1
  608. package/dist/esm/trace-toolpack/causeSnapshot.js +26 -15
  609. package/dist/esm/trace-toolpack/causeSnapshot.js.map +1 -1
  610. package/dist/esm/trace-toolpack/causeTools.js +1 -1
  611. package/dist/esm/trace-toolpack/causeTools.js.map +1 -1
  612. package/dist/events/registry.js +2 -0
  613. package/dist/events/registry.js.map +1 -1
  614. package/dist/hosting/answeredPause.js +536 -0
  615. package/dist/hosting/answeredPause.js.map +1 -0
  616. package/dist/hosting/conformance/cases.js +80 -0
  617. package/dist/hosting/conformance/cases.js.map +1 -1
  618. package/dist/hosting/envelope.js +14 -0
  619. package/dist/hosting/envelope.js.map +1 -1
  620. package/dist/hosting/errors.js +13 -6
  621. package/dist/hosting/errors.js.map +1 -1
  622. package/dist/hosting/index.js +7 -3
  623. package/dist/hosting/index.js.map +1 -1
  624. package/dist/hosting/memorySessions.js +10 -2
  625. package/dist/hosting/memorySessions.js.map +1 -1
  626. package/dist/hosting/processLocalStore.js +31 -0
  627. package/dist/hosting/processLocalStore.js.map +1 -0
  628. package/dist/hosting/refusalStatus.js +13 -0
  629. package/dist/hosting/refusalStatus.js.map +1 -1
  630. package/dist/hosting/sessionWire.js.map +1 -1
  631. package/dist/hosting/sqliteSessions.js +27 -3
  632. package/dist/hosting/sqliteSessions.js.map +1 -1
  633. package/dist/hosting/standingAgent.js +69 -25
  634. package/dist/hosting/standingAgent.js.map +1 -1
  635. package/dist/hosting/streamHandler.js +149 -31
  636. package/dist/hosting/streamHandler.js.map +1 -1
  637. package/dist/hosting/types.js.map +1 -1
  638. package/dist/index.js +26 -21
  639. package/dist/index.js.map +1 -1
  640. package/dist/integrity/negative-claim/anchor.js +124 -0
  641. package/dist/integrity/negative-claim/anchor.js.map +1 -0
  642. package/dist/integrity/negative-claim/citation.js +371 -0
  643. package/dist/integrity/negative-claim/citation.js.map +1 -0
  644. package/dist/integrity/negative-claim/containment.js +262 -0
  645. package/dist/integrity/negative-claim/containment.js.map +1 -0
  646. package/dist/integrity/negative-claim/derive.js +130 -0
  647. package/dist/integrity/negative-claim/derive.js.map +1 -0
  648. package/dist/integrity/negative-claim/detect.js +69 -0
  649. package/dist/integrity/negative-claim/detect.js.map +1 -0
  650. package/dist/integrity/negative-claim/judge.js +100 -0
  651. package/dist/integrity/negative-claim/judge.js.map +1 -0
  652. package/dist/integrity/negative-claim/language.js +46 -0
  653. package/dist/integrity/negative-claim/language.js.map +1 -0
  654. package/dist/integrity/negative-claim/limits.js +6 -0
  655. package/dist/integrity/negative-claim/limits.js.map +1 -0
  656. package/dist/integrity/negative-claim/matcher.js +179 -0
  657. package/dist/integrity/negative-claim/matcher.js.map +1 -0
  658. package/dist/integrity/negative-claim/noRead.js +13 -0
  659. package/dist/integrity/negative-claim/noRead.js.map +1 -0
  660. package/dist/integrity/negative-claim/phrases.js +253 -0
  661. package/dist/integrity/negative-claim/phrases.js.map +1 -0
  662. package/dist/integrity/negative-claim/prose.js +147 -0
  663. package/dist/integrity/negative-claim/prose.js.map +1 -0
  664. package/dist/integrity/negative-claim/readings.js +338 -0
  665. package/dist/integrity/negative-claim/readings.js.map +1 -0
  666. package/dist/integrity/negative-claim/resolve.js +184 -0
  667. package/dist/integrity/negative-claim/resolve.js.map +1 -0
  668. package/dist/integrity/negative-claim/statement.js +369 -0
  669. package/dist/integrity/negative-claim/statement.js.map +1 -0
  670. package/dist/integrity/negative-claim/types.js +42 -0
  671. package/dist/integrity/negative-claim/types.js.map +1 -0
  672. package/dist/integrity/negative-claim/units.js +190 -0
  673. package/dist/integrity/negative-claim/units.js.map +1 -0
  674. package/dist/integrity/negative-claim/work.js +24 -0
  675. package/dist/integrity/negative-claim/work.js.map +1 -0
  676. package/dist/integrity/unsupported-claim/check.js +50 -27
  677. package/dist/integrity/unsupported-claim/check.js.map +1 -1
  678. package/dist/integrity/unsupported-claim/delivered.js +102 -0
  679. package/dist/integrity/unsupported-claim/delivered.js.map +1 -0
  680. package/dist/integrity/unsupported-claim/evaluate.js +377 -1
  681. package/dist/integrity/unsupported-claim/evaluate.js.map +1 -1
  682. package/dist/lib/conventions.js +3 -0
  683. package/dist/lib/conventions.js.map +1 -1
  684. package/dist/lib/frozenCopy.js +207 -0
  685. package/dist/lib/frozenCopy.js.map +1 -0
  686. package/dist/lib/jsonFaithful.js +115 -0
  687. package/dist/lib/jsonFaithful.js.map +1 -0
  688. package/dist/{tools → lib}/normalize.js +151 -7
  689. package/dist/lib/normalize.js.map +1 -0
  690. package/dist/lib/saidByPerson.js +4 -1
  691. package/dist/lib/saidByPerson.js.map +1 -1
  692. package/dist/mcp/toolExtras.js +11 -0
  693. package/dist/mcp/toolExtras.js.map +1 -1
  694. package/dist/provider-contract/nativeOutputSchema.js +11 -3
  695. package/dist/provider-contract/nativeOutputSchema.js.map +1 -1
  696. package/dist/provider-contract/types.js.map +1 -1
  697. package/dist/recorders/core/CheckInRecorder.js +5 -1
  698. package/dist/recorders/core/CheckInRecorder.js.map +1 -1
  699. package/dist/redaction/conversation.js +6 -0
  700. package/dist/redaction/conversation.js.map +1 -1
  701. package/dist/redaction/knownStrings.js +74 -0
  702. package/dist/redaction/knownStrings.js.map +1 -1
  703. package/dist/resilience/withCircuitBreaker.js +3 -0
  704. package/dist/resilience/withCircuitBreaker.js.map +1 -1
  705. package/dist/resilience/withFallback.js +7 -0
  706. package/dist/resilience/withFallback.js.map +1 -1
  707. package/dist/resilience/withRetry.js +3 -0
  708. package/dist/resilience/withRetry.js.map +1 -1
  709. package/dist/semantics/check.js +112 -3
  710. package/dist/semantics/check.js.map +1 -1
  711. package/dist/semantics/cli.js +32 -2
  712. package/dist/semantics/cli.js.map +1 -1
  713. package/dist/semantics/coverage/absent.js +56 -52
  714. package/dist/semantics/coverage/absent.js.map +1 -1
  715. package/dist/semantics/coverage/among.js +177 -0
  716. package/dist/semantics/coverage/among.js.map +1 -0
  717. package/dist/semantics/coverage/composedCoverage.js +46 -0
  718. package/dist/semantics/coverage/composedCoverage.js.map +1 -0
  719. package/dist/semantics/coverage/evidence.js +27 -2
  720. package/dist/semantics/coverage/evidence.js.map +1 -1
  721. package/dist/semantics/coverage/index.js +5 -1
  722. package/dist/semantics/coverage/index.js.map +1 -1
  723. package/dist/semantics/coverage/ledger.js +18 -56
  724. package/dist/semantics/coverage/ledger.js.map +1 -1
  725. package/dist/semantics/coverage/read.js.map +1 -1
  726. package/dist/semantics/coverage/recognize.js +43 -1
  727. package/dist/semantics/coverage/recognize.js.map +1 -1
  728. package/dist/semantics/coverage/search/binding.js +46 -0
  729. package/dist/semantics/coverage/search/binding.js.map +1 -0
  730. package/dist/semantics/coverage/search/compose.js +124 -0
  731. package/dist/semantics/coverage/search/compose.js.map +1 -0
  732. package/dist/semantics/coverage/search/declaration.js +462 -0
  733. package/dist/semantics/coverage/search/declaration.js.map +1 -0
  734. package/dist/semantics/coverage/search/door.js +134 -0
  735. package/dist/semantics/coverage/search/door.js.map +1 -0
  736. package/dist/semantics/coverage/search/events.js +104 -0
  737. package/dist/semantics/coverage/search/events.js.map +1 -0
  738. package/dist/semantics/coverage/search/facets.js +196 -0
  739. package/dist/semantics/coverage/search/facets.js.map +1 -0
  740. package/dist/semantics/coverage/search/gaps.js +226 -0
  741. package/dist/semantics/coverage/search/gaps.js.map +1 -0
  742. package/dist/semantics/coverage/search/inEffect.js +52 -0
  743. package/dist/semantics/coverage/search/inEffect.js.map +1 -0
  744. package/dist/semantics/coverage/search/resultFacts.js +109 -0
  745. package/dist/semantics/coverage/search/resultFacts.js.map +1 -0
  746. package/dist/semantics/coverage/search/review.js +93 -0
  747. package/dist/semantics/coverage/search/review.js.map +1 -0
  748. package/dist/semantics/coverage/search/served.js +137 -0
  749. package/dist/semantics/coverage/search/served.js.map +1 -0
  750. package/dist/semantics/coverage/search/span.js +66 -0
  751. package/dist/semantics/coverage/search/span.js.map +1 -0
  752. package/dist/semantics/coverage/search/statementText.js +107 -0
  753. package/dist/semantics/coverage/search/statementText.js.map +1 -0
  754. package/dist/semantics/coverage/search/types.js +12 -0
  755. package/dist/semantics/coverage/search/types.js.map +1 -0
  756. package/dist/semantics/coverage/search/valueWords.js +36 -0
  757. package/dist/semantics/coverage/search/valueWords.js.map +1 -0
  758. package/dist/semantics/described.js +3 -1
  759. package/dist/semantics/described.js.map +1 -1
  760. package/dist/semantics/envelope.js +26 -2
  761. package/dist/semantics/envelope.js.map +1 -1
  762. package/dist/semantics/index.js.map +1 -1
  763. package/dist/semantics/overclaim.js +407 -0
  764. package/dist/semantics/overclaim.js.map +1 -0
  765. package/dist/semantics/types.js.map +1 -1
  766. package/dist/time/forms.js +1 -1
  767. package/dist/time/textForms.js +1 -1
  768. package/dist/time-travel/servedView.js +51 -159
  769. package/dist/time-travel/servedView.js.map +1 -1
  770. package/dist/tools/declare.js +2 -2
  771. package/dist/tools/declare.js.map +1 -1
  772. package/dist/tools/hostFilled.js +48 -2
  773. package/dist/tools/hostFilled.js.map +1 -1
  774. package/dist/tools/searchOf.js +104 -0
  775. package/dist/tools/searchOf.js.map +1 -0
  776. package/dist/tools/tools.js +80 -2
  777. package/dist/tools/tools.js.map +1 -1
  778. package/dist/trace-toolpack/causeCapture.js +103 -0
  779. package/dist/trace-toolpack/causeCapture.js.map +1 -0
  780. package/dist/trace-toolpack/causeControl.js +49 -0
  781. package/dist/trace-toolpack/causeControl.js.map +1 -0
  782. package/dist/trace-toolpack/causeReader.js +11 -9
  783. package/dist/trace-toolpack/causeReader.js.map +1 -1
  784. package/dist/trace-toolpack/causeResponse.js +27 -7
  785. package/dist/trace-toolpack/causeResponse.js.map +1 -1
  786. package/dist/trace-toolpack/causeSnapshot.js +31 -20
  787. package/dist/trace-toolpack/causeSnapshot.js.map +1 -1
  788. package/dist/trace-toolpack/causeTools.js +1 -1
  789. package/dist/trace-toolpack/causeTools.js.map +1 -1
  790. package/dist/types/adapters/hosting/agentCoreA2A.d.ts.map +1 -1
  791. package/dist/types/adapters/hosting/firestoreSessions.d.ts.map +1 -1
  792. package/dist/types/adapters/hosting/googleAgentEngine.d.ts.map +1 -1
  793. package/dist/types/adapters/llm/AnthropicProvider.d.ts +1 -0
  794. package/dist/types/adapters/llm/AnthropicProvider.d.ts.map +1 -1
  795. package/dist/types/adapters/llm/BrowserAnthropicProvider.d.ts +1 -0
  796. package/dist/types/adapters/llm/BrowserAnthropicProvider.d.ts.map +1 -1
  797. package/dist/types/adapters/llm/MockProvider.d.ts +2 -0
  798. package/dist/types/adapters/llm/MockProvider.d.ts.map +1 -1
  799. package/dist/types/ag-ui/request.d.ts +4 -1
  800. package/dist/types/ag-ui/request.d.ts.map +1 -1
  801. package/dist/types/ag-ui/serializer.d.ts +15 -2
  802. package/dist/types/ag-ui/serializer.d.ts.map +1 -1
  803. package/dist/types/answer-account/facts/howSure.d.ts.map +1 -1
  804. package/dist/types/answer-account/templates.d.ts +4 -1
  805. package/dist/types/answer-account/templates.d.ts.map +1 -1
  806. package/dist/types/answer-validation/agentChecks.d.ts +76 -0
  807. package/dist/types/answer-validation/agentChecks.d.ts.map +1 -0
  808. package/dist/types/answer-validation/index.d.ts +2 -1
  809. package/dist/types/answer-validation/index.d.ts.map +1 -1
  810. package/dist/types/answer-validation/outputSchema.d.ts +18 -7
  811. package/dist/types/answer-validation/outputSchema.d.ts.map +1 -1
  812. package/dist/types/answer-validation/types.d.ts +125 -1
  813. package/dist/types/answer-validation/types.d.ts.map +1 -1
  814. package/dist/types/answer-validation/validate.d.ts +11 -2
  815. package/dist/types/answer-validation/validate.d.ts.map +1 -1
  816. package/dist/types/core/Agent.d.ts +25 -1
  817. package/dist/types/core/Agent.d.ts.map +1 -1
  818. package/dist/types/core/RunnerBase.d.ts.map +1 -1
  819. package/dist/types/core/agent/AgentBuilder.d.ts +43 -12
  820. package/dist/types/core/agent/AgentBuilder.d.ts.map +1 -1
  821. package/dist/types/core/agent/arguments/checks.d.ts +1 -1
  822. package/dist/types/core/agent/arguments/subflow.d.ts +6 -0
  823. package/dist/types/core/agent/arguments/subflow.d.ts.map +1 -1
  824. package/dist/types/core/agent/assessment/assess.d.ts.map +1 -1
  825. package/dist/types/core/agent/assessment/compose.d.ts.map +1 -1
  826. package/dist/types/core/agent/assessment/reasons.d.ts.map +1 -1
  827. package/dist/types/core/agent/assessment/types.d.ts +3 -2
  828. package/dist/types/core/agent/assessment/types.d.ts.map +1 -1
  829. package/dist/types/core/agent/buildAgentChart.d.ts +4 -12
  830. package/dist/types/core/agent/buildAgentChart.d.ts.map +1 -1
  831. package/dist/types/core/agent/buildDynamicAgentChart.d.ts.map +1 -1
  832. package/dist/types/core/agent/buildToolRegistry.d.ts.map +1 -1
  833. package/dist/types/core/agent/composeRequest.d.ts +19 -0
  834. package/dist/types/core/agent/composeRequest.d.ts.map +1 -1
  835. package/dist/types/core/agent/evidence/extract.d.ts +45 -6
  836. package/dist/types/core/agent/evidence/extract.d.ts.map +1 -1
  837. package/dist/types/core/agent/evidence/frames.d.ts.map +1 -1
  838. package/dist/types/core/agent/evidence/gate.d.ts +6 -0
  839. package/dist/types/core/agent/evidence/gate.d.ts.map +1 -1
  840. package/dist/types/core/agent/evidence/recovery.d.ts +2 -0
  841. package/dist/types/core/agent/evidence/recovery.d.ts.map +1 -1
  842. package/dist/types/core/agent/evidence/resultCarries.d.ts +2 -2
  843. package/dist/types/core/agent/evidence/types.d.ts +17 -0
  844. package/dist/types/core/agent/evidence/types.d.ts.map +1 -1
  845. package/dist/types/core/agent/findings/context.d.ts +14 -0
  846. package/dist/types/core/agent/findings/context.d.ts.map +1 -0
  847. package/dist/types/core/agent/findings/instruction.d.ts +13 -0
  848. package/dist/types/core/agent/findings/instruction.d.ts.map +1 -0
  849. package/dist/types/core/agent/findings/ledger.d.ts +3 -0
  850. package/dist/types/core/agent/findings/ledger.d.ts.map +1 -1
  851. package/dist/types/core/agent/findings/negativeProse.d.ts +2 -0
  852. package/dist/types/core/agent/findings/negativeProse.d.ts.map +1 -0
  853. package/dist/types/core/agent/findings/offer.d.ts +9 -57
  854. package/dist/types/core/agent/findings/offer.d.ts.map +1 -1
  855. package/dist/types/core/agent/findings/reserved.d.ts +7 -31
  856. package/dist/types/core/agent/findings/reserved.d.ts.map +1 -1
  857. package/dist/types/core/agent/findings/types.d.ts +11 -4
  858. package/dist/types/core/agent/findings/types.d.ts.map +1 -1
  859. package/dist/types/core/agent/honesty/mounts.d.ts +7 -0
  860. package/dist/types/core/agent/honesty/mounts.d.ts.map +1 -1
  861. package/dist/types/core/agent/nativeOutputFormat.d.ts +2 -1
  862. package/dist/types/core/agent/nativeOutputFormat.d.ts.map +1 -1
  863. package/dist/types/core/agent/negativeClaims/capture.d.ts +66 -0
  864. package/dist/types/core/agent/negativeClaims/capture.d.ts.map +1 -0
  865. package/dist/types/core/agent/negativeClaims/checkpoint.d.ts +8 -0
  866. package/dist/types/core/agent/negativeClaims/checkpoint.d.ts.map +1 -0
  867. package/dist/types/core/agent/negativeClaims/config.d.ts +67 -0
  868. package/dist/types/core/agent/negativeClaims/config.d.ts.map +1 -0
  869. package/dist/types/core/agent/negativeClaims/delivery.d.ts +25 -0
  870. package/dist/types/core/agent/negativeClaims/delivery.d.ts.map +1 -0
  871. package/dist/types/core/agent/negativeClaims/observe.d.ts +15 -0
  872. package/dist/types/core/agent/negativeClaims/observe.d.ts.map +1 -0
  873. package/dist/types/core/agent/negativeClaims/prose.d.ts +10 -0
  874. package/dist/types/core/agent/negativeClaims/prose.d.ts.map +1 -0
  875. package/dist/types/core/agent/negativeClaims/recheck.d.ts +8 -0
  876. package/dist/types/core/agent/negativeClaims/recheck.d.ts.map +1 -0
  877. package/dist/types/core/agent/outputEnforcement.d.ts +5 -1
  878. package/dist/types/core/agent/outputEnforcement.d.ts.map +1 -1
  879. package/dist/types/core/agent/receipt/receipt.d.ts +2 -2
  880. package/dist/types/core/agent/receipt/receipt.d.ts.map +1 -1
  881. package/dist/types/core/agent/stages/answerEvidence.d.ts +29 -0
  882. package/dist/types/core/agent/stages/answerEvidence.d.ts.map +1 -0
  883. package/dist/types/core/agent/stages/answerValidation.d.ts +15 -3
  884. package/dist/types/core/agent/stages/answerValidation.d.ts.map +1 -1
  885. package/dist/types/core/agent/stages/callLLM.d.ts +11 -2
  886. package/dist/types/core/agent/stages/callLLM.d.ts.map +1 -1
  887. package/dist/types/core/agent/stages/evidenceRecheck.d.ts +6 -1
  888. package/dist/types/core/agent/stages/evidenceRecheck.d.ts.map +1 -1
  889. package/dist/types/core/agent/stages/outputRetry.d.ts.map +1 -1
  890. package/dist/types/core/agent/stages/prepareFinal.d.ts.map +1 -1
  891. package/dist/types/core/agent/stages/reliabilityExecution.d.ts +3 -0
  892. package/dist/types/core/agent/stages/reliabilityExecution.d.ts.map +1 -1
  893. package/dist/types/core/agent/stages/route.d.ts +8 -2
  894. package/dist/types/core/agent/stages/route.d.ts.map +1 -1
  895. package/dist/types/core/agent/stages/searchCoverage.d.ts +95 -0
  896. package/dist/types/core/agent/stages/searchCoverage.d.ts.map +1 -0
  897. package/dist/types/core/agent/stages/seed.d.ts +10 -0
  898. package/dist/types/core/agent/stages/seed.d.ts.map +1 -1
  899. package/dist/types/core/agent/stages/toolCalls.d.ts +16 -0
  900. package/dist/types/core/agent/stages/toolCalls.d.ts.map +1 -1
  901. package/dist/types/core/agent/toolChoice/compose.d.ts +2 -0
  902. package/dist/types/core/agent/toolChoice/compose.d.ts.map +1 -1
  903. package/dist/types/core/agent/toolChoice/pick.d.ts +2 -0
  904. package/dist/types/core/agent/toolChoice/pick.d.ts.map +1 -1
  905. package/dist/types/core/agent/toolChoice/types.d.ts +1 -1
  906. package/dist/types/core/agent/toolChoice/types.d.ts.map +1 -1
  907. package/dist/types/core/agent/types.d.ts +86 -5
  908. package/dist/types/core/agent/types.d.ts.map +1 -1
  909. package/dist/types/core/checkin.d.ts +83 -7
  910. package/dist/types/core/checkin.d.ts.map +1 -1
  911. package/dist/types/core/consentRequest.d.ts +489 -0
  912. package/dist/types/core/consentRequest.d.ts.map +1 -0
  913. package/dist/types/core/pause.d.ts +88 -7
  914. package/dist/types/core/pause.d.ts.map +1 -1
  915. package/dist/types/core/runCheckpoint.d.ts +5 -1
  916. package/dist/types/core/runCheckpoint.d.ts.map +1 -1
  917. package/dist/types/core/slots/buildToolsSlot.d.ts +4 -11
  918. package/dist/types/core/slots/buildToolsSlot.d.ts.map +1 -1
  919. package/dist/types/debug.d.ts +1 -1
  920. package/dist/types/debug.d.ts.map +1 -1
  921. package/dist/types/events/payloads.d.ts +145 -3
  922. package/dist/types/events/payloads.d.ts.map +1 -1
  923. package/dist/types/events/registry.d.ts +3 -1
  924. package/dist/types/events/registry.d.ts.map +1 -1
  925. package/dist/types/hosting/answeredPause.d.ts +302 -0
  926. package/dist/types/hosting/answeredPause.d.ts.map +1 -0
  927. package/dist/types/hosting/conformance/cases.d.ts.map +1 -1
  928. package/dist/types/hosting/conformance/types.d.ts +1 -1
  929. package/dist/types/hosting/conformance/types.d.ts.map +1 -1
  930. package/dist/types/hosting/envelope.d.ts +6 -0
  931. package/dist/types/hosting/envelope.d.ts.map +1 -1
  932. package/dist/types/hosting/errors.d.ts +14 -2
  933. package/dist/types/hosting/errors.d.ts.map +1 -1
  934. package/dist/types/hosting/index.d.ts +2 -1
  935. package/dist/types/hosting/index.d.ts.map +1 -1
  936. package/dist/types/hosting/memorySessions.d.ts.map +1 -1
  937. package/dist/types/hosting/processLocalStore.d.ts +21 -0
  938. package/dist/types/hosting/processLocalStore.d.ts.map +1 -0
  939. package/dist/types/hosting/protocolAdapter.d.ts +13 -0
  940. package/dist/types/hosting/protocolAdapter.d.ts.map +1 -1
  941. package/dist/types/hosting/refusalStatus.d.ts +6 -0
  942. package/dist/types/hosting/refusalStatus.d.ts.map +1 -1
  943. package/dist/types/hosting/sessionWire.d.ts +8 -3
  944. package/dist/types/hosting/sessionWire.d.ts.map +1 -1
  945. package/dist/types/hosting/sqliteSessions.d.ts.map +1 -1
  946. package/dist/types/hosting/standingAgent.d.ts.map +1 -1
  947. package/dist/types/hosting/streamHandler.d.ts +3 -1
  948. package/dist/types/hosting/streamHandler.d.ts.map +1 -1
  949. package/dist/types/hosting/types.d.ts +28 -6
  950. package/dist/types/hosting/types.d.ts.map +1 -1
  951. package/dist/types/index.d.ts +7 -3
  952. package/dist/types/index.d.ts.map +1 -1
  953. package/dist/types/integrity/negative-claim/anchor.d.ts +10 -0
  954. package/dist/types/integrity/negative-claim/anchor.d.ts.map +1 -0
  955. package/dist/types/integrity/negative-claim/citation.d.ts +35 -0
  956. package/dist/types/integrity/negative-claim/citation.d.ts.map +1 -0
  957. package/dist/types/integrity/negative-claim/containment.d.ts +41 -0
  958. package/dist/types/integrity/negative-claim/containment.d.ts.map +1 -0
  959. package/dist/types/integrity/negative-claim/derive.d.ts +18 -0
  960. package/dist/types/integrity/negative-claim/derive.d.ts.map +1 -0
  961. package/dist/types/integrity/negative-claim/detect.d.ts +45 -0
  962. package/dist/types/integrity/negative-claim/detect.d.ts.map +1 -0
  963. package/dist/types/integrity/negative-claim/judge.d.ts +42 -0
  964. package/dist/types/integrity/negative-claim/judge.d.ts.map +1 -0
  965. package/dist/types/integrity/negative-claim/language.d.ts +15 -0
  966. package/dist/types/integrity/negative-claim/language.d.ts.map +1 -0
  967. package/dist/types/integrity/negative-claim/limits.d.ts +3 -0
  968. package/dist/types/integrity/negative-claim/limits.d.ts.map +1 -0
  969. package/dist/types/integrity/negative-claim/matcher.d.ts +52 -0
  970. package/dist/types/integrity/negative-claim/matcher.d.ts.map +1 -0
  971. package/dist/types/integrity/negative-claim/noRead.d.ts +9 -0
  972. package/dist/types/integrity/negative-claim/noRead.d.ts.map +1 -0
  973. package/dist/types/integrity/negative-claim/phrases.d.ts +70 -0
  974. package/dist/types/integrity/negative-claim/phrases.d.ts.map +1 -0
  975. package/dist/types/integrity/negative-claim/prose.d.ts +37 -0
  976. package/dist/types/integrity/negative-claim/prose.d.ts.map +1 -0
  977. package/dist/types/integrity/negative-claim/readings.d.ts +82 -0
  978. package/dist/types/integrity/negative-claim/readings.d.ts.map +1 -0
  979. package/dist/types/integrity/negative-claim/resolve.d.ts +38 -0
  980. package/dist/types/integrity/negative-claim/resolve.d.ts.map +1 -0
  981. package/dist/types/integrity/negative-claim/statement.d.ts +76 -0
  982. package/dist/types/integrity/negative-claim/statement.d.ts.map +1 -0
  983. package/dist/types/integrity/negative-claim/types.d.ts +145 -0
  984. package/dist/types/integrity/negative-claim/types.d.ts.map +1 -0
  985. package/dist/types/integrity/negative-claim/units.d.ts +34 -0
  986. package/dist/types/integrity/negative-claim/units.d.ts.map +1 -0
  987. package/dist/types/integrity/negative-claim/work.d.ts +13 -0
  988. package/dist/types/integrity/negative-claim/work.d.ts.map +1 -0
  989. package/dist/types/integrity/unsupported-claim/check.d.ts +33 -0
  990. package/dist/types/integrity/unsupported-claim/check.d.ts.map +1 -1
  991. package/dist/types/integrity/unsupported-claim/delivered.d.ts +73 -0
  992. package/dist/types/integrity/unsupported-claim/delivered.d.ts.map +1 -0
  993. package/dist/types/integrity/unsupported-claim/evaluate.d.ts +103 -1
  994. package/dist/types/integrity/unsupported-claim/evaluate.d.ts.map +1 -1
  995. package/dist/types/lib/conventions.d.ts +1 -0
  996. package/dist/types/lib/conventions.d.ts.map +1 -1
  997. package/dist/types/lib/frozenCopy.d.ts +76 -0
  998. package/dist/types/lib/frozenCopy.d.ts.map +1 -0
  999. package/dist/types/lib/jsonFaithful.d.ts +35 -0
  1000. package/dist/types/lib/jsonFaithful.d.ts.map +1 -0
  1001. package/dist/types/lib/normalize.d.ts +97 -0
  1002. package/dist/types/lib/normalize.d.ts.map +1 -0
  1003. package/dist/types/lib/saidByPerson.d.ts +2 -0
  1004. package/dist/types/lib/saidByPerson.d.ts.map +1 -1
  1005. package/dist/types/mcp/toolExtras.d.ts +10 -0
  1006. package/dist/types/mcp/toolExtras.d.ts.map +1 -1
  1007. package/dist/types/provider-contract/nativeOutputSchema.d.ts +6 -2
  1008. package/dist/types/provider-contract/nativeOutputSchema.d.ts.map +1 -1
  1009. package/dist/types/provider-contract/types.d.ts +12 -1
  1010. package/dist/types/provider-contract/types.d.ts.map +1 -1
  1011. package/dist/types/recorders/core/CheckInRecorder.d.ts +6 -1
  1012. package/dist/types/recorders/core/CheckInRecorder.d.ts.map +1 -1
  1013. package/dist/types/redaction/conversation.d.ts.map +1 -1
  1014. package/dist/types/redaction/knownStrings.d.ts +9 -7
  1015. package/dist/types/redaction/knownStrings.d.ts.map +1 -1
  1016. package/dist/types/resilience/withCircuitBreaker.d.ts.map +1 -1
  1017. package/dist/types/resilience/withFallback.d.ts.map +1 -1
  1018. package/dist/types/resilience/withRetry.d.ts.map +1 -1
  1019. package/dist/types/semantics/check.d.ts +44 -2
  1020. package/dist/types/semantics/check.d.ts.map +1 -1
  1021. package/dist/types/semantics/cli.d.ts.map +1 -1
  1022. package/dist/types/semantics/coverage/absent.d.ts +19 -2
  1023. package/dist/types/semantics/coverage/absent.d.ts.map +1 -1
  1024. package/dist/types/semantics/coverage/among.d.ts +74 -0
  1025. package/dist/types/semantics/coverage/among.d.ts.map +1 -0
  1026. package/dist/types/semantics/coverage/composedCoverage.d.ts +221 -0
  1027. package/dist/types/semantics/coverage/composedCoverage.d.ts.map +1 -0
  1028. package/dist/types/semantics/coverage/evidence.d.ts.map +1 -1
  1029. package/dist/types/semantics/coverage/index.d.ts +4 -1
  1030. package/dist/types/semantics/coverage/index.d.ts.map +1 -1
  1031. package/dist/types/semantics/coverage/ledger.d.ts +2 -1
  1032. package/dist/types/semantics/coverage/ledger.d.ts.map +1 -1
  1033. package/dist/types/semantics/coverage/read.d.ts +19 -0
  1034. package/dist/types/semantics/coverage/read.d.ts.map +1 -1
  1035. package/dist/types/semantics/coverage/recognize.d.ts +17 -1
  1036. package/dist/types/semantics/coverage/recognize.d.ts.map +1 -1
  1037. package/dist/types/semantics/coverage/search/binding.d.ts +28 -0
  1038. package/dist/types/semantics/coverage/search/binding.d.ts.map +1 -0
  1039. package/dist/types/semantics/coverage/search/compose.d.ts +91 -0
  1040. package/dist/types/semantics/coverage/search/compose.d.ts.map +1 -0
  1041. package/dist/types/semantics/coverage/search/declaration.d.ts +76 -0
  1042. package/dist/types/semantics/coverage/search/declaration.d.ts.map +1 -0
  1043. package/dist/types/semantics/coverage/search/door.d.ts +47 -0
  1044. package/dist/types/semantics/coverage/search/door.d.ts.map +1 -0
  1045. package/dist/types/semantics/coverage/search/events.d.ts +43 -0
  1046. package/dist/types/semantics/coverage/search/events.d.ts.map +1 -0
  1047. package/dist/types/semantics/coverage/search/facets.d.ts +53 -0
  1048. package/dist/types/semantics/coverage/search/facets.d.ts.map +1 -0
  1049. package/dist/types/semantics/coverage/search/gaps.d.ts +64 -0
  1050. package/dist/types/semantics/coverage/search/gaps.d.ts.map +1 -0
  1051. package/dist/types/semantics/coverage/search/inEffect.d.ts +66 -0
  1052. package/dist/types/semantics/coverage/search/inEffect.d.ts.map +1 -0
  1053. package/dist/types/semantics/coverage/search/resultFacts.d.ts +43 -0
  1054. package/dist/types/semantics/coverage/search/resultFacts.d.ts.map +1 -0
  1055. package/dist/types/semantics/coverage/search/review.d.ts +37 -0
  1056. package/dist/types/semantics/coverage/search/review.d.ts.map +1 -0
  1057. package/dist/types/semantics/coverage/search/served.d.ts +52 -0
  1058. package/dist/types/semantics/coverage/search/served.d.ts.map +1 -0
  1059. package/dist/types/semantics/coverage/search/span.d.ts +35 -0
  1060. package/dist/types/semantics/coverage/search/span.d.ts.map +1 -0
  1061. package/dist/types/semantics/coverage/search/statementText.d.ts +47 -0
  1062. package/dist/types/semantics/coverage/search/statementText.d.ts.map +1 -0
  1063. package/dist/types/semantics/coverage/search/types.d.ts +121 -0
  1064. package/dist/types/semantics/coverage/search/types.d.ts.map +1 -0
  1065. package/dist/types/semantics/coverage/search/valueWords.d.ts +23 -0
  1066. package/dist/types/semantics/coverage/search/valueWords.d.ts.map +1 -0
  1067. package/dist/types/semantics/coverage/types.d.ts +163 -0
  1068. package/dist/types/semantics/coverage/types.d.ts.map +1 -1
  1069. package/dist/types/semantics/described.d.ts.map +1 -1
  1070. package/dist/types/semantics/envelope.d.ts.map +1 -1
  1071. package/dist/types/semantics/index.d.ts +2 -1
  1072. package/dist/types/semantics/index.d.ts.map +1 -1
  1073. package/dist/types/semantics/overclaim.d.ts +106 -0
  1074. package/dist/types/semantics/overclaim.d.ts.map +1 -0
  1075. package/dist/types/semantics/types.d.ts +13 -0
  1076. package/dist/types/semantics/types.d.ts.map +1 -1
  1077. package/dist/types/time-travel/servedView.d.ts +2 -2
  1078. package/dist/types/time-travel/servedView.d.ts.map +1 -1
  1079. package/dist/types/tools/declare.d.ts +1 -1
  1080. package/dist/types/tools/hostFilled.d.ts +20 -1
  1081. package/dist/types/tools/hostFilled.d.ts.map +1 -1
  1082. package/dist/types/tools/searchOf.d.ts +61 -0
  1083. package/dist/types/tools/searchOf.d.ts.map +1 -0
  1084. package/dist/types/tools/tools.d.ts +49 -0
  1085. package/dist/types/tools/tools.d.ts.map +1 -1
  1086. package/dist/types/trace-toolpack/causeCapture.d.ts +18 -0
  1087. package/dist/types/trace-toolpack/causeCapture.d.ts.map +1 -0
  1088. package/dist/types/trace-toolpack/causeControl.d.ts +7 -0
  1089. package/dist/types/trace-toolpack/causeControl.d.ts.map +1 -0
  1090. package/dist/types/trace-toolpack/causeReader.d.ts.map +1 -1
  1091. package/dist/types/trace-toolpack/causeResponse.d.ts +3 -2
  1092. package/dist/types/trace-toolpack/causeResponse.d.ts.map +1 -1
  1093. package/dist/types/trace-toolpack/causeSnapshot.d.ts +6 -1
  1094. package/dist/types/trace-toolpack/causeSnapshot.d.ts.map +1 -1
  1095. package/package.json +3 -2
  1096. package/dist/esm/tools/normalize.d.ts +0 -43
  1097. package/dist/esm/tools/normalize.js.map +0 -1
  1098. package/dist/tools/normalize.js.map +0 -1
  1099. package/dist/types/tools/normalize.d.ts +0 -44
  1100. package/dist/types/tools/normalize.d.ts.map +0 -1
@@ -103,8 +103,10 @@ const pause_js_1 = require("../../pause.js");
103
103
  const inputRequest_js_1 = require("../../../tools/inputRequest.js");
104
104
  const askComponent_js_1 = require("../../../tools/askComponent.js");
105
105
  const checkin_js_1 = require("../../checkin.js");
106
+ const consentRequest_js_1 = require("../../consentRequest.js");
106
107
  const toolShownArgs_js_1 = require("../../toolShownArgs.js");
107
108
  const toolBytes_js_1 = require("../../../lib/toolBytes.js");
109
+ const frozenCopy_js_1 = require("../../../lib/frozenCopy.js");
108
110
  const toolResolver_js_1 = require("./toolResolver.js");
109
111
  const toolDispatch_js_1 = require("../toolDispatch.js");
110
112
  const memberRun_js_1 = require("../../memberRun.js");
@@ -120,7 +122,9 @@ const rows_js_1 = require("../../../time/rows.js");
120
122
  const evidenceIndex_js_1 = require("../evidence/evidenceIndex.js");
121
123
  const repeatedCall_js_1 = require("../repeatedCall.js");
122
124
  const toolArgsValidation_js_1 = require("../../../tools/toolArgsValidation.js");
125
+ const jsonFaithful_js_1 = require("../../../lib/jsonFaithful.js");
123
126
  const validators_js_1 = require("../validators.js");
127
+ const capture_js_1 = require("../negativeClaims/capture.js");
124
128
  const toolResultCap_js_1 = require("../toolResultCap.js");
125
129
  const resultCeiling_js_1 = require("../resultCeiling.js");
126
130
  const skillSteps_js_1 = require("../../../injection-engine/skillSteps.js");
@@ -130,6 +134,8 @@ const check_js_1 = require("../../../integrity/empty-lookup/check.js");
130
134
  const check_js_2 = require("../../../integrity/column-types/check.js");
131
135
  const integrityFindings_js_1 = require("../integrityFindings.js");
132
136
  const index_js_1 = require("../../../semantics/coverage/index.js");
137
+ const events_js_1 = require("../../../semantics/coverage/search/events.js");
138
+ const searchCoverage_js_1 = require("./searchCoverage.js");
133
139
  const items_js_1 = require("../../../semantics/coverage/items.js");
134
140
  const inProgress_js_1 = require("../../../semantics/coverage/inProgress.js");
135
141
  const period_js_1 = require("../../../semantics/coverage/period.js");
@@ -787,6 +793,123 @@ const madeInRun = (bindRun) => bindRun?.runContext?.runId;
787
793
  function buildToolCallsHandler(deps) {
788
794
  const { registryByName, externalToolProvider, providerToolCache, servedTools, toolClaimants, permissionChecker, } = deps;
789
795
  const toolArgValidation = deps.toolArgValidation ?? 'enforce';
796
+ /** Where answered consent requests are spent — the agent's, else this process's. */
797
+ const decisionLedger = deps.decisionLedger ?? (0, consentRequest_js_1.processDecisionLedger)();
798
+ /**
799
+ * The decision a consent-gate resume carries, held to the request this run
800
+ * paused on and to the exact call it was bound to (`core/consentRequest.ts`)
801
+ * — or a `ResumeDecisionError` / `DecisionRequiredError`, thrown before
802
+ * anything about the call runs. Pure: the decision is spent by the branch
803
+ * that USES it (`spendDecision`), so a resume stopped before that (a refused
804
+ * findings reference) leaves it unspent.
805
+ *
806
+ * THE door every resume of a consent gate passes through: an agent's own
807
+ * `resume()` asks the same pure question first, but a composition resumes a
808
+ * nested agent's chart directly, and only this handler sees every decision
809
+ * that is used. So this is where a request is held and spent, once.
810
+ */
811
+ const heldAnswer = (scope, input, gate) => {
812
+ const read = (key) => scope.$getValue(key);
813
+ const toolName = read('pausedToolName');
814
+ const middleware = gate === 'ask' ? read('pausedAskMiddleware') : undefined;
815
+ return (0, consentRequest_js_1.heldDecision)(input, {
816
+ kind: gate,
817
+ ...(typeof toolName === 'string' && { toolName }),
818
+ ...(typeof middleware === 'string' && { middleware }),
819
+ }, read('pausedRequest'), (0, consentRequest_js_1.gatedCallOf)(read, gate),
820
+ // An ask's approval holds only for the rules it was asked under — this
821
+ // agent's chain, by link name.
822
+ (deps.toolMiddleware ?? []).map((link) => link.name),
823
+ // …and a request minted under a ledger that can prove is spent only
824
+ // there: never silently in this agent's ledger if it is another one.
825
+ decisionLedger);
826
+ };
827
+ /**
828
+ * The copy of a paused call's arguments its request was bound to, detached
829
+ * from the run's state — what an approved call runs with, as at a fresh
830
+ * dispatch. A live view of the state goes on changing after the call (the
831
+ * resume clears it, a later pause rewrites it), so a tool or a rule that kept
832
+ * its arguments would read values nobody approved. `heldAnswer` already
833
+ * proved them faithful JSON, which is what makes the copy safe to take.
834
+ */
835
+ const boundArgsOf = (scope, key) => {
836
+ const raw = scope.$getValue(key);
837
+ return typeof raw === 'object' && raw !== null
838
+ ? structuredClone(raw)
839
+ : {};
840
+ };
841
+ /**
842
+ * The permission checker's view of a call's arguments: the call's shared
843
+ * frozen copy (`lib/frozenCopy.ts`), never the object the tool runs with — a
844
+ * checker that wrote into its `context` used to change the call. Arguments
845
+ * no copy can be made of are not handed over: the throw lands in the gate's
846
+ * fail-closed catch, so the call is denied.
847
+ */
848
+ const checkerContextOf = (view) => {
849
+ if (view === undefined) {
850
+ throw new Error("the call's arguments could not be copied for the permission checker");
851
+ }
852
+ return view;
853
+ };
854
+ /**
855
+ * One frozen copy of a batch's assistant turn — every call's arguments in
856
+ * it — for the callbacks and events that see the batch before its calls run
857
+ * (`lib/frozenCopy.ts`). The turn holds the very objects the calls run
858
+ * with, so a history handed to a callback carries this copy in its place.
859
+ * A turn no copy can be made of is replaced by a frozen shell without its
860
+ * calls: nothing a callback holds may reach what runs.
861
+ */
862
+ const frozenTurnOf = (turn) => (0, frozenCopy_js_1.frozenCopyOf)(turn) ?? Object.freeze({ role: turn.role, content: turn.content });
863
+ /**
864
+ * What a consent gate refuses with when the call cannot be bound to a
865
+ * request — its arguments are not values JSON writes down faithfully, so an
866
+ * approval could not be held to them. The call does not run and nobody is
867
+ * asked; the model reads why — as a past fact about that one call, never an
868
+ * order for the next one, because a tool result is re-read on every later
869
+ * call of the turn (`test/modelFacingScan.test.ts`).
870
+ */
871
+ const unboundCallRefusal = (toolName, gate) => `tool '${toolName}' was not run on that call: it needed a person's ${gate === 'ask' ? 'answer to a middleware ask' : 'approval (checkIn)'}, and an approval binds to the exact arguments it is shown — those arguments held a ` +
872
+ `value plain JSON cannot write down (a date object, a map, a non-finite number, …), so no ` +
873
+ `approval could be bound to them.`;
874
+ /**
875
+ * The chain's rows for an ask no approval could be bound to. Nobody was
876
+ * asked, so no row may say a person was: the asking link's `ask` row (the
877
+ * walk's last — it stops at the ask) becomes the refusal it turned into,
878
+ * naming why, the way `askPolicy: 'refuse'` files a refused ask.
879
+ */
880
+ const unboundAskRows = (rows, middleware, question) => rows.map((row, at) => at === rows.length - 1 && row.outcome === 'ask'
881
+ ? {
882
+ ...row,
883
+ outcome: 'deny',
884
+ why: `middleware '${middleware}' asked a person to decide, and the call could not be ` +
885
+ `bound to a request a decision names — its arguments held a value plain JSON ` +
886
+ `cannot write down — so nobody was asked: ${question}`,
887
+ }
888
+ : row);
889
+ /**
890
+ * Who changed an approved ask's arguments after the approval, in words: the
891
+ * links whose rows declared a rewrite — or, when none did (an edit in place
892
+ * declares nothing), every link that ran after the ask, without claiming
893
+ * which of them it was.
894
+ */
895
+ const changedAfterApproval = (rows) => {
896
+ const quoted = (picked) => [...new Set(picked.map((row) => `'${row.middleware}'`))].join(', ');
897
+ const declared = rows.filter((row) => row.changed);
898
+ if (declared.length > 0) {
899
+ return `the middleware ${quoted(declared)} changed those arguments after the approval`;
900
+ }
901
+ return rows.length > 0
902
+ ? `those arguments came back changed from the middleware after the ask (${quoted(rows)})`
903
+ : 'a middleware after the ask changed those arguments';
904
+ };
905
+ /**
906
+ * What the model reads when the rest of an approved ask's chain handed back
907
+ * other arguments than the ones the person approved: the call does not run.
908
+ * A past fact about that call.
909
+ */
910
+ const rewrittenAfterApproval = (toolName, changedBy) => `tool '${toolName}' was not run on that call: a person approved it with the arguments ` +
911
+ `they were shown, and ${changedBy}, so the approval did not cover the call that would ` +
912
+ `have run.`;
790
913
  /**
791
914
  * One admission rule for initial and resumed dispatch. Judge against the
792
915
  * wire schema after middleware, before artifact resolution or credentials.
@@ -987,12 +1110,20 @@ function buildToolCallsHandler(deps) {
987
1110
  * block reads it. Written only when a tool declares one, so an agent that
988
1111
  * returns neither shape commits exactly what it always did.
989
1112
  */
990
- const declareCoverage = (scope, call, value) => {
991
- const reading = (0, index_js_1.readCoverageResult)(value, call.toolName);
1113
+ const declareCoverage = (scope, call, value,
1114
+ /** What the search funnel composed (`./searchCoverage.ts`) — read in place of the value. */
1115
+ composed) => {
1116
+ const reading = composed ?? (0, index_js_1.readCoverageResult)(value, call.toolName);
992
1117
  if (reading === undefined)
993
1118
  return undefined;
994
1119
  const rows = [];
995
1120
  for (const facts of reading.declared) {
1121
+ // A statement the LIBRARY composed from the tool's `search`: the row
1122
+ // carries the typed items and gaps, the events carry no composed value.
1123
+ if (facts.composed !== undefined) {
1124
+ rows.push(declareComposed(scope, call, facts));
1125
+ continue;
1126
+ }
996
1127
  // Honesty step 7b: a declared period rides the event and the tracked row
997
1128
  // (read by the ONE period rule — a malformed one never reaches here), as
998
1129
  // a copy. Filed whatever the agent armed: it is the tool's declaration.
@@ -1069,6 +1200,73 @@ function buildToolCallsHandler(deps) {
1069
1200
  scope.coverageDeclared = [...(scope.coverageDeclared ?? []), ...rows];
1070
1201
  return reading.status;
1071
1202
  };
1203
+ /**
1204
+ * One COMPOSED statement (`Tool.search`) — its event and its row. The row is
1205
+ * the committed record: every value, under the run's redaction policy, at
1206
+ * the address the funnel reserved (`resultId`). The event carries the
1207
+ * declaration's constants, the gaps and each other facet as a reference —
1208
+ * never a composed value, armed or not (`search/events.ts`).
1209
+ */
1210
+ const declareComposed = (scope, call, facts) => {
1211
+ const composed = facts.composed;
1212
+ const period = facts.period !== undefined ? (0, period_js_1.copyPeriod)(facts.period) : undefined;
1213
+ if (period !== undefined && deps.resultsLayer !== true)
1214
+ warnPeriodUnjudged(call.toolName);
1215
+ const event = (0, events_js_1.composedEventFields)(facts, { armed: deps.negativeClaimsArmed === true });
1216
+ const base = {
1217
+ toolName: call.toolName,
1218
+ toolCallId: call.toolCallId,
1219
+ iteration: call.iteration,
1220
+ };
1221
+ if (facts.kind === 'absence') {
1222
+ (0, typedEmit_js_1.typedEmit)(scope, 'agentfootprint.tools.absent', {
1223
+ ...base,
1224
+ ...(event.lookedFor !== undefined && { lookedFor: event.lookedFor }),
1225
+ ...(event.lookedForRef !== undefined && { lookedForRef: event.lookedForRef }),
1226
+ checked: event.checked,
1227
+ ...(event.notChecked.length > 0 && { notChecked: event.notChecked }),
1228
+ ...(event.cannotCover.length > 0 && { cannotCover: event.cannotCover }),
1229
+ ...(facts.tryInstead !== undefined && { tryInstead: facts.tryInstead }),
1230
+ ...(facts.tryInsteadTool !== undefined && { tryInsteadTool: facts.tryInsteadTool }),
1231
+ ...(facts.provenance !== undefined && { provenance: { ...facts.provenance } }),
1232
+ ...(period !== undefined && { period: (0, period_js_1.copyPeriod)(period) }),
1233
+ composition: event.composition,
1234
+ });
1235
+ }
1236
+ else {
1237
+ (0, typedEmit_js_1.typedEmit)(scope, 'agentfootprint.tools.coverage_declared', {
1238
+ ...base,
1239
+ ...(event.checked.length > 0 && { checked: event.checked }),
1240
+ ...(event.notChecked.length > 0 && { notChecked: event.notChecked }),
1241
+ ...(event.cannotCover.length > 0 && { cannotCover: event.cannotCover }),
1242
+ ...(facts.inProgress !== undefined && {
1243
+ inProgress: facts.inProgress.map(inProgress_js_1.copyInProgressItem),
1244
+ }),
1245
+ ...(period !== undefined && { period: (0, period_js_1.copyPeriod)(period) }),
1246
+ composition: event.composition,
1247
+ });
1248
+ }
1249
+ // Detached plain data: the row must not share a reference with a value
1250
+ // the tool still holds (a sent argument object, the declaration's lists).
1251
+ const row = structuredClone({
1252
+ kind: facts.kind,
1253
+ ...base,
1254
+ composed: composed.origin,
1255
+ resultId: composed.resultId,
1256
+ handle: composed.handle,
1257
+ ...(facts.lookedFor !== undefined && { lookedFor: facts.lookedFor }),
1258
+ checked: facts.coverage.checked,
1259
+ notChecked: facts.coverage.notChecked,
1260
+ cannotCover: facts.coverage.cannotCover,
1261
+ complete: composed.complete,
1262
+ gaps: composed.gaps,
1263
+ ...(period !== undefined && { period }),
1264
+ ...(facts.inProgress !== undefined && { inProgress: facts.inProgress }),
1265
+ });
1266
+ if (deps.negativeClaimsArmed === true)
1267
+ (0, capture_js_1.captureNegativeCoverage)(scope, row);
1268
+ return row;
1269
+ };
1072
1270
  /**
1073
1271
  * THE WRITE SEAM (9.77.0) — `empty-lookup`, at the one moment a lookup's
1074
1272
  * answer becomes a fact in the conversation.
@@ -1664,6 +1862,12 @@ function buildToolCallsHandler(deps) {
1664
1862
  * instance's own (`deps.currentRun`) describe some other run — its last
1665
1863
  * standalone caller, or none — and must never reach this run's tools.
1666
1864
  */
1865
+ /**
1866
+ * `Tool.search` — the call's result identity reserved before dispatch, its
1867
+ * coverage composed after (`./searchCoverage.ts`). Inert for every tool
1868
+ * that declares no search.
1869
+ */
1870
+ const searchFunnel = (0, searchCoverage_js_1.buildSearchCoverage)((scope) => runFactsOf(scope)?.runId);
1667
1871
  const runFactsOf = (scope) => {
1668
1872
  // Decided WITHOUT reading the state, so the agent's own runs record
1669
1873
  // exactly what they always did.
@@ -1685,7 +1889,17 @@ function buildToolCallsHandler(deps) {
1685
1889
  * never results. `ran` is whether the tool's own code ran: a call a person
1686
1890
  * declined or a rule refused without an `error` is listed `not-run`, never `ok`.
1687
1891
  */
1688
- const emitToolEnd = (scope, toolName, payload, ran, declaredStatus = payload.status) => {
1892
+ const emitToolEnd = (scope, toolName, payload, ran, declaredStatus = payload.status, negativeResultId, refusalArgs) => {
1893
+ if (deps.negativeClaimsArmed === true) {
1894
+ (0, capture_js_1.settleNegativeCall)(scope, negativeResultId, (0, toolLedger_js_1.toolOutcomeOf)(payload, ran));
1895
+ if (!ran ||
1896
+ payload.error ||
1897
+ ['invalid', 'denied', 'failure'].includes(declaredStatus ?? '')) {
1898
+ (0, capture_js_1.captureNegativeRefusal)(scope, toolName, payload.result, refusalArgs);
1899
+ if (payload.modelResult !== undefined)
1900
+ (0, capture_js_1.captureNegativeRefusal)(scope, toolName, payload.modelResult, refusalArgs);
1901
+ }
1902
+ }
1689
1903
  (0, typedEmit_js_1.typedEmit)(scope, 'agentfootprint.stream.tool_end', payload);
1690
1904
  const ledger = deps.toolCallLedger;
1691
1905
  if (ledger === undefined)
@@ -1701,7 +1915,13 @@ function buildToolCallsHandler(deps) {
1701
1915
  };
1702
1916
  /** `emitToolEnd`'s twin: the call is open in the ledger until its `tool_end` lands. */
1703
1917
  const emitToolStart = (scope, payload) => {
1704
- (0, typedEmit_js_1.typedEmit)(scope, 'agentfootprint.stream.tool_start', payload);
1918
+ // A listener sees the call's frozen copy — the dispatch loop's shared one
1919
+ // when it hands that over — never the arguments the tool runs with: one
1920
+ // that set `amount = 9000` used to refund 9000. Arguments no copy can be
1921
+ // made of are carried as a frozen, detached projection — what JSON writes
1922
+ // of them — never as their live objects.
1923
+ const args = (0, frozenCopy_js_1.frozenView)(payload.args) ?? (0, frozenCopy_js_1.frozenProjectionOf)(payload.args);
1924
+ (0, typedEmit_js_1.typedEmit)(scope, 'agentfootprint.stream.tool_start', { ...payload, args });
1705
1925
  const ledger = deps.toolCallLedger;
1706
1926
  if (ledger === undefined)
1707
1927
  return;
@@ -2443,6 +2663,8 @@ function buildToolCallsHandler(deps) {
2443
2663
  // reference back when no item carried either key: a run whose tools
2444
2664
  // declare neither serves the bytes it always did, and the callers'
2445
2665
  // reference-inequality stamp of `tool_end.modelResult` stays unstamped.
2666
+ if (deps.negativeClaimsArmed === true && call.error)
2667
+ (0, capture_js_1.captureNegativeRefusal)(scope, call.toolName, call.result, call.args);
2446
2668
  const served = (0, read_js_1.servedToModel)(call.result);
2447
2669
  const chain = deps.toolMiddleware ?? [];
2448
2670
  // No `onToolResult` hook anywhere in the chain → no walk, no rows, no await
@@ -2464,7 +2686,20 @@ function buildToolCallsHandler(deps) {
2464
2686
  ...(call.signal && { signal: call.signal }),
2465
2687
  });
2466
2688
  (0, ledger_js_1.recordDecisions)(scope, verdict.decisions);
2467
- return verdict.kind === 'deny' ? verdict.reason : verdict.result;
2689
+ const delivered = verdict.kind === 'deny' ? verdict.reason : verdict.result;
2690
+ // An explicit policy denial withdraws access to the native observation.
2691
+ // A guessed handle must not make the final composer disclose it again.
2692
+ // Allowed summaries remain eligible: their native coverage and gaps, not
2693
+ // the summary's claims, are what the final checker uses.
2694
+ if (deps.negativeClaimsArmed === true) {
2695
+ const transformedStatus = (0, toolEffects_js_1.readToolResultEnvelope)(delivered)?.status;
2696
+ const notRead = ['invalid', 'denied', 'failure', 'pending'].includes(transformedStatus ?? '');
2697
+ if (verdict.kind === 'deny' || notRead || !(0, jsonFaithful_js_1.isJsonFaithful)(delivered))
2698
+ (0, capture_js_1.keepNegativeResultOut)(scope, call.negativeResultId);
2699
+ if (verdict.kind === 'deny' || notRead)
2700
+ (0, capture_js_1.captureNegativeRefusal)(scope, call.toolName, delivered, call.args);
2701
+ }
2702
+ return delivered;
2468
2703
  };
2469
2704
  const settleBatch = (answered, paused) => {
2470
2705
  const batch = pausedBatchOf(answered, paused.toolCallId);
@@ -2535,8 +2770,18 @@ function buildToolCallsHandler(deps) {
2535
2770
  // runs now. Fail-closed: a blocked/failed credential surfaces to the model
2536
2771
  // and the tool does NOT run. A tool that pauses again during an approved
2537
2772
  // resume can't re-pause (resume returns void), so that is surfaced as an error.
2538
- const resolveCredentialAndExecute = async (scope, resolved, toolName, args, toolCallId, iteration, env) => {
2773
+ //
2774
+ // `heldTo` names the consent gate a person approved this call through (a
2775
+ // check-in, an ask). Its arguments are then held to the request once more
2776
+ // at the last moment before `execute` — defence in depth behind the frozen
2777
+ // copies every app callback is handed (`lib/frozenCopy.ts`): arguments that
2778
+ // no longer re-derive the request's id (`runsAsAsked`, the one rule that
2779
+ // binds a decision to its call) do not run (`callChanged`).
2780
+ const resolveCredentialAndExecute = async (scope, resolved, toolName, args, toolCallId, iteration, env, heldTo) => {
2539
2781
  const tool = resolved.tool;
2782
+ /** What the approval covers — the arguments as handed in, before any
2783
+ * `wants` resolution or clock redraw derives the ones `execute` gets. */
2784
+ const approved = args;
2540
2785
  const emitSecurity = (0, toolSecurityEvents_js_1.bindToolSecurityEvents)(scope, { toolCallId, iteration });
2541
2786
  // The two refusals share one door here too (9.92.0): a name nothing holds,
2542
2787
  // and a name whose offered party cannot answer on this resume.
@@ -2626,6 +2871,9 @@ function buildToolCallsHandler(deps) {
2626
2871
  }
2627
2872
  }
2628
2873
  let executed = false;
2874
+ let negativeDispatch;
2875
+ /** What the run ended with, when it ended before the call could run. */
2876
+ let ended;
2629
2877
  try {
2630
2878
  // The time layer's dispatch moment — a resumed call is dispatched NOW,
2631
2879
  // so its `dispatchedAt` is the resume's, not the pause's.
@@ -2651,9 +2899,59 @@ function buildToolCallsHandler(deps) {
2651
2899
  ...sessionContext(scope, toolName, toolCallId),
2652
2900
  ...toolDispatchCtx(scope, { toolName, toolCallId, iteration }, env.signal),
2653
2901
  };
2902
+ // The last moment before the call runs, after every await that prepared
2903
+ // it — its artifacts (`wants`), its credential (`needs`), its clock, and
2904
+ // on an ask the rest of the chain. The engine stops waiting on an
2905
+ // aborted run's stage (a hang-up, a deadline), but the stage goes on:
2906
+ // a call never runs for a caller already told the run ended. Thrown past
2907
+ // the catch below — the run ended, the tool did not fail.
2908
+ ended = (0, consentRequest_js_1.runEndedBy)(env.signal);
2909
+ if (ended !== undefined)
2910
+ throw ended;
2911
+ // An approved call runs with the arguments its request binds, or not
2912
+ // at all — asked here, after every callback that saw them has returned.
2913
+ if (heldTo !== undefined) {
2914
+ const read = (key) => scope.$getValue(key);
2915
+ if (!(0, consentRequest_js_1.runsAsAsked)(read('pausedRequest'), (0, consentRequest_js_1.gatedCallOf)(read, heldTo), approved)) {
2916
+ // Nothing ran; the call's sessions are still released, as for a
2917
+ // run that ended here.
2918
+ await endCall(toolCallId).catch(() => undefined);
2919
+ return {
2920
+ result: rewrittenAfterApproval(toolName, 'those arguments changed before the call could run'),
2921
+ error: true,
2922
+ callChanged: true,
2923
+ };
2924
+ }
2925
+ }
2926
+ // `Tool.search`: reserved, with the dispatch instant, just before the
2927
+ // call runs — as in the batch loop.
2928
+ const searchDispatch = searchFunnel.dispatch(scope, tool, callTime);
2929
+ negativeDispatch =
2930
+ deps.negativeClaimsArmed === true
2931
+ ? (0, capture_js_1.startNegativeCall)(scope, {
2932
+ tool,
2933
+ party: resolved.party,
2934
+ args,
2935
+ toolCallId,
2936
+ iteration,
2937
+ runId: runFactsOf(scope)?.runId,
2938
+ dispatch: searchDispatch,
2939
+ context: executionContext,
2940
+ })
2941
+ : undefined;
2654
2942
  executed = true;
2655
2943
  let result = await tool.execute(args, executionContext);
2944
+ if (negativeDispatch !== undefined)
2945
+ result = (0, capture_js_1.captureNegativeResult)(scope, negativeDispatch, result, tool);
2656
2946
  await endCall(toolCallId);
2947
+ const searchBoundary = (status) => ({
2948
+ call: { toolName, toolCallId, iteration },
2949
+ tool,
2950
+ ...(resolved.party !== undefined && { party: resolved.party }),
2951
+ args: negativeDispatch?.args ?? args,
2952
+ ...(searchDispatch !== undefined && { dispatch: searchDispatch }),
2953
+ ...(status !== undefined && { status }),
2954
+ });
2657
2955
  // The typed effects channel (9.19.0) — same unwrap as the batch loop,
2658
2956
  // at this path's own execute boundary, so a resumed call's envelope is
2659
2957
  // judged exactly as an inline one's.
@@ -2665,14 +2963,16 @@ function buildToolCallsHandler(deps) {
2665
2963
  // that died with an oversized result would be the silence this
2666
2964
  // primitive exists to break. An absence's status is the tool's own
2667
2965
  // and wins over the envelope's only when the envelope declared none.
2668
- const coverageStatus = declareCoverage(scope, { toolName, toolCallId, iteration }, envelope.content);
2966
+ const searched = searchFunnel.compose(scope, searchBoundary(envelope.status), envelope.content);
2967
+ const declaredContent = searched !== undefined ? searched.value : envelope.content;
2968
+ const coverageStatus = declareCoverage(scope, { toolName, toolCallId, iteration }, declaredContent, searched?.reading);
2669
2969
  const declaredStatus = envelope.status ?? coverageStatus;
2670
2970
  // The semantic envelope (9.53.0), on the unwrapped content — the
2671
2971
  // effects+semantics composition point: full envelope to the record,
2672
2972
  // projection to the model. BEFORE the ceiling, which must measure
2673
2973
  // what the model will actually read.
2674
- const semanticView = declareSemantics(scope, { toolName, toolCallId, iteration }, envelope.content);
2675
- const content = semanticView ?? envelope.content;
2974
+ const semanticView = declareSemantics(scope, { toolName, toolCallId, iteration }, declaredContent);
2975
+ const content = semanticView ?? declaredContent;
2676
2976
  // The tool's own ceiling (9.20.0) measures the CONTENT — the channel
2677
2977
  // that can overflow a context window. The DECLARED effects are small
2678
2978
  // validated data and are still judged by the caller: a tool that
@@ -2682,9 +2982,12 @@ function buildToolCallsHandler(deps) {
2682
2982
  // `result_refused` event keeps what was declared).
2683
2983
  const refusal = refuseOverCeiling(scope, { toolName, toolCallId, iteration }, tool, content, declaredStatus);
2684
2984
  if (refusal !== undefined) {
2985
+ if (negativeDispatch !== undefined)
2986
+ (0, capture_js_1.keepNegativeResultOut)(scope, negativeDispatch.resultId);
2685
2987
  return {
2686
2988
  result: refusal,
2687
2989
  executed: true,
2990
+ negativeResultId: negativeDispatch?.resultId,
2688
2991
  ceilingRefused: true,
2689
2992
  envelope: { ...envelope, content: refusal, status: 'invalid' },
2690
2993
  };
@@ -2694,9 +2997,12 @@ function buildToolCallsHandler(deps) {
2694
2997
  // path keeps every byte it had.
2695
2998
  const columnRefusal = judgeColumns(scope, { toolName, toolCallId, iteration }, content);
2696
2999
  if (columnRefusal !== undefined) {
3000
+ if (negativeDispatch !== undefined)
3001
+ (0, capture_js_1.keepNegativeResultOut)(scope, negativeDispatch.resultId);
2697
3002
  return {
2698
3003
  result: columnRefusal,
2699
3004
  executed: true,
3005
+ negativeResultId: negativeDispatch?.resultId,
2700
3006
  // The ceiling's flag, reused for the ceiling's reason: a refused
2701
3007
  // payload must not advance the step pointer on any path, and
2702
3008
  // there is exactly one fact here — the model did not get the
@@ -2708,7 +3014,8 @@ function buildToolCallsHandler(deps) {
2708
3014
  return {
2709
3015
  result: content,
2710
3016
  executed: true,
2711
- envelope: declaredStatus === envelope.status && semanticView === undefined
3017
+ negativeResultId: negativeDispatch?.resultId,
3018
+ envelope: declaredStatus === envelope.status && content === envelope.content
2712
3019
  ? envelope
2713
3020
  : {
2714
3021
  ...envelope,
@@ -2717,7 +3024,10 @@ function buildToolCallsHandler(deps) {
2717
3024
  },
2718
3025
  };
2719
3026
  }
2720
- const coverageStatus = declareCoverage(scope, { toolName, toolCallId, iteration }, result);
3027
+ const searched = searchFunnel.compose(scope, searchBoundary(undefined), result);
3028
+ if (searched !== undefined)
3029
+ result = searched.value;
3030
+ const coverageStatus = declareCoverage(scope, { toolName, toolCallId, iteration }, result, searched?.reading);
2721
3031
  // The semantic envelope (9.53.0) on this path's own execute boundary —
2722
3032
  // a resumed call's envelope is judged exactly as an inline one's.
2723
3033
  const semanticView = declareSemantics(scope, { toolName, toolCallId, iteration }, result);
@@ -2725,6 +3035,8 @@ function buildToolCallsHandler(deps) {
2725
3035
  result = semanticView;
2726
3036
  const refusal = refuseOverCeiling(scope, { toolName, toolCallId, iteration }, tool, result, coverageStatus);
2727
3037
  if (refusal !== undefined) {
3038
+ if (negativeDispatch !== undefined)
3039
+ (0, capture_js_1.keepNegativeResultOut)(scope, negativeDispatch.resultId);
2728
3040
  // Synthesized empty-effects envelope: the resume paths read the
2729
3041
  // routing status off `envelope.status`, and this is how a refused
2730
3042
  // NON-envelope result carries `'invalid'` there without every path
@@ -2732,6 +3044,7 @@ function buildToolCallsHandler(deps) {
2732
3044
  return {
2733
3045
  result: refusal,
2734
3046
  executed: true,
3047
+ negativeResultId: negativeDispatch?.resultId,
2735
3048
  ceilingRefused: true,
2736
3049
  envelope: { content: refusal, effects: [], status: 'invalid', malformed: [] },
2737
3050
  };
@@ -2740,9 +3053,12 @@ function buildToolCallsHandler(deps) {
2740
3053
  // resumed call's rows are judged exactly as an inline one's.
2741
3054
  const columnRefusal = judgeColumns(scope, { toolName, toolCallId, iteration }, result);
2742
3055
  if (columnRefusal !== undefined) {
3056
+ if (negativeDispatch !== undefined)
3057
+ (0, capture_js_1.keepNegativeResultOut)(scope, negativeDispatch.resultId);
2743
3058
  return {
2744
3059
  result: columnRefusal,
2745
3060
  executed: true,
3061
+ negativeResultId: negativeDispatch?.resultId,
2746
3062
  ceilingRefused: true,
2747
3063
  envelope: { content: columnRefusal, effects: [], status: 'invalid', malformed: [] },
2748
3064
  };
@@ -2762,12 +3078,19 @@ function buildToolCallsHandler(deps) {
2762
3078
  return {
2763
3079
  result,
2764
3080
  executed: true,
3081
+ negativeResultId: negativeDispatch?.resultId,
2765
3082
  envelope: { content: result, effects: [], status: coverageStatus, malformed: [] },
2766
3083
  };
2767
3084
  }
2768
- return { result, executed: true };
3085
+ return { result, executed: true, negativeResultId: negativeDispatch?.resultId };
2769
3086
  }
2770
3087
  catch (err) {
3088
+ if (ended !== undefined && err === ended) {
3089
+ // Nothing ran; the call's sessions are still released, and the run's
3090
+ // end — not a tool failure — is what the stage ends with.
3091
+ await endCall(toolCallId).catch(() => undefined);
3092
+ throw err;
3093
+ }
2771
3094
  // Settled by throwing is still settled — a tool that opened a session and
2772
3095
  // then failed must not keep it.
2773
3096
  await endCall(toolCallId);
@@ -2777,6 +3100,7 @@ function buildToolCallsHandler(deps) {
2777
3100
  error: true,
2778
3101
  // It ran — a tool that asked to pause had already started work.
2779
3102
  executed,
3103
+ negativeResultId: negativeDispatch?.resultId,
2780
3104
  };
2781
3105
  }
2782
3106
  // A tool that threw still RAN, and may have done half its work; the
@@ -2785,6 +3109,7 @@ function buildToolCallsHandler(deps) {
2785
3109
  result: err instanceof Error ? err.message : String(err),
2786
3110
  error: true,
2787
3111
  executed,
3112
+ negativeResultId: negativeDispatch?.resultId,
2788
3113
  };
2789
3114
  }
2790
3115
  };
@@ -2910,6 +3235,37 @@ function buildToolCallsHandler(deps) {
2910
3235
  ...(0, assistantReplay_js_1.assistantReplayFields)(scope),
2911
3236
  });
2912
3237
  }
3238
+ // ── ONE FROZEN COPY OF THE BATCH, for every pre-execute callback ──
3239
+ // The assistant turn just pushed holds every call's arguments — the
3240
+ // objects the calls run with. A callback that reads the history (the
3241
+ // permission checker, middleware, a check-in predicate, the evidence
3242
+ // assembler) gets it with this turn as a frozen copy, and each call's
3243
+ // `tool_start`, checker and predicate share that copy's arguments: one
3244
+ // copy of the batch, and nothing a callback holds reaches what runs.
3245
+ // Earlier turns are handed as they are: their calls already ran, and
3246
+ // deep-copying the whole conversation for every call would cost
3247
+ // O(conversation) per call.
3248
+ const turnAt = newHistory.length - 1;
3249
+ const pushedTurn = toolCalls.length > 0 ? newHistory[turnAt] : undefined;
3250
+ const frozenTurn = pushedTurn === undefined ? undefined : frozenTurnOf(pushedTurn);
3251
+ /**
3252
+ * The history a pre-execute callback is handed — the batch's turn frozen.
3253
+ * The one copy is shared only when freezing SEALED it (`isSealed`: every
3254
+ * JSON turn); a turn holding a container freezing leaves writable (a
3255
+ * `Map`, a `Date`, a typed array an app's provider put in a call) is
3256
+ * copied again for each callback, so none can change what the next sees.
3257
+ */
3258
+ const callbackHistory = () => {
3259
+ if (pushedTurn === undefined || frozenTurn === undefined)
3260
+ return [...newHistory];
3261
+ const turn = (0, frozenCopy_js_1.isSealed)(frozenTurn) ? frozenTurn : frozenTurnOf(pushedTurn);
3262
+ return newHistory.map((message, at) => (at === turnAt ? turn : message));
3263
+ };
3264
+ /** The batch's sealed copy of call `at`'s arguments, when there is one to share. */
3265
+ const frozenArgsAt = (at) => {
3266
+ const shared = frozenTurn?.toolCalls?.[at]?.args;
3267
+ return (0, frozenCopy_js_1.isSealed)(shared) ? shared : undefined;
3268
+ };
2913
3269
  // `lookupTool` is hoisted to the handler closure (shared with resume).
2914
3270
  // ── The model's `read_skill` pick: one-shot by construction ──────
2915
3271
  // Cleared at the TOP of every iteration that dispatches tools, and set
@@ -2996,10 +3352,45 @@ function buildToolCallsHandler(deps) {
2996
3352
  if (towers !== undefined) {
2997
3353
  (0, ledger_js_2.recordFindings)(scope, (0, contingent_js_1.contingentRowsOf)((0, contingent_js_1.groundedArgumentValues)(args, towers.gate, towers.corpus, towers.exempt), towers.corpus, towers.standingOf, { toolCallId: tc.id }, iteration), turnStampOf(scope));
2998
3354
  }
3355
+ // ── THIS CALL'S SHARED FROZEN COPY — `tool_start`, the permission
3356
+ // checker, a capability check and the check-in predicate (and, on a
3357
+ // pause, the request shown and its evidence assembler) all read ONE
3358
+ // frozen copy of the arguments, never the arguments the tool runs
3359
+ // with. The batch's copy when `args` is the call's own object;
3360
+ // remade only when the arguments are replaced, and after the
3361
+ // middleware chain (its links are handed the live arguments, by
3362
+ // contract, and may have edited them in place). Shared only while
3363
+ // freezing SEALED it (`isSealed` — every JSON value): arguments that
3364
+ // hold a `Map`, a `Set`, a `Date` or a typed array get a new copy for
3365
+ // each callback, so one cannot change what the next one judges.
3366
+ let viewed;
3367
+ let view;
3368
+ /** The batch's copy still shows these arguments — until a link could have edited them. */
3369
+ let batchCopyCurrent = true;
3370
+ const viewOf = (source) => {
3371
+ if (source === viewed && view !== undefined)
3372
+ return view;
3373
+ const batchCopy = batchCopyCurrent && source === tc.args ? frozenArgsAt(callIndex) : undefined;
3374
+ const copy = batchCopy ?? (0, frozenCopy_js_1.frozenView)(source);
3375
+ const shareable = copy !== undefined && (0, frozenCopy_js_1.isSealed)(copy);
3376
+ viewed = shareable ? source : undefined;
3377
+ view = shareable ? copy : undefined;
3378
+ return copy;
3379
+ };
3380
+ /** The history this call's callbacks are handed — made once per call when sealed. */
3381
+ let callHistory;
3382
+ const historyForCallbacks = () => {
3383
+ if (callHistory !== undefined)
3384
+ return callHistory;
3385
+ const made = callbackHistory();
3386
+ if (frozenTurn === undefined || (0, frozenCopy_js_1.isSealed)(frozenTurn))
3387
+ callHistory = made;
3388
+ return made;
3389
+ };
2999
3390
  emitToolStart(scope, {
3000
3391
  toolName: tc.name,
3001
3392
  toolCallId: tc.id,
3002
- args,
3393
+ args: viewOf(args) ?? args,
3003
3394
  ...(toolCalls.length > 1 && { parallelCount: toolCalls.length }),
3004
3395
  });
3005
3396
  const startMs = Date.now();
@@ -3054,6 +3445,7 @@ function buildToolCallsHandler(deps) {
3054
3445
  let denied = findingsRefusal !== undefined;
3055
3446
  /** True once `tool.execute` has been entered — see `afterMoment`. */
3056
3447
  let executed = false;
3448
+ let negativeDispatch;
3057
3449
  /** The tool's own `resultCeiling` refused this call's result (9.20.0)
3058
3450
  * — the call ran, but it must not complete a procedure step: the
3059
3451
  * refusal's own instruction is to call again. */
@@ -3063,14 +3455,15 @@ function buildToolCallsHandler(deps) {
3063
3455
  try {
3064
3456
  // Sequence is derived from history at check time (not parallel
3065
3457
  // state) — single source of truth, survives resumeOnError.
3066
- const sequence = (0, extractSequence_js_1.extractSequence)(newHistory, iteration);
3458
+ const sequence = (0, extractSequence_js_1.extractSequence)(historyForCallbacks(), iteration);
3067
3459
  const decision = await permissionChecker.check({
3068
3460
  capability: 'tool_call',
3069
3461
  actor: 'agent',
3070
3462
  target: tc.name,
3071
- context: runArgs,
3463
+ // The call's shared frozen copy, never the arguments it runs with.
3464
+ context: checkerContextOf(viewOf(runArgs)),
3072
3465
  sequence,
3073
- history: newHistory,
3466
+ history: historyForCallbacks(),
3074
3467
  iteration,
3075
3468
  ...(runIdentity && { identity: runIdentity }),
3076
3469
  ...(env.signal && { signal: env.signal }),
@@ -3114,6 +3507,10 @@ function buildToolCallsHandler(deps) {
3114
3507
  }
3115
3508
  }
3116
3509
  catch (permErr) {
3510
+ // A checker that wrote into its frozen `context` lands here too —
3511
+ // said once, in dev mode, so a checker that normalised in place
3512
+ // does not deny every call in silence.
3513
+ (0, frozenCopy_js_1.warnFrozenWrite)('permission checker', permErr, 'the call was denied');
3117
3514
  // A checker that threw is treated as deny-by-default — fail closed:
3118
3515
  // something that did not answer did not say yes.
3119
3516
  //
@@ -3166,8 +3563,8 @@ function buildToolCallsHandler(deps) {
3166
3563
  capability,
3167
3564
  actor: 'agent',
3168
3565
  target,
3169
- context: callArgs,
3170
- history: newHistory,
3566
+ context: checkerContextOf(viewOf(callArgs)),
3567
+ history: historyForCallbacks(),
3171
3568
  iteration,
3172
3569
  ...(runIdentity && { identity: runIdentity }),
3173
3570
  ...(env.signal && { signal: env.signal }),
@@ -3199,6 +3596,7 @@ function buildToolCallsHandler(deps) {
3199
3596
  }
3200
3597
  }
3201
3598
  catch (permErr) {
3599
+ (0, frozenCopy_js_1.warnFrozenWrite)('permission checker', permErr, 'the call was denied');
3202
3600
  // Fail closed, and say so terminally — the 9.4.0 lesson applies
3203
3601
  // whole: an operator's outage text reads as weather to a model.
3204
3602
  denied = true;
@@ -3287,7 +3685,7 @@ function buildToolCallsHandler(deps) {
3287
3685
  toolCallId: tc.id,
3288
3686
  iteration,
3289
3687
  args: callArgs,
3290
- history: newHistory,
3688
+ history: historyForCallbacks(),
3291
3689
  ...(runIdentity && { identity: runIdentity }),
3292
3690
  ...(env.signal && { signal: env.signal }),
3293
3691
  // One human question per resume: this batch already asked the
@@ -3295,15 +3693,45 @@ function buildToolCallsHandler(deps) {
3295
3693
  // gets the chain's named refusal and the tool does not run.
3296
3694
  ...(oneQuestionAsked && { askPolicy: 'refuse' }),
3297
3695
  });
3696
+ // The rules the asked call still has to pass once the person
3697
+ // answers: the asking link and every link after it, by name.
3698
+ const askChain = chain.kind === 'ask'
3699
+ ? deps.toolMiddleware.slice(chain.index).map((link) => link.name)
3700
+ : undefined;
3701
+ // The request the person would be asked (`core/consentRequest.ts`):
3702
+ // an id their decision must quote, bound to a detached copy of this
3703
+ // exact call — the args AS TRANSFORMED SO FAR, where the chain
3704
+ // resumes and the rules from there on. Minted only for a call that
3705
+ // is about to pause.
3706
+ const bound = chain.kind === 'ask'
3707
+ ? (0, consentRequest_js_1.mintConsentRequest)({
3708
+ gate: 'ask',
3709
+ tool: tc.name,
3710
+ toolCallId: tc.id,
3711
+ party: resolved.party,
3712
+ args: chain.args,
3713
+ middleware: chain.middleware,
3714
+ askIndex: chain.index,
3715
+ chain: askChain,
3716
+ }, decisionLedger)
3717
+ : undefined;
3718
+ // An ask no approval could be bound to asked nobody, and its row
3719
+ // says so (`unboundAskRows`).
3720
+ const chainRows = chain.kind === 'ask' && bound === undefined
3721
+ ? unboundAskRows(chain.decisions, chain.middleware, chain.payload.question)
3722
+ : chain.decisions;
3298
3723
  // Under the inputs layer, a rewrite of a RULED tool's arguments is
3299
3724
  // filed with the NAMES of the keys it changed (honesty layer 2) —
3300
3725
  // the answer's standing reads a rewritten ruled argument with no
3301
3726
  // declared origin as assumed. Every other row: as it always was.
3302
- (0, ledger_js_1.recordDecisions)(scope, inputs !== undefined
3303
- ? inputs.decisionsToRecord(tool, chain.decisions)
3304
- : chain.decisions);
3727
+ (0, ledger_js_1.recordDecisions)(scope, inputs !== undefined ? inputs.decisionsToRecord(tool, chainRows) : chainRows);
3305
3728
  callArgs = chain.args;
3306
3729
  chainedArgs = chain.args;
3730
+ // The links were handed the live arguments (a link rewrites by what
3731
+ // it hands back, and may have edited them in place): the shared
3732
+ // frozen copy is made again from what the chain handed back.
3733
+ viewed = undefined;
3734
+ batchCopyCurrent = false;
3307
3735
  if (chain.kind === 'deny') {
3308
3736
  denied = true;
3309
3737
  // A link that ASKED, refused by the one-question law: the person's
@@ -3313,7 +3741,13 @@ function buildToolCallsHandler(deps) {
3313
3741
  ? chain.reason + askedLayer.keptNote(scope, tc.name, resolution)
3314
3742
  : chain.reason;
3315
3743
  }
3316
- else if (chain.kind === 'ask') {
3744
+ else if (chain.kind === 'ask' && bound === undefined) {
3745
+ // A call no approval could be bound to is refused, never asked.
3746
+ denied = true;
3747
+ error = true;
3748
+ result = unboundCallRefusal(tc.name, 'ask');
3749
+ }
3750
+ else if (chain.kind === 'ask' && bound !== undefined) {
3317
3751
  // The typed half of the question (9.24.0), judged BEFORE anything
3318
3752
  // is committed: a component the screen could not render must
3319
3753
  // refuse here, at the source, not pause and be discovered. The
@@ -3327,16 +3761,18 @@ function buildToolCallsHandler(deps) {
3327
3761
  : undefined;
3328
3762
  // Commit partial state so resume() finds history intact (the
3329
3763
  // pauseHere / check-in path does the same). The TRANSFORMED args
3330
- // ride the checkpoint: a person approves what the chain produced,
3331
- // not what the model originally proposed.
3764
+ // ride the checkpoint — the bound copy: a person approves what the
3765
+ // chain produced, not what the model originally proposed.
3332
3766
  scope.history = newHistory;
3333
3767
  scope.pausedToolCallId = tc.id;
3334
3768
  scope.pausedToolName = tc.name;
3335
3769
  scope.pausedToolStartMs = startMs;
3336
3770
  scope.pausedAsk = true;
3337
- scope.pausedAskArgs = chain.args;
3771
+ scope.pausedAskArgs = bound.args;
3338
3772
  scope.pausedAskIndex = chain.index;
3339
3773
  scope.pausedAskMiddleware = chain.middleware;
3774
+ scope.pausedAskChain = askChain;
3775
+ scope.pausedRequest = bound.request;
3340
3776
  // The party this call was resolved against (9.92.0) — so a resume
3341
3777
  // in a FRESH instance dispatches to the same party, never to the
3342
3778
  // build-time map's first holder. Pause-path-only.
@@ -3354,7 +3790,7 @@ function buildToolCallsHandler(deps) {
3354
3790
  return {
3355
3791
  toolCallId: tc.id,
3356
3792
  toolName: tc.name,
3357
- ask: { ...chain.payload, middleware: chain.middleware },
3793
+ ask: { ...chain.payload, middleware: chain.middleware, id: bound.request.id },
3358
3794
  };
3359
3795
  }
3360
3796
  }
@@ -3450,12 +3886,32 @@ function buildToolCallsHandler(deps) {
3450
3886
  if (!denied && !argsRejected && tool && tool.checkIn !== undefined && deps.checkIn) {
3451
3887
  // Computed ONLY for a checkIn-declaring tool → zero cost otherwise.
3452
3888
  // Shape shared with the ask-resume gate; see `historyForCheckIn`.
3453
- const historyForEvidence = historyForCheckIn(scope, newHistory);
3454
- if (!(0, checkin_js_1.shouldCheckIn)(tool.checkIn, callArgs, {
3889
+ const historyForEvidence = historyForCheckIn(scope, historyForCallbacks());
3890
+ const trips = (0, checkin_js_1.shouldCheckIn)(tool.checkIn, viewOf(callArgs) ?? callArgs, {
3455
3891
  iteration,
3456
3892
  toolCallId: tc.id,
3457
3893
  history: historyForEvidence,
3458
- })) {
3894
+ });
3895
+ // The request the person would be asked (`core/consentRequest.ts`):
3896
+ // an id their decision must quote, bound to a detached copy of this
3897
+ // exact call — minted only for a call that is about to pause.
3898
+ const bound = trips && askedLayer === undefined
3899
+ ? (0, consentRequest_js_1.mintConsentRequest)({
3900
+ gate: 'checkIn',
3901
+ tool: tc.name,
3902
+ toolCallId: tc.id,
3903
+ party: resolved.party,
3904
+ args: callArgs,
3905
+ }, decisionLedger)
3906
+ : undefined;
3907
+ // What the person is shown — and the evidence assembler and every
3908
+ // `checkin.request` listener handed: the call's shared frozen copy
3909
+ // (equal to `bound.args`, which was copied from the same arguments).
3910
+ // The paused state keeps `bound.args`, the copy the request is bound
3911
+ // to, so nothing that sees the question can change the call the
3912
+ // answer runs.
3913
+ const shown = bound === undefined ? undefined : viewOf(callArgs);
3914
+ if (!trips) {
3459
3915
  // Predicate said no — fall through to the normal credential+execute
3460
3916
  // path below (this `if` block is the ONLY thing the gate adds).
3461
3917
  }
@@ -3472,6 +3928,12 @@ function buildToolCallsHandler(deps) {
3472
3928
  askedLayer.secondPauseRefusal(tc.name, 'check-in') +
3473
3929
  askedLayer.keptNote(scope, tc.name, resolution);
3474
3930
  }
3931
+ else if (bound === undefined || shown === undefined) {
3932
+ // A call no approval could be bound to is refused, never asked.
3933
+ checkInRefused = true;
3934
+ error = true;
3935
+ result = unboundCallRefusal(tc.name, 'checkIn');
3936
+ }
3475
3937
  else {
3476
3938
  // The tool's declared decision component (9.24.0), judged BEFORE
3477
3939
  // the evidence pack is assembled — a gate that cannot be honored
@@ -3481,18 +3943,28 @@ function buildToolCallsHandler(deps) {
3481
3943
  ? await assertComponentDeliverable(scope, tc.name, tool.checkInComponent, `tool '${tc.name}' checkInComponent`)
3482
3944
  : undefined;
3483
3945
  const intent = scope.llmLatestContent ? String(scope.llmLatestContent) : undefined;
3484
- const evidence = await deps.checkIn.assembler({
3485
- tool: { name: tc.name, description: tool.schema.description },
3486
- args: callArgs,
3487
- ...(intent !== undefined && { intent }),
3488
- iteration,
3489
- history: historyForEvidence,
3490
- scorer: deps.checkIn.scorer,
3491
- ...(env.signal && { signal: env.signal }),
3492
- });
3946
+ let evidence;
3947
+ try {
3948
+ evidence = await deps.checkIn.assembler({
3949
+ tool: { name: tc.name, description: tool.schema.description },
3950
+ args: shown,
3951
+ ...(intent !== undefined && { intent }),
3952
+ iteration,
3953
+ history: historyForEvidence,
3954
+ scorer: deps.checkIn.scorer,
3955
+ ...(env.signal && { signal: env.signal }),
3956
+ });
3957
+ }
3958
+ catch (err) {
3959
+ // An assembler that wrote into its frozen arguments fails the
3960
+ // check-in as any throw does — said once, in dev mode.
3961
+ (0, frozenCopy_js_1.warnFrozenWrite)('check-in evidence assembler', err, 'the check-in failed');
3962
+ throw err;
3963
+ }
3493
3964
  const request = {
3965
+ id: bound.request.id,
3494
3966
  tool: tc.name,
3495
- args: callArgs,
3967
+ args: shown,
3496
3968
  ...(intent !== undefined && { intent }),
3497
3969
  evidence,
3498
3970
  ...(gateComponent !== undefined && { component: gateComponent }),
@@ -3504,14 +3976,15 @@ function buildToolCallsHandler(deps) {
3504
3976
  request: request,
3505
3977
  });
3506
3978
  // Commit partial state so resume() finds history intact (mirror the
3507
- // pauseHere path). The proposed args ride the checkpoint so an
3508
- // APPROVED tool can execute on resume.
3979
+ // pauseHere path). The bound copy of the args rides the checkpoint,
3980
+ // so an APPROVED tool executes exactly what was asked.
3509
3981
  scope.history = newHistory;
3510
3982
  scope.pausedToolCallId = tc.id;
3511
3983
  scope.pausedToolName = tc.name;
3512
3984
  scope.pausedToolStartMs = startMs;
3513
3985
  scope.pausedCheckIn = true;
3514
- scope.pausedCheckInArgs = callArgs;
3986
+ scope.pausedCheckInArgs = bound.args;
3987
+ scope.pausedRequest = bound.request;
3515
3988
  // Same carrier as the middleware-ask pause (9.92.0).
3516
3989
  if (resolved.party !== undefined)
3517
3990
  scope.pausedToolParty = resolved.party;
@@ -3701,8 +4174,27 @@ function buildToolCallsHandler(deps) {
3701
4174
  ...sessionContext(scope, tc.name, tc.id),
3702
4175
  ...toolDispatchCtx(scope, { toolName: tc.name, toolCallId: tc.id, iteration }, env.signal),
3703
4176
  };
4177
+ // `Tool.search`: the result identity is reserved and the dispatch
4178
+ // instant taken just BEFORE the call runs (the row's address,
4179
+ // never the provider's call id; a relative window's clock).
4180
+ const searchDispatch = searchFunnel.dispatch(scope, tool, callTime);
4181
+ negativeDispatch =
4182
+ deps.negativeClaimsArmed === true
4183
+ ? (0, capture_js_1.startNegativeCall)(scope, {
4184
+ tool,
4185
+ party: resolved.party,
4186
+ args: callArgs,
4187
+ toolCallId: tc.id,
4188
+ iteration,
4189
+ runId: runFactsOf(scope)?.runId,
4190
+ dispatch: searchDispatch,
4191
+ context: executionContext,
4192
+ })
4193
+ : undefined;
3704
4194
  executed = true;
3705
4195
  result = await tool.execute(callArgs, executionContext);
4196
+ if (negativeDispatch !== undefined)
4197
+ result = (0, capture_js_1.captureNegativeResult)(scope, negativeDispatch, result, tool);
3706
4198
  // A code-runner tool leaves the SHAPE of what it just ran, keyed by
3707
4199
  // this call. Taken and deleted here so the map cannot grow across
3708
4200
  // a long run, and emitted from the dispatch loop rather than from
@@ -3748,7 +4240,20 @@ function buildToolCallsHandler(deps) {
3748
4240
  // it; otherwise an absence names the delivered outcome, so an
3749
4241
  // `onToolStatus` edge can route "we looked and there was
3750
4242
  // nothing" somewhere other than "the call broke".
3751
- const coverageStatus = declareCoverage(scope, { toolName: tc.name, toolCallId: tc.id, iteration }, result);
4243
+ // `Tool.search` — the coverage composed from the declaration and
4244
+ // the arguments the call ran with, BEFORE everything that reads
4245
+ // the value: the composed absence is what the model is served.
4246
+ const searched = searchFunnel.compose(scope, {
4247
+ call: { toolName: tc.name, toolCallId: tc.id, iteration },
4248
+ tool,
4249
+ ...(resolved.party !== undefined && { party: resolved.party }),
4250
+ args: negativeDispatch?.args ?? callArgs,
4251
+ ...(searchDispatch !== undefined && { dispatch: searchDispatch }),
4252
+ ...(toolStatus !== undefined && { status: toolStatus }),
4253
+ }, result);
4254
+ if (searched !== undefined)
4255
+ result = searched.value;
4256
+ const coverageStatus = declareCoverage(scope, { toolName: tc.name, toolCallId: tc.id, iteration }, result, searched?.reading);
3752
4257
  if (toolStatus === undefined)
3753
4258
  toolStatus = coverageStatus;
3754
4259
  // The semantic envelope (9.53.0), on the unwrapped content and
@@ -3773,6 +4278,8 @@ function buildToolCallsHandler(deps) {
3773
4278
  // (the declared one rides the `result_refused` event).
3774
4279
  const overflowRefusal = refuseOverCeiling(scope, { toolName: tc.name, toolCallId: tc.id, iteration }, tool, result, toolStatus);
3775
4280
  if (overflowRefusal !== undefined) {
4281
+ if (negativeDispatch !== undefined)
4282
+ (0, capture_js_1.keepNegativeResultOut)(scope, negativeDispatch.resultId);
3776
4283
  ceilingRefused = true;
3777
4284
  result = overflowRefusal;
3778
4285
  toolStatus = 'invalid';
@@ -3784,6 +4291,8 @@ function buildToolCallsHandler(deps) {
3784
4291
  // arguing about.
3785
4292
  const columnRefusal = judgeColumns(scope, { toolName: tc.name, toolCallId: tc.id, iteration }, result);
3786
4293
  if (columnRefusal !== undefined) {
4294
+ if (negativeDispatch !== undefined)
4295
+ (0, capture_js_1.keepNegativeResultOut)(scope, negativeDispatch.resultId);
3787
4296
  ceilingRefused = true;
3788
4297
  result = columnRefusal;
3789
4298
  toolStatus = 'invalid';
@@ -3836,6 +4345,8 @@ function buildToolCallsHandler(deps) {
3836
4345
  // The pause writes: partial state, so resume() can find the
3837
4346
  // history intact.
3838
4347
  const writePause = () => {
4348
+ if (negativeDispatch !== undefined)
4349
+ (0, capture_js_1.pauseNegativeCall)(scope, negativeDispatch.resultId);
3839
4350
  scope.history = newHistory;
3840
4351
  scope.pausedToolCallId = tc.id;
3841
4352
  scope.pausedToolName = tc.name;
@@ -4194,6 +4705,7 @@ function buildToolCallsHandler(deps) {
4194
4705
  iteration,
4195
4706
  args: callArgs,
4196
4707
  result,
4708
+ negativeResultId: negativeDispatch?.resultId,
4197
4709
  ...(error === true && { error: true }),
4198
4710
  history: newHistory,
4199
4711
  ...(runIdentity && { identity: runIdentity }),
@@ -4239,13 +4751,16 @@ function buildToolCallsHandler(deps) {
4239
4751
  ...(modelResult !== capped.result && { modelResult }),
4240
4752
  ...(executed && changedKeys.length > 0 && { changedArgKeys: changedKeys }),
4241
4753
  ...(denied && { notExecuted: true }),
4242
- }, executed, toolEnvelope?.status);
4754
+ }, executed, toolEnvelope?.status, negativeDispatch?.resultId, callArgs);
4243
4755
  let resultStr = typeof modelResult === 'string' ? modelResult : (0, validators_js_1.safeStringify)(modelResult);
4244
4756
  // The tool's OWN answer, before any framework suffix joins it — what
4245
4757
  // the repeated-call ledger fingerprints. Fingerprinting the decorated
4246
4758
  // string instead would compare our own additions (a step that advanced
4247
4759
  // once, an effect note) and miss the repeat they decorate.
4248
4760
  const deliveredResult = resultStr;
4761
+ if (deps.negativeClaimsArmed === true)
4762
+ resultStr = (0, capture_js_1.serveNegativeHandle)(scope, negativeDispatch?.resultId, resultStr);
4763
+ const hasNegativeNote = resultStr !== deliveredResult;
4249
4764
  // ── Step boundary (9.18.0): advance decided, then decorate, THEN
4250
4765
  // push — the suffix must be part of the one past every reader sees
4251
4766
  // (history, `lastToolResult`, the batch), never spliced in later.
@@ -4358,7 +4873,7 @@ function buildToolCallsHandler(deps) {
4358
4873
  toolCallId: tc.id,
4359
4874
  toolName: tc.name,
4360
4875
  ...(deps.findings === true && !executed && { toolResultOrigin: 'not-entered' }),
4361
- ...(layerNote !== '' && { toolChars: deliveredResult.length }),
4876
+ ...((layerNote !== '' || hasNegativeNote) && { toolChars: deliveredResult.length }),
4362
4877
  ...(tc.argumentsFailure !== undefined && {
4363
4878
  toolArgumentsFailure: { ...tc.argumentsFailure },
4364
4879
  }),
@@ -4481,12 +4996,30 @@ function buildToolCallsHandler(deps) {
4481
4996
  return undefined; // explicit: no pause, flow continues to loopTo
4482
4997
  },
4483
4998
  resume: async (scope, input) => {
4999
+ // A consent gate's answer is a DECISION for ONE request: held to the
5000
+ // request this run paused on and to the exact call it was bound to —
5001
+ // refused (thrown) before anything below writes or runs. The two
5002
+ // decision paths further down spend it as their first act, once.
5003
+ const consentGate = scope.pausedAsk === true ? 'ask' : scope.pausedCheckIn === true ? 'checkIn' : undefined;
5004
+ // Taken up here, too: a composition resumes this chart without an
5005
+ // agent's own `resume()`, and a door watching the paused request must
5006
+ // still know that every use of its decision passes through the spend
5007
+ // below (`consentRequest.ts` · `watchDecisionUse`).
5008
+ if (consentGate !== undefined) {
5009
+ (0, consentRequest_js_1.noteDecisionTakenUp)((0, consentRequest_js_1.recordedRequestId)(scope.$getValue('pausedRequest')));
5010
+ }
5011
+ // The run's signal, read while the stage is live: the engine stops
5012
+ // waiting on this stage when the run is aborted, but the stage goes on,
5013
+ // and a decision must not be spent — nor its call run — by a resume
5014
+ // nobody is waiting for any more (`spendDecision`).
5015
+ const runSignal = scope.$getEnv().signal;
4484
5016
  // Same barrier as `execute`, for the same reason: an approved check-in
4485
5017
  // runs the REAL tool here, and that side effect must not go out ahead of
4486
5018
  // the state the last write is still carrying.
4487
5019
  const durable = deps.awaitDurable?.();
4488
5020
  if (durable)
4489
5021
  await durable;
5022
+ const consentDecision = consentGate === undefined ? undefined : heldAnswer(scope, input, consentGate);
4490
5023
  // The time layer: the paused turn's clock is KEPT — its words were
4491
5024
  // resolved against it. A resume that passed a different `time` is
4492
5025
  // recorded here, first, and never applied (TQ21).
@@ -4537,21 +5070,26 @@ function buildToolCallsHandler(deps) {
4537
5070
  // this call may proceed, and on approval the REAL tool runs — the person
4538
5071
  // never writes the tool's answer, and neither does the middleware.
4539
5072
  //
4540
- // A malformed resume DECLINES, for the same reason the check-in path
4541
- // does: a governed call must never execute because a message was
4542
- // mis-shaped.
4543
- if (scope.pausedAsk === true) {
5073
+ // A malformed resume never reaches here: `heldAnswer` refused it at the
5074
+ // top (a governed call never executes, and nobody's decline is invented,
5075
+ // because a message was mis-shaped).
5076
+ if (consentGate === 'ask' && consentDecision !== undefined) {
4544
5077
  const iteration = scope.iteration;
4545
- const args = (scope.pausedAskArgs ?? {});
5078
+ // What the rest of the chain is handed: a detached copy of the
5079
+ // approved arguments (`boundArgsOf`). The arguments that come back are
5080
+ // held to the REQUEST, never to this copy — a link that edits it in
5081
+ // place edits the copy — and the tool runs on another fresh copy.
5082
+ const args = boundArgsOf(scope, 'pausedAskArgs');
4546
5083
  const askIndex = (scope.pausedAskIndex ?? 0);
4547
5084
  const askedBy = (scope.pausedAskMiddleware ?? 'middleware');
4548
5085
  // The registered component that COLLECTED this decision (9.24.0),
4549
5086
  // written at pause time only when the ask carried one — the ledger
4550
5087
  // rows below then say which surface the person answered through.
4551
5088
  const answeredVia = scope.pausedComponentId;
4552
- const decision = (0, checkin_js_1.isCheckInDecision)(input)
4553
- ? input
4554
- : (0, checkin_js_1.checkInDeclined)({ by: 'unknown', note: 'resume input was not a CheckInDecision' });
5089
+ const decision = consentDecision;
5090
+ // Used from here — so spent here, before any row or the tool: a second
5091
+ // resume presenting it is refused ('already-answered').
5092
+ await (0, consentRequest_js_1.spendDecision)(decisionLedger, decision, 'ask', runSignal);
4555
5093
  let result;
4556
5094
  /** What the model reads. Differs from `result` only when a rule at the
4557
5095
  * after-tool moment transformed or withheld it. */
@@ -4564,8 +5102,9 @@ function buildToolCallsHandler(deps) {
4564
5102
  let resumeEnvelope;
4565
5103
  /** The tool ran (any outcome) — the judge's gate (9.104.0). */
4566
5104
  let toolRan = false;
5105
+ let negativeResultId;
4567
5106
  if (!decision.approved) {
4568
- result = decision.note ? `declined by human: ${decision.note}` : 'declined by human';
5107
+ result = (0, checkin_js_1.declinedResult)(decision.note);
4569
5108
  (0, ledger_js_1.recordDecisions)(scope, [
4570
5109
  {
4571
5110
  middleware: askedBy,
@@ -4644,6 +5183,21 @@ function buildToolCallsHandler(deps) {
4644
5183
  askPolicy: 'refuse',
4645
5184
  });
4646
5185
  (0, ledger_js_1.recordDecisions)(scope, rest.decisions);
5186
+ // The approval covers the arguments the person was shown. The ones
5187
+ // the rest of the chain hands back must re-derive the paused
5188
+ // request's id (`runsAsAsked`) — held to the request itself, never
5189
+ // to the copy the links were handed. Any other arguments are not
5190
+ // approved: the call does not run, and the record and the model
5191
+ // are told why ('call-changed').
5192
+ const read = (key) => scope.$getValue(key);
5193
+ const rewrittenBy = rest.kind === 'deny' ||
5194
+ (0, consentRequest_js_1.runsAsAsked)(read('pausedRequest'), (0, consentRequest_js_1.gatedCallOf)(read, 'ask'), rest.args)
5195
+ ? undefined
5196
+ : changedAfterApproval(rest.decisions);
5197
+ // The arguments the call runs with: a fresh copy of the approved
5198
+ // ones (equal, by the check above, to what the chain handed back),
5199
+ // so nothing a link still holds can reach the tool.
5200
+ const runArgs = boundArgsOf(scope, 'pausedAskArgs');
4647
5201
  // Would this tool's OWN consent gate have fired for this call? Asked by
4648
5202
  // EVALUATING the demand, not by noticing that one was declared (8.13.0).
4649
5203
  // Before that, any tool carrying a `checkIn` field was refused here even
@@ -4651,12 +5205,16 @@ function buildToolCallsHandler(deps) {
4651
5205
  // the £5 refunds it was written to let through, and the refusal claimed a
4652
5206
  // consent gate would have run when it provably would not have.
4653
5207
  //
4654
- // Judged on `rest.args` (what the tool would actually run with) and on
5208
+ // Judged on `runArgs` (what the tool would actually run with) and on
4655
5209
  // the same history shape the loop's gate uses, so the answer cannot
4656
- // depend on which door the call arrived through.
5210
+ // depend on which door the call arrived through. The predicate is
5211
+ // handed its own frozen copy of them (`shouldCheckIn`), never
5212
+ // `runArgs` itself: a predicate that wrote into its argument used
5213
+ // to change the call the person had approved.
4657
5214
  const demandTrips = rest.kind !== 'deny' &&
5215
+ rewrittenBy === undefined &&
4658
5216
  tool?.checkIn !== undefined &&
4659
- (0, checkin_js_1.shouldCheckIn)(tool.checkIn, rest.args, {
5217
+ (0, checkin_js_1.shouldCheckIn)(tool.checkIn, runArgs, {
4660
5218
  iteration,
4661
5219
  toolCallId,
4662
5220
  history: historyForCheckIn(scope, scope.history),
@@ -4664,6 +5222,24 @@ function buildToolCallsHandler(deps) {
4664
5222
  if (rest.kind === 'deny') {
4665
5223
  result = rest.reason;
4666
5224
  }
5225
+ else if (rewrittenBy !== undefined) {
5226
+ error = true;
5227
+ result = rewrittenAfterApproval(toolName, rewrittenBy);
5228
+ (0, ledger_js_1.recordDecisions)(scope, [
5229
+ {
5230
+ middleware: askedBy,
5231
+ moment: 'before-tool',
5232
+ at: 'tool',
5233
+ toolName,
5234
+ toolCallId,
5235
+ iteration,
5236
+ outcome: 'deny',
5237
+ changed: false,
5238
+ why: `the approval covers the arguments the person was shown; ${rewrittenBy}, ` +
5239
+ `so the call was not run (call-changed)`,
5240
+ },
5241
+ ]);
5242
+ }
4667
5243
  else if (demandTrips) {
4668
5244
  // The one-question rule, from the other direction: this tool's own
4669
5245
  // consent gate really does demand a person for THESE arguments, and
@@ -4695,10 +5271,29 @@ function buildToolCallsHandler(deps) {
4695
5271
  }
4696
5272
  else {
4697
5273
  const env = scope.$getEnv();
4698
- const dispatched = await resolveCredentialAndExecute(scope, resolved, toolName, rest.args, toolCallId, iteration, env);
5274
+ const dispatched = await resolveCredentialAndExecute(scope, resolved, toolName, runArgs, toolCallId, iteration, env, 'ask');
5275
+ negativeResultId = dispatched.negativeResultId;
4699
5276
  result = dispatched.result;
4700
5277
  error = dispatched.error;
4701
5278
  toolRan = dispatched.executed === true;
5279
+ // Held to the request at the last moment and found changed: the
5280
+ // record says so, as for a rewrite the chain handed back.
5281
+ if (dispatched.callChanged === true) {
5282
+ (0, ledger_js_1.recordDecisions)(scope, [
5283
+ {
5284
+ middleware: askedBy,
5285
+ moment: 'before-tool',
5286
+ at: 'tool',
5287
+ toolName,
5288
+ toolCallId,
5289
+ iteration,
5290
+ outcome: 'deny',
5291
+ changed: false,
5292
+ why: 'the approval covers the arguments the person was shown; they changed ' +
5293
+ 'before the call could run, so the call was not run (call-changed)',
5294
+ },
5295
+ ]);
5296
+ }
4702
5297
  // A ceiling-refused call RAN but must not advance a step (9.20.0);
4703
5298
  // its envelope — status 'invalid' plus any surviving declared
4704
5299
  // effects — is still picked up and judged below.
@@ -4714,7 +5309,7 @@ function buildToolCallsHandler(deps) {
4714
5309
  // sentence BEFORE the chain's last word, the execute loop's
4715
5310
  // composition kept.
4716
5311
  if (frameworkSkipStepAnswered(toolName, tool) && stepToolRan) {
4717
- result = applySkipStep(scope, { args: rest.args, toolCallId, iteration });
5312
+ result = applySkipStep(scope, { args: runArgs, toolCallId, iteration });
4718
5313
  }
4719
5314
  // present behind a middleware ask, approved (9.22.0): same
4720
5315
  // overwrite the batch loop applies — the snapshot (or refusal)
@@ -4722,7 +5317,7 @@ function buildToolCallsHandler(deps) {
4722
5317
  // is an errored call here too.
4723
5318
  if (deps.artifactStore && toolName === present_js_1.PRESENT_TOOL_NAME && stepToolRan) {
4724
5319
  const presented = await applyPresent(scope, {
4725
- args: rest.args,
5320
+ args: runArgs,
4726
5321
  toolCallId,
4727
5322
  iteration,
4728
5323
  });
@@ -4741,8 +5336,9 @@ function buildToolCallsHandler(deps) {
4741
5336
  toolName,
4742
5337
  toolCallId,
4743
5338
  iteration,
4744
- args: rest.args,
5339
+ args: runArgs,
4745
5340
  result,
5341
+ negativeResultId,
4746
5342
  ...(error === true && { error: true }),
4747
5343
  history: [...scope.history],
4748
5344
  ...(scope.runIdentity && { identity: scope.runIdentity }),
@@ -4763,6 +5359,9 @@ function buildToolCallsHandler(deps) {
4763
5359
  const askCapped = capResults(toolName, askPlaced);
4764
5360
  modelResult = askCapped.modelResult;
4765
5361
  let askResultStr = typeof modelResult === 'string' ? modelResult : (0, validators_js_1.safeStringify)(modelResult);
5362
+ const askToolChars = askResultStr.length;
5363
+ if (deps.negativeClaimsArmed === true)
5364
+ askResultStr = (0, capture_js_1.serveNegativeHandle)(scope, negativeResultId, askResultStr);
4766
5365
  // Step boundary (9.18.0) — a result finalized HERE is as final as one
4767
5366
  // from the batch loop; the answered call advances the pointer before
4768
5367
  // the push, exactly as it would have inline.
@@ -4783,6 +5382,7 @@ function buildToolCallsHandler(deps) {
4783
5382
  {
4784
5383
  role: 'tool',
4785
5384
  content: askResultStr,
5385
+ ...(deps.negativeClaimsArmed === true && { toolChars: askToolChars }),
4786
5386
  toolCallId,
4787
5387
  toolName,
4788
5388
  ...(deps.findings === true &&
@@ -4812,7 +5412,7 @@ function buildToolCallsHandler(deps) {
4812
5412
  ...(askCapped.modelResult !== askCapped.result && {
4813
5413
  modelResult: askCapped.modelResult,
4814
5414
  }),
4815
- }, toolRan);
5415
+ }, toolRan, undefined, negativeResultId, args);
4816
5416
  bracketSettled(scope, askSettlement);
4817
5417
  (0, typedEmit_js_1.typedEmit)(scope, 'agentfootprint.agent.iteration_end', {
4818
5418
  turnIndex: 0,
@@ -4831,6 +5431,9 @@ function buildToolCallsHandler(deps) {
4831
5431
  scope.pausedAskArgs = undefined;
4832
5432
  scope.pausedAskIndex = undefined;
4833
5433
  scope.pausedAskMiddleware = undefined;
5434
+ scope.pausedAskChain = undefined;
5435
+ // The request was answered — and spent — by this resume.
5436
+ scope.pausedRequest = undefined;
4834
5437
  // Cleared ONLY when it was set: a later component-less pause in this
4835
5438
  // run must not inherit this ask's surface, and a run that never
4836
5439
  // carried one must not gain the key (byte-identical).
@@ -4850,15 +5453,19 @@ function buildToolCallsHandler(deps) {
4850
5453
  // comes BEFORE execute); on DECLINE a model-visible tool_result lands so
4851
5454
  // the agent adapts in-loop. The typed `checkin.decision` event fires
4852
5455
  // either way. Same iteration semantics as resume-after-askHuman.
4853
- if (scope.pausedCheckIn === true) {
5456
+ if (consentGate === 'checkIn' && consentDecision !== undefined) {
4854
5457
  const iteration = scope.iteration;
4855
- const args = (scope.pausedCheckInArgs ?? {});
4856
- // A check-in pause MUST be resumed with a CheckInDecision. A mis-wired
4857
- // resume (a bare string, say) declines by default — a consequential
4858
- // tool can never silently EXECUTE from a malformed resume.
4859
- const decision = (0, checkin_js_1.isCheckInDecision)(input)
4860
- ? input
4861
- : (0, checkin_js_1.checkInDeclined)({ by: 'unknown', note: 'resume input was not a CheckInDecision' });
5458
+ // The copy the person approved, detached (`boundArgsOf`).
5459
+ const args = boundArgsOf(scope, 'pausedCheckInArgs');
5460
+ // A check-in pause is resumed with a CheckInDecision for THIS request
5461
+ // and this exact call, or not at all: `heldAnswer` refused anything else
5462
+ // at the top — a bare string, a decision for another request, a replay.
5463
+ // A consequential tool never EXECUTES from a malformed resume, and a
5464
+ // decline is never invented for one.
5465
+ const decision = consentDecision;
5466
+ // Used from here — so spent here, before the record or the tool: a
5467
+ // second resume presenting it is refused ('already-answered').
5468
+ await (0, consentRequest_js_1.spendDecision)(decisionLedger, decision, 'checkIn', runSignal);
4862
5469
  // The registered component that COLLECTED this decision (9.24.0),
4863
5470
  // written at pause time only when the ask carried one. The decision
4864
5471
  // stays exactly what it was — a structured `CheckInDecision`, never
@@ -4868,6 +5475,7 @@ function buildToolCallsHandler(deps) {
4868
5475
  toolName,
4869
5476
  toolCallId,
4870
5477
  iteration,
5478
+ requestId: decision.requestId,
4871
5479
  approved: decision.approved,
4872
5480
  by: decision.by,
4873
5481
  ...(decision.note !== undefined && { note: decision.note }),
@@ -4883,12 +5491,14 @@ function buildToolCallsHandler(deps) {
4883
5491
  let resumeEnvelope;
4884
5492
  /** The tool ran (any outcome) — the judge's gate (9.104.0). */
4885
5493
  let toolRan = false;
5494
+ let negativeResultId;
4886
5495
  if (decision.approved) {
4887
5496
  const env = scope.$getEnv();
4888
5497
  // Resolved against the party the checkpoint carries (9.92.0).
4889
5498
  const resolved = resolveTool(toolName, scope.pausedToolParty);
4890
5499
  const tool = resolved.tool;
4891
- const dispatched = await resolveCredentialAndExecute(scope, resolved, toolName, args, toolCallId, iteration, env);
5500
+ const dispatched = await resolveCredentialAndExecute(scope, resolved, toolName, args, toolCallId, iteration, env, 'checkIn');
5501
+ negativeResultId = dispatched.negativeResultId;
4892
5502
  result = dispatched.result;
4893
5503
  error = dispatched.error;
4894
5504
  toolRan = dispatched.executed === true;
@@ -4908,6 +5518,7 @@ function buildToolCallsHandler(deps) {
4908
5518
  iteration,
4909
5519
  args,
4910
5520
  result,
5521
+ negativeResultId,
4911
5522
  ...(error === true && { error: true }),
4912
5523
  history: [...scope.history],
4913
5524
  ...(scope.runIdentity && { identity: scope.runIdentity }),
@@ -4916,7 +5527,7 @@ function buildToolCallsHandler(deps) {
4916
5527
  }
4917
5528
  }
4918
5529
  else {
4919
- result = decision.note ? `declined by human: ${decision.note}` : 'declined by human';
5530
+ result = (0, checkin_js_1.declinedResult)(decision.note);
4920
5531
  }
4921
5532
  if (modelResult === undefined)
4922
5533
  modelResult = result;
@@ -4925,6 +5536,9 @@ function buildToolCallsHandler(deps) {
4925
5536
  const decisionCapped = capResults(toolName, decisionPlaced);
4926
5537
  modelResult = decisionCapped.modelResult;
4927
5538
  let decisionResultStr = typeof modelResult === 'string' ? modelResult : (0, validators_js_1.safeStringify)(modelResult);
5539
+ const decisionToolChars = decisionResultStr.length;
5540
+ if (deps.negativeClaimsArmed === true)
5541
+ decisionResultStr = (0, capture_js_1.serveNegativeHandle)(scope, negativeResultId, decisionResultStr);
4928
5542
  // Step boundary (9.18.0) — an approved consequential step (a checkIn
4929
5543
  // tool CAN be a step's tool) advances on the resumed dispatch.
4930
5544
  if (deps.stepPlanFor && stepToolRan) {
@@ -4943,6 +5557,7 @@ function buildToolCallsHandler(deps) {
4943
5557
  {
4944
5558
  role: 'tool',
4945
5559
  content: decisionResultStr,
5560
+ ...(deps.negativeClaimsArmed === true && { toolChars: decisionToolChars }),
4946
5561
  toolCallId,
4947
5562
  toolName,
4948
5563
  ...(deps.findings === true &&
@@ -4973,7 +5588,7 @@ function buildToolCallsHandler(deps) {
4973
5588
  ...(decisionCapped.modelResult !== decisionCapped.result && {
4974
5589
  modelResult: decisionCapped.modelResult,
4975
5590
  }),
4976
- }, toolRan);
5591
+ }, toolRan, undefined, negativeResultId, args);
4977
5592
  bracketSettled(scope, decisionSettlement);
4978
5593
  (0, typedEmit_js_1.typedEmit)(scope, 'agentfootprint.agent.iteration_end', {
4979
5594
  turnIndex: 0,
@@ -4989,6 +5604,8 @@ function buildToolCallsHandler(deps) {
4989
5604
  scope.pausedToolStartMs = 0;
4990
5605
  scope.pausedCheckIn = false;
4991
5606
  scope.pausedCheckInArgs = undefined;
5607
+ // The request was answered — and spent — by this resume.
5608
+ scope.pausedRequest = undefined;
4992
5609
  // Cleared ONLY when it was set — see the ask path's twin note.
4993
5610
  if (answeredVia !== undefined)
4994
5611
  scope.pausedComponentId = undefined;
@@ -5031,6 +5648,7 @@ function buildToolCallsHandler(deps) {
5031
5648
  iteration,
5032
5649
  args,
5033
5650
  result,
5651
+ negativeResultId: dispatched.negativeResultId,
5034
5652
  ...(error === true && { error: true }),
5035
5653
  history: [...scope.history],
5036
5654
  ...(scope.runIdentity && { identity: scope.runIdentity }),
@@ -5044,6 +5662,9 @@ function buildToolCallsHandler(deps) {
5044
5662
  const consentCapped = capResults(toolName, consentPlaced);
5045
5663
  modelResult = consentCapped.modelResult;
5046
5664
  let consentResultStr = typeof modelResult === 'string' ? modelResult : (0, validators_js_1.safeStringify)(modelResult);
5665
+ const consentToolChars = consentResultStr.length;
5666
+ if (deps.negativeClaimsArmed === true)
5667
+ consentResultStr = (0, capture_js_1.serveNegativeHandle)(scope, dispatched.negativeResultId, consentResultStr);
5047
5668
  // Step boundary (9.18.0) — a step tool that waited on 3LO consent
5048
5669
  // advances the moment its resumed dispatch really ran, clean. A
5049
5670
  // ceiling-refused result is not clean (9.20.0): the model holds no
@@ -5067,6 +5688,7 @@ function buildToolCallsHandler(deps) {
5067
5688
  {
5068
5689
  role: 'tool',
5069
5690
  content: consentResultStr,
5691
+ ...(deps.negativeClaimsArmed === true && { toolChars: consentToolChars }),
5070
5692
  toolCallId,
5071
5693
  toolName,
5072
5694
  ...(deps.findings === true &&
@@ -5096,7 +5718,7 @@ function buildToolCallsHandler(deps) {
5096
5718
  ...(consentCapped.modelResult !== consentCapped.result && {
5097
5719
  modelResult: consentCapped.modelResult,
5098
5720
  }),
5099
- }, dispatched.executed === true);
5721
+ }, dispatched.executed === true, undefined, dispatched.negativeResultId, args);
5100
5722
  bracketSettled(scope, consentSettlement);
5101
5723
  (0, typedEmit_js_1.typedEmit)(scope, 'agentfootprint.agent.iteration_end', {
5102
5724
  turnIndex: 0,
@@ -5156,6 +5778,7 @@ function buildToolCallsHandler(deps) {
5156
5778
  iteration,
5157
5779
  args,
5158
5780
  result: input,
5781
+ negativeResultId: deps.negativeClaimsArmed === true ? (0, capture_js_1.pausedNegativeResultId)(scope) : undefined,
5159
5782
  history: [...scope.history],
5160
5783
  ...(scope.runIdentity && {
5161
5784
  identity: scope.runIdentity,
@@ -5210,7 +5833,7 @@ function buildToolCallsHandler(deps) {
5210
5833
  ...(pauseCapped.modelResult !== pauseCapped.result && {
5211
5834
  modelResult: pauseCapped.modelResult,
5212
5835
  }),
5213
- }, true);
5836
+ }, true, undefined, deps.negativeClaimsArmed === true ? (0, capture_js_1.pausedNegativeResultId)(scope) : undefined);
5214
5837
  bracketSettled(scope, pauseSettlement);
5215
5838
  (0, typedEmit_js_1.typedEmit)(scope, 'agentfootprint.agent.iteration_end', {
5216
5839
  turnIndex: 0,