agency-lang 0.18.1 → 0.18.2

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 (251) hide show
  1. package/dist/lib/agents/agency-agent/agent.agency +1 -1
  2. package/dist/lib/agents/agency-agent/agent.js +12 -15
  3. package/dist/lib/agents/agency-agent/brains/brain.js +3 -3
  4. package/dist/lib/agents/agency-agent/brains/coordinator/coordinator.js +59 -86
  5. package/dist/lib/agents/agency-agent/brains/coordinator/lib/announce.js +16 -22
  6. package/dist/lib/agents/agency-agent/brains/coordinator/lib/budgets.js +31 -42
  7. package/dist/lib/agents/agency-agent/brains/coordinator/prompts/codeSample.js +9 -9
  8. package/dist/lib/agents/agency-agent/brains/coordinator/subagents/brainstorm.js +46 -67
  9. package/dist/lib/agents/agency-agent/brains/coordinator/subagents/code.agency +1 -1
  10. package/dist/lib/agents/agency-agent/brains/coordinator/subagents/code.js +118 -171
  11. package/dist/lib/agents/agency-agent/brains/coordinator/subagents/explorer.js +10 -13
  12. package/dist/lib/agents/agency-agent/brains/coordinator/subagents/oracle.js +10 -13
  13. package/dist/lib/agents/agency-agent/brains/coordinator/subagents/research.js +10 -13
  14. package/dist/lib/agents/agency-agent/brains/coordinator/subagents/review.js +40 -58
  15. package/dist/lib/agents/agency-agent/brains/coordinator/subagents/rewrite.js +16 -22
  16. package/dist/lib/agents/agency-agent/brains/coordinator/subagents/supervisor.js +82 -121
  17. package/dist/lib/agents/agency-agent/brains/coordinator/subagents/writing.js +10 -13
  18. package/dist/lib/agents/agency-agent/brains/registry.js +16 -22
  19. package/dist/lib/agents/agency-agent/brains/simple/simple.js +22 -31
  20. package/dist/lib/agents/agency-agent/images/images.js +3 -3
  21. package/dist/lib/agents/agency-agent/lib/agentName.js +10 -13
  22. package/dist/lib/agents/agency-agent/lib/args.agency +1 -1
  23. package/dist/lib/agents/agency-agent/lib/args.js +17 -23
  24. package/dist/lib/agents/agency-agent/lib/attachments.js +16 -22
  25. package/dist/lib/agents/agency-agent/lib/budget.js +10 -13
  26. package/dist/lib/agents/agency-agent/lib/capabilities.agency +4 -0
  27. package/dist/lib/agents/agency-agent/lib/capabilities.js +74 -104
  28. package/dist/lib/agents/agency-agent/lib/capabilitiesUi.js +58 -85
  29. package/dist/lib/agents/agency-agent/lib/commandPalette.js +16 -22
  30. package/dist/lib/agents/agency-agent/lib/config.js +10 -13
  31. package/dist/lib/agents/agency-agent/lib/grounding.js +16 -22
  32. package/dist/lib/agents/agency-agent/lib/header.js +46 -67
  33. package/dist/lib/agents/agency-agent/lib/images.js +16 -22
  34. package/dist/lib/agents/agency-agent/lib/mcp.js +40 -58
  35. package/dist/lib/agents/agency-agent/lib/modelFilters.js +10 -13
  36. package/dist/lib/agents/agency-agent/lib/models.js +69 -98
  37. package/dist/lib/agents/agency-agent/lib/policy.agency +3 -3
  38. package/dist/lib/agents/agency-agent/lib/policy.js +57 -72
  39. package/dist/lib/agents/agency-agent/lib/projectContext.js +16 -22
  40. package/dist/lib/agents/agency-agent/lib/repl.agency +2 -4
  41. package/dist/lib/agents/agency-agent/lib/repl.js +85 -124
  42. package/dist/lib/agents/agency-agent/lib/resolution.js +46 -67
  43. package/dist/lib/agents/agency-agent/lib/resume.js +52 -76
  44. package/dist/lib/agents/agency-agent/lib/search.js +100 -148
  45. package/dist/lib/agents/agency-agent/lib/session.js +46 -67
  46. package/dist/lib/agents/agency-agent/lib/sessionTitle.js +35 -49
  47. package/dist/lib/agents/agency-agent/lib/sessions.js +65 -94
  48. package/dist/lib/agents/agency-agent/lib/settings.js +40 -58
  49. package/dist/lib/agents/agency-agent/lib/slots.js +22 -31
  50. package/dist/lib/agents/agency-agent/lib/trace.js +76 -112
  51. package/dist/lib/agents/agency-agent/lib/transcript.js +22 -31
  52. package/dist/lib/agents/agency-agent/lib/turn.js +70 -103
  53. package/dist/lib/agents/agency-agent/lib/utils/renderLLMCallResponse.js +10 -13
  54. package/dist/lib/agents/agency-agent/lib/utils.js +52 -76
  55. package/dist/lib/agents/agency-agent/shared.agency +33 -5
  56. package/dist/lib/agents/agency-agent/shared.js +306 -241
  57. package/dist/lib/agents/eval/goalJudge.js +5 -5
  58. package/dist/lib/agents/eval/judge.js +5 -5
  59. package/dist/lib/agents/eval/judgePairwise.js +5 -5
  60. package/dist/lib/agents/eval/rubricJudge.js +5 -5
  61. package/dist/lib/agents/optimize/gepaReflect.js +5 -5
  62. package/dist/lib/agents/optimize/mutatePrompt.js +5 -5
  63. package/dist/lib/agents/policy/agent.js +60 -86
  64. package/dist/lib/agents/review/agent.js +6 -6
  65. package/dist/lib/backends/typescriptBuilder.js +15 -3
  66. package/dist/lib/backends/typescriptGenerator/typeToString.js +8 -6
  67. package/dist/lib/backends/typescriptGenerator/typeToZodSchema.d.ts +1 -1
  68. package/dist/lib/backends/typescriptGenerator/typeToZodSchema.js +7 -2
  69. package/dist/lib/cli/local.d.ts +6 -1
  70. package/dist/lib/cli/local.js +74 -9
  71. package/dist/lib/cli/localFlag.d.ts +4 -3
  72. package/dist/lib/cli/localFlag.js +11 -4
  73. package/dist/lib/config.d.ts +8 -0
  74. package/dist/lib/config.js +1 -0
  75. package/dist/lib/parsers/parsers.js +9 -9
  76. package/dist/lib/runtime/agencyFunction.js +4 -2
  77. package/dist/lib/runtime/call.js +2 -2
  78. package/dist/lib/runtime/index.d.ts +1 -1
  79. package/dist/lib/runtime/index.js +1 -1
  80. package/dist/lib/runtime/interruptResponse.d.ts +2 -2
  81. package/dist/lib/runtime/interruptResponse.js +2 -2
  82. package/dist/lib/runtime/ipc.js +1 -2
  83. package/dist/lib/runtime/llmRetry.js +1 -1
  84. package/dist/lib/runtime/prompt.d.ts +0 -6
  85. package/dist/lib/runtime/prompt.js +19 -28
  86. package/dist/lib/runtime/result.d.ts +24 -2
  87. package/dist/lib/runtime/result.js +82 -6
  88. package/dist/lib/runtime/validateChain.js +2 -2
  89. package/dist/lib/statelogClient.d.ts +1 -1
  90. package/dist/lib/stdlib/agency.d.ts +3 -3
  91. package/dist/lib/stdlib/agency.js +7 -7
  92. package/dist/lib/stdlib/aws/client.js +1 -3
  93. package/dist/lib/stdlib/aws/credentials.js +2 -4
  94. package/dist/lib/stdlib/aws/endpoints.js +3 -7
  95. package/dist/lib/stdlib/aws/errors.js +1 -2
  96. package/dist/lib/stdlib/aws/s3.js +5 -11
  97. package/dist/lib/stdlib/http.js +1 -2
  98. package/dist/lib/stdlib/localModels.d.ts +46 -8
  99. package/dist/lib/stdlib/localModels.js +217 -37
  100. package/dist/lib/stdlib/mcp.js +1 -1
  101. package/dist/lib/stdlib/mlxModelRecord.d.ts +26 -0
  102. package/dist/lib/stdlib/mlxModelRecord.js +60 -0
  103. package/dist/lib/stdlib/modelBackend.d.ts +17 -0
  104. package/dist/lib/stdlib/modelBackend.js +42 -0
  105. package/dist/lib/stdlib/objectBytes.js +2 -4
  106. package/dist/lib/stdlib/threads.js +1 -1
  107. package/dist/lib/templates/backends/typescriptGenerator/functionCatchFailure.d.ts +1 -1
  108. package/dist/lib/templates/backends/typescriptGenerator/functionCatchFailure.js +6 -9
  109. package/dist/lib/templates/backends/typescriptGenerator/imports.d.ts +1 -1
  110. package/dist/lib/templates/backends/typescriptGenerator/imports.js +2 -2
  111. package/dist/lib/templates/backends/typescriptGenerator/interruptAssignment.d.ts +1 -1
  112. package/dist/lib/templates/backends/typescriptGenerator/interruptAssignment.js +4 -4
  113. package/dist/lib/templates/backends/typescriptGenerator/interruptReturn.d.ts +1 -1
  114. package/dist/lib/templates/backends/typescriptGenerator/interruptReturn.js +4 -4
  115. package/dist/lib/typeChecker/assignability.js +2 -2
  116. package/dist/lib/typeChecker/builtinGenerics.d.ts +12 -0
  117. package/dist/lib/typeChecker/builtinGenerics.js +4 -2
  118. package/dist/lib/typeChecker/builtins.js +17 -2
  119. package/dist/lib/typeChecker/dataShape.d.ts +10 -0
  120. package/dist/lib/typeChecker/dataShape.js +21 -0
  121. package/dist/lib/typeChecker/diagnosticExplanations.js +53 -0
  122. package/dist/lib/typeChecker/diagnostics.d.ts +25 -0
  123. package/dist/lib/typeChecker/diagnostics.js +25 -0
  124. package/dist/lib/typeChecker/inference.js +1 -1
  125. package/dist/lib/typeChecker/resultUnion.js +18 -2
  126. package/dist/lib/typeChecker/scopes.js +8 -1
  127. package/dist/lib/typeChecker/synthesizer.js +37 -7
  128. package/dist/lib/typeChecker/typeKey.js +1 -1
  129. package/dist/lib/typeChecker/typeWalker.js +2 -2
  130. package/dist/lib/typeChecker/utils.d.ts +1 -1
  131. package/dist/lib/typeChecker/utils.js +41 -2
  132. package/dist/lib/typeChecker/validate.d.ts +5 -0
  133. package/dist/lib/typeChecker/validate.js +14 -0
  134. package/dist/lib/typeChecker/validation.d.ts +4 -3
  135. package/dist/lib/typeChecker/validation.js +6 -5
  136. package/dist/lib/typeChecker/valueParamSubstitution.js +2 -2
  137. package/dist/lib/types/typeHints.d.ts +3 -1
  138. package/dist/lib/utils/formatType.js +8 -4
  139. package/dist/scripts/agency.js +3 -2
  140. package/package.json +2 -2
  141. package/stdlib/agency/eval.js +22 -31
  142. package/stdlib/agency/local.agency +49 -15
  143. package/stdlib/agency/local.js +362 -125
  144. package/stdlib/agency.agency +34 -27
  145. package/stdlib/agency.js +411 -800
  146. package/stdlib/agent.js +36 -51
  147. package/stdlib/agents/agency/coding.agency +5 -4
  148. package/stdlib/agents/agency/coding.js +66 -82
  149. package/stdlib/agents/agency/expert.js +22 -31
  150. package/stdlib/agents/agency/researcher.js +22 -31
  151. package/stdlib/agents/agency/review.js +41 -58
  152. package/stdlib/agents/agency/verifier.js +28 -40
  153. package/stdlib/agents/coding.js +22 -31
  154. package/stdlib/agents/composable/promptRewriter.js +10 -13
  155. package/stdlib/agents/composable/researcher.js +16 -22
  156. package/stdlib/agents/composable/utils.js +12 -15
  157. package/stdlib/agents/data.js +22 -31
  158. package/stdlib/agents/expert.js +22 -31
  159. package/stdlib/agents/explorer.js +22 -31
  160. package/stdlib/agents/lib/expertGuidance.js +17 -23
  161. package/stdlib/agents/lib/feedback.js +45 -63
  162. package/stdlib/agents/lib/search.js +34 -49
  163. package/stdlib/agents/lib/shared.js +22 -31
  164. package/stdlib/agents/lib/toolkits.js +76 -112
  165. package/stdlib/agents/oracle.js +22 -31
  166. package/stdlib/agents/planner.agency +2 -2
  167. package/stdlib/agents/planner.js +97 -145
  168. package/stdlib/agents/researcher.js +35 -49
  169. package/stdlib/agents/review.js +22 -31
  170. package/stdlib/agents/typescript/review.js +23 -31
  171. package/stdlib/agents/verifier.js +29 -41
  172. package/stdlib/agents/writing/review.js +59 -85
  173. package/stdlib/agents/writing/rewrite.js +18 -23
  174. package/stdlib/args.js +10 -13
  175. package/stdlib/array.js +82 -121
  176. package/stdlib/auth/keyring.js +34 -46
  177. package/stdlib/auth/oauth.js +34 -46
  178. package/stdlib/aws/s3.js +52 -70
  179. package/stdlib/calendar.js +50 -68
  180. package/stdlib/capabilities.js +3 -3
  181. package/stdlib/clipboard.js +20 -26
  182. package/stdlib/concurrency.js +16 -22
  183. package/stdlib/data/connector.js +34 -49
  184. package/stdlib/data/finance/dbnomics.js +32 -43
  185. package/stdlib/data/finance/edgar.js +53 -73
  186. package/stdlib/data/finance/fred.js +74 -103
  187. package/stdlib/data/news/gdelt.js +31 -42
  188. package/stdlib/data/people/littlesis.js +127 -180
  189. package/stdlib/data/social/bluesky.js +94 -132
  190. package/stdlib/data/tech/hackernews.js +142 -201
  191. package/stdlib/data/tech/yc.js +126 -179
  192. package/stdlib/data/usaspending.js +79 -111
  193. package/stdlib/data/wikidata.js +110 -157
  194. package/stdlib/date.js +106 -157
  195. package/stdlib/docs/cli/local.md +51 -12
  196. package/stdlib/docs/diagnostics/checking.md +88 -0
  197. package/stdlib/docs/diagnostics/index.md +5 -0
  198. package/stdlib/docs/guide/error-handling.md +60 -5
  199. package/stdlib/docs/guide/guards.md +6 -4
  200. package/stdlib/docs/guide/using-local-models.md +3 -2
  201. package/stdlib/docs/stdlib/agency/local.md +89 -31
  202. package/stdlib/docs/stdlib/policy.md +6 -7
  203. package/stdlib/docs/stdlib/supervise.md +2 -2
  204. package/stdlib/docs/stdlib/thread.md +14 -7
  205. package/stdlib/docs/stdlib/toolbox.md +3 -3
  206. package/stdlib/fs.js +52 -70
  207. package/stdlib/git.js +154 -211
  208. package/stdlib/github.js +148 -202
  209. package/stdlib/http.js +28 -37
  210. package/stdlib/image.js +10 -13
  211. package/stdlib/index.js +198 -291
  212. package/stdlib/llm.agency +2 -2
  213. package/stdlib/llm.js +65 -91
  214. package/stdlib/markdown.js +36 -50
  215. package/stdlib/math.js +35 -49
  216. package/stdlib/mcp.js +34 -49
  217. package/stdlib/memory.js +68 -95
  218. package/stdlib/messaging/email.js +28 -37
  219. package/stdlib/messaging/imessage.js +12 -15
  220. package/stdlib/messaging/sms.js +12 -15
  221. package/stdlib/notes/apple.js +75 -101
  222. package/stdlib/object.js +52 -76
  223. package/stdlib/path.js +46 -67
  224. package/stdlib/policy.agency +16 -24
  225. package/stdlib/policy.js +170 -262
  226. package/stdlib/safeBash/actions.js +31 -42
  227. package/stdlib/safeBash.js +295 -414
  228. package/stdlib/shell.js +62 -86
  229. package/stdlib/skills.js +198 -281
  230. package/stdlib/speech.js +42 -57
  231. package/stdlib/spill.js +65 -91
  232. package/stdlib/statelog.js +52 -76
  233. package/stdlib/strategy.js +46 -67
  234. package/stdlib/supervise.js +11 -13
  235. package/stdlib/syntax.js +28 -40
  236. package/stdlib/system.js +94 -133
  237. package/stdlib/tag.js +40 -58
  238. package/stdlib/thread.agency +3 -0
  239. package/stdlib/thread.js +125 -185
  240. package/stdlib/toolbox.agency +21 -37
  241. package/stdlib/toolbox.js +415 -757
  242. package/stdlib/ui/chart.js +28 -40
  243. package/stdlib/ui/cli.js +58 -85
  244. package/stdlib/ui/layout.js +112 -166
  245. package/stdlib/ui/table.js +46 -67
  246. package/stdlib/ui.js +340 -508
  247. package/stdlib/validation.js +83 -121
  248. package/stdlib/weather.js +24 -33
  249. package/stdlib/web/browser.js +12 -15
  250. package/stdlib/web/search.js +20 -26
  251. package/stdlib/wikipedia.js +28 -37
