@codexhost/cli-win32-arm64 0.27.0 → 0.28.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 +340 -161
- package/app/console-web.js +194 -5
- package/app/desktop-controller.mjs +105 -4
- package/app/host-runtime.mjs +1891 -1006
- package/app/plugins/antigravity/plugin.mjs +390 -135
- package/app/plugins/claude-code/plugin.mjs +383 -32
- package/app/plugins/codebuddy/plugin.mjs +213 -30
- package/app/plugins/codex-usage/plugin.mjs +370 -52
- package/app/plugins/copilot/plugin.mjs +105 -4
- package/app/plugins/cursor-cli/plugin.mjs +126 -4
- package/app/plugins/deepseek-harness/plugin.mjs +107 -4
- package/app/plugins/devin/plugin.mjs +106 -4
- package/app/plugins/grok/plugin.mjs +186 -25
- package/app/plugins/hermes/plugin.mjs +107 -4
- package/app/plugins/kimi-code/plugin.mjs +105 -4
- package/app/plugins/kiro-cli/plugin.mjs +105 -4
- package/app/plugins/omp/plugin.mjs +261 -45
- package/app/plugins/opencode/plugin.mjs +107 -4
- package/app/plugins/pi/plugin.mjs +312 -48
- package/app/plugins/qoder/plugin.mjs +179 -18
- package/app/plugins/qoder-cn/plugin.mjs +179 -18
- package/app/plugins/qwen-code/plugin.mjs +105 -4
- package/app/plugins/workbuddy/plugin.mjs +213 -30
- package/app/plugins/zcode/plugin.mjs +107 -4
- package/app/renderer-extension.js +12013 -11533
- package/app/web/assets/{index-nw2RXcDu.css → index-DBPgg32z.css} +1 -1
- package/app/web/assets/index-DWxiVzuS.js +204 -0
- package/app/web/codexhost-settings.js +81 -46
- package/app/web/index.html +2 -2
- package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +65 -65
- package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +69 -69
- package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +75 -75
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +72 -72
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +14 -14
- package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +5 -5
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.pdf.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
- package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +8 -8
- package/app/web-modules/server.mjs +2476 -1131
- package/bin/codexhost.exe +0 -0
- package/libexec/codexhost-node-repl.exe +0 -0
- package/libexec/codexhost-shell.exe +0 -0
- package/libexec/codexhost-shim.exe +0 -0
- package/libexec/codexhost-updater.exe +0 -0
- package/package.json +1 -1
- package/app/web/assets/index-D9l7_ThH.js +0 -199
package/app/console-server.mjs
CHANGED
|
@@ -1627,128 +1627,6 @@ import path2 from "node:path";
|
|
|
1627
1627
|
// packages/update-manager/dist/distribution.js
|
|
1628
1628
|
import path from "node:path";
|
|
1629
1629
|
|
|
1630
|
-
// packages/update-manager/dist/status.js
|
|
1631
|
-
var STATUS_SCHEMA_VERSION = 1;
|
|
1632
|
-
var SEMVER_PATTERN = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/u;
|
|
1633
|
-
function requireSemanticVersion(value) {
|
|
1634
|
-
if (!SEMVER_PATTERN.test(value))
|
|
1635
|
-
throw new Error("update version must be valid semantic version");
|
|
1636
|
-
return value;
|
|
1637
|
-
}
|
|
1638
|
-
function preparedStatus(version2, installation, now) {
|
|
1639
|
-
return {
|
|
1640
|
-
schemaVersion: STATUS_SCHEMA_VERSION,
|
|
1641
|
-
version: version2,
|
|
1642
|
-
installation,
|
|
1643
|
-
phase: "prepared",
|
|
1644
|
-
updatedAt: Math.floor(now / 1e3)
|
|
1645
|
-
};
|
|
1646
|
-
}
|
|
1647
|
-
function parseUpdateStatus(value) {
|
|
1648
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
1649
|
-
throw new Error("background update status must be an object");
|
|
1650
|
-
}
|
|
1651
|
-
const status = value;
|
|
1652
|
-
const allowed = [
|
|
1653
|
-
"downloadedBytes",
|
|
1654
|
-
"error",
|
|
1655
|
-
"installation",
|
|
1656
|
-
"phase",
|
|
1657
|
-
"schemaVersion",
|
|
1658
|
-
"serviceStopOutput",
|
|
1659
|
-
"totalBytes",
|
|
1660
|
-
"updatedAt",
|
|
1661
|
-
"version"
|
|
1662
|
-
];
|
|
1663
|
-
if (Object.keys(status).some((key) => !allowed.includes(key))) {
|
|
1664
|
-
throw new Error("background update status contains unknown fields");
|
|
1665
|
-
}
|
|
1666
|
-
if (status.schemaVersion !== STATUS_SCHEMA_VERSION || typeof status.version !== "string" || !SEMVER_PATTERN.test(status.version) || !["npm", "windows-installer", "macos-dmg", "linux-archive"].includes(String(status.installation)) || ![
|
|
1667
|
-
"prepared",
|
|
1668
|
-
"downloading",
|
|
1669
|
-
"waiting-for-exit",
|
|
1670
|
-
"installing",
|
|
1671
|
-
"restarting",
|
|
1672
|
-
"succeeded",
|
|
1673
|
-
"failed"
|
|
1674
|
-
].includes(String(status.phase)) || !Number.isSafeInteger(status.updatedAt) || status.downloadedBytes !== void 0 && (typeof status.downloadedBytes !== "number" || !Number.isSafeInteger(status.downloadedBytes) || status.downloadedBytes < 0) || status.totalBytes !== void 0 && (typeof status.totalBytes !== "number" || !Number.isSafeInteger(status.totalBytes) || status.totalBytes <= 0) || typeof status.downloadedBytes === "number" && typeof status.totalBytes === "number" && status.downloadedBytes > status.totalBytes || status.error !== void 0 && typeof status.error !== "string" || status.serviceStopOutput !== void 0 && typeof status.serviceStopOutput !== "string") {
|
|
1675
|
-
throw new Error("background update status is invalid");
|
|
1676
|
-
}
|
|
1677
|
-
return status;
|
|
1678
|
-
}
|
|
1679
|
-
|
|
1680
|
-
// packages/update-manager/dist/distribution.js
|
|
1681
|
-
var UPDATE_RUNTIME_ENV = Object.freeze({
|
|
1682
|
-
launcherPid: "CODEXHOST_LAUNCHER_PID",
|
|
1683
|
-
launcherExecutable: "CODEXHOST_LAUNCHER_EXECUTABLE",
|
|
1684
|
-
runtimeDescriptorPath: "CODEXHOST_RUNTIME_DESCRIPTOR_PATH",
|
|
1685
|
-
controllerPort: "CODEXHOST_CONTROL_PORT",
|
|
1686
|
-
controllerNonce: "CODEXHOST_CONTROL_NONCE",
|
|
1687
|
-
npmNodePath: "CODEXHOST_NPM_NODE_PATH",
|
|
1688
|
-
npmCliPath: "CODEXHOST_NPM_CLI_PATH",
|
|
1689
|
-
npmLauncherPath: "CODEXHOST_NPM_LAUNCHER_PATH",
|
|
1690
|
-
npmPackageRoot: "CODEXHOST_NPM_PACKAGE_ROOT",
|
|
1691
|
-
serviceManaged: "CODEXHOST_UPDATE_SERVICE"
|
|
1692
|
-
});
|
|
1693
|
-
function object(value, label) {
|
|
1694
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
1695
|
-
throw new Error(`${label} must be an object`);
|
|
1696
|
-
}
|
|
1697
|
-
return value;
|
|
1698
|
-
}
|
|
1699
|
-
function parseDistributionMetadata(value) {
|
|
1700
|
-
const metadata = object(value, "distribution metadata");
|
|
1701
|
-
const allowed = ["distribution", "schemaVersion", "target", "version"];
|
|
1702
|
-
if (Object.keys(metadata).some((key) => !allowed.includes(key))) {
|
|
1703
|
-
throw new Error("distribution metadata contains unknown fields");
|
|
1704
|
-
}
|
|
1705
|
-
if (metadata.schemaVersion !== 1 || metadata.distribution !== "npm" && metadata.distribution !== "installer" || ![
|
|
1706
|
-
"macos-arm64",
|
|
1707
|
-
"macos-x64",
|
|
1708
|
-
"windows-x64",
|
|
1709
|
-
"windows-arm64",
|
|
1710
|
-
"linux-x64",
|
|
1711
|
-
"linux-arm64"
|
|
1712
|
-
].includes(String(metadata.target)) || typeof metadata.version !== "string") {
|
|
1713
|
-
throw new Error("distribution metadata is invalid");
|
|
1714
|
-
}
|
|
1715
|
-
return {
|
|
1716
|
-
schemaVersion: 1,
|
|
1717
|
-
version: requireSemanticVersion(metadata.version),
|
|
1718
|
-
distribution: metadata.distribution,
|
|
1719
|
-
target: metadata.target
|
|
1720
|
-
};
|
|
1721
|
-
}
|
|
1722
|
-
function defaultUpdateStateDirectory(platform = process.platform, environment = process.env) {
|
|
1723
|
-
if (platform === "win32") {
|
|
1724
|
-
const root = environment.LOCALAPPDATA;
|
|
1725
|
-
if (!root || !path.isAbsolute(root))
|
|
1726
|
-
throw new Error("LOCALAPPDATA is unavailable");
|
|
1727
|
-
return path.join(root, "codexhost", "updates");
|
|
1728
|
-
}
|
|
1729
|
-
const home = environment.HOME;
|
|
1730
|
-
if (!home || !path.isAbsolute(home))
|
|
1731
|
-
throw new Error("HOME is unavailable");
|
|
1732
|
-
return platform === "darwin" ? path.join(home, "Library", "Application Support", "codexhost", "updates") : path.join(home, ".codexhost", "updates");
|
|
1733
|
-
}
|
|
1734
|
-
|
|
1735
|
-
// packages/update-manager/dist/runtime-metadata.js
|
|
1736
|
-
async function readRuntimeMetadata(entryPath2, environment = process.env) {
|
|
1737
|
-
const directory = path2.dirname(entryPath2);
|
|
1738
|
-
try {
|
|
1739
|
-
return parseDistributionMetadata(JSON.parse(await readFile(path2.join(directory, "codexhost-distribution.json"), "utf8")));
|
|
1740
|
-
} catch (error62) {
|
|
1741
|
-
if (path2.basename(directory) !== "dist" || path2.basename(path2.resolve(directory, "../..")) !== "packages")
|
|
1742
|
-
throw error62;
|
|
1743
|
-
const workspace = JSON.parse(await readFile(path2.resolve(directory, "../../../package.json"), "utf8"));
|
|
1744
|
-
if (workspace.name !== "codexhost" || typeof workspace.version !== "string")
|
|
1745
|
-
throw error62;
|
|
1746
|
-
const workspaceVersion = requireSemanticVersion(workspace.version);
|
|
1747
|
-
const version2 = environment.CODEXHOST_DEV_VERSION === void 0 ? `${workspaceVersion}-dev` : requireSemanticVersion(environment.CODEXHOST_DEV_VERSION);
|
|
1748
|
-
return { version: version2, distribution: "development" };
|
|
1749
|
-
}
|
|
1750
|
-
}
|
|
1751
|
-
|
|
1752
1630
|
// node_modules/zod/v4/classic/external.js
|
|
1753
1631
|
var external_exports = {};
|
|
1754
1632
|
__export(external_exports, {
|
|
@@ -1943,7 +1821,7 @@ __export(external_exports, {
|
|
|
1943
1821
|
nullable: () => nullable,
|
|
1944
1822
|
nullish: () => nullish2,
|
|
1945
1823
|
number: () => number2,
|
|
1946
|
-
object: () =>
|
|
1824
|
+
object: () => object,
|
|
1947
1825
|
optional: () => optional,
|
|
1948
1826
|
output: () => output,
|
|
1949
1827
|
overwrite: () => _overwrite,
|
|
@@ -18863,7 +18741,7 @@ __export(schemas_exports2, {
|
|
|
18863
18741
|
nullable: () => nullable,
|
|
18864
18742
|
nullish: () => nullish2,
|
|
18865
18743
|
number: () => number2,
|
|
18866
|
-
object: () =>
|
|
18744
|
+
object: () => object,
|
|
18867
18745
|
optional: () => optional,
|
|
18868
18746
|
partialRecord: () => partialRecord,
|
|
18869
18747
|
pipe: () => pipe,
|
|
@@ -19857,7 +19735,7 @@ var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
|
19857
19735
|
return util_exports.required(ZodNonOptional, this, args[0]);
|
|
19858
19736
|
}
|
|
19859
19737
|
});
|
|
19860
|
-
function
|
|
19738
|
+
function object(shape, params) {
|
|
19861
19739
|
const def = {
|
|
19862
19740
|
type: "object",
|
|
19863
19741
|
shape: shape ?? {},
|
|
@@ -21864,11 +21742,21 @@ var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionS
|
|
|
21864
21742
|
ids.add(option.id);
|
|
21865
21743
|
}
|
|
21866
21744
|
});
|
|
21745
|
+
var harnessThinkingOptionsScopeSchema = external_exports.enum(["catalog", "activeModel"]);
|
|
21867
21746
|
var harnessModelCatalogSchema = external_exports.object({
|
|
21868
21747
|
models: external_exports.array(harnessModelSchema),
|
|
21869
21748
|
defaultModel: harnessModelRefSchema.optional(),
|
|
21870
21749
|
thinkingOptions: harnessThinkingOptionsSchema,
|
|
21871
|
-
defaultThinkingOptionId: harnessThinkingOptionIdSchema.optional()
|
|
21750
|
+
defaultThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
21751
|
+
/**
|
|
21752
|
+
* Scope of per-Model `supportedThinkingOptionIds` in this catalog.
|
|
21753
|
+
* Omitted or `"catalog"` means each Model's `supportedThinkingOptionIds`
|
|
21754
|
+
* reflects its own options (omitted or `[]` means none).
|
|
21755
|
+
* `"activeModel"` means only the active Model's Thinking options were
|
|
21756
|
+
* observed; other Models omit `supportedThinkingOptionIds` and must be
|
|
21757
|
+
* validated by the Adapter after selecting the Model.
|
|
21758
|
+
*/
|
|
21759
|
+
thinkingOptionsScope: harnessThinkingOptionsScopeSchema.optional()
|
|
21872
21760
|
}).strict().superRefine((catalog, context) => {
|
|
21873
21761
|
const refs = [];
|
|
21874
21762
|
const thinkingIds = new Set(catalog.thinkingOptions.map(({ id: id2 }) => id2));
|
|
@@ -22847,7 +22735,12 @@ var clientProjectlessWorkspaceSchema = external_exports.object({
|
|
|
22847
22735
|
prompt: external_exports.string().max(16384).optional()
|
|
22848
22736
|
}).strict();
|
|
22849
22737
|
var clientWorkspaceSnapshotSchema = external_exports.object({
|
|
22850
|
-
projects: external_exports.array(external_exports.object({
|
|
22738
|
+
projects: external_exports.array(external_exports.object({
|
|
22739
|
+
id: external_exports.string(),
|
|
22740
|
+
name: external_exports.string(),
|
|
22741
|
+
rootPaths: external_exports.array(external_exports.string()),
|
|
22742
|
+
createdAt: external_exports.number().int().optional()
|
|
22743
|
+
})),
|
|
22851
22744
|
nativeProjects: external_exports.literal(true).optional(),
|
|
22852
22745
|
assignments: external_exports.record(external_exports.string(), external_exports.string()),
|
|
22853
22746
|
projectless: external_exports.array(external_exports.string()),
|
|
@@ -23260,6 +23153,7 @@ var delegationReadParamsSchema = external_exports.strictObject({
|
|
|
23260
23153
|
// packages/shared-contracts/dist/remote-peers.js
|
|
23261
23154
|
var REMOTE_PEER_ID_PATTERN = /^[a-zA-Z0-9_-]{1,64}$/u;
|
|
23262
23155
|
var remotePeerIdSchema = external_exports.string().regex(REMOTE_PEER_ID_PATTERN);
|
|
23156
|
+
var remotePeerNodeIdSchema = external_exports.string().regex(REMOTE_PEER_ID_PATTERN);
|
|
23263
23157
|
var remotePeerHostIdSchema = external_exports.string().regex(/^remote-peer:[a-zA-Z0-9_-]{1,64}$/u);
|
|
23264
23158
|
var remotePeerTransportKindSchema = external_exports.enum(["relay", "tailscale", "lan", "custom"]);
|
|
23265
23159
|
var REMOTE_PEER_COLORS = [
|
|
@@ -23283,6 +23177,7 @@ var remotePeerStateSchema = external_exports.enum([
|
|
|
23283
23177
|
var remotePeerSummarySchema = external_exports.object({
|
|
23284
23178
|
peerId: remotePeerIdSchema,
|
|
23285
23179
|
hostId: remotePeerHostIdSchema,
|
|
23180
|
+
nodeId: remotePeerNodeIdSchema.optional(),
|
|
23286
23181
|
name: external_exports.string().min(1).max(120),
|
|
23287
23182
|
color: remotePeerColorSchema.optional(),
|
|
23288
23183
|
origin: external_exports.string().min(1).max(2048),
|
|
@@ -23290,6 +23185,11 @@ var remotePeerSummarySchema = external_exports.object({
|
|
|
23290
23185
|
encrypted: external_exports.boolean(),
|
|
23291
23186
|
enabled: external_exports.boolean(),
|
|
23292
23187
|
state: remotePeerStateSchema,
|
|
23188
|
+
supportsPeerPairing: external_exports.boolean().optional(),
|
|
23189
|
+
/** Omitted when either side's node mapping is unknown. */
|
|
23190
|
+
pairedBack: external_exports.boolean().optional(),
|
|
23191
|
+
/** Other configured remote peerIds on this Hub present in this peer's `manifest.peerNodes`. */
|
|
23192
|
+
linkedPeerIds: external_exports.array(remotePeerIdSchema).max(128).optional(),
|
|
23293
23193
|
latencyMs: external_exports.number().int().nonnegative().optional(),
|
|
23294
23194
|
version: external_exports.string().max(128).optional(),
|
|
23295
23195
|
platform: external_exports.string().max(64).optional(),
|
|
@@ -23308,8 +23208,48 @@ var remotePeerAddParamsSchema = external_exports.object({
|
|
|
23308
23208
|
origin: external_exports.string().min(1).max(2048).optional(),
|
|
23309
23209
|
token: external_exports.string().min(1).max(2048).optional(),
|
|
23310
23210
|
name: external_exports.string().trim().min(1).max(120).optional(),
|
|
23311
|
-
color: remotePeerColorSchema.optional()
|
|
23211
|
+
color: remotePeerColorSchema.optional(),
|
|
23212
|
+
pairBack: external_exports.boolean().optional(),
|
|
23213
|
+
meshPeerIds: external_exports.array(remotePeerIdSchema).max(64).optional(),
|
|
23214
|
+
selfOrigin: external_exports.string().min(1).max(2048).optional()
|
|
23312
23215
|
}).refine((input3) => Boolean(input3.connectionUrl) || Boolean(input3.origin) && Boolean(input3.token), "Provide either connectionUrl or both origin and token");
|
|
23216
|
+
var remotePeerIntroduceParamsSchema = external_exports.strictObject({
|
|
23217
|
+
origin: external_exports.string().min(1).max(2048),
|
|
23218
|
+
token: external_exports.string().min(1).max(2048),
|
|
23219
|
+
name: external_exports.string().trim().min(1).max(120).optional(),
|
|
23220
|
+
color: remotePeerColorSchema.optional(),
|
|
23221
|
+
expectedNodeId: remotePeerNodeIdSchema.optional()
|
|
23222
|
+
});
|
|
23223
|
+
var remotePeerIntroduceResultSchema = external_exports.object({
|
|
23224
|
+
status: external_exports.enum(["added", "updated", "existing"]),
|
|
23225
|
+
peerId: remotePeerIdSchema,
|
|
23226
|
+
hostId: remotePeerHostIdSchema,
|
|
23227
|
+
nodeId: remotePeerNodeIdSchema.optional()
|
|
23228
|
+
});
|
|
23229
|
+
var remotePeerPairingStatusSchema = external_exports.enum([
|
|
23230
|
+
"added",
|
|
23231
|
+
"updated",
|
|
23232
|
+
"existing",
|
|
23233
|
+
"failed",
|
|
23234
|
+
"skipped"
|
|
23235
|
+
]);
|
|
23236
|
+
var remotePeerPairingStepSchema = external_exports.object({
|
|
23237
|
+
targetPeerId: remotePeerIdSchema,
|
|
23238
|
+
targetName: external_exports.string().min(1).max(120),
|
|
23239
|
+
introducedHost: external_exports.union([external_exports.literal("local"), remotePeerIdSchema]),
|
|
23240
|
+
introducedName: external_exports.string().min(1).max(120),
|
|
23241
|
+
status: remotePeerPairingStatusSchema,
|
|
23242
|
+
error: external_exports.string().max(1e3).optional()
|
|
23243
|
+
});
|
|
23244
|
+
var remotePeerPairingReportSchema = external_exports.object({
|
|
23245
|
+
results: external_exports.array(remotePeerPairingStepSchema)
|
|
23246
|
+
});
|
|
23247
|
+
var remotePeerSyncMeshParamsSchema = external_exports.object({
|
|
23248
|
+
peerIds: external_exports.array(remotePeerIdSchema).max(64).optional(),
|
|
23249
|
+
includeSelf: external_exports.boolean().optional(),
|
|
23250
|
+
includeMesh: external_exports.boolean().optional(),
|
|
23251
|
+
selfOrigin: external_exports.string().min(1).max(2048).optional()
|
|
23252
|
+
});
|
|
23313
23253
|
var remotePeerUpdateParamsSchema = external_exports.object({
|
|
23314
23254
|
peerId: remotePeerIdSchema,
|
|
23315
23255
|
name: external_exports.string().trim().min(1).max(120).optional(),
|
|
@@ -23338,6 +23278,9 @@ var remotePeerTestProjectSchema = external_exports.object({
|
|
|
23338
23278
|
});
|
|
23339
23279
|
var remotePeerTestResultSchema = external_exports.object({
|
|
23340
23280
|
ok: external_exports.boolean(),
|
|
23281
|
+
nodeId: remotePeerNodeIdSchema.optional(),
|
|
23282
|
+
supportsPeerPairing: external_exports.boolean().optional(),
|
|
23283
|
+
pairedBack: external_exports.boolean().optional(),
|
|
23341
23284
|
latencyMs: external_exports.number().int().nonnegative().optional(),
|
|
23342
23285
|
origin: external_exports.string().max(2048).optional(),
|
|
23343
23286
|
transportKind: remotePeerTransportKindSchema.optional(),
|
|
@@ -23364,7 +23307,9 @@ var remotePeerCapabilitiesSchema = external_exports.object({
|
|
|
23364
23307
|
/** Peer supports officeToPdf/render over /api/peer/v1/workspace-files/rpc. */
|
|
23365
23308
|
officePreview: external_exports.literal(1).optional(),
|
|
23366
23309
|
/** /api/peer/v1/delegation is available for fixed-whitelist cross-host delegation. */
|
|
23367
|
-
delegation: external_exports.literal(1).optional()
|
|
23310
|
+
delegation: external_exports.literal(1).optional(),
|
|
23311
|
+
/** POST /api/peer/v1/peers is available. */
|
|
23312
|
+
peerPairing: external_exports.literal(1).optional()
|
|
23368
23313
|
});
|
|
23369
23314
|
var remotePeerManifestSchema = external_exports.object({
|
|
23370
23315
|
version: external_exports.string().max(128),
|
|
@@ -23372,6 +23317,8 @@ var remotePeerManifestSchema = external_exports.object({
|
|
|
23372
23317
|
hostname: external_exports.string().max(255),
|
|
23373
23318
|
homeDir: external_exports.string().max(4096).optional(),
|
|
23374
23319
|
epoch: external_exports.string().min(1).max(256),
|
|
23320
|
+
nodeId: remotePeerNodeIdSchema.optional(),
|
|
23321
|
+
peerNodes: external_exports.record(remotePeerHostIdSchema, remotePeerNodeIdSchema).refine((v) => Object.keys(v).length <= 128).optional(),
|
|
23375
23322
|
projects: external_exports.array(remotePeerManifestProjectSchema),
|
|
23376
23323
|
capabilities: remotePeerCapabilitiesSchema.optional()
|
|
23377
23324
|
});
|
|
@@ -23458,6 +23405,29 @@ var remotePeerWorkspaceMutationResultSchema = external_exports.object({
|
|
|
23458
23405
|
workspaceId: external_exports.string().min(1).max(1024).optional(),
|
|
23459
23406
|
manifest: remotePeerManifestSchema
|
|
23460
23407
|
});
|
|
23408
|
+
var delegationRemoteHostsParamsSchema = external_exports.object({
|
|
23409
|
+
sessionHostId: external_exports.string().min(1).max(128).optional()
|
|
23410
|
+
});
|
|
23411
|
+
var delegationRemoteHostOptionSchema = external_exports.object({
|
|
23412
|
+
hostId: external_exports.union([external_exports.literal("local"), remotePeerHostIdSchema]),
|
|
23413
|
+
name: external_exports.string().min(1).max(120),
|
|
23414
|
+
isLocal: external_exports.boolean().optional(),
|
|
23415
|
+
color: remotePeerColorSchema.optional(),
|
|
23416
|
+
hostname: external_exports.string().max(255).optional()
|
|
23417
|
+
});
|
|
23418
|
+
var delegationRemoteHostsResultSchema = external_exports.object({
|
|
23419
|
+
hosts: external_exports.array(delegationRemoteHostOptionSchema)
|
|
23420
|
+
});
|
|
23421
|
+
var delegationHostHarnessesParamsSchema = external_exports.object({
|
|
23422
|
+
hostId: external_exports.union([external_exports.literal("local"), remotePeerHostIdSchema])
|
|
23423
|
+
});
|
|
23424
|
+
var delegationHostHarnessOptionSchema = external_exports.object({
|
|
23425
|
+
id: external_exports.string().regex(/^[a-z0-9][a-z0-9-]*$/u),
|
|
23426
|
+
name: external_exports.string().min(1).max(120)
|
|
23427
|
+
});
|
|
23428
|
+
var delegationHostHarnessesResultSchema = external_exports.object({
|
|
23429
|
+
harnesses: external_exports.array(delegationHostHarnessOptionSchema)
|
|
23430
|
+
});
|
|
23461
23431
|
|
|
23462
23432
|
// packages/shared-contracts/dist/peer-delegation.js
|
|
23463
23433
|
var PEER_DELEGATION_BRIDGE_VERSION = 1;
|
|
@@ -23501,6 +23471,7 @@ var peerDelegationHostProjectSchema = external_exports.strictObject({
|
|
|
23501
23471
|
});
|
|
23502
23472
|
var peerDelegationHostSummarySchema = external_exports.strictObject({
|
|
23503
23473
|
hostId: remotePeerHostIdSchema,
|
|
23474
|
+
nodeId: remotePeerNodeIdSchema.optional(),
|
|
23504
23475
|
displayName: external_exports.string().min(1).max(120),
|
|
23505
23476
|
online: external_exports.boolean(),
|
|
23506
23477
|
state: remotePeerStateSchema,
|
|
@@ -24401,6 +24372,13 @@ var updatePhaseSchema = external_exports.enum([
|
|
|
24401
24372
|
"succeeded",
|
|
24402
24373
|
"failed"
|
|
24403
24374
|
]);
|
|
24375
|
+
var npmDownloadProgressSchema = external_exports.strictObject({
|
|
24376
|
+
completed: external_exports.number().int().nonnegative(),
|
|
24377
|
+
total: external_exports.number().int().positive()
|
|
24378
|
+
}).refine((progress) => progress.completed <= progress.total, {
|
|
24379
|
+
path: ["completed"],
|
|
24380
|
+
message: "completed must not exceed total"
|
|
24381
|
+
});
|
|
24404
24382
|
var updateStatusSchema = external_exports.strictObject({
|
|
24405
24383
|
version: updateSemanticVersionSchema,
|
|
24406
24384
|
installation: updateInstallationSchema,
|
|
@@ -24408,6 +24386,7 @@ var updateStatusSchema = external_exports.strictObject({
|
|
|
24408
24386
|
updatedAt: external_exports.number().int().nonnegative(),
|
|
24409
24387
|
downloadedBytes: external_exports.number().int().nonnegative().optional(),
|
|
24410
24388
|
totalBytes: external_exports.number().int().positive().optional(),
|
|
24389
|
+
npmDownload: npmDownloadProgressSchema.optional(),
|
|
24411
24390
|
error: external_exports.string().min(1).max(UPDATE_ERROR_MAX_LENGTH).nullable(),
|
|
24412
24391
|
serviceStopOutput: external_exports.string().optional()
|
|
24413
24392
|
}).superRefine((status, context) => {
|
|
@@ -24745,6 +24724,120 @@ var webUiExtensionRemoveSchema = external_exports.object({ id: webUiExtensionIdS
|
|
|
24745
24724
|
// packages/shared-contracts/dist/index.js
|
|
24746
24725
|
var workspaceContractVersionSchema = external_exports.literal(WORKSPACE_CONTRACT_VERSION);
|
|
24747
24726
|
|
|
24727
|
+
// packages/update-manager/dist/status.js
|
|
24728
|
+
var STATUS_SCHEMA_VERSION = 1;
|
|
24729
|
+
var SEMVER_PATTERN = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/u;
|
|
24730
|
+
function requireSemanticVersion(value) {
|
|
24731
|
+
if (!SEMVER_PATTERN.test(value))
|
|
24732
|
+
throw new Error("update version must be valid semantic version");
|
|
24733
|
+
return value;
|
|
24734
|
+
}
|
|
24735
|
+
function parseUpdateStatus(value) {
|
|
24736
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
24737
|
+
throw new Error("background update status must be an object");
|
|
24738
|
+
}
|
|
24739
|
+
const status = value;
|
|
24740
|
+
const allowed = [
|
|
24741
|
+
"downloadedBytes",
|
|
24742
|
+
"error",
|
|
24743
|
+
"installation",
|
|
24744
|
+
"npmDownload",
|
|
24745
|
+
"phase",
|
|
24746
|
+
"schemaVersion",
|
|
24747
|
+
"serviceStopOutput",
|
|
24748
|
+
"totalBytes",
|
|
24749
|
+
"updatedAt",
|
|
24750
|
+
"version"
|
|
24751
|
+
];
|
|
24752
|
+
if (Object.keys(status).some((key) => !allowed.includes(key))) {
|
|
24753
|
+
throw new Error("background update status contains unknown fields");
|
|
24754
|
+
}
|
|
24755
|
+
if (status.schemaVersion !== STATUS_SCHEMA_VERSION || typeof status.version !== "string" || !SEMVER_PATTERN.test(status.version) || !["npm", "windows-installer", "macos-dmg", "linux-archive"].includes(String(status.installation)) || ![
|
|
24756
|
+
"prepared",
|
|
24757
|
+
"downloading",
|
|
24758
|
+
"waiting-for-exit",
|
|
24759
|
+
"installing",
|
|
24760
|
+
"restarting",
|
|
24761
|
+
"succeeded",
|
|
24762
|
+
"failed"
|
|
24763
|
+
].includes(String(status.phase)) || !Number.isSafeInteger(status.updatedAt) || status.downloadedBytes !== void 0 && (typeof status.downloadedBytes !== "number" || !Number.isSafeInteger(status.downloadedBytes) || status.downloadedBytes < 0) || status.totalBytes !== void 0 && (typeof status.totalBytes !== "number" || !Number.isSafeInteger(status.totalBytes) || status.totalBytes <= 0) || typeof status.downloadedBytes === "number" && typeof status.totalBytes === "number" && status.downloadedBytes > status.totalBytes || status.npmDownload !== void 0 && !npmDownloadProgressSchema.safeParse(status.npmDownload).success || status.error !== void 0 && typeof status.error !== "string" || status.serviceStopOutput !== void 0 && typeof status.serviceStopOutput !== "string") {
|
|
24764
|
+
throw new Error("background update status is invalid");
|
|
24765
|
+
}
|
|
24766
|
+
return status;
|
|
24767
|
+
}
|
|
24768
|
+
|
|
24769
|
+
// packages/update-manager/dist/distribution.js
|
|
24770
|
+
var UPDATE_RUNTIME_ENV = Object.freeze({
|
|
24771
|
+
launcherPid: "CODEXHOST_LAUNCHER_PID",
|
|
24772
|
+
launcherExecutable: "CODEXHOST_LAUNCHER_EXECUTABLE",
|
|
24773
|
+
runtimeDescriptorPath: "CODEXHOST_RUNTIME_DESCRIPTOR_PATH",
|
|
24774
|
+
controllerPort: "CODEXHOST_CONTROL_PORT",
|
|
24775
|
+
controllerNonce: "CODEXHOST_CONTROL_NONCE",
|
|
24776
|
+
npmNodePath: "CODEXHOST_NPM_NODE_PATH",
|
|
24777
|
+
npmCliPath: "CODEXHOST_NPM_CLI_PATH",
|
|
24778
|
+
npmLauncherPath: "CODEXHOST_NPM_LAUNCHER_PATH",
|
|
24779
|
+
npmPackageRoot: "CODEXHOST_NPM_PACKAGE_ROOT",
|
|
24780
|
+
serviceManaged: "CODEXHOST_UPDATE_SERVICE"
|
|
24781
|
+
});
|
|
24782
|
+
function object2(value, label) {
|
|
24783
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
24784
|
+
throw new Error(`${label} must be an object`);
|
|
24785
|
+
}
|
|
24786
|
+
return value;
|
|
24787
|
+
}
|
|
24788
|
+
function parseDistributionMetadata(value) {
|
|
24789
|
+
const metadata = object2(value, "distribution metadata");
|
|
24790
|
+
const allowed = ["distribution", "schemaVersion", "target", "version"];
|
|
24791
|
+
if (Object.keys(metadata).some((key) => !allowed.includes(key))) {
|
|
24792
|
+
throw new Error("distribution metadata contains unknown fields");
|
|
24793
|
+
}
|
|
24794
|
+
if (metadata.schemaVersion !== 1 || metadata.distribution !== "npm" && metadata.distribution !== "installer" || ![
|
|
24795
|
+
"macos-arm64",
|
|
24796
|
+
"macos-x64",
|
|
24797
|
+
"windows-x64",
|
|
24798
|
+
"windows-arm64",
|
|
24799
|
+
"linux-x64",
|
|
24800
|
+
"linux-arm64"
|
|
24801
|
+
].includes(String(metadata.target)) || typeof metadata.version !== "string") {
|
|
24802
|
+
throw new Error("distribution metadata is invalid");
|
|
24803
|
+
}
|
|
24804
|
+
return {
|
|
24805
|
+
schemaVersion: 1,
|
|
24806
|
+
version: requireSemanticVersion(metadata.version),
|
|
24807
|
+
distribution: metadata.distribution,
|
|
24808
|
+
target: metadata.target
|
|
24809
|
+
};
|
|
24810
|
+
}
|
|
24811
|
+
function defaultUpdateStateDirectory(platform = process.platform, environment = process.env) {
|
|
24812
|
+
if (platform === "win32") {
|
|
24813
|
+
const root = environment.LOCALAPPDATA;
|
|
24814
|
+
if (!root || !path.isAbsolute(root))
|
|
24815
|
+
throw new Error("LOCALAPPDATA is unavailable");
|
|
24816
|
+
return path.join(root, "codexhost", "updates");
|
|
24817
|
+
}
|
|
24818
|
+
const home = environment.HOME;
|
|
24819
|
+
if (!home || !path.isAbsolute(home))
|
|
24820
|
+
throw new Error("HOME is unavailable");
|
|
24821
|
+
return platform === "darwin" ? path.join(home, "Library", "Application Support", "codexhost", "updates") : path.join(home, ".codexhost", "updates");
|
|
24822
|
+
}
|
|
24823
|
+
|
|
24824
|
+
// packages/update-manager/dist/runtime-metadata.js
|
|
24825
|
+
async function readRuntimeMetadata(entryPath2, environment = process.env) {
|
|
24826
|
+
const directory = path2.dirname(entryPath2);
|
|
24827
|
+
try {
|
|
24828
|
+
return parseDistributionMetadata(JSON.parse(await readFile(path2.join(directory, "codexhost-distribution.json"), "utf8")));
|
|
24829
|
+
} catch (error62) {
|
|
24830
|
+
if (path2.basename(directory) !== "dist" || path2.basename(path2.resolve(directory, "../..")) !== "packages")
|
|
24831
|
+
throw error62;
|
|
24832
|
+
const workspace = JSON.parse(await readFile(path2.resolve(directory, "../../../package.json"), "utf8"));
|
|
24833
|
+
if (workspace.name !== "codexhost" || typeof workspace.version !== "string")
|
|
24834
|
+
throw error62;
|
|
24835
|
+
const workspaceVersion = requireSemanticVersion(workspace.version);
|
|
24836
|
+
const version2 = environment.CODEXHOST_DEV_VERSION === void 0 ? `${workspaceVersion}-dev` : requireSemanticVersion(environment.CODEXHOST_DEV_VERSION);
|
|
24837
|
+
return { version: version2, distribution: "development" };
|
|
24838
|
+
}
|
|
24839
|
+
}
|
|
24840
|
+
|
|
24748
24841
|
// packages/update-manager/dist/release-announcement.js
|
|
24749
24842
|
var graphemes = new Intl.Segmenter();
|
|
24750
24843
|
|
|
@@ -24927,13 +25020,21 @@ async function releaseInstallable(target2, run2) {
|
|
|
24927
25020
|
}
|
|
24928
25021
|
return true;
|
|
24929
25022
|
}
|
|
24930
|
-
async function prefetchNpmRelease(target2, run2 = runNpmCommand) {
|
|
24931
|
-
const
|
|
24932
|
-
|
|
24933
|
-
|
|
24934
|
-
|
|
24935
|
-
|
|
24936
|
-
|
|
25023
|
+
async function prefetchNpmRelease(target2, run2 = runNpmCommand, onProgress) {
|
|
25024
|
+
const specs = npmReleasePackages(target2.packageRoot, target2.version);
|
|
25025
|
+
const deadline = Date.now() + PREFETCH_TIMEOUT_MS;
|
|
25026
|
+
await onProgress?.({ completed: 0, total: specs.length });
|
|
25027
|
+
for (const [index, spec] of specs.entries()) {
|
|
25028
|
+
const remaining = deadline - Date.now();
|
|
25029
|
+
if (remaining <= 0)
|
|
25030
|
+
throw new Error("npm update download timed out");
|
|
25031
|
+
const result = await run2(target2, ["cache", "add", spec], remaining);
|
|
25032
|
+
if (missingFromRegistry(result) && result.code !== 0)
|
|
25033
|
+
throw new Error(`npm registry does not have codexhost ${target2.version} yet; retry later`);
|
|
25034
|
+
if (result.code !== 0)
|
|
25035
|
+
throw new Error(`npm could not download the update: ${firstErrorLine(result)}`);
|
|
25036
|
+
await onProgress?.({ completed: index + 1, total: specs.length });
|
|
25037
|
+
}
|
|
24937
25038
|
}
|
|
24938
25039
|
function createNpmReleaseAvailability(run2 = runNpmCommand, now = Date.now) {
|
|
24939
25040
|
const answers = /* @__PURE__ */ new Map();
|
|
@@ -25438,7 +25539,7 @@ function createBackgroundUpdateManager(dependencies = {}) {
|
|
|
25438
25539
|
const randomId = dependencies.randomId ?? randomUUID2;
|
|
25439
25540
|
const download2 = dependencies.download ?? downloadArtifact;
|
|
25440
25541
|
const spawnUpdater = dependencies.spawnUpdater ?? defaultSpawnUpdater;
|
|
25441
|
-
const prefetchNpm = dependencies.prefetchNpm ?? ((target2) => prefetchNpmRelease(target2));
|
|
25542
|
+
const prefetchNpm = dependencies.prefetchNpm ?? ((target2, onProgress) => prefetchNpmRelease(target2, void 0, onProgress));
|
|
25442
25543
|
const now = dependencies.now ?? Date.now;
|
|
25443
25544
|
const preparedRequests = /* @__PURE__ */ new Set();
|
|
25444
25545
|
async function writeStatusSnapshot(statusPath, status) {
|
|
@@ -25516,7 +25617,7 @@ function createBackgroundUpdateManager(dependencies = {}) {
|
|
|
25516
25617
|
await chmod(helperPath, 448);
|
|
25517
25618
|
const requestPath = path6.join(workDirectory, "request-v1.json");
|
|
25518
25619
|
const statusPath = path6.join(workDirectory, "status-v1.json");
|
|
25519
|
-
await writePrivateJson(statusPath,
|
|
25620
|
+
await writePrivateJson(statusPath, statusSnapshot(version2, installation, "downloading"));
|
|
25520
25621
|
await options.onPrepared?.({ version: version2, installation, statusPath });
|
|
25521
25622
|
return {
|
|
25522
25623
|
version: version2,
|
|
@@ -25533,11 +25634,12 @@ function createBackgroundUpdateManager(dependencies = {}) {
|
|
|
25533
25634
|
};
|
|
25534
25635
|
}
|
|
25535
25636
|
async function prepareArtifact(common, installation, sourceValue, fileName) {
|
|
25536
|
-
const source = validateArtifact(sourceValue);
|
|
25537
25637
|
const temporaryPath = path6.join(common.workDirectory, `.${fileName}.download`);
|
|
25538
25638
|
const artifactPath = path6.join(common.workDirectory, fileName);
|
|
25539
|
-
|
|
25639
|
+
let progress;
|
|
25540
25640
|
try {
|
|
25641
|
+
const source = validateArtifact(sourceValue);
|
|
25642
|
+
progress = progressReporter(common.statusPath, common.version, installation, source.size);
|
|
25541
25643
|
const result = await download2(source, temporaryPath, progress.update);
|
|
25542
25644
|
progress.update({ downloadedBytes: result.bytes, totalBytes: source.size });
|
|
25543
25645
|
await progress.flush();
|
|
@@ -25550,7 +25652,7 @@ function createBackgroundUpdateManager(dependencies = {}) {
|
|
|
25550
25652
|
return { source, artifactPath };
|
|
25551
25653
|
} catch (error62) {
|
|
25552
25654
|
await rm2(temporaryPath, { force: true });
|
|
25553
|
-
await progress
|
|
25655
|
+
await progress?.flush();
|
|
25554
25656
|
await writeFailedStatus(common.statusPath, common.version, installation, error62);
|
|
25555
25657
|
throw error62;
|
|
25556
25658
|
}
|
|
@@ -25568,8 +25670,13 @@ function createBackgroundUpdateManager(dependencies = {}) {
|
|
|
25568
25670
|
...common.dataDirectory ? { data_directory: common.dataDirectory } : {},
|
|
25569
25671
|
installation
|
|
25570
25672
|
};
|
|
25571
|
-
|
|
25572
|
-
|
|
25673
|
+
try {
|
|
25674
|
+
await writePrivateJson(common.requestPath, request);
|
|
25675
|
+
await writeStatusSnapshot(common.statusPath, statusSnapshot(common.version, installation.kind, "prepared"));
|
|
25676
|
+
} catch (error62) {
|
|
25677
|
+
await writeFailedStatus(common.statusPath, common.version, installation.kind, error62);
|
|
25678
|
+
throw error62;
|
|
25679
|
+
}
|
|
25573
25680
|
preparedRequests.add(common.requestPath);
|
|
25574
25681
|
return Object.freeze({
|
|
25575
25682
|
version: common.version,
|
|
@@ -25587,8 +25694,10 @@ function createBackgroundUpdateManager(dependencies = {}) {
|
|
|
25587
25694
|
const nodePath = await requireRegularFile(options.nodePath, "npm Node.js executable");
|
|
25588
25695
|
const npmCliPath = await requireRegularFile(options.npmCliPath, "npm CLI");
|
|
25589
25696
|
const packageRoot = requireAbsolutePath(options.packageRoot, "npm platform package root");
|
|
25590
|
-
await
|
|
25591
|
-
|
|
25697
|
+
await prefetchNpm({ nodePath, npmCliPath, packageRoot, version: common.version }, (npmDownload) => writeStatusSnapshot(common.statusPath, {
|
|
25698
|
+
...statusSnapshot(common.version, "npm", "downloading"),
|
|
25699
|
+
npmDownload
|
|
25700
|
+
}).catch(() => void 0));
|
|
25592
25701
|
return await finalize2(common, {
|
|
25593
25702
|
kind: "npm",
|
|
25594
25703
|
node_path: nodePath,
|
|
@@ -25604,23 +25713,24 @@ function createBackgroundUpdateManager(dependencies = {}) {
|
|
|
25604
25713
|
async prepareWindowsInstaller(options) {
|
|
25605
25714
|
if (platform !== "win32")
|
|
25606
25715
|
throw new Error("Windows installer updates require Windows");
|
|
25716
|
+
const installRoot = requireAbsolutePath(options.installRoot, "Windows install root");
|
|
25607
25717
|
const common = await prepareCommon(options, "windows-installer");
|
|
25608
25718
|
const artifact = await prepareArtifact(common, "windows-installer", options.artifact, "update.exe");
|
|
25609
25719
|
return finalize2(common, {
|
|
25610
25720
|
kind: "windows-installer",
|
|
25611
25721
|
installer_path: artifact.artifactPath,
|
|
25612
25722
|
artifact_sha256: artifact.source.sha256,
|
|
25613
|
-
install_root:
|
|
25723
|
+
install_root: installRoot
|
|
25614
25724
|
}, artifact.artifactPath);
|
|
25615
25725
|
},
|
|
25616
25726
|
async prepareMacOsDmg(options) {
|
|
25617
25727
|
if (platform !== "darwin")
|
|
25618
25728
|
throw new Error("macOS DMG updates require macOS");
|
|
25619
|
-
const common = await prepareCommon(options, "macos-dmg");
|
|
25620
25729
|
const appPath = requireAbsolutePath(options.appPath, "macOS application path");
|
|
25621
25730
|
if (path6.extname(appPath) !== ".app") {
|
|
25622
25731
|
throw new Error("macOS application path must end in .app");
|
|
25623
25732
|
}
|
|
25733
|
+
const common = await prepareCommon(options, "macos-dmg");
|
|
25624
25734
|
const artifact = await prepareArtifact(common, "macos-dmg", options.artifact, "update.dmg");
|
|
25625
25735
|
return finalize2(common, {
|
|
25626
25736
|
kind: "macos-dmg",
|
|
@@ -25632,13 +25742,14 @@ function createBackgroundUpdateManager(dependencies = {}) {
|
|
|
25632
25742
|
async prepareLinuxArchive(options) {
|
|
25633
25743
|
if (platform !== "linux")
|
|
25634
25744
|
throw new Error("Linux archive updates require Linux");
|
|
25745
|
+
const installRoot = requireAbsolutePath(options.installRoot, "Linux install root");
|
|
25635
25746
|
const common = await prepareCommon(options, "linux-archive");
|
|
25636
25747
|
const artifact = await prepareArtifact(common, "linux-archive", options.artifact, "update.tar.gz");
|
|
25637
25748
|
return finalize2(common, {
|
|
25638
25749
|
kind: "linux-archive",
|
|
25639
25750
|
archive_path: artifact.artifactPath,
|
|
25640
25751
|
artifact_sha256: artifact.source.sha256,
|
|
25641
|
-
install_root:
|
|
25752
|
+
install_root: installRoot
|
|
25642
25753
|
}, artifact.artifactPath);
|
|
25643
25754
|
},
|
|
25644
25755
|
async start(prepared, transferOwnership) {
|
|
@@ -27270,6 +27381,7 @@ function publicStatus(status) {
|
|
|
27270
27381
|
updatedAt: status.updatedAt,
|
|
27271
27382
|
...status.downloadedBytes === void 0 ? {} : { downloadedBytes: status.downloadedBytes },
|
|
27272
27383
|
...status.totalBytes === void 0 ? {} : { totalBytes: status.totalBytes },
|
|
27384
|
+
...status.npmDownload === void 0 ? {} : { npmDownload: status.npmDownload },
|
|
27273
27385
|
error: status.error?.slice(0, ERROR_MAX_LENGTH) ?? null,
|
|
27274
27386
|
...status.serviceStopOutput === void 0 ? {} : { serviceStopOutput: status.serviceStopOutput }
|
|
27275
27387
|
};
|
|
@@ -28178,7 +28290,22 @@ async function openConsole(options) {
|
|
|
28178
28290
|
}
|
|
28179
28291
|
|
|
28180
28292
|
// packages/console-server/src/update-cli.ts
|
|
28181
|
-
|
|
28293
|
+
import { setTimeout as delay4 } from "node:timers/promises";
|
|
28294
|
+
var POLL_INTERVAL_MS = 500;
|
|
28295
|
+
var DOWNLOAD_IDLE_TIMEOUT_MS = 15 * 6e4;
|
|
28296
|
+
function downloadMessage(status) {
|
|
28297
|
+
const prefix = "Downloading update...";
|
|
28298
|
+
if (status.npmDownload) {
|
|
28299
|
+
return `${prefix} ${status.npmDownload.completed}/${status.npmDownload.total} npm packages ready`;
|
|
28300
|
+
}
|
|
28301
|
+
if (status.downloadedBytes === void 0) return prefix;
|
|
28302
|
+
const mib = (bytes) => `${(bytes / (1024 * 1024)).toFixed(1)} MiB`;
|
|
28303
|
+
const downloaded = mib(status.downloadedBytes);
|
|
28304
|
+
if (status.totalBytes === void 0) return `${prefix} ${downloaded}`;
|
|
28305
|
+
const percent = Math.floor(status.downloadedBytes / status.totalBytes * 100);
|
|
28306
|
+
return `${prefix} ${percent}% (${downloaded} / ${mib(status.totalBytes)})`;
|
|
28307
|
+
}
|
|
28308
|
+
async function runUpdateCommand(target2, updates, write = (message) => console.log(message)) {
|
|
28182
28309
|
write("Checking for codexhost updates...");
|
|
28183
28310
|
const checked = await updates.check(target2);
|
|
28184
28311
|
if (checked.error) throw new Error(checked.error);
|
|
@@ -28192,8 +28319,37 @@ async function runUpdateCommand(target2, updates, write = console.log) {
|
|
|
28192
28319
|
);
|
|
28193
28320
|
}
|
|
28194
28321
|
write(`Updating codexhost ${checked.currentVersion} → ${checked.latestVersion}...`);
|
|
28195
|
-
|
|
28322
|
+
let lastProgress;
|
|
28323
|
+
const report = (status2) => {
|
|
28324
|
+
if (status2?.phase !== "downloading" || status2.version !== checked.latestVersion) return;
|
|
28325
|
+
const message = downloadMessage(status2);
|
|
28326
|
+
if (message === lastProgress) return;
|
|
28327
|
+
lastProgress = message;
|
|
28328
|
+
write(message, true);
|
|
28329
|
+
};
|
|
28330
|
+
const starting = updates.start(target2).then(({ status: status2 }) => status2);
|
|
28331
|
+
const startOrPoll = () => Promise.race([starting, delay4(POLL_INTERVAL_MS, null, { ref: false })]);
|
|
28332
|
+
let status = await startOrPoll();
|
|
28333
|
+
while (status === null) {
|
|
28334
|
+
report((await updates.status()).status);
|
|
28335
|
+
status = await startOrPoll();
|
|
28336
|
+
}
|
|
28337
|
+
const waitingSince = Date.now();
|
|
28338
|
+
while (status.phase === "downloading") {
|
|
28339
|
+
report(status);
|
|
28340
|
+
if (Date.now() - Math.max(waitingSince, status.updatedAt * 1e3) >= DOWNLOAD_IDLE_TIMEOUT_MS)
|
|
28341
|
+
throw new Error("Timed out waiting for download progress");
|
|
28342
|
+
await delay4(POLL_INTERVAL_MS);
|
|
28343
|
+
const current = (await updates.status()).status;
|
|
28344
|
+
if (current?.version === status.version && current.installation === status.installation)
|
|
28345
|
+
status = current;
|
|
28346
|
+
}
|
|
28196
28347
|
if (status.phase === "failed") throw new Error(status.error ?? "Update failed");
|
|
28348
|
+
if (lastProgress) write("Download complete.");
|
|
28349
|
+
if (status.phase === "succeeded") {
|
|
28350
|
+
write(`Update ${status.version}: installed successfully.`);
|
|
28351
|
+
return;
|
|
28352
|
+
}
|
|
28197
28353
|
write(
|
|
28198
28354
|
`Update ${status.version}: ${status.phase}. The update request was accepted; installation is not complete yet. The background updater will install it and restart codexhost.`
|
|
28199
28355
|
);
|
|
@@ -28208,17 +28364,40 @@ async function updateFromCommand(appDirectory2, arguments_) {
|
|
|
28208
28364
|
updateAppDirectory: appDirectory2
|
|
28209
28365
|
});
|
|
28210
28366
|
const inspected = await inspectInstallation(installation.launcherExecutable);
|
|
28211
|
-
|
|
28212
|
-
|
|
28213
|
-
|
|
28214
|
-
|
|
28215
|
-
|
|
28216
|
-
|
|
28217
|
-
|
|
28218
|
-
|
|
28219
|
-
|
|
28220
|
-
|
|
28221
|
-
|
|
28367
|
+
const local = createConsoleUpdates({ waitForHandoff: true, onHandedOff() {
|
|
28368
|
+
} });
|
|
28369
|
+
const updates = await host.available() ? { ...createHostUpdates(host), status: local.status } : local;
|
|
28370
|
+
const output2 = process.stdout;
|
|
28371
|
+
let progressVisible = false;
|
|
28372
|
+
const clearProgress = () => {
|
|
28373
|
+
if (!progressVisible) return;
|
|
28374
|
+
output2.clearLine(0);
|
|
28375
|
+
output2.cursorTo(0);
|
|
28376
|
+
progressVisible = false;
|
|
28377
|
+
};
|
|
28378
|
+
try {
|
|
28379
|
+
await runUpdateCommand(
|
|
28380
|
+
{
|
|
28381
|
+
...installation,
|
|
28382
|
+
runtimeDescriptorPath: inspected.runtime.descriptorPath,
|
|
28383
|
+
codexhostRunning: inspected.runtime.running,
|
|
28384
|
+
dataDirectory: paths.dataDirectory,
|
|
28385
|
+
restartTarget: inspected.desktop === null ? "web" : "desktop"
|
|
28386
|
+
},
|
|
28387
|
+
updates,
|
|
28388
|
+
(message, live) => {
|
|
28389
|
+
clearProgress();
|
|
28390
|
+
if (live && output2.isTTY) {
|
|
28391
|
+
output2.write(message);
|
|
28392
|
+
progressVisible = true;
|
|
28393
|
+
} else {
|
|
28394
|
+
console.log(message);
|
|
28395
|
+
}
|
|
28396
|
+
}
|
|
28397
|
+
);
|
|
28398
|
+
} finally {
|
|
28399
|
+
clearProgress();
|
|
28400
|
+
}
|
|
28222
28401
|
}
|
|
28223
28402
|
|
|
28224
28403
|
// packages/console-server/src/main.ts
|