context-mode 2.0.0-next.17 → 2.0.0-next.18

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.
@@ -12,5 +12,5 @@
12
12
  }
13
13
  },
14
14
  "name": "context-mode",
15
- "version": "2.0.0-next.17"
15
+ "version": "2.0.0-next.18"
16
16
  }
package/run.mjs CHANGED
@@ -683,7 +683,8 @@ var RESULT_SUCCESS = "success";
683
683
  function isRecord(v) {
684
684
  return typeof v === "object" && v !== null && !Array.isArray(v);
685
685
  }
686
- var NATIVE_TO_CANONICAL3 = { bash: "Bash" };
686
+ var SHELL_TOOL_NAMES = Object.freeze(["bash", "powershell"]);
687
+ var NATIVE_TO_CANONICAL3 = Object.fromEntries(SHELL_TOOL_NAMES.map((n) => [n, "Bash"]));
687
688
  function canonicalName3(name) {
688
689
  if (name.startsWith(TOOL_NAME_PREFIX5)) return name.slice(TOOL_NAME_PREFIX5.length);
689
690
  if (Object.hasOwn(NATIVE_TO_CANONICAL3, name)) return NATIVE_TO_CANONICAL3[name];
@@ -764,11 +765,11 @@ var VSCODE_EVENTS = ["SessionStart", "UserPromptSubmit", "PreToolUse", "PostTool
764
765
  var MCP_PREFIX2 = "mcp_";
765
766
  var MCP_SEP2 = "_";
766
767
  var SESSION_START_NEW = "new";
767
- var SHELL_TOOL_NAMES = Object.freeze(["run_in_terminal", "runTerminalCommand", "bash", "powershell"]);
768
+ var SHELL_TOOL_NAMES2 = Object.freeze(["run_in_terminal", "runTerminalCommand", "bash", "powershell"]);
768
769
  var READ_TOOL_NAMES = Object.freeze(["read_file", "view"]);
769
770
  var WEBFETCH_TOOL_NAMES = Object.freeze(["fetch_webpage", "web_fetch"]);
770
771
  var NATIVE_TO_CANONICAL4 = Object.fromEntries([
771
- ...SHELL_TOOL_NAMES.map((n) => [n, "Bash"]),
772
+ ...SHELL_TOOL_NAMES2.map((n) => [n, "Bash"]),
772
773
  ...READ_TOOL_NAMES.map((n) => [n, "Read"]),
773
774
  ...WEBFETCH_TOOL_NAMES.map((n) => [n, "WebFetch"])
774
775
  ]);
@@ -896,8 +897,8 @@ var KIRO_EVENTS = {
896
897
  };
897
898
  var PROMPT_ENV = "USER_PROMPT";
898
899
  var MCP_PREFIX3 = "mcp_";
899
- var SHELL_TOOL_NAMES2 = Object.freeze(["execute_bash", "execute_pwsh", "shell"]);
900
- var NATIVE_TO_CANONICAL5 = Object.fromEntries(SHELL_TOOL_NAMES2.map((n) => [n, "Bash"]));
900
+ var SHELL_TOOL_NAMES3 = Object.freeze(["execute_bash", "execute_pwsh", "shell"]);
901
+ var NATIVE_TO_CANONICAL5 = Object.fromEntries(SHELL_TOOL_NAMES3.map((n) => [n, "Bash"]));
901
902
  var MCP_SEP3 = "_";
902
903
  var KIRO_SOURCES = { startup: "startup", resume: "resume", clear: "clear", compact: "compact" };
903
904
  function canonicalName5(name) {
@@ -1169,8 +1170,9 @@ var ADAPTERS = Object.freeze([
1169
1170
  installMode: "plugin",
1170
1171
  projectSource: "arg:--agent+cwd",
1171
1172
  toolNamePrefix: TOOL_NAME_PREFIX5,
1172
- nativeTools: { shell: ["bash"] },
1173
+ nativeTools: { shell: [...SHELL_TOOL_NAMES] },
1173
1174
  execReadOnlyHint: false,
1175
+ // D-PWSH-DUMP-1
1174
1176
  eventMap: { SessionStart: "sessionStart", UserPromptSubmit: "userPromptSubmitted", PreToolUse: "preToolUse", PostToolUse: "postToolUse" },
1175
1177
  compactDelivery: "pending-flag",
1176
1178
  compactSummary: "none",
@@ -1188,7 +1190,7 @@ var ADAPTERS = Object.freeze([
1188
1190
  projectSource: "arg:workspaceFolder",
1189
1191
  toolNamePrefix: TOOL_NAME_PREFIX6,
1190
1192
  // PreCompact sets the pending flag (ADR-0009 §6, DEVIATIONS D-M3-A4-1).
1191
- nativeTools: { shell: [...SHELL_TOOL_NAMES], read: [...READ_TOOL_NAMES], webfetch: [...WEBFETCH_TOOL_NAMES] },
1193
+ nativeTools: { shell: [...SHELL_TOOL_NAMES2], read: [...READ_TOOL_NAMES], webfetch: [...WEBFETCH_TOOL_NAMES] },
1192
1194
  // D-HF-VSCODE-PROJECT-1, D-N7-VSCODE-TOOLS-1
1193
1195
  execReadOnlyHint: false,
1194
1196
  eventMap: { ...CLAUDE_EVENTS, PreCompact: "PreCompact" },
@@ -1207,7 +1209,7 @@ var ADAPTERS = Object.freeze([
1207
1209
  installMode: "mcp-entry",
1208
1210
  projectSource: "arg:--agent+cwd",
1209
1211
  toolNamePrefix: TOOL_NAME_PREFIX7,
1210
- nativeTools: { shell: [...SHELL_TOOL_NAMES2] },
1212
+ nativeTools: { shell: [...SHELL_TOOL_NAMES3] },
1211
1213
  execReadOnlyHint: false,
1212
1214
  // D-HF-KIRO-SHELL-1, D-N7-KIRO-1
1213
1215
  eventMap: { SessionStart: "SessionStart", UserPromptSubmit: "UserPromptSubmit", PreToolUse: "PreToolUse", PostToolUse: "PostToolUse" },
@@ -3371,7 +3373,7 @@ function moreLine(intent, label) {
3371
3373
  }
3372
3374
 
3373
3375
  // src/core/policy/decide.ts
3374
- import { resolve } from "node:path";
3376
+ import { resolve as resolve2 } from "node:path";
3375
3377
 
3376
3378
  // src/core/policy/lexer.ts
3377
3379
  var OPS = ["&&", "||", ";;", "|&", ";", "|", "&", "(", ")"];
@@ -4312,6 +4314,343 @@ function parseShell(cmd) {
4312
4314
  return { ok: true, commands };
4313
4315
  }
4314
4316
 
4317
+ // src/core/policy/powershell.ts
4318
+ import { resolve } from "node:path";
4319
+ var SQ = "'";
4320
+ var DQ = '"';
4321
+ var TICK = "`";
4322
+ var SPACES = " \r";
4323
+ var OPENERS = "([{";
4324
+ var CLOSERS = ")]}";
4325
+ var GLUE_END = " \r\n|;>";
4326
+ var FD_STAR = "*";
4327
+ var STDOUT_FD = "1";
4328
+ var METHOD_MARK = "::";
4329
+ var PAIR = METHOD_MARK.length;
4330
+ var MIN_STATIC_CALL = PAIR;
4331
+ function quoteEnd(text, at2) {
4332
+ const q = text.charAt(at2);
4333
+ for (let j = at2 + 1; j < text.length; j++) {
4334
+ const c = text.charAt(j);
4335
+ if (q === DQ && c === TICK) {
4336
+ j++;
4337
+ continue;
4338
+ }
4339
+ if (c !== q) continue;
4340
+ if (text.charAt(j + 1) === q) {
4341
+ j++;
4342
+ continue;
4343
+ }
4344
+ return j;
4345
+ }
4346
+ return -1;
4347
+ }
4348
+ function unquote(body, q) {
4349
+ let out = "";
4350
+ for (let j = 0; j < body.length; j++) {
4351
+ const c = body.charAt(j);
4352
+ if (q === DQ && c === TICK && j + 1 < body.length) {
4353
+ out += body.charAt(++j);
4354
+ continue;
4355
+ }
4356
+ if (c === q && body.charAt(j + 1) === q) j++;
4357
+ out += c;
4358
+ }
4359
+ return out;
4360
+ }
4361
+ function closeOf(text, at2) {
4362
+ let depth = 0;
4363
+ for (let j = at2; j < text.length; j++) {
4364
+ const c = text.charAt(j);
4365
+ if (c === SQ || c === DQ) {
4366
+ const e = quoteEnd(text, j);
4367
+ if (e < 0) return -1;
4368
+ j = e;
4369
+ continue;
4370
+ }
4371
+ if (c === TICK) {
4372
+ j++;
4373
+ continue;
4374
+ }
4375
+ if (OPENERS.includes(c)) depth++;
4376
+ else if (CLOSERS.includes(c) && --depth === 0) return j;
4377
+ }
4378
+ return -1;
4379
+ }
4380
+ function glueEnd(text, from) {
4381
+ let depth = 0;
4382
+ for (let j = from; j < text.length; j++) {
4383
+ const c = text.charAt(j);
4384
+ if (c === SQ || c === DQ) {
4385
+ const e = quoteEnd(text, j);
4386
+ if (e < 0) return text.length;
4387
+ j = e;
4388
+ continue;
4389
+ }
4390
+ if (OPENERS.includes(c)) depth++;
4391
+ else if (CLOSERS.includes(c)) depth--;
4392
+ else if (depth <= 0 && GLUE_END.includes(c)) return j;
4393
+ }
4394
+ return text.length;
4395
+ }
4396
+ function splitArgs(inner) {
4397
+ const parts = [];
4398
+ let depth = 0;
4399
+ let from = 0;
4400
+ for (let j = 0; j < inner.length; j++) {
4401
+ const c = inner.charAt(j);
4402
+ if (c === SQ || c === DQ) {
4403
+ const e = quoteEnd(inner, j);
4404
+ if (e < 0) break;
4405
+ j = e;
4406
+ continue;
4407
+ }
4408
+ if (OPENERS.includes(c)) depth++;
4409
+ else if (CLOSERS.includes(c)) depth--;
4410
+ else if (c === "," && depth === 0) {
4411
+ parts.push(inner.slice(from, j));
4412
+ from = j + 1;
4413
+ }
4414
+ }
4415
+ parts.push(inner.slice(from));
4416
+ return parts;
4417
+ }
4418
+ var isFd = (w) => w !== "" && (w === FD_STAR || [...w].every((ch) => ch >= "0" && ch <= "9"));
4419
+ var fresh = () => ({ words: [], toFile: false, chained: false });
4420
+ function psParse(text) {
4421
+ const statements = [];
4422
+ let stages = [];
4423
+ let stage = fresh();
4424
+ let word = "";
4425
+ let has2 = false;
4426
+ let bare = true;
4427
+ let target = null;
4428
+ const n = text.length;
4429
+ const endWord = () => {
4430
+ if (!has2) return;
4431
+ if (target !== null) {
4432
+ if (target === "file") stage.toFile = true;
4433
+ target = null;
4434
+ } else stage.words.push(word);
4435
+ word = "";
4436
+ has2 = false;
4437
+ bare = true;
4438
+ };
4439
+ const endStage = () => {
4440
+ endWord();
4441
+ if (stage.words.length > 0 || stage.toFile) stages.push(stage);
4442
+ stage = fresh();
4443
+ };
4444
+ const endStatement = () => {
4445
+ endStage();
4446
+ if (stages.length > 0) statements.push(stages);
4447
+ stages = [];
4448
+ };
4449
+ const grow = (s, quoted) => {
4450
+ word += s;
4451
+ has2 = true;
4452
+ if (quoted) bare = false;
4453
+ };
4454
+ let i = 0;
4455
+ while (i < n) {
4456
+ const c = text.charAt(i);
4457
+ const next = text.charAt(i + 1);
4458
+ if (c === SQ || c === DQ) {
4459
+ const e = quoteEnd(text, i);
4460
+ grow(unquote(text.slice(i + 1, e < 0 ? n : e), c), true);
4461
+ i = e < 0 ? n : e + 1;
4462
+ } else if (c === TICK) {
4463
+ if (next !== "\n" && next !== "") grow(next, false);
4464
+ i += PAIR;
4465
+ } else if (c === "\n") {
4466
+ endStatement();
4467
+ i++;
4468
+ } else if (SPACES.includes(c)) {
4469
+ endWord();
4470
+ i++;
4471
+ } else if (c === ";") {
4472
+ endStatement();
4473
+ i++;
4474
+ } else if (c === "|") {
4475
+ if (next === "|") {
4476
+ endStatement();
4477
+ i += PAIR;
4478
+ } else {
4479
+ endStage();
4480
+ i++;
4481
+ }
4482
+ } else if (c === "&") {
4483
+ if (next === "&") {
4484
+ endStatement();
4485
+ i += PAIR;
4486
+ } else {
4487
+ if (has2 || stage.words.length > 0) grow(c, false);
4488
+ i++;
4489
+ }
4490
+ } else if (c === "#" && !has2) {
4491
+ while (i < n && text.charAt(i) !== "\n") i++;
4492
+ } else if (c === ">") {
4493
+ let fd = STDOUT_FD;
4494
+ if (has2 && bare && isFd(word)) {
4495
+ fd = word;
4496
+ word = "";
4497
+ has2 = false;
4498
+ } else if (has2) endWord();
4499
+ let j = i + 1;
4500
+ if (text.charAt(j) === ">") j++;
4501
+ if (text.charAt(j) === "&") {
4502
+ j++;
4503
+ while (j < n && !GLUE_END.includes(text.charAt(j))) j++;
4504
+ } else target = fd === STDOUT_FD || fd === FD_STAR ? "file" : "skip";
4505
+ i = j;
4506
+ } else if (c === "(" && has2 && bare && word.includes(METHOD_MARK)) {
4507
+ const e = closeOf(text, i);
4508
+ const inner = text.slice(i + 1, e < 0 ? n : e);
4509
+ endWord();
4510
+ for (const a of inner.trim() === "" ? [] : splitArgs(inner)) {
4511
+ const first = psParse(a)[0]?.[0]?.words[0];
4512
+ stage.words.push(first ?? a.trim());
4513
+ }
4514
+ i = e < 0 ? n : e + 1;
4515
+ if (i < n && !GLUE_END.includes(text.charAt(i))) {
4516
+ stage.chained = true;
4517
+ i = glueEnd(text, i);
4518
+ }
4519
+ } else if (c === "[" && !has2 && text.startsWith(METHOD_MARK, closeOf(text, i) + 1) && closeOf(text, i) >= 0) {
4520
+ const e = closeOf(text, i);
4521
+ grow(text.slice(i, e + 1), false);
4522
+ i = e + 1;
4523
+ } else if (OPENERS.includes(c) && (c !== "[" || !has2) || (c === "$" || c === "@") && OPENERS.includes(next) && next !== "[") {
4524
+ const open = c === "$" || c === "@" ? i + 1 : i;
4525
+ const e = closeOf(text, open);
4526
+ grow(text.slice(i, e < 0 ? n : e + 1), true);
4527
+ i = e < 0 ? n : e + 1;
4528
+ } else {
4529
+ grow(c, false);
4530
+ i++;
4531
+ }
4532
+ }
4533
+ endStatement();
4534
+ return statements;
4535
+ }
4536
+ var READ_COMMANDS = ["get-content", "gc", "cat", "type"];
4537
+ var FILE_CLASSES = ["[io.file]::", "[system.io.file]::"];
4538
+ var FILE_READS = ["readalltext", "readalllines", "readallbytes", "readlines"];
4539
+ var PATH_PARAMS = ["path", "literalpath"];
4540
+ var BOUND_PARAMS = ["totalcount", "head", "first", "tail", "last"];
4541
+ var VALUE_PARAMS = [...PATH_PARAMS, ...BOUND_PARAMS, "encoding", "readcount", "delimiter", "filter", "include", "exclude", "stream", "credential"];
4542
+ var SWITCH_PARAMS = ["raw", "wait", "force", "asbytestream"];
4543
+ var ALL_PARAMS = [...VALUE_PARAMS, ...SWITCH_PARAMS];
4544
+ var PASS_THROUGH = ["out-string", "write-output", "echo", "write", "out-host", "write-host", "out-default", "tee-object"];
4545
+ var CD_COMMANDS = ["cd", "chdir", "sl", "set-location", "pushd", "push-location"];
4546
+ var POWERSHELLS = ["powershell", "powershell.exe", "pwsh", "pwsh.exe"];
4547
+ var CMDS = ["cmd", "cmd.exe"];
4548
+ var CMD_RUN_FLAGS = ["/c", "/k", "/r"];
4549
+ var COMMAND_PARAM = "command";
4550
+ var DASH = "-";
4551
+ function cmdName(word) {
4552
+ const k = Math.max(word.lastIndexOf("\\"), word.lastIndexOf("/"));
4553
+ return (k >= 0 && k < word.length - 1 ? word.slice(k + 1) : word).toLowerCase();
4554
+ }
4555
+ function param(word, names) {
4556
+ const body = word.slice(DASH.length);
4557
+ const colon = body.indexOf(":");
4558
+ const name = (colon < 0 ? body : body.slice(0, colon)).toLowerCase();
4559
+ const inline = colon < 0 ? void 0 : body.slice(colon + 1);
4560
+ if (name === "") return { full: void 0, inline };
4561
+ if (names.includes(name)) return { full: name, inline };
4562
+ const hits = names.filter((p) => p.startsWith(name));
4563
+ return { full: hits.length === 1 ? hits[0] : void 0, inline };
4564
+ }
4565
+ function psDump(words) {
4566
+ if (words.length === 0) return null;
4567
+ const name = cmdName(words[0]);
4568
+ if (!READ_COMMANDS.includes(name)) {
4569
+ const lower = words[0].toLowerCase();
4570
+ const cls = FILE_CLASSES.find((c) => lower.startsWith(c));
4571
+ if (cls === void 0 || !FILE_READS.includes(lower.slice(cls.length)) || words.length < MIN_STATIC_CALL) return null;
4572
+ return { file: words[1], bounded: false };
4573
+ }
4574
+ const files = [];
4575
+ let bounded = false;
4576
+ for (let k = 1; k < words.length; k++) {
4577
+ const a = words[k];
4578
+ if (!a.startsWith(DASH) || a.length === DASH.length) {
4579
+ files.push(a);
4580
+ continue;
4581
+ }
4582
+ const p = param(a, ALL_PARAMS);
4583
+ if (p.full === void 0 || !VALUE_PARAMS.includes(p.full)) continue;
4584
+ const value = p.inline ?? words[++k];
4585
+ if (value === void 0) return null;
4586
+ if (PATH_PARAMS.includes(p.full)) files.push(value);
4587
+ if (BOUND_PARAMS.includes(p.full)) bounded = true;
4588
+ }
4589
+ return files.length === 1 ? { file: files[0], bounded } : null;
4590
+ }
4591
+ function nestedScript(name, words) {
4592
+ if (POWERSHELLS.includes(name)) {
4593
+ for (let k = 1; k < words.length; k++) {
4594
+ const w = words[k];
4595
+ if (!w.startsWith(DASH) || w.length === DASH.length) continue;
4596
+ const p = param(w, [COMMAND_PARAM]);
4597
+ if (p.full === void 0) continue;
4598
+ return [...p.inline === void 0 ? [] : [p.inline], ...words.slice(k + 1)].join(" ");
4599
+ }
4600
+ return null;
4601
+ }
4602
+ if (CMDS.includes(name)) {
4603
+ for (let k = 1; k < words.length; k++) {
4604
+ if (CMD_RUN_FLAGS.includes(words[k].toLowerCase())) return words.slice(k + 1).join(" ");
4605
+ }
4606
+ }
4607
+ return null;
4608
+ }
4609
+ function cdTarget(words) {
4610
+ for (let k = 1; k < words.length; k++) {
4611
+ const w = words[k];
4612
+ if (w.toLowerCase() === "/d") continue;
4613
+ if (!w.startsWith(DASH) || w.length === DASH.length) return w;
4614
+ const p = param(w, PATH_PARAMS);
4615
+ if (p.full !== void 0) return p.inline ?? words[k + 1] ?? null;
4616
+ }
4617
+ return null;
4618
+ }
4619
+ function walk(script, cwd, depth, found) {
4620
+ let dir = cwd;
4621
+ for (const stages of psParse(script)) {
4622
+ const head = stages[0];
4623
+ if (head.words.length === 0) continue;
4624
+ const name = cmdName(head.words[0]);
4625
+ if (stages.length === 1 && CD_COMMANDS.includes(name)) {
4626
+ const t = cdTarget(head.words);
4627
+ if (t !== null) dir = resolve(dir, t);
4628
+ continue;
4629
+ }
4630
+ const inner = depth < MAX_NEST_DEPTH ? nestedScript(name, head.words) : null;
4631
+ if (inner !== null) {
4632
+ walk(inner, dir, depth + 1, found);
4633
+ continue;
4634
+ }
4635
+ if (head.toFile || head.chained) continue;
4636
+ const d = psDump(head.words);
4637
+ if (d === null || d.bounded) continue;
4638
+ let shown = true;
4639
+ for (let k = 1; k < stages.length; k++) {
4640
+ if (stages[k].toFile || !PASS_THROUGH.includes(cmdName(stages[k].words[0] ?? ""))) {
4641
+ shown = false;
4642
+ break;
4643
+ }
4644
+ }
4645
+ if (shown) found.push(resolve(dir, d.file));
4646
+ }
4647
+ }
4648
+ function psDumpFiles(script, cwd) {
4649
+ const found = [];
4650
+ walk(script, cwd, 0, found);
4651
+ return found;
4652
+ }
4653
+
4315
4654
  // src/core/policy/subagent.ts
4316
4655
  import { join as join2 } from "node:path";
4317
4656
 
@@ -4659,7 +4998,7 @@ function readPath(input) {
4659
4998
  }
4660
4999
  function userDenyHit(canonical, input, cwd, rules) {
4661
5000
  if (rules.length === 0) return null;
4662
- const readRule = (p) => matchesAnyDenyPattern(resolve(cwd, p), rules, { tool: READ, projectDir: cwd });
5001
+ const readRule = (p) => matchesAnyDenyPattern(resolve2(cwd, p), rules, { tool: READ, projectDir: cwd });
4663
5002
  if (canonical === BASH) {
4664
5003
  const cmd = str(input.command);
4665
5004
  return cmd === void 0 ? null : matchesAnyDenyPattern(cmd, rules);
@@ -4711,7 +5050,7 @@ function webFetch(input, row) {
4711
5050
  function bash(ev, row, input, rules) {
4712
5051
  const cmd = str(input.command) ?? "";
4713
5052
  const parsed = parseShell(cmd);
4714
- if (!parsed.ok) return couldMatch(cmd, rules) ? deny(prefixToolNames(PARSE_ERROR_DENY_LINE, row.toolNamePrefix)) : ALLOW;
5053
+ if (!parsed.ok) return couldMatch(cmd, rules) ? deny(prefixToolNames(PARSE_ERROR_DENY_LINE, row.toolNamePrefix)) : psShellDump(cmd, ev.cwd, row) ?? ALLOW;
4715
5054
  const cmds = unwrap(parsed.commands);
4716
5055
  for (const c of cmds) {
4717
5056
  const h = segmentHit(c, rules);
@@ -4723,7 +5062,7 @@ function bash(ev, row, input, rules) {
4723
5062
  if (kind !== null) return deny(denyMessage(kind, cmd, row, str(input.description)));
4724
5063
  }
4725
5064
  }
4726
- return shellDump(cmds, ev.cwd, row) ?? ALLOW;
5065
+ return shellDump(cmds, ev.cwd, row) ?? psShellDump(cmd, ev.cwd, row) ?? ALLOW;
4727
5066
  }
4728
5067
  function denyKind(c) {
4729
5068
  const name = c.argv0.toLowerCase();
@@ -4770,7 +5109,7 @@ function read(ev, row, input) {
4770
5109
  if (!present(input.offset) && !present(input.limit)) {
4771
5110
  const p = readPath(input);
4772
5111
  if (p !== void 0) {
4773
- const abs = resolve(ev.cwd, p);
5112
+ const abs = resolve2(ev.cwd, p);
4774
5113
  const size = fileSize(abs);
4775
5114
  if (size > OUTPUT_CAP) return deny(READ_DENY_MESSAGE(abs, size, row.toolNamePrefix));
4776
5115
  }
@@ -4783,7 +5122,7 @@ function shellDump(cmds, cwd, row) {
4783
5122
  let verdict = null;
4784
5123
  for (const c of cmds) {
4785
5124
  const name = c.argv0.toLowerCase();
4786
- if (name === CD_COMMAND && c.args.length === 1 && c.insideConstruct === void 0) dir = resolve(dir, c.args[0]);
5125
+ if (name === CD_COMMAND && c.args.length === 1 && c.insideConstruct === void 0) dir = resolve2(dir, c.args[0]);
4787
5126
  if (c.redirectsToFile || c.endsInBoundedSink || c.pipesOut === true || c.insideConstruct !== void 0) continue;
4788
5127
  if (!has(SHELL_DUMP_COMMANDS, name)) continue;
4789
5128
  const d = dumpTarget(name, c.args);
@@ -4792,12 +5131,20 @@ function shellDump(cmds, cwd, row) {
4792
5131
  verdict = ALLOW;
4793
5132
  continue;
4794
5133
  }
4795
- const abs = resolve(dir, d.file);
5134
+ const abs = resolve2(dir, d.file);
4796
5135
  const size = fileSize(abs);
4797
5136
  if (size > OUTPUT_CAP) return deny(READ_DENY_MESSAGE(abs, size, row.toolNamePrefix));
4798
5137
  }
4799
5138
  return verdict;
4800
5139
  }
5140
+ function psShellDump(cmd, cwd, row) {
5141
+ if (row.nativeTools.read !== void 0 && row.nativeTools.read.length > 0 && dumpRunsThenReplaces(row)) return null;
5142
+ for (const abs of psDumpFiles(cmd, cwd)) {
5143
+ const size = fileSize(abs);
5144
+ if (size > OUTPUT_CAP) return deny(READ_DENY_MESSAGE(abs, size, row.toolNamePrefix));
5145
+ }
5146
+ return null;
5147
+ }
4801
5148
  var allDigits2 = (s) => s !== "" && [...s].every((ch) => ch >= "0" && ch <= "9");
4802
5149
  function countFlag(a) {
4803
5150
  if (has(DUMP_COUNT_FLAGS, a)) return 1;
@@ -4855,7 +5202,7 @@ function dumpTarget(name, args) {
4855
5202
  }
4856
5203
 
4857
5204
  // src/core/project/resolve.ts
4858
- import { basename, dirname as dirname2, join as join4, resolve as resolve2 } from "node:path";
5205
+ import { basename, dirname as dirname2, join as join4, resolve as resolve3 } from "node:path";
4859
5206
 
4860
5207
  // src/core/project/contain.ts
4861
5208
  import { dirname, sep as sep2 } from "node:path";
@@ -5050,7 +5397,7 @@ function gitDirs(dir) {
5050
5397
  const gitDir = gitDirAt(join4(cur, GIT_DIR_NAME));
5051
5398
  if (gitDir !== null) {
5052
5399
  const common = firstLine(join4(gitDir, GIT_COMMONDIR_FILE));
5053
- return { commonDir: realpathSync3.native(common === null ? gitDir : resolve2(gitDir, common)), worktree: cur, start };
5400
+ return { commonDir: realpathSync3.native(common === null ? gitDir : resolve3(gitDir, common)), worktree: cur, start };
5054
5401
  }
5055
5402
  const up = dirname2(cur);
5056
5403
  if (up === cur) return { commonDir: null, start };
@@ -5065,7 +5412,7 @@ function gitDirAt(dotGit) {
5065
5412
  } else {
5066
5413
  const line = firstLine(dotGit);
5067
5414
  if (line === null || !line.startsWith(GITDIR_FILE_PREFIX)) return null;
5068
- gitDir = resolve2(dirname2(dotGit), line.slice(GITDIR_FILE_PREFIX.length));
5415
+ gitDir = resolve3(dirname2(dotGit), line.slice(GITDIR_FILE_PREFIX.length));
5069
5416
  }
5070
5417
  } catch {
5071
5418
  return null;
@@ -5278,10 +5625,10 @@ function startArgv(argv) {
5278
5625
  return sh === null ? null : [sh, ...argv];
5279
5626
  }
5280
5627
  function runProcess(argv, o) {
5281
- return new Promise((resolve3) => {
5628
+ return new Promise((resolve4) => {
5282
5629
  const isWin2 = process.platform === "win32";
5283
5630
  const start = startArgv(argv);
5284
- if (start === null) return resolve3(NOT_STARTED);
5631
+ if (start === null) return resolve4(NOT_STARTED);
5285
5632
  let child;
5286
5633
  try {
5287
5634
  child = spawn(start[0], start.slice(1), {
@@ -5295,7 +5642,7 @@ function runProcess(argv, o) {
5295
5642
  windowsHide: true
5296
5643
  });
5297
5644
  } catch {
5298
- return resolve3(NOT_STARTED);
5645
+ return resolve4(NOT_STARTED);
5299
5646
  }
5300
5647
  const stdoutChunks = [];
5301
5648
  const stderrChunks = [];
@@ -5320,7 +5667,7 @@ function runProcess(argv, o) {
5320
5667
  settled = true;
5321
5668
  clearTimeout(timer);
5322
5669
  o.signal.removeEventListener("abort", onAbort);
5323
- resolve3({
5670
+ resolve4({
5324
5671
  stdout: Buffer.concat(stdoutChunks),
5325
5672
  stderr: Buffer.concat(stderrChunks),
5326
5673
  exitCode,