@codexhost/cli-darwin-arm64 0.17.0 → 0.17.1

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.
@@ -1317,10 +1317,10 @@ function mergeDefs(...defs) {
1317
1317
  function cloneDef(schema) {
1318
1318
  return mergeDefs(schema._zod.def);
1319
1319
  }
1320
- function getElementAtPath(obj, path17) {
1321
- if (!path17)
1320
+ function getElementAtPath(obj, path18) {
1321
+ if (!path18)
1322
1322
  return obj;
1323
- return path17.reduce((acc, key) => acc?.[key], obj);
1323
+ return path18.reduce((acc, key) => acc?.[key], obj);
1324
1324
  }
1325
1325
  function promiseAllObject(promisesObj) {
1326
1326
  const keys = Object.keys(promisesObj);
@@ -1729,11 +1729,11 @@ function explicitlyAborted(x, startIndex = 0) {
1729
1729
  }
1730
1730
  return false;
1731
1731
  }
1732
- function prefixIssues(path17, issues) {
1732
+ function prefixIssues(path18, issues) {
1733
1733
  return issues.map((iss) => {
1734
1734
  var _a3;
1735
1735
  (_a3 = iss).path ?? (_a3.path = []);
1736
- iss.path.unshift(path17);
1736
+ iss.path.unshift(path18);
1737
1737
  return iss;
1738
1738
  });
1739
1739
  }
@@ -1880,16 +1880,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
1880
1880
  }
1881
1881
  function formatError(error51, mapper = (issue2) => issue2.message) {
1882
1882
  const fieldErrors = { _errors: [] };
1883
- const processError = (error52, path17 = []) => {
1883
+ const processError = (error52, path18 = []) => {
1884
1884
  for (const issue2 of error52.issues) {
1885
1885
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1886
- issue2.errors.map((issues) => processError({ issues }, [...path17, ...issue2.path]));
1886
+ issue2.errors.map((issues) => processError({ issues }, [...path18, ...issue2.path]));
1887
1887
  } else if (issue2.code === "invalid_key") {
1888
- processError({ issues: issue2.issues }, [...path17, ...issue2.path]);
1888
+ processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
1889
1889
  } else if (issue2.code === "invalid_element") {
1890
- processError({ issues: issue2.issues }, [...path17, ...issue2.path]);
1890
+ processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
1891
1891
  } else {
1892
- const fullpath = [...path17, ...issue2.path];
1892
+ const fullpath = [...path18, ...issue2.path];
1893
1893
  if (fullpath.length === 0) {
1894
1894
  fieldErrors._errors.push(mapper(issue2));
1895
1895
  } else {
@@ -1916,17 +1916,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
1916
1916
  }
1917
1917
  function treeifyError(error51, mapper = (issue2) => issue2.message) {
1918
1918
  const result = { errors: [] };
1919
- const processError = (error52, path17 = []) => {
1919
+ const processError = (error52, path18 = []) => {
1920
1920
  var _a3, _b;
1921
1921
  for (const issue2 of error52.issues) {
1922
1922
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1923
- issue2.errors.map((issues) => processError({ issues }, [...path17, ...issue2.path]));
1923
+ issue2.errors.map((issues) => processError({ issues }, [...path18, ...issue2.path]));
1924
1924
  } else if (issue2.code === "invalid_key") {
1925
- processError({ issues: issue2.issues }, [...path17, ...issue2.path]);
1925
+ processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
1926
1926
  } else if (issue2.code === "invalid_element") {
1927
- processError({ issues: issue2.issues }, [...path17, ...issue2.path]);
1927
+ processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
1928
1928
  } else {
1929
- const fullpath = [...path17, ...issue2.path];
1929
+ const fullpath = [...path18, ...issue2.path];
1930
1930
  if (fullpath.length === 0) {
1931
1931
  result.errors.push(mapper(issue2));
1932
1932
  continue;
@@ -1958,8 +1958,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
1958
1958
  }
1959
1959
  function toDotPath(_path) {
1960
1960
  const segs = [];
1961
- const path17 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1962
- for (const seg of path17) {
1961
+ const path18 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1962
+ for (const seg of path18) {
1963
1963
  if (typeof seg === "number")
1964
1964
  segs.push(`[${seg}]`);
1965
1965
  else if (typeof seg === "symbol")
@@ -8189,8 +8189,8 @@ function ko_default() {
8189
8189
  }
8190
8190
 
8191
8191
  // ../../../node_modules/zod/v4/locales/lt.js
8192
- var capitalizeFirstCharacter = (text3) => {
8193
- return text3.charAt(0).toUpperCase() + text3.slice(1);
8192
+ var capitalizeFirstCharacter = (text4) => {
8193
+ return text4.charAt(0).toUpperCase() + text4.slice(1);
8194
8194
  };
8195
8195
  function getUnitTypeFromNumber(number4) {
8196
8196
  const abs = Math.abs(number4);
@@ -14651,13 +14651,13 @@ function resolveRef(ref, ctx) {
14651
14651
  if (!ref.startsWith("#")) {
14652
14652
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
14653
14653
  }
14654
- const path17 = ref.slice(1).split("/").filter(Boolean);
14655
- if (path17.length === 0) {
14654
+ const path18 = ref.slice(1).split("/").filter(Boolean);
14655
+ if (path18.length === 0) {
14656
14656
  return ctx.rootSchema;
14657
14657
  }
14658
14658
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
14659
- if (path17[0] === defsKey) {
14660
- const key = path17[1];
14659
+ if (path18[0] === defsKey) {
14660
+ const key = path18[1];
14661
14661
  if (!key || !ctx.defs[key]) {
14662
14662
  throw new Error(`Reference not found: ${ref}`);
14663
14663
  }
@@ -15146,7 +15146,7 @@ var harnessDisplaySetSchema = external_exports.strictObject({
15146
15146
 
15147
15147
  // ../../shared-contracts/dist/harness-presentation.js
15148
15148
  var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
15149
- var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text3) => text3.trim().length > 0);
15149
+ var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text4) => text4.trim().length > 0);
15150
15150
  var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
15151
15151
  label: displayText(256).optional(),
15152
15152
  description: displayText(1024).optional()
@@ -15474,7 +15474,7 @@ var threadManualCompactionStartedSchema = external_exports.strictObject({
15474
15474
  var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
15475
15475
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
15476
15476
  var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
15477
- var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text3) => text3.length <= maximum));
15477
+ var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text4) => text4.length <= maximum));
15478
15478
  var composerIndicatorsSchema = external_exports.array(external_exports.object({
15479
15479
  kind: external_exports.literal("countdown"),
15480
15480
  id: external_exports.string().min(1).max(64),
@@ -16719,8 +16719,8 @@ async function readCandidate(file2, signal) {
16719
16719
  const message3 = isRecord(entry.message) ? entry.message : null;
16720
16720
  if (!firstMessage && entry.type === "message" && message3?.role === "user") {
16721
16721
  const content = message3.content;
16722
- const text3 = typeof content === "string" ? content : Array.isArray(content) ? content.filter((block) => isRecord(block) && block.type === "text" && typeof block.text === "string").map((block) => block.text).join(" ") : "";
16723
- firstMessage = sessionImportTitle(text3);
16722
+ const text4 = typeof content === "string" ? content : Array.isArray(content) ? content.filter((block) => isRecord(block) && block.type === "text" && typeof block.text === "string").map((block) => block.text).join(" ") : "";
16723
+ firstMessage = sessionImportTitle(text4);
16724
16724
  }
16725
16725
  hasUser = entry.type === "message" && message3?.role === "user" || typeof entry.parentId === "string" && entries.get(entry.parentId) === true;
16726
16726
  entries.set(entry.id, hasUser);
@@ -17233,8 +17233,8 @@ function liveHarnessCommandPrompt(catalog, idPrefix, commandId, argumentText) {
17233
17233
  const descriptor = catalog.commands.find(({ id }) => id === commandId);
17234
17234
  if (!descriptor)
17235
17235
  return null;
17236
- const text3 = typeof argumentText === "string" ? argumentText.trim() : "";
17237
- return text3 ? `${descriptor.invocation} ${text3}` : descriptor.invocation;
17236
+ const text4 = typeof argumentText === "string" ? argumentText.trim() : "";
17237
+ return text4 ? `${descriptor.invocation} ${text4}` : descriptor.invocation;
17238
17238
  }
17239
17239
  function mergeLiveHarnessCommands(builtIns, idPrefix, live, exclusions = {}) {
17240
17240
  if (!live)
@@ -17370,16 +17370,16 @@ var Diff = class {
17370
17370
  }
17371
17371
  }
17372
17372
  }
17373
- addToPath(path17, added, removed, oldPosInc, options) {
17374
- const last = path17.lastComponent;
17373
+ addToPath(path18, added, removed, oldPosInc, options) {
17374
+ const last = path18.lastComponent;
17375
17375
  if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
17376
17376
  return {
17377
- oldPos: path17.oldPos + oldPosInc,
17377
+ oldPos: path18.oldPos + oldPosInc,
17378
17378
  lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
17379
17379
  };
17380
17380
  } else {
17381
17381
  return {
17382
- oldPos: path17.oldPos + oldPosInc,
17382
+ oldPos: path18.oldPos + oldPosInc,
17383
17383
  lastComponent: { count: 1, added, removed, previousComponent: last }
17384
17384
  };
17385
17385
  }
@@ -17779,9 +17779,9 @@ function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader
17779
17779
  } }));
17780
17780
  }
17781
17781
  }
17782
- function splitLines(text3) {
17783
- const hasTrailingNl = text3.endsWith("\n");
17784
- const result = text3.split("\n").map((line) => line + "\n");
17782
+ function splitLines(text4) {
17783
+ const hasTrailingNl = text4.endsWith("\n");
17784
+ const result = text4.split("\n").map((line) => line + "\n");
17785
17785
  if (hasTrailingNl) {
17786
17786
  result.pop();
17787
17787
  } else {
@@ -18744,11 +18744,11 @@ ${entry.text}`);
18744
18744
  formatVersion: 1
18745
18745
  }),
18746
18746
  input: reply.task ? [{ type: "text", text: reply.task }] : [],
18747
- items: texts.map((text3, index) => ({
18747
+ items: texts.map((text4, index) => ({
18748
18748
  item: {
18749
18749
  type: "agentMessage",
18750
- text: text3,
18751
- itemId: hostItemIdSchema.parse(`pi-subagent-${createHash3("sha256").update(`${id}:${index}:${text3}`).digest("hex")}`)
18750
+ text: text4,
18751
+ itemId: hostItemIdSchema.parse(`pi-subagent-${createHash3("sha256").update(`${id}:${index}:${text4}`).digest("hex")}`)
18752
18752
  },
18753
18753
  outcome: { status: "succeeded" }
18754
18754
  })),
@@ -18908,13 +18908,13 @@ function textContent(content) {
18908
18908
  return "";
18909
18909
  return content.filter((part) => record4(part) && part.type === "text" && typeof part.text === "string").map((part) => part.text).join("");
18910
18910
  }
18911
- function boundedPiProgress(text3) {
18911
+ function boundedPiProgress(text4) {
18912
18912
  const limit = 64e3;
18913
- return text3.length <= limit ? text3 : `${text3.slice(0, limit)}
18913
+ return text4.length <= limit ? text4 : `${text4.slice(0, limit)}
18914
18914
  [Pi notification truncated]`;
18915
18915
  }
18916
- function visibleText(text3) {
18917
- return text3.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
18916
+ function visibleText(text4) {
18917
+ return text4.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
18918
18918
  }
18919
18919
  function noticeDisplay(value, fallback) {
18920
18920
  if (!record4(value) || !record4(value.details) || typeof value.details.summary !== "string")
@@ -18935,10 +18935,10 @@ function noticeDisplay(value, fallback) {
18935
18935
  function piCustomNoticeKey(value) {
18936
18936
  if (!record4(value) || value.type !== "custom_message" && value.role !== "custom" || value.display !== true || typeof value.customType !== "string")
18937
18937
  return null;
18938
- const text3 = textContent(value.content);
18939
- if (text3.trim().length === 0)
18938
+ const text4 = textContent(value.content);
18939
+ if (text4.trim().length === 0)
18940
18940
  return null;
18941
- return JSON.stringify([value.customType, text3]);
18941
+ return JSON.stringify([value.customType, text4]);
18942
18942
  }
18943
18943
  function piCustomNotice(value, sessionId, occurrences) {
18944
18944
  const key = piCustomNoticeKey(value);
@@ -18947,13 +18947,13 @@ function piCustomNotice(value, sessionId, occurrences) {
18947
18947
  const occurrence = occurrences.get(key) ?? 0;
18948
18948
  occurrences.set(key, occurrence + 1);
18949
18949
  const digest = createHash4("sha256").update(JSON.stringify([sessionId, key, occurrence])).digest("hex");
18950
- const [customType, text3] = JSON.parse(key);
18950
+ const [customType, text4] = JSON.parse(key);
18951
18951
  return {
18952
18952
  type: "progress.message",
18953
18953
  itemId: hostItemIdSchema.parse(`pi-notice-v1-${digest}`),
18954
18954
  text: boundedPiProgress(`Pi notification (${visibleText(customType)})
18955
18955
 
18956
- ${noticeDisplay(value, text3)}`)
18956
+ ${noticeDisplay(value, text4)}`)
18957
18957
  };
18958
18958
  }
18959
18959
  function piHistoryNotices(sessionId, entries) {
@@ -19114,8 +19114,8 @@ function itemOutcome(outcome) {
19114
19114
  return { status: "succeeded" };
19115
19115
  }
19116
19116
  function toolOutput(value) {
19117
- const text3 = textContent2(value);
19118
- return text3.length > 0 ? { content: [{ type: "text", text: text3 }] } : void 0;
19117
+ const text4 = textContent2(value);
19118
+ return text4.length > 0 ? { content: [{ type: "text", text: text4 }] } : void 0;
19119
19119
  }
19120
19120
  function historicalFileChanges(call, nativeMessage, toolItemId, cwd) {
19121
19121
  const items = [];
@@ -19160,7 +19160,7 @@ function snapshotItems(entries, messageIdentities, notices, outcome, subagents,
19160
19160
  continue;
19161
19161
  const content = Array.isArray(nativeMessage.content) ? nativeMessage.content : [];
19162
19162
  if (nativeMessage.role === "assistant") {
19163
- const text3 = textContent2(content);
19163
+ const text4 = textContent2(content);
19164
19164
  const reasoning = thinkingContent(content);
19165
19165
  let projectedText = false;
19166
19166
  let projectedReasoning = false;
@@ -19177,12 +19177,12 @@ function snapshotItems(entries, messageIdentities, notices, outcome, subagents,
19177
19177
  projectedReasoning = true;
19178
19178
  continue;
19179
19179
  }
19180
- if (part.type === "text" && !projectedText && text3.length > 0) {
19180
+ if (part.type === "text" && !projectedText && text4.length > 0) {
19181
19181
  const phase = piAssistantPhase(nativeMessage);
19182
19182
  const item2 = {
19183
19183
  type: "agentMessage",
19184
19184
  itemId: piMessageItemId(messageIdentities.get(entry.id), "assistant") ?? itemId(entry.id, "assistant", 0),
19185
- text: text3,
19185
+ text: text4,
19186
19186
  ...phase ? { phase } : {}
19187
19187
  };
19188
19188
  snapshots.push({ item: item2, outcome: itemOutcome(outcome) });
@@ -20321,7 +20321,7 @@ async function readPiEmptySessionConfiguration(sessionFile) {
20321
20321
 
20322
20322
  // dist/pi-adapter.js
20323
20323
  import { randomUUID as randomUUID7 } from "node:crypto";
20324
- import path16 from "node:path";
20324
+ import path17 from "node:path";
20325
20325
 
20326
20326
  // dist/pi-workflow-child-history.js
20327
20327
  import { createHash as createHash6 } from "node:crypto";
@@ -20628,7 +20628,7 @@ async function rollbackPiLastTurn(transport, sourceSessionId, cwd) {
20628
20628
  // dist/pi-rpc-session.js
20629
20629
  import { spawn, spawnSync } from "node:child_process";
20630
20630
  import { randomUUID as randomUUID6 } from "node:crypto";
20631
- import path15 from "node:path";
20631
+ import path16 from "node:path";
20632
20632
 
20633
20633
  // dist/pi-slash-commands.js
20634
20634
  var DYNAMIC_ID_PREFIX = "pi.slash.";
@@ -20674,6 +20674,118 @@ function piDynamicCommandPrompt(catalog, commandId, argumentText) {
20674
20674
  return liveHarnessCommandPrompt(catalog, DYNAMIC_ID_PREFIX, commandId, argumentText);
20675
20675
  }
20676
20676
 
20677
+ // dist/pi-unc-launch.js
20678
+ import fs3 from "node:fs";
20679
+ import path15 from "node:path";
20680
+ function isWindowsUncDirectory(directory) {
20681
+ return /^\\\\(?:\?\\UNC\\)?(?![?.]\\)[^\\]+\\[^\\]+(?:\\|$)/iu.test(path15.win32.normalize(directory));
20682
+ }
20683
+ function text3(file2) {
20684
+ try {
20685
+ return fs3.readFileSync(file2, "utf8").replace(/^\uFEFF/u, "").replaceAll("\r\n", "\n").trim();
20686
+ } catch {
20687
+ return void 0;
20688
+ }
20689
+ }
20690
+ function isFile(file2) {
20691
+ try {
20692
+ return fs3.statSync(file2).isFile();
20693
+ } catch {
20694
+ return false;
20695
+ }
20696
+ }
20697
+ function nodeOnPath(environment) {
20698
+ for (const directory of pathDirectories(environment, "win32")) {
20699
+ for (const extension of executableExtensions("node", "win32", environment)) {
20700
+ const suffix = extension.toLowerCase();
20701
+ const candidate = path15.join(directory, `node${suffix}`);
20702
+ if (!isFile(candidate))
20703
+ continue;
20704
+ if (suffix !== ".exe" && suffix !== ".com") {
20705
+ throw new Error("Pi PATH Node launcher cannot safely bypass CMD in a UNC directory");
20706
+ }
20707
+ return candidate;
20708
+ }
20709
+ }
20710
+ return process.execPath;
20711
+ }
20712
+ function npmShim(target, pathExtFix = false) {
20713
+ return `@ECHO off
20714
+ GOTO start
20715
+ :find_dp0
20716
+ SET dp0=%~dp0
20717
+ EXIT /b
20718
+ :start
20719
+ SETLOCAL
20720
+ CALL :find_dp0
20721
+
20722
+ IF EXIST "%dp0%\\node.exe" (
20723
+ SET "_prog=%dp0%\\node.exe"
20724
+ ) ELSE (
20725
+ SET "_prog=node"
20726
+ ${pathExtFix ? "" : " SET PATHEXT=%PATHEXT:;.JS;=;%\n"})
20727
+
20728
+ endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & ${pathExtFix ? "set PATHEXT=%PATHEXT:;.JS;=;% & " : ""}"%_prog%" "%dp0%\\${target}" %*`;
20729
+ }
20730
+ var standaloneNodeSetup = 'IF EXIST "%LOCALAPPDATA%\\pi-node\\current\\node.exe" SET "node=%LOCALAPPDATA%\\pi-node\\current\\node.exe"';
20731
+ function managedShim(standalone) {
20732
+ return `@ECHO off
20733
+ SETLOCAL
20734
+ SET "node=node"
20735
+ ${standalone ? `${standaloneNodeSetup}
20736
+ ` : ""}"%node%" "%~dp0pi-launcher.js" %*
20737
+ SET "pi_exit_code=%ERRORLEVEL%"
20738
+ IF "%pi_exit_code%"=="9009" (
20739
+ IF "%node%"=="node" (
20740
+ "%SystemRoot%\\System32\\where.exe" /Q node
20741
+ IF ERRORLEVEL 1 GOTO node_missing
20742
+ ) ELSE IF NOT EXIST "%node%" GOTO node_missing
20743
+ )
20744
+ EXIT /B %pi_exit_code%
20745
+ :node_missing
20746
+ ECHO Pi could not find Node.js. Install Node.js 22.19.0 or newer, or rerun the installer at https://pi.dev. 1>&2
20747
+ EXIT /B %pi_exit_code%`;
20748
+ }
20749
+ function piUncNodeInvocation(command, arguments_, environment) {
20750
+ const directory = path15.dirname(command);
20751
+ const source = text3(command);
20752
+ if (path15.isAbsolute(command) && path15.win32.basename(command).toLowerCase() === "pi.cmd" && source !== void 0) {
20753
+ const packageDirectory = path15.join(directory, "node_modules", "@earendil-works", "pi-coding-agent");
20754
+ try {
20755
+ const manifest = JSON.parse(text3(path15.join(packageDirectory, "package.json")) ?? "");
20756
+ if (typeof manifest === "object" && manifest !== null && "name" in manifest && manifest.name === "@earendil-works/pi-coding-agent") {
20757
+ const entry = findPiCliEntry(packageDirectory);
20758
+ const target = entry && path15.relative(directory, entry).replaceAll("/", "\\");
20759
+ if (entry && target && [npmShim(target), npmShim(target, true)].includes(source)) {
20760
+ const localNode = path15.join(directory, "node.exe");
20761
+ return {
20762
+ command: isFile(localNode) ? localNode : nodeOnPath(environment),
20763
+ arguments: [entry, ...arguments_],
20764
+ windowsVerbatimArguments: false
20765
+ };
20766
+ }
20767
+ }
20768
+ } catch {
20769
+ }
20770
+ const launcher = path15.join(directory, "pi-launcher.js");
20771
+ try {
20772
+ const marker = JSON.parse(text3(path15.join(path15.dirname(directory), "install", "managed-install.json")) ?? "");
20773
+ if (typeof marker === "object" && marker !== null && "kind" in marker && marker.kind === "pi-managed-install" && "schemaVersion" in marker && marker.schemaVersion === 1 && "layout" in marker && marker.layout === "releases-v1" && "entrypoint" in marker && typeof marker.entrypoint === "object" && marker.entrypoint !== null && "type" in marker.entrypoint && marker.entrypoint.type === "script" && "path" in marker.entrypoint && typeof marker.entrypoint.path === "string" && path15.isAbsolute(marker.entrypoint.path) && path15.resolve(marker.entrypoint.path).toLowerCase() === path15.resolve(command).toLowerCase() && isFile(launcher) && (source === managedShim(false) || source === managedShim(true))) {
20774
+ const localAppData = environmentValue(environment, "LOCALAPPDATA");
20775
+ const standaloneNode = localAppData ? path15.join(localAppData, "pi-node", "current", "node.exe") : void 0;
20776
+ return {
20777
+ command: source === managedShim(true) && standaloneNode && isFile(standaloneNode) ? standaloneNode : nodeOnPath(environment),
20778
+ // The native launcher reads current-version and sets PI_MANAGED_INSTALL_ROOT itself.
20779
+ arguments: [launcher, ...arguments_],
20780
+ windowsVerbatimArguments: false
20781
+ };
20782
+ }
20783
+ } catch {
20784
+ }
20785
+ }
20786
+ throw new Error("Pi batch launcher cannot safely start in a UNC working directory. Use a standard npm or managed Pi installation, a native Pi executable, or a Host running inside WSL; custom Pi or PATH Node batch launchers are not bypassed.");
20787
+ }
20788
+
20677
20789
  // dist/pi-content-stream.js
20678
20790
  var PiContentStreamConflictError = class extends Error {
20679
20791
  };
@@ -20701,7 +20813,7 @@ var PiContentStream = class {
20701
20813
  }
20702
20814
  finalize(blocks) {
20703
20815
  if (this.#indexed !== true) {
20704
- blocks = this.#legacyBlockIndex > 0 ? blocks.map(({ text: text3 }, index) => ({ index, text: text3 })) : [{ index: 0, text: blocks.map(({ text: text3 }) => text3).join("") }];
20816
+ blocks = this.#legacyBlockIndex > 0 ? blocks.map(({ text: text4 }, index) => ({ index, text: text4 })) : [{ index: 0, text: blocks.map(({ text: text4 }) => text4).join("") }];
20705
20817
  }
20706
20818
  const indices = new Set(blocks.map(({ index }) => index));
20707
20819
  for (const [index, block] of this.#blocks) {
@@ -20711,8 +20823,8 @@ var PiContentStream = class {
20711
20823
  this.#conflict();
20712
20824
  this.#blocks.delete(index);
20713
20825
  }
20714
- for (const { index, text: text3 } of blocks)
20715
- this.#finish(index, text3);
20826
+ for (const { index, text: text4 } of blocks)
20827
+ this.#finish(index, text4);
20716
20828
  return this.#flush();
20717
20829
  }
20718
20830
  #key(index) {
@@ -20994,15 +21106,15 @@ function extractReasoningText(content) {
20994
21106
  return null;
20995
21107
  const type = String(content.type ?? "");
20996
21108
  if (type === "thinking" || type === "reasoning" || type === "thought") {
20997
- const text3 = content.thinking ?? content.reasoning ?? content.text ?? content.delta;
20998
- return typeof text3 === "string" ? text3 : null;
21109
+ const text4 = content.thinking ?? content.reasoning ?? content.text ?? content.delta;
21110
+ return typeof text4 === "string" ? text4 : null;
20999
21111
  }
21000
21112
  return null;
21001
21113
  }
21002
21114
  function assistantReasoning(value) {
21003
21115
  if (!isRecord9(value) || value.role !== "assistant" || !Array.isArray(value.content))
21004
21116
  return null;
21005
- return value.content.map(extractReasoningText).filter((text3) => typeof text3 === "string").join("");
21117
+ return value.content.map(extractReasoningText).filter((text4) => typeof text4 === "string").join("");
21006
21118
  }
21007
21119
  function assistantFailure(value) {
21008
21120
  if (!isRecord9(value) || value.role !== "assistant")
@@ -21069,10 +21181,17 @@ function piRpcProcessCommand(options, dependencies = {}) {
21069
21181
  ...thinkingArguments,
21070
21182
  ...sessionArguments
21071
21183
  ];
21072
- const extension = path15.win32.extname(command).toLowerCase();
21184
+ const extension = path16.win32.extname(command).toLowerCase();
21073
21185
  if (platform !== "win32" || ![".cmd", ".bat"].includes(extension)) {
21074
21186
  return { command, arguments: arguments_, windowsVerbatimArguments: false };
21075
21187
  }
21188
+ if (isWindowsUncDirectory(options.cwd)) {
21189
+ try {
21190
+ return piUncNodeInvocation(command, arguments_, options.environment);
21191
+ } catch (error51) {
21192
+ throw new PiRpcFaultError("unavailable", message2(error51));
21193
+ }
21194
+ }
21076
21195
  const quote = (value) => `"${value.replaceAll("%", "%%").replaceAll('"', '""')}"`;
21077
21196
  const commandLine = [command, ...arguments_].map(quote).join(" ");
21078
21197
  return {
@@ -21426,13 +21545,13 @@ var PiRpcSession = class {
21426
21545
  throw fault;
21427
21546
  }
21428
21547
  }
21429
- async runTurn(text3, onEvent) {
21548
+ async runTurn(text4, onEvent) {
21430
21549
  if (!this.#child || !this.#state || this.#closed || this.#failed) {
21431
21550
  throw new Error("Pi RPC Session is unavailable");
21432
21551
  }
21433
21552
  if (this.isBusy)
21434
21553
  throw new PiRpcBusyError();
21435
- if (text3.length === 0)
21554
+ if (text4.length === 0)
21436
21555
  throw new Error("Pi text Turn must not be empty");
21437
21556
  const settled = new Promise((resolve, reject) => {
21438
21557
  this.#activeTurn = {
@@ -21467,7 +21586,7 @@ var PiRpcSession = class {
21467
21586
  });
21468
21587
  try {
21469
21588
  this.#drainProgress(onEvent);
21470
- await this.#send("prompt", { message: text3 });
21589
+ await this.#send("prompt", { message: text4 });
21471
21590
  } catch (error51) {
21472
21591
  this.#rejectActiveTurn(error51 instanceof Error ? error51 : new Error(message2(error51)));
21473
21592
  }
@@ -21819,16 +21938,17 @@ var PiRpcSession = class {
21819
21938
  return true;
21820
21939
  this.#extensionStatuses.set(value.statusKey, value.statusText);
21821
21940
  }
21941
+ return true;
21822
21942
  }
21823
- const text3 = piStatusText(value);
21824
- if (!text3)
21943
+ const text4 = piStatusText(value);
21944
+ if (!text4)
21825
21945
  return false;
21826
21946
  if (value.type === "extension_ui_request" && typeof value.id === "string" && !this.#acceptNoticeFrame(JSON.stringify([value.type, value.id])))
21827
21947
  return true;
21828
21948
  this.#publishProgress({
21829
21949
  type: "progress.message",
21830
21950
  itemId: hostItemIdSchema.parse(`pi-progress-${randomUUID6()}`),
21831
- text: text3
21951
+ text: text4
21832
21952
  }, value.method === "setStatus" && typeof value.statusKey === "string" ? value.statusKey : void 0);
21833
21953
  return true;
21834
21954
  }
@@ -22231,8 +22351,8 @@ var PiRpcSession = class {
22231
22351
  const content = value.content;
22232
22352
  if (failure === null || !active.sawStreamedMessageReasoning) {
22233
22353
  this.#emitContent(active, true, active.reasoningStream.finalize(content.flatMap((part, index) => {
22234
- const text3 = extractReasoningText(part);
22235
- return text3 === null ? [] : [{ index, text: text3 }];
22354
+ const text4 = extractReasoningText(part);
22355
+ return text4 === null ? [] : [{ index, text: text4 }];
22236
22356
  })));
22237
22357
  }
22238
22358
  if (active.reasoningMessageOpen && active.failure === null) {
@@ -22499,20 +22619,20 @@ function nativeText(value) {
22499
22619
  return value;
22500
22620
  if (!isRecord10(value) || !Array.isArray(value.content))
22501
22621
  return "";
22502
- return value.content.filter((content) => isRecord10(content) && content.type === "text" && typeof content.text === "string").map(({ text: text3 }) => text3).join("");
22622
+ return value.content.filter((content) => isRecord10(content) && content.type === "text" && typeof content.text === "string").map(({ text: text4 }) => text4).join("");
22503
22623
  }
22504
22624
  function boundedOutput(value, limit) {
22505
- const text3 = nativeText(value);
22506
- if (text3.length === 0)
22625
+ const text4 = nativeText(value);
22626
+ if (text4.length === 0)
22507
22627
  return void 0;
22508
- const truncated = text3.length > limit;
22628
+ const truncated = text4.length > limit;
22509
22629
  return {
22510
- content: [{ type: "text", text: truncated ? text3.slice(0, limit) : text3 }],
22630
+ content: [{ type: "text", text: truncated ? text4.slice(0, limit) : text4 }],
22511
22631
  ...truncated ? { truncated: true } : {}
22512
22632
  };
22513
22633
  }
22514
22634
  function outputText(output) {
22515
- return output?.content.filter((content) => content.type === "text").map(({ text: text3 }) => text3).join("") ?? "";
22635
+ return output?.content.filter((content) => content.type === "text").map(({ text: text4 }) => text4).join("") ?? "";
22516
22636
  }
22517
22637
  function numberField(value, key) {
22518
22638
  if (!isRecord10(value))
@@ -22597,7 +22717,7 @@ var PiHarnessSession = class {
22597
22717
  return this.#transport?.state.sessionId === id;
22598
22718
  }
22599
22719
  async readSubagentHistory(cwd) {
22600
- if (this.#phase !== "open" || path16.resolve(cwd) !== path16.resolve(this.#cwd)) {
22720
+ if (this.#phase !== "open" || path17.resolve(cwd) !== path17.resolve(this.#cwd)) {
22601
22721
  throw new Error("Pi Subagent parent workspace or Session is unavailable");
22602
22722
  }
22603
22723
  return (await this.#ensureTransport()).getEntries();
@@ -22610,7 +22730,7 @@ var PiHarnessSession = class {
22610
22730
  return readGotgenesChild(history, transport.state.sessionId, id, this.#subagents.gotgenes.records.get(id));
22611
22731
  }
22612
22732
  async inspectSubagent(id, cwd) {
22613
- if (this.#phase !== "open" || path16.resolve(cwd) !== path16.resolve(this.#cwd)) {
22733
+ if (this.#phase !== "open" || path17.resolve(cwd) !== path17.resolve(this.#cwd)) {
22614
22734
  throw new Error("Pi Subagent parent workspace or Session is unavailable");
22615
22735
  }
22616
22736
  const transport = await this.#ensureTransport();
@@ -22688,8 +22808,8 @@ var PiHarnessSession = class {
22688
22808
  }
22689
22809
  };
22690
22810
  }
22691
- const text3 = command.input.map((input) => input.text).join("\n");
22692
- if (text3.length === 0) {
22811
+ const text4 = command.input.map((input) => input.text).join("\n");
22812
+ if (text4.length === 0) {
22693
22813
  return {
22694
22814
  ok: false,
22695
22815
  error: {
@@ -22751,7 +22871,7 @@ var PiHarnessSession = class {
22751
22871
  this.#active = active;
22752
22872
  this.#event({ type: "turn.started", turnId: command.turnId });
22753
22873
  this.#event({ type: "item.started", turnId: command.turnId, item });
22754
- void transport.runTurn(text3, (event) => this.#handleTurnEvent(active, event)).then(async (result) => {
22874
+ void transport.runTurn(text4, (event) => this.#handleTurnEvent(active, event)).then(async (result) => {
22755
22875
  active.settling = true;
22756
22876
  try {
22757
22877
  const identity = await this.#completedTurnIdentity(active, transport);
@@ -23650,16 +23770,16 @@ var PiHarnessSession = class {
23650
23770
  }
23651
23771
  active.agentMessageId = messageId;
23652
23772
  }
23653
- #appendText(active, text3) {
23773
+ #appendText(active, text4) {
23654
23774
  if (active.agentMessageId === null || !active.agentItem) {
23655
23775
  throw new Error("Pi Assistant text arrived outside an active message");
23656
23776
  }
23657
- active.agentItem = { ...active.agentItem, text: active.agentItem.text + text3 };
23777
+ active.agentItem = { ...active.agentItem, text: active.agentItem.text + text4 };
23658
23778
  this.#event({
23659
23779
  type: "item.updated",
23660
23780
  turnId: active.command.turnId,
23661
23781
  itemId: active.agentItem.itemId,
23662
- update: { type: "text.append", text: text3 }
23782
+ update: { type: "text.append", text: text4 }
23663
23783
  });
23664
23784
  }
23665
23785
  #completeAgentItem(active, outcome, completeEmpty) {
@@ -23670,8 +23790,8 @@ var PiHarnessSession = class {
23670
23790
  active.agentItem = null;
23671
23791
  this.#completeItem(active, item, outcome);
23672
23792
  }
23673
- #appendReasoning(active, text3, nativeMessageIdentity2) {
23674
- if (text3.length === 0)
23793
+ #appendReasoning(active, text4, nativeMessageIdentity2) {
23794
+ if (text4.length === 0)
23675
23795
  return;
23676
23796
  if (!active.reasoningItem) {
23677
23797
  active.reasoningItem = {
@@ -23687,13 +23807,13 @@ var PiHarnessSession = class {
23687
23807
  }
23688
23808
  active.reasoningItem = {
23689
23809
  ...active.reasoningItem,
23690
- text: active.reasoningItem.text + text3
23810
+ text: active.reasoningItem.text + text4
23691
23811
  };
23692
23812
  this.#event({
23693
23813
  type: "item.updated",
23694
23814
  turnId: active.command.turnId,
23695
23815
  itemId: active.reasoningItem.itemId,
23696
- update: { type: "text.append", text: text3 }
23816
+ update: { type: "text.append", text: text4 }
23697
23817
  });
23698
23818
  }
23699
23819
  #completeReasoning(active, outcome) {