@cydm/pie 1.0.8 → 1.0.10

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.
@@ -1,7 +1,7 @@
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-6WD2NFIC.js";
4
+ } from "../../../chunks/chunk-EJGQAAKS.js";
5
5
  import "../../../chunks/chunk-A5JSJAPK.js";
6
6
  import "../../../chunks/chunk-TG2EQLX2.js";
7
7
 
@@ -7,7 +7,7 @@ import {
7
7
  isPlanModeSafeCommand,
8
8
  markCompletedPlanSteps,
9
9
  restoreExecutionState
10
- } from "../../../chunks/chunk-6WD2NFIC.js";
10
+ } from "../../../chunks/chunk-EJGQAAKS.js";
11
11
  import "../../../chunks/chunk-A5JSJAPK.js";
12
12
  import "../../../chunks/chunk-TG2EQLX2.js";
13
13
 
@@ -1,11 +1,11 @@
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-ZRONUKTW.js";
4
+ } from "../../../chunks/chunk-R2HMYSEK.js";
5
5
  import {
6
6
  createSharedFileSystemTools,
7
7
  createSubagentCapability
8
- } from "../../../chunks/chunk-6WD2NFIC.js";
8
+ } from "../../../chunks/chunk-EJGQAAKS.js";
9
9
  import "../../../chunks/chunk-A5JSJAPK.js";
10
10
  import "../../../chunks/chunk-TG2EQLX2.js";
11
11
 
@@ -7,7 +7,7 @@ import {
7
7
  executeManageTodoList,
8
8
  executionStateToTodos,
9
9
  restoreExecutionState
10
- } from "../../../chunks/chunk-6WD2NFIC.js";
10
+ } from "../../../chunks/chunk-EJGQAAKS.js";
11
11
  import "../../../chunks/chunk-A5JSJAPK.js";
12
12
  import "../../../chunks/chunk-TG2EQLX2.js";
13
13
 
@@ -4619,6 +4619,9 @@ import * as nodePath from "node:path";
4619
4619
 
4620
4620
  // ../../packages/shared-headless-capabilities/src/builtin/fs/path-utils.ts
