agency-lang 0.22.0 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/dist/lib/agents/agency-agent/agent.agency +14 -0
  2. package/dist/lib/agents/agency-agent/agent.js +132 -49
  3. package/dist/lib/agents/agency-agent/lib/args.agency +4 -0
  4. package/dist/lib/agents/agency-agent/lib/args.js +6 -2
  5. package/dist/lib/agents/agency-agent/lib/effort.agency +26 -0
  6. package/dist/lib/agents/agency-agent/lib/effort.js +408 -0
  7. package/dist/lib/backends/typescriptBuilder.js +13 -0
  8. package/dist/lib/cli/docLedger.d.ts +3 -0
  9. package/dist/lib/cli/docLedger.js +8 -3
  10. package/dist/lib/cli/localFlag.d.ts +1 -1
  11. package/dist/lib/cli/localFlag.js +19 -2
  12. package/dist/lib/cli/localServe.d.ts +71 -6
  13. package/dist/lib/cli/localServe.js +120 -24
  14. package/dist/lib/cli/mlxChatServer.py +1372 -0
  15. package/dist/lib/cli/mlxServer.d.ts +16 -2
  16. package/dist/lib/cli/mlxServer.js +36 -6
  17. package/dist/lib/cli/statelog/spendTypes.d.ts +4 -0
  18. package/dist/lib/cli/statelog/spendTypes.js +1 -0
  19. package/dist/lib/compiler/buildManifest.d.ts +18 -1
  20. package/dist/lib/compiler/buildManifest.js +58 -13
  21. package/dist/lib/compiler/manifestTracker.d.ts +3 -0
  22. package/dist/lib/compiler/manifestTracker.js +10 -5
  23. package/dist/lib/config/config.d.ts +26 -0
  24. package/dist/lib/config/config.js +25 -0
  25. package/dist/lib/logsViewer/spanText.js +9 -0
  26. package/dist/lib/logsViewer/summary.js +7 -0
  27. package/dist/lib/logsViewer/tree.js +1 -0
  28. package/dist/lib/runtime/agencyLlm.d.ts +5 -0
  29. package/dist/lib/runtime/agencyLlm.js +4 -0
  30. package/dist/lib/runtime/asyncContext.d.ts +7 -0
  31. package/dist/lib/runtime/decision/collector.d.ts +69 -0
  32. package/dist/lib/runtime/decision/collector.js +251 -0
  33. package/dist/lib/runtime/decision/dispatch.d.ts +24 -0
  34. package/dist/lib/runtime/decision/dispatch.js +136 -0
  35. package/dist/lib/runtime/decision/questions.d.ts +40 -0
  36. package/dist/lib/runtime/decision/questions.js +163 -0
  37. package/dist/lib/runtime/deterministicClient.d.ts +15 -2
  38. package/dist/lib/runtime/deterministicClient.js +80 -0
  39. package/dist/lib/runtime/index.d.ts +2 -2
  40. package/dist/lib/runtime/index.js +1 -1
  41. package/dist/lib/runtime/invocationUsage.d.ts +1 -1
  42. package/dist/lib/runtime/invocationUsage.js +2 -0
  43. package/dist/lib/runtime/llmClient.d.ts +14 -0
  44. package/dist/lib/runtime/llmClient.js +16 -1
  45. package/dist/lib/runtime/llmConfig.d.ts +8 -0
  46. package/dist/lib/runtime/llmConfig.js +44 -0
  47. package/dist/lib/runtime/llmDispatch.d.ts +7 -1
  48. package/dist/lib/runtime/llmDispatch.js +21 -2
  49. package/dist/lib/runtime/localDefaults.d.ts +82 -0
  50. package/dist/lib/runtime/localDefaults.js +207 -0
  51. package/dist/lib/runtime/policy.js +7 -4
  52. package/dist/lib/runtime/prompt.d.ts +4 -0
  53. package/dist/lib/runtime/prompt.js +27 -18
  54. package/dist/lib/runtime/recordPaidUsage.d.ts +1 -1
  55. package/dist/lib/runtime/recordPaidUsage.js +2 -2
  56. package/dist/lib/runtime/resumableScope.js +3 -0
  57. package/dist/lib/runtime/runBatch.d.ts +11 -0
  58. package/dist/lib/runtime/runBatch.js +15 -4
  59. package/dist/lib/runtime/runner.js +44 -0
  60. package/dist/lib/runtime/state/context.d.ts +1 -1
  61. package/dist/lib/runtime/state/context.js +3 -2
  62. package/dist/lib/runtime/utils.d.ts +25 -0
  63. package/dist/lib/runtime/utils.js +47 -0
  64. package/dist/lib/statelogClient.d.ts +15 -2
  65. package/dist/lib/statelogClient.js +11 -0
  66. package/dist/lib/stdlib/llm.d.ts +20 -1
  67. package/dist/lib/stdlib/llm.js +25 -4
  68. package/dist/lib/stdlib/modelCatalog.d.ts +18 -0
  69. package/dist/lib/stdlib/modelCatalog.js +142 -0
  70. package/dist/lib/stdlib/thread.d.ts +30 -0
  71. package/dist/lib/stdlib/thread.js +51 -0
  72. package/dist/lib/typeChecker/builtins.js +35 -0
  73. package/dist/scripts/agency.js +16 -1
  74. package/package.json +6 -2
  75. package/stdlib/docs/cli/local.md +2 -2
  76. package/stdlib/docs/guide/agency-config-file.md +2 -0
  77. package/stdlib/docs/guide/custom-providers.md +2 -0
  78. package/stdlib/docs/guide/decision-models.md +275 -0
  79. package/stdlib/docs/guide/llm-part-2.md +18 -2
  80. package/stdlib/docs/guide/llm.md +4 -1
  81. package/stdlib/docs/guide/message-threads.md +78 -2
  82. package/stdlib/docs/guide/policies.md +15 -0
  83. package/stdlib/docs/guide/using-local-models.md +203 -9
  84. package/stdlib/docs/stdlib/llm.md +40 -14
  85. package/stdlib/docs/stdlib/thread.md +228 -26
  86. package/stdlib/llm.agency +15 -1
  87. package/stdlib/llm.js +3 -3
  88. package/stdlib/thread.agency +114 -0
  89. package/stdlib/thread.js +149 -3
