brass-runtime 1.13.8 → 1.15.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 (49) hide show
  1. package/README.md +6 -3
  2. package/dist/agent/cli/main.cjs +44 -43
  3. package/dist/agent/cli/main.js +5 -4
  4. package/dist/agent/cli/main.mjs +5 -4
  5. package/dist/agent/index.cjs +4 -3
  6. package/dist/agent/index.d.ts +1 -1
  7. package/dist/agent/index.js +3 -2
  8. package/dist/agent/index.mjs +3 -2
  9. package/dist/{chunk-3R7ZYRK2.mjs → chunk-3QMOKAS5.js} +9 -7
  10. package/dist/{chunk-ATHSSDUF.js → chunk-4NHES7VK.mjs} +113 -31
  11. package/dist/chunk-AR22SXML.js +1043 -0
  12. package/dist/chunk-BDF4AMWX.mjs +3773 -0
  13. package/dist/chunk-BDYEENHT.js +224 -0
  14. package/dist/chunk-BMH5AV44.js +3773 -0
  15. package/dist/chunk-ELOOF35R.mjs +131 -0
  16. package/dist/chunk-JFPU5GQI.mjs +1043 -0
  17. package/dist/{chunk-INZBKOHY.js → chunk-K6M7MDZ4.mjs} +9 -7
  18. package/dist/chunk-MS34J5LY.cjs +224 -0
  19. package/dist/{chunk-XNOTJSMZ.mjs → chunk-PPUXIH5R.js} +113 -31
  20. package/dist/chunk-R3R2FVLG.cjs +131 -0
  21. package/dist/{chunk-ZTDK2DLG.cjs → chunk-STVLQ3XD.cjs} +169 -87
  22. package/dist/chunk-TGIFUAK4.cjs +3773 -0
  23. package/dist/chunk-TO7IKXYT.js +131 -0
  24. package/dist/chunk-UMAZLXAB.mjs +224 -0
  25. package/dist/{chunk-XDINDYNA.cjs → chunk-VEZNF5GZ.cjs} +136 -134
  26. package/dist/chunk-XPZNXSVN.cjs +1043 -0
  27. package/dist/core/index.cjs +216 -0
  28. package/dist/core/index.d.ts +673 -0
  29. package/dist/core/index.js +216 -0
  30. package/dist/core/index.mjs +216 -0
  31. package/dist/{effect-ISvXPLgc.d.ts → effect-CMOQKX8y.d.ts} +202 -31
  32. package/dist/http/index.cjs +3177 -187
  33. package/dist/http/index.d.ts +1692 -9
  34. package/dist/http/index.js +3164 -174
  35. package/dist/http/index.mjs +3164 -174
  36. package/dist/index.cjs +936 -219
  37. package/dist/index.d.ts +313 -36
  38. package/dist/index.js +830 -113
  39. package/dist/index.mjs +830 -113
  40. package/dist/{stream-BvukHxCv.d.ts → stream-FQm9h4Mg.d.ts} +12 -4
  41. package/dist/tracing-DNT9jEbr.d.ts +106 -0
  42. package/package.json +11 -3
  43. package/wasm/pkg/brass_runtime_wasm_engine.d.ts +95 -16
  44. package/wasm/pkg/brass_runtime_wasm_engine.js +715 -15
  45. package/wasm/pkg/brass_runtime_wasm_engine_bg.wasm +0 -0
  46. package/wasm/pkg/brass_runtime_wasm_engine_bg.wasm.d.ts +78 -7
  47. package/dist/chunk-2P4PD6D7.cjs +0 -2557
  48. package/dist/chunk-7F2R7A2V.mjs +0 -2557
  49. package/dist/chunk-L6KKKM66.js +0 -2557
@@ -1,5 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
+ var _chunkR3R2FVLGcjs = require('./chunk-R3R2FVLG.cjs');
3
4
 
4
5
 
5
6
 
@@ -11,7 +12,8 @@
11
12
 
12
13
 
13
14
 
14
- var _chunk2P4PD6D7cjs = require('./chunk-2P4PD6D7.cjs');
15
+
16
+ var _chunkTGIFUAK4cjs = require('./chunk-TGIFUAK4.cjs');
15
17
 
16
18
  // src/agent/core/state.ts
17
19
  var initialAgentState = (goal) => ({
@@ -1350,22 +1352,22 @@ var decideNextAction = (state) => {
1350
1352
  const latest = state.observations.at(-1);
1351
1353
  if (_optionalChain([latest, 'optionalAccess', _109 => _109.type]) === "agent.error") {
1352
1354
  if (shouldRequestRepairAfterPatchError(state)) {
1353
- return _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, repairAction(state, "previous patch failed to apply"));
1355
+ return _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, repairAction(state, "previous patch failed to apply"));
1354
1356
  }
1355
- return _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, { type: "agent.finish", summary: buildErrorSummary(state) });
1357
+ return _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, { type: "agent.finish", summary: buildErrorSummary(state) });
1356
1358
  }
1357
1359
  if (!hasObservation(state, "fs.fileRead")) {
1358
- return _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, { type: "fs.readFile", path: "package.json" });
1360
+ return _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, { type: "fs.readFile", path: "package.json" });
1359
1361
  }
1360
1362
  const probeAction = nextProjectProbeAction(state);
1361
1363
  if (probeAction) {
1362
- return _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, probeAction);
1364
+ return _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, probeAction);
1363
1365
  }
1364
1366
  const suppliedPatch = _optionalChain([state, 'access', _110 => _110.goal, 'access', _111 => _111.initialPatch, 'optionalAccess', _112 => _112.trim, 'call', _113 => _113()]);
1365
1367
  if (suppliedPatch) {
1366
1368
  const action = initialPatchFlowAction(state, suppliedPatch);
1367
- if (action) return _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, action);
1368
- return _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, {
1369
+ if (action) return _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, action);
1370
+ return _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, {
1369
1371
  type: "agent.finish",
1370
1372
  summary: buildCompletionSummary(state, suppliedPatch)
1371
1373
  });
