@liberseek/boft-cli-win32-arm64 0.7.5 → 0.7.7

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.
@@ -5,6 +5,488 @@ var __export = (target, all) => {
5
5
  __defProp(target, name, { get: all[name], enumerable: true });
6
6
  };
7
7
 
8
+ // ../../harness-discovery/dist/environment.js
9
+ import fs from "node:fs";
10
+ import path from "node:path";
11
+ function targetPath(platform) {
12
+ return platform === "win32" ? path.win32 : path.posix;
13
+ }
14
+ function environmentValue(environment, name) {
15
+ const lowered = name.toLowerCase();
16
+ for (const [key, value] of Object.entries(environment)) {
17
+ if (key.toLowerCase() === lowered)
18
+ return value;
19
+ }
20
+ return void 0;
21
+ }
22
+ function pathDelimiter(platform) {
23
+ return platform === "win32" ? ";" : ":";
24
+ }
25
+ function pathDirectories(environment, platform) {
26
+ return (environmentValue(environment, "PATH") ?? "").split(pathDelimiter(platform)).map((directory) => directory.trim().replace(/^"|"$/gu, "")).filter(Boolean);
27
+ }
28
+ function executableExtensions(command, platform, environment) {
29
+ if (platform !== "win32")
30
+ return [""];
31
+ if (targetPath(platform).extname(command) !== "")
32
+ return [""];
33
+ return (environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").map((extension) => extension.trim()).filter(Boolean);
34
+ }
35
+ function isExecutableFile(filePath, platform) {
36
+ try {
37
+ fs.accessSync(filePath, platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK);
38
+ return fs.statSync(filePath).isFile();
39
+ } catch {
40
+ return false;
41
+ }
42
+ }
43
+ function subdirectoryNames(directory) {
44
+ try {
45
+ return fs.readdirSync(directory, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
46
+ } catch {
47
+ return [];
48
+ }
49
+ }
50
+ function newestFirst(names) {
51
+ return [...names].sort((left, right) => right.localeCompare(left, void 0, { numeric: true }));
52
+ }
53
+
54
+ // ../../harness-discovery/dist/invocation.js
55
+ import path2 from "node:path";
56
+ function commandInvocation(command, arguments_, environment, platform = process.platform) {
57
+ const extension = path2.win32.extname(command).toLowerCase();
58
+ if (platform !== "win32" || ![".cmd", ".bat"].includes(extension)) {
59
+ return { command, arguments: [...arguments_], windowsVerbatimArguments: false };
60
+ }
61
+ const quote = (value) => `"${value.replaceAll("%", "%%").replaceAll('"', '""')}"`;
62
+ const commandLine = [command, ...arguments_].map(quote).join(" ");
63
+ return {
64
+ command: environmentValue(environment, "ComSpec") ?? "cmd.exe",
65
+ arguments: ["/d", "/v:off", "/s", "/c", `"${commandLine}"`],
66
+ windowsVerbatimArguments: true
67
+ };
68
+ }
69
+
70
+ // ../../harness-discovery/dist/node-runtime.js
71
+ import path3 from "node:path";
72
+ function withNodeRuntimeOnPath(environment, runtimeExecutable = process.execPath, platform = process.platform) {
73
+ const pathKey = Object.keys(environment).find((name) => name.toLowerCase() === "path") ?? "PATH";
74
+ const delimiter = platform === "win32" ? ";" : ":";
75
+ const runtimeDirectory = path3.dirname(runtimeExecutable);
76
+ const directories = (environment[pathKey] ?? "").split(delimiter).filter(Boolean);
77
+ const equal = platform === "win32" ? (value) => value.toLowerCase() : (value) => value;
78
+ if (!directories.some((directory) => equal(directory) === equal(runtimeDirectory))) {
79
+ directories.push(runtimeDirectory);
80
+ }
81
+ return { ...environment, [pathKey]: directories.join(delimiter) };
82
+ }
83
+
84
+ // ../../harness-discovery/dist/resolve.js
85
+ import os from "node:os";
86
+
87
+ // ../../harness-discovery/dist/version-managers.js
88
+ function versionManagerBinaryDirectories(context) {
89
+ const { platform, environment, home } = context;
90
+ const list = context.subdirectories ?? subdirectoryNames;
91
+ const pathFlavor = targetPath(platform);
92
+ const value = (name) => environmentValue(environment, name);
93
+ const directories = [];
94
+ const versioned = (root, ...tail) => {
95
+ for (const version2 of newestFirst(list(root))) {
96
+ directories.push(pathFlavor.join(root, version2, ...tail));
97
+ }
98
+ };
99
+ if (platform === "win32") {
100
+ const appData = value("APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming");
101
+ const localAppData = value("LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local");
102
+ versioned(pathFlavor.join(appData, "nvm"));
103
+ versioned(value("FNM_DIR") ?? pathFlavor.join(appData, "fnm", "node-versions"), "installation");
104
+ directories.push(pathFlavor.join(localAppData, "Volta", "bin"));
105
+ directories.push(pathFlavor.join(home, ".bun", "bin"));
106
+ const pnpmHome2 = value("PNPM_HOME");
107
+ if (pnpmHome2)
108
+ directories.push(pnpmHome2);
109
+ directories.push(pathFlavor.join(localAppData, "pnpm"));
110
+ return directories;
111
+ }
112
+ versioned(pathFlavor.join(value("NVM_DIR") ?? pathFlavor.join(home, ".nvm"), "versions", "node"), "bin");
113
+ const fnmRoots = [
114
+ value("FNM_DIR"),
115
+ pathFlavor.join(home, ".local", "share", "fnm"),
116
+ pathFlavor.join(home, "Library", "Application Support", "fnm")
117
+ ].filter((root) => root !== void 0);
118
+ for (const root of fnmRoots) {
119
+ versioned(pathFlavor.join(root, "node-versions"), "installation", "bin");
120
+ }
121
+ const voltaHome = value("VOLTA_HOME") ?? pathFlavor.join(home, ".volta");
122
+ versioned(pathFlavor.join(voltaHome, "tools", "image", "node"), "bin");
123
+ directories.push(pathFlavor.join(voltaHome, "bin"));
124
+ const asdfHome = value("ASDF_DATA_DIR") ?? pathFlavor.join(home, ".asdf");
125
+ versioned(pathFlavor.join(asdfHome, "installs", "nodejs"), "bin");
126
+ directories.push(pathFlavor.join(asdfHome, "shims"));
127
+ const nodenvHome = value("NODENV_ROOT") ?? pathFlavor.join(home, ".nodenv");
128
+ versioned(pathFlavor.join(nodenvHome, "versions"), "bin");
129
+ directories.push(pathFlavor.join(nodenvHome, "shims"));
130
+ versioned(pathFlavor.join(value("N_PREFIX") ?? "/usr/local", "n", "versions", "node"), "bin");
131
+ directories.push(pathFlavor.join(home, ".bun", "bin"));
132
+ const pnpmHome = value("PNPM_HOME");
133
+ if (pnpmHome)
134
+ directories.push(pnpmHome);
135
+ directories.push(pathFlavor.join(home, "Library", "pnpm"));
136
+ directories.push(pathFlavor.join(home, ".local", "share", "pnpm"));
137
+ for (const prefix of ["/opt/homebrew/opt", "/usr/local/opt"]) {
138
+ for (const formula of newestFirst(list(prefix).filter((name) => name.startsWith("node@")))) {
139
+ directories.push(pathFlavor.join(prefix, formula, "bin"));
140
+ }
141
+ }
142
+ return directories;
143
+ }
144
+
145
+ // ../../harness-discovery/dist/resolve.js
146
+ var VERSION_MANAGER_ROOTS = "<version-managers>";
147
+ function installRootExtensions(platform) {
148
+ return platform === "win32" ? [".exe", ".cmd"] : [""];
149
+ }
150
+ function resolveHomeDirectory(input) {
151
+ return input.homeDirectory ?? environmentValue(input.environment, "HOME") ?? environmentValue(input.environment, "USERPROFILE") ?? os.homedir();
152
+ }
153
+ function templateVariables(environment, platform, home) {
154
+ const pathFlavor = targetPath(platform);
155
+ return {
156
+ HOME: home,
157
+ USERPROFILE: home,
158
+ APPDATA: environmentValue(environment, "APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming"),
159
+ LOCALAPPDATA: environmentValue(environment, "LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local")
160
+ };
161
+ }
162
+ function joinTemplate(platform, value) {
163
+ const pathFlavor = targetPath(platform);
164
+ const segments = value.split("/");
165
+ const head = segments[0] ?? "";
166
+ const tail = segments.slice(1);
167
+ if (head === "")
168
+ return pathFlavor.join(pathFlavor.sep, ...tail);
169
+ return tail.length === 0 ? head : pathFlavor.join(head, ...tail);
170
+ }
171
+ function expandInstallRoot(template, environment, platform, home) {
172
+ const variables = templateVariables(environment, platform, home);
173
+ let unresolved = false;
174
+ const substituted = template.replace(/^~(?=\/|$)/u, home).replace(/\$\{(\w+)\}/gu, (_match, name) => {
175
+ const value = variables[name] ?? environmentValue(environment, name);
176
+ if (value === void 0 || value === "") {
177
+ unresolved = true;
178
+ return "";
179
+ }
180
+ return value;
181
+ });
182
+ return unresolved ? void 0 : joinTemplate(platform, substituted);
183
+ }
184
+ function installRootDirectories(spec, input, dependencies, platform, home) {
185
+ const templates = (platform === "win32" ? spec.installRoots?.windows : spec.installRoots?.posix) ?? [];
186
+ const directories = [];
187
+ for (const template of templates) {
188
+ if (template === VERSION_MANAGER_ROOTS) {
189
+ directories.push(...versionManagerBinaryDirectories({
190
+ platform,
191
+ environment: input.environment,
192
+ home,
193
+ ...dependencies.subdirectories ? { subdirectories: dependencies.subdirectories } : {}
194
+ }));
195
+ continue;
196
+ }
197
+ const directory = expandInstallRoot(template, input.environment, platform, home);
198
+ if (directory !== void 0)
199
+ directories.push(directory);
200
+ }
201
+ return directories;
202
+ }
203
+ function harnessCandidates(spec, input, dependencies = {}) {
204
+ const platform = input.platform ?? process.platform;
205
+ const pathFlavor = targetPath(platform);
206
+ const configured = input.command ?? (spec.commandEnvironmentVariable ? environmentValue(input.environment, spec.commandEnvironmentVariable) : void 0);
207
+ const command = configured ?? spec.command;
208
+ if (pathFlavor.isAbsolute(command) || command.includes("/") || command.includes("\\")) {
209
+ return [{ candidate: command, source: "configured" }];
210
+ }
211
+ const candidates = [];
212
+ const extensions = executableExtensions(command, platform, input.environment);
213
+ for (const directory of pathDirectories(input.environment, platform)) {
214
+ for (const extension of extensions) {
215
+ candidates.push({
216
+ candidate: pathFlavor.join(directory, command + extension),
217
+ source: "path"
218
+ });
219
+ }
220
+ }
221
+ if (configured !== void 0)
222
+ return candidates;
223
+ const home = resolveHomeDirectory(input);
224
+ for (const directory of installRootDirectories(spec, input, dependencies, platform, home)) {
225
+ for (const extension of installRootExtensions(platform)) {
226
+ candidates.push({
227
+ candidate: pathFlavor.join(directory, spec.command + extension),
228
+ source: "install-root"
229
+ });
230
+ }
231
+ }
232
+ return candidates;
233
+ }
234
+ function resolveHarnessExecutable(spec, input, dependencies = {}) {
235
+ const platform = input.platform ?? process.platform;
236
+ const isExecutable = dependencies.isExecutable ?? ((candidate) => isExecutableFile(candidate, platform));
237
+ const runnable = spec.runnableCandidate ?? ((candidate) => candidate);
238
+ const context = { platform, isExecutable };
239
+ for (const { candidate, source } of harnessCandidates(spec, input, dependencies)) {
240
+ const executable = runnable(candidate, context);
241
+ if (executable !== void 0 && isExecutable(executable))
242
+ return { executable, source };
243
+ }
244
+ return void 0;
245
+ }
246
+
247
+ // ../../harness-discovery/dist/installation.js
248
+ import { execFile } from "node:child_process";
249
+ import { homedir } from "node:os";
250
+ function runInstallationCommand(command, args, environment, timeout = 3e4) {
251
+ const env = withNodeRuntimeOnPath(environment);
252
+ const invocation = /\.[cm]?js$/i.test(command) ? commandInvocation(process.execPath, [command, ...args], env) : commandInvocation(command, args, env);
253
+ return new Promise((resolve, reject) => {
254
+ const child = execFile(invocation.command, invocation.arguments, {
255
+ env,
256
+ cwd: env.HOME ?? env.USERPROFILE ?? homedir(),
257
+ encoding: "utf8",
258
+ timeout,
259
+ killSignal: "SIGKILL",
260
+ maxBuffer: 1024 * 1024,
261
+ windowsHide: true,
262
+ windowsVerbatimArguments: invocation.windowsVerbatimArguments
263
+ }, (error51, stdout, stderr) => {
264
+ if (error51)
265
+ reject(new Error(error51.killed ? "Harness command timed out" : "Harness command failed; check the native installation and retry"));
266
+ else
267
+ resolve((stdout || stderr).trim());
268
+ });
269
+ child.stdin?.end();
270
+ });
271
+ }
272
+ function installationVersion(value) {
273
+ if (typeof value !== "string" || !/^v?\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?$/.test(value.trim()))
274
+ throw new Error("Harness returned an invalid version");
275
+ return value.trim().replace(/^v/, "");
276
+ }
277
+ function versionFromOutput(output) {
278
+ return installationVersion(output.match(/\b\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?\b/)?.[0]);
279
+ }
280
+ function newerInstallationVersion(current, latest) {
281
+ const a = installationVersion(current).replace(/\+.*/, "");
282
+ const b = installationVersion(latest).replace(/\+.*/, "");
283
+ const coreA = a.replace(/-.*/, "").split(".").map(BigInt);
284
+ const coreB = b.replace(/-.*/, "").split(".").map(BigInt);
285
+ for (let i = 0; i < Math.max(coreA.length, coreB.length); i++) {
286
+ if ((coreA[i] ?? 0n) !== (coreB[i] ?? 0n))
287
+ return (coreB[i] ?? 0n) > (coreA[i] ?? 0n);
288
+ }
289
+ const preA = a.includes("-") ? a.slice(a.indexOf("-") + 1).split(".") : [];
290
+ const preB = b.includes("-") ? b.slice(b.indexOf("-") + 1).split(".") : [];
291
+ if (!preA.length || !preB.length)
292
+ return !!preA.length && !preB.length;
293
+ for (let i = 0; i < Math.max(preA.length, preB.length); i++) {
294
+ const x = preA[i];
295
+ const y = preB[i];
296
+ if (x === y)
297
+ continue;
298
+ if (x === void 0 || y === void 0)
299
+ return x === void 0;
300
+ const numericX = /^\d+$/.test(x);
301
+ const numericY = /^\d+$/.test(y);
302
+ if (numericX && numericY) {
303
+ if (BigInt(x) === BigInt(y))
304
+ continue;
305
+ return BigInt(y) > BigInt(x);
306
+ }
307
+ if (numericX !== numericY)
308
+ return numericX;
309
+ return y > x;
310
+ }
311
+ return false;
312
+ }
313
+ function createInstallationManager(options) {
314
+ let checking;
315
+ let updating;
316
+ const check2 = () => checking ??= options.check().finally(() => {
317
+ checking = void 0;
318
+ });
319
+ return (action) => {
320
+ if (updating)
321
+ return updating;
322
+ if (action === "check")
323
+ return check2();
324
+ updating = (async () => {
325
+ const before = await check2();
326
+ if (!before.updateAvailable)
327
+ return before;
328
+ if (!before.canUpdate)
329
+ throw new Error(before.message ?? "This installation cannot be updated automatically");
330
+ await options.update(before);
331
+ const after = await check2();
332
+ if (after.currentVersion === before.currentVersion)
333
+ throw new Error("The Harness version did not change; check the native updater and retry");
334
+ return after;
335
+ })().finally(() => {
336
+ updating = void 0;
337
+ });
338
+ return updating;
339
+ };
340
+ }
341
+ async function fetchInstallationText(url2) {
342
+ const request = async () => {
343
+ const response = await fetch(url2, { signal: AbortSignal.timeout(15e3) });
344
+ if (!response.ok)
345
+ throw new Error("Could not check the latest Harness version");
346
+ return response.text();
347
+ };
348
+ try {
349
+ return await request();
350
+ } catch (error51) {
351
+ if (error51 instanceof DOMException && (error51.name === "AbortError" || error51.name === "TimeoutError"))
352
+ throw error51;
353
+ return request();
354
+ }
355
+ }
356
+
357
+ // ../../harness-discovery/dist/npm-installation.js
358
+ import { readFile, realpath } from "node:fs/promises";
359
+ import path4 from "node:path";
360
+ function referencesNpmBin(shim, name, bin) {
361
+ if (bin.includes(".."))
362
+ return false;
363
+ const target = `node_modules/${name}/${bin.replace(/^\.\//, "")}`.toLowerCase();
364
+ const text2 = shim.replaceAll("\\", "/").toLowerCase();
365
+ return text2.includes(`%dp0%/${target}"`) || text2.includes(`%~dp0/${target}"`);
366
+ }
367
+ async function npmInstallation(command, packages, environment) {
368
+ let selected = await realpath(command);
369
+ if (process.platform === "win32" && /\.(cmd|bat)$/i.test(selected)) {
370
+ const shim = (await readFile(selected, "utf8")).replaceAll("\\", "/");
371
+ const root = path4.dirname(selected);
372
+ for (const name of packages) {
373
+ const directory2 = path4.join(root, "node_modules", ...name.split("/"));
374
+ const metadata = await readFile(path4.join(directory2, "package.json"), "utf8").then((text2) => JSON.parse(text2)).catch(() => null);
375
+ const bins = typeof metadata?.bin === "string" ? [metadata.bin] : Object.values(metadata?.bin ?? {});
376
+ const bin = bins.find((entry) => referencesNpmBin(shim, name, entry));
377
+ if (bin) {
378
+ selected = await realpath(path4.join(directory2, bin));
379
+ break;
380
+ }
381
+ }
382
+ }
383
+ let directory = path4.dirname(selected);
384
+ for (let depth = 0; depth < 8; depth++) {
385
+ const metadata = await readFile(path4.join(directory, "package.json"), "utf8").then((text2) => JSON.parse(text2)).catch(() => null);
386
+ if (metadata?.name && packages.includes(metadata.name)) {
387
+ const name = metadata.name;
388
+ const currentVersion = installationVersion(metadata.version);
389
+ const segments = name.split("/");
390
+ let modules = directory;
391
+ for (let index = 0; index < segments.length; index++)
392
+ modules = path4.dirname(modules);
393
+ const prefix = process.platform === "win32" ? path4.dirname(modules) : path4.dirname(path4.dirname(modules));
394
+ const globalRoot = process.platform === "win32" ? path4.join(prefix, "node_modules") : path4.join(prefix, "lib", "node_modules");
395
+ const env = withNodeRuntimeOnPath(environment);
396
+ const npm = resolveHarnessExecutable({ id: "npm", command: "npm", installRoots: { posix: [], windows: [] } }, { environment: env });
397
+ let globalInstall = modules === globalRoot;
398
+ if (process.platform === "win32") {
399
+ const project = (await Promise.all(["package.json", "package-lock.json", "npm-shrinkwrap.json"].map((file2) => readFile(path4.join(prefix, file2), "utf8").then(() => true, (error51) => error51.code !== "ENOENT")))).some(Boolean);
400
+ const bins = typeof metadata.bin === "string" ? { [name.split("/").at(-1) ?? name]: metadata.bin } : metadata.bin ?? {};
401
+ const launchers = await Promise.all(Object.entries(bins).map(async ([bin, entry]) => {
402
+ if (path4.basename(bin) !== bin || entry.includes(".."))
403
+ return false;
404
+ const target = await realpath(path4.join(directory, entry)).catch(() => "");
405
+ if (target.toLowerCase() !== selected.toLowerCase())
406
+ return false;
407
+ const shim = await readFile(path4.join(prefix, `${bin}.cmd`), "utf8").catch(() => "");
408
+ return referencesNpmBin(shim, name, entry);
409
+ }));
410
+ globalInstall = globalInstall && !project && launchers.some(Boolean);
411
+ }
412
+ const canUpdate = globalInstall && !!npm;
413
+ return {
414
+ prefix,
415
+ currentVersion,
416
+ canUpdate,
417
+ latest: async () => {
418
+ const data = JSON.parse(await fetchInstallationText(`https://registry.npmjs.org/${encodeURIComponent(name)}/latest`));
419
+ return installationVersion(data.version);
420
+ },
421
+ update: async (version2) => {
422
+ if (!canUpdate || !npm)
423
+ throw new Error("Use the original package manager to update this installation");
424
+ await runInstallationCommand(npm.executable, ["install", "--global", "--prefix", prefix, `${name}@${installationVersion(version2)}`], env, 3e5);
425
+ }
426
+ };
427
+ }
428
+ const parent = path4.dirname(directory);
429
+ if (parent === directory)
430
+ break;
431
+ directory = parent;
432
+ }
433
+ return null;
434
+ }
435
+
436
+ // ../../harness-discovery/dist/installer.js
437
+ import { mkdtemp, rm, writeFile } from "node:fs/promises";
438
+ import { tmpdir } from "node:os";
439
+ import { join } from "node:path";
440
+ function createHarnessInstaller(environment, source) {
441
+ return async () => {
442
+ if (!["darwin", "linux", "win32"].includes(process.platform))
443
+ throw new Error("Unsupported installation platform");
444
+ const env = withNodeRuntimeOnPath(environment);
445
+ if ("npm" in source) {
446
+ const npm = resolveHarnessExecutable({
447
+ id: "npm",
448
+ command: "npm",
449
+ installRoots: {
450
+ posix: [
451
+ "~/.npm-global/bin",
452
+ "~/.local/bin",
453
+ VERSION_MANAGER_ROOTS,
454
+ "/opt/homebrew/bin",
455
+ "/usr/local/bin",
456
+ "/usr/bin"
457
+ ],
458
+ windows: [
459
+ "${APPDATA}/npm",
460
+ VERSION_MANAGER_ROOTS,
461
+ "${ProgramFiles}/nodejs",
462
+ "${LOCALAPPDATA}/Programs/nodejs"
463
+ ]
464
+ }
465
+ }, { environment: env });
466
+ if (!npm)
467
+ throw new Error("Install Node.js and npm first");
468
+ await runInstallationCommand(npm.executable, ["install", "--global", source.npm], {
469
+ ...env,
470
+ ...source.allowScripts ? { npm_config_allow_scripts: source.allowScripts } : {}
471
+ }, 6e5);
472
+ return;
473
+ }
474
+ const windows = process.platform === "win32";
475
+ const url2 = windows ? source.windows : source.posix;
476
+ if (new URL(url2).protocol !== "https:")
477
+ throw new Error("Installer requires HTTPS");
478
+ const script = await fetchInstallationText(url2);
479
+ const directory = await mkdtemp(join(tmpdir(), "codexhost-installer-"));
480
+ try {
481
+ const file2 = join(directory, windows ? "install.ps1" : "install.sh");
482
+ await writeFile(file2, script, { mode: 384 });
483
+ await runInstallationCommand(windows ? "powershell.exe" : source.shell ?? "bash", windows ? ["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-File", file2] : [file2], env, 6e5);
484
+ } finally {
485
+ await rm(directory, { recursive: true, force: true });
486
+ }
487
+ };
488
+ }
489
+
8
490
  // ../../../node_modules/zod/v4/classic/external.js
9
491
  var external_exports = {};
10
492
  __export(external_exports, {
@@ -771,10 +1253,10 @@ function mergeDefs(...defs) {
771
1253
  function cloneDef(schema) {
772
1254
  return mergeDefs(schema._zod.def);
773
1255
  }
774
- function getElementAtPath(obj, path8) {
775
- if (!path8)
1256
+ function getElementAtPath(obj, path9) {
1257
+ if (!path9)
776
1258
  return obj;
777
- return path8.reduce((acc, key) => acc?.[key], obj);
1259
+ return path9.reduce((acc, key) => acc?.[key], obj);
778
1260
  }
779
1261
  function promiseAllObject(promisesObj) {
780
1262
  const keys = Object.keys(promisesObj);
@@ -1183,11 +1665,11 @@ function explicitlyAborted(x, startIndex = 0) {
1183
1665
  }
1184
1666
  return false;
1185
1667
  }
1186
- function prefixIssues(path8, issues) {
1668
+ function prefixIssues(path9, issues) {
1187
1669
  return issues.map((iss) => {
1188
1670
  var _a3;
1189
1671
  (_a3 = iss).path ?? (_a3.path = []);
1190
- iss.path.unshift(path8);
1672
+ iss.path.unshift(path9);
1191
1673
  return iss;
1192
1674
  });
1193
1675
  }
@@ -1334,16 +1816,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
1334
1816
  }
1335
1817
  function formatError(error51, mapper = (issue2) => issue2.message) {
1336
1818
  const fieldErrors = { _errors: [] };
1337
- const processError = (error52, path8 = []) => {
1819
+ const processError = (error52, path9 = []) => {
1338
1820
  for (const issue2 of error52.issues) {
1339
1821
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1340
- issue2.errors.map((issues) => processError({ issues }, [...path8, ...issue2.path]));
1822
+ issue2.errors.map((issues) => processError({ issues }, [...path9, ...issue2.path]));
1341
1823
  } else if (issue2.code === "invalid_key") {
1342
- processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
1824
+ processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
1343
1825
  } else if (issue2.code === "invalid_element") {
1344
- processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
1826
+ processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
1345
1827
  } else {
1346
- const fullpath = [...path8, ...issue2.path];
1828
+ const fullpath = [...path9, ...issue2.path];
1347
1829
  if (fullpath.length === 0) {
1348
1830
  fieldErrors._errors.push(mapper(issue2));
1349
1831
  } else {
@@ -1370,17 +1852,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
1370
1852
  }
1371
1853
  function treeifyError(error51, mapper = (issue2) => issue2.message) {
1372
1854
  const result = { errors: [] };
1373
- const processError = (error52, path8 = []) => {
1855
+ const processError = (error52, path9 = []) => {
1374
1856
  var _a3, _b;
1375
1857
  for (const issue2 of error52.issues) {
1376
1858
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1377
- issue2.errors.map((issues) => processError({ issues }, [...path8, ...issue2.path]));
1859
+ issue2.errors.map((issues) => processError({ issues }, [...path9, ...issue2.path]));
1378
1860
  } else if (issue2.code === "invalid_key") {
1379
- processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
1861
+ processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
1380
1862
  } else if (issue2.code === "invalid_element") {
1381
- processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
1863
+ processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
1382
1864
  } else {
1383
- const fullpath = [...path8, ...issue2.path];
1865
+ const fullpath = [...path9, ...issue2.path];
1384
1866
  if (fullpath.length === 0) {
1385
1867
  result.errors.push(mapper(issue2));
1386
1868
  continue;
@@ -1412,8 +1894,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
1412
1894
  }
1413
1895
  function toDotPath(_path) {
1414
1896
  const segs = [];
1415
- const path8 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1416
- for (const seg of path8) {
1897
+ const path9 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1898
+ for (const seg of path9) {
1417
1899
  if (typeof seg === "number")
1418
1900
  segs.push(`[${seg}]`);
1419
1901
  else if (typeof seg === "symbol")
@@ -14105,13 +14587,13 @@ function resolveRef(ref, ctx) {
14105
14587
  if (!ref.startsWith("#")) {
14106
14588
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
14107
14589
  }
14108
- const path8 = ref.slice(1).split("/").filter(Boolean);
14109
- if (path8.length === 0) {
14590
+ const path9 = ref.slice(1).split("/").filter(Boolean);
14591
+ if (path9.length === 0) {
14110
14592
  return ctx.rootSchema;
14111
14593
  }
14112
14594
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
14113
- if (path8[0] === defsKey) {
14114
- const key = path8[1];
14595
+ if (path9[0] === defsKey) {
14596
+ const key = path9[1];
14115
14597
  if (!key || !ctx.defs[key]) {
14116
14598
  throw new Error(`Reference not found: ${ref}`);
14117
14599
  }
@@ -14574,6 +15056,123 @@ var credentialImportsParamsSchema = external_exports.object({
14574
15056
  request: credentialImportsRequestSchema
14575
15057
  }).strict();
14576
15058
 
15059
+ // ../../shared-contracts/dist/harness-display-settings.js
15060
+ var harnessDisplayEntriesSchema = external_exports.array(external_exports.strictObject({
15061
+ agent: external_exports.string().min(1).max(128),
15062
+ section: external_exports.enum(["main", "more", "auto"])
15063
+ })).max(256).refine((entries) => new Set(entries.map((entry) => entry.agent)).size === entries.length, "Duplicate Harness IDs");
15064
+ var harnessDisplaySettingsSchema = external_exports.strictObject({
15065
+ entries: harnessDisplayEntriesSchema.nullable()
15066
+ });
15067
+ var harnessDisplayGetSchema = external_exports.strictObject({});
15068
+ var harnessDisplaySetSchema = external_exports.strictObject({
15069
+ entries: harnessDisplayEntriesSchema,
15070
+ /** Import legacy Desktop preferences only if no shared settings exist yet. */
15071
+ initializeOnly: external_exports.boolean().optional()
15072
+ });
15073
+
15074
+ // ../../shared-contracts/dist/ids.js
15075
+ var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
15076
+ message: "Identifier must not be empty or whitespace"
15077
+ });
15078
+ var harnessIdSchema = opaqueIdSchema.brand();
15079
+ var hostThreadIdSchema = opaqueIdSchema.brand();
15080
+ var hostTurnIdSchema = opaqueIdSchema.brand();
15081
+ var hostItemIdSchema = opaqueIdSchema.brand();
15082
+ var hostInteractionIdSchema = opaqueIdSchema.brand();
15083
+
15084
+ // ../../shared-contracts/dist/harness-plugins.js
15085
+ var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
15086
+ var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
15087
+ var HARNESS_PLUGIN_LIMIT = 128;
15088
+ var harnessPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u).refine((id) => id !== "codex", "The official Codex identity is reserved").pipe(harnessIdSchema);
15089
+ var relativeResourceSchema = external_exports.string().min(1).max(512).refine((value) => !/[\\\u0000:#?]/u.test(value) && !value.startsWith("/") && !value.split("/").some((part) => part === ".." || part === ""), "Plugin resources must be relative paths inside the plugin");
15090
+ var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
15091
+ var pluginPresentationShape = {
15092
+ id: harnessPluginIdSchema,
15093
+ name: external_exports.string().trim().min(1).max(128),
15094
+ version: external_exports.string().min(1).max(128),
15095
+ /** The factory accepts a persisted local entrypoint through its construction context. */
15096
+ launchCommand: external_exports.literal(true).optional(),
15097
+ links: external_exports.object({
15098
+ documentation: documentationUrlSchema.optional(),
15099
+ installation: documentationUrlSchema.optional()
15100
+ }).strict().optional()
15101
+ };
15102
+ var harnessPluginManifestSchema = external_exports.object({
15103
+ manifestVersion: external_exports.literal(1),
15104
+ ...pluginPresentationShape,
15105
+ adapterApiVersion: external_exports.number().int().positive(),
15106
+ entry: relativeResourceSchema,
15107
+ icon: relativeResourceSchema.optional()
15108
+ }).strict();
15109
+ var harnessPluginIconSchema = external_exports.string().max(Math.ceil(HARNESS_PLUGIN_ICON_MAX_BYTES / 3) * 4 + 64).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u);
15110
+ var harnessPluginDescriptorSchema = external_exports.object({
15111
+ ...pluginPresentationShape,
15112
+ icon: harnessPluginIconSchema.optional()
15113
+ }).strict();
15114
+ var harnessPluginListParamsSchema = external_exports.object({}).strict();
15115
+ var harnessPluginListResultSchema = external_exports.object({
15116
+ plugins: external_exports.array(harnessPluginDescriptorSchema).max(HARNESS_PLUGIN_LIMIT)
15117
+ }).strict();
15118
+ var harnessPluginConfigurationSchema = external_exports.object({
15119
+ version: external_exports.literal(1),
15120
+ enabled: external_exports.array(harnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
15121
+ }).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
15122
+ message: "Enabled plugin IDs must be unique",
15123
+ path: ["enabled"]
15124
+ });
15125
+
15126
+ // ../../shared-contracts/dist/harness-long-context.js
15127
+ var HARNESS_LONG_CONTEXT_GET_METHOD = "codexhost/harness/long-context/get";
15128
+ var HARNESS_LONG_CONTEXT_SET_METHOD = "codexhost/harness/long-context/set";
15129
+ var harnessLongContextGetSchema = external_exports.object({
15130
+ harnessId: harnessPluginIdSchema
15131
+ }).strict();
15132
+ var harnessLongContextSetSchema = harnessLongContextGetSchema.extend({
15133
+ enabled: external_exports.boolean()
15134
+ });
15135
+ var harnessLongContextSchema = external_exports.object({
15136
+ enabled: external_exports.boolean()
15137
+ }).strict();
15138
+
15139
+ // ../../shared-contracts/dist/console.js
15140
+ var consoleAnnouncementSchema = external_exports.strictObject({
15141
+ title: external_exports.string().trim().min(1).max(200),
15142
+ type: external_exports.enum(["info", "warning", "danger"]),
15143
+ body: external_exports.string().trim().min(1).max(16 * 1024)
15144
+ });
15145
+ var consoleOpenParamsSchema = external_exports.strictObject({});
15146
+ var consoleOpenResultSchema = external_exports.strictObject({
15147
+ /** The console address. */
15148
+ url: external_exports.string().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)
15149
+ });
15150
+ var CONSOLE_HOST_METHODS = Object.freeze([
15151
+ "codexhost/harness/plugins/list",
15152
+ "codexhost/harness/display-settings/get",
15153
+ "codexhost/harness/display-settings/set",
15154
+ "codexhost/harness/inspect",
15155
+ "codexhost/harness/installation",
15156
+ "codexhost/harness/launch-settings/get",
15157
+ "codexhost/harness/launch-settings/set",
15158
+ HARNESS_LONG_CONTEXT_GET_METHOD,
15159
+ HARNESS_LONG_CONTEXT_SET_METHOD,
15160
+ "codexhost/harness/web-ui/open",
15161
+ "codexhost/harness/accounts/sources",
15162
+ "codexhost/harness/accounts/list",
15163
+ "codexhost/harness/accounts/inspect",
15164
+ "codexhost/harness/credential-imports",
15165
+ "codexhost/harness/session-import/sources",
15166
+ "codexhost/harness/session-import/list",
15167
+ "codexhost/harness/session-import/import",
15168
+ "codexhost/account/list",
15169
+ "codexhost/account/refresh",
15170
+ "codexhost/account/usage/inspect",
15171
+ "codexhost/update/check",
15172
+ "codexhost/update/start",
15173
+ "codexhost/update/status"
15174
+ ]);
15175
+
14577
15176
  // ../../shared-contracts/dist/version.js
14578
15177
  var WORKSPACE_CONTRACT_VERSION = 1;
14579
15178
 
@@ -14617,15 +15216,11 @@ var loadedSessionsSchema = external_exports.array(external_exports.strictObject(
14617
15216
  inactiveMs: external_exports.number().nonnegative()
14618
15217
  }));
14619
15218
 
14620
- // ../../shared-contracts/dist/ids.js
14621
- var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
14622
- message: "Identifier must not be empty or whitespace"
15219
+ // ../../shared-contracts/dist/manual-compaction.js
15220
+ var threadManualCompactionStartedSchema = external_exports.strictObject({
15221
+ threadId: hostThreadIdSchema,
15222
+ turnId: hostTurnIdSchema
14623
15223
  });
14624
- var harnessIdSchema = opaqueIdSchema.brand();
14625
- var hostThreadIdSchema = opaqueIdSchema.brand();
14626
- var hostTurnIdSchema = opaqueIdSchema.brand();
14627
- var hostItemIdSchema = opaqueIdSchema.brand();
14628
- var hostInteractionIdSchema = opaqueIdSchema.brand();
14629
15224
 
14630
15225
  // ../../shared-contracts/dist/thread-usage.js
14631
15226
  var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
@@ -14687,6 +15282,10 @@ var threadUsageSnapshotSchema = external_exports.object({
14687
15282
  var usagePercentSchema = external_exports.number().finite().min(0).max(100);
14688
15283
  var accountCreditsProductUsageSchema = external_exports.object({
14689
15284
  product: external_exports.string().min(1),
15285
+ used: external_exports.number().finite().nonnegative().optional(),
15286
+ // Zero is a real empty cap, not an absent field.
15287
+ limit: external_exports.number().finite().nonnegative().optional(),
15288
+ unit: external_exports.string().min(1).max(32).optional(),
14690
15289
  usagePercent: usagePercentSchema,
14691
15290
  resetsAt: external_exports.string().min(1).optional()
14692
15291
  }).strict();
@@ -14696,11 +15295,14 @@ var accountResetCreditsSchema = external_exports.object({
14696
15295
  expiresAt: external_exports.array(external_exports.string().min(1)).min(1).max(32).optional()
14697
15296
  }).strict();
14698
15297
  var accountCreditsSnapshotSchema = external_exports.object({
15298
+ used: external_exports.number().finite().nonnegative().optional(),
15299
+ // Zero is a real empty cap, not an absent field.
15300
+ limit: external_exports.number().finite().nonnegative().optional(),
15301
+ unit: external_exports.string().trim().min(1).max(32).optional(),
14699
15302
  /** Native label when the primary limit is scoped to a model or product group. */
14700
15303
  label: external_exports.string().min(1).optional(),
14701
15304
  usedPercent: usagePercentSchema.optional(),
14702
15305
  remaining: external_exports.number().finite().optional(),
14703
- unit: external_exports.string().trim().min(1).max(32).optional(),
14704
15306
  resetsAt: external_exports.string().min(1).optional(),
14705
15307
  periodType: external_exports.enum(["weekly", "monthly", "five_hour", "seven_day", "unknown"]),
14706
15308
  productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
@@ -14731,12 +15333,27 @@ var threadUsageInspectionSchema = external_exports.object({
14731
15333
  }).strict();
14732
15334
 
14733
15335
  // ../../shared-contracts/dist/harness-accounts.js
14734
- var harnessAccountSnapshotSchema = external_exports.object({
15336
+ var accountBalanceSnapshotSchema = external_exports.object({
15337
+ amount: external_exports.number().finite().nonnegative(),
15338
+ /** ISO 4217 code as reported by the Provider, for example `CNY`. */
15339
+ currency: external_exports.string().trim().min(1).max(8),
15340
+ /** Native label when the Harness exposes several Billing Sources. */
15341
+ label: external_exports.string().trim().min(1).max(128).optional()
15342
+ }).strict();
15343
+ var harnessAccountSnapshotObject = external_exports.object({
14735
15344
  email: external_exports.string().trim().min(1).max(320).optional(),
14736
15345
  label: external_exports.string().trim().min(1).max(256).optional(),
14737
15346
  plan: external_exports.string().trim().min(1).max(128).optional(),
14738
- credits: accountCreditsSnapshotSchema
15347
+ credits: accountCreditsSnapshotSchema.optional(),
15348
+ balance: accountBalanceSnapshotSchema.optional()
14739
15349
  }).strict();
15350
+ function requireReportedQuota(schema) {
15351
+ return schema.refine((value) => {
15352
+ const reported = value;
15353
+ return reported.credits !== void 0 || reported.balance !== void 0;
15354
+ }, { message: "Account must report either credits or a balance" });
15355
+ }
15356
+ var harnessAccountSnapshotSchema = requireReportedQuota(harnessAccountSnapshotObject);
14740
15357
  var harnessAccountIdentityShape = {
14741
15358
  harnessId: harnessIdSchema,
14742
15359
  harnessName: external_exports.string().trim().min(1).max(128)
@@ -14747,11 +15364,13 @@ var harnessAccountSourceListResultSchema = external_exports.object({ sources: ex
14747
15364
  var harnessAccountInspectParamsSchema = external_exports.object({ harnessId: harnessIdSchema, refresh: external_exports.boolean().optional() }).strict();
14748
15365
  var harnessAccountInspectResultSchema = external_exports.object({
14749
15366
  ...harnessAccountIdentityShape,
14750
- account: harnessAccountSnapshotSchema.nullable()
15367
+ account: harnessAccountSnapshotSchema.nullable(),
15368
+ /** Every Billing Source from one Harness; `account` remains the first for older clients. */
15369
+ accounts: external_exports.array(harnessAccountSnapshotSchema).max(8).optional()
14751
15370
  }).strict();
14752
15371
  var harnessAccountListParamsSchema = external_exports.object({ refresh: external_exports.boolean().optional() }).strict();
14753
15372
  var harnessAccountListResultSchema = external_exports.object({
14754
- accounts: external_exports.array(harnessAccountSnapshotSchema.extend(harnessAccountIdentityShape)).max(128)
15373
+ accounts: external_exports.array(requireReportedQuota(harnessAccountSnapshotObject.extend(harnessAccountIdentityShape))).max(128)
14755
15374
  }).strict();
14756
15375
 
14757
15376
  // ../../shared-contracts/dist/json-value.js
@@ -14889,6 +15508,8 @@ var harnessModelSchema = external_exports.object({
14889
15508
  ref: harnessModelRefSchema,
14890
15509
  label: nonBlankTextSchema2.max(HARNESS_MODEL_LABEL_MAX_LENGTH),
14891
15510
  resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
15511
+ /** Optional opaque selection for this same Model with priority processing enabled. */
15512
+ fastModel: harnessModelRefSchema.optional(),
14892
15513
  supportedThinkingOptionIds: external_exports.array(harnessThinkingOptionIdSchema).optional()
14893
15514
  }).strict();
14894
15515
  var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context) => {
@@ -14921,6 +15542,16 @@ var harnessModelCatalogSchema = external_exports.object({
14921
15542
  });
14922
15543
  }
14923
15544
  refs.add(model.ref.id);
15545
+ if (model.fastModel) {
15546
+ if (refs.has(model.fastModel.id) || catalog.models.some((entry) => entry.ref.id === model.fastModel?.id)) {
15547
+ context.addIssue({
15548
+ code: "custom",
15549
+ message: "Fast Model refs must be distinct and unique",
15550
+ path: ["models", index, "fastModel"]
15551
+ });
15552
+ }
15553
+ refs.add(model.fastModel.id);
15554
+ }
14924
15555
  const supportedThinkingIds = /* @__PURE__ */ new Set();
14925
15556
  for (const [optionIndex, optionId] of (model.supportedThinkingOptionIds ?? []).entries()) {
14926
15557
  if (supportedThinkingIds.has(optionId)) {
@@ -15043,11 +15674,13 @@ var threadThinkingSelectParamsSchema = external_exports.object({
15043
15674
  thinkingOptionId: harnessThinkingOptionIdSchema
15044
15675
  }).strict();
15045
15676
  var threadInspectionParamsSchema = external_exports.object({
15046
- threadId: hostThreadIdSchema
15677
+ threadId: hostThreadIdSchema,
15678
+ includeReferenceCapability: external_exports.boolean().optional()
15047
15679
  }).strict();
15048
15680
  var codexThreadInspectionSchema = external_exports.object({
15049
15681
  owner: external_exports.literal("codex"),
15050
- locked: external_exports.literal(true)
15682
+ locked: external_exports.literal(true),
15683
+ supportsThreadReferences: external_exports.literal(true).optional()
15051
15684
  }).strict();
15052
15685
  var externalThreadInspectionSchema = external_exports.object({
15053
15686
  owner: external_exports.literal("external"),
@@ -15112,48 +15745,6 @@ var threadOwnershipListResultSchema = external_exports.object({
15112
15745
  }
15113
15746
  });
15114
15747
 
15115
- // ../../shared-contracts/dist/harness-plugins.js
15116
- var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
15117
- var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
15118
- var HARNESS_PLUGIN_LIMIT = 128;
15119
- var harnessPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u).refine((id) => id !== "codex", "The official Codex identity is reserved").pipe(harnessIdSchema);
15120
- var relativeResourceSchema = external_exports.string().min(1).max(512).refine((value) => !/[\\\u0000:#?]/u.test(value) && !value.startsWith("/") && !value.split("/").some((part) => part === ".." || part === ""), "Plugin resources must be relative paths inside the plugin");
15121
- var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
15122
- var pluginPresentationShape = {
15123
- id: harnessPluginIdSchema,
15124
- name: external_exports.string().trim().min(1).max(128),
15125
- version: external_exports.string().min(1).max(128),
15126
- /** The factory accepts a persisted local entrypoint through its construction context. */
15127
- launchCommand: external_exports.literal(true).optional(),
15128
- links: external_exports.object({
15129
- documentation: documentationUrlSchema.optional(),
15130
- installation: documentationUrlSchema.optional()
15131
- }).strict().optional()
15132
- };
15133
- var harnessPluginManifestSchema = external_exports.object({
15134
- manifestVersion: external_exports.literal(1),
15135
- ...pluginPresentationShape,
15136
- adapterApiVersion: external_exports.number().int().positive(),
15137
- entry: relativeResourceSchema,
15138
- icon: relativeResourceSchema.optional()
15139
- }).strict();
15140
- var harnessPluginIconSchema = external_exports.string().max(Math.ceil(HARNESS_PLUGIN_ICON_MAX_BYTES / 3) * 4 + 64).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u);
15141
- var harnessPluginDescriptorSchema = external_exports.object({
15142
- ...pluginPresentationShape,
15143
- icon: harnessPluginIconSchema.optional()
15144
- }).strict();
15145
- var harnessPluginListParamsSchema = external_exports.object({}).strict();
15146
- var harnessPluginListResultSchema = external_exports.object({
15147
- plugins: external_exports.array(harnessPluginDescriptorSchema).max(HARNESS_PLUGIN_LIMIT)
15148
- }).strict();
15149
- var harnessPluginConfigurationSchema = external_exports.object({
15150
- version: external_exports.literal(1),
15151
- enabled: external_exports.array(harnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
15152
- }).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
15153
- message: "Enabled plugin IDs must be unique",
15154
- path: ["enabled"]
15155
- });
15156
-
15157
15748
  // ../../shared-contracts/dist/harness-route.js
15158
15749
  var harnessPluginRouteSchema = external_exports.object({
15159
15750
  harnessId: harnessPluginIdSchema,
@@ -15175,10 +15766,31 @@ var harnessLaunchSettingsSchema = external_exports.object({
15175
15766
  restartRequired: external_exports.boolean()
15176
15767
  }).strict();
15177
15768
 
15769
+ // ../../shared-contracts/dist/harness-installation.js
15770
+ var harnessInstallationParamsSchema = external_exports.object({
15771
+ harnessId: harnessIdSchema,
15772
+ action: external_exports.enum(["check", "update", "install"])
15773
+ }).strict();
15774
+ var harnessInstallationStateSchema = external_exports.object({
15775
+ currentVersion: external_exports.string().min(1).max(128),
15776
+ latestVersion: external_exports.string().min(1).max(128),
15777
+ updateAvailable: external_exports.boolean(),
15778
+ canUpdate: external_exports.boolean(),
15779
+ message: external_exports.string().max(2048).optional()
15780
+ }).strict();
15781
+
15178
15782
  // ../../shared-contracts/dist/codex-accounts.js
15179
15783
  var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
15180
15784
  var nonBlankTextSchema3 = external_exports.string().trim().min(1);
15181
15785
  var codexAccountAuthKindSchema = external_exports.enum(["api", "chatgpt"]);
15786
+ var codexAccountSiteUrlPattern = /^https?:\/\/(?:\[[0-9a-fA-F:]+\]|[^/\s:@?#]+)(?::\d{1,5})?(?:[/?#][^\s]*)?$/u;
15787
+ function isCodexAccountSiteUrl(value) {
15788
+ return value.length > 0 && value.length <= 2048 && codexAccountSiteUrlPattern.test(value);
15789
+ }
15790
+ var externalUrlOpenParamsSchema = external_exports.object({
15791
+ url: external_exports.string().max(2048).refine(isCodexAccountSiteUrl, "External URL must be http(s)")
15792
+ }).strict();
15793
+ var externalUrlOpenResultSchema = external_exports.object({}).strict();
15182
15794
  var codexAccountPlanTypeSchema = external_exports.enum([
15183
15795
  "free",
15184
15796
  "go",
@@ -15204,7 +15816,8 @@ var codexAccountSchema = external_exports.object({
15204
15816
  email: external_exports.string().email().max(320).optional(),
15205
15817
  planType: codexAccountPlanTypeSchema.optional(),
15206
15818
  authKind: codexAccountAuthKindSchema.optional(),
15207
- authIdentity: nonBlankTextSchema3.max(256).optional()
15819
+ authIdentity: nonBlankTextSchema3.max(256).optional(),
15820
+ siteUrl: external_exports.string().refine(isCodexAccountSiteUrl, "Account site URL must be http(s)").optional()
15208
15821
  }).strict();
15209
15822
  var codexAccountPhaseSchema = external_exports.enum(["ready", "unavailable"]);
15210
15823
  var codexAccountListResultSchema = external_exports.object({
@@ -15906,7 +16519,7 @@ function commandPrompt(command, catalog, profile = CODEBUDDY_RUNTIME_PROFILE) {
15906
16519
  import { stat as stat2 } from "node:fs/promises";
15907
16520
 
15908
16521
  // dist/acp-client.js
15909
- import { execFile, spawn } from "node:child_process";
16522
+ import { execFile as execFile2, spawn } from "node:child_process";
15910
16523
  import { Readable as Readable2, Writable } from "node:stream";
15911
16524
 
15912
16525
  // ../../../node_modules/@agentclientprotocol/sdk/dist/schema/index.js
@@ -20132,245 +20745,6 @@ var CodeBuddyCopyCleanup = class {
20132
20745
  }
20133
20746
  };
20134
20747
 
20135
- // ../../harness-discovery/dist/environment.js
20136
- import fs from "node:fs";
20137
- import path from "node:path";
20138
- function targetPath(platform) {
20139
- return platform === "win32" ? path.win32 : path.posix;
20140
- }
20141
- function environmentValue(environment, name) {
20142
- const lowered = name.toLowerCase();
20143
- for (const [key, value] of Object.entries(environment)) {
20144
- if (key.toLowerCase() === lowered)
20145
- return value;
20146
- }
20147
- return void 0;
20148
- }
20149
- function pathDelimiter(platform) {
20150
- return platform === "win32" ? ";" : ":";
20151
- }
20152
- function pathDirectories(environment, platform) {
20153
- return (environmentValue(environment, "PATH") ?? "").split(pathDelimiter(platform)).map((directory) => directory.trim().replace(/^"|"$/gu, "")).filter(Boolean);
20154
- }
20155
- function executableExtensions(command, platform, environment) {
20156
- if (platform !== "win32")
20157
- return [""];
20158
- if (targetPath(platform).extname(command) !== "")
20159
- return [""];
20160
- return (environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").map((extension) => extension.trim()).filter(Boolean);
20161
- }
20162
- function isExecutableFile(filePath, platform) {
20163
- try {
20164
- fs.accessSync(filePath, platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK);
20165
- return fs.statSync(filePath).isFile();
20166
- } catch {
20167
- return false;
20168
- }
20169
- }
20170
- function subdirectoryNames(directory) {
20171
- try {
20172
- return fs.readdirSync(directory, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
20173
- } catch {
20174
- return [];
20175
- }
20176
- }
20177
- function newestFirst(names) {
20178
- return [...names].sort((left, right) => right.localeCompare(left, void 0, { numeric: true }));
20179
- }
20180
-
20181
- // ../../harness-discovery/dist/invocation.js
20182
- import path2 from "node:path";
20183
- function commandInvocation(command, arguments_, environment, platform = process.platform) {
20184
- const extension = path2.win32.extname(command).toLowerCase();
20185
- if (platform !== "win32" || ![".cmd", ".bat"].includes(extension)) {
20186
- return { command, arguments: [...arguments_], windowsVerbatimArguments: false };
20187
- }
20188
- const quote = (value) => `"${value.replaceAll("%", "%%").replaceAll('"', '""')}"`;
20189
- const commandLine = [command, ...arguments_].map(quote).join(" ");
20190
- return {
20191
- command: environmentValue(environment, "ComSpec") ?? "cmd.exe",
20192
- arguments: ["/d", "/v:off", "/s", "/c", `"${commandLine}"`],
20193
- windowsVerbatimArguments: true
20194
- };
20195
- }
20196
-
20197
- // ../../harness-discovery/dist/node-runtime.js
20198
- import path3 from "node:path";
20199
- function withNodeRuntimeOnPath(environment, runtimeExecutable = process.execPath, platform = process.platform) {
20200
- const pathKey = Object.keys(environment).find((name) => name.toLowerCase() === "path") ?? "PATH";
20201
- const delimiter = platform === "win32" ? ";" : ":";
20202
- const runtimeDirectory = path3.dirname(runtimeExecutable);
20203
- const directories = (environment[pathKey] ?? "").split(delimiter).filter(Boolean);
20204
- const equal = platform === "win32" ? (value) => value.toLowerCase() : (value) => value;
20205
- if (!directories.some((directory) => equal(directory) === equal(runtimeDirectory))) {
20206
- directories.push(runtimeDirectory);
20207
- }
20208
- return { ...environment, [pathKey]: directories.join(delimiter) };
20209
- }
20210
-
20211
- // ../../harness-discovery/dist/resolve.js
20212
- import os from "node:os";
20213
-
20214
- // ../../harness-discovery/dist/version-managers.js
20215
- function versionManagerBinaryDirectories(context) {
20216
- const { platform, environment, home } = context;
20217
- const list = context.subdirectories ?? subdirectoryNames;
20218
- const pathFlavor = targetPath(platform);
20219
- const value = (name) => environmentValue(environment, name);
20220
- const directories = [];
20221
- const versioned = (root, ...tail) => {
20222
- for (const version2 of newestFirst(list(root))) {
20223
- directories.push(pathFlavor.join(root, version2, ...tail));
20224
- }
20225
- };
20226
- if (platform === "win32") {
20227
- const appData = value("APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming");
20228
- const localAppData = value("LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local");
20229
- versioned(pathFlavor.join(appData, "nvm"));
20230
- versioned(value("FNM_DIR") ?? pathFlavor.join(appData, "fnm", "node-versions"), "installation");
20231
- directories.push(pathFlavor.join(localAppData, "Volta", "bin"));
20232
- directories.push(pathFlavor.join(home, ".bun", "bin"));
20233
- const pnpmHome2 = value("PNPM_HOME");
20234
- if (pnpmHome2)
20235
- directories.push(pnpmHome2);
20236
- directories.push(pathFlavor.join(localAppData, "pnpm"));
20237
- return directories;
20238
- }
20239
- versioned(pathFlavor.join(value("NVM_DIR") ?? pathFlavor.join(home, ".nvm"), "versions", "node"), "bin");
20240
- const fnmRoots = [
20241
- value("FNM_DIR"),
20242
- pathFlavor.join(home, ".local", "share", "fnm"),
20243
- pathFlavor.join(home, "Library", "Application Support", "fnm")
20244
- ].filter((root) => root !== void 0);
20245
- for (const root of fnmRoots) {
20246
- versioned(pathFlavor.join(root, "node-versions"), "installation", "bin");
20247
- }
20248
- const voltaHome = value("VOLTA_HOME") ?? pathFlavor.join(home, ".volta");
20249
- versioned(pathFlavor.join(voltaHome, "tools", "image", "node"), "bin");
20250
- directories.push(pathFlavor.join(voltaHome, "bin"));
20251
- const asdfHome = value("ASDF_DATA_DIR") ?? pathFlavor.join(home, ".asdf");
20252
- versioned(pathFlavor.join(asdfHome, "installs", "nodejs"), "bin");
20253
- directories.push(pathFlavor.join(asdfHome, "shims"));
20254
- const nodenvHome = value("NODENV_ROOT") ?? pathFlavor.join(home, ".nodenv");
20255
- versioned(pathFlavor.join(nodenvHome, "versions"), "bin");
20256
- directories.push(pathFlavor.join(nodenvHome, "shims"));
20257
- versioned(pathFlavor.join(value("N_PREFIX") ?? "/usr/local", "n", "versions", "node"), "bin");
20258
- directories.push(pathFlavor.join(home, ".bun", "bin"));
20259
- const pnpmHome = value("PNPM_HOME");
20260
- if (pnpmHome)
20261
- directories.push(pnpmHome);
20262
- directories.push(pathFlavor.join(home, "Library", "pnpm"));
20263
- directories.push(pathFlavor.join(home, ".local", "share", "pnpm"));
20264
- for (const prefix of ["/opt/homebrew/opt", "/usr/local/opt"]) {
20265
- for (const formula of newestFirst(list(prefix).filter((name) => name.startsWith("node@")))) {
20266
- directories.push(pathFlavor.join(prefix, formula, "bin"));
20267
- }
20268
- }
20269
- return directories;
20270
- }
20271
-
20272
- // ../../harness-discovery/dist/resolve.js
20273
- var VERSION_MANAGER_ROOTS = "<version-managers>";
20274
- function installRootExtensions(platform) {
20275
- return platform === "win32" ? [".exe", ".cmd"] : [""];
20276
- }
20277
- function resolveHomeDirectory(input) {
20278
- return input.homeDirectory ?? environmentValue(input.environment, "HOME") ?? environmentValue(input.environment, "USERPROFILE") ?? os.homedir();
20279
- }
20280
- function templateVariables(environment, platform, home) {
20281
- const pathFlavor = targetPath(platform);
20282
- return {
20283
- HOME: home,
20284
- USERPROFILE: home,
20285
- APPDATA: environmentValue(environment, "APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming"),
20286
- LOCALAPPDATA: environmentValue(environment, "LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local")
20287
- };
20288
- }
20289
- function joinTemplate(platform, value) {
20290
- const pathFlavor = targetPath(platform);
20291
- const segments = value.split("/");
20292
- const head = segments[0] ?? "";
20293
- const tail = segments.slice(1);
20294
- if (head === "")
20295
- return pathFlavor.join(pathFlavor.sep, ...tail);
20296
- return tail.length === 0 ? head : pathFlavor.join(head, ...tail);
20297
- }
20298
- function expandInstallRoot(template, environment, platform, home) {
20299
- const variables = templateVariables(environment, platform, home);
20300
- let unresolved = false;
20301
- const substituted = template.replace(/^~(?=\/|$)/u, home).replace(/\$\{(\w+)\}/gu, (_match, name) => {
20302
- const value = variables[name] ?? environmentValue(environment, name);
20303
- if (value === void 0 || value === "") {
20304
- unresolved = true;
20305
- return "";
20306
- }
20307
- return value;
20308
- });
20309
- return unresolved ? void 0 : joinTemplate(platform, substituted);
20310
- }
20311
- function installRootDirectories(spec, input, dependencies, platform, home) {
20312
- const templates = (platform === "win32" ? spec.installRoots?.windows : spec.installRoots?.posix) ?? [];
20313
- const directories = [];
20314
- for (const template of templates) {
20315
- if (template === VERSION_MANAGER_ROOTS) {
20316
- directories.push(...versionManagerBinaryDirectories({
20317
- platform,
20318
- environment: input.environment,
20319
- home,
20320
- ...dependencies.subdirectories ? { subdirectories: dependencies.subdirectories } : {}
20321
- }));
20322
- continue;
20323
- }
20324
- const directory = expandInstallRoot(template, input.environment, platform, home);
20325
- if (directory !== void 0)
20326
- directories.push(directory);
20327
- }
20328
- return directories;
20329
- }
20330
- function harnessCandidates(spec, input, dependencies = {}) {
20331
- const platform = input.platform ?? process.platform;
20332
- const pathFlavor = targetPath(platform);
20333
- const configured = input.command ?? (spec.commandEnvironmentVariable ? environmentValue(input.environment, spec.commandEnvironmentVariable) : void 0);
20334
- const command = configured ?? spec.command;
20335
- if (pathFlavor.isAbsolute(command) || command.includes("/") || command.includes("\\")) {
20336
- return [{ candidate: command, source: "configured" }];
20337
- }
20338
- const candidates = [];
20339
- const extensions = executableExtensions(command, platform, input.environment);
20340
- for (const directory of pathDirectories(input.environment, platform)) {
20341
- for (const extension of extensions) {
20342
- candidates.push({
20343
- candidate: pathFlavor.join(directory, command + extension),
20344
- source: "path"
20345
- });
20346
- }
20347
- }
20348
- if (configured !== void 0)
20349
- return candidates;
20350
- const home = resolveHomeDirectory(input);
20351
- for (const directory of installRootDirectories(spec, input, dependencies, platform, home)) {
20352
- for (const extension of installRootExtensions(platform)) {
20353
- candidates.push({
20354
- candidate: pathFlavor.join(directory, spec.command + extension),
20355
- source: "install-root"
20356
- });
20357
- }
20358
- }
20359
- return candidates;
20360
- }
20361
- function resolveHarnessExecutable(spec, input, dependencies = {}) {
20362
- const platform = input.platform ?? process.platform;
20363
- const isExecutable = dependencies.isExecutable ?? ((candidate) => isExecutableFile(candidate, platform));
20364
- const runnable = spec.runnableCandidate ?? ((candidate) => candidate);
20365
- const context = { platform, isExecutable };
20366
- for (const { candidate, source } of harnessCandidates(spec, input, dependencies)) {
20367
- const executable = runnable(candidate, context);
20368
- if (executable !== void 0 && isExecutable(executable))
20369
- return { executable, source };
20370
- }
20371
- return void 0;
20372
- }
20373
-
20374
20748
  // dist/command.js
20375
20749
  var codeBuddyDiscoverySpec = {
20376
20750
  id: "codebuddy",
@@ -20563,7 +20937,7 @@ var CodeBuddyAcpClient = class {
20563
20937
  }
20564
20938
  const pid = this.#child.pid;
20565
20939
  if (pid && process.platform === "win32") {
20566
- await new Promise((resolve) => execFile("taskkill", ["/PID", String(pid), "/T", "/F"], { windowsHide: true, timeout: 3e3 }, () => resolve()));
20940
+ await new Promise((resolve) => execFile2("taskkill", ["/PID", String(pid), "/T", "/F"], { windowsHide: true, timeout: 3e3 }, () => resolve()));
20567
20941
  } else if (pid) {
20568
20942
  try {
20569
20943
  process.kill(-pid, "SIGKILL");
@@ -20655,17 +21029,17 @@ function confirmedConfiguration(response, id, value, profile = CODEBUDDY_RUNTIME
20655
21029
 
20656
21030
  // dist/derivation.js
20657
21031
  import { randomUUID } from "node:crypto";
20658
- import { execFile as execFile2, spawn as spawn2 } from "node:child_process";
20659
- import { lstat, mkdir, readFile as readFile2, realpath as realpath4, unlink, writeFile } from "node:fs/promises";
20660
- import path5 from "node:path";
21032
+ import { execFile as execFile3, spawn as spawn2 } from "node:child_process";
21033
+ import { lstat, mkdir, readFile as readFile3, realpath as realpath5, unlink, writeFile as writeFile2 } from "node:fs/promises";
21034
+ import path6 from "node:path";
20661
21035
  import { isDeepStrictEqual as isDeepStrictEqual3 } from "node:util";
20662
21036
 
20663
21037
  // dist/history.js
20664
21038
  import { createHash } from "node:crypto";
20665
21039
  import { realpathSync } from "node:fs";
20666
- import { access, readdir, realpath as realpath2 } from "node:fs/promises";
20667
- import { homedir } from "node:os";
20668
- import path4 from "node:path";
21040
+ import { access, readdir, realpath as realpath3 } from "node:fs/promises";
21041
+ import { homedir as homedir2 } from "node:os";
21042
+ import path5 from "node:path";
20669
21043
  import { isDeepStrictEqual } from "node:util";
20670
21044
 
20671
21045
  // ../../../node_modules/diff/libesm/diff/base.js
@@ -20768,16 +21142,16 @@ var Diff = class {
20768
21142
  }
20769
21143
  }
20770
21144
  }
20771
- addToPath(path8, added, removed, oldPosInc, options) {
20772
- const last = path8.lastComponent;
21145
+ addToPath(path9, added, removed, oldPosInc, options) {
21146
+ const last = path9.lastComponent;
20773
21147
  if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
20774
21148
  return {
20775
- oldPos: path8.oldPos + oldPosInc,
21149
+ oldPos: path9.oldPos + oldPosInc,
20776
21150
  lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
20777
21151
  };
20778
21152
  } else {
20779
21153
  return {
20780
- oldPos: path8.oldPos + oldPosInc,
21154
+ oldPos: path9.oldPos + oldPosInc,
20781
21155
  lastComponent: { count: 1, added, removed, previousComponent: last }
20782
21156
  };
20783
21157
  }
@@ -21329,9 +21703,9 @@ function codeBuddyDelegation(callId, input, status, childId, displayName = "Code
21329
21703
  }
21330
21704
 
21331
21705
  // dist/file-observation.js
21332
- import { readFile, realpath, stat } from "node:fs/promises";
21706
+ import { readFile as readFile2, realpath as realpath2, stat } from "node:fs/promises";
21333
21707
  async function codeBuddyFileVersion(file2) {
21334
- const [realFile, value] = await Promise.all([realpath(file2), stat(file2, { bigint: true })]);
21708
+ const [realFile, value] = await Promise.all([realpath2(file2), stat(file2, { bigint: true })]);
21335
21709
  return {
21336
21710
  realFile,
21337
21711
  fingerprint: `${value.dev}:${value.ino}:${value.size}:${value.mtimeNs}:${value.ctimeNs}`,
@@ -21345,7 +21719,7 @@ async function readCodeBuddyVersionedText(file2, maximumBytes, tooLargeMessage,
21345
21719
  const observedBefore = before ?? await codeBuddyFileVersion(file2);
21346
21720
  if (observedBefore.size > maximumBytes)
21347
21721
  throw new CodeBuddyError("unsupported", tooLargeMessage);
21348
- const contents = await readFile(file2, "utf8"), after = await codeBuddyFileVersion(file2), bytesRead = Buffer.byteLength(contents), reusableVersion = sameCodeBuddyFileVersion(observedBefore, after) && bytesRead === after.size ? after : void 0;
21722
+ const contents = await readFile2(file2, "utf8"), after = await codeBuddyFileVersion(file2), bytesRead = Buffer.byteLength(contents), reusableVersion = sameCodeBuddyFileVersion(observedBefore, after) && bytesRead === after.size ? after : void 0;
21349
21723
  if (bytesRead > maximumBytes || after.size > maximumBytes)
21350
21724
  throw new CodeBuddyError("unsupported", tooLargeMessage);
21351
21725
  return { contents, reusableVersion };
@@ -21362,15 +21736,15 @@ function codeBuddyCanonicalCwd(cwd) {
21362
21736
  try {
21363
21737
  return realpathSync.native(cwd);
21364
21738
  } catch {
21365
- return path4.resolve(cwd);
21739
+ return path5.resolve(cwd);
21366
21740
  }
21367
21741
  }
21368
21742
  function codeBuddyConfigRoot(environment, profile) {
21369
21743
  const configuredRoot = profile.configDirectoryEnvironmentVariables.map((name) => environment[name]).find((value) => typeof value === "string" && value.trim().length > 0);
21370
- return configuredRoot || path4.join(environment.HOME || environment.USERPROFILE || homedir(), profile.defaultConfigDirectoryName);
21744
+ return configuredRoot || path5.join(environment.HOME || environment.USERPROFILE || homedir2(), profile.defaultConfigDirectoryName);
21371
21745
  }
21372
21746
  function codeBuddyPrimaryHistoryPath(cwd, ref, environment, profile = CODEBUDDY_RUNTIME_PROFILE) {
21373
- return path4.join(codeBuddyConfigRoot(environment, profile), "projects", codeBuddyProjectSlug(cwd, profile), `${ref.nativeSessionId}.jsonl`);
21747
+ return path5.join(codeBuddyConfigRoot(environment, profile), "projects", codeBuddyProjectSlug(cwd, profile), `${ref.nativeSessionId}.jsonl`);
21374
21748
  }
21375
21749
  function derivedLocator(ref) {
21376
21750
  const locator = record2(ref.locator);
@@ -21404,8 +21778,8 @@ function validateNativeRef(ref, profile = CODEBUDDY_RUNTIME_PROFILE) {
21404
21778
  }
21405
21779
  }
21406
21780
  async function sameCwd(left, right) {
21407
- const b = await realpath2(right);
21408
- const a = await realpath2(left).catch((error51) => {
21781
+ const b = await realpath3(right);
21782
+ const a = await realpath3(left).catch((error51) => {
21409
21783
  if (["ENOENT", "ENOTDIR"].includes(String(record2(error51).code)))
21410
21784
  throw new CodeBuddyError("invalidRequest", "Native Session historical working directory is unavailable; ownership cannot be verified");
21411
21785
  throw error51;
@@ -21413,9 +21787,9 @@ async function sameCwd(left, right) {
21413
21787
  return process.platform === "win32" ? a.toLowerCase() === b.toLowerCase() : a === b;
21414
21788
  }
21415
21789
  async function matchesAnyHistoricalCwd(value, candidates) {
21416
- const resolved = path4.resolve(value);
21790
+ const resolved = path5.resolve(value);
21417
21791
  for (const candidate of candidates) {
21418
- const other = path4.resolve(candidate);
21792
+ const other = path5.resolve(candidate);
21419
21793
  if (process.platform === "win32" ? resolved.toLowerCase() === other.toLowerCase() : resolved === other)
21420
21794
  return true;
21421
21795
  try {
@@ -21439,9 +21813,9 @@ async function codeBuddyLiveNativeHistory(cwd, ref, environment, profile = CODEB
21439
21813
  async function codeBuddyHistory(cwd, ref, environment, tolerateIncompleteTail, profile, transaction) {
21440
21814
  validateNativeRef(ref, profile);
21441
21815
  const configRoot = codeBuddyConfigRoot(environment, profile);
21442
- const root = path4.join(configRoot, "projects");
21816
+ const root = path5.join(configRoot, "projects");
21443
21817
  const slug = codeBuddyProjectSlug(cwd, profile);
21444
- const primary = path4.join(root, slug, `${ref.nativeSessionId}.jsonl`);
21818
+ const primary = path5.join(root, slug, `${ref.nativeSessionId}.jsonl`);
21445
21819
  const provenance = derivedLocator(ref);
21446
21820
  let candidates = [];
21447
21821
  try {
@@ -21460,7 +21834,7 @@ async function codeBuddyHistory(cwd, ref, environment, tolerateIncompleteTail, p
21460
21834
  for (const directory of directories) {
21461
21835
  if (!directory.isDirectory())
21462
21836
  continue;
21463
- const file3 = path4.join(root, directory.name, `${ref.nativeSessionId}.jsonl`);
21837
+ const file3 = path5.join(root, directory.name, `${ref.nativeSessionId}.jsonl`);
21464
21838
  try {
21465
21839
  await access(file3);
21466
21840
  candidates.push(file3);
@@ -21475,7 +21849,7 @@ async function codeBuddyHistory(cwd, ref, environment, tolerateIncompleteTail, p
21475
21849
  const file2 = candidates[0];
21476
21850
  if (!file2)
21477
21851
  throw new CodeBuddyError("sessionNotFound", "Native Session history was not found");
21478
- if (profile.historyCapabilities?.fork && !transaction && path4.resolve(file2) !== path4.resolve(primary))
21852
+ if (profile.historyCapabilities?.fork && !transaction && path5.resolve(file2) !== path5.resolve(primary))
21479
21853
  throw new CodeBuddyError("invalidRequest", "Native Session is not stored in the requested working directory");
21480
21854
  const source = await readCodeBuddyVersionedText(file2, 64e6, "Native history exceeds the supported 64 MB snapshot size"), parsed = parseJsonl(source.contents, tolerateIncompleteTail);
21481
21855
  const checkedDirectories = /* @__PURE__ */ new Set();
@@ -21504,7 +21878,7 @@ async function codeBuddyHistory(cwd, ref, environment, tolerateIncompleteTail, p
21504
21878
  }
21505
21879
  }
21506
21880
  } else if (provenance) {
21507
- if (!await sameCwd(provenance.boundCwd, cwd) || provenance.targetProjectSlug !== slug || path4.resolve(file2) !== path4.resolve(primary))
21881
+ if (!await sameCwd(provenance.boundCwd, cwd) || provenance.targetProjectSlug !== slug || path5.resolve(file2) !== path5.resolve(primary))
21508
21882
  throw new CodeBuddyError("invalidRequest", "Derived Native Session target binding changed");
21509
21883
  const active = nativeHistoryRows(parsed.contents);
21510
21884
  if (provenance.inheritedPrefixRows > active.length || nativeRowsDigest(active.slice(0, provenance.inheritedPrefixRows)) !== provenance.inheritedPrefixSha256)
@@ -21798,7 +22172,7 @@ function historyUsage(contents) {
21798
22172
 
21799
22173
  // dist/child-provenance.js
21800
22174
  import { createHash as createHash2 } from "node:crypto";
21801
- import { realpath as realpath3 } from "node:fs/promises";
22175
+ import { realpath as realpath4 } from "node:fs/promises";
21802
22176
  import { isDeepStrictEqual as isDeepStrictEqual2 } from "node:util";
21803
22177
  var CODEBUDDY_CHILD_MAX_BYTES = 8e6;
21804
22178
  var equalPath = (left, right) => process.platform === "win32" ? left.toLowerCase() === right.toLowerCase() : left === right;
@@ -21866,7 +22240,7 @@ function codeBuddyInheritedChild(parent, childId) {
21866
22240
  async function canonicalCwds(cwds) {
21867
22241
  const result = /* @__PURE__ */ new Map();
21868
22242
  for (const cwd of new Set(cwds)) {
21869
- const canonical = await realpath3(cwd).catch((error51) => {
22243
+ const canonical = await realpath4(cwd).catch((error51) => {
21870
22244
  if (["ENOENT", "ENOTDIR"].includes(String(record2(error51).code)))
21871
22245
  throw new CodeBuddyError("invalidRequest", "Subagent historical working directory is unavailable; ownership cannot be verified");
21872
22246
  throw error51;
@@ -21905,7 +22279,7 @@ async function validateCodeBuddyChildContents(contents, parent, childId, cwd, to
21905
22279
  throw new CodeBuddyError("protocolError", "Inherited Subagent identity changed");
21906
22280
  inheritedEntries = prefixParsed.entries;
21907
22281
  }
21908
- const target = await realpath3(cwd);
22282
+ const target = await realpath4(cwd);
21909
22283
  const inheritedCwds = inheritedEntries.flatMap((row) => typeof row.cwd === "string" ? [row.cwd] : []);
21910
22284
  const suffixCwds = parsed.entries.slice(inheritedEntries.length).flatMap((row) => typeof row.cwd === "string" ? [row.cwd] : []);
21911
22285
  const canonical = await canonicalCwds(suffixCwds);
@@ -22041,7 +22415,7 @@ async function copyCodeBuddySession(cwd, sourceId, targetId, environment, signal
22041
22415
  child.stderr.destroy();
22042
22416
  } else if (process.platform === "win32" && child.pid) {
22043
22417
  termination = new Promise((done) => {
22044
- execFile2("taskkill", ["/PID", String(child.pid), "/T", "/F"], { windowsHide: true, timeout: 3e3 }, () => {
22418
+ execFile3("taskkill", ["/PID", String(child.pid), "/T", "/F"], { windowsHide: true, timeout: 3e3 }, () => {
22045
22419
  child.kill();
22046
22420
  done();
22047
22421
  });
@@ -22148,20 +22522,20 @@ async function bridgeCopyToTarget(sourceCwd, targetCwd, ref, contents, environme
22148
22522
  const targetFile = codeBuddyPrimaryHistoryPath(targetCwd, ref, environment, profile);
22149
22523
  if (sameResolvedPath(sourceFile, targetFile))
22150
22524
  return void 0;
22151
- const targetDirectory = path5.dirname(targetFile);
22152
- const projectsDirectory = path5.dirname(targetDirectory);
22525
+ const targetDirectory = path6.dirname(targetFile);
22526
+ const projectsDirectory = path6.dirname(targetDirectory);
22153
22527
  await mkdir(targetDirectory, { recursive: true });
22154
22528
  const [realProjects, realTargetDirectory] = await Promise.all([
22155
- realpath4(projectsDirectory),
22156
- realpath4(targetDirectory)
22529
+ realpath5(projectsDirectory),
22530
+ realpath5(targetDirectory)
22157
22531
  ]);
22158
- if (!sameResolvedPath(realTargetDirectory, path5.join(realProjects, codeBuddyProjectSlug(targetCwd, profile))))
22532
+ if (!sameResolvedPath(realTargetDirectory, path6.join(realProjects, codeBuddyProjectSlug(targetCwd, profile))))
22159
22533
  throw new CodeBuddyError("invalidRequest", "Cross-directory history bridge target escaped the native projects root");
22160
22534
  const expected = Buffer.from(contents, "utf8");
22161
- await writeFile(targetFile, expected, { flag: "wx", mode: 384 });
22535
+ await writeFile2(targetFile, expected, { flag: "wx", mode: 384 });
22162
22536
  const bridge = { file: targetFile, expected };
22163
22537
  try {
22164
- const persisted = await readFile2(targetFile);
22538
+ const persisted = await readFile3(targetFile);
22165
22539
  if (!isDeepStrictEqual3(persisted, expected))
22166
22540
  throw new CodeBuddyError("nativeFailure", "Cross-directory history bridge changed native bytes");
22167
22541
  return bridge;
@@ -22176,7 +22550,7 @@ async function cleanupBridge(bridge) {
22176
22550
  const info = await lstat(bridge.file);
22177
22551
  if (!info.isFile() || process.platform !== "win32" && (info.mode & 63) !== 0)
22178
22552
  return;
22179
- if (!isDeepStrictEqual3(await readFile2(bridge.file), bridge.expected))
22553
+ if (!isDeepStrictEqual3(await readFile3(bridge.file), bridge.expected))
22180
22554
  return;
22181
22555
  await unlink(bridge.file);
22182
22556
  } catch (error51) {
@@ -22262,7 +22636,7 @@ function assertChildRanges(rows2, child) {
22262
22636
  }
22263
22637
  }
22264
22638
  async function plainDirectory(parent, name) {
22265
- const directory = path5.join(parent, name);
22639
+ const directory = path6.join(parent, name);
22266
22640
  await mkdir(directory, { mode: 448 }).catch((error51) => {
22267
22641
  if (record2(error51).code !== "EEXIST")
22268
22642
  throw error51;
@@ -22270,7 +22644,7 @@ async function plainDirectory(parent, name) {
22270
22644
  const info = await lstat(directory);
22271
22645
  if (!info.isDirectory() || info.isSymbolicLink() || process.platform !== "win32" && (info.mode & 18) !== 0)
22272
22646
  throw new CodeBuddyError("invalidRequest", "Redirected native Subagent directory");
22273
- const actual = await realpath4(directory);
22647
+ const actual = await realpath5(directory);
22274
22648
  if (!sameResolvedPath(actual, directory))
22275
22649
  throw new CodeBuddyError("invalidRequest", "Redirected native Subagent directory");
22276
22650
  return directory;
@@ -22279,7 +22653,7 @@ async function verifiedChildFile(file2, expected) {
22279
22653
  const info = await lstat(file2);
22280
22654
  if (!info.isFile() || info.isSymbolicLink() || process.platform !== "win32" && (info.mode & 63) !== 0)
22281
22655
  throw new CodeBuddyError("invalidRequest", "Unsafe derived Subagent transcript");
22282
- if (!sameResolvedPath(await realpath4(file2), file2))
22656
+ if (!sameResolvedPath(await realpath5(file2), file2))
22283
22657
  throw new CodeBuddyError("invalidRequest", "Redirected derived Subagent transcript");
22284
22658
  const before = await codeBuddyFileVersion(file2);
22285
22659
  const actual = await readCodeBuddyVersionedText(file2, CODEBUDDY_CHILD_MAX_BYTES, "Subagent transcript exceeds 8 MB", before);
@@ -22288,7 +22662,7 @@ async function verifiedChildFile(file2, expected) {
22288
22662
  }
22289
22663
  async function persistChildCopy(file2, expected) {
22290
22664
  try {
22291
- await writeFile(file2, expected, { flag: "wx", mode: 384 });
22665
+ await writeFile2(file2, expected, { flag: "wx", mode: 384 });
22292
22666
  } catch (error51) {
22293
22667
  if (record2(error51).code !== "EEXIST")
22294
22668
  throw error51;
@@ -22307,19 +22681,19 @@ async function copyInheritedChildren(options) {
22307
22681
  const { references } = options;
22308
22682
  if (!references.length)
22309
22683
  return { descriptors: [], created: [] };
22310
- const sourceHistoryFile = await realpath4(options.sourceHistoryFile);
22311
- const sourceProject = path5.dirname(sourceHistoryFile);
22312
- if (!sameResolvedPath(sourceHistoryFile, path5.join(sourceProject, `${options.sourceRef.nativeSessionId}.jsonl`)))
22684
+ const sourceHistoryFile = await realpath5(options.sourceHistoryFile);
22685
+ const sourceProject = path6.dirname(sourceHistoryFile);
22686
+ if (!sameResolvedPath(sourceHistoryFile, path6.join(sourceProject, `${options.sourceRef.nativeSessionId}.jsonl`)))
22313
22687
  throw new CodeBuddyError("invalidRequest", "Unexpected source history location");
22314
- const sourceDirectory = path5.join(sourceProject, options.sourceRef.nativeSessionId, "subagents");
22688
+ const sourceDirectory = path6.join(sourceProject, options.sourceRef.nativeSessionId, "subagents");
22315
22689
  const sourceDirectoryInfo = await lstat(sourceDirectory);
22316
22690
  if (!sourceDirectoryInfo.isDirectory() || sourceDirectoryInfo.isSymbolicLink())
22317
22691
  throw new CodeBuddyError("invalidRequest", "Redirected source Subagent directory");
22318
- if (!sameResolvedPath(await realpath4(sourceDirectory), sourceDirectory))
22692
+ if (!sameResolvedPath(await realpath5(sourceDirectory), sourceDirectory))
22319
22693
  throw new CodeBuddyError("invalidRequest", "Redirected source Subagent directory");
22320
- const targetHistoryFile = await realpath4(options.targetHistoryFile);
22321
- const targetProject = path5.dirname(targetHistoryFile);
22322
- if (!sameResolvedPath(targetHistoryFile, path5.join(targetProject, `${options.targetRef.nativeSessionId}.jsonl`)))
22694
+ const targetHistoryFile = await realpath5(options.targetHistoryFile);
22695
+ const targetProject = path6.dirname(targetHistoryFile);
22696
+ if (!sameResolvedPath(targetHistoryFile, path6.join(targetProject, `${options.targetRef.nativeSessionId}.jsonl`)))
22323
22697
  throw new CodeBuddyError("invalidRequest", "Unexpected target history location");
22324
22698
  const targetSessionDirectory = await plainDirectory(targetProject, options.targetRef.nativeSessionId);
22325
22699
  const targetDirectory = await plainDirectory(targetSessionDirectory, "subagents");
@@ -22327,7 +22701,7 @@ async function copyInheritedChildren(options) {
22327
22701
  const created = [];
22328
22702
  try {
22329
22703
  for (const reference of references) {
22330
- const sourceFile = path5.join(sourceDirectory, `${reference.childId}.jsonl`);
22704
+ const sourceFile = path6.join(sourceDirectory, `${reference.childId}.jsonl`);
22331
22705
  const sourceInfo = await lstat(sourceFile);
22332
22706
  if (!sourceInfo.isFile() || sourceInfo.isSymbolicLink())
22333
22707
  throw new CodeBuddyError("invalidRequest", "Redirected source Subagent transcript");
@@ -22346,7 +22720,7 @@ async function copyInheritedChildren(options) {
22346
22720
  throw new CodeBuddyError("protocolError", "Missing Agent result child range");
22347
22721
  const prefix = await codeBuddyChildPrefixThrough(source.contents, last, validated);
22348
22722
  const expected = Buffer.from(prefix.contents, "utf8");
22349
- const targetFile = path5.join(targetDirectory, `${reference.childId}.jsonl`);
22723
+ const targetFile = path6.join(targetDirectory, `${reference.childId}.jsonl`);
22350
22724
  const copy = await persistChildCopy(targetFile, expected);
22351
22725
  if (copy)
22352
22726
  created.push(copy);
@@ -22725,8 +23099,8 @@ var CodeBuddyInteractions = class {
22725
23099
  };
22726
23100
 
22727
23101
  // dist/subagent-history.js
22728
- import { readdir as readdir2, realpath as realpath5 } from "node:fs/promises";
22729
- import path6 from "node:path";
23102
+ import { readdir as readdir2, realpath as realpath6 } from "node:fs/promises";
23103
+ import path7 from "node:path";
22730
23104
  var equalPath2 = (a, b) => process.platform === "win32" ? a.toLowerCase() === b.toLowerCase() : a === b;
22731
23105
  var MAX_CACHED_CHILDREN = 16;
22732
23106
  var CodeBuddyChildObserver = class {
@@ -22753,9 +23127,9 @@ var CodeBuddyChildObserver = class {
22753
23127
  throw new CodeBuddyError("invalidRequest", "Subagent observer is closed");
22754
23128
  }
22755
23129
  async #validateWorkspaces(cwds) {
22756
- const expected = await realpath5(this.cwd);
23130
+ const expected = await realpath6(this.cwd);
22757
23131
  for (const cwd of new Set(cwds)) {
22758
- const actual = await realpath5(cwd).catch((error51) => {
23132
+ const actual = await realpath6(cwd).catch((error51) => {
22759
23133
  if (["ENOENT", "ENOTDIR"].includes(String(record2(error51).code)))
22760
23134
  throw new CodeBuddyError("invalidRequest", "Native Session historical working directory is unavailable; ownership cannot be verified");
22761
23135
  throw error51;
@@ -22790,9 +23164,9 @@ var CodeBuddyChildObserver = class {
22790
23164
  }
22791
23165
  async #directory() {
22792
23166
  const history = await this.#parentHistory();
22793
- const project = path6.dirname(await realpath5(history.file));
22794
- const expected = path6.join(project, this.parent.nativeSessionId, "subagents");
22795
- const actual = await realpath5(expected);
23167
+ const project = path7.dirname(await realpath6(history.file));
23168
+ const expected = path7.join(project, this.parent.nativeSessionId, "subagents");
23169
+ const actual = await realpath6(expected);
22796
23170
  this.#assertOpen();
22797
23171
  if (!equalPath2(actual, expected))
22798
23172
  throw new CodeBuddyError("invalidRequest", `Redirected ${this.profile.displayName} Subagent directory`);
@@ -22801,7 +23175,7 @@ var CodeBuddyChildObserver = class {
22801
23175
  async #child(directory, childId) {
22802
23176
  if (!validCodeBuddyChildId(childId))
22803
23177
  throw new CodeBuddyError("invalidRequest", "Invalid native Subagent ID");
22804
- const file2 = path6.join(directory, `${childId}.jsonl`);
23178
+ const file2 = path7.join(directory, `${childId}.jsonl`);
22805
23179
  const before = await codeBuddyFileVersion(file2);
22806
23180
  if (!equalPath2(before.realFile, file2))
22807
23181
  throw new CodeBuddyError("invalidRequest", "Redirected Subagent transcript");
@@ -23686,9 +24060,40 @@ var CodeBuddyAdapter = class {
23686
24060
  }
23687
24061
  };
23688
24062
 
24063
+ // dist/installation.js
24064
+ function createCodeBuddyInstallation(environment) {
24065
+ let update;
24066
+ return createInstallationManager({
24067
+ async check() {
24068
+ const resolved = resolveHarnessExecutable(codeBuddyDiscoverySpec, { environment });
24069
+ if (!resolved)
24070
+ throw new Error("CodeBuddy is not installed");
24071
+ const currentVersion = versionFromOutput(await runInstallationCommand(resolved.executable, ["--version"], environment));
24072
+ const npm = await npmInstallation(resolved.executable, ["@tencent-ai/codebuddy-code"], environment);
24073
+ update = npm?.update;
24074
+ const latestVersion = npm ? await npm.latest() : "Unknown";
24075
+ const canUpdate = npm?.canUpdate ?? false;
24076
+ return {
24077
+ currentVersion,
24078
+ latestVersion,
24079
+ updateAvailable: !!npm && newerInstallationVersion(currentVersion, latestVersion),
24080
+ canUpdate,
24081
+ ...!canUpdate ? {
24082
+ message: "Use CodeBuddy's native updater or original package manager for this installation. Latest-version checks here require an identified npm installation."
24083
+ } : {}
24084
+ };
24085
+ },
24086
+ async update(state) {
24087
+ if (!update)
24088
+ throw new Error("This CodeBuddy installation requires a manual update");
24089
+ await update(state.latestVersion);
24090
+ }
24091
+ });
24092
+ }
24093
+
23689
24094
  // ../../harness-broker/dist/client.js
23690
24095
  import { randomUUID as randomUUID2 } from "node:crypto";
23691
- import { lstat as lstat2, readFile as readFile3 } from "node:fs/promises";
24096
+ import { lstat as lstat2, readFile as readFile4 } from "node:fs/promises";
23692
24097
  import net, {} from "node:net";
23693
24098
 
23694
24099
  // ../../harness-broker/dist/protocol.js
@@ -23806,24 +24211,25 @@ function consumeBrokerFrames(socket, onFrame, onError) {
23806
24211
 
23807
24212
  // ../../harness-broker/dist/paths.js
23808
24213
  import os2 from "node:os";
23809
- import path7 from "node:path";
24214
+ import path8 from "node:path";
23810
24215
  var HARNESS_BROKER_DESCRIPTOR_ENV = "CODEXHOST_CLAUDE_BROKER_DESCRIPTOR";
23811
24216
  var HARNESS_BROKER_DESCRIPTOR_FILE = "claude-code-broker-v1.json";
23812
24217
  function defaultHarnessBrokerDirectory(environment = process.env) {
23813
24218
  const home = environment.HOME || os2.homedir();
23814
- return path7.join(home, ".codexhost", "harness-broker");
24219
+ return path8.join(home, ".codexhost", "harness-broker");
23815
24220
  }
23816
24221
  function defaultHarnessBrokerDescriptorPath(environment = process.env, harnessId = "claude-code") {
23817
24222
  harnessPluginIdSchema.parse(harnessId);
23818
24223
  if (harnessId !== "claude-code")
23819
- return path7.join(defaultHarnessBrokerDirectory(environment), `${harnessId}-broker-v1.json`);
23820
- return environment[HARNESS_BROKER_DESCRIPTOR_ENV] ?? path7.join(defaultHarnessBrokerDirectory(environment), HARNESS_BROKER_DESCRIPTOR_FILE);
24224
+ return path8.join(defaultHarnessBrokerDirectory(environment), `${harnessId}-broker-v1.json`);
24225
+ return environment[HARNESS_BROKER_DESCRIPTOR_ENV] ?? path8.join(defaultHarnessBrokerDirectory(environment), HARNESS_BROKER_DESCRIPTOR_FILE);
23821
24226
  }
23822
24227
 
23823
24228
  // ../../harness-broker/dist/validation.js
23824
24229
  var cwdSchema = external_exports.string().min(1).max(16384);
23825
24230
  var brokerEnvironmentSchema = external_exports.object({
23826
24231
  CODEXHOST_CLI_PATH: external_exports.string().max(16384).optional(),
24232
+ CODEXHOST_CLI_NODE_PATH: external_exports.string().max(16384).optional(),
23827
24233
  CODEXHOST_RUNTIME_ENDPOINT: external_exports.string().max(16384).optional(),
23828
24234
  CODEXHOST_RUNTIME_TOKEN: external_exports.string().max(16384).optional(),
23829
24235
  CODEXHOST_THREAD_ID: external_exports.string().max(256).optional()
@@ -23999,6 +24405,7 @@ var eventKeys = /* @__PURE__ */ new Map([
23999
24405
  ["item.started", /* @__PURE__ */ new Set(["type", "turnId", "item"])],
24000
24406
  ["item.updated", /* @__PURE__ */ new Set(["type", "turnId", "itemId", "update"])],
24001
24407
  ["item.completed", /* @__PURE__ */ new Set(["type", "turnId", "snapshot"])],
24408
+ ["item.detached", /* @__PURE__ */ new Set(["type", "turnId", "itemId"])],
24002
24409
  ["interaction.closed", /* @__PURE__ */ new Set(["type", "interactionId", "turnId", "reason"])],
24003
24410
  ["turn.completed", /* @__PURE__ */ new Set(["type", "turnId", "nativeTurnRef", "outcome", "completedAtMs"])],
24004
24411
  ["session.faulted", /* @__PURE__ */ new Set(["type", "error"])]
@@ -24127,7 +24534,7 @@ async function readDescriptor(descriptorPath) {
24127
24534
  throw new Error("Aqua Harness broker descriptor belongs to another user");
24128
24535
  }
24129
24536
  }
24130
- const descriptor = harnessBrokerDescriptorSchema.parse(JSON.parse(await readFile3(descriptorPath, "utf8")));
24537
+ const descriptor = harnessBrokerDescriptorSchema.parse(JSON.parse(await readFile4(descriptorPath, "utf8")));
24131
24538
  if (process.platform === "darwin" && Buffer.byteLength(descriptor.socketPath) > 103) {
24132
24539
  throw new Error("Aqua Harness broker socket path is too long for macOS");
24133
24540
  }
@@ -24646,6 +25053,7 @@ var BrokeredHarnessAdapter = class {
24646
25053
  if (this.#forwardEnvironment && input.environment) {
24647
25054
  const allowed = [
24648
25055
  "CODEXHOST_CLI_PATH",
25056
+ "CODEXHOST_CLI_NODE_PATH",
24649
25057
  "CODEXHOST_RUNTIME_ENDPOINT",
24650
25058
  "CODEXHOST_RUNTIME_TOKEN",
24651
25059
  "CODEXHOST_THREAD_ID"
@@ -24711,7 +25119,11 @@ function createHarnessAdapter(context) {
24711
25119
  liveCommandCatalog: true,
24712
25120
  environment: { ...context.environment }
24713
25121
  });
24714
- return new CodeBuddyAdapter({ environment: { ...context.environment } });
25122
+ const environment = { ...context.environment };
25123
+ return Object.assign(new CodeBuddyAdapter({ environment }), {
25124
+ installation: createCodeBuddyInstallation(environment),
25125
+ install: createHarnessInstaller(environment, { npm: "@tencent-ai/codebuddy-code" })
25126
+ });
24715
25127
  }
24716
25128
  export {
24717
25129
  createHarnessAdapter