agentfootprint 12.2.0 → 13.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 (405) hide show
  1. package/CAPABILITIES.md +1 -0
  2. package/dist/adapters/code/output.js +8 -29
  3. package/dist/adapters/code/output.js.map +1 -1
  4. package/dist/adapters/observability/audit.js +151 -159
  5. package/dist/adapters/observability/audit.js.map +1 -1
  6. package/dist/adapters/observability/auditBounding.js +411 -0
  7. package/dist/adapters/observability/auditBounding.js.map +1 -0
  8. package/dist/adapters/observability/auditKeptByContract.js +107 -0
  9. package/dist/adapters/observability/auditKeptByContract.js.map +1 -0
  10. package/dist/adapters/observability/auditShapes.js +1731 -0
  11. package/dist/adapters/observability/auditShapes.js.map +1 -0
  12. package/dist/answer-account/account.js +92 -15
  13. package/dist/answer-account/account.js.map +1 -1
  14. package/dist/answer-account/facts/calls.js +7 -9
  15. package/dist/answer-account/facts/calls.js.map +1 -1
  16. package/dist/answer-account/facts/checked.js +2 -2
  17. package/dist/answer-account/facts/checked.js.map +1 -1
  18. package/dist/answer-account/facts/common.js +40 -7
  19. package/dist/answer-account/facts/common.js.map +1 -1
  20. package/dist/answer-account/facts/found.js +1 -1
  21. package/dist/answer-account/facts/found.js.map +1 -1
  22. package/dist/answer-account/facts/howSure.js +21 -3
  23. package/dist/answer-account/facts/howSure.js.map +1 -1
  24. package/dist/answer-account/facts/inView.js +3 -4
  25. package/dist/answer-account/facts/inView.js.map +1 -1
  26. package/dist/answer-account/facts/pausedLeg.js +1 -1
  27. package/dist/answer-account/facts/pausedLeg.js.map +1 -1
  28. package/dist/answer-account/facts/scripts.js +222 -0
  29. package/dist/answer-account/facts/scripts.js.map +1 -0
  30. package/dist/answer-account/facts/understood.js +5 -5
  31. package/dist/answer-account/facts/understood.js.map +1 -1
  32. package/dist/answer-account/pointerKey.js +1 -1
  33. package/dist/answer-account/shown.js +25 -7
  34. package/dist/answer-account/shown.js.map +1 -1
  35. package/dist/answer-account/signals.js +1 -1
  36. package/dist/answer-account/signals.js.map +1 -1
  37. package/dist/answer-account/size.js +152 -0
  38. package/dist/answer-account/size.js.map +1 -0
  39. package/dist/answer-account/templates.js +39 -1
  40. package/dist/answer-account/templates.js.map +1 -1
  41. package/dist/core/Agent.js +25 -1
  42. package/dist/core/Agent.js.map +1 -1
  43. package/dist/core/agent/AgentBuilder.js +85 -1
  44. package/dist/core/agent/AgentBuilder.js.map +1 -1
  45. package/dist/core/agent/arguments/ask.js +85 -2
  46. package/dist/core/agent/arguments/ask.js.map +1 -1
  47. package/dist/core/agent/arguments/partialWindow.js +120 -0
  48. package/dist/core/agent/arguments/partialWindow.js.map +1 -0
  49. package/dist/core/agent/assessment/assess.js +37 -0
  50. package/dist/core/agent/assessment/assess.js.map +1 -1
  51. package/dist/core/agent/assessment/compose.js +5 -1
  52. package/dist/core/agent/assessment/compose.js.map +1 -1
  53. package/dist/core/agent/assessment/reasons.js +7 -0
  54. package/dist/core/agent/assessment/reasons.js.map +1 -1
  55. package/dist/core/agent/assessment/witness.js +37 -4
  56. package/dist/core/agent/assessment/witness.js.map +1 -1
  57. package/dist/core/agent/buildAgentChart.js.map +1 -1
  58. package/dist/core/agent/evidence/codeRegions.js +279 -0
  59. package/dist/core/agent/evidence/codeRegions.js.map +1 -0
  60. package/dist/core/agent/evidence/gate.js +13 -2
  61. package/dist/core/agent/evidence/gate.js.map +1 -1
  62. package/dist/core/agent/evidence/recovery.js +11 -2
  63. package/dist/core/agent/evidence/recovery.js.map +1 -1
  64. package/dist/core/agent/findings/types.js.map +1 -1
  65. package/dist/core/agent/scripts/attachment.js +375 -0
  66. package/dist/core/agent/scripts/attachment.js.map +1 -0
  67. package/dist/core/agent/scripts/inert.js +88 -0
  68. package/dist/core/agent/scripts/inert.js.map +1 -0
  69. package/dist/core/agent/scripts/judge.js +41 -0
  70. package/dist/core/agent/scripts/judge.js.map +1 -0
  71. package/dist/core/agent/scripts/label.js +143 -0
  72. package/dist/core/agent/scripts/label.js.map +1 -0
  73. package/dist/core/agent/scripts/match.js +233 -0
  74. package/dist/core/agent/scripts/match.js.map +1 -0
  75. package/dist/core/agent/scripts/recovery.js +81 -0
  76. package/dist/core/agent/scripts/recovery.js.map +1 -0
  77. package/dist/core/agent/scripts/rows.js +221 -0
  78. package/dist/core/agent/scripts/rows.js.map +1 -0
  79. package/dist/core/agent/scripts/types.js +22 -0
  80. package/dist/core/agent/scripts/types.js.map +1 -0
  81. package/dist/core/agent/scripts/wrapper.js +63 -0
  82. package/dist/core/agent/scripts/wrapper.js.map +1 -0
  83. package/dist/core/agent/stages/argumentAsk.js +161 -19
  84. package/dist/core/agent/stages/argumentAsk.js.map +1 -1
  85. package/dist/core/agent/stages/evidenceRecheck.js +4 -1
  86. package/dist/core/agent/stages/evidenceRecheck.js.map +1 -1
  87. package/dist/core/agent/stages/prepareFinal.js +65 -10
  88. package/dist/core/agent/stages/prepareFinal.js.map +1 -1
  89. package/dist/core/agent/stages/route.js +53 -3
  90. package/dist/core/agent/stages/route.js.map +1 -1
  91. package/dist/core/agent/stages/seed.js +14 -1
  92. package/dist/core/agent/stages/seed.js.map +1 -1
  93. package/dist/core/agent/stages/toolCalls.js +339 -18
  94. package/dist/core/agent/stages/toolCalls.js.map +1 -1
  95. package/dist/core/codeRunnerTool.js +32 -3
  96. package/dist/core/codeRunnerTool.js.map +1 -1
  97. package/dist/core/runCheckpoint.js +19 -6
  98. package/dist/core/runCheckpoint.js.map +1 -1
  99. package/dist/esm/adapters/code/output.d.ts +1 -4
  100. package/dist/esm/adapters/code/output.js +3 -24
  101. package/dist/esm/adapters/code/output.js.map +1 -1
  102. package/dist/esm/adapters/observability/audit.d.ts +79 -12
  103. package/dist/esm/adapters/observability/audit.js +132 -142
  104. package/dist/esm/adapters/observability/audit.js.map +1 -1
  105. package/dist/esm/adapters/observability/auditBounding.d.ts +215 -0
  106. package/dist/esm/adapters/observability/auditBounding.js +390 -0
  107. package/dist/esm/adapters/observability/auditBounding.js.map +1 -0
  108. package/dist/esm/adapters/observability/auditKeptByContract.d.ts +65 -0
  109. package/dist/esm/adapters/observability/auditKeptByContract.js +103 -0
  110. package/dist/esm/adapters/observability/auditKeptByContract.js.map +1 -0
  111. package/dist/esm/adapters/observability/auditShapes.d.ts +78 -0
  112. package/dist/esm/adapters/observability/auditShapes.js +1726 -0
  113. package/dist/esm/adapters/observability/auditShapes.js.map +1 -0
  114. package/dist/esm/answer-account/account.js +91 -14
  115. package/dist/esm/answer-account/account.js.map +1 -1
  116. package/dist/esm/answer-account/facts/calls.d.ts +0 -2
  117. package/dist/esm/answer-account/facts/calls.js +1 -3
  118. package/dist/esm/answer-account/facts/calls.js.map +1 -1
  119. package/dist/esm/answer-account/facts/checked.js +2 -2
  120. package/dist/esm/answer-account/facts/checked.js.map +1 -1
  121. package/dist/esm/answer-account/facts/common.d.ts +16 -4
  122. package/dist/esm/answer-account/facts/common.js +38 -6
  123. package/dist/esm/answer-account/facts/common.js.map +1 -1
  124. package/dist/esm/answer-account/facts/found.js +2 -2
  125. package/dist/esm/answer-account/facts/found.js.map +1 -1
  126. package/dist/esm/answer-account/facts/howSure.d.ts +1 -1
  127. package/dist/esm/answer-account/facts/howSure.js +22 -4
  128. package/dist/esm/answer-account/facts/howSure.js.map +1 -1
  129. package/dist/esm/answer-account/facts/inView.js +1 -2
  130. package/dist/esm/answer-account/facts/inView.js.map +1 -1
  131. package/dist/esm/answer-account/facts/pausedLeg.js +2 -2
  132. package/dist/esm/answer-account/facts/pausedLeg.js.map +1 -1
  133. package/dist/esm/answer-account/facts/scripts.d.ts +34 -0
  134. package/dist/esm/answer-account/facts/scripts.js +218 -0
  135. package/dist/esm/answer-account/facts/scripts.js.map +1 -0
  136. package/dist/esm/answer-account/facts/understood.js +2 -2
  137. package/dist/esm/answer-account/facts/understood.js.map +1 -1
  138. package/dist/esm/answer-account/pointerKey.d.ts +1 -1
  139. package/dist/esm/answer-account/pointerKey.js +1 -1
  140. package/dist/esm/answer-account/shown.d.ts +9 -2
  141. package/dist/esm/answer-account/shown.js +25 -7
  142. package/dist/esm/answer-account/shown.js.map +1 -1
  143. package/dist/esm/answer-account/signals.js +2 -2
  144. package/dist/esm/answer-account/signals.js.map +1 -1
  145. package/dist/esm/answer-account/size.d.ts +59 -0
  146. package/dist/esm/answer-account/size.js +147 -0
  147. package/dist/esm/answer-account/size.js.map +1 -0
  148. package/dist/esm/answer-account/templates.d.ts +29 -1
  149. package/dist/esm/answer-account/templates.js +39 -1
  150. package/dist/esm/answer-account/templates.js.map +1 -1
  151. package/dist/esm/core/Agent.d.ts +8 -1
  152. package/dist/esm/core/Agent.js +25 -1
  153. package/dist/esm/core/Agent.js.map +1 -1
  154. package/dist/esm/core/agent/AgentBuilder.d.ts +52 -0
  155. package/dist/esm/core/agent/AgentBuilder.js +85 -1
  156. package/dist/esm/core/agent/AgentBuilder.js.map +1 -1
  157. package/dist/esm/core/agent/arguments/ask.d.ts +11 -0
  158. package/dist/esm/core/agent/arguments/ask.js +83 -1
  159. package/dist/esm/core/agent/arguments/ask.js.map +1 -1
  160. package/dist/esm/core/agent/arguments/partialWindow.d.ts +42 -0
  161. package/dist/esm/core/agent/arguments/partialWindow.js +111 -0
  162. package/dist/esm/core/agent/arguments/partialWindow.js.map +1 -0
  163. package/dist/esm/core/agent/assessment/assess.js +37 -0
  164. package/dist/esm/core/agent/assessment/assess.js.map +1 -1
  165. package/dist/esm/core/agent/assessment/compose.d.ts +3 -1
  166. package/dist/esm/core/agent/assessment/compose.js +5 -1
  167. package/dist/esm/core/agent/assessment/compose.js.map +1 -1
  168. package/dist/esm/core/agent/assessment/reasons.js +7 -0
  169. package/dist/esm/core/agent/assessment/reasons.js.map +1 -1
  170. package/dist/esm/core/agent/assessment/types.d.ts +12 -2
  171. package/dist/esm/core/agent/assessment/witness.d.ts +44 -4
  172. package/dist/esm/core/agent/assessment/witness.js +35 -3
  173. package/dist/esm/core/agent/assessment/witness.js.map +1 -1
  174. package/dist/esm/core/agent/buildAgentChart.d.ts +9 -0
  175. package/dist/esm/core/agent/buildAgentChart.js.map +1 -1
  176. package/dist/esm/core/agent/evidence/codeRegions.d.ts +130 -0
  177. package/dist/esm/core/agent/evidence/codeRegions.js +275 -0
  178. package/dist/esm/core/agent/evidence/codeRegions.js.map +1 -0
  179. package/dist/esm/core/agent/evidence/gate.d.ts +3 -0
  180. package/dist/esm/core/agent/evidence/gate.js +12 -2
  181. package/dist/esm/core/agent/evidence/gate.js.map +1 -1
  182. package/dist/esm/core/agent/evidence/recovery.d.ts +5 -1
  183. package/dist/esm/core/agent/evidence/recovery.js +11 -2
  184. package/dist/esm/core/agent/evidence/recovery.js.map +1 -1
  185. package/dist/esm/core/agent/evidence/types.d.ts +35 -0
  186. package/dist/esm/core/agent/findings/types.d.ts +3 -2
  187. package/dist/esm/core/agent/findings/types.js.map +1 -1
  188. package/dist/esm/core/agent/scripts/attachment.d.ts +179 -0
  189. package/dist/esm/core/agent/scripts/attachment.js +361 -0
  190. package/dist/esm/core/agent/scripts/attachment.js.map +1 -0
  191. package/dist/esm/core/agent/scripts/inert.d.ts +38 -0
  192. package/dist/esm/core/agent/scripts/inert.js +84 -0
  193. package/dist/esm/core/agent/scripts/inert.js.map +1 -0
  194. package/dist/esm/core/agent/scripts/judge.d.ts +36 -0
  195. package/dist/esm/core/agent/scripts/judge.js +37 -0
  196. package/dist/esm/core/agent/scripts/judge.js.map +1 -0
  197. package/dist/esm/core/agent/scripts/label.d.ts +103 -0
  198. package/dist/esm/core/agent/scripts/label.js +136 -0
  199. package/dist/esm/core/agent/scripts/label.js.map +1 -0
  200. package/dist/esm/core/agent/scripts/match.d.ts +99 -0
  201. package/dist/esm/core/agent/scripts/match.js +226 -0
  202. package/dist/esm/core/agent/scripts/match.js.map +1 -0
  203. package/dist/esm/core/agent/scripts/recovery.d.ts +54 -0
  204. package/dist/esm/core/agent/scripts/recovery.js +77 -0
  205. package/dist/esm/core/agent/scripts/recovery.js.map +1 -0
  206. package/dist/esm/core/agent/scripts/rows.d.ts +143 -0
  207. package/dist/esm/core/agent/scripts/rows.js +211 -0
  208. package/dist/esm/core/agent/scripts/rows.js.map +1 -0
  209. package/dist/esm/core/agent/scripts/types.d.ts +91 -0
  210. package/dist/esm/core/agent/scripts/types.js +21 -0
  211. package/dist/esm/core/agent/scripts/types.js.map +1 -0
  212. package/dist/esm/core/agent/scripts/wrapper.d.ts +36 -0
  213. package/dist/esm/core/agent/scripts/wrapper.js +58 -0
  214. package/dist/esm/core/agent/scripts/wrapper.js.map +1 -0
  215. package/dist/esm/core/agent/stages/argumentAsk.d.ts +4 -1
  216. package/dist/esm/core/agent/stages/argumentAsk.js +164 -22
  217. package/dist/esm/core/agent/stages/argumentAsk.js.map +1 -1
  218. package/dist/esm/core/agent/stages/evidenceRecheck.js +4 -1
  219. package/dist/esm/core/agent/stages/evidenceRecheck.js.map +1 -1
  220. package/dist/esm/core/agent/stages/prepareFinal.d.ts +11 -0
  221. package/dist/esm/core/agent/stages/prepareFinal.js +65 -10
  222. package/dist/esm/core/agent/stages/prepareFinal.js.map +1 -1
  223. package/dist/esm/core/agent/stages/route.js +53 -3
  224. package/dist/esm/core/agent/stages/route.js.map +1 -1
  225. package/dist/esm/core/agent/stages/seed.js +14 -1
  226. package/dist/esm/core/agent/stages/seed.js.map +1 -1
  227. package/dist/esm/core/agent/stages/toolCalls.d.ts +14 -0
  228. package/dist/esm/core/agent/stages/toolCalls.js +337 -16
  229. package/dist/esm/core/agent/stages/toolCalls.js.map +1 -1
  230. package/dist/esm/core/agent/types.d.ts +41 -0
  231. package/dist/esm/core/codeRunnerTool.d.ts +23 -0
  232. package/dist/esm/core/codeRunnerTool.js +31 -2
  233. package/dist/esm/core/codeRunnerTool.js.map +1 -1
  234. package/dist/esm/core/runCheckpoint.js +16 -3
  235. package/dist/esm/core/runCheckpoint.js.map +1 -1
  236. package/dist/esm/events/payloads.d.ts +46 -1
  237. package/dist/esm/hosting/answerAccounts.js +4 -2
  238. package/dist/esm/hosting/answerAccounts.js.map +1 -1
  239. package/dist/esm/hosting/artifactWire.d.ts +3 -2
  240. package/dist/esm/hosting/artifactWire.js.map +1 -1
  241. package/dist/esm/index.d.ts +3 -1
  242. package/dist/esm/index.js.map +1 -1
  243. package/dist/esm/lib/boundedJson.d.ts +24 -0
  244. package/dist/esm/lib/boundedJson.js +45 -2
  245. package/dist/esm/lib/boundedJson.js.map +1 -1
  246. package/dist/esm/lib/scriptRecord.d.ts +139 -0
  247. package/dist/esm/lib/scriptRecord.js +18 -0
  248. package/dist/esm/lib/scriptRecord.js.map +1 -0
  249. package/dist/esm/lib/utf8.d.ts +36 -0
  250. package/dist/esm/lib/utf8.js +70 -0
  251. package/dist/esm/lib/utf8.js.map +1 -0
  252. package/dist/esm/mcp/toolExtras.d.ts +9 -0
  253. package/dist/esm/mcp/toolExtras.js +6 -0
  254. package/dist/esm/mcp/toolExtras.js.map +1 -1
  255. package/dist/esm/redaction/conversation.js +10 -0
  256. package/dist/esm/redaction/conversation.js.map +1 -1
  257. package/dist/esm/redaction/knownStrings.js +34 -0
  258. package/dist/esm/redaction/knownStrings.js.map +1 -1
  259. package/dist/esm/semantics/coverage/answer.d.ts +12 -1
  260. package/dist/esm/semantics/coverage/answer.js +26 -3
  261. package/dist/esm/semantics/coverage/answer.js.map +1 -1
  262. package/dist/esm/tools/script.d.ts +85 -0
  263. package/dist/esm/tools/script.js +157 -0
  264. package/dist/esm/tools/script.js.map +1 -0
  265. package/dist/esm/tools/tools.d.ts +30 -0
  266. package/dist/esm/tools/tools.js +4 -0
  267. package/dist/esm/tools/tools.js.map +1 -1
  268. package/dist/hosting/answerAccounts.js +4 -2
  269. package/dist/hosting/answerAccounts.js.map +1 -1
  270. package/dist/hosting/artifactWire.js.map +1 -1
  271. package/dist/index.js.map +1 -1
  272. package/dist/lib/boundedJson.js +48 -3
  273. package/dist/lib/boundedJson.js.map +1 -1
  274. package/dist/lib/scriptRecord.js +19 -0
  275. package/dist/lib/scriptRecord.js.map +1 -0
  276. package/dist/lib/utf8.js +77 -0
  277. package/dist/lib/utf8.js.map +1 -0
  278. package/dist/mcp/toolExtras.js +6 -0
  279. package/dist/mcp/toolExtras.js.map +1 -1
  280. package/dist/redaction/conversation.js +10 -0
  281. package/dist/redaction/conversation.js.map +1 -1
  282. package/dist/redaction/knownStrings.js +34 -0
  283. package/dist/redaction/knownStrings.js.map +1 -1
  284. package/dist/semantics/coverage/answer.js +26 -3
  285. package/dist/semantics/coverage/answer.js.map +1 -1
  286. package/dist/tools/script.js +163 -0
  287. package/dist/tools/script.js.map +1 -0
  288. package/dist/tools/tools.js +4 -0
  289. package/dist/tools/tools.js.map +1 -1
  290. package/dist/types/adapters/code/output.d.ts +1 -4
  291. package/dist/types/adapters/code/output.d.ts.map +1 -1
  292. package/dist/types/adapters/observability/audit.d.ts +79 -12
  293. package/dist/types/adapters/observability/audit.d.ts.map +1 -1
  294. package/dist/types/adapters/observability/auditBounding.d.ts +216 -0
  295. package/dist/types/adapters/observability/auditBounding.d.ts.map +1 -0
  296. package/dist/types/adapters/observability/auditKeptByContract.d.ts +66 -0
  297. package/dist/types/adapters/observability/auditKeptByContract.d.ts.map +1 -0
  298. package/dist/types/adapters/observability/auditShapes.d.ts +79 -0
  299. package/dist/types/adapters/observability/auditShapes.d.ts.map +1 -0
  300. package/dist/types/answer-account/account.d.ts.map +1 -1
  301. package/dist/types/answer-account/facts/calls.d.ts +0 -2
  302. package/dist/types/answer-account/facts/calls.d.ts.map +1 -1
  303. package/dist/types/answer-account/facts/checked.d.ts.map +1 -1
  304. package/dist/types/answer-account/facts/common.d.ts +16 -4
  305. package/dist/types/answer-account/facts/common.d.ts.map +1 -1
  306. package/dist/types/answer-account/facts/found.d.ts.map +1 -1
  307. package/dist/types/answer-account/facts/howSure.d.ts +1 -1
  308. package/dist/types/answer-account/facts/howSure.d.ts.map +1 -1
  309. package/dist/types/answer-account/facts/inView.d.ts.map +1 -1
  310. package/dist/types/answer-account/facts/pausedLeg.d.ts.map +1 -1
  311. package/dist/types/answer-account/facts/scripts.d.ts +35 -0
  312. package/dist/types/answer-account/facts/scripts.d.ts.map +1 -0
  313. package/dist/types/answer-account/facts/understood.d.ts.map +1 -1
  314. package/dist/types/answer-account/pointerKey.d.ts +1 -1
  315. package/dist/types/answer-account/shown.d.ts +9 -2
  316. package/dist/types/answer-account/shown.d.ts.map +1 -1
  317. package/dist/types/answer-account/signals.d.ts.map +1 -1
  318. package/dist/types/answer-account/size.d.ts +60 -0
  319. package/dist/types/answer-account/size.d.ts.map +1 -0
  320. package/dist/types/answer-account/templates.d.ts +29 -1
  321. package/dist/types/answer-account/templates.d.ts.map +1 -1
  322. package/dist/types/core/Agent.d.ts +8 -1
  323. package/dist/types/core/Agent.d.ts.map +1 -1
  324. package/dist/types/core/agent/AgentBuilder.d.ts +52 -0
  325. package/dist/types/core/agent/AgentBuilder.d.ts.map +1 -1
  326. package/dist/types/core/agent/arguments/ask.d.ts +11 -0
  327. package/dist/types/core/agent/arguments/ask.d.ts.map +1 -1
  328. package/dist/types/core/agent/arguments/partialWindow.d.ts +43 -0
  329. package/dist/types/core/agent/arguments/partialWindow.d.ts.map +1 -0
  330. package/dist/types/core/agent/assessment/assess.d.ts.map +1 -1
  331. package/dist/types/core/agent/assessment/compose.d.ts +3 -1
  332. package/dist/types/core/agent/assessment/compose.d.ts.map +1 -1
  333. package/dist/types/core/agent/assessment/reasons.d.ts.map +1 -1
  334. package/dist/types/core/agent/assessment/types.d.ts +12 -2
  335. package/dist/types/core/agent/assessment/types.d.ts.map +1 -1
  336. package/dist/types/core/agent/assessment/witness.d.ts +44 -4
  337. package/dist/types/core/agent/assessment/witness.d.ts.map +1 -1
  338. package/dist/types/core/agent/buildAgentChart.d.ts +9 -0
  339. package/dist/types/core/agent/buildAgentChart.d.ts.map +1 -1
  340. package/dist/types/core/agent/evidence/codeRegions.d.ts +131 -0
  341. package/dist/types/core/agent/evidence/codeRegions.d.ts.map +1 -0
  342. package/dist/types/core/agent/evidence/gate.d.ts +3 -0
  343. package/dist/types/core/agent/evidence/gate.d.ts.map +1 -1
  344. package/dist/types/core/agent/evidence/recovery.d.ts +5 -1
  345. package/dist/types/core/agent/evidence/recovery.d.ts.map +1 -1
  346. package/dist/types/core/agent/evidence/types.d.ts +35 -0
  347. package/dist/types/core/agent/evidence/types.d.ts.map +1 -1
  348. package/dist/types/core/agent/findings/types.d.ts +3 -2
  349. package/dist/types/core/agent/findings/types.d.ts.map +1 -1
  350. package/dist/types/core/agent/scripts/attachment.d.ts +180 -0
  351. package/dist/types/core/agent/scripts/attachment.d.ts.map +1 -0
  352. package/dist/types/core/agent/scripts/inert.d.ts +39 -0
  353. package/dist/types/core/agent/scripts/inert.d.ts.map +1 -0
  354. package/dist/types/core/agent/scripts/judge.d.ts +37 -0
  355. package/dist/types/core/agent/scripts/judge.d.ts.map +1 -0
  356. package/dist/types/core/agent/scripts/label.d.ts +104 -0
  357. package/dist/types/core/agent/scripts/label.d.ts.map +1 -0
  358. package/dist/types/core/agent/scripts/match.d.ts +100 -0
  359. package/dist/types/core/agent/scripts/match.d.ts.map +1 -0
  360. package/dist/types/core/agent/scripts/recovery.d.ts +55 -0
  361. package/dist/types/core/agent/scripts/recovery.d.ts.map +1 -0
  362. package/dist/types/core/agent/scripts/rows.d.ts +144 -0
  363. package/dist/types/core/agent/scripts/rows.d.ts.map +1 -0
  364. package/dist/types/core/agent/scripts/types.d.ts +92 -0
  365. package/dist/types/core/agent/scripts/types.d.ts.map +1 -0
  366. package/dist/types/core/agent/scripts/wrapper.d.ts +37 -0
  367. package/dist/types/core/agent/scripts/wrapper.d.ts.map +1 -0
  368. package/dist/types/core/agent/stages/argumentAsk.d.ts +4 -1
  369. package/dist/types/core/agent/stages/argumentAsk.d.ts.map +1 -1
  370. package/dist/types/core/agent/stages/evidenceRecheck.d.ts.map +1 -1
  371. package/dist/types/core/agent/stages/prepareFinal.d.ts +11 -0
  372. package/dist/types/core/agent/stages/prepareFinal.d.ts.map +1 -1
  373. package/dist/types/core/agent/stages/route.d.ts.map +1 -1
  374. package/dist/types/core/agent/stages/seed.d.ts.map +1 -1
  375. package/dist/types/core/agent/stages/toolCalls.d.ts +14 -0
  376. package/dist/types/core/agent/stages/toolCalls.d.ts.map +1 -1
  377. package/dist/types/core/agent/types.d.ts +41 -0
  378. package/dist/types/core/agent/types.d.ts.map +1 -1
  379. package/dist/types/core/codeRunnerTool.d.ts +23 -0
  380. package/dist/types/core/codeRunnerTool.d.ts.map +1 -1
  381. package/dist/types/core/runCheckpoint.d.ts.map +1 -1
  382. package/dist/types/events/payloads.d.ts +46 -1
  383. package/dist/types/events/payloads.d.ts.map +1 -1
  384. package/dist/types/hosting/answerAccounts.d.ts.map +1 -1
  385. package/dist/types/hosting/artifactWire.d.ts +3 -2
  386. package/dist/types/hosting/artifactWire.d.ts.map +1 -1
  387. package/dist/types/index.d.ts +3 -1
  388. package/dist/types/index.d.ts.map +1 -1
  389. package/dist/types/lib/boundedJson.d.ts +24 -0
  390. package/dist/types/lib/boundedJson.d.ts.map +1 -1
  391. package/dist/types/lib/scriptRecord.d.ts +140 -0
  392. package/dist/types/lib/scriptRecord.d.ts.map +1 -0
  393. package/dist/types/lib/utf8.d.ts +37 -0
  394. package/dist/types/lib/utf8.d.ts.map +1 -0
  395. package/dist/types/mcp/toolExtras.d.ts +9 -0
  396. package/dist/types/mcp/toolExtras.d.ts.map +1 -1
  397. package/dist/types/redaction/conversation.d.ts.map +1 -1
  398. package/dist/types/redaction/knownStrings.d.ts.map +1 -1
  399. package/dist/types/semantics/coverage/answer.d.ts +12 -1
  400. package/dist/types/semantics/coverage/answer.d.ts.map +1 -1
  401. package/dist/types/tools/script.d.ts +86 -0
  402. package/dist/types/tools/script.d.ts.map +1 -0
  403. package/dist/types/tools/tools.d.ts +30 -0
  404. package/dist/types/tools/tools.d.ts.map +1 -1
  405. package/package.json +2 -1