@@ -52,7 +52,7 @@ def oneShotAgent(target: string, prompt: string): string {
52
52
  if (result is success(r)) {
53
53
  reply = r
54
54
  } else if (result is failure(f)) {
55
- reply = formatTurnFailure("${f.error}")
55
+ reply = formatTurnFailure(f)
56
56
  }
57
57
  }
58
58
  evalOutput(reply)
@@ -60,7 +60,7 @@ import {
60
60
  __registerGlobalsInit,
61
61
  __registerCallbacksInit,
62
62
  registerModuleFingerprint as __registerModuleFingerprint,
63
- failure,
63
+ runtimeFailure,
64
64
  isSuccess,
65
65
  isFailure,
66
66
  stampFailureBoundary,
@@ -126,8 +126,8 @@ const graph = __globalCtx.graph;
126
126
  function approve(value) {
127
127
  return { type: "approve", value };
128
128
  }
129
- function reject(value) {
130
- return { type: "reject", value };
129
+ function reject(reason) {
130
+ return { type: "reject", value: reason };
131
131
  }
132
132
  function propagate() {
133
133
  return { type: "propagate" };
@@ -423,7 +423,7 @@ async function __oneShotAgent_impl(target, prompt) {
423
423
  await runner5.step(1, async (runner6) => {
424
424
  __stack.locals.reply = await __call(formatTurnFailure, {
425
425
  type: "positional",
426
- args: [`${__bstack.locals.f.error}`]
426
+ args: [__bstack.locals.f]
427
427
  });
428
428
  if (hasInterrupts(__stack.locals.reply)) {
429
429
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
@@ -506,15 +506,12 @@ async function __oneShotAgent_impl(target, prompt) {
506
506
  functionName: "oneShotAgent"
507
507
  });
508
508
  }
509
- return failure(
510
- __error instanceof Error ? __error.message : String(__error),
511
- {
512
- checkpoint: getRuntimeContext().ctx.getResultCheckpoint(),
513
- destructiveRan: __self.__destructiveRan,
514
- functionName: "oneShotAgent",
515
- args: __stack.args
516
- }
517
- );
509
+ return runtimeFailure(__error, {
510
+ checkpoint: getRuntimeContext().ctx.getResultCheckpoint(),
511
+ destructiveRan: __self.__destructiveRan,
512
+ functionName: "oneShotAgent",
513
+ args: __stack.args
514
+ });
518
515
  } finally {
519
516
  __stateStack()?.pop();
520
517
  if (__functionCompleted) {
@@ -1643,7 +1640,7 @@ Session cost: ${__stack.locals.roundedCost}`]
1643
1640
  }
1644
1641
  return {
1645
1642
  messages: __threads(),
1646
- data: failure(__error instanceof Error ? __error.message : String(__error), { functionName: "main" })
1643
+ data: runtimeFailure(__error, { functionName: "main" })
1647
1644
  };
1648
1645
  }
1649
1646
  });
@@ -1680,7 +1677,7 @@ Agent crashed: ${__error.message}`);
1680
1677
  }
1681
1678
  var stdin_default = graph;
1682
1679
  const __sourceMap = { "dist/lib/agents/agency-agent/agent.agency:oneShotAgent": { "1": { "line": 41, "col": 2 }, "2": { "line": 45, "col": 2 }, "3": { "line": 46, "col": 2 }, "4": { "line": 47, "col": 2 }, "5": { "line": 57, "col": 2 }, "6": { "line": 58, "col": 2 } }, "dist/lib/agents/agency-agent/agent.agency:__block_0": { "4.0": { "line": 48, "col": 4 }, "4.1": { "line": 51, "col": 18 }, "4.2.0": { "line": 51, "col": 4 }, "4.2.1": { "line": 52, "col": 6 }, "4.2.2": { "line": 53, "col": 25 }, "4.2.3.0": { "line": 53, "col": 11 }, "4.2.3.1": { "line": 54, "col": 6 }, "4.2.3": { "line": 53, "col": 11 }, "4.2": { "line": 51, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:main": { "2": { "line": 68, "col": 2 }, "3": { "line": 76, "col": 2 }, "4": { "line": 79, "col": 2 }, "6": { "line": 86, "col": 2 }, "7": { "line": 90, "col": 2 }, "8": { "line": 96, "col": 63 }, "9": { "line": 96, "col": 2 }, "10": { "line": 97, "col": 2 }, "11": { "line": 98, "col": 2 }, "12": { "line": 104, "col": 2 }, "13": { "line": 109, "col": 2 }, "14": { "line": 110, "col": 2 }, "15": { "line": 111, "col": 2 }, "16": { "line": 115, "col": 2 }, "17": { "line": 116, "col": 2 }, "18": { "line": 119, "col": 15 }, "19": { "line": 119, "col": 2 }, "20": { "line": 122, "col": 2 }, "21": { "line": 123, "col": 2 }, "22": { "line": 124, "col": 2 }, "23": { "line": 125, "col": 2 }, "24": { "line": 138, "col": 2 }, "25": { "line": 142, "col": 2 }, "26": { "line": 146, "col": 15 }, "27": { "line": 146, "col": 2 }, "28": { "line": 148, "col": 2 }, "29": { "line": 152, "col": 2 }, "30": { "line": 155, "col": 2 }, "31": { "line": 156, "col": 2 }, "33": { "line": 162, "col": 2 }, "34": { "line": 163, "col": 2 }, "35": { "line": 169, "col": 14 }, "36": { "line": 169, "col": 2 }, "37": { "line": 175, "col": 2 }, "39": { "line": 187, "col": 2 }, "40": { "line": 196, "col": 2 }, "3.0": { "line": 77, "col": 4 }, "4.0": { "line": 80, "col": 4 }, "6.0": { "line": 87, "col": 4 }, "6.1": { "line": 88, "col": 4 }, "11.0": { "line": 99, "col": 22 }, "11.2": { "line": 99, "col": 4 }, "11.3": { "line": 100, "col": 10 }, "11.4": { "line": 100, "col": 4 }, "11.5": { "line": 101, "col": 4 }, "11.6": { "line": 102, "col": 4 }, "23.0": { "line": 126, "col": 4 }, "23.1": { "line": 128, "col": 6 }, "23.2": { "line": 127, "col": 4 }, "23.3": { "line": 132, "col": 4 }, "23.4": { "line": 133, "col": 4 }, "23.5": { "line": 135, "col": 4 }, "31.0": { "line": 157, "col": 4 }, "34.0": { "line": 164, "col": 4 }, "37.0": { "line": 177, "col": 6 }, "37.1": { "line": 176, "col": 4 }, "37.2": { "line": 181, "col": 4 }, "39.0": { "line": 188, "col": 4 }, "39.1": { "line": 189, "col": 20 }, "39.2": { "line": 189, "col": 4 }, "39.3": { "line": 191, "col": 6 }, "39.4": { "line": 190, "col": 4 }, "40.0": { "line": 197, "col": 4 }, "40.1.0": { "line": 199, "col": 6 }, "40.1.1.0": { "line": 201, "col": 8 }, "40.1.1": { "line": 200, "col": 6 }, "40.1.2": { "line": 203, "col": 6 }, "40.1": { "line": 198, "col": 4 }, "40.2": { "line": 205, "col": 10 }, "40.3": { "line": 205, "col": 4 }, "40.5": { "line": 206, "col": 28 }, "40.6": { "line": 206, "col": 4 }, "40.7": { "line": 207, "col": 10 }, "40.8": { "line": 207, "col": 4 }, "40.9": { "line": 209, "col": 4 }, "40.10": { "line": 210, "col": 4 }, "40.11": { "line": 211, "col": 10 }, "40.12": { "line": 211, "col": 4 }, "40.13": { "line": 212, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:__block_1": {}, "dist/lib/agents/agency-agent/agent.agency:__block_2": { "40.13.0": { "line": 213, "col": 6 } } };
1683
- __registerModuleFingerprint("dist/lib/agents/agency-agent/agent.agency", "e3d680c4c0e63d334fea5de26f09958da25d6b813e8382b46e761c613b67028b", import.meta.url);
1680
+ __registerModuleFingerprint("dist/lib/agents/agency-agent/agent.agency", "b34d82660446614ec24362a0682b10bc70c7b302798ece7016ceab387819cefc", import.meta.url);
1684
1681
  export {
1685
1682
  __getCheckpoints,
1686
1683
  __invokeFunction,
@@ -76,8 +76,8 @@ const graph = __globalCtx.graph;
76
76
  function approve(value) {
77
77
  return { type: "approve", value };
78
78
  }
79
- function reject(value) {
80
- return { type: "reject", value };
79
+ function reject(reason) {
80
+ return { type: "reject", value: reason };
81
81
  }
82
82
  function propagate() {
83
83
  return { type: "propagate" };
@@ -176,7 +176,7 @@ const BrainContext = z.object({ "interactive": z.boolean(), "grounding": z.strin
176
176
  const AgentBrain = z.object({ "name": z.string(), "description": z.string(), "session": z.string(), "startTargets": z.array(z.string()), "init": z.string(), "runTurn": z.string() });
177
177
  var stdin_default = graph;
178
178
  const __sourceMap = {};
179
- __registerModuleFingerprint("dist/lib/agents/agency-agent/brains/brain.agency", "7ba76067983debee248c86b1b867d720994d01c83bed4f8889fcde947edfefce", import.meta.url);
179
+ __registerModuleFingerprint("dist/lib/agents/agency-agent/brains/brain.agency", "9dca0b935f7990aceeaf4506229ab0ebd6ac37ceba1adbf162c35d5fc132b454", import.meta.url);
180
180
  export {
181
181
  AgentBrain,
182
182
  BrainContext,
@@ -53,7 +53,7 @@ import {
53
53
  __registerGlobalsInit,
54
54
  __registerCallbacksInit,
55
55
  registerModuleFingerprint as __registerModuleFingerprint,
56
- failure,
56
+ runtimeFailure,
57
57
  isSuccess,
58
58
  isFailure,
59
59
  stampFailureBoundary,
@@ -121,8 +121,8 @@ const graph = __globalCtx.graph;
121
121
  function approve(value) {
122
122
  return { type: "approve", value };
123
123
  }
124
- function reject(value) {
125
- return { type: "reject", value };
124
+ function reject(reason) {
125
+ return { type: "reject", value: reason };
126
126
  }
127
127
  function propagate() {
128
128
  return { type: "propagate" };
@@ -475,15 +475,12 @@ async function __coordinatorInit_impl(context) {
475
475
  functionName: "coordinatorInit"
476
476
  });
477
477
  }
478
- return failure(
479
- __error instanceof Error ? __error.message : String(__error),
480
- {
481
- checkpoint: getRuntimeContext().ctx.getResultCheckpoint(),
482
- destructiveRan: __self.__destructiveRan,
483
- functionName: "coordinatorInit",
484
- args: __stack.args
485
- }
486
- );
478
+ return runtimeFailure(__error, {
479
+ checkpoint: getRuntimeContext().ctx.getResultCheckpoint(),
480
+ destructiveRan: __self.__destructiveRan,
481
+ functionName: "coordinatorInit",
482
+ args: __stack.args
483
+ });
487
484
  } finally {
488
485
  __stateStack()?.pop();
489
486
  if (__functionCompleted) {
@@ -787,15 +784,12 @@ async function __mainAgent_impl(prompt) {
787
784
  functionName: "mainAgent"
788
785
  });
789
786
  }
790
- return failure(
791
- __error instanceof Error ? __error.message : String(__error),
792
- {
793
- checkpoint: getRuntimeContext().ctx.getResultCheckpoint(),
794
- destructiveRan: __self.__destructiveRan,
795
- functionName: "mainAgent",
796
- args: __stack.args
797
- }
798
- );
787
+ return runtimeFailure(__error, {
788
+ checkpoint: getRuntimeContext().ctx.getResultCheckpoint(),
789
+ destructiveRan: __self.__destructiveRan,
790
+ functionName: "mainAgent",
791
+ args: __stack.args
792
+ });
799
793
  } finally {
800
794
  __stateStack()?.pop();
801
795
  if (__functionCompleted) {
@@ -938,15 +932,12 @@ async function __promptText_impl(prompt) {
938
932
  functionName: "promptText"
939
933
  });
940
934
  }
941
- return failure(
942
- __error instanceof Error ? __error.message : String(__error),
943
- {
944
- checkpoint: getRuntimeContext().ctx.getResultCheckpoint(),
945
- destructiveRan: __self.__destructiveRan,
946
- functionName: "promptText",
947
- args: __stack.args
948
- }
949
- );
935
+ return runtimeFailure(__error, {
936
+ checkpoint: getRuntimeContext().ctx.getResultCheckpoint(),
937
+ destructiveRan: __self.__destructiveRan,
938
+ functionName: "promptText",
939
+ args: __stack.args
940
+ });
950
941
  } finally {
951
942
  __stateStack()?.pop();
952
943
  if (__functionCompleted) {
@@ -1084,15 +1075,12 @@ async function __replyText_impl(name, result) {
1084
1075
  functionName: "replyText"
1085
1076
  });
1086
1077
  }
1087
- return failure(
1088
- __error instanceof Error ? __error.message : String(__error),
1089
- {
1090
- checkpoint: getRuntimeContext().ctx.getResultCheckpoint(),
1091
- destructiveRan: __self.__destructiveRan,
1092
- functionName: "replyText",
1093
- args: __stack.args
1094
- }
1095
- );
1078
+ return runtimeFailure(__error, {
1079
+ checkpoint: getRuntimeContext().ctx.getResultCheckpoint(),
1080
+ destructiveRan: __self.__destructiveRan,
1081
+ functionName: "replyText",
1082
+ args: __stack.args
1083
+ });
1096
1084
  } finally {
1097
1085
  __stateStack()?.pop();
1098
1086
  if (__functionCompleted) {
@@ -1128,7 +1116,7 @@ const replyText = __AgencyFunction.create({
1128
1116
  toolDefinition: {
1129
1117
  name: "replyText",
1130
1118
  description: "No description provided.",
1131
- schema: z.object({ "name": z.string(), "result": z.union([z.object({ __type: z.literal("resultType"), success: z.literal(true), value: z.string() }), z.object({ __type: z.literal("resultType"), success: z.literal(false), error: z.any() })]) })
1119
+ schema: z.object({ "name": z.string(), "result": z.union([z.object({ __type: z.literal("resultType"), success: z.literal(true), value: z.string() }), z.object({ __type: z.literal("resultType"), success: z.literal(false), error: z.string(), data: z.record(z.any()) })]) })
1132
1120
  },
1133
1121
  exported: false
1134
1122
  }, __toolRegistry);
@@ -1225,15 +1213,12 @@ async function __researchTurn_impl(userMsg) {
1225
1213
  functionName: "researchTurn"
1226
1214
  });
1227
1215
  }
1228
- return failure(
1229
- __error instanceof Error ? __error.message : String(__error),
1230
- {
1231
- checkpoint: getRuntimeContext().ctx.getResultCheckpoint(),
1232
- destructiveRan: __self.__destructiveRan,
1233
- functionName: "researchTurn",
1234
- args: __stack.args
1235
- }
1236
- );
1216
+ return runtimeFailure(__error, {
1217
+ checkpoint: getRuntimeContext().ctx.getResultCheckpoint(),
1218
+ destructiveRan: __self.__destructiveRan,
1219
+ functionName: "researchTurn",
1220
+ args: __stack.args
1221
+ });
1237
1222
  } finally {
1238
1223
  __stateStack()?.pop();
1239
1224
  if (__functionCompleted) {
@@ -1376,15 +1361,12 @@ async function __oracleTurn_impl(userMsg) {
1376
1361
  functionName: "oracleTurn"
1377
1362
  });
1378
1363
  }
1379
- return failure(
1380
- __error instanceof Error ? __error.message : String(__error),
1381
- {
1382
- checkpoint: getRuntimeContext().ctx.getResultCheckpoint(),
1383
- destructiveRan: __self.__destructiveRan,
1384
- functionName: "oracleTurn",
1385
- args: __stack.args
1386
- }
1387
- );
1364
+ return runtimeFailure(__error, {
1365
+ checkpoint: getRuntimeContext().ctx.getResultCheckpoint(),
1366
+ destructiveRan: __self.__destructiveRan,
1367
+ functionName: "oracleTurn",
1368
+ args: __stack.args
1369
+ });
1388
1370
  } finally {
1389
1371
  __stateStack()?.pop();
1390
1372
  if (__functionCompleted) {
@@ -1527,15 +1509,12 @@ async function __explorerTurn_impl(userMsg) {
1527
1509
  functionName: "explorerTurn"
1528
1510
  });
1529
1511
  }
1530
- return failure(
1531
- __error instanceof Error ? __error.message : String(__error),
1532
- {
1533
- checkpoint: getRuntimeContext().ctx.getResultCheckpoint(),
1534
- destructiveRan: __self.__destructiveRan,
1535
- functionName: "explorerTurn",
1536
- args: __stack.args
1537
- }
1538
- );
1512
+ return runtimeFailure(__error, {
1513
+ checkpoint: getRuntimeContext().ctx.getResultCheckpoint(),
1514
+ destructiveRan: __self.__destructiveRan,
1515
+ functionName: "explorerTurn",
1516
+ args: __stack.args
1517
+ });
1539
1518
  } finally {
1540
1519
  __stateStack()?.pop();
1541
1520
  if (__functionCompleted) {
@@ -1944,15 +1923,12 @@ async function __coordinatorRunTurn_impl(target, prompt) {
1944
1923
  functionName: "coordinatorRunTurn"
1945
1924
  });
1946
1925
  }
1947
- return failure(
1948
- __error instanceof Error ? __error.message : String(__error),
1949
- {
1950
- checkpoint: getRuntimeContext().ctx.getResultCheckpoint(),
1951
- destructiveRan: __self.__destructiveRan,
1952
- functionName: "coordinatorRunTurn",
1953
- args: __stack.args
1954
- }
1955
- );
1926
+ return runtimeFailure(__error, {
1927
+ checkpoint: getRuntimeContext().ctx.getResultCheckpoint(),
1928
+ destructiveRan: __self.__destructiveRan,
1929
+ functionName: "coordinatorRunTurn",
1930
+ args: __stack.args
1931
+ });
1956
1932
  } finally {
1957
1933
  __stateStack()?.pop();
1958
1934
  if (__functionCompleted) {
@@ -2067,15 +2043,12 @@ async function __coordinatorBrain_impl() {
2067
2043
  functionName: "coordinatorBrain"
2068
2044
  });
2069
2045
  }
2070
- return failure(
2071
- __error instanceof Error ? __error.message : String(__error),
2072
- {
2073
- checkpoint: getRuntimeContext().ctx.getResultCheckpoint(),
2074
- destructiveRan: __self.__destructiveRan,
2075
- functionName: "coordinatorBrain",
2076
- args: __stack.args
2077
- }
2078
- );
2046
+ return runtimeFailure(__error, {
2047
+ checkpoint: getRuntimeContext().ctx.getResultCheckpoint(),
2048
+ destructiveRan: __self.__destructiveRan,
2049
+ functionName: "coordinatorBrain",
2050
+ args: __stack.args
2051
+ });
2079
2052
  } finally {
2080
2053
  __stateStack()?.pop();
2081
2054
  if (__functionCompleted) {
@@ -2103,7 +2076,7 @@ const coordinatorBrain = __AgencyFunction.create({
2103
2076
  }, __toolRegistry);
2104
2077
  var stdin_default = graph;
2105
2078
  const __sourceMap = { "dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency:coordinatorInit": { "1": { "line": 56, "col": 6 }, "2": { "line": 56, "col": 2 }, "3": { "line": 62, "col": 6 }, "4": { "line": 62, "col": 2 }, "5": { "line": 68, "col": 2 }, "6": { "line": 69, "col": 2 }, "7": { "line": 72, "col": 2 }, "2.0": { "line": 58, "col": 6 }, "2.1": { "line": 57, "col": 4 }, "2.2": { "line": 60, "col": 4 }, "4.0": { "line": 64, "col": 6 }, "4.1": { "line": 63, "col": 4 }, "4.2": { "line": 66, "col": 4 } }, "dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency:mainAgent": { "2": { "line": 79, "col": 2 }, "3": { "line": 80, "col": 2 }, "4": { "line": 111, "col": 2 }, "3.0": { "line": 81, "col": 4 }, "3.1.1": { "line": 83, "col": 6 }, "3.1.2": { "line": 84, "col": 24 }, "3.1.3": { "line": 84, "col": 6 }, "3.1.4": { "line": 88, "col": 6 }, "3.1.5": { "line": 89, "col": 6 }, "3.1": { "line": 82, "col": 4 }, "3.3": { "line": 99, "col": 11 }, "3.4": { "line": 101, "col": 8 }, "3.5": { "line": 95, "col": 4 }, "3.6": { "line": 104, "col": 4 }, "3.7.0": { "line": 106, "col": 6 }, "3.7.1": { "line": 107, "col": 6 }, "3.7": { "line": 105, "col": 4 }, "3.8": { "line": 109, "col": 4 } }, "dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency:promptText": { "1": { "line": 117, "col": 9 }, "2": { "line": 117, "col": 9 }, "3": { "line": 117, "col": 2 }, "2.0": { "line": 117, "col": 9 }, "2.1": { "line": 118, "col": 20 }, "2.2": { "line": 118, "col": 20 }, "2.3": { "line": 117, "col": 9 } }, "dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency:replyText": { "1": { "line": 125, "col": 6 }, "2": { "line": 125, "col": 2 }, "3": { "line": 128, "col": 2 }, "2.0": { "line": 126, "col": 4 } }, "dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency:researchTurn": { "1": { "line": 132, "col": 37 }, "2": { "line": 132, "col": 2 } }, "dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency:oracleTurn": { "1": { "line": 140, "col": 2 }, "2": { "line": 141, "col": 2 }, "3": { "line": 144, "col": 2 }, "2.0": { "line": 142, "col": 36 }, "2.1": { "line": 142, "col": 4 } }, "dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency:explorerTurn": { "1": { "line": 148, "col": 2 }, "2": { "line": 149, "col": 2 }, "3": { "line": 152, "col": 2 }, "2.0": { "line": 150, "col": 38 }, "2.1": { "line": 150, "col": 4 } }, "dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency:coordinatorRunTurn": { "1": { "line": 159, "col": 9 }, "2": { "line": 159, "col": 2 }, "1.0": { "line": 160, "col": 24 }, "1.1": { "line": 160, "col": 14 }, "1.2": { "line": 160, "col": 14 }, "1.3": { "line": 161, "col": 31 }, "1.4": { "line": 161, "col": 18 }, "1.5": { "line": 161, "col": 18 }, "1.6": { "line": 162, "col": 27 }, "1.7": { "line": 162, "col": 16 }, "1.8": { "line": 162, "col": 16 }, "1.9": { "line": 163, "col": 31 }, "1.10": { "line": 163, "col": 18 }, "1.11": { "line": 163, "col": 18 }, "1.12": { "line": 164, "col": 28 }, "1.13": { "line": 164, "col": 16 }, "1.14": { "line": 164, "col": 16 }, "1.15": { "line": 165, "col": 30 }, "1.16": { "line": 165, "col": 17 }, "1.17": { "line": 165, "col": 17 }, "1.18": { "line": 166, "col": 30 }, "1.19": { "line": 166, "col": 17 }, "1.20": { "line": 166, "col": 17 }, "1.21": { "line": 167, "col": 9 }, "1.22": { "line": 167, "col": 9 } }, "dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency:coordinatorBrain": { "1": { "line": 172, "col": 2 } } };
2106
- __registerModuleFingerprint("dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency", "cd36a19aceea96dcdc72c74f3ea12a84c11f939155ddd06d8678f66a830a365f", import.meta.url);
2079
+ __registerModuleFingerprint("dist/lib/agents/agency-agent/brains/coordinator/coordinator.agency", "6898ad0d7f112a9c4b25c1cb2c377c389acb4a192388dba4526e85e789b9aeb2", import.meta.url);
2107
2080
  export {
2108
2081
  __getCheckpoints,
2109
2082
  __invokeFunction,
@@ -32,7 +32,7 @@ import {
32
32
  __registerGlobalsInit,
33
33
  __registerCallbacksInit,
34
34
  registerModuleFingerprint as __registerModuleFingerprint,
35
- failure,
35
+ runtimeFailure,
36
36
  isFailure,
37
37
  stampFailureBoundary,
38
38
  __nn,
@@ -94,8 +94,8 @@ const graph = __globalCtx.graph;
94
94
  function approve(value) {
95
95
  return { type: "approve", value };
96
96
  }
97
- function reject(value) {
98
- return { type: "reject", value };
97
+ function reject(reason) {
98
+ return { type: "reject", value: reason };
99
99
  }
100
100
  function propagate() {
101
101
  return { type: "propagate" };
@@ -324,15 +324,12 @@ async function __announce_impl(agentName, userMsg) {
324
324
  functionName: "announce"
325
325
  });
326
326
  }
327
- return failure(
328
- __error instanceof Error ? __error.message : String(__error),
329
- {
330
- checkpoint: getRuntimeContext().ctx.getResultCheckpoint(),
331
- destructiveRan: __self.__destructiveRan,
332
- functionName: "announce",
333
- args: __stack.args
334
- }
335
- );
327
+ return runtimeFailure(__error, {
328
+ checkpoint: getRuntimeContext().ctx.getResultCheckpoint(),
329
+ destructiveRan: __self.__destructiveRan,
330
+ functionName: "announce",
331
+ args: __stack.args
332
+ });
336
333
  } finally {
337
334
  __stateStack()?.pop();
338
335
  if (__functionCompleted) {
@@ -468,15 +465,12 @@ async function __stripControlChars_impl(text) {
468
465
  functionName: "stripControlChars"
469
466
  });
470
467
  }
471
- return failure(
472
- __error instanceof Error ? __error.message : String(__error),
473
- {
474
- checkpoint: getRuntimeContext().ctx.getResultCheckpoint(),
475
- destructiveRan: __self.__destructiveRan,
476
- functionName: "stripControlChars",
477
- args: __stack.args
478
- }
479
- );
468
+ return runtimeFailure(__error, {
469
+ checkpoint: getRuntimeContext().ctx.getResultCheckpoint(),
470
+ destructiveRan: __self.__destructiveRan,
471
+ functionName: "stripControlChars",
472
+ args: __stack.args
473
+ });
480
474
  } finally {
481
475
  __stateStack()?.pop();
482
476
  if (__functionCompleted) {
@@ -511,7 +505,7 @@ const stripControlChars = __AgencyFunction.create({
511
505
  }, __toolRegistry);
512
506
  var stdin_default = graph;
513
507
  const __sourceMap = { "dist/lib/agents/agency-agent/brains/coordinator/lib/announce.agency:announce": { "1": { "line": 11, "col": 31 }, "2": { "line": 11, "col": 2 }, "3": { "line": 12, "col": 2 }, "4": { "line": 15, "col": 8 }, "5": { "line": 15, "col": 2 }, "3.0": { "line": 13, "col": 11 }, "3.1": { "line": 13, "col": 4 } }, "dist/lib/agents/agency-agent/brains/coordinator/lib/announce.agency:stripControlChars": { "1": { "line": 21, "col": 2 }, "2": { "line": 22, "col": 20 }, "3": { "line": 22, "col": 2 }, "4": { "line": 27, "col": 2 }, "3.0.0": { "line": 24, "col": 6 }, "3.0": { "line": 23, "col": 4 } } };
514
- __registerModuleFingerprint("dist/lib/agents/agency-agent/brains/coordinator/lib/announce.agency", "9e49c274c1bb5075dac5f22307759a05a3d1ca56053f1e723a108ceb0ba612d6", import.meta.url);
508
+ __registerModuleFingerprint("dist/lib/agents/agency-agent/brains/coordinator/lib/announce.agency", "3c0fd0eedec77cd64736a9a6acf171b30556638693b7c1cd27269d7a73eefb89", import.meta.url);
515
509
  export {
516
510
  __getCheckpoints,
517
511
  __invokeFunction,
@@ -35,6 +35,7 @@ import {
35
35
  registerModuleFingerprint as __registerModuleFingerprint,
36
36
  success,
37
37
  failure,
38
+ runtimeFailure,
38
39
  isFailure,
39
40
  stampFailureBoundary,
40
41
  __eq,
@@ -95,8 +96,8 @@ const graph = __globalCtx.graph;
95
96
  function approve(value) {
96
97
  return { type: "approve", value };
97
98
  }
98
- function reject(value) {
99
- return { type: "reject", value };
99
+ function reject(reason) {
100
+ return { type: "reject", value: reason };
100
101
  }
101
102
  function propagate() {
102
103
  return { type: "propagate" };
@@ -284,15 +285,12 @@ async function __timeBudget_impl(maxSeconds, fallback) {
284
285
  functionName: "timeBudget"
285
286
  });
286
287
  }
287
- return failure(
288
- __error instanceof Error ? __error.message : String(__error),
289
- {
290
- checkpoint: getRuntimeContext().ctx.getResultCheckpoint(),
291
- destructiveRan: __self.__destructiveRan,
292
- functionName: "timeBudget",
293
- args: __stack.args
294
- }
295
- );
288
+ return runtimeFailure(__error, {
289
+ checkpoint: getRuntimeContext().ctx.getResultCheckpoint(),
290
+ destructiveRan: __self.__destructiveRan,
291
+ functionName: "timeBudget",
292
+ args: __stack.args
293
+ });
296
294
  } finally {
297
295
  __stateStack()?.pop();
298
296
  if (__functionCompleted) {
@@ -413,15 +411,12 @@ async function __costBudget_impl(maxDollars, fallback) {
413
411
  functionName: "costBudget"
414
412
  });
415
413
  }
416
- return failure(
417
- __error instanceof Error ? __error.message : String(__error),
418
- {
419
- checkpoint: getRuntimeContext().ctx.getResultCheckpoint(),
420
- destructiveRan: __self.__destructiveRan,
421
- functionName: "costBudget",
422
- args: __stack.args
423
- }
424
- );
414
+ return runtimeFailure(__error, {
415
+ checkpoint: getRuntimeContext().ctx.getResultCheckpoint(),
416
+ destructiveRan: __self.__destructiveRan,
417
+ functionName: "costBudget",
418
+ args: __stack.args
419
+ });
425
420
  } finally {
426
421
  __stateStack()?.pop();
427
422
  if (__functionCompleted) {
@@ -563,15 +558,12 @@ async function __describeTrip_impl(trip) {
563
558
  functionName: "describeTrip"
564
559
  });
565
560
  }
566
- return failure(
567
- __error instanceof Error ? __error.message : String(__error),
568
- {
569
- checkpoint: getRuntimeContext().ctx.getResultCheckpoint(),
570
- destructiveRan: __self.__destructiveRan,
571
- functionName: "describeTrip",
572
- args: __stack.args
573
- }
574
- );
561
+ return runtimeFailure(__error, {
562
+ checkpoint: getRuntimeContext().ctx.getResultCheckpoint(),
563
+ destructiveRan: __self.__destructiveRan,
564
+ functionName: "describeTrip",
565
+ args: __stack.args
566
+ });
575
567
  } finally {
576
568
  __stateStack()?.pop();
577
569
  if (__functionCompleted) {
@@ -716,7 +708,7 @@ async function __budgeted_impl(label, block) {
716
708
  });
717
709
  await runner2.step(1, async (runner3) => {
718
710
  __functionCompleted = true;
719
- runner3.halt(failure(__stack.locals.__hoist_0, { checkpoint: getRuntimeContext().ctx.getResultCheckpoint(), functionName: "budgeted", args: __stack.args }));
711
+ runner3.halt(failure(__stack.locals.__hoist_0, null, { checkpoint: getRuntimeContext().ctx.getResultCheckpoint(), functionName: "budgeted", args: __stack.args }));
720
712
  return;
721
713
  });
722
714
  }
@@ -740,7 +732,7 @@ async function __budgeted_impl(label, block) {
740
732
  body: async (runner2) => {
741
733
  await runner2.step(0, async (runner3) => {
742
734
  __functionCompleted = true;
743
- runner3.halt(failure(`${__stack.locals.result.error}`, { checkpoint: getRuntimeContext().ctx.getResultCheckpoint(), functionName: "budgeted", args: __stack.args }));
735
+ runner3.halt(failure(`${__stack.locals.result.error}`, null, { checkpoint: getRuntimeContext().ctx.getResultCheckpoint(), functionName: "budgeted", args: __stack.args }));
744
736
  return;
745
737
  });
746
738
  }
@@ -752,7 +744,7 @@ async function __budgeted_impl(label, block) {
752
744
  body: async (runner2) => {
753
745
  await runner2.step(0, async (runner3) => {
754
746
  __functionCompleted = true;
755
- runner3.halt(failure(`it returned no answer`, { checkpoint: getRuntimeContext().ctx.getResultCheckpoint(), functionName: "budgeted", args: __stack.args }));
747
+ runner3.halt(failure(`it returned no answer`, null, { checkpoint: getRuntimeContext().ctx.getResultCheckpoint(), functionName: "budgeted", args: __stack.args }));
756
748
  return;
757
749
  });
758
750
  }
@@ -789,15 +781,12 @@ async function __budgeted_impl(label, block) {
789
781
  functionName: "budgeted"
790
782
  });
791
783
  }
792
- return failure(
793
- __error instanceof Error ? __error.message : String(__error),
794
- {
795
- checkpoint: getRuntimeContext().ctx.getResultCheckpoint(),
796
- destructiveRan: __self.__destructiveRan,
797
- functionName: "budgeted",
798
- args: __stack.args
799
- }
800
- );
784
+ return runtimeFailure(__error, {
785
+ checkpoint: getRuntimeContext().ctx.getResultCheckpoint(),
786
+ destructiveRan: __self.__destructiveRan,
787
+ functionName: "budgeted",
788
+ args: __stack.args
789
+ });
801
790
  } finally {
802
791
  __stateStack()?.pop();
803
792
  if (__functionCompleted) {
@@ -846,7 +835,7 @@ const budgeted = __AgencyFunction.create({
846
835
  }, __toolRegistry);
847
836
  var stdin_default = graph;
848
837
  const __sourceMap = { "dist/lib/agents/agency-agent/brains/coordinator/lib/budgets.agency:timeBudget": { "1": { "line": 9, "col": 2 }, "2": { "line": 12, "col": 2 }, "1.0": { "line": 10, "col": 4 } }, "dist/lib/agents/agency-agent/brains/coordinator/lib/budgets.agency:costBudget": { "1": { "line": 17, "col": 2 } }, "dist/lib/agents/agency-agent/brains/coordinator/lib/budgets.agency:describeTrip": { "1": { "line": 21, "col": 2 }, "2": { "line": 24, "col": 2 }, "1.0": { "line": 22, "col": 33 }, "1.1": { "line": 22, "col": 4 } }, "dist/lib/agents/agency-agent/brains/coordinator/lib/budgets.agency:budgeted": { "1": { "line": 38, "col": 2 }, "2": { "line": 39, "col": 2 }, "3": { "line": 40, "col": 2 }, "4": { "line": 49, "col": 2 }, "5": { "line": 52, "col": 6 }, "6": { "line": 52, "col": 2 }, "7": { "line": 55, "col": 2 }, "8": { "line": 58, "col": 2 }, "3.0": { "line": 41, "col": 4 }, "4.0": { "line": 50, "col": 19 }, "4.1": { "line": 50, "col": 4 }, "6.0": { "line": 53, "col": 4 }, "7.0": { "line": 56, "col": 4 } } };
849
- __registerModuleFingerprint("dist/lib/agents/agency-agent/brains/coordinator/lib/budgets.agency", "87eebf3b56d4eab390b34b92fd9304e23ea125f84b4cdb5c93212f4e82a5b755", import.meta.url);
838
+ __registerModuleFingerprint("dist/lib/agents/agency-agent/brains/coordinator/lib/budgets.agency", "0bbdccc56ac73aa9ed4cc214ab23f89a3d6675d5eefdea8c754a79931d1179c0", import.meta.url);
850
839
  export {
851
840
  __getCheckpoints,
852
841
  __invokeFunction,
@@ -36,7 +36,7 @@ import {
36
36
  __registerGlobalsInit,
37
37
  __registerCallbacksInit,
38
38
  registerModuleFingerprint as __registerModuleFingerprint,
39
- failure,
39
+ runtimeFailure,
40
40
  __eq,
41
41
  AgencyFunction as __AgencyFunction,
42
42
  __call,
@@ -95,8 +95,8 @@ const graph = __globalCtx.graph;
95
95
  function approve(value) {
96
96
  return { type: "approve", value };
97
97
  }
98
- function reject(value) {
99
- return { type: "reject", value };
98
+ function reject(reason) {
99
+ return { type: "reject", value: reason };
100
100
  }
101
101
  function propagate() {
102
102
  return { type: "propagate" };
@@ -299,7 +299,7 @@ graph.node("main", async (__state) => {
299
299
  }
300
300
  return {
301
301
  messages: __threads(),
302
- data: failure(__error instanceof Error ? __error.message : String(__error), { functionName: "main" })
302
+ data: runtimeFailure(__error, { functionName: "main" })
303
303
  };
304
304
  }
305
305
  });
@@ -454,7 +454,7 @@ graph.node("categorize", async (__state) => {
454
454
  }
455
455
  return {
456
456
  messages: __threads(),
457
- data: failure(__error instanceof Error ? __error.message : String(__error), { functionName: "categorize" })
457
+ data: runtimeFailure(__error, { functionName: "categorize" })
458
458
  };
459
459
  }
460
460
  });
@@ -538,7 +538,7 @@ graph.node("scrapeRecipe", async (__state) => {
538
538
  }
539
539
  return {
540
540
  messages: __threads(),
541
- data: failure(__error instanceof Error ? __error.message : String(__error), { functionName: "scrapeRecipe" })
541
+ data: runtimeFailure(__error, { functionName: "scrapeRecipe" })
542
542
  };
543
543
  }
544
544
  });
@@ -622,7 +622,7 @@ graph.node("createIngredients", async (__state) => {
622
622
  }
623
623
  return {
624
624
  messages: __threads(),
625
- data: failure(__error instanceof Error ? __error.message : String(__error), { functionName: "createIngredients" })
625
+ data: runtimeFailure(__error, { functionName: "createIngredients" })
626
626
  };
627
627
  }
628
628
  });
@@ -706,7 +706,7 @@ graph.node("createMeals", async (__state) => {
706
706
  }
707
707
  return {
708
708
  messages: __threads(),
709
- data: failure(__error instanceof Error ? __error.message : String(__error), { functionName: "createMeals" })
709
+ data: runtimeFailure(__error, { functionName: "createMeals" })
710
710
  };
711
711
  }
712
712
  });
@@ -811,7 +811,7 @@ Agent crashed: ${__error.message}`);
811
811
  }
812
812
  var stdin_default = graph;
813
813
  const __sourceMap = { "dist/lib/agents/agency-agent/brains/coordinator/prompts/codeSample.agency:main": { "1": { "line": 1, "col": 2 }, "2": { "line": 2, "col": 2 }, "3": { "line": 3, "col": 2 } }, "dist/lib/agents/agency-agent/brains/coordinator/prompts/codeSample.agency:categorize": { "1": { "line": 10, "col": 2 }, "2": { "line": 18, "col": 2 }, "3": { "line": 20, "col": 2 }, "4": { "line": 23, "col": 2 }, "5": { "line": 26, "col": 2 }, "3.0": { "line": 21, "col": 4 }, "4.0": { "line": 24, "col": 4 }, "5.0": { "line": 27, "col": 4 } }, "dist/lib/agents/agency-agent/brains/coordinator/prompts/codeSample.agency:scrapeRecipe": { "1": { "line": 32, "col": 2 } }, "dist/lib/agents/agency-agent/brains/coordinator/prompts/codeSample.agency:createIngredients": { "1": { "line": 37, "col": 2 } }, "dist/lib/agents/agency-agent/brains/coordinator/prompts/codeSample.agency:createMeals": { "1": { "line": 42, "col": 2 } } };
814
- __registerModuleFingerprint("dist/lib/agents/agency-agent/brains/coordinator/prompts/codeSample.agency", "d97878a147477e99e5e0c428b27b7b48cf121e5ab2fa68d885fda1cf6bd7c42c", import.meta.url);
814
+ __registerModuleFingerprint("dist/lib/agents/agency-agent/brains/coordinator/prompts/codeSample.agency", "75c56428dd9516bf01a33c05ed7ebd04a0dc32d2a5da38050a87bcf83ca3788b", import.meta.url);
815
815
  export {
816
816
  __categorizeNodeParams,
817
817
  __createIngredientsNodeParams,