@cydm/pie 1.0.8 → 1.0.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.
@@ -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-XHZP5EK4.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";
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-XHZP5EK4.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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cydm/pie",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
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",