@@ -78,6 +78,8 @@ const admission_js_1 = require("../findings/admission.js");
78
78
  * activates that Skill (lifetime: turn).
79
79
  */
80
80
  const codeRunnerTool_js_1 = require("../../codeRunnerTool.js");
81
+ const script_js_1 = require("../../../tools/script.js");
82
+ const rows_js_1 = require("../scripts/rows.js");
81
83
  const footprintjs_1 = require("footprintjs");
82
84
  const types_js_1 = require("../../../provider-contract/types.js");
83
85
  const typedEmit_js_1 = require("../../../recorders/core/typedEmit.js");
@@ -120,7 +122,7 @@ const offer_js_1 = require("../findings/offer.js");
120
122
  const ledger_js_2 = require("../findings/ledger.js");
121
123
  const contingent_js_1 = require("../findings/contingent.js");
122
124
  const unsettled_js_1 = require("../findings/unsettled.js");
123
- const rows_js_1 = require("../../../time/rows.js");
125
+ const rows_js_2 = require("../../../time/rows.js");
124
126
  const evidenceIndex_js_1 = require("../evidence/evidenceIndex.js");
125
127
  const repeatedCall_js_1 = require("../repeatedCall.js");
126
128
  const toolArgsValidation_js_1 = require("../../../tools/toolArgsValidation.js");
