@karlorz/codexhost-cli-win32-x64 0.13.3-6 → 0.14.0-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-server.mjs +539 -95
- package/app/console-web.js +879 -73
- package/app/cpa-live-voice-hook.js +605 -37
- package/app/desktop-controller.mjs +94 -9
- package/app/host-runtime.mjs +1662 -642
- package/app/plugins/antigravity/plugin.mjs +113 -13
- package/app/plugins/claude-code/plugin.mjs +429 -26
- package/app/plugins/codebuddy/plugin.mjs +139 -22
- package/app/plugins/codex-usage/plugin.mjs +198 -74
- package/app/plugins/copilot/assets/icon.png +0 -0
- package/app/plugins/copilot/manifest.json +26 -0
- package/app/plugins/copilot/plugin.mjs +34645 -0
- package/app/plugins/cursor-cli/plugin.mjs +20877 -44973
- package/app/plugins/deepseek-harness/plugin.mjs +105 -11
- package/app/plugins/enabled.json +1 -0
- package/app/plugins/grok/plugin.mjs +1073 -214
- package/app/plugins/hermes/plugin.mjs +102 -9
- package/app/plugins/kimi-code/plugin.mjs +98 -7
- package/app/plugins/kiro-cli/plugin.mjs +98 -7
- package/app/plugins/omp/plugin.mjs +2177 -2000
- package/app/plugins/opencode/plugin.mjs +107 -11
- package/app/plugins/pi/plugin.mjs +2554 -2285
- package/app/plugins/qoder/plugin.mjs +105 -11
- package/app/plugins/qoder-cn/plugin.mjs +105 -11
- package/app/plugins/workbuddy/plugin.mjs +400 -46
- package/app/plugins/zcode/plugin.mjs +106 -11
- package/app/renderer-extension.js +2717 -1237
- 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/console-server.mjs
CHANGED
|
@@ -5,7 +5,7 @@ var __export = (target, all) => {
|
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
// packages/console-server/src/main.ts
|
|
8
|
-
import
|
|
8
|
+
import path21 from "node:path";
|
|
9
9
|
import { fileURLToPath } from "node:url";
|
|
10
10
|
|
|
11
11
|
// packages/update-manager/dist/runtime-metadata.js
|
|
@@ -891,7 +891,7 @@ function createBackgroundUpdateManager(dependencies = {}) {
|
|
|
891
891
|
}
|
|
892
892
|
|
|
893
893
|
// packages/console-server/src/harnesses.ts
|
|
894
|
-
import
|
|
894
|
+
import path12 from "node:path";
|
|
895
895
|
|
|
896
896
|
// packages/harness-plugin-files/dist/discovery.js
|
|
897
897
|
import { readdir as readdir2, realpath as realpath2 } from "node:fs/promises";
|
|
@@ -1663,10 +1663,10 @@ function mergeDefs(...defs) {
|
|
|
1663
1663
|
function cloneDef(schema) {
|
|
1664
1664
|
return mergeDefs(schema._zod.def);
|
|
1665
1665
|
}
|
|
1666
|
-
function getElementAtPath(obj,
|
|
1667
|
-
if (!
|
|
1666
|
+
function getElementAtPath(obj, path22) {
|
|
1667
|
+
if (!path22)
|
|
1668
1668
|
return obj;
|
|
1669
|
-
return
|
|
1669
|
+
return path22.reduce((acc, key) => acc?.[key], obj);
|
|
1670
1670
|
}
|
|
1671
1671
|
function promiseAllObject(promisesObj) {
|
|
1672
1672
|
const keys = Object.keys(promisesObj);
|
|
@@ -2075,11 +2075,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
2075
2075
|
}
|
|
2076
2076
|
return false;
|
|
2077
2077
|
}
|
|
2078
|
-
function prefixIssues(
|
|
2078
|
+
function prefixIssues(path22, issues) {
|
|
2079
2079
|
return issues.map((iss) => {
|
|
2080
2080
|
var _a3;
|
|
2081
2081
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
2082
|
-
iss.path.unshift(
|
|
2082
|
+
iss.path.unshift(path22);
|
|
2083
2083
|
return iss;
|
|
2084
2084
|
});
|
|
2085
2085
|
}
|
|
@@ -2226,16 +2226,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
2226
2226
|
}
|
|
2227
2227
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
2228
2228
|
const fieldErrors = { _errors: [] };
|
|
2229
|
-
const processError = (error52,
|
|
2229
|
+
const processError = (error52, path22 = []) => {
|
|
2230
2230
|
for (const issue2 of error52.issues) {
|
|
2231
2231
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
2232
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
2232
|
+
issue2.errors.map((issues) => processError({ issues }, [...path22, ...issue2.path]));
|
|
2233
2233
|
} else if (issue2.code === "invalid_key") {
|
|
2234
|
-
processError({ issues: issue2.issues }, [...
|
|
2234
|
+
processError({ issues: issue2.issues }, [...path22, ...issue2.path]);
|
|
2235
2235
|
} else if (issue2.code === "invalid_element") {
|
|
2236
|
-
processError({ issues: issue2.issues }, [...
|
|
2236
|
+
processError({ issues: issue2.issues }, [...path22, ...issue2.path]);
|
|
2237
2237
|
} else {
|
|
2238
|
-
const fullpath = [...
|
|
2238
|
+
const fullpath = [...path22, ...issue2.path];
|
|
2239
2239
|
if (fullpath.length === 0) {
|
|
2240
2240
|
fieldErrors._errors.push(mapper(issue2));
|
|
2241
2241
|
} else {
|
|
@@ -2262,17 +2262,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
2262
2262
|
}
|
|
2263
2263
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
2264
2264
|
const result = { errors: [] };
|
|
2265
|
-
const processError = (error52,
|
|
2265
|
+
const processError = (error52, path22 = []) => {
|
|
2266
2266
|
var _a3, _b;
|
|
2267
2267
|
for (const issue2 of error52.issues) {
|
|
2268
2268
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
2269
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
2269
|
+
issue2.errors.map((issues) => processError({ issues }, [...path22, ...issue2.path]));
|
|
2270
2270
|
} else if (issue2.code === "invalid_key") {
|
|
2271
|
-
processError({ issues: issue2.issues }, [...
|
|
2271
|
+
processError({ issues: issue2.issues }, [...path22, ...issue2.path]);
|
|
2272
2272
|
} else if (issue2.code === "invalid_element") {
|
|
2273
|
-
processError({ issues: issue2.issues }, [...
|
|
2273
|
+
processError({ issues: issue2.issues }, [...path22, ...issue2.path]);
|
|
2274
2274
|
} else {
|
|
2275
|
-
const fullpath = [...
|
|
2275
|
+
const fullpath = [...path22, ...issue2.path];
|
|
2276
2276
|
if (fullpath.length === 0) {
|
|
2277
2277
|
result.errors.push(mapper(issue2));
|
|
2278
2278
|
continue;
|
|
@@ -2304,8 +2304,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
2304
2304
|
}
|
|
2305
2305
|
function toDotPath(_path) {
|
|
2306
2306
|
const segs = [];
|
|
2307
|
-
const
|
|
2308
|
-
for (const seg of
|
|
2307
|
+
const path22 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
2308
|
+
for (const seg of path22) {
|
|
2309
2309
|
if (typeof seg === "number")
|
|
2310
2310
|
segs.push(`[${seg}]`);
|
|
2311
2311
|
else if (typeof seg === "symbol")
|
|
@@ -14997,13 +14997,13 @@ function resolveRef(ref, ctx) {
|
|
|
14997
14997
|
if (!ref.startsWith("#")) {
|
|
14998
14998
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
14999
14999
|
}
|
|
15000
|
-
const
|
|
15001
|
-
if (
|
|
15000
|
+
const path22 = ref.slice(1).split("/").filter(Boolean);
|
|
15001
|
+
if (path22.length === 0) {
|
|
15002
15002
|
return ctx.rootSchema;
|
|
15003
15003
|
}
|
|
15004
15004
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
15005
|
-
if (
|
|
15006
|
-
const key =
|
|
15005
|
+
if (path22[0] === defsKey) {
|
|
15006
|
+
const key = path22[1];
|
|
15007
15007
|
if (!key || !ctx.defs[key]) {
|
|
15008
15008
|
throw new Error(`Reference not found: ${ref}`);
|
|
15009
15009
|
}
|
|
@@ -15548,10 +15548,19 @@ var model = external_exports.string().min(1).max(512);
|
|
|
15548
15548
|
var project = external_exports.string().min(1).max(4096);
|
|
15549
15549
|
var usageStatisticsParamsSchema = external_exports.strictObject({
|
|
15550
15550
|
range: external_exports.enum(USAGE_STATISTICS_RANGES),
|
|
15551
|
+
/** Display timezone for ranges, dates and hourly buckets; omitted means the Host's local zone. */
|
|
15552
|
+
timeZone: external_exports.string().min(1).max(128).refine((value) => {
|
|
15553
|
+
try {
|
|
15554
|
+
new Intl.DateTimeFormat("en", { timeZone: value });
|
|
15555
|
+
return true;
|
|
15556
|
+
} catch {
|
|
15557
|
+
return false;
|
|
15558
|
+
}
|
|
15559
|
+
}, "Unsupported usage statistics timezone").optional(),
|
|
15551
15560
|
harness: harness.optional(),
|
|
15552
15561
|
model: model.nullable().optional(),
|
|
15553
15562
|
project: project.nullable().optional(),
|
|
15554
|
-
/** One
|
|
15563
|
+
/** One date in the query timezone inside the range. */
|
|
15555
15564
|
date: localDate.optional()
|
|
15556
15565
|
});
|
|
15557
15566
|
var usageStatisticsTotalsSchema = external_exports.strictObject({
|
|
@@ -15587,7 +15596,7 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
|
|
|
15587
15596
|
});
|
|
15588
15597
|
var usageStatisticsResultSchema = external_exports.strictObject({
|
|
15589
15598
|
range: external_exports.enum(USAGE_STATISTICS_RANGES),
|
|
15590
|
-
/** First
|
|
15599
|
+
/** First date in the query timezone (Host local when omitted); null for all time. */
|
|
15591
15600
|
from: localDate.nullable(),
|
|
15592
15601
|
to: localDate,
|
|
15593
15602
|
/** The filters these figures apply, echoed so a late answer to older filters is recognised. */
|
|
@@ -15627,7 +15636,7 @@ var usageStatisticsResultSchema = external_exports.strictObject({
|
|
|
15627
15636
|
totals: usageStatisticsTotalsSchema,
|
|
15628
15637
|
/** Each date and Harness of the range: every filter except the day. */
|
|
15629
15638
|
daily: external_exports.array(external_exports.strictObject({ date: localDate, harness, ...totals })).max(2e5),
|
|
15630
|
-
/**
|
|
15639
|
+
/** Weekday (0 = Sunday) and hour in the query timezone, all filters applied. */
|
|
15631
15640
|
hourly: external_exports.array(external_exports.strictObject({
|
|
15632
15641
|
weekday: external_exports.number().int().min(0).max(6),
|
|
15633
15642
|
hour: external_exports.number().int().min(0).max(23),
|
|
@@ -15718,8 +15727,12 @@ var CONSOLE_HOST_METHODS = Object.freeze([
|
|
|
15718
15727
|
"codexhost/harness/display-settings/set",
|
|
15719
15728
|
"codexhost/harness/inspect",
|
|
15720
15729
|
"codexhost/harness/installation",
|
|
15730
|
+
"codexhost/harness/installation/start",
|
|
15731
|
+
"codexhost/harness/installation/status",
|
|
15721
15732
|
"codexhost/harness/launch-settings/get",
|
|
15722
15733
|
"codexhost/harness/launch-settings/set",
|
|
15734
|
+
"codexhost/harness/grok-computer-use/get",
|
|
15735
|
+
"codexhost/harness/grok-computer-use/set",
|
|
15723
15736
|
"codexhost/harness/web-ui/open",
|
|
15724
15737
|
"codexhost/harness/accounts/sources",
|
|
15725
15738
|
"codexhost/harness/accounts/list",
|
|
@@ -15796,7 +15809,18 @@ var threadManualCompactionStartedSchema = external_exports.strictObject({
|
|
|
15796
15809
|
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
|
|
15797
15810
|
var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
|
|
15798
15811
|
var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
|
|
15812
|
+
var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text) => text.length <= maximum));
|
|
15813
|
+
var composerIndicatorsSchema = external_exports.array(external_exports.object({
|
|
15814
|
+
kind: external_exports.literal("countdown"),
|
|
15815
|
+
id: external_exports.string().min(1).max(64),
|
|
15816
|
+
expiresAtUnix: nonNegativeSafeIntegerSchema,
|
|
15817
|
+
label: indicatorTextSchema(256).optional(),
|
|
15818
|
+
tooltip: indicatorTextSchema(1024).optional()
|
|
15819
|
+
}).strict()).max(2).refine((entries) => new Set(entries.map(({ id }) => id)).size === entries.length, {
|
|
15820
|
+
message: "Composer indicator IDs must be unique"
|
|
15821
|
+
});
|
|
15799
15822
|
var threadUsageSnapshotSchema = external_exports.object({
|
|
15823
|
+
composerIndicators: composerIndicatorsSchema.optional(),
|
|
15800
15824
|
inputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
15801
15825
|
cachedInputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
15802
15826
|
cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
@@ -16204,7 +16228,9 @@ var harnessSessionCapabilitiesSchema = external_exports.object({
|
|
|
16204
16228
|
}).strict().optional(),
|
|
16205
16229
|
autonomousTurns: external_exports.object({
|
|
16206
16230
|
observe: external_exports.boolean()
|
|
16207
|
-
}).strict().optional()
|
|
16231
|
+
}).strict().optional(),
|
|
16232
|
+
/** True only when `turn.steer` delivers input into the active Turn through a native primitive. */
|
|
16233
|
+
steer: external_exports.boolean().optional()
|
|
16208
16234
|
}).strict();
|
|
16209
16235
|
var harnessConfigurationStateSchema = external_exports.object({
|
|
16210
16236
|
effectiveModel: harnessModelRefSchema.optional(),
|
|
@@ -16251,7 +16277,9 @@ var harnessInspectionSchema = external_exports.union([
|
|
|
16251
16277
|
var harnessInspectParamsSchema = external_exports.object({
|
|
16252
16278
|
harnessId: harnessIdSchema,
|
|
16253
16279
|
cwd: nonBlankTextSchema2.max(16384).optional(),
|
|
16254
|
-
refresh: external_exports.boolean().optional()
|
|
16280
|
+
refresh: external_exports.boolean().optional(),
|
|
16281
|
+
/** `availability` asks only whether the Harness can run; see `InspectHarnessInput.purpose`. */
|
|
16282
|
+
purpose: external_exports.literal("availability").optional()
|
|
16255
16283
|
}).strict();
|
|
16256
16284
|
var harnessWebUiOpenParamsSchema = external_exports.object({
|
|
16257
16285
|
harnessId: harnessIdSchema
|
|
@@ -16334,6 +16362,15 @@ var threadOwnershipListResultSchema = external_exports.object({
|
|
|
16334
16362
|
seen.add(thread.threadId);
|
|
16335
16363
|
}
|
|
16336
16364
|
});
|
|
16365
|
+
var threadSteeringInspectParamsSchema = external_exports.object({
|
|
16366
|
+
threadId: hostThreadIdSchema,
|
|
16367
|
+
/** The text about to be steered; a Harness command always stops and restarts. */
|
|
16368
|
+
text: external_exports.string().optional()
|
|
16369
|
+
}).strict();
|
|
16370
|
+
var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
|
|
16371
|
+
var threadSteeringInspectResultSchema = external_exports.object({
|
|
16372
|
+
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
16373
|
+
}).strict();
|
|
16337
16374
|
|
|
16338
16375
|
// packages/shared-contracts/dist/harness-plugins.js
|
|
16339
16376
|
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
@@ -16425,6 +16462,26 @@ var harnessLaunchSettingsSchema = external_exports.object({
|
|
|
16425
16462
|
restartRequired: external_exports.boolean()
|
|
16426
16463
|
}).strict();
|
|
16427
16464
|
|
|
16465
|
+
// packages/shared-contracts/dist/grok-computer-use.js
|
|
16466
|
+
var grokComputerUseGetSchema = external_exports.object({}).strict();
|
|
16467
|
+
var grokComputerUseSetSchema = external_exports.object({
|
|
16468
|
+
enabled: external_exports.boolean().optional(),
|
|
16469
|
+
browser: external_exports.boolean().optional()
|
|
16470
|
+
}).strict().refine((value) => value.enabled !== void 0 || value.browser !== void 0, {
|
|
16471
|
+
message: "Expected enabled or browser"
|
|
16472
|
+
});
|
|
16473
|
+
var grokComputerUseSettingsSchema = external_exports.object({
|
|
16474
|
+
enabled: external_exports.boolean(),
|
|
16475
|
+
available: external_exports.boolean(),
|
|
16476
|
+
unavailableReason: external_exports.string().min(1).max(500).optional(),
|
|
16477
|
+
browser: external_exports.boolean().optional(),
|
|
16478
|
+
browserFilesPresent: external_exports.boolean().optional(),
|
|
16479
|
+
browserAvailable: external_exports.boolean().optional(),
|
|
16480
|
+
browserUnavailableReason: external_exports.string().min(1).max(500).optional(),
|
|
16481
|
+
applyFailed: external_exports.boolean().optional(),
|
|
16482
|
+
applyError: external_exports.string().min(1).max(500).optional()
|
|
16483
|
+
}).strict();
|
|
16484
|
+
|
|
16428
16485
|
// packages/shared-contracts/dist/harness-installation.js
|
|
16429
16486
|
var harnessInstallationParamsSchema = external_exports.object({
|
|
16430
16487
|
harnessId: harnessIdSchema,
|
|
@@ -16435,6 +16492,10 @@ var harnessInstallationStateSchema = external_exports.object({
|
|
|
16435
16492
|
latestVersion: external_exports.string().min(1).max(128),
|
|
16436
16493
|
updateAvailable: external_exports.boolean(),
|
|
16437
16494
|
canUpdate: external_exports.boolean(),
|
|
16495
|
+
/** Defaults to CLI; some Harnesses ship only inside a desktop application. */
|
|
16496
|
+
versionKind: external_exports.enum(["cli", "application"]).optional(),
|
|
16497
|
+
/** Official download opened by the user; does not imply an automatic installation. */
|
|
16498
|
+
manualUpdateUrl: external_exports.url().max(2048).refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Manual updates require a credential-free HTTPS URL").optional(),
|
|
16438
16499
|
// Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
|
|
16439
16500
|
message: external_exports.string().max(2048).optional(),
|
|
16440
16501
|
messageCode: external_exports.string().min(1).max(128).optional(),
|
|
@@ -16442,6 +16503,20 @@ var harnessInstallationStateSchema = external_exports.object({
|
|
|
16442
16503
|
notice: harnessLocalizedTextSchema.optional(),
|
|
16443
16504
|
latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
|
|
16444
16505
|
}).strict();
|
|
16506
|
+
var harnessInstallationTaskParamsSchema = external_exports.object({ taskId: external_exports.string().uuid() }).strict();
|
|
16507
|
+
var harnessInstallationTaskSchema = external_exports.discriminatedUnion("status", [
|
|
16508
|
+
external_exports.object({ taskId: external_exports.string().uuid(), status: external_exports.literal("running") }).strict(),
|
|
16509
|
+
external_exports.object({
|
|
16510
|
+
taskId: external_exports.string().uuid(),
|
|
16511
|
+
status: external_exports.literal("succeeded"),
|
|
16512
|
+
result: harnessInstallationStateSchema
|
|
16513
|
+
}).strict(),
|
|
16514
|
+
external_exports.object({
|
|
16515
|
+
taskId: external_exports.string().uuid(),
|
|
16516
|
+
status: external_exports.literal("failed"),
|
|
16517
|
+
error: external_exports.object({ code: external_exports.number().int(), message: external_exports.string().min(1).max(2048) }).strict()
|
|
16518
|
+
}).strict()
|
|
16519
|
+
]);
|
|
16445
16520
|
|
|
16446
16521
|
// packages/shared-contracts/dist/codex-accounts.js
|
|
16447
16522
|
var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
|
|
@@ -17057,23 +17132,365 @@ var HarnessLaunchSettingsStore = class {
|
|
|
17057
17132
|
}
|
|
17058
17133
|
};
|
|
17059
17134
|
|
|
17060
|
-
// packages/
|
|
17135
|
+
// packages/harness-plugin-files/dist/grok-computer-use.js
|
|
17136
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
17137
|
+
import { access, mkdir as mkdir5, readFile as readFile5, rename as rename3, rm as rm5, writeFile as writeFile4 } from "node:fs/promises";
|
|
17061
17138
|
import os2 from "node:os";
|
|
17139
|
+
import path10 from "node:path";
|
|
17140
|
+
|
|
17141
|
+
// packages/harness-plugin-files/dist/grok-computer-use-lock.js
|
|
17142
|
+
import { mkdir as mkdir4, rm as rm4 } from "node:fs/promises";
|
|
17062
17143
|
import path9 from "node:path";
|
|
17144
|
+
import { setTimeout as delay3 } from "node:timers/promises";
|
|
17145
|
+
async function withGrokComputerUseLock(dataDirectory3, grokHome2, operation) {
|
|
17146
|
+
const locks = [
|
|
17147
|
+
.../* @__PURE__ */ new Set([
|
|
17148
|
+
path9.join(dataDirectory3, ".grok-computer-use.lock"),
|
|
17149
|
+
path9.join(grokHome2, ".codexhost-cua.lock")
|
|
17150
|
+
])
|
|
17151
|
+
].sort();
|
|
17152
|
+
const acquired = [];
|
|
17153
|
+
const deadline = Date.now() + 5e3;
|
|
17154
|
+
try {
|
|
17155
|
+
for (const lock of locks) {
|
|
17156
|
+
await mkdir4(path9.dirname(lock), { recursive: true, mode: 448 });
|
|
17157
|
+
for (; ; ) {
|
|
17158
|
+
try {
|
|
17159
|
+
await mkdir4(lock, { mode: 448 });
|
|
17160
|
+
acquired.push(lock);
|
|
17161
|
+
break;
|
|
17162
|
+
} catch (error51) {
|
|
17163
|
+
if (error51.code !== "EEXIST")
|
|
17164
|
+
throw error51;
|
|
17165
|
+
if (Date.now() >= deadline)
|
|
17166
|
+
throw new Error("Grok Computer Use settings are locked");
|
|
17167
|
+
await delay3(25);
|
|
17168
|
+
}
|
|
17169
|
+
}
|
|
17170
|
+
}
|
|
17171
|
+
return await operation();
|
|
17172
|
+
} finally {
|
|
17173
|
+
for (const lock of acquired.reverse())
|
|
17174
|
+
await rm4(lock, { recursive: true });
|
|
17175
|
+
}
|
|
17176
|
+
}
|
|
17177
|
+
|
|
17178
|
+
// packages/harness-plugin-files/dist/grok-computer-use.js
|
|
17179
|
+
var GROK_BROWSER_BINDING_SUPPORTED = false;
|
|
17180
|
+
var PREFERENCE_FILE = "grok-computer-use.json";
|
|
17181
|
+
var TABLE = "[mcp_servers.cua_repl]";
|
|
17182
|
+
var ENV_TABLE = "[mcp_servers.cua_repl.env]";
|
|
17183
|
+
var COMPUTER_UNAVAILABLE = "ChatGPT Desktop Computer Use files were not found. Install ChatGPT.app with Computer Use, then try again.";
|
|
17184
|
+
var BROWSER_FILES_UNAVAILABLE = "ChatGPT Desktop in-app browser files were not found. Update ChatGPT.app, then try again.";
|
|
17185
|
+
var BROWSER_UNSUPPORTED = "ChatGPT Desktop does not authorize Grok to use the in-app browser. The preference is saved as intent until Desktop supports an external Harness.";
|
|
17186
|
+
var APPLY_FAILED = "Could not apply Grok Computer Use settings to Grok config.";
|
|
17187
|
+
var GrokComputerUseError = class extends Error {
|
|
17188
|
+
constructor(message) {
|
|
17189
|
+
super(message);
|
|
17190
|
+
this.name = "GrokComputerUseError";
|
|
17191
|
+
}
|
|
17192
|
+
};
|
|
17193
|
+
function dataDirectory(environment) {
|
|
17194
|
+
return environment.CODEXHOST_DATA_DIR ? path10.resolve(environment.CODEXHOST_DATA_DIR) : path10.join(os2.homedir(), ".codexhost");
|
|
17195
|
+
}
|
|
17196
|
+
function grokHome(environment) {
|
|
17197
|
+
return environment.GROK_HOME ? path10.resolve(environment.GROK_HOME) : path10.join(environment.HOME ?? os2.homedir(), ".grok");
|
|
17198
|
+
}
|
|
17199
|
+
function chatgptApp(environment, platform) {
|
|
17200
|
+
if (environment.CODEXHOST_CHATGPT_APP)
|
|
17201
|
+
return path10.resolve(environment.CODEXHOST_CHATGPT_APP);
|
|
17202
|
+
if (platform === "darwin")
|
|
17203
|
+
return "/Applications/ChatGPT.app";
|
|
17204
|
+
return void 0;
|
|
17205
|
+
}
|
|
17206
|
+
async function isFile(target) {
|
|
17207
|
+
try {
|
|
17208
|
+
await access(target);
|
|
17209
|
+
return true;
|
|
17210
|
+
} catch {
|
|
17211
|
+
return false;
|
|
17212
|
+
}
|
|
17213
|
+
}
|
|
17214
|
+
function isNotFound(error51) {
|
|
17215
|
+
return Boolean(error51 && typeof error51 === "object" && "code" in error51 && error51.code === "ENOENT");
|
|
17216
|
+
}
|
|
17217
|
+
async function writeAtomically(file2, content) {
|
|
17218
|
+
await mkdir5(path10.dirname(file2), { recursive: true, mode: 448 });
|
|
17219
|
+
const temporary = `${file2}.${randomUUID3()}.tmp`;
|
|
17220
|
+
try {
|
|
17221
|
+
await writeFile4(temporary, content, { mode: 384, flag: "wx" });
|
|
17222
|
+
await rename3(temporary, file2);
|
|
17223
|
+
} finally {
|
|
17224
|
+
await rm5(temporary, { force: true });
|
|
17225
|
+
}
|
|
17226
|
+
}
|
|
17227
|
+
function launchPaths(environment, platform) {
|
|
17228
|
+
const app = chatgptApp(environment, platform);
|
|
17229
|
+
if (!app)
|
|
17230
|
+
return void 0;
|
|
17231
|
+
const resources = path10.join(app, "Contents", "Resources");
|
|
17232
|
+
const cuaNode = path10.join(resources, "cua_node");
|
|
17233
|
+
return {
|
|
17234
|
+
node: path10.join(cuaNode, "bin", "node"),
|
|
17235
|
+
cuaRepl: path10.join(cuaNode, "lib", "node_modules", "@oai", "cua-repl", "bin", "cua-repl.mjs"),
|
|
17236
|
+
nodeRepl: path10.join(cuaNode, "bin", "node_repl"),
|
|
17237
|
+
nodeModules: path10.join(cuaNode, "lib", "node_modules"),
|
|
17238
|
+
codexCli: path10.join(resources, "codex-cli", "bin", "codex"),
|
|
17239
|
+
skyApp: path10.join(environment.HOME ?? os2.homedir(), ".codex", "computer-use", "Codex Computer Use.app"),
|
|
17240
|
+
codexHome: path10.join(environment.HOME ?? os2.homedir(), ".codex"),
|
|
17241
|
+
browserDesktop: path10.join(cuaNode, "lib", "node_modules", "@oai", "browser-desktop")
|
|
17242
|
+
};
|
|
17243
|
+
}
|
|
17244
|
+
async function sharedRuntimePresent(launch) {
|
|
17245
|
+
const present = await Promise.all([launch.node, launch.cuaRepl, launch.nodeRepl].map(isFile));
|
|
17246
|
+
return present.every(Boolean);
|
|
17247
|
+
}
|
|
17248
|
+
async function computerFilesPresent(launch) {
|
|
17249
|
+
const present = await Promise.all([isFile(launch.skyApp), isFile(launch.codexCli)]);
|
|
17250
|
+
return present.every(Boolean);
|
|
17251
|
+
}
|
|
17252
|
+
async function browserFilesPresent(launch) {
|
|
17253
|
+
return isFile(path10.join(launch.browserDesktop, "package.json"));
|
|
17254
|
+
}
|
|
17255
|
+
async function discoverGrokComputerUseLaunch(environment = process.env, platform = process.platform) {
|
|
17256
|
+
const launch = launchPaths(environment, platform);
|
|
17257
|
+
if (!launch || !await sharedRuntimePresent(launch))
|
|
17258
|
+
return void 0;
|
|
17259
|
+
return launch;
|
|
17260
|
+
}
|
|
17261
|
+
function tableRange(text, header) {
|
|
17262
|
+
const lines = text.split(/\n/);
|
|
17263
|
+
let start = -1;
|
|
17264
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
17265
|
+
if (lines[index] === header) {
|
|
17266
|
+
start = index;
|
|
17267
|
+
break;
|
|
17268
|
+
}
|
|
17269
|
+
}
|
|
17270
|
+
if (start < 0)
|
|
17271
|
+
return void 0;
|
|
17272
|
+
let end = lines.length;
|
|
17273
|
+
for (let index = start + 1; index < lines.length; index += 1) {
|
|
17274
|
+
const line = lines[index] ?? "";
|
|
17275
|
+
if (line.startsWith("[") && line.endsWith("]")) {
|
|
17276
|
+
end = index;
|
|
17277
|
+
break;
|
|
17278
|
+
}
|
|
17279
|
+
}
|
|
17280
|
+
return { start, end };
|
|
17281
|
+
}
|
|
17282
|
+
function removeTables(text, headers) {
|
|
17283
|
+
let current = text;
|
|
17284
|
+
for (const header of headers) {
|
|
17285
|
+
const range = tableRange(current, header);
|
|
17286
|
+
if (!range)
|
|
17287
|
+
continue;
|
|
17288
|
+
const lines = current.split(/\n/);
|
|
17289
|
+
lines.splice(range.start, range.end - range.start);
|
|
17290
|
+
current = lines.join("\n");
|
|
17291
|
+
}
|
|
17292
|
+
return current.replace(/\n{3,}/g, "\n\n");
|
|
17293
|
+
}
|
|
17294
|
+
function cuaReplEnabledInToml(text) {
|
|
17295
|
+
const range = tableRange(text, TABLE);
|
|
17296
|
+
if (!range)
|
|
17297
|
+
return false;
|
|
17298
|
+
const body = text.split(/\n/).slice(range.start, range.end);
|
|
17299
|
+
for (const line of body) {
|
|
17300
|
+
if (/^enabled\s*=\s*false\b/u.test(line))
|
|
17301
|
+
return false;
|
|
17302
|
+
if (/^enabled\s*=\s*true\b/u.test(line))
|
|
17303
|
+
return true;
|
|
17304
|
+
}
|
|
17305
|
+
return true;
|
|
17306
|
+
}
|
|
17307
|
+
function inferredSurfaces(text) {
|
|
17308
|
+
if (!cuaReplEnabledInToml(text))
|
|
17309
|
+
return { enabled: false, browser: false };
|
|
17310
|
+
const range = tableRange(text, ENV_TABLE);
|
|
17311
|
+
const body = range ? text.split(/\n/).slice(range.start, range.end).join("\n") : "";
|
|
17312
|
+
const literal2 = /^CUA_REPL_ENABLED_SURFACES\s*=\s*(["'])([^"']*)\1\s*(?:#.*)?$/mu.exec(body);
|
|
17313
|
+
if (!literal2)
|
|
17314
|
+
return { enabled: true, browser: false };
|
|
17315
|
+
const surfaces = new Set(literal2[2]?.split(",").map((surface) => surface.trim()));
|
|
17316
|
+
return { enabled: surfaces.has("computer"), browser: surfaces.has("browser") };
|
|
17317
|
+
}
|
|
17318
|
+
function stanza(launch, state) {
|
|
17319
|
+
const trusted = `${launch.codexHome}:${launch.nodeModules}`;
|
|
17320
|
+
const services = {};
|
|
17321
|
+
if (state.browser)
|
|
17322
|
+
services.browser = "@oai/browser-desktop/service";
|
|
17323
|
+
if (state.enabled)
|
|
17324
|
+
services.sky = "@oai/sky/service";
|
|
17325
|
+
const surfaces = [state.browser ? "browser" : "", state.enabled ? "computer" : ""].filter(Boolean).join(",");
|
|
17326
|
+
const backends = state.browser ? 'BROWSER_USE_AVAILABLE_BACKENDS = "iab"\n' : "";
|
|
17327
|
+
const active = state.enabled || state.browser;
|
|
17328
|
+
return `${TABLE}
|
|
17329
|
+
command = ${JSON.stringify(launch.node)}
|
|
17330
|
+
args = [${JSON.stringify(launch.cuaRepl)}]
|
|
17331
|
+
enabled = ${active ? "true" : "false"}
|
|
17332
|
+
startup_timeout_sec = 120
|
|
17333
|
+
|
|
17334
|
+
${ENV_TABLE}
|
|
17335
|
+
NODE_REPL_TRUSTED_SERVICES = ${JSON.stringify(JSON.stringify(services))}
|
|
17336
|
+
NODE_REPL_TRUSTED_CODE_PATHS = ${JSON.stringify(trusted)}
|
|
17337
|
+
NODE_REPL_NODE_PATH = ${JSON.stringify(launch.node)}
|
|
17338
|
+
CODEX_HOME = ${JSON.stringify(launch.codexHome)}
|
|
17339
|
+
CUA_REPL_NODE_REPL_PATH = ${JSON.stringify(launch.nodeRepl)}
|
|
17340
|
+
NODE_REPL_NODE_MODULE_DIRS = ${JSON.stringify(launch.nodeModules)}
|
|
17341
|
+
NODE_REPL_NATIVE_PIPE_CONNECT_TIMEOUT_MS = "1000"
|
|
17342
|
+
SKY_CUA_SERVICE_PATH = ${JSON.stringify(launch.skyApp)}
|
|
17343
|
+
CODEX_CLI_PATH = ${JSON.stringify(launch.codexCli)}
|
|
17344
|
+
${backends}CUA_REPL_ENABLED_SURFACES = ${JSON.stringify(surfaces)}
|
|
17345
|
+
`;
|
|
17346
|
+
}
|
|
17347
|
+
async function readPreference(environment) {
|
|
17348
|
+
try {
|
|
17349
|
+
const document = JSON.parse(await readFile5(path10.join(dataDirectory(environment), PREFERENCE_FILE), "utf8"));
|
|
17350
|
+
return {
|
|
17351
|
+
...typeof document.enabled === "boolean" ? { enabled: document.enabled } : {},
|
|
17352
|
+
...typeof document.browser === "boolean" ? { browser: document.browser } : {},
|
|
17353
|
+
...typeof document.applyError === "string" && document.applyError ? { applyError: document.applyError } : {}
|
|
17354
|
+
};
|
|
17355
|
+
} catch (error51) {
|
|
17356
|
+
if (isNotFound(error51))
|
|
17357
|
+
return void 0;
|
|
17358
|
+
throw new GrokComputerUseError("Could not read Grok Computer Use settings");
|
|
17359
|
+
}
|
|
17360
|
+
}
|
|
17361
|
+
async function writePreference(environment, state) {
|
|
17362
|
+
const document = {
|
|
17363
|
+
...typeof state.enabled === "boolean" ? { enabled: state.enabled } : {},
|
|
17364
|
+
...typeof state.browser === "boolean" ? { browser: state.browser } : {},
|
|
17365
|
+
...state.applyError ? { applyError: state.applyError } : {}
|
|
17366
|
+
};
|
|
17367
|
+
await writeAtomically(path10.join(dataDirectory(environment), PREFERENCE_FILE), `${JSON.stringify(document)}
|
|
17368
|
+
`);
|
|
17369
|
+
}
|
|
17370
|
+
async function readGrokConfig(environment) {
|
|
17371
|
+
try {
|
|
17372
|
+
return await readFile5(path10.join(grokHome(environment), "config.toml"), "utf8");
|
|
17373
|
+
} catch (error51) {
|
|
17374
|
+
if (isNotFound(error51))
|
|
17375
|
+
return "";
|
|
17376
|
+
throw new GrokComputerUseError("Could not read Grok config");
|
|
17377
|
+
}
|
|
17378
|
+
}
|
|
17379
|
+
async function writeGrokConfig(environment, text) {
|
|
17380
|
+
await writeAtomically(path10.join(grokHome(environment), "config.toml"), text.endsWith("\n") ? text : `${text}
|
|
17381
|
+
`);
|
|
17382
|
+
}
|
|
17383
|
+
async function currentState(environment, preference) {
|
|
17384
|
+
const resolved = preference ?? await readPreference(environment);
|
|
17385
|
+
const inferred = resolved?.enabled === void 0 ? inferredSurfaces(await readGrokConfig(environment)) : void 0;
|
|
17386
|
+
return {
|
|
17387
|
+
enabled: resolved?.enabled ?? inferred?.enabled ?? false,
|
|
17388
|
+
browser: resolved ? resolved.browser ?? false : inferred?.browser ?? false,
|
|
17389
|
+
...resolved?.applyError ? { applyError: resolved.applyError } : {}
|
|
17390
|
+
};
|
|
17391
|
+
}
|
|
17392
|
+
function settingsFrom(state, files) {
|
|
17393
|
+
const bindable = files.browser && GROK_BROWSER_BINDING_SUPPORTED;
|
|
17394
|
+
return {
|
|
17395
|
+
enabled: state.enabled,
|
|
17396
|
+
available: files.computer,
|
|
17397
|
+
...files.computer ? {} : { unavailableReason: COMPUTER_UNAVAILABLE },
|
|
17398
|
+
browser: state.browser,
|
|
17399
|
+
browserFilesPresent: files.browser,
|
|
17400
|
+
browserAvailable: bindable,
|
|
17401
|
+
...bindable ? {} : {
|
|
17402
|
+
browserUnavailableReason: files.browser ? BROWSER_UNSUPPORTED : BROWSER_FILES_UNAVAILABLE
|
|
17403
|
+
},
|
|
17404
|
+
...state.applyError ? { applyFailed: true, applyError: state.applyError } : {}
|
|
17405
|
+
};
|
|
17406
|
+
}
|
|
17407
|
+
async function surfaceFiles(launch) {
|
|
17408
|
+
if (!launch)
|
|
17409
|
+
return { computer: false, browser: false };
|
|
17410
|
+
const [computer, browser] = await Promise.all([
|
|
17411
|
+
computerFilesPresent(launch),
|
|
17412
|
+
browserFilesPresent(launch)
|
|
17413
|
+
]);
|
|
17414
|
+
return { computer, browser };
|
|
17415
|
+
}
|
|
17416
|
+
async function getGrokComputerUseSettings(environment = process.env, platform = process.platform) {
|
|
17417
|
+
const launch = await discoverGrokComputerUseLaunch(environment, platform);
|
|
17418
|
+
return settingsFrom(await currentState(environment), await surfaceFiles(launch));
|
|
17419
|
+
}
|
|
17420
|
+
async function writeConfigForState(state, launch, files, environment) {
|
|
17421
|
+
const current = await readGrokConfig(environment);
|
|
17422
|
+
const range = tableRange(current, TABLE);
|
|
17423
|
+
const effective = {
|
|
17424
|
+
enabled: state.enabled && files.computer,
|
|
17425
|
+
browser: state.browser && files.browser && GROK_BROWSER_BINDING_SUPPORTED
|
|
17426
|
+
};
|
|
17427
|
+
if (!effective.enabled && !effective.browser && !range)
|
|
17428
|
+
return;
|
|
17429
|
+
if (!launch) {
|
|
17430
|
+
if (!range)
|
|
17431
|
+
return;
|
|
17432
|
+
const lines = current.split(/\n/);
|
|
17433
|
+
const body = lines.slice(range.start, range.end);
|
|
17434
|
+
const replaced = body.map((line) => /^enabled\s*=/u.test(line) ? "enabled = false" : line);
|
|
17435
|
+
if (!replaced.some((line) => /^enabled\s*=/u.test(line))) {
|
|
17436
|
+
replaced.splice(1, 0, "enabled = false");
|
|
17437
|
+
}
|
|
17438
|
+
lines.splice(range.start, range.end - range.start, ...replaced);
|
|
17439
|
+
await writeGrokConfig(environment, lines.join("\n"));
|
|
17440
|
+
return;
|
|
17441
|
+
}
|
|
17442
|
+
const stripped = removeTables(current, [ENV_TABLE, TABLE]).replace(/\s+$/u, "\n");
|
|
17443
|
+
await writeGrokConfig(environment, `${stripped.trimEnd()}
|
|
17444
|
+
|
|
17445
|
+
${stanza(launch, effective)}`);
|
|
17446
|
+
}
|
|
17447
|
+
async function setGrokComputerUse(update, environment = process.env, platform = process.platform) {
|
|
17448
|
+
return withGrokComputerUseLock(dataDirectory(environment), grokHome(environment), async () => {
|
|
17449
|
+
const launch = await discoverGrokComputerUseLaunch(environment, platform);
|
|
17450
|
+
const files = await surfaceFiles(launch);
|
|
17451
|
+
if (update.enabled && !files.computer) {
|
|
17452
|
+
throw new GrokComputerUseError(COMPUTER_UNAVAILABLE);
|
|
17453
|
+
}
|
|
17454
|
+
if (update.browser && !files.browser) {
|
|
17455
|
+
throw new GrokComputerUseError(BROWSER_FILES_UNAVAILABLE);
|
|
17456
|
+
}
|
|
17457
|
+
const previous = await currentState(environment);
|
|
17458
|
+
const state = {
|
|
17459
|
+
enabled: update.enabled ?? previous.enabled,
|
|
17460
|
+
browser: update.browser ?? previous.browser
|
|
17461
|
+
};
|
|
17462
|
+
try {
|
|
17463
|
+
await writeConfigForState(state, launch, files, environment);
|
|
17464
|
+
await writePreference(environment, state);
|
|
17465
|
+
} catch (error51) {
|
|
17466
|
+
await writeConfigForState(previous, launch, files, environment).catch(() => void 0);
|
|
17467
|
+
const applyError = error51 instanceof GrokComputerUseError ? error51.message : APPLY_FAILED;
|
|
17468
|
+
await writePreference(environment, { ...previous, applyError }).catch(() => void 0);
|
|
17469
|
+
if (error51 instanceof GrokComputerUseError)
|
|
17470
|
+
throw error51;
|
|
17471
|
+
throw new GrokComputerUseError(APPLY_FAILED);
|
|
17472
|
+
}
|
|
17473
|
+
return settingsFrom(state, files);
|
|
17474
|
+
});
|
|
17475
|
+
}
|
|
17476
|
+
|
|
17477
|
+
// packages/console-server/src/paths.ts
|
|
17478
|
+
import os3 from "node:os";
|
|
17479
|
+
import path11 from "node:path";
|
|
17063
17480
|
var DEFAULT_CONSOLE_PORT = 4399;
|
|
17064
17481
|
var CONSOLE_PORT_ENV = "CODEXHOST_CONSOLE_PORT";
|
|
17065
17482
|
var LAUNCHER_EXECUTABLE_ENV = "CODEXHOST_LAUNCHER_EXECUTABLE";
|
|
17066
|
-
function
|
|
17067
|
-
return environment.CODEXHOST_DATA_DIR ?
|
|
17483
|
+
function dataDirectory2(environment = process.env) {
|
|
17484
|
+
return environment.CODEXHOST_DATA_DIR ? path11.resolve(environment.CODEXHOST_DATA_DIR) : path11.join(os3.homedir(), ".codexhost");
|
|
17068
17485
|
}
|
|
17069
17486
|
function consolePaths(environment = process.env) {
|
|
17070
|
-
const root =
|
|
17487
|
+
const root = dataDirectory2(environment);
|
|
17071
17488
|
return {
|
|
17072
17489
|
dataDirectory: root,
|
|
17073
|
-
startupRecordFile:
|
|
17074
|
-
controllerStatusFile:
|
|
17075
|
-
logsDirectory:
|
|
17076
|
-
hostDescriptorDirectory:
|
|
17490
|
+
startupRecordFile: path11.join(root, "diagnostics", "launcher-startup-v1.json"),
|
|
17491
|
+
controllerStatusFile: path11.join(root, "diagnostics", "desktop-controller-v1.json"),
|
|
17492
|
+
logsDirectory: path11.join(root, "logs"),
|
|
17493
|
+
hostDescriptorDirectory: path11.join(root, "console", "hosts")
|
|
17077
17494
|
};
|
|
17078
17495
|
}
|
|
17079
17496
|
function consolePort(environment = process.env) {
|
|
@@ -17089,10 +17506,10 @@ function consolePort(environment = process.env) {
|
|
|
17089
17506
|
// packages/console-server/src/harnesses.ts
|
|
17090
17507
|
var HARNESS_PLUGIN_DIRECTORY_ENV = "CODEXHOST_PLUGIN_DIRECTORY";
|
|
17091
17508
|
function harnessPluginRoots(appDirectory2, sourceCheckout, environment = process.env) {
|
|
17092
|
-
const bundled = sourceCheckout ?
|
|
17509
|
+
const bundled = sourceCheckout ? path12.resolve(appDirectory2, "..", "..", "host-runtime", "dist", "plugins") : path12.join(appDirectory2, "plugins");
|
|
17093
17510
|
return [
|
|
17094
17511
|
bundled,
|
|
17095
|
-
environment[HARNESS_PLUGIN_DIRECTORY_ENV] ??
|
|
17512
|
+
environment[HARNESS_PLUGIN_DIRECTORY_ENV] ?? path12.join(dataDirectory2(environment), "plugins")
|
|
17096
17513
|
];
|
|
17097
17514
|
}
|
|
17098
17515
|
var ConsoleHarnessError = class extends Error {
|
|
@@ -17126,7 +17543,8 @@ function createConsoleHarnesses(roots, environment = process.env) {
|
|
|
17126
17543
|
launchCommand: manifest.launchCommand === true,
|
|
17127
17544
|
links: manifest.links ?? null,
|
|
17128
17545
|
icon,
|
|
17129
|
-
launchPath
|
|
17546
|
+
launchPath,
|
|
17547
|
+
...manifest.id === "grok" ? { computerUse: await getGrokComputerUseSettings(environment) } : {}
|
|
17130
17548
|
});
|
|
17131
17549
|
}
|
|
17132
17550
|
return harnesses.sort(
|
|
@@ -17147,17 +17565,27 @@ function createConsoleHarnesses(roots, environment = process.env) {
|
|
|
17147
17565
|
} catch (error51) {
|
|
17148
17566
|
throw new ConsoleHarnessError(400, error51 instanceof Error ? error51.message : String(error51));
|
|
17149
17567
|
}
|
|
17568
|
+
},
|
|
17569
|
+
async setGrokComputerUse(update) {
|
|
17570
|
+
const harness2 = (await list()).find((candidate) => candidate.id === "grok");
|
|
17571
|
+
if (!harness2) throw new ConsoleHarnessError(404, "Harness 'grok' is not installed");
|
|
17572
|
+
try {
|
|
17573
|
+
const computerUse = await setGrokComputerUse(update, environment);
|
|
17574
|
+
return { ...harness2, computerUse };
|
|
17575
|
+
} catch (error51) {
|
|
17576
|
+
throw new ConsoleHarnessError(400, error51 instanceof Error ? error51.message : String(error51));
|
|
17577
|
+
}
|
|
17150
17578
|
}
|
|
17151
17579
|
};
|
|
17152
17580
|
}
|
|
17153
17581
|
|
|
17154
17582
|
// packages/console-server/src/host-client.ts
|
|
17155
|
-
import { readdir as readdir4, readFile as
|
|
17156
|
-
import
|
|
17583
|
+
import { readdir as readdir4, readFile as readFile7, rm as rm6 } from "node:fs/promises";
|
|
17584
|
+
import path14 from "node:path";
|
|
17157
17585
|
|
|
17158
17586
|
// packages/console-server/src/diagnostics.ts
|
|
17159
|
-
import { open as open4, readdir as readdir3, readFile as
|
|
17160
|
-
import
|
|
17587
|
+
import { open as open4, readdir as readdir3, readFile as readFile6, stat as stat3 } from "node:fs/promises";
|
|
17588
|
+
import path13 from "node:path";
|
|
17161
17589
|
var MAX_DIAGNOSTIC_FILE_BYTES = 256 * 1024;
|
|
17162
17590
|
var MAX_LOG_TAIL_BYTES = 256 * 1024;
|
|
17163
17591
|
var LOG_FILE_PATTERN = /^host-runtime-\d{1,10}\.log(?:\.1)?$/u;
|
|
@@ -17165,7 +17593,7 @@ async function readBoundedJson(filePath) {
|
|
|
17165
17593
|
try {
|
|
17166
17594
|
const metadata = await stat3(filePath);
|
|
17167
17595
|
if (!metadata.isFile() || metadata.size > MAX_DIAGNOSTIC_FILE_BYTES) return null;
|
|
17168
|
-
return JSON.parse(await
|
|
17596
|
+
return JSON.parse(await readFile6(filePath, "utf8"));
|
|
17169
17597
|
} catch {
|
|
17170
17598
|
return null;
|
|
17171
17599
|
}
|
|
@@ -17238,7 +17666,7 @@ async function listLogFiles(logsDirectory) {
|
|
|
17238
17666
|
const entries = await Promise.all(
|
|
17239
17667
|
names.filter(isLogFileName).map(async (name) => {
|
|
17240
17668
|
try {
|
|
17241
|
-
const metadata = await stat3(
|
|
17669
|
+
const metadata = await stat3(path13.join(logsDirectory, name));
|
|
17242
17670
|
return metadata.isFile() ? { name, size: metadata.size, modifiedAt: metadata.mtimeMs } : null;
|
|
17243
17671
|
} catch {
|
|
17244
17672
|
return null;
|
|
@@ -17252,7 +17680,7 @@ async function readLogTail(logsDirectory, name, maxBytes = MAX_LOG_TAIL_BYTES) {
|
|
|
17252
17680
|
const limit = Math.max(1, Math.min(maxBytes, MAX_LOG_TAIL_BYTES));
|
|
17253
17681
|
let handle;
|
|
17254
17682
|
try {
|
|
17255
|
-
handle = await open4(
|
|
17683
|
+
handle = await open4(path13.join(logsDirectory, name), "r");
|
|
17256
17684
|
} catch {
|
|
17257
17685
|
return null;
|
|
17258
17686
|
}
|
|
@@ -17333,14 +17761,14 @@ async function findHost(descriptorDirectory, isAlive = processIsAlive2) {
|
|
|
17333
17761
|
}
|
|
17334
17762
|
const hosts = [];
|
|
17335
17763
|
for (const name of names.filter((candidate) => DESCRIPTOR_PATTERN.test(candidate))) {
|
|
17336
|
-
const filePath =
|
|
17764
|
+
const filePath = path14.join(descriptorDirectory, name);
|
|
17337
17765
|
try {
|
|
17338
|
-
const text = await
|
|
17766
|
+
const text = await readFile7(filePath, "utf8");
|
|
17339
17767
|
if (text.length > DESCRIPTOR_MAX_BYTES) continue;
|
|
17340
17768
|
const endpoint = parseDescriptor(JSON.parse(text));
|
|
17341
17769
|
if (!endpoint) continue;
|
|
17342
17770
|
if (isAlive(endpoint.pid)) hosts.push(endpoint);
|
|
17343
|
-
else await
|
|
17771
|
+
else await rm6(filePath, { force: true });
|
|
17344
17772
|
} catch {
|
|
17345
17773
|
continue;
|
|
17346
17774
|
}
|
|
@@ -17378,12 +17806,12 @@ function createConsoleHostClient(descriptorDirectory, options = {}) {
|
|
|
17378
17806
|
// packages/console-server/src/installation.ts
|
|
17379
17807
|
import { execFile as execFile2 } from "node:child_process";
|
|
17380
17808
|
import { existsSync } from "node:fs";
|
|
17381
|
-
import { readFile as
|
|
17382
|
-
import
|
|
17809
|
+
import { readFile as readFile8 } from "node:fs/promises";
|
|
17810
|
+
import path15 from "node:path";
|
|
17383
17811
|
async function readDistribution(appDirectory2) {
|
|
17384
17812
|
try {
|
|
17385
17813
|
return parseDistributionMetadata(
|
|
17386
|
-
JSON.parse(await
|
|
17814
|
+
JSON.parse(await readFile8(path15.join(appDirectory2, "codexhost-distribution.json"), "utf8"))
|
|
17387
17815
|
);
|
|
17388
17816
|
} catch (error51) {
|
|
17389
17817
|
if (error51.code === "ENOENT") return null;
|
|
@@ -17391,17 +17819,17 @@ async function readDistribution(appDirectory2) {
|
|
|
17391
17819
|
}
|
|
17392
17820
|
}
|
|
17393
17821
|
function installedLauncherCandidates(appDirectory2, platform = process.platform) {
|
|
17394
|
-
const resourcesRoot =
|
|
17822
|
+
const resourcesRoot = path15.dirname(appDirectory2);
|
|
17395
17823
|
const suffix = platform === "win32" ? ".exe" : "";
|
|
17396
|
-
const candidates = [
|
|
17397
|
-
if (platform === "darwin" &&
|
|
17398
|
-
candidates.unshift(
|
|
17824
|
+
const candidates = [path15.join(resourcesRoot, "bin", `codexhost${suffix}`)];
|
|
17825
|
+
if (platform === "darwin" && path15.basename(resourcesRoot) === "Resources") {
|
|
17826
|
+
candidates.unshift(path15.join(path15.dirname(resourcesRoot), "MacOS", "codexhost"));
|
|
17399
17827
|
}
|
|
17400
17828
|
return candidates;
|
|
17401
17829
|
}
|
|
17402
17830
|
function resolveLauncherExecutable(appDirectory2, environment = process.env, platform = process.platform, exists = existsSync) {
|
|
17403
17831
|
const configured = environment[LAUNCHER_EXECUTABLE_ENV];
|
|
17404
|
-
if (configured &&
|
|
17832
|
+
if (configured && path15.isAbsolute(configured) && exists(configured)) return configured;
|
|
17405
17833
|
return installedLauncherCandidates(appDirectory2, platform).find(exists) ?? null;
|
|
17406
17834
|
}
|
|
17407
17835
|
async function resolveInstallation(appDirectory2, environment = process.env) {
|
|
@@ -17443,7 +17871,7 @@ function launchCommand(installation, environment = process.env, action = "launch
|
|
|
17443
17871
|
if (installation.distribution?.distribution === "npm") {
|
|
17444
17872
|
const node = environment.CODEXHOST_NPM_NODE_PATH;
|
|
17445
17873
|
const wrapper = environment.CODEXHOST_NPM_LAUNCHER_PATH;
|
|
17446
|
-
if (node && wrapper &&
|
|
17874
|
+
if (node && wrapper && path15.isAbsolute(node) && path15.isAbsolute(wrapper)) {
|
|
17447
17875
|
return { command: node, args: [wrapper, ...action === "restart" ? [action] : []] };
|
|
17448
17876
|
}
|
|
17449
17877
|
return null;
|
|
@@ -17454,11 +17882,11 @@ function launchCommand(installation, environment = process.env, action = "launch
|
|
|
17454
17882
|
// packages/console-server/src/open.ts
|
|
17455
17883
|
import { spawn as spawn3 } from "node:child_process";
|
|
17456
17884
|
import { stat as stat4 } from "node:fs/promises";
|
|
17457
|
-
import
|
|
17885
|
+
import path20 from "node:path";
|
|
17458
17886
|
|
|
17459
17887
|
// packages/console-server/src/page.ts
|
|
17460
|
-
import { readFile as
|
|
17461
|
-
import
|
|
17888
|
+
import { readFile as readFile9 } from "node:fs/promises";
|
|
17889
|
+
import path16 from "node:path";
|
|
17462
17890
|
var CONSOLE_PAGE_HTML = `<!doctype html>
|
|
17463
17891
|
<html lang="en">
|
|
17464
17892
|
<head>
|
|
@@ -17479,14 +17907,14 @@ var MISSING_BUNDLE_SCRIPT = `document.body.textContent = "codexhost console asse
|
|
|
17479
17907
|
`;
|
|
17480
17908
|
function consoleBundleCandidates(appDirectory2) {
|
|
17481
17909
|
return [
|
|
17482
|
-
|
|
17483
|
-
|
|
17910
|
+
path16.join(appDirectory2, "console-web.js"),
|
|
17911
|
+
path16.resolve(appDirectory2, "..", "..", "renderer-extension", "dist", "console.js")
|
|
17484
17912
|
];
|
|
17485
17913
|
}
|
|
17486
17914
|
async function loadConsoleBundle(appDirectory2) {
|
|
17487
17915
|
for (const candidate of consoleBundleCandidates(appDirectory2)) {
|
|
17488
17916
|
try {
|
|
17489
|
-
return await
|
|
17917
|
+
return await readFile9(candidate, "utf8");
|
|
17490
17918
|
} catch {
|
|
17491
17919
|
continue;
|
|
17492
17920
|
}
|
|
@@ -17610,14 +18038,14 @@ function readAnnouncement(fetcher = fetch) {
|
|
|
17610
18038
|
}
|
|
17611
18039
|
|
|
17612
18040
|
// packages/console-server/src/diagnostic-report.ts
|
|
17613
|
-
import
|
|
18041
|
+
import os4 from "node:os";
|
|
17614
18042
|
var ISSUE_REPOSITORY_URL = "https://github.com/karlorz/codex-host";
|
|
17615
18043
|
var ISSUE_ERROR_CHARS = 800;
|
|
17616
18044
|
var ISSUE_URL_MAX_LENGTH = 7e3;
|
|
17617
18045
|
var REPORT_LOG_TAIL_BYTES = 32 * 1024;
|
|
17618
18046
|
var REPORT_LOG_FILES = 2;
|
|
17619
18047
|
var REPORT_STARTUP_RECORDS = 5;
|
|
17620
|
-
function redactHome(text, home =
|
|
18048
|
+
function redactHome(text, home = os4.homedir()) {
|
|
17621
18049
|
if (!home || home === "/" || home.length < 3) return text;
|
|
17622
18050
|
const variants = /* @__PURE__ */ new Set([home, JSON.stringify(home).slice(1, -1)]);
|
|
17623
18051
|
let result = text;
|
|
@@ -17633,7 +18061,7 @@ async function buildDiagnosticReport(input, readTail, now = () => /* @__PURE__ *
|
|
|
17633
18061
|
return {
|
|
17634
18062
|
schemaVersion: 1,
|
|
17635
18063
|
generatedAt: now().toISOString(),
|
|
17636
|
-
platform: { os: process.platform, arch: process.arch, release:
|
|
18064
|
+
platform: { os: process.platform, arch: process.arch, release: os4.release() },
|
|
17637
18065
|
codexhost: {
|
|
17638
18066
|
version: input.distribution?.version ?? input.consoleVersion,
|
|
17639
18067
|
distribution: input.distribution?.distribution ?? null,
|
|
@@ -17709,7 +18137,7 @@ function issueUrl(report, home) {
|
|
|
17709
18137
|
}
|
|
17710
18138
|
|
|
17711
18139
|
// packages/console-server/src/updates.ts
|
|
17712
|
-
import
|
|
18140
|
+
import path17 from "node:path";
|
|
17713
18141
|
var ERROR_MAX_LENGTH = 500;
|
|
17714
18142
|
var ConsoleUpdateError = class extends Error {
|
|
17715
18143
|
constructor(code, message) {
|
|
@@ -17742,13 +18170,13 @@ function installationKind(metadata) {
|
|
|
17742
18170
|
}
|
|
17743
18171
|
function absoluteEnvironmentPath(environment, name) {
|
|
17744
18172
|
const value = environment[name];
|
|
17745
|
-
if (!value || !
|
|
18173
|
+
if (!value || !path17.isAbsolute(value)) {
|
|
17746
18174
|
throw new ConsoleUpdateError(
|
|
17747
18175
|
"unsupported",
|
|
17748
18176
|
`${name} is unavailable; run 'codexhost console' from the npm command to update`
|
|
17749
18177
|
);
|
|
17750
18178
|
}
|
|
17751
|
-
return
|
|
18179
|
+
return path17.normalize(value);
|
|
17752
18180
|
}
|
|
17753
18181
|
function createConsoleUpdates(options) {
|
|
17754
18182
|
const environment = options.environment ?? process.env;
|
|
@@ -17789,13 +18217,13 @@ function createConsoleUpdates(options) {
|
|
|
17789
18217
|
}
|
|
17790
18218
|
}
|
|
17791
18219
|
async function prepare(metadata, target, release, onPrepared) {
|
|
17792
|
-
const resourcesRoot =
|
|
18220
|
+
const resourcesRoot = path17.dirname(target.appDirectory);
|
|
17793
18221
|
const common = {
|
|
17794
18222
|
version: release.version,
|
|
17795
18223
|
launcherPid: options.processId ?? process.pid,
|
|
17796
18224
|
launcherExecutable: options.processExecutable ?? process.execPath,
|
|
17797
18225
|
runtimeDescriptorPath: target.runtimeDescriptorPath,
|
|
17798
|
-
updaterExecutable:
|
|
18226
|
+
updaterExecutable: path17.join(
|
|
17799
18227
|
resourcesRoot,
|
|
17800
18228
|
"libexec",
|
|
17801
18229
|
platform === "win32" ? "codexhost-updater.exe" : "codexhost-updater"
|
|
@@ -17830,13 +18258,13 @@ function createConsoleUpdates(options) {
|
|
|
17830
18258
|
if (kind === "windows-installer") {
|
|
17831
18259
|
return manager.prepareWindowsInstaller({ ...common, artifact, installRoot: resourcesRoot });
|
|
17832
18260
|
}
|
|
17833
|
-
const appPath =
|
|
18261
|
+
const appPath = path17.dirname(path17.dirname(resourcesRoot));
|
|
17834
18262
|
return manager.prepareMacOsDmg({ ...common, artifact, appPath });
|
|
17835
18263
|
}
|
|
17836
18264
|
return Object.freeze({
|
|
17837
18265
|
async check(target, signal) {
|
|
17838
18266
|
const metadata = target.distribution;
|
|
17839
|
-
const runtime = metadata ? null : await readRuntimeMetadata(
|
|
18267
|
+
const runtime = metadata ? null : await readRuntimeMetadata(path17.join(target.appDirectory, "main.js"), environment).catch(
|
|
17840
18268
|
() => null
|
|
17841
18269
|
);
|
|
17842
18270
|
const empty = {
|
|
@@ -17887,7 +18315,7 @@ function createConsoleUpdates(options) {
|
|
|
17887
18315
|
if (!metadata) {
|
|
17888
18316
|
throw new ConsoleUpdateError("unsupported", "A source checkout cannot update itself");
|
|
17889
18317
|
}
|
|
17890
|
-
if (!target.runtimeDescriptorPath || !
|
|
18318
|
+
if (!target.runtimeDescriptorPath || !path17.isAbsolute(target.runtimeDescriptorPath)) {
|
|
17891
18319
|
throw new ConsoleUpdateError("unsupported", "The Launcher runtime path is unavailable");
|
|
17892
18320
|
}
|
|
17893
18321
|
if (handedOff) {
|
|
@@ -17956,20 +18384,20 @@ function createConsoleUpdates(options) {
|
|
|
17956
18384
|
}
|
|
17957
18385
|
|
|
17958
18386
|
// packages/console-server/src/live-voice-inject.ts
|
|
17959
|
-
import { randomUUID as
|
|
17960
|
-
import { mkdir as
|
|
17961
|
-
import
|
|
18387
|
+
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
18388
|
+
import { mkdir as mkdir6, readFile as readFile10, rename as rename4, rm as rm7, writeFile as writeFile5 } from "node:fs/promises";
|
|
18389
|
+
import path18 from "node:path";
|
|
17962
18390
|
var CPA_LIVE_VOICE_ENV = "CODEXHOST_CPA_LIVE_VOICE";
|
|
17963
18391
|
var LIVE_VOICE_INJECT_FILE = "live-voice-inject-v1.json";
|
|
17964
|
-
function injectPath(
|
|
17965
|
-
return
|
|
18392
|
+
function injectPath(dataDirectory3) {
|
|
18393
|
+
return path18.join(dataDirectory3, LIVE_VOICE_INJECT_FILE);
|
|
17966
18394
|
}
|
|
17967
|
-
async function readLiveVoiceInjectState(
|
|
18395
|
+
async function readLiveVoiceInjectState(dataDirectory3, environment = process.env) {
|
|
17968
18396
|
const env = environment[CPA_LIVE_VOICE_ENV];
|
|
17969
18397
|
const envOverride = env === "0" || env === "1" ? env : null;
|
|
17970
18398
|
let inject = true;
|
|
17971
18399
|
try {
|
|
17972
|
-
const parsed = JSON.parse(await
|
|
18400
|
+
const parsed = JSON.parse(await readFile10(injectPath(dataDirectory3), "utf8"));
|
|
17973
18401
|
inject = parsed.version !== 1 || parsed.inject !== false;
|
|
17974
18402
|
} catch {
|
|
17975
18403
|
inject = true;
|
|
@@ -17979,18 +18407,18 @@ async function readLiveVoiceInjectState(dataDirectory2, environment = process.en
|
|
|
17979
18407
|
if (envOverride === "1") inject = true;
|
|
17980
18408
|
return { inject, savedInject, envOverride };
|
|
17981
18409
|
}
|
|
17982
|
-
async function writeLiveVoiceInjectFile(
|
|
18410
|
+
async function writeLiveVoiceInjectFile(dataDirectory3, inject, routes) {
|
|
17983
18411
|
if (!routes) {
|
|
17984
18412
|
try {
|
|
17985
|
-
const saved = JSON.parse(await
|
|
18413
|
+
const saved = JSON.parse(await readFile10(injectPath(dataDirectory3), "utf8"));
|
|
17986
18414
|
if (saved?.version === 1) routes = voiceRoutesSchema.safeParse(saved.routes).data;
|
|
17987
18415
|
} catch {
|
|
17988
18416
|
}
|
|
17989
18417
|
}
|
|
17990
|
-
await
|
|
17991
|
-
const temporaryPath =
|
|
18418
|
+
await mkdir6(dataDirectory3, { recursive: true, mode: 448 });
|
|
18419
|
+
const temporaryPath = path18.join(dataDirectory3, `.${LIVE_VOICE_INJECT_FILE}.${randomUUID4()}.tmp`);
|
|
17992
18420
|
try {
|
|
17993
|
-
await
|
|
18421
|
+
await writeFile5(
|
|
17994
18422
|
temporaryPath,
|
|
17995
18423
|
`${JSON.stringify({ version: 1, inject, ...routes ? { routes } : {} }, null, 2)}
|
|
17996
18424
|
`,
|
|
@@ -17999,16 +18427,16 @@ async function writeLiveVoiceInjectFile(dataDirectory2, inject, routes) {
|
|
|
17999
18427
|
flag: "wx"
|
|
18000
18428
|
}
|
|
18001
18429
|
);
|
|
18002
|
-
await
|
|
18430
|
+
await rename4(temporaryPath, injectPath(dataDirectory3));
|
|
18003
18431
|
} finally {
|
|
18004
|
-
await
|
|
18432
|
+
await rm7(temporaryPath, { force: true });
|
|
18005
18433
|
}
|
|
18006
18434
|
}
|
|
18007
18435
|
|
|
18008
18436
|
// packages/console-server/src/voice-settings.ts
|
|
18009
18437
|
import { createHash as createHash2 } from "node:crypto";
|
|
18010
|
-
import { readFile as
|
|
18011
|
-
import
|
|
18438
|
+
import { readFile as readFile11 } from "node:fs/promises";
|
|
18439
|
+
import path19 from "node:path";
|
|
18012
18440
|
var VoiceSettingsConflict = class extends Error {
|
|
18013
18441
|
};
|
|
18014
18442
|
var VoiceSettingsStore = class {
|
|
@@ -18022,7 +18450,7 @@ var VoiceSettingsStore = class {
|
|
|
18022
18450
|
let document = null;
|
|
18023
18451
|
try {
|
|
18024
18452
|
document = JSON.parse(
|
|
18025
|
-
await
|
|
18453
|
+
await readFile11(path19.join(this.directory, LIVE_VOICE_INJECT_FILE), "utf8")
|
|
18026
18454
|
);
|
|
18027
18455
|
} catch (error51) {
|
|
18028
18456
|
if (!(error51 instanceof SyntaxError) && error51.code !== "ENOENT")
|
|
@@ -18469,6 +18897,22 @@ function startConsoleServer(options) {
|
|
|
18469
18897
|
sendJson(response, 200, { harnesses: await options.harnesses.list() });
|
|
18470
18898
|
return;
|
|
18471
18899
|
}
|
|
18900
|
+
if (route === "POST /api/harnesses/grok-computer-use") {
|
|
18901
|
+
const parsed = grokComputerUseSetSchema.safeParse(body);
|
|
18902
|
+
if (!parsed.success) {
|
|
18903
|
+
sendJson(response, 400, { error: "Expected { enabled } or { browser }" });
|
|
18904
|
+
return;
|
|
18905
|
+
}
|
|
18906
|
+
try {
|
|
18907
|
+
const harness2 = await options.harnesses.setGrokComputerUse(parsed.data);
|
|
18908
|
+
sendJson(response, 200, { harness: harness2 });
|
|
18909
|
+
} catch (error51) {
|
|
18910
|
+
sendJson(response, error51 instanceof ConsoleHarnessError ? error51.status : 500, {
|
|
18911
|
+
error: error51 instanceof Error ? error51.message : String(error51)
|
|
18912
|
+
});
|
|
18913
|
+
}
|
|
18914
|
+
return;
|
|
18915
|
+
}
|
|
18472
18916
|
if (route === "POST /api/harnesses/launch-path") {
|
|
18473
18917
|
const id = body.id;
|
|
18474
18918
|
const value = body.path;
|
|
@@ -18630,7 +19074,7 @@ async function requestShutdown(port) {
|
|
|
18630
19074
|
if (!response.ok) throw new Error(`console shutdown failed: HTTP ${response.status}`);
|
|
18631
19075
|
}
|
|
18632
19076
|
async function consoleBuildId(entryPath2, environment = process.env) {
|
|
18633
|
-
const files = [entryPath2, ...consoleBundleCandidates(
|
|
19077
|
+
const files = [entryPath2, ...consoleBundleCandidates(path20.dirname(entryPath2))];
|
|
18634
19078
|
const parts = [];
|
|
18635
19079
|
for (const file2 of files) {
|
|
18636
19080
|
const metadata = await stat4(file2).catch(() => null);
|
|
@@ -18638,7 +19082,7 @@ async function consoleBuildId(entryPath2, environment = process.env) {
|
|
|
18638
19082
|
}
|
|
18639
19083
|
const runtime = await readRuntimeMetadata(entryPath2, environment).catch(() => null);
|
|
18640
19084
|
if (runtime?.distribution === "development") parts.push(runtime.version);
|
|
18641
|
-
return JSON.stringify([parts.join("."),
|
|
19085
|
+
return JSON.stringify([parts.join("."), dataDirectory2(environment)]);
|
|
18642
19086
|
}
|
|
18643
19087
|
function startDetachedServer(entryPath2, environment) {
|
|
18644
19088
|
const child = spawn3(process.execPath, [entryPath2, "serve"], {
|
|
@@ -18733,7 +19177,7 @@ async function updateFromCommand(appDirectory2, arguments_) {
|
|
|
18733
19177
|
var IDLE_TIMEOUT_MS = 30 * 60 * 1e3;
|
|
18734
19178
|
var HANDOFF_EXIT_DELAY_MS = 500;
|
|
18735
19179
|
var entryPath = fileURLToPath(import.meta.url);
|
|
18736
|
-
var appDirectory =
|
|
19180
|
+
var appDirectory = path21.dirname(entryPath);
|
|
18737
19181
|
function usage() {
|
|
18738
19182
|
console.error(
|
|
18739
19183
|
"usage: console-server open [--no-browser] | console-server ensure | console-server serve | console-server update"
|