brass-runtime 1.15.0 → 1.16.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.
- package/README.md +409 -137
- package/dist/agent/cli/main.cjs +40 -35
- package/dist/agent/cli/main.js +9 -4
- package/dist/agent/cli/main.mjs +9 -4
- package/dist/agent/index.cjs +8 -4
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.js +7 -3
- package/dist/agent/index.mjs +7 -3
- package/dist/{chunk-PPUXIH5R.js → chunk-2WC63LJK.mjs} +11 -7
- package/dist/chunk-3RG5ZIWI.js +10 -0
- package/dist/chunk-45F7OKGT.cjs +104 -0
- package/dist/chunk-5YOQOXEQ.cjs +2491 -0
- package/dist/{chunk-STVLQ3XD.cjs → chunk-7HUOJA4W.cjs} +78 -74
- package/dist/{chunk-BMH5AV44.js → chunk-7LVI2GIN.js} +251 -370
- package/dist/chunk-7TL2LHQJ.js +2491 -0
- package/dist/chunk-7V4KY4RL.mjs +104 -0
- package/dist/chunk-7XOPAB5Q.js +2143 -0
- package/dist/chunk-CCKHV5BT.mjs +193 -0
- package/dist/{chunk-AR22SXML.js → chunk-CY33PGEX.mjs} +488 -421
- package/dist/chunk-DJQ7OMMB.cjs +144 -0
- package/dist/chunk-F5EUMJL7.mjs +2143 -0
- package/dist/chunk-FM4W4QPL.js +193 -0
- package/dist/{chunk-TO7IKXYT.js → chunk-G3XGCZDQ.js} +1 -1
- package/dist/{chunk-BDF4AMWX.mjs → chunk-G6IQOE4P.mjs} +251 -370
- package/dist/chunk-GOV47PPB.mjs +552 -0
- package/dist/chunk-H55LI6WY.js +93 -0
- package/dist/chunk-IJT6RRQ5.cjs +93 -0
- package/dist/{chunk-ELOOF35R.mjs → chunk-J3H54ZRV.mjs} +1 -1
- package/dist/chunk-JF4XXPZ5.cjs +552 -0
- package/dist/chunk-JNFRRJYH.cjs +2143 -0
- package/dist/chunk-JX3LZQJH.cjs +354 -0
- package/dist/chunk-K2T3DV26.mjs +93 -0
- package/dist/chunk-KCPT2D6G.js +552 -0
- package/dist/chunk-MWXMNYJS.cjs +1110 -0
- package/dist/{chunk-VEZNF5GZ.cjs → chunk-N6VHMOWB.cjs} +130 -126
- package/dist/{chunk-3QMOKAS5.js → chunk-NC5SDRYE.js} +9 -5
- package/dist/chunk-NOYZIMUJ.mjs +144 -0
- package/dist/{chunk-R3R2FVLG.cjs → chunk-NYL4D7SK.cjs} +5 -5
- package/dist/chunk-OBGZSXTJ.cjs +10 -0
- package/dist/{chunk-4NHES7VK.mjs → chunk-OOGJ73B6.js} +11 -7
- package/dist/chunk-PNVFW245.js +144 -0
- package/dist/chunk-PRWCB3QL.mjs +2491 -0
- package/dist/{chunk-JFPU5GQI.mjs → chunk-QY5FKYEQ.js} +488 -421
- package/dist/chunk-ROJC3NBJ.js +104 -0
- package/dist/chunk-SPUEME2B.cjs +343 -0
- package/dist/chunk-TDVMADDN.js +343 -0
- package/dist/chunk-TVN5I4U6.cjs +193 -0
- package/dist/chunk-U5KWK3PX.mjs +343 -0
- package/dist/chunk-VFIUZG7J.mjs +354 -0
- package/dist/{chunk-TGIFUAK4.cjs → chunk-WQ5QNU5R.cjs} +459 -578
- package/dist/chunk-XDZOO4L5.js +354 -0
- package/dist/chunk-Y6FXYEAI.mjs +10 -0
- package/dist/{chunk-K6M7MDZ4.mjs → chunk-ZGLD4TVZ.mjs} +9 -5
- package/dist/client-CtFmoDvM.d.ts +645 -0
- package/dist/core/index.cjs +72 -4
- package/dist/core/index.d.ts +92 -198
- package/dist/core/index.js +106 -38
- package/dist/core/index.mjs +106 -38
- package/dist/{effect-CMOQKX8y.d.ts → effect-CGNl5Rqp.d.ts} +107 -1
- package/dist/effectRunner-3ZHAD3LE.cjs +8 -0
- package/dist/effectRunner-A4CHJXJI.js +8 -0
- package/dist/effectRunner-OPUF6QRN.mjs +8 -0
- package/dist/http/index.cjs +2189 -1271
- package/dist/http/index.d.ts +830 -270
- package/dist/http/index.js +2008 -1090
- package/dist/http/index.mjs +2008 -1090
- package/dist/http/testing.cjs +159 -0
- package/dist/http/testing.d.ts +42 -0
- package/dist/http/testing.js +159 -0
- package/dist/http/testing.mjs +159 -0
- package/dist/index.cjs +246 -178
- package/dist/index.d.ts +9 -35
- package/dist/index.js +120 -52
- package/dist/index.mjs +120 -52
- package/dist/observability/index.cjs +677 -0
- package/dist/observability/index.d.ts +79 -0
- package/dist/observability/index.js +677 -0
- package/dist/observability/index.mjs +677 -0
- package/dist/schedule-Fque9Abz.d.ts +70 -0
- package/dist/schema/index.cjs +25 -0
- package/dist/schema/index.d.ts +177 -0
- package/dist/schema/index.js +25 -0
- package/dist/schema/index.mjs +25 -0
- package/dist/server-C8hDXA74.d.ts +674 -0
- package/dist/{stream-FQm9h4Mg.d.ts → stream-dvSs0QS5.d.ts} +1 -1
- package/dist/tracer-B5tRH9H7.d.ts +230 -0
- package/dist/tracing-Dt9S_6V8.d.ts +148 -0
- package/package.json +27 -1
- package/dist/chunk-BDYEENHT.js +0 -224
- package/dist/chunk-MS34J5LY.cjs +0 -224
- package/dist/chunk-UMAZLXAB.mjs +0 -224
- package/dist/chunk-XPZNXSVN.cjs +0 -1043
- package/dist/tracing-DNT9jEbr.d.ts +0 -106
package/dist/agent/cli/main.cjs
CHANGED
|
@@ -17,14 +17,19 @@
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
var
|
|
21
|
-
require('../../chunk-
|
|
20
|
+
var _chunkN6VHMOWBcjs = require('../../chunk-N6VHMOWB.cjs');
|
|
21
|
+
require('../../chunk-NYL4D7SK.cjs');
|
|
22
|
+
require('../../chunk-TVN5I4U6.cjs');
|
|
22
23
|
|
|
23
24
|
|
|
25
|
+
var _chunkWQ5QNU5Rcjs = require('../../chunk-WQ5QNU5R.cjs');
|
|
24
26
|
|
|
25
27
|
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
|
|
30
|
+
var _chunkDJQ7OMMBcjs = require('../../chunk-DJQ7OMMB.cjs');
|
|
31
|
+
require('../../chunk-SPUEME2B.cjs');
|
|
32
|
+
require('../../chunk-OBGZSXTJ.cjs');
|
|
28
33
|
|
|
29
34
|
// src/agent/cli/approvals.ts
|
|
30
35
|
var dynamicImport = new Function("specifier", "return import(specifier)");
|
|
@@ -40,7 +45,7 @@ var answerToResponse = (answer, request) => {
|
|
|
40
45
|
return { type: "rejected", reason: `Unrecognized approval answer: ${answer}` };
|
|
41
46
|
};
|
|
42
47
|
var makeCliApprovalService = (options = {}) => ({
|
|
43
|
-
request: (request) =>
|
|
48
|
+
request: (request) => _chunkDJQ7OMMBcjs.asyncEffect.call(void 0, (_env, cb) => {
|
|
44
49
|
let closed = false;
|
|
45
50
|
let rl;
|
|
46
51
|
dynamicImport("node:readline/promises").then(({ createInterface }) => {
|
|
@@ -52,7 +57,7 @@ var makeCliApprovalService = (options = {}) => ({
|
|
|
52
57
|
_optionalChain([output, 'optionalAccess', _ => _.write, 'optionalCall', _2 => _2(`
|
|
53
58
|
Approval required (${request.risk})
|
|
54
59
|
`)]);
|
|
55
|
-
_optionalChain([output, 'optionalAccess', _3 => _3.write, 'optionalCall', _4 => _4(`Action: ${
|
|
60
|
+
_optionalChain([output, 'optionalAccess', _3 => _3.write, 'optionalCall', _4 => _4(`Action: ${_chunkN6VHMOWBcjs.summarizeAgentAction.call(void 0, request.action)}
|
|
56
61
|
`)]);
|
|
57
62
|
_optionalChain([output, 'optionalAccess', _5 => _5.write, 'optionalCall', _6 => _6(`Reason: ${request.reason}
|
|
58
63
|
`)]);
|
|
@@ -61,14 +66,14 @@ Approval required (${request.risk})
|
|
|
61
66
|
if (answer === void 0 || closed) return;
|
|
62
67
|
closed = true;
|
|
63
68
|
_optionalChain([rl, 'optionalAccess', _7 => _7.close, 'optionalCall', _8 => _8()]);
|
|
64
|
-
cb(
|
|
69
|
+
cb(_chunkDJQ7OMMBcjs.Exit.succeed(answerToResponse(answer, request)));
|
|
65
70
|
}).catch((cause) => {
|
|
66
71
|
if (closed) return;
|
|
67
72
|
closed = true;
|
|
68
73
|
_optionalChain([rl, 'optionalAccess', _9 => _9.close, 'optionalCall', _10 => _10()]);
|
|
69
74
|
cb(
|
|
70
|
-
|
|
71
|
-
|
|
75
|
+
_chunkDJQ7OMMBcjs.Exit.failCause(
|
|
76
|
+
_chunkDJQ7OMMBcjs.Cause.fail({
|
|
72
77
|
_tag: "AgentLoopError",
|
|
73
78
|
message: `Approval prompt failed: ${String(cause)}`
|
|
74
79
|
})
|
|
@@ -1099,7 +1104,7 @@ var parseCliArgs = (argv) => {
|
|
|
1099
1104
|
}
|
|
1100
1105
|
if (arg === "--preset" || arg.startsWith("--preset=")) {
|
|
1101
1106
|
const [value, nextIndex] = readFlagValue(argv, index, "--preset");
|
|
1102
|
-
if (!
|
|
1107
|
+
if (!_chunkN6VHMOWBcjs.isAgentPreset.call(void 0, value)) {
|
|
1103
1108
|
throw new Error("--preset requires one of: fix-tests, inspect, typecheck, lint");
|
|
1104
1109
|
}
|
|
1105
1110
|
preset = value;
|
|
@@ -1275,7 +1280,7 @@ var parseBatchGoal = (value, path) => {
|
|
|
1275
1280
|
if (cwd !== void 0 && typeof cwd !== "string") throw new Error(`${path}.cwd must be a string.`);
|
|
1276
1281
|
if (patchFile !== void 0 && typeof patchFile !== "string") throw new Error(`${path}.patchFile must be a string.`);
|
|
1277
1282
|
if (saveRunDir !== void 0 && typeof saveRunDir !== "string") throw new Error(`${path}.saveRunDir must be a string.`);
|
|
1278
|
-
if (preset !== void 0 && (typeof preset !== "string" || !
|
|
1283
|
+
if (preset !== void 0 && (typeof preset !== "string" || !_chunkN6VHMOWBcjs.isAgentPreset.call(void 0, preset))) {
|
|
1279
1284
|
throw new Error(`${path}.preset must be one of: fix-tests, inspect, typecheck, lint.`);
|
|
1280
1285
|
}
|
|
1281
1286
|
if (mode !== void 0 && (typeof mode !== "string" || !isAgentMode(mode))) {
|
|
@@ -1319,7 +1324,7 @@ var readBatchFile = async (cwd, batchFile) => {
|
|
|
1319
1324
|
var resolveBatchGoalText = (item, fallbackPatchFile) => {
|
|
1320
1325
|
if (typeof item === "string") return item;
|
|
1321
1326
|
if (item.goal) return item.goal;
|
|
1322
|
-
if (item.preset) return
|
|
1327
|
+
if (item.preset) return _chunkN6VHMOWBcjs.goalForAgentPreset.call(void 0, item.preset);
|
|
1323
1328
|
if (_nullishCoalesce(item.patchFile, () => ( fallbackPatchFile))) return "apply supplied patch";
|
|
1324
1329
|
return "";
|
|
1325
1330
|
};
|
|
@@ -1346,7 +1351,7 @@ var resolveBatchRuns = (items, parsed, config) => items.map((item, index) => {
|
|
|
1346
1351
|
};
|
|
1347
1352
|
});
|
|
1348
1353
|
var resolveParsedConfig = async (parsed) => {
|
|
1349
|
-
const workspaceDiscovery =
|
|
1354
|
+
const workspaceDiscovery = _chunkN6VHMOWBcjs.discoverNodeWorkspaceRoot.call(void 0, parsed.cwd, {
|
|
1350
1355
|
enabled: parsed.discoverWorkspace
|
|
1351
1356
|
});
|
|
1352
1357
|
const cwdResolved = workspaceDiscovery.cwd;
|
|
@@ -1354,7 +1359,7 @@ var resolveParsedConfig = async (parsed) => {
|
|
|
1354
1359
|
...parsed,
|
|
1355
1360
|
cwd: cwdResolved
|
|
1356
1361
|
};
|
|
1357
|
-
const loaded = await
|
|
1362
|
+
const loaded = await _chunkN6VHMOWBcjs.loadNodeAgentConfig.call(void 0, {
|
|
1358
1363
|
cwd: cwdResolved,
|
|
1359
1364
|
configPath: parsed.configPath,
|
|
1360
1365
|
noConfig: parsed.noConfig
|
|
@@ -1370,7 +1375,7 @@ var resolveParsedConfig = async (parsed) => {
|
|
|
1370
1375
|
const batchRuns = resolveBatchRuns(batchItems, parsedAtWorkspace, loaded.config);
|
|
1371
1376
|
return {
|
|
1372
1377
|
...parsedAtWorkspace,
|
|
1373
|
-
goalText: parsed.goalText || (parsed.preset ?
|
|
1378
|
+
goalText: parsed.goalText || (parsed.preset ? _chunkN6VHMOWBcjs.goalForAgentPreset.call(void 0, parsed.preset) : parsed.patchFile ? "apply supplied patch" : parsed.goalText),
|
|
1374
1379
|
mode: parsed.modeSpecified ? parsed.mode : parsed.preset === "inspect" ? "read-only" : _nullishCoalesce(loaded.config.mode, () => ( parsed.mode)),
|
|
1375
1380
|
approval: parsed.approvalSpecified ? parsed.approval : _nullishCoalesce(loaded.config.approval, () => ( parsed.approval)),
|
|
1376
1381
|
config: loaded.config,
|
|
@@ -1494,7 +1499,7 @@ var envByName = (name) => name ? process.env[name] : void 0;
|
|
|
1494
1499
|
var makeGoogleLLMFromEnv = (config) => {
|
|
1495
1500
|
const apiKey = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(envByName(_optionalChain([config, 'optionalAccess', _39 => _39.apiKeyEnv])), () => ( process.env.BRASS_GOOGLE_API_KEY)), () => ( process.env.GOOGLE_API_KEY)), () => ( process.env.GEMINI_API_KEY));
|
|
1496
1501
|
if (!apiKey) return void 0;
|
|
1497
|
-
return
|
|
1502
|
+
return _chunkN6VHMOWBcjs.makeGoogleGenerativeAILLM.call(void 0, {
|
|
1498
1503
|
apiKey,
|
|
1499
1504
|
model: _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(process.env.BRASS_GOOGLE_MODEL, () => ( process.env.BRASS_LLM_MODEL)), () => ( _optionalChain([config, 'optionalAccess', _40 => _40.model]))), () => ( "gemini-2.5-flash")),
|
|
1500
1505
|
apiVersion: _nullishCoalesce(_nullishCoalesce(process.env.BRASS_GOOGLE_API_VERSION, () => ( _optionalChain([config, 'optionalAccess', _41 => _41.apiVersion]))), () => ( "v1beta")),
|
|
@@ -1512,12 +1517,12 @@ var makeOpenAICompatibleLLMFromEnv = (config) => {
|
|
|
1512
1517
|
const apiKey = _nullishCoalesce(envByName(_optionalChain([config, 'optionalAccess', _50 => _50.apiKeyEnv])), () => ( process.env.BRASS_LLM_API_KEY));
|
|
1513
1518
|
const model = _nullishCoalesce(_nullishCoalesce(process.env.BRASS_LLM_MODEL, () => ( _optionalChain([config, 'optionalAccess', _51 => _51.model]))), () => ( "gpt-4.1"));
|
|
1514
1519
|
if (!endpoint || !apiKey) return void 0;
|
|
1515
|
-
return
|
|
1520
|
+
return _chunkN6VHMOWBcjs.makeOpenAICompatibleLLM.call(void 0, { endpoint, apiKey, model });
|
|
1516
1521
|
};
|
|
1517
1522
|
var makeLLMFromEnv = (config) => {
|
|
1518
1523
|
const provider = _optionalChain([(_nullishCoalesce(process.env.BRASS_LLM_PROVIDER, () => ( _optionalChain([config, 'optionalAccess', _52 => _52.provider])))), 'optionalAccess', _53 => _53.trim, 'call', _54 => _54(), 'access', _55 => _55.toLowerCase, 'call', _56 => _56()]);
|
|
1519
1524
|
const fakeResponse = _nullishCoalesce(process.env.BRASS_FAKE_LLM_RESPONSE, () => ( _optionalChain([config, 'optionalAccess', _57 => _57.fakeResponse])));
|
|
1520
|
-
if (provider === "fake") return
|
|
1525
|
+
if (provider === "fake") return _chunkN6VHMOWBcjs.makeFakeLLM.call(void 0, { content: fakeResponse });
|
|
1521
1526
|
if (provider === "google" || provider === "gemini") {
|
|
1522
1527
|
const google = makeGoogleLLMFromEnv(config);
|
|
1523
1528
|
if (!google) {
|
|
@@ -1539,7 +1544,7 @@ var makeLLMFromEnv = (config) => {
|
|
|
1539
1544
|
if (provider) {
|
|
1540
1545
|
throw new Error(`Unsupported LLM provider: ${provider}`);
|
|
1541
1546
|
}
|
|
1542
|
-
return _nullishCoalesce(_nullishCoalesce(makeGoogleLLMFromEnv(config), () => ( makeOpenAICompatibleLLMFromEnv(config))), () => (
|
|
1547
|
+
return _nullishCoalesce(_nullishCoalesce(makeGoogleLLMFromEnv(config), () => ( makeOpenAICompatibleLLMFromEnv(config))), () => ( _chunkN6VHMOWBcjs.makeFakeLLM.call(void 0, { content: fakeResponse })));
|
|
1543
1548
|
};
|
|
1544
1549
|
var parseApprovalModeFromEnv = () => {
|
|
1545
1550
|
const raw = _optionalChain([process, 'access', _58 => _58.env, 'access', _59 => _59.BRASS_AGENT_APPROVAL, 'optionalAccess', _60 => _60.trim, 'call', _61 => _61(), 'access', _62 => _62.toLowerCase, 'call', _63 => _63()]);
|
|
@@ -1562,9 +1567,9 @@ var makeApprovalServiceFromCli = (parsed) => {
|
|
|
1562
1567
|
const mode = resolveApprovalMode(parsed);
|
|
1563
1568
|
switch (mode) {
|
|
1564
1569
|
case "approve":
|
|
1565
|
-
return
|
|
1570
|
+
return _chunkN6VHMOWBcjs.autoApproveApprovals;
|
|
1566
1571
|
case "deny":
|
|
1567
|
-
return
|
|
1572
|
+
return _chunkN6VHMOWBcjs.makeAutoDenyApprovals.call(void 0, "Approval rejected because the CLI is running without interactive input. Use --yes to auto-approve.");
|
|
1568
1573
|
case "interactive":
|
|
1569
1574
|
return makeCliApprovalService();
|
|
1570
1575
|
}
|
|
@@ -1696,32 +1701,32 @@ var createHumanEventSink = (configPath) => ({
|
|
|
1696
1701
|
console.log("");
|
|
1697
1702
|
break;
|
|
1698
1703
|
case "agent.action.started":
|
|
1699
|
-
console.log(`\u2192 ${
|
|
1704
|
+
console.log(`\u2192 ${_chunkN6VHMOWBcjs.summarizeAgentAction.call(void 0, event.action)}`);
|
|
1700
1705
|
break;
|
|
1701
1706
|
case "agent.action.completed": {
|
|
1702
|
-
const status =
|
|
1703
|
-
console.log(`${statusIcon2(status)} ${
|
|
1707
|
+
const status = _chunkN6VHMOWBcjs.observationStatus.call(void 0, event.observation);
|
|
1708
|
+
console.log(`${statusIcon2(status)} ${_chunkN6VHMOWBcjs.summarizeAgentObservation.call(void 0, event.observation)} ${formatDuration(event.durationMs)}`);
|
|
1704
1709
|
break;
|
|
1705
1710
|
}
|
|
1706
1711
|
case "agent.action.failed":
|
|
1707
1712
|
if (event.error._tag !== "ToolTimeout" && event.error._tag !== "PermissionDenied" && event.error._tag !== "ApprovalRejected") {
|
|
1708
|
-
console.log(`\u2717 ${
|
|
1713
|
+
console.log(`\u2717 ${_chunkN6VHMOWBcjs.summarizeAgentAction.call(void 0, event.action)} failed with ${event.error._tag} ${formatDuration(event.durationMs)}`);
|
|
1709
1714
|
}
|
|
1710
1715
|
break;
|
|
1711
1716
|
case "agent.tool.timeout":
|
|
1712
|
-
console.log(`! ${
|
|
1717
|
+
console.log(`! ${_chunkN6VHMOWBcjs.summarizeAgentAction.call(void 0, event.action)} timed out after ${event.timeoutMs}ms`);
|
|
1713
1718
|
break;
|
|
1714
1719
|
case "agent.permission.denied":
|
|
1715
|
-
console.log(`\u2717 ${
|
|
1720
|
+
console.log(`\u2717 ${_chunkN6VHMOWBcjs.summarizeAgentAction.call(void 0, event.action)} denied: ${event.reason}`);
|
|
1716
1721
|
break;
|
|
1717
1722
|
case "agent.approval.requested":
|
|
1718
|
-
console.log(`? approval required for ${
|
|
1723
|
+
console.log(`? approval required for ${_chunkN6VHMOWBcjs.summarizeAgentAction.call(void 0, event.action)} (${event.risk})`);
|
|
1719
1724
|
break;
|
|
1720
1725
|
case "agent.approval.resolved":
|
|
1721
1726
|
if (event.approved) {
|
|
1722
|
-
console.log(`\u2713 approval granted for ${
|
|
1727
|
+
console.log(`\u2713 approval granted for ${_chunkN6VHMOWBcjs.summarizeAgentAction.call(void 0, event.action)}`);
|
|
1723
1728
|
} else {
|
|
1724
|
-
console.log(`\u2717 approval rejected for ${
|
|
1729
|
+
console.log(`\u2717 approval rejected for ${_chunkN6VHMOWBcjs.summarizeAgentAction.call(void 0, event.action)}${event.reason ? `: ${event.reason}` : ""}`);
|
|
1725
1730
|
}
|
|
1726
1731
|
break;
|
|
1727
1732
|
case "agent.patch.applied":
|
|
@@ -1826,13 +1831,13 @@ var printHumanFinalSummary = (state) => {
|
|
|
1826
1831
|
};
|
|
1827
1832
|
var makeEventsSink = (parsed, compactOptions) => parsed.output === "human" ? createHumanEventSink(parsed.resolvedConfigPath) : parsed.output === "events-json" ? createJsonEventSink(compactOptions) : parsed.output === "protocol-json" ? createProtocolEventSink(compactOptions) : void 0;
|
|
1828
1833
|
var makeAgentEnv = (parsed, events) => {
|
|
1829
|
-
const shell =
|
|
1834
|
+
const shell = _chunkN6VHMOWBcjs.NodeShell;
|
|
1830
1835
|
return {
|
|
1831
1836
|
shell,
|
|
1832
|
-
fs:
|
|
1833
|
-
patch:
|
|
1837
|
+
fs: _chunkN6VHMOWBcjs.makeNodeFileSystem.call(void 0, shell),
|
|
1838
|
+
patch: _chunkN6VHMOWBcjs.makeNodePatchService.call(void 0, shell),
|
|
1834
1839
|
llm: makeLLMFromEnv(parsed.config.llm),
|
|
1835
|
-
permissions:
|
|
1840
|
+
permissions: _chunkN6VHMOWBcjs.makeConfiguredPermissions.call(void 0, parsed.config.permissions),
|
|
1836
1841
|
approvals: makeApprovalServiceFromCli(parsed),
|
|
1837
1842
|
...events ? { events } : {},
|
|
1838
1843
|
...parsed.config.tools ? { toolPolicies: parsed.config.tools } : {}
|
|
@@ -1849,10 +1854,10 @@ var singleRunFromParsed = (parsed) => ({
|
|
|
1849
1854
|
});
|
|
1850
1855
|
var runCliAgent = async (parsed, run, compactOptions, events) => {
|
|
1851
1856
|
const env = makeAgentEnv(parsed, events);
|
|
1852
|
-
const runtime = new (0,
|
|
1857
|
+
const runtime = new (0, _chunkWQ5QNU5Rcjs.Runtime)({ env });
|
|
1853
1858
|
const initialPatch = run.patchFile ? await readPatchFile(run.cwd, run.patchFile) : void 0;
|
|
1854
1859
|
const state = await runtime.toPromise(
|
|
1855
|
-
|
|
1860
|
+
_chunkN6VHMOWBcjs.runAgent.call(void 0, runtime, {
|
|
1856
1861
|
id: `agent-${Date.now()}-${run.index + 1}`,
|
|
1857
1862
|
cwd: run.cwd,
|
|
1858
1863
|
text: run.goalText,
|
package/dist/agent/cli/main.js
CHANGED
|
@@ -17,14 +17,19 @@ import {
|
|
|
17
17
|
runAgent,
|
|
18
18
|
summarizeAgentAction,
|
|
19
19
|
summarizeAgentObservation
|
|
20
|
-
} from "../../chunk-
|
|
21
|
-
import "../../chunk-
|
|
20
|
+
} from "../../chunk-NC5SDRYE.js";
|
|
21
|
+
import "../../chunk-G3XGCZDQ.js";
|
|
22
|
+
import "../../chunk-FM4W4QPL.js";
|
|
23
|
+
import {
|
|
24
|
+
Runtime
|
|
25
|
+
} from "../../chunk-7LVI2GIN.js";
|
|
22
26
|
import {
|
|
23
27
|
Cause,
|
|
24
28
|
Exit,
|
|
25
|
-
Runtime,
|
|
26
29
|
asyncEffect
|
|
27
|
-
} from "../../chunk-
|
|
30
|
+
} from "../../chunk-PNVFW245.js";
|
|
31
|
+
import "../../chunk-TDVMADDN.js";
|
|
32
|
+
import "../../chunk-3RG5ZIWI.js";
|
|
28
33
|
|
|
29
34
|
// src/agent/cli/approvals.ts
|
|
30
35
|
var dynamicImport = new Function("specifier", "return import(specifier)");
|
package/dist/agent/cli/main.mjs
CHANGED
|
@@ -17,14 +17,19 @@ import {
|
|
|
17
17
|
runAgent,
|
|
18
18
|
summarizeAgentAction,
|
|
19
19
|
summarizeAgentObservation
|
|
20
|
-
} from "../../chunk-
|
|
21
|
-
import "../../chunk-
|
|
20
|
+
} from "../../chunk-ZGLD4TVZ.mjs";
|
|
21
|
+
import "../../chunk-J3H54ZRV.mjs";
|
|
22
|
+
import "../../chunk-CCKHV5BT.mjs";
|
|
23
|
+
import {
|
|
24
|
+
Runtime
|
|
25
|
+
} from "../../chunk-G6IQOE4P.mjs";
|
|
22
26
|
import {
|
|
23
27
|
Cause,
|
|
24
28
|
Exit,
|
|
25
|
-
Runtime,
|
|
26
29
|
asyncEffect
|
|
27
|
-
} from "../../chunk-
|
|
30
|
+
} from "../../chunk-NOYZIMUJ.mjs";
|
|
31
|
+
import "../../chunk-U5KWK3PX.mjs";
|
|
32
|
+
import "../../chunk-Y6FXYEAI.mjs";
|
|
28
33
|
|
|
29
34
|
// src/agent/cli/approvals.ts
|
|
30
35
|
var dynamicImport = new Function("specifier", "return import(specifier)");
|
package/dist/agent/index.cjs
CHANGED
|
@@ -73,9 +73,13 @@
|
|
|
73
73
|
|
|
74
74
|
|
|
75
75
|
|
|
76
|
-
var
|
|
77
|
-
require('../chunk-
|
|
78
|
-
require('../chunk-
|
|
76
|
+
var _chunkN6VHMOWBcjs = require('../chunk-N6VHMOWB.cjs');
|
|
77
|
+
require('../chunk-NYL4D7SK.cjs');
|
|
78
|
+
require('../chunk-TVN5I4U6.cjs');
|
|
79
|
+
require('../chunk-WQ5QNU5R.cjs');
|
|
80
|
+
require('../chunk-DJQ7OMMB.cjs');
|
|
81
|
+
require('../chunk-SPUEME2B.cjs');
|
|
82
|
+
require('../chunk-OBGZSXTJ.cjs');
|
|
79
83
|
|
|
80
84
|
|
|
81
85
|
|
|
@@ -151,4 +155,4 @@ require('../chunk-TGIFUAK4.cjs');
|
|
|
151
155
|
|
|
152
156
|
|
|
153
157
|
|
|
154
|
-
exports.AGENT_CONFIG_FILE_NAMES =
|
|
158
|
+
exports.AGENT_CONFIG_FILE_NAMES = _chunkN6VHMOWBcjs.AGENT_CONFIG_FILE_NAMES; exports.NodeShell = _chunkN6VHMOWBcjs.NodeShell; exports.PROJECT_LOCKFILE_PROBES = _chunkN6VHMOWBcjs.PROJECT_LOCKFILE_PROBES; exports.PROJECT_PROFILE_PROBES = _chunkN6VHMOWBcjs.PROJECT_PROFILE_PROBES; exports.autoApproveApprovals = _chunkN6VHMOWBcjs.autoApproveApprovals; exports.canAutoRollback = _chunkN6VHMOWBcjs.canAutoRollback; exports.canRequestPatchRepair = _chunkN6VHMOWBcjs.canRequestPatchRepair; exports.commandForScript = _chunkN6VHMOWBcjs.commandForScript; exports.decideNextAction = _chunkN6VHMOWBcjs.decideNextAction; exports.defaultPermissions = _chunkN6VHMOWBcjs.defaultPermissions; exports.deriveContextSearchQueries = _chunkN6VHMOWBcjs.deriveContextSearchQueries; exports.describeCommandDiscovery = _chunkN6VHMOWBcjs.describeCommandDiscovery; exports.describeContextDiscovery = _chunkN6VHMOWBcjs.describeContextDiscovery; exports.describeLanguagePolicy = _chunkN6VHMOWBcjs.describeLanguagePolicy; exports.describePatchQuality = _chunkN6VHMOWBcjs.describePatchQuality; exports.describeProjectProfile = _chunkN6VHMOWBcjs.describeProjectProfile; exports.describeRollbackSafety = _chunkN6VHMOWBcjs.describeRollbackSafety; exports.discoverNodeWorkspaceRoot = _chunkN6VHMOWBcjs.discoverNodeWorkspaceRoot; exports.discoverPackageManager = _chunkN6VHMOWBcjs.discoverPackageManager; exports.discoverProjectProfile = _chunkN6VHMOWBcjs.discoverProjectProfile; exports.discoverValidationCommands = _chunkN6VHMOWBcjs.discoverValidationCommands; exports.emitAgentEvent = _chunkN6VHMOWBcjs.emitAgentEvent; exports.emitAgentEvents = _chunkN6VHMOWBcjs.emitAgentEvents; exports.errorEventFor = _chunkN6VHMOWBcjs.errorEventFor; exports.extractLikelyFilePaths = _chunkN6VHMOWBcjs.extractLikelyFilePaths; exports.extractPatchPaths = _chunkN6VHMOWBcjs.extractPatchPaths; exports.extractUnifiedDiff = _chunkN6VHMOWBcjs.extractUnifiedDiff; exports.goalForAgentPreset = _chunkN6VHMOWBcjs.goalForAgentPreset; exports.inferUserLanguage = _chunkN6VHMOWBcjs.inferUserLanguage; exports.initialAgentState = _chunkN6VHMOWBcjs.initialAgentState; exports.invokeAction = _chunkN6VHMOWBcjs.invokeAction; exports.isAgentConfigApprovalMode = _chunkN6VHMOWBcjs.isAgentConfigApprovalMode; exports.isAgentConfigLLMProvider = _chunkN6VHMOWBcjs.isAgentConfigLLMProvider; exports.isAgentConfigMode = _chunkN6VHMOWBcjs.isAgentConfigMode; exports.isAgentPreset = _chunkN6VHMOWBcjs.isAgentPreset; exports.isRedactionEnabled = _chunkN6VHMOWBcjs.isRedactionEnabled; exports.isTerminal = _chunkN6VHMOWBcjs.isTerminal; exports.latestUnappliedPatch = _chunkN6VHMOWBcjs.latestUnappliedPatch; exports.loadNodeAgentConfig = _chunkN6VHMOWBcjs.loadNodeAgentConfig; exports.makeAutoDenyApprovals = _chunkN6VHMOWBcjs.makeAutoDenyApprovals; exports.makeConfiguredPermissions = _chunkN6VHMOWBcjs.makeConfiguredPermissions; exports.makeFakeLLM = _chunkN6VHMOWBcjs.makeFakeLLM; exports.makeGoogleGenerativeAILLM = _chunkN6VHMOWBcjs.makeGoogleGenerativeAILLM; exports.makeNodeFileSystem = _chunkN6VHMOWBcjs.makeNodeFileSystem; exports.makeNodePatchService = _chunkN6VHMOWBcjs.makeNodePatchService; exports.makeOpenAICompatibleLLM = _chunkN6VHMOWBcjs.makeOpenAICompatibleLLM; exports.nextContextDiscoveryAction = _chunkN6VHMOWBcjs.nextContextDiscoveryAction; exports.nextProjectProbeAction = _chunkN6VHMOWBcjs.nextProjectProbeAction; exports.nextUnrunValidationCommand = _chunkN6VHMOWBcjs.nextUnrunValidationCommand; exports.nowMillis = _chunkN6VHMOWBcjs.nowMillis; exports.observationEventFor = _chunkN6VHMOWBcjs.observationEventFor; exports.observationStatus = _chunkN6VHMOWBcjs.observationStatus; exports.parseProjectPackageJson = _chunkN6VHMOWBcjs.parseProjectPackageJson; exports.patchQualitySummary = _chunkN6VHMOWBcjs.patchQualitySummary; exports.patchRepairAttemptsUsed = _chunkN6VHMOWBcjs.patchRepairAttemptsUsed; exports.patchValidationStatus = _chunkN6VHMOWBcjs.patchValidationStatus; exports.projectProfileProbePending = _chunkN6VHMOWBcjs.projectProfileProbePending; exports.redactText = _chunkN6VHMOWBcjs.redactText; exports.reduceAgentState = _chunkN6VHMOWBcjs.reduceAgentState; exports.responseLanguageName = _chunkN6VHMOWBcjs.responseLanguageName; exports.retry = _chunkN6VHMOWBcjs.retry; exports.rollbackSafetySummary = _chunkN6VHMOWBcjs.rollbackSafetySummary; exports.runAgent = _chunkN6VHMOWBcjs.runAgent; exports.runStatusFor = _chunkN6VHMOWBcjs.runStatusFor; exports.shouldContinueRollbackStack = _chunkN6VHMOWBcjs.shouldContinueRollbackStack; exports.sleep = _chunkN6VHMOWBcjs.sleep; exports.spanishLike = _chunkN6VHMOWBcjs.spanishLike; exports.splitCommand = _chunkN6VHMOWBcjs.splitCommand; exports.summarizeAgentAction = _chunkN6VHMOWBcjs.summarizeAgentAction; exports.summarizeAgentObservation = _chunkN6VHMOWBcjs.summarizeAgentObservation; exports.summarizeContextDiscovery = _chunkN6VHMOWBcjs.summarizeContextDiscovery; exports.timeout = _chunkN6VHMOWBcjs.timeout; exports.unappliedPatchStack = _chunkN6VHMOWBcjs.unappliedPatchStack; exports.workspaceValidationStatus = _chunkN6VHMOWBcjs.workspaceValidationStatus;
|
package/dist/agent/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as Async,
|
|
1
|
+
import { A as Async, f as Runtime, S as Scope } from '../effect-CGNl5Rqp.js';
|
|
2
2
|
|
|
3
3
|
type AgentMode = "read-only" | "propose" | "write" | "autonomous";
|
|
4
4
|
type AgentPackageManager = "npm" | "pnpm" | "yarn" | "bun";
|
package/dist/agent/index.js
CHANGED
|
@@ -73,9 +73,13 @@ import {
|
|
|
73
73
|
timeout,
|
|
74
74
|
unappliedPatchStack,
|
|
75
75
|
workspaceValidationStatus
|
|
76
|
-
} from "../chunk-
|
|
77
|
-
import "../chunk-
|
|
78
|
-
import "../chunk-
|
|
76
|
+
} from "../chunk-NC5SDRYE.js";
|
|
77
|
+
import "../chunk-G3XGCZDQ.js";
|
|
78
|
+
import "../chunk-FM4W4QPL.js";
|
|
79
|
+
import "../chunk-7LVI2GIN.js";
|
|
80
|
+
import "../chunk-PNVFW245.js";
|
|
81
|
+
import "../chunk-TDVMADDN.js";
|
|
82
|
+
import "../chunk-3RG5ZIWI.js";
|
|
79
83
|
export {
|
|
80
84
|
AGENT_CONFIG_FILE_NAMES,
|
|
81
85
|
NodeShell,
|
package/dist/agent/index.mjs
CHANGED
|
@@ -73,9 +73,13 @@ import {
|
|
|
73
73
|
timeout,
|
|
74
74
|
unappliedPatchStack,
|
|
75
75
|
workspaceValidationStatus
|
|
76
|
-
} from "../chunk-
|
|
77
|
-
import "../chunk-
|
|
78
|
-
import "../chunk-
|
|
76
|
+
} from "../chunk-ZGLD4TVZ.mjs";
|
|
77
|
+
import "../chunk-J3H54ZRV.mjs";
|
|
78
|
+
import "../chunk-CCKHV5BT.mjs";
|
|
79
|
+
import "../chunk-G6IQOE4P.mjs";
|
|
80
|
+
import "../chunk-NOYZIMUJ.mjs";
|
|
81
|
+
import "../chunk-U5KWK3PX.mjs";
|
|
82
|
+
import "../chunk-Y6FXYEAI.mjs";
|
|
79
83
|
export {
|
|
80
84
|
AGENT_CONFIG_FILE_NAMES,
|
|
81
85
|
NodeShell,
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
raceWith
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-J3H54ZRV.mjs";
|
|
4
|
+
import {
|
|
5
|
+
Scope
|
|
6
|
+
} from "./chunk-CCKHV5BT.mjs";
|
|
7
|
+
import {
|
|
8
|
+
getCurrentFiber,
|
|
9
|
+
unsafeGetCurrentRuntime,
|
|
10
|
+
unsafeRunFoldWithEnv
|
|
11
|
+
} from "./chunk-G6IQOE4P.mjs";
|
|
4
12
|
import {
|
|
5
13
|
Cause,
|
|
6
14
|
Exit,
|
|
7
|
-
Scope,
|
|
8
15
|
asyncEffect,
|
|
9
16
|
asyncFail,
|
|
10
17
|
asyncFlatMap,
|
|
@@ -14,17 +21,14 @@ import {
|
|
|
14
21
|
asyncSync,
|
|
15
22
|
fail,
|
|
16
23
|
flatMap,
|
|
17
|
-
getCurrentFiber,
|
|
18
24
|
map,
|
|
19
25
|
mapError,
|
|
20
26
|
none,
|
|
21
27
|
orElseOptional,
|
|
22
28
|
some,
|
|
23
29
|
succeed,
|
|
24
|
-
sync
|
|
25
|
-
|
|
26
|
-
unsafeRunFoldWithEnv
|
|
27
|
-
} from "./chunk-BMH5AV44.js";
|
|
30
|
+
sync
|
|
31
|
+
} from "./chunk-NOYZIMUJ.mjs";
|
|
28
32
|
|
|
29
33
|
// src/core/stream/stream.ts
|
|
30
34
|
var widenOpt = (opt) => opt._tag === "None" ? none : some(opt.value);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
+
}) : x)(function(x) {
|
|
4
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
__require
|
|
10
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
|
+
|
|
3
|
+
var _chunkWQ5QNU5Rcjs = require('./chunk-WQ5QNU5R.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var _chunkDJQ7OMMBcjs = require('./chunk-DJQ7OMMB.cjs');
|
|
11
|
+
|
|
12
|
+
// src/core/runtime/combinators.ts
|
|
13
|
+
function sleep(ms) {
|
|
14
|
+
return _chunkDJQ7OMMBcjs.asyncEffect.call(void 0, (_env, cb) => {
|
|
15
|
+
const delay = Math.max(0, Math.floor(ms));
|
|
16
|
+
const id = setTimeout(() => cb({ _tag: "Success", value: void 0 }), delay);
|
|
17
|
+
return () => clearTimeout(id);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function timeout(effect, ms) {
|
|
21
|
+
return _chunkDJQ7OMMBcjs.asyncEffect.call(void 0, (env, cb) => {
|
|
22
|
+
let done = false;
|
|
23
|
+
let timerId;
|
|
24
|
+
let effectRunning = true;
|
|
25
|
+
timerId = setTimeout(() => {
|
|
26
|
+
if (done) return;
|
|
27
|
+
done = true;
|
|
28
|
+
effectRunning = false;
|
|
29
|
+
cb({
|
|
30
|
+
_tag: "Failure",
|
|
31
|
+
cause: { _tag: "Fail", error: { _tag: "TimeoutError", ms } }
|
|
32
|
+
});
|
|
33
|
+
}, Math.max(0, Math.floor(ms)));
|
|
34
|
+
const runtime = _chunkWQ5QNU5Rcjs.unsafeGetCurrentRuntime.call(void 0, );
|
|
35
|
+
const fiber = runtime.fork(effect);
|
|
36
|
+
fiber.join((exit) => {
|
|
37
|
+
if (done) return;
|
|
38
|
+
done = true;
|
|
39
|
+
clearTimeout(timerId);
|
|
40
|
+
cb(exit);
|
|
41
|
+
});
|
|
42
|
+
return () => {
|
|
43
|
+
if (done) return;
|
|
44
|
+
done = true;
|
|
45
|
+
clearTimeout(timerId);
|
|
46
|
+
fiber.interrupt();
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function retry(effect, policy) {
|
|
51
|
+
const shouldRetry = _nullishCoalesce(policy.shouldRetry, () => ( (() => true)));
|
|
52
|
+
const jitter = _nullishCoalesce(policy.jitter, () => ( "full"));
|
|
53
|
+
const maxElapsedMs = policy.maxElapsedMs;
|
|
54
|
+
const computeDelay = (attempt) => {
|
|
55
|
+
const exp = policy.baseDelayMs * Math.pow(2, attempt);
|
|
56
|
+
const capped = Math.min(exp, policy.maxDelayMs);
|
|
57
|
+
if (jitter === "none") return capped;
|
|
58
|
+
return Math.floor(Math.random() * capped);
|
|
59
|
+
};
|
|
60
|
+
const loop = (attempt, startedAt) => _chunkDJQ7OMMBcjs.asyncFold.call(void 0,
|
|
61
|
+
effect,
|
|
62
|
+
(error) => {
|
|
63
|
+
if (attempt >= policy.maxRetries) return _chunkDJQ7OMMBcjs.asyncFail.call(void 0, error);
|
|
64
|
+
if (!shouldRetry(error, attempt)) return _chunkDJQ7OMMBcjs.asyncFail.call(void 0, error);
|
|
65
|
+
if (maxElapsedMs !== void 0) {
|
|
66
|
+
const elapsed = performance.now() - startedAt;
|
|
67
|
+
if (elapsed >= maxElapsedMs) return _chunkDJQ7OMMBcjs.asyncFail.call(void 0, error);
|
|
68
|
+
}
|
|
69
|
+
const delay = computeDelay(attempt);
|
|
70
|
+
return _chunkDJQ7OMMBcjs.asyncFlatMap.call(void 0, sleep(delay), () => loop(attempt + 1, startedAt));
|
|
71
|
+
},
|
|
72
|
+
(value) => _chunkDJQ7OMMBcjs.asyncSucceed.call(void 0, value)
|
|
73
|
+
);
|
|
74
|
+
return _chunkDJQ7OMMBcjs.asyncFlatMap.call(void 0,
|
|
75
|
+
{ _tag: "Sync", thunk: () => performance.now() },
|
|
76
|
+
(startedAt) => loop(0, startedAt)
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
function retryN(effect, n) {
|
|
80
|
+
return retry(effect, {
|
|
81
|
+
maxRetries: n,
|
|
82
|
+
baseDelayMs: 0,
|
|
83
|
+
maxDelayMs: 0,
|
|
84
|
+
jitter: "none"
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
function retryWithBackoff(effect, opts = {}) {
|
|
88
|
+
return retry(effect, {
|
|
89
|
+
maxRetries: _nullishCoalesce(opts.maxRetries, () => ( 3)),
|
|
90
|
+
baseDelayMs: _nullishCoalesce(opts.baseDelayMs, () => ( 100)),
|
|
91
|
+
maxDelayMs: _nullishCoalesce(opts.maxDelayMs, () => ( 1e4)),
|
|
92
|
+
maxElapsedMs: opts.maxElapsedMs,
|
|
93
|
+
shouldRetry: opts.shouldRetry,
|
|
94
|
+
jitter: "full"
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
exports.sleep = sleep; exports.timeout = timeout; exports.retry = retry; exports.retryN = retryN; exports.retryWithBackoff = retryWithBackoff;
|