@@ -10,6 +10,7 @@ import { clearMessages, pushMessage, repl, clearScreen } from "std::ui/cli"
10
10
  import { brainByName, allBrains } from "./brains/registry.agency"
11
11
  import { agentNameFor } from "./lib/agentName.agency"
12
12
  import { parseAgentArgs } from "./lib/args.agency"
13
+ import { parseEffort } from "./lib/effort.agency"
13
14
  import { mergedPalette } from "./lib/commandPalette.agency"
14
15
  import { getHeader } from "./lib/header.agency"
15
16
  import { maybeLoadMcp } from "./lib/mcp.agency"
@@ -159,6 +160,19 @@ node main() {
159
160
  maxTokens: capsMaxTokens
160
161
  })
161
162
  }
163
+ // --effort sets the provider's reasoning effort on every call. Without
164
+ // it a reasoning model runs at the provider's default, which is not
165
+ // what a benchmark run under fixed conditions wants.
166
+ const effort = parseEffort(args.flags.effort ?? null)
167
+ if (effort.error != "") {
168
+ print(color.red(effort.error))
169
+ process.exit(1)
170
+ }
171
+ if (effort.level != null) {
172
+ setLlmOptions({
173
+ reasoningEffort: effort.level
174
+ })
175
+ }
162
176
 
163
177
  setAgentCwd(cwd())
164
178
 
@@ -10,6 +10,7 @@ import { clearMessages, pushMessage, repl, clearScreen } from "agency-lang/stdli
10
10
  import { brainByName, allBrains } from "./brains/registry.js";
11
11
  import { agentNameFor } from "./lib/agentName.js";
12
12
  import { parseAgentArgs } from "./lib/args.js";
13
+ import { parseEffort } from "./lib/effort.js";
13
14
  import { mergedPalette } from "./lib/commandPalette.js";
14
15
  import { getHeader } from "./lib/header.js";
15
16
  import { maybeLoadMcp } from "./lib/mcp.js";
@@ -186,7 +187,7 @@ function registerTools(tools) {
186
187
  }
187
188
  }
188
189
  }
189
- __registerModuleFingerprint("dist/lib/agents/agency-agent/agent.agency", "7895daaab342ab8c994c7efdfb878130c18dbfcc1826734ca9029f25bc4ab6a6", import.meta.url);
190
+ __registerModuleFingerprint("dist/lib/agents/agency-agent/agent.agency", "36859b3fce9a08dda5d9dbb68aeb4e928266f8f5b45fefaba17e89da160b07cf", import.meta.url);
190
191
  __registerTool(print);
191
192
  __registerTool(printJSON);
192
193
  __registerTool(input);
@@ -239,6 +240,7 @@ __registerTool(brainByName);
239
240
  __registerTool(allBrains);
240
241
  __registerTool(agentNameFor);
241
242
  __registerTool(parseAgentArgs);
243
+ __registerTool(parseEffort);
242
244
  __registerTool(mergedPalette);
243
245
  __registerTool(getHeader);
244
246
  __registerTool(maybeLoadMcp);
@@ -1238,26 +1240,107 @@ graph.node("main", async (__state) => {
1238
1240
  }
1239
1241
  ]);