@@ -1373,10 +1375,10 @@ var decideNextAction = (state) => {
1373
1375
  const pendingLlmPatch = latestLlmPatchCandidate(state);
1374
1376
  if (pendingLlmPatch) {
1375
1377
  if (isWritableMode(state.goal.mode)) {
1376
- return _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, { type: "patch.apply", patch: pendingLlmPatch.patch });
1378
+ return _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, { type: "patch.apply", patch: pendingLlmPatch.patch });
1377
1379
  }
1378
1380
  if (state.goal.mode === "propose") {
1379
- return _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, { type: "patch.propose", patch: pendingLlmPatch.patch });
1381
+ return _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, { type: "patch.propose", patch: pendingLlmPatch.patch });
1380
1382
  }
1381
1383
  }
1382
1384
  const planResponse = state.observations.find(
@@ -1384,10 +1386,10 @@ var decideNextAction = (state) => {
1384
1386
  );
1385
1387
  if (!planResponse) {
1386
1388
  const validationAction = nextValidationActionBeforePlanning(state);
1387
- if (validationAction) return _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, validationAction);
1389
+ if (validationAction) return _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, validationAction);
1388
1390
  const contextAction = nextContextDiscoveryAction(state);
1389
- if (contextAction) return _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, contextAction);
1390
- return _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, {
1391
+ if (contextAction) return _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, contextAction);
1392
+ return _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, {
1391
1393
  type: "llm.complete",
1392
1394
  purpose: "plan",
1393
1395
  prompt: buildPlanningPrompt(state)
@@ -1396,39 +1398,39 @@ var decideNextAction = (state) => {
1396
1398
  if (isWritableMode(state.goal.mode)) {
1397
1399
  if (shouldContinueRollbackStack(state)) {
1398
1400
  const rollbackAction = automaticRollbackAction(state, "continuing rollback of generated patch stack");
1399
- if (rollbackAction) return _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, rollbackAction);
1401
+ if (rollbackAction) return _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, rollbackAction);
1400
1402
  }
1401
1403
  if (_optionalChain([latestWorkspaceChange, 'call', _114 => _114(state), 'optionalAccess', _115 => _115.type]) === "patch.rolledBack") {
1402
1404
  const summary = rollbackSafetySummary(state);
1403
1405
  if (summary.runValidationAfterRollback) {
1404
1406
  const validationAction = nextValidationActionAfterLatestWorkspaceChange(state);
1405
- if (validationAction) return _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, validationAction);
1407
+ if (validationAction) return _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, validationAction);
1406
1408
  }
1407
1409
  }
1408
1410
  if (_optionalChain([latestWorkspaceChange, 'call', _116 => _116(state), 'optionalAccess', _117 => _117.type]) === "patch.applied") {
1409
1411
  const validationAction = nextValidationActionAfterPatch(state);
1410
- if (validationAction) return _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, validationAction);
1412
+ if (validationAction) return _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, validationAction);
1411
1413
  if (shouldRequestRepairAfterValidation(state)) {
1412
- return _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, repairAction(state, "validation failed after applying the generated patch"));
1414
+ return _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, repairAction(state, "validation failed after applying the generated patch"));
1413
1415
  }
1414
1416
  if (shouldAutoRollbackAfterFinalValidationFailure(state)) {
1415
1417
  const rollbackAction = automaticRollbackAction(state, "validation failed after generated patches and no repair attempts remain");
1416
- if (rollbackAction) return _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, rollbackAction);
1418
+ if (rollbackAction) return _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, rollbackAction);
1417
1419
  }
1418
1420
  }
1419
1421
  }
1420
1422
  const patch = latestExtractedPatch(state);
1421
- return _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, {
1423
+ return _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, {
1422
1424
  type: "agent.finish",
1423
1425
  summary: buildCompletionSummary(state, patch)
1424
1426
  });
1425
1427
  };
1426
1428
 
1427
1429
  // src/agent/core/events.ts
