agency-lang 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (431) hide show
  1. package/dist/lib/agents/agency-agent/agent.agency +3 -2
  2. package/dist/lib/agents/judge.js +67 -70
  3. package/dist/lib/agents/policy/agent.agency +153 -53
  4. package/dist/lib/agents/policy/prompts/system.md +7 -0
  5. package/dist/lib/agents/review/agent.agency +2 -1
  6. package/dist/lib/agents/review/agent.js +394 -446
  7. package/dist/lib/backends/agencyGenerator.d.ts +45 -2
  8. package/dist/lib/backends/agencyGenerator.js +249 -62
  9. package/dist/lib/backends/agencyGenerator.test.js +106 -76
  10. package/dist/lib/backends/docstringInterpolationRuntime.test.js +59 -0
  11. package/dist/lib/backends/typescriptBuilder/assignmentEmitter.d.ts +64 -0
  12. package/dist/lib/backends/typescriptBuilder/assignmentEmitter.js +104 -0
  13. package/dist/lib/backends/typescriptBuilder/nameClassifier.d.ts +51 -0
  14. package/dist/lib/backends/typescriptBuilder/nameClassifier.js +130 -0
  15. package/dist/lib/backends/typescriptBuilder/namedArgsResolver.d.ts +28 -0
  16. package/dist/lib/backends/typescriptBuilder/namedArgsResolver.js +92 -0
  17. package/dist/lib/backends/typescriptBuilder/namedArgsResolver.test.d.ts +1 -0
  18. package/dist/lib/backends/typescriptBuilder/namedArgsResolver.test.js +75 -0
  19. package/dist/lib/backends/typescriptBuilder/pipeChainEmitter.d.ts +94 -0
  20. package/dist/lib/backends/typescriptBuilder/pipeChainEmitter.js +227 -0
  21. package/dist/lib/backends/typescriptBuilder/pipeReceiverCodegen.test.d.ts +1 -0
  22. package/dist/lib/backends/typescriptBuilder/pipeReceiverCodegen.test.js +58 -0
  23. package/dist/lib/backends/typescriptBuilder/scopeManager.d.ts +62 -0
  24. package/dist/lib/backends/typescriptBuilder/scopeManager.js +131 -0
  25. package/dist/lib/backends/typescriptBuilder/sectionAssembler.d.ts +108 -0
  26. package/dist/lib/backends/typescriptBuilder/sectionAssembler.js +249 -0
  27. package/dist/lib/backends/typescriptBuilder/stepPathTracker.d.ts +45 -0
  28. package/dist/lib/backends/typescriptBuilder/stepPathTracker.js +76 -0
  29. package/dist/lib/backends/typescriptBuilder.d.ts +37 -114
  30. package/dist/lib/backends/typescriptBuilder.integration.test.js +0 -26
  31. package/dist/lib/backends/typescriptBuilder.js +603 -974
  32. package/dist/lib/backends/typescriptGenerator/jsonSchemaAnnotation.test.d.ts +1 -0
  33. package/dist/lib/backends/typescriptGenerator/jsonSchemaAnnotation.test.js +104 -0
  34. package/dist/lib/backends/typescriptGenerator/tagArgToTs.d.ts +19 -0
  35. package/dist/lib/backends/typescriptGenerator/tagArgToTs.js +171 -0
  36. package/dist/lib/backends/typescriptGenerator/tagArgToTs.test.d.ts +1 -0
  37. package/dist/lib/backends/typescriptGenerator/tagArgToTs.test.js +44 -0
  38. package/dist/lib/backends/typescriptGenerator/typeToString.js +96 -1
  39. package/dist/lib/backends/typescriptGenerator/typeToString.test.d.ts +1 -0
  40. package/dist/lib/backends/typescriptGenerator/typeToString.test.js +52 -0
  41. package/dist/lib/backends/typescriptGenerator/typeToZodSchema.d.ts +12 -3
  42. package/dist/lib/backends/typescriptGenerator/typeToZodSchema.js +105 -9
  43. package/dist/lib/backends/typescriptGenerator/typeToZodSchema.test.js +122 -1
  44. package/dist/lib/backends/typescriptGenerator/validationDescriptor.d.ts +31 -0
  45. package/dist/lib/backends/typescriptGenerator/validationDescriptor.js +257 -0
  46. package/dist/lib/cli/commands.js +9 -4
  47. package/dist/lib/cli/debug.js +2 -0
  48. package/dist/lib/cli/doc.js +74 -3
  49. package/dist/lib/cli/doc.test.js +39 -0
  50. package/dist/lib/cli/evaluate.js +3 -3
  51. package/dist/lib/cli/optimize.js +23 -2
  52. package/dist/lib/cli/optimize.test.js +6 -1
  53. package/dist/lib/cli/schedule/index.js +1 -0
  54. package/dist/lib/cli/serve.js +1 -0
  55. package/dist/lib/cli/test.js +19 -6
  56. package/dist/lib/cli/util.d.ts +2 -1
  57. package/dist/lib/cli/util.js +14 -6
  58. package/dist/lib/compilationUnit.d.ts +6 -7
  59. package/dist/lib/compilationUnit.js +35 -16
  60. package/dist/lib/compilationUnit.test.js +3 -35
  61. package/dist/lib/compiler/compile.d.ts +9 -6
  62. package/dist/lib/compiler/compile.js +36 -42
  63. package/dist/lib/compiler/compile.test.js +71 -21
  64. package/dist/lib/compiler/typecheck.d.ts +18 -0
  65. package/dist/lib/compiler/typecheck.js +79 -0
  66. package/dist/lib/config.js +1 -1
  67. package/dist/lib/debugger/debuggerState.js +0 -3
  68. package/dist/lib/debugger/driver.js +12 -3
  69. package/dist/lib/debugger/testHelpers.js +1 -0
  70. package/dist/lib/debugger/uiState.js +1 -0
  71. package/dist/lib/formatter.test.js +8 -0
  72. package/dist/lib/importPaths.d.ts +33 -0
  73. package/dist/lib/importPaths.js +37 -0
  74. package/dist/lib/importPaths.test.js +70 -0
  75. package/dist/lib/ir/builders.d.ts +115 -15
  76. package/dist/lib/ir/builders.js +166 -54
  77. package/dist/lib/ir/prettyPrint.js +43 -5
  78. package/dist/lib/ir/prettyPrint.test.js +35 -1
  79. package/dist/lib/ir/tsIR.d.ts +25 -1
  80. package/dist/lib/logsViewer/render.d.ts +2 -1
  81. package/dist/lib/logsViewer/render.js +57 -13
  82. package/dist/lib/logsViewer/render.test.js +63 -1
  83. package/dist/lib/logsViewer/run.js +5 -1
  84. package/dist/lib/logsViewer/search.d.ts +1 -1
  85. package/dist/lib/logsViewer/search.js +9 -5
  86. package/dist/lib/logsViewer/search.test.js +1 -1
  87. package/dist/lib/logsViewer/summary.js +1 -1
  88. package/dist/lib/logsViewer/types.d.ts +1 -0
  89. package/dist/lib/lowering/patternLowering.js +27 -1
  90. package/dist/lib/lowering/patternLowering.test.js +165 -0
  91. package/dist/lib/lsp/builtinHover.d.ts +5 -1
  92. package/dist/lib/lsp/builtinHover.js +41 -2
  93. package/dist/lib/lsp/completion.js +10 -6
  94. package/dist/lib/lsp/diagnostics.js +2 -2
  95. package/dist/lib/lsp/documentSymbol.js +0 -8
  96. package/dist/lib/lsp/foldingRange.js +0 -1
  97. package/dist/lib/lsp/semantics.js +1 -14
  98. package/dist/lib/lsp/server.js +1 -0
  99. package/dist/lib/lsp/workspaceSymbol.js +0 -1
  100. package/dist/lib/parser.js +2 -2
  101. package/dist/lib/parsers/function.test.js +175 -140
  102. package/dist/lib/parsers/objectTypeTags.test.d.ts +1 -0
  103. package/dist/lib/parsers/objectTypeTags.test.js +69 -0
  104. package/dist/lib/parsers/parsers.d.ts +50 -7
  105. package/dist/lib/parsers/parsers.js +302 -121
  106. package/dist/lib/parsers/pattern.test.js +146 -0
  107. package/dist/lib/parsers/tag.test.js +141 -13
  108. package/dist/lib/parsers/tagIntegration.test.js +11 -8
  109. package/dist/lib/parsers/typeHints.test.js +330 -1
  110. package/dist/lib/preprocessors/importResolver.js +10 -2
  111. package/dist/lib/preprocessors/injectSchemaArgs.d.ts +36 -0
  112. package/dist/lib/preprocessors/injectSchemaArgs.js +209 -0
  113. package/dist/lib/preprocessors/injectSchemaArgs.test.d.ts +1 -0
  114. package/dist/lib/preprocessors/injectSchemaArgs.test.js +383 -0
  115. package/dist/lib/preprocessors/liftCallbacks.d.ts +2 -0
  116. package/dist/lib/preprocessors/liftCallbacks.js +242 -0
  117. package/dist/lib/preprocessors/liftCallbacks.test.d.ts +1 -0
  118. package/dist/lib/preprocessors/liftCallbacks.test.js +146 -0
  119. package/dist/lib/preprocessors/parallelDesugar.js +4 -5
  120. package/dist/lib/preprocessors/resolveReExports.js +1 -3
  121. package/dist/lib/preprocessors/typeAliasTags.test.d.ts +1 -0
  122. package/dist/lib/preprocessors/typeAliasTags.test.js +57 -0
  123. package/dist/lib/preprocessors/typescriptPreprocessor.core.test.js +3 -3
  124. package/dist/lib/preprocessors/typescriptPreprocessor.d.ts +9 -1
  125. package/dist/lib/preprocessors/typescriptPreprocessor.js +66 -30
  126. package/dist/lib/runtime/__tests__/node.test.js +8 -3
  127. package/dist/lib/runtime/__tests__/testHelpers.js +31 -0
  128. package/dist/lib/runtime/agency.d.ts +49 -0
  129. package/dist/lib/runtime/agency.js +204 -0
  130. package/dist/lib/runtime/agency.test.d.ts +1 -0
  131. package/dist/lib/runtime/agency.test.js +277 -0
  132. package/dist/lib/runtime/agencyFunction.d.ts +15 -3
  133. package/dist/lib/runtime/agencyFunction.js +37 -24
  134. package/dist/lib/runtime/agencyFunction.test.js +76 -12
  135. package/dist/lib/runtime/agencyInterrupt.d.ts +18 -0
  136. package/dist/lib/runtime/agencyInterrupt.js +159 -0
  137. package/dist/lib/runtime/agencyInterrupt.test.d.ts +1 -0
  138. package/dist/lib/runtime/agencyInterrupt.test.js +231 -0
  139. package/dist/lib/runtime/agencyLlm.checkpointInfo.test.d.ts +1 -0
  140. package/dist/lib/runtime/agencyLlm.checkpointInfo.test.js +63 -0
  141. package/dist/lib/runtime/agencyLlm.d.ts +59 -0
  142. package/dist/lib/runtime/agencyLlm.js +20 -0
  143. package/dist/lib/runtime/agencyLlm.test.d.ts +1 -0
  144. package/dist/lib/runtime/agencyLlm.test.js +199 -0
  145. package/dist/lib/runtime/asyncContext.d.ts +208 -0
  146. package/dist/lib/runtime/asyncContext.js +196 -0
  147. package/dist/lib/runtime/asyncContext.test.d.ts +1 -0
  148. package/dist/lib/runtime/asyncContext.test.js +221 -0
  149. package/dist/lib/runtime/call.d.ts +15 -2
  150. package/dist/lib/runtime/call.js +17 -4
  151. package/dist/lib/runtime/call.test.js +20 -7
  152. package/dist/lib/runtime/checkpoint.d.ts +11 -4
  153. package/dist/lib/runtime/checkpoint.js +19 -11
  154. package/dist/lib/runtime/checkpoint.test.js +54 -39
  155. package/dist/lib/runtime/debugger.d.ts +1 -2
  156. package/dist/lib/runtime/debugger.js +1 -1
  157. package/dist/lib/runtime/debugger.test.js +13 -16
  158. package/dist/lib/runtime/deterministicClient.d.ts +9 -1
  159. package/dist/lib/runtime/deterministicClient.js +19 -5
  160. package/dist/lib/runtime/deterministicClient.test.js +10 -2
  161. package/dist/lib/runtime/guard.d.ts +243 -0
  162. package/dist/lib/runtime/guard.js +314 -0
  163. package/dist/lib/runtime/guard.test.d.ts +1 -0
  164. package/dist/lib/runtime/guard.test.js +289 -0
  165. package/dist/lib/runtime/haltSignal.d.ts +21 -0
  166. package/dist/lib/runtime/haltSignal.js +24 -0
  167. package/dist/lib/runtime/hooks.d.ts +49 -4
  168. package/dist/lib/runtime/hooks.js +148 -35
  169. package/dist/lib/runtime/hooks.test.d.ts +1 -0
  170. package/dist/lib/runtime/hooks.test.js +143 -0
  171. package/dist/lib/runtime/index.d.ts +18 -1
  172. package/dist/lib/runtime/index.js +12 -0
  173. package/dist/lib/runtime/interrupts.d.ts +2 -1
  174. package/dist/lib/runtime/interrupts.js +34 -6
  175. package/dist/lib/runtime/ipc.d.ts +1 -2
  176. package/dist/lib/runtime/ipc.js +6 -3
  177. package/dist/lib/runtime/memory/manager.js +51 -0
  178. package/dist/lib/runtime/memory/manager.test.js +173 -0
  179. package/dist/lib/runtime/node.d.ts +5 -5
  180. package/dist/lib/runtime/node.js +92 -36
  181. package/dist/lib/runtime/policy.d.ts +19 -5
  182. package/dist/lib/runtime/policy.js +9 -12
  183. package/dist/lib/runtime/prompt.d.ts +8 -5
  184. package/dist/lib/runtime/prompt.js +436 -309
  185. package/dist/lib/runtime/promptRunner.d.ts +128 -0
  186. package/dist/lib/runtime/promptRunner.js +222 -0
  187. package/dist/lib/runtime/promptRunner.test.d.ts +1 -0
  188. package/dist/lib/runtime/promptRunner.test.js +398 -0
  189. package/dist/lib/runtime/result.js +36 -0
  190. package/dist/lib/runtime/resumableScope.d.ts +45 -0
  191. package/dist/lib/runtime/resumableScope.js +124 -0
  192. package/dist/lib/runtime/resumableScope.test.d.ts +1 -0
  193. package/dist/lib/runtime/resumableScope.test.js +239 -0
  194. package/dist/lib/runtime/rewind.d.ts +2 -0
  195. package/dist/lib/runtime/rewind.js +21 -3
  196. package/dist/lib/runtime/runBatch.d.ts +93 -0
  197. package/dist/lib/runtime/runBatch.js +443 -0
  198. package/dist/lib/runtime/runBatch.test.d.ts +1 -0
  199. package/dist/lib/runtime/runBatch.test.js +574 -0
  200. package/dist/lib/runtime/runner.d.ts +106 -21
  201. package/dist/lib/runtime/runner.js +361 -304
  202. package/dist/lib/runtime/runner.test.js +120 -5
  203. package/dist/lib/runtime/schema.d.ts +8 -0
  204. package/dist/lib/runtime/schema.js +11 -0
  205. package/dist/lib/runtime/state/bootstrapThreadStore.d.ts +38 -0
  206. package/dist/lib/runtime/state/bootstrapThreadStore.js +72 -0
  207. package/dist/lib/runtime/state/bootstrapThreadStore.test.d.ts +1 -0
  208. package/dist/lib/runtime/state/bootstrapThreadStore.test.js +34 -0
  209. package/dist/lib/runtime/state/context.d.ts +7 -10
  210. package/dist/lib/runtime/state/context.js +16 -36
  211. package/dist/lib/runtime/state/stateStack.d.ts +93 -0
  212. package/dist/lib/runtime/state/stateStack.js +219 -0
  213. package/dist/lib/runtime/state/stateStack.test.js +386 -0
  214. package/dist/lib/runtime/subprocess-bootstrap.js +8 -0
  215. package/dist/lib/runtime/types.d.ts +1 -9
  216. package/dist/lib/runtime/validateChain.d.ts +71 -0
  217. package/dist/lib/runtime/validateChain.js +138 -0
  218. package/dist/lib/runtime/validateChain.test.d.ts +1 -0
  219. package/dist/lib/runtime/validateChain.test.js +131 -0
  220. package/dist/lib/simplemachine/graph.js +1 -1
  221. package/dist/lib/simplemachine/util.d.ts +1 -1
  222. package/dist/lib/stdlib/abortable.d.ts +58 -0
  223. package/dist/lib/stdlib/abortable.js +175 -0
  224. package/dist/lib/stdlib/agency.d.ts +44 -0
  225. package/dist/lib/stdlib/agency.js +218 -12
  226. package/dist/lib/stdlib/assertContained.d.ts +24 -0
  227. package/dist/lib/stdlib/assertContained.js +110 -0
  228. package/dist/lib/stdlib/browserUse.d.ts +7 -0
  229. package/dist/lib/stdlib/browserUse.js +58 -27
  230. package/dist/lib/stdlib/builtins.d.ts +16 -2
  231. package/dist/lib/stdlib/builtins.js +75 -8
  232. package/dist/lib/stdlib/fs.d.ts +2 -2
  233. package/dist/lib/stdlib/fs.js +14 -26
  234. package/dist/lib/stdlib/http.d.ts +32 -1
  235. package/dist/lib/stdlib/http.js +105 -23
  236. package/dist/lib/stdlib/memory.d.ts +27 -13
  237. package/dist/lib/stdlib/memory.js +71 -13
  238. package/dist/lib/stdlib/oauth.d.ts +37 -0
  239. package/dist/lib/stdlib/oauth.js +113 -34
  240. package/dist/lib/stdlib/policy.d.ts +2 -1
  241. package/dist/lib/stdlib/policy.js +7 -2
  242. package/dist/lib/stdlib/resolvePath.d.ts +11 -0
  243. package/dist/lib/stdlib/resolvePath.js +13 -2
  244. package/dist/lib/stdlib/shell.d.ts +47 -16
  245. package/dist/lib/stdlib/shell.js +62 -58
  246. package/dist/lib/stdlib/skills.d.ts +9 -0
  247. package/dist/lib/stdlib/skills.js +16 -0
  248. package/dist/lib/stdlib/speech.d.ts +18 -3
  249. package/dist/lib/stdlib/speech.js +102 -22
  250. package/dist/lib/stdlib/system.d.ts +19 -5
  251. package/dist/lib/stdlib/system.js +51 -12
  252. package/dist/lib/stdlib/thread.d.ts +45 -0
  253. package/dist/lib/stdlib/thread.js +120 -0
  254. package/dist/lib/stdlib/ui.d.ts +7 -0
  255. package/dist/lib/stdlib/ui.js +45 -6
  256. package/dist/lib/stdlib/validators.d.ts +12 -0
  257. package/dist/lib/stdlib/validators.js +77 -0
  258. package/dist/lib/symbolTable.d.ts +24 -8
  259. package/dist/lib/symbolTable.js +43 -25
  260. package/dist/lib/symbolTable.test.js +53 -0
  261. package/dist/lib/templates/backends/agency/template.d.ts +1 -1
  262. package/dist/lib/templates/backends/agency/template.js +1 -1
  263. package/dist/lib/templates/backends/typescriptGenerator/blockSetup.d.ts +1 -1
  264. package/dist/lib/templates/backends/typescriptGenerator/blockSetup.js +1 -1
  265. package/dist/lib/templates/backends/typescriptGenerator/builtinFunctions/system.d.ts +1 -1
  266. package/dist/lib/templates/backends/typescriptGenerator/builtinFunctions/system.js +4 -2
  267. package/dist/lib/templates/backends/typescriptGenerator/debugger.d.ts +1 -1
  268. package/dist/lib/templates/backends/typescriptGenerator/debugger.js +2 -2
  269. package/dist/lib/templates/backends/typescriptGenerator/forkBlockSetup.d.ts +1 -1
  270. package/dist/lib/templates/backends/typescriptGenerator/forkBlockSetup.js +10 -2
  271. package/dist/lib/templates/backends/typescriptGenerator/functionCatchFailure.d.ts +1 -1
  272. package/dist/lib/templates/backends/typescriptGenerator/functionCatchFailure.js +9 -1
  273. package/dist/lib/templates/backends/typescriptGenerator/imports.d.ts +1 -2
  274. package/dist/lib/templates/backends/typescriptGenerator/imports.js +6 -14
  275. package/dist/lib/templates/backends/typescriptGenerator/interruptAssignment.d.ts +1 -1
  276. package/dist/lib/templates/backends/typescriptGenerator/interruptAssignment.js +9 -9
  277. package/dist/lib/templates/backends/typescriptGenerator/interruptReturn.d.ts +1 -1
  278. package/dist/lib/templates/backends/typescriptGenerator/interruptReturn.js +9 -9
  279. package/dist/lib/templates/backends/typescriptGenerator/resultCheckpointSetup.d.ts +1 -1
  280. package/dist/lib/templates/backends/typescriptGenerator/resultCheckpointSetup.js +1 -1
  281. package/dist/lib/tui/styleParser.js +1 -0
  282. package/dist/lib/typeChecker/assignability.d.ts +46 -3
  283. package/dist/lib/typeChecker/assignability.js +313 -8
  284. package/dist/lib/typeChecker/builtins.js +83 -26
  285. package/dist/lib/typeChecker/callbackBodyInterrupts.test.d.ts +1 -0
  286. package/dist/lib/typeChecker/callbackBodyInterrupts.test.js +168 -0
  287. package/dist/lib/typeChecker/checker.js +25 -18
  288. package/dist/lib/typeChecker/docstringParamInterpolation.test.d.ts +1 -0
  289. package/dist/lib/typeChecker/docstringParamInterpolation.test.js +70 -0
  290. package/dist/lib/typeChecker/genericAliasDeclaration.test.d.ts +1 -0
  291. package/dist/lib/typeChecker/genericAliasDeclaration.test.js +71 -0
  292. package/dist/lib/typeChecker/genericValidation.test.d.ts +1 -0
  293. package/dist/lib/typeChecker/genericValidation.test.js +212 -0
  294. package/dist/lib/typeChecker/index.js +58 -4
  295. package/dist/lib/typeChecker/interruptAnalysis.d.ts +14 -0
  296. package/dist/lib/typeChecker/interruptAnalysis.js +74 -0
  297. package/dist/lib/typeChecker/jsGlobalsSig.test.js +0 -4
  298. package/dist/lib/typeChecker/jsonSchemaArgValidator.d.ts +60 -0
  299. package/dist/lib/typeChecker/jsonSchemaArgValidator.js +266 -0
  300. package/dist/lib/typeChecker/jsonSchemaArgValidator.test.d.ts +1 -0
  301. package/dist/lib/typeChecker/jsonSchemaArgValidator.test.js +179 -0
  302. package/dist/lib/typeChecker/mergeTags.d.ts +28 -0
  303. package/dist/lib/typeChecker/mergeTags.js +182 -0
  304. package/dist/lib/typeChecker/mergeTags.test.d.ts +1 -0
  305. package/dist/lib/typeChecker/mergeTags.test.js +144 -0
  306. package/dist/lib/typeChecker/namedArgStructure.test.d.ts +1 -0
  307. package/dist/lib/typeChecker/namedArgStructure.test.js +66 -0
  308. package/dist/lib/typeChecker/recordAssignability.test.d.ts +1 -0
  309. package/dist/lib/typeChecker/recordAssignability.test.js +72 -0
  310. package/dist/lib/typeChecker/recordSynth.test.d.ts +1 -0
  311. package/dist/lib/typeChecker/recordSynth.test.js +80 -0
  312. package/dist/lib/typeChecker/reservedNameDeclaration.test.js +15 -0
  313. package/dist/lib/typeChecker/resolveCall.d.ts +4 -5
  314. package/dist/lib/typeChecker/resolveCall.js +7 -3
  315. package/dist/lib/typeChecker/resolveType.test.d.ts +1 -0
  316. package/dist/lib/typeChecker/resolveType.test.js +478 -0
  317. package/dist/lib/typeChecker/resolveTypeTags.test.d.ts +1 -0
  318. package/dist/lib/typeChecker/resolveTypeTags.test.js +154 -0
  319. package/dist/lib/typeChecker/resolveVariable.d.ts +5 -15
  320. package/dist/lib/typeChecker/resolveVariable.js +3 -7
  321. package/dist/lib/typeChecker/scopes.js +53 -2
  322. package/dist/lib/typeChecker/shadowing.d.ts +0 -1
  323. package/dist/lib/typeChecker/shadowing.js +1 -5
  324. package/dist/lib/typeChecker/substitute.d.ts +25 -0
  325. package/dist/lib/typeChecker/substitute.js +33 -0
  326. package/dist/lib/typeChecker/substitute.test.d.ts +1 -0
  327. package/dist/lib/typeChecker/substitute.test.js +165 -0
  328. package/dist/lib/typeChecker/synthesizer.js +46 -18
  329. package/dist/lib/typeChecker/typeWalker.d.ts +14 -0
  330. package/dist/lib/typeChecker/typeWalker.js +62 -0
  331. package/dist/lib/typeChecker/typeWalker.test.d.ts +1 -0
  332. package/dist/lib/typeChecker/typeWalker.test.js +212 -0
  333. package/dist/lib/typeChecker/types.d.ts +7 -2
  334. package/dist/lib/typeChecker/undefinedFunctionDiagnostic.js +1 -4
  335. package/dist/lib/typeChecker/undefinedVariableDiagnostic.js +3 -4
  336. package/dist/lib/typeChecker/undefinedVariableDiagnostic.test.js +33 -6
  337. package/dist/lib/typeChecker/utils.js +4 -2
  338. package/dist/lib/typeChecker/validate.d.ts +2 -2
  339. package/dist/lib/typeChecker/validate.js +123 -5
  340. package/dist/lib/typeChecker/valueParamSubstitution.d.ts +92 -0
  341. package/dist/lib/typeChecker/valueParamSubstitution.js +645 -0
  342. package/dist/lib/typeChecker/valueParamSubstitution.test.d.ts +1 -0
  343. package/dist/lib/typeChecker/valueParamSubstitution.test.js +214 -0
  344. package/dist/lib/types/dataStructures.d.ts +6 -0
  345. package/dist/lib/types/function.d.ts +2 -6
  346. package/dist/lib/types/graphNode.d.ts +3 -3
  347. package/dist/lib/types/literals.d.ts +1 -1
  348. package/dist/lib/types/newExpression.d.ts +14 -0
  349. package/dist/lib/types/newExpression.js +1 -0
  350. package/dist/lib/types/pattern.d.ts +8 -3
  351. package/dist/lib/types/tag.d.ts +2 -1
  352. package/dist/lib/types/typeHints.d.ts +108 -1
  353. package/dist/lib/types.d.ts +4 -4
  354. package/dist/lib/types.js +1 -1
  355. package/dist/lib/utils/docStringText.d.ts +22 -0
  356. package/dist/lib/utils/docStringText.js +47 -0
  357. package/dist/lib/utils/formatType.js +2 -0
  358. package/dist/lib/utils/node.js +19 -14
  359. package/dist/lib/utils/schemaParam.d.ts +34 -0
  360. package/dist/lib/utils/schemaParam.js +48 -0
  361. package/dist/lib/utils/schemaParam.test.d.ts +1 -0
  362. package/dist/lib/utils/schemaParam.test.js +69 -0
  363. package/dist/lib/utils.d.ts +13 -0
  364. package/dist/lib/utils.js +97 -0
  365. package/dist/lib/utils.test.d.ts +1 -0
  366. package/dist/lib/utils.test.js +101 -0
  367. package/dist/scripts/agency.js +1 -0
  368. package/package.json +1 -1
  369. package/stdlib/agency.agency +217 -3
  370. package/stdlib/agency.js +1864 -222
  371. package/stdlib/agent.js +147 -146
  372. package/stdlib/array.js +737 -784
  373. package/stdlib/browser.agency +2 -2
  374. package/stdlib/browser.js +92 -103
  375. package/stdlib/calendar.js +425 -436
  376. package/stdlib/clipboard.js +132 -143
  377. package/stdlib/date.js +580 -591
  378. package/stdlib/email.js +289 -300
  379. package/stdlib/fs.agency +12 -6
  380. package/stdlib/fs.js +525 -508
  381. package/stdlib/http.agency +61 -4
  382. package/stdlib/http.js +451 -98
  383. package/stdlib/imessage.js +84 -95
  384. package/stdlib/index.agency +66 -40
  385. package/stdlib/index.js +944 -1119
  386. package/stdlib/keyring.js +252 -263
  387. package/stdlib/math.js +167 -162
  388. package/stdlib/memory.agency +21 -13
  389. package/stdlib/memory.js +267 -216
  390. package/stdlib/oauth.agency +4 -1
  391. package/stdlib/oauth.js +270 -277
  392. package/stdlib/object.js +276 -307
  393. package/stdlib/path.js +273 -284
  394. package/stdlib/policy.agency +30 -6
  395. package/stdlib/policy.js +160 -141
  396. package/stdlib/schemas.agency +37 -0
  397. package/stdlib/schemas.js +202 -0
  398. package/stdlib/shell.agency +39 -22
  399. package/stdlib/shell.js +597 -518
  400. package/stdlib/skills.agency +18 -0
  401. package/stdlib/skills.js +276 -0
  402. package/stdlib/sms.js +90 -101
  403. package/stdlib/speech.agency +31 -9
  404. package/stdlib/speech.js +256 -223
  405. package/stdlib/strategy.js +336 -369
  406. package/stdlib/syntax.agency +20 -0
  407. package/stdlib/syntax.js +296 -0
  408. package/stdlib/system.agency +27 -4
  409. package/stdlib/system.js +512 -398
  410. package/stdlib/thread.agency +148 -0
  411. package/stdlib/thread.js +937 -0
  412. package/stdlib/types.agency +58 -0
  413. package/stdlib/types.js +180 -0
  414. package/stdlib/ui.agency +3 -1
  415. package/stdlib/ui.js +541 -558
  416. package/stdlib/validators.agency +150 -0
  417. package/stdlib/validators.js +1471 -0
  418. package/stdlib/weather.js +127 -130
  419. package/stdlib/wikipedia.js +124 -135
  420. package/dist/lib/codegenBuiltins/contextInjected.d.ts +0 -56
  421. package/dist/lib/codegenBuiltins/contextInjected.js +0 -78
  422. package/dist/lib/codegenBuiltins/contextInjected.test.js +0 -57
  423. package/dist/lib/runtime/classReviver.d.ts +0 -15
  424. package/dist/lib/runtime/classReviver.js +0 -32
  425. package/dist/lib/templates/backends/typescriptGenerator/classDefinition.d.ts +0 -19
  426. package/dist/lib/templates/backends/typescriptGenerator/classDefinition.js +0 -48
  427. package/dist/lib/templates/backends/typescriptGenerator/classMethod.d.ts +0 -14
  428. package/dist/lib/templates/backends/typescriptGenerator/classMethod.js +0 -37
  429. package/dist/lib/types/classDefinition.d.ts +0 -30
  430. package/dist/lib/types/classDefinition.js +0 -4
  431. /package/dist/lib/{codegenBuiltins/contextInjected.test.d.ts → backends/docstringInterpolationRuntime.test.d.ts} +0 -0
