agency-lang 0.6.2 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/dist/lib/agents/agency-agent/agent.agency +1 -1
  2. package/dist/lib/agents/agency-agent/agent.js +45 -112
  3. package/dist/lib/agents/agency-agent/code.js +532 -0
  4. package/dist/lib/agents/agency-agent/images/images.js +3 -0
  5. package/dist/lib/agents/agency-agent/lib/config.js +3 -0
  6. package/dist/lib/agents/agency-agent/lib/defaultPolicy.js +5 -6
  7. package/dist/lib/agents/agency-agent/lib/models.agency +154 -0
  8. package/dist/lib/agents/agency-agent/lib/models.js +711 -0
  9. package/dist/lib/agents/agency-agent/lib/utils.js +9 -22
  10. package/dist/lib/agents/agency-agent/prompts/codeSample.js +9 -22
  11. package/dist/lib/agents/agency-agent/research.js +311 -0
  12. package/dist/lib/agents/agency-agent/shared.agency +19 -67
  13. package/dist/lib/agents/agency-agent/shared.js +52 -150
  14. package/dist/lib/agents/agency-agent/subagents/code.js +16 -20
  15. package/dist/lib/agents/agency-agent/subagents/explorer.js +9 -10
  16. package/dist/lib/agents/agency-agent/subagents/oracle.js +10 -11
  17. package/dist/lib/agents/agency-agent/subagents/research.js +12 -13
  18. package/dist/lib/agents/agency-agent/subagents/review.js +12 -34
  19. package/dist/lib/agents/agency-agent/tests/agentTurn.js +5 -6
  20. package/dist/lib/agents/agency-agent/tests/execPolicy.js +15 -31
  21. package/dist/lib/agents/agency-agent/tests/toolWiring.js +13 -26
  22. package/dist/lib/agents/agency-agent/toolWiring.js +696 -0
  23. package/dist/lib/agents/docs/cli/cli/optimize.md +4 -2
  24. package/dist/lib/agents/docs/cli/optimize.md +4 -2
  25. package/dist/lib/agents/eval/goalJudge.agency +4 -1
  26. package/dist/lib/agents/eval/goalJudge.js +14 -10
  27. package/dist/lib/agents/eval/judge.js +5 -6
  28. package/dist/lib/agents/eval/judgePairwise.js +5 -6
  29. package/dist/lib/agents/gepaReflect.js +316 -0
  30. package/dist/lib/agents/mutatePrompt.js +301 -0
  31. package/dist/lib/agents/optimize/gepaReflect.js +5 -6
  32. package/dist/lib/agents/optimize/mutatePrompt.js +5 -6
  33. package/dist/lib/agents/policy/agent.js +16 -44
  34. package/dist/lib/agents/review/agent.js +6 -10
  35. package/dist/lib/backends/typescriptBuilder.integration.test.js +80 -0
  36. package/dist/lib/backends/typescriptBuilder.js +67 -17
  37. package/dist/lib/backends/typescriptGenerator/validationDescriptor.d.ts +6 -0
  38. package/dist/lib/backends/typescriptGenerator/validationDescriptor.js +108 -31
  39. package/dist/lib/cli/eval/optimize.js +4 -2
  40. package/dist/lib/optimize/baseOptimizer.d.ts +27 -0
  41. package/dist/lib/optimize/baseOptimizer.js +56 -3
  42. package/dist/lib/optimize/grading/functionGrader.d.ts +5 -1
  43. package/dist/lib/optimize/grading/functionGrader.js +9 -1
  44. package/dist/lib/optimize/grading/functionGrader.test.js +22 -0
  45. package/dist/lib/optimize/grading/graders/llmJudge.d.ts +1 -0
  46. package/dist/lib/optimize/grading/graders/llmJudge.js +5 -1
  47. package/dist/lib/optimize/grading/graders/llmJudge.test.js +12 -2
  48. package/dist/lib/optimize/optimizers/example.d.ts +9 -10
  49. package/dist/lib/optimize/optimizers/example.js +33 -33
  50. package/dist/lib/optimize/optimizers/example.test.js +11 -0
  51. package/dist/lib/optimize/optimizers/gepa.d.ts +0 -2
  52. package/dist/lib/optimize/optimizers/gepa.js +3 -18
  53. package/dist/lib/optimize/optimizers/gepa.test.js +11 -0
  54. package/dist/lib/optimize/optimizers/greedyReflective.d.ts +0 -7
  55. package/dist/lib/optimize/optimizers/greedyReflective.js +2 -36
  56. package/dist/lib/runtime/errors.d.ts +21 -10
  57. package/dist/lib/runtime/errors.js +46 -22
  58. package/dist/lib/runtime/errors.test.js +56 -2
  59. package/dist/lib/runtime/guard.d.ts +22 -5
  60. package/dist/lib/runtime/guard.js +30 -7
  61. package/dist/lib/runtime/guard.test.js +30 -1
  62. package/dist/lib/runtime/hooks.js +5 -2
  63. package/dist/lib/runtime/index.d.ts +2 -2
  64. package/dist/lib/runtime/index.js +2 -2
  65. package/dist/lib/runtime/node.d.ts +43 -0
  66. package/dist/lib/runtime/node.js +129 -52
  67. package/dist/lib/runtime/prompt.js +16 -28
  68. package/dist/lib/runtime/result.d.ts +6 -0
  69. package/dist/lib/runtime/result.js +19 -15
  70. package/dist/lib/runtime/result.test.js +55 -4
  71. package/dist/lib/runtime/runBatch.js +3 -2
  72. package/dist/lib/runtime/runBatch.test.js +33 -0
  73. package/dist/lib/runtime/state/stateStack.test.js +6 -2
  74. package/dist/lib/runtime/threadRepair.d.ts +36 -0
  75. package/dist/lib/runtime/threadRepair.js +69 -0
  76. package/dist/lib/runtime/threadRepair.test.d.ts +1 -0
  77. package/dist/lib/runtime/threadRepair.test.js +89 -0
  78. package/dist/lib/serve/discovery.js +24 -2
  79. package/dist/lib/serve/http/adapter.js +1 -5
  80. package/dist/lib/serve/http/adapter.test.js +3 -0
  81. package/dist/lib/serve/http/functionFrame.integration.test.d.ts +1 -0
  82. package/dist/lib/serve/http/functionFrame.integration.test.js +83 -0
  83. package/dist/lib/serve/mcp/adapter.js +1 -1
  84. package/dist/lib/serve/mcp/adapter.test.js +4 -2
  85. package/dist/lib/serve/mcp/httpTransport.test.js +1 -0
  86. package/dist/lib/serve/types.d.ts +10 -0
  87. package/dist/lib/stdlib/http.js +19 -2
  88. package/dist/lib/stdlib/thread.d.ts +29 -4
  89. package/dist/lib/stdlib/thread.js +60 -15
  90. package/dist/lib/templates/backends/typescriptGenerator/functionCatchFailure.d.ts +1 -1
  91. package/dist/lib/templates/backends/typescriptGenerator/functionCatchFailure.js +8 -15
  92. package/dist/lib/templates/backends/typescriptGenerator/imports.d.ts +1 -1
  93. package/dist/lib/templates/backends/typescriptGenerator/imports.js +7 -2
  94. package/dist/lib/typeChecker/valueParamSubstitution.js +17 -3
  95. package/package.json +1 -1
  96. package/stdlib/agency/eval.js +9 -22
  97. package/stdlib/agency.js +20 -66
  98. package/stdlib/agent.js +13 -38
  99. package/stdlib/args.js +5 -6
  100. package/stdlib/array.js +17 -54
  101. package/stdlib/browser.js +5 -6
  102. package/stdlib/calendar.js +10 -26
  103. package/stdlib/chart.js +8 -18
  104. package/stdlib/cli.js +10 -26
  105. package/stdlib/clipboard.js +6 -10
  106. package/stdlib/concurrency.js +5 -6
  107. package/stdlib/date.js +19 -62
  108. package/stdlib/email.js +7 -14
  109. package/stdlib/fs.js +10 -26
  110. package/stdlib/http.js +7 -14
  111. package/stdlib/imessage.js +5 -6
  112. package/stdlib/index.js +24 -82
  113. package/stdlib/keyring.js +8 -18
  114. package/stdlib/layout.js +22 -74
  115. package/stdlib/llm.agency +9 -3
  116. package/stdlib/llm.js +17 -21
  117. package/stdlib/markdown.js +8 -18
  118. package/stdlib/math.js +8 -18
  119. package/stdlib/memory.js +13 -38
  120. package/stdlib/oauth.js +8 -18
  121. package/stdlib/object.js +9 -22
  122. package/stdlib/path.js +11 -30
  123. package/stdlib/policy.js +22 -74
  124. package/stdlib/schemas.js +3 -0
  125. package/stdlib/search.js +5 -6
  126. package/stdlib/shell.js +12 -34
  127. package/stdlib/skills.js +13 -38
  128. package/stdlib/sms.js +5 -6
  129. package/stdlib/speech.js +7 -14
  130. package/stdlib/statelog.js +10 -26
  131. package/stdlib/strategy.js +9 -22
  132. package/stdlib/syntax.js +8 -18
  133. package/stdlib/system.js +15 -46
  134. package/stdlib/table.js +11 -30
  135. package/stdlib/thread.agency +4 -3
  136. package/stdlib/thread.js +25 -43
  137. package/stdlib/threads.js +9 -22
  138. package/stdlib/types.js +27 -0
  139. package/stdlib/ui.js +60 -226
  140. package/stdlib/validators.js +15 -46
  141. package/stdlib/weather.js +7 -14
  142. package/stdlib/wikipedia.js +7 -14
