@cydm/pie 2.7.8 → 2.7.9
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 +3 -3
- package/dist/builtin/extensions/plan-mode/index.js +3 -18
- package/dist/builtin/extensions/subagent/index.js +10 -6
- package/dist/builtin/extensions/todo/index.js +3 -3
- package/dist/chunks/{chunk-W5B3OXHQ.js → chunk-5SP2H5QK.js} +1 -1
- package/dist/chunks/{chunk-E6F4BTNN.js → chunk-ABZOXNDK.js} +11 -5
- package/dist/chunks/{chunk-P22SYVGO.js → chunk-AX5QEIKP.js} +361 -175
- package/dist/chunks/{chunk-2FEDB5GR.js → chunk-SMGBZQI5.js} +12 -4
- package/dist/chunks/{src-C2CBPEUY.js → src-BQUDKBQ7.js} +2 -2
- package/dist/chunks/{test-stream-LDVUVSUP.js → test-stream-A5KBYYZD.js} +1 -1
- package/dist/cli.js +133 -47
- package/package.json +2 -2
|
@@ -1,9 +1,9 @@
|
|
|
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-
|
|
6
|
-
import "../../../chunks/chunk-
|
|
4
|
+
} from "../../../chunks/chunk-AX5QEIKP.js";
|
|
5
|
+
import "../../../chunks/chunk-5SP2H5QK.js";
|
|
6
|
+
import "../../../chunks/chunk-SMGBZQI5.js";
|
|
7
7
|
import "../../../chunks/chunk-XXGYUYXI.js";
|
|
8
8
|
import "../../../chunks/chunk-LZQXQOPJ.js";
|
|
9
9
|
|
|
@@ -4,13 +4,11 @@ import {
|
|
|
4
4
|
createExecutionStateFromPlan,
|
|
5
5
|
createPlanCapability,
|
|
6
6
|
extractPlanTodoItems,
|
|
7
|
-
getToolCapabilityMetadata,
|
|
8
|
-
isPlanModeSafeCommand,
|
|
9
7
|
markCompletedPlanSteps,
|
|
10
8
|
restoreExecutionState
|
|
11
|
-
} from "../../../chunks/chunk-
|
|
12
|
-
import "../../../chunks/chunk-
|
|
13
|
-
import "../../../chunks/chunk-
|
|
9
|
+
} from "../../../chunks/chunk-AX5QEIKP.js";
|
|
10
|
+
import "../../../chunks/chunk-5SP2H5QK.js";
|
|
11
|
+
import "../../../chunks/chunk-SMGBZQI5.js";
|
|
14
12
|
import {
|
|
15
13
|
Type
|
|
16
14
|
} from "../../../chunks/chunk-XXGYUYXI.js";
|
|
@@ -258,19 +256,6 @@ Update the plan accordingly and call plan_submit again with the revised steps. D
|
|
|
258
256
|
togglePlanMode();
|
|
259
257
|
}
|
|
260
258
|
});
|
|
261
|
-
ctx.on("tool:call", async (event) => {
|
|
262
|
-
if (!planModeEnabled) return;
|
|
263
|
-
if (getToolCapabilityMetadata({ name: event.toolName })?.executesShell !== true) return;
|
|
264
|
-
const command = typeof event.args === "object" && event.args !== null ? event.args.command : void 0;
|
|
265
|
-
if (typeof command === "string" && !isPlanModeSafeCommand(command)) {
|
|
266
|
-
ctx.ui.notify(
|
|
267
|
-
`Plan mode: Command blocked. Use read-only commands or plan_scratch for temporary drafts; submit the finished plan with plan_submit. Use /tools/plan to leave Plan mode.
|
|
268
|
-
Command: ${command}`,
|
|
269
|
-
"error"
|
|
270
|
-
);
|
|
271
|
-
return { block: true, reason: `Plan mode: command "${command}" is not a read-only shell command. Use plan_scratch for temporary drafts, submit the finished plan with plan_submit, or use /tools/plan to leave Plan mode.` };
|
|
272
|
-
}
|
|
273
|
-
});
|
|
274
259
|
ctx.on("agent:start", async () => {
|
|
275
260
|
const persisted = readPersistedPlanMode();
|
|
276
261
|
applyPlanModeState(persisted);
|
|
@@ -4,14 +4,15 @@ import {
|
|
|
4
4
|
formatTransportLifecycle,
|
|
5
5
|
getConfigDir,
|
|
6
6
|
logTransportLifecycle
|
|
7
|
-
} from "../../../chunks/chunk-
|
|
7
|
+
} from "../../../chunks/chunk-ABZOXNDK.js";
|
|
8
8
|
import {
|
|
9
9
|
SUBAGENT_SESSION_RECORD_VERSION,
|
|
10
|
+
createPolicyEnforcedTools,
|
|
10
11
|
createSharedFileSystemTools,
|
|
11
12
|
createSubagentCapability
|
|
12
|
-
} from "../../../chunks/chunk-
|
|
13
|
-
import "../../../chunks/chunk-
|
|
14
|
-
import "../../../chunks/chunk-
|
|
13
|
+
} from "../../../chunks/chunk-AX5QEIKP.js";
|
|
14
|
+
import "../../../chunks/chunk-5SP2H5QK.js";
|
|
15
|
+
import "../../../chunks/chunk-SMGBZQI5.js";
|
|
15
16
|
import "../../../chunks/chunk-XXGYUYXI.js";
|
|
16
17
|
import "../../../chunks/chunk-LZQXQOPJ.js";
|
|
17
18
|
|
|
@@ -232,7 +233,8 @@ function createSubagentSessionStore(sessionsDir, log, deps) {
|
|
|
232
233
|
let current;
|
|
233
234
|
try {
|
|
234
235
|
current = fs.readFileSync(lockPath, "utf8");
|
|
235
|
-
} catch {
|
|
236
|
+
} catch (recheckError) {
|
|
237
|
+
if (recheckError.code === "ENOENT") continue;
|
|
236
238
|
current = void 0;
|
|
237
239
|
}
|
|
238
240
|
if (current !== lockContent) {
|
|
@@ -428,7 +430,9 @@ function subagentExtension(ctx) {
|
|
|
428
430
|
};
|
|
429
431
|
const fsTools = createSharedFileSystemTools(ctx.cwd, fsOptions);
|
|
430
432
|
const cliHostCapabilities = createCliHostCapabilities(ctx.cwd);
|
|
431
|
-
return [...fsTools, ...cliHostCapabilities.tools]
|
|
433
|
+
return createPolicyEnforcedTools([...fsTools, ...cliHostCapabilities.tools], {
|
|
434
|
+
getContext: () => ({ mode: "normal", confirmationPolicy: "allow" })
|
|
435
|
+
});
|
|
432
436
|
}
|
|
433
437
|
});
|
|
434
438
|
ctx.registerCleanup?.(() => capability.dispose());
|
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
executeManageTodoList,
|
|
9
9
|
executionStateToTodos,
|
|
10
10
|
restoreExecutionState
|
|
11
|
-
} from "../../../chunks/chunk-
|
|
12
|
-
import "../../../chunks/chunk-
|
|
13
|
-
import "../../../chunks/chunk-
|
|
11
|
+
} from "../../../chunks/chunk-AX5QEIKP.js";
|
|
12
|
+
import "../../../chunks/chunk-5SP2H5QK.js";
|
|
13
|
+
import "../../../chunks/chunk-SMGBZQI5.js";
|
|
14
14
|
import "../../../chunks/chunk-XXGYUYXI.js";
|
|
15
15
|
import "../../../chunks/chunk-LZQXQOPJ.js";
|
|
16
16
|
|
|
@@ -4,12 +4,13 @@ import {
|
|
|
4
4
|
createSharedWebFetchTool,
|
|
5
5
|
createSharedWebResearchTool,
|
|
6
6
|
createSharedWebSearchTool,
|
|
7
|
+
defaultShellKindForPlatform,
|
|
7
8
|
interpretShellExit,
|
|
8
9
|
requestInteraction
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-AX5QEIKP.js";
|
|
10
11
|
import {
|
|
11
12
|
getLogger
|
|
12
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-SMGBZQI5.js";
|
|
13
14
|
import {
|
|
14
15
|
Type
|
|
15
16
|
} from "./chunk-XXGYUYXI.js";
|
|
@@ -320,10 +321,11 @@ function truncateStringToBytesFromEnd(str, maxBytes) {
|
|
|
320
321
|
var WINDOWS_DIALECT_BLOCK = `On this host shell:auto runs Windows PowerShell 5.1 (powershell.exe). Write PowerShell syntax: separate statements with ';' (PS 5.1 has no && or || \u2014 chain with "if ($?) { ... }" or check $LASTEXITCODE after native commands). Nested quotes in inline "node -e" or "-Command" strings are fragile; write a temp script file with write_file and execute it instead. Heredocs do not exist; multi-line commands work, but long scripts run more reliably from a file. Judge outcomes by the exit code; stderr may carry PowerShell-generated records such as CLIXML. shell:"bash" runs the first real bash on PATH (Git Bash when installed) and fails with an actionable error when only the WSL stub exists; shell:"cmd" runs cmd.exe.`;
|
|
321
322
|
var POSIX_DIALECT_BLOCK = 'On this host shell:auto runs bash (bash -c). POSIX syntax applies: && and || chaining, heredocs, and standard quoting rules are available. shell:"powershell" uses pwsh when installed; shell:"cmd" is Windows-only.';
|
|
322
323
|
function buildShellToolContract(platform = process.platform) {
|
|
324
|
+
const defaultShell = defaultShellKindForPlatform(platform);
|
|
323
325
|
if (platform === "win32") {
|
|
324
326
|
return {
|
|
325
327
|
dialect: "powershell51",
|
|
326
|
-
defaultShell
|
|
328
|
+
defaultShell,
|
|
327
329
|
name: "shell",
|
|
328
330
|
label: "powershell",
|
|
329
331
|
dialectBlock: WINDOWS_DIALECT_BLOCK,
|
|
@@ -332,7 +334,7 @@ function buildShellToolContract(platform = process.platform) {
|
|
|
332
334
|
}
|
|
333
335
|
return {
|
|
334
336
|
dialect: "bash",
|
|
335
|
-
defaultShell
|
|
337
|
+
defaultShell,
|
|
336
338
|
name: "shell",
|
|
337
339
|
label: "bash",
|
|
338
340
|
dialectBlock: POSIX_DIALECT_BLOCK,
|
|
@@ -599,6 +601,9 @@ function resolveShell(shell, contract) {
|
|
|
599
601
|
if (!shell || shell === "auto") {
|
|
600
602
|
return contract.defaultShell;
|
|
601
603
|
}
|
|
604
|
+
if (shell !== "bash" && shell !== "powershell" && shell !== "cmd") {
|
|
605
|
+
throw new Error(`Unknown shell "${shell}". Supported: auto, bash, powershell, cmd.`);
|
|
606
|
+
}
|
|
602
607
|
return shell;
|
|
603
608
|
}
|
|
604
609
|
function buildBashDescription(contract) {
|
|
@@ -610,6 +615,7 @@ function buildBashDescription(contract) {
|
|
|
610
615
|
}
|
|
611
616
|
function buildSpawnCommand(shell, command) {
|
|
612
617
|
if (shell === "powershell") {
|
|
618
|
+
const childExe = process.platform === "win32" ? "powershell.exe" : "pwsh";
|
|
613
619
|
const childScript = [
|
|
614
620
|
"$ProgressPreference = 'SilentlyContinue'",
|
|
615
621
|
"[Console]::OutputEncoding = New-Object System.Text.UTF8Encoding; $OutputEncoding = [Console]::OutputEncoding",
|
|
@@ -618,7 +624,7 @@ function buildSpawnCommand(shell, command) {
|
|
|
618
624
|
].join("\n");
|
|
619
625
|
const script = [
|
|
620
626
|
"$ProgressPreference = 'SilentlyContinue'",
|
|
621
|
-
|
|
627
|
+
`${childExe} -NoProfile -NonInteractive -EncodedCommand ${Buffer.from(childScript, "utf16le").toString("base64")}`,
|
|
622
628
|
"$__pieCode = $LASTEXITCODE; $__pieOk = $?",
|
|
623
629
|
"if (-not $__pieOk -and (($null -eq $__pieCode) -or ($__pieCode -eq 0))) { exit 1 }",
|
|
624
630
|
"if (($null -ne $__pieCode) -and ($__pieCode -ne 0)) { exit $__pieCode }",
|