@liberseek/boft-cli-linux-x64 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,9 +5,351 @@ 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
+ async function fetchInstallationText(url2) {
281
+ const request = async () => {
282
+ const response = await fetch(url2, { signal: AbortSignal.timeout(15e3) });
283
+ if (!response.ok)
284
+ throw new Error("Could not check the latest Harness version");
285
+ return response.text();
286
+ };
287
+ try {
288
+ return await request();
289
+ } catch (error51) {
290
+ if (error51 instanceof DOMException && (error51.name === "AbortError" || error51.name === "TimeoutError"))
291
+ throw error51;
292
+ return request();
293
+ }
294
+ }
295
+
296
+ // ../../harness-discovery/dist/installer.js
297
+ import { mkdtemp, rm, writeFile } from "node:fs/promises";
298
+ import { tmpdir } from "node:os";
299
+ import { join } from "node:path";
300
+ function createHarnessInstaller(environment, source) {
301
+ return async () => {
302
+ if (!["darwin", "linux", "win32"].includes(process.platform))
303
+ throw new Error("Unsupported installation platform");
304
+ const env = withNodeRuntimeOnPath(environment);
305
+ if ("npm" in source) {
306
+ const npm = resolveHarnessExecutable({
307
+ id: "npm",
308
+ command: "npm",
309
+ installRoots: {
310
+ posix: [
311
+ "~/.npm-global/bin",
312
+ "~/.local/bin",
313
+ VERSION_MANAGER_ROOTS,
314
+ "/opt/homebrew/bin",
315
+ "/usr/local/bin",
316
+ "/usr/bin"
317
+ ],
318
+ windows: [
319
+ "${APPDATA}/npm",
320
+ VERSION_MANAGER_ROOTS,
321
+ "${ProgramFiles}/nodejs",
322
+ "${LOCALAPPDATA}/Programs/nodejs"
323
+ ]
324
+ }
325
+ }, { environment: env });
326
+ if (!npm)
327
+ throw new Error("Install Node.js and npm first");
328
+ await runInstallationCommand(npm.executable, ["install", "--global", source.npm], {
329
+ ...env,
330
+ ...source.allowScripts ? { npm_config_allow_scripts: source.allowScripts } : {}
331
+ }, 6e5);
332
+ return;
333
+ }
334
+ const windows = process.platform === "win32";
335
+ const url2 = windows ? source.windows : source.posix;
336
+ if (new URL(url2).protocol !== "https:")
337
+ throw new Error("Installer requires HTTPS");
338
+ const script = await fetchInstallationText(url2);
339
+ const directory = await mkdtemp(join(tmpdir(), "codexhost-installer-"));
340
+ try {
341
+ const file2 = join(directory, windows ? "install.ps1" : "install.sh");
342
+ await writeFile(file2, script, { mode: 384 });
343
+ await runInstallationCommand(windows ? "powershell.exe" : source.shell ?? "bash", windows ? ["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-File", file2] : [file2], env, 6e5);
344
+ } finally {
345
+ await rm(directory, { recursive: true, force: true });
346
+ }
347
+ };
348
+ }
349
+
8
350
  // dist/kiro-adapter.js
9
351
  import { randomUUID } from "node:crypto";
10
- import path6 from "node:path";
352
+ import path7 from "node:path";
11
353
 
12
354
  // ../../../node_modules/zod/v4/classic/external.js
13
355
  var external_exports = {};