@@ -697,7 +697,7 @@ node main() {
697
697
  },
698
698
  provider: {
699
699
  type: "string",
700
- description: "Force the LLM provider (use when a model name doesn't imply one)"
700
+ description: "Force the LLM provider. Given alone (openai/anthropic/google) it selects that provider's default models and skips env auto-detection; pair it with --model for a custom/local model name"
701
701
  },
702
702
  interactive: {
703
703
  type: "boolean",
@@ -48,9 +48,9 @@ import {
48
48
  isDebugger,
49
49
  respondToInterrupts as _respondToInterrupts,
50
50
  rewindFrom as _rewindFrom,
51
+ runExportedFunction as _runExportedFunction,
51
52
  RestoreSignal,
52
- GuardExceededError,
53
- isAbortError as __isAbortError,
53
+ AgencyAbort,
54
54
  deepFreeze as __deepFreeze,
55
55
  __UNINIT_STATIC,
56
56
  __readStatic,
@@ -115,6 +115,7 @@ function propagate() {
115
115
  }
116
116
  const respondToInterrupts = (interrupts, responses, opts) => _respondToInterrupts({ ctx: __globalCtx, interrupts, responses, overrides: opts?.overrides, metadata: opts?.metadata, registerTopLevelCallbacks: __registerTopLevelCallbacks, moduleDir: __dirname });
117
117
  const rewindFrom = (checkpoint2, overrides, opts) => _rewindFrom({ ctx: __globalCtx, checkpoint: checkpoint2, overrides, metadata: opts?.metadata, registerTopLevelCallbacks: __registerTopLevelCallbacks, moduleDir: __dirname });
118
+ const __invokeFunction = (fn, namedArgs) => _runExportedFunction({ ctx: __globalCtx, fn, namedArgs, initializeGlobals: __initializeGlobals, registerTopLevelCallbacks: __registerTopLevelCallbacks, moduleDir: __dirname });
118
119
  const __setDebugger = (dbg) => {
119
120
  __globalCtx.debuggerState = dbg;
120
121
  };
@@ -398,31 +399,31 @@ unless the user has clearly asked for an action ("do X", "fix Y",
398
399
  "build Z"). If the user is exploring or thinking out loud, think
399
400
  with them \u2014 don't sprint to implementation.
400
401
  `);
401
- mainAgentTools = __deepFreeze([await __callMethod(__readStatic(researchAgent, "researchAgent", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/subagents/research.agency"), "partial", {
402
+ mainAgentTools = __deepFreeze([await __callMethod(__readStatic(researchAgent, "researchAgent", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/subagents/research.agency"), "partial", {
402
403
  type: "named",
403
404
  positionalArgs: [],
404
405
  namedArgs: {
405
406
  allowHandoff: false
406
407
  }
407
- }), await __callMethod(__readStatic(codeAgent, "codeAgent", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/subagents/code.agency"), "partial", {
408
+ }), await __callMethod(__readStatic(codeAgent, "codeAgent", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/subagents/code.agency"), "partial", {
408
409
  type: "named",
409
410
  positionalArgs: [],
410
411
  namedArgs: {
411
412
  allowHandoff: false
412
413
  }
413
- }), await __callMethod(__readStatic(reviewAgent, "reviewAgent", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/subagents/review.agency"), "partial", {
414
+ }), await __callMethod(__readStatic(reviewAgent, "reviewAgent", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/subagents/review.agency"), "partial", {
414
415
  type: "named",
415
416
  positionalArgs: [],
416
417
  namedArgs: {
417
418
  allowHandoff: false
418
419
  }
419
- }), await __callMethod(__readStatic(oracleAgent, "oracleAgent", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/subagents/oracle.agency"), "partial", {
420
+ }), await __callMethod(__readStatic(oracleAgent, "oracleAgent", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/subagents/oracle.agency"), "partial", {
420
421
  type: "named",
421
422
  positionalArgs: [],
422
423
  namedArgs: {
423
424
  allowHandoff: false
424
425
  }
425
- }), await __callMethod(__readStatic(explorerAgent, "explorerAgent", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/subagents/explorer.agency"), "partial", {
426
+ }), await __callMethod(__readStatic(explorerAgent, "explorerAgent", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/subagents/explorer.agency"), "partial", {
426
427
  type: "named",
427
428
  positionalArgs: [],
428
429
  namedArgs: {
@@ -565,10 +566,7 @@ async function ____cb_top_0_impl(data) {
565
566
  if (__error instanceof RestoreSignal) {
566
567
  throw __error;
567
568
  }
568
- if (__error instanceof GuardExceededError) {
569
- throw __error;
570
- }
571
- if (__isAbortError(__error)) {
569
+ if (__error instanceof AgencyAbort) {
572
570
  throw __error;
573
571
  }
574
572
  {
@@ -766,10 +764,7 @@ async function ____cb_top_1_impl(data) {
766
764
  if (__error instanceof RestoreSignal) {
767
765
  throw __error;
768
766
  }
769
- if (__error instanceof GuardExceededError) {
770
- throw __error;
771
- }
772
- if (__isAbortError(__error)) {
767
+ if (__error instanceof AgencyAbort) {
773
768
  throw __error;
774
769
  }
775
770
  {
@@ -906,10 +901,7 @@ async function ____cb_top_2_impl(data) {
906
901
  if (__error instanceof RestoreSignal) {
907
902
  throw __error;
908
903
  }
909
- if (__error instanceof GuardExceededError) {
910
- throw __error;
911
- }
912
- if (__isAbortError(__error)) {
904
+ if (__error instanceof AgencyAbort) {
913
905
  throw __error;
914
906
  }
915
907
  {
@@ -1049,10 +1041,7 @@ async function ____cb_top_3_impl(data) {
1049
1041
  if (__error instanceof RestoreSignal) {
1050
1042
  throw __error;
1051
1043
  }
1052
- if (__error instanceof GuardExceededError) {
1053
- throw __error;
1054
- }
1055
- if (__isAbortError(__error)) {
1044
+ if (__error instanceof AgencyAbort) {
1056
1045
  throw __error;
1057
1046
  }
1058
1047
  {
@@ -1162,10 +1151,7 @@ async function ___showTraces_impl() {
1162
1151
  if (__error instanceof RestoreSignal) {
1163
1152
  throw __error;
1164
1153
  }
1165
- if (__error instanceof GuardExceededError) {
1166
- throw __error;
1167
- }
1168
- if (__isAbortError(__error)) {
1154
+ if (__error instanceof AgencyAbort) {
1169
1155
  throw __error;
1170
1156
  }
1171
1157
  {
@@ -1323,10 +1309,7 @@ async function __renderLLMCallResponse_impl(data) {
1323
1309
  if (__error instanceof RestoreSignal) {
1324
1310
  throw __error;
1325
1311
  }
1326
- if (__error instanceof GuardExceededError) {
1327
- throw __error;
1328
- }
1329
- if (__isAbortError(__error)) {
1312
+ if (__error instanceof AgencyAbort) {
1330
1313
  throw __error;
1331
1314
  }
1332
1315
  {
@@ -1487,10 +1470,7 @@ ${__stack.locals.result.value}
1487
1470
  if (__error instanceof RestoreSignal) {
1488
1471
  throw __error;
1489
1472
  }
1490
- if (__error instanceof GuardExceededError) {
1491
- throw __error;
1492
- }
1493
- if (__isAbortError(__error)) {
1473
+ if (__error instanceof AgencyAbort) {
1494
1474
  throw __error;
1495
1475
  }
1496
1476
  {
@@ -1610,10 +1590,7 @@ async function __builtinPalette_impl() {
1610
1590
  if (__error instanceof RestoreSignal) {
1611
1591
  throw __error;
1612
1592
  }
1613
- if (__error instanceof GuardExceededError) {
1614
- throw __error;
1615
- }
1616
- if (__isAbortError(__error)) {
1593
+ if (__error instanceof AgencyAbort) {
1617
1594
  throw __error;
1618
1595
  }
1619
1596
  {
@@ -1754,10 +1731,7 @@ async function __mergedPalette_impl() {
1754
1731
  if (__error instanceof RestoreSignal) {
1755
1732
  throw __error;
1756
1733
  }
1757
- if (__error instanceof GuardExceededError) {
1758
- throw __error;
1759
- }
1760
- if (__isAbortError(__error)) {
1734
+ if (__error instanceof AgencyAbort) {
1761
1735
  throw __error;
1762
1736
  }
1763
1737
  {
@@ -2133,10 +2107,7 @@ async function ___runTurn_impl(msg) {
2133
2107
  if (__error instanceof RestoreSignal) {
2134
2108
  throw __error;
2135
2109
  }
2136
- if (__error instanceof GuardExceededError) {
2137
- throw __error;
2138
- }
2139
- if (__isAbortError(__error)) {
2110
+ if (__error instanceof AgencyAbort) {
2140
2111
  throw __error;
2141
2112
  }
2142
2113
  {
@@ -2316,10 +2287,7 @@ async function __mainAgent_impl(prompt) {
2316
2287
  if (__error instanceof RestoreSignal) {
2317
2288
  throw __error;
2318
2289
  }
2319
- if (__error instanceof GuardExceededError) {
2320
- throw __error;
2321
- }
2322
- if (__isAbortError(__error)) {
2290
+ if (__error instanceof AgencyAbort) {
2323
2291
  throw __error;
2324
2292
  }
2325
2293
  {
@@ -2552,10 +2520,7 @@ async function __agentReplyVia_impl(target, userMsg) {
2552
2520
  if (__error instanceof RestoreSignal) {
2553
2521
  throw __error;
2554
2522
  }
2555
- if (__error instanceof GuardExceededError) {
2556
- throw __error;
2557
- }
2558
- if (__isAbortError(__error)) {
2523
+ if (__error instanceof AgencyAbort) {
2559
2524
  throw __error;
2560
2525
  }
2561
2526
  {
@@ -2681,10 +2646,7 @@ async function __agentReply_impl(userMsg) {
2681
2646
  if (__error instanceof RestoreSignal) {
2682
2647
  throw __error;
2683
2648
  }
2684
- if (__error instanceof GuardExceededError) {
2685
- throw __error;
2686
- }
2687
- if (__isAbortError(__error)) {
2649
+ if (__error instanceof AgencyAbort) {
2688
2650
  throw __error;
2689
2651
  }
2690
2652
  {
@@ -2800,10 +2762,7 @@ async function __roundedCost_impl() {
2800
2762
  if (__error instanceof RestoreSignal) {
2801
2763
  throw __error;
2802
2764
  }
2803
- if (__error instanceof GuardExceededError) {
2804
- throw __error;
2805
- }
2806
- if (__isAbortError(__error)) {
2765
+ if (__error instanceof AgencyAbort) {
2807
2766
  throw __error;
2808
2767
  }
2809
2768
  {
@@ -2914,10 +2873,7 @@ async function ___buildStatus_impl() {
2914
2873
  if (__error instanceof RestoreSignal) {
2915
2874
  throw __error;
2916
2875
  }
2917
- if (__error instanceof GuardExceededError) {
2918
- throw __error;
2919
- }
2920
- if (__isAbortError(__error)) {
2876
+ if (__error instanceof AgencyAbort) {
2921
2877
  throw __error;
2922
2878
  }
2923
2879
  {
@@ -3034,10 +2990,7 @@ async function __sample_impl(arr) {
3034
2990
  if (__error instanceof RestoreSignal) {
3035
2991
  throw __error;
3036
2992
  }
3037
- if (__error instanceof GuardExceededError) {
3038
- throw __error;
3039
- }
3040
- if (__isAbortError(__error)) {
2993
+ if (__error instanceof AgencyAbort) {
3041
2994
  throw __error;
3042
2995
  }
3043
2996
  {
@@ -3134,7 +3087,7 @@ async function __printHeader_impl() {
3134
3087
  await runner.step(1, async (runner2) => {
3135
3088
  __stack.locals.fig = await __call(sample, {
3136
3089
  type: "positional",
3137
- args: [__readStatic(figs, "figs", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/images/images.agency")]
3090
+ args: [__readStatic(figs, "figs", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/images/images.agency")]
3138
3091
  });
3139
3092
  if (hasInterrupts(__stack.locals.fig)) {
3140
3093
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
@@ -3332,10 +3285,7 @@ async function __printHeader_impl() {
3332
3285
  if (__error instanceof RestoreSignal) {
3333
3286
  throw __error;
3334
3287
  }
3335
- if (__error instanceof GuardExceededError) {
3336
- throw __error;
3337
- }
3338
- if (__isAbortError(__error)) {
3288
+ if (__error instanceof AgencyAbort) {
3339
3289
  throw __error;
3340
3290
  }
3341
3291
  {
@@ -3427,7 +3377,7 @@ async function __givePolicyChoice_impl() {
3427
3377
  __stack.locals.title = `Welcome to the agency agent. Please pick a policy to start.`;
3428
3378
  });
3429
3379
  await runner.step(2, async (runner2) => {
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.`;
3380
+ __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.`;
3431
3381
  });
3432
3382
  await runner.step(3, async (runner2) => {
3433
3383
  __stack.locals.items = [{
@@ -3458,7 +3408,7 @@ async function __givePolicyChoice_impl() {
3458
3408
  condition: async () => __stack.locals.answer === `minimal`,
3459
3409
  body: async (runner2) => {
3460
3410
  __functionCompleted = true;
3461
- runner2.halt(__readStatic(minimalAutoApprovePolicy, "minimalAutoApprovePolicy", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/defaultPolicy.agency"));
3411
+ runner2.halt(__readStatic(minimalAutoApprovePolicy, "minimalAutoApprovePolicy", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/defaultPolicy.agency"));
3462
3412
  return;
3463
3413
  }
3464
3414
  },
@@ -3466,7 +3416,7 @@ async function __givePolicyChoice_impl() {
3466
3416
  condition: async () => __stack.locals.answer === `recommended`,
3467
3417
  body: async (runner2) => {
3468
3418
  __functionCompleted = true;
3469
- runner2.halt(__readStatic(recommendedAutoApprovePolicy, "recommendedAutoApprovePolicy", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/defaultPolicy.agency"));
3419
+ runner2.halt(__readStatic(recommendedAutoApprovePolicy, "recommendedAutoApprovePolicy", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/defaultPolicy.agency"));
3470
3420
  return;
3471
3421
  }
3472
3422
  }
@@ -3482,10 +3432,7 @@ async function __givePolicyChoice_impl() {
3482
3432
  if (__error instanceof RestoreSignal) {
3483
3433
  throw __error;
3484
3434
  }
3485
- if (__error instanceof GuardExceededError) {
3486
- throw __error;
3487
- }
3488
- if (__isAbortError(__error)) {
3435
+ if (__error instanceof AgencyAbort) {
3489
3436
  throw __error;
3490
3437
  }
3491
3438
  {
@@ -3628,7 +3575,7 @@ Current working directory: ${await __call(cwd, {
3628
3575
  __self.__retryable = false;
3629
3576
  __stack.locals.policy = await __call(parsePolicyFile, {
3630
3577
  type: "positional",
3631
- args: [__readStatic(POLICY_PATH, "POLICY_PATH", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/config.agency")]
3578
+ args: [__readStatic(POLICY_PATH, "POLICY_PATH", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/config.agency")]
3632
3579
  });
3633
3580
  if (hasInterrupts(__stack.locals.policy)) {
3634
3581
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
@@ -3656,7 +3603,7 @@ Current working directory: ${await __call(cwd, {
3656
3603
  type: "positional",
3657
3604
  args: [await __callMethod(color, "yellow", {
3658
3605
  type: "positional",
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")}.`]
3606
+ 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")}.`]
3660
3607
  })]
