@karlorz/codexhost-cli-win32-x64 0.17.0-1 → 0.17.1-0
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.
- package/README.md +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-web.js +1 -1
- package/app/cpa-live-voice-hook.js +1 -1
- package/app/desktop-controller.mjs +910 -38
- package/app/host-runtime.mjs +911 -41
- package/app/plugins/antigravity/plugin.mjs +27 -7
- package/app/plugins/cursor-cli/plugin.mjs +19 -3
- package/app/plugins/kimi-code/plugin.mjs +50 -3
- package/app/plugins/pi/plugin.mjs +208 -88
- package/app/plugins/zcode/plugin.mjs +142 -9
- package/app/renderer-extension.js +1 -1
- package/bin/codexhost.exe +0 -0
- package/libexec/codexhost-node-repl.exe +0 -0
- package/libexec/codexhost-shim.exe +0 -0
- package/libexec/codexhost-updater.exe +0 -0
- package/package.json +1 -1
|
@@ -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,
|
|
1321
|
-
if (!
|
|
1320
|
+
function getElementAtPath(obj, path18) {
|
|
1321
|
+
if (!path18)
|
|
1322
1322
|
return obj;
|
|
1323
|
-
return
|
|
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(
|
|
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(
|
|
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,
|
|
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 }, [...
|
|
1886
|
+
issue2.errors.map((issues) => processError({ issues }, [...path18, ...issue2.path]));
|
|
1887
1887
|
} else if (issue2.code === "invalid_key") {
|
|
1888
|
-
processError({ issues: issue2.issues }, [...
|
|
1888
|
+
processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
|
|
1889
1889
|
} else if (issue2.code === "invalid_element") {
|
|
1890
|
-
processError({ issues: issue2.issues }, [...
|
|
1890
|
+
processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
|
|
1891
1891
|
} else {
|
|
1892
|
-
const fullpath = [...
|
|
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,
|
|
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 }, [...
|
|
1923
|
+
issue2.errors.map((issues) => processError({ issues }, [...path18, ...issue2.path]));
|
|
1924
1924
|
} else if (issue2.code === "invalid_key") {
|
|
1925
|
-
processError({ issues: issue2.issues }, [...
|
|
1925
|
+
processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
|
|
1926
1926
|
} else if (issue2.code === "invalid_element") {
|
|
1927
|
-
processError({ issues: issue2.issues }, [...
|
|
1927
|
+
processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
|
|
1928
1928
|
} else {
|
|
1929
|
-
const fullpath = [...
|
|
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
|
|
1962
|
-
for (const seg of
|
|
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 = (
|
|
8193
|
-
return
|
|
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
|
|
14655
|
-
if (
|
|
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 (
|
|
14660
|
-
const key =
|
|
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
|
}
|
|
@@ -15173,7 +15173,7 @@ var harnessDisplaySetSchema = external_exports.strictObject({
|
|
|
15173
15173
|
|
|
15174
15174
|
// ../../shared-contracts/dist/harness-presentation.js
|
|
15175
15175
|
var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
|
|
15176
|
-
var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((
|
|
15176
|
+
var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text4) => text4.trim().length > 0);
|
|
15177
15177
|
var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
|
|
15178
15178
|
label: displayText(256).optional(),
|
|
15179
15179
|
description: displayText(1024).optional()
|
|
@@ -15545,7 +15545,7 @@ var threadManualCompactionStartedSchema = external_exports.strictObject({
|
|
|
15545
15545
|
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
|
|
15546
15546
|
var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
|
|
15547
15547
|
var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
|
|
15548
|
-
var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((
|
|
15548
|
+
var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text4) => text4.length <= maximum));
|
|
15549
15549
|
var composerIndicatorsSchema = external_exports.array(external_exports.object({
|
|
15550
15550
|
kind: external_exports.literal("countdown"),
|
|
15551
15551
|
id: external_exports.string().min(1).max(64),
|
|
@@ -16889,8 +16889,8 @@ async function readCandidate(file2, signal) {
|
|
|
16889
16889
|
const message3 = isRecord(entry.message) ? entry.message : null;
|
|
16890
16890
|
if (!firstMessage && entry.type === "message" && message3?.role === "user") {
|
|
16891
16891
|
const content = message3.content;
|
|
16892
|
-
const
|
|
16893
|
-
firstMessage = sessionImportTitle(
|
|
16892
|
+
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(" ") : "";
|
|
16893
|
+
firstMessage = sessionImportTitle(text4);
|
|
16894
16894
|
}
|
|
16895
16895
|
hasUser = entry.type === "message" && message3?.role === "user" || typeof entry.parentId === "string" && entries.get(entry.parentId) === true;
|
|
16896
16896
|
entries.set(entry.id, hasUser);
|
|
@@ -17406,8 +17406,8 @@ function liveHarnessCommandPrompt(catalog, idPrefix, commandId, argumentText) {
|
|
|
17406
17406
|
const descriptor = catalog.commands.find(({ id }) => id === commandId);
|
|
17407
17407
|
if (!descriptor)
|
|
17408
17408
|
return null;
|
|
17409
|
-
const
|
|
17410
|
-
return
|
|
17409
|
+
const text4 = typeof argumentText === "string" ? argumentText.trim() : "";
|
|
17410
|
+
return text4 ? `${descriptor.invocation} ${text4}` : descriptor.invocation;
|
|
17411
17411
|
}
|
|
17412
17412
|
function mergeLiveHarnessCommands(builtIns, idPrefix, live, exclusions = {}) {
|
|
17413
17413
|
if (!live)
|
|
@@ -17543,16 +17543,16 @@ var Diff = class {
|
|
|
17543
17543
|
}
|
|
17544
17544
|
}
|
|
17545
17545
|
}
|
|
17546
|
-
addToPath(
|
|
17547
|
-
const last =
|
|
17546
|
+
addToPath(path18, added, removed, oldPosInc, options) {
|
|
17547
|
+
const last = path18.lastComponent;
|
|
17548
17548
|
if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
|
|
17549
17549
|
return {
|
|
17550
|
-
oldPos:
|
|
17550
|
+
oldPos: path18.oldPos + oldPosInc,
|
|
17551
17551
|
lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
|
|
17552
17552
|
};
|
|
17553
17553
|
} else {
|
|
17554
17554
|
return {
|
|
17555
|
-
oldPos:
|
|
17555
|
+
oldPos: path18.oldPos + oldPosInc,
|
|
17556
17556
|
lastComponent: { count: 1, added, removed, previousComponent: last }
|
|
17557
17557
|
};
|
|
17558
17558
|
}
|
|
@@ -17952,9 +17952,9 @@ function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader
|
|
|
17952
17952
|
} }));
|
|
17953
17953
|
}
|
|
17954
17954
|
}
|
|
17955
|
-
function splitLines(
|
|
17956
|
-
const hasTrailingNl =
|
|
17957
|
-
const result =
|
|
17955
|
+
function splitLines(text4) {
|
|
17956
|
+
const hasTrailingNl = text4.endsWith("\n");
|
|
17957
|
+
const result = text4.split("\n").map((line) => line + "\n");
|
|
17958
17958
|
if (hasTrailingNl) {
|
|
17959
17959
|
result.pop();
|
|
17960
17960
|
} else {
|
|
@@ -18917,11 +18917,11 @@ ${entry.text}`);
|
|
|
18917
18917
|
formatVersion: 1
|
|
18918
18918
|
}),
|
|
18919
18919
|
input: reply.task ? [{ type: "text", text: reply.task }] : [],
|
|
18920
|
-
items: texts.map((
|
|
18920
|
+
items: texts.map((text4, index) => ({
|
|
18921
18921
|
item: {
|
|
18922
18922
|
type: "agentMessage",
|
|
18923
|
-
text:
|
|
18924
|
-
itemId: hostItemIdSchema.parse(`pi-subagent-${createHash3("sha256").update(`${id}:${index}:${
|
|
18923
|
+
text: text4,
|
|
18924
|
+
itemId: hostItemIdSchema.parse(`pi-subagent-${createHash3("sha256").update(`${id}:${index}:${text4}`).digest("hex")}`)
|
|
18925
18925
|
},
|
|
18926
18926
|
outcome: { status: "succeeded" }
|
|
18927
18927
|
})),
|
|
@@ -19081,13 +19081,13 @@ function textContent(content) {
|
|
|
19081
19081
|
return "";
|
|
19082
19082
|
return content.filter((part) => record4(part) && part.type === "text" && typeof part.text === "string").map((part) => part.text).join("");
|
|
19083
19083
|
}
|
|
19084
|
-
function boundedPiProgress(
|
|
19084
|
+
function boundedPiProgress(text4) {
|
|
19085
19085
|
const limit = 64e3;
|
|
19086
|
-
return
|
|
19086
|
+
return text4.length <= limit ? text4 : `${text4.slice(0, limit)}
|
|
19087
19087
|
[Pi notification truncated]`;
|
|
19088
19088
|
}
|
|
19089
|
-
function visibleText(
|
|
19090
|
-
return
|
|
19089
|
+
function visibleText(text4) {
|
|
19090
|
+
return text4.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
19091
19091
|
}
|
|
19092
19092
|
function noticeDisplay(value, fallback) {
|
|
19093
19093
|
if (!record4(value) || !record4(value.details) || typeof value.details.summary !== "string")
|
|
@@ -19108,10 +19108,10 @@ function noticeDisplay(value, fallback) {
|
|
|
19108
19108
|
function piCustomNoticeKey(value) {
|
|
19109
19109
|
if (!record4(value) || value.type !== "custom_message" && value.role !== "custom" || value.display !== true || typeof value.customType !== "string")
|
|
19110
19110
|
return null;
|
|
19111
|
-
const
|
|
19112
|
-
if (
|
|
19111
|
+
const text4 = textContent(value.content);
|
|
19112
|
+
if (text4.trim().length === 0)
|
|
19113
19113
|
return null;
|
|
19114
|
-
return JSON.stringify([value.customType,
|
|
19114
|
+
return JSON.stringify([value.customType, text4]);
|
|
19115
19115
|
}
|
|
19116
19116
|
function piCustomNotice(value, sessionId, occurrences) {
|
|
19117
19117
|
const key = piCustomNoticeKey(value);
|
|
@@ -19120,13 +19120,13 @@ function piCustomNotice(value, sessionId, occurrences) {
|
|
|
19120
19120
|
const occurrence = occurrences.get(key) ?? 0;
|
|
19121
19121
|
occurrences.set(key, occurrence + 1);
|
|
19122
19122
|
const digest = createHash4("sha256").update(JSON.stringify([sessionId, key, occurrence])).digest("hex");
|
|
19123
|
-
const [customType,
|
|
19123
|
+
const [customType, text4] = JSON.parse(key);
|
|
19124
19124
|
return {
|
|
19125
19125
|
type: "progress.message",
|
|
19126
19126
|
itemId: hostItemIdSchema.parse(`pi-notice-v1-${digest}`),
|
|
19127
19127
|
text: boundedPiProgress(`Pi notification (${visibleText(customType)})
|
|
19128
19128
|
|
|
19129
|
-
${noticeDisplay(value,
|
|
19129
|
+
${noticeDisplay(value, text4)}`)
|
|
19130
19130
|
};
|
|
19131
19131
|
}
|
|
19132
19132
|
function piHistoryNotices(sessionId, entries) {
|
|
@@ -19287,8 +19287,8 @@ function itemOutcome(outcome) {
|
|
|
19287
19287
|
return { status: "succeeded" };
|
|
19288
19288
|
}
|
|
19289
19289
|
function toolOutput(value) {
|
|
19290
|
-
const
|
|
19291
|
-
return
|
|
19290
|
+
const text4 = textContent2(value);
|
|
19291
|
+
return text4.length > 0 ? { content: [{ type: "text", text: text4 }] } : void 0;
|
|
19292
19292
|
}
|
|
19293
19293
|
function historicalFileChanges(call, nativeMessage, toolItemId, cwd) {
|
|
19294
19294
|
const items = [];
|
|
@@ -19333,7 +19333,7 @@ function snapshotItems(entries, messageIdentities, notices, outcome, subagents,
|
|
|
19333
19333
|
continue;
|
|
19334
19334
|
const content = Array.isArray(nativeMessage.content) ? nativeMessage.content : [];
|
|
19335
19335
|
if (nativeMessage.role === "assistant") {
|
|
19336
|
-
const
|
|
19336
|
+
const text4 = textContent2(content);
|
|
19337
19337
|
const reasoning = thinkingContent(content);
|
|
19338
19338
|
let projectedText = false;
|
|
19339
19339
|
let projectedReasoning = false;
|
|
@@ -19350,12 +19350,12 @@ function snapshotItems(entries, messageIdentities, notices, outcome, subagents,
|
|
|
19350
19350
|
projectedReasoning = true;
|
|
19351
19351
|
continue;
|
|
19352
19352
|
}
|
|
19353
|
-
if (part.type === "text" && !projectedText &&
|
|
19353
|
+
if (part.type === "text" && !projectedText && text4.length > 0) {
|
|
19354
19354
|
const phase = piAssistantPhase(nativeMessage);
|
|
19355
19355
|
const item2 = {
|
|
19356
19356
|
type: "agentMessage",
|
|
19357
19357
|
itemId: piMessageItemId(messageIdentities.get(entry.id), "assistant") ?? itemId(entry.id, "assistant", 0),
|
|
19358
|
-
text:
|
|
19358
|
+
text: text4,
|
|
19359
19359
|
...phase ? { phase } : {}
|
|
19360
19360
|
};
|
|
19361
19361
|
snapshots.push({ item: item2, outcome: itemOutcome(outcome) });
|
|
@@ -20494,7 +20494,7 @@ async function readPiEmptySessionConfiguration(sessionFile) {
|
|
|
20494
20494
|
|
|
20495
20495
|
// dist/pi-adapter.js
|
|
20496
20496
|
import { randomUUID as randomUUID7 } from "node:crypto";
|
|
20497
|
-
import
|
|
20497
|
+
import path17 from "node:path";
|
|
20498
20498
|
|
|
20499
20499
|
// dist/pi-workflow-child-history.js
|
|
20500
20500
|
import { createHash as createHash6 } from "node:crypto";
|
|
@@ -20801,7 +20801,7 @@ async function rollbackPiLastTurn(transport, sourceSessionId, cwd) {
|
|
|
20801
20801
|
// dist/pi-rpc-session.js
|
|
20802
20802
|
import { spawn, spawnSync } from "node:child_process";
|
|
20803
20803
|
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
20804
|
-
import
|
|
20804
|
+
import path16 from "node:path";
|
|
20805
20805
|
|
|
20806
20806
|
// dist/pi-slash-commands.js
|
|
20807
20807
|
var DYNAMIC_ID_PREFIX = "pi.slash.";
|
|
@@ -20847,6 +20847,118 @@ function piDynamicCommandPrompt(catalog, commandId, argumentText) {
|
|
|
20847
20847
|
return liveHarnessCommandPrompt(catalog, DYNAMIC_ID_PREFIX, commandId, argumentText);
|
|
20848
20848
|
}
|
|
20849
20849
|
|
|
20850
|
+
// dist/pi-unc-launch.js
|
|
20851
|
+
import fs3 from "node:fs";
|
|
20852
|
+
import path15 from "node:path";
|
|
20853
|
+
function isWindowsUncDirectory(directory) {
|
|
20854
|
+
return /^\\\\(?:\?\\UNC\\)?(?![?.]\\)[^\\]+\\[^\\]+(?:\\|$)/iu.test(path15.win32.normalize(directory));
|
|
20855
|
+
}
|
|
20856
|
+
function text3(file2) {
|
|
20857
|
+
try {
|
|
20858
|
+
return fs3.readFileSync(file2, "utf8").replace(/^\uFEFF/u, "").replaceAll("\r\n", "\n").trim();
|
|
20859
|
+
} catch {
|
|
20860
|
+
return void 0;
|
|
20861
|
+
}
|
|
20862
|
+
}
|
|
20863
|
+
function isFile(file2) {
|
|
20864
|
+
try {
|
|
20865
|
+
return fs3.statSync(file2).isFile();
|
|
20866
|
+
} catch {
|
|
20867
|
+
return false;
|
|
20868
|
+
}
|
|
20869
|
+
}
|
|
20870
|
+
function nodeOnPath(environment) {
|
|
20871
|
+
for (const directory of pathDirectories(environment, "win32")) {
|
|
20872
|
+
for (const extension of executableExtensions("node", "win32", environment)) {
|
|
20873
|
+
const suffix = extension.toLowerCase();
|
|
20874
|
+
const candidate = path15.join(directory, `node${suffix}`);
|
|
20875
|
+
if (!isFile(candidate))
|
|
20876
|
+
continue;
|
|
20877
|
+
if (suffix !== ".exe" && suffix !== ".com") {
|
|
20878
|
+
throw new Error("Pi PATH Node launcher cannot safely bypass CMD in a UNC directory");
|
|
20879
|
+
}
|
|
20880
|
+
return candidate;
|
|
20881
|
+
}
|
|
20882
|
+
}
|
|
20883
|
+
return process.execPath;
|
|
20884
|
+
}
|
|
20885
|
+
function npmShim(target, pathExtFix = false) {
|
|
20886
|
+
return `@ECHO off
|
|
20887
|
+
GOTO start
|
|
20888
|
+
:find_dp0
|
|
20889
|
+
SET dp0=%~dp0
|
|
20890
|
+
EXIT /b
|
|
20891
|
+
:start
|
|
20892
|
+
SETLOCAL
|
|
20893
|
+
CALL :find_dp0
|
|
20894
|
+
|
|
20895
|
+
IF EXIST "%dp0%\\node.exe" (
|
|
20896
|
+
SET "_prog=%dp0%\\node.exe"
|
|
20897
|
+
) ELSE (
|
|
20898
|
+
SET "_prog=node"
|
|
20899
|
+
${pathExtFix ? "" : " SET PATHEXT=%PATHEXT:;.JS;=;%\n"})
|
|
20900
|
+
|
|
20901
|
+
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & ${pathExtFix ? "set PATHEXT=%PATHEXT:;.JS;=;% & " : ""}"%_prog%" "%dp0%\\${target}" %*`;
|
|
20902
|
+
}
|
|
20903
|
+
var standaloneNodeSetup = 'IF EXIST "%LOCALAPPDATA%\\pi-node\\current\\node.exe" SET "node=%LOCALAPPDATA%\\pi-node\\current\\node.exe"';
|
|
20904
|
+
function managedShim(standalone) {
|
|
20905
|
+
return `@ECHO off
|
|
20906
|
+
SETLOCAL
|
|
20907
|
+
SET "node=node"
|
|
20908
|
+
${standalone ? `${standaloneNodeSetup}
|
|
20909
|
+
` : ""}"%node%" "%~dp0pi-launcher.js" %*
|
|
20910
|
+
SET "pi_exit_code=%ERRORLEVEL%"
|
|
20911
|
+
IF "%pi_exit_code%"=="9009" (
|
|
20912
|
+
IF "%node%"=="node" (
|
|
20913
|
+
"%SystemRoot%\\System32\\where.exe" /Q node
|
|
20914
|
+
IF ERRORLEVEL 1 GOTO node_missing
|
|
20915
|
+
) ELSE IF NOT EXIST "%node%" GOTO node_missing
|
|
20916
|
+
)
|
|
20917
|
+
EXIT /B %pi_exit_code%
|
|
20918
|
+
:node_missing
|
|
20919
|
+
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
|
|
20920
|
+
EXIT /B %pi_exit_code%`;
|
|
20921
|
+
}
|
|
20922
|
+
function piUncNodeInvocation(command, arguments_, environment) {
|
|
20923
|
+
const directory = path15.dirname(command);
|
|
20924
|
+
const source = text3(command);
|
|
20925
|
+
if (path15.isAbsolute(command) && path15.win32.basename(command).toLowerCase() === "pi.cmd" && source !== void 0) {
|
|
20926
|
+
const packageDirectory = path15.join(directory, "node_modules", "@earendil-works", "pi-coding-agent");
|
|
20927
|
+
try {
|
|
20928
|
+
const manifest = JSON.parse(text3(path15.join(packageDirectory, "package.json")) ?? "");
|
|
20929
|
+
if (typeof manifest === "object" && manifest !== null && "name" in manifest && manifest.name === "@earendil-works/pi-coding-agent") {
|
|
20930
|
+
const entry = findPiCliEntry(packageDirectory);
|
|
20931
|
+
const target = entry && path15.relative(directory, entry).replaceAll("/", "\\");
|
|
20932
|
+
if (entry && target && [npmShim(target), npmShim(target, true)].includes(source)) {
|
|
20933
|
+
const localNode = path15.join(directory, "node.exe");
|
|
20934
|
+
return {
|
|
20935
|
+
command: isFile(localNode) ? localNode : nodeOnPath(environment),
|
|
20936
|
+
arguments: [entry, ...arguments_],
|
|
20937
|
+
windowsVerbatimArguments: false
|
|
20938
|
+
};
|
|
20939
|
+
}
|
|
20940
|
+
}
|
|
20941
|
+
} catch {
|
|
20942
|
+
}
|
|
20943
|
+
const launcher = path15.join(directory, "pi-launcher.js");
|
|
20944
|
+
try {
|
|
20945
|
+
const marker = JSON.parse(text3(path15.join(path15.dirname(directory), "install", "managed-install.json")) ?? "");
|
|
20946
|
+
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))) {
|
|
20947
|
+
const localAppData = environmentValue(environment, "LOCALAPPDATA");
|
|
20948
|
+
const standaloneNode = localAppData ? path15.join(localAppData, "pi-node", "current", "node.exe") : void 0;
|
|
20949
|
+
return {
|
|
20950
|
+
command: source === managedShim(true) && standaloneNode && isFile(standaloneNode) ? standaloneNode : nodeOnPath(environment),
|
|
20951
|
+
// The native launcher reads current-version and sets PI_MANAGED_INSTALL_ROOT itself.
|
|
20952
|
+
arguments: [launcher, ...arguments_],
|
|
20953
|
+
windowsVerbatimArguments: false
|
|
20954
|
+
};
|
|
20955
|
+
}
|
|
20956
|
+
} catch {
|
|
20957
|
+
}
|
|
20958
|
+
}
|
|
20959
|
+
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.");
|
|
20960
|
+
}
|
|
20961
|
+
|
|
20850
20962
|
// dist/pi-content-stream.js
|
|
20851
20963
|
var PiContentStreamConflictError = class extends Error {
|
|
20852
20964
|
};
|
|
@@ -20874,7 +20986,7 @@ var PiContentStream = class {
|
|
|
20874
20986
|
}
|
|
20875
20987
|
finalize(blocks) {
|
|
20876
20988
|
if (this.#indexed !== true) {
|
|
20877
|
-
blocks = this.#legacyBlockIndex > 0 ? blocks.map(({ text:
|
|
20989
|
+
blocks = this.#legacyBlockIndex > 0 ? blocks.map(({ text: text4 }, index) => ({ index, text: text4 })) : [{ index: 0, text: blocks.map(({ text: text4 }) => text4).join("") }];
|
|
20878
20990
|
}
|
|
20879
20991
|
const indices = new Set(blocks.map(({ index }) => index));
|
|
20880
20992
|
for (const [index, block] of this.#blocks) {
|
|
@@ -20884,8 +20996,8 @@ var PiContentStream = class {
|
|
|
20884
20996
|
this.#conflict();
|
|
20885
20997
|
this.#blocks.delete(index);
|
|
20886
20998
|
}
|
|
20887
|
-
for (const { index, text:
|
|
20888
|
-
this.#finish(index,
|
|
20999
|
+
for (const { index, text: text4 } of blocks)
|
|
21000
|
+
this.#finish(index, text4);
|
|
20889
21001
|
return this.#flush();
|
|
20890
21002
|
}
|
|
20891
21003
|
#key(index) {
|
|
@@ -21167,15 +21279,15 @@ function extractReasoningText(content) {
|
|
|
21167
21279
|
return null;
|
|
21168
21280
|
const type = String(content.type ?? "");
|
|
21169
21281
|
if (type === "thinking" || type === "reasoning" || type === "thought") {
|
|
21170
|
-
const
|
|
21171
|
-
return typeof
|
|
21282
|
+
const text4 = content.thinking ?? content.reasoning ?? content.text ?? content.delta;
|
|
21283
|
+
return typeof text4 === "string" ? text4 : null;
|
|
21172
21284
|
}
|
|
21173
21285
|
return null;
|
|
21174
21286
|
}
|
|
21175
21287
|
function assistantReasoning(value) {
|
|
21176
21288
|
if (!isRecord9(value) || value.role !== "assistant" || !Array.isArray(value.content))
|
|
21177
21289
|
return null;
|
|
21178
|
-
return value.content.map(extractReasoningText).filter((
|
|
21290
|
+
return value.content.map(extractReasoningText).filter((text4) => typeof text4 === "string").join("");
|
|
21179
21291
|
}
|
|
21180
21292
|
function assistantFailure(value) {
|
|
21181
21293
|
if (!isRecord9(value) || value.role !== "assistant")
|
|
@@ -21242,10 +21354,17 @@ function piRpcProcessCommand(options, dependencies = {}) {
|
|
|
21242
21354
|
...thinkingArguments,
|
|
21243
21355
|
...sessionArguments
|
|
21244
21356
|
];
|
|
21245
|
-
const extension =
|
|
21357
|
+
const extension = path16.win32.extname(command).toLowerCase();
|
|
21246
21358
|
if (platform !== "win32" || ![".cmd", ".bat"].includes(extension)) {
|
|
21247
21359
|
return { command, arguments: arguments_, windowsVerbatimArguments: false };
|
|
21248
21360
|
}
|
|
21361
|
+
if (isWindowsUncDirectory(options.cwd)) {
|
|
21362
|
+
try {
|
|
21363
|
+
return piUncNodeInvocation(command, arguments_, options.environment);
|
|
21364
|
+
} catch (error51) {
|
|
21365
|
+
throw new PiRpcFaultError("unavailable", message2(error51));
|
|
21366
|
+
}
|
|
21367
|
+
}
|
|
21249
21368
|
const quote = (value) => `"${value.replaceAll("%", "%%").replaceAll('"', '""')}"`;
|
|
21250
21369
|
const commandLine = [command, ...arguments_].map(quote).join(" ");
|
|
21251
21370
|
return {
|
|
@@ -21599,13 +21718,13 @@ var PiRpcSession = class {
|
|
|
21599
21718
|
throw fault;
|
|
21600
21719
|
}
|
|
21601
21720
|
}
|
|
21602
|
-
async runTurn(
|
|
21721
|
+
async runTurn(text4, onEvent) {
|
|
21603
21722
|
if (!this.#child || !this.#state || this.#closed || this.#failed) {
|
|
21604
21723
|
throw new Error("Pi RPC Session is unavailable");
|
|
21605
21724
|
}
|
|
21606
21725
|
if (this.isBusy)
|
|
21607
21726
|
throw new PiRpcBusyError();
|
|
21608
|
-
if (
|
|
21727
|
+
if (text4.length === 0)
|
|
21609
21728
|
throw new Error("Pi text Turn must not be empty");
|
|
21610
21729
|
const settled = new Promise((resolve, reject) => {
|
|
21611
21730
|
this.#activeTurn = {
|
|
@@ -21640,7 +21759,7 @@ var PiRpcSession = class {
|
|
|
21640
21759
|
});
|
|
21641
21760
|
try {
|
|
21642
21761
|
this.#drainProgress(onEvent);
|
|
21643
|
-
await this.#send("prompt", { message:
|
|
21762
|
+
await this.#send("prompt", { message: text4 });
|
|
21644
21763
|
} catch (error51) {
|
|
21645
21764
|
this.#rejectActiveTurn(error51 instanceof Error ? error51 : new Error(message2(error51)));
|
|
21646
21765
|
}
|
|
@@ -21992,16 +22111,17 @@ var PiRpcSession = class {
|
|
|
21992
22111
|
return true;
|
|
21993
22112
|
this.#extensionStatuses.set(value.statusKey, value.statusText);
|
|
21994
22113
|
}
|
|
22114
|
+
return true;
|
|
21995
22115
|
}
|
|
21996
|
-
const
|
|
21997
|
-
if (!
|
|
22116
|
+
const text4 = piStatusText(value);
|
|
22117
|
+
if (!text4)
|
|
21998
22118
|
return false;
|
|
21999
22119
|
if (value.type === "extension_ui_request" && typeof value.id === "string" && !this.#acceptNoticeFrame(JSON.stringify([value.type, value.id])))
|
|
22000
22120
|
return true;
|
|
22001
22121
|
this.#publishProgress({
|
|
22002
22122
|
type: "progress.message",
|
|
22003
22123
|
itemId: hostItemIdSchema.parse(`pi-progress-${randomUUID6()}`),
|
|
22004
|
-
text:
|
|
22124
|
+
text: text4
|
|
22005
22125
|
}, value.method === "setStatus" && typeof value.statusKey === "string" ? value.statusKey : void 0);
|
|
22006
22126
|
return true;
|
|
22007
22127
|
}
|
|
@@ -22404,8 +22524,8 @@ var PiRpcSession = class {
|
|
|
22404
22524
|
const content = value.content;
|
|
22405
22525
|
if (failure === null || !active.sawStreamedMessageReasoning) {
|
|
22406
22526
|
this.#emitContent(active, true, active.reasoningStream.finalize(content.flatMap((part, index) => {
|
|
22407
|
-
const
|
|
22408
|
-
return
|
|
22527
|
+
const text4 = extractReasoningText(part);
|
|
22528
|
+
return text4 === null ? [] : [{ index, text: text4 }];
|
|
22409
22529
|
})));
|
|
22410
22530
|
}
|
|
22411
22531
|
if (active.reasoningMessageOpen && active.failure === null) {
|
|
@@ -22672,20 +22792,20 @@ function nativeText(value) {
|
|
|
22672
22792
|
return value;
|
|
22673
22793
|
if (!isRecord10(value) || !Array.isArray(value.content))
|
|
22674
22794
|
return "";
|
|
22675
|
-
return value.content.filter((content) => isRecord10(content) && content.type === "text" && typeof content.text === "string").map(({ text:
|
|
22795
|
+
return value.content.filter((content) => isRecord10(content) && content.type === "text" && typeof content.text === "string").map(({ text: text4 }) => text4).join("");
|
|
22676
22796
|
}
|
|
22677
22797
|
function boundedOutput(value, limit) {
|
|
22678
|
-
const
|
|
22679
|
-
if (
|
|
22798
|
+
const text4 = nativeText(value);
|
|
22799
|
+
if (text4.length === 0)
|
|
22680
22800
|
return void 0;
|
|
22681
|
-
const truncated =
|
|
22801
|
+
const truncated = text4.length > limit;
|
|
22682
22802
|
return {
|
|
22683
|
-
content: [{ type: "text", text: truncated ?
|
|
22803
|
+
content: [{ type: "text", text: truncated ? text4.slice(0, limit) : text4 }],
|
|
22684
22804
|
...truncated ? { truncated: true } : {}
|
|
22685
22805
|
};
|
|
22686
22806
|
}
|
|
22687
22807
|
function outputText(output) {
|
|
22688
|
-
return output?.content.filter((content) => content.type === "text").map(({ text:
|
|
22808
|
+
return output?.content.filter((content) => content.type === "text").map(({ text: text4 }) => text4).join("") ?? "";
|
|
22689
22809
|
}
|
|
22690
22810
|
function numberField(value, key) {
|
|
22691
22811
|
if (!isRecord10(value))
|
|
@@ -22770,7 +22890,7 @@ var PiHarnessSession = class {
|
|
|
22770
22890
|
return this.#transport?.state.sessionId === id;
|
|
22771
22891
|
}
|
|
22772
22892
|
async readSubagentHistory(cwd) {
|
|
22773
|
-
if (this.#phase !== "open" ||
|
|
22893
|
+
if (this.#phase !== "open" || path17.resolve(cwd) !== path17.resolve(this.#cwd)) {
|
|
22774
22894
|
throw new Error("Pi Subagent parent workspace or Session is unavailable");
|
|
22775
22895
|
}
|
|
22776
22896
|
return (await this.#ensureTransport()).getEntries();
|
|
@@ -22783,7 +22903,7 @@ var PiHarnessSession = class {
|
|
|
22783
22903
|
return readGotgenesChild(history, transport.state.sessionId, id, this.#subagents.gotgenes.records.get(id));
|
|
22784
22904
|
}
|
|
22785
22905
|
async inspectSubagent(id, cwd) {
|
|
22786
|
-
if (this.#phase !== "open" ||
|
|
22906
|
+
if (this.#phase !== "open" || path17.resolve(cwd) !== path17.resolve(this.#cwd)) {
|
|
22787
22907
|
throw new Error("Pi Subagent parent workspace or Session is unavailable");
|
|
22788
22908
|
}
|
|
22789
22909
|
const transport = await this.#ensureTransport();
|
|
@@ -22861,8 +22981,8 @@ var PiHarnessSession = class {
|
|
|
22861
22981
|
}
|
|
22862
22982
|
};
|
|
22863
22983
|
}
|
|
22864
|
-
const
|
|
22865
|
-
if (
|
|
22984
|
+
const text4 = command.input.map((input) => input.text).join("\n");
|
|
22985
|
+
if (text4.length === 0) {
|
|
22866
22986
|
return {
|
|
22867
22987
|
ok: false,
|
|
22868
22988
|
error: {
|
|
@@ -22924,7 +23044,7 @@ var PiHarnessSession = class {
|
|
|
22924
23044
|
this.#active = active;
|
|
22925
23045
|
this.#event({ type: "turn.started", turnId: command.turnId });
|
|
22926
23046
|
this.#event({ type: "item.started", turnId: command.turnId, item });
|
|
22927
|
-
void transport.runTurn(
|
|
23047
|
+
void transport.runTurn(text4, (event) => this.#handleTurnEvent(active, event)).then(async (result) => {
|
|
22928
23048
|
active.settling = true;
|
|
22929
23049
|
try {
|
|
22930
23050
|
const identity = await this.#completedTurnIdentity(active, transport);
|
|
@@ -23823,16 +23943,16 @@ var PiHarnessSession = class {
|
|
|
23823
23943
|
}
|
|
23824
23944
|
active.agentMessageId = messageId;
|
|
23825
23945
|
}
|
|
23826
|
-
#appendText(active,
|
|
23946
|
+
#appendText(active, text4) {
|
|
23827
23947
|
if (active.agentMessageId === null || !active.agentItem) {
|
|
23828
23948
|
throw new Error("Pi Assistant text arrived outside an active message");
|
|
23829
23949
|
}
|
|
23830
|
-
active.agentItem = { ...active.agentItem, text: active.agentItem.text +
|
|
23950
|
+
active.agentItem = { ...active.agentItem, text: active.agentItem.text + text4 };
|
|
23831
23951
|
this.#event({
|
|
23832
23952
|
type: "item.updated",
|
|
23833
23953
|
turnId: active.command.turnId,
|
|
23834
23954
|
itemId: active.agentItem.itemId,
|
|
23835
|
-
update: { type: "text.append", text:
|
|
23955
|
+
update: { type: "text.append", text: text4 }
|
|
23836
23956
|
});
|
|
23837
23957
|
}
|
|
23838
23958
|
#completeAgentItem(active, outcome, completeEmpty) {
|
|
@@ -23843,8 +23963,8 @@ var PiHarnessSession = class {
|
|
|
23843
23963
|
active.agentItem = null;
|
|
23844
23964
|
this.#completeItem(active, item, outcome);
|
|
23845
23965
|
}
|
|
23846
|
-
#appendReasoning(active,
|
|
23847
|
-
if (
|
|
23966
|
+
#appendReasoning(active, text4, nativeMessageIdentity2) {
|
|
23967
|
+
if (text4.length === 0)
|
|
23848
23968
|
return;
|
|
23849
23969
|
if (!active.reasoningItem) {
|
|
23850
23970
|
active.reasoningItem = {
|
|
@@ -23860,13 +23980,13 @@ var PiHarnessSession = class {
|
|
|
23860
23980
|
}
|
|
23861
23981
|
active.reasoningItem = {
|
|
23862
23982
|
...active.reasoningItem,
|
|
23863
|
-
text: active.reasoningItem.text +
|
|
23983
|
+
text: active.reasoningItem.text + text4
|
|
23864
23984
|
};
|
|
23865
23985
|
this.#event({
|
|
23866
23986
|
type: "item.updated",
|
|
23867
23987
|
turnId: active.command.turnId,
|
|
23868
23988
|
itemId: active.reasoningItem.itemId,
|
|
23869
|
-
update: { type: "text.append", text:
|
|
23989
|
+
update: { type: "text.append", text: text4 }
|
|
23870
23990
|
});
|
|
23871
23991
|
}
|
|
23872
23992
|
#completeReasoning(active, outcome) {
|