agency-lang 0.6.0 → 0.6.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 (169) hide show
  1. package/dist/lib/agents/agency-agent/agent.agency +24 -3
  2. package/dist/lib/agents/agency-agent/agent.js +111 -39
  3. package/dist/lib/agents/agency-agent/images/images.js +1 -1
  4. package/dist/lib/agents/agency-agent/lib/config.js +1 -1
  5. package/dist/lib/agents/agency-agent/lib/defaultPolicy.js +1 -1
  6. package/dist/lib/agents/agency-agent/lib/utils.js +1 -1
  7. package/dist/lib/agents/agency-agent/prompts/codeSample.js +4 -2
  8. package/dist/lib/agents/agency-agent/shared.js +1 -1
  9. package/dist/lib/agents/agency-agent/subagents/code.js +11 -11
  10. package/dist/lib/agents/agency-agent/subagents/explorer.js +5 -5
  11. package/dist/lib/agents/agency-agent/subagents/oracle.js +6 -6
  12. package/dist/lib/agents/agency-agent/subagents/research.js +8 -8
  13. package/dist/lib/agents/agency-agent/subagents/review.js +1 -3
  14. package/dist/lib/agents/agency-agent/tests/agentTurn.js +1 -1
  15. package/dist/lib/agents/agency-agent/tests/execPolicy.js +6 -6
  16. package/dist/lib/agents/agency-agent/tests/toolWiring.js +5 -5
  17. package/dist/lib/agents/docs/cli/cli/optimize.md +195 -72
  18. package/dist/lib/agents/docs/cli/optimize.md +195 -72
  19. package/dist/lib/agents/docs/guide/guide/observability.md +6 -0
  20. package/dist/lib/agents/docs/guide/observability.md +6 -0
  21. package/dist/lib/agents/eval/goalJudge.js +4 -2
  22. package/dist/lib/agents/eval/judge.js +1 -1
  23. package/dist/lib/agents/eval/judgePairwise.js +1 -1
  24. package/dist/lib/agents/optimize/gepaReflect.js +1 -1
  25. package/dist/lib/agents/optimize/mutatePrompt.js +1 -1
  26. package/dist/lib/agents/policy/agent.js +6 -5
  27. package/dist/lib/agents/review/agent.js +4 -3
  28. package/dist/lib/backends/typescriptBuilder.d.ts +1 -0
  29. package/dist/lib/backends/typescriptBuilder.js +15 -2
  30. package/dist/lib/cli/serve.js +16 -7
  31. package/dist/lib/logsViewer/conversation.js +4 -1
  32. package/dist/lib/logsViewer/conversation.test.js +18 -0
  33. package/dist/lib/logsViewer/follow.js +16 -2
  34. package/dist/lib/logsViewer/follow.test.js +31 -0
  35. package/dist/lib/logsViewer/help.js +2 -1
  36. package/dist/lib/logsViewer/input.js +42 -4
  37. package/dist/lib/logsViewer/input.test.js +51 -18
  38. package/dist/lib/logsViewer/render.d.ts +1 -0
  39. package/dist/lib/logsViewer/render.e2e.test.d.ts +1 -0
  40. package/dist/lib/logsViewer/render.e2e.test.js +156 -0
  41. package/dist/lib/logsViewer/render.flatten.test.d.ts +1 -0
  42. package/dist/lib/logsViewer/render.flatten.test.js +240 -0
  43. package/dist/lib/logsViewer/render.js +112 -33
  44. package/dist/lib/logsViewer/render.test.js +38 -0
  45. package/dist/lib/logsViewer/search.js +41 -12
  46. package/dist/lib/logsViewer/search.test.js +84 -0
  47. package/dist/lib/logsViewer/summary.js +134 -5
  48. package/dist/lib/logsViewer/summary.test.js +151 -0
  49. package/dist/lib/logsViewer/tree.js +31 -31
  50. package/dist/lib/logsViewer/tree.test.js +47 -17
  51. package/dist/lib/runtime/errors.d.ts +60 -1
  52. package/dist/lib/runtime/errors.js +46 -1
  53. package/dist/lib/runtime/errors.test.js +70 -1
  54. package/dist/lib/runtime/guard.d.ts +3 -0
  55. package/dist/lib/runtime/guard.js +39 -1
  56. package/dist/lib/runtime/guard.test.js +18 -0
  57. package/dist/lib/runtime/index.d.ts +1 -1
  58. package/dist/lib/runtime/index.js +1 -1
  59. package/dist/lib/runtime/interrupts.d.ts +15 -1
  60. package/dist/lib/runtime/interrupts.js +25 -0
  61. package/dist/lib/runtime/interrupts.test.js +55 -2
  62. package/dist/lib/runtime/prompt.js +46 -48
  63. package/dist/lib/runtime/promptRunner.d.ts +1 -1
  64. package/dist/lib/runtime/promptRunner.js +11 -0
  65. package/dist/lib/runtime/result.js +43 -17
  66. package/dist/lib/runtime/result.test.js +65 -1
  67. package/dist/lib/runtime/runBatch.d.ts +4 -2
  68. package/dist/lib/runtime/runBatch.js +3 -3
  69. package/dist/lib/runtime/runBatch.test.js +40 -0
  70. package/dist/lib/runtime/runner.d.ts +8 -0
  71. package/dist/lib/runtime/runner.js +50 -25
  72. package/dist/lib/runtime/runner.test.js +69 -2
  73. package/dist/lib/runtime/state/context.d.ts +10 -1
  74. package/dist/lib/runtime/state/context.js +13 -4
  75. package/dist/lib/runtime/state/globalStore.js +6 -3
  76. package/dist/lib/runtime/state/stateStack.d.ts +16 -0
  77. package/dist/lib/runtime/state/stateStack.js +33 -0
  78. package/dist/lib/runtime/utils.d.ts +14 -0
  79. package/dist/lib/runtime/utils.js +36 -5
  80. package/dist/lib/runtime/utils.test.js +60 -1
  81. package/dist/lib/serve/http/adapter.js +50 -0
  82. package/dist/lib/serve/http/adapter.test.js +33 -0
  83. package/dist/lib/serve/mcp/adapter.d.ts +7 -1
  84. package/dist/lib/serve/mcp/adapter.js +52 -6
  85. package/dist/lib/serve/mcp/adapter.test.js +36 -1
  86. package/dist/lib/serve/mcp/httpTransport.d.ts +5 -0
  87. package/dist/lib/serve/mcp/httpTransport.js +2 -0
  88. package/dist/lib/statelogClient.d.ts +5 -1
  89. package/dist/lib/statelogClient.js +2 -1
  90. package/dist/lib/stdlib/abortable.js +20 -9
  91. package/dist/lib/stdlib/cli.d.ts +17 -0
  92. package/dist/lib/stdlib/cli.js +60 -20
  93. package/dist/lib/stdlib/thread.d.ts +12 -0
  94. package/dist/lib/stdlib/thread.js +15 -0
  95. package/dist/lib/templates/backends/typescriptGenerator/imports.d.ts +1 -1
  96. package/dist/lib/templates/backends/typescriptGenerator/imports.js +1 -1
  97. package/dist/lib/templates/cli/standaloneMcp.d.ts +1 -1
  98. package/dist/lib/templates/cli/standaloneMcp.js +5 -4
  99. package/dist/lib/templates/cli/standaloneMcpHttp.d.ts +1 -1
  100. package/dist/lib/templates/cli/standaloneMcpHttp.js +5 -3
  101. package/dist/scripts/agency.js +13 -1
  102. package/dist/scripts/agency.test.js +13 -0
  103. package/package.json +1 -1
  104. package/stdlib/agency/eval.js +1 -1
  105. package/stdlib/agency.agency +10 -10
  106. package/stdlib/agency.js +11 -11
  107. package/stdlib/agent.js +1 -1
  108. package/stdlib/args.js +1 -1
  109. package/stdlib/array.js +1 -1
  110. package/stdlib/browser.js +1 -1
  111. package/stdlib/calendar.js +1 -1
  112. package/stdlib/chart.js +1 -1
  113. package/stdlib/cli.agency +2 -2
  114. package/stdlib/cli.js +3 -4
  115. package/stdlib/clipboard.agency +1 -1
  116. package/stdlib/clipboard.js +2 -3
  117. package/stdlib/concurrency.js +1 -1
  118. package/stdlib/date.js +1 -1
  119. package/stdlib/email.js +1 -1
  120. package/stdlib/fs.js +1 -1
  121. package/stdlib/http.agency +3 -3
  122. package/stdlib/http.js +4 -4
  123. package/stdlib/imessage.js +1 -1
  124. package/stdlib/index.agency +13 -3
  125. package/stdlib/index.js +5 -5
  126. package/stdlib/keyring.agency +1 -1
  127. package/stdlib/keyring.js +2 -2
  128. package/stdlib/layout.agency +3 -3
  129. package/stdlib/layout.js +4 -4
  130. package/stdlib/llm.js +1 -1
  131. package/stdlib/markdown.js +1 -1
  132. package/stdlib/math.js +1 -1
  133. package/stdlib/memory.agency +2 -2
  134. package/stdlib/memory.js +3 -5
  135. package/stdlib/oauth.js +1 -1
  136. package/stdlib/object.js +1 -1
  137. package/stdlib/path.js +1 -1
  138. package/stdlib/policy.js +10 -19
  139. package/stdlib/schemas.js +1 -1
  140. package/stdlib/search.js +1 -1
  141. package/stdlib/shell.agency +3 -3
  142. package/stdlib/shell.js +4 -4
  143. package/stdlib/skills.js +1 -1
  144. package/stdlib/sms.js +1 -1
  145. package/stdlib/speech.js +1 -1
  146. package/stdlib/statelog.agency +4 -4
  147. package/stdlib/statelog.js +5 -9
  148. package/stdlib/strategy.js +1 -1
  149. package/stdlib/syntax.agency +1 -1
  150. package/stdlib/syntax.js +2 -3
  151. package/stdlib/system.js +1 -1
  152. package/stdlib/table.agency +1 -1
  153. package/stdlib/table.js +2 -2
  154. package/stdlib/thread.agency +24 -0
  155. package/stdlib/thread.js +125 -3
  156. package/stdlib/threads.agency +1 -1
  157. package/stdlib/threads.js +2 -2
  158. package/stdlib/types.js +1 -1
  159. package/stdlib/ui.agency +6 -6
  160. package/stdlib/ui.js +7 -7
  161. package/stdlib/validators.agency +11 -11
  162. package/stdlib/validators.js +12 -23
  163. package/stdlib/weather.js +1 -1
  164. package/stdlib/wikipedia.js +1 -1
  165. package/dist/lib/agents/agency-agent/code.js +0 -532
  166. package/dist/lib/agents/agency-agent/research.js +0 -311
  167. package/dist/lib/agents/agency-agent/toolWiring.js +0 -696
  168. package/dist/lib/agents/gepaReflect.js +0 -316
  169. package/dist/lib/agents/mutatePrompt.js +0 -301