1428
- var nowMillis = () => _chunk2P4PD6D7cjs.async.call(void 0, (_env, cb) => {
1430
+ var nowMillis = () => _chunkTGIFUAK4cjs.asyncEffect.call(void 0, (_env, cb) => {
1429
1431
  cb({ _tag: "Success", value: Date.now() });
1430
1432
  });
1431
- var emitAgentEvent = (event) => _chunk2P4PD6D7cjs.async.call(void 0, (env, cb) => {
1433
+ var emitAgentEvent = (event) => _chunkTGIFUAK4cjs.asyncEffect.call(void 0, (env, cb) => {
1432
1434
  try {
1433
1435
  _optionalChain([env, 'access', _118 => _118.events, 'optionalAccess', _119 => _119.emit, 'call', _120 => _120(event)]);
1434
1436
  } catch (e5) {
@@ -1436,8 +1438,8 @@ var emitAgentEvent = (event) => _chunk2P4PD6D7cjs.async.call(void 0, (env, cb) =
1436
1438
  cb({ _tag: "Success", value: void 0 });
1437
1439
  });
1438
1440
  var emitAgentEvents = (events) => events.reduce(
1439
- (acc, event) => _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0, acc, () => emitAgentEvent(event)),
1440
- _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, void 0)
1441
+ (acc, event) => _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0, acc, () => emitAgentEvent(event)),
1442
+ _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, void 0)
1441
1443
  );
1442
1444
  var summarizeAgentAction = (action) => {
1443
1445
  switch (action.type) {
@@ -1549,7 +1551,7 @@ var observationEventFor = (state, observation, at) => {
1549
1551
  var runStatusFor = (phase) => phase === "done" ? "done" : "failed";
1550
1552
 
1551
1553
  // src/agent/tools/env.ts
1552
- var service = (key) => _chunk2P4PD6D7cjs.asyncSync.call(void 0, (env) => env[key]);
1554
+ var service = (key) => _chunkTGIFUAK4cjs.asyncSync.call(void 0, (env) => env[key]);
1553
1555
 
1554
1556
  // src/agent/tools/path.ts
1555
1557
  var isAbsoluteLike = (path) => path.startsWith("/") || /^[A-Za-z]:[\\/]/.test(path);
@@ -1575,48 +1577,48 @@ var normalizeWorkspaceRelativePath = (inputPath) => {
1575
1577
  var resolveWorkspacePath = (cwd, inputPath) => {
1576
1578
  const normalized = normalizeWorkspaceRelativePath(inputPath);
1577
1579
  if (!normalized) {
1578
- return _chunk2P4PD6D7cjs.asyncFail.call(void 0, { _tag: "PathOutsideWorkspace", path: inputPath, cwd });
1580
+ return _chunkTGIFUAK4cjs.asyncFail.call(void 0, { _tag: "PathOutsideWorkspace", path: inputPath, cwd });
1579
1581
  }
1580
- return _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, `${trimTrailingSlash(cwd)}/${normalized}`);
1582
+ return _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, `${trimTrailingSlash(cwd)}/${normalized}`);
1581
1583
  };
1582
1584
 
1583
1585
  // src/agent/tools/actionToEffect.ts
1584
1586
  var actionToEffect = (action, state) => {
1585
1587
  switch (action.type) {
1586
1588
  case "fs.readFile":
1587
- return _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0,
1589
+ return _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0,
1588
1590
  resolveWorkspacePath(state.goal.cwd, action.path),
1589
- (path) => _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0,
1591
+ (path) => _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0,
1590
1592
  service("fs"),
1591
- (fs) => _chunk2P4PD6D7cjs.asyncMap.call(void 0,
1593
+ (fs) => _chunkTGIFUAK4cjs.asyncMap.call(void 0,
1592
1594
  fs.readFile(path),
1593
1595
  (content) => ({ type: "fs.fileRead", path: action.path, content })
1594
1596
  )
1595
1597
  )
1596
1598
  );
1597
1599
  case "fs.exists":
1598
- return _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0,
1600
+ return _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0,
1599
1601
  resolveWorkspacePath(state.goal.cwd, action.path),
1600
- (path) => _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0,
1602
+ (path) => _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0,
1601
1603
  service("fs"),
1602
- (fs) => _chunk2P4PD6D7cjs.asyncMap.call(void 0,
1604
+ (fs) => _chunkTGIFUAK4cjs.asyncMap.call(void 0,
1603
1605
  fs.exists(path),
1604
1606
  (exists) => ({ type: "fs.exists", path: action.path, exists })
1605
1607
  )
1606
1608
  )
1607
1609
  );
1608
1610
  case "fs.searchText":
1609
- return _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0,
1611
+ return _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0,
1610
1612
  service("fs"),
1611
- (fs) => _chunk2P4PD6D7cjs.asyncMap.call(void 0,
1613
+ (fs) => _chunkTGIFUAK4cjs.asyncMap.call(void 0,
1612
1614
  fs.searchText(state.goal.cwd, action.query, { globs: action.globs }),
1613
1615
  (matches) => ({ type: "fs.searchResult", query: action.query, matches })
1614
1616
  )
1615
1617
  );
1616
1618
  case "shell.exec":
1617
- return _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0,
1619
+ return _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0,
1618
1620
  service("shell"),
1619
- (shell) => _chunk2P4PD6D7cjs.asyncMap.call(void 0,
1621
+ (shell) => _chunkTGIFUAK4cjs.asyncMap.call(void 0,
1620
1622
  shell.exec(action.command, { cwd: _nullishCoalesce(action.cwd, () => ( state.goal.cwd)) }),
1621
1623
  (result) => ({
1622
1624
  type: "shell.result",
@@ -1628,19 +1630,19 @@ var actionToEffect = (action, state) => {
1628
1630
  )
1629
1631
  );
1630
1632
  case "llm.complete":
1631
- return _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0,
1633
+ return _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0,
1632
1634
  service("llm"),
1633
- (llm) => _chunk2P4PD6D7cjs.asyncMap.call(void 0,
1635
+ (llm) => _chunkTGIFUAK4cjs.asyncMap.call(void 0,
1634
1636
  llm.complete({ purpose: action.purpose, prompt: action.prompt }),
1635
1637
  (response) => ({ type: "llm.response", purpose: action.purpose, content: response.content })
1636
1638
  )
1637
1639
  );
1638
1640
  case "patch.propose":
1639
- return _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, { type: "patch.proposed", patch: action.patch });
1641
+ return _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, { type: "patch.proposed", patch: action.patch });
1640
1642
  case "patch.apply":
1641
- return _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0,
1643
+ return _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0,
1642
1644
  service("patch"),
1643
- (patch) => _chunk2P4PD6D7cjs.asyncMap.call(void 0,
1645
+ (patch) => _chunkTGIFUAK4cjs.asyncMap.call(void 0,
1644
1646
  patch.apply(state.goal.cwd, action.patch),
1645
1647
  (result) => ({
1646
1648
  type: "patch.applied",
@@ -1650,9 +1652,9 @@ var actionToEffect = (action, state) => {
1650
1652
  )
1651
1653
  );
1652
1654
  case "patch.rollback":
1653
- return _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0,
1655
+ return _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0,
1654
1656
  service("patch"),
1655
- (patch) => _chunk2P4PD6D7cjs.asyncMap.call(void 0,
1657
+ (patch) => _chunkTGIFUAK4cjs.asyncMap.call(void 0,
1656
1658
  patch.rollback(state.goal.cwd, action.patch),
1657
1659
  (result) => ({
1658
1660
  type: "patch.rolledBack",
@@ -1664,33 +1666,33 @@ var actionToEffect = (action, state) => {
1664
1666
  )
1665
1667
  );
1666
1668
  case "agent.finish":
1667
- return _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, { type: "agent.done", summary: action.summary });
1669
+ return _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, { type: "agent.done", summary: action.summary });
1668
1670
  case "agent.fail":
1669
- return _chunk2P4PD6D7cjs.asyncFail.call(void 0, { _tag: "AgentLoopError", message: action.reason });
1671
+ return _chunkTGIFUAK4cjs.asyncFail.call(void 0, { _tag: "AgentLoopError", message: action.reason });
1670
1672
  }
1671
1673
  };
1672
1674
 
1673
1675
  // src/agent/tools/retry.ts
1674
1676
  var retry = (make, options) => {
1675
- const loop = (remaining) => _chunk2P4PD6D7cjs.asyncFold.call(void 0,
1677
+ const loop = (remaining) => _chunkTGIFUAK4cjs.asyncFold.call(void 0,
1676
1678
  make(),
1677
1679
  (error) => {
1678
1680
  if (remaining > 0 && options.while(error)) return loop(remaining - 1);
1679
- return _chunk2P4PD6D7cjs.asyncFail.call(void 0, error);
1681
+ return _chunkTGIFUAK4cjs.asyncFail.call(void 0, error);
1680
1682
  },
1681
- (value) => _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, value)
1683
+ (value) => _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, value)
1682
1684
  );
1683
1685
  return loop(options.times);
1684
1686
  };
1685
1687
 
1686
1688
  // src/agent/tools/timeout.ts
1687
- var sleep = (ms) => _chunk2P4PD6D7cjs.async.call(void 0, (_env, cb) => {
1689
+ var sleep = (ms) => _chunkTGIFUAK4cjs.asyncEffect.call(void 0, (_env, cb) => {
1688
1690
  const id = setTimeout(() => cb({ _tag: "Success", value: void 0 }), ms);
1689
1691
  return () => clearTimeout(id);
1690
1692
  });
1691
- var timeout = (effect, ms, scope) => _chunk2P4PD6D7cjs.race.call(void 0,
1693
+ var timeout = (effect, ms, scope) => _chunkR3R2FVLGcjs.race.call(void 0,
1692
1694
  effect,
1693
- _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0, sleep(ms), () => _chunk2P4PD6D7cjs.asyncFail.call(void 0, { _tag: "ToolTimeout", timeoutMs: ms })),
1695
+ _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0, sleep(ms), () => _chunkTGIFUAK4cjs.asyncFail.call(void 0, { _tag: "ToolTimeout", timeoutMs: ms })),
1694
1696
  scope
1695
1697
  );
1696
1698
 
@@ -1724,7 +1726,7 @@ var configuredPolicyFor = (action, overrides) => {
1724
1726
  retries: _optionalChain([override, 'optionalAccess', _123 => _123.retries]) !== void 0 ? Math.max(0, Math.floor(override.retries)) : base.retries
1725
1727
  };
1726
1728
  };
1727
- var runAuthorizedAction = (action, state, scope) => _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0, _chunk2P4PD6D7cjs.asyncSync.call(void 0, (env) => env.toolPolicies), (toolPolicies) => {
1729
+ var runAuthorizedAction = (action, state, scope) => _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0, _chunkTGIFUAK4cjs.asyncSync.call(void 0, (env) => env.toolPolicies), (toolPolicies) => {
1728
1730
  const policy = configuredPolicyFor(action, toolPolicies);
1729
1731
  return retry(() => timeout(actionToEffect(action, state), policy.timeoutMs, scope), {
1730
1732
  times: policy.retries,
@@ -1736,7 +1738,7 @@ var rejected = (action, reason) => ({
1736
1738
  action,
1737
1739
  reason
1738
1740
  });
1739
- var emitApprovalResolved = (action, state, approved, reason) => _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0,
1741
+ var emitApprovalResolved = (action, state, approved, reason) => _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0,
1740
1742
  nowMillis(),
1741
1743
  (at) => emitAgentEvent({
1742
1744
  type: "agent.approval.resolved",
@@ -1750,9 +1752,9 @@ var emitApprovalResolved = (action, state, approved, reason) => _chunk2P4PD6D7cj
1750
1752
  );
1751
1753
  var requestApproval = (action, state, decision) => {
1752
1754
  const defaultAnswer = _nullishCoalesce(decision.defaultAnswer, () => ( "reject"));
1753
- return _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0,
1755
+ return _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0,
1754
1756
  nowMillis(),
1755
- (at) => _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0,
1757
+ (at) => _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0,
1756
1758
  emitAgentEvent({
1757
1759
  type: "agent.approval.requested",
1758
1760
  action,
@@ -1763,15 +1765,15 @@ var requestApproval = (action, state, decision) => {
1763
1765
  defaultAnswer,
1764
1766
  at
1765
1767
  }),
1766
- () => _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0, service("approvals"), (approvals) => {
1768
+ () => _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0, service("approvals"), (approvals) => {
1767
1769
  if (!approvals) {
1768
1770
  const reason = "No approval service configured.";
1769
- return _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0,
1771
+ return _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0,
1770
1772
  emitApprovalResolved(action, state, false, reason),
1771
- () => _chunk2P4PD6D7cjs.asyncFail.call(void 0, rejected(action, reason))
1773
+ () => _chunkTGIFUAK4cjs.asyncFail.call(void 0, rejected(action, reason))
1772
1774
  );
1773
1775
  }
1774
- return _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0,
1776
+ return _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0,
1775
1777
  approvals.request({
1776
1778
  action,
1777
1779
  state,
@@ -1781,15 +1783,15 @@ var requestApproval = (action, state, decision) => {
1781
1783
  }),
1782
1784
  (response) => {
1783
1785
  if (response.type === "approved") {
1784
- return _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0,
1786
+ return _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0,
1785
1787
  emitApprovalResolved(action, state, true, void 0),
1786
- () => _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, void 0)
1788
+ () => _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, void 0)
1787
1789
  );
1788
1790
  }
1789
1791
  const reason = _nullishCoalesce(response.reason, () => ( "Approval rejected."));
1790
- return _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0,
1792
+ return _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0,
1791
1793
  emitApprovalResolved(action, state, false, reason),
1792
- () => _chunk2P4PD6D7cjs.asyncFail.call(void 0, rejected(action, reason))
1794
+ () => _chunkTGIFUAK4cjs.asyncFail.call(void 0, rejected(action, reason))
1793
1795
  );
1794
1796
  }
1795
1797
  );
@@ -1797,18 +1799,18 @@ var requestApproval = (action, state, decision) => {
1797
1799
  )
1798
1800
  );
1799
1801
  };
1800
- var invokeAction = (action, state, scope) => _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0,
1802
+ var invokeAction = (action, state, scope) => _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0,
1801
1803
  service("permissions"),
1802
- (permissions) => _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0, permissions.check(action, state), (decision) => {
1804
+ (permissions) => _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0, permissions.check(action, state), (decision) => {
1803
1805
  if (decision.type === "deny") {
1804
- return _chunk2P4PD6D7cjs.asyncFail.call(void 0, {
1806
+ return _chunkTGIFUAK4cjs.asyncFail.call(void 0, {
1805
1807
  _tag: "PermissionDenied",
1806
1808
  action,
1807
1809
  reason: decision.reason
1808
1810
  });
1809
1811
  }
1810
1812
  if (decision.type === "ask") {
1811
- return _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0,
1813
+ return _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0,
1812
1814
  requestApproval(action, state, decision),
1813
1815
  () => runAuthorizedAction(action, state, scope)
1814
1816
  );
@@ -1818,9 +1820,9 @@ var invokeAction = (action, state, scope) => _chunk2P4PD6D7cjs.asyncFlatMap.call
1818
1820
  );
1819
1821
 
1820
1822
  // src/agent/core/runAgent.ts
1821
- var executeAction = (action, state, scope) => _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0,
1823
+ var executeAction = (action, state, scope) => _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0,
1822
1824
  nowMillis(),
1823
- (startedAt) => _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0,
1825
+ (startedAt) => _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0,
1824
1826
  emitAgentEvent({
1825
1827
  type: "agent.action.started",
1826
1828
  action,
@@ -1828,9 +1830,9 @@ var executeAction = (action, state, scope) => _chunk2P4PD6D7cjs.asyncFlatMap.cal
1828
1830
  phase: state.phase,
1829
1831
  at: startedAt
1830
1832
  }),
1831
- () => _chunk2P4PD6D7cjs.asyncFold.call(void 0,
1833
+ () => _chunkTGIFUAK4cjs.asyncFold.call(void 0,
1832
1834
  invokeAction(action, state, scope),
1833
- (error) => _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0, nowMillis(), (endedAt) => {
1835
+ (error) => _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0, nowMillis(), (endedAt) => {
1834
1836
  const specific = errorEventFor(action, state, error, endedAt);
1835
1837
  const events = [
1836
1838
  ...specific ? [specific] : [],
@@ -1844,14 +1846,14 @@ var executeAction = (action, state, scope) => _chunk2P4PD6D7cjs.asyncFlatMap.cal
1844
1846
  at: endedAt
1845
1847
  }
1846
1848
  ];
1847
- return _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0,
1849
+ return _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0,
1848
1850
  emitAgentEvents(events),
1849
- () => _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, { type: "agent.error", error })
1851
+ () => _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, { type: "agent.error", error })
1850
1852
  );
1851
1853
  }),
1852
- (observation) => _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0,
1854
+ (observation) => _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0,
1853
1855
  nowMillis(),
1854
- (endedAt) => _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0,
1856
+ (endedAt) => _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0,
1855
1857
  emitAgentEvent({
1856
1858
  type: "agent.action.completed",
1857
1859
  action,
@@ -1861,13 +1863,13 @@ var executeAction = (action, state, scope) => _chunk2P4PD6D7cjs.asyncFlatMap.cal
1861
1863
  durationMs: endedAt - startedAt,
1862
1864
  at: endedAt
1863
1865
  }),
1864
- () => _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, observation)
1866
+ () => _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, observation)
1865
1867
  )
1866
1868
  )
1867
1869
  )
1868
1870
  )
1869
1871
  );
1870
- var recordObservation = (next, observation) => _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0, nowMillis(), (at) => {
1872
+ var recordObservation = (next, observation) => _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0, nowMillis(), (at) => {
1871
1873
  const specific = observationEventFor(next, observation, at);
1872
1874
  const events = [
1873
1875
  {
@@ -1883,9 +1885,9 @@ var recordObservation = (next, observation) => _chunk2P4PD6D7cjs.asyncFlatMap.ca
1883
1885
  });
1884
1886
  var runLoop = (state, scope, runStartedAt) => {
1885
1887
  if (isTerminal(state)) {
1886
- return _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0,
1888
+ return _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0,
1887
1889
  nowMillis(),
1888
- (at) => _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0,
1890
+ (at) => _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0,
1889
1891
  emitAgentEvent({
1890
1892
  type: "agent.run.completed",
1891
1893
  goal: state.goal,
@@ -1895,26 +1897,26 @@ var runLoop = (state, scope, runStartedAt) => {
1895
1897
  durationMs: at - runStartedAt,
1896
1898
  at
1897
1899
  }),
1898
- () => _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, state)
1900
+ () => _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, state)
1899
1901
  )
1900
1902
  );
1901
1903
  }
1902
- return _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0,
1904
+ return _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0,
1903
1905
  decideNextAction(state),
1904
- (action) => _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0, executeAction(action, state, scope), (observation) => {
1906
+ (action) => _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0, executeAction(action, state, scope), (observation) => {
1905
1907
  const next = reduceAgentState(state, observation);
1906
- return _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0,
1908
+ return _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0,
1907
1909
  recordObservation(next, observation),
1908
1910
  () => runLoop(next, scope, runStartedAt)
1909
1911
  );
1910
1912
  })
1911
1913
  );
