@smthrs/harness 0.0.0-stage → 1.0.0-rc.3

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 (476) hide show
  1. package/CHANGELOG.md +387 -0
  2. package/LICENSE +21 -0
  3. package/README.md +138 -2
  4. package/dist/cjs/AgentEvent.d.ts +3092 -0
  5. package/dist/cjs/AgentEvent.d.ts.map +1 -0
  6. package/dist/cjs/AgentEvent.js +1116 -0
  7. package/dist/cjs/AgentEvent.js.map +7 -0
  8. package/dist/cjs/CallLedger.d.ts +378 -0
  9. package/dist/cjs/CallLedger.d.ts.map +1 -0
  10. package/dist/cjs/CallLedger.js +240 -0
  11. package/dist/cjs/CallLedger.js.map +7 -0
  12. package/dist/cjs/Cell.d.ts +774 -0
  13. package/dist/cjs/Cell.d.ts.map +1 -0
  14. package/dist/cjs/Cell.js +431 -0
  15. package/dist/cjs/Cell.js.map +7 -0
  16. package/dist/cjs/CellCalls.d.ts +115 -0
  17. package/dist/cjs/CellCalls.d.ts.map +1 -0
  18. package/dist/cjs/CellCalls.js +98 -0
  19. package/dist/cjs/CellCalls.js.map +7 -0
  20. package/dist/cjs/CellHistory.d.ts +102 -0
  21. package/dist/cjs/CellHistory.d.ts.map +1 -0
  22. package/dist/cjs/CellHistory.js +54 -0
  23. package/dist/cjs/CellHistory.js.map +7 -0
  24. package/dist/cjs/CellTurn.d.ts +1071 -0
  25. package/dist/cjs/CellTurn.d.ts.map +1 -0
  26. package/dist/cjs/CellTurn.js +2618 -0
  27. package/dist/cjs/CellTurn.js.map +7 -0
  28. package/dist/cjs/CellValidation.d.ts +94 -0
  29. package/dist/cjs/CellValidation.d.ts.map +1 -0
  30. package/dist/cjs/CellValidation.js +218 -0
  31. package/dist/cjs/CellValidation.js.map +7 -0
  32. package/dist/cjs/Compaction.d.ts +158 -0
  33. package/dist/cjs/Compaction.d.ts.map +1 -0
  34. package/dist/cjs/Compaction.js +189 -0
  35. package/dist/cjs/Compaction.js.map +7 -0
  36. package/dist/cjs/CompletionClaim.d.ts +801 -0
  37. package/dist/cjs/CompletionClaim.d.ts.map +1 -0
  38. package/dist/cjs/CompletionClaim.js +303 -0
  39. package/dist/cjs/CompletionClaim.js.map +7 -0
  40. package/dist/cjs/ContextWindow.d.ts +435 -0
  41. package/dist/cjs/ContextWindow.d.ts.map +1 -0
  42. package/dist/cjs/ContextWindow.js +319 -0
  43. package/dist/cjs/ContextWindow.js.map +7 -0
  44. package/dist/cjs/EngineLike.d.ts +546 -0
  45. package/dist/cjs/EngineLike.d.ts.map +1 -0
  46. package/dist/cjs/EngineLike.js +114 -0
  47. package/dist/cjs/EngineLike.js.map +7 -0
  48. package/dist/cjs/ExternalTranscript.d.ts +349 -0
  49. package/dist/cjs/ExternalTranscript.d.ts.map +1 -0
  50. package/dist/cjs/ExternalTranscript.js +826 -0
  51. package/dist/cjs/ExternalTranscript.js.map +7 -0
  52. package/dist/cjs/FailedCall.d.ts +132 -0
  53. package/dist/cjs/FailedCall.d.ts.map +1 -0
  54. package/dist/cjs/FailedCall.js +53 -0
  55. package/dist/cjs/FailedCall.js.map +7 -0
  56. package/dist/cjs/FlowBinding.d.ts +289 -0
  57. package/dist/cjs/FlowBinding.d.ts.map +1 -0
  58. package/dist/cjs/FlowBinding.js +251 -0
  59. package/dist/cjs/FlowBinding.js.map +7 -0
  60. package/dist/cjs/HarnessError.d.ts +57 -0
  61. package/dist/cjs/HarnessError.d.ts.map +1 -0
  62. package/dist/cjs/HarnessError.js +75 -0
  63. package/dist/cjs/HarnessError.js.map +7 -0
  64. package/dist/cjs/Judgement.d.ts +289 -0
  65. package/dist/cjs/Judgement.d.ts.map +1 -0
  66. package/dist/cjs/Judgement.js +240 -0
  67. package/dist/cjs/Judgement.js.map +7 -0
  68. package/dist/cjs/Monitor.d.ts +374 -0
  69. package/dist/cjs/Monitor.d.ts.map +1 -0
  70. package/dist/cjs/Monitor.js +233 -0
  71. package/dist/cjs/Monitor.js.map +7 -0
  72. package/dist/cjs/NarrowedCheck.d.ts +523 -0
  73. package/dist/cjs/NarrowedCheck.d.ts.map +1 -0
  74. package/dist/cjs/NarrowedCheck.js +263 -0
  75. package/dist/cjs/NarrowedCheck.js.map +7 -0
  76. package/dist/cjs/Notifications.d.ts +42 -0
  77. package/dist/cjs/Notifications.d.ts.map +1 -0
  78. package/dist/cjs/Notifications.js +177 -0
  79. package/dist/cjs/Notifications.js.map +7 -0
  80. package/dist/cjs/Plan.d.ts +127 -0
  81. package/dist/cjs/Plan.d.ts.map +1 -0
  82. package/dist/cjs/Plan.js +77 -0
  83. package/dist/cjs/Plan.js.map +7 -0
  84. package/dist/cjs/QuickJSSandbox.d.ts +151 -0
  85. package/dist/cjs/QuickJSSandbox.d.ts.map +1 -0
  86. package/dist/cjs/QuickJSSandbox.js +987 -0
  87. package/dist/cjs/QuickJSSandbox.js.map +7 -0
  88. package/dist/cjs/Relevance.d.ts +213 -0
  89. package/dist/cjs/Relevance.d.ts.map +1 -0
  90. package/dist/cjs/Relevance.js +183 -0
  91. package/dist/cjs/Relevance.js.map +7 -0
  92. package/dist/cjs/Sandbox.d.ts +637 -0
  93. package/dist/cjs/Sandbox.d.ts.map +1 -0
  94. package/dist/cjs/Sandbox.js +260 -0
  95. package/dist/cjs/Sandbox.js.map +7 -0
  96. package/dist/cjs/Steering.d.ts +464 -0
  97. package/dist/cjs/Steering.d.ts.map +1 -0
  98. package/dist/cjs/Steering.js +153 -0
  99. package/dist/cjs/Steering.js.map +7 -0
  100. package/dist/cjs/StructuredOutput.d.ts +252 -0
  101. package/dist/cjs/StructuredOutput.d.ts.map +1 -0
  102. package/dist/cjs/StructuredOutput.js +266 -0
  103. package/dist/cjs/StructuredOutput.js.map +7 -0
  104. package/dist/cjs/Sufficiency.d.ts +195 -0
  105. package/dist/cjs/Sufficiency.d.ts.map +1 -0
  106. package/dist/cjs/Sufficiency.js +110 -0
  107. package/dist/cjs/Sufficiency.js.map +7 -0
  108. package/dist/cjs/Supervisor.d.ts +719 -0
  109. package/dist/cjs/Supervisor.d.ts.map +1 -0
  110. package/dist/cjs/Supervisor.js +313 -0
  111. package/dist/cjs/Supervisor.js.map +7 -0
  112. package/dist/cjs/Tokens.d.ts +86 -0
  113. package/dist/cjs/Tokens.d.ts.map +1 -0
  114. package/dist/cjs/Tokens.js +72 -0
  115. package/dist/cjs/Tokens.js.map +7 -0
  116. package/dist/cjs/Transcript.d.ts +171 -0
  117. package/dist/cjs/Transcript.d.ts.map +1 -0
  118. package/dist/cjs/Transcript.js +342 -0
  119. package/dist/cjs/Transcript.js.map +7 -0
  120. package/dist/cjs/TruncatedOutput.d.ts +186 -0
  121. package/dist/cjs/TruncatedOutput.d.ts.map +1 -0
  122. package/dist/cjs/TruncatedOutput.js +143 -0
  123. package/dist/cjs/TruncatedOutput.js.map +7 -0
  124. package/dist/cjs/UnmovedTree.d.ts +113 -0
  125. package/dist/cjs/UnmovedTree.d.ts.map +1 -0
  126. package/dist/cjs/UnmovedTree.js +38 -0
  127. package/dist/cjs/UnmovedTree.js.map +7 -0
  128. package/dist/cjs/UnresolvedFailure.d.ts +196 -0
  129. package/dist/cjs/UnresolvedFailure.d.ts.map +1 -0
  130. package/dist/cjs/UnresolvedFailure.js +77 -0
  131. package/dist/cjs/UnresolvedFailure.js.map +7 -0
  132. package/dist/cjs/VacuousVerification.d.ts +237 -0
  133. package/dist/cjs/VacuousVerification.d.ts.map +1 -0
  134. package/dist/cjs/VacuousVerification.js +91 -0
  135. package/dist/cjs/VacuousVerification.js.map +7 -0
  136. package/dist/cjs/VariablesPanel.d.ts +117 -0
  137. package/dist/cjs/VariablesPanel.d.ts.map +1 -0
  138. package/dist/cjs/VariablesPanel.js +108 -0
  139. package/dist/cjs/VariablesPanel.js.map +7 -0
  140. package/dist/cjs/index.d.ts +172 -0
  141. package/dist/cjs/index.d.ts.map +1 -0
  142. package/dist/cjs/index.js +99 -0
  143. package/dist/cjs/index.js.map +7 -0
  144. package/dist/cjs/internal/bytes.d.ts +36 -0
  145. package/dist/cjs/internal/bytes.d.ts.map +1 -0
  146. package/dist/cjs/internal/bytes.js +57 -0
  147. package/dist/cjs/internal/bytes.js.map +7 -0
  148. package/dist/cjs/internal/cellPrompt.d.ts +122 -0
  149. package/dist/cjs/internal/cellPrompt.d.ts.map +1 -0
  150. package/dist/cjs/internal/cellPrompt.js +146 -0
  151. package/dist/cjs/internal/cellPrompt.js.map +7 -0
  152. package/dist/cjs/internal/compactable.d.ts +44 -0
  153. package/dist/cjs/internal/compactable.d.ts.map +1 -0
  154. package/dist/cjs/internal/compactable.js +56 -0
  155. package/dist/cjs/internal/compactable.js.map +7 -0
  156. package/dist/cjs/internal/compactionMarks.d.ts +278 -0
  157. package/dist/cjs/internal/compactionMarks.d.ts.map +1 -0
  158. package/dist/cjs/internal/compactionMarks.js +212 -0
  159. package/dist/cjs/internal/compactionMarks.js.map +7 -0
  160. package/dist/cjs/internal/demandText.d.ts +95 -0
  161. package/dist/cjs/internal/demandText.d.ts.map +1 -0
  162. package/dist/cjs/internal/demandText.js +70 -0
  163. package/dist/cjs/internal/demandText.js.map +7 -0
  164. package/dist/cjs/internal/elide.d.ts +109 -0
  165. package/dist/cjs/internal/elide.d.ts.map +1 -0
  166. package/dist/cjs/internal/elide.js +59 -0
  167. package/dist/cjs/internal/elide.js.map +7 -0
  168. package/dist/cjs/internal/frame.d.ts +463 -0
  169. package/dist/cjs/internal/frame.d.ts.map +1 -0
  170. package/dist/cjs/internal/frame.js +514 -0
  171. package/dist/cjs/internal/frame.js.map +7 -0
  172. package/dist/cjs/internal/nonNegativeSafeInt.d.ts +20 -0
  173. package/dist/cjs/internal/nonNegativeSafeInt.d.ts.map +1 -0
  174. package/dist/cjs/internal/nonNegativeSafeInt.js +29 -0
  175. package/dist/cjs/internal/nonNegativeSafeInt.js.map +7 -0
  176. package/dist/cjs/internal/paidUsage.d.ts +52 -0
  177. package/dist/cjs/internal/paidUsage.d.ts.map +1 -0
  178. package/dist/cjs/internal/paidUsage.js +70 -0
  179. package/dist/cjs/internal/paidUsage.js.map +7 -0
  180. package/dist/cjs/internal/printChannel.d.ts +233 -0
  181. package/dist/cjs/internal/printChannel.d.ts.map +1 -0
  182. package/dist/cjs/internal/printChannel.js +165 -0
  183. package/dist/cjs/internal/printChannel.js.map +7 -0
  184. package/dist/cjs/internal/printsObservation.d.ts +26 -0
  185. package/dist/cjs/internal/printsObservation.d.ts.map +1 -0
  186. package/dist/cjs/internal/printsObservation.js +27 -0
  187. package/dist/cjs/internal/printsObservation.js.map +7 -0
  188. package/dist/cjs/internal/refusal.d.ts +40 -0
  189. package/dist/cjs/internal/refusal.d.ts.map +1 -0
  190. package/dist/cjs/internal/refusal.js +45 -0
  191. package/dist/cjs/internal/refusal.js.map +7 -0
  192. package/dist/cjs/internal/supervision.d.ts +174 -0
  193. package/dist/cjs/internal/supervision.d.ts.map +1 -0
  194. package/dist/cjs/internal/supervision.js +402 -0
  195. package/dist/cjs/internal/supervision.js.map +7 -0
  196. package/dist/cjs/internal/unfinishedWork.d.ts +99 -0
  197. package/dist/cjs/internal/unfinishedWork.d.ts.map +1 -0
  198. package/dist/cjs/internal/unfinishedWork.js +80 -0
  199. package/dist/cjs/internal/unfinishedWork.js.map +7 -0
  200. package/dist/cjs/internal/unobservedCall.d.ts +112 -0
  201. package/dist/cjs/internal/unobservedCall.d.ts.map +1 -0
  202. package/dist/cjs/internal/unobservedCall.js +345 -0
  203. package/dist/cjs/internal/unobservedCall.js.map +7 -0
  204. package/dist/cjs/internal/untrustedData.d.ts +14 -0
  205. package/dist/cjs/internal/untrustedData.d.ts.map +1 -0
  206. package/dist/cjs/internal/untrustedData.js +30 -0
  207. package/dist/cjs/internal/untrustedData.js.map +7 -0
  208. package/dist/cjs/package.json +1 -0
  209. package/dist/esm/AgentEvent.d.ts +3092 -0
  210. package/dist/esm/AgentEvent.d.ts.map +1 -0
  211. package/dist/esm/AgentEvent.js +1610 -0
  212. package/dist/esm/AgentEvent.js.map +1 -0
  213. package/dist/esm/CallLedger.d.ts +378 -0
  214. package/dist/esm/CallLedger.d.ts.map +1 -0
  215. package/dist/esm/CallLedger.js +506 -0
  216. package/dist/esm/CallLedger.js.map +1 -0
  217. package/dist/esm/Cell.d.ts +774 -0
  218. package/dist/esm/Cell.d.ts.map +1 -0
  219. package/dist/esm/Cell.js +772 -0
  220. package/dist/esm/Cell.js.map +1 -0
  221. package/dist/esm/CellCalls.d.ts +115 -0
  222. package/dist/esm/CellCalls.d.ts.map +1 -0
  223. package/dist/esm/CellCalls.js +97 -0
  224. package/dist/esm/CellCalls.js.map +1 -0
  225. package/dist/esm/CellHistory.d.ts +102 -0
  226. package/dist/esm/CellHistory.d.ts.map +1 -0
  227. package/dist/esm/CellHistory.js +91 -0
  228. package/dist/esm/CellHistory.js.map +1 -0
  229. package/dist/esm/CellTurn.d.ts +1071 -0
  230. package/dist/esm/CellTurn.d.ts.map +1 -0
  231. package/dist/esm/CellTurn.js +3410 -0
  232. package/dist/esm/CellTurn.js.map +1 -0
  233. package/dist/esm/CellValidation.d.ts +94 -0
  234. package/dist/esm/CellValidation.d.ts.map +1 -0
  235. package/dist/esm/CellValidation.js +335 -0
  236. package/dist/esm/CellValidation.js.map +1 -0
  237. package/dist/esm/Compaction.d.ts +158 -0
  238. package/dist/esm/Compaction.d.ts.map +1 -0
  239. package/dist/esm/Compaction.js +216 -0
  240. package/dist/esm/Compaction.js.map +1 -0
  241. package/dist/esm/CompletionClaim.d.ts +801 -0
  242. package/dist/esm/CompletionClaim.d.ts.map +1 -0
  243. package/dist/esm/CompletionClaim.js +833 -0
  244. package/dist/esm/CompletionClaim.js.map +1 -0
  245. package/dist/esm/ContextWindow.d.ts +435 -0
  246. package/dist/esm/ContextWindow.d.ts.map +1 -0
  247. package/dist/esm/ContextWindow.js +427 -0
  248. package/dist/esm/ContextWindow.js.map +1 -0
  249. package/dist/esm/EngineLike.d.ts +546 -0
  250. package/dist/esm/EngineLike.d.ts.map +1 -0
  251. package/dist/esm/EngineLike.js +218 -0
  252. package/dist/esm/EngineLike.js.map +1 -0
  253. package/dist/esm/ExternalTranscript.d.ts +349 -0
  254. package/dist/esm/ExternalTranscript.d.ts.map +1 -0
  255. package/dist/esm/ExternalTranscript.js +987 -0
  256. package/dist/esm/ExternalTranscript.js.map +1 -0
  257. package/dist/esm/FailedCall.d.ts +132 -0
  258. package/dist/esm/FailedCall.d.ts.map +1 -0
  259. package/dist/esm/FailedCall.js +131 -0
  260. package/dist/esm/FailedCall.js.map +1 -0
  261. package/dist/esm/FlowBinding.d.ts +289 -0
  262. package/dist/esm/FlowBinding.d.ts.map +1 -0
  263. package/dist/esm/FlowBinding.js +376 -0
  264. package/dist/esm/FlowBinding.js.map +1 -0
  265. package/dist/esm/HarnessError.d.ts +57 -0
  266. package/dist/esm/HarnessError.d.ts.map +1 -0
  267. package/dist/esm/HarnessError.js +85 -0
  268. package/dist/esm/HarnessError.js.map +1 -0
  269. package/dist/esm/Judgement.d.ts +289 -0
  270. package/dist/esm/Judgement.d.ts.map +1 -0
  271. package/dist/esm/Judgement.js +305 -0
  272. package/dist/esm/Judgement.js.map +1 -0
  273. package/dist/esm/Monitor.d.ts +374 -0
  274. package/dist/esm/Monitor.d.ts.map +1 -0
  275. package/dist/esm/Monitor.js +370 -0
  276. package/dist/esm/Monitor.js.map +1 -0
  277. package/dist/esm/NarrowedCheck.d.ts +523 -0
  278. package/dist/esm/NarrowedCheck.d.ts.map +1 -0
  279. package/dist/esm/NarrowedCheck.js +612 -0
  280. package/dist/esm/NarrowedCheck.js.map +1 -0
  281. package/dist/esm/Notifications.d.ts +42 -0
  282. package/dist/esm/Notifications.d.ts.map +1 -0
  283. package/dist/esm/Notifications.js +215 -0
  284. package/dist/esm/Notifications.js.map +1 -0
  285. package/dist/esm/Plan.d.ts +127 -0
  286. package/dist/esm/Plan.d.ts.map +1 -0
  287. package/dist/esm/Plan.js +97 -0
  288. package/dist/esm/Plan.js.map +1 -0
  289. package/dist/esm/QuickJSSandbox.d.ts +151 -0
  290. package/dist/esm/QuickJSSandbox.d.ts.map +1 -0
  291. package/dist/esm/QuickJSSandbox.js +1364 -0
  292. package/dist/esm/QuickJSSandbox.js.map +1 -0
  293. package/dist/esm/Relevance.d.ts +213 -0
  294. package/dist/esm/Relevance.d.ts.map +1 -0
  295. package/dist/esm/Relevance.js +254 -0
  296. package/dist/esm/Relevance.js.map +1 -0
  297. package/dist/esm/Sandbox.d.ts +637 -0
  298. package/dist/esm/Sandbox.d.ts.map +1 -0
  299. package/dist/esm/Sandbox.js +464 -0
  300. package/dist/esm/Sandbox.js.map +1 -0
  301. package/dist/esm/Steering.d.ts +464 -0
  302. package/dist/esm/Steering.d.ts.map +1 -0
  303. package/dist/esm/Steering.js +193 -0
  304. package/dist/esm/Steering.js.map +1 -0
  305. package/dist/esm/StructuredOutput.d.ts +252 -0
  306. package/dist/esm/StructuredOutput.d.ts.map +1 -0
  307. package/dist/esm/StructuredOutput.js +430 -0
  308. package/dist/esm/StructuredOutput.js.map +1 -0
  309. package/dist/esm/Sufficiency.d.ts +195 -0
  310. package/dist/esm/Sufficiency.d.ts.map +1 -0
  311. package/dist/esm/Sufficiency.js +207 -0
  312. package/dist/esm/Sufficiency.js.map +1 -0
  313. package/dist/esm/Supervisor.d.ts +719 -0
  314. package/dist/esm/Supervisor.d.ts.map +1 -0
  315. package/dist/esm/Supervisor.js +575 -0
  316. package/dist/esm/Supervisor.js.map +1 -0
  317. package/dist/esm/Tokens.d.ts +86 -0
  318. package/dist/esm/Tokens.d.ts.map +1 -0
  319. package/dist/esm/Tokens.js +92 -0
  320. package/dist/esm/Tokens.js.map +1 -0
  321. package/dist/esm/Transcript.d.ts +171 -0
  322. package/dist/esm/Transcript.d.ts.map +1 -0
  323. package/dist/esm/Transcript.js +424 -0
  324. package/dist/esm/Transcript.js.map +1 -0
  325. package/dist/esm/TruncatedOutput.d.ts +186 -0
  326. package/dist/esm/TruncatedOutput.d.ts.map +1 -0
  327. package/dist/esm/TruncatedOutput.js +257 -0
  328. package/dist/esm/TruncatedOutput.js.map +1 -0
  329. package/dist/esm/UnmovedTree.d.ts +113 -0
  330. package/dist/esm/UnmovedTree.d.ts.map +1 -0
  331. package/dist/esm/UnmovedTree.js +90 -0
  332. package/dist/esm/UnmovedTree.js.map +1 -0
  333. package/dist/esm/UnresolvedFailure.d.ts +196 -0
  334. package/dist/esm/UnresolvedFailure.d.ts.map +1 -0
  335. package/dist/esm/UnresolvedFailure.js +218 -0
  336. package/dist/esm/UnresolvedFailure.js.map +1 -0
  337. package/dist/esm/VacuousVerification.d.ts +237 -0
  338. package/dist/esm/VacuousVerification.d.ts.map +1 -0
  339. package/dist/esm/VacuousVerification.js +245 -0
  340. package/dist/esm/VacuousVerification.js.map +1 -0
  341. package/dist/esm/VariablesPanel.d.ts +117 -0
  342. package/dist/esm/VariablesPanel.d.ts.map +1 -0
  343. package/dist/esm/VariablesPanel.js +142 -0
  344. package/dist/esm/VariablesPanel.js.map +1 -0
  345. package/dist/esm/index.d.ts +172 -0
  346. package/dist/esm/index.d.ts.map +1 -0
  347. package/dist/esm/index.js +172 -0
  348. package/dist/esm/index.js.map +1 -0
  349. package/dist/esm/internal/bytes.d.ts +36 -0
  350. package/dist/esm/internal/bytes.d.ts.map +1 -0
  351. package/dist/esm/internal/bytes.js +70 -0
  352. package/dist/esm/internal/bytes.js.map +1 -0
  353. package/dist/esm/internal/cellPrompt.d.ts +122 -0
  354. package/dist/esm/internal/cellPrompt.d.ts.map +1 -0
  355. package/dist/esm/internal/cellPrompt.js +276 -0
  356. package/dist/esm/internal/cellPrompt.js.map +1 -0
  357. package/dist/esm/internal/compactable.d.ts +44 -0
  358. package/dist/esm/internal/compactable.d.ts.map +1 -0
  359. package/dist/esm/internal/compactable.js +71 -0
  360. package/dist/esm/internal/compactable.js.map +1 -0
  361. package/dist/esm/internal/compactionMarks.d.ts +278 -0
  362. package/dist/esm/internal/compactionMarks.d.ts.map +1 -0
  363. package/dist/esm/internal/compactionMarks.js +317 -0
  364. package/dist/esm/internal/compactionMarks.js.map +1 -0
  365. package/dist/esm/internal/demandText.d.ts +95 -0
  366. package/dist/esm/internal/demandText.d.ts.map +1 -0
  367. package/dist/esm/internal/demandText.js +128 -0
  368. package/dist/esm/internal/demandText.js.map +1 -0
  369. package/dist/esm/internal/elide.d.ts +109 -0
  370. package/dist/esm/internal/elide.d.ts.map +1 -0
  371. package/dist/esm/internal/elide.js +123 -0
  372. package/dist/esm/internal/elide.js.map +1 -0
  373. package/dist/esm/internal/frame.d.ts +463 -0
  374. package/dist/esm/internal/frame.d.ts.map +1 -0
  375. package/dist/esm/internal/frame.js +861 -0
  376. package/dist/esm/internal/frame.js.map +1 -0
  377. package/dist/esm/internal/nonNegativeSafeInt.d.ts +20 -0
  378. package/dist/esm/internal/nonNegativeSafeInt.d.ts.map +1 -0
  379. package/dist/esm/internal/nonNegativeSafeInt.js +20 -0
  380. package/dist/esm/internal/nonNegativeSafeInt.js.map +1 -0
  381. package/dist/esm/internal/paidUsage.d.ts +52 -0
  382. package/dist/esm/internal/paidUsage.d.ts.map +1 -0
  383. package/dist/esm/internal/paidUsage.js +72 -0
  384. package/dist/esm/internal/paidUsage.js.map +1 -0
  385. package/dist/esm/internal/printChannel.d.ts +233 -0
  386. package/dist/esm/internal/printChannel.d.ts.map +1 -0
  387. package/dist/esm/internal/printChannel.js +376 -0
  388. package/dist/esm/internal/printChannel.js.map +1 -0
  389. package/dist/esm/internal/printsObservation.d.ts +26 -0
  390. package/dist/esm/internal/printsObservation.d.ts.map +1 -0
  391. package/dist/esm/internal/printsObservation.js +29 -0
  392. package/dist/esm/internal/printsObservation.js.map +1 -0
  393. package/dist/esm/internal/refusal.d.ts +40 -0
  394. package/dist/esm/internal/refusal.d.ts.map +1 -0
  395. package/dist/esm/internal/refusal.js +47 -0
  396. package/dist/esm/internal/refusal.js.map +1 -0
  397. package/dist/esm/internal/supervision.d.ts +174 -0
  398. package/dist/esm/internal/supervision.d.ts.map +1 -0
  399. package/dist/esm/internal/supervision.js +485 -0
  400. package/dist/esm/internal/supervision.js.map +1 -0
  401. package/dist/esm/internal/unfinishedWork.d.ts +99 -0
  402. package/dist/esm/internal/unfinishedWork.d.ts.map +1 -0
  403. package/dist/esm/internal/unfinishedWork.js +85 -0
  404. package/dist/esm/internal/unfinishedWork.js.map +1 -0
  405. package/dist/esm/internal/unobservedCall.d.ts +112 -0
  406. package/dist/esm/internal/unobservedCall.d.ts.map +1 -0
  407. package/dist/esm/internal/unobservedCall.js +501 -0
  408. package/dist/esm/internal/unobservedCall.js.map +1 -0
  409. package/dist/esm/internal/untrustedData.d.ts +14 -0
  410. package/dist/esm/internal/untrustedData.d.ts.map +1 -0
  411. package/dist/esm/internal/untrustedData.js +15 -0
  412. package/dist/esm/internal/untrustedData.js.map +1 -0
  413. package/docs/README.md +129 -0
  414. package/docs/api.md +1869 -0
  415. package/docs/concepts.md +238 -0
  416. package/docs/external-transcripts.md +245 -0
  417. package/docs/guides/bind-flows.md +167 -0
  418. package/docs/guides/drive-the-loop.md +265 -0
  419. package/docs/guides/run-cells.md +262 -0
  420. package/docs/guides/workerd.md +144 -0
  421. package/docs/installation.md +69 -0
  422. package/docs/quickstart.md +121 -0
  423. package/docs/reference.md +954 -0
  424. package/docs/troubleshooting.md +177 -0
  425. package/package.json +463 -3
  426. package/src/AgentEvent.ts +1772 -0
  427. package/src/CallLedger.ts +560 -0
  428. package/src/Cell.ts +926 -0
  429. package/src/CellCalls.ts +198 -0
  430. package/src/CellHistory.ts +128 -0
  431. package/src/CellTurn.ts +4450 -0
  432. package/src/CellValidation.ts +382 -0
  433. package/src/Compaction.ts +330 -0
  434. package/src/CompletionClaim.ts +1013 -0
  435. package/src/ContextWindow.ts +669 -0
  436. package/src/EngineLike.ts +614 -0
  437. package/src/ExternalTranscript.ts +1143 -0
  438. package/src/FailedCall.ts +163 -0
  439. package/src/FlowBinding.ts +603 -0
  440. package/src/HarnessError.ts +98 -0
  441. package/src/Judgement.ts +526 -0
  442. package/src/Monitor.ts +579 -0
  443. package/src/NarrowedCheck.ts +694 -0
  444. package/src/Notifications.ts +262 -0
  445. package/src/Plan.ts +113 -0
  446. package/src/QuickJSSandbox.ts +1557 -0
  447. package/src/Relevance.ts +352 -0
  448. package/src/Sandbox.ts +908 -0
  449. package/src/Steering.ts +405 -0
  450. package/src/StructuredOutput.ts +484 -0
  451. package/src/Sufficiency.ts +247 -0
  452. package/src/Supervisor.ts +798 -0
  453. package/src/Tokens.ts +108 -0
  454. package/src/Transcript.ts +513 -0
  455. package/src/TruncatedOutput.ts +297 -0
  456. package/src/UnmovedTree.ts +121 -0
  457. package/src/UnresolvedFailure.ts +240 -0
  458. package/src/VacuousVerification.ts +280 -0
  459. package/src/VariablesPanel.ts +165 -0
  460. package/src/index.ts +204 -0
  461. package/src/internal/bytes.ts +70 -0
  462. package/src/internal/cellPrompt.ts +337 -0
  463. package/src/internal/compactable.ts +76 -0
  464. package/src/internal/compactionMarks.ts +454 -0
  465. package/src/internal/demandText.ts +145 -0
  466. package/src/internal/elide.ts +130 -0
  467. package/src/internal/frame.ts +1178 -0
  468. package/src/internal/nonNegativeSafeInt.ts +24 -0
  469. package/src/internal/paidUsage.ts +90 -0
  470. package/src/internal/printChannel.ts +434 -0
  471. package/src/internal/printsObservation.ts +31 -0
  472. package/src/internal/refusal.ts +53 -0
  473. package/src/internal/supervision.ts +652 -0
  474. package/src/internal/unfinishedWork.ts +123 -0
  475. package/src/internal/unobservedCall.ts +536 -0
  476. package/src/internal/untrustedData.ts +19 -0