1240
1242
  await runner.step(38, async (runner2) => {
1241
- __stack.locals.__hoist_11 = await __call(cwd, {
1243
+ });
1244
+ await runner.step(39, async (runner2) => {
1245
+ __stack.locals.effort = await __call(parseEffort, {
1246
+ type: "positional",
1247
+ args: [__stack.locals.args.flags.effort ?? null]
1248
+ });
1249
+ if (hasInterrupts(__stack.locals.effort)) {
1250
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
1251
+ runner2.halt({
1252
+ ...__state,
1253
+ data: __stack.locals.effort
1254
+ });
1255
+ return;
1256
+ }
1257
+ if (isAborted(__stack.locals.effort)) {
1258
+ throw __stack.locals.effort.toError();
1259
+ }
1260
+ });
1261
+ await runner.ifElse(40, [
1262
+ {
1263
+ condition: async () => !__eq(__stack.locals.effort.error, ``),
1264
+ body: async (runner2) => {
1265
+ await runner2.step(0, async (runner3) => {
1266
+ __stack.locals.__hoist_11 = await __callMethod(color, "red", {
1267
+ type: "positional",
1268
+ args: [__stack.locals.effort.error]
1269
+ });
1270
+ });
1271
+ await runner2.step(1, async (runner3) => {
1272
+ const __funcResult = await __call(print, {
1273
+ type: "positional",
1274
+ args: [__stack.locals.__hoist_11]
1275
+ });
1276
+ if (hasInterrupts(__funcResult)) {
1277
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
1278
+ runner3.halt({
1279
+ ...__state,
1280
+ data: __funcResult
1281
+ });
1282
+ return;
1283
+ }
1284
+ if (isAborted(__funcResult)) {
1285
+ throw __funcResult.toError();
1286
+ }
1287
+ });
1288
+ await runner2.step(2, async (runner3) => {
1289
+ await __callMethod(process, "exit", {
1290
+ type: "positional",
1291
+ args: [1]
1292
+ });
1293
+ });
1294
+ }
1295
+ }
1296
+ ]);
1297
+ await runner.ifElse(41, [
1298
+ {
1299
+ condition: async () => !__eq(__stack.locals.effort.level, null),
1300
+ body: async (runner2) => {
1301
+ await runner2.step(0, async (runner3) => {
1302
+ const __funcResult = await __call(setLlmOptions, {
1303
+ type: "positional",
1304
+ args: [{
1305
+ "reasoningEffort": __stack.locals.effort.level
1306
+ }]
1307
+ });
1308
+ if (hasInterrupts(__funcResult)) {
1309
+ await getRuntimeContext().ctx.pendingPromises.awaitAll();
1310
+ runner3.halt({
1311
+ ...__state,
1312
+ data: __funcResult
1313
+ });
1314
+ return;
1315
+ }
1316
+ if (isAborted(__funcResult)) {
1317
+ throw __funcResult.toError();
1318
+ }
1319
+ });
1320
+ }
1321
+ }
1322
+ ]);
1323
+ await runner.step(42, async (runner2) => {
1324
+ __stack.locals.__hoist_12 = await __call(cwd, {
1242
1325
  type: "positional",
1243
1326
  args: []
1244
1327
  });
1245
- if (hasInterrupts(__stack.locals.__hoist_11)) {
1328
+ if (hasInterrupts(__stack.locals.__hoist_12)) {
1246
1329
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
1247
1330
  runner2.halt({
1248
1331
  ...__state,
1249
- data: __stack.locals.__hoist_11
1332
+ data: __stack.locals.__hoist_12
1250
1333
  });
1251
1334
  return;
1252
1335
  }
1253
- if (isAborted(__stack.locals.__hoist_11)) {
1254
- throw __stack.locals.__hoist_11.toError();
1336
+ if (isAborted(__stack.locals.__hoist_12)) {
1337
+ throw __stack.locals.__hoist_12.toError();
1255
1338
  }
1256
1339
  });
1257
- await runner.step(39, async (runner2) => {
1340
+ await runner.step(43, async (runner2) => {
1258
1341
  const __funcResult = await __call(setAgentCwd, {
1259
1342
  type: "positional",
1260
- args: [__stack.locals.__hoist_11]
1343
+ args: [__stack.locals.__hoist_12]
1261
1344
  });
1262
1345
  if (hasInterrupts(__funcResult)) {
1263
1346
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
@@ -1271,12 +1354,12 @@ graph.node("main", async (__state) => {
1271
1354
  throw __funcResult.toError();
1272
1355
  }
1273
1356
  });
1274
- await runner.ifElse(40, [
1357
+ await runner.ifElse(44, [
1275
1358
  {
1276
1359
  condition: async () => __stack.locals.isOneShot && (__stack.locals.args.flags.continue || !__eq(__stack.locals.args.flags.resume, null)),
1277
1360
  body: async (runner2) => {
1278
1361
  await runner2.step(0, async (runner3) => {
1279
- __stack.locals.__hoist_12 = await __callMethod(color, "red", {
1362
+ __stack.locals.__hoist_13 = await __callMethod(color, "red", {
1280
1363
  type: "positional",
1281
1364
  args: [`--continue and --resume need an interactive session; one-shot runs are not saved.`]
1282
1365
  });
@@ -1284,7 +1367,7 @@ graph.node("main", async (__state) => {
1284
1367
  await runner2.step(1, async (runner3) => {
1285
1368
  const __funcResult = await __call(print, {
1286
1369
  type: "positional",
1287
- args: [__stack.locals.__hoist_12]
1370
+ args: [__stack.locals.__hoist_13]
1288
1371
  });
1289
1372
  if (hasInterrupts(__funcResult)) {
1290
1373
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
@@ -1307,9 +1390,9 @@ graph.node("main", async (__state) => {
1307
1390
  }
1308
1391
  }
1309
1392
  ]);
1310
- await runner.step(41, async (runner2) => {
1393
+ await runner.step(45, async (runner2) => {
1311
1394
  });
1312
- await runner.ifElse(42, [
1395
+ await runner.ifElse(46, [
1313
1396
  {
1314
1397
  condition: async () => !__stack.locals.isOneShot,
1315
1398
  body: async (runner2) => {
@@ -1331,26 +1414,26 @@ graph.node("main", async (__state) => {
1331
1414
  }
1332
1415
  });
1333
1416
  await runner2.step(1, async (runner3) => {
1334
- __stack.locals.__hoist_13 = await __call(mergedPalette, {
1417
+ __stack.locals.__hoist_14 = await __call(mergedPalette, {
1335
1418
  type: "positional",
1336
1419
  args: []
1337
1420
  });
1338
- if (hasInterrupts(__stack.locals.__hoist_13)) {
1421
+ if (hasInterrupts(__stack.locals.__hoist_14)) {
1339
1422
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
1340
1423
  runner3.halt({
1341
1424
  ...__state,
1342
- data: __stack.locals.__hoist_13
1425
+ data: __stack.locals.__hoist_14
1343
1426
  });
1344
1427
  return;
1345
1428
  }
1346
- if (isAborted(__stack.locals.__hoist_13)) {
1347
- throw __stack.locals.__hoist_13.toError();
1429
+ if (isAborted(__stack.locals.__hoist_14)) {
1430
+ throw __stack.locals.__hoist_14.toError();
1348
1431
  }
1349
1432
  });
1350
1433
  await runner2.step(2, async (runner3) => {
1351
1434
  const __funcResult = await __call(setSlashPalette, {
1352
1435
  type: "positional",
1353
- args: [__stack.locals.__hoist_13]
1436
+ args: [__stack.locals.__hoist_14]
1354
1437
  });
1355
1438
  if (hasInterrupts(__funcResult)) {
1356
1439
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
@@ -1365,26 +1448,26 @@ graph.node("main", async (__state) => {
1365
1448
  }
1366
1449
  });
1367
1450
  await runner2.step(3, async (runner3) => {
1368
- __stack.locals.__hoist_14 = await __call(chooseSession, {
1451
+ __stack.locals.__hoist_15 = await __call(chooseSession, {
1369
1452
  type: "positional",
1370
1453
  args: [__stack.locals.args.flags.continue, __stack.locals.args.flags.resume ?? null]
1371
1454
  });
1372
- if (hasInterrupts(__stack.locals.__hoist_14)) {
1455
+ if (hasInterrupts(__stack.locals.__hoist_15)) {
1373
1456
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
1374
1457
  runner3.halt({
1375
1458
  ...__state,
1376
- data: __stack.locals.__hoist_14
1459
+ data: __stack.locals.__hoist_15
1377
1460
  });
1378
1461
  return;
1379
1462
  }
1380
- if (isAborted(__stack.locals.__hoist_14)) {
1381
- throw __stack.locals.__hoist_14.toError();
1463
+ if (isAborted(__stack.locals.__hoist_15)) {
1464
+ throw __stack.locals.__hoist_15.toError();
1382
1465
  }
1383
1466
  });
1384
1467
  await runner2.step(4, async (runner3) => {
1385
1468
  const __funcResult = await __call(startSession, {
1386
1469
  type: "positional",
1387
- args: [__stack.locals.__hoist_14, __stack.locals.brain]
1470
+ args: [__stack.locals.__hoist_15, __stack.locals.brain]
1388
1471
  });
1389
1472
  if (hasInterrupts(__funcResult)) {
1390
1473
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
@@ -1401,7 +1484,7 @@ graph.node("main", async (__state) => {
1401
1484
  }
1402
1485
  }
1403
1486
  ]);
1404
- await runner.ifElse(43, [
1487
+ await runner.ifElse(47, [
1405
1488
  {
1406
1489
  condition: async () => __stack.locals.isOneShot,
1407
1490
  body: async (runner2) => {
@@ -1449,26 +1532,26 @@ graph.node("main", async (__state) => {
1449
1532
  }
1450
1533
  ]);
1451
1534
  await runner2.step(2, async (runner3) => {
1452
- __stack.locals.__hoist_15 = await __call(oneShotAgent, {
1535
+ __stack.locals.__hoist_16 = await __call(oneShotAgent, {
1453
1536
  type: "positional",
1454
1537
  args: [__stack.locals.startAgent, __stack.locals.prompt]
1455
1538
  });
1456
- if (hasInterrupts(__stack.locals.__hoist_15)) {
1539
+ if (hasInterrupts(__stack.locals.__hoist_16)) {
1457
1540
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
1458
1541
  runner3.halt({
1459
1542
  ...__state,
1460
- data: __stack.locals.__hoist_15
1543
+ data: __stack.locals.__hoist_16
1461
1544
  });
1462
1545
  return;
1463
1546
  }
1464
- if (isAborted(__stack.locals.__hoist_15)) {
1465
- throw __stack.locals.__hoist_15.toError();
1547
+ if (isAborted(__stack.locals.__hoist_16)) {
1548
+ throw __stack.locals.__hoist_16.toError();
1466
1549
  }
1467
1550
  });
1468
1551
  await runner2.step(3, async (runner3) => {
1469
1552
  const __funcResult = await __call(print, {
1470
1553
  type: "positional",
1471
- args: [__stack.locals.__hoist_15]
1554
+ args: [__stack.locals.__hoist_16]
1472
1555
  });
1473
1556
  if (hasInterrupts(__funcResult)) {
1474
1557
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
@@ -1483,33 +1566,33 @@ graph.node("main", async (__state) => {
1483
1566
  }
1484
1567
  });
1485
1568
  await runner2.step(4, async (runner3) => {
1486
- __stack.locals.__hoist_16 = await __call(getCost, {
1569
+ __stack.locals.__hoist_17 = await __call(getCost, {
1487
1570
  type: "positional",
1488
1571
  args: []
1489
1572
  });
1490
- if (hasInterrupts(__stack.locals.__hoist_16)) {
1573
+ if (hasInterrupts(__stack.locals.__hoist_17)) {
1491
1574
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
1492
1575
  runner3.halt({
1493
1576
  ...__state,
1494
- data: __stack.locals.__hoist_16
1577
+ data: __stack.locals.__hoist_17
1495
1578
  });
1496
1579
  return;
1497
1580
  }
1498
- if (isAborted(__stack.locals.__hoist_16)) {
1499
- throw __stack.locals.__hoist_16.toError();
1581
+ if (isAborted(__stack.locals.__hoist_17)) {
1582
+ throw __stack.locals.__hoist_17.toError();
1500
1583
  }
1501
1584
  });
1502
1585
  await runner2.step(5, async (runner3) => {
1503
- __stack.locals.__hoist_17 = await __callMethod(__stack.locals.__hoist_16, "toFixed", {
1586
+ __stack.locals.__hoist_18 = await __callMethod(__stack.locals.__hoist_17, "toFixed", {
1504
1587
  type: "positional",
1505
1588
  args: [4]
1506
1589
  });
1507
1590
  });
1508
1591
  await runner2.step(6, async (runner3) => {
1509
- __stack.locals.roundedCost = `$${__stack.locals.__hoist_17}`;
1592
+ __stack.locals.roundedCost = `$${__stack.locals.__hoist_18}`;
1510
1593
  });
1511
1594
  await runner2.step(7, async (runner3) => {
1512
- __stack.locals.__hoist_18 = await __callMethod(color, "dim", {
1595
+ __stack.locals.__hoist_19 = await __callMethod(color, "dim", {
1513
1596
  type: "positional",
1514
1597
  args: [`
1515
1598
  Session cost: ${__stack.locals.roundedCost}`]
@@ -1518,7 +1601,7 @@ Session cost: ${__stack.locals.roundedCost}`]
1518
1601
  await runner2.step(8, async (runner3) => {
1519
1602
  const __funcResult = await __call(print, {
1520
1603
  type: "positional",
1521
- args: [__stack.locals.__hoist_18]
1604
+ args: [__stack.locals.__hoist_19]
1522
1605
  });
1523
1606
  if (hasInterrupts(__funcResult)) {
1524
1607
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
@@ -1570,26 +1653,26 @@ Session cost: ${__stack.locals.roundedCost}`]
1570
1653
  }
1571
1654
  });
1572
1655
  await runner2.step(11, async (runner3) => {
1573
- __stack.locals.__hoist_19 = await __call(getHeader, {
1656
+ __stack.locals.__hoist_20 = await __call(getHeader, {
1574
1657
  type: "positional",
1575
1658
  args: [__stack.locals.brain.name]
1576
1659
  });
1577
- if (hasInterrupts(__stack.locals.__hoist_19)) {
1660
+ if (hasInterrupts(__stack.locals.__hoist_20)) {
1578
1661
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
1579
1662
  runner3.halt({
1580
1663
  ...__state,
1581
- data: __stack.locals.__hoist_19
1664
+ data: __stack.locals.__hoist_20
1582
1665
  });
1583
1666
  return;
1584
1667
  }
1585
- if (isAborted(__stack.locals.__hoist_19)) {
1586
- throw __stack.locals.__hoist_19.toError();
1668
+ if (isAborted(__stack.locals.__hoist_20)) {
1669
+ throw __stack.locals.__hoist_20.toError();
1587
1670
  }
1588
1671
  });
1589
1672
  await runner2.step(12, async (runner3) => {
1590
1673
  const __funcResult = await __call(print, {
1591
1674
  type: "positional",
1592
- args: [__stack.locals.__hoist_19]
1675
+ args: [__stack.locals.__hoist_20]
1593
1676
  });
1594
1677
  if (hasInterrupts(__funcResult)) {
1595
1678
  await getRuntimeContext().ctx.pendingPromises.awaitAll();
@@ -1657,7 +1740,7 @@ Session cost: ${__stack.locals.roundedCost}`]
1657
1740
  });
1658
1741
  });
1659
1742
  if (runner.halted) return runner.haltResult;
1660
- await runner.hook(44, async () => {
1743
+ await runner.hook(48, async () => {
1661
1744
  await callHook({
1662
1745
  name: "onNodeEnd",
1663
1746
  data: {
@@ -1739,7 +1822,7 @@ Agent crashed: ${__error.message}`);
1739
1822
  }
1740
1823
  }
1741
1824
  var stdin_default = graph;
1742
- const __sourceMap = { "dist/lib/agents/agency-agent/agent.agency:oneShotAgent": { "1": { "line": 43, "col": 2 }, "2": { "line": 47, "col": 2 }, "3": { "line": 48, "col": 2 }, "4": { "line": 49, "col": 2 }, "5": { "line": 59, "col": 2 }, "6": { "line": 60, "col": 2 } }, "dist/lib/agents/agency-agent/agent.agency:__block_0": { "4.0": { "line": 50, "col": 4 }, "4.1": { "line": 53, "col": 18 }, "4.2.0": { "line": 53, "col": 4 }, "4.2.1": { "line": 54, "col": 6 }, "4.2.2": { "line": 55, "col": 25 }, "4.2.3.0": { "line": 55, "col": 11 }, "4.2.3.1": { "line": 56, "col": 6 }, "4.2.3": { "line": 55, "col": 11 }, "4.2": { "line": 53, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:main": { "2": { "line": 70, "col": 2 }, "3": { "line": 78, "col": 2 }, "4": { "line": 81, "col": 2 }, "6": { "line": 88, "col": 2 }, "7": { "line": 92, "col": 2 }, "8": { "line": 98, "col": 63 }, "9": { "line": 98, "col": 2 }, "10": { "line": 99, "col": 2 }, "11": { "line": 100, "col": 2 }, "12": { "line": 106, "col": 2 }, "13": { "line": 111, "col": 2 }, "14": { "line": 112, "col": 2 }, "15": { "line": 113, "col": 2 }, "16": { "line": 117, "col": 2 }, "17": { "line": 118, "col": 2 }, "18": { "line": 121, "col": 15 }, "19": { "line": 121, "col": 2 }, "20": { "line": 124, "col": 2 }, "21": { "line": 125, "col": 2 }, "22": { "line": 126, "col": 2 }, "23": { "line": 127, "col": 2 }, "25": { "line": 141, "col": 39 }, "26": { "line": 141, "col": 2 }, "27": { "line": 142, "col": 2 }, "28": { "line": 146, "col": 2 }, "29": { "line": 150, "col": 15 }, "30": { "line": 150, "col": 2 }, "31": { "line": 152, "col": 23 }, "32": { "line": 152, "col": 2 }, "33": { "line": 153, "col": 18 }, "34": { "line": 153, "col": 2 }, "36": { "line": 155, "col": 2 }, "37": { "line": 156, "col": 2 }, "38": { "line": 162, "col": 14 }, "39": { "line": 162, "col": 2 }, "40": { "line": 168, "col": 2 }, "42": { "line": 180, "col": 2 }, "43": { "line": 189, "col": 2 }, "3.0": { "line": 79, "col": 4 }, "4.0": { "line": 82, "col": 4 }, "6.0": { "line": 89, "col": 4 }, "6.1": { "line": 90, "col": 4 }, "11.0": { "line": 101, "col": 22 }, "11.2": { "line": 101, "col": 4 }, "11.3": { "line": 102, "col": 10 }, "11.4": { "line": 102, "col": 4 }, "11.5": { "line": 103, "col": 4 }, "11.6": { "line": 104, "col": 4 }, "23.0": { "line": 128, "col": 4 }, "23.1": { "line": 130, "col": 6 }, "23.2": { "line": 129, "col": 4 }, "23.3": { "line": 134, "col": 4 }, "23.4": { "line": 135, "col": 4 }, "23.5": { "line": 137, "col": 4 }, "37.0": { "line": 157, "col": 4 }, "40.0": { "line": 170, "col": 6 }, "40.1": { "line": 169, "col": 4 }, "40.2": { "line": 174, "col": 4 }, "42.0": { "line": 181, "col": 4 }, "42.1": { "line": 182, "col": 20 }, "42.2": { "line": 182, "col": 4 }, "42.3": { "line": 184, "col": 6 }, "42.4": { "line": 183, "col": 4 }, "43.0": { "line": 190, "col": 4 }, "43.1.0": { "line": 192, "col": 6 }, "43.1.1.0": { "line": 194, "col": 8 }, "43.1.1": { "line": 193, "col": 6 }, "43.1.2": { "line": 196, "col": 6 }, "43.1": { "line": 191, "col": 4 }, "43.2": { "line": 198, "col": 10 }, "43.3": { "line": 198, "col": 4 }, "43.5": { "line": 199, "col": 28 }, "43.6": { "line": 199, "col": 4 }, "43.7": { "line": 200, "col": 10 }, "43.8": { "line": 200, "col": 4 }, "43.9": { "line": 202, "col": 4 }, "43.10": { "line": 203, "col": 4 }, "43.11": { "line": 204, "col": 10 }, "43.12": { "line": 204, "col": 4 }, "43.13": { "line": 205, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:__block_1": {}, "dist/lib/agents/agency-agent/agent.agency:__block_2": { "43.13.0": { "line": 206, "col": 6 } } };
1825
+ const __sourceMap = { "dist/lib/agents/agency-agent/agent.agency:oneShotAgent": { "1": { "line": 44, "col": 2 }, "2": { "line": 48, "col": 2 }, "3": { "line": 49, "col": 2 }, "4": { "line": 50, "col": 2 }, "5": { "line": 60, "col": 2 }, "6": { "line": 61, "col": 2 } }, "dist/lib/agents/agency-agent/agent.agency:__block_0": { "4.0": { "line": 51, "col": 4 }, "4.1": { "line": 54, "col": 18 }, "4.2.0": { "line": 54, "col": 4 }, "4.2.1": { "line": 55, "col": 6 }, "4.2.2": { "line": 56, "col": 25 }, "4.2.3.0": { "line": 56, "col": 11 }, "4.2.3.1": { "line": 57, "col": 6 }, "4.2.3": { "line": 56, "col": 11 }, "4.2": { "line": 54, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:main": { "2": { "line": 71, "col": 2 }, "3": { "line": 79, "col": 2 }, "4": { "line": 82, "col": 2 }, "6": { "line": 89, "col": 2 }, "7": { "line": 93, "col": 2 }, "8": { "line": 99, "col": 63 }, "9": { "line": 99, "col": 2 }, "10": { "line": 100, "col": 2 }, "11": { "line": 101, "col": 2 }, "12": { "line": 107, "col": 2 }, "13": { "line": 112, "col": 2 }, "14": { "line": 113, "col": 2 }, "15": { "line": 114, "col": 2 }, "16": { "line": 118, "col": 2 }, "17": { "line": 119, "col": 2 }, "18": { "line": 122, "col": 15 }, "19": { "line": 122, "col": 2 }, "20": { "line": 125, "col": 2 }, "21": { "line": 126, "col": 2 }, "22": { "line": 127, "col": 2 }, "23": { "line": 128, "col": 2 }, "25": { "line": 142, "col": 39 }, "26": { "line": 142, "col": 2 }, "27": { "line": 143, "col": 2 }, "28": { "line": 147, "col": 2 }, "29": { "line": 151, "col": 15 }, "30": { "line": 151, "col": 2 }, "31": { "line": 153, "col": 23 }, "32": { "line": 153, "col": 2 }, "33": { "line": 154, "col": 18 }, "34": { "line": 154, "col": 2 }, "36": { "line": 156, "col": 2 }, "37": { "line": 157, "col": 2 }, "39": { "line": 165, "col": 2 }, "40": { "line": 166, "col": 2 }, "41": { "line": 170, "col": 2 }, "42": { "line": 176, "col": 14 }, "43": { "line": 176, "col": 2 }, "44": { "line": 182, "col": 2 }, "46": { "line": 194, "col": 2 }, "47": { "line": 203, "col": 2 }, "3.0": { "line": 80, "col": 4 }, "4.0": { "line": 83, "col": 4 }, "6.0": { "line": 90, "col": 4 }, "6.1": { "line": 91, "col": 4 }, "11.0": { "line": 102, "col": 22 }, "11.2": { "line": 102, "col": 4 }, "11.3": { "line": 103, "col": 10 }, "11.4": { "line": 103, "col": 4 }, "11.5": { "line": 104, "col": 4 }, "11.6": { "line": 105, "col": 4 }, "23.0": { "line": 129, "col": 4 }, "23.1": { "line": 131, "col": 6 }, "23.2": { "line": 130, "col": 4 }, "23.3": { "line": 135, "col": 4 }, "23.4": { "line": 136, "col": 4 }, "23.5": { "line": 138, "col": 4 }, "37.0": { "line": 158, "col": 4 }, "40.0": { "line": 167, "col": 10 }, "40.1": { "line": 167, "col": 4 }, "40.2": { "line": 168, "col": 4 }, "41.0": { "line": 171, "col": 4 }, "44.0": { "line": 184, "col": 6 }, "44.1": { "line": 183, "col": 4 }, "44.2": { "line": 188, "col": 4 }, "46.0": { "line": 195, "col": 4 }, "46.1": { "line": 196, "col": 20 }, "46.2": { "line": 196, "col": 4 }, "46.3": { "line": 198, "col": 6 }, "46.4": { "line": 197, "col": 4 }, "47.0": { "line": 204, "col": 4 }, "47.1.0": { "line": 206, "col": 6 }, "47.1.1.0": { "line": 208, "col": 8 }, "47.1.1": { "line": 207, "col": 6 }, "47.1.2": { "line": 210, "col": 6 }, "47.1": { "line": 205, "col": 4 }, "47.2": { "line": 212, "col": 10 }, "47.3": { "line": 212, "col": 4 }, "47.5": { "line": 213, "col": 28 }, "47.6": { "line": 213, "col": 4 }, "47.7": { "line": 214, "col": 10 }, "47.8": { "line": 214, "col": 4 }, "47.9": { "line": 216, "col": 4 }, "47.10": { "line": 217, "col": 4 }, "47.11": { "line": 218, "col": 10 }, "47.12": { "line": 218, "col": 4 }, "47.13": { "line": 219, "col": 4 } }, "dist/lib/agents/agency-agent/agent.agency:__block_1": {}, "dist/lib/agents/agency-agent/agent.agency:__block_2": { "47.13.0": { "line": 220, "col": 6 } } };
1743
1826
  export {
1744
1827
  __getCheckpoints,
1745
1828
  __invokeFunction,
@@ -119,6 +119,10 @@ export def parseAgentArgs() {
119
119
  type: "string",
120
120
  description: "Abort if the agent's LLM spend exceeds this many dollars (0 = local models only; negative = no limit)"
121
121
  },
122
+ effort: {
123
+ type: "string",
124
+ description: "How hard a reasoning model thinks on every call: low, medium, or high. Sent to the provider as its reasoning effort; omit for the provider's default."
125
+ },
122
126
  "max-time": {
123
127
  type: "string",
124
128
  description: "Abort if the agent's working time exceeds this duration (e.g. 30m or 2d); waiting on a human is not counted; zero/negative = no limit"
@@ -156,7 +156,7 @@ function registerTools(tools) {
156
156
  }
157
157
  }
158
158
  }
159
- __registerModuleFingerprint("dist/lib/agents/agency-agent/lib/args.agency", "dc2807869d0d7ecc15dce2edddfdeae5d4be47400c729b015f54d30cd03b1e05", import.meta.url);
159
+ __registerModuleFingerprint("dist/lib/agents/agency-agent/lib/args.agency", "d8b4acb34b2a23ede40197cca679b41071551f66f9f6c80d3027ca7c140fd0a5", import.meta.url);
160
160
  __registerTool(print);
161
161
  __registerTool(printJSON);
162
162
  __registerTool(input);
@@ -508,6 +508,10 @@ async function __parseAgentArgs_impl() {
508
508
  "type": `string`,
509
509
  "description": `Abort if the agent's LLM spend exceeds this many dollars (0 = local models only; negative = no limit)`
510
510
  },
511
+ "effort": {
512
+ "type": `string`,
513
+ "description": `How hard a reasoning model thinks on every call: low, medium, or high. Sent to the provider as its reasoning effort; omit for the provider's default.`
514
+ },
511
515
  "max-time": {
512
516
  "type": `string`,
513
517
  "description": `Abort if the agent's working time exceeds this duration (e.g. 30m or 2d); waiting on a human is not counted; zero/negative = no limit`
@@ -610,7 +614,7 @@ const parseAgentArgs = __AgencyFunction.create({
610
614
  exported: true
611
615
  }, __toolRegistry);
612
616
  var stdin_default = graph;
613
- const __sourceMap = { "dist/lib/agents/agency-agent/lib/args.agency:brainFlagHelp": { "1": { "line": 7, "col": 2 }, "2": { "line": 8, "col": 16 }, "3": { "line": 8, "col": 2 }, "4": { "line": 11, "col": 71 }, "5": { "line": 11, "col": 2 }, "3.0": { "line": 9, "col": 4 } }, "dist/lib/agents/agency-agent/lib/args.agency:parseAgentArgs": { "1": { "line": 19, "col": 15 }, "2": { "line": 61, "col": 23 }, "3": { "line": 15, "col": 2 }, "4": { "line": 142, "col": 2 }, "5": { "line": 145, "col": 2 }, "4.0": { "line": 143, "col": 4 } } };
617
+ const __sourceMap = { "dist/lib/agents/agency-agent/lib/args.agency:brainFlagHelp": { "1": { "line": 7, "col": 2 }, "2": { "line": 8, "col": 16 }, "3": { "line": 8, "col": 2 }, "4": { "line": 11, "col": 71 }, "5": { "line": 11, "col": 2 }, "3.0": { "line": 9, "col": 4 } }, "dist/lib/agents/agency-agent/lib/args.agency:parseAgentArgs": { "1": { "line": 19, "col": 15 }, "2": { "line": 61, "col": 23 }, "3": { "line": 15, "col": 2 }, "4": { "line": 146, "col": 2 }, "5": { "line": 149, "col": 2 }, "4.0": { "line": 147, "col": 4 } } };
614
618
  export {
615
619
  __getCheckpoints,
616
620
  __invokeFunction,
@@ -0,0 +1,26 @@
1
+ /** @module The --effort flag: a reasoning model's thinking level, sent to
2
+ the provider with every call. Pure parsing so the flag's rule is
3
+ testable without a run. */
4
+ /** What a --effort value means: the level to send, or null for an absent
5
+ flag, and an error naming the choices when the value is not a level,
6
+ so a typo never silently becomes the provider's default. */
7
+ export type Effort = {
8
+ level: "low" | "medium" | "high" | null;
9
+ error: string
10
+ }
11
+ export def parseEffort(value: string | null): Effort {
12
+ if (value == null) {
13
+ return { level: null, error: "" }
14
+ }
15
+ const level = value.trim().toLowerCase()
16
+ if (level == "low") {
17
+ return { level: "low", error: "" }
18
+ }
19
+ if (level == "medium") {
20
+ return { level: "medium", error: "" }
21
+ }
22
+ if (level == "high") {
23
+ return { level: "high", error: "" }
24
+ }
25
+ return { level: null, error: "--effort must be low, medium, or high; got '${value}'." }
26
+ }