@codexhost/cli-darwin-arm64 0.17.0 → 0.17.2

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),
@@ -16032,6 +16032,21 @@ var threadSteeringInspectParamsSchema = external_exports.object({
16032
16032
  /** The text about to be steered; a Harness command always stops and restarts. */
16033
16033
  text: external_exports.string().optional()
16034
16034
  }).strict();
16035
+ var threadSteeringContextSchema = external_exports.object({
16036
+ kind: external_exports.literal("application"),
16037
+ value: external_exports.string().transform((text4, context) => {
16038
+ try {
16039
+ return JSON.parse(text4);
16040
+ } catch {
16041
+ context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
16042
+ return external_exports.NEVER;
16043
+ }
16044
+ }).pipe(external_exports.object({
16045
+ expectedTurnId: hostTurnIdSchema,
16046
+ clientUserMessageId: external_exports.string().min(1),
16047
+ delivery: external_exports.enum(["newTurn", "activeTurn"])
16048
+ }).strict())
16049
+ }).strict().transform((context) => context.value);
16035
16050
  var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
16036
16051
  var threadSteeringInspectResultSchema = external_exports.object({
16037
16052
  delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
@@ -16719,8 +16734,8 @@ async function readCandidate(file2, signal) {
16719
16734
  const message3 = isRecord(entry.message) ? entry.message : null;
16720
16735
  if (!firstMessage && entry.type === "message" && message3?.role === "user") {
16721
16736
  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);
16737
+ 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(" ") : "";
16738
+ firstMessage = sessionImportTitle(text4);
16724
16739
  }
16725
16740
  hasUser = entry.type === "message" && message3?.role === "user" || typeof entry.parentId === "string" && entries.get(entry.parentId) === true;
16726
16741
  entries.set(entry.id, hasUser);
@@ -17233,8 +17248,8 @@ function liveHarnessCommandPrompt(catalog, idPrefix, commandId, argumentText) {
17233
17248
  const descriptor = catalog.commands.find(({ id }) => id === commandId);
17234
17249
  if (!descriptor)
17235
17250
  return null;
17236
- const text3 = typeof argumentText === "string" ? argumentText.trim() : "";
17237
- return text3 ? `${descriptor.invocation} ${text3}` : descriptor.invocation;
17251
+ const text4 = typeof argumentText === "string" ? argumentText.trim() : "";
17252
+ return text4 ? `${descriptor.invocation} ${text4}` : descriptor.invocation;
17238
17253
  }
17239
17254
  function mergeLiveHarnessCommands(builtIns, idPrefix, live, exclusions = {}) {
17240
17255
  if (!live)
@@ -17370,16 +17385,16 @@ var Diff = class {
17370
17385
  }
17371
17386
  }
17372
17387
  }
17373
- addToPath(path17, added, removed, oldPosInc, options) {
17374
- const last = path17.lastComponent;
17388
+ addToPath(path18, added, removed, oldPosInc, options) {
17389
+ const last = path18.lastComponent;
17375
17390
  if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
17376
17391
  return {
17377
- oldPos: path17.oldPos + oldPosInc,
17392
+ oldPos: path18.oldPos + oldPosInc,
17378
17393
  lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
17379
17394
  };
17380
17395
  } else {
17381
17396
  return {
17382
- oldPos: path17.oldPos + oldPosInc,
17397
+ oldPos: path18.oldPos + oldPosInc,
17383
17398
  lastComponent: { count: 1, added, removed, previousComponent: last }
17384
17399
  };
17385
17400
  }
@@ -17779,9 +17794,9 @@ function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader
17779
17794
  } }));
17780
17795
  }
17781
17796
  }