@@ -0,0 +1,1610 @@
1
+ /**
2
+ * Serializable events emitted by harness adapters.
3
+ *
4
+ * @since 0.1.0
5
+ */
6
+ import * as Permission from "@smthrs/capability/Permission";
7
+ import * as Evaluator from "@smthrs/model/Evaluator";
8
+ import * as ModelError from "@smthrs/model/ModelError";
9
+ import * as ModelEvent from "@smthrs/model/ModelEvent";
10
+ import * as ModelRequest from "@smthrs/model/ModelRequest";
11
+ import * as Pricing from "@smthrs/model/Pricing";
12
+ import { Context, Effect, Schema } from "effect";
13
+ import * as Cell from "./Cell.js";
14
+ import * as EngineLike from "./EngineLike.js";
15
+ import { NonNegativeSafeInt } from "./internal/nonNegativeSafeInt.js";
16
+ import * as Sandbox from "./Sandbox.js";
17
+ /**
18
+ * Observes an event before the controller advances or parks. Durable hosts
19
+ * finish their checkpoint here; stream consumers may lag behind the source.
20
+ * @category services
21
+ * @since 1.0.0-rc.0
22
+ */
23
+ export const Observer = Context.Reference("@smthrs/harness/AgentEvent/Observer", { defaultValue: () => () => Effect.void });
24
+ /**
25
+ * Journals an event into the run whose cell called the current flow. The
26
+ * controller provides it around each flow call, so a flow that asks Jev
27
+ * itself journals its receipts beside the run's own. Outside a run there is
28
+ * no journal, and it does nothing.
29
+ * @category services
30
+ * @since 1.0.0-rc.0
31
+ */
32
+ export const Journal = Context.Reference("@smthrs/harness/AgentEvent/Journal", { defaultValue: () => () => Effect.void });
33
+ /**
34
+ * The kind of a human-provided item a relevance reading may withhold.
35
+ *
36
+ * @category models
37
+ * @since 1.0.0-rc.0
38
+ */
39
+ export const RelevanceKind = Schema.Literals(["flow", "skill", "instruction", "memory"]);
40
+ /**
41
+ * What a compaction reading did with one replaced message.
42
+ *
43
+ * @category models
44
+ * @since 1.0.0-rc.0
45
+ */
46
+ export const CompactionMark = Schema.Literals(["keep", "squash", "remove"]);
47
+ /**
48
+ * The invariant that kept a message from being removed, whatever it was marked.
49
+ *
50
+ * @category models
51
+ * @since 1.0.0-rc.0
52
+ */
53
+ export const CompactionPin = Schema.Literals(["summary", "person", "steering", "mutated", "failing", "pair", "budget"]);
54
+ /**
55
+ * Why a compaction ran: the context `budget` was crossed, or a drained
56
+ * supervisor reading found the run carrying `outdated_context` or
57
+ * `irrelevant_context`.
58
+ *
59
+ * @category models
60
+ * @since 1.0.0-rc.0
61
+ */
62
+ export const CompactionCause = Schema.Literals(["budget", "outdated_context", "irrelevant_context"]);
63
+ /**
64
+ * What a supervisor monitor watches for.
65
+ *
66
+ * @category models
67
+ * @since 1.0.0-rc.0
68
+ */
69
+ export const MonitorKind = Schema.Literals(["mood", "skill", "lint"]);
70
+ /**
71
+ * The static stance a run's monitors deliver under.
72
+ *
73
+ * @category models
74
+ * @since 1.0.0-rc.0
75
+ */
76
+ export const Stance = Schema.Literals(["careful", "paranoid"]);
77
+ /**
78
+ * Why a crossed monitor was not delivered.
79
+ *
80
+ * @category models
81
+ * @since 1.0.0-rc.0
82
+ */
83
+ export const Suppression = Schema.Literals(["streak", "cooldown", "limit", "slot"]);
84
+ /**
85
+ * Why a reading could not be judged: `unconfigured`, `interrupted`, or the
86
+ * transport's own error code.
87
+ *
88
+ * @category models
89
+ * @since 1.0.0-rc.0
90
+ */
91
+ export const UnjudgedReason = Schema.Literals(["interrupted", ...Evaluator.EvaluatorErrorCode.literals]);
92
+ /**
93
+ * Token usage an evaluator reported for one reading, and the model that read
94
+ * it when the transport named it: what prices the reading (#3010).
95
+ */
96
+ const Usage = Schema.Struct({
97
+ inputTokens: Schema.Number,
98
+ outputTokens: Schema.Number,
99
+ modelId: Schema.optional(Schema.String)
100
+ });
101
+ /**
102
+ * The loop discipline a run was armed with, journaled once when it starts.
103
+ *
104
+ * Arming used to be observable only through the events a disciplined run
105
+ * *reaches*: the read-cap failure proves the cap was armed, and a run that
106
+ * times out before it fires proves nothing — so a grader could not tell "armed
107
+ * but never reached" from "never armed", which is exactly what the 2026-08-19
108
+ * SWE-bench wave could not decide about its django instance. This event is the
109
+ * positive record: it says what was armed, before anything has had a chance to
110
+ * fire.
111
+ *
112
+ * @category events
113
+ * @since 0.1.0
114
+ * @slop
115
+ */
116
+ export class DisciplineArmed extends Schema.TaggedClass("flows/harness/AgentEvent/DisciplineArmed")("discipline-armed", {
117
+ eventType: Schema.Literal("flows.harness.discipline-armed.v1"),
118
+ /** Consecutive read-only frames allowed; zero means the cap is disarmed. */
119
+ readOnlyCap: Schema.Number,
120
+ /** The frame budget the run stops at. */
121
+ maxFrames: Schema.Number,
122
+ /**
123
+ * Whether a human can answer this run.
124
+ *
125
+ * False says nothing is listening: a `park` transition is refused and
126
+ * answered in the frame that returned it, because a run that waits for an
127
+ * answer nobody will give has stopped working with its budget unspent.
128
+ */
129
+ approvalChannel: Schema.Boolean,
130
+ /**
131
+ * Wall-clock milliseconds one model call may spend; zero means disarmed.
132
+ *
133
+ * Every other budget here caps the cell — the calls it makes, the memory and
134
+ * time its code spends, the run's frames. This one caps the step in between,
135
+ * which was the only unbounded thing the loop did.
136
+ */
137
+ modelCallMs: Schema.Number,
138
+ /**
139
+ * Consecutive repeat-observation frames allowed; zero disarms the demand.
140
+ *
141
+ * Armed here for the same reason the read-only cap is: a run that never
142
+ * reaches a control proves nothing about whether the control was armed, and
143
+ * a grader must be able to tell "armed and never needed" from "never armed".
144
+ */
145
+ repeatCap: Schema.Number,
146
+ /**
147
+ * Completions this run may have bounced for narrowed evidence; zero disarms.
148
+ *
149
+ * Journaled with the rest because the demand it governs fires at most once
150
+ * in a run and often not at all, so its absence from a wave says nothing on
151
+ * its own. One is the armed default: the loop names the missing check once,
152
+ * and the answer that comes back is the answer that stands.
153
+ */
154
+ narrowingCap: Schema.Number,
155
+ /**
156
+ * Completions this run may have bounced for an unmoved tree; zero disarms.
157
+ *
158
+ * Journaled for the same reason as the other two completion caps: the demand
159
+ * fires at most once and usually not at all, so a wave that records none must
160
+ * be able to say whether the control was armed and never needed.
161
+ */
162
+ unmovedCap: Schema.Number,
163
+ /**
164
+ * Times one frame may answer its own unparseable cell before ending; zero
165
+ * disarms the answer.
166
+ *
167
+ * Journaled with the rest because a wave that records no
168
+ * `cell-rejected-in-frame` must be able to say whether the answer was armed
169
+ * and never needed or never armed at all.
170
+ */
171
+ revalidations: Schema.Number.pipe(Schema.withConstructorDefault(Effect.succeed(0)), Schema.withDecodingDefaultKey(Effect.succeed(0))),
172
+ /**
173
+ * Completions this run may have bounced for a failing check it replaced
174
+ * rather than answered; zero disarms.
175
+ */
176
+ unresolvedCap: Schema.Number,
177
+ /**
178
+ * Completions this run may have bounced for a claim its own record does not
179
+ * support; zero disarms.
180
+ *
181
+ * Journaled with the other completion caps, and it says less than they do on
182
+ * its own: the control it arms is also a no-op wherever no `Evaluator` is
183
+ * bound, so an armed cap and no `claim-demanded` event anywhere in a run
184
+ * means either that nothing was asked or that everything asked came back
185
+ * inside the thresholds. Defaulted so journals written before this control
186
+ * existed decode unchanged. See `CompletionClaim`.
187
+ */
188
+ claimCap: Schema.Number.pipe(Schema.withConstructorDefault(Effect.succeed(0)), Schema.withDecodingDefaultKey(Effect.succeed(0))),
189
+ /**
190
+ * Whether a supervisor reading could nudge the run, as journals written
191
+ * before {@link judged} said it. Later writers omit it: `judged` says the
192
+ * same.
193
+ */
194
+ supervisorSteer: Schema.optional(Schema.Boolean),
195
+ /** Maximum calls per cell, when this binding can enforce one. */
196
+ calls: Schema.optional(Schema.Number),
197
+ /** Maximum sandbox heap, when this binding can enforce one. */
198
+ memoryBytes: Schema.optional(Schema.Number),
199
+ /** Maximum interpreter steps, when this binding can enforce one. */
200
+ steps: Schema.optional(Schema.Number),
201
+ /** Maximum cell-compute time, when this binding can enforce one. */
202
+ timeMs: Schema.optional(Schema.Number),
203
+ /** Maximum whole-evaluation time, when this binding can enforce one. */
204
+ totalMs: Schema.optional(Schema.Number),
205
+ /** Maximum wall-clock time for one flow call. */
206
+ callMs: Schema.optional(Schema.Number),
207
+ /** Whether a judge was bound, so Jev's readings run. Absent before it existed. */
208
+ judged: Schema.optional(Schema.Boolean),
209
+ /** The relevance gate: the withhold threshold and the item ids never offered to it. */
210
+ relevance: Schema.optional(Schema.Struct({ withholdAt: Schema.Number, pinned: Schema.Array(Schema.String) })),
211
+ /** The supervisor monitors armed, with their delivery gates. */
212
+ monitors: Schema.optional(Schema.Array(Schema.Struct({
213
+ id: Schema.String,
214
+ kind: MonitorKind,
215
+ /** The probability at or above which the monitor crosses. */
216
+ at: Schema.Number,
217
+ /** Consecutive crossed readings required before a delivery. */
218
+ consecutive: NonNegativeSafeInt,
219
+ /** Frames after a delivery during which the monitor is not delivered again. */
220
+ cooldownFrames: NonNegativeSafeInt,
221
+ /** Deliveries allowed in one run. */
222
+ limit: NonNegativeSafeInt
223
+ }))),
224
+ /** The static stance the monitors deliver under. */
225
+ stance: Schema.optional(Stance)
226
+ }) {
227
+ }
228
+ /**
229
+ * The serializable snapshot fixed when a turn opens.
230
+ *
231
+ * @category events
232
+ * @since 0.1.0
233
+ * @slop
234
+ */
235
+ export class TurnOpened extends Schema.TaggedClass("flows/harness/AgentEvent/TurnOpened")("turn-opened", {
236
+ eventType: Schema.Literal("flows.harness.turn-opened.v1"),
237
+ seat: Schema.String,
238
+ modelParams: ModelRequest.GenerationParams,
239
+ /**
240
+ * The tool set the turn opened with, which the cell-first controller always
241
+ * opens empty: it declares no provider tools. The field stays on the event
242
+ * so journals written before the provider-tool loop was retired keep
243
+ * decoding, and so a foreign-adapter loop has somewhere to put one.
244
+ */
245
+ activeToolNames: Schema.Array(Schema.String),
246
+ contextDigest: Schema.String
247
+ }) {
248
+ }
249
+ /**
250
+ * What one model call was asked, written before the call is made.
251
+ *
252
+ * `model-settled` journals what a call answered and what it cost, and until
253
+ * this event nothing journaled what it was asked: the request existed only in
254
+ * the sealed step's key material, as a digest. A reader that wants to open one
255
+ * step and run it again needs the request itself, so this is the request
256
+ * itself, carried whole here and bounded where it is journaled.
257
+ *
258
+ * It is written when the call is OPENED rather than when it settles, so a call
259
+ * that never settles (a deadline, a refusal, a process that died mid-stream)
260
+ * still leaves what it asked on the record.
261
+ *
262
+ * `scope`, `frame` and `attempt` are the join keys, and they are on the record
263
+ * because position is not one. `scope` is the run's session, which for a
264
+ * module step is the step's recorded scope; `frame` is the controller's own
265
+ * frame number; `attempt` counts the model calls one frame made, from one,
266
+ * and is the same number `cell-rejected-in-frame` names when it refuses that
267
+ * call's answer. A compaction call runs before its frame's `turn-opened`, so a
268
+ * reader counting turns would file it under the frame before; `purpose` and
269
+ * `frame` say where it belongs.
270
+ *
271
+ * Credential-free by construction. The request is the provider-neutral
272
+ * `ModelRequest`, which has no member a credential can occupy, and
273
+ * {@link EngineLike.Binding} carries two names read off the prepared request
274
+ * that exists before any secret is signed on.
275
+ *
276
+ * @category events
277
+ * @since 1.0.0-rc.0
278
+ */
279
+ export class ModelRequested extends Schema.TaggedClass("flows/harness/AgentEvent/ModelRequested")("model-requested", {
280
+ eventType: Schema.Literal("flows.harness.model-requested.v1"),
281
+ /** The run's session, which is the recorded scope of the step that made the call. */
282
+ scope: Schema.String,
283
+ /** The controller's frame number for the turn this call belongs to. */
284
+ frame: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
285
+ /** Which model call of that frame and purpose this is, counting from one. */
286
+ attempt: Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)),
287
+ /** What the call is for: the frame's own turn, or the compaction ahead of it. */
288
+ purpose: Schema.Literals(["frame", "compaction"]),
289
+ /** The seat the frame ran on, as `turn-opened` names it. */
290
+ seat: Schema.String,
291
+ /** The route the host resolved, absent where the host names none. */
292
+ binding: Schema.optional(EngineLike.Binding),
293
+ /** The request the provider is sent, whole: after any rewrite the host applies. */
294
+ request: ModelRequest.ModelRequest
295
+ }) {
296
+ }
297
+ /**
298
+ * The host selected the seat that will receive this capacity attempt.
299
+ * @category events
300
+ * @since 1.0.0-rc.1
301
+ */
302
+ export class ModelSelected extends Schema.TaggedClass("flows/harness/AgentEvent/ModelSelected")("model-selected", {
303
+ eventType: Schema.Literal("flows.harness.model-selected.v1"),
304
+ seat: Schema.String
305
+ }) {
306
+ }
307
+ /**
308
+ * A capacity refusal moved the current frame to another seat.
309
+ * @category events
310
+ * @since 1.0.0-rc.1
311
+ */
312
+ export class SeatFailedOver extends Schema.TaggedClass("flows/harness/AgentEvent/SeatFailedOver")("seat-failed-over", {
313
+ eventType: Schema.Literal("flows.harness.seat-failed-over.v1"),
314
+ from: Schema.String,
315
+ to: Schema.String,
316
+ code: ModelError.ModelErrorCode,
317
+ resetAtEpochMillis: Schema.optional(Schema.Number),
318
+ retryAfterMillis: Schema.optional(Schema.Number),
319
+ httpStatus: Schema.optional(Schema.Number),
320
+ quotaScope: Schema.optional(Schema.Literals(["account", "model"]))
321
+ }) {
322
+ }
323
+ /**
324
+ * All configured model seats are cooling until this instant.
325
+ * @category events
326
+ * @since 1.0.0-rc.1
327
+ */
328
+ export class ModelParked extends Schema.TaggedClass("flows/harness/AgentEvent/ModelParked")("model-parked", {
329
+ eventType: Schema.Literal("flows.harness.model-parked.v1"),
330
+ seat: Schema.String,
331
+ wakeAt: Schema.Number,
332
+ source: Schema.Literals(["reset", "retry-after", "default"]),
333
+ code: ModelError.ModelErrorCode
334
+ }) {
335
+ }
336
+ /**
337
+ * A parked model frame may issue a new request.
338
+ * @category events
339
+ * @since 1.0.0-rc.1
340
+ */
341
+ export class ModelUnparked extends Schema.TaggedClass("flows/harness/AgentEvent/ModelUnparked")("model-unparked", {
342
+ eventType: Schema.Literal("flows.harness.model-unparked.v1"),
343
+ seat: Schema.String,
344
+ at: Schema.Number
345
+ }) {
346
+ }
347
+ /**
348
+ * One provider-neutral model progress event.
349
+ *
350
+ * @category events
351
+ * @since 0.1.0
352
+ * @slop
353
+ */
354
+ export class ModelDelta extends Schema.TaggedClass("flows/harness/AgentEvent/ModelDelta")("model-delta", {
355
+ eventType: Schema.Literal("flows.harness.model-delta.v1"),
356
+ delta: ModelEvent.ModelEvent
357
+ }) {
358
+ }
359
+ /**
360
+ * A transport-only model retry taken before the sealed step settled.
361
+ *
362
+ * @category events
363
+ * @since 0.1.0
364
+ */
365
+ export class ModelRetried extends Schema.TaggedClass("flows/harness/AgentEvent/ModelRetried")("model-retried", {
366
+ eventType: Schema.Literal("flows.harness.model-retried.v1"),
367
+ attempt: Schema.Int,
368
+ code: Schema.String,
369
+ /**
370
+ * Milliseconds the boundary waited before this attempt.
371
+ *
372
+ * Every retry of one sealed step is journaled at the moment the step
373
+ * settles, so the event timestamps cannot show the schedule. This carries
374
+ * it. Zero is what an unscheduled retry, or a record written before the
375
+ * field existed, reports.
376
+ */
377
+ delayMillis: Schema.Number.pipe(Schema.withConstructorDefault(Effect.succeed(0)), Schema.withDecodingDefaultKey(Effect.succeed(0)))
378
+ }) {
379
+ }
380
+ /**
381
+ * The complete recorded model settlement and usage.
382
+ *
383
+ * @category events
384
+ * @since 0.1.0
385
+ * @slop
386
+ */
387
+ export class ModelSettled extends Schema.TaggedClass("flows/harness/AgentEvent/ModelSettled")("model-settled", {
388
+ eventType: Schema.Literal("flows.harness.model-settled.v1"),
389
+ message: ModelRequest.AssistantMessage,
390
+ usage: ModelEvent.Usage,
391
+ /**
392
+ * The call's USD cost: the provider's reported charge, or its usage priced
393
+ * under the model's rate card. Absent for an unpriced model.
394
+ */
395
+ costUsd: Schema.optional(Schema.Number),
396
+ /** Where {@link costUsd} came from. */
397
+ costSource: Schema.optional(Pricing.CostSource),
398
+ /** The vendor session that answered, for a wrapped CLI seat: `claude --resume <sessionId>`. */
399
+ sessionId: Schema.optional(Schema.String),
400
+ /**
401
+ * Wall-clock milliseconds the sealed step took, measured on the injected
402
+ * clock.
403
+ *
404
+ * Usage alone answers what a call cost, never how long it took, so a
405
+ * benchmark could compare tokens per run but not seconds per call — and
406
+ * speed was the larger half of the gap the first head-to-head measured.
407
+ * Zero is what an event carries when nothing timed it.
408
+ */
409
+ durationMillis: Schema.Number.pipe(Schema.withConstructorDefault(Effect.succeed(0)), Schema.withDecodingDefaultKey(Effect.succeed(0)))
410
+ }) {
411
+ }
412
+ /**
413
+ * The cell source recovered from one model settlement.
414
+ *
415
+ * The source itself is durable evidence: replay re-executes exactly this text,
416
+ * and every call identity inside the frame folds in its digest.
417
+ *
418
+ * @category events
419
+ * @since 0.1.0
420
+ * @slop
421
+ */
422
+ export class CellProduced extends Schema.TaggedClass("flows/harness/AgentEvent/CellProduced")("cell-produced", {
423
+ eventType: Schema.Literal("flows.harness.cell-produced.v1"),
424
+ cell: Cell.Source,
425
+ /**
426
+ * How many fenced cell blocks the reply was written in.
427
+ *
428
+ * Journaled because it is the only record of how the model laid its frame
429
+ * out, and because the count above one is the shape whose whole program the
430
+ * harness used to discard. See `Cell.extract`.
431
+ */
432
+ blocks: Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)).pipe(Schema.withConstructorDefault(Effect.succeed(1)), Schema.withDecodingDefaultKey(Effect.succeed(1)))
433
+ }) {
434
+ }
435
+ /**
436
+ * One reply the boundary parse refused, answered inside the frame it arrived
437
+ * in rather than by ending the frame.
438
+ *
439
+ * Journaled because it is spend: a re-prompt is a real model call, cached
440
+ * prefix or not, and a wave counting cost per frame would otherwise see the
441
+ * output of an answer it has no record of asking for. It is also the only
442
+ * measure of whether validating at the boundary is worth what it costs — the
443
+ * ratio of this event to `cell-settled` rejections says how often one re-ask
444
+ * recovers a frame.
445
+ *
446
+ * @category events
447
+ * @since 0.1.0
448
+ * @slop
449
+ */
450
+ export class CellRejectedInFrame extends Schema.TaggedClass("flows/harness/AgentEvent/CellRejectedInFrame")("cell-rejected-in-frame", {
451
+ eventType: Schema.Literal("flows.harness.cell-rejected-in-frame.v1"),
452
+ /** Which attempt of this frame was refused, counting from one. */
453
+ attempt: Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)),
454
+ /** Why the parse refused it. */
455
+ code: Cell.RejectionCode,
456
+ /** What the frame told the model, verbatim. */
457
+ message: Schema.String
458
+ }) {
459
+ }
460
+ /**
461
+ * One flow call opened from inside a running cell.
462
+ *
463
+ * @category events
464
+ * @since 0.1.0
465
+ * @slop
466
+ */
467
+ export class CellCallStarted extends Schema.TaggedClass("flows/harness/AgentEvent/CellCallStarted")("cell-call-started", {
468
+ eventType: Schema.Literal("flows.harness.cell-call-started.v1"),
469
+ call: Cell.Call
470
+ }) {
471
+ }
472
+ /**
473
+ * One settled flow call made from inside a running cell.
474
+ *
475
+ * @category events
476
+ * @since 0.1.0
477
+ * @slop
478
+ */
479
+ export class CellCallSettled extends Schema.TaggedClass("flows/harness/AgentEvent/CellCallSettled")("cell-call-settled", {
480
+ eventType: Schema.Literal("flows.harness.cell-call-settled.v1"),
481
+ flowName: Schema.String,
482
+ identity: Cell.CallIdentity,
483
+ result: Cell.CallResult
484
+ }) {
485
+ }
486
+ /**
487
+ * What one REPL cell printed, as the next model turn will read it.
488
+ *
489
+ * The print buffer is the whole of the context channel in REPL mode, so it is
490
+ * journaled rather than derived: a transcript projection rebuilds a resumed
491
+ * run's window from the journal without re-running anything, exactly as it does
492
+ * for the context a filing cell projected. Bounded before it is emitted, so the
493
+ * journal carries what the model saw and nothing larger.
494
+ *
495
+ * @category events
496
+ * @since 0.1.0
497
+ */
498
+ export class CellPrinted extends Schema.TaggedClass("flows/harness/AgentEvent/CellPrinted")("cell-printed", {
499
+ eventType: Schema.Literal("flows.harness.cell-printed.v1"),
500
+ /** The digest of the cell whose prints these are. */
501
+ cell: Schema.String,
502
+ /** The frame's whole print buffer, already bounded; empty when it printed nothing. */
503
+ text: Schema.String
504
+ }) {
505
+ }
506
+ /**
507
+ * The outcome of executing one cell, whether it settled, threw, or was
508
+ * rejected before it ran.
509
+ *
510
+ * @category events
511
+ * @since 0.1.0
512
+ * @slop
513
+ */
514
+ export class CellSettled extends Schema.TaggedClass("flows/harness/AgentEvent/CellSettled")("cell-settled", {
515
+ eventType: Schema.Literal("flows.harness.cell-settled.v1"),
516
+ cell: Schema.String,
517
+ outcome: Cell.Outcome,
518
+ /** Absent in journals written before execution frontiers were recorded. */
519
+ boundary: Schema.optional(Sandbox.FrameBoundary)
520
+ }) {
521
+ }
522
+ /**
523
+ * The durable transition the controller applied after a cell settled.
524
+ *
525
+ * @category events
526
+ * @since 0.1.0
527
+ * @slop
528
+ */
529
+ export class TransitionApplied extends Schema.TaggedClass("flows/harness/AgentEvent/TransitionApplied")("transition-applied", {
530
+ eventType: Schema.Literal("flows.harness.transition-applied.v1"),
531
+ transition: Cell.Transition
532
+ }) {
533
+ }
534
+ /**
535
+ * The controller issuing a read-cap intervention to the next frame.
536
+ *
537
+ * Kept separately from {@link ReadOnlyDemanded}: this event records the user
538
+ * message entering the model transcript, while that event records how a later
539
+ * frame answered it. A crash between those boundaries must retain the demand.
540
+ *
541
+ * @category events
542
+ * @since 1.0.0-rc.0
543
+ */
544
+ export class ReadOnlyDemandIssued extends Schema.TaggedClass("flows/harness/AgentEvent/ReadOnlyDemandIssued")("read-only-demand-issued", {
545
+ eventType: Schema.Literal("flows.harness.read-only-demand-issued.v1"),
546
+ /** Consecutive read-only frames the run had spent. */
547
+ streak: Schema.Int,
548
+ /** The armed threshold that streak reached. */
549
+ cap: Schema.Int,
550
+ /** The frame the demand was attached to, which is the one that must answer it. */
551
+ nextFrame: Schema.Int
552
+ }) {
553
+ }
554
+ /**
555
+ * The outcome of the frame immediately following a read-cap intervention.
556
+ *
557
+ * @category events
558
+ * @since 0.1.0
559
+ */
560
+ export class ReadOnlyDemanded extends Schema.TaggedClass("flows/harness/AgentEvent/ReadOnlyDemanded")("read-only-demanded", {
561
+ eventType: Schema.Literal("flows.harness.read-only-demanded.v1"),
562
+ streak: Schema.Int,
563
+ cap: Schema.Int,
564
+ nextFrame: Schema.Int,
565
+ nextAction: Schema.Literals(["write", "justification", "read-only", "park"])
566
+ }) {
567
+ }
568
+ /**
569
+ * The controller telling a run it has stopped learning anything.
570
+ *
571
+ * Written when a run reaches its repeat-observation threshold: consecutive
572
+ * frames that issued calls, issued none the run had not already issued, and
573
+ * changed nothing. Both this and {@link ReadOnlyDemandIssued} are written when
574
+ * their demand is issued; {@link ReadOnlyDemanded} additionally records the
575
+ * read-cap demand's later answer because that answer is a field on a
576
+ * transition. A repeat demand is answered by the shape of the next frame's
577
+ * calls, which the journal already writes one by one.
578
+ *
579
+ * @category events
580
+ * @since 0.1.0
581
+ */
582
+ export class RepeatDemanded extends Schema.TaggedClass("flows/harness/AgentEvent/RepeatDemanded")("repeat-demanded", {
583
+ eventType: Schema.Literal("flows.harness.repeat-demanded.v1"),
584
+ /** Consecutive repeat-observation frames the run had spent. */
585
+ frames: Schema.Int,
586
+ /** The armed threshold that streak reached. */
587
+ cap: Schema.Int,
588
+ /** The frame the demand was attached to, which is the one that must answer it. */
589
+ nextFrame: Schema.Int
590
+ }) {
591
+ }
592
+ /**
593
+ * The controller refusing one completion whose evidence was narrowed.
594
+ *
595
+ * Written when a frame returns `complete` while the check it ran is a strict
596
+ * narrowing of one the run had already run in full, over a tree that has since
597
+ * changed and never re-run since. Written when the demand is *issued*, like the
598
+ * repeat demand and unlike the read-cap one, because what answers it is the
599
+ * shape of the next frame's calls and its output — both of which the journal
600
+ * already writes.
601
+ *
602
+ * The event is the whole audit trail for the bounce. `broader` and `narrower`
603
+ * quote the two inputs as the run wrote them, and the two digests say which
604
+ * trees they were measured over, so a grader can decide after the fact whether
605
+ * the demand was right without replaying anything.
606
+ *
607
+ * @category events
608
+ * @since 0.1.0
609
+ */
610
+ export class NarrowedDemanded extends Schema.TaggedClass("flows/harness/AgentEvent/NarrowedDemanded")("narrowed-demanded", {
611
+ eventType: Schema.Literal("flows.harness.narrowed-demanded.v1"),
612
+ /** The flow both checks named. */
613
+ flow: Schema.String,
614
+ /** The broader check's input as the run wrote it, clipped. */
615
+ broader: Schema.String,
616
+ /** The narrowing check's input as the run wrote it, clipped. */
617
+ narrower: Schema.String,
618
+ /** Workspace digest the broader check was last run over. */
619
+ broaderDigest: Schema.String,
620
+ /** Workspace digest the completing frame closed on. */
621
+ currentDigest: Schema.String,
622
+ /** The frame the demand was attached to, which is the one that must answer it. */
623
+ nextFrame: Schema.Int
624
+ }) {
625
+ }
626
+ /**
627
+ * The controller refusing one completion with no change behind it.
628
+ *
629
+ * Written when a frame returns `complete` while the tree it closed on is
630
+ * byte-for-byte the tree the run opened on. Written when the demand is
631
+ * *issued*, like the narrowing demand, because what answers it is the next
632
+ * frame's own record — an edit that moves the digest, or a second completion
633
+ * saying no change was needed — and the journal already writes both.
634
+ *
635
+ * The two digests are the whole audit trail: a grader can decide after the fact
636
+ * whether the demand was right by comparing them to the run's
637
+ * `mutation-observed` record, without replaying anything.
638
+ *
639
+ * @category events
640
+ * @since 0.1.0
641
+ */
642
+ export class UnmovedDemanded extends Schema.TaggedClass("flows/harness/AgentEvent/UnmovedDemanded")("unmoved-demanded", {
643
+ eventType: Schema.Literal("flows.harness.unmoved-demanded.v1"),
644
+ /** Workspace digest the run opened on. */
645
+ openedDigest: Schema.String,
646
+ /** Workspace digest the completing frame closed on, equal to the first. */
647
+ currentDigest: Schema.String,
648
+ /** The frame the demand was attached to, which is the one that must answer it. */
649
+ nextFrame: Schema.Int
650
+ }) {
651
+ }
652
+ /**
653
+ * The controller refusing one completion that stepped around a failing check.
654
+ *
655
+ * Written when a frame returns `complete` while a check recorded over the same
656
+ * tree reported a failing exit status, was never re-run, and a later check went
657
+ * back to the same subject with a different command.
658
+ *
659
+ * `failed` and `instead` quote the two inputs as the run wrote them, and
660
+ * `currentDigest` is the tree both were measured over, so the record says which
661
+ * reading the completion stands on and which one replaced it.
662
+ *
663
+ * @category events
664
+ * @since 0.1.0
665
+ */
666
+ export class UnresolvedDemanded extends Schema.TaggedClass("flows/harness/AgentEvent/UnresolvedDemanded")("unresolved-demanded", {
667
+ eventType: Schema.Literal("flows.harness.unresolved-demanded.v1"),
668
+ /** The flow both checks named. */
669
+ flow: Schema.String,
670
+ /** The failing check's input as the run wrote it, clipped. */
671
+ failed: Schema.String,
672
+ /** The input of the reading the run took instead, clipped. */
673
+ instead: Schema.String,
674
+ /** Workspace digest both checks were recorded over, and the frame closed on. */
675
+ currentDigest: Schema.String,
676
+ /** The frame the demand was attached to, which is the one that must answer it. */
677
+ nextFrame: Schema.Int
678
+ }) {
679
+ }
680
+ /**
681
+ * The controller handing back a completion its own cell wrote before a call
682
+ * in that cell failed.
683
+ *
684
+ * `failures` quotes each failed call's flow and message as the flow reported
685
+ * them, so the record says which results the completion was written without.
686
+ * See `FailedCall`.
687
+ *
688
+ * @category events
689
+ * @since 1.0.0-rc.1
690
+ */
691
+ export class FailedCallDemanded extends Schema.TaggedClass("flows/harness/AgentEvent/FailedCallDemanded")("failed-call-demanded", {
692
+ eventType: Schema.Literal("flows.harness.failed-call-demanded.v1"),
693
+ /** The calls the completing frame settled as failures, oldest first. */
694
+ failures: Schema.Array(Schema.Struct({ flow: Schema.String, message: Schema.String })),
695
+ /** The frame the demand was attached to, which is the one that must answer it. */
696
+ nextFrame: Schema.Int
697
+ }) {
698
+ }
699
+ /**
700
+ * The controller handing back a completion whose output does not fit the
701
+ * shape the host declared for it.
702
+ *
703
+ * `note` is the correction the run was shown, verbatim, so a transcript
704
+ * rebuilt from the journal holds what the model read. The same session
705
+ * answers it, with everything its earlier frames bound still in scope.
706
+ *
707
+ * @category events
708
+ * @since 1.0.0-rc.1
709
+ */
710
+ export class OutputDemanded extends Schema.TaggedClass("flows/harness/AgentEvent/OutputDemanded")("output-demanded", {
711
+ eventType: Schema.Literal("flows.harness.output-demanded.v1"),
712
+ /** The correction handed back with the completion. */
713
+ note: Schema.String,
714
+ /** The frame the demand was attached to, which is the one that must answer it. */
715
+ nextFrame: Schema.Int
716
+ }) {
717
+ }
718
+ /**
719
+ * The controller handing back a completion its own cell wrote before reading
720
+ * the calls it made.
721
+ *
722
+ * `calls` names each call the completing frame settled, in ledger order, with
723
+ * the head of the result the next frame was shown, so the record says which
724
+ * results the completion was written without.
725
+ *
726
+ * @category events
727
+ * @since 1.0.0-rc.1
728
+ */
729
+ export class UnobservedDemanded extends Schema.TaggedClass("flows/harness/AgentEvent/UnobservedDemanded")("unobserved-demanded", {
730
+ eventType: Schema.Literal("flows.harness.unobserved-demanded.v1"),
731
+ /** The calls the completion was written without reading, oldest first. */
732
+ calls: Schema.Array(Schema.Struct({ flow: Schema.String, ordinal: Schema.Int, ok: Schema.Boolean, summary: Schema.String })),
733
+ /** The frame the demand was attached to, which is the one that must answer it. */
734
+ nextFrame: Schema.Int
735
+ }) {
736
+ }
737
+ /**
738
+ * The controller refusing one completion that holds a single reading.
739
+ *
740
+ * Written when a frame returns `complete` while the last check it ran names
741
+ * subjects no other check of the run covers together, and the run never issued
742
+ * that exact call before. The sibling of `narrowed-demanded`, from the other
743
+ * side: that one fires when a broader check exists in the ledger and was not
744
+ * re-run, this one when no broader check was ever taken.
745
+ *
746
+ * `check` quotes the input as the run wrote it and `targets` names the subjects
747
+ * the demand is about, so a grader can decide after the fact whether the demand
748
+ * was right without replaying anything.
749
+ *
750
+ * @category events
751
+ * @since 0.1.0
752
+ */
753
+ export class NarrowOnlyDemanded extends Schema.TaggedClass("flows/harness/AgentEvent/NarrowOnlyDemanded")("narrow-only-demanded", {
754
+ eventType: Schema.Literal("flows.harness.narrow-only-demanded.v1"),
755
+ /** The flow the check named. */
756
+ flow: Schema.String,
757
+ /** The check's input as the run wrote it, clipped. */
758
+ check: Schema.String,
759
+ /** The subjects it names, sorted. */
760
+ targets: Schema.Array(Schema.String),
761
+ /** Workspace digest the completing frame closed on; empty when unmeasured. */
762
+ currentDigest: Schema.String,
763
+ /** The frame the demand was attached to, which is the one that must answer it. */
764
+ nextFrame: Schema.Int
765
+ }) {
766
+ }
767
+ /**
768
+ * What Jev read off one completion claim, whether or not it braked.
769
+ *
770
+ * The only demand event written on every evaluation rather than only on a
771
+ * firing, and it is written that way on purpose: the other five demands are
772
+ * derived from facts a grader can recompute from the journal, and this one is
773
+ * a model's reading that exists nowhere else. Without the passing readings the
774
+ * record would answer "how often did it fire" and could never answer "how
775
+ * often did it agree", which is the only question that says whether arming it
776
+ * was right. `demanded` is the field that separates them, and it says exactly one
777
+ * thing: whether this reading handed the completion back for a frame. A
778
+ * reading comes out three ways, not two. It passes, and cost the run nothing.
779
+ * It demands, and cost the run a frame. Or it reads against a run with no
780
+ * bounce left to spend, where `demanded` is false and the run ends on
781
+ * `CompletionClaim.unproven`: the verdict is in the run's failure, and the two
782
+ * probabilities here are what a grader re-applies a threshold to either way.
783
+ *
784
+ * `complete` and `overclaims` are the transport's probabilities for the
785
+ * classifier's two questions, verbatim, so a grader can re-apply any
786
+ * threshold to a whole wave without re-asking. `latencyMs` is what the
787
+ * evaluation cost in wall clock on the hot path of a completion. No event is
788
+ * written where the brake is disarmed (`claimCap` of zero), where the
789
+ * transport failed, or where there was no task and no claim to ask about:
790
+ * nothing was read, so there is nothing to record. A spent cap is no longer
791
+ * one of those cases — the reading still happens, and it is the reading that
792
+ * ends the run. See `CompletionClaim`.
793
+ *
794
+ * @category events
795
+ * @since 1.0.0-rc.0
796
+ */
797
+ export class ClaimDemanded extends Schema.TaggedClass("flows/harness/AgentEvent/ClaimDemanded")("claim-demanded", {
798
+ eventType: Schema.Literal("flows.harness.claim-demanded.v1"),
799
+ /** Probability the transport gave to "the task as stated is done"; journaled, decides nothing. */
800
+ complete: Schema.Number,
801
+ /** Probability it gave to "the claim asserts what the evidence does not show"; journaled, decides nothing. */
802
+ overclaims: Schema.Number,
803
+ /** Probability it gave to "the claim reports a command or a result the evidence does not record"; the one that decides. */
804
+ invented: Schema.Number,
805
+ /** Wall-clock milliseconds the evaluation took. */
806
+ latencyMs: Schema.Int,
807
+ /** Token usage reported by the evaluator, absent from older journal entries. */
808
+ usage: Schema.optional(Usage),
809
+ /** Whether this reading handed the completion back. */
810
+ demanded: Schema.Boolean,
811
+ /**
812
+ * Whether this reading ended the run instead of handing the completion back.
813
+ *
814
+ * The third of the three ways a reading comes out, and the one that had no
815
+ * field. `demanded` false meant both "the claim stands" and "the claim is
816
+ * refused and the run is over", which a projection cannot tell apart, so the
817
+ * refusal wrote no card and the sentence it refused was nowhere a person
818
+ * could read. Absent from older journal entries, where it decodes false: a
819
+ * journal written before this field carries its verdict in the run's
820
+ * failure, which is where it always was.
821
+ */
822
+ refused: Schema.Boolean.pipe(Schema.withConstructorDefault(Effect.succeed(false)), Schema.withDecodingDefaultKey(Effect.succeed(false))),
823
+ /** Workspace digest the completing frame closed on; empty when unmeasured. */
824
+ currentDigest: Schema.String,
825
+ /** The frame the demand was attached to, which is the one that must answer it. */
826
+ nextFrame: Schema.Int
827
+ }) {
828
+ }
829
+ const Probability = Schema.Number.check(Schema.isBetween({ minimum: 0, maximum: 1 }));
830
+ /**
831
+ * One classifier answer as `decision-settled` journals it, tagged by kind.
832
+ *
833
+ * `confidence` is the PROVIDER's number, `Evaluator.Response.confidence`, and
834
+ * it is absent whenever the provider sent none. It is never the largest
835
+ * probability wearing the name: `Classifier.confidence` reads 1 for an answer
836
+ * that carried no distribution at all, so a record that filled the field from
837
+ * it would report certainty exactly where the provider reported nothing. A
838
+ * boolean has no such field because its probability is the whole answer.
839
+ *
840
+ * @category models
841
+ * @since 1.0.0-rc.0
842
+ */
843
+ export const DecisionAnswer = Schema.Union([
844
+ Schema.Struct({
845
+ kind: Schema.Literal("boolean"),
846
+ /** The probability the transport gave to yes. */
847
+ p: Probability
848
+ }),
849
+ Schema.Struct({
850
+ kind: Schema.Literal("choice"),
851
+ /** The option chosen. */
852
+ value: Schema.String,
853
+ probabilities: Schema.Record(Schema.String, Probability),
854
+ /** The provider's own number, unchecked: it is theirs to define, and a record must not fail a run. */
855
+ confidence: Schema.optionalKey(Schema.Number)
856
+ }),
857
+ Schema.Struct({
858
+ kind: Schema.Literal("score"),
859
+ /** The score as the transport gave it, interpolated over rung indexes. */
860
+ value: Schema.Number,
861
+ /** The label of the nearest rung. */
862
+ label: Schema.String,
863
+ probabilities: Schema.Record(Schema.String, Probability),
864
+ /** The provider's own number, unchecked: it is theirs to define, and a record must not fail a run. */
865
+ confidence: Schema.optionalKey(Schema.Number)
866
+ })
867
+ ]);
868
+ /**
869
+ * The answers of one evaluation in the shape {@link DecisionSettled} carries.
870
+ *
871
+ * `confidence` is `Evaluator.Response.confidence`, passed through per question
872
+ * and left out per question: see {@link DecisionAnswer}.
873
+ *
874
+ * @category conversions
875
+ * @since 1.0.0-rc.0
876
+ */
877
+ export const decisionAnswers = (answers, confidence) => Object.fromEntries(Object.entries(answers).map(([id, answer]) => {
878
+ if ("probability" in answer)
879
+ return [id, { kind: "boolean", p: answer.probability }];
880
+ const reported = confidence !== undefined && Object.hasOwn(confidence, id) ? confidence[id] : undefined;
881
+ const provided = reported === undefined ? {} : { confidence: reported };
882
+ return "label" in answer
883
+ ? [id, {
884
+ kind: "score",
885
+ value: answer.value,
886
+ label: answer.label,
887
+ probabilities: answer.probabilities,
888
+ ...provided
889
+ }]
890
+ : [id, { kind: "choice", value: answer.value, probabilities: answer.probabilities, ...provided }];
891
+ }));
892
+ /**
893
+ * One decision a classifier made, with everything a reader needs to make it
894
+ * again: the state it read, the questions it was asked, and what it answered.
895
+ *
896
+ * The generalisation of {@link ClaimDemanded}, which stays. That event is three
897
+ * probabilities and a verdict, and it cannot say what the probabilities were
898
+ * probabilities OF: the evidence the brake assembled exists nowhere else, so a
899
+ * reading could be re-thresholded and never re-asked. This one carries the
900
+ * evidence. It is written beside `claim-demanded` rather than instead of it,
901
+ * because every projection that counts readings counts that event.
902
+ *
903
+ * `classifier` is the declaration's stable id, never its description, and
904
+ * `digest` is `Classifier.digest`, so a reader can tell a decision made under
905
+ * questions that have since been reworded from one it can reproduce.
906
+ * `questions` are the wire shapes the transport was sent.
907
+ *
908
+ * `acted` says whether the decision changed what the run did next. For the
909
+ * completion brake that is a completion handed back or a run ended; a reading
910
+ * that let the claim stand is `false`, and it is journaled all the same,
911
+ * because the passing decisions are what say whether asking was right.
912
+ *
913
+ * `decidedBy` names who answered: `jev` for the decision-only model behind
914
+ * `Evaluator`, `seat` for a generation seat asked to judge, `human` for a
915
+ * person. Only `jev` is written today.
916
+ *
917
+ * `scope` and `frame` are the join keys {@link ModelRequested} carries, for the
918
+ * reason it carries them.
919
+ *
920
+ * An emitter must produce the reading inside a recorded boundary, as the
921
+ * completion brake does, and emit what the record holds. The answers are a
922
+ * model's and the latency is a clock's, so a replayed frame that asked again
923
+ * would journal a second, different decision at the same coordinates.
924
+ *
925
+ * @category events
926
+ * @since 1.0.0-rc.0
927
+ */
928
+ export class DecisionSettled extends Schema.TaggedClass("flows/harness/AgentEvent/DecisionSettled")("decision-settled", {
929
+ eventType: Schema.Literal("flows.harness.decision-settled.v1"),
930
+ /** The run's session, which is the recorded scope of the step that decided. */
931
+ scope: Schema.String,
932
+ /** The controller's frame number for the turn the decision was made in. */
933
+ frame: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
934
+ /** The classifier's stable id. */
935
+ classifier: Schema.String,
936
+ /** `Classifier.digest`: the canonical hash of the id and the questions. */
937
+ digest: Schema.String,
938
+ /** The encoded state the questions were asked about, as the transport was sent it. */
939
+ state: Schema.Json,
940
+ /** The questions as they crossed the wire, keyed by question id. */
941
+ questions: Schema.Record(Schema.String, Evaluator.Question),
942
+ /** One answer per question id, tagged by kind. */
943
+ answers: Schema.Record(Schema.String, DecisionAnswer),
944
+ /** Wall-clock milliseconds the evaluation took. */
945
+ latencyMs: Schema.Int,
946
+ /** Whether this decision changed what the run did next. */
947
+ acted: Schema.Boolean,
948
+ /** Who answered. */
949
+ decidedBy: Schema.Literals(["jev", "seat", "human"]),
950
+ /** Token usage reported by the evaluator, absent when it supplied none. */
951
+ usage: Schema.optional(Usage)
952
+ }) {
953
+ }
954
+ const Level = Schema.Literals(["none", "mild", "strong"]);
955
+ /**
956
+ * What Jev read off one frame of a running run, whether or not it nudged.
957
+ *
958
+ * Written by the supervisor fiber for every snapshot it read, at some time
959
+ * after the frame it is a reading of closed: the reading is taken off the
960
+ * cell loop's hot path, so its position among the frame's other events is not
961
+ * fixed and `scope` and `frame` are its coordinates. `frame` is the frame the
962
+ * snapshot was built from, not the frame that will read any nudge.
963
+ *
964
+ * `thrashing`, `onTarget` and `suspect` are the transport's probabilities
965
+ * verbatim, so a wave re-applies any threshold without re-asking. The five
966
+ * levels and `needsHelp` are the transport's words: nothing here is a default
967
+ * a failed reading fills in, because a failed reading writes
968
+ * {@link SupervisorUnjudged} and never this. `crossed` says whether the
969
+ * reading passed a nudge threshold; `nudged` whether a nudge was handed to
970
+ * the next boundary, which needs the host to have armed steering. The
971
+ * recalled rows are judged by Relevance and journaled beside this as
972
+ * `relevance-settled`. `decision-settled` beside this carries the snapshot
973
+ * and every answer.
974
+ *
975
+ * @category events
976
+ * @since 1.0.0-rc.0
977
+ */
978
+ export class SupervisorSettled extends Schema.TaggedClass("flows/harness/AgentEvent/SupervisorSettled")("supervisor-settled", {
979
+ eventType: Schema.Literal("flows.harness.supervisor-settled.v1"),
980
+ /** The run's session. */
981
+ scope: Schema.String,
982
+ /** The frame the snapshot was built from. */
983
+ frame: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
984
+ /** Probability the run is repeating itself without converging. */
985
+ thrashing: Schema.Number,
986
+ /** Probability the run is still working on the task as stated. */
987
+ onTarget: Schema.Number,
988
+ /** Probability the run's evidence is suspect. */
989
+ suspect: Schema.Number,
990
+ /** Probability visible earlier context is contradicted by later evidence. */
991
+ outdatedContext: Schema.optional(Schema.Number),
992
+ /** Probability visible earlier context is no longer useful for this task. */
993
+ irrelevantContext: Schema.optional(Schema.Number),
994
+ frustrated: Level,
995
+ anxious: Level,
996
+ scared: Level,
997
+ confused: Level,
998
+ confident: Level,
999
+ /** The one word a person is shown. */
1000
+ needsHelp: Schema.Literals(["none", "clarification", "permission", "stuck", "risky_action"]),
1001
+ /** Whether the reading crossed a nudge threshold. */
1002
+ crossed: Schema.Boolean,
1003
+ /** Whether a nudge was handed to the next boundary. */
1004
+ nudged: Schema.Boolean,
1005
+ /**
1006
+ * Whether steering was armed for this reading. `discipline-armed` states it
1007
+ * once, at a run's first frame; a resumed run may be armed differently, and
1008
+ * this is where the journal says what the reading actually ran under.
1009
+ * Absent from readings journaled before it existed.
1010
+ */
1011
+ steer: Schema.optional(Schema.Boolean),
1012
+ /**
1013
+ * Whether the snapshot had more uncalled skills than `Supervisor.skillLimit`,
1014
+ * so some were not scored. Absent when every one was.
1015
+ */
1016
+ skillsCapped: Schema.optional(Schema.Boolean),
1017
+ /** Wall-clock milliseconds the evaluation took. */
1018
+ latencyMs: Schema.Int,
1019
+ /** Token usage reported by the evaluator, absent when it supplied none. */
1020
+ usage: Schema.optional(Usage),
1021
+ /** Each armed monitor's probability in this reading, and whether it crossed. */
1022
+ monitors: Schema.optional(Schema.Array(Schema.Struct({
1023
+ id: Schema.String,
1024
+ kind: MonitorKind,
1025
+ p: Schema.Number,
1026
+ crossed: Schema.Boolean
1027
+ })))
1028
+ }) {
1029
+ }
1030
+ /**
1031
+ * A supervisor snapshot nobody could judge, and why.
1032
+ *
1033
+ * Written instead of {@link SupervisorSettled}, never beside it: no
1034
+ * evaluator on the host, a refusal, a deadline, an answer that does not
1035
+ * decode, a run that ended with the reading in flight. `reason` is
1036
+ * `unconfigured`, `interrupted`, or the transport's own error code. A reading
1037
+ * that fails inserts nothing and reports no level, so a
1038
+ * wave counting calm runs counts only runs Jev read. An `interrupted` reading
1039
+ * was asked and may have cost a call, so a wave counting Jev's cost counts it.
1040
+ *
1041
+ * @category events
1042
+ * @since 1.0.0-rc.0
1043
+ */
1044
+ export class SupervisorUnjudged extends Schema.TaggedClass("flows/harness/AgentEvent/SupervisorUnjudged")("supervisor-unjudged", {
1045
+ eventType: Schema.Literal("flows.harness.supervisor-unjudged.v1"),
1046
+ /** The run's session. */
1047
+ scope: Schema.String,
1048
+ /** The frame the snapshot was built from. */
1049
+ frame: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
1050
+ /** `unconfigured`, `interrupted`, or the transport's own error code. */
1051
+ reason: UnjudgedReason,
1052
+ /** What went wrong, safe to journal: see `Evaluator.publicMessage`. */
1053
+ detail: Schema.String,
1054
+ /** What each request of the failed reading paid; absent when none was metered. */
1055
+ usage: Schema.optional(Schema.Array(Usage))
1056
+ }) {
1057
+ }
1058
+ /**
1059
+ * A Jev reading that could not be judged, outside the supervisor.
1060
+ *
1061
+ * Written by a relevance, compaction or routing reading instead of its
1062
+ * settlement. The caller then keeps everything it would have filtered, so the
1063
+ * receipt is what says the filter did not run. `items` is how many items the
1064
+ * failed reading covered.
1065
+ *
1066
+ * @category events
1067
+ * @since 1.0.0-rc.0
1068
+ */
1069
+ export class DecisionUnjudged extends Schema.TaggedClass("flows/harness/AgentEvent/DecisionUnjudged")("decision-unjudged", {
1070
+ eventType: Schema.Literal("flows.harness.decision-unjudged.v1"),
1071
+ /** The run's session. */
1072
+ scope: Schema.String,
1073
+ /** The frame the reading was asked in. */
1074
+ frame: NonNegativeSafeInt,
1075
+ /** The classifier's stable id. */
1076
+ classifier: Schema.String,
1077
+ /** `unconfigured`, `interrupted`, or the transport's own error code. */
1078
+ reason: UnjudgedReason,
1079
+ /** What went wrong, safe to journal: see `Evaluator.publicMessage`. */
1080
+ detail: Schema.String,
1081
+ /** Items the failed reading covered. */
1082
+ items: NonNegativeSafeInt,
1083
+ /** What each request of the failed reading paid; absent when none was metered. */
1084
+ usage: Schema.optional(Schema.Array(Usage))
1085
+ }) {
1086
+ }
1087
+ const RelevanceItem = Schema.Struct({
1088
+ kind: RelevanceKind,
1089
+ id: Schema.String,
1090
+ /** Digest of the item's text; the text itself is never journaled. */
1091
+ digest: Schema.String,
1092
+ /** Probability the item is unnecessary for the task as stated. */
1093
+ p: Schema.Number
1094
+ });
1095
+ /**
1096
+ * Which human-provided items a relevance reading kept and which it withheld.
1097
+ *
1098
+ * An item is withheld only at or above `withholdAt`. Ids and digests, never
1099
+ * item text.
1100
+ *
1101
+ * @category events
1102
+ * @since 1.0.0-rc.0
1103
+ */
1104
+ export class RelevanceSettled extends Schema.TaggedClass("flows/harness/AgentEvent/RelevanceSettled")("relevance-settled", {
1105
+ eventType: Schema.Literal("flows.harness.relevance-settled.v1"),
1106
+ /** The run's session. */
1107
+ scope: Schema.String,
1108
+ /** The frame the reading was asked in. */
1109
+ frame: NonNegativeSafeInt,
1110
+ /**
1111
+ * `run` for the gate at run start, `supervisor` for recalled memory,
1112
+ * `recall` for a recall the model called.
1113
+ */
1114
+ source: Schema.Literals(["run", "supervisor", "recall"]),
1115
+ /** The probability at or above which an item is withheld. */
1116
+ withholdAt: Schema.Number,
1117
+ kept: Schema.Array(RelevanceItem),
1118
+ withheld: Schema.Array(RelevanceItem),
1119
+ /** Wall-clock milliseconds the evaluation took. */
1120
+ latencyMs: NonNegativeSafeInt,
1121
+ /** Token usage reported by the evaluator, absent when it supplied none. */
1122
+ usage: Schema.optional(Usage)
1123
+ }) {
1124
+ }
1125
+ /**
1126
+ * A withheld flow restored because the run called it by name.
1127
+ *
1128
+ * @category events
1129
+ * @since 1.0.0-rc.0
1130
+ */
1131
+ export class RelevanceRestored extends Schema.TaggedClass("flows/harness/AgentEvent/RelevanceRestored")("relevance-restored", {
1132
+ eventType: Schema.Literal("flows.harness.relevance-restored.v1"),
1133
+ /** The run's session. */
1134
+ scope: Schema.String,
1135
+ /** The frame whose call restored it. */
1136
+ frame: NonNegativeSafeInt,
1137
+ /** The flow restored. */
1138
+ flow: Schema.String
1139
+ }) {
1140
+ }
1141
+ /**
1142
+ * A panel a routed run fans out to: each member seat, with the backups it
1143
+ * fails over to, answers the task, and `merger` merges their answers.
1144
+ *
1145
+ * @category schemas
1146
+ * @since 1.0.0-rc.0
1147
+ */
1148
+ export const SeatPanel = Schema.Struct({
1149
+ seats: Schema.Array(Schema.Struct({ seat: Schema.String, backups: Schema.Array(Schema.String) })),
1150
+ merger: Schema.String
1151
+ });
1152
+ /**
1153
+ * The seat a run with no declared model was routed to, and who chose it.
1154
+ *
1155
+ * `decidedBy` is `jev` when Jev answered the routing questions. Rows written
1156
+ * before the routing graph may say `only` and carry the seat choice's
1157
+ * `confidence`.
1158
+ *
1159
+ * @category events
1160
+ * @since 1.0.0-rc.0
1161
+ */
1162
+ export class SeatRouted extends Schema.TaggedClass("flows/harness/AgentEvent/SeatRouted")("seat-routed", {
1163
+ eventType: Schema.Literal("flows.harness.seat-routed.v1"),
1164
+ /** The run's session. */
1165
+ scope: Schema.String,
1166
+ /** What the flow declared, such as `auto`. */
1167
+ declared: Schema.String,
1168
+ /** The seat chosen. */
1169
+ seat: Schema.String,
1170
+ /** The chosen seat's model. */
1171
+ modelId: Schema.String,
1172
+ /** The system-prompt variant chosen with it, when one was. */
1173
+ variant: Schema.NullOr(Schema.String),
1174
+ /** The seats offered. */
1175
+ candidates: Schema.Array(Schema.String),
1176
+ decidedBy: Schema.Literals(["jev", "only"]),
1177
+ /** The provider's own number, absent when it sent none. */
1178
+ confidence: Schema.optional(Schema.Number),
1179
+ /** Wall-clock milliseconds the routing took. */
1180
+ latencyMs: NonNegativeSafeInt,
1181
+ /** The seats `seat` fails over to, in order; absent when there are none. */
1182
+ backups: Schema.optionalKey(Schema.Array(Schema.String)),
1183
+ /** The panel the task was routed to, whose merger is `seat`; absent for one seat. */
1184
+ panel: Schema.optionalKey(SeatPanel)
1185
+ }) {
1186
+ }
1187
+ /**
1188
+ * A memory read or write the store refused.
1189
+ *
1190
+ * A `recall` is written by the supervisor fiber beside the reading it belongs
1191
+ * to, never instead of it: a memory fault is not a supervisor fault, and the
1192
+ * reading still settles. A `remember` is written at run end by the transcript
1193
+ * miner, for a fact Jev accepted that the store did not keep, and the run
1194
+ * still ends as it would have. `operation` says which side failed; `detail`
1195
+ * is the store's own account. A wave counts these rather than reading a log, because a
1196
+ * concurrent writer that loses a lock looks exactly like a run that
1197
+ * remembered nothing.
1198
+ *
1199
+ * @category events
1200
+ * @since 1.0.0-rc.0
1201
+ */
1202
+ export class SupervisorMemoryFailed extends Schema.TaggedClass("flows/harness/AgentEvent/SupervisorMemoryFailed")("supervisor-memory-failed", {
1203
+ eventType: Schema.Literal("flows.harness.supervisor-memory-failed.v1"),
1204
+ /** The run's session. */
1205
+ scope: Schema.String,
1206
+ /** The frame whose reading asked; for a `remember`, the run's last frame. */
1207
+ frame: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
1208
+ /** `recall` for a read, `remember` for a write. */
1209
+ operation: Schema.Literals(["recall", "remember"]),
1210
+ /** The store's own account of the failure. */
1211
+ detail: Schema.String
1212
+ }) {
1213
+ }
1214
+ /**
1215
+ * The controller telling a run that its own evidence is complete.
1216
+ *
1217
+ * The one control that is not a brake, and the only one written for a frame
1218
+ * that has done nothing wrong: the run watched a check fail before it changed
1219
+ * anything and watched the same check, or a broader one, pass after. Written
1220
+ * when the observation is *issued*, at most once per run, because what answers
1221
+ * it is the next frame's transition and the journal already writes that.
1222
+ *
1223
+ * `failed` and `passed` quote the two inputs as the run wrote them, and `epoch`
1224
+ * is the run's count of mutating frames when the failure was recorded, so the
1225
+ * ordering the observation asserts is checkable after the fact. Nothing is
1226
+ * refused and no cap is spent, so there is no cap field to record.
1227
+ *
1228
+ * @category events
1229
+ * @since 0.1.0
1230
+ */
1231
+ export class SufficiencyObserved extends Schema.TaggedClass("flows/harness/AgentEvent/SufficiencyObserved")("sufficiency-observed", {
1232
+ eventType: Schema.Literal("flows.harness.sufficiency-observed.v1"),
1233
+ /** The flow that ran the failing check. */
1234
+ flow: Schema.String,
1235
+ /** The failing check's input as the run wrote it, clipped. */
1236
+ failed: Schema.String,
1237
+ /** The input of the passing check that answered it, clipped. */
1238
+ passed: Schema.String,
1239
+ /** Mutating frames the run had spent when the failure was recorded. */
1240
+ epoch: Schema.Int,
1241
+ /** The frame the observation was attached to. */
1242
+ nextFrame: Schema.Int
1243
+ }) {
1244
+ }
1245
+ /**
1246
+ * The controller telling a run that its stored proof was already green.
1247
+ *
1248
+ * **Nothing emits this.** `VacuousVerification` is unwired from `CellTurn`;
1249
+ * the event stays declared so the r93 journals that carry it keep decoding and
1250
+ * so a controlled re-measure needs no schema change. See `VacuousVerification`
1251
+ * for the evidence that turned the arm off.
1252
+ *
1253
+ * The second control in this package that is not a brake, and the narrower of
1254
+ * the two: a cell stored `state.verification` naming a call this run had
1255
+ * already watched pass over the tree it was handed, before any frame changed a
1256
+ * byte. Written when the observation is issued, at most once per distinct
1257
+ * verification input, and delivered on the `invalidProbe` channel because it is
1258
+ * the same class of fact — a result that reads identically on a broken tree and
1259
+ * on a fixed one.
1260
+ *
1261
+ * `check` quotes the stored input as the run wrote it, and `callDigest` is the
1262
+ * controller's own identity for that call, so a reader can reconcile the
1263
+ * observation against the run's own `cell-call-settled` rows without replaying
1264
+ * anything. Nothing is refused and no cap is spent, so there is no cap field.
1265
+ *
1266
+ * It is named for what it is -- the digest of `{ flow, input }`, nothing signs
1267
+ * it -- rather than `signature`, the controller's own word for it everywhere
1268
+ * else. The journal redacts by field name, and `signature` names a credential
1269
+ * often enough in this repository (an HMAC over share claims, a grant
1270
+ * envelope, a webhook header) that the rule stays. A field this row exists to
1271
+ * be reconciled by cannot be written as `[REDACTED]`, so the field carries the
1272
+ * honest word and the rule keeps its reach.
1273
+ *
1274
+ * @category events
1275
+ * @since 0.1.0
1276
+ */
1277
+ export class VacuousVerificationObserved extends Schema.TaggedClass("flows/harness/AgentEvent/VacuousVerificationObserved")("vacuous-verification-observed", {
1278
+ eventType: Schema.Literal("flows.harness.vacuous-verification-observed.v1"),
1279
+ /** The flow the stored check named. */
1280
+ flow: Schema.String,
1281
+ /** The stored check's input as the run wrote it, clipped. */
1282
+ check: Schema.String,
1283
+ /** The controller's identity for that call: the digest of its flow and input. */
1284
+ callDigest: Schema.String,
1285
+ /** The frame the observation was attached to. */
1286
+ nextFrame: Schema.Int
1287
+ }) {
1288
+ }
1289
+ /**
1290
+ * What one frame did to the workspace, and how the controller knows.
1291
+ *
1292
+ * Emitted once per frame that ran a cell. It is the frame's own answer to the
1293
+ * question every later audit asks — "did this frame change anything" — written
1294
+ * before any control acts on it, so a run that never trips the cap still leaves
1295
+ * the evidence behind.
1296
+ *
1297
+ * `basis` is the field that keeps the record honest. `observed` means the frame
1298
+ * had two measurements around it that each covered the whole workspace, so the
1299
+ * tree itself could answer. `partial` means a measurement was taken and stopped
1300
+ * at a bound before it covered the tree, so it is set aside: a prefix chosen by
1301
+ * sort order cannot say the files being edited outside it held still, and its
1302
+ * own movement is as likely to be a tool's churn as work. `declared` means the
1303
+ * host measured nothing at all.
1304
+ * Under the last two, `mutated` is only what the frame's calls claimed about
1305
+ * themselves — which is exactly the signal that missed a shell redirect over a
1306
+ * tracked source file.
1307
+ *
1308
+ * `mutated` is the union of the two signals, with one exception. A declaration
1309
+ * by a call that *succeeded* stands even where the measurement cannot see the
1310
+ * path it touched, because the alternative is failing a run that has been
1311
+ * editing all along on the strength of a walk that never looked at its files.
1312
+ * A declaration by a call that *failed* is a claim about what it would have
1313
+ * written, and where `basis` is `observed` and the digest did not move, the
1314
+ * tree has answered that claim: nothing was written, and the frame is not
1315
+ * counted as a write. So `declaredWrites: 1` beside `mutated: false` under
1316
+ * `observed` is a declaration the measurement vetoed, and both numbers stay in
1317
+ * the record.
1318
+ *
1319
+ * @category events
1320
+ * @since 0.1.0
1321
+ */
1322
+ export class MutationObserved extends Schema.TaggedClass("flows/harness/AgentEvent/MutationObserved")("mutation-observed", {
1323
+ eventType: Schema.Literal("flows.harness.mutation-observed.v1"),
1324
+ /** What the frame had to decide with: a full measurement, a partial one, or paperwork. */
1325
+ basis: Schema.Literals(["observed", "partial", "declared"]),
1326
+ /** Whether this frame changed anything: the tree said so, or a call declared it. */
1327
+ mutated: Schema.Boolean,
1328
+ /** Content address of the workspace as the frame left it; empty when unobserved. */
1329
+ digest: Schema.String,
1330
+ /** Paths the closing measurement covered; zero when unobserved. */
1331
+ paths: Schema.Int,
1332
+ /**
1333
+ * Calls this frame made that DECLARED a write, whether or not they landed.
1334
+ *
1335
+ * Journaled beside the observed answer rather than instead of it, because
1336
+ * the gap between the two numbers is the accounting defect itself: a frame
1337
+ * with `declaredWrites: 0` and `mutated: true` is a shell mutation nothing
1338
+ * else in the run can see, and a frame with `declaredWrites: 1` and
1339
+ * `mutated: false` under `observed` is a failed call whose declaration the
1340
+ * measurement contradicted.
1341
+ */
1342
+ declaredWrites: Schema.Int
1343
+ }) {
1344
+ }
1345
+ /**
1346
+ * One tree this run pinned, and the store's own name for it.
1347
+ *
1348
+ * Journaled at the mint rather than only at its use, because the two are
1349
+ * frames apart by design: a run pins the tree it is about to change and reads
1350
+ * against it later, and a journal that recorded only the reading could not say
1351
+ * which tree it was a reading of. `ref` is the host's vocabulary and the
1352
+ * controller never interprets it; a grader reconciles it against the store by
1353
+ * hand. See `EngineLike` `Snapshot`.
1354
+ *
1355
+ * @category events
1356
+ * @since 0.1.0
1357
+ */
1358
+ export class CheckpointMinted extends Schema.TaggedClass("flows/harness/AgentEvent/CheckpointMinted")("checkpoint-minted", {
1359
+ eventType: Schema.Literal("flows.harness.checkpoint-minted.v1"),
1360
+ /** The handle the cell holds, and what a later call names in its `at`. */
1361
+ id: Schema.String,
1362
+ /** What the host recorded, in the host's own vocabulary. */
1363
+ ref: Schema.String,
1364
+ /** The cell that minted it, and where in that cell. */
1365
+ cell: Schema.String,
1366
+ ordinal: Schema.Int
1367
+ }) {
1368
+ }
1369
+ /**
1370
+ * The durable reason a cell execution parked.
1371
+ *
1372
+ * @category events
1373
+ * @since 0.1.0
1374
+ * @slop
1375
+ */
1376
+ export class Suspended extends Schema.TaggedClass("flows/harness/AgentEvent/Suspended")("suspended", {
1377
+ eventType: Schema.Literal("flows.harness.suspended.v1"),
1378
+ reason: EngineLike.SuspendReason
1379
+ }) {
1380
+ }
1381
+ /**
1382
+ * A sealed compaction summary and the prefix it replaces.
1383
+ *
1384
+ * @category events
1385
+ * @since 0.1.0
1386
+ * @slop
1387
+ */
1388
+ export class CompactionSettled extends Schema.TaggedClass("flows/harness/AgentEvent/CompactionSettled")("compaction-settled", {
1389
+ eventType: Schema.Literal("flows.harness.compaction-settled.v1"),
1390
+ replacedPrefixDigest: Schema.String,
1391
+ // Counts messages, not segments: one live transcript segment can contain
1392
+ // both an assistant turn and its observations. Absent in older journals.
1393
+ retainedMessageCount: Schema.optional(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),
1394
+ /** Absent when nothing replaced was squashed. */
1395
+ summary: Schema.optional(ModelRequest.Message),
1396
+ /** Replaced messages carried over verbatim, after the summary. */
1397
+ kept: Schema.optional(Schema.Array(ModelRequest.Message)),
1398
+ /** What a reading marked each replaced segment, by segment digest. */
1399
+ marks: Schema.optional(Schema.Array(Schema.Struct({
1400
+ digest: Schema.String,
1401
+ mark: CompactionMark,
1402
+ /** The invariant that overrode a `remove`, when one did. */
1403
+ pinned: Schema.optional(CompactionPin)
1404
+ }))),
1405
+ /** Estimated tokens the removed messages held. */
1406
+ removedTokens: Schema.optional(NonNegativeSafeInt),
1407
+ /**
1408
+ * True when a judged run could not mark: its facts do not describe every
1409
+ * transcript segment, as in state written before marks, so every replaced
1410
+ * message was squashed.
1411
+ */
1412
+ unaligned: Schema.optional(Schema.Boolean),
1413
+ /** Why the compaction ran, budget first. Absent in older journals, which compacted on the budget alone. */
1414
+ causes: Schema.optional(Schema.Array(CompactionCause))
1415
+ }) {
1416
+ }
1417
+ /**
1418
+ * Steering messages drained at a turn boundary.
1419
+ *
1420
+ * @category events
1421
+ * @since 0.1.0
1422
+ * @slop
1423
+ */
1424
+ export class SteeringDrained extends Schema.TaggedClass("flows/harness/AgentEvent/SteeringDrained")("steering-drained", {
1425
+ eventType: Schema.Literal("flows.harness.steering-drained.v1"),
1426
+ /** What the person sent, in admission order. */
1427
+ messages: Schema.Array(ModelRequest.Message),
1428
+ /**
1429
+ * What the run's supervisor delivered at the same boundary: a nudge or a
1430
+ * recalled row. The model reads these above the person's messages; they
1431
+ * never join the task the completion brake or the supervisor reads.
1432
+ */
1433
+ supervisor: Schema.optional(Schema.Array(ModelRequest.Message)),
1434
+ /** The monitor whose delivery `supervisor` carries, when one's does. */
1435
+ monitor: Schema.optional(Schema.String),
1436
+ /** Crossed monitors not delivered at this boundary, and why. */
1437
+ suppressed: Schema.optional(Schema.Array(Schema.Struct({ id: Schema.String, reason: Suppression }))),
1438
+ /** Keys of the memory rows delivered at this boundary. */
1439
+ memory: Schema.optional(Schema.Array(Schema.String))
1440
+ }) {
1441
+ }
1442
+ /**
1443
+ * The terminal decision made at a turn boundary.
1444
+ *
1445
+ * @category events
1446
+ * @since 0.1.0
1447
+ * @slop
1448
+ */
1449
+ export class TurnClosed extends Schema.TaggedClass("flows/harness/AgentEvent/TurnClosed")("turn-closed", {
1450
+ eventType: Schema.Literal("flows.harness.turn-closed.v1"),
1451
+ stopReason: ModelRequest.StopReason,
1452
+ outcome: Schema.Literals(["continue", "resolved", "aborted", "suspended"])
1453
+ }) {
1454
+ }
1455
+ /**
1456
+ * A permission request reported for engine-owned suspension and resolution.
1457
+ *
1458
+ * @category events
1459
+ * @since 0.1.0
1460
+ * @slop
1461
+ */
1462
+ export class PermissionRequired extends Schema.TaggedClass("flows/harness/AgentEvent/PermissionRequired")("permission-required", {
1463
+ eventType: Schema.Literal("flows.harness.permission-required.v1"),
1464
+ request: Permission.PermissionRequired
1465
+ }) {
1466
+ }
1467
+ /**
1468
+ * A normalized harness abort.
1469
+ *
1470
+ * @category events
1471
+ * @since 0.1.0
1472
+ * @slop
1473
+ */
1474
+ export class Aborted extends Schema.TaggedClass("flows/harness/AgentEvent/Aborted")("aborted", {
1475
+ eventType: Schema.Literal("flows.harness.aborted.v1"),
1476
+ reason: Schema.String
1477
+ }) {
1478
+ }
1479
+ /**
1480
+ * The final assistant message produced by the harness.
1481
+ *
1482
+ * @category events
1483
+ * @since 0.1.0
1484
+ * @slop
1485
+ */
1486
+ export class Resolved extends Schema.TaggedClass("flows/harness/AgentEvent/Resolved")("resolved", {
1487
+ eventType: Schema.Literal("flows.harness.resolved.v1"),
1488
+ message: ModelRequest.AssistantMessage
1489
+ }) {
1490
+ }
1491
+ /**
1492
+ * All normalized events emitted by a harness adapter.
1493
+ *
1494
+ * @category events
1495
+ * @since 0.1.0
1496
+ * @slop
1497
+ */
1498
+ export const AgentEvent = Schema.Union([
1499
+ DisciplineArmed,
1500
+ TurnOpened,
1501
+ ModelDelta,
1502
+ ModelRequested,
1503
+ ModelSelected,
1504
+ SeatFailedOver,
1505
+ ModelParked,
1506
+ ModelUnparked,
1507
+ ModelRetried,
1508
+ ModelSettled,
1509
+ CellProduced,
1510
+ CellRejectedInFrame,
1511
+ CellCallStarted,
1512
+ CellCallSettled,
1513
+ CellPrinted,
1514
+ CellSettled,
1515
+ TransitionApplied,
1516
+ MutationObserved,
1517
+ CheckpointMinted,
1518
+ ReadOnlyDemandIssued,
1519
+ ReadOnlyDemanded,
1520
+ RepeatDemanded,
1521
+ NarrowedDemanded,
1522
+ NarrowOnlyDemanded,
1523
+ UnmovedDemanded,
1524
+ UnresolvedDemanded,
1525
+ FailedCallDemanded,
1526
+ UnobservedDemanded,
1527
+ OutputDemanded,
1528
+ ClaimDemanded,
1529
+ DecisionSettled,
1530
+ SupervisorSettled,
1531
+ SupervisorUnjudged,
1532
+ SupervisorMemoryFailed,
1533
+ DecisionUnjudged,
1534
+ RelevanceSettled,
1535
+ RelevanceRestored,
1536
+ SeatRouted,
1537
+ SufficiencyObserved,
1538
+ VacuousVerificationObserved,
1539
+ Suspended,
1540
+ CompactionSettled,
1541
+ SteeringDrained,
1542
+ TurnClosed,
1543
+ PermissionRequired,
1544
+ Aborted,
1545
+ Resolved
1546
+ ]).pipe(Schema.toTaggedUnion("_tag"));
1547
+ /**
1548
+ * The journal event type of every member of {@link AgentEvent}, by tag.
1549
+ *
1550
+ * One table, because the literal used to be written three times: on the class,
1551
+ * in `CellTurn`'s emitter, and again in `Transcript`'s decoder. A projection
1552
+ * that reads a literal the emitter no longer writes silently returns an empty
1553
+ * transcript, and nothing failed when the two drifted. `CellTurn` and
1554
+ * `Transcript` both read this, and `Contracts.test.ts` pins it against the
1555
+ * union, so an event added without a row here fails a test rather than a run.
1556
+ *
1557
+ * @category events
1558
+ * @since 0.1.0
1559
+ * @slop
1560
+ */
1561
+ export const eventType = {
1562
+ aborted: "flows.harness.aborted.v1",
1563
+ cellCallSettled: "flows.harness.cell-call-settled.v1",
1564
+ cellCallStarted: "flows.harness.cell-call-started.v1",
1565
+ cellPrinted: "flows.harness.cell-printed.v1",
1566
+ cellProduced: "flows.harness.cell-produced.v1",
1567
+ cellRejectedInFrame: "flows.harness.cell-rejected-in-frame.v1",
1568
+ cellSettled: "flows.harness.cell-settled.v1",
1569
+ checkpointMinted: "flows.harness.checkpoint-minted.v1",
1570
+ claimDemanded: "flows.harness.claim-demanded.v1",
1571
+ compactionSettled: "flows.harness.compaction-settled.v1",
1572
+ decisionSettled: "flows.harness.decision-settled.v1",
1573
+ decisionUnjudged: "flows.harness.decision-unjudged.v1",
1574
+ disciplineArmed: "flows.harness.discipline-armed.v1",
1575
+ modelDelta: "flows.harness.model-delta.v1",
1576
+ modelRequested: "flows.harness.model-requested.v1",
1577
+ modelSelected: "flows.harness.model-selected.v1",
1578
+ seatFailedOver: "flows.harness.seat-failed-over.v1",
1579
+ modelParked: "flows.harness.model-parked.v1",
1580
+ modelUnparked: "flows.harness.model-unparked.v1",
1581
+ modelRetried: "flows.harness.model-retried.v1",
1582
+ modelSettled: "flows.harness.model-settled.v1",
1583
+ mutationObserved: "flows.harness.mutation-observed.v1",
1584
+ narrowOnlyDemanded: "flows.harness.narrow-only-demanded.v1",
1585
+ narrowedDemanded: "flows.harness.narrowed-demanded.v1",
1586
+ permissionRequired: "flows.harness.permission-required.v1",
1587
+ readOnlyDemandIssued: "flows.harness.read-only-demand-issued.v1",
1588
+ readOnlyDemanded: "flows.harness.read-only-demanded.v1",
1589
+ relevanceRestored: "flows.harness.relevance-restored.v1",
1590
+ relevanceSettled: "flows.harness.relevance-settled.v1",
1591
+ repeatDemanded: "flows.harness.repeat-demanded.v1",
1592
+ resolved: "flows.harness.resolved.v1",
1593
+ seatRouted: "flows.harness.seat-routed.v1",
1594
+ steeringDrained: "flows.harness.steering-drained.v1",
1595
+ sufficiencyObserved: "flows.harness.sufficiency-observed.v1",
1596
+ supervisorSettled: "flows.harness.supervisor-settled.v1",
1597
+ supervisorUnjudged: "flows.harness.supervisor-unjudged.v1",
1598
+ supervisorMemoryFailed: "flows.harness.supervisor-memory-failed.v1",
1599
+ suspended: "flows.harness.suspended.v1",
1600
+ transitionApplied: "flows.harness.transition-applied.v1",
1601
+ turnClosed: "flows.harness.turn-closed.v1",
1602
+ turnOpened: "flows.harness.turn-opened.v1",
1603
+ unmovedDemanded: "flows.harness.unmoved-demanded.v1",
1604
+ unresolvedDemanded: "flows.harness.unresolved-demanded.v1",
1605
+ failedCallDemanded: "flows.harness.failed-call-demanded.v1",
1606
+ unobservedDemanded: "flows.harness.unobserved-demanded.v1",
1607
+ outputDemanded: "flows.harness.output-demanded.v1",
1608
+ vacuousVerificationObserved: "flows.harness.vacuous-verification-observed.v1"
1609
+ };
1610
+ //# sourceMappingURL=AgentEvent.js.map