@@ -780,11 +782,11 @@ function towersFor(scope, findings, gate) {
780
782
  function recordSourceClock(scope, call, zone) {
781
783
  const ledger = scope.findingsLedger;
782
784
  const turn = scope.turnNumber;
783
- const filed = (0, rows_js_1.sourceClocksOf)(ledger, turn).some((r) => r.toolCallId === call.toolCallId && r.zone === zone);
785
+ const filed = (0, rows_js_2.sourceClocksOf)(ledger, turn).some((r) => r.toolCallId === call.toolCallId && r.zone === zone);
784
786
  if (filed)
785
787
  return;
786
788
  (0, ledger_js_2.recordFindings)(scope, [
787
- (0, rows_js_1.sourceClockRow)(call, { turn, iteration: scope.iteration }, zone),
789
+ (0, rows_js_2.sourceClockRow)(call, { turn, iteration: scope.iteration }, zone),
788
790
  ]);
789
791
  }
790
792
  /** The run a capability binding was made in — `undefined` when there is no binding. */
@@ -1916,6 +1918,153 @@ function buildToolCallsHandler(deps) {
1916
1918
  if (next !== prior)
1917
1919
  scope.toolCallLedger = next;
1918
1920
  };
1921
+ /**
1922
+ * THE ONE DOOR for a call's `script` row (`deps.scriptRecord`) — asked
1923
+ * where each call of a declared code-running tool settles or pauses. A tool
1924
+ * that declares no `script` (or one the dispatch door refuses,
1925
+ * `tools/script.ts` · `scriptOf`) files nothing; an unarmed agent never
1926
+ * reaches the declaration at all.
1927
+ */
1928
+ const fileScript = (scope, call) => {
1929
+ if (deps.scriptRecord !== true)
1930
+ return undefined;
1931
+ const script = (0, script_js_1.scriptOf)(call.tool);
1932
+ if (script === undefined)
1933
+ return undefined;
1934
+ const row = (0, rows_js_1.scriptRowFor)({
1935
+ script,
1936
+ tool: call.toolName,
1937
+ toolCallId: call.toolCallId,
1938
+ iteration: call.iteration,
1939
+ turn: scope.turnNumber,
1940
+ proposed: call.proposed,
1941
+ ...(call.submitted !== undefined && { submitted: call.submitted }),
1942
+ settlement: call.settlement,
1943
+ ...(call.facts !== undefined && { facts: call.facts }),
1944
+ ...(call.withheld === true && { withheld: true }),
1945
+ ...(call.paused === true && { paused: true }),
1946
+ });
1947
+ if (row === undefined)
1948
+ return undefined;
1949
+ const dispatch = (0, rows_js_1.recordScriptRow)(scope, row, {
1950
+ paused: call.paused === true,
1951
+ ...(call.dispatch !== undefined && { dispatch: call.dispatch }),
1952
+ });
1953
+ // A paused call keeps its dispatch across the checkpoint: the row that
1954
+ // settles it on resume joins the same dispatch, never a new one.
1955
+ if (call.paused === true && dispatch !== undefined) {
1956
+ scope.pausedScriptDispatch = { dispatch, toolCallId: call.toolCallId, turn: row.turn };
1957
+ }
1958
+ return dispatch;
1959
+ };
1960
+ /**
1961
+ * The declared argument's VALUE in `args`, read now — `undefined` when the
1962
+ * agent is unarmed or the tool declares no `script`. Asked at the boundary
1963
+ * each value belongs to (as the call arrives; just before `execute`) and
1964
+ * kept: a string cannot be edited afterwards, the arguments object can.
1965
+ */
1966
+ const programOfCall = (tool, args) => {
1967
+ if (deps.scriptRecord !== true)
1968
+ return undefined;
1969
+ const script = (0, script_js_1.scriptOf)(tool);
1970
+ return script === undefined ? undefined : (0, rows_js_1.programIn)(script, args);
1971
+ };
1972
+ /**
1973
+ * The arguments the model PROPOSED for a call, read back from the assistant
1974
+ * turn that carried it (`_findings` peeled) — what a resumed call's script
1975
+ * row compares the program it ran with. `undefined` when the turn is gone.
1976
+ */
1977
+ const proposedArgsOf = (scope, toolCallId) => {
1978
+ const history = scope.history;
1979
+ for (let i = history.length - 1; i >= 0; i--) {
1980
+ const call = history[i]?.toolCalls?.find((c) => c.id === toolCallId);
1981
+ if (call !== undefined)
1982
+ return peelCall(call).args;
1983
+ }
1984
+ return undefined;
1985
+ };
1986
+ /**
1987
+ * A RESUMED call's script row — the four resume doors settle the paused call
1988
+ * here. `carried` is the pause carrier (the arguments the person approved,
1989
+ * or the call was paused with); `seen` is what `resolveCredentialAndExecute`
1990
+ * saw when the call ran. The tool is resolved as the resume resolved it.
1991
+ */
1992
+ const fileResumedScript = (scope, call) => {
1993
+ if (deps.scriptRecord !== true)
1994
+ return;
1995
+ const tool = resolveTool(call.toolName, scope.pausedToolParty).tool;
1996
+ // The dispatch the pause filed this call under — when it is THIS call's.
1997
+ const held = scope.pausedScriptDispatch;
1998
+ const dispatch = held !== undefined &&
1999
+ held.toolCallId === call.toolCallId &&
2000
+ held.turn === scope.turnNumber
2001
+ ? held.dispatch
2002
+ : undefined;
2003
+ if (held !== undefined)
2004
+ scope.pausedScriptDispatch = undefined;
2005
+ // A call that paused from inside `execute` carried the values read before
2006
+ // it ran (`pausedScriptPrograms`) — this call's, when the dispatch is.
2007
+ const carried = scope.pausedScriptPrograms;
2008
+ if (carried !== undefined)
2009
+ scope.pausedScriptPrograms = undefined;
2010
+ const own = dispatch !== undefined ? carried : undefined;
2011
+ // Read before `execute` ran (`seen`), or carried from before it ran; a
2012
+ // call that never got there reads its carrier now — no tool code ran on it.
2013
+ const proposed = call.seen.entered === true
2014
+ ? call.seen.proposed
2015
+ : own?.proposed ??
2016
+ programOfCall(tool, proposedArgsOf(scope, call.toolCallId) ?? call.carried);
2017
+ const submitted = call.seen.entered === true
2018
+ ? call.seen.submitted
2019
+ : own?.submitted ?? programOfCall(tool, call.carried);
2020
+ fileScript(scope, {
2021
+ tool,
2022
+ toolName: call.toolName,
2023
+ toolCallId: call.toolCallId,
2024
+ iteration: call.iteration,
2025
+ proposed,
2026
+ ...(submitted !== undefined && { submitted }),
2027
+ settlement: !call.entered ? 'not-entered' : call.seen.threw === true ? 'threw' : 'returned',
2028
+ ...(call.seen.codeRun !== undefined && { facts: call.seen.codeRun }),
2029
+ withheld: call.seen.overCeiling === true,
2030
+ ...(dispatch !== undefined && { dispatch }),
2031
+ });
2032
+ };
2033
+ /**
2034
+ * THIS dispatch's code-run facts, taken from its own slot (`CODE_RUN_SLOT`)
2035
+ * — what the script row attests, whichever runner filed them (a wrapper that
2036
+ * hands its context to a code runner included). Asked at BOTH execute
2037
+ * boundaries — the batch loop and `resolveCredentialAndExecute` — right
2038
+ * after `tool.execute` returns. Only the slot is ever attested from.
2039
+ *
2040
+ * The published surfaces are kept exactly as they were. The map
2041
+ * (`codeRunsOf`): at the batch boundary (`takeListed`) the dispatched tool's
2042
+ * entry for this call id is taken off it; the resume boundary leaves it.
2043
+ * The event fires when the dispatched tool is itself a code runner, as it
2044
+ * always did, carrying the dispatch's own facts. When the slot is empty
2045
+ * there — a decorator kept the runner's map but handed the runner a context
2046
+ * of its own, so the runner filed by the call id alone — it fires as it
2047
+ * always did, from the map's entry: the one case the slot cannot reach, and
2048
+ * the facts it carries are the map's, never attested. The code itself is
2049
+ * never on this channel: generated code quotes the data it was handed.
2050
+ */
2051
+ const takeCodeRun = (scope, tool, slot, call) => {
2052
+ const facts = slot.facts;
2053
+ slot.facts = undefined;
2054
+ const listed = (0, codeRunnerTool_js_1.codeRunsOf)(tool);
2055
+ const filed = call.takeListed ? listed?.get(call.toolCallId) : undefined;
2056
+ if (filed !== undefined)
2057
+ listed?.delete(call.toolCallId);
2058
+ const told = facts ?? filed;
2059
+ if (told !== undefined && listed !== undefined) {
2060
+ // `tool` is the name the model CALLED, not the one the runner's closure
2061
+ // was built with: a runner re-exposed under another schema name must be
2062
+ // recognizable by the name its calls carry (a content exporter withholds
2063
+ // that tool's arguments — the program). Same bytes whenever they agree.
2064
+ (0, typedEmit_js_1.typedEmit)(scope, 'agentfootprint.tools.code_run', { ...told, tool: call.toolName });
2065
+ }
2066
+ return facts;
2067
+ };
1919
2068
  /** `emitToolEnd`'s twin: the call is open in the ledger until its `tool_end` lands. */
1920
2069
  const emitToolStart = (scope, payload) => {
1921
2070
  // A listener sees the call's frozen copy — the dispatch loop's shared one
@@ -2757,6 +2906,19 @@ function buildToolCallsHandler(deps) {
2757
2906
  */
2758
2907
  const bracketSettled = (scope, settlement) => {
2759
2908
  for (const { call, result } of settlement.settled) {
2909
+ // Never dispatched: the program is on the record as proposed, `submitted`.
2910
+ // Guarded here — the arguments read the scope, and an unarmed agent reads
2911
+ // nothing new.
2912
+ if (deps.scriptRecord === true) {
2913
+ fileScript(scope, {
2914
+ tool: resolveTool(call.name).tool,
2915
+ toolName: call.name,
2916
+ toolCallId: call.id,
2917
+ iteration: scope.iteration,
2918
+ proposed: programOfCall(resolveTool(call.name).tool, peelCall(call).args),
2919
+ settlement: 'not-entered',
2920
+ });
2921
+ }
2760
2922
  emitToolStart(scope, {
2761
2923
  toolName: call.name,
2762
2924
  toolCallId: call.id,
@@ -2786,7 +2948,10 @@ function buildToolCallsHandler(deps) {
2786
2948
  // copies every app callback is handed (`lib/frozenCopy.ts`): arguments that
2787
2949
  // no longer re-derive the request's id (`runsAsAsked`, the one rule that
2788
2950
  // binds a decision to its call) do not run (`callChanged`).
2789
- const resolveCredentialAndExecute = async (scope, resolved, toolName, args, toolCallId, iteration, env, heldTo) => {
2951
+ const resolveCredentialAndExecute = async (scope, resolved, toolName, args, toolCallId, iteration, env, heldTo,
2952
+ /** Filled for the call's script row (`deps.scriptRecord`): what `execute`
2953
+ * was handed, the runner's facts, a ceiling refusal, a throw. */
2954
+ seen) => {
2790
2955
  const tool = resolved.tool;
2791
2956
  /** What the approval covers — the arguments as handed in, before any
2792
2957
  * `wants` resolution or clock redraw derives the ones `execute` gets. */
@@ -2894,7 +3059,12 @@ function buildToolCallsHandler(deps) {
2894
3059
  args = dispatched.args;
2895
3060
  // `let`, not `const`: the semantic projection below replaces the value
2896
3061
  // on the non-envelope path exactly as the batch loop does.
3062
+ // This dispatch's own slot for the runner's facts (`CODE_RUN_SLOT`):
3063
+ // facts reach the exact dispatch that ran, never another run's call
3064
+ // that happens to reuse the provider's id.
3065
+ const codeRunSlot = {};
2897
3066
  const executionContext = {
3067
+ [codeRunnerTool_js_1.CODE_RUN_SLOT]: codeRunSlot,
2898
3068
  toolCallId,
2899
3069
  iteration,
2900
3070
  ...(callTime !== undefined && { time: callTime }),
@@ -2951,7 +3121,22 @@ function buildToolCallsHandler(deps) {
2951
3121
  })
2952
3122
  : undefined;
2953
3123
  executed = true;
3124
+ if (seen !== undefined) {
3125
+ // Read now, before any tool code runs: what the call proposed and
3126
+ // what `execute` is handed — values, never the arguments object.
3127
+ seen.entered = true;
3128
+ seen.proposed = programOfCall(tool, proposedArgsOf(scope, toolCallId) ?? args);
3129
+ seen.submitted = programOfCall(tool, args);
3130
+ }
2954
3131
  let result = await tool.execute(args, executionContext);
3132
+ // The runner's facts, at this execute boundary as at the batch loop's.
3133
+ const codeRun = takeCodeRun(scope, tool, codeRunSlot, {
3134
+ toolName,
3135
+ toolCallId,
3136
+ takeListed: false,
3137
+ });
3138
+ if (seen !== undefined && codeRun !== undefined)
3139
+ seen.codeRun = codeRun;
2955
3140
  if (negativeDispatch !== undefined)
2956
3141
  result = (0, capture_js_1.captureNegativeResult)(scope, negativeDispatch, result, tool);
2957
3142
  await endCall(toolCallId);
@@ -2995,6 +3180,8 @@ function buildToolCallsHandler(deps) {
2995
3180
  if (refusal !== undefined) {
2996
3181
  if (negativeDispatch !== undefined)
2997
3182
  (0, capture_js_1.keepNegativeResultOut)(scope, negativeDispatch.resultId);
3183
+ if (seen !== undefined)
3184
+ seen.overCeiling = true;
2998
3185
  return {
2999
3186
  result: refusal,
3000
3187
  executed: true,
@@ -3048,6 +3235,8 @@ function buildToolCallsHandler(deps) {
3048
3235
  if (refusal !== undefined) {
3049
3236
  if (negativeDispatch !== undefined)
3050
3237
  (0, capture_js_1.keepNegativeResultOut)(scope, negativeDispatch.resultId);
3238
+ if (seen !== undefined)
3239
+ seen.overCeiling = true;
3051
3240
  // Synthesized empty-effects envelope: the resume paths read the
3052
3241
  // routing status off `envelope.status`, and this is how a refused
3053
3242
  // NON-envelope result carries `'invalid'` there without every path
@@ -3105,6 +3294,8 @@ function buildToolCallsHandler(deps) {
3105
3294
  // Settled by throwing is still settled — a tool that opened a session and
3106
3295
  // then failed must not keep it.
3107
3296
  await endCall(toolCallId);
3297
+ if (seen !== undefined && executed)
3298
+ seen.threw = true;
3108
3299
  if ((0, pause_js_1.isPauseRequest)(err)) {
3109
3300
  return {
3110
3301
  result: `tool '${toolName}' requested a pause while resuming an approved check-in, which is not supported`,
@@ -3203,11 +3394,16 @@ function buildToolCallsHandler(deps) {
3203
3394
  let askedLayer;
3204
3395
  if (inputs !== undefined &&
3205
3396
  resolutions !== undefined &&
3206
- [...resolutions.values()].some((r) => r.ask !== undefined)) {
3397
+ ([...resolutions.values()].some((r) => r.ask !== undefined) ||
3398
+ deps.time?.reader !== undefined)) {
3207
3399
  // Loaded on first use — the optional-family law: a plain agent's
3208
3400
  // graph never carries the ask (`test/trace-toolpack/browserGraph`).
3209
3401
  const { askBeforeDispatch } = await Promise.resolve().then(() => __importStar(require('./argumentAsk.js')));
3210
3402
  const asked = askBeforeDispatch(scope, resolutions, {
3403
+ excludedCallIds: toolCalls
3404
+ .filter((_, index) => findingsRefusals[index] !== undefined)
3405
+ .map((call) => call.id),
3406
+ ...(deps.argumentSources === true && { argumentSources: true }),
3211
3407
  toolOf: (toolName) => resolveTool(toolName).tool,
3212
3408
  runId: () => runFactsOf(scope)?.runId,
3213
3409
  ...(deps.argumentAskContext !== undefined && { hostContext: deps.argumentAskContext }),
@@ -3348,6 +3544,10 @@ function buildToolCallsHandler(deps) {
3348
3544
  // same reference — `tc.args` — and not one byte moves.
3349
3545
  const peeled = peelCall(tc);
3350
3546
  const args = peeled.args;
3547
+ // The script record's proposal (`deps.scriptRecord`): the declared
3548
+ // argument's value, read as the call arrives — before any rule or tool
3549
+ // code runs. `undefined` unarmed.
3550
+ const proposedProgram = programOfCall(tool, args);
3351
3551
  // ── THE BASIS ROW — immediately, so it precedes `tool_start` in the
3352
3552
  // event log and every pause `return` in program order (a paused
3353
3553
  // call's row is on the pre-pause partial commit; a denied call keeps
@@ -3456,6 +3656,14 @@ function buildToolCallsHandler(deps) {
3456
3656
  let denied = findingsRefusal !== undefined;
3457
3657
  /** True once `tool.execute` has been entered — see `afterMoment`. */
3458
3658
  let executed = false;
3659
+ /** The declared argument's value handed to `execute`, read just before it ran. */
3660
+ let submittedProgram;
3661
+ /** `execute` was entered and threw — a settlement the script row reads. */
3662
+ let executeThrew = false;
3663
+ /** The code-run facts a code-runner tool left for this call (`takeCodeRun`). */
3664
+ let ranCode;
3665
+ /** The tool's own `resultCeiling` (not the column contract) refused the result. */
3666
+ let withheldOverCeiling = false;
3459
3667
  let negativeDispatch;
3460
3668
  /** The tool's own `resultCeiling` refused this call's result (9.20.0)
3461
3669
  * — the call ran, but it must not complete a procedure step: the
@@ -3795,6 +4003,18 @@ function buildToolCallsHandler(deps) {
3795
4003
  // checkpoint stays byte-identical.
3796
4004
  if (askComponent !== undefined)
3797
4005
  scope.pausedComponentId = askComponent.componentId;
4006
+ // The call is open, waiting on a person: its script row says
4007
+ // `submitted`, without the text — the settled row carries it.
4008
+ fileScript(scope, {
4009
+ tool,
4010
+ toolName: tc.name,
4011
+ toolCallId: tc.id,
4012
+ iteration,
4013
+ proposed: proposedProgram,
4014
+ submitted: programOfCall(tool, bound.args),
4015
+ settlement: 'not-entered',
4016
+ paused: true,
4017
+ });
3798
4018
  // A defined return value triggers the footprintjs pause; this
3799
4019
  // object becomes the checkpoint's pauseData, and detectPause
3800
4020
  // surfaces `pauseData.ask` as `outcome.ask`.
@@ -4004,6 +4224,17 @@ function buildToolCallsHandler(deps) {
4004
4224
  // only when one exists (byte-identical otherwise).
4005
4225
  if (gateComponent !== undefined)
4006
4226
  scope.pausedComponentId = gateComponent.componentId;
4227
+ // Open until a person decides: `submitted`, without the text.
4228
+ fileScript(scope, {
4229
+ tool,
4230
+ toolName: tc.name,
4231
+ toolCallId: tc.id,
4232
+ iteration,
4233
+ proposed: proposedProgram,
4234
+ submitted: programOfCall(tool, bound.args),
4235
+ settlement: 'not-entered',
4236
+ paused: true,
4237
+ });
4007
4238
  // Returning a defined value triggers the footprintjs pause; the
4008
4239
  // returned object becomes the checkpoint's pauseData. detectPause
4009
4240
  // surfaces `pauseData.checkIn` as `outcome.checkIn`.
@@ -4098,6 +4329,17 @@ function buildToolCallsHandler(deps) {
4098
4329
  // Same carrier as the middleware-ask pause (9.92.0).
4099
4330
  if (resolved.party !== undefined)
4100
4331
  scope.pausedToolParty = resolved.party;
4332
+ // Open until the person consents: `submitted`, without the text.
4333
+ fileScript(scope, {
4334
+ tool,
4335
+ toolName: tc.name,
4336
+ toolCallId: tc.id,
4337
+ iteration,
4338
+ proposed: proposedProgram,
4339
+ submitted: programOfCall(tool, callArgs),
4340
+ settlement: 'not-entered',
4341
+ paused: true,
4342
+ });
4101
4343
  // A defined return value triggers the footprintjs pause; this
4102
4344
  // object becomes the checkpoint's pauseData, and standingAgent's
4103
4345
  // describePause hands it to the caller as `PendingAsk`.
@@ -4171,7 +4413,11 @@ function buildToolCallsHandler(deps) {
4171
4413
  // Set BEFORE the await: a tool that throws has still run, and a
4172
4414
  // tool that does not exist has not. This flag is the entire
4173
4415
  // precondition of the after-tool moment below.
4416
+ // This dispatch's own slot for the runner's facts — see the
4417
+ // resume path's twin in `resolveCredentialAndExecute`.
4418
+ const codeRunSlot = {};
4174
4419
  const executionContext = {
4420
+ [codeRunnerTool_js_1.CODE_RUN_SLOT]: codeRunSlot,
4175
4421
  toolCallId: tc.id,
4176
4422
  iteration,
4177
4423
  ...(callTime !== undefined && { time: callTime }),
@@ -4209,6 +4455,7 @@ function buildToolCallsHandler(deps) {
4209
4455
  })
4210
4456
  : undefined;
4211
4457
  executed = true;
4458
+ submittedProgram = programOfCall(tool, callArgs);
4212
4459
  result = await tool.execute(callArgs, executionContext);
4213
4460
  if (negativeDispatch !== undefined)
4214
4461
  result = (0, capture_js_1.captureNegativeResult)(scope, negativeDispatch, result, tool);
@@ -4221,16 +4468,11 @@ function buildToolCallsHandler(deps) {
4221
4468
  // session events follow with `keyHash`, never the key. Generated
4222
4469
  // code quotes the data it was handed, so the program is the one
4223
4470
  // part of a code run that must not reach an exporter.
4224
- const ranCode = (0, codeRunnerTool_js_1.codeRunsOf)(tool)?.get(tc.id);
4225
- if (ranCode !== undefined) {
4226
- (0, codeRunnerTool_js_1.codeRunsOf)(tool)?.delete(tc.id);
4227
- // `tool` is the name the model CALLED, not the one the runner's
4228
- // closure was built with: a runner re-exposed under another
4229
- // schema name must be recognizable by the name its calls carry
4230
- // (a content exporter withholds that tool's arguments — the
4231
- // program). Same bytes whenever the two names agree.
4232
- (0, typedEmit_js_1.typedEmit)(scope, 'agentfootprint.tools.code_run', { ...ranCode, tool: tc.name });
4233
- }
4471
+ ranCode = takeCodeRun(scope, tool, codeRunSlot, {
4472
+ toolName: tc.name,
4473
+ toolCallId: tc.id,
4474
+ takeListed: true,
4475
+ });
4234
4476
  // The typed effects channel (9.19.0): a recognized envelope is
4235
4477
  // unwrapped HERE, at the one boundary the raw return crosses —
4236
4478
  // everything downstream (governance rules, the cap, history,
@@ -4298,6 +4540,7 @@ function buildToolCallsHandler(deps) {
4298
4540
  if (negativeDispatch !== undefined)
4299
4541
  (0, capture_js_1.keepNegativeResultOut)(scope, negativeDispatch.resultId);
4300
4542
  ceilingRefused = true;
4543
+ withheldOverCeiling = true;
4301
4544
  result = overflowRefusal;
4302
4545
  toolStatus = 'invalid';
4303
4546
  }
@@ -4396,6 +4639,28 @@ function buildToolCallsHandler(deps) {
4396
4639
  // person, and the resources it opened are what the resume
4397
4640
  // needs. No `'call'` teardown here, deliberately.
4398
4641
  writePause();
4642
+ // The tool asked from INSIDE `execute`: its program is the
4643
+ // value read before it ran, never the arguments as it left them.
4644
+ const pausedDispatch = fileScript(scope, {
4645
+ tool,
4646
+ toolName: tc.name,
4647
+ toolCallId: tc.id,
4648
+ iteration,
4649
+ proposed: proposedProgram,
4650
+ submitted: submittedProgram,
4651
+ settlement: 'not-entered',
4652
+ paused: true,
4653
+ });
4654
+ // The resume settles this call without running it again, so
4655
+ // the values read before it ran ride the checkpoint.
4656
+ if (pausedDispatch !== undefined) {
4657
+ scope.pausedScriptPrograms = {
4658
+ ...(typeof proposedProgram === 'string' && { proposed: proposedProgram }),
4659
+ ...(typeof submittedProgram === 'string' && {
4660
+ submitted: submittedProgram,
4661
+ }),
4662
+ };
4663
+ }
4399
4664
  const stamped = declaration === undefined
4400
4665
  ? undefined
4401
4666
  : declared ?? (0, inputRequest_js_1.validateInputDeclaration)(declaration);
@@ -4433,6 +4698,7 @@ function buildToolCallsHandler(deps) {
4433
4698
  // settled here too — the returned path's error, not a pause.
4434
4699
  await endCall(tc.id);
4435
4700
  error = true;
4701
+ executeThrew = executed;
4436
4702
  result =
4437
4703
  raisedMissError ??
4438
4704
  (askedLayer !== undefined && (0, pause_js_1.isPauseRequest)(err)
@@ -4750,6 +5016,20 @@ function buildToolCallsHandler(deps) {
4750
5016
  const capped = capResults(tc.name, placedValues);
4751
5017
  const modelResult = capped.modelResult;
4752
5018
  const durationMs = Date.now() - startMs;
5019
+ // The call has settled: its script row, read from the runner's facts
5020
+ // first, then from how the call settled — never from the delivery
5021
+ // (`ceilingRefused` rides the row as `resultWithheld`).
5022
+ fileScript(scope, {
5023
+ tool,
5024
+ toolName: tc.name,
5025
+ toolCallId: tc.id,
5026
+ iteration,
5027
+ proposed: proposedProgram,
5028
+ submitted: executed ? submittedProgram : programOfCall(tool, callArgs),
5029
+ settlement: !executed ? 'not-entered' : executeThrew ? 'threw' : 'returned',
5030
+ ...(ranCode !== undefined && { facts: ranCode }),
5031
+ withheld: withheldOverCeiling,
5032
+ });
4753
5033
  emitToolEnd(scope, tc.name, {
4754
5034
  toolCallId: tc.id,
4755
5035
  result: capped.result,
@@ -5120,6 +5400,8 @@ function buildToolCallsHandler(deps) {
5120
5400
  /** The tool ran (any outcome) — the judge's gate (9.104.0). */
5121
5401
  let toolRan = false;
5122
5402
  let negativeResultId;
5403
+ /** What the approved call's `execute` saw — its script row reads it. */
5404
+ const scriptSeen = {};
5123
5405
  if (!decision.approved) {
5124
5406
  result = (0, checkin_js_1.declinedResult)(decision.note);
5125
5407
  (0, ledger_js_1.recordDecisions)(scope, [
@@ -5288,7 +5570,7 @@ function buildToolCallsHandler(deps) {
5288
5570
  }
5289
5571
  else {
5290
5572
  const env = scope.$getEnv();
5291
- const dispatched = await resolveCredentialAndExecute(scope, resolved, toolName, runArgs, toolCallId, iteration, env, 'ask');
5573
+ const dispatched = await resolveCredentialAndExecute(scope, resolved, toolName, runArgs, toolCallId, iteration, env, 'ask', scriptSeen);
5292
5574
  negativeResultId = dispatched.negativeResultId;
5293
5575
  result = dispatched.result;
5294
5576
  error = dispatched.error;
@@ -5420,6 +5702,14 @@ function buildToolCallsHandler(deps) {
5420
5702
  ...(resumeEnvelope?.status !== undefined && { status: resumeEnvelope.status }),
5421
5703
  });
5422
5704
  await judgeLanded(scope, deps.findingsJudge, toolRan, { toolName, result: askResultStr, toolCallId }, iteration, turnStampOf(scope));
5705
+ fileResumedScript(scope, {
5706
+ toolName,
5707
+ toolCallId,
5708
+ iteration,
5709
+ carried: args,
5710
+ entered: toolRan,
5711
+ seen: scriptSeen,
5712
+ });
5423
5713
  emitToolEnd(scope, toolName, {
5424
5714
  toolCallId,
5425
5715
  result: askCapped.result,
@@ -5509,12 +5799,14 @@ function buildToolCallsHandler(deps) {
5509
5799
  /** The tool ran (any outcome) — the judge's gate (9.104.0). */
5510
5800
  let toolRan = false;
5511
5801
  let negativeResultId;
5802
+ /** What the approved call's `execute` saw — its script row reads it. */
5803
+ const scriptSeen = {};
5512
5804
  if (decision.approved) {
5513
5805
  const env = scope.$getEnv();
5514
5806
  // Resolved against the party the checkpoint carries (9.92.0).
5515
5807
  const resolved = resolveTool(toolName, scope.pausedToolParty);
5516
5808
  const tool = resolved.tool;
5517
- const dispatched = await resolveCredentialAndExecute(scope, resolved, toolName, args, toolCallId, iteration, env, 'checkIn');
5809
+ const dispatched = await resolveCredentialAndExecute(scope, resolved, toolName, args, toolCallId, iteration, env, 'checkIn', scriptSeen);
5518
5810
  negativeResultId = dispatched.negativeResultId;
5519
5811
  result = dispatched.result;
5520
5812
  error = dispatched.error;
@@ -5596,6 +5888,14 @@ function buildToolCallsHandler(deps) {
5596
5888
  ...(resumeEnvelope?.status !== undefined && { status: resumeEnvelope.status }),
5597
5889
  });
5598
5890
  await judgeLanded(scope, deps.findingsJudge, toolRan, { toolName, result: decisionResultStr, toolCallId }, iteration, turnStampOf(scope));
5891
+ fileResumedScript(scope, {
5892
+ toolName,
5893
+ toolCallId,
5894
+ iteration,
5895
+ carried: args,
5896
+ entered: toolRan,
5897
+ seen: scriptSeen,
5898
+ });
5599
5899
  emitToolEnd(scope, toolName, {
5600
5900
  toolCallId,
5601
5901
  result: decisionCapped.result,
@@ -5653,7 +5953,9 @@ function buildToolCallsHandler(deps) {
5653
5953
  // Resolved against the party the checkpoint carries (9.92.0).
5654
5954
  const resolved = resolveTool(toolName, scope.pausedToolParty);
5655
5955
  const tool = resolved.tool;
5656
- const dispatched = await resolveCredentialAndExecute(scope, resolved, toolName, args, toolCallId, iteration, env);
5956
+ /** What the call's `execute` saw — its script row reads it. */
5957
+ const scriptSeen = {};
5958
+ const dispatched = await resolveCredentialAndExecute(scope, resolved, toolName, args, toolCallId, iteration, env, undefined, scriptSeen);
5657
5959
  const result = dispatched.result;
5658
5960
  const error = dispatched.error;
5659
5961
  let modelResult;
@@ -5726,6 +6028,14 @@ function buildToolCallsHandler(deps) {
5726
6028
  ...(consentEnvelope?.status !== undefined && { status: consentEnvelope.status }),
5727
6029
  });
5728
6030
  await judgeLanded(scope, deps.findingsJudge, dispatched.executed === true, { toolName, result: consentResultStr, toolCallId }, iteration, turnStampOf(scope));
6031
+ fileResumedScript(scope, {
6032
+ toolName,
6033
+ toolCallId,
6034
+ iteration,
6035
+ carried: args,
6036
+ entered: dispatched.executed === true,
6037
+ seen: scriptSeen,
6038
+ });
5729
6039
  emitToolEnd(scope, toolName, {
5730
6040
  toolCallId,
5731
6041
  result: consentCapped.result,
@@ -5840,6 +6150,17 @@ function buildToolCallsHandler(deps) {
5840
6150
  // The person's answer IS the tool's result (the handler's contract
5841
6151
  // above), so it ran by definition.
5842
6152
  await judgeLanded(scope, deps.findingsJudge, true, { toolName, result: resultStr, toolCallId }, iteration, turnStampOf(scope));
6153
+ // The tool asked a person from inside `execute`, and the answer IS its
6154
+ // result (the handler's contract): the call returned, and no runner
6155
+ // reported an execution — `returned`, never `completed`.
6156
+ fileResumedScript(scope, {
6157
+ toolName,
6158
+ toolCallId,
6159
+ iteration,
6160
+ carried: args,
6161
+ entered: true,
6162
+ seen: {},
6163
+ });
5843
6164
  emitToolEnd(scope, toolName, {
5844
6165
  toolCallId,
5845
6166
  // The REAL value the pause returned, not what a rule let the model read