1912
1914
  };
1913
- var runAgent = (runtime, goal) => _chunk2P4PD6D7cjs.withScopeAsync.call(void 0,
1915
+ var runAgent = (runtime, goal) => _chunkTGIFUAK4cjs.withScopeAsync.call(void 0,
1914
1916
  runtime,
1915
- (scope) => _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0,
1917
+ (scope) => _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0,
1916
1918
  nowMillis(),
1917
- (startedAt) => _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0,
1919
+ (startedAt) => _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0,
1918
1920
  emitAgentEvent({ type: "agent.run.started", goal, at: startedAt }),
1919
1921
  () => runLoop(initialAgentState(goal), scope, startedAt)
1920
1922
  )
@@ -2064,45 +2066,45 @@ var makeConfiguredPermissions = (config = {}) => ({
2064
2066
  switch (state.goal.mode) {
2065
2067
  case "read-only": {
2066
2068
  if (action.type === "fs.readFile" || action.type === "fs.exists" || action.type === "fs.searchText" || action.type === "llm.complete" || action.type === "agent.finish" || action.type === "agent.fail") {
2067
- return _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, allow());
2069
+ return _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, allow());
2068
2070
  }
2069
- return _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, deny(`Action ${action.type} is not allowed in read-only mode`));
2071
+ return _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, deny(`Action ${action.type} is not allowed in read-only mode`));
2070
2072
  }