17782
- function splitLines(text3) {
17783
- const hasTrailingNl = text3.endsWith("\n");
17784
- const result = text3.split("\n").map((line) => line + "\n");
17797
+ function splitLines(text4) {
17798
+ const hasTrailingNl = text4.endsWith("\n");
17799
+ const result = text4.split("\n").map((line) => line + "\n");
17785
17800
  if (hasTrailingNl) {
17786
17801
  result.pop();
17787
17802
  } else {
@@ -18744,11 +18759,11 @@ ${entry.text}`);
18744
18759
  formatVersion: 1
18745
18760
  }),
18746
18761
  input: reply.task ? [{ type: "text", text: reply.task }] : [],
18747
- items: texts.map((text3, index) => ({
18762
+ items: texts.map((text4, index) => ({
18748
18763
  item: {
18749
18764
  type: "agentMessage",
18750
- text: text3,
18751
- itemId: hostItemIdSchema.parse(`pi-subagent-${createHash3("sha256").update(`${id}:${index}:${text3}`).digest("hex")}`)
18765
+ text: text4,
18766
+ itemId: hostItemIdSchema.parse(`pi-subagent-${createHash3("sha256").update(`${id}:${index}:${text4}`).digest("hex")}`)
18752
18767
  },
18753
18768
  outcome: { status: "succeeded" }
18754
18769
  })),
@@ -18908,13 +18923,13 @@ function textContent(content) {
18908
18923
  return "";
18909
18924
  return content.filter((part) => record4(part) && part.type === "text" && typeof part.text === "string").map((part) => part.text).join("");
18910
18925
  }
18911
- function boundedPiProgress(text3) {
18926
+ function boundedPiProgress(text4) {
18912
18927
  const limit = 64e3;
18913
- return text3.length <= limit ? text3 : `${text3.slice(0, limit)}
18928
+ return text4.length <= limit ? text4 : `${text4.slice(0, limit)}
18914
18929
  [Pi notification truncated]`;
18915
18930
  }
18916
- function visibleText(text3) {
18917
- return text3.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
18931
+ function visibleText(text4) {
18932
+ return text4.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
18918
18933
  }
18919
18934
  function noticeDisplay(value, fallback) {
18920
18935
  if (!record4(value) || !record4(value.details) || typeof value.details.summary !== "string")
@@ -18935,10 +18950,10 @@ function noticeDisplay(value, fallback) {
18935
18950
  function piCustomNoticeKey(value) {
18936
18951
  if (!record4(value) || value.type !== "custom_message" && value.role !== "custom" || value.display !== true || typeof value.customType !== "string")
18937
18952
  return null;
18938
- const text3 = textContent(value.content);
18939
- if (text3.trim().length === 0)
18953
+ const text4 = textContent(value.content);
18954
+ if (text4.trim().length === 0)
18940
18955
  return null;
18941
- return JSON.stringify([value.customType, text3]);
18956
+ return JSON.stringify([value.customType, text4]);
18942
18957
  }
18943
18958
  function piCustomNotice(value, sessionId, occurrences) {
18944
18959
  const key = piCustomNoticeKey(value);
@@ -18947,13 +18962,13 @@ function piCustomNotice(value, sessionId, occurrences) {
18947
18962
  const occurrence = occurrences.get(key) ?? 0;
18948
18963
  occurrences.set(key, occurrence + 1);
18949
18964
  const digest = createHash4("sha256").update(JSON.stringify([sessionId, key, occurrence])).digest("hex");
18950
- const [customType, text3] = JSON.parse(key);
18965
+ const [customType, text4] = JSON.parse(key);
18951
18966
  return {
18952
18967
  type: "progress.message",
18953
18968
  itemId: hostItemIdSchema.parse(`pi-notice-v1-${digest}`),
18954
18969
  text: boundedPiProgress(`Pi notification (${visibleText(customType)})
18955
18970
 
18956
- ${noticeDisplay(value, text3)}`)
18971
+ ${noticeDisplay(value, text4)}`)
18957
18972
  };
18958
18973
  }
18959
18974
  function piHistoryNotices(sessionId, entries) {
@@ -19114,8 +19129,8 @@ function itemOutcome(outcome) {
19114
19129
  return { status: "succeeded" };
19115
19130
  }
19116
19131
  function toolOutput(value) {
19117
- const text3 = textContent2(value);
19118
- return text3.length > 0 ? { content: [{ type: "text", text: text3 }] } : void 0;
19132
+ const text4 = textContent2(value);
19133
+ return text4.length > 0 ? { content: [{ type: "text", text: text4 }] } : void 0;
19119
19134
  }
19120
19135
  function historicalFileChanges(call, nativeMessage, toolItemId, cwd) {
19121
19136
  const items = [];
@@ -19160,7 +19175,7 @@ function snapshotItems(entries, messageIdentities, notices, outcome, subagents,
19160
19175
  continue;
19161
19176
  const content = Array.isArray(nativeMessage.content) ? nativeMessage.content : [];
19162
19177
  if (nativeMessage.role === "assistant") {
19163
- const text3 = textContent2(content);
19178
+ const text4 = textContent2(content);
19164
19179
  const reasoning = thinkingContent(content);
19165
19180
  let projectedText = false;
19166
19181
  let projectedReasoning = false;
@@ -19177,12 +19192,12 @@ function snapshotItems(entries, messageIdentities, notices, outcome, subagents,
19177
19192
  projectedReasoning = true;
19178
19193
  continue;
19179
19194
  }
19180
- if (part.type === "text" && !projectedText && text3.length > 0) {
19195
+ if (part.type === "text" && !projectedText && text4.length > 0) {
19181
19196
  const phase = piAssistantPhase(nativeMessage);
19182
19197
  const item2 = {
19183
19198
  type: "agentMessage",
19184
19199
  itemId: piMessageItemId(messageIdentities.get(entry.id), "assistant") ?? itemId(entry.id, "assistant", 0),
19185
- text: text3,
19200
+ text: text4,
19186
19201
  ...phase ? { phase } : {}
19187
19202
  };
19188
19203
  snapshots.push({ item: item2, outcome: itemOutcome(outcome) });
@@ -20321,7 +20336,7 @@ async function readPiEmptySessionConfiguration(sessionFile) {
20321
20336
 
20322
20337
  // dist/pi-adapter.js
20323
20338
  import { randomUUID as randomUUID7 } from "node:crypto";
20324
- import path16 from "node:path";
20339
+ import path17 from "node:path";
20325
20340
 
20326
20341
  // dist/pi-workflow-child-history.js
20327
20342
  import { createHash as createHash6 } from "node:crypto";
@@ -20628,7 +20643,7 @@ async function rollbackPiLastTurn(transport, sourceSessionId, cwd) {
20628
20643
  // dist/pi-rpc-session.js
20629
20644
  import { spawn, spawnSync } from "node:child_process";
20630
20645
  import { randomUUID as randomUUID6 } from "node:crypto";
20631
- import path15 from "node:path";
20646
+ import path16 from "node:path";
20632
20647
 
20633
20648
  // dist/pi-slash-commands.js
20634
20649
  var DYNAMIC_ID_PREFIX = "pi.slash.";
@@ -20674,6 +20689,118 @@ function piDynamicCommandPrompt(catalog, commandId, argumentText) {
20674
20689
  return liveHarnessCommandPrompt(catalog, DYNAMIC_ID_PREFIX, commandId, argumentText);
20675
20690
  }
20676
20691
 
20692
+ // dist/pi-unc-launch.js
20693
+ import fs3 from "node:fs";
20694
+ import path15 from "node:path";
20695
+ function isWindowsUncDirectory(directory) {
20696
+ return /^\\\\(?:\?\\UNC\\)?(?![?.]\\)[^\\]+\\[^\\]+(?:\\|$)/iu.test(path15.win32.normalize(directory));
20697
+ }
20698
+ function text3(file2) {
20699
+ try {
20700
+ return fs3.readFileSync(file2, "utf8").replace(/^\uFEFF/u, "").replaceAll("\r\n", "\n").trim();
20701
+ } catch {
20702
+ return void 0;
20703
+ }
20704
+ }
20705
+ function isFile(file2) {
20706
+ try {
20707
+ return fs3.statSync(file2).isFile();
20708
+ } catch {
20709
+ return false;
20710
+ }
20711
+ }
20712
+ function nodeOnPath(environment) {
20713
+ for (const directory of pathDirectories(environment, "win32")) {
20714
+ for (const extension of executableExtensions("node", "win32", environment)) {
20715
+ const suffix = extension.toLowerCase();
20716
+ const candidate = path15.join(directory, `node${suffix}`);
20717
+ if (!isFile(candidate))
20718
+ continue;
20719
+ if (suffix !== ".exe" && suffix !== ".com") {
20720
+ throw new Error("Pi PATH Node launcher cannot safely bypass CMD in a UNC directory");
20721
+ }
20722
+ return candidate;
20723
+ }
20724
+ }
20725
+ return process.execPath;
20726
+ }
20727
+ function npmShim(target, pathExtFix = false) {
20728
+ return `@ECHO off
20729
+ GOTO start
20730
+ :find_dp0
20731
+ SET dp0=%~dp0
20732
+ EXIT /b
20733
+ :start
20734
+ SETLOCAL
20735
+ CALL :find_dp0
20736
+
20737
+ IF EXIST "%dp0%\\node.exe" (
20738
+ SET "_prog=%dp0%\\node.exe"
20739
+ ) ELSE (
20740
+ SET "_prog=node"
20741
+ ${pathExtFix ? "" : " SET PATHEXT=%PATHEXT:;.JS;=;%\n"})
20742
+
20743
+ endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & ${pathExtFix ? "set PATHEXT=%PATHEXT:;.JS;=;% & " : ""}"%_prog%" "%dp0%\\${target}" %*`;
20744
+ }
20745
+ var standaloneNodeSetup = 'IF EXIST "%LOCALAPPDATA%\\pi-node\\current\\node.exe" SET "node=%LOCALAPPDATA%\\pi-node\\current\\node.exe"';
20746
+ function managedShim(standalone) {
20747
+ return `@ECHO off
20748
+ SETLOCAL
20749
+ SET "node=node"
20750
+ ${standalone ? `${standaloneNodeSetup}
20751
+ ` : ""}"%node%" "%~dp0pi-launcher.js" %*
20752
+ SET "pi_exit_code=%ERRORLEVEL%"
20753
+ IF "%pi_exit_code%"=="9009" (
20754
+ IF "%node%"=="node" (
20755
+ "%SystemRoot%\\System32\\where.exe" /Q node
20756
+ IF ERRORLEVEL 1 GOTO node_missing
20757
+ ) ELSE IF NOT EXIST "%node%" GOTO node_missing
20758
+ )
20759
+ EXIT /B %pi_exit_code%
20760
+ :node_missing
20761
+ 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
20762
+ EXIT /B %pi_exit_code%`;
20763
+ }
20764
+ function piUncNodeInvocation(command, arguments_, environment) {
20765
+ const directory = path15.dirname(command);
20766
+ const source = text3(command);
20767
+ if (path15.isAbsolute(command) && path15.win32.basename(command).toLowerCase() === "pi.cmd" && source !== void 0) {
20768
+ const packageDirectory = path15.join(directory, "node_modules", "@earendil-works", "pi-coding-agent");
20769
+ try {
20770
+ const manifest = JSON.parse(text3(path15.join(packageDirectory, "package.json")) ?? "");
20771
+ if (typeof manifest === "object" && manifest !== null && "name" in manifest && manifest.name === "@earendil-works/pi-coding-agent") {
20772
+ const entry = findPiCliEntry(packageDirectory);
20773
+ const target = entry && path15.relative(directory, entry).replaceAll("/", "\\");
20774
+ if (entry && target && [npmShim(target), npmShim(target, true)].includes(source)) {
20775
+ const localNode = path15.join(directory, "node.exe");
20776
+ return {
20777
+ command: isFile(localNode) ? localNode : nodeOnPath(environment),
20778
+ arguments: [entry, ...arguments_],
20779
+ windowsVerbatimArguments: false
20780
+ };
20781
+ }
20782
+ }
20783
+ } catch {
20784
+ }
20785
+ const launcher = path15.join(directory, "pi-launcher.js");
20786
+ try {
20787
+ const marker = JSON.parse(text3(path15.join(path15.dirname(directory), "install", "managed-install.json")) ?? "");
20788
+ 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))) {
20789
+ const localAppData = environmentValue(environment, "LOCALAPPDATA");
20790
+ const standaloneNode = localAppData ? path15.join(localAppData, "pi-node", "current", "node.exe") : void 0;
20791
+ return {
20792
+ command: source === managedShim(true) && standaloneNode && isFile(standaloneNode) ? standaloneNode : nodeOnPath(environment),
20793
+ // The native launcher reads current-version and sets PI_MANAGED_INSTALL_ROOT itself.
20794
+ arguments: [launcher, ...arguments_],
20795
+ windowsVerbatimArguments: false
20796
+ };
20797
+ }
20798
+ } catch {
20799
+ }
20800
+ }
20801
+ 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.");
20802
+ }
20803
+
20677
20804
  // dist/pi-content-stream.js
20678
20805
  var PiContentStreamConflictError = class extends Error {
20679
20806
  };
@@ -20701,7 +20828,7 @@ var PiContentStream = class {
20701
20828
  }
20702
20829
  finalize(blocks) {
20703
20830
  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("") }];
20831
+ blocks = this.#legacyBlockIndex > 0 ? blocks.map(({ text: text4 }, index) => ({ index, text: text4 })) : [{ index: 0, text: blocks.map(({ text: text4 }) => text4).join("") }];
20705
20832
  }
20706
20833
  const indices = new Set(blocks.map(({ index }) => index));
20707
20834
  for (const [index, block] of this.#blocks) {
@@ -20711,8 +20838,8 @@ var PiContentStream = class {
20711
20838
  this.#conflict();
20712
20839
  this.#blocks.delete(index);
20713
20840
  }
20714
- for (const { index, text: text3 } of blocks)
20715
- this.#finish(index, text3);
20841
+ for (const { index, text: text4 } of blocks)
20842
+ this.#finish(index, text4);
20716
20843
  return this.#flush();
20717
20844
  }
20718
20845
  #key(index) {
@@ -20994,15 +21121,15 @@ function extractReasoningText(content) {
20994
21121
  return null;
20995
21122
  const type = String(content.type ?? "");
20996
21123
  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;
21124
+ const text4 = content.thinking ?? content.reasoning ?? content.text ?? content.delta;
21125
+ return typeof text4 === "string" ? text4 : null;
20999
21126
  }
21000
21127
  return null;
21001
21128
  }
21002
21129
  function assistantReasoning(value) {
21003
21130
  if (!isRecord9(value) || value.role !== "assistant" || !Array.isArray(value.content))
21004
21131
  return null;
21005
- return value.content.map(extractReasoningText).filter((text3) => typeof text3 === "string").join("");
21132
+ return value.content.map(extractReasoningText).filter((text4) => typeof text4 === "string").join("");
21006
21133
  }
21007
21134
  function assistantFailure(value) {
21008
21135
  if (!isRecord9(value) || value.role !== "assistant")
@@ -21069,10 +21196,17 @@ function piRpcProcessCommand(options, dependencies = {}) {
21069
21196
  ...thinkingArguments,
21070
21197
  ...sessionArguments
21071
21198
  ];
21072
- const extension = path15.win32.extname(command).toLowerCase();
21199
+ const extension = path16.win32.extname(command).toLowerCase();
21073
21200
  if (platform !== "win32" || ![".cmd", ".bat"].includes(extension)) {
21074
21201
  return { command, arguments: arguments_, windowsVerbatimArguments: false };
21075
21202
  }
21203
+ if (isWindowsUncDirectory(options.cwd)) {
21204
+ try {
21205
+ return piUncNodeInvocation(command, arguments_, options.environment);
21206
+ } catch (error51) {
21207
+ throw new PiRpcFaultError("unavailable", message2(error51));
21208
+ }
21209
+ }
21076
21210
  const quote = (value) => `"${value.replaceAll("%", "%%").replaceAll('"', '""')}"`;
21077
21211
  const commandLine = [command, ...arguments_].map(quote).join(" ");
21078
21212
  return {
@@ -21426,13 +21560,13 @@ var PiRpcSession = class {
21426
21560
  throw fault;
21427
21561
  }
21428
21562
  }
21429
- async runTurn(text3, onEvent) {
21563
+ async runTurn(text4, onEvent) {
21430
21564
  if (!this.#child || !this.#state || this.#closed || this.#failed) {
21431
21565
  throw new Error("Pi RPC Session is unavailable");
21432
21566
  }
21433
21567
  if (this.isBusy)
21434
21568
  throw new PiRpcBusyError();
21435
- if (text3.length === 0)
21569
+ if (text4.length === 0)
21436
21570
  throw new Error("Pi text Turn must not be empty");
21437
21571
  const settled = new Promise((resolve, reject) => {
21438
21572
  this.#activeTurn = {
@@ -21467,7 +21601,7 @@ var PiRpcSession = class {
21467
21601
  });
21468
21602
  try {
21469
21603
  this.#drainProgress(onEvent);
21470
- await this.#send("prompt", { message: text3 });
21604
+ await this.#send("prompt", { message: text4 });
21471
21605
  } catch (error51) {
21472
21606
  this.#rejectActiveTurn(error51 instanceof Error ? error51 : new Error(message2(error51)));
21473
21607
  }
@@ -21819,16 +21953,17 @@ var PiRpcSession = class {
21819
21953
  return true;
21820
21954
  this.#extensionStatuses.set(value.statusKey, value.statusText);
21821
21955
  }
21956
+ return true;
21822
21957
  }
21823
- const text3 = piStatusText(value);
21824
- if (!text3)
21958
+ const text4 = piStatusText(value);
21959
+ if (!text4)
21825
21960
  return false;
21826
21961
  if (value.type === "extension_ui_request" && typeof value.id === "string" && !this.#acceptNoticeFrame(JSON.stringify([value.type, value.id])))
21827
21962
  return true;
21828
21963
  this.#publishProgress({
21829
21964
  type: "progress.message",
21830
21965
  itemId: hostItemIdSchema.parse(`pi-progress-${randomUUID6()}`),
21831
- text: text3
21966
+ text: text4
21832
21967
  }, value.method === "setStatus" && typeof value.statusKey === "string" ? value.statusKey : void 0);
21833
21968
  return true;
21834
21969
  }
@@ -22231,8 +22366,8 @@ var PiRpcSession = class {
22231
22366
  const content = value.content;
22232
22367
  if (failure === null || !active.sawStreamedMessageReasoning) {
22233
22368
  this.#emitContent(active, true, active.reasoningStream.finalize(content.flatMap((part, index) => {
22234
- const text3 = extractReasoningText(part);
22235
- return text3 === null ? [] : [{ index, text: text3 }];
22369
+ const text4 = extractReasoningText(part);
22370
+ return text4 === null ? [] : [{ index, text: text4 }];
22236
22371
  })));
22237
22372
  }
22238
22373
  if (active.reasoningMessageOpen && active.failure === null) {
@@ -22499,20 +22634,20 @@ function nativeText(value) {
22499
22634
  return value;
22500
22635
  if (!isRecord10(value) || !Array.isArray(value.content))
22501
22636
  return "";
22502
- return value.content.filter((content) => isRecord10(content) && content.type === "text" && typeof content.text === "string").map(({ text: text3 }) => text3).join("");
22637
+ return value.content.filter((content) => isRecord10(content) && content.type === "text" && typeof content.text === "string").map(({ text: text4 }) => text4).join("");
22503
22638
  }
22504
22639
  function boundedOutput(value, limit) {
22505
- const text3 = nativeText(value);
22506
- if (text3.length === 0)
22640
+ const text4 = nativeText(value);
22641
+ if (text4.length === 0)
22507
22642
  return void 0;
22508
- const truncated = text3.length > limit;
22643
+ const truncated = text4.length > limit;
22509
22644
  return {
22510
- content: [{ type: "text", text: truncated ? text3.slice(0, limit) : text3 }],
22645
+ content: [{ type: "text", text: truncated ? text4.slice(0, limit) : text4 }],
22511
22646
  ...truncated ? { truncated: true } : {}
22512
22647
  };
22513
22648
  }
22514
22649
  function outputText(output) {
22515
- return output?.content.filter((content) => content.type === "text").map(({ text: text3 }) => text3).join("") ?? "";
22650
+ return output?.content.filter((content) => content.type === "text").map(({ text: text4 }) => text4).join("") ?? "";
22516
22651
  }
22517
22652
  function numberField(value, key) {
22518
22653
  if (!isRecord10(value))
@@ -22597,7 +22732,7 @@ var PiHarnessSession = class {
22597
22732
  return this.#transport?.state.sessionId === id;
22598
22733
  }
22599
22734
  async readSubagentHistory(cwd) {
22600
- if (this.#phase !== "open" || path16.resolve(cwd) !== path16.resolve(this.#cwd)) {
22735
+ if (this.#phase !== "open" || path17.resolve(cwd) !== path17.resolve(this.#cwd)) {
22601
22736
  throw new Error("Pi Subagent parent workspace or Session is unavailable");
22602
22737
  }
22603
22738
  return (await this.#ensureTransport()).getEntries();
@@ -22610,7 +22745,7 @@ var PiHarnessSession = class {
22610
22745
  return readGotgenesChild(history, transport.state.sessionId, id, this.#subagents.gotgenes.records.get(id));
22611
22746
  }
22612
22747
  async inspectSubagent(id, cwd) {
22613
- if (this.#phase !== "open" || path16.resolve(cwd) !== path16.resolve(this.#cwd)) {
22748
+ if (this.#phase !== "open" || path17.resolve(cwd) !== path17.resolve(this.#cwd)) {
22614
22749
  throw new Error("Pi Subagent parent workspace or Session is unavailable");
22615
22750
  }
22616
22751
  const transport = await this.#ensureTransport();
@@ -22688,8 +22823,8 @@ var PiHarnessSession = class {
22688
22823
  }
22689
22824
  };
22690
22825
  }
22691
- const text3 = command.input.map((input) => input.text).join("\n");
22692
- if (text3.length === 0) {
22826
+ const text4 = command.input.map((input) => input.text).join("\n");
22827
+ if (text4.length === 0) {
22693
22828
  return {
22694
22829
  ok: false,
22695
22830
  error: {
@@ -22751,7 +22886,7 @@ var PiHarnessSession = class {
22751
22886
  this.#active = active;
22752
22887
  this.#event({ type: "turn.started", turnId: command.turnId });
22753
22888
  this.#event({ type: "item.started", turnId: command.turnId, item });
22754
- void transport.runTurn(text3, (event) => this.#handleTurnEvent(active, event)).then(async (result) => {
22889
+ void transport.runTurn(text4, (event) => this.#handleTurnEvent(active, event)).then(async (result) => {
22755
22890
  active.settling = true;
22756
22891
  try {
22757
22892
  const identity = await this.#completedTurnIdentity(active, transport);
@@ -23650,16 +23785,16 @@ var PiHarnessSession = class {
23650
23785
  }
23651
23786
  active.agentMessageId = messageId;
23652
23787
  }
23653
- #appendText(active, text3) {
23788
+ #appendText(active, text4) {
23654
23789
  if (active.agentMessageId === null || !active.agentItem) {
23655
23790
  throw new Error("Pi Assistant text arrived outside an active message");
23656
23791
  }
23657
- active.agentItem = { ...active.agentItem, text: active.agentItem.text + text3 };
23792
+ active.agentItem = { ...active.agentItem, text: active.agentItem.text + text4 };
23658
23793
  this.#event({
23659
23794
  type: "item.updated",
23660
23795
  turnId: active.command.turnId,
23661
23796
  itemId: active.agentItem.itemId,
23662
- update: { type: "text.append", text: text3 }
23797
+ update: { type: "text.append", text: text4 }
23663
23798
  });
23664
23799
  }
23665
23800
  #completeAgentItem(active, outcome, completeEmpty) {
@@ -23670,8 +23805,8 @@ var PiHarnessSession = class {
23670
23805
  active.agentItem = null;
23671
23806
  this.#completeItem(active, item, outcome);
23672
23807
  }
23673
- #appendReasoning(active, text3, nativeMessageIdentity2) {
23674
- if (text3.length === 0)
23808
+ #appendReasoning(active, text4, nativeMessageIdentity2) {
23809
+ if (text4.length === 0)
23675
23810
  return;
23676
23811
  if (!active.reasoningItem) {
23677
23812
  active.reasoningItem = {
@@ -23687,13 +23822,13 @@ var PiHarnessSession = class {
23687
23822
  }
23688
23823
  active.reasoningItem = {
23689
23824
  ...active.reasoningItem,
23690
- text: active.reasoningItem.text + text3
23825
+ text: active.reasoningItem.text + text4
23691
23826
  };
23692
23827
  this.#event({
23693
23828
  type: "item.updated",
23694
23829
  turnId: active.command.turnId,
23695
23830
  itemId: active.reasoningItem.itemId,
23696
- update: { type: "text.append", text: text3 }
23831
+ update: { type: "text.append", text: text4 }
23697
23832
  });
23698
23833
  }
23699
23834
  #completeReasoning(active, outcome) {