@cydm/pie 2.6.10 → 2.6.12
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/dist/builtin/extensions/ask-user/index.js +2 -2
- package/dist/builtin/extensions/plan-mode/index.js +2 -2
- package/dist/builtin/extensions/subagent/index.js +3 -3
- package/dist/builtin/extensions/todo/index.js +2 -2
- package/dist/chunks/{chunk-YUVGEY6X.js → chunk-AAEBH6KX.js} +28 -1
- package/dist/chunks/{chunk-PAC62XU4.js → chunk-HHNOENEH.js} +11 -2
- package/dist/chunks/{chunk-DFWWHVJL.js → chunk-PPEWRUMQ.js} +105 -14
- package/dist/chunks/{src-HPIBCE2I.js → src-OWQI5M6W.js} +1 -1
- package/dist/cli.js +1618 -190
- package/package.json +2 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
createAskUserCapability
|
|
4
|
-
} from "../../../chunks/chunk-
|
|
5
|
-
import "../../../chunks/chunk-
|
|
4
|
+
} from "../../../chunks/chunk-PPEWRUMQ.js";
|
|
5
|
+
import "../../../chunks/chunk-HHNOENEH.js";
|
|
6
6
|
import "../../../chunks/chunk-7B4IIBVS.js";
|
|
7
7
|
import "../../../chunks/chunk-XXGYUYXI.js";
|
|
8
8
|
import "../../../chunks/chunk-LZQXQOPJ.js";
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
isPlanModeSafeCommand,
|
|
8
8
|
markCompletedPlanSteps,
|
|
9
9
|
restoreExecutionState
|
|
10
|
-
} from "../../../chunks/chunk-
|
|
11
|
-
import "../../../chunks/chunk-
|
|
10
|
+
} from "../../../chunks/chunk-PPEWRUMQ.js";
|
|
11
|
+
import "../../../chunks/chunk-HHNOENEH.js";
|
|
12
12
|
import "../../../chunks/chunk-7B4IIBVS.js";
|
|
13
13
|
import {
|
|
14
14
|
Type
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
createCliHostCapabilities
|
|
4
|
-
} from "../../../chunks/chunk-
|
|
4
|
+
} from "../../../chunks/chunk-AAEBH6KX.js";
|
|
5
5
|
import {
|
|
6
6
|
SUBAGENT_SESSION_RECORD_VERSION,
|
|
7
7
|
createSharedFileSystemTools,
|
|
8
8
|
createSubagentCapability
|
|
9
|
-
} from "../../../chunks/chunk-
|
|
10
|
-
import "../../../chunks/chunk-
|
|
9
|
+
} from "../../../chunks/chunk-PPEWRUMQ.js";
|
|
10
|
+
import "../../../chunks/chunk-HHNOENEH.js";
|
|
11
11
|
import "../../../chunks/chunk-7B4IIBVS.js";
|
|
12
12
|
import "../../../chunks/chunk-5353DEEC.js";
|
|
13
13
|
import "../../../chunks/chunk-XXGYUYXI.js";
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
executeManageTodoList,
|
|
9
9
|
executionStateToTodos,
|
|
10
10
|
restoreExecutionState
|
|
11
|
-
} from "../../../chunks/chunk-
|
|
12
|
-
import "../../../chunks/chunk-
|
|
11
|
+
} from "../../../chunks/chunk-PPEWRUMQ.js";
|
|
12
|
+
import "../../../chunks/chunk-HHNOENEH.js";
|
|
13
13
|
import "../../../chunks/chunk-7B4IIBVS.js";
|
|
14
14
|
import "../../../chunks/chunk-XXGYUYXI.js";
|
|
15
15
|
import "../../../chunks/chunk-LZQXQOPJ.js";
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
createSharedWebSearchTool,
|
|
9
9
|
interpretShellExit,
|
|
10
10
|
requestInteraction
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-PPEWRUMQ.js";
|
|
12
12
|
import {
|
|
13
13
|
getBuiltinDir,
|
|
14
14
|
getConfigDir
|
|
@@ -491,6 +491,21 @@ function createBashTool(defaultCwd, options) {
|
|
|
491
491
|
sandboxRoot: defaultCwd ?? workingDir
|
|
492
492
|
});
|
|
493
493
|
if (risk.destructive && !options?.isYoloMode?.()) {
|
|
494
|
+
onUpdate?.({
|
|
495
|
+
content: [{
|
|
496
|
+
type: "text",
|
|
497
|
+
text: `\u23F8 Awaiting user confirmation (${risk.commandClass}): ${risk.riskWarnings.join("; ")}`
|
|
498
|
+
}],
|
|
499
|
+
details: {
|
|
500
|
+
exitCode: null,
|
|
501
|
+
signal: null,
|
|
502
|
+
timedOut: false,
|
|
503
|
+
shell: resolvedShell,
|
|
504
|
+
commandClass: risk.commandClass,
|
|
505
|
+
riskWarnings: risk.riskWarnings,
|
|
506
|
+
pendingConfirmation: true
|
|
507
|
+
}
|
|
508
|
+
});
|
|
494
509
|
const approved = await (options?.confirm ?? requestHighRiskConfirmation)({
|
|
495
510
|
command: effectiveCommand,
|
|
496
511
|
shell: resolvedShell,
|
|
@@ -519,6 +534,18 @@ function createBashTool(defaultCwd, options) {
|
|
|
519
534
|
isError: true
|
|
520
535
|
};
|
|
521
536
|
}
|
|
537
|
+
onUpdate?.({
|
|
538
|
+
content: [{ type: "text", text: "\u2713 Confirmed by user \u2014 running" }],
|
|
539
|
+
details: {
|
|
540
|
+
exitCode: null,
|
|
541
|
+
signal: null,
|
|
542
|
+
timedOut: false,
|
|
543
|
+
shell: resolvedShell,
|
|
544
|
+
commandClass: risk.commandClass,
|
|
545
|
+
riskWarnings: risk.riskWarnings,
|
|
546
|
+
pendingConfirmation: false
|
|
547
|
+
}
|
|
548
|
+
});
|
|
522
549
|
}
|
|
523
550
|
const timeoutPolicy = resolveTimeoutPolicy(timeout, risk.commandClass);
|
|
524
551
|
const timeoutMs = timeoutPolicy.effectiveSeconds * 1e3;
|
|
@@ -261,7 +261,15 @@ async function streamAssistantResponse(context, config, signal, stream, streamFn
|
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
|
-
|
|
264
|
+
const finalResult = await response.result();
|
|
265
|
+
if (signal?.aborted && finalResult.stopReason === "stop") {
|
|
266
|
+
const adjusted = { ...finalResult, stopReason: "aborted" };
|
|
267
|
+
if (addedPartial && context.messages.length > 0) {
|
|
268
|
+
context.messages[context.messages.length - 1] = adjusted;
|
|
269
|
+
}
|
|
270
|
+
return adjusted;
|
|
271
|
+
}
|
|
272
|
+
return finalResult;
|
|
265
273
|
}
|
|
266
274
|
async function executeToolCalls(tools, assistantMessage, signal, stream, getSteeringMessages, hooks) {
|
|
267
275
|
const toolCalls = assistantMessage.content.filter((c) => c.type === "toolCall");
|
|
@@ -833,7 +841,8 @@ var Agent = class {
|
|
|
833
841
|
(c) => c.type === "thinking" && c.thinking?.trim().length > 0 || c.type === "text" && c.text?.trim().length > 0 || c.type === "toolCall" && c.name?.trim().length > 0
|
|
834
842
|
);
|
|
835
843
|
if (!onlyEmpty) {
|
|
836
|
-
this.
|
|
844
|
+
const effective = this.abortController?.signal.aborted && partial.stopReason === "stop" ? { ...partial, stopReason: "aborted" } : partial;
|
|
845
|
+
this.appendMessage(effective);
|
|
837
846
|
}
|
|
838
847
|
}
|
|
839
848
|
} catch (err) {
|
|
@@ -2,7 +2,7 @@ import { createRequire as __createRequire } from "node:module"; const require =
|
|
|
2
2
|
import {
|
|
3
3
|
Agent,
|
|
4
4
|
getToolCallerIdentity
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-HHNOENEH.js";
|
|
6
6
|
import {
|
|
7
7
|
AssistantMessageEventStream,
|
|
8
8
|
FileSystemGateway,
|
|
@@ -1215,7 +1215,10 @@ var DESTRUCTIVE_PATTERNS = [
|
|
|
1215
1215
|
{ pattern: /\bgit\s+stash[ \t]+(drop|clear)\b/, warning: "may permanently remove stashed changes", commandClass: "git_destructive" },
|
|
1216
1216
|
{ pattern: /\bgit\s+branch\s+(-D[ \t]|--delete\s+--force|--force\s+--delete)\b/, warning: "may force-delete a branch", commandClass: "git_destructive" },
|
|
1217
1217
|
{ pattern: /\bgit\s+(commit|push|merge)\b[^;&|\n]*--no-verify\b/, warning: "may skip safety hooks", commandClass: "git_destructive" },
|
|
1218
|
-
|
|
1218
|
+
// `rm -rf` is NOT in this regex list: raw-text matching both missed split
|
|
1219
|
+
// flags (`rm -r -f`) and false-positived on quoted literals mentioning
|
|
1220
|
+
// `rm -rf` (grep patterns, echo, docs). It is detected semantically by
|
|
1221
|
+
// containsRecursiveForceRemove in classifyShellCommand instead.
|
|
1219
1222
|
{ pattern: /\bsudo\b|\bsu\s+-|\bchmod\s+777\b|\bchown\s+-R\b/, warning: "may require elevated privileges or weaken permissions", commandClass: "privilege_escalation" },
|
|
1220
1223
|
{ pattern: /\b(DROP|TRUNCATE)\s+(TABLE|DATABASE|SCHEMA)\b/i, warning: "may drop or truncate database objects", commandClass: "infra_destructive" },
|
|
1221
1224
|
{ pattern: /\bDELETE\s+FROM\s+\w+[ \t]*(;|"|'|\n|$)/i, warning: "may delete all rows from a database table", commandClass: "infra_destructive" },
|
|
@@ -1223,6 +1226,9 @@ var DESTRUCTIVE_PATTERNS = [
|
|
|
1223
1226
|
{ pattern: /\bterraform\s+destroy\b/, warning: "may destroy Terraform infrastructure", commandClass: "infra_destructive" }
|
|
1224
1227
|
];
|
|
1225
1228
|
var RM_FORCE_RECURSIVE_WARNING = "may recursively force-remove files";
|
|
1229
|
+
var RM_RECURSIVE_WARNING = "may recursively remove files";
|
|
1230
|
+
var FIND_DELETE_WARNING = "may recursively delete matched files";
|
|
1231
|
+
var RSYNC_DELETE_WARNING = "may delete extraneous destination files";
|
|
1226
1232
|
var SHELL_DYNAMIC_TOKEN = /[$`*?[\]{}~]/;
|
|
1227
1233
|
var PROTECTED_POSIX_PATHS = /* @__PURE__ */ new Set([
|
|
1228
1234
|
"/",
|
|
@@ -1276,7 +1282,45 @@ function classifyBashCommand(command, options) {
|
|
|
1276
1282
|
return classifyShellCommand(command, "bash", options);
|
|
1277
1283
|
}
|
|
1278
1284
|
function splitShellSegments(command) {
|
|
1279
|
-
|
|
1285
|
+
const segments = [];
|
|
1286
|
+
let current = "";
|
|
1287
|
+
let quote;
|
|
1288
|
+
for (let index = 0; index < command.length; index += 1) {
|
|
1289
|
+
const char = command[index];
|
|
1290
|
+
if (quote) {
|
|
1291
|
+
if (quote === '"' && char === "\\" && index + 1 < command.length) {
|
|
1292
|
+
current += char;
|
|
1293
|
+
current += command[index + 1];
|
|
1294
|
+
index += 1;
|
|
1295
|
+
continue;
|
|
1296
|
+
}
|
|
1297
|
+
current += char;
|
|
1298
|
+
if (char === quote) quote = void 0;
|
|
1299
|
+
continue;
|
|
1300
|
+
}
|
|
1301
|
+
if (char === "'" || char === '"') {
|
|
1302
|
+
quote = char;
|
|
1303
|
+
current += char;
|
|
1304
|
+
continue;
|
|
1305
|
+
}
|
|
1306
|
+
if (char === "\\" && index + 1 < command.length) {
|
|
1307
|
+
current += char;
|
|
1308
|
+
current += command[index + 1];
|
|
1309
|
+
index += 1;
|
|
1310
|
+
continue;
|
|
1311
|
+
}
|
|
1312
|
+
if (char === "&" || char === "|" || char === ";" || char === "\n") {
|
|
1313
|
+
if ((char === "&" || char === "|") && command[index + 1] === char) {
|
|
1314
|
+
index += 1;
|
|
1315
|
+
}
|
|
1316
|
+
segments.push(current);
|
|
1317
|
+
current = "";
|
|
1318
|
+
continue;
|
|
1319
|
+
}
|
|
1320
|
+
current += char;
|
|
1321
|
+
}
|
|
1322
|
+
segments.push(current);
|
|
1323
|
+
return segments.map((part) => part.trim()).filter(Boolean);
|
|
1280
1324
|
}
|
|
1281
1325
|
function splitShellWords(segment) {
|
|
1282
1326
|
const words = [];
|
|
@@ -1348,7 +1392,7 @@ function isProtectedPosixPath(target) {
|
|
|
1348
1392
|
function isStaticPathToken(token) {
|
|
1349
1393
|
return Boolean(token) && !token.startsWith("-") && !token.includes("\0") && !SHELL_DYNAMIC_TOKEN.test(token);
|
|
1350
1394
|
}
|
|
1351
|
-
function
|
|
1395
|
+
function scanRmInvocation(words) {
|
|
1352
1396
|
const executable = words[0] ?? "";
|
|
1353
1397
|
if (executable !== "rm" && !executable.endsWith("/rm")) return void 0;
|
|
1354
1398
|
let recursive = false;
|
|
@@ -1361,9 +1405,8 @@ function parseRmForceRecursiveTargets(words) {
|
|
|
1361
1405
|
continue;
|
|
1362
1406
|
}
|
|
1363
1407
|
if (!endOfOptions && word.startsWith("--")) {
|
|
1364
|
-
if (word === "--recursive"
|
|
1408
|
+
if (word === "--recursive") recursive = true;
|
|
1365
1409
|
else if (word === "--force") force = true;
|
|
1366
|
-
else return void 0;
|
|
1367
1410
|
continue;
|
|
1368
1411
|
}
|
|
1369
1412
|
if (!endOfOptions && /^-[A-Za-z]+$/.test(word)) {
|
|
@@ -1373,7 +1416,37 @@ function parseRmForceRecursiveTargets(words) {
|
|
|
1373
1416
|
}
|
|
1374
1417
|
targets.push(word);
|
|
1375
1418
|
}
|
|
1376
|
-
return recursive
|
|
1419
|
+
return { recursive, force, targets };
|
|
1420
|
+
}
|
|
1421
|
+
var COMMAND_POSITION_RM_RECURSIVE_PATTERN = /^rm\s+-[a-zA-Z]*[rR]/;
|
|
1422
|
+
function recursiveRemoveWarnings(command) {
|
|
1423
|
+
const found = [];
|
|
1424
|
+
const warnings = [];
|
|
1425
|
+
for (const segment of splitShellSegments(command)) {
|
|
1426
|
+
const words = splitShellWords(segment);
|
|
1427
|
+
if (words) {
|
|
1428
|
+
const scan = scanRmInvocation(words);
|
|
1429
|
+
if (scan?.recursive) found.push({ scan });
|
|
1430
|
+
const xargsArgs = words[0] === "xargs" || words[0]?.endsWith("/xargs") ? words.slice(1) : void 0;
|
|
1431
|
+
const xargsScan = xargsArgs ? scanRmInvocation(xargsArgs) : void 0;
|
|
1432
|
+
if (xargsScan?.recursive) found.push({ scan: xargsScan });
|
|
1433
|
+
const executable = words[0] ?? "";
|
|
1434
|
+
if ((executable === "find" || executable.endsWith("/find")) && words.slice(1).some((word) => word === "-delete")) {
|
|
1435
|
+
warnings.push(FIND_DELETE_WARNING);
|
|
1436
|
+
}
|
|
1437
|
+
if ((executable === "rsync" || executable.endsWith("/rsync")) && words.slice(1).some((word) => word === "--delete" || word.startsWith("--delete-"))) {
|
|
1438
|
+
warnings.push(RSYNC_DELETE_WARNING);
|
|
1439
|
+
}
|
|
1440
|
+
continue;
|
|
1441
|
+
}
|
|
1442
|
+
if (COMMAND_POSITION_RM_RECURSIVE_PATTERN.test(segment)) {
|
|
1443
|
+
warnings.push(RM_RECURSIVE_WARNING);
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
for (const { scan } of found) {
|
|
1447
|
+
warnings.push(scan.force ? RM_FORCE_RECURSIVE_WARNING : RM_RECURSIVE_WARNING);
|
|
1448
|
+
}
|
|
1449
|
+
return warnings;
|
|
1377
1450
|
}
|
|
1378
1451
|
function resolveStaticScopedTarget(target, cwd, root) {
|
|
1379
1452
|
if (!isStaticPathToken(target)) return void 0;
|
|
@@ -1406,10 +1479,10 @@ function isStaticallyScopedRecursiveForceRemove(command, options) {
|
|
|
1406
1479
|
currentCwd = next;
|
|
1407
1480
|
continue;
|
|
1408
1481
|
}
|
|
1409
|
-
const
|
|
1410
|
-
if (!targets) continue;
|
|
1482
|
+
const scan = scanRmInvocation(words);
|
|
1483
|
+
if (!scan?.recursive || scan.targets.length === 0) continue;
|
|
1411
1484
|
sawRm = true;
|
|
1412
|
-
if (!targets.every((target) => resolveStaticScopedTarget(target, currentCwd, normalizedRoot))) {
|
|
1485
|
+
if (!scan.targets.every((target) => resolveStaticScopedTarget(target, currentCwd, normalizedRoot))) {
|
|
1413
1486
|
return false;
|
|
1414
1487
|
}
|
|
1415
1488
|
}
|
|
@@ -1420,12 +1493,18 @@ function classifyShellCommand(command, shell = "bash", options) {
|
|
|
1420
1493
|
let commandClass = "unknown_shell";
|
|
1421
1494
|
let destructive = false;
|
|
1422
1495
|
const destructivePatterns = shell === "powershell" ? [...POWERSHELL_DESTRUCTIVE_PATTERNS, ...DESTRUCTIVE_PATTERNS] : shell === "cmd" ? [...CMD_DESTRUCTIVE_PATTERNS, ...DESTRUCTIVE_PATTERNS] : DESTRUCTIVE_PATTERNS;
|
|
1496
|
+
const removeWarnings = recursiveRemoveWarnings(command);
|
|
1497
|
+
if (removeWarnings.length > 0) {
|
|
1498
|
+
if (shell === "bash" && isStaticallyScopedRecursiveForceRemove(command, options)) {
|
|
1499
|
+
commandClass = "filesystem_write";
|
|
1500
|
+
} else {
|
|
1501
|
+
warnings.push(...removeWarnings);
|
|
1502
|
+
commandClass = "filesystem_write";
|
|
1503
|
+
destructive = true;
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1423
1506
|
for (const entry of destructivePatterns) {
|
|
1424
1507
|
if (entry.pattern.test(command)) {
|
|
1425
|
-
if (shell === "bash" && entry.commandClass === "filesystem_write" && entry.warning === RM_FORCE_RECURSIVE_WARNING && isStaticallyScopedRecursiveForceRemove(command, options)) {
|
|
1426
|
-
commandClass = "filesystem_write";
|
|
1427
|
-
continue;
|
|
1428
|
-
}
|
|
1429
1508
|
warnings.push(entry.warning);
|
|
1430
1509
|
commandClass = entry.commandClass;
|
|
1431
1510
|
destructive = true;
|
|
@@ -8585,6 +8664,18 @@ var SessionTraceSnapshotWriter = class {
|
|
|
8585
8664
|
recentTurnsLimit;
|
|
8586
8665
|
recentEventsLimit;
|
|
8587
8666
|
debounceMs;
|
|
8667
|
+
/**
|
|
8668
|
+
* Current in-memory trace snapshot for the active session, or null
|
|
8669
|
+
* when no session is active. Read-only observability accessor: never
|
|
8670
|
+
* loads, mutates, or flushes state.
|
|
8671
|
+
*/
|
|
8672
|
+
getLiveSnapshot() {
|
|
8673
|
+
if (!this.cachedSessionId || !this.cachedController) return null;
|
|
8674
|
+
if (this.cachedSessionId !== String(this.options.getSessionId() || "").trim()) {
|
|
8675
|
+
return null;
|
|
8676
|
+
}
|
|
8677
|
+
return this.cachedController.getSnapshot();
|
|
8678
|
+
}
|
|
8588
8679
|
loadController(sessionId) {
|
|
8589
8680
|
if (this.cachedSessionId === sessionId && this.cachedController) {
|
|
8590
8681
|
return this.cachedController;
|