2071
2073
  case "propose": {
2072
2074
  if (action.type === "shell.exec") {
2073
2075
  const decision = shellDecisionFromConfig(action.command, config.shell);
2074
- return _chunk2P4PD6D7cjs.asyncSucceed.call(void 0,
2076
+ return _chunkTGIFUAK4cjs.asyncSucceed.call(void 0,
2075
2077
  _nullishCoalesce(decision, () => ( deny(`Command not whitelisted: ${action.command.join(" ")}`)))
2076
2078
  );
2077
2079
  }
2078
2080
  if (action.type === "patch.apply" || action.type === "patch.rollback") {
2079
- return _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, deny(`${action.type} is not allowed in propose mode; use write mode or --apply.`));
2081
+ return _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, deny(`${action.type} is not allowed in propose mode; use write mode or --apply.`));
2080
2082
  }
2081
- return _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, allow());
2083
+ return _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, allow());
2082
2084
  }
2083
2085
  case "write": {
2084
2086
  if (action.type === "shell.exec") {
2085
2087
  const decision = shellDecisionFromConfig(action.command, config.shell);
2086
- return _chunk2P4PD6D7cjs.asyncSucceed.call(void 0,
2088
+ return _chunkTGIFUAK4cjs.asyncSucceed.call(void 0,
2087
2089
  _nullishCoalesce(decision, () => ( deny(`Command not whitelisted: ${action.command.join(" ")}`)))
2088
2090
  );
2089
2091
  }
2090
2092
  if (action.type === "patch.apply" || action.type === "patch.rollback") {
2091
- return _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, patchApplyDecisionFromConfig(action, config.patchApply));
2093
+ return _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, patchApplyDecisionFromConfig(action, config.patchApply));
2092
2094
  }
