@agentclientprotocol/codex-acp 2.5.1-preview.13 → 2.5.1-preview.14

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.
Files changed (2) hide show
  1. package/dist/index.js +100 -84
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -36416,6 +36416,56 @@ function withSubagentUserAction(sessionId, request, itemId, signal) {
36416
36416
  return context.foreground ? context.foreground.withUserAction(itemId ?? context.itemId, send, cancellation) : send();
36417
36417
  }
36418
36418
 
36419
+ // src/PathUtils.ts
36420
+ import path5 from "node:path";
36421
+ function isAbsoluteProtocolPath(value) {
36422
+ return !value.includes("\0") && (path5.posix.isAbsolute(value) || isWindowsAbsolutePath(value));
36423
+ }
36424
+ function isAbsolutePathLike(value) {
36425
+ return isAbsoluteProtocolPath(value.trim());
36426
+ }
36427
+ function arePathsEqual(left, right) {
36428
+ return normalizePathForComparison(left) === normalizePathForComparison(right);
36429
+ }
36430
+ function arePathBasenamesEqual(left, right) {
36431
+ const leftBase = path5.posix.basename(normalizePathForComparison(left));
36432
+ const rightBase = path5.posix.basename(normalizePathForComparison(right));
36433
+ if (shouldComparePathCaseInsensitive(left) || shouldComparePathCaseInsensitive(right)) {
36434
+ return leftBase.toLowerCase() === rightBase.toLowerCase();
36435
+ }
36436
+ return leftBase === rightBase;
36437
+ }
36438
+ function normalizePathForComparison(value) {
36439
+ const trimmed = value.trim();
36440
+ if (trimmed.length === 0) {
36441
+ return "";
36442
+ }
36443
+ if (isWindowsAbsolutePath(trimmed)) {
36444
+ const normalized2 = path5.win32.normalize(trimmed).replace(/\\/g, "/");
36445
+ return trimTrailingPathSeparators(normalized2).toLowerCase();
36446
+ }
36447
+ const pathForComparison = path5.isAbsolute(trimmed) ? trimmed : trimmed.replace(/\\/g, "/");
36448
+ const normalized = path5.posix.normalize(pathForComparison);
36449
+ return trimTrailingPathSeparators(normalized);
36450
+ }
36451
+ function isWindowsAbsolutePath(value) {
36452
+ const portableValue = value.replace(/\\/g, "/");
36453
+ return /^[A-Za-z]:\//.test(portableValue) || /^\/\/[^/]+\/[^/]+/.test(portableValue);
36454
+ }
36455
+ function shouldComparePathCaseInsensitive(value) {
36456
+ return isWindowsAbsolutePath(value) || /^[A-Za-z]:/.test(value) || value.includes("\\");
36457
+ }
36458
+ function trimTrailingPathSeparators(value) {
36459
+ let trimmed = value;
36460
+ while (trimmed.endsWith("/") && !isRootPath(trimmed)) {
36461
+ trimmed = trimmed.slice(0, -1);
36462
+ }
36463
+ return trimmed;
36464
+ }
36465
+ function isRootPath(value) {
36466
+ return value === "/" || /^[A-Za-z]:\/$/.test(value) || /^\/\/[^/]+\/[^/]+\/$/.test(value);
36467
+ }
36468
+
36419
36469
  // src/subagents/StandardSubagentEventRouter.ts