3661
3608
  });
3662
3609
  if (hasInterrupts(__funcResult)) {
@@ -3669,7 +3616,7 @@ Current working directory: ${await __call(cwd, {
3669
3616
  __self.__retryable = false;
3670
3617
  const __funcResult = await __call(setPolicy, {
3671
3618
  type: "positional",
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, {
3619
+ args: [__readStatic(POLICY_PATH, "POLICY_PATH", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/config.agency"), await __call(givePolicyChoice, {
3673
3620
  type: "positional",
3674
3621
  args: []
3675
3622
  })]
@@ -3687,7 +3634,7 @@ Current working directory: ${await __call(cwd, {
3687
3634
  __self.__retryable = false;
3688
3635
  const __funcResult = await __call(setPolicy, {
3689
3636
  type: "positional",
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")]
3637
+ 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")]
3691
3638
  });
3692
3639
  if (hasInterrupts(__funcResult)) {
3693
3640
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
@@ -3736,7 +3683,7 @@ Current working directory: ${await __call(cwd, {
3736
3683
  __self.__retryable = false;
3737
3684
  const __funcResult = await __call(setPolicy, {
3738
3685
  type: "positional",
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]
3686
+ 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]
3740
3687
  });
3741
3688
  if (hasInterrupts(__funcResult)) {
3742
3689
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
@@ -3755,8 +3702,8 @@ Current working directory: ${await __call(cwd, {
3755
3702
  type: "named",
3756
3703
  positionalArgs: [],
3757
3704
  namedArgs: {
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")
3705
+ file: __readStatic(POLICY_PATH, "POLICY_PATH", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/config.agency"),
3706
+ fields: __readStatic(ALWAYS_FIELDS, "ALWAYS_FIELDS", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/config.agency")
3760
3707
  }
3761
3708
  }));
3762
3709
  return;
@@ -3772,10 +3719,7 @@ Current working directory: ${await __call(cwd, {
3772
3719
  if (__error instanceof RestoreSignal) {
3773
3720
  throw __error;
3774
3721
  }
3775
- if (__error instanceof GuardExceededError) {
3776
- throw __error;
3777
- }
3778
- if (__isAbortError(__error)) {
3722
+ if (__error instanceof AgencyAbort) {
3779
3723
  throw __error;
3780
3724
  }
3781
3725
  {
@@ -3933,10 +3877,7 @@ async function __oneShotAgent_impl(target, prompt) {
3933
3877
  if (__error instanceof RestoreSignal) {
3934
3878
  throw __error;
3935
3879
  }
3936
- if (__error instanceof GuardExceededError) {
3937
- throw __error;
3938
- }
3939
- if (__isAbortError(__error)) {
3880
+ if (__error instanceof AgencyAbort) {
3940
3881
  throw __error;
3941
3882
  }
3942
3883
  {
@@ -4131,10 +4072,7 @@ async function ___runSeedTurn_impl(target, msg) {
4131
4072
  if (__error instanceof RestoreSignal) {
4132
4073
  throw __error;
4133
4074
  }
4134
- if (__error instanceof GuardExceededError) {
4135
- throw __error;
4136
- }
4137
- if (__isAbortError(__error)) {
4075
+ if (__error instanceof AgencyAbort) {
4138
4076
  throw __error;
4139
4077
  }
4140
4078
  {
@@ -4286,7 +4224,7 @@ async function __startInteractive_impl(handler, seedTarget, seedPrompt) {
4286
4224
  status: _buildStatus,
4287
4225
  onSubmit: _runTurn,
4288
4226
  prompt: `> `,
4289
- historyFile: __readStatic(HISTORY_PATH, "HISTORY_PATH", "/Users/abhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/config.agency"),
4227
+ historyFile: __readStatic(HISTORY_PATH, "HISTORY_PATH", "/Users/adityabhargava/agency-lang/packages/agency-lang/dist/lib/agents/agency-agent/lib/config.agency"),
4290
4228
  historyMax: 1e3,
4291
4229
  paletteCommands: await __call(mergedPalette, {
4292
4230
  type: "positional",
@@ -4330,10 +4268,7 @@ Goodbye!`]
4330
4268
  if (__error instanceof RestoreSignal) {
4331
4269
  throw __error;
4332
4270
  }
4333
- if (__error instanceof GuardExceededError) {
4334
- throw __error;
4335
- }
4336
- if (__isAbortError(__error)) {
4271
+ if (__error instanceof AgencyAbort) {
4337
4272
  throw __error;
4338
4273
  }
4339
4274
  {
@@ -4469,7 +4404,7 @@ graph.node("main", async (__state) => {
4469
4404
  },
4470
4405
  "provider": {
4471
4406
  "type": `string`,
4472
- "description": `Force the LLM provider (use when a model name doesn't imply one)`
4407
+ "description": `Force the LLM provider. Given alone (openai/anthropic/google) it selects that provider's default models and skips env auto-detection; pair it with --model for a custom/local model name`
4473
4408
  },
4474
4409
  "interactive": {
4475
4410
  "type": `boolean`,
@@ -4842,10 +4777,7 @@ graph.node("main", async (__state) => {
4842
4777
  if (__error instanceof RestoreSignal) {
4843
4778
  throw __error;
4844
4779
  }
4845
- if (__error instanceof GuardExceededError) {
4846
- throw __error;
4847
- }
4848
- if (__isAbortError(__error)) {
4780
+ if (__error instanceof AgencyAbort) {
4849
4781
  throw __error;
4850
4782
  }
4851
4783
  {
@@ -4897,6 +4829,7 @@ var stdin_default = graph;
4897
4829
  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 } } };
4898
4830
  export {
4899
4831
  __getCheckpoints,
4832
+ __invokeFunction,
4900
4833
  __mainNodeParams,
4901
4834
  __setDebugger,
4902
4835
  __setLLMClient,