@liberseek/boft-cli-win32-arm64 0.6.4 → 0.6.5
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/host-runtime.mjs +182 -127
- package/app/plugins/claude-code/plugin.mjs +664 -229
- package/app/plugins/deepseek-harness/plugin.mjs +82 -17
- package/app/plugins/grok/plugin.mjs +6 -0
- package/app/plugins/kiro-cli/plugin.mjs +77 -61
- package/app/plugins/omp/plugin.mjs +6 -0
- package/app/plugins/opencode/plugin.mjs +292 -142
- package/app/plugins/pi/plugin.mjs +1489 -1304
- package/app/renderer-extension.js +17 -23
- 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
package/app/host-runtime.mjs
CHANGED
|
@@ -4100,7 +4100,8 @@ async function runDelegationCli(input) {
|
|
|
4100
4100
|
|
|
4101
4101
|
// packages/host-runtime/src/run-host-runtime.ts
|
|
4102
4102
|
import { randomBytes } from "node:crypto";
|
|
4103
|
-
import
|
|
4103
|
+
import path21 from "node:path";
|
|
4104
|
+
import { homedir } from "node:os";
|
|
4104
4105
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
4105
4106
|
|
|
4106
4107
|
// packages/update-manager/dist/distribution.js
|
|
@@ -5958,10 +5959,10 @@ function mergeDefs(...defs) {
|
|
|
5958
5959
|
function cloneDef(schema) {
|
|
5959
5960
|
return mergeDefs(schema._zod.def);
|
|
5960
5961
|
}
|
|
5961
|
-
function getElementAtPath(obj,
|
|
5962
|
-
if (!
|
|
5962
|
+
function getElementAtPath(obj, path26) {
|
|
5963
|
+
if (!path26)
|
|
5963
5964
|
return obj;
|
|
5964
|
-
return
|
|
5965
|
+
return path26.reduce((acc, key) => acc?.[key], obj);
|
|
5965
5966
|
}
|
|
5966
5967
|
function promiseAllObject(promisesObj) {
|
|
5967
5968
|
const keys = Object.keys(promisesObj);
|
|
@@ -6370,11 +6371,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
6370
6371
|
}
|
|
6371
6372
|
return false;
|
|
6372
6373
|
}
|
|
6373
|
-
function prefixIssues(
|
|
6374
|
+
function prefixIssues(path26, issues) {
|
|
6374
6375
|
return issues.map((iss) => {
|
|
6375
6376
|
var _a3;
|
|
6376
6377
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
6377
|
-
iss.path.unshift(
|
|
6378
|
+
iss.path.unshift(path26);
|
|
6378
6379
|
return iss;
|
|
6379
6380
|
});
|
|
6380
6381
|
}
|
|
@@ -6521,16 +6522,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
6521
6522
|
}
|
|
6522
6523
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
6523
6524
|
const fieldErrors = { _errors: [] };
|
|
6524
|
-
const processError = (error52,
|
|
6525
|
+
const processError = (error52, path26 = []) => {
|
|
6525
6526
|
for (const issue2 of error52.issues) {
|
|
6526
6527
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
6527
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
6528
|
+
issue2.errors.map((issues) => processError({ issues }, [...path26, ...issue2.path]));
|
|
6528
6529
|
} else if (issue2.code === "invalid_key") {
|
|
6529
|
-
processError({ issues: issue2.issues }, [...
|
|
6530
|
+
processError({ issues: issue2.issues }, [...path26, ...issue2.path]);
|
|
6530
6531
|
} else if (issue2.code === "invalid_element") {
|
|
6531
|
-
processError({ issues: issue2.issues }, [...
|
|
6532
|
+
processError({ issues: issue2.issues }, [...path26, ...issue2.path]);
|
|
6532
6533
|
} else {
|
|
6533
|
-
const fullpath = [...
|
|
6534
|
+
const fullpath = [...path26, ...issue2.path];
|
|
6534
6535
|
if (fullpath.length === 0) {
|
|
6535
6536
|
fieldErrors._errors.push(mapper(issue2));
|
|
6536
6537
|
} else {
|
|
@@ -6557,17 +6558,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
6557
6558
|
}
|
|
6558
6559
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
6559
6560
|
const result = { errors: [] };
|
|
6560
|
-
const processError = (error52,
|
|
6561
|
+
const processError = (error52, path26 = []) => {
|
|
6561
6562
|
var _a3, _b;
|
|
6562
6563
|
for (const issue2 of error52.issues) {
|
|
6563
6564
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
6564
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
6565
|
+
issue2.errors.map((issues) => processError({ issues }, [...path26, ...issue2.path]));
|
|
6565
6566
|
} else if (issue2.code === "invalid_key") {
|
|
6566
|
-
processError({ issues: issue2.issues }, [...
|
|
6567
|
+
processError({ issues: issue2.issues }, [...path26, ...issue2.path]);
|
|
6567
6568
|
} else if (issue2.code === "invalid_element") {
|
|
6568
|
-
processError({ issues: issue2.issues }, [...
|
|
6569
|
+
processError({ issues: issue2.issues }, [...path26, ...issue2.path]);
|
|
6569
6570
|
} else {
|
|
6570
|
-
const fullpath = [...
|
|
6571
|
+
const fullpath = [...path26, ...issue2.path];
|
|
6571
6572
|
if (fullpath.length === 0) {
|
|
6572
6573
|
result.errors.push(mapper(issue2));
|
|
6573
6574
|
continue;
|
|
@@ -6599,8 +6600,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
6599
6600
|
}
|
|
6600
6601
|
function toDotPath(_path) {
|
|
6601
6602
|
const segs = [];
|
|
6602
|
-
const
|
|
6603
|
-
for (const seg of
|
|
6603
|
+
const path26 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
6604
|
+
for (const seg of path26) {
|
|
6604
6605
|
if (typeof seg === "number")
|
|
6605
6606
|
segs.push(`[${seg}]`);
|
|
6606
6607
|
else if (typeof seg === "symbol")
|
|
@@ -19292,13 +19293,13 @@ function resolveRef(ref, ctx) {
|
|
|
19292
19293
|
if (!ref.startsWith("#")) {
|
|
19293
19294
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
19294
19295
|
}
|
|
19295
|
-
const
|
|
19296
|
-
if (
|
|
19296
|
+
const path26 = ref.slice(1).split("/").filter(Boolean);
|
|
19297
|
+
if (path26.length === 0) {
|
|
19297
19298
|
return ctx.rootSchema;
|
|
19298
19299
|
}
|
|
19299
19300
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
19300
|
-
if (
|
|
19301
|
-
const key =
|
|
19301
|
+
if (path26[0] === defsKey) {
|
|
19302
|
+
const key = path26[1];
|
|
19302
19303
|
if (!key || !ctx.defs[key]) {
|
|
19303
19304
|
throw new Error(`Reference not found: ${ref}`);
|
|
19304
19305
|
}
|
|
@@ -20687,6 +20688,12 @@ function parseHostUsage(value2) {
|
|
|
20687
20688
|
throw new Error(`Harness Usage contains unknown field '${key}'`);
|
|
20688
20689
|
}
|
|
20689
20690
|
}
|
|
20691
|
+
for (const field of ["totalCredits", "contextUsagePercent"]) {
|
|
20692
|
+
const candidate = value2[field];
|
|
20693
|
+
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
|
|
20694
|
+
throw new Error(`Harness Usage '${field}' must be a finite non-negative number`);
|
|
20695
|
+
}
|
|
20696
|
+
}
|
|
20690
20697
|
for (const field of tokenFields) {
|
|
20691
20698
|
const candidate = value2[field];
|
|
20692
20699
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
|
|
@@ -22329,8 +22336,8 @@ function projectFileChangeKind(kind) {
|
|
|
22329
22336
|
return { type: kind };
|
|
22330
22337
|
}
|
|
22331
22338
|
function projectFileChanges(changes) {
|
|
22332
|
-
return changes.map(({ path:
|
|
22333
|
-
path:
|
|
22339
|
+
return changes.map(({ path: path26, kind, unifiedDiff }) => ({
|
|
22340
|
+
path: path26,
|
|
22334
22341
|
kind: projectFileChangeKind(kind),
|
|
22335
22342
|
diff: unifiedDiff
|
|
22336
22343
|
}));
|
|
@@ -22625,7 +22632,9 @@ function projectHistoricalTurn(input) {
|
|
|
22625
22632
|
codexErrorInfo: "other",
|
|
22626
22633
|
additionalDetails: null
|
|
22627
22634
|
} : null;
|
|
22628
|
-
const
|
|
22635
|
+
const startedAtMs = snapshot.startedAtMs;
|
|
22636
|
+
const completedAtMs = snapshot.completedAtMs;
|
|
22637
|
+
const hasTiming = startedAtMs !== void 0 && completedAtMs !== void 0 && Number.isFinite(startedAtMs) && Number.isFinite(completedAtMs) && startedAtMs >= 0 && completedAtMs >= startedAtMs;
|
|
22629
22638
|
return {
|
|
22630
22639
|
id: turnId,
|
|
22631
22640
|
status: historicalStatus(snapshot.outcome),
|
|
@@ -22656,9 +22665,9 @@ function projectHistoricalTurn(input) {
|
|
|
22656
22665
|
})
|
|
22657
22666
|
],
|
|
22658
22667
|
error: error51,
|
|
22659
|
-
startedAt:
|
|
22660
|
-
completedAt:
|
|
22661
|
-
durationMs:
|
|
22668
|
+
startedAt: hasTiming ? Math.floor(startedAtMs / 1e3) : null,
|
|
22669
|
+
completedAt: hasTiming ? Math.floor(completedAtMs / 1e3) : null,
|
|
22670
|
+
durationMs: hasTiming ? completedAtMs - startedAtMs : null,
|
|
22662
22671
|
itemsView: "full"
|
|
22663
22672
|
};
|
|
22664
22673
|
}
|
|
@@ -23285,13 +23294,13 @@ function decodeThreadForkRequest(request) {
|
|
|
23285
23294
|
if (runtimeWorkspaceRoots !== void 0 && runtimeWorkspaceRoots !== null && (!Array.isArray(runtimeWorkspaceRoots) || runtimeWorkspaceRoots.some((root) => typeof root !== "string" || root.length === 0))) {
|
|
23286
23295
|
throw new Error("thread/fork params.runtimeWorkspaceRoots must be text paths or null");
|
|
23287
23296
|
}
|
|
23288
|
-
const
|
|
23297
|
+
const path26 = optionalText(params, "path", { allowEmpty: true });
|
|
23289
23298
|
const ephemeral = optionalBoolean(params, "ephemeral");
|
|
23290
23299
|
return {
|
|
23291
23300
|
threadId: threadId3,
|
|
23292
23301
|
...lastTurnText ? { lastTurnId: hostTurnIdSchema.parse(lastTurnText) } : {},
|
|
23293
23302
|
...beforeTurnText ? { beforeTurnId: hostTurnIdSchema.parse(beforeTurnText) } : {},
|
|
23294
|
-
...
|
|
23303
|
+
...path26 ? { path: path26 } : {},
|
|
23295
23304
|
...optionalField(params, "model"),
|
|
23296
23305
|
...optionalField(params, "modelProvider"),
|
|
23297
23306
|
...optionalField(params, "cwd"),
|
|
@@ -25284,6 +25293,7 @@ async function executeCurrentLastTurnRollback(input) {
|
|
|
25284
25293
|
error: { code: -32079, message: "External Native Session is unavailable" }
|
|
25285
25294
|
};
|
|
25286
25295
|
}
|
|
25296
|
+
const configuration = currentConfiguration(current);
|
|
25287
25297
|
let opened;
|
|
25288
25298
|
try {
|
|
25289
25299
|
opened = await adapter.open({
|
|
@@ -25293,7 +25303,10 @@ async function executeCurrentLastTurnRollback(input) {
|
|
|
25293
25303
|
...input.environment ?? process.env,
|
|
25294
25304
|
[DELEGATION_THREAD_ID_ENV]: current.id
|
|
25295
25305
|
},
|
|
25296
|
-
sourceRef: currentNativeRef
|
|
25306
|
+
sourceRef: currentNativeRef,
|
|
25307
|
+
...configuration.effectiveModel ? { model: configuration.effectiveModel } : {},
|
|
25308
|
+
...configuration.effectiveThinkingOptionId ? { thinkingOptionId: configuration.effectiveThinkingOptionId } : {},
|
|
25309
|
+
...configuration.effectivePermissionModeId ? { permissionModeId: configuration.effectivePermissionModeId } : {}
|
|
25297
25310
|
});
|
|
25298
25311
|
} catch {
|
|
25299
25312
|
return { ok: false, error: { code: -32076, message: "External Thread rollback failed" } };
|
|
@@ -25310,7 +25323,6 @@ async function executeCurrentLastTurnRollback(input) {
|
|
|
25310
25323
|
error: { code: -32076, message: "External rollback did not return a valid Session" }
|
|
25311
25324
|
};
|
|
25312
25325
|
}
|
|
25313
|
-
const configuration = currentConfiguration(current);
|
|
25314
25326
|
const configurationError = await restoreCurrentConfiguration(session, configuration);
|
|
25315
25327
|
if (configurationError) {
|
|
25316
25328
|
await session.close().catch(() => void 0);
|
|
@@ -25882,6 +25894,8 @@ var ExternalThreadRuntime = class {
|
|
|
25882
25894
|
environment: { ...this.#environment, [DELEGATION_THREAD_ID_ENV]: record3.hostThreadId },
|
|
25883
25895
|
nativeRef: record3.nativeSessionRef,
|
|
25884
25896
|
knownTurnRefs: record3.turnMappings.map(({ nativeTurnRef }) => nativeTurnRef),
|
|
25897
|
+
...restoredSelection?.model ? { model: restoredSelection.model } : {},
|
|
25898
|
+
...restoredSelection?.thinkingOptionId ? { thinkingOptionId: restoredSelection.thinkingOptionId } : {},
|
|
25885
25899
|
...harnessId === "grok" && restoredSelection?.permissionModeId ? { permissionModeId: restoredSelection.permissionModeId } : {}
|
|
25886
25900
|
});
|
|
25887
25901
|
if (!opened.ok) {
|
|
@@ -27798,25 +27812,25 @@ function resolveExternalSessionTreeIds(records) {
|
|
|
27798
27812
|
const resolve = (start) => {
|
|
27799
27813
|
const cached2 = resolved.get(start.hostThreadId);
|
|
27800
27814
|
if (cached2) return cached2;
|
|
27801
|
-
const
|
|
27815
|
+
const path26 = [];
|
|
27802
27816
|
const visited = /* @__PURE__ */ new Set();
|
|
27803
27817
|
let current = start;
|
|
27804
27818
|
while (true) {
|
|
27805
27819
|
const known = resolved.get(current.hostThreadId);
|
|
27806
27820
|
if (known) {
|
|
27807
|
-
for (const record3 of
|
|
27821
|
+
for (const record3 of path26) resolved.set(record3.hostThreadId, known);
|
|
27808
27822
|
return known;
|
|
27809
27823
|
}
|
|
27810
27824
|
if (visited.has(current.hostThreadId)) {
|
|
27811
27825
|
throw new Error("External Thread Fork tree contains a cycle");
|
|
27812
27826
|
}
|
|
27813
27827
|
visited.add(current.hostThreadId);
|
|
27814
|
-
|
|
27828
|
+
path26.push(current);
|
|
27815
27829
|
const sourceId = current.forkSource?.hostThreadId;
|
|
27816
27830
|
const source = sourceId ? byId.get(sourceId) : void 0;
|
|
27817
27831
|
if (!source) {
|
|
27818
27832
|
const root = current.hostThreadId;
|
|
27819
|
-
for (const record3 of
|
|
27833
|
+
for (const record3 of path26) resolved.set(record3.hostThreadId, root);
|
|
27820
27834
|
return root;
|
|
27821
27835
|
}
|
|
27822
27836
|
current = source;
|
|
@@ -28361,6 +28375,8 @@ function approvalServerName(harnessId) {
|
|
|
28361
28375
|
return "Oh My Pi";
|
|
28362
28376
|
case "antigravity":
|
|
28363
28377
|
return "Antigravity CLI";
|
|
28378
|
+
case "kiro-cli":
|
|
28379
|
+
return "Kiro CLI";
|
|
28364
28380
|
default:
|
|
28365
28381
|
return harnessId;
|
|
28366
28382
|
}
|
|
@@ -32107,6 +32123,40 @@ var AppServerHost = class {
|
|
|
32107
32123
|
}
|
|
32108
32124
|
};
|
|
32109
32125
|
|
|
32126
|
+
// packages/host-runtime/src/codex-runtime/account-official-listeners.ts
|
|
32127
|
+
import path13 from "node:path";
|
|
32128
|
+
var AccountOfficialListeners = class {
|
|
32129
|
+
constructor(createListener) {
|
|
32130
|
+
this.createListener = createListener;
|
|
32131
|
+
}
|
|
32132
|
+
createListener;
|
|
32133
|
+
#listeners = /* @__PURE__ */ new Map();
|
|
32134
|
+
#starting = /* @__PURE__ */ new Map();
|
|
32135
|
+
#closed = false;
|
|
32136
|
+
async endpoint(account) {
|
|
32137
|
+
if (this.#closed) throw new Error("Account official listeners are closed");
|
|
32138
|
+
const key = path13.resolve(account.codexHome);
|
|
32139
|
+
const existing = this.#starting.get(key);
|
|
32140
|
+
if (existing) return existing;
|
|
32141
|
+
const listener = this.createListener(account);
|
|
32142
|
+
this.#listeners.set(key, listener);
|
|
32143
|
+
const starting = listener.listen().catch(async (error51) => {
|
|
32144
|
+
await listener.close();
|
|
32145
|
+
this.#listeners.delete(key);
|
|
32146
|
+
this.#starting.delete(key);
|
|
32147
|
+
throw error51;
|
|
32148
|
+
});
|
|
32149
|
+
this.#starting.set(key, starting);
|
|
32150
|
+
return starting;
|
|
32151
|
+
}
|
|
32152
|
+
async close() {
|
|
32153
|
+
this.#closed = true;
|
|
32154
|
+
await Promise.all([...this.#listeners.values()].map((listener) => listener.close()));
|
|
32155
|
+
this.#listeners.clear();
|
|
32156
|
+
this.#starting.clear();
|
|
32157
|
+
}
|
|
32158
|
+
};
|
|
32159
|
+
|
|
32110
32160
|
// packages/host-runtime/src/delegation-control-registry.ts
|
|
32111
32161
|
function only(values, message) {
|
|
32112
32162
|
const value2 = values.length === 1 ? values[0] : void 0;
|
|
@@ -32215,17 +32265,17 @@ var DelegationControlRegistry = class {
|
|
|
32215
32265
|
|
|
32216
32266
|
// packages/host-runtime/src/installed-harness-plugins.ts
|
|
32217
32267
|
import os3 from "node:os";
|
|
32218
|
-
import
|
|
32268
|
+
import path15 from "node:path";
|
|
32219
32269
|
import { fileURLToPath } from "node:url";
|
|
32220
32270
|
|
|
32221
32271
|
// packages/host-runtime/src/launcher-url-opener.ts
|
|
32222
32272
|
import { spawn as spawn3 } from "node:child_process";
|
|
32223
|
-
import
|
|
32273
|
+
import path14 from "node:path";
|
|
32224
32274
|
var LOOPBACK_HOSTS = /* @__PURE__ */ new Set(["127.0.0.1", "localhost", "[::1]"]);
|
|
32225
32275
|
var OPEN_TIMEOUT_MS = 1e4;
|
|
32226
32276
|
function createLauncherUrlOpener(environment, spawnLauncher = (command, arguments_2, options2) => spawn3(command, arguments_2, options2)) {
|
|
32227
32277
|
const launcher = environment.CODEXHOST_LAUNCHER_EXECUTABLE;
|
|
32228
|
-
if (!launcher || !
|
|
32278
|
+
if (!launcher || !path14.isAbsolute(launcher)) return void 0;
|
|
32229
32279
|
const launcherEnvironment = Object.fromEntries(
|
|
32230
32280
|
Object.entries(environment).filter(([name]) => {
|
|
32231
32281
|
const normalized = name.toUpperCase();
|
|
@@ -32283,9 +32333,9 @@ function installedHarnessPluginOptions(environment, managedRemoteHost = false, h
|
|
|
32283
32333
|
const opener = managedRemoteHost ? void 0 : createLauncherUrlOpener(environment);
|
|
32284
32334
|
return {
|
|
32285
32335
|
pluginRoots: [
|
|
32286
|
-
|
|
32287
|
-
environment[HARNESS_PLUGIN_DIRECTORY_ENV] ??
|
|
32288
|
-
environment.CODEXHOST_DATA_DIR ?
|
|
32336
|
+
path15.join(path15.dirname(fileURLToPath(hostRuntimeUrl)), "plugins"),
|
|
32337
|
+
environment[HARNESS_PLUGIN_DIRECTORY_ENV] ?? path15.join(
|
|
32338
|
+
environment.CODEXHOST_DATA_DIR ? path15.resolve(environment.CODEXHOST_DATA_DIR) : path15.join(os3.homedir(), ".codexhost"),
|
|
32289
32339
|
"plugins"
|
|
32290
32340
|
)
|
|
32291
32341
|
],
|
|
@@ -32410,9 +32460,9 @@ async function startDelegationControlServer(input) {
|
|
|
32410
32460
|
import { createHash as createHash6, randomUUID as randomUUID9 } from "node:crypto";
|
|
32411
32461
|
import { mkdir as mkdir7, open as open5, readFile as readFile8, rename as rename5, rm as rm5, stat as stat3 } from "node:fs/promises";
|
|
32412
32462
|
import os4 from "node:os";
|
|
32413
|
-
import
|
|
32463
|
+
import path16 from "node:path";
|
|
32414
32464
|
var SKILL_VERSION = 5;
|
|
32415
|
-
var SKILL_RELATIVE_PATH =
|
|
32465
|
+
var SKILL_RELATIVE_PATH = path16.join("skills", "codexhost-delegation", "SKILL.md");
|
|
32416
32466
|
var PREVIOUS_MANAGED_DIGESTS = [
|
|
32417
32467
|
"aff258622dc8ff321f32b15620d081e578cb9c9ed1134d6a57f35ca8e7762c0a",
|
|
32418
32468
|
"ba509f57e5448e796b3dfdd5031dcb08672eded50b61c0a54de84cfa02c49dd3",
|
|
@@ -32501,8 +32551,8 @@ async function readOptional(filePath) {
|
|
|
32501
32551
|
}
|
|
32502
32552
|
}
|
|
32503
32553
|
async function atomicWrite(filePath, content) {
|
|
32504
|
-
await mkdir7(
|
|
32505
|
-
const temporaryPath =
|
|
32554
|
+
await mkdir7(path16.dirname(filePath), { recursive: true, mode: 448 });
|
|
32555
|
+
const temporaryPath = path16.join(path16.dirname(filePath), `.SKILL.md.${randomUUID9()}.tmp`);
|
|
32506
32556
|
const handle = await open5(temporaryPath, "wx", 384);
|
|
32507
32557
|
try {
|
|
32508
32558
|
await handle.writeFile(content, "utf8");
|
|
@@ -32519,8 +32569,8 @@ async function atomicWrite(filePath, content) {
|
|
|
32519
32569
|
async function installDelegationSkills(input = {}) {
|
|
32520
32570
|
const home = input.homeDirectory ?? os4.homedir();
|
|
32521
32571
|
const destinations = [
|
|
32522
|
-
|
|
32523
|
-
|
|
32572
|
+
path16.join(home, ".agents", SKILL_RELATIVE_PATH),
|
|
32573
|
+
path16.join(home, ".claude", SKILL_RELATIVE_PATH)
|
|
32524
32574
|
];
|
|
32525
32575
|
const knownDigests = /* @__PURE__ */ new Set([
|
|
32526
32576
|
CURRENT_DIGEST,
|
|
@@ -32587,7 +32637,7 @@ async function installDelegationSkills(input = {}) {
|
|
|
32587
32637
|
// packages/host-runtime/src/remote-control-app-server.ts
|
|
32588
32638
|
import { randomUUID as randomUUID10 } from "node:crypto";
|
|
32589
32639
|
import { mkdir as mkdir8, open as open6, rename as rename6, rm as rm6 } from "node:fs/promises";
|
|
32590
|
-
import
|
|
32640
|
+
import path17 from "node:path";
|
|
32591
32641
|
|
|
32592
32642
|
// packages/host-runtime/src/remote-official-connection.ts
|
|
32593
32643
|
import net from "node:net";
|
|
@@ -32777,8 +32827,8 @@ var BRIDGE_READY_METHOD = "codexhost/remote-control-bridge/ready";
|
|
|
32777
32827
|
function absoluteEnvironmentPath2(environment, name, fallback, platform = process.platform) {
|
|
32778
32828
|
const value2 = environment[name] ?? fallback;
|
|
32779
32829
|
if (!value2) return null;
|
|
32780
|
-
if (
|
|
32781
|
-
return platform === "win32" &&
|
|
32830
|
+
if (path17.isAbsolute(value2)) return path17.normalize(value2);
|
|
32831
|
+
return platform === "win32" && path17.win32.isAbsolute(value2) ? path17.win32.normalize(value2) : null;
|
|
32782
32832
|
}
|
|
32783
32833
|
function nodeCompatibleWindowsPath(value2) {
|
|
32784
32834
|
if (value2.startsWith("\\\\?\\UNC\\")) return `\\\\${value2.slice(8)}`;
|
|
@@ -32792,13 +32842,13 @@ function remoteControlBridgePipePath(processId = process.pid, instanceId = rando
|
|
|
32792
32842
|
}
|
|
32793
32843
|
function remoteControlBridgeDescriptorPath(environment) {
|
|
32794
32844
|
const root = environment.LOCALAPPDATA;
|
|
32795
|
-
if (!root || !
|
|
32796
|
-
return
|
|
32845
|
+
if (!root || !path17.isAbsolute(root)) return null;
|
|
32846
|
+
return path17.join(path17.normalize(root), "codexhost", REMOTE_CONTROL_BRIDGE_DESCRIPTOR_FILE);
|
|
32797
32847
|
}
|
|
32798
32848
|
async function publishRemoteControlAppServerDescriptor(plan) {
|
|
32799
|
-
const directory =
|
|
32849
|
+
const directory = path17.dirname(plan.descriptorPath);
|
|
32800
32850
|
await mkdir8(directory, { recursive: true, mode: 448 });
|
|
32801
|
-
const temporaryPath =
|
|
32851
|
+
const temporaryPath = path17.join(
|
|
32802
32852
|
directory,
|
|
32803
32853
|
`.${REMOTE_CONTROL_BRIDGE_DESCRIPTOR_FILE}.${plan.descriptor.ownerPid}.${randomUUID10()}.tmp`
|
|
32804
32854
|
);
|
|
@@ -32891,14 +32941,14 @@ async function runRemoteControlAppServerBridge(input = {}) {
|
|
|
32891
32941
|
import { createServer as createServer2 } from "node:http";
|
|
32892
32942
|
import net2 from "node:net";
|
|
32893
32943
|
import { chmod as chmod3, lstat as lstat6, mkdir as mkdir10, rm as rm8 } from "node:fs/promises";
|
|
32894
|
-
import
|
|
32944
|
+
import path19 from "node:path";
|
|
32895
32945
|
import { PassThrough as PassThrough2 } from "node:stream";
|
|
32896
32946
|
|
|
32897
32947
|
// packages/host-runtime/src/remote-socket-lock.ts
|
|
32898
32948
|
import { randomUUID as randomUUID11 } from "node:crypto";
|
|
32899
32949
|
import { chmod as chmod2, lstat as lstat5, mkdir as mkdir9, open as open7, readFile as readFile9, readdir as readdir4, rename as rename7, rm as rm7 } from "node:fs/promises";
|
|
32900
32950
|
import { uptime } from "node:os";
|
|
32901
|
-
import
|
|
32951
|
+
import path18 from "node:path";
|
|
32902
32952
|
import { setTimeout as delay4 } from "node:timers/promises";
|
|
32903
32953
|
var LOCK_RETRY_COUNT = 200;
|
|
32904
32954
|
var LOCK_RETRY_DELAY_MS = 25;
|
|
@@ -32972,7 +33022,7 @@ async function readLockEntrySnapshot(filePath) {
|
|
|
32972
33022
|
source,
|
|
32973
33023
|
identity: { dev: metadata.dev, ino: metadata.ino },
|
|
32974
33024
|
mtimeMs: metadata.mtimeMs,
|
|
32975
|
-
record: record3 &&
|
|
33025
|
+
record: record3 && path18.basename(filePath) === lockEntryName(record3.ownerToken) ? record3 : null
|
|
32976
33026
|
};
|
|
32977
33027
|
}
|
|
32978
33028
|
function lockEntryIsAbandoned(snapshot) {
|
|
@@ -32993,7 +33043,7 @@ async function readLockEntryCatalog(lockDirectory) {
|
|
|
32993
33043
|
let unsettled = false;
|
|
32994
33044
|
for (const name of names) {
|
|
32995
33045
|
if (!name.startsWith(LOCK_ENTRY_PREFIX) || !name.endsWith(LOCK_ENTRY_SUFFIX)) continue;
|
|
32996
|
-
const snapshot = await readLockEntrySnapshot(
|
|
33046
|
+
const snapshot = await readLockEntrySnapshot(path18.join(lockDirectory, name));
|
|
32997
33047
|
if (snapshot === null) continue;
|
|
32998
33048
|
if (lockEntryIsAbandoned(snapshot)) {
|
|
32999
33049
|
if (!await removeAbandonedLockEntry(snapshot)) unsettled = true;
|
|
@@ -33021,7 +33071,7 @@ async function preparePrivateLockDirectory(lockDirectory) {
|
|
|
33021
33071
|
await chmod2(lockDirectory, 448);
|
|
33022
33072
|
}
|
|
33023
33073
|
async function writeLockRecordAtomic(lockDirectory, entryPath, record3) {
|
|
33024
|
-
const temporary =
|
|
33074
|
+
const temporary = path18.join(lockDirectory, `.tmp-${record3.ownerToken}-${randomUUID11()}`);
|
|
33025
33075
|
const handle = await open7(temporary, "wx", 384);
|
|
33026
33076
|
try {
|
|
33027
33077
|
await handle.writeFile(`${JSON.stringify(record3)}
|
|
@@ -33097,7 +33147,7 @@ async function withRemoteAppServerSocketInitializationLock(socketPath, action) {
|
|
|
33097
33147
|
const lockDirectory = `${socketPath}.initializers`;
|
|
33098
33148
|
await preparePrivateLockDirectory(lockDirectory);
|
|
33099
33149
|
const ownerToken = randomUUID11();
|
|
33100
|
-
const entryPath =
|
|
33150
|
+
const entryPath = path18.join(lockDirectory, lockEntryName(ownerToken));
|
|
33101
33151
|
const baseRecord = {
|
|
33102
33152
|
version: 2,
|
|
33103
33153
|
ownerToken,
|
|
@@ -33271,14 +33321,14 @@ function remoteAppServerSocketPath(environment, listenUrl = "unix://") {
|
|
|
33271
33321
|
throw new Error("Remote app-server listener must use a Unix URL");
|
|
33272
33322
|
}
|
|
33273
33323
|
const explicit = listenUrl.slice("unix://".length);
|
|
33274
|
-
if (explicit.length > 0) return
|
|
33275
|
-
const codexHome = environment.CODEX_HOME ?? (environment.HOME ?
|
|
33324
|
+
if (explicit.length > 0) return path19.posix.resolve(decodeURIComponent(explicit));
|
|
33325
|
+
const codexHome = environment.CODEX_HOME ?? (environment.HOME ? path19.posix.join(environment.HOME, ".codex") : void 0);
|
|
33276
33326
|
if (!codexHome)
|
|
33277
33327
|
throw new Error("CODEX_HOME or HOME is required for the remote app-server socket");
|
|
33278
|
-
return
|
|
33328
|
+
return path19.posix.join(codexHome, "app-server-control", "app-server-control.sock");
|
|
33279
33329
|
}
|
|
33280
33330
|
function officialListenerArgumentsForRemoteListener(arguments_2, socketPath) {
|
|
33281
|
-
if (!
|
|
33331
|
+
if (!path19.posix.isAbsolute(socketPath)) {
|
|
33282
33332
|
throw new Error("Shared official app-server socket path must be absolute");
|
|
33283
33333
|
}
|
|
33284
33334
|
if (remoteUnixListenerUrl(arguments_2) === null) {
|
|
@@ -33389,7 +33439,7 @@ async function removeStaleSocket(socketPath) {
|
|
|
33389
33439
|
await rm8(socketPath, { force: true });
|
|
33390
33440
|
}
|
|
33391
33441
|
async function prepareRemoteAppServerSocketDirectory(socketPath) {
|
|
33392
|
-
const socketDirectory =
|
|
33442
|
+
const socketDirectory = path19.dirname(socketPath);
|
|
33393
33443
|
const existing = await lstat6(socketDirectory).catch((error51) => {
|
|
33394
33444
|
if (error51.code === "ENOENT") return null;
|
|
33395
33445
|
throw error51;
|
|
@@ -33596,18 +33646,18 @@ function createRemoteAppServerWebSocketListener(input) {
|
|
|
33596
33646
|
import { spawn as spawn4 } from "node:child_process";
|
|
33597
33647
|
import { randomUUID as randomUUID12 } from "node:crypto";
|
|
33598
33648
|
import { lstat as lstat7, rm as rm9 } from "node:fs/promises";
|
|
33599
|
-
import
|
|
33649
|
+
import path20 from "node:path";
|
|
33600
33650
|
var DEFAULT_CLOSE_TIMEOUT_MS = 2e3;
|
|
33601
33651
|
var DEFAULT_LISTEN_TIMEOUT_MS = 1e4;
|
|
33602
33652
|
function remoteOfficialAppServerSocketPath(desktopControlSocketPath, token = randomUUID12()) {
|
|
33603
|
-
if (!
|
|
33653
|
+
if (!path20.posix.isAbsolute(desktopControlSocketPath)) {
|
|
33604
33654
|
throw new Error("Desktop control socket path must be absolute");
|
|
33605
33655
|
}
|
|
33606
33656
|
if (!/^[A-Za-z0-9-]+$/u.test(token) || !/[A-Za-z0-9]/u.test(token)) {
|
|
33607
33657
|
throw new Error("Shared official app-server socket token is invalid");
|
|
33608
33658
|
}
|
|
33609
33659
|
const compactToken = token.replaceAll("-", "").slice(0, 15);
|
|
33610
|
-
return
|
|
33660
|
+
return path20.posix.join(path20.posix.dirname(desktopControlSocketPath), `.c-${compactToken}.sock`);
|
|
33611
33661
|
}
|
|
33612
33662
|
function errorMessage5(error51) {
|
|
33613
33663
|
return error51 instanceof Error ? error51.message : String(error51);
|
|
@@ -34074,9 +34124,9 @@ function hasLauncherManagedUpdateRuntime(environment, hostRuntimePath) {
|
|
|
34074
34124
|
if (!environment[UPDATE_RUNTIME_ENV.launcherPid]) return false;
|
|
34075
34125
|
const npmPackageRoot = environment[UPDATE_RUNTIME_ENV.npmPackageRoot];
|
|
34076
34126
|
if (!npmPackageRoot || !hostRuntimePath) return true;
|
|
34077
|
-
if (!
|
|
34078
|
-
const runtimePackageRoot =
|
|
34079
|
-
return
|
|
34127
|
+
if (!path21.isAbsolute(npmPackageRoot) || !path21.isAbsolute(hostRuntimePath)) return false;
|
|
34128
|
+
const runtimePackageRoot = path21.dirname(path21.dirname(path21.normalize(hostRuntimePath)));
|
|
34129
|
+
return path21.relative(path21.normalize(npmPackageRoot), runtimePackageRoot) === "";
|
|
34080
34130
|
}
|
|
34081
34131
|
function requiredRuntimeConfiguration(environment) {
|
|
34082
34132
|
const stockCodexPath = environment[STOCK_CODEX_PATH_ENV];
|
|
@@ -34157,19 +34207,15 @@ async function runHostRuntime(input) {
|
|
|
34157
34207
|
const officialPlan = createRemoteControlOfficialAppServerPlan(
|
|
34158
34208
|
remoteControlPlan.officialArguments
|
|
34159
34209
|
);
|
|
34160
|
-
const
|
|
34161
|
-
|
|
34162
|
-
|
|
34163
|
-
|
|
34164
|
-
|
|
34165
|
-
|
|
34166
|
-
|
|
34167
|
-
|
|
34168
|
-
|
|
34169
|
-
throw new Error("Shared official app-server endpoint is unavailable");
|
|
34170
|
-
}
|
|
34171
|
-
return createRemoteOfficialAppServerConnection(officialEndpoint);
|
|
34172
|
-
};
|
|
34210
|
+
const officialListeners = new AccountOfficialListeners(
|
|
34211
|
+
(account) => createLoopbackOfficialAppServerListener({
|
|
34212
|
+
stockCodexPath,
|
|
34213
|
+
arguments: officialPlan.listenerArguments,
|
|
34214
|
+
environment: officialAccountEnvironment(delegationEnvironment, account),
|
|
34215
|
+
diagnosticOutput: process.stderr
|
|
34216
|
+
})
|
|
34217
|
+
);
|
|
34218
|
+
const createOfficialConnection = async (account) => createRemoteOfficialAppServerConnection(await officialListeners.endpoint(account));
|
|
34173
34219
|
const mappingStore = createProductionExternalThreadStore(delegationEnvironment);
|
|
34174
34220
|
await mappingStore.initialize();
|
|
34175
34221
|
const host = new AppServerHost({
|
|
@@ -34206,7 +34252,11 @@ async function runHostRuntime(input) {
|
|
|
34206
34252
|
}
|
|
34207
34253
|
});
|
|
34208
34254
|
try {
|
|
34209
|
-
|
|
34255
|
+
await officialListeners.endpoint({
|
|
34256
|
+
codexHome: path21.resolve(
|
|
34257
|
+
delegationEnvironment.CODEX_HOME ?? path21.join(homedir(), ".codex")
|
|
34258
|
+
)
|
|
34259
|
+
});
|
|
34210
34260
|
await listener.listen();
|
|
34211
34261
|
await publishRemoteControlAppServerDescriptor(remoteControlPlan);
|
|
34212
34262
|
return await host.run();
|
|
@@ -34215,7 +34265,7 @@ async function runHostRuntime(input) {
|
|
|
34215
34265
|
await listener.close();
|
|
34216
34266
|
} finally {
|
|
34217
34267
|
try {
|
|
34218
|
-
await
|
|
34268
|
+
await officialListeners.close();
|
|
34219
34269
|
} finally {
|
|
34220
34270
|
await mappingStore.close();
|
|
34221
34271
|
}
|
|
@@ -34320,7 +34370,7 @@ import {
|
|
|
34320
34370
|
stat as stat4,
|
|
34321
34371
|
writeFile as writeFile5
|
|
34322
34372
|
} from "node:fs/promises";
|
|
34323
|
-
import
|
|
34373
|
+
import path22 from "node:path";
|
|
34324
34374
|
var MANIFEST_FORMAT = 1;
|
|
34325
34375
|
var WRAPPER_MARKER = "# codexhost remote SSH wrapper v1";
|
|
34326
34376
|
var PROFILE_START = "# >>> codexhost remote SSH >>>";
|
|
@@ -34331,25 +34381,25 @@ function resolvePaths(options2) {
|
|
|
34331
34381
|
if (!configuredHome) {
|
|
34332
34382
|
throw new Error("A non-root HOME is required for remote Host installation");
|
|
34333
34383
|
}
|
|
34334
|
-
const home =
|
|
34335
|
-
if (!home || home ===
|
|
34384
|
+
const home = path22.resolve(configuredHome);
|
|
34385
|
+
if (!home || home === path22.parse(home).root) {
|
|
34336
34386
|
throw new Error("A non-root HOME is required for remote Host installation");
|
|
34337
34387
|
}
|
|
34338
|
-
const installRoot =
|
|
34339
|
-
const profilePath =
|
|
34340
|
-
options2.profilePath ??
|
|
34388
|
+
const installRoot = path22.resolve(options2.installRoot ?? path22.join(home, ".codexhost", "remote"));
|
|
34389
|
+
const profilePath = path22.resolve(
|
|
34390
|
+
options2.profilePath ?? path22.join(
|
|
34341
34391
|
home,
|
|
34342
|
-
|
|
34392
|
+
path22.basename(environment.SHELL ?? "") === "zsh" ? ".zshenv" : path22.basename(environment.SHELL ?? "") === "bash" ? ".bashrc" : ".profile"
|
|
34343
34393
|
)
|
|
34344
34394
|
);
|
|
34345
|
-
const binDirectory =
|
|
34395
|
+
const binDirectory = path22.join(installRoot, "bin");
|
|
34346
34396
|
return {
|
|
34347
34397
|
home,
|
|
34348
34398
|
installRoot,
|
|
34349
34399
|
binDirectory,
|
|
34350
|
-
wrapperPath:
|
|
34351
|
-
manifestPath:
|
|
34352
|
-
dataDirectory:
|
|
34400
|
+
wrapperPath: path22.join(binDirectory, "codex"),
|
|
34401
|
+
manifestPath: path22.join(installRoot, "manifest.json"),
|
|
34402
|
+
dataDirectory: path22.join(installRoot, "data"),
|
|
34353
34403
|
profilePath
|
|
34354
34404
|
};
|
|
34355
34405
|
}
|
|
@@ -34368,7 +34418,7 @@ async function fileSha256(filePath) {
|
|
|
34368
34418
|
return createHash7("sha256").update(await readFile10(filePath)).digest("hex");
|
|
34369
34419
|
}
|
|
34370
34420
|
async function executable(filePath, label) {
|
|
34371
|
-
const absolute =
|
|
34421
|
+
const absolute = path22.resolve(filePath);
|
|
34372
34422
|
try {
|
|
34373
34423
|
if (!(await stat4(absolute)).isFile()) throw new Error("not a regular file");
|
|
34374
34424
|
await access(absolute, fsConstants.X_OK);
|
|
@@ -34378,7 +34428,7 @@ async function executable(filePath, label) {
|
|
|
34378
34428
|
return absolute;
|
|
34379
34429
|
}
|
|
34380
34430
|
async function existingFile(filePath, label) {
|
|
34381
|
-
const absolute =
|
|
34431
|
+
const absolute = path22.resolve(filePath);
|
|
34382
34432
|
try {
|
|
34383
34433
|
const metadata = await stat4(absolute);
|
|
34384
34434
|
if (!metadata.isFile()) throw new Error("not a regular file");
|
|
@@ -34388,9 +34438,9 @@ async function existingFile(filePath, label) {
|
|
|
34388
34438
|
return absolute;
|
|
34389
34439
|
}
|
|
34390
34440
|
async function discoverExecutable(name, environment) {
|
|
34391
|
-
for (const directory of (environment.PATH ?? "").split(
|
|
34441
|
+
for (const directory of (environment.PATH ?? "").split(path22.delimiter)) {
|
|
34392
34442
|
if (!directory) continue;
|
|
34393
|
-
const candidate =
|
|
34443
|
+
const candidate = path22.resolve(directory, name);
|
|
34394
34444
|
try {
|
|
34395
34445
|
await access(candidate, fsConstants.X_OK);
|
|
34396
34446
|
return candidate;
|
|
@@ -34401,10 +34451,10 @@ async function discoverExecutable(name, environment) {
|
|
|
34401
34451
|
return null;
|
|
34402
34452
|
}
|
|
34403
34453
|
async function writeAtomic(filePath, contents, mode) {
|
|
34404
|
-
await mkdir11(
|
|
34405
|
-
const temporary =
|
|
34406
|
-
|
|
34407
|
-
`.${
|
|
34454
|
+
await mkdir11(path22.dirname(filePath), { recursive: true, mode: 448 });
|
|
34455
|
+
const temporary = path22.join(
|
|
34456
|
+
path22.dirname(filePath),
|
|
34457
|
+
`.${path22.basename(filePath)}.${process.pid}.${randomUUID13()}.tmp`
|
|
34408
34458
|
);
|
|
34409
34459
|
try {
|
|
34410
34460
|
if (typeof contents === "string") {
|
|
@@ -34425,10 +34475,10 @@ async function writeAtomic(filePath, contents, mode) {
|
|
|
34425
34475
|
}
|
|
34426
34476
|
}
|
|
34427
34477
|
async function writeAtomicExecutable(filePath, sourcePath) {
|
|
34428
|
-
await mkdir11(
|
|
34429
|
-
const temporary =
|
|
34430
|
-
|
|
34431
|
-
`.${
|
|
34478
|
+
await mkdir11(path22.dirname(filePath), { recursive: true, mode: 448 });
|
|
34479
|
+
const temporary = path22.join(
|
|
34480
|
+
path22.dirname(filePath),
|
|
34481
|
+
`.${path22.basename(filePath)}.${process.pid}.${randomUUID13()}.tmp`
|
|
34432
34482
|
);
|
|
34433
34483
|
try {
|
|
34434
34484
|
await copyFile3(sourcePath, temporary);
|
|
@@ -34469,8 +34519,8 @@ function removeManagedProfileBlock(contents) {
|
|
|
34469
34519
|
function installManagedProfileBlock(contents, manifest) {
|
|
34470
34520
|
const base = removeManagedProfileBlock(contents);
|
|
34471
34521
|
const environment = [
|
|
34472
|
-
`export CODEX_INSTALL_DIR=${shellQuote(
|
|
34473
|
-
`export PATH=${shellQuote(
|
|
34522
|
+
`export CODEX_INSTALL_DIR=${shellQuote(path22.dirname(manifest.wrapperPath))}`,
|
|
34523
|
+
`export PATH=${shellQuote(path22.dirname(manifest.wrapperPath))}:${shellQuote(path22.dirname(manifest.nodePath))}:${shellQuote(path22.dirname(manifest.stockCodexPath))}:"\${PATH:-/usr/local/bin:/usr/bin:/bin}"`,
|
|
34474
34524
|
`export CODEXHOST_STOCK_CODEX_PATH=${shellQuote(manifest.stockCodexPath)}`,
|
|
34475
34525
|
`export CODEXHOST_HOST_NODE_PATH=${shellQuote(manifest.nodePath)}`,
|
|
34476
34526
|
`export CODEXHOST_HOST_RUNTIME_PATH=${shellQuote(manifest.hostRuntimePath)}`,
|
|
@@ -34487,7 +34537,7 @@ function installManagedProfileBlock(contents, manifest) {
|
|
|
34487
34537
|
PROFILE_END,
|
|
34488
34538
|
""
|
|
34489
34539
|
].join("\n");
|
|
34490
|
-
if (
|
|
34540
|
+
if (path22.basename(manifest.profilePath) === ".bashrc") return `${block}${base}`;
|
|
34491
34541
|
const separator = base.length > 0 && !base.endsWith("\n") ? "\n" : "";
|
|
34492
34542
|
return `${base}${separator}${block}`;
|
|
34493
34543
|
}
|
|
@@ -34552,9 +34602,9 @@ async function readManifest(filePath) {
|
|
|
34552
34602
|
];
|
|
34553
34603
|
const optionalPaths = ["claudeCommand", "profileBackupPath"];
|
|
34554
34604
|
if (manifest.format !== MANIFEST_FORMAT || Object.keys(manifest).some((key) => !allowed.has(key)) || requiredPaths.some(
|
|
34555
|
-
(key) => typeof manifest[key] !== "string" || !
|
|
34605
|
+
(key) => typeof manifest[key] !== "string" || !path22.isAbsolute(manifest[key])
|
|
34556
34606
|
) || optionalPaths.some(
|
|
34557
|
-
(key) => manifest[key] !== void 0 && (typeof manifest[key] !== "string" || !
|
|
34607
|
+
(key) => manifest[key] !== void 0 && (typeof manifest[key] !== "string" || !path22.isAbsolute(manifest[key]))
|
|
34558
34608
|
) || manifest.entrypointSha256 !== void 0 && (typeof manifest.entrypointSha256 !== "string" || !/^[a-f0-9]{64}$/u.test(manifest.entrypointSha256))) {
|
|
34559
34609
|
throw new Error("Remote Host manifest has an unsupported format");
|
|
34560
34610
|
}
|
|
@@ -34783,7 +34833,7 @@ async function uninstallRemoteHost(options2) {
|
|
|
34783
34833
|
import { spawn as spawn5 } from "node:child_process";
|
|
34784
34834
|
import { stat as stat5 } from "node:fs/promises";
|
|
34785
34835
|
import net3 from "node:net";
|
|
34786
|
-
import
|
|
34836
|
+
import path23 from "node:path";
|
|
34787
34837
|
import { Duplex } from "node:stream";
|
|
34788
34838
|
var CODEXHOST_STATUS_METHOD = "codexhost/update/status";
|
|
34789
34839
|
var DIRECT_PROBE_TIMEOUT_MS = 5e3;
|
|
@@ -34802,9 +34852,9 @@ function classifyRemoteHostProbeResponse(response, socketPath) {
|
|
|
34802
34852
|
}
|
|
34803
34853
|
var lifecycleDependencyOverrides = {};
|
|
34804
34854
|
function socketPathFor(environment) {
|
|
34805
|
-
const codexHome = environment.CODEX_HOME ?? (environment.HOME ?
|
|
34855
|
+
const codexHome = environment.CODEX_HOME ?? (environment.HOME ? path23.join(environment.HOME, ".codex") : void 0);
|
|
34806
34856
|
if (!codexHome) throw new Error("CODEX_HOME or HOME is required for remote Host lifecycle");
|
|
34807
|
-
return
|
|
34857
|
+
return path23.join(codexHome, "app-server-control", "app-server-control.sock");
|
|
34808
34858
|
}
|
|
34809
34859
|
async function defaultSocketExists(socketPath) {
|
|
34810
34860
|
const metadata = await stat5(socketPath).catch((error51) => {
|
|
@@ -34934,7 +34984,7 @@ function installedManifest(status) {
|
|
|
34934
34984
|
function managedEnvironment(manifest, environment) {
|
|
34935
34985
|
return {
|
|
34936
34986
|
...environment,
|
|
34937
|
-
CODEX_INSTALL_DIR:
|
|
34987
|
+
CODEX_INSTALL_DIR: path23.dirname(manifest.wrapperPath),
|
|
34938
34988
|
CODEXHOST_STOCK_CODEX_PATH: manifest.stockCodexPath,
|
|
34939
34989
|
CODEXHOST_HOST_NODE_PATH: manifest.nodePath,
|
|
34940
34990
|
CODEXHOST_HOST_RUNTIME_PATH: manifest.hostRuntimePath,
|
|
@@ -34942,7 +34992,7 @@ function managedEnvironment(manifest, environment) {
|
|
|
34942
34992
|
CODEXHOST_DEFAULT_AGENT: "codex",
|
|
34943
34993
|
CODEXHOST_REMOTE_SSH_MANAGED: "1",
|
|
34944
34994
|
...manifest.claudeCommand ? { CODEXHOST_CLAUDE_COMMAND: manifest.claudeCommand } : {},
|
|
34945
|
-
PATH: `${
|
|
34995
|
+
PATH: `${path23.dirname(manifest.wrapperPath)}${path23.delimiter}${path23.dirname(manifest.stockCodexPath)}${path23.delimiter}${environment.PATH ?? "/usr/bin:/bin"}`
|
|
34946
34996
|
};
|
|
34947
34997
|
}
|
|
34948
34998
|
async function defaultRunTerminator(manifest, socketPath, role, environment) {
|
|
@@ -35284,19 +35334,19 @@ function consumeBrokerFrames(socket, onFrame, onError) {
|
|
|
35284
35334
|
|
|
35285
35335
|
// packages/harness-broker/dist/paths.js
|
|
35286
35336
|
import os5 from "node:os";
|
|
35287
|
-
import
|
|
35337
|
+
import path24 from "node:path";
|
|
35288
35338
|
var HARNESS_BROKER_DESCRIPTOR_ENV = "CODEXHOST_CLAUDE_BROKER_DESCRIPTOR";
|
|
35289
35339
|
var HARNESS_BROKER_DESCRIPTOR_FILE = "claude-code-broker-v1.json";
|
|
35290
35340
|
var HARNESS_BROKER_SOCKET_FILE = "claude-code-broker-v1.sock";
|
|
35291
35341
|
function defaultHarnessBrokerDirectory(environment = process.env) {
|
|
35292
35342
|
const home = environment.HOME || os5.homedir();
|
|
35293
|
-
return
|
|
35343
|
+
return path24.join(home, ".codexhost", "harness-broker");
|
|
35294
35344
|
}
|
|
35295
35345
|
function defaultHarnessBrokerDescriptorPath(environment = process.env) {
|
|
35296
|
-
return environment[HARNESS_BROKER_DESCRIPTOR_ENV] ??
|
|
35346
|
+
return environment[HARNESS_BROKER_DESCRIPTOR_ENV] ?? path24.join(defaultHarnessBrokerDirectory(environment), HARNESS_BROKER_DESCRIPTOR_FILE);
|
|
35297
35347
|
}
|
|
35298
35348
|
function defaultHarnessBrokerSocketPath(environment = process.env) {
|
|
35299
|
-
return
|
|
35349
|
+
return path24.join(defaultHarnessBrokerDirectory(environment), HARNESS_BROKER_SOCKET_FILE);
|
|
35300
35350
|
}
|
|
35301
35351
|
|
|
35302
35352
|
// packages/harness-broker/dist/validation.js
|
|
@@ -35311,6 +35361,8 @@ var createSchema = external_exports.object({
|
|
|
35311
35361
|
}).strict();
|
|
35312
35362
|
var resumeSchema = external_exports.object({
|
|
35313
35363
|
kind: external_exports.literal("resume"),
|
|
35364
|
+
model: harnessModelRefSchema.optional(),
|
|
35365
|
+
thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
35314
35366
|
nativeRef: nativeSessionRefSchema,
|
|
35315
35367
|
cwd: cwdSchema,
|
|
35316
35368
|
knownTurnRefs: external_exports.array(nativeTurnRefSchema).max(1e5).optional()
|
|
@@ -35323,6 +35375,9 @@ var forkSchema = external_exports.object({
|
|
|
35323
35375
|
}).strict();
|
|
35324
35376
|
var rollbackSchema = external_exports.object({
|
|
35325
35377
|
kind: external_exports.literal("rollbackLastTurn"),
|
|
35378
|
+
model: harnessModelRefSchema.optional(),
|
|
35379
|
+
thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
35380
|
+
permissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
35326
35381
|
sourceRef: nativeSessionRefSchema,
|
|
35327
35382
|
cwd: cwdSchema
|
|
35328
35383
|
}).strict();
|
|
@@ -35517,7 +35572,7 @@ var harnessOutputSchema = external_exports.custom((value2) => {
|
|
|
35517
35572
|
import { randomBytes as randomBytes2, randomUUID as randomUUID14 } from "node:crypto";
|
|
35518
35573
|
import { chmod as chmod5, lstat as lstat9, mkdir as mkdir12, open as open8, readFile as readFile11, rename as rename9, rm as rm11 } from "node:fs/promises";
|
|
35519
35574
|
import net4, {} from "node:net";
|
|
35520
|
-
import
|
|
35575
|
+
import path25 from "node:path";
|
|
35521
35576
|
function harnessError(message, retryable = true) {
|
|
35522
35577
|
return { code: "unavailable", message, retryable, stage: "harnessBroker" };
|
|
35523
35578
|
}
|
|
@@ -35642,13 +35697,13 @@ async function startHarnessBrokerServer(input) {
|
|
|
35642
35697
|
if (input.adapter.harnessId !== "claude-code") {
|
|
35643
35698
|
throw new Error("Harness broker accepts only the claude-code adapter");
|
|
35644
35699
|
}
|
|
35645
|
-
if (process.platform !== "win32" &&
|
|
35700
|
+
if (process.platform !== "win32" && path25.dirname(input.descriptorPath) !== path25.dirname(input.socketPath)) {
|
|
35646
35701
|
throw new Error("Harness broker descriptor and socket must share one private directory");
|
|
35647
35702
|
}
|
|
35648
35703
|
if (process.platform === "darwin" && Buffer.byteLength(input.socketPath) > 103) {
|
|
35649
35704
|
throw new Error("Harness broker Unix socket path is too long for macOS");
|
|
35650
35705
|
}
|
|
35651
|
-
await privateDirectory(
|
|
35706
|
+
await privateDirectory(path25.dirname(input.descriptorPath));
|
|
35652
35707
|
await assertNoLiveDescriptor(input.descriptorPath);
|
|
35653
35708
|
if (process.platform !== "win32")
|
|
35654
35709
|
await prepareUnixSocketPath(input.socketPath);
|