@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 @@
1
+ {"version":3,"file":"Supervisor.d.ts","sourceRoot":"","sources":["../../src/Supervisor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AAEH,OAAO,KAAK,UAAU,MAAM,0BAA0B,CAAA;AACtD,OAAO,KAAK,KAAK,SAAS,MAAM,yBAAyB,CAAA;AACzD,OAAO,KAAK,OAAO,MAAM,gBAAgB,CA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AsD,CAAA;AAElF;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,eAAe,CAAC,MAAM,CAAC,CAAA;AAK3D;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,GAAI,SAAS,WAAW,KAAG,OAAoE,CAAA;AAEnH;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,GAAI,SAAS,WAAW,KAAG,aAAa,CAAC,cAAc,CAAyC,CAAA;AAEvH;;;;;;;;;GASG;AACH,eAAO,MAAM,KAAK,GAAI,UAAU,QAAQ,EAAE,SAAS,OAAO,KAAG,MA8B5D,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,KAAK,QAAQ,KAAG,MAAqE,CAAA;AAEpH;;;;;GAKG;AACH,eAAO,MAAM,IAAI,GAAI,MAAM,MAAM,KAAG,MAAwD,CAAA;AAE5F;;;;;GAKG;AACH,eAAO,MAAM,IAAI,GAAI,MAAM,MAAM,KAAG,MAInC,CAAA;AAID;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,GAAI,MAAM,MAAM,KAAG,MAA6C,CAAA"}
@@ -0,0 +1,575 @@
1
+ /**
2
+ * The reading Jev takes of a run while it is still running.
3
+ *
4
+ * Every other control in this package reads a completion, or reads one fact
5
+ * the harness measured: a tree that never moved, a check that was narrowed, a
6
+ * frame that repeated itself. Each is exact, each fires late, and each is
7
+ * silent about the run between its brakes. A run that edits the wrong file
8
+ * for twenty frames, re-runs one failing check after every edit and never
9
+ * once claims to be done trips none of them until its budget is gone.
10
+ *
11
+ * So this module asks Jev about the run's *shape* rather than its sentence.
12
+ * One classifier, `supervisor/turn`, over a {@link Snapshot} the controller
13
+ * assembles from what it already holds: the task, the newest frames, and the
14
+ * counts the deterministic controls keep — read-only streak, repeat streak,
15
+ * mutations, checks run and failing, unanswered failures, demands spent. It
16
+ * re-derives none of them. Beside the run's state it carries the skills it has
17
+ * not called, the flows it has, and whether it can call `jev`. One Jev call per
18
+ * snapshot answers every question at once.
19
+ *
20
+ * Eleven questions are fixed. Five are about the run: whether it is
21
+ * thrashing, whether it is still on the task, whether its evidence is
22
+ * suspect, and whether it carries outdated or irrelevant context. Five are
23
+ * operational states a person would recognise in a colleague, each scored
24
+ * `none`, `mild` or `strong` against evidence the snapshot names, and
25
+ * `needs_help` is the one word a person is shown. The five about the run are
26
+ * the {@link triggers}: any one past its threshold crosses. Each monitor the
27
+ * host arms may add one boolean of its own, under {@link monitorPrefix}.
28
+ *
29
+ * Rows recalled from {@link Memory} are not asked about here. Beside each
30
+ * reading, the supervisor asks `Relevance` which of up to
31
+ * {@link recalledLimit} rows, none already shown to the run, are unnecessary
32
+ * for the task; the rest are shown at the next boundary as
33
+ * {@link recalledInsert} renders them, and a row is shown to a run once.
34
+ *
35
+ * It is a supervisor and not a brake: nothing here ends a run, refuses a
36
+ * completion, or decides anything on the cell loop's hot path. `CellTurn`
37
+ * offers each frame's snapshot to a one-slot sliding queue and continues; a
38
+ * forked fiber takes the newest snapshot, asks, journals what came back, and
39
+ * hands the monitors' values and any recalled rows to the *next* turn boundary,
40
+ * which decides there what the run is told. A reading that arrives after the boundary it was for is
41
+ * journaled and never delivered, and a snapshot the fiber never reached is
42
+ * dropped: the run is never told something about a frame two frames gone.
43
+ *
44
+ * It never falls back. A snapshot Jev could not read is journaled as
45
+ * {@link AgentEvent.SupervisorUnjudged} with the transport's own reason; it
46
+ * nudges nothing, and is never counted as a reading that
47
+ * found the run calm or on target. A host with no judge (`unconfigured`) is
48
+ * journaled once per streak rather than every frame; each reading still asks,
49
+ * so a judge connected mid-run is used at once. Nothing here is a default value: every
50
+ * level and every word on the settled event came back from the transport.
51
+ *
52
+ * What a reading says is delivered wherever the host holds a real judge
53
+ * (`CellTurn.Input.judged`), and only through a monitor that crossed and
54
+ * passed its gates; the text of the legacy nudge is {@link nudge}, which the
55
+ * `supervisor` lint monitor says. The offline replay of archived journals
56
+ * (`evals/swebench/lib/jev-replay.mjs`, which scores {@link triggers} itself
57
+ * rather than a copy of it) measures their precision. The verdict is
58
+ * journaled whenever an `Evaluator` is bound. The supervisor writes no
59
+ * memory: a run's transcript is mined once, at run end, by `@smthrs/agent`'s
60
+ * `MemoryMine`.
61
+ *
62
+ * @since 1.0.0-rc.0
63
+ */
64
+ import * as Classifier from "@smthrs/model/Classifier";
65
+ import * as Context from "effect/Context";
66
+ import * as Effect from "effect/Effect";
67
+ import * as Schema from "effect/Schema";
68
+ import * as elide from "./internal/elide.js";
69
+ import { NonNegativeSafeInt } from "./internal/nonNegativeSafeInt.js";
70
+ import { untrustedData } from "./internal/untrustedData.js";
71
+ import * as Judgement from "./Judgement.js";
72
+ /**
73
+ * The most of one frame's cell, prose or prints the snapshot carries, in
74
+ * UTF-8 bytes. The head of a cell and the tail of its prints: a cell states
75
+ * its plan first and a runner states its verdict last.
76
+ *
77
+ * @category constants
78
+ * @since 1.0.0-rc.0
79
+ */
80
+ export const frameBytes = 1024;
81
+ /**
82
+ * How many of the newest frames a snapshot carries.
83
+ *
84
+ * @category constants
85
+ * @since 1.0.0-rc.0
86
+ */
87
+ export const recentFrames = 3;
88
+ /**
89
+ * The most rows one reading recalls from {@link Memory}.
90
+ *
91
+ * @category constants
92
+ * @since 1.0.0-rc.0
93
+ */
94
+ export const recalledLimit = 6;
95
+ /**
96
+ * How long a run that ends with a reading in flight waits for it to settle
97
+ * and journal, in milliseconds. A reading still unanswered then is interrupted
98
+ * and journaled `supervisor-unjudged` with reason `interrupted`; the run never
99
+ * waits longer than this for its supervisor.
100
+ *
101
+ * @category constants
102
+ * @since 1.0.0-rc.0
103
+ */
104
+ export const closeGraceMs = 1_500;
105
+ /**
106
+ * At or above this probability of `thrashing`, the reading crosses.
107
+ *
108
+ * @category constants
109
+ * @since 1.0.0-rc.0
110
+ */
111
+ export const thrashingAt = 0.5;
112
+ /**
113
+ * At or below this probability of `on_target`, the reading crosses.
114
+ *
115
+ * @category constants
116
+ * @since 1.0.0-rc.0
117
+ */
118
+ export const offTargetAt = 0.5;
119
+ /**
120
+ * At or above this probability of `suspect`, the reading crosses.
121
+ *
122
+ * @category constants
123
+ * @since 1.0.0-rc.0
124
+ */
125
+ export const suspectAt = 0.5;
126
+ /**
127
+ * At or above this probability of `outdated_context` or
128
+ * `irrelevant_context`, a judged run compacts at its next frame.
129
+ *
130
+ * @category constants
131
+ * @since 1.0.0-rc.0
132
+ */
133
+ export const contextAt = 0.5;
134
+ /**
135
+ * The three rungs every operational-state question is scored on.
136
+ *
137
+ * @category schemas
138
+ * @since 1.0.0-rc.0
139
+ */
140
+ export const Level = Schema.Literals(["none", "mild", "strong"]);
141
+ /**
142
+ * The rungs as the score question declares them, in order.
143
+ *
144
+ * @category constants
145
+ * @since 1.0.0-rc.0
146
+ */
147
+ export const levels = ["none", "mild", "strong"];
148
+ /**
149
+ * The one word a person is shown about a run.
150
+ *
151
+ * @category schemas
152
+ * @since 1.0.0-rc.0
153
+ */
154
+ export const Help = Schema.Literals(["none", "clarification", "permission", "stuck", "risky_action"]);
155
+ /**
156
+ * The five operational states, in the order they are asked and journaled.
157
+ *
158
+ * @category constants
159
+ * @since 1.0.0-rc.0
160
+ */
161
+ export const emotions = ["frustrated", "anxious", "scared", "confused", "confident"];
162
+ /**
163
+ * One recent frame as the snapshot carries it: the cell the model wrote, the
164
+ * prose around it, what the cell printed, and how it ended.
165
+ *
166
+ * @category schemas
167
+ * @since 1.0.0-rc.0
168
+ */
169
+ export const Frame = Schema.Struct({
170
+ frame: NonNegativeSafeInt,
171
+ cell: Schema.String.annotate({ description: "The cell the model wrote, head kept" }),
172
+ prose: Schema.String.annotate({ description: "What the model wrote outside the cell, head kept" }),
173
+ printed: Schema.String.annotate({ description: "What the cell printed, newest bytes kept" }),
174
+ transition: Schema.Literals(["continue", "complete", "park", "raised", "rejected"]),
175
+ mutated: Schema.Boolean.annotate({ description: "Whether this frame changed the workspace" })
176
+ });
177
+ /**
178
+ * The counts the deterministic controls keep, handed over as they stand.
179
+ *
180
+ * Every field is read off `CellTurn.State` or the frame's accounting and none
181
+ * is re-derived here: the supervisor is a reader of the harness's evidence,
182
+ * not a second measurer of it.
183
+ *
184
+ * @category schemas
185
+ * @since 1.0.0-rc.0
186
+ */
187
+ export const Signals = Schema.Struct({
188
+ frame: NonNegativeSafeInt.annotate({ description: "The frame just closed, counting from zero" }),
189
+ maxFrames: NonNegativeSafeInt.annotate({ description: "The frame budget; zero is unbounded" }),
190
+ readOnlyFrames: NonNegativeSafeInt.annotate({ description: "Consecutive frames that changed nothing" }),
191
+ repeatFrames: NonNegativeSafeInt.annotate({
192
+ description: "Consecutive frames that issued only calls already issued and changed nothing"
193
+ }),
194
+ mutations: NonNegativeSafeInt.annotate({ description: "Frames that changed the workspace" }),
195
+ remoteMutations: NonNegativeSafeInt.annotate({ description: "Writes recorded on trees the host cannot see" }),
196
+ treeMoved: Schema.Boolean.annotate({ description: "Whether the workspace differs from the tree the run opened on" }),
197
+ paths: NonNegativeSafeInt.annotate({
198
+ description: "Paths the closing workspace measurement covered; zero unmeasured"
199
+ }),
200
+ checksRun: NonNegativeSafeInt.annotate({ description: "Distinct checks the run has run" }),
201
+ checksFailing: NonNegativeSafeInt.annotate({ description: "Of those, how many last reported a failing status" }),
202
+ failuresUnanswered: NonNegativeSafeInt.annotate({
203
+ description: "Failing checks no later passing check has answered"
204
+ }),
205
+ callsFailed: NonNegativeSafeInt.annotate({ description: "Settled calls in the ledger that failed" }),
206
+ callsSettled: NonNegativeSafeInt.annotate({ description: "Settled calls in the ledger" }),
207
+ narrowingDemands: NonNegativeSafeInt.annotate({ description: "Completions bounced for narrowed evidence" }),
208
+ unmovedDemands: NonNegativeSafeInt.annotate({ description: "Completions bounced for an unmoved tree" }),
209
+ unresolvedDemands: NonNegativeSafeInt.annotate({ description: "Completions bounced for a stepped-around failure" }),
210
+ claimDemands: NonNegativeSafeInt.annotate({ description: "Completions bounced for an unsupported claim" }),
211
+ sufficiencyStated: Schema.Boolean.annotate({ description: "Whether the run was told its evidence is complete" })
212
+ });
213
+ /**
214
+ * One row recalled from memory.
215
+ *
216
+ * @category schemas
217
+ * @since 1.0.0-rc.0
218
+ */
219
+ export const Recalled = Schema.Struct({
220
+ key: Schema.String,
221
+ text: Schema.String
222
+ });
223
+ /**
224
+ * The most skills one snapshot offers.
225
+ *
226
+ * @category constants
227
+ * @since 1.0.0-rc.0
228
+ */
229
+ export const skillLimit = 12;
230
+ /**
231
+ * The most of one skill's description a snapshot carries, in UTF-8 bytes.
232
+ *
233
+ * @category constants
234
+ * @since 1.0.0-rc.0
235
+ */
236
+ export const skillBytes = 256;
237
+ /**
238
+ * The most distinct flow names {@link Snapshot} `called` carries.
239
+ *
240
+ * @category constants
241
+ * @since 1.0.0-rc.0
242
+ */
243
+ export const calledLimit = 64;
244
+ /**
245
+ * One skill the run could read and has neither called nor read.
246
+ *
247
+ * @category schemas
248
+ * @since 1.0.0-rc.0
249
+ */
250
+ export const Skill = Schema.Struct({
251
+ name: Schema.String,
252
+ description: Schema.String.annotate({ description: "The description's head, wrapped as untrusted data" }),
253
+ path: Schema.String.annotate({ description: "Where the skill's Markdown body is" })
254
+ });
255
+ /**
256
+ * One skill as a snapshot offers it: its description's head within
257
+ * {@link skillBytes}, wrapped as untrusted data.
258
+ *
259
+ * @category constructors
260
+ * @since 1.0.0-rc.0
261
+ */
262
+ export const skill = (name, description, path) => ({
263
+ name,
264
+ description: untrustedData(elide.head(description, skillBytes, "clipped"), `description of skill ${name}`),
265
+ path
266
+ });
267
+ /**
268
+ * Everything one supervisor reading is a reading of.
269
+ *
270
+ * @category schemas
271
+ * @since 1.0.0-rc.0
272
+ */
273
+ export const Snapshot = Schema.Struct({
274
+ task: Schema.String.annotate({ description: "The task, as the person stated it" }),
275
+ frames: Schema.Array(Frame).annotate({ description: "The newest frames, oldest first" }),
276
+ signals: Signals,
277
+ skills: Schema.Array(Skill).annotate({
278
+ description: "Skills the run could read and has neither called nor read, by index"
279
+ }),
280
+ called: Schema.Array(Schema.String).annotate({ description: "Distinct flows the run has called" }),
281
+ jevAvailable: Schema.Boolean.annotate({ description: "Whether the run can call the jev flow" })
282
+ });
283
+ /**
284
+ * The fixed questions, asked of every snapshot.
285
+ *
286
+ * Each criterion names the evidence it reads, so a reading is answerable from
287
+ * the snapshot and never from what the transport imagines the repository holds.
288
+ */
289
+ const fixedQuestions = {
290
+ thrashing: Classifier.boolean({
291
+ instructions: "Is the run going in circles rather than converging? Compare the newest frames with each other and with signals.checksFailing, signals.failuresUnanswered, signals.readOnlyFrames and signals.repeatFrames. Any one sign below is enough.",
292
+ criteria: {
293
+ true: "a check fails again after an edit meant to fix it, an edit is redone or reverted, or the newest frames re-read or re-run what earlier frames already saw without learning anything new",
294
+ false: "the newest frames learn something new or make progress: a failing check now passes, or a new cause is found and acted on"
295
+ }
296
+ }),
297
+ on_target: Classifier.boolean({
298
+ instructions: "Is the run still working on the task as stated? Read the task and the newest frames' cells and prose.",
299
+ criteria: {
300
+ true: "the newest frames read, edit or check the thing the task names",
301
+ false: "the newest frames work on something the task does not ask for, or have drifted from it"
302
+ }
303
+ }),
304
+ suspect: Classifier.boolean({
305
+ instructions: "Is the run's evidence suspect? Read the newest frames for tests edited to pass, edits to a file the task does not concern, or prose claiming a result no printed output shows.",
306
+ criteria: {
307
+ true: "a test was changed rather than the code under test, the wrong file was edited, or a claim has no check behind it",
308
+ false: "edits are to the code the task names and every claim has a printed result behind it"
309
+ }
310
+ }),
311
+ outdated_context: Classifier.boolean({
312
+ instructions: "Do the newest frames show earlier context that is now factually wrong or stale? Judge only evidence visible in the task and frames; do not assume unseen history is outdated.",
313
+ criteria: {
314
+ true: "a later observation explicitly contradicts an earlier assumption or file state in the visible frames",
315
+ false: "no visible contradiction, or the earlier context is still accurate"
316
+ }
317
+ }),
318
+ irrelevant_context: Classifier.boolean({
319
+ instructions: "Do the newest frames show earlier context that is accurate but no longer useful for the task? Do not treat the task, a reusable PRD, or decisions still needed as irrelevant.",
320
+ criteria: {
321
+ true: "the visible frames explicitly move away from earlier work that will not be needed again",
322
+ false: "the earlier work may still be needed, or the visible frames do not establish irrelevance"
323
+ }
324
+ }),
325
+ frustrated: Classifier.score({
326
+ instructions: "How frustrated is the run: the same check failing repeatedly, edits reverted, attempts not converging? Read signals.checksFailing, signals.failuresUnanswered, signals.repeatFrames, signals.readOnlyFrames and the newest frames.",
327
+ criteria: levels
328
+ }),
329
+ anxious: Classifier.score({
330
+ instructions: "How anxious is the run: its own prose hedges or expresses uncertainty while the evidence is thin? Read the frames' prose against signals.checksRun and signals.callsSettled.",
331
+ criteria: levels
332
+ }),
333
+ scared: Classifier.score({
334
+ instructions: "How scared should a person be: is the run taking or considering a destructive, irreversible or out-of-scope action, or hitting permission or sandbox refusals? Read the newest frames' cells, prints and failed calls.",
335
+ criteria: levels
336
+ }),
337
+ confused: Classifier.score({
338
+ instructions: "How confused is the run: the task is ambiguous or contradicted by the repository, and the run keeps switching interpretations or files? Read the task against the newest frames.",
339
+ criteria: levels
340
+ }),
341
+ confident: Classifier.score({
342
+ instructions: "How confident should a person be that the work converges on the task: checks pass and each frame builds on the last? Read signals.checksRun, signals.checksFailing, signals.mutations and the newest frames.",
343
+ criteria: levels
344
+ }),
345
+ needs_help: Classifier.choice({
346
+ instructions: "What, if anything, does the run need from a person right now? Read the states above and the newest frames.",
347
+ criteria: {
348
+ none: "nothing; the run can carry on",
349
+ clarification: "the task is ambiguous or contradicted and a person must say which reading is meant",
350
+ permission: "the run is blocked on a permission or sandbox refusal a person can grant",
351
+ stuck: "the run is not converging and a person should intervene",
352
+ risky_action: "the run is about to do something destructive, irreversible or out of scope"
353
+ }
354
+ })
355
+ };
356
+ /**
357
+ * The prefix of every question a monitor adds to a reading; the rest of the
358
+ * id is the monitor's own.
359
+ *
360
+ * @category constants
361
+ * @since 1.0.0-rc.0
362
+ */
363
+ export const monitorPrefix = "monitor_";
364
+ const declare = (extra) => Classifier.make("supervisor/turn", {
365
+ description: "Read one running agent's newest frames and the counts its harness keeps: whether it is thrashing, on the task and honest; its operational state in five scored words; and what it needs from a person.",
366
+ state: Snapshot,
367
+ questions: { ...fixedQuestions, ...extra }
368
+ });
369
+ const cache = new Map();
370
+ /**
371
+ * The classifier for a snapshot with these monitor questions.
372
+ *
373
+ * The fixed questions are the same for every snapshot and the monitors' follow
374
+ * them, so a snapshot with no monitor questions asks the eleven fixed
375
+ * questions and no others. Declared once per set of monitor ids, and again
376
+ * when a monitor id asks a different question, because the digest is the
377
+ * canonical hash of the questions and the journal names it.
378
+ *
379
+ * @category classifiers
380
+ * @since 1.0.0-rc.0
381
+ */
382
+ export const classifierFor = (extra) => {
383
+ const ids = Object.keys(extra).sort();
384
+ const key = ids.join(",");
385
+ const held = cache.get(key);
386
+ if (held !== undefined && ids.every((id) => held.extra[id] === extra[id]))
387
+ return held.made;
388
+ const made = declare(extra);
389
+ cache.set(key, { extra, made });
390
+ return made;
391
+ };
392
+ /**
393
+ * The classifier over a bare snapshot: the eleven fixed questions and no
394
+ * monitor booleans. Its id is the id every shape shares.
395
+ *
396
+ * @category classifiers
397
+ * @since 1.0.0-rc.0
398
+ */
399
+ export const classifier = classifierFor({});
400
+ /**
401
+ * Asks Jev about one snapshot, and the monitor questions `extra` adds.
402
+ *
403
+ * Fails, typed, whenever an answer could not be obtained: no evaluator bound,
404
+ * a transport refusal, a deadline, an answer that does not decode. There is
405
+ * no reading of a snapshot Jev did not read.
406
+ *
407
+ * @category conversions
408
+ * @since 1.0.0-rc.0
409
+ */
410
+ export const read = (snapshot, extra) => Effect.gen(function* () {
411
+ const { answers, asked } = yield* Judgement.read(classifierFor(extra), snapshot);
412
+ const all = answers;
413
+ // Every declared question is answered or the decode above failed, and a
414
+ // monitor question is declared exactly for the ids read below.
415
+ const bool = (id) => all[id].probability;
416
+ return {
417
+ thrashing: answers.thrashing.probability,
418
+ onTarget: answers.on_target.probability,
419
+ suspect: answers.suspect.probability,
420
+ outdatedContext: answers.outdated_context.probability,
421
+ irrelevantContext: answers.irrelevant_context.probability,
422
+ emotions: {
423
+ frustrated: answers.frustrated.label,
424
+ anxious: answers.anxious.label,
425
+ scared: answers.scared.label,
426
+ confused: answers.confused.label,
427
+ confident: answers.confident.label
428
+ },
429
+ needsHelp: answers.needs_help.value,
430
+ monitors: Object.fromEntries(Object.keys(extra).map((id) => [id.slice(monitorPrefix.length), bool(id)])),
431
+ latencyMs: asked.latencyMs,
432
+ ...(asked.usage === undefined ? {} : { usage: asked.usage }),
433
+ asked: { digest: asked.digest, questions: asked.questions, state: asked.state, answers: asked.answers }
434
+ };
435
+ });
436
+ /**
437
+ * A memory with nothing behind it.
438
+ *
439
+ * @category constructors
440
+ * @since 1.0.0-rc.0
441
+ */
442
+ export const memoryNone = {
443
+ bound: false,
444
+ recall: () => Effect.succeed([]),
445
+ remember: () => Effect.void
446
+ };
447
+ /**
448
+ * The {@link Memory} reference, defaulting to {@link memoryNone}.
449
+ *
450
+ * @category services
451
+ * @since 1.0.0-rc.0
452
+ */
453
+ export const Memory = Context.Reference("@smthrs/harness/Supervisor/Memory", {
454
+ defaultValue: () => memoryNone
455
+ });
456
+ /**
457
+ * The five triggers a reading fires, by name, each with the inequality that
458
+ * fires it. The one rule: the `supervisor` lint monitor crosses on it,
459
+ * {@link nudge} names from it, {@link compacting} reads its context triggers,
460
+ * and the offline replay scores it, so they cannot drift apart.
461
+ *
462
+ * @category constants
463
+ * @since 1.0.0-rc.0
464
+ */
465
+ export const triggers = {
466
+ thrashing: (reading) => reading.thrashing >= thrashingAt,
467
+ off_target: (reading) => reading.onTarget <= offTargetAt,
468
+ suspect: (reading) => reading.suspect >= suspectAt,
469
+ outdated_context: (reading) => reading.outdatedContext >= contextAt,
470
+ irrelevant_context: (reading) => reading.irrelevantContext >= contextAt
471
+ };
472
+ /**
473
+ * The triggers one reading fires, in declaration order.
474
+ *
475
+ * @category conversions
476
+ * @since 1.0.0-rc.0
477
+ */
478
+ export const triggered = (reading) => Object.keys(triggers).filter((name) => triggers[name](reading));
479
+ /**
480
+ * The triggers that compact the run's context instead of nudging it.
481
+ *
482
+ * @category constants
483
+ * @since 1.0.0-rc.0
484
+ */
485
+ export const contextTriggers = ["outdated_context", "irrelevant_context"];
486
+ const isContext = (trigger) => contextTriggers.includes(trigger);
487
+ /**
488
+ * Whether one reading crosses: any trigger but a context one fires. A context
489
+ * trigger compacts the run's context at the next frame instead; see
490
+ * {@link compacting}.
491
+ *
492
+ * @category conversions
493
+ * @since 1.0.0-rc.0
494
+ */
495
+ export const crosses = (reading) => triggered(reading).some((trigger) => !isContext(trigger));
496
+ /**
497
+ * The context triggers one reading fires, in declaration order: why a judged
498
+ * run that is sent this reading compacts at its next frame.
499
+ *
500
+ * @category conversions
501
+ * @since 1.0.0-rc.0
502
+ */
503
+ export const compacting = (reading) => triggered(reading).filter(isContext);
504
+ /**
505
+ * The nudge a crossed reading puts in front of the run, naming its evidence.
506
+ *
507
+ * Concise on purpose, and built from counts rather than from the model's
508
+ * prose: what the run is told is what the harness measured, and the reading's
509
+ * probabilities say only which measurements to name.
510
+ *
511
+ * @category conversions
512
+ * @since 1.0.0-rc.0
513
+ */
514
+ export const nudge = (snapshot, reading) => {
515
+ const { signals } = snapshot;
516
+ const said = {
517
+ thrashing: `repeating itself (thrashing ${reading.thrashing.toFixed(2)})`,
518
+ off_target: `drifting from the task (on target ${reading.onTarget.toFixed(2)})`,
519
+ suspect: `standing on suspect evidence (suspect ${reading.suspect.toFixed(2)})`
520
+ };
521
+ const found = triggered(reading).flatMap((name) => isContext(name) ? [] : [said[name]]);
522
+ const evidence = [];
523
+ if (signals.checksFailing > 0) {
524
+ evidence.push(`${signals.checksFailing} check${signals.checksFailing === 1 ? "" : "s"} last reported failing`);
525
+ }
526
+ if (signals.failuresUnanswered > 0) {
527
+ evidence.push(`${signals.failuresUnanswered} failing check${signals.failuresUnanswered === 1 ? "" : "s"} never answered by a pass`);
528
+ }
529
+ if (signals.repeatFrames > 0)
530
+ evidence.push(`${signals.repeatFrames} consecutive frames repeated earlier calls`);
531
+ if (signals.readOnlyFrames > 0)
532
+ evidence.push(`${signals.readOnlyFrames} consecutive frames changed nothing`);
533
+ if (signals.callsFailed > 0)
534
+ evidence.push(`${signals.callsFailed} of ${signals.callsSettled} calls failed`);
535
+ evidence.push(`${signals.mutations} frame${signals.mutations === 1 ? "" : "s"} changed the workspace`);
536
+ // The counts are the ones the run held when frame N closed; by the time the
537
+ // run reads this it has written at least one frame more, so the frame is named.
538
+ return `Supervisor: a reading of this run's last ${snapshot.frames.length} frames, through frame ${signals.frame}, finds it ${found.join(", ")}. Evidence at frame ${signals.frame}: ${evidence.join("; ")}. Before the next call, state in one sentence which mechanism you now believe is wrong and which single call would show it; then make that call. Do not re-run a check over an unchanged tree, and do not edit a test to make it pass.`;
539
+ };
540
+ /**
541
+ * Renders one recalled row as the run reads it.
542
+ *
543
+ * @category conversions
544
+ * @since 1.0.0-rc.0
545
+ */
546
+ export const recalledInsert = (row) => `From memory of this repository (${row.key}):\n${row.text}`;
547
+ /**
548
+ * The head of a frame's cell or prose, bounded by {@link frameBytes}.
549
+ *
550
+ * @category conversions
551
+ * @since 1.0.0-rc.0
552
+ */
553
+ export const head = (text) => elide.head(text.trim(), frameBytes, "clipped");
554
+ /**
555
+ * The newest {@link frameBytes} of a frame's prints.
556
+ *
557
+ * @category conversions
558
+ * @since 1.0.0-rc.0
559
+ */
560
+ export const tail = (text) => {
561
+ const trimmed = text.trim();
562
+ const kept = elide.tailSlice(trimmed, frameBytes);
563
+ return kept.length === trimmed.length ? trimmed : `[… older bytes elided]\n${kept}`;
564
+ };
565
+ const fencedCell = /```(?:cell|typescript|ts|javascript|js)[^\n]*\n[\s\S]*?(?:```|$)/g;
566
+ /**
567
+ * What the model wrote around its cell: the reply with every fenced cell
568
+ * removed. The anxiety question reads it, and so does the run-end
569
+ * transcript miner.
570
+ *
571
+ * @category conversions
572
+ * @since 1.0.0-rc.0
573
+ */
574
+ export const prose = (text) => text.replace(fencedCell, "").trim();
575
+ //# sourceMappingURL=Supervisor.js.map