2093
- return _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, allow());
2095
+ return _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, allow());
2094
2096
  }
2095
2097
  case "autonomous": {
2096
2098
  if (action.type === "patch.apply" || action.type === "patch.rollback") {
2097
- return _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, patchApplyDecisionFromConfig(action, config.patchApply));
2099
+ return _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, patchApplyDecisionFromConfig(action, config.patchApply));
2098
2100
  }
2099
2101
  if (action.type === "shell.exec") {
2100
2102
  const decision = shellDecisionFromConfig(action.command, config.shell);
2101
- return _chunk2P4PD6D7cjs.asyncSucceed.call(void 0,
2103
+ return _chunkTGIFUAK4cjs.asyncSucceed.call(void 0,
2102
2104
  _nullishCoalesce(decision, () => ( ask(`Run non-whitelisted command: ${describeCommand(action)}`, "high", "reject")))
2103
2105
  );
2104
2106
  }
2105
- return _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, allow());
2107
+ return _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, allow());
2106
2108
  }
2107
2109
  }
2108
2110
  }
@@ -2111,10 +2113,10 @@ var defaultPermissions = makeConfiguredPermissions();
2111
2113
 
2112
2114
  // src/agent/tools/approvals.ts
2113
2115
  var autoApproveApprovals = {
2114
- request: () => _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, { type: "approved" })
2116
+ request: () => _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, { type: "approved" })
2115
2117
  };
2116
2118
  var makeAutoDenyApprovals = (reason = "Approval denied by non-interactive policy.") => ({
2117
- request: () => _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, { type: "rejected", reason })
2119
+ request: () => _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, { type: "rejected", reason })
2118
2120
  });
2119
2121
 
2120
2122
  // src/agent/node/nodeShell.ts
@@ -2124,12 +2126,12 @@ var chunkToString = (chunk) => {
2124
2126
  return typeof maybeToString === "function" ? maybeToString.call(chunk, "utf8") : String(chunk);
2125
2127
  };
