agency-lang 0.6.0 → 0.6.1

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 (151) hide show
  1. package/dist/lib/agents/agency-agent/agent.agency +24 -3
  2. package/dist/lib/agents/agency-agent/agent.js +109 -32
  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 -1
  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/guide/guide/observability.md +6 -0
  18. package/dist/lib/agents/docs/guide/observability.md +6 -0
  19. package/dist/lib/agents/eval/goalJudge.js +4 -2
  20. package/dist/lib/agents/eval/judge.js +1 -1
  21. package/dist/lib/agents/eval/judgePairwise.js +1 -1
  22. package/dist/lib/agents/optimize/gepaReflect.js +1 -1
  23. package/dist/lib/agents/optimize/mutatePrompt.js +1 -1
  24. package/dist/lib/agents/policy/agent.js +6 -4
  25. package/dist/lib/agents/review/agent.js +4 -2
  26. package/dist/lib/backends/typescriptBuilder.js +6 -1
  27. package/dist/lib/cli/serve.js +16 -7
  28. package/dist/lib/logsViewer/conversation.js +4 -1
  29. package/dist/lib/logsViewer/conversation.test.js +18 -0
  30. package/dist/lib/logsViewer/follow.js +16 -2
  31. package/dist/lib/logsViewer/follow.test.js +31 -0
  32. package/dist/lib/logsViewer/help.js +2 -1
  33. package/dist/lib/logsViewer/input.js +42 -4
  34. package/dist/lib/logsViewer/input.test.js +51 -18
  35. package/dist/lib/logsViewer/render.d.ts +1 -0
  36. package/dist/lib/logsViewer/render.e2e.test.d.ts +1 -0
  37. package/dist/lib/logsViewer/render.e2e.test.js +156 -0
  38. package/dist/lib/logsViewer/render.flatten.test.d.ts +1 -0
  39. package/dist/lib/logsViewer/render.flatten.test.js +240 -0
  40. package/dist/lib/logsViewer/render.js +112 -33
  41. package/dist/lib/logsViewer/render.test.js +38 -0
  42. package/dist/lib/logsViewer/search.js +41 -12
  43. package/dist/lib/logsViewer/search.test.js +84 -0
  44. package/dist/lib/logsViewer/summary.js +134 -5
  45. package/dist/lib/logsViewer/summary.test.js +151 -0
  46. package/dist/lib/logsViewer/tree.js +31 -31
  47. package/dist/lib/logsViewer/tree.test.js +47 -17
  48. package/dist/lib/runtime/errors.d.ts +60 -1
  49. package/dist/lib/runtime/errors.js +46 -1
  50. package/dist/lib/runtime/errors.test.js +70 -1
  51. package/dist/lib/runtime/guard.d.ts +3 -0
  52. package/dist/lib/runtime/guard.js +39 -1
  53. package/dist/lib/runtime/guard.test.js +18 -0
  54. package/dist/lib/runtime/index.d.ts +1 -1
  55. package/dist/lib/runtime/index.js +1 -1
  56. package/dist/lib/runtime/interrupts.d.ts +15 -1
  57. package/dist/lib/runtime/interrupts.js +25 -0
  58. package/dist/lib/runtime/interrupts.test.js +55 -2
  59. package/dist/lib/runtime/prompt.js +46 -48
  60. package/dist/lib/runtime/promptRunner.d.ts +1 -1
  61. package/dist/lib/runtime/promptRunner.js +11 -0
  62. package/dist/lib/runtime/result.js +43 -17
  63. package/dist/lib/runtime/result.test.js +65 -1
  64. package/dist/lib/runtime/runBatch.d.ts +4 -2
  65. package/dist/lib/runtime/runBatch.js +3 -3
  66. package/dist/lib/runtime/runBatch.test.js +40 -0
  67. package/dist/lib/runtime/runner.d.ts +8 -0
  68. package/dist/lib/runtime/runner.js +50 -25
  69. package/dist/lib/runtime/runner.test.js +69 -2
  70. package/dist/lib/runtime/state/context.d.ts +10 -1
  71. package/dist/lib/runtime/state/context.js +13 -4
  72. package/dist/lib/runtime/state/globalStore.js +6 -3
  73. package/dist/lib/runtime/state/stateStack.d.ts +16 -0
  74. package/dist/lib/runtime/state/stateStack.js +33 -0
  75. package/dist/lib/runtime/utils.d.ts +14 -0
  76. package/dist/lib/runtime/utils.js +36 -5
  77. package/dist/lib/runtime/utils.test.js +60 -1
  78. package/dist/lib/serve/http/adapter.js +50 -0
  79. package/dist/lib/serve/http/adapter.test.js +33 -0
  80. package/dist/lib/serve/mcp/adapter.d.ts +7 -1
  81. package/dist/lib/serve/mcp/adapter.js +52 -6
  82. package/dist/lib/serve/mcp/adapter.test.js +36 -1
  83. package/dist/lib/serve/mcp/httpTransport.d.ts +5 -0
  84. package/dist/lib/serve/mcp/httpTransport.js +2 -0
  85. package/dist/lib/statelogClient.d.ts +5 -1
  86. package/dist/lib/statelogClient.js +2 -1
  87. package/dist/lib/stdlib/abortable.js +20 -9
  88. package/dist/lib/stdlib/cli.d.ts +17 -0
  89. package/dist/lib/stdlib/cli.js +60 -20
  90. package/dist/lib/stdlib/thread.d.ts +12 -0
  91. package/dist/lib/stdlib/thread.js +15 -0
  92. package/dist/lib/templates/backends/typescriptGenerator/imports.d.ts +1 -1
  93. package/dist/lib/templates/backends/typescriptGenerator/imports.js +1 -1
  94. package/dist/lib/templates/cli/standaloneMcp.d.ts +1 -1
  95. package/dist/lib/templates/cli/standaloneMcp.js +5 -4
  96. package/dist/lib/templates/cli/standaloneMcpHttp.d.ts +1 -1
  97. package/dist/lib/templates/cli/standaloneMcpHttp.js +5 -3
  98. package/dist/scripts/agency.js +13 -1
  99. package/dist/scripts/agency.test.js +13 -0
  100. package/package.json +1 -1
  101. package/stdlib/agency/eval.js +1 -1
  102. package/stdlib/agency.js +1 -1
  103. package/stdlib/agent.js +1 -1
  104. package/stdlib/args.js +1 -1
  105. package/stdlib/array.js +1 -1
  106. package/stdlib/browser.js +1 -1
  107. package/stdlib/calendar.js +1 -1
  108. package/stdlib/chart.js +1 -1
  109. package/stdlib/cli.js +1 -1
  110. package/stdlib/clipboard.js +1 -1
  111. package/stdlib/concurrency.js +1 -1
  112. package/stdlib/date.js +1 -1
  113. package/stdlib/email.js +1 -1
  114. package/stdlib/fs.js +1 -1
  115. package/stdlib/http.js +1 -1
  116. package/stdlib/imessage.js +1 -1
  117. package/stdlib/index.js +1 -1
  118. package/stdlib/keyring.js +1 -1
  119. package/stdlib/layout.js +1 -1
  120. package/stdlib/llm.js +1 -1
  121. package/stdlib/markdown.js +1 -1
  122. package/stdlib/math.js +1 -1
  123. package/stdlib/memory.js +1 -1
  124. package/stdlib/oauth.js +1 -1
  125. package/stdlib/object.js +1 -1
  126. package/stdlib/path.js +1 -1
  127. package/stdlib/policy.js +1 -1
  128. package/stdlib/schemas.js +1 -1
  129. package/stdlib/search.js +1 -1
  130. package/stdlib/shell.js +1 -1
  131. package/stdlib/skills.js +1 -1
  132. package/stdlib/sms.js +1 -1
  133. package/stdlib/speech.js +1 -1
  134. package/stdlib/statelog.js +1 -1
  135. package/stdlib/strategy.js +1 -1
  136. package/stdlib/syntax.js +1 -1
  137. package/stdlib/system.js +1 -1
  138. package/stdlib/table.js +1 -1
  139. package/stdlib/thread.agency +24 -0
  140. package/stdlib/thread.js +125 -3
  141. package/stdlib/threads.js +1 -1
  142. package/stdlib/types.js +1 -1
  143. package/stdlib/ui.js +1 -1
  144. package/stdlib/validators.js +1 -1
  145. package/stdlib/weather.js +1 -1
  146. package/stdlib/wikipedia.js +1 -1
  147. package/dist/lib/agents/agency-agent/code.js +0 -532
  148. package/dist/lib/agents/agency-agent/research.js +0 -311
  149. package/dist/lib/agents/agency-agent/toolWiring.js +0 -696
  150. package/dist/lib/agents/gepaReflect.js +0 -316
  151. 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: {
@@ -1946,13 +1947,37 @@ async function ___runTurn_impl(msg) {
1946
1947
  condition: async () => __stack.locals.trimmed === `/cost`,
1947
1948
  body: async (runner2) => {
1948
1949
  await runner2.step(0, async (runner3) => {
1950
+ });
1951
+ await runner2.step(1, async (runner3) => {
1952
+ __stack.locals.byModel = await __call(getModelCosts, {
1953
+ type: "positional",
1954
+ args: []
1955
+ });
1956
+ if (hasInterrupts(__stack.locals.byModel)) {
1957
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
1958
+ runner3.halt(__stack.locals.byModel);
1959
+ return;
1960
+ }
1961
+ });
1962
+ await runner2.step(2, async (runner3) => {
1963
+ __stack.locals.totalCost = 0;
1964
+ });
1965
+ await runner2.step(3, async (runner3) => {
1966
+ __stack.locals.totalTokens = 0;
1967
+ });
1968
+ await runner2.loop(4, __stack.locals.byModel, async (m, _, runner3) => {
1969
+ await runner3.step(0, async (runner4) => {
1970
+ __stack.locals.totalCost = __stack.locals.totalCost + m.cost;
1971
+ });
1972
+ await runner3.step(1, async (runner4) => {
1973
+ __stack.locals.totalTokens = __stack.locals.totalTokens + m.inputTokens + m.outputTokens;
1974
+ });
1975
+ });
1976
+ await runner2.step(5, async (runner3) => {
1949
1977
  __self.__retryable = false;
1950
1978
  const __funcResult = await __call(pushMessage, {
1951
1979
  type: "positional",
1952
- args: [`Cost: $${await __callMethod(await await __call(getCost, {
1953
- type: "positional",
1954
- args: []
1955
- }), "toFixed", {
1980
+ args: [`Cost: $${await __callMethod(__stack.locals.totalCost, "toFixed", {
1956
1981
  type: "positional",
1957
1982
  args: [4]
1958
1983
  })}`]
@@ -1963,14 +1988,11 @@ async function ___runTurn_impl(msg) {
1963
1988
  return;
1964
1989
  }
1965
1990
  });
1966
- await runner2.step(1, async (runner3) => {
1991
+ await runner2.step(6, async (runner3) => {
1967
1992
  __self.__retryable = false;
1968
1993
  const __funcResult = await __call(pushMessage, {
1969
1994
  type: "positional",
1970
- args: [`Tokens: ${await __call(getTokens, {
1971
- type: "positional",
1972
- args: []
1973
- })}`]
1995
+ args: [`Tokens: ${__stack.locals.totalTokens}`]
1974
1996
  });
1975
1997
  if (hasInterrupts(__funcResult)) {
1976
1998
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
@@ -1978,7 +2000,61 @@ async function ___runTurn_impl(msg) {
1978
2000
  return;
1979
2001
  }
1980
2002
  });
1981
- await runner2.step(2, async (runner3) => {
2003
+ await runner2.ifElse(7, [
2004
+ {
2005
+ condition: async () => __stack.locals.byModel.length > 0,
2006
+ body: async (runner3) => {
2007
+ await runner3.step(0, async (runner4) => {
2008
+ __self.__retryable = false;
2009
+ const __funcResult = await __call(pushMessage, {
2010
+ type: "positional",
2011
+ args: [``]
2012
+ });
2013
+ if (hasInterrupts(__funcResult)) {
2014
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
2015
+ runner4.halt(__funcResult);
2016
+ return;
2017
+ }
2018
+ });
2019
+ await runner3.step(1, async (runner4) => {
2020
+ __self.__retryable = false;
2021
+ const __funcResult = await __call(pushMessage, {
2022
+ type: "positional",
2023
+ args: [`By model:`]
2024
+ });
2025
+ if (hasInterrupts(__funcResult)) {
2026
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
2027
+ runner4.halt(__funcResult);
2028
+ return;
2029
+ }
2030
+ });
2031
+ await runner3.loop(2, __stack.locals.byModel, async (m, _, runner4) => {
2032
+ await runner4.step(0, async (runner5) => {
2033
+ __self.__retryable = false;
2034
+ const __funcResult = await __call(pushMessage, {
2035
+ type: "positional",
2036
+ args: [` ${m.model} \u2191${m.inputTokens} \u2193${m.outputTokens} $${await __callMethod(m.cost, "toFixed", {
2037
+ type: "positional",
2038
+ args: [4]
2039
+ })}`]
2040
+ });
2041
+ if (hasInterrupts(__funcResult)) {
2042
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
2043
+ runner5.halt(__funcResult);
2044
+ return;
2045
+ }
2046
+ });
2047
+ });
2048
+ await runner3.step(3, async (runner4) => {
2049
+ __self.__retryable = false;
2050
+ });
2051
+ }
2052
+ }
2053
+ ]);
2054
+ await runner2.step(8, async (runner3) => {
2055
+ __self.__retryable = false;
2056
+ });
2057
+ await runner2.step(9, async (runner3) => {
1982
2058
  __functionCompleted = true;
1983
2059
  runner3.halt(true);
1984
2060
  return;
@@ -3062,7 +3138,7 @@ async function __printHeader_impl() {
3062
3138
  await runner.step(1, async (runner2) => {
3063
3139
  __stack.locals.fig = await __call(sample, {
3064
3140
  type: "positional",
3065
- args: [__readStatic(figs, "figs", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/images/images.agency")]
3141
+ args: [__readStatic(figs, "figs", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/images/images.agency")]
3066
3142
  });
3067
3143
  if (hasInterrupts(__stack.locals.fig)) {
3068
3144
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
@@ -3356,7 +3432,7 @@ async function __givePolicyChoice_impl() {
3356
3432
  __stack.locals.title = `Welcome to the agency agent. Please pick a policy to start.`;
3357
3433
  });
3358
3434
  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.`;
3435
+ __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
3436
  });
3361
3437
  await runner.step(3, async (runner2) => {
3362
3438
  __stack.locals.items = [{
@@ -3387,7 +3463,7 @@ async function __givePolicyChoice_impl() {
3387
3463
  condition: async () => __stack.locals.answer === `minimal`,
3388
3464
  body: async (runner2) => {
3389
3465
  __functionCompleted = true;
3390
- runner2.halt(__readStatic(minimalAutoApprovePolicy, "minimalAutoApprovePolicy", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/defaultPolicy.agency"));
3466
+ runner2.halt(__readStatic(minimalAutoApprovePolicy, "minimalAutoApprovePolicy", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/defaultPolicy.agency"));
3391
3467
  return;
3392
3468
  }
3393
3469
  },
@@ -3395,7 +3471,7 @@ async function __givePolicyChoice_impl() {
3395
3471
  condition: async () => __stack.locals.answer === `recommended`,
3396
3472
  body: async (runner2) => {
3397
3473
  __functionCompleted = true;
3398
- runner2.halt(__readStatic(recommendedAutoApprovePolicy, "recommendedAutoApprovePolicy", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/defaultPolicy.agency"));
3474
+ runner2.halt(__readStatic(recommendedAutoApprovePolicy, "recommendedAutoApprovePolicy", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/defaultPolicy.agency"));
3399
3475
  return;
3400
3476
  }
3401
3477
  }
@@ -3557,7 +3633,7 @@ Current working directory: ${await __call(cwd, {
3557
3633
  __self.__retryable = false;
3558
3634
  __stack.locals.policy = await __call(parsePolicyFile, {
3559
3635
  type: "positional",
3560
- args: [__readStatic(POLICY_PATH, "POLICY_PATH", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/config.agency")]
3636
+ args: [__readStatic(POLICY_PATH, "POLICY_PATH", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/config.agency")]
3561
3637
  });
3562
3638
  if (hasInterrupts(__stack.locals.policy)) {
3563
3639
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
@@ -3585,7 +3661,7 @@ Current working directory: ${await __call(cwd, {
3585
3661
  type: "positional",
3586
3662
  args: [await __callMethod(color, "yellow", {
3587
3663
  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")}.`]
3664
+ 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
3665
  })]
3590
3666
  });
3591
3667
  if (hasInterrupts(__funcResult)) {
@@ -3598,7 +3674,7 @@ Current working directory: ${await __call(cwd, {
3598
3674
  __self.__retryable = false;
3599
3675
  const __funcResult = await __call(setPolicy, {
3600
3676
  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, {
3677
+ 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
3678
  type: "positional",
3603
3679
  args: []
3604
3680
  })]
@@ -3616,7 +3692,7 @@ Current working directory: ${await __call(cwd, {
3616
3692
  __self.__retryable = false;
3617
3693
  const __funcResult = await __call(setPolicy, {
3618
3694
  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")]
3695
+ 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
3696
  });
3621
3697
  if (hasInterrupts(__funcResult)) {
3622
3698
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
@@ -3665,7 +3741,7 @@ Current working directory: ${await __call(cwd, {
3665
3741
  __self.__retryable = false;
3666
3742
  const __funcResult = await __call(setPolicy, {
3667
3743
  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]
3744
+ 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
3745
  });
3670
3746
  if (hasInterrupts(__funcResult)) {
3671
3747
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
@@ -3684,8 +3760,8 @@ Current working directory: ${await __call(cwd, {
3684
3760
  type: "named",
3685
3761
  positionalArgs: [],
3686
3762
  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")
3763
+ file: __readStatic(POLICY_PATH, "POLICY_PATH", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/config.agency"),
3764
+ fields: __readStatic(ALWAYS_FIELDS, "ALWAYS_FIELDS", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/config.agency")
3689
3765
  }
3690
3766
  }));
3691
3767
  return;
@@ -4215,7 +4291,7 @@ async function __startInteractive_impl(handler, seedTarget, seedPrompt) {
4215
4291
  status: _buildStatus,
4216
4292
  onSubmit: _runTurn,
4217
4293
  prompt: `> `,
4218
- historyFile: __readStatic(HISTORY_PATH, "HISTORY_PATH", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/config.agency"),
4294
+ historyFile: __readStatic(HISTORY_PATH, "HISTORY_PATH", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/config.agency"),
4219
4295
  historyMax: 1e3,
4220
4296
  paletteCommands: await __call(mergedPalette, {
4221
4297
  type: "positional",
@@ -4814,7 +4890,8 @@ if (__process.argv[1] === fileURLToPath(import.meta.url)) {
4814
4890
  messages: new ThreadStore(),
4815
4891
  data: {}
4816
4892
  };
4817
- await main(initialState);
4893
+ const __result = await main(initialState);
4894
+ reportUnhandledInterrupts(__result);
4818
4895
  } catch (__error) {
4819
4896
  console.error(`
4820
4897
  Agent crashed: ${__error.message}`);
@@ -4822,7 +4899,7 @@ Agent crashed: ${__error.message}`);
4822
4899
  }
4823
4900
  }
4824
4901
  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 } } };
4902
+ 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": 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
4903
  export {
4827
4904
  __getCheckpoints,
4828
4905
  __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: {
@@ -57,7 +57,7 @@ const __globalCtx = new RuntimeContext({
57
57
  projectId: "agency-lang",
58
58
  debugMode: false,
59
59
  observability: true,
60
- logFile: "statelog.log"
60
+ logFile: "log.jsonl"
61
61
  },
62
62
  smoltalkDefaults: {
63
63
  openAiApiKey: __process.env["OPENAI_API_KEY"] || "",
@@ -263,25 +263,25 @@ and produce structured overviews. Typical questions you answer:
263
263
  - Don't pad the synthesis with restatements of the caller's
264
264
  question or apologies for length. Get to the substance.
265
265
  `);
266
- explorerTools = __deepFreeze([await __callMethod(__readStatic(read, "read", "/Users/adityabhargava/agency-lang/packages/agency-lang/stdlib/index.agency"), "partial", {
266
+ explorerTools = __deepFreeze([await __callMethod(__readStatic(read, "read", "/Users/abhargava/agency-lang/packages/agency-lang/stdlib/index.agency"), "partial", {
267
267
  type: "named",
268
268
  positionalArgs: [],
269
269
  namedArgs: {
270
270
  useAgentCwd: true
271
271
  }
272
- }), await __callMethod(__readStatic(ls, "ls", "/Users/adityabhargava/agency-lang/packages/agency-lang/stdlib/shell.agency"), "partial", {
272
+ }), await __callMethod(__readStatic(ls, "ls", "/Users/abhargava/agency-lang/packages/agency-lang/stdlib/shell.agency"), "partial", {
273
273
  type: "named",
274
274
  positionalArgs: [],
275
275
  namedArgs: {
276
276
  useAgentCwd: true
277
277
  }
278
- }), await __callMethod(__readStatic(glob, "glob", "/Users/adityabhargava/agency-lang/packages/agency-lang/stdlib/shell.agency"), "partial", {
278
+ }), await __callMethod(__readStatic(glob, "glob", "/Users/abhargava/agency-lang/packages/agency-lang/stdlib/shell.agency"), "partial", {
279
279
  type: "named",
280
280
  positionalArgs: [],
281
281
  namedArgs: {
282
282
  useAgentCwd: true
283
283
  }
284
- }), await __callMethod(__readStatic(grep, "grep", "/Users/adityabhargava/agency-lang/packages/agency-lang/stdlib/shell.agency"), "partial", {
284
+ }), await __callMethod(__readStatic(grep, "grep", "/Users/abhargava/agency-lang/packages/agency-lang/stdlib/shell.agency"), "partial", {
285
285
  type: "named",
286
286
  positionalArgs: [],
287
287
  namedArgs: {