@@ -15,7 +15,7 @@ import { exists } from "std::shell"
15
15
  import { commandsDir, expandSlash } from "std::skills"
16
16
  import { highlight } from "std::syntax"
17
17
  import { cwd, env, isTTY, readStdin, setTitle } from "std::system"
18
- import { getCost, getTokens, systemMessage } from "std::thread"
18
+ import { getCost, getModelCosts, systemMessage } from "std::thread"
19
19
  import { chooseOption, ChoiceItem } from "std::ui"
20
20
 
21
21
  import { figs, title } from "./images/images.agency"
@@ -232,8 +232,29 @@ def _runTurn(msg: string): boolean {
232
232
  return true
233
233
  }
234
234
  if (trimmed == "/cost") {
235
- pushMessage("Cost: $${getCost().toFixed(4)}")
236
- pushMessage("Tokens: ${getTokens()}")
235
+ // Derive BOTH the header total and the per-model breakdown from the
236
+ // same process-wide accumulator (getModelCosts), so the `Cost:` /
237
+ // `Tokens:` lines and the rows below them can never visibly disagree.
238
+ // (getCost()/getTokens() read the per-branch accumulator, a different
239
+ // scope — adjacent in the output, they could in principle diverge.)
240
+ // Rows are sorted by cost descending by getModelCosts(); a subagent
241
+ // on a pricier model (e.g. the oracle on opus-4.8) shows up here.
242
+ const byModel = getModelCosts()
243
+ let totalCost = 0.0
244
+ let totalTokens = 0
245
+ for (m in byModel) {
246
+ totalCost = totalCost + m.cost
247
+ totalTokens = totalTokens + m.inputTokens + m.outputTokens
248
+ }
249
+ pushMessage("Cost: $${totalCost.toFixed(4)}")
250
+ pushMessage("Tokens: ${totalTokens}")
251
+ if (byModel.length > 0) {
252
+ pushMessage("")
253
+ pushMessage("By model:")
254
+ for (m in byModel) {
255
+ pushMessage(" ${m.model} ↑${m.inputTokens} ↓${m.outputTokens} $${m.cost.toFixed(4)}")
256
+ }
257
+ }
237
258
  return true
238
259
  }
239
260
  // Hand the message to the agent. `agentReply` does the slash-command
@@ -11,7 +11,7 @@ import { exists } from "agency-lang/stdlib/shell.js";
11
11
  import { commandsDir, expandSlash } from "agency-lang/stdlib/skills.js";
12
12
  import { highlight } from "agency-lang/stdlib/syntax.js";
13
13
  import { cwd, env, isTTY, readStdin, setTitle } from "agency-lang/stdlib/system.js";
14
- import { getCost, getTokens, systemMessage } from "agency-lang/stdlib/thread.js";
14
+ import { getCost, getModelCosts, systemMessage } from "agency-lang/stdlib/thread.js";
15
15
  import { chooseOption, ChoiceItem } from "agency-lang/stdlib/ui.js";
16
16
  import { figs, title } from "./images/images.js";
17
17
  import { POLICY_PATH, HISTORY_PATH, ALWAYS_FIELDS } from "./lib/config.js";