2126
2128
  var NodeShell = {
2127
- exec: (command, options) => _chunk2P4PD6D7cjs.async.call(void 0, (_env, cb) => {
2129
+ exec: (command, options) => _chunkTGIFUAK4cjs.asyncEffect.call(void 0, (_env, cb) => {
2128
2130
  const [bin, ...args] = command;
2129
2131
  if (!bin) {
2130
2132
  cb(
2131
- _chunk2P4PD6D7cjs.Exit.failCause(
2132
- _chunk2P4PD6D7cjs.Cause.fail({
2133
+ _chunkTGIFUAK4cjs.Exit.failCause(
2134
+ _chunkTGIFUAK4cjs.Cause.fail({
2133
2135
  _tag: "ShellError",
2134
2136
  operation: "exec",
2135
2137
  command,
@@ -2160,8 +2162,8 @@ var NodeShell = {
2160
2162
  if (done) return;
2161
2163
  done = true;
2162
2164
  cb(
2163
- _chunk2P4PD6D7cjs.Exit.failCause(
2164
- _chunk2P4PD6D7cjs.Cause.fail({
2165
+ _chunkTGIFUAK4cjs.Exit.failCause(
2166
+ _chunkTGIFUAK4cjs.Cause.fail({
2165
2167
  _tag: "ShellError",
2166
2168
  operation: "exec",
2167
2169
  command,
@@ -2174,7 +2176,7 @@ var NodeShell = {
2174
2176
  if (done) return;
2175
2177
  done = true;
2176
2178
  cb(
2177
- _chunk2P4PD6D7cjs.Exit.succeed({
2179
+ _chunkTGIFUAK4cjs.Exit.succeed({
2178
2180
  exitCode: _nullishCoalesce(code, () => ( 1)),
2179
2181
  stdout,
2180
2182
  stderr
@@ -2190,8 +2192,8 @@ var NodeShell = {
2190
2192
  if (done) return;
2191
2193
  done = true;
2192
2194
  cb(
2193
- _chunk2P4PD6D7cjs.Exit.failCause(
2194
- _chunk2P4PD6D7cjs.Cause.fail({
2195
+ _chunkTGIFUAK4cjs.Exit.failCause(
2196
+ _chunkTGIFUAK4cjs.Cause.fail({
2195
2197
  _tag: "ShellError",
2196
2198
  operation: "exec",
2197
2199
  command,
@@ -2215,15 +2217,15 @@ var parseRipgrep = (stdout) => stdout.split("\n").filter(Boolean).map((line) =>
2215
2217
  return { path, line: Number(lineNo), text: rest.join(":") };
2216
2218
  });
2217
2219
  var makeNodeFileSystem = (shell) => ({
2218
- readFile: (path) => _chunk2P4PD6D7cjs.fromPromiseAbortable.call(void 0,
2219
- _chunk2P4PD6D7cjs.async.call(void 0, signal) => {
2220
+ readFile: (path) => _chunkTGIFUAK4cjs.fromPromiseAbortable.call(void 0,
2221
+ async (signal) => {
2220
2222
  const { readFile } = await dynamicImport2("node:fs/promises");
2221
2223
  return readFile(path, { encoding: "utf8", signal });
2222
2224
  },
2223
2225
  (cause) => ({ _tag: "FsError", operation: "readFile", cause })
2224
2226
  ),
2225
- exists: (path) => _chunk2P4PD6D7cjs.fromPromiseAbortable.call(void 0,
2226
- _chunk2P4PD6D7cjs.async.call(void 0, signal) => {
2227
+ exists: (path) => _chunkTGIFUAK4cjs.fromPromiseAbortable.call(void 0,
2228
+ async (signal) => {
2227
2229
  if (signal.aborted) return false;
2228
2230
  const { stat } = await dynamicImport2("node:fs/promises");
2229
2231
  if (signal.aborted) return false;
@@ -2236,7 +2238,7 @@ var makeNodeFileSystem = (shell) => ({
2236
2238
  },
2237
2239
  (cause) => ({ _tag: "FsError", operation: "exists", cause })
2238
2240
  ),
2239
- searchText: (cwd, query, options) => _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0,
2241
+ searchText: (cwd, query, options) => _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0,
2240
2242
  shell.exec(
2241
2243
  [
2242
2244
  "rg",
@@ -2256,27 +2258,27 @@ var makeNodeFileSystem = (shell) => ({
2256
2258
  ),
2257
2259
  (result) => {
2258
2260
  if (result.exitCode > 1) {
2259
- return _chunk2P4PD6D7cjs.asyncFail.call(void 0, {
2261
+ return _chunkTGIFUAK4cjs.asyncFail.call(void 0, {
2260
2262
  _tag: "FsError",
2261
2263
  operation: "searchText",
2262
2264
  cause: result.stderr
2263
2265
  });
2264
2266
  }
2265
- return _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, parseRipgrep(result.stdout));
2267
+ return _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, parseRipgrep(result.stdout));
2266
2268
  }
2267
2269
  )
2268
2270
  });
2269
2271
 
2270
2272
  // src/agent/node/nodePatchService.ts
2271
2273
  var validatePatchTargets = (cwd, paths) => paths.reduce(
2272
- (acc, path) => _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0,
2274
+ (acc, path) => _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0,
2273
2275
  acc,
2274
- (validated) => _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0,
2276
+ (validated) => _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0,
2275
2277
  resolveWorkspacePath(cwd, path),
2276
- () => _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, [...validated, path])
2278
+ () => _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, [...validated, path])
2277
2279
  )
2278
2280
  ),
2279
- _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, [])
2281
+ _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, [])
2280
2282
  );
2281
2283
  var patchFailure = (operation, cause, patch) => ({
2282
2284
  _tag: "PatchError",
@@ -2292,7 +2294,7 @@ var makeNodePatchService = (shell) => {
2292
2294
  `;
2293
2295
  const operation = reverse ? "rollback" : "apply";
2294
2296
  if (!patch || !changedFiles.length) {
2295
- return _chunk2P4PD6D7cjs.asyncFail.call(void 0,
2297
+ return _chunkTGIFUAK4cjs.asyncFail.call(void 0,
2296
2298
  patchFailure("extract", "No unified diff with workspace-scoped paths was found.", rawPatch)
2297
2299
  );
2298
2300
  }
@@ -2313,13 +2315,13 @@ var makeNodePatchService = (shell) => {
2313
2315
  "--whitespace=nowarn",
2314
2316
  "-"
2315
2317
  ];
2316
- return _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0,
2318
+ return _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0,
2317
2319
  validatePatchTargets(cwd, changedFiles),
2318
- () => _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0,
2320
+ () => _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0,
2319
2321
  shell.exec(checkArgs, { cwd, stdin }),
2320
2322
  (checkResult) => {
2321
2323
  if (checkResult.exitCode !== 0) {
2322
- return _chunk2P4PD6D7cjs.asyncFail.call(void 0,
2324
+ return _chunkTGIFUAK4cjs.asyncFail.call(void 0,
2323
2325
  patchFailure(
2324
2326
  `${operation}.check`,
2325
2327
  checkResult.stderr || checkResult.stdout || `git apply --check exited with ${checkResult.exitCode}`,
@@ -2327,11 +2329,11 @@ var makeNodePatchService = (shell) => {
2327
2329
  )
2328
2330
  );
2329
2331
  }
2330
- return _chunk2P4PD6D7cjs.asyncFlatMap.call(void 0,
2332
+ return _chunkTGIFUAK4cjs.asyncFlatMap.call(void 0,
2331
2333
  shell.exec(applyArgs, { cwd, stdin }),
2332
2334
  (applyResult) => {
2333
2335
  if (applyResult.exitCode !== 0) {
2334
- return _chunk2P4PD6D7cjs.asyncFail.call(void 0,
2336
+ return _chunkTGIFUAK4cjs.asyncFail.call(void 0,
2335
2337
  patchFailure(
2336
2338
  operation,
2337
2339
  applyResult.stderr || applyResult.stdout || `git apply exited with ${applyResult.exitCode}`,
@@ -2339,7 +2341,7 @@ var makeNodePatchService = (shell) => {
2339
2341
  )
2340
2342
  );
2341
2343
  }
2342
- return _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, { changedFiles });
2344
+ return _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, { changedFiles });
2343
2345
  }
2344
2346
  );
2345
2347
  }
@@ -2554,7 +2556,7 @@ var validateAgentConfig = (config, sourcePath) => {
2554
2556
  }
2555
2557
  return config;
2556
2558
  };
2557
- var isFile = _chunk2P4PD6D7cjs.async.call(void 0, path) => {
2559
+ var isFile = async (path) => {
2558
2560
  const { stat } = await dynamicImport3("node:fs/promises");
2559
2561
  try {
2560
2562
  return (await stat(path)).isFile();
@@ -2562,7 +2564,7 @@ var isFile = _chunk2P4PD6D7cjs.async.call(void 0, path) => {
2562
2564
  return false;
2563
2565
  }
2564
2566
  };
2565
- var findConfigPath = _chunk2P4PD6D7cjs.async.call(void 0, cwd) => {
2567
+ var findConfigPath = async (cwd) => {
2566
2568
  const nodePath = await dynamicImport3("node:path");
2567
2569
  let current = nodePath.resolve(cwd);
2568
2570
  while (true) {
@@ -2575,7 +2577,7 @@ var findConfigPath = _chunk2P4PD6D7cjs.async.call(void 0, cwd) => {
2575
2577
  current = parent;
2576
2578
  }
2577
2579
  };
2578
- var readConfigFile = _chunk2P4PD6D7cjs.async.call(void 0, path) => {
2580
+ var readConfigFile = async (path) => {
2579
2581
  const { readFile } = await dynamicImport3("node:fs/promises");
2580
2582
  const raw = String(await readFile(path, "utf8")).replace(/^\uFEFF/, "");
2581
2583
  try {
@@ -2587,7 +2589,7 @@ var readConfigFile = _chunk2P4PD6D7cjs.async.call(void 0, path) => {
2587
2589
  throw error;
2588
2590
  }
2589
2591
  };
2590
- var loadNodeAgentConfig = _chunk2P4PD6D7cjs.async.call(void 0, options) => {
2592
+ var loadNodeAgentConfig = async (options) => {
2591
2593
  if (options.noConfig) return { config: {} };
2592
2594
  const nodePath = await dynamicImport3("node:path");
2593
2595
  if (options.configPath) {
@@ -2603,8 +2605,8 @@ var loadNodeAgentConfig = _chunk2P4PD6D7cjs.async.call(void 0, options) => {
2603
2605
  // src/agent/llm/openAICompatible.ts
2604
2606
  var extractText = (json) => _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([json, 'optionalAccess', _150 => _150.choices, 'optionalAccess', _151 => _151[0], 'optionalAccess', _152 => _152.message, 'optionalAccess', _153 => _153.content]), () => ( _optionalChain([json, 'optionalAccess', _154 => _154.output_text]))), () => ( _optionalChain([json, 'optionalAccess', _155 => _155.content, 'optionalAccess', _156 => _156[0], 'optionalAccess', _157 => _157.text]))), () => ( JSON.stringify(json)));
2605
2607
  var makeOpenAICompatibleLLM = (config) => ({
2606
- complete: (request) => _chunk2P4PD6D7cjs.fromPromiseAbortable.call(void 0,
2607
- _chunk2P4PD6D7cjs.async.call(void 0, signal) => {
2608
+ complete: (request) => _chunkTGIFUAK4cjs.fromPromiseAbortable.call(void 0,
2609
+ async (signal) => {
2608
2610
  const res = await fetch(config.endpoint, {
2609
2611
  method: "POST",
2610
2612
  signal,
@@ -2685,7 +2687,7 @@ var extractGoogleText = (json) => {
2685
2687
  }
2686
2688
  return JSON.stringify(json);
2687
2689
  };
2688
- var responseErrorMessage = _chunk2P4PD6D7cjs.async.call(void 0, res) => {
2690
+ var responseErrorMessage = async (res) => {
2689
2691
  const raw = await res.text();
2690
2692
  try {
2691
2693
  const json = JSON.parse(raw);
@@ -2695,8 +2697,8 @@ var responseErrorMessage = _chunk2P4PD6D7cjs.async.call(void 0, res) => {
2695
2697
  }
2696
2698
  };
2697
2699
  var makeGoogleGenerativeAILLM = (config) => ({
2698
- complete: (request) => _chunk2P4PD6D7cjs.fromPromiseAbortable.call(void 0,
2699
- _chunk2P4PD6D7cjs.async.call(void 0, signal) => {
2700
+ complete: (request) => _chunkTGIFUAK4cjs.fromPromiseAbortable.call(void 0,
2701
+ async (signal) => {
2700
2702
  const res = await fetch(makeGenerateContentEndpoint(config), {
2701
2703
  method: "POST",
2702
2704
  signal,
@@ -2726,7 +2728,7 @@ var defaultContent = (request) => [
2726
2728
  "You can also set BRASS_FAKE_LLM_RESPONSE to provide a deterministic offline response, including a fenced ```diff block."
2727
2729
  ].join("\n");
2728
2730
  var makeFakeLLM = (options = {}) => ({
2729
- complete: (request) => _chunk2P4PD6D7cjs.asyncSucceed.call(void 0, {
2731
+ complete: (request) => _chunkTGIFUAK4cjs.asyncSucceed.call(void 0, {
2730
2732
  content: typeof options.content === "function" ? options.content(request) : _nullishCoalesce(options.content, () => ( defaultContent(request)))
2731
2733
  })
2732
2734
  });