@@ -1,11 +1,11 @@
1
- import { print, printJSON, parseJSON, input, sleep, round, fetch, fetchJSON, read, write, readImage, notify, range, mostCommon, keys, values, entries, emit } from "agency-lang/stdlib/index.js";
1
+ import { print, printJSON, parseJSON, input, sleep, round, read, write, readImage, notify, range, mostCommon, keys, values, entries, emit, callback } from "agency-lang/stdlib/index.js";
2
2
  import { exec } from "agency-lang/stdlib/shell.js";
3
3
  import { args } from "agency-lang/stdlib/system.js";
4
+ import { systemMessage } from "agency-lang/stdlib/thread.js";
4
5
  import { fileURLToPath } from "url";
5
6
  import __process from "process";
6
7
  import { z } from "agency-lang/zod";
7
8
  import { goToNode, nanoid } from "agency-lang";
8
- import { smoltalk } from "agency-lang";
9
9
  import path from "path";
10
10
  import {
11
11
  RuntimeContext,
@@ -26,12 +26,14 @@ import {
26
26
  respondToInterrupts as _respondToInterrupts,
27
27
  rewindFrom as _rewindFrom,
28
28
  RestoreSignal,
29
+ GuardExceededError,
29
30
  failure,
30
- readSkill as _readSkillRaw,
31
- readSkillTool as __readSkillTool,
32
- readSkillToolParams as __readSkillToolParams,
33
31
  AgencyFunction as __AgencyFunction,
34
32
  __call,
33
+ __threads,
34
+ __stateStack,
35
+ getRuntimeContext,
36
+ agencyStore,
35
37
  functionRefReviver as __functionRefReviver,
36
38
  DeterministicClient as __DeterministicClient
37
39
  } from "agency-lang/runtime";
@@ -65,15 +67,9 @@ const __globalCtx = new RuntimeContext({
65
67
  traceConfig: {
66
68
  program: "dist/lib/agents/review/agent.agency",
67
69
  traceDir: "traces"
68
- },
69
- memory: {
70
- dir: ".agency-memory"
71
70
  }
72
71
  });
73
72
  const graph = __globalCtx.graph;
74
- function readSkill({ filepath }) {
75
- return _readSkillRaw({ filepath, dirname: __dirname });
76
- }
77
73
  function approve(value) {
78
74
  return { type: "approve", value };
79
75
  }
@@ -83,8 +79,8 @@ function reject(value) {
83
79
  function propagate() {
84
80
  return { type: "propagate" };
85
81
  }
86
- const respondToInterrupts = (interrupts, responses, opts) => _respondToInterrupts({ ctx: __globalCtx, interrupts, responses, overrides: opts?.overrides, metadata: opts?.metadata });
87
- const rewindFrom = (checkpoint2, overrides, opts) => _rewindFrom({ ctx: __globalCtx, checkpoint: checkpoint2, overrides, metadata: opts?.metadata });
82
+ const respondToInterrupts = (interrupts, responses, opts) => _respondToInterrupts({ ctx: __globalCtx, interrupts, responses, overrides: opts?.overrides, metadata: opts?.metadata, registerTopLevelCallbacks: __registerTopLevelCallbacks, moduleDir: __dirname });
83
+ const rewindFrom = (checkpoint2, overrides, opts) => _rewindFrom({ ctx: __globalCtx, checkpoint: checkpoint2, overrides, metadata: opts?.metadata, registerTopLevelCallbacks: __registerTopLevelCallbacks, moduleDir: __dirname });
88
84
  const __setDebugger = (dbg) => {
89
85
  __globalCtx.debuggerState = dbg;
90
86
  };
@@ -126,8 +122,6 @@ __registerTool(parseJSON);
126
122
  __registerTool(input);
127
123
  __registerTool(sleep);
128
124
  __registerTool(round);
129
- __registerTool(fetch);
130
- __registerTool(fetchJSON);
131
125
  __registerTool(read);
132
126
  __registerTool(write);
133
127
  __registerTool(readImage);
@@ -138,24 +132,20 @@ __registerTool(keys);
138
132
  __registerTool(values);
139
133
  __registerTool(entries);
140
134
  __registerTool(emit);
135
+ __registerTool(callback);
141
136
  __registerTool(exec);
142
137
  __registerTool(args);
138
+ __registerTool(systemMessage);
143
139
  async function __initializeGlobals(__ctx) {
144
140
  __ctx.globals.markInitialized("dist/lib/agents/review/agent.agency");
145
141
  __ctx.globals.set("dist/lib/agents/review/agent.agency", "systemPrompt", await __call(read, {
146
142
  type: "positional",
147
143
  args: [`./prompts/system.md`]
148
- }, {
149
- ctx: __ctx
150
144
  }));
151
145
  }
152
- __toolRegistry["readSkill"] = __AgencyFunction.create({
153
- name: "readSkill",
154
- module: "dist/lib/agents/review/agent.agency",
155
- fn: readSkill,
156
- params: __readSkillToolParams.map((p) => ({ name: p, hasDefault: false, defaultValue: void 0, variadic: false })),
157
- toolDefinition: __readSkillTool
158
- }, __toolRegistry);
146
+ async function __registerTopLevelCallbacks(__ctx) {
147
+ __ctx.topLevelCallbacks = [];
148
+ }
159
149
  __functionRefReviver.registry = __toolRegistry;
160
150
  const Severity = z.union([z.literal("critical"), z.literal("warning"), z.literal("suggestion")]);
161
151
  const Issue = z.object({ "severity": Severity, "line": z.union([z.number(), z.null()]), "message": z.string(), "suggestion": z.union([z.string(), z.null()]) });
@@ -164,242 +154,217 @@ graph.node("main", async (__state) => {
164
154
  const __setupData = setupNode({
165
155
  state: __state
166
156
  });
167
- const __stateStack = __state.ctx.stateStack;
168
157
  const __stack = __setupData.stack;
169
158
  const __step = __setupData.step;
170
159
  const __self = __setupData.self;
171
- const __threads = __setupData.threads;
172
- const __ctx = __state.ctx;
173
- const statelogClient = __ctx.statelogClient;
174
- const __graph = __ctx.graph;
160
+ const __ctx = getRuntimeContext().ctx;
175
161
  let __forked;
176
162
  let __functionCompleted = false;
177
- await callHook({
178
- callbacks: __ctx.callbacks,
179
- name: "onNodeStart",
180
- data: {
181
- nodeName: "main"
182
- }
183
- });
184
- const runner = new Runner(__ctx, __stack, { nodeContext: true, state: __stack, moduleId: "dist/lib/agents/review/agent.agency", scopeName: "main" });
163
+ const runner = new Runner(__ctx, __stack, { nodeContext: true, state: __stack, moduleId: "dist/lib/agents/review/agent.agency", scopeName: "main", threads: __setupData.threads });
185
164
  try {
186
- await runner.step(0, async (runner2) => {
187
- __stack.locals.cliArgs = await __call(args, {
188
- type: "positional",
189
- args: []
190
- }, {
191
- ctx: __ctx,
192
- threads: __threads,
193
- stateStack: __stateStack
165
+ await agencyStore.run({
166
+ ...getRuntimeContext(),
167
+ ctx: __ctx,
168
+ stack: __ctx.stateStack,
169
+ threads: __setupData.threads
170
+ }, async () => {
171
+ await runner.hook(0, async () => {
172
+ await callHook({
173
+ name: "onNodeStart",
174
+ data: {
175
+ nodeName: "main"
176
+ }
177
+ });
194
178
  });
195
- if (hasInterrupts(__stack.locals.cliArgs)) {
196
- await __ctx.pendingPromises.awaitAll();
197
- runner2.halt({
198
- ...__state,
199
- data: __stack.locals.cliArgs
179
+ await runner.step(1, async (runner2) => {
180
+ __stack.locals.cliArgs = await __call(args, {
181
+ type: "positional",
182
+ args: []
200
183
  });
201
- return;
202
- }
203
- });
204
- await runner.ifElse(1, [
205
- {
206
- condition: async () => __stack.locals.cliArgs.length < 2,
207
- body: async (runner2) => {
208
- await runner2.step(0, async (runner3) => {
209
- const __funcResult = await __call(print, {
210
- type: "positional",
211
- args: [`Usage: agency review <file.agency>`]
212
- }, {
213
- ctx: __ctx,
214
- threads: __threads,
215
- stateStack: __stateStack
216
- });
217
- if (hasInterrupts(__funcResult)) {
218
- await __ctx.pendingPromises.awaitAll();
219
- runner3.halt({
220
- ...__state,
221
- data: __funcResult
222
- });
223
- return;
224
- }
225
- });
226
- await runner2.step(1, async (runner3) => {
227
- __stateStack.pop();
228
- __functionCompleted = true;
229
- runner3.halt(goToNode("end", {
230
- messages: __threads,
231
- ctx: __ctx,
232
- data: {}
233
- }));
234
- return;
184
+ if (hasInterrupts(__stack.locals.cliArgs)) {
185
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
186
+ runner2.halt({
187
+ ...__state,
188
+ data: __stack.locals.cliArgs
235
189
  });
190
+ return;
236
191
  }
237
- }
238
- ]);
239
- await runner.step(2, async (runner2) => {
240
- __stack.locals.agencyScript = __stack.locals.cliArgs[0];
241
- });
242
- await runner.step(3, async (runner2) => {
243
- __stack.locals.filePath = __stack.locals.cliArgs[1];
244
- });
245
- await runner.step(4, async (runner2) => {
246
- __self.__retryable = false;
247
- __stack.locals.code = await __call(read, {
248
- type: "positional",
249
- args: [__stack.locals.filePath]
250
- }, {
251
- ctx: __ctx,
252
- threads: __threads,
253
- stateStack: __stateStack
254
192
  });
255
- if (hasInterrupts(__stack.locals.code)) {
256
- await __ctx.pendingPromises.awaitAll();
257
- runner2.halt({
258
- ...__state,
259
- data: __stack.locals.code
260
- });
261
- return;
262
- }
263
- });
264
- await runner.step(5, async (runner2) => {
265
- const __funcResult = await __call(print, {
266
- type: "positional",
267
- args: [`Reviewing: ${__stack.locals.filePath}
268
- `]
269
- }, {
270
- ctx: __ctx,
271
- threads: __threads,
272
- stateStack: __stateStack
273
- });
274
- if (hasInterrupts(__funcResult)) {
275
- await __ctx.pendingPromises.awaitAll();
276
- runner2.halt({
277
- ...__state,
278
- data: __funcResult
279
- });
280
- return;
281
- }
282
- });
283
- await runner.step(6, async (runner2) => {
284
- const __funcResult = await __call(print, {
285
- type: "positional",
286
- args: [`Running type checker...`]
287
- }, {
288
- ctx: __ctx,
289
- threads: __threads,
290
- stateStack: __stateStack
193
+ await runner.ifElse(2, [
194
+ {
195
+ condition: async () => __stack.locals.cliArgs.length < 2,
196
+ body: async (runner2) => {
197
+ await runner2.step(0, async (runner3) => {
198
+ const __funcResult = await __call(print, {
199
+ type: "positional",
200
+ args: [`Usage: agency review <file.agency>`]
201
+ });
202
+ if (hasInterrupts(__funcResult)) {
203
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
204
+ runner3.halt({
205
+ ...__state,
206
+ data: __funcResult
207
+ });
208
+ return;
209
+ }
210
+ });
211
+ await runner2.step(1, async (runner3) => {
212
+ __stateStack()?.pop();
213
+ __functionCompleted = true;
214
+ runner3.halt(goToNode("end", {
215
+ messages: __threads(),
216
+ ctx: getRuntimeContext().ctx,
217
+ data: {}
218
+ }));
219
+ return;
220
+ });
221
+ }
222
+ }
223
+ ]);
224
+ await runner.step(3, async (runner2) => {
225
+ __stack.locals.agencyScript = __stack.locals.cliArgs[0];
291
226
  });
292
- if (hasInterrupts(__funcResult)) {
293
- await __ctx.pendingPromises.awaitAll();
294
- runner2.halt({
295
- ...__state,
296
- data: __funcResult
297
- });
298
- return;
299
- }
300
- });
301
- await runner.step(7, async (runner2) => {
302
- __self.__retryable = false;
303
- __stack.locals.typeCheckResult = await __call(exec, {
304
- type: "positional",
305
- args: [`node`, [__stack.locals.agencyScript, `typecheck`, __stack.locals.filePath]]
306
- }, {
307
- ctx: __ctx,
308
- threads: __threads,
309
- stateStack: __stateStack
227
+ await runner.step(4, async (runner2) => {
228
+ __stack.locals.filePath = __stack.locals.cliArgs[1];
310
229
  });
311
- if (hasInterrupts(__stack.locals.typeCheckResult)) {
312
- await __ctx.pendingPromises.awaitAll();
313
- runner2.halt({
314
- ...__state,
315
- data: __stack.locals.typeCheckResult
230
+ await runner.step(5, async (runner2) => {
231
+ __self.__retryable = false;
232
+ __stack.locals.code = await __call(read, {
233
+ type: "positional",
234
+ args: [__stack.locals.filePath]
316
235
  });
317
- return;
318
- }
319
- });
320
- await runner.step(8, async (runner2) => {
321
- __stack.locals.typeErrors = ``;
322
- });
323
- await runner.ifElse(9, [
324
- {
325
- condition: async () => __stack.locals.typeCheckResult.exitCode !== 0,
326
- body: async (runner2) => {
327
- await runner2.step(0, async (runner3) => {
328
- __stack.locals.typeErrors = __stack.locals.typeCheckResult.stderr + __stack.locals.typeCheckResult.stdout;
329
- });
330
- await runner2.step(1, async (runner3) => {
331
- const __funcResult = await __call(print, {
332
- type: "positional",
333
- args: [`Type checker found issues:
334
- ${__stack.locals.typeErrors}
335
- `]
336
- }, {
337
- ctx: __ctx,
338
- threads: __threads,
339
- stateStack: __stateStack
340
- });
341
- if (hasInterrupts(__funcResult)) {
342
- await __ctx.pendingPromises.awaitAll();
343
- runner3.halt({
344
- ...__state,
345
- data: __funcResult
346
- });
347
- return;
348
- }
236
+ if (hasInterrupts(__stack.locals.code)) {
237
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
238
+ runner2.halt({
239
+ ...__state,
240
+ data: __stack.locals.code
349
241
  });
242
+ return;
350
243
  }
351
- }
352
- ], async (runner2) => {
353
- await runner2.step(2, async (runner3) => {
244
+ });
245
+ await runner.step(6, async (runner2) => {
354
246
  const __funcResult = await __call(print, {
355
247
  type: "positional",
356
- args: [`Type checker passed.
248
+ args: [`Reviewing: ${__stack.locals.filePath}
357
249
  `]
358
- }, {
359
- ctx: __ctx,
360
- threads: __threads,
361
- stateStack: __stateStack
362
250
  });
363
251
  if (hasInterrupts(__funcResult)) {
364
- await __ctx.pendingPromises.awaitAll();
365
- runner3.halt({
252
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
253
+ runner2.halt({
366
254
  ...__state,
367
255
  data: __funcResult
368
256
  });
369
257
  return;
370
258
  }
371
259
  });
372
- });
373
- await runner.step(10, async (runner2) => {
374
- });
375
- await runner.thread(11, __threads, "create", async (runner2) => {
376
- await runner2.step(0, async (runner3) => {
377
- const __funcResult = __threads.active().push(smoltalk.systemMessage(__ctx.globals.get("dist/lib/agents/review/agent.agency", "systemPrompt")));
260
+ await runner.step(7, async (runner2) => {
261
+ const __funcResult = await __call(print, {
262
+ type: "positional",
263
+ args: [`Running type checker...`]
264
+ });
378
265
  if (hasInterrupts(__funcResult)) {
379
- await __ctx.pendingPromises.awaitAll();
380
- runner3.halt({
266
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
267
+ runner2.halt({
381
268
  ...__state,
382
269
  data: __funcResult
383
270
  });
384
271
  return;
385
272
  }
386
273
  });
387
- await runner2.step(1, async (runner3) => {
388
- __stack.locals.typeErrorMessage = `The type checker found no errors.`;
274
+ await runner.step(8, async (runner2) => {
275
+ __self.__retryable = false;
276
+ __stack.locals.typeCheckResult = await __call(exec, {
277
+ type: "positional",
278
+ args: [`node`, [__stack.locals.agencyScript, `typecheck`, __stack.locals.filePath]]
279
+ });
280
+ if (hasInterrupts(__stack.locals.typeCheckResult)) {
281
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
282
+ runner2.halt({
283
+ ...__state,
284
+ data: __stack.locals.typeCheckResult
285
+ });
286
+ return;
287
+ }
389
288
  });
390
- await runner2.ifElse(2, [
289
+ await runner.step(9, async (runner2) => {
290
+ __stack.locals.typeErrors = ``;
291
+ });
292
+ await runner.ifElse(10, [
391
293
  {
392
- condition: async () => __stack.locals.typeErrors !== ``,
393
- body: async (runner3) => {
394
- await runner3.step(0, async (runner4) => {
395
- __stack.locals.typeErrorMessage = `The type checker reported the following errors:
396
- ${__stack.locals.typeErrors}`;
294
+ condition: async () => __stack.locals.typeCheckResult.exitCode !== 0,
295
+ body: async (runner2) => {
296
+ await runner2.step(0, async (runner3) => {
297
+ __stack.locals.typeErrors = __stack.locals.typeCheckResult.stderr + __stack.locals.typeCheckResult.stdout;
298
+ });
299
+ await runner2.step(1, async (runner3) => {
300
+ const __funcResult = await __call(print, {
301
+ type: "positional",
302
+ args: [`Type checker found issues:
303
+ ${__stack.locals.typeErrors}
304
+ `]
305
+ });
306
+ if (hasInterrupts(__funcResult)) {
307
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
308
+ runner3.halt({
309
+ ...__state,
310
+ data: __funcResult
311
+ });
312
+ return;
313
+ }
397
314
  });
398
315
  }
399
316
  }
400
- ]);
401
- await runner2.step(3, async (runner3) => {
402
- __stack.locals.reviewPrompt = `
317
+ ], async (runner2) => {
318
+ await runner2.step(2, async (runner3) => {
319
+ const __funcResult = await __call(print, {
320
+ type: "positional",
321
+ args: [`Type checker passed.
322
+ `]
323
+ });
324
+ if (hasInterrupts(__funcResult)) {
325
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
326
+ runner3.halt({
327
+ ...__state,
328
+ data: __funcResult
329
+ });
330
+ return;
331
+ }
332
+ });
333
+ });
334
+ await runner.step(11, async (runner2) => {
335
+ });
336
+ await runner.thread(12, "create", async (runner2) => {
337
+ await runner2.step(0, async (runner3) => {
338
+ __self.__retryable = false;
339
+ const __funcResult = await __call(systemMessage, {
340
+ type: "positional",
341
+ args: [getRuntimeContext().ctx.globals.get("dist/lib/agents/review/agent.agency", "systemPrompt")]
342
+ });
343
+ if (hasInterrupts(__funcResult)) {
344
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
345
+ runner3.halt({
346
+ ...__state,
347
+ data: __funcResult
348
+ });
349
+ return;
350
+ }
351
+ });
352
+ await runner2.step(1, async (runner3) => {
353
+ __stack.locals.typeErrorMessage = `The type checker found no errors.`;
354
+ });
355
+ await runner2.ifElse(2, [
356
+ {
357
+ condition: async () => __stack.locals.typeErrors !== ``,
358
+ body: async (runner3) => {
359
+ await runner3.step(0, async (runner4) => {
360
+ __stack.locals.typeErrorMessage = `The type checker reported the following errors:
361
+ ${__stack.locals.typeErrors}`;
362
+ });
363
+ }
364
+ }
365
+ ]);
366
+ await runner2.step(3, async (runner3) => {
367
+ __stack.locals.reviewPrompt = `
403
368
  Please review the following Agency code.
404
369
 
405
370
  File: ${__stack.locals.filePath}
@@ -412,256 +377,228 @@ ${__stack.locals.typeErrors}`;
412
377
 
413
378
  Provide a structured review with a summary, list of issues (with severity, line number if applicable, message, and suggested fix), and a list of strengths.
414
379
  `;
415
- });
416
- await runner2.step(4, async (runner3) => {
417
- __self.__removedTools = __self.__removedTools || [];
418
- __stack.locals.review = await runPrompt({
419
- ctx: __ctx,
420
- prompt: __stack.locals.reviewPrompt,
421
- messages: __threads.getOrCreateActive(),
422
- responseFormat: z.object({
423
- response: ReviewResult
424
- }),
425
- clientConfig: {},
426
- maxToolCallRounds: 10,
427
- stateStack: __stateStack,
428
- removedTools: __self.__removedTools,
429
- checkpointInfo: runner3.getCheckpointInfo()
430
380
  });
431
- if (hasInterrupts(__stack.locals.review)) {
432
- await __ctx.pendingPromises.awaitAll();
433
- runner3.halt({
434
- messages: __threads,
435
- data: __stack.locals.review
381
+ await runner2.step(4, async (runner3) => {
382
+ __self.__removedTools = __self.__removedTools || [];
383
+ __stack.locals.review = await runPrompt({
384
+ prompt: __stack.locals.reviewPrompt,
385
+ messages: __threads().getOrCreateActive(),
386
+ responseFormat: z.object({
387
+ response: ReviewResult
388
+ }),
389
+ clientConfig: {},
390
+ maxToolCallRounds: 10,
391
+ removedTools: __self.__removedTools,
392
+ checkpointInfo: runner3.getCheckpointInfo()
436
393
  });
437
- return;
438
- }
394
+ if (hasInterrupts(__stack.locals.review)) {
395
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
396
+ runner3.halt({
397
+ messages: __threads(),
398
+ data: __stack.locals.review
399
+ });
400
+ return;
401
+ }
402
+ });
439
403
  });
440
- });
441
- await runner.step(12, async (runner2) => {
442
- });
443
- await runner.step(13, async (runner2) => {
444
- const __funcResult = await __call(print, {
445
- type: "positional",
446
- args: [`
447
- --- Review Summary ---`]
448
- }, {
449
- ctx: __ctx,
450
- threads: __threads,
451
- stateStack: __stateStack
404
+ await runner.step(13, async (runner2) => {
405
+ __self.__retryable = false;
452
406
  });
453
- if (hasInterrupts(__funcResult)) {
454
- await __ctx.pendingPromises.awaitAll();
455
- runner2.halt({
456
- ...__state,
457
- data: __funcResult
407
+ await runner.step(14, async (runner2) => {
408
+ const __funcResult = await __call(print, {
409
+ type: "positional",
410
+ args: [`
411
+ --- Review Summary ---`]
458
412
  });
459
- return;
460
- }
461
- });
462
- await runner.step(14, async (runner2) => {
463
- const __funcResult = await __call(print, {
464
- type: "positional",
465
- args: [__stack.locals.review.summary]
466
- }, {
467
- ctx: __ctx,
468
- threads: __threads,
469
- stateStack: __stateStack
413
+ if (hasInterrupts(__funcResult)) {
414
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
415
+ runner2.halt({
416
+ ...__state,
417
+ data: __funcResult
418
+ });
419
+ return;
420
+ }
470
421
  });
471
- if (hasInterrupts(__funcResult)) {
472
- await __ctx.pendingPromises.awaitAll();
473
- runner2.halt({
474
- ...__state,
475
- data: __funcResult
422
+ await runner.step(15, async (runner2) => {
423
+ const __funcResult = await __call(print, {
424
+ type: "positional",
425
+ args: [__stack.locals.review.summary]
476
426
  });
477
- return;
478
- }
479
- });
480
- await runner.ifElse(15, [
481
- {
482
- condition: async () => __stack.locals.review.strengths.length > 0,
483
- body: async (runner2) => {
484
- await runner2.step(0, async (runner3) => {
485
- const __funcResult = await __call(print, {
486
- type: "positional",
487
- args: [`
488
- --- Strengths ---`]
489
- }, {
490
- ctx: __ctx,
491
- threads: __threads,
492
- stateStack: __stateStack
493
- });
494
- if (hasInterrupts(__funcResult)) {
495
- await __ctx.pendingPromises.awaitAll();
496
- runner3.halt({
497
- ...__state,
498
- data: __funcResult
499
- });
500
- return;
501
- }
427
+ if (hasInterrupts(__funcResult)) {
428
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
429
+ runner2.halt({
430
+ ...__state,
431
+ data: __funcResult
502
432
  });
503
- await runner2.loop(1, __stack.locals.review.strengths, async (strength, _, runner3) => {
504
- await runner3.step(0, async (runner4) => {
433
+ return;
434
+ }
435
+ });
436
+ await runner.ifElse(16, [
437
+ {
438
+ condition: async () => __stack.locals.review.strengths.length > 0,
439
+ body: async (runner2) => {
440
+ await runner2.step(0, async (runner3) => {
505
441
  const __funcResult = await __call(print, {
506
442
  type: "positional",
507
- args: [` + ${strength}`]
508
- }, {
509
- ctx: __ctx,
510
- threads: __threads,
511
- stateStack: __stateStack
443
+ args: [`
444
+ --- Strengths ---`]
512
445
  });
513
446
  if (hasInterrupts(__funcResult)) {
514
- await __ctx.pendingPromises.awaitAll();
515
- runner4.halt({
447
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
448
+ runner3.halt({
516
449
  ...__state,
517
450
  data: __funcResult
518
451
  });
519
452
  return;
520
453
  }
521
454
  });
522
- });
523
- }
524
- }
525
- ]);
526
- await runner.ifElse(16, [
527
- {
528
- condition: async () => __stack.locals.review.issues.length > 0,
529
- body: async (runner2) => {
530
- await runner2.step(0, async (runner3) => {
531
- const __funcResult = await __call(print, {
532
- type: "positional",
533
- args: [`
534
- --- Issues ---`]
535
- }, {
536
- ctx: __ctx,
537
- threads: __threads,
538
- stateStack: __stateStack
539
- });
540
- if (hasInterrupts(__funcResult)) {
541
- await __ctx.pendingPromises.awaitAll();
542
- runner3.halt({
543
- ...__state,
544
- data: __funcResult
545
- });
546
- return;
547
- }
548
- });
549
- await runner2.loop(1, __stack.locals.review.issues, async (issue, _, runner3) => {
550
- await runner3.step(0, async (runner4) => {
551
- __stack.locals.prefix = `[${issue.severity}]`;
552
- });
553
- await runner3.step(1, async (runner4) => {
554
- __stack.locals.lineInfo = ``;
555
- });
556
- await runner3.ifElse(2, [
557
- {
558
- condition: async () => issue.line !== null,
559
- body: async (runner4) => {
560
- await runner4.step(0, async (runner5) => {
561
- __stack.locals.lineInfo = ` (line ${issue.line})`;
455
+ await runner2.loop(1, __stack.locals.review.strengths, async (strength, _, runner3) => {
456
+ await runner3.step(0, async (runner4) => {
457
+ const __funcResult = await __call(print, {
458
+ type: "positional",
459
+ args: [` + ${strength}`]
460
+ });
461
+ if (hasInterrupts(__funcResult)) {
462
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
463
+ runner4.halt({
464
+ ...__state,
465
+ data: __funcResult
562
466
  });
467
+ return;
563
468
  }
564
- }
565
- ]);
566
- await runner3.step(3, async (runner4) => {
469
+ });
470
+ });
471
+ }
472
+ }
473
+ ]);
474
+ await runner.ifElse(17, [
475
+ {
476
+ condition: async () => __stack.locals.review.issues.length > 0,
477
+ body: async (runner2) => {
478
+ await runner2.step(0, async (runner3) => {
567
479
  const __funcResult = await __call(print, {
568
480
  type: "positional",
569
- args: [` ${__stack.locals.prefix}${__stack.locals.lineInfo} ${issue.message}`]
570
- }, {
571
- ctx: __ctx,
572
- threads: __threads,
573
- stateStack: __stateStack
481
+ args: [`
482
+ --- Issues ---`]
574
483
  });
575
484
  if (hasInterrupts(__funcResult)) {
576
- await __ctx.pendingPromises.awaitAll();
577
- runner4.halt({
485
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
486
+ runner3.halt({
578
487
  ...__state,
579
488
  data: __funcResult
580
489
  });
581
490
  return;
582
491
  }
583
492
  });
584
- await runner3.ifElse(4, [
585
- {
586
- condition: async () => issue.suggestion !== null,
587
- body: async (runner4) => {
588
- await runner4.step(0, async (runner5) => {
589
- const __funcResult = await __call(print, {
590
- type: "positional",
591
- args: [` Fix: ${issue.suggestion}`]
592
- }, {
593
- ctx: __ctx,
594
- threads: __threads,
595
- stateStack: __stateStack
493
+ await runner2.loop(1, __stack.locals.review.issues, async (issue, _, runner3) => {
494
+ await runner3.step(0, async (runner4) => {
495
+ __stack.locals.prefix = `[${issue.severity}]`;
496
+ });
497
+ await runner3.step(1, async (runner4) => {
498
+ __stack.locals.lineInfo = ``;
499
+ });
500
+ await runner3.ifElse(2, [
501
+ {
502
+ condition: async () => issue.line !== null,
503
+ body: async (runner4) => {
504
+ await runner4.step(0, async (runner5) => {
505
+ __stack.locals.lineInfo = ` (line ${issue.line})`;
596
506
  });
597
- if (hasInterrupts(__funcResult)) {
598
- await __ctx.pendingPromises.awaitAll();
599
- runner5.halt({
600
- ...__state,
601
- data: __funcResult
602
- });
603
- return;
604
- }
507
+ }
508
+ }
509
+ ]);
510
+ await runner3.step(3, async (runner4) => {
511
+ const __funcResult = await __call(print, {
512
+ type: "positional",
513
+ args: [` ${__stack.locals.prefix}${__stack.locals.lineInfo} ${issue.message}`]
514
+ });
515
+ if (hasInterrupts(__funcResult)) {
516
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
517
+ runner4.halt({
518
+ ...__state,
519
+ data: __funcResult
605
520
  });
521
+ return;
606
522
  }
607
- }
608
- ]);
609
- });
523
+ });
524
+ await runner3.ifElse(4, [
525
+ {
526
+ condition: async () => issue.suggestion !== null,
527
+ body: async (runner4) => {
528
+ await runner4.step(0, async (runner5) => {
529
+ const __funcResult = await __call(print, {
530
+ type: "positional",
531
+ args: [` Fix: ${issue.suggestion}`]
532
+ });
533
+ if (hasInterrupts(__funcResult)) {
534
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
535
+ runner5.halt({
536
+ ...__state,
537
+ data: __funcResult
538
+ });
539
+ return;
540
+ }
541
+ });
542
+ }
543
+ }
544
+ ]);
545
+ });
546
+ }
610
547
  }
611
- }
612
- ], async (runner2) => {
613
- await runner2.step(2, async (runner3) => {
614
- const __funcResult = await __call(print, {
615
- type: "positional",
616
- args: [`
548
+ ], async (runner2) => {
549
+ await runner2.step(2, async (runner3) => {
550
+ const __funcResult = await __call(print, {
551
+ type: "positional",
552
+ args: [`
617
553
  No issues found. Code looks good!`]
618
- }, {
619
- ctx: __ctx,
620
- threads: __threads,
621
- stateStack: __stateStack
622
- });
623
- if (hasInterrupts(__funcResult)) {
624
- await __ctx.pendingPromises.awaitAll();
625
- runner3.halt({
626
- ...__state,
627
- data: __funcResult
628
554
  });
629
- return;
630
- }
555
+ if (hasInterrupts(__funcResult)) {
556
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
557
+ runner3.halt({
558
+ ...__state,
559
+ data: __funcResult
560
+ });
561
+ return;
562
+ }
563
+ });
564
+ });
565
+ await runner.step(18, async (runner2) => {
566
+ __stateStack()?.pop();
567
+ __functionCompleted = true;
568
+ runner2.halt(goToNode("end", {
569
+ messages: __threads(),
570
+ ctx: getRuntimeContext().ctx,
571
+ data: {}
572
+ }));
573
+ return;
631
574
  });
632
- });
633
- await runner.step(17, async (runner2) => {
634
- __stateStack.pop();
635
- __functionCompleted = true;
636
- runner2.halt(goToNode("end", {
637
- messages: __threads,
638
- ctx: __ctx,
639
- data: {}
640
- }));
641
- return;
642
575
  });
643
576
  if (runner.halted) return runner.haltResult;
644
- await callHook({
645
- callbacks: __ctx.callbacks,
646
- name: "onNodeEnd",
647
- data: {
648
- nodeName: "main",
649
- data: void 0
650
- }
577
+ await runner.hook(19, async () => {
578
+ await callHook({
579
+ name: "onNodeEnd",
580
+ data: {
581
+ nodeName: "main",
582
+ data: void 0
583
+ }
584
+ });
651
585
  });
652
586
  return {
653
- messages: __threads,
587
+ messages: __threads(),
654
588
  data: void 0
655
589
  };
656
590
  } catch (__error) {
657
591
  if (__error instanceof RestoreSignal) {
658
592
  throw __error;
659
593
  }
594
+ if (__error instanceof GuardExceededError) {
595
+ throw __error;
596
+ }
660
597
  console.error(`
661
598
  Agent crashed: ${__error.message}`);
662
599
  console.error(__error.stack);
663
600
  return {
664
- messages: __threads,
601
+ messages: __threads(),
665
602
  data: failure(__error instanceof Error ? __error.message : String(__error), { functionName: "main" })
666
603
  };
667
604
  }
@@ -670,47 +607,55 @@ graph.node("end", async (__state) => {
670
607
  const __setupData = setupNode({
671
608
  state: __state
672
609
  });
673
- const __stateStack = __state.ctx.stateStack;
674
610
  const __stack = __setupData.stack;
675
611
  const __step = __setupData.step;
676
612
  const __self = __setupData.self;
677
- const __threads = __setupData.threads;
678
- const __ctx = __state.ctx;
679
- const statelogClient = __ctx.statelogClient;
680
- const __graph = __ctx.graph;
613
+ const __ctx = getRuntimeContext().ctx;
681
614
  let __forked;
682
615
  let __functionCompleted = false;
683
- await callHook({
684
- callbacks: __ctx.callbacks,
685
- name: "onNodeStart",
686
- data: {
687
- nodeName: "end"
688
- }
689
- });
690
- const runner = new Runner(__ctx, __stack, { nodeContext: true, state: __stack, moduleId: "dist/lib/agents/review/agent.agency", scopeName: "end" });
616
+ const runner = new Runner(__ctx, __stack, { nodeContext: true, state: __stack, moduleId: "dist/lib/agents/review/agent.agency", scopeName: "end", threads: __setupData.threads });
691
617
  try {
618
+ await agencyStore.run({
619
+ ...getRuntimeContext(),
620
+ ctx: __ctx,
621
+ stack: __ctx.stateStack,
622
+ threads: __setupData.threads
623
+ }, async () => {
624
+ await runner.hook(0, async () => {
625
+ await callHook({
626
+ name: "onNodeStart",
627
+ data: {
628
+ nodeName: "end"
629
+ }
630
+ });
631
+ });
632
+ });
692
633
  if (runner.halted) return runner.haltResult;
693
- await callHook({
694
- callbacks: __ctx.callbacks,
695
- name: "onNodeEnd",
696
- data: {
697
- nodeName: "end",
698
- data: void 0
699
- }
634
+ await runner.hook(1, async () => {
635
+ await callHook({
636
+ name: "onNodeEnd",
637
+ data: {
638
+ nodeName: "end",
639
+ data: void 0
640
+ }
641
+ });
700
642
  });
701
643
  return {
702
- messages: __threads,
644
+ messages: __threads(),
703
645
  data: void 0
704
646
  };
705
647
  } catch (__error) {
706
648
  if (__error instanceof RestoreSignal) {
707
649
  throw __error;
708
650
  }
651
+ if (__error instanceof GuardExceededError) {
652
+ throw __error;
653
+ }
709
654
  console.error(`
710
655
  Agent crashed: ${__error.message}`);
711
656
  console.error(__error.stack);
712
657
  return {
713
- messages: __threads,
658
+ messages: __threads(),
714
659
  data: failure(__error instanceof Error ? __error.message : String(__error), { functionName: "end" })
715
660
  };
716
661
  }
@@ -723,7 +668,9 @@ async function main({ messages, callbacks } = {}) {
723
668
  data: {},
724
669
  messages,
725
670
  callbacks,
726
- initializeGlobals: __initializeGlobals
671
+ initializeGlobals: __initializeGlobals,
672
+ registerTopLevelCallbacks: __registerTopLevelCallbacks,
673
+ moduleDir: __dirname
727
674
  });
728
675
  }
729
676
  const __mainNodeParams = [];
@@ -734,7 +681,9 @@ async function end({ messages, callbacks } = {}) {
734
681
  data: {},
735
682
  messages,
736
683
  callbacks,
737
- initializeGlobals: __initializeGlobals
684
+ initializeGlobals: __initializeGlobals,
685
+ registerTopLevelCallbacks: __registerTopLevelCallbacks,
686
+ moduleDir: __dirname
738
687
  });
739
688
  }
740
689
  const __endNodeParams = [];
@@ -752,7 +701,7 @@ Agent crashed: ${__error.message}`);
752
701
  }
753
702
  }
754
703
  var stdin_default = graph;
755
- const __sourceMap = { "dist/lib/agents/review/agent.agency:main": { "0": { "line": 20, "col": 2 }, "1": { "line": 21, "col": 2 }, "2": { "line": 25, "col": 2 }, "3": { "line": 26, "col": 2 }, "4": { "line": 27, "col": 2 }, "5": { "line": 28, "col": 2 }, "6": { "line": 29, "col": 2 }, "7": { "line": 30, "col": 2 }, "8": { "line": 31, "col": 2 }, "9": { "line": 32, "col": 2 }, "11": { "line": 39, "col": 2 }, "13": { "line": 61, "col": 2 }, "14": { "line": 62, "col": 2 }, "15": { "line": 63, "col": 2 }, "16": { "line": 69, "col": 2 }, "17": { "line": 85, "col": 2 }, "1.0": { "line": 22, "col": 4 }, "1.1": { "line": 23, "col": 4 }, "9.0": { "line": 33, "col": 4 }, "9.1": { "line": 34, "col": 4 }, "9.2": { "line": 36, "col": 4 }, "11.0": { "line": 40, "col": 4 }, "11.1": { "line": 41, "col": 4 }, "11.2.0": { "line": 43, "col": 6 }, "11.2": { "line": 42, "col": 4 }, "11.3": { "line": 45, "col": 4 }, "11.4": { "line": 58, "col": 4 }, "15.0": { "line": 64, "col": 4 }, "15.1.0": { "line": 66, "col": 6 }, "15.1": { "line": 65, "col": 4 }, "16.0": { "line": 70, "col": 4 }, "16.1.0": { "line": 72, "col": 6 }, "16.1.1": { "line": 73, "col": 6 }, "16.1.2.0": { "line": 75, "col": 8 }, "16.1.2": { "line": 74, "col": 6 }, "16.1.3": { "line": 77, "col": 6 }, "16.1.4.0": { "line": 79, "col": 8 }, "16.1.4": { "line": 78, "col": 6 }, "16.1": { "line": 71, "col": 4 }, "16.2": { "line": 83, "col": 4 } }, "dist/lib/agents/review/agent.agency:end": {} };
704
+ const __sourceMap = { "dist/lib/agents/review/agent.agency:main": { "1": { "line": 21, "col": 2 }, "2": { "line": 22, "col": 2 }, "3": { "line": 26, "col": 2 }, "4": { "line": 27, "col": 2 }, "5": { "line": 28, "col": 2 }, "6": { "line": 29, "col": 2 }, "7": { "line": 30, "col": 2 }, "8": { "line": 31, "col": 2 }, "9": { "line": 32, "col": 2 }, "10": { "line": 33, "col": 2 }, "12": { "line": 40, "col": 2 }, "14": { "line": 62, "col": 2 }, "15": { "line": 63, "col": 2 }, "16": { "line": 64, "col": 2 }, "17": { "line": 70, "col": 2 }, "18": { "line": 86, "col": 2 }, "2.0": { "line": 23, "col": 4 }, "2.1": { "line": 24, "col": 4 }, "10.0": { "line": 34, "col": 4 }, "10.1": { "line": 35, "col": 4 }, "10.2": { "line": 37, "col": 4 }, "12.0": { "line": 41, "col": 4 }, "12.1": { "line": 42, "col": 4 }, "12.2.0": { "line": 44, "col": 6 }, "12.2": { "line": 43, "col": 4 }, "12.3": { "line": 46, "col": 4 }, "12.4": { "line": 59, "col": 4 }, "16.0": { "line": 65, "col": 4 }, "16.1.0": { "line": 67, "col": 6 }, "16.1": { "line": 66, "col": 4 }, "17.0": { "line": 71, "col": 4 }, "17.1.0": { "line": 73, "col": 6 }, "17.1.1": { "line": 74, "col": 6 }, "17.1.2.0": { "line": 76, "col": 8 }, "17.1.2": { "line": 75, "col": 6 }, "17.1.3": { "line": 78, "col": 6 }, "17.1.4.0": { "line": 80, "col": 8 }, "17.1.4": { "line": 79, "col": 6 }, "17.1": { "line": 72, "col": 4 }, "17.2": { "line": 84, "col": 4 } }, "dist/lib/agents/review/agent.agency:end": {} };
756
705
  export {
757
706
  __endNodeParams,
758
707
  __getCheckpoints,
@@ -770,7 +719,6 @@ export {
770
719
  isDebugger,
771
720
  isInterrupt,
772
721
  main,
773
- readSkill,
774
722
  reject,
775
723
  respondToInterrupts,
776
724
  rewindFrom