@@ -44,6 +44,7 @@ import {
44
44
  interrupt,
45
45
  isInterrupt,
46
46
  hasInterrupts,
47
+ reportUnhandledInterrupts,
47
48
  isDebugger,
48
49
  respondToInterrupts as _respondToInterrupts,
49
50
  rewindFrom as _rewindFrom,
@@ -81,7 +82,7 @@ const __globalCtx = new RuntimeContext({
81
82
  projectId: "agency-lang",
82
83
  debugMode: false,
83
84
  observability: true,
84
- logFile: "statelog.log"
85
+ logFile: "log.jsonl"
85
86
  },
86
87
  smoltalkDefaults: {
87
88
  openAiApiKey: __process.env["OPENAI_API_KEY"] || "",
@@ -191,7 +192,7 @@ __registerTool(isTTY);
191
192
  __registerTool(readStdin);
192
193
  __registerTool(setTitle);
193
194
  __registerTool(getCost);
194
- __registerTool(getTokens);
195
+ __registerTool(getModelCosts);
195
196
  __registerTool(systemMessage);
196
197
  __registerTool(chooseOption);
197
198
  __registerTool(ChoiceItem);
@@ -397,31 +398,31 @@ unless the user has clearly asked for an action ("do X", "fix Y",
397
398
  "build Z"). If the user is exploring or thinking out loud, think
398
399
  with them \u2014 don't sprint to implementation.
399
400
  `);
400
- mainAgentTools = __deepFreeze([await __callMethod(__readStatic(researchAgent, "researchAgent", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/subagents/research.agency"), "partial", {
401
+ mainAgentTools = __deepFreeze([await __callMethod(__readStatic(researchAgent, "researchAgent", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/subagents/research.agency"), "partial", {
401
402
  type: "named",
402
403
  positionalArgs: [],
403
404
  namedArgs: {
404
405
  allowHandoff: false
405
406
  }
406
- }), await __callMethod(__readStatic(codeAgent, "codeAgent", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/subagents/code.agency"), "partial", {
407
+ }), await __callMethod(__readStatic(codeAgent, "codeAgent", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/subagents/code.agency"), "partial", {
407
408
  type: "named",
408
409
  positionalArgs: [],
409
410
  namedArgs: {
410
411
  allowHandoff: false
411
412
  }
412
- }), await __callMethod(__readStatic(reviewAgent, "reviewAgent", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/subagents/review.agency"), "partial", {
413
+ }), await __callMethod(__readStatic(reviewAgent, "reviewAgent", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/subagents/review.agency"), "partial", {
413
414
  type: "named",
414
415
  positionalArgs: [],
415
416
  namedArgs: {
416
417
  allowHandoff: false
417
418
  }
418
- }), await __callMethod(__readStatic(oracleAgent, "oracleAgent", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/subagents/oracle.agency"), "partial", {
419
+ }), await __callMethod(__readStatic(oracleAgent, "oracleAgent", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/subagents/oracle.agency"), "partial", {
419
420
  type: "named",
420
421
  positionalArgs: [],
421
422
  namedArgs: {
422
423
  allowHandoff: false
423
424
  }
424
- }), await __callMethod(__readStatic(explorerAgent, "explorerAgent", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/subagents/explorer.agency"), "partial", {
425
+ }), await __callMethod(__readStatic(explorerAgent, "explorerAgent", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/subagents/explorer.agency"), "partial", {
425
426
  type: "named",
426
427
  positionalArgs: [],
427
428
  namedArgs: {
@@ -1443,7 +1444,6 @@ async function __loadAgentsMd_impl(dir) {
1443
1444
  ]);
1444
1445
  await runner.handle(2, async (__data) => approve(), async (runner2) => {
1445
1446
  await runner2.step(0, async (runner3) => {
1446
- __self.__retryable = false;
1447
1447
  __stack.locals.result = await __call(read, {
1448
1448
  type: "positional",
1449
1449
  args: [`AGENTS.md`, __stack.args.dir]
@@ -1455,10 +1455,7 @@ async function __loadAgentsMd_impl(dir) {
1455
1455
  }
1456
1456
  });
1457
1457
  });
1458
- await runner.step(3, async (runner2) => {
1459
- __self.__retryable = false;
1460
- });
1461
- await runner.ifElse(4, [
1458
+ await runner.ifElse(3, [
1462
1459
  {
1463
1460
  condition: async () => await isFailure(__stack.locals.result),
1464
1461
  body: async (runner2) => {
@@ -1470,7 +1467,7 @@ async function __loadAgentsMd_impl(dir) {
1470
1467
  }
1471
1468
  }
1472
1469
  ]);
1473
- await runner.step(5, async (runner2) => {
1470
+ await runner.step(4, async (runner2) => {
1474
1471
  __functionCompleted = true;
1475
1472
  runner2.halt(`
1476
1473
 
@@ -1946,13 +1943,37 @@ async function ___runTurn_impl(msg) {
1946
1943
  condition: async () => __stack.locals.trimmed === `/cost`,
1947
1944
  body: async (runner2) => {
1948
1945
  await runner2.step(0, async (runner3) => {
1946
+ });
1947
+ await runner2.step(1, async (runner3) => {
1948
+ __stack.locals.byModel = await __call(getModelCosts, {
1949
+ type: "positional",
1950
+ args: []
1951
+ });
1952
+ if (hasInterrupts(__stack.locals.byModel)) {
1953
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
1954
+ runner3.halt(__stack.locals.byModel);
1955
+ return;
1956
+ }
1957
+ });
1958
+ await runner2.step(2, async (runner3) => {
1959
+ __stack.locals.totalCost = 0;
1960
+ });
1961
+ await runner2.step(3, async (runner3) => {
1962
+ __stack.locals.totalTokens = 0;
1963
+ });
1964
+ await runner2.loop(4, __stack.locals.byModel, async (m, _, runner3) => {
1965
+ await runner3.step(0, async (runner4) => {
1966
+ __stack.locals.totalCost = __stack.locals.totalCost + m.cost;
1967
+ });
1968
+ await runner3.step(1, async (runner4) => {
1969
+ __stack.locals.totalTokens = __stack.locals.totalTokens + m.inputTokens + m.outputTokens;
1970
+ });
1971
+ });
1972
+ await runner2.step(5, async (runner3) => {
1949
1973
  __self.__retryable = false;
1950
1974
  const __funcResult = await __call(pushMessage, {
1951
1975
  type: "positional",
1952
- args: [`Cost: $${await __callMethod(await await __call(getCost, {
1953
- type: "positional",
1954
- args: []
1955
- }), "toFixed", {
1976
+ args: [`Cost: $${await __callMethod(__stack.locals.totalCost, "toFixed", {
1956
1977
  type: "positional",
1957
1978
  args: [4]
1958
1979
  })}`]
@@ -1963,14 +1984,11 @@ async function ___runTurn_impl(msg) {
1963
1984
  return;
1964
1985
  }
1965
1986
  });
1966
- await runner2.step(1, async (runner3) => {
1987
+ await runner2.step(6, async (runner3) => {
1967
1988
  __self.__retryable = false;
1968
1989
  const __funcResult = await __call(pushMessage, {
1969
1990
  type: "positional",
1970
- args: [`Tokens: ${await __call(getTokens, {
1971
- type: "positional",
1972
- args: []
1973
- })}`]
1991
+ args: [`Tokens: ${__stack.locals.totalTokens}`]
1974
1992
  });
1975
1993
  if (hasInterrupts(__funcResult)) {
1976
1994
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
@@ -1978,7 +1996,61 @@ async function ___runTurn_impl(msg) {
1978
1996
  return;
1979
1997
  }
1980
1998
  });
1981
- await runner2.step(2, async (runner3) => {
1999
+ await runner2.ifElse(7, [
2000
+ {
2001
+ condition: async () => __stack.locals.byModel.length > 0,
2002
+ body: async (runner3) => {
2003
+ await runner3.step(0, async (runner4) => {
2004
+ __self.__retryable = false;
2005
+ const __funcResult = await __call(pushMessage, {
2006
+ type: "positional",
2007
+ args: [``]
2008
+ });
2009
+ if (hasInterrupts(__funcResult)) {
2010
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
2011
+ runner4.halt(__funcResult);
2012
+ return;
2013
+ }
2014
+ });
2015
+ await runner3.step(1, async (runner4) => {
2016
+ __self.__retryable = false;
2017
+ const __funcResult = await __call(pushMessage, {
2018
+ type: "positional",
2019
+ args: [`By model:`]
2020
+ });
2021
+ if (hasInterrupts(__funcResult)) {
2022
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
2023
+ runner4.halt(__funcResult);
2024
+ return;
2025
+ }
2026
+ });
2027
+ await runner3.loop(2, __stack.locals.byModel, async (m, _, runner4) => {
2028
+ await runner4.step(0, async (runner5) => {
2029
+ __self.__retryable = false;
2030
+ const __funcResult = await __call(pushMessage, {
2031
+ type: "positional",
2032
+ args: [` ${m.model} \u2191${m.inputTokens} \u2193${m.outputTokens} $${await __callMethod(m.cost, "toFixed", {
2033
+ type: "positional",
2034
+ args: [4]
2035
+ })}`]
2036
+ });
2037
+ if (hasInterrupts(__funcResult)) {
2038
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
2039
+ runner5.halt(__funcResult);
2040
+ return;
2041
+ }
2042
+ });
2043
+ });
2044
+ await runner3.step(3, async (runner4) => {
2045
+ __self.__retryable = false;
2046
+ });
2047
+ }
2048
+ }
2049
+ ]);
2050
+ await runner2.step(8, async (runner3) => {
2051
+ __self.__retryable = false;
2052
+ });
2053
+ await runner2.step(9, async (runner3) => {
1982
2054
  __functionCompleted = true;
1983
2055
  runner3.halt(true);
1984
2056
  return;
@@ -3062,7 +3134,7 @@ async function __printHeader_impl() {
3062
3134
  await runner.step(1, async (runner2) => {
3063
3135
  __stack.locals.fig = await __call(sample, {
3064
3136
  type: "positional",
3065
- args: [__readStatic(figs, "figs", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/images/images.agency")]
3137
+ args: [__readStatic(figs, "figs", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/images/images.agency")]
3066
3138
  });
3067
3139
  if (hasInterrupts(__stack.locals.fig)) {
3068
3140
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
@@ -3071,7 +3143,6 @@ async function __printHeader_impl() {
3071
3143
  }
3072
3144
  });
3073
3145
  await runner.step(2, async (runner2) => {
3074
- __self.__retryable = false;
3075
3146
  __stack.locals.data = await __call(box, {
3076
3147
  type: "named",
3077
3148
  positionalArgs: [],
@@ -3356,7 +3427,7 @@ async function __givePolicyChoice_impl() {
3356
3427
  __stack.locals.title = `Welcome to the agency agent. Please pick a policy to start.`;
3357
3428
  });
3358
3429
  await runner.step(2, async (runner2) => {
3359
- __stack.locals.body = `Don't worry, you can change this later. The policy just controls how the agent asks for your approval when it wants to do something. You can also create your own custom policy file at ${__readStatic(POLICY_PATH, "POLICY_PATH", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/config.agency")} and the agent will use it automatically.`;
3430
+ __stack.locals.body = `Don't worry, you can change this later. The policy just controls how the agent asks for your approval when it wants to do something. You can also create your own custom policy file at ${__readStatic(POLICY_PATH, "POLICY_PATH", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/config.agency")} and the agent will use it automatically.`;
3360
3431
  });
3361
3432
  await runner.step(3, async (runner2) => {
3362
3433
  __stack.locals.items = [{
@@ -3387,7 +3458,7 @@ async function __givePolicyChoice_impl() {
3387
3458
  condition: async () => __stack.locals.answer === `minimal`,
3388
3459
  body: async (runner2) => {
3389
3460
  __functionCompleted = true;
3390
- runner2.halt(__readStatic(minimalAutoApprovePolicy, "minimalAutoApprovePolicy", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/defaultPolicy.agency"));
3461
+ runner2.halt(__readStatic(minimalAutoApprovePolicy, "minimalAutoApprovePolicy", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/defaultPolicy.agency"));
3391
3462
  return;
3392
3463
  }
3393
3464
  },
@@ -3395,7 +3466,7 @@ async function __givePolicyChoice_impl() {
3395
3466
  condition: async () => __stack.locals.answer === `recommended`,
3396
3467
  body: async (runner2) => {
3397
3468
  __functionCompleted = true;
3398
- runner2.halt(__readStatic(recommendedAutoApprovePolicy, "recommendedAutoApprovePolicy", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/defaultPolicy.agency"));
3469
+ runner2.halt(__readStatic(recommendedAutoApprovePolicy, "recommendedAutoApprovePolicy", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/defaultPolicy.agency"));
3399
3470
  return;
3400
3471
  }
3401
3472
  }
@@ -3557,7 +3628,7 @@ Current working directory: ${await __call(cwd, {
3557
3628
  __self.__retryable = false;
3558
3629
  __stack.locals.policy = await __call(parsePolicyFile, {
3559
3630
  type: "positional",
3560
- args: [__readStatic(POLICY_PATH, "POLICY_PATH", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/config.agency")]
3631
+ args: [__readStatic(POLICY_PATH, "POLICY_PATH", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/config.agency")]
3561
3632
  });
3562
3633
  if (hasInterrupts(__stack.locals.policy)) {
3563
3634
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
@@ -3585,7 +3656,7 @@ Current working directory: ${await __call(cwd, {
3585
3656
  type: "positional",
3586
3657
  args: [await __callMethod(color, "yellow", {
3587
3658
  type: "positional",
3588
- args: [`No existing policy found at ${__readStatic(POLICY_PATH, "POLICY_PATH", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/config.agency")}.`]
3659
+ args: [`No existing policy found at ${__readStatic(POLICY_PATH, "POLICY_PATH", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/config.agency")}.`]
3589
3660
  })]
3590
3661
  });
3591
3662
  if (hasInterrupts(__funcResult)) {
@@ -3598,7 +3669,7 @@ Current working directory: ${await __call(cwd, {
3598
3669
  __self.__retryable = false;
3599
3670
  const __funcResult = await __call(setPolicy, {
3600
3671
  type: "positional",
3601
- args: [__readStatic(POLICY_PATH, "POLICY_PATH", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/config.agency"), await __call(givePolicyChoice, {
3672
+ args: [__readStatic(POLICY_PATH, "POLICY_PATH", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/config.agency"), await __call(givePolicyChoice, {
3602
3673
  type: "positional",
3603
3674
  args: []
3604
3675
  })]
@@ -3616,7 +3687,7 @@ Current working directory: ${await __call(cwd, {
3616
3687
  __self.__retryable = false;
3617
3688
  const __funcResult = await __call(setPolicy, {
3618
3689
  type: "positional",
3619
- args: [__readStatic(POLICY_PATH, "POLICY_PATH", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/config.agency"), __readStatic(recommendedAutoApprovePolicy, "recommendedAutoApprovePolicy", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/defaultPolicy.agency")]
3690
+ args: [__readStatic(POLICY_PATH, "POLICY_PATH", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/config.agency"), __readStatic(recommendedAutoApprovePolicy, "recommendedAutoApprovePolicy", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/defaultPolicy.agency")]
3620
3691
  });
3621
3692
  if (hasInterrupts(__funcResult)) {
3622
3693
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
@@ -3665,7 +3736,7 @@ Current working directory: ${await __call(cwd, {
3665
3736
  __self.__retryable = false;
3666
3737
  const __funcResult = await __call(setPolicy, {
3667
3738
  type: "positional",
3668
- args: [__readStatic(POLICY_PATH, "POLICY_PATH", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/config.agency"), __stack.locals.policy.value]
3739
+ args: [__readStatic(POLICY_PATH, "POLICY_PATH", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/config.agency"), __stack.locals.policy.value]
3669
3740
  });
3670
3741
  if (hasInterrupts(__funcResult)) {
3671
3742
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
@@ -3684,8 +3755,8 @@ Current working directory: ${await __call(cwd, {
3684
3755
  type: "named",
3685
3756
  positionalArgs: [],
3686
3757
  namedArgs: {
3687
- file: __readStatic(POLICY_PATH, "POLICY_PATH", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/config.agency"),
3688
- fields: __readStatic(ALWAYS_FIELDS, "ALWAYS_FIELDS", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/config.agency")
3758
+ file: __readStatic(POLICY_PATH, "POLICY_PATH", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/config.agency"),
3759
+ fields: __readStatic(ALWAYS_FIELDS, "ALWAYS_FIELDS", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/config.agency")
3689
3760
  }
3690
3761
  }));
3691
3762
  return;
@@ -4215,7 +4286,7 @@ async function __startInteractive_impl(handler, seedTarget, seedPrompt) {
4215
4286
  status: _buildStatus,
4216
4287
  onSubmit: _runTurn,
4217
4288
  prompt: `> `,
4218
- historyFile: __readStatic(HISTORY_PATH, "HISTORY_PATH", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/config.agency"),
4289
+ historyFile: __readStatic(HISTORY_PATH, "HISTORY_PATH", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/config.agency"),
4219
4290
  historyMax: 1e3,
4220
4291
  paletteCommands: await __call(mergedPalette, {
4221
4292
  type: "positional",
@@ -4814,7 +4885,8 @@ if (__process.argv[1] === fileURLToPath(import.meta.url)) {
4814
4885
  messages: new ThreadStore(),
4815
4886
  data: {}
4816
4887
  };
4817
- await main(initialState);
4888
+ const __result = await main(initialState);
4889
+ reportUnhandledInterrupts(__result);
4818
4890
  } catch (__error) {
4819
4891
  console.error(`
4820
4892
  Agent crashed: ${__error.message}`);
@@ -4822,7 +4894,7 @@ Agent crashed: ${__error.message}`);
4822
4894
  }
4823
4895
  }
4824
4896
  var stdin_default = graph;
4825
- const __sourceMap = { "dist/lib/agents/agency-agent/agent.agency:__cb_top_0": { "1": { "line": 97, "col": 2 }, "1.0": { "line": 98, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:__cb_top_1": { "1": { "line": 103, "col": 2 }, "1.0.0": { "line": 104, "col": 4 }, "1.0.1": { "line": 105, "col": 6 }, "1.0.2": { "line": 106, "col": 11 }, "1.0.3": { "line": 107, "col": 6 }, "1.0.4": { "line": 109, "col": 6 }, "1.0": { "line": 104, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:__cb_top_2": { "1": { "line": 115, "col": 2 }, "1.0": { "line": 116, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:__cb_top_3": { "1": { "line": 121, "col": 2 }, "1.0": { "line": 122, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:_showTraces": { "1": { "line": 93, "col": 2 } }, "dist/lib/agents/agency-agent/agent.agency:renderLLMCallResponse": { "1": { "line": 142, "col": 2 }, "2": { "line": 143, "col": 2 }, "3": { "line": 146, "col": 2 }, "5": { "line": 151, "col": 2 }, "2.0": { "line": 144, "col": 4 }, "3.0.0": { "line": 148, "col": 6 }, "3.0": { "line": 147, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:loadAgentsMd": { "1": { "line": 162, "col": 2 }, "2": { "line": 165, "col": 2 }, "4": { "line": 166, "col": 2 }, "5": { "line": 169, "col": 2 }, "1.0": { "line": 163, "col": 4 }, "2.0": { "line": 165, "col": 2 }, "4.0": { "line": 167, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:builtinPalette": { "1": { "line": 183, "col": 2 } }, "dist/lib/agents/agency-agent/agent.agency:mergedPalette": { "1": { "line": 195, "col": 2 }, "2": { "line": 196, "col": 2 }, "3": { "line": 203, "col": 2 }, "4": { "line": 204, "col": 2 }, "5": { "line": 207, "col": 2 }, "2.0": { "line": 197, "col": 4 }, "2.1.0": { "line": 199, "col": 6 }, "2.1": { "line": 198, "col": 4 }, "2.2": { "line": 201, "col": 4 }, "4.0": { "line": 205, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:_runTurn": { "2": { "line": 218, "col": 2 }, "3": { "line": 219, "col": 2 }, "4": { "line": 222, "col": 2 }, "5": { "line": 225, "col": 2 }, "7": { "line": 229, "col": 2 }, "9": { "line": 233, "col": 2 }, "11": { "line": 240, "col": 2 }, "12": { "line": 241, "col": 2 }, "14": { "line": 246, "col": 2 }, "3.0": { "line": 220, "col": 4 }, "4.0": { "line": 223, "col": 4 }, "5.0": { "line": 226, "col": 4 }, "5.1": { "line": 227, "col": 4 }, "7.0": { "line": 230, "col": 4 }, "7.1": { "line": 231, "col": 4 }, "9.0": { "line": 234, "col": 4 }, "9.1": { "line": 235, "col": 4 }, "9.2": { "line": 236, "col": 4 }, "12.0": { "line": 242, "col": 4 }, "12.1": { "line": 244, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:mainAgent": { "1": { "line": 429, "col": 2 }, "3": { "line": 443, "col": 2 }, "1.0": { "line": 430, "col": 4 }, "1.1.1": { "line": 435, "col": 6 }, "1.1.2": { "line": 436, "col": 6 }, "1.1": { "line": 431, "col": 4 }, "1.3": { "line": 438, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:agentReplyVia": { "1": { "line": 452, "col": 2 }, "2": { "line": 453, "col": 2 }, "4": { "line": 456, "col": 2 }, "6": { "line": 459, "col": 2 }, "8": { "line": 462, "col": 2 }, "10": { "line": 465, "col": 2 }, "12": { "line": 468, "col": 2 }, "2.0": { "line": 454, "col": 4 }, "4.0": { "line": 457, "col": 4 }, "6.0": { "line": 460, "col": 4 }, "8.0": { "line": 463, "col": 4 }, "10.0": { "line": 466, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:agentReply": { "1": { "line": 478, "col": 2 } }, "dist/lib/agents/agency-agent/agent.agency:roundedCost": { "1": { "line": 482, "col": 2 } }, "dist/lib/agents/agency-agent/agent.agency:_buildStatus": { "1": { "line": 486, "col": 2 } }, "dist/lib/agents/agency-agent/agent.agency:sample": { "1": { "line": 494, "col": 2 } }, "dist/lib/agents/agency-agent/agent.agency:printHeader": { "1": { "line": 498, "col": 2 }, "2": { "line": 499, "col": 2 }, "3": { "line": 521, "col": 2 } }, "dist/lib/agents/agency-agent/agent.agency:__block_0": { "2.0": { "line": 506, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:__block_1": { "2.0.0": { "line": 507, "col": 6 }, "2.0.1": { "line": 515, "col": 6 }, "2.0.2": { "line": 516, "col": 6 } }, "dist/lib/agents/agency-agent/agent.agency:__block_2": { "2.0.0.0": { "line": 508, "col": 8 }, "2.0.0.1": { "line": 509, "col": 8 }, "2.0.0.2": { "line": 510, "col": 8 }, "2.0.0.3": { "line": 511, "col": 8 }, "2.0.0.4": { "line": 512, "col": 8 }, "2.0.0.5": { "line": 513, "col": 8 } }, "dist/lib/agents/agency-agent/agent.agency:__block_3": { "2.0.2.0": { "line": 517, "col": 8 } }, "dist/lib/agents/agency-agent/agent.agency:givePolicyChoice": { "1": { "line": 525, "col": 2 }, "2": { "line": 526, "col": 2 }, "3": { "line": 527, "col": 2 }, "4": { "line": 538, "col": 2 }, "5": { "line": 539, "col": 2 } }, "dist/lib/agents/agency-agent/agent.agency:setupSession": { "2": { "line": 557, "col": 2 }, "3": { "line": 562, "col": 2 }, "4": { "line": 563, "col": 2 }, "5": { "line": 565, "col": 2 }, "6": { "line": 566, "col": 2 }, "8": { "line": 583, "col": 2 }, "3.0": { "line": 562, "col": 2 }, "6.0": { "line": 566, "col": 2 }, "6.1.0.0": { "line": 569, "col": 8 }, "6.1.0.1": { "line": 570, "col": 8 }, "6.1.0.2": { "line": 572, "col": 8 }, "6.1.0": { "line": 568, "col": 6 }, "6.1.2": { "line": 575, "col": 6 }, "6.1.3": { "line": 576, "col": 6 }, "6.1": { "line": 567, "col": 4 }, "6.3": { "line": 579, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:oneShotAgent": { "1": { "line": 593, "col": 2 }, "2": { "line": 594, "col": 2 }, "3": { "line": 595, "col": 2 }, "4": { "line": 596, "col": 2 }, "5": { "line": 601, "col": 2 }, "4.0": { "line": 597, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:_runSeedTurn": { "1": { "line": 608, "col": 2 }, "2": { "line": 609, "col": 2 }, "3": { "line": 610, "col": 2 }, "3.0": { "line": 611, "col": 4 }, "3.1": { "line": 613, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:startInteractive": { "1": { "line": 624, "col": 2 }, "3": { "line": 639, "col": 2 }, "1.0.0": { "line": 626, "col": 6 }, "1.0": { "line": 625, "col": 4 }, "1.1": { "line": 628, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:main": { "2": { "line": 645, "col": 2 }, "3": { "line": 693, "col": 2 }, "4": { "line": 696, "col": 2 }, "6": { "line": 707, "col": 2 }, "7": { "line": 717, "col": 2 }, "8": { "line": 718, "col": 2 }, "9": { "line": 719, "col": 2 }, "10": { "line": 720, "col": 2 }, "11": { "line": 723, "col": 2 }, "13": { "line": 738, "col": 2 }, "15": { "line": 757, "col": 2 }, "16": { "line": 758, "col": 2 }, "18": { "line": 776, "col": 2 }, "19": { "line": 777, "col": 2 }, "20": { "line": 778, "col": 2 }, "21": { "line": 779, "col": 2 }, "22": { "line": 780, "col": 2 }, "3.0": { "line": 694, "col": 4 }, "4.0": { "line": 697, "col": 4 }, "11.0": { "line": 724, "col": 4 }, "11.1": { "line": 729, "col": 4 }, "13.0": { "line": 739, "col": 4 }, "13.1": { "line": 740, "col": 4 }, "13.2": { "line": 741, "col": 4 }, "13.3": { "line": 742, "col": 4 }, "13.4": { "line": 743, "col": 4 }, "13.5": { "line": 744, "col": 4 }, "16.0": { "line": 759, "col": 4 }, "16.1.0": { "line": 761, "col": 6 }, "16.1.1.0": { "line": 763, "col": 8 }, "16.1.1": { "line": 762, "col": 6 }, "16.1.2": { "line": 765, "col": 6 }, "16.1": { "line": 760, "col": 4 }, "16.2": { "line": 767, "col": 4 }, "16.3": { "line": 768, "col": 4 } } };
4897
+ const __sourceMap = { "dist/lib/agents/agency-agent/agent.agency:__cb_top_0": { "1": { "line": 97, "col": 2 }, "1.0": { "line": 98, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:__cb_top_1": { "1": { "line": 103, "col": 2 }, "1.0.0": { "line": 104, "col": 4 }, "1.0.1": { "line": 105, "col": 6 }, "1.0.2": { "line": 106, "col": 11 }, "1.0.3": { "line": 107, "col": 6 }, "1.0.4": { "line": 109, "col": 6 }, "1.0": { "line": 104, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:__cb_top_2": { "1": { "line": 115, "col": 2 }, "1.0": { "line": 116, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:__cb_top_3": { "1": { "line": 121, "col": 2 }, "1.0": { "line": 122, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:_showTraces": { "1": { "line": 93, "col": 2 } }, "dist/lib/agents/agency-agent/agent.agency:renderLLMCallResponse": { "1": { "line": 142, "col": 2 }, "2": { "line": 143, "col": 2 }, "3": { "line": 146, "col": 2 }, "5": { "line": 151, "col": 2 }, "2.0": { "line": 144, "col": 4 }, "3.0.0": { "line": 148, "col": 6 }, "3.0": { "line": 147, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:loadAgentsMd": { "1": { "line": 162, "col": 2 }, "2": { "line": 165, "col": 2 }, "3": { "line": 166, "col": 2 }, "4": { "line": 169, "col": 2 }, "1.0": { "line": 163, "col": 4 }, "2.0": { "line": 165, "col": 2 }, "3.0": { "line": 167, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:builtinPalette": { "1": { "line": 183, "col": 2 } }, "dist/lib/agents/agency-agent/agent.agency:mergedPalette": { "1": { "line": 195, "col": 2 }, "2": { "line": 196, "col": 2 }, "3": { "line": 203, "col": 2 }, "4": { "line": 204, "col": 2 }, "5": { "line": 207, "col": 2 }, "2.0": { "line": 197, "col": 4 }, "2.1.0": { "line": 199, "col": 6 }, "2.1": { "line": 198, "col": 4 }, "2.2": { "line": 201, "col": 4 }, "4.0": { "line": 205, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:_runTurn": { "2": { "line": 218, "col": 2 }, "3": { "line": 219, "col": 2 }, "4": { "line": 222, "col": 2 }, "5": { "line": 225, "col": 2 }, "7": { "line": 229, "col": 2 }, "9": { "line": 233, "col": 2 }, "11": { "line": 261, "col": 2 }, "12": { "line": 262, "col": 2 }, "14": { "line": 267, "col": 2 }, "3.0": { "line": 220, "col": 4 }, "4.0": { "line": 223, "col": 4 }, "5.0": { "line": 226, "col": 4 }, "5.1": { "line": 227, "col": 4 }, "7.0": { "line": 230, "col": 4 }, "7.1": { "line": 231, "col": 4 }, "9.1": { "line": 241, "col": 4 }, "9.2": { "line": 242, "col": 4 }, "9.3": { "line": 243, "col": 4 }, "9.4.0": { "line": 245, "col": 6 }, "9.4.1": { "line": 246, "col": 6 }, "9.4": { "line": 244, "col": 4 }, "9.5": { "line": 248, "col": 4 }, "9.6": { "line": 249, "col": 4 }, "9.7.0": { "line": 251, "col": 6 }, "9.7.1": { "line": 252, "col": 6 }, "9.7.2.0": { "line": 254, "col": 8 }, "9.7.2": { "line": 253, "col": 6 }, "9.7": { "line": 250, "col": 4 }, "9.9": { "line": 257, "col": 4 }, "12.0": { "line": 263, "col": 4 }, "12.1": { "line": 265, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:mainAgent": { "1": { "line": 450, "col": 2 }, "3": { "line": 464, "col": 2 }, "1.0": { "line": 451, "col": 4 }, "1.1.1": { "line": 456, "col": 6 }, "1.1.2": { "line": 457, "col": 6 }, "1.1": { "line": 452, "col": 4 }, "1.3": { "line": 459, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:agentReplyVia": { "1": { "line": 473, "col": 2 }, "2": { "line": 474, "col": 2 }, "4": { "line": 477, "col": 2 }, "6": { "line": 480, "col": 2 }, "8": { "line": 483, "col": 2 }, "10": { "line": 486, "col": 2 }, "12": { "line": 489, "col": 2 }, "2.0": { "line": 475, "col": 4 }, "4.0": { "line": 478, "col": 4 }, "6.0": { "line": 481, "col": 4 }, "8.0": { "line": 484, "col": 4 }, "10.0": { "line": 487, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:agentReply": { "1": { "line": 499, "col": 2 } }, "dist/lib/agents/agency-agent/agent.agency:roundedCost": { "1": { "line": 503, "col": 2 } }, "dist/lib/agents/agency-agent/agent.agency:_buildStatus": { "1": { "line": 507, "col": 2 } }, "dist/lib/agents/agency-agent/agent.agency:sample": { "1": { "line": 515, "col": 2 } }, "dist/lib/agents/agency-agent/agent.agency:printHeader": { "1": { "line": 519, "col": 2 }, "2": { "line": 520, "col": 2 }, "3": { "line": 542, "col": 2 } }, "dist/lib/agents/agency-agent/agent.agency:__block_0": { "2.0": { "line": 527, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:__block_1": { "2.0.0": { "line": 528, "col": 6 }, "2.0.1": { "line": 536, "col": 6 }, "2.0.2": { "line": 537, "col": 6 } }, "dist/lib/agents/agency-agent/agent.agency:__block_2": { "2.0.0.0": { "line": 529, "col": 8 }, "2.0.0.1": { "line": 530, "col": 8 }, "2.0.0.2": { "line": 531, "col": 8 }, "2.0.0.3": { "line": 532, "col": 8 }, "2.0.0.4": { "line": 533, "col": 8 }, "2.0.0.5": { "line": 534, "col": 8 } }, "dist/lib/agents/agency-agent/agent.agency:__block_3": { "2.0.2.0": { "line": 538, "col": 8 } }, "dist/lib/agents/agency-agent/agent.agency:givePolicyChoice": { "1": { "line": 546, "col": 2 }, "2": { "line": 547, "col": 2 }, "3": { "line": 548, "col": 2 }, "4": { "line": 559, "col": 2 }, "5": { "line": 560, "col": 2 } }, "dist/lib/agents/agency-agent/agent.agency:setupSession": { "2": { "line": 578, "col": 2 }, "3": { "line": 583, "col": 2 }, "4": { "line": 584, "col": 2 }, "5": { "line": 586, "col": 2 }, "6": { "line": 587, "col": 2 }, "8": { "line": 604, "col": 2 }, "3.0": { "line": 583, "col": 2 }, "6.0": { "line": 587, "col": 2 }, "6.1.0.0": { "line": 590, "col": 8 }, "6.1.0.1": { "line": 591, "col": 8 }, "6.1.0.2": { "line": 593, "col": 8 }, "6.1.0": { "line": 589, "col": 6 }, "6.1.2": { "line": 596, "col": 6 }, "6.1.3": { "line": 597, "col": 6 }, "6.1": { "line": 588, "col": 4 }, "6.3": { "line": 600, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:oneShotAgent": { "1": { "line": 614, "col": 2 }, "2": { "line": 615, "col": 2 }, "3": { "line": 616, "col": 2 }, "4": { "line": 617, "col": 2 }, "5": { "line": 622, "col": 2 }, "4.0": { "line": 618, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:_runSeedTurn": { "1": { "line": 629, "col": 2 }, "2": { "line": 630, "col": 2 }, "3": { "line": 631, "col": 2 }, "3.0": { "line": 632, "col": 4 }, "3.1": { "line": 634, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:startInteractive": { "1": { "line": 645, "col": 2 }, "3": { "line": 660, "col": 2 }, "1.0.0": { "line": 647, "col": 6 }, "1.0": { "line": 646, "col": 4 }, "1.1": { "line": 649, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:main": { "2": { "line": 666, "col": 2 }, "3": { "line": 714, "col": 2 }, "4": { "line": 717, "col": 2 }, "6": { "line": 728, "col": 2 }, "7": { "line": 738, "col": 2 }, "8": { "line": 739, "col": 2 }, "9": { "line": 740, "col": 2 }, "10": { "line": 741, "col": 2 }, "11": { "line": 744, "col": 2 }, "13": { "line": 759, "col": 2 }, "15": { "line": 778, "col": 2 }, "16": { "line": 779, "col": 2 }, "18": { "line": 797, "col": 2 }, "19": { "line": 798, "col": 2 }, "20": { "line": 799, "col": 2 }, "21": { "line": 800, "col": 2 }, "22": { "line": 801, "col": 2 }, "3.0": { "line": 715, "col": 4 }, "4.0": { "line": 718, "col": 4 }, "11.0": { "line": 745, "col": 4 }, "11.1": { "line": 750, "col": 4 }, "13.0": { "line": 760, "col": 4 }, "13.1": { "line": 761, "col": 4 }, "13.2": { "line": 762, "col": 4 }, "13.3": { "line": 763, "col": 4 }, "13.4": { "line": 764, "col": 4 }, "13.5": { "line": 765, "col": 4 }, "16.0": { "line": 780, "col": 4 }, "16.1.0": { "line": 782, "col": 6 }, "16.1.1.0": { "line": 784, "col": 8 }, "16.1.1": { "line": 783, "col": 6 }, "16.1.2": { "line": 786, "col": 6 }, "16.1": { "line": 781, "col": 4 }, "16.2": { "line": 788, "col": 4 }, "16.3": { "line": 789, "col": 4 } } };
4826
4898
  export {
4827
4899
  __getCheckpoints,
4828
4900
  __mainNodeParams,
@@ -35,7 +35,7 @@ const __globalCtx = new RuntimeContext({
35
35
  projectId: "agency-lang",
36
36
  debugMode: false,
37
37
  observability: true,
38
- logFile: "statelog.log"
38
+ logFile: "log.jsonl"
39
39
  },
40
40
  smoltalkDefaults: {
41
41
  openAiApiKey: __process.env["OPENAI_API_KEY"] || "",
@@ -38,7 +38,7 @@ const __globalCtx = new RuntimeContext({
38
38
  projectId: "agency-lang",
39
39
  debugMode: false,
40
40
  observability: true,
41
- logFile: "statelog.log"
41
+ logFile: "log.jsonl"
42
42
  },
43
43
  smoltalkDefaults: {
44
44
  openAiApiKey: __process.env["OPENAI_API_KEY"] || "",
@@ -51,7 +51,7 @@ const __globalCtx = new RuntimeContext({
51
51
  projectId: "agency-lang",
52
52
  debugMode: false,
53
53
  observability: true,
54
- logFile: "statelog.log"
54
+ logFile: "log.jsonl"
55
55
  },
56
56
  smoltalkDefaults: {
57
57
  openAiApiKey: __process.env["OPENAI_API_KEY"] || "",
@@ -49,7 +49,7 @@ const __globalCtx = new RuntimeContext({
49
49
  projectId: "agency-lang",
50
50
  debugMode: false,
51
51
  observability: true,
52
- logFile: "statelog.log"
52
+ logFile: "log.jsonl"
53
53
  },
54
54
  smoltalkDefaults: {
55
55
  openAiApiKey: __process.env["OPENAI_API_KEY"] || "",
@@ -19,6 +19,7 @@ import {
19
19
  interrupt,
20
20
  isInterrupt,
21
21
  hasInterrupts,
22
+ reportUnhandledInterrupts,
22
23
  isDebugger,
23
24
  respondToInterrupts as _respondToInterrupts,
24
25
  rewindFrom as _rewindFrom,
@@ -48,7 +49,7 @@ const __globalCtx = new RuntimeContext({
48
49
  projectId: "agency-lang",
49
50
  debugMode: false,
50
51
  observability: true,
51
- logFile: "statelog.log"
52
+ logFile: "log.jsonl"
52
53
  },
53
54
  smoltalkDefaults: {
54
55
  openAiApiKey: __process.env["OPENAI_API_KEY"] || "",
@@ -723,7 +724,8 @@ if (__process.argv[1] === fileURLToPath(import.meta.url)) {
723
724
  messages: new ThreadStore(),
724
725
  data: {}
725
726
  };
726
- await main(initialState);
727
+ const __result = await main(initialState);
728
+ reportUnhandledInterrupts(__result);
727
729
  } catch (__error) {
728
730
  console.error(`
729
731
  Agent crashed: ${__error.message}`);
@@ -55,7 +55,7 @@ const __globalCtx = new RuntimeContext({
55
55
  projectId: "agency-lang",
56
56
  debugMode: false,
57
57
  observability: true,
58
- logFile: "statelog.log"
58
+ logFile: "log.jsonl"
59
59
  },
60
60
  smoltalkDefaults: {
61
61
  openAiApiKey: __process.env["OPENAI_API_KEY"] || "",
@@ -66,7 +66,7 @@ const __globalCtx = new RuntimeContext({
66
66
  projectId: "agency-lang",
67
67
  debugMode: false,
68
68
  observability: true,
69
- logFile: "statelog.log"
69
+ logFile: "log.jsonl"
70
70
  },
71
71
  smoltalkDefaults: {
72
72
  openAiApiKey: __process.env["OPENAI_API_KEY"] || "",
@@ -462,49 +462,49 @@ signature is a function signature. Diagrams earn their space when
462
462
  they show **relationships** or **flow**. Keep them small; if your
463
463
  diagram needs scrolling, prose is probably better.
464
464
  `);
465
- codeTools = __deepFreeze([__readStatic(setAgentCwd, "setAgentCwd", "/Users/adityabhargava/agency-lang/packages/agency-lang/stdlib/index.agency"), __readStatic(getAgentCwd, "getAgentCwd", "/Users/adityabhargava/agency-lang/packages/agency-lang/stdlib/index.agency"), await __callMethod(__readStatic(read, "read", "/Users/adityabhargava/agency-lang/packages/agency-lang/stdlib/index.agency"), "partial", {
465
+ codeTools = __deepFreeze([__readStatic(setAgentCwd, "setAgentCwd", "/Users/abhargava/agency-lang/packages/agency-lang/stdlib/index.agency"), __readStatic(getAgentCwd, "getAgentCwd", "/Users/abhargava/agency-lang/packages/agency-lang/stdlib/index.agency"), await __callMethod(__readStatic(read, "read", "/Users/abhargava/agency-lang/packages/agency-lang/stdlib/index.agency"), "partial", {
466
466
  type: "named",
467
467
  positionalArgs: [],
468
468
  namedArgs: {
469
469
  useAgentCwd: true
470
470
  }
471
- }), await __callMethod(__readStatic(write, "write", "/Users/adityabhargava/agency-lang/packages/agency-lang/stdlib/index.agency"), "partial", {
471
+ }), await __callMethod(__readStatic(write, "write", "/Users/abhargava/agency-lang/packages/agency-lang/stdlib/index.agency"), "partial", {
472
472
  type: "named",
473
473
  positionalArgs: [],
474
474
  namedArgs: {
475
475
  useAgentCwd: true
476
476
  }
477
- }), await __callMethod(__readStatic(edit, "edit", "/Users/adityabhargava/agency-lang/packages/agency-lang/stdlib/fs.agency"), "partial", {
477
+ }), await __callMethod(__readStatic(edit, "edit", "/Users/abhargava/agency-lang/packages/agency-lang/stdlib/fs.agency"), "partial", {
478
478
  type: "named",
479
479
  positionalArgs: [],
480
480
  namedArgs: {
481
481
  useAgentCwd: true
482
482
  }
483
- }), await __callMethod(__readStatic(ls, "ls", "/Users/adityabhargava/agency-lang/packages/agency-lang/stdlib/shell.agency"), "partial", {
483
+ }), await __callMethod(__readStatic(ls, "ls", "/Users/abhargava/agency-lang/packages/agency-lang/stdlib/shell.agency"), "partial", {
484
484
  type: "named",
485
485
  positionalArgs: [],
486
486
  namedArgs: {
487
487
  useAgentCwd: true
488
488
  }
489
- }), await __callMethod(__readStatic(glob, "glob", "/Users/adityabhargava/agency-lang/packages/agency-lang/stdlib/shell.agency"), "partial", {
489
+ }), await __callMethod(__readStatic(glob, "glob", "/Users/abhargava/agency-lang/packages/agency-lang/stdlib/shell.agency"), "partial", {
490
490
  type: "named",
491
491
  positionalArgs: [],
492
492
  namedArgs: {
493
493
  useAgentCwd: true
494
494
  }
495
- }), await __callMethod(__readStatic(grep, "grep", "/Users/adityabhargava/agency-lang/packages/agency-lang/stdlib/shell.agency"), "partial", {
495
+ }), await __callMethod(__readStatic(grep, "grep", "/Users/abhargava/agency-lang/packages/agency-lang/stdlib/shell.agency"), "partial", {
496
496
  type: "named",
497
497
  positionalArgs: [],
498
498
  namedArgs: {
499
499
  useAgentCwd: true
500
500
  }
501
- }), await __callMethod(__readStatic(bash, "bash", "/Users/adityabhargava/agency-lang/packages/agency-lang/stdlib/shell.agency"), "partial", {
501
+ }), await __callMethod(__readStatic(bash, "bash", "/Users/abhargava/agency-lang/packages/agency-lang/stdlib/shell.agency"), "partial", {
502
502
  type: "named",
503
503
  positionalArgs: [],
504
504
  namedArgs: {
505
505
  useAgentCwd: true
506
506
  }
507
- }), agencyCli, __readStatic(typecheck, "typecheck", "/Users/adityabhargava/agency-lang/packages/agency-lang/stdlib/agency.agency"), __readStatic(parseAST, "parseAST", "/Users/adityabhargava/agency-lang/packages/agency-lang/stdlib/agency.agency"), __readStatic(remember, "remember", "/Users/adityabhargava/agency-lang/packages/agency-lang/stdlib/memory.agency"), __readStatic(recall, "recall", "/Users/adityabhargava/agency-lang/packages/agency-lang/stdlib/memory.agency"), __readStatic(superpowersSkill, "superpowersSkill", "dist/lib/agents/agency-agent/subagents/code.agency"), __readStatic(docSkill, "docSkill", "dist/lib/agents/agency-agent/subagents/code.agency"), __readStatic(cliSkill, "cliSkill", "dist/lib/agents/agency-agent/subagents/code.agency"), __readStatic(appendixSkill, "appendixSkill", "dist/lib/agents/agency-agent/subagents/code.agency"), __readStatic(todoWrite, "todoWrite", "/Users/adityabhargava/agency-lang/packages/agency-lang/stdlib/agent.agency"), __readStatic(todoList, "todoList", "/Users/adityabhargava/agency-lang/packages/agency-lang/stdlib/agent.agency"), await __callMethod(__readStatic(oracleAgent, "oracleAgent", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/subagents/oracle.agency"), "partial", {
507
+ }), agencyCli, __readStatic(typecheck, "typecheck", "/Users/abhargava/agency-lang/packages/agency-lang/stdlib/agency.agency"), __readStatic(parseAST, "parseAST", "/Users/abhargava/agency-lang/packages/agency-lang/stdlib/agency.agency"), __readStatic(remember, "remember", "/Users/abhargava/agency-lang/packages/agency-lang/stdlib/memory.agency"), __readStatic(recall, "recall", "/Users/abhargava/agency-lang/packages/agency-lang/stdlib/memory.agency"), __readStatic(superpowersSkill, "superpowersSkill", "dist/lib/agents/agency-agent/subagents/code.agency"), __readStatic(docSkill, "docSkill", "dist/lib/agents/agency-agent/subagents/code.agency"), __readStatic(cliSkill, "cliSkill", "dist/lib/agents/agency-agent/subagents/code.agency"), __readStatic(appendixSkill, "appendixSkill", "dist/lib/agents/agency-agent/subagents/code.agency"), __readStatic(todoWrite, "todoWrite", "/Users/abhargava/agency-lang/packages/agency-lang/stdlib/agent.agency"), __readStatic(todoList, "todoList", "/Users/abhargava/agency-lang/packages/agency-lang/stdlib/agent.agency"), await __callMethod(__readStatic(oracleAgent, "oracleAgent", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/subagents/oracle.agency"), "partial", {
508
508
  type: "named",
509
509
  positionalArgs: [],
510
510
  namedArgs: {
@@ -738,7 +738,7 @@ async function __codeAgent_impl(userMsg, allowHandoff) {
738
738
  __self.__retryable = false;
739
739
  __stack.locals.otherAgents = await __call(filter, {
740
740
  type: "named",
741
- positionalArgs: [__readStatic(agentNames, "agentNames", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/config.agency")],
741
+ positionalArgs: [__readStatic(agentNames, "agentNames", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/config.agency")],
742
742
  namedArgs: {},
743
743
  blockArg: __AgencyFunction.create({ name: "__block_0", module: "dist/lib/agents/agency-agent/subagents/code.agency", fn: async (name) => {
744
744
  const __bsetup = setupFunction();
@@ -771,7 +771,7 @@ async function __codeAgent_impl(userMsg, allowHandoff) {
771
771
  await runner2.step(0, async (runner3) => {
772
772
  await __callMethod(__stack.locals.tools, "push", {
773
773
  type: "positional",
774
- args: [await __callMethod(__readStatic(handoff, "handoff", "/Users/adityabhargava/agency-lang/packages/agency-lang/stdlib/agent.agency"), "partial", {
774
+ args: [await __callMethod(__readStatic(handoff, "handoff", "/Users/abhargava/agency-lang/packages/agency-lang/stdlib/agent.agency"), "partial", {
775
775
  type: "named",
776
776
  positionalArgs: [],
777
777
  namedArgs: {