@@ -775,10 +1117,10 @@ function mergeDefs(...defs) {
775
1117
  function cloneDef(schema) {
776
1118
  return mergeDefs(schema._zod.def);
777
1119
  }
778
- function getElementAtPath(obj, path7) {
779
- if (!path7)
1120
+ function getElementAtPath(obj, path8) {
1121
+ if (!path8)
780
1122
  return obj;
781
- return path7.reduce((acc, key) => acc?.[key], obj);
1123
+ return path8.reduce((acc, key) => acc?.[key], obj);
782
1124
  }
783
1125
  function promiseAllObject(promisesObj) {
784
1126
  const keys = Object.keys(promisesObj);
@@ -1187,11 +1529,11 @@ function explicitlyAborted(x, startIndex = 0) {
1187
1529
  }
1188
1530
  return false;
1189
1531
  }
1190
- function prefixIssues(path7, issues) {
1532
+ function prefixIssues(path8, issues) {
1191
1533
  return issues.map((iss) => {
1192
1534
  var _a3;
1193
1535
  (_a3 = iss).path ?? (_a3.path = []);
1194
- iss.path.unshift(path7);
1536
+ iss.path.unshift(path8);
1195
1537
  return iss;
1196
1538
  });
1197
1539
  }
@@ -1338,16 +1680,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
1338
1680
  }
1339
1681
  function formatError(error51, mapper = (issue2) => issue2.message) {
1340
1682
  const fieldErrors = { _errors: [] };
1341
- const processError = (error52, path7 = []) => {
1683
+ const processError = (error52, path8 = []) => {
1342
1684
  for (const issue2 of error52.issues) {
1343
1685
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1344
- issue2.errors.map((issues) => processError({ issues }, [...path7, ...issue2.path]));
1686
+ issue2.errors.map((issues) => processError({ issues }, [...path8, ...issue2.path]));
1345
1687
  } else if (issue2.code === "invalid_key") {
1346
- processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
1688
+ processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
1347
1689
  } else if (issue2.code === "invalid_element") {
1348
- processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
1690
+ processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
1349
1691
  } else {
1350
- const fullpath = [...path7, ...issue2.path];
1692
+ const fullpath = [...path8, ...issue2.path];
1351
1693
  if (fullpath.length === 0) {
1352
1694
  fieldErrors._errors.push(mapper(issue2));
1353
1695
  } else {
@@ -1374,17 +1716,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
1374
1716
  }
1375
1717
  function treeifyError(error51, mapper = (issue2) => issue2.message) {
1376
1718
  const result = { errors: [] };
1377
- const processError = (error52, path7 = []) => {
1719
+ const processError = (error52, path8 = []) => {
1378
1720
  var _a3, _b;
1379
1721
  for (const issue2 of error52.issues) {
1380
1722
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1381
- issue2.errors.map((issues) => processError({ issues }, [...path7, ...issue2.path]));
1723
+ issue2.errors.map((issues) => processError({ issues }, [...path8, ...issue2.path]));
1382
1724
  } else if (issue2.code === "invalid_key") {
1383
- processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
1725
+ processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
1384
1726
  } else if (issue2.code === "invalid_element") {
1385
- processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
1727
+ processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
1386
1728
  } else {
1387
- const fullpath = [...path7, ...issue2.path];
1729
+ const fullpath = [...path8, ...issue2.path];
1388
1730
  if (fullpath.length === 0) {
1389
1731
  result.errors.push(mapper(issue2));
1390
1732
  continue;
@@ -1416,8 +1758,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
1416
1758
  }
1417
1759
  function toDotPath(_path) {
1418
1760
  const segs = [];
1419
- const path7 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1420
- for (const seg of path7) {
1761
+ const path8 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1762
+ for (const seg of path8) {
1421
1763
  if (typeof seg === "number")
1422
1764
  segs.push(`[${seg}]`);
1423
1765
  else if (typeof seg === "symbol")
@@ -14109,13 +14451,13 @@ function resolveRef(ref, ctx) {
14109
14451
  if (!ref.startsWith("#")) {
14110
14452
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
14111
14453
  }
14112
- const path7 = ref.slice(1).split("/").filter(Boolean);
14113
- if (path7.length === 0) {
14454
+ const path8 = ref.slice(1).split("/").filter(Boolean);
14455
+ if (path8.length === 0) {
14114
14456
  return ctx.rootSchema;
14115
14457
  }
14116
14458
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
14117
- if (path7[0] === defsKey) {
14118
- const key = path7[1];
14459
+ if (path8[0] === defsKey) {
14460
+ const key = path8[1];
14119
14461
  if (!key || !ctx.defs[key]) {
14120
14462
  throw new Error(`Reference not found: ${ref}`);
14121
14463
  }
@@ -14578,7 +14920,124 @@ var credentialImportsParamsSchema = external_exports.object({
14578
14920
  request: credentialImportsRequestSchema
14579
14921
  }).strict();
14580
14922
 
14581
- // ../../shared-contracts/dist/version.js
14923
+ // ../../shared-contracts/dist/harness-display-settings.js
14924
+ var harnessDisplayEntriesSchema = external_exports.array(external_exports.strictObject({
14925
+ agent: external_exports.string().min(1).max(128),
14926
+ section: external_exports.enum(["main", "more", "auto"])
14927
+ })).max(256).refine((entries) => new Set(entries.map((entry) => entry.agent)).size === entries.length, "Duplicate Harness IDs");
14928
+ var harnessDisplaySettingsSchema = external_exports.strictObject({
14929
+ entries: harnessDisplayEntriesSchema.nullable()
14930
+ });
14931
+ var harnessDisplayGetSchema = external_exports.strictObject({});
14932
+ var harnessDisplaySetSchema = external_exports.strictObject({
14933
+ entries: harnessDisplayEntriesSchema,
14934
+ /** Import legacy Desktop preferences only if no shared settings exist yet. */
14935
+ initializeOnly: external_exports.boolean().optional()
14936
+ });
14937
+
14938
+ // ../../shared-contracts/dist/ids.js
14939
+ var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
14940
+ message: "Identifier must not be empty or whitespace"
14941
+ });
14942
+ var harnessIdSchema = opaqueIdSchema.brand();
14943
+ var hostThreadIdSchema = opaqueIdSchema.brand();
14944
+ var hostTurnIdSchema = opaqueIdSchema.brand();
14945
+ var hostItemIdSchema = opaqueIdSchema.brand();
14946
+ var hostInteractionIdSchema = opaqueIdSchema.brand();
14947
+
14948
+ // ../../shared-contracts/dist/harness-plugins.js
14949
+ var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
14950
+ var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
14951
+ var HARNESS_PLUGIN_LIMIT = 128;
14952
+ 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);
14953
+ 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");
14954
+ var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
14955
+ var pluginPresentationShape = {
14956
+ id: harnessPluginIdSchema,
14957
+ name: external_exports.string().trim().min(1).max(128),
14958
+ version: external_exports.string().min(1).max(128),
14959
+ /** The factory accepts a persisted local entrypoint through its construction context. */
14960
+ launchCommand: external_exports.literal(true).optional(),
14961
+ links: external_exports.object({
14962
+ documentation: documentationUrlSchema.optional(),
14963
+ installation: documentationUrlSchema.optional()
14964
+ }).strict().optional()
14965
+ };
14966
+ var harnessPluginManifestSchema = external_exports.object({
14967
+ manifestVersion: external_exports.literal(1),
14968
+ ...pluginPresentationShape,
14969
+ adapterApiVersion: external_exports.number().int().positive(),
14970
+ entry: relativeResourceSchema,
14971
+ icon: relativeResourceSchema.optional()
14972
+ }).strict();
14973
+ 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);
14974
+ var harnessPluginDescriptorSchema = external_exports.object({
14975
+ ...pluginPresentationShape,
14976
+ icon: harnessPluginIconSchema.optional()
14977
+ }).strict();
14978
+ var harnessPluginListParamsSchema = external_exports.object({}).strict();
14979
+ var harnessPluginListResultSchema = external_exports.object({
14980
+ plugins: external_exports.array(harnessPluginDescriptorSchema).max(HARNESS_PLUGIN_LIMIT)
14981
+ }).strict();
14982
+ var harnessPluginConfigurationSchema = external_exports.object({
14983
+ version: external_exports.literal(1),
14984
+ enabled: external_exports.array(harnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
14985
+ }).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
14986
+ message: "Enabled plugin IDs must be unique",
14987
+ path: ["enabled"]
14988
+ });
14989
+
14990
+ // ../../shared-contracts/dist/harness-long-context.js
14991
+ var HARNESS_LONG_CONTEXT_GET_METHOD = "codexhost/harness/long-context/get";
14992
+ var HARNESS_LONG_CONTEXT_SET_METHOD = "codexhost/harness/long-context/set";
14993
+ var harnessLongContextGetSchema = external_exports.object({
14994
+ harnessId: harnessPluginIdSchema
14995
+ }).strict();
14996
+ var harnessLongContextSetSchema = harnessLongContextGetSchema.extend({
14997
+ enabled: external_exports.boolean()
14998
+ });
14999
+ var harnessLongContextSchema = external_exports.object({
15000
+ enabled: external_exports.boolean()
15001
+ }).strict();
15002
+
15003
+ // ../../shared-contracts/dist/console.js
15004
+ var consoleAnnouncementSchema = external_exports.strictObject({
15005
+ title: external_exports.string().trim().min(1).max(200),
15006
+ type: external_exports.enum(["info", "warning", "danger"]),
15007
+ body: external_exports.string().trim().min(1).max(16 * 1024)
15008
+ });
15009
+ var consoleOpenParamsSchema = external_exports.strictObject({});
15010
+ var consoleOpenResultSchema = external_exports.strictObject({
15011
+ /** The console address. */
15012
+ url: external_exports.string().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)
15013
+ });
15014
+ var CONSOLE_HOST_METHODS = Object.freeze([
15015
+ "codexhost/harness/plugins/list",
15016
+ "codexhost/harness/display-settings/get",
15017
+ "codexhost/harness/display-settings/set",
15018
+ "codexhost/harness/inspect",
15019
+ "codexhost/harness/installation",
15020
+ "codexhost/harness/launch-settings/get",
15021
+ "codexhost/harness/launch-settings/set",
15022
+ HARNESS_LONG_CONTEXT_GET_METHOD,
15023
+ HARNESS_LONG_CONTEXT_SET_METHOD,
15024
+ "codexhost/harness/web-ui/open",
15025
+ "codexhost/harness/accounts/sources",
15026
+ "codexhost/harness/accounts/list",
15027
+ "codexhost/harness/accounts/inspect",
15028
+ "codexhost/harness/credential-imports",
15029
+ "codexhost/harness/session-import/sources",
15030
+ "codexhost/harness/session-import/list",
15031
+ "codexhost/harness/session-import/import",
15032
+ "codexhost/account/list",
15033
+ "codexhost/account/refresh",
15034
+ "codexhost/account/usage/inspect",
15035
+ "codexhost/update/check",
15036
+ "codexhost/update/start",
15037
+ "codexhost/update/status"
15038
+ ]);
15039
+
15040
+ // ../../shared-contracts/dist/version.js
14582
15041
  var WORKSPACE_CONTRACT_VERSION = 1;
14583
15042
 
14584
15043
  // ../../shared-contracts/dist/idle-release.js
@@ -14621,15 +15080,11 @@ var loadedSessionsSchema = external_exports.array(external_exports.strictObject(
14621
15080
  inactiveMs: external_exports.number().nonnegative()
14622
15081
  }));
14623
15082
 
14624
- // ../../shared-contracts/dist/ids.js
14625
- var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
14626
- message: "Identifier must not be empty or whitespace"
15083
+ // ../../shared-contracts/dist/manual-compaction.js
15084
+ var threadManualCompactionStartedSchema = external_exports.strictObject({
15085
+ threadId: hostThreadIdSchema,
15086
+ turnId: hostTurnIdSchema
14627
15087
  });
14628
- var harnessIdSchema = opaqueIdSchema.brand();
14629
- var hostThreadIdSchema = opaqueIdSchema.brand();
14630
- var hostTurnIdSchema = opaqueIdSchema.brand();
14631
- var hostItemIdSchema = opaqueIdSchema.brand();
14632
- var hostInteractionIdSchema = opaqueIdSchema.brand();
14633
15088
 
14634
15089
  // ../../shared-contracts/dist/thread-usage.js
14635
15090
  var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
@@ -14691,6 +15146,10 @@ var threadUsageSnapshotSchema = external_exports.object({
14691
15146
  var usagePercentSchema = external_exports.number().finite().min(0).max(100);
14692
15147
  var accountCreditsProductUsageSchema = external_exports.object({
14693
15148
  product: external_exports.string().min(1),
15149
+ used: external_exports.number().finite().nonnegative().optional(),
15150
+ // Zero is a real empty cap, not an absent field.
15151
+ limit: external_exports.number().finite().nonnegative().optional(),
15152
+ unit: external_exports.string().min(1).max(32).optional(),
14694
15153
  usagePercent: usagePercentSchema,
14695
15154
  resetsAt: external_exports.string().min(1).optional()
14696
15155
  }).strict();
@@ -14700,11 +15159,14 @@ var accountResetCreditsSchema = external_exports.object({
14700
15159
  expiresAt: external_exports.array(external_exports.string().min(1)).min(1).max(32).optional()
14701
15160
  }).strict();
14702
15161
  var accountCreditsSnapshotSchema = external_exports.object({
15162
+ used: external_exports.number().finite().nonnegative().optional(),
15163
+ // Zero is a real empty cap, not an absent field.
15164
+ limit: external_exports.number().finite().nonnegative().optional(),
15165
+ unit: external_exports.string().trim().min(1).max(32).optional(),
14703
15166
  /** Native label when the primary limit is scoped to a model or product group. */
14704
15167
  label: external_exports.string().min(1).optional(),
14705
15168
  usedPercent: usagePercentSchema.optional(),
14706
15169
  remaining: external_exports.number().finite().optional(),
14707
- unit: external_exports.string().trim().min(1).max(32).optional(),
14708
15170
  resetsAt: external_exports.string().min(1).optional(),
14709
15171
  periodType: external_exports.enum(["weekly", "monthly", "five_hour", "seven_day", "unknown"]),
14710
15172
  productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
@@ -14735,12 +15197,27 @@ var threadUsageInspectionSchema = external_exports.object({
14735
15197
  }).strict();
14736
15198
 
14737
15199
  // ../../shared-contracts/dist/harness-accounts.js
14738
- var harnessAccountSnapshotSchema = external_exports.object({
15200
+ var accountBalanceSnapshotSchema = external_exports.object({
15201
+ amount: external_exports.number().finite().nonnegative(),
15202
+ /** ISO 4217 code as reported by the Provider, for example `CNY`. */
15203
+ currency: external_exports.string().trim().min(1).max(8),
15204
+ /** Native label when the Harness exposes several Billing Sources. */
15205
+ label: external_exports.string().trim().min(1).max(128).optional()
15206
+ }).strict();
15207
+ var harnessAccountSnapshotObject = external_exports.object({
14739
15208
  email: external_exports.string().trim().min(1).max(320).optional(),
14740
15209
  label: external_exports.string().trim().min(1).max(256).optional(),
14741
15210
  plan: external_exports.string().trim().min(1).max(128).optional(),
14742
- credits: accountCreditsSnapshotSchema
15211
+ credits: accountCreditsSnapshotSchema.optional(),
15212
+ balance: accountBalanceSnapshotSchema.optional()
14743
15213
  }).strict();
15214
+ function requireReportedQuota(schema) {
15215
+ return schema.refine((value) => {
15216
+ const reported = value;
15217
+ return reported.credits !== void 0 || reported.balance !== void 0;
15218
+ }, { message: "Account must report either credits or a balance" });
15219
+ }
15220
+ var harnessAccountSnapshotSchema = requireReportedQuota(harnessAccountSnapshotObject);
14744
15221
  var harnessAccountIdentityShape = {
14745
15222
  harnessId: harnessIdSchema,
14746
15223
  harnessName: external_exports.string().trim().min(1).max(128)
@@ -14751,11 +15228,13 @@ var harnessAccountSourceListResultSchema = external_exports.object({ sources: ex
14751
15228
  var harnessAccountInspectParamsSchema = external_exports.object({ harnessId: harnessIdSchema, refresh: external_exports.boolean().optional() }).strict();
14752
15229
  var harnessAccountInspectResultSchema = external_exports.object({
14753
15230
  ...harnessAccountIdentityShape,
14754
- account: harnessAccountSnapshotSchema.nullable()
15231
+ account: harnessAccountSnapshotSchema.nullable(),
15232
+ /** Every Billing Source from one Harness; `account` remains the first for older clients. */
15233
+ accounts: external_exports.array(harnessAccountSnapshotSchema).max(8).optional()
14755
15234
  }).strict();
14756
15235
  var harnessAccountListParamsSchema = external_exports.object({ refresh: external_exports.boolean().optional() }).strict();
14757
15236
  var harnessAccountListResultSchema = external_exports.object({
14758
- accounts: external_exports.array(harnessAccountSnapshotSchema.extend(harnessAccountIdentityShape)).max(128)
15237
+ accounts: external_exports.array(requireReportedQuota(harnessAccountSnapshotObject.extend(harnessAccountIdentityShape))).max(128)
14759
15238
  }).strict();
14760
15239
 
14761
15240
  // ../../shared-contracts/dist/json-value.js
@@ -14893,6 +15372,8 @@ var harnessModelSchema = external_exports.object({
14893
15372
  ref: harnessModelRefSchema,
14894
15373
  label: nonBlankTextSchema2.max(HARNESS_MODEL_LABEL_MAX_LENGTH),
14895
15374
  resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
15375
+ /** Optional opaque selection for this same Model with priority processing enabled. */
15376
+ fastModel: harnessModelRefSchema.optional(),
14896
15377
  supportedThinkingOptionIds: external_exports.array(harnessThinkingOptionIdSchema).optional()
14897
15378
  }).strict();
14898
15379
  var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context) => {
@@ -14925,6 +15406,16 @@ var harnessModelCatalogSchema = external_exports.object({
14925
15406
  });
14926
15407
  }
14927
15408
  refs.add(model.ref.id);
15409
+ if (model.fastModel) {
15410
+ if (refs.has(model.fastModel.id) || catalog.models.some((entry) => entry.ref.id === model.fastModel?.id)) {
15411
+ context.addIssue({
15412
+ code: "custom",
15413
+ message: "Fast Model refs must be distinct and unique",
15414
+ path: ["models", index, "fastModel"]
15415
+ });
15416
+ }
15417
+ refs.add(model.fastModel.id);
15418
+ }
14928
15419
  const supportedThinkingIds = /* @__PURE__ */ new Set();
14929
15420
  for (const [optionIndex, optionId] of (model.supportedThinkingOptionIds ?? []).entries()) {
14930
15421
  if (supportedThinkingIds.has(optionId)) {
@@ -15047,11 +15538,13 @@ var threadThinkingSelectParamsSchema = external_exports.object({
15047
15538
  thinkingOptionId: harnessThinkingOptionIdSchema
15048
15539
  }).strict();
15049
15540
  var threadInspectionParamsSchema = external_exports.object({
15050
- threadId: hostThreadIdSchema
15541
+ threadId: hostThreadIdSchema,
15542
+ includeReferenceCapability: external_exports.boolean().optional()
15051
15543
  }).strict();
15052
15544
  var codexThreadInspectionSchema = external_exports.object({
15053
15545
  owner: external_exports.literal("codex"),
15054
- locked: external_exports.literal(true)
15546
+ locked: external_exports.literal(true),
15547
+ supportsThreadReferences: external_exports.literal(true).optional()
15055
15548
  }).strict();
15056
15549
  var externalThreadInspectionSchema = external_exports.object({
15057
15550
  owner: external_exports.literal("external"),
@@ -15116,48 +15609,6 @@ var threadOwnershipListResultSchema = external_exports.object({
15116
15609
  }
15117
15610
  });
15118
15611
 
15119
- // ../../shared-contracts/dist/harness-plugins.js
15120
- var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
15121
- var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
15122
- var HARNESS_PLUGIN_LIMIT = 128;
15123
- 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);
15124
- 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");
15125
- var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
15126
- var pluginPresentationShape = {
15127
- id: harnessPluginIdSchema,
15128
- name: external_exports.string().trim().min(1).max(128),
15129
- version: external_exports.string().min(1).max(128),
15130
- /** The factory accepts a persisted local entrypoint through its construction context. */
15131
- launchCommand: external_exports.literal(true).optional(),
15132
- links: external_exports.object({
15133
- documentation: documentationUrlSchema.optional(),
15134
- installation: documentationUrlSchema.optional()
15135
- }).strict().optional()
15136
- };
15137
- var harnessPluginManifestSchema = external_exports.object({
15138
- manifestVersion: external_exports.literal(1),
15139
- ...pluginPresentationShape,
15140
- adapterApiVersion: external_exports.number().int().positive(),
15141
- entry: relativeResourceSchema,
15142
- icon: relativeResourceSchema.optional()
15143
- }).strict();
15144
- 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);
15145
- var harnessPluginDescriptorSchema = external_exports.object({
15146
- ...pluginPresentationShape,
15147
- icon: harnessPluginIconSchema.optional()
15148
- }).strict();
15149
- var harnessPluginListParamsSchema = external_exports.object({}).strict();
15150
- var harnessPluginListResultSchema = external_exports.object({
15151
- plugins: external_exports.array(harnessPluginDescriptorSchema).max(HARNESS_PLUGIN_LIMIT)
15152
- }).strict();
15153
- var harnessPluginConfigurationSchema = external_exports.object({
15154
- version: external_exports.literal(1),
15155
- enabled: external_exports.array(harnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
15156
- }).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
15157
- message: "Enabled plugin IDs must be unique",
15158
- path: ["enabled"]
15159
- });
15160
-
15161
15612
  // ../../shared-contracts/dist/harness-route.js
15162
15613
  var harnessPluginRouteSchema = external_exports.object({
15163
15614
  harnessId: harnessPluginIdSchema,
@@ -15179,10 +15630,31 @@ var harnessLaunchSettingsSchema = external_exports.object({
15179
15630
  restartRequired: external_exports.boolean()
15180
15631
  }).strict();
15181
15632
 
15633
+ // ../../shared-contracts/dist/harness-installation.js
15634
+ var harnessInstallationParamsSchema = external_exports.object({
15635
+ harnessId: harnessIdSchema,
15636
+ action: external_exports.enum(["check", "update", "install"])
15637
+ }).strict();
15638
+ var harnessInstallationStateSchema = external_exports.object({
15639
+ currentVersion: external_exports.string().min(1).max(128),
15640
+ latestVersion: external_exports.string().min(1).max(128),
15641
+ updateAvailable: external_exports.boolean(),
15642
+ canUpdate: external_exports.boolean(),
15643
+ message: external_exports.string().max(2048).optional()
15644
+ }).strict();
15645
+
15182
15646
  // ../../shared-contracts/dist/codex-accounts.js
15183
15647
  var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
15184
15648
  var nonBlankTextSchema3 = external_exports.string().trim().min(1);
15185
15649
  var codexAccountAuthKindSchema = external_exports.enum(["api", "chatgpt"]);
15650
+ var codexAccountSiteUrlPattern = /^https?:\/\/(?:\[[0-9a-fA-F:]+\]|[^/\s:@?#]+)(?::\d{1,5})?(?:[/?#][^\s]*)?$/u;
15651
+ function isCodexAccountSiteUrl(value) {
15652
+ return value.length > 0 && value.length <= 2048 && codexAccountSiteUrlPattern.test(value);
15653
+ }
15654
+ var externalUrlOpenParamsSchema = external_exports.object({
15655
+ url: external_exports.string().max(2048).refine(isCodexAccountSiteUrl, "External URL must be http(s)")
15656
+ }).strict();
15657
+ var externalUrlOpenResultSchema = external_exports.object({}).strict();
15186
15658
  var codexAccountPlanTypeSchema = external_exports.enum([
15187
15659
  "free",
15188
15660
  "go",
@@ -15208,7 +15680,8 @@ var codexAccountSchema = external_exports.object({
15208
15680
  email: external_exports.string().email().max(320).optional(),
15209
15681
  planType: codexAccountPlanTypeSchema.optional(),
15210
15682
  authKind: codexAccountAuthKindSchema.optional(),
15211
- authIdentity: nonBlankTextSchema3.max(256).optional()
15683
+ authIdentity: nonBlankTextSchema3.max(256).optional(),
15684
+ siteUrl: external_exports.string().refine(isCodexAccountSiteUrl, "Account site URL must be http(s)").optional()
15212
15685
  }).strict();
15213
15686
  var codexAccountPhaseSchema = external_exports.enum(["ready", "unavailable"]);
15214
15687
  var codexAccountListResultSchema = external_exports.object({
@@ -15803,235 +16276,10 @@ function mergeLiveHarnessCommands(builtIns, idPrefix, live, exclusions = {}) {
15803
16276
  // dist/acp-transport.js
15804
16277
  import { spawn, spawnSync } from "node:child_process";
15805
16278
  import { Readable, Writable } from "node:stream";
15806
- import { execFile } from "node:child_process";
16279
+ import { execFile as execFile2 } from "node:child_process";
15807
16280
  import { promisify } from "node:util";
15808
16281
  import { setTimeout as delay } from "node:timers/promises";
15809
16282
 
15810
- // ../../harness-discovery/dist/environment.js
15811
- import fs from "node:fs";
15812
- import path from "node:path";
15813
- function targetPath(platform) {
15814
- return platform === "win32" ? path.win32 : path.posix;
15815
- }
15816
- function environmentValue(environment, name) {
15817
- const lowered = name.toLowerCase();
15818
- for (const [key, value] of Object.entries(environment)) {
15819
- if (key.toLowerCase() === lowered)
15820
- return value;
15821
- }
15822
- return void 0;
15823
- }
15824
- function pathDelimiter(platform) {
15825
- return platform === "win32" ? ";" : ":";
15826
- }
15827
- function pathDirectories(environment, platform) {
15828
- return (environmentValue(environment, "PATH") ?? "").split(pathDelimiter(platform)).map((directory) => directory.trim().replace(/^"|"$/gu, "")).filter(Boolean);
15829
- }
15830
- function executableExtensions(command, platform, environment) {
15831
- if (platform !== "win32")
15832
- return [""];
15833
- if (targetPath(platform).extname(command) !== "")
15834
- return [""];
15835
- return (environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").map((extension) => extension.trim()).filter(Boolean);
15836
- }
15837
- function isExecutableFile(filePath, platform) {
15838
- try {
15839
- fs.accessSync(filePath, platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK);
15840
- return fs.statSync(filePath).isFile();
15841
- } catch {
15842
- return false;
15843
- }
15844
- }
15845
- function subdirectoryNames(directory) {
15846
- try {
15847
- return fs.readdirSync(directory, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
15848
- } catch {
15849
- return [];
15850
- }
15851
- }
15852
- function newestFirst(names) {
15853
- return [...names].sort((left, right) => right.localeCompare(left, void 0, { numeric: true }));
15854
- }
15855
-
15856
- // ../../harness-discovery/dist/invocation.js
15857
- import path2 from "node:path";
15858
- function commandInvocation(command, arguments_, environment, platform = process.platform) {
15859
- const extension = path2.win32.extname(command).toLowerCase();
15860
- if (platform !== "win32" || ![".cmd", ".bat"].includes(extension)) {
15861
- return { command, arguments: [...arguments_], windowsVerbatimArguments: false };
15862
- }
15863
- const quote = (value) => `"${value.replaceAll("%", "%%").replaceAll('"', '""')}"`;
15864
- const commandLine = [command, ...arguments_].map(quote).join(" ");
15865
- return {
15866
- command: environmentValue(environment, "ComSpec") ?? "cmd.exe",
15867
- arguments: ["/d", "/v:off", "/s", "/c", `"${commandLine}"`],
15868
- windowsVerbatimArguments: true
15869
- };
15870
- }
15871
-
15872
- // ../../harness-discovery/dist/resolve.js
15873
- import os from "node:os";
15874
-
15875
- // ../../harness-discovery/dist/version-managers.js
15876
- function versionManagerBinaryDirectories(context) {
15877
- const { platform, environment, home } = context;
15878
- const list = context.subdirectories ?? subdirectoryNames;
15879
- const pathFlavor = targetPath(platform);
15880
- const value = (name) => environmentValue(environment, name);
15881
- const directories = [];
15882
- const versioned = (root, ...tail) => {
15883
- for (const version2 of newestFirst(list(root))) {
15884
- directories.push(pathFlavor.join(root, version2, ...tail));
15885
- }
15886
- };
15887
- if (platform === "win32") {
15888
- const appData = value("APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming");
15889
- const localAppData = value("LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local");
15890
- versioned(pathFlavor.join(appData, "nvm"));
15891
- versioned(value("FNM_DIR") ?? pathFlavor.join(appData, "fnm", "node-versions"), "installation");
15892
- directories.push(pathFlavor.join(localAppData, "Volta", "bin"));
15893
- directories.push(pathFlavor.join(home, ".bun", "bin"));
15894
- const pnpmHome2 = value("PNPM_HOME");
15895
- if (pnpmHome2)
15896
- directories.push(pnpmHome2);
15897
- directories.push(pathFlavor.join(localAppData, "pnpm"));
15898
- return directories;
15899
- }
15900
- versioned(pathFlavor.join(value("NVM_DIR") ?? pathFlavor.join(home, ".nvm"), "versions", "node"), "bin");
15901
- const fnmRoots = [
15902
- value("FNM_DIR"),
15903
- pathFlavor.join(home, ".local", "share", "fnm"),
15904
- pathFlavor.join(home, "Library", "Application Support", "fnm")
15905
- ].filter((root) => root !== void 0);
15906
- for (const root of fnmRoots) {
15907
- versioned(pathFlavor.join(root, "node-versions"), "installation", "bin");
15908
- }
15909
- const voltaHome = value("VOLTA_HOME") ?? pathFlavor.join(home, ".volta");
15910
- versioned(pathFlavor.join(voltaHome, "tools", "image", "node"), "bin");
15911
- directories.push(pathFlavor.join(voltaHome, "bin"));
15912
- const asdfHome = value("ASDF_DATA_DIR") ?? pathFlavor.join(home, ".asdf");
15913
- versioned(pathFlavor.join(asdfHome, "installs", "nodejs"), "bin");
15914
- directories.push(pathFlavor.join(asdfHome, "shims"));
15915
- const nodenvHome = value("NODENV_ROOT") ?? pathFlavor.join(home, ".nodenv");
15916
- versioned(pathFlavor.join(nodenvHome, "versions"), "bin");
15917
- directories.push(pathFlavor.join(nodenvHome, "shims"));
15918
- versioned(pathFlavor.join(value("N_PREFIX") ?? "/usr/local", "n", "versions", "node"), "bin");
15919
- directories.push(pathFlavor.join(home, ".bun", "bin"));
15920
- const pnpmHome = value("PNPM_HOME");
15921
- if (pnpmHome)
15922
- directories.push(pnpmHome);
15923
- directories.push(pathFlavor.join(home, "Library", "pnpm"));
15924
- directories.push(pathFlavor.join(home, ".local", "share", "pnpm"));
15925
- for (const prefix of ["/opt/homebrew/opt", "/usr/local/opt"]) {
15926
- for (const formula of newestFirst(list(prefix).filter((name) => name.startsWith("node@")))) {
15927
- directories.push(pathFlavor.join(prefix, formula, "bin"));
15928
- }
15929
- }
15930
- return directories;
15931
- }
15932
-
15933
- // ../../harness-discovery/dist/resolve.js
15934
- var VERSION_MANAGER_ROOTS = "<version-managers>";
15935
- function installRootExtensions(platform) {
15936
- return platform === "win32" ? [".exe", ".cmd"] : [""];
15937
- }
15938
- function resolveHomeDirectory(input) {
15939
- return input.homeDirectory ?? environmentValue(input.environment, "HOME") ?? environmentValue(input.environment, "USERPROFILE") ?? os.homedir();
15940
- }
15941
- function templateVariables(environment, platform, home) {
15942
- const pathFlavor = targetPath(platform);
15943
- return {
15944
- HOME: home,
15945
- USERPROFILE: home,
15946
- APPDATA: environmentValue(environment, "APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming"),
15947
- LOCALAPPDATA: environmentValue(environment, "LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local")
15948
- };
15949
- }
15950
- function joinTemplate(platform, value) {
15951
- const pathFlavor = targetPath(platform);
15952
- const segments = value.split("/");
15953
- const head = segments[0] ?? "";
15954
- const tail = segments.slice(1);
15955
- if (head === "")
15956
- return pathFlavor.join(pathFlavor.sep, ...tail);
15957
- return tail.length === 0 ? head : pathFlavor.join(head, ...tail);
15958
- }
15959
- function expandInstallRoot(template, environment, platform, home) {
15960
- const variables = templateVariables(environment, platform, home);
15961
- let unresolved = false;
15962
- const substituted = template.replace(/^~(?=\/|$)/u, home).replace(/\$\{(\w+)\}/gu, (_match, name) => {
15963
- const value = variables[name] ?? environmentValue(environment, name);
15964
- if (value === void 0 || value === "") {
15965
- unresolved = true;
15966
- return "";
15967
- }
15968
- return value;
15969
- });
15970
- return unresolved ? void 0 : joinTemplate(platform, substituted);
15971
- }
15972
- function installRootDirectories(spec, input, dependencies, platform, home) {
15973
- const templates = (platform === "win32" ? spec.installRoots?.windows : spec.installRoots?.posix) ?? [];
15974
- const directories = [];
15975
- for (const template of templates) {
15976
- if (template === VERSION_MANAGER_ROOTS) {
15977
- directories.push(...versionManagerBinaryDirectories({
15978
- platform,
15979
- environment: input.environment,
15980
- home,
15981
- ...dependencies.subdirectories ? { subdirectories: dependencies.subdirectories } : {}
15982
- }));
15983
- continue;
15984
- }
15985
- const directory = expandInstallRoot(template, input.environment, platform, home);
15986
- if (directory !== void 0)
15987
- directories.push(directory);
15988
- }
15989
- return directories;
15990
- }
15991
- function harnessCandidates(spec, input, dependencies = {}) {
15992
- const platform = input.platform ?? process.platform;
15993
- const pathFlavor = targetPath(platform);
15994
- const configured = input.command ?? (spec.commandEnvironmentVariable ? environmentValue(input.environment, spec.commandEnvironmentVariable) : void 0);
15995
- const command = configured ?? spec.command;
15996
- if (pathFlavor.isAbsolute(command) || command.includes("/") || command.includes("\\")) {
15997
- return [{ candidate: command, source: "configured" }];
15998
- }
15999
- const candidates = [];
16000
- const extensions = executableExtensions(command, platform, input.environment);
16001
- for (const directory of pathDirectories(input.environment, platform)) {
16002
- for (const extension of extensions) {
16003
- candidates.push({
16004
- candidate: pathFlavor.join(directory, command + extension),
16005
- source: "path"
16006
- });
16007
- }
16008
- }
16009
- if (configured !== void 0)
16010
- return candidates;
16011
- const home = resolveHomeDirectory(input);
16012
- for (const directory of installRootDirectories(spec, input, dependencies, platform, home)) {
16013
- for (const extension of installRootExtensions(platform)) {
16014
- candidates.push({
16015
- candidate: pathFlavor.join(directory, spec.command + extension),
16016
- source: "install-root"
16017
- });
16018
- }
16019
- }
16020
- return candidates;
16021
- }
16022
- function resolveHarnessExecutable(spec, input, dependencies = {}) {
16023
- const platform = input.platform ?? process.platform;
16024
- const isExecutable = dependencies.isExecutable ?? ((candidate) => isExecutableFile(candidate, platform));
16025
- const runnable = spec.runnableCandidate ?? ((candidate) => candidate);
16026
- const context = { platform, isExecutable };
16027
- for (const { candidate, source } of harnessCandidates(spec, input, dependencies)) {
16028
- const executable = runnable(candidate, context);
16029
- if (executable !== void 0 && isExecutable(executable))
16030
- return { executable, source };
16031
- }
16032
- return void 0;
16033
- }
16034
-
16035
16283
  // ../../../node_modules/@agentclientprotocol/sdk/dist/schema/index.js
16036
16284
  var AGENT_METHODS = {
16037
16285
  initialize: "initialize",
@@ -20226,7 +20474,7 @@ function kiroLiveCommands(native) {
20226
20474
  }
20227
20475
 
20228
20476
  // dist/command.js
20229
- import path3 from "node:path";
20477
+ import path4 from "node:path";
20230
20478
  var KiroExecutableError = class extends Error {
20231
20479
  code = "KIRO_NOT_FOUND";
20232
20480
  };
@@ -20255,7 +20503,7 @@ function resolveKiroExecutable(input = {}, dependencies = {}) {
20255
20503
  }, dependencies);
20256
20504
  if (!resolution)
20257
20505
  throw new KiroExecutableError("Kiro CLI is not installed");
20258
- return targetPath(platform).isAbsolute(resolution.executable) ? resolution.executable : path3.resolve(resolution.executable);
20506
+ return targetPath(platform).isAbsolute(resolution.executable) ? resolution.executable : path4.resolve(resolution.executable);
20259
20507
  }
20260
20508
  function kiroInvocation(command, platform = process.platform) {
20261
20509
  return commandInvocation(command, ["acp", "--agent-engine", "v3", "--auth-method", "cli"], process.env, platform);
@@ -20512,7 +20760,7 @@ var KiroAcpTransport = class {
20512
20760
  environment
20513
20761
  });
20514
20762
  const invocation = commandInvocation(executable, ["chat", "--list-models", "--format", "json"], environment, process.platform);
20515
- const { stdout } = await promisify(execFile)(invocation.command, invocation.arguments, {
20763
+ const { stdout } = await promisify(execFile2)(invocation.command, invocation.arguments, {
20516
20764
  cwd: this.#options.cwd,
20517
20765
  env: environment,
20518
20766
  windowsHide: true,
@@ -21101,7 +21349,7 @@ ${fence}`;
21101
21349
 
21102
21350
  // dist/file-diff.js
21103
21351
  import { Buffer as Buffer2 } from "node:buffer";
21104
- import path4 from "node:path";
21352
+ import path5 from "node:path";
21105
21353
  import { fileURLToPath } from "node:url";
21106
21354
 
21107
21355
  // ../../../node_modules/diff/libesm/diff/base.js
@@ -21204,16 +21452,16 @@ var Diff = class {
21204
21452
  }
21205
21453
  }
21206
21454
  }
21207
- addToPath(path7, added, removed, oldPosInc, options) {
21208
- const last = path7.lastComponent;
21455
+ addToPath(path8, added, removed, oldPosInc, options) {
21456
+ const last = path8.lastComponent;
21209
21457
  if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
21210
21458
  return {
21211
- oldPos: path7.oldPos + oldPosInc,
21459
+ oldPos: path8.oldPos + oldPosInc,
21212
21460
  lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
21213
21461
  };
21214
21462
  } else {
21215
21463
  return {
21216
- oldPos: path7.oldPos + oldPosInc,
21464
+ oldPos: path8.oldPos + oldPosInc,
21217
21465
  lastComponent: { count: 1, added, removed, previousComponent: last }
21218
21466
  };
21219
21467
  }
@@ -21533,23 +21781,23 @@ function resolveFilePath(candidate) {
21533
21781
  }
21534
21782
  try {
21535
21783
  if (candidate.startsWith("file:")) {
21536
- return path4.resolve(fileURLToPath(new URL(candidate)));
21784
+ return path5.resolve(fileURLToPath(new URL(candidate)));
21537
21785
  }
21538
- return path4.resolve(candidate);
21786
+ return path5.resolve(candidate);
21539
21787
  } catch {
21540
21788
  try {
21541
21789
  const withoutScheme = candidate.replace(/^file:\/\/\/?/iu, "");
21542
- return path4.resolve(decodeURIComponent(withoutScheme));
21790
+ return path5.resolve(decodeURIComponent(withoutScheme));
21543
21791
  } catch {
21544
21792
  return null;
21545
21793
  }
21546
21794
  }
21547
21795
  }
21548
21796
  function displayPath(nativePath, cwd) {
21549
- const resolvedCwd = path4.resolve(cwd);
21550
- const resolvedPath = path4.resolve(nativePath);
21551
- const relative = path4.relative(resolvedCwd, resolvedPath);
21552
- const inside = relative.length > 0 && relative !== ".." && !relative.startsWith(`..${path4.sep}`);
21797
+ const resolvedCwd = path5.resolve(cwd);
21798
+ const resolvedPath = path5.resolve(nativePath);
21799
+ const relative = path5.relative(resolvedCwd, resolvedPath);
21800
+ const inside = relative.length > 0 && relative !== ".." && !relative.startsWith(`..${path5.sep}`);
21553
21801
  const selected = inside ? relative : resolvedPath;
21554
21802
  const normalized = selected.replaceAll("\\", "/");
21555
21803
  if (normalized.length === 0 || normalized === ".")
@@ -22155,7 +22403,7 @@ var KiroUsage = class {
22155
22403
  // dist/history.js
22156
22404
  import { access, readdir, readFile } from "node:fs/promises";
22157
22405
  import os2 from "node:os";
22158
- import path5 from "node:path";
22406
+ import path6 from "node:path";
22159
22407
 
22160
22408
  // dist/permission-modes.js
22161
22409
  var KIRO_DEFAULT_PERMISSION_MODE_ID = harnessPermissionModeIdSchema.parse("autopilot");
@@ -22191,12 +22439,12 @@ function isRecord10(value) {
22191
22439
  }
22192
22440
  function kiroHomeDir(environment = process.env) {
22193
22441
  const home = environment.HOME ?? environment.USERPROFILE ?? os2.homedir();
22194
- return environment.KIRO_HOME ?? path5.join(home, ".kiro");
22442
+ return environment.KIRO_HOME ?? path6.join(home, ".kiro");
22195
22443
  }
22196
22444
  async function locateKiroNativeSession(input, sessionId) {
22197
22445
  if (!sessionId || sessionId.trim().length === 0)
22198
22446
  return null;
22199
- const root = path5.join(input.homeDirectory ?? kiroHomeDir(input.environment), "sessions");
22447
+ const root = path6.join(input.homeDirectory ?? kiroHomeDir(input.environment), "sessions");
22200
22448
  let entries;
22201
22449
  try {
22202
22450
  entries = await readdir(root, { withFileTypes: true });
@@ -22206,14 +22454,14 @@ async function locateKiroNativeSession(input, sessionId) {
22206
22454
  for (const entry of entries) {
22207
22455
  if (!entry.isDirectory() || entry.name === "cli")
22208
22456
  continue;
22209
- const sessionDir = path5.join(root, entry.name, sessionId);
22210
- const metaFile = path5.join(sessionDir, "session.json");
22457
+ const sessionDir = path6.join(root, entry.name, sessionId);
22458
+ const metaFile = path6.join(sessionDir, "session.json");
22211
22459
  try {
22212
22460
  await access(metaFile);
22213
22461
  const content = await readFile(metaFile, "utf8");
22214
22462
  const meta3 = JSON.parse(content);
22215
22463
  if (meta3 && meta3.id === sessionId) {
22216
- const cwd = Array.isArray(meta3.workspacePaths) && meta3.workspacePaths.length > 0 ? path5.resolve(meta3.workspacePaths[0]) : process.cwd();
22464
+ const cwd = Array.isArray(meta3.workspacePaths) && meta3.workspacePaths.length > 0 ? path6.resolve(meta3.workspacePaths[0]) : process.cwd();
22217
22465
  return {
22218
22466
  sessionDirectory: sessionDir,
22219
22467
  sessionMeta: meta3,
@@ -22227,7 +22475,7 @@ async function locateKiroNativeSession(input, sessionId) {
22227
22475
  return null;
22228
22476
  }
22229
22477
  async function readKiroNativeMessages(sessionDirectory) {
22230
- const messagesFile = path5.join(sessionDirectory, "messages.jsonl");
22478
+ const messagesFile = path6.join(sessionDirectory, "messages.jsonl");
22231
22479
  const raw = await readFile(messagesFile, "utf8");
22232
22480
  return raw.split("\n").map((line) => line.trim()).filter((line) => line.length > 0).map((line) => {
22233
22481
  const row = JSON.parse(line);
@@ -22248,7 +22496,7 @@ async function readKiroSessionMessages(location, ancestors = /* @__PURE__ */ new
22248
22496
  if (first?.payload.operationType !== "Summary" || !location.sessionMeta.parentSessionId) {
22249
22497
  return rows;
22250
22498
  }
22251
- const parent = await locateKiroNativeSession({ homeDirectory: path5.resolve(location.sessionDirectory, "../../..") }, location.sessionMeta.parentSessionId);
22499
+ const parent = await locateKiroNativeSession({ homeDirectory: path6.resolve(location.sessionDirectory, "../../..") }, location.sessionMeta.parentSessionId);
22252
22500
  if (!parent)
22253
22501
  throw new Error("Kiro fork's archived parent history was not found");
22254
22502
  const parentRows = await readKiroSessionMessages(parent, ancestors);
@@ -22531,7 +22779,7 @@ var KiroAdapter = class {
22531
22779
  this.#deps = deps;
22532
22780
  }
22533
22781
  async inspect(input = {}) {
22534
- const cwd = path6.resolve(input.cwd ?? process.cwd());
22782
+ const cwd = path7.resolve(input.cwd ?? process.cwd());
22535
22783
  const cached2 = this.#inspectionCache.get(cwd);
22536
22784
  if (!input.refresh && cached2) {
22537
22785
  if (cached2.refreshAfter <= Date.now()) {
@@ -23643,13 +23891,36 @@ var KiroSession = class {
23643
23891
  }
23644
23892
  };
23645
23893
 
23894
+ // dist/installation.js
23895
+ function createKiroInstallation(environment, command) {
23896
+ return async (action) => {
23897
+ if (action === "update")
23898
+ throw new Error("Use Kiro CLI's original installer to update");
23899
+ const executable = resolveKiroExecutable({ environment, ...command ? { command } : {} });
23900
+ const currentVersion = versionFromOutput(await runInstallationCommand(executable, ["--version"], environment));
23901
+ return {
23902
+ currentVersion,
23903
+ latestVersion: "Unknown",
23904
+ updateAvailable: false,
23905
+ canUpdate: false,
23906
+ message: "Use Kiro CLI's original installer or native updater to check for and install updates."
23907
+ };
23908
+ };
23909
+ }
23910
+
23646
23911
  // dist/plugin.js
23647
23912
  var CODEXHOST_KIRO_COMMAND = "CODEXHOST_KIRO_COMMAND";
23648
23913
  function createHarnessAdapter(context) {
23649
23914
  const environment = { ...context.environment };
23650
- return new KiroAdapter({
23915
+ return Object.assign(new KiroAdapter({
23651
23916
  ...environment[CODEXHOST_KIRO_COMMAND] ? { command: environment[CODEXHOST_KIRO_COMMAND] } : {},
23652
23917
  environment
23918
+ }), {
23919
+ installation: createKiroInstallation(environment, environment[CODEXHOST_KIRO_COMMAND]),
23920
+ install: createHarnessInstaller(environment, {
23921
+ posix: "https://cli.kiro.dev/install",
23922
+ windows: "https://cli.kiro.dev/install.ps1"
23923
+ })
23653
23924
  });
23654
23925
  }
23655
23926
  export {