36420
36470
  var StandardSubagentEventRouter = class {
36421
36471
  constructor(rootSessionId, session, associations, onChildWorkEnded, capabilities = ClientCapabilities.DEFAULT, deferLive = false, ready = Promise.resolve(), runningTurnId = () => void 0, rootModels = () => null, configurationRuntime) {
@@ -36471,7 +36521,11 @@ var StandardSubagentEventRouter = class {
36471
36521
  if (notification.method === "thread/settings/updated" && !this.appliedSettings.has(notification.params)) {
36472
36522
  this.appliedSettings.add(notification.params);
36473
36523
  const settings = notification.params.threadSettings;
36474
- await this.observeConfiguration(threadId, { model: settings.model, effort: settings.effort }, "settings");
36524
+ await this.observeConfiguration(threadId, {
36525
+ model: settings.model,
36526
+ effort: settings.effort,
36527
+ ...this.children.has(threadId) ? { cwd: settings.cwd } : {}
36528
+ }, "settings");
36475
36529
  }
36476
36530
  if (this.deferLive) {
36477
36531
  this.deferredLive.push(notification);
@@ -36757,10 +36811,14 @@ var StandardSubagentEventRouter = class {
36757
36811
  }
36758
36812
  async observeConfiguration(threadId, observed, source) {
36759
36813
  const previous = this.configurations.get(threadId);
36760
- if (this.retired || !previous && !observed.model && observed.effort === null && source !== "settings") return;
36814
+ const cwd = observed.cwd !== void 0 && isAbsoluteProtocolPath(observed.cwd) ? observed.cwd : null;
36815
+ if (this.retired || !previous && !observed.model && observed.effort === null && cwd === null && source !== "settings") return;
36761
36816
  this.configurationRequests.delete(threadId);
36762
36817
  const next = { ...previous };
36763
36818
  if (observed.model) next.model = preferredModel(previous?.model, { model: observed.model, source });
36819
+ if (cwd !== null && (!previous?.cwd || MODEL_SOURCE_RANK[source] >= MODEL_SOURCE_RANK[previous.cwd.source])) {
36820
+ next.cwd = { value: cwd, source };
36821
+ }
36764
36822
  const changedModel = next.model?.model !== previous?.model?.model;
36765
36823
  if (changedModel || !previous?.effort || MODEL_SOURCE_RANK[source] >= MODEL_SOURCE_RANK[previous.effort.source]) {
36766
36824
  next.effort = { value: observed.effort, source };
@@ -36776,6 +36834,14 @@ var StandardSubagentEventRouter = class {
36776
36834
  await this.ensureAnnounced(child);
36777
36835
  const configuration = this.configurations.get(child.threadId);
36778
36836
  if (!configuration || this.retired) return;
36837
+ if (configuration.cwd && configuration.cwd.value !== configuration.publishedCwd) {
36838
+ await this.session.update({
36839
+ sessionUpdate: "subagent_update",
36840
+ sessionId: child.sessionId,
36841
+ cwd: configuration.cwd.value
36842
+ }, child.parentSessionId);
36843
+ configuration.publishedCwd = configuration.cwd.value;
36844
+ }
36779
36845
  const options = subagentConfigurationOptions(this.rootModels(), {
36780
36846
  model: configuration.model?.model ?? null,
36781
36847
  effort: configuration.effort?.value ?? null
@@ -37175,7 +37241,7 @@ function mergeRateLimitSnapshot(previous, update) {
37175
37241
 
37176
37242
  // src/AgentFileChangeReport.ts
37177
37243
  import fs2 from "node:fs";
37178
- import path5 from "node:path";
37244
+ import path6 from "node:path";
37179
37245
  var AGENT_FILE_CHANGE_REPORT_VERSION = 1;
37180
37246
  var AGENT_FILE_CHANGE_REPORT_MAX_PATHS = 1024;
37181
37247
  var AGENT_FILE_CHANGE_REPORT_MAX_PATH_LENGTH = 4096;
@@ -37362,37 +37428,37 @@ function parseWorkspaceRoot(value) {
37362
37428
  if (!isValidPathText(trimmed)) {
37363
37429
  return null;
37364
37430
  }
37365
- if (isWindowsAbsolutePath(trimmed)) {
37431
+ if (isWindowsAbsolutePath2(trimmed)) {
37366
37432
  return {
37367
- value: path5.win32.normalize(trimmed.replace(/\//g, "\\")),
37433
+ value: path6.win32.normalize(trimmed.replace(/\//g, "\\")),
37368
37434
  flavor: "windows"
37369
37435
  };
37370
37436
  }
37371
- if (path5.posix.isAbsolute(trimmed)) {
37437
+ if (path6.posix.isAbsolute(trimmed)) {
37372
37438
  return {
37373
- value: path5.posix.normalize(trimmed.replace(/\\/g, "/")),
37439
+ value: path6.posix.normalize(trimmed.replace(/\\/g, "/")),
37374
37440
  flavor: "posix"
37375
37441
  };
37376
37442
  }
37377
37443
  return null;
37378
37444
  }
37379
37445
  function normalizeReportedPath(value, relativeRoot, roots) {
37380
- if (!isValidPathText(value) || /^[A-Za-z]:[^\\/]/.test(value) || /^\\\\[?.]\\/.test(value) || /^(?:\\\\|\/\/)/.test(value) && !isWindowsAbsolutePath(value) || relativeRoot.flavor === "windows" && /^\\(?!\\)/.test(value) || /^[A-Za-z][A-Za-z0-9+.-]*:\/\//.test(value)) {
37446
+ if (!isValidPathText(value) || /^[A-Za-z]:[^\\/]/.test(value) || /^\\\\[?.]\\/.test(value) || /^(?:\\\\|\/\/)/.test(value) && !isWindowsAbsolutePath2(value) || relativeRoot.flavor === "windows" && /^\\(?!\\)/.test(value) || /^[A-Za-z][A-Za-z0-9+.-]*:\/\//.test(value)) {
37381
37447
  return null;
37382
37448
  }
37383
37449
  let candidate;
37384
- if (isWindowsAbsolutePath(value)) {
37385
- candidate = { value: path5.win32.normalize(value.replace(/\//g, "\\")), flavor: "windows" };
37386
- } else if (path5.posix.isAbsolute(value)) {
37387
- candidate = { value: path5.posix.normalize(value.replace(/\\/g, "/")), flavor: "posix" };
37450
+ if (isWindowsAbsolutePath2(value)) {
37451
+ candidate = { value: path6.win32.normalize(value.replace(/\//g, "\\")), flavor: "windows" };
37452
+ } else if (path6.posix.isAbsolute(value)) {
37453
+ candidate = { value: path6.posix.normalize(value.replace(/\\/g, "/")), flavor: "posix" };
37388
37454
  } else if (relativeRoot.flavor === "windows") {
37389
37455
  candidate = {
37390
- value: path5.win32.resolve(relativeRoot.value, value.replace(/\//g, "\\")),
37456
+ value: path6.win32.resolve(relativeRoot.value, value.replace(/\//g, "\\")),
37391
37457
  flavor: "windows"
37392
37458
  };
37393
37459
  } else {
37394
37460
  candidate = {
37395
- value: path5.posix.resolve(relativeRoot.value, value.replace(/\\/g, "/")),
37461
+ value: path6.posix.resolve(relativeRoot.value, value.replace(/\\/g, "/")),
37396
37462
  flavor: "posix"
37397
37463
  };
37398
37464
  }
@@ -37401,7 +37467,7 @@ function normalizeReportedPath(value, relativeRoot, roots) {
37401
37467
  }
37402
37468
  function findDiffDisplayRoot(cwd) {
37403
37469
  if (!isNativePathFlavor(cwd.flavor)) return cwd;
37404
- const pathImplementation = cwd.flavor === "windows" ? path5.win32 : path5.posix;
37470
+ const pathImplementation = cwd.flavor === "windows" ? path6.win32 : path6.posix;
37405
37471
  let current = cwd.value;
37406
37472
  while (true) {
37407
37473
  if (fs2.existsSync(pathImplementation.join(current, ".git"))) {
@@ -37422,23 +37488,23 @@ function canonicalizeReportedPath(candidate) {
37422
37488
  if (!isNativePathFlavor(candidate.flavor)) {
37423
37489
  return candidate;
37424
37490
  }
37425
- const parent = canonicalizeFromExistingAncestor(path5.dirname(candidate.value));
37426
- return { ...candidate, value: path5.resolve(parent, path5.basename(candidate.value)) };
37491
+ const parent = canonicalizeFromExistingAncestor(path6.dirname(candidate.value));
37492
+ return { ...candidate, value: path6.resolve(parent, path6.basename(candidate.value)) };
37427
37493
  }
37428
37494
  function canonicalizeFromExistingAncestor(value) {
37429
- const original = path5.resolve(value);
37495
+ const original = path6.resolve(value);
37430
37496
  let current = original;
37431
37497
  const missingSegments = [];
37432
37498
  while (true) {
37433
37499
  try {
37434
37500
  const canonical = fs2.realpathSync.native(current);
37435
- return path5.resolve(canonical, ...missingSegments.reverse());
37501
+ return path6.resolve(canonical, ...missingSegments.reverse());
37436
37502
  } catch (error62) {
37437
37503
  if (!isMissingPathError(error62)) return original;
37438
37504
  }
37439
- const parent = path5.dirname(current);
37505
+ const parent = path6.dirname(current);
37440
37506
  if (parent === current) return original;
37441
- missingSegments.push(path5.basename(current));
37507
+ missingSegments.push(path6.basename(current));
37442
37508
  current = parent;
37443
37509
  }
37444
37510
  }
@@ -37453,11 +37519,11 @@ function pathIsStrictlyInside(root, candidate) {
37453
37519
  if (root.flavor !== candidate.flavor) {
37454
37520
  return false;
37455
37521
  }
37456
- const pathImplementation = root.flavor === "windows" ? path5.win32 : path5.posix;
37522
+ const pathImplementation = root.flavor === "windows" ? path6.win32 : path6.posix;
37457
37523
  const relative = pathImplementation.relative(root.value, candidate.value);
37458
37524
  return relative.length > 0 && !pathImplementation.isAbsolute(relative) && relative !== ".." && !relative.startsWith(`..${pathImplementation.sep}`);
37459
37525
  }
37460
- function isWindowsAbsolutePath(value) {
37526
+ function isWindowsAbsolutePath2(value) {
37461
37527
  const portable = value.replace(/\\/g, "/");
37462
37528
  return /^[A-Za-z]:\//.test(portable) || /^\/\/[^/]+\/[^/]+(?:\/|$)/.test(portable);
37463
37529
  }
@@ -37487,7 +37553,7 @@ function createSessionNotice(severity, title, description) {
37487
37553
  }
37488
37554
 
37489
37555
  // src/SessionIndexMutations.ts
37490
- import path6 from "node:path";
37556
+ import path7 from "node:path";
37491
37557
  var ARCHIVED_SESSIONS_DIR = "archived_sessions";
37492
37558
  function isMissingThreadError(err) {
37493
37559
  return isUnknownThreadError(err) || isThreadNotFoundError(err);
@@ -37553,8 +37619,8 @@ async function readThreadArchived(client, threadId, codexHome) {
37553
37619
  }
37554
37620
  function isArchivedRolloutPath(threadPath, codexHome) {
37555
37621
  if (codexHome !== null) {
37556
- const relative = path6.relative(path6.join(codexHome, ARCHIVED_SESSIONS_DIR), threadPath);
37557
- if (relative !== "" && !relative.startsWith("..") && !path6.isAbsolute(relative)) return true;
37622
+ const relative = path7.relative(path7.join(codexHome, ARCHIVED_SESSIONS_DIR), threadPath);
37623
+ if (relative !== "" && !relative.startsWith("..") && !path7.isAbsolute(relative)) return true;
37558
37624
  }
37559
37625
  return threadPath.replace(/\\/g, "/").split("/").includes(ARCHIVED_SESSIONS_DIR);
37560
37626
  }
@@ -40409,13 +40475,13 @@ function parseMcpStartupAwaitTimeoutMs(meta3) {
40409
40475
 
40410
40476
  // node_modules/open/index.js
40411
40477
  import process10 from "node:process";
40412
- import path8 from "node:path";
40478
+ import path9 from "node:path";
40413
40479
  import { fileURLToPath } from "node:url";
40414
40480
  import childProcess4 from "node:child_process";
40415
40481
  import fs7, { constants as fsConstants2 } from "node:fs/promises";
40416
40482
 
40417
40483
  // node_modules/wsl-utils/index.js
40418
- import path7 from "node:path";
40484
+ import path8 from "node:path";
40419
40485
  import { promisify as promisify2 } from "node:util";
40420
40486
  import childProcess2 from "node:child_process";
40421
40487
  import fs6, { constants as fsConstants } from "node:fs/promises";
@@ -40595,7 +40661,7 @@ var wslDefaultBrowser = async () => {
40595
40661
  const command = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
40596
40662
  const { stdout } = await executePowerShell(command, {
40597
40663
  powerShellPath: psPath,
40598
- cwd: path7.dirname(psPath)
40664
+ cwd: path8.dirname(psPath)
40599
40665
  });
40600
40666
  return stdout.trim();
40601
40667
  };
@@ -40803,8 +40869,8 @@ var is_in_ssh_default = isInSsh;
40803
40869
 
40804
40870
  // node_modules/open/index.js
40805
40871
  var fallbackAttemptSymbol = /* @__PURE__ */ Symbol("fallbackAttempt");
40806
- var __dirname = import.meta.url ? path8.dirname(fileURLToPath(import.meta.url)) : "";
40807
- var localXdgOpenPath = path8.join(__dirname, "xdg-open");
40872
+ var __dirname = import.meta.url ? path9.dirname(fileURLToPath(import.meta.url)) : "";
40873
+ var localXdgOpenPath = path9.join(__dirname, "xdg-open");
40808
40874
  var { platform, arch } = process10;
40809
40875
  var tryEachApp = async (apps2, opener) => {
40810
40876
  if (apps2.length === 0) {
@@ -40947,7 +41013,7 @@ var baseOpen = async (options) => {
40947
41013
  childProcessOptions.stdio = "ignore";
40948
41014
  }
40949
41015
  if (is_wsl_default) {
40950
- childProcessOptions.cwd = path8.dirname(command);
41016
+ childProcessOptions.cwd = path9.dirname(command);
40951
41017
  }
40952
41018
  } else {
40953
41019
  if (app) {
@@ -41256,7 +41322,7 @@ var package_default = {
41256
41322
  publishConfig: {
41257
41323
  access: "public"
41258
41324
  },
41259
- version: "2.5.1-preview.13",
41325
+ version: "2.5.1-preview.14",
41260
41326
  description: "",
41261
41327
  main: "dist/index.js",
41262
41328
  bin: {
@@ -41366,56 +41432,6 @@ function createCodexCollaborationMode(mode, currentModelId) {
41366
41432
  };
41367
41433
  }
41368
41434
 
41369
- // src/PathUtils.ts
41370
- import path9 from "node:path";
41371
- function isAbsoluteProtocolPath(value) {
41372
- return !value.includes("\0") && (path9.posix.isAbsolute(value) || isWindowsAbsolutePath2(value));
41373
- }
41374
- function isAbsolutePathLike(value) {
41375
- return isAbsoluteProtocolPath(value.trim());
41376
- }
41377
- function arePathsEqual(left, right) {
41378
- return normalizePathForComparison(left) === normalizePathForComparison(right);
41379
- }
41380
- function arePathBasenamesEqual(left, right) {
41381
- const leftBase = path9.posix.basename(normalizePathForComparison(left));
41382
- const rightBase = path9.posix.basename(normalizePathForComparison(right));
41383
- if (shouldComparePathCaseInsensitive(left) || shouldComparePathCaseInsensitive(right)) {
41384
- return leftBase.toLowerCase() === rightBase.toLowerCase();
41385
- }
41386
- return leftBase === rightBase;
41387
- }
41388
- function normalizePathForComparison(value) {
41389
- const trimmed = value.trim();
41390
- if (trimmed.length === 0) {
41391
- return "";
41392
- }
41393
- if (isWindowsAbsolutePath2(trimmed)) {
41394
- const normalized2 = path9.win32.normalize(trimmed).replace(/\\/g, "/");
41395
- return trimTrailingPathSeparators(normalized2).toLowerCase();
41396
- }
41397
- const pathForComparison = path9.isAbsolute(trimmed) ? trimmed : trimmed.replace(/\\/g, "/");
41398
- const normalized = path9.posix.normalize(pathForComparison);
41399
- return trimTrailingPathSeparators(normalized);
41400
- }
41401
- function isWindowsAbsolutePath2(value) {
41402
- const portableValue = value.replace(/\\/g, "/");
41403
- return /^[A-Za-z]:\//.test(portableValue) || /^\/\/[^/]+\/[^/]+/.test(portableValue);
41404
- }
41405
- function shouldComparePathCaseInsensitive(value) {
41406
- return isWindowsAbsolutePath2(value) || /^[A-Za-z]:/.test(value) || value.includes("\\");
41407
- }
41408
- function trimTrailingPathSeparators(value) {
41409
- let trimmed = value;
41410
- while (trimmed.endsWith("/") && !isRootPath(trimmed)) {
41411
- trimmed = trimmed.slice(0, -1);
41412
- }
41413
- return trimmed;
41414
- }
41415
- function isRootPath(value) {
41416
- return value === "/" || /^[A-Za-z]:\/$/.test(value) || /^\/\/[^/]+\/[^/]+\/$/.test(value);
41417
- }
41418
-
41419
41435
  // src/subagents/CodexSubagentSubscriptions.ts
41420
41436
  var CodexSubagentSubscriptions = class {
41421
41437
  constructor(client) {
@@ -50206,7 +50222,7 @@ var CodexAcpServer = class {
50206
50222
  async readSubagentConfiguration(threadId, parentThreadId) {
50207
50223
  const thread = await this.codexAcpClient.readSubagentThread(threadId);
50208
50224
  if (!thread || thread.id !== threadId || thread.parentThreadId !== parentThreadId || thread.status.type === "notLoaded") return null;
50209
- return { model: thread.model, effort: thread.reasoningEffort };
50225
+ return { model: thread.model, effort: thread.reasoningEffort, cwd: thread.cwd };
50210
50226
  }
50211
50227
  getSubagentInteractionHandlers(router, rootSessionId) {
50212
50228
  const existing = this.subagentInteractionHandlers.get(router);
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "2.5.1-preview.13",
6
+ "version": "2.5.1-preview.14",
7
7
  "description": "",
8
8
  "main": "dist/index.js",
9
9
  "bin": {