4621
4621
  function isInAllowlist(path3, allowlistedDirs) {
4622
+ if (allowlistedDirs.some((dir) => isGlobalFilesystemSentinel(dir))) {
4623
+ return true;
4624
+ }
4622
4625
  const normalized = normalizeForComparison(path3);
4623
4626
  for (const dir of allowlistedDirs) {
4624
4627
  const normalizedDir = normalizeForComparison(dir);
@@ -4630,9 +4633,19 @@ function isInAllowlist(path3, allowlistedDirs) {
4630
4633
  return false;
4631
4634
  }
4632
4635
  function normalizeForComparison(path3) {
4633
- const normalized = path3.replace(/\\/g, "/").replace(/\/+/g, "/");
4636
+ const slashNormalized = path3.replace(/\\/g, "/");
4637
+ const isWindowsPath = /^[a-zA-Z]:($|\/)/.test(slashNormalized) || /^\/{2}[^/]+\/[^/]+/.test(slashNormalized);
4638
+ const normalized = slashNormalized.replace(/\/+/g, "/");
4634
4639
  if (normalized === "/") return normalized;
4635
- return normalized.replace(/\/+$/, "");
4640
+ const trimmed = normalized.replace(/\/+$/, "");
4641
+ return isWindowsPath ? trimmed.toLowerCase() : trimmed;
4642
+ }
4643
+ function isGlobalFilesystemSentinel(path3) {
4644
+ return normalizeForComparison(String(path3 || "").trim()) === "/";
4645
+ }
4646
+ function isAbsoluteUserPath(path3) {
4647
+ const normalized = path3.replace(/\\/g, "/");
4648
+ return /^[a-zA-Z]:\//.test(normalized) || /^\/{2}[^/]+\/[^/]+/.test(normalized);
4636
4649
  }
4637
4650
  function validateToolPathArgument(filePath) {
4638
4651
  const trimmed = filePath.trim();
@@ -4650,6 +4663,9 @@ function withTrailingSep(path3) {
4650
4663
  return path3.endsWith("/") ? path3 : `${path3}/`;
4651
4664
  }
4652
4665
  function isWithinRoot(path3, root) {
4666
+ if (isGlobalFilesystemSentinel(root)) {
4667
+ return true;
4668
+ }
4653
4669
  const normalizedPath = normalizeForComparison(path3);
4654
4670
  const normalizedRoot = normalizeForComparison(root);
4655
4671
  return normalizedPath === normalizedRoot || normalizedPath.startsWith(withTrailingSep(normalizedRoot));
@@ -4758,7 +4774,7 @@ function resolveInSandbox(filePath, sandboxRoot, options, rootName) {
4758
4774
  }
4759
4775
  validateToolPathArgument(filePath);
4760
4776
  const cleaned = filePath.trim().startsWith("@") ? filePath.trim().slice(1) : filePath.trim();
4761
- if (fs2.isAbsolute(cleaned)) {
4777
+ if (fs2.isAbsolute(cleaned) || isAbsoluteUserPath(cleaned)) {
4762
4778
  const normalized = fs2.normalize(cleaned);
4763
4779
  const selectedRoot2 = rootName ? getRootByName(rootName, sandboxRoot, options) : void 0;
4764
4780
  if (rootName && !selectedRoot2) {
@@ -8,7 +8,7 @@ import {
8
8
  createSharedWebSearchTool,
9
9
  interpretShellExit,
10
10
  requestInteraction
11
- } from "./chunk-6WD2NFIC.js";
11
+ } from "./chunk-EJGQAAKS.js";
12
12
  import {
13
13
  Type
14
14
  } from "./chunk-A5JSJAPK.js";
@@ -320,7 +320,7 @@ function buildBashRecoveryHint(command, output) {
320
320
  if (/\bnpm ERR!|\bnpm error\b/i.test(output) && /\b(?:ECONNRESET|ETIMEDOUT|ENOTFOUND|EAI_AGAIN|fetch failed|socket hang up|registry|proxy)\b/i.test(output)) {
321
321
  return "npm could not reach the registry. Treat this as an environment/network/proxy issue, not a source-code failure; retry npm install/npm ci when network is available or check npm proxy/registry settings.";
322
322
  }
323
- if (/\bnpm\s+run\b/.test(command) && /(?:^|\n)\s*(?:sh|bash|zsh):\s+[\w@./-]+:\s+command not found\b/i.test(output)) {
323
+ if (/\bnpm\s+run\b/.test(command) && (/(?:^|\n)\s*(?:sh|bash|zsh):\s+[\w@./-]+:\s+command not found\b/i.test(output) || /(?:^|\r?\n)\s*'[^']+'\s+is not recognized as an internal or external command\b/i.test(output))) {
324
324
  return "This npm script could not find a local executable. Check whether dependencies were installed successfully in cwd, whether node_modules exists, and whether a prior npm install/npm ci failed before treating this as a code failure.";
325
325
  }
326
326
  return void 0;
@@ -406,8 +406,7 @@ function createBashTool(defaultCwd, options) {
406
406
  shell: spawnCommand.shell,
407
407
  cwd: workingDir,
408
408
  env: process.env,
409
- detached: true
410
- // Allows killing entire process tree
409
+ detached: process.platform !== "win32"
411
410
  });
412
411
  const timeoutId = setTimeout(() => {
413
412
  timedOut = true;
@@ -515,6 +514,9 @@ function createBashTool(defaultCwd, options) {
515
514
  };
516
515
  const semantic = interpretShellExit(effectiveCommand, code);
517
516
  details.semanticExitMeaning = semantic.semanticExitMeaning;
517
+ if (resolvedShell === "powershell" && code === 0 && /^\s*(?:diff|Compare-Object)\b/i.test(effectiveCommand) && /\bSideIndicator\b/.test(fullOutput)) {
518
+ details.semanticExitMeaning = "files differ";
519
+ }
518
520
  if (truncation.truncated) {
519
521
  details.truncation = {
520
522
  truncated: true,
package/dist/cli.js CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  getSettingsPath,
15
15
  getThemesDir,
16
16
  migrateConfigFromAgentDir
17
- } from "./chunks/chunk-ZRONUKTW.js";
17
+ } from "./chunks/chunk-R2HMYSEK.js";
18
18
  import {
19
19
  AGENTS_CONTEXT_FILE_NAME,
20
20
  AgentSessionController,
@@ -52,7 +52,7 @@ import {
52
52
  selectToolsForRuntimePolicy,
53
53
  shouldPreserveExecutionStateForUserText,
54
54
  supersedeExecutionState
55
- } from "./chunks/chunk-6WD2NFIC.js";
55
+ } from "./chunks/chunk-EJGQAAKS.js";
56
56
  import {
57
57
  Deref,
58
58
  Errors,
@@ -53574,6 +53574,17 @@ var DEFAULT_PIC_OPTIONS = {
53574
53574
 
53575
53575
  // src/files/utils.ts
53576
53576
  import * as path10 from "node:path";
53577
+ import { homedir as homedir2 } from "node:os";
53578
+ var WINDOWS_ABSOLUTE_PATH_RE = /^(?:[a-zA-Z]:[\\/]|[\\/]{2}[^\\/]+[\\/][^\\/]+)/;
53579
+ function isWindowsAbsolutePath(filePath) {
53580
+ return WINDOWS_ABSOLUTE_PATH_RE.test(filePath);
53581
+ }
53582
+ function getHomeDirectory() {
53583
+ return homedir2() || process.env.USERPROFILE || process.env.HOME || ".";
53584
+ }
53585
+ function looksLikeFilePath(inputPath) {
53586
+ return inputPath.startsWith("/") || inputPath.startsWith("~") || inputPath.startsWith("./") || inputPath.startsWith("../") || inputPath.startsWith(".\\") || inputPath.startsWith("..\\") || isWindowsAbsolutePath(inputPath);
53587
+ }
53577
53588
  function formatBytes(bytes) {
53578
53589
  if (bytes < 1024) return `${bytes}B`;
53579
53590
  if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)}KB`;
@@ -53583,7 +53594,10 @@ function formatBytes(bytes) {
53583
53594
  }
53584
53595
  function resolvePath(inputPath) {
53585
53596
  if (inputPath.startsWith("~")) {
53586
- return path10.join(process.env.HOME || ".", inputPath.slice(1));
53597
+ return path10.join(getHomeDirectory(), inputPath.slice(1));
53598
+ }
53599
+ if (isWindowsAbsolutePath(inputPath)) {
53600
+ return inputPath;
53587
53601
  }
53588
53602
  if (!path10.isAbsolute(inputPath)) {
53589
53603
  return path10.resolve(process.cwd(), inputPath);
@@ -61891,7 +61905,7 @@ var MentionHandler = class {
61891
61905
  this.pendingStatusMessages.delete(key);
61892
61906
  }
61893
61907
  isPath(query) {
61894
- return query.startsWith("/") || query.startsWith("~") || query.startsWith("./") || query.startsWith("../");
61908
+ return looksLikeFilePath(query);
61895
61909
  }
61896
61910
  };
61897
61911
 
@@ -63644,16 +63658,27 @@ function selectToolsForRuntimeMode(tools, mode) {
63644
63658
  }
63645
63659
 
63646
63660
  // src/input/direct-bash.ts
63661
+ function buildDirectShellCommand(command) {
63662
+ if (process.platform === "win32") {
63663
+ return {
63664
+ file: "powershell.exe",
63665
+ args: ["-NoProfile", "-NonInteractive", "-Command", command],
63666
+ prompt: "PS>"
63667
+ };
63668
+ }
63669
+ return { file: "bash", args: ["-lc", command], prompt: "$" };
63670
+ }
63647
63671
  async function handleDirectBash(host, command) {
63648
63672
  host.chatContainer.addChild(new Spacer(1));
63649
- host.chatContainer.addChild(new Text(theme.fg("accent", `$ ${command}`), 1, 0));
63673
+ const shellCommand = buildDirectShellCommand(command);
63674
+ host.chatContainer.addChild(new Text(theme.fg("accent", `${shellCommand.prompt} ${command}`), 1, 0));
63650
63675
  host.editor.setText("");
63651
63676
  const outputContainer = new Container();
63652
63677
  outputContainer.addChild(new Spacer(1));
63653
63678
  host.chatContainer.addChild(outputContainer);
63654
63679
  host.ui.requestRender();
63655
63680
  const { spawn: spawn2 } = await import("child_process");
63656
- const child = spawn2("bash", ["-c", command], {
63681
+ const child = spawn2(shellCommand.file, shellCommand.args, {
63657
63682
  cwd: process.cwd(),
63658
63683
  env: process.env
63659
63684
  });
@@ -63678,14 +63703,24 @@ async function handleDirectBash(host, command) {
63678
63703
  host.ui.requestRender();
63679
63704
  });
63680
63705
  return new Promise((resolve4) => {
63681
- child.on("close", (code) => {
63706
+ let settled = false;
63707
+ const finish = (code) => {
63708
+ if (settled) return;
63709
+ settled = true;
63682
63710
  if (code !== 0) {
63683
63711
  outputContainer.addChild(new Spacer(1));
63684
- outputContainer.addChild(new Text(theme.fg("error", `[exit ${code}]`), 1, 0));
63712
+ outputContainer.addChild(new Text(theme.fg("error", `[exit ${code ?? "spawn error"}]`), 1, 0));
63685
63713
  }
63686
63714
  host.chatContainer.addChild(new Spacer(1));
63687
63715
  host.ui.requestRender();
63688
63716
  resolve4();
63717
+ };
63718
+ child.on("error", (error) => {
63719
+ outputContainer.addChild(new Text(theme.fg("error", error.message), 1, 0));
63720
+ finish(null);
63721
+ });
63722
+ child.on("close", (code) => {
63723
+ finish(code);
63689
63724
  });
63690
63725
  });
63691
63726
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cydm/pie",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "Pie AI Agent CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -16,7 +16,7 @@
16
16
  "validate:models": "tsx scripts/validate-models-config.ts",
17
17
  "test": "npm run test:offline",
18
18
  "pretest:offline": "npm run build --workspace @pie/agent-framework && npm run build --workspace @pie/shared-headless-capabilities && npm run build",
19
- "test:offline": "node --test --import tsx test/core-services.test.ts test/cli.test.ts test/execution-state-manager.test.ts test/queued-steer-execution-state.test.ts test/architecture-boundaries.test.ts test/attachment-resolver.test.ts test/kimi-attachment-extension.test.ts test/document-attachment-extension.test.ts test/auto-compact-overflow.test.ts test/hierarchical-command-system.test.ts test/message-queue-unit.test.ts test/evals-harness.test.ts test/session-trace.test.ts test/runtime-mode-context.test.ts test/tool-policy.test.ts test/yolo-command.test.ts test/footer-lifecycle.test.ts test/source-size-guard.test.ts test/runtime-logger.test.ts test/release-readiness.test.ts test/code-intel-typescript-provider.test.ts test/init-extension-contract.test.ts test/skills-runtime.test.ts test/mention-file-select.terminal.test.ts test/tool-partial-display.terminal.test.ts test/tool-name-rendering.test.ts test/tools-registry.test.ts test/system-prompt-contract.test.ts test/daily-agent-smoke.terminal.test.ts test/viewport-position-final.test.ts",
19
+ "test:offline": "node --test --import tsx test/core-services.test.ts test/cli.test.ts test/execution-state-manager.test.ts test/queued-steer-execution-state.test.ts test/architecture-boundaries.test.ts test/attachment-resolver.test.ts test/kimi-attachment-extension.test.ts test/document-attachment-extension.test.ts test/auto-compact-overflow.test.ts test/hierarchical-command-system.test.ts test/message-queue-unit.test.ts test/evals-harness.test.ts test/session-trace.test.ts test/runtime-mode-context.test.ts test/tool-policy.test.ts test/yolo-command.test.ts test/footer-lifecycle.test.ts test/files-utils.test.ts test/source-size-guard.test.ts test/runtime-logger.test.ts test/release-readiness.test.ts test/code-intel-typescript-provider.test.ts test/init-extension-contract.test.ts test/skills-runtime.test.ts test/mention-file-select.terminal.test.ts test/tool-partial-display.terminal.test.ts test/tool-name-rendering.test.ts test/tools-registry.test.ts test/system-prompt-contract.test.ts test/daily-agent-smoke.terminal.test.ts test/viewport-position-final.test.ts",
20
20
  "test:todo-tui": "PIE_REAL_TODO_TUI=1 node --test --import tsx test/todo-closure.terminal.test.ts",
21
21
  "test:daily-tui": "npm run test:daily-tui:quick",
22
22
  "test:daily-tui:quick": "PIE_REAL_DAILY_TUI=1 PIE_DAILY_TUI_LEVEL=quick node --test --import tsx test/daily-agent-smoke.terminal.test.ts",