@liberseek/boft-cli-win32-arm64 0.7.6 → 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,368 @@ 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 createInstallationManager(options) {
273
+ let checking;
274
+ let updating;
275
+ const check2 = () => checking ??= options.check().finally(() => {
276
+ checking = void 0;
277
+ });
278
+ return (action) => {
279
+ if (updating)
280
+ return updating;
281
+ if (action === "check")
282
+ return check2();
283
+ updating = (async () => {
284
+ const before = await check2();
285
+ if (!before.updateAvailable)
286
+ return before;
287
+ if (!before.canUpdate)
288
+ throw new Error(before.message ?? "This installation cannot be updated automatically");
289
+ await options.update(before);
290
+ const after = await check2();
291
+ if (after.currentVersion === before.currentVersion)
292
+ throw new Error("The Harness version did not change; check the native updater and retry");
293
+ return after;
294
+ })().finally(() => {
295
+ updating = void 0;
296
+ });
297
+ return updating;
298
+ };
299
+ }
300
+ async function fetchInstallationText(url2) {
301
+ const request = async () => {
302
+ const response = await fetch(url2, { signal: AbortSignal.timeout(15e3) });
303
+ if (!response.ok)
304
+ throw new Error("Could not check the latest Harness version");
305
+ return response.text();
306
+ };
307
+ try {
308
+ return await request();
309
+ } catch (error51) {
310
+ if (error51 instanceof DOMException && (error51.name === "AbortError" || error51.name === "TimeoutError"))
311
+ throw error51;
312
+ return request();
313
+ }
314
+ }
315
+
316
+ // ../../harness-discovery/dist/installer.js
317
+ import { mkdtemp, rm, writeFile } from "node:fs/promises";
318
+ import { tmpdir } from "node:os";
319
+ import { join } from "node:path";
320
+ function createHarnessInstaller(environment, source) {
321
+ return async () => {
322
+ if (!["darwin", "linux", "win32"].includes(process.platform))
323
+ throw new Error("Unsupported installation platform");
324
+ const env = withNodeRuntimeOnPath(environment);
325
+ if ("npm" in source) {
326
+ const npm = resolveHarnessExecutable({
327
+ id: "npm",
328
+ command: "npm",
329
+ installRoots: {
330
+ posix: [
331
+ "~/.npm-global/bin",
332
+ "~/.local/bin",
333
+ VERSION_MANAGER_ROOTS,
334
+ "/opt/homebrew/bin",
335
+ "/usr/local/bin",
336
+ "/usr/bin"
337
+ ],
338
+ windows: [
339
+ "${APPDATA}/npm",
340
+ VERSION_MANAGER_ROOTS,
341
+ "${ProgramFiles}/nodejs",
342
+ "${LOCALAPPDATA}/Programs/nodejs"
343
+ ]
344
+ }
345
+ }, { environment: env });
346
+ if (!npm)
347
+ throw new Error("Install Node.js and npm first");
348
+ await runInstallationCommand(npm.executable, ["install", "--global", source.npm], {
349
+ ...env,
350
+ ...source.allowScripts ? { npm_config_allow_scripts: source.allowScripts } : {}
351
+ }, 6e5);
352
+ return;
353
+ }
354
+ const windows = process.platform === "win32";
355
+ const url2 = windows ? source.windows : source.posix;
356
+ if (new URL(url2).protocol !== "https:")
357
+ throw new Error("Installer requires HTTPS");
358
+ const script = await fetchInstallationText(url2);
359
+ const directory = await mkdtemp(join(tmpdir(), "codexhost-installer-"));
360
+ try {
361
+ const file2 = join(directory, windows ? "install.ps1" : "install.sh");
362
+ await writeFile(file2, script, { mode: 384 });
363
+ await runInstallationCommand(windows ? "powershell.exe" : source.shell ?? "bash", windows ? ["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-File", file2] : [file2], env, 6e5);
364
+ } finally {
365
+ await rm(directory, { recursive: true, force: true });
366
+ }
367
+ };
368
+ }
369
+
8
370
  // ../../../node_modules/zod/v4/classic/external.js
9
371
  var external_exports = {};
10
372
  __export(external_exports, {
@@ -14589,6 +14951,71 @@ var harnessDisplaySetSchema = external_exports.strictObject({
14589
14951
  initializeOnly: external_exports.boolean().optional()
14590
14952
  });
14591
14953
 
14954
+ // ../../shared-contracts/dist/ids.js
14955
+ var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
14956
+ message: "Identifier must not be empty or whitespace"
14957
+ });
14958
+ var harnessIdSchema = opaqueIdSchema.brand();
14959
+ var hostThreadIdSchema = opaqueIdSchema.brand();
14960
+ var hostTurnIdSchema = opaqueIdSchema.brand();
14961
+ var hostItemIdSchema = opaqueIdSchema.brand();
14962
+ var hostInteractionIdSchema = opaqueIdSchema.brand();
14963
+
14964
+ // ../../shared-contracts/dist/harness-plugins.js
14965
+ var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
14966
+ var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
14967
+ var HARNESS_PLUGIN_LIMIT = 128;
14968
+ 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);
14969
+ 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");
14970
+ var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
14971
+ var pluginPresentationShape = {
14972
+ id: harnessPluginIdSchema,
14973
+ name: external_exports.string().trim().min(1).max(128),
14974
+ version: external_exports.string().min(1).max(128),
14975
+ /** The factory accepts a persisted local entrypoint through its construction context. */
14976
+ launchCommand: external_exports.literal(true).optional(),
14977
+ links: external_exports.object({
14978
+ documentation: documentationUrlSchema.optional(),
14979
+ installation: documentationUrlSchema.optional()
14980
+ }).strict().optional()
14981
+ };
14982
+ var harnessPluginManifestSchema = external_exports.object({
14983
+ manifestVersion: external_exports.literal(1),
14984
+ ...pluginPresentationShape,
14985
+ adapterApiVersion: external_exports.number().int().positive(),
14986
+ entry: relativeResourceSchema,
14987
+ icon: relativeResourceSchema.optional()
14988
+ }).strict();
14989
+ 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);
14990
+ var harnessPluginDescriptorSchema = external_exports.object({
14991
+ ...pluginPresentationShape,
14992
+ icon: harnessPluginIconSchema.optional()
14993
+ }).strict();
14994
+ var harnessPluginListParamsSchema = external_exports.object({}).strict();
14995
+ var harnessPluginListResultSchema = external_exports.object({
14996
+ plugins: external_exports.array(harnessPluginDescriptorSchema).max(HARNESS_PLUGIN_LIMIT)
14997
+ }).strict();
14998
+ var harnessPluginConfigurationSchema = external_exports.object({
14999
+ version: external_exports.literal(1),
15000
+ enabled: external_exports.array(harnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
15001
+ }).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
15002
+ message: "Enabled plugin IDs must be unique",
15003
+ path: ["enabled"]
15004
+ });
15005
+
15006
+ // ../../shared-contracts/dist/harness-long-context.js
15007
+ var HARNESS_LONG_CONTEXT_GET_METHOD = "codexhost/harness/long-context/get";
15008
+ var HARNESS_LONG_CONTEXT_SET_METHOD = "codexhost/harness/long-context/set";
15009
+ var harnessLongContextGetSchema = external_exports.object({
15010
+ harnessId: harnessPluginIdSchema
15011
+ }).strict();
15012
+ var harnessLongContextSetSchema = harnessLongContextGetSchema.extend({
15013
+ enabled: external_exports.boolean()
15014
+ });
15015
+ var harnessLongContextSchema = external_exports.object({
15016
+ enabled: external_exports.boolean()
15017
+ }).strict();
15018
+
14592
15019
  // ../../shared-contracts/dist/console.js
14593
15020
  var consoleAnnouncementSchema = external_exports.strictObject({
14594
15021
  title: external_exports.string().trim().min(1).max(200),
@@ -14605,8 +15032,11 @@ var CONSOLE_HOST_METHODS = Object.freeze([
14605
15032
  "codexhost/harness/display-settings/get",
14606
15033
  "codexhost/harness/display-settings/set",
14607
15034
  "codexhost/harness/inspect",
15035
+ "codexhost/harness/installation",
14608
15036
  "codexhost/harness/launch-settings/get",
14609
15037
  "codexhost/harness/launch-settings/set",
15038
+ HARNESS_LONG_CONTEXT_GET_METHOD,
15039
+ HARNESS_LONG_CONTEXT_SET_METHOD,
14610
15040
  "codexhost/harness/web-ui/open",
14611
15041
  "codexhost/harness/accounts/sources",
14612
15042
  "codexhost/harness/accounts/list",
@@ -14666,16 +15096,6 @@ var loadedSessionsSchema = external_exports.array(external_exports.strictObject(
14666
15096
  inactiveMs: external_exports.number().nonnegative()
14667
15097
  }));
14668
15098
 
14669
- // ../../shared-contracts/dist/ids.js
14670
- var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
14671
- message: "Identifier must not be empty or whitespace"
14672
- });
14673
- var harnessIdSchema = opaqueIdSchema.brand();
14674
- var hostThreadIdSchema = opaqueIdSchema.brand();
14675
- var hostTurnIdSchema = opaqueIdSchema.brand();
14676
- var hostItemIdSchema = opaqueIdSchema.brand();
14677
- var hostInteractionIdSchema = opaqueIdSchema.brand();
14678
-
14679
15099
  // ../../shared-contracts/dist/manual-compaction.js
14680
15100
  var threadManualCompactionStartedSchema = external_exports.strictObject({
14681
15101
  threadId: hostThreadIdSchema,
@@ -15205,48 +15625,6 @@ var threadOwnershipListResultSchema = external_exports.object({
15205
15625
  }
15206
15626
  });
15207
15627
 
15208
- // ../../shared-contracts/dist/harness-plugins.js
15209
- var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
15210
- var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
15211
- var HARNESS_PLUGIN_LIMIT = 128;
15212
- 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);
15213
- 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");
15214
- var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
15215
- var pluginPresentationShape = {
15216
- id: harnessPluginIdSchema,
15217
- name: external_exports.string().trim().min(1).max(128),
15218
- version: external_exports.string().min(1).max(128),
15219
- /** The factory accepts a persisted local entrypoint through its construction context. */
15220
- launchCommand: external_exports.literal(true).optional(),
15221
- links: external_exports.object({
15222
- documentation: documentationUrlSchema.optional(),
15223
- installation: documentationUrlSchema.optional()
15224
- }).strict().optional()
15225
- };
15226
- var harnessPluginManifestSchema = external_exports.object({
15227
- manifestVersion: external_exports.literal(1),
15228
- ...pluginPresentationShape,
15229
- adapterApiVersion: external_exports.number().int().positive(),
15230
- entry: relativeResourceSchema,
15231
- icon: relativeResourceSchema.optional()
15232
- }).strict();
15233
- 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);
15234
- var harnessPluginDescriptorSchema = external_exports.object({
15235
- ...pluginPresentationShape,
15236
- icon: harnessPluginIconSchema.optional()
15237
- }).strict();
15238
- var harnessPluginListParamsSchema = external_exports.object({}).strict();
15239
- var harnessPluginListResultSchema = external_exports.object({
15240
- plugins: external_exports.array(harnessPluginDescriptorSchema).max(HARNESS_PLUGIN_LIMIT)
15241
- }).strict();
15242
- var harnessPluginConfigurationSchema = external_exports.object({
15243
- version: external_exports.literal(1),
15244
- enabled: external_exports.array(harnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
15245
- }).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
15246
- message: "Enabled plugin IDs must be unique",
15247
- path: ["enabled"]
15248
- });
15249
-
15250
15628
  // ../../shared-contracts/dist/harness-route.js
15251
15629
  var harnessPluginRouteSchema = external_exports.object({
15252
15630
  harnessId: harnessPluginIdSchema,
@@ -15271,7 +15649,7 @@ var harnessLaunchSettingsSchema = external_exports.object({
15271
15649
  // ../../shared-contracts/dist/harness-installation.js
15272
15650
  var harnessInstallationParamsSchema = external_exports.object({
15273
15651
  harnessId: harnessIdSchema,
15274
- action: external_exports.enum(["check", "update"])
15652
+ action: external_exports.enum(["check", "update", "install"])
15275
15653
  }).strict();
15276
15654
  var harnessInstallationStateSchema = external_exports.object({
15277
15655
  currentVersion: external_exports.string().min(1).max(128),
@@ -19943,391 +20321,96 @@ var ClientSideConnection = class {
19943
20321
  * Notifies the agent that a NES suggestion was accepted.
19944
20322
  *
19945
20323
  * @experimental
19946
- */
19947
- unstable_acceptNes(params) {
19948
- return this.connection.sendNotification(AGENT_METHODS.nes_accept, params);
19949
- }
19950
- /**
19951
- * **UNSTABLE**: This capability is not part of the spec yet, and may be removed or changed at any point.
19952
- *
19953
- * Notifies the agent that a NES suggestion was rejected.
19954
- *
19955
- * @experimental
19956
- */
19957
- unstable_rejectNes(params) {
19958
- return this.connection.sendNotification(AGENT_METHODS.nes_reject, params);
19959
- }
19960
- request(method, params, options) {
19961
- const spec = agentRequestSpecsByMethod[method];
19962
- return this.connection.sendRequest(method, params, spec?.mapResponse, options);
19963
- }
19964
- notify(method, params) {
19965
- return this.connection.sendNotification(method, params);
19966
- }
19967
- /**
19968
- * Extension method.
19969
- *
19970
- * @deprecated Use {@link request}.
19971
- */
19972
- extMethod(method, params) {
19973
- return this.request(method, params);
19974
- }
19975
- /**
19976
- * Extension notification.
19977
- *
19978
- * @deprecated Use {@link notify}.
19979
- */
19980
- extNotification(method, params) {
19981
- return this.notify(method, params);
19982
- }
19983
- /**
19984
- * AbortSignal that aborts when the connection closes.
19985
- *
19986
- * This signal can be used to:
19987
- * - Listen for connection closure: `connection.signal.addEventListener('abort', () => {...})`
19988
- * - Check connection status synchronously: `if (connection.signal.aborted) {...}`
19989
- * - Pass to other APIs (fetch, setTimeout) for automatic cancellation
19990
- *
19991
- * The connection closes when the underlying stream ends, either normally or due to an error.
19992
- *
19993
- * @example
19994
- * ```typescript
19995
- * const connection = new ClientSideConnection(client, stream);
19996
- *
19997
- * // Listen for closure
19998
- * connection.signal.addEventListener('abort', () => {
19999
- * console.log('Connection closed - performing cleanup');
20000
- * });
20001
- *
20002
- * // Check status
20003
- * if (connection.signal.aborted) {
20004
- * console.log('Connection is already closed');
20005
- * }
20006
- *
20007
- * // Pass to other APIs
20008
- * fetch(url, { signal: connection.signal });
20009
- * ```
20010
- */
20011
- get signal() {
20012
- return this.connection.signal;
20013
- }
20014
- /**
20015
- * Promise that resolves when the connection closes.
20016
- *
20017
- * The connection closes when the underlying stream ends, either normally or due to an error.
20018
- * Once closed, the connection cannot send or receive any more messages.
20019
- *
20020
- * This is useful for async/await style cleanup:
20021
- *
20022
- * @example
20023
- * ```typescript
20024
- * const connection = new ClientSideConnection(client, stream);
20025
- * await connection.closed;
20026
- * console.log('Connection closed - performing cleanup');
20027
- * ```
20028
- */
20029
- get closed() {
20030
- return this.connection.closed;
20031
- }
20032
- };
20033
-
20034
- // dist/command.js
20035
- import path4 from "node:path";
20036
-
20037
- // ../../harness-discovery/dist/environment.js
20038
- import fs from "node:fs";
20039
- import path from "node:path";
20040
- function targetPath(platform) {
20041
- return platform === "win32" ? path.win32 : path.posix;
20042
- }
20043
- function environmentValue(environment, name) {
20044
- const lowered = name.toLowerCase();
20045
- for (const [key, value] of Object.entries(environment)) {
20046
- if (key.toLowerCase() === lowered)
20047
- return value;
20048
- }
20049
- return void 0;
20050
- }
20051
- function pathDelimiter(platform) {
20052
- return platform === "win32" ? ";" : ":";
20053
- }
20054
- function pathDirectories(environment, platform) {
20055
- return (environmentValue(environment, "PATH") ?? "").split(pathDelimiter(platform)).map((directory) => directory.trim().replace(/^"|"$/gu, "")).filter(Boolean);
20056
- }
20057
- function executableExtensions(command, platform, environment) {
20058
- if (platform !== "win32")
20059
- return [""];
20060
- if (targetPath(platform).extname(command) !== "")
20061
- return [""];
20062
- return (environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").map((extension) => extension.trim()).filter(Boolean);
20063
- }
20064
- function isExecutableFile(filePath, platform) {
20065
- try {
20066
- fs.accessSync(filePath, platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK);
20067
- return fs.statSync(filePath).isFile();
20068
- } catch {
20069
- return false;
20070
- }
20071
- }
20072
- function subdirectoryNames(directory) {
20073
- try {
20074
- return fs.readdirSync(directory, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
20075
- } catch {
20076
- return [];
20077
- }
20078
- }
20079
- function newestFirst(names) {
20080
- return [...names].sort((left, right) => right.localeCompare(left, void 0, { numeric: true }));
20081
- }
20082
-
20083
- // ../../harness-discovery/dist/invocation.js
20084
- import path2 from "node:path";
20085
- function commandInvocation(command, arguments_, environment, platform = process.platform) {
20086
- const extension = path2.win32.extname(command).toLowerCase();
20087
- if (platform !== "win32" || ![".cmd", ".bat"].includes(extension)) {
20088
- return { command, arguments: [...arguments_], windowsVerbatimArguments: false };
20089
- }
20090
- const quote = (value) => `"${value.replaceAll("%", "%%").replaceAll('"', '""')}"`;
20091
- const commandLine = [command, ...arguments_].map(quote).join(" ");
20092
- return {
20093
- command: environmentValue(environment, "ComSpec") ?? "cmd.exe",
20094
- arguments: ["/d", "/v:off", "/s", "/c", `"${commandLine}"`],
20095
- windowsVerbatimArguments: true
20096
- };
20097
- }
20098
-
20099
- // ../../harness-discovery/dist/node-runtime.js
20100
- import path3 from "node:path";
20101
- function withNodeRuntimeOnPath(environment, runtimeExecutable = process.execPath, platform = process.platform) {
20102
- const pathKey = Object.keys(environment).find((name) => name.toLowerCase() === "path") ?? "PATH";
20103
- const delimiter = platform === "win32" ? ";" : ":";
20104
- const runtimeDirectory = path3.dirname(runtimeExecutable);
20105
- const directories = (environment[pathKey] ?? "").split(delimiter).filter(Boolean);
20106
- const equal = platform === "win32" ? (value) => value.toLowerCase() : (value) => value;
20107
- if (!directories.some((directory) => equal(directory) === equal(runtimeDirectory))) {
20108
- directories.push(runtimeDirectory);
20109
- }
20110
- return { ...environment, [pathKey]: directories.join(delimiter) };
20111
- }
20112
-
20113
- // ../../harness-discovery/dist/resolve.js
20114
- import os from "node:os";
20115
-
20116
- // ../../harness-discovery/dist/version-managers.js
20117
- function versionManagerBinaryDirectories(context) {
20118
- const { platform, environment, home } = context;
20119
- const list = context.subdirectories ?? subdirectoryNames;
20120
- const pathFlavor = targetPath(platform);
20121
- const value = (name) => environmentValue(environment, name);
20122
- const directories = [];
20123
- const versioned = (root, ...tail) => {
20124
- for (const version2 of newestFirst(list(root))) {
20125
- directories.push(pathFlavor.join(root, version2, ...tail));
20126
- }
20127
- };
20128
- if (platform === "win32") {
20129
- const appData = value("APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming");
20130
- const localAppData = value("LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local");
20131
- versioned(pathFlavor.join(appData, "nvm"));
20132
- versioned(value("FNM_DIR") ?? pathFlavor.join(appData, "fnm", "node-versions"), "installation");
20133
- directories.push(pathFlavor.join(localAppData, "Volta", "bin"));
20134
- directories.push(pathFlavor.join(home, ".bun", "bin"));
20135
- const pnpmHome2 = value("PNPM_HOME");
20136
- if (pnpmHome2)
20137
- directories.push(pnpmHome2);
20138
- directories.push(pathFlavor.join(localAppData, "pnpm"));
20139
- return directories;
20140
- }
20141
- versioned(pathFlavor.join(value("NVM_DIR") ?? pathFlavor.join(home, ".nvm"), "versions", "node"), "bin");
20142
- const fnmRoots = [
20143
- value("FNM_DIR"),
20144
- pathFlavor.join(home, ".local", "share", "fnm"),
20145
- pathFlavor.join(home, "Library", "Application Support", "fnm")
20146
- ].filter((root) => root !== void 0);
20147
- for (const root of fnmRoots) {
20148
- versioned(pathFlavor.join(root, "node-versions"), "installation", "bin");
20324
+ */
20325
+ unstable_acceptNes(params) {
20326
+ return this.connection.sendNotification(AGENT_METHODS.nes_accept, params);
20149
20327
  }
20150
- const voltaHome = value("VOLTA_HOME") ?? pathFlavor.join(home, ".volta");
20151
- versioned(pathFlavor.join(voltaHome, "tools", "image", "node"), "bin");
20152
- directories.push(pathFlavor.join(voltaHome, "bin"));
20153
- const asdfHome = value("ASDF_DATA_DIR") ?? pathFlavor.join(home, ".asdf");
20154
- versioned(pathFlavor.join(asdfHome, "installs", "nodejs"), "bin");
20155
- directories.push(pathFlavor.join(asdfHome, "shims"));
20156
- const nodenvHome = value("NODENV_ROOT") ?? pathFlavor.join(home, ".nodenv");
20157
- versioned(pathFlavor.join(nodenvHome, "versions"), "bin");
20158
- directories.push(pathFlavor.join(nodenvHome, "shims"));
20159
- versioned(pathFlavor.join(value("N_PREFIX") ?? "/usr/local", "n", "versions", "node"), "bin");
20160
- directories.push(pathFlavor.join(home, ".bun", "bin"));
20161
- const pnpmHome = value("PNPM_HOME");
20162
- if (pnpmHome)
20163
- directories.push(pnpmHome);
20164
- directories.push(pathFlavor.join(home, "Library", "pnpm"));
20165
- directories.push(pathFlavor.join(home, ".local", "share", "pnpm"));
20166
- for (const prefix of ["/opt/homebrew/opt", "/usr/local/opt"]) {
20167
- for (const formula of newestFirst(list(prefix).filter((name) => name.startsWith("node@")))) {
20168
- directories.push(pathFlavor.join(prefix, formula, "bin"));
20169
- }
20328
+ /**
20329
+ * **UNSTABLE**: This capability is not part of the spec yet, and may be removed or changed at any point.
20330
+ *
20331
+ * Notifies the agent that a NES suggestion was rejected.
20332
+ *
20333
+ * @experimental
20334
+ */
20335
+ unstable_rejectNes(params) {
20336
+ return this.connection.sendNotification(AGENT_METHODS.nes_reject, params);
20170
20337
  }
20171
- return directories;
20172
- }
20173
-
20174
- // ../../harness-discovery/dist/resolve.js
20175
- var VERSION_MANAGER_ROOTS = "<version-managers>";
20176
- function installRootExtensions(platform) {
20177
- return platform === "win32" ? [".exe", ".cmd"] : [""];
20178
- }
20179
- function resolveHomeDirectory(input) {
20180
- return input.homeDirectory ?? environmentValue(input.environment, "HOME") ?? environmentValue(input.environment, "USERPROFILE") ?? os.homedir();
20181
- }
20182
- function templateVariables(environment, platform, home) {
20183
- const pathFlavor = targetPath(platform);
20184
- return {
20185
- HOME: home,
20186
- USERPROFILE: home,
20187
- APPDATA: environmentValue(environment, "APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming"),
20188
- LOCALAPPDATA: environmentValue(environment, "LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local")
20189
- };
20190
- }
20191
- function joinTemplate(platform, value) {
20192
- const pathFlavor = targetPath(platform);
20193
- const segments = value.split("/");
20194
- const head = segments[0] ?? "";
20195
- const tail = segments.slice(1);
20196
- if (head === "")
20197
- return pathFlavor.join(pathFlavor.sep, ...tail);
20198
- return tail.length === 0 ? head : pathFlavor.join(head, ...tail);
20199
- }
20200
- function expandInstallRoot(template, environment, platform, home) {
20201
- const variables = templateVariables(environment, platform, home);
20202
- let unresolved = false;
20203
- const substituted = template.replace(/^~(?=\/|$)/u, home).replace(/\$\{(\w+)\}/gu, (_match, name) => {
20204
- const value = variables[name] ?? environmentValue(environment, name);
20205
- if (value === void 0 || value === "") {
20206
- unresolved = true;
20207
- return "";
20208
- }
20209
- return value;
20210
- });
20211
- return unresolved ? void 0 : joinTemplate(platform, substituted);
20212
- }
20213
- function installRootDirectories(spec, input, dependencies, platform, home) {
20214
- const templates = (platform === "win32" ? spec.installRoots?.windows : spec.installRoots?.posix) ?? [];
20215
- const directories = [];
20216
- for (const template of templates) {
20217
- if (template === VERSION_MANAGER_ROOTS) {
20218
- directories.push(...versionManagerBinaryDirectories({
20219
- platform,
20220
- environment: input.environment,
20221
- home,
20222
- ...dependencies.subdirectories ? { subdirectories: dependencies.subdirectories } : {}
20223
- }));
20224
- continue;
20225
- }
20226
- const directory = expandInstallRoot(template, input.environment, platform, home);
20227
- if (directory !== void 0)
20228
- directories.push(directory);
20338
+ request(method, params, options) {
20339
+ const spec = agentRequestSpecsByMethod[method];
20340
+ return this.connection.sendRequest(method, params, spec?.mapResponse, options);
20229
20341
  }
20230
- return directories;
20231
- }
20232
- function harnessCandidates(spec, input, dependencies = {}) {
20233
- const platform = input.platform ?? process.platform;
20234
- const pathFlavor = targetPath(platform);
20235
- const configured = input.command ?? (spec.commandEnvironmentVariable ? environmentValue(input.environment, spec.commandEnvironmentVariable) : void 0);
20236
- const command = configured ?? spec.command;
20237
- if (pathFlavor.isAbsolute(command) || command.includes("/") || command.includes("\\")) {
20238
- return [{ candidate: command, source: "configured" }];
20342
+ notify(method, params) {
20343
+ return this.connection.sendNotification(method, params);
20239
20344
  }
20240
- const candidates = [];
20241
- const extensions = executableExtensions(command, platform, input.environment);
20242
- for (const directory of pathDirectories(input.environment, platform)) {
20243
- for (const extension of extensions) {
20244
- candidates.push({
20245
- candidate: pathFlavor.join(directory, command + extension),
20246
- source: "path"
20247
- });
20248
- }
20345
+ /**
20346
+ * Extension method.
20347
+ *
20348
+ * @deprecated Use {@link request}.
20349
+ */
20350
+ extMethod(method, params) {
20351
+ return this.request(method, params);
20249
20352
  }
20250
- if (configured !== void 0)
20251
- return candidates;
20252
- const home = resolveHomeDirectory(input);
20253
- for (const directory of installRootDirectories(spec, input, dependencies, platform, home)) {
20254
- for (const extension of installRootExtensions(platform)) {
20255
- candidates.push({
20256
- candidate: pathFlavor.join(directory, spec.command + extension),
20257
- source: "install-root"
20258
- });
20259
- }
20353
+ /**
20354
+ * Extension notification.
20355
+ *
20356
+ * @deprecated Use {@link notify}.
20357
+ */
20358
+ extNotification(method, params) {
20359
+ return this.notify(method, params);
20260
20360
  }
20261
- return candidates;
20262
- }
20263
- function resolveHarnessExecutable(spec, input, dependencies = {}) {
20264
- const platform = input.platform ?? process.platform;
20265
- const isExecutable = dependencies.isExecutable ?? ((candidate) => isExecutableFile(candidate, platform));
20266
- const runnable = spec.runnableCandidate ?? ((candidate) => candidate);
20267
- const context = { platform, isExecutable };
20268
- for (const { candidate, source } of harnessCandidates(spec, input, dependencies)) {
20269
- const executable = runnable(candidate, context);
20270
- if (executable !== void 0 && isExecutable(executable))
20271
- return { executable, source };
20361
+ /**
20362
+ * AbortSignal that aborts when the connection closes.
20363
+ *
20364
+ * This signal can be used to:
20365
+ * - Listen for connection closure: `connection.signal.addEventListener('abort', () => {...})`
20366
+ * - Check connection status synchronously: `if (connection.signal.aborted) {...}`
20367
+ * - Pass to other APIs (fetch, setTimeout) for automatic cancellation
20368
+ *
20369
+ * The connection closes when the underlying stream ends, either normally or due to an error.
20370
+ *
20371
+ * @example
20372
+ * ```typescript
20373
+ * const connection = new ClientSideConnection(client, stream);
20374
+ *
20375
+ * // Listen for closure
20376
+ * connection.signal.addEventListener('abort', () => {
20377
+ * console.log('Connection closed - performing cleanup');
20378
+ * });
20379
+ *
20380
+ * // Check status
20381
+ * if (connection.signal.aborted) {
20382
+ * console.log('Connection is already closed');
20383
+ * }
20384
+ *
20385
+ * // Pass to other APIs
20386
+ * fetch(url, { signal: connection.signal });
20387
+ * ```
20388
+ */
20389
+ get signal() {
20390
+ return this.connection.signal;
20272
20391
  }
20273
- return void 0;
20274
- }
20275
-
20276
- // ../../harness-discovery/dist/installation.js
20277
- import { execFile } from "node:child_process";
20278
- import { homedir } from "node:os";
20279
- function runInstallationCommand(command, args, environment, timeout = 3e4) {
20280
- const env = withNodeRuntimeOnPath(environment);
20281
- const invocation = /\.[cm]?js$/i.test(command) ? commandInvocation(process.execPath, [command, ...args], env) : commandInvocation(command, args, env);
20282
- return new Promise((resolve, reject) => {
20283
- const child = execFile(invocation.command, invocation.arguments, {
20284
- env,
20285
- cwd: env.HOME ?? env.USERPROFILE ?? homedir(),
20286
- encoding: "utf8",
20287
- timeout,
20288
- killSignal: "SIGKILL",
20289
- maxBuffer: 1024 * 1024,
20290
- windowsHide: true,
20291
- windowsVerbatimArguments: invocation.windowsVerbatimArguments
20292
- }, (error51, stdout, stderr) => {
20293
- if (error51)
20294
- reject(new Error(error51.killed ? "Harness command timed out" : "Harness command failed; check the native installation and retry"));
20295
- else
20296
- resolve((stdout || stderr).trim());
20297
- });
20298
- child.stdin?.end();
20299
- });
20300
- }
20301
- function createInstallationManager(options) {
20302
- let checking;
20303
- let updating;
20304
- const check2 = () => checking ??= options.check().finally(() => {
20305
- checking = void 0;
20306
- });
20307
- return (action) => {
20308
- if (updating)
20309
- return updating;
20310
- if (action === "check")
20311
- return check2();
20312
- updating = (async () => {
20313
- const before = await check2();
20314
- if (!before.updateAvailable)
20315
- return before;
20316
- if (!before.canUpdate)
20317
- throw new Error(before.message ?? "This installation cannot be updated automatically");
20318
- await options.update(before);
20319
- const after = await check2();
20320
- if (after.currentVersion === before.currentVersion)
20321
- throw new Error("The Harness version did not change; check the native updater and retry");
20322
- return after;
20323
- })().finally(() => {
20324
- updating = void 0;
20325
- });
20326
- return updating;
20327
- };
20328
- }
20392
+ /**
20393
+ * Promise that resolves when the connection closes.
20394
+ *
20395
+ * The connection closes when the underlying stream ends, either normally or due to an error.
20396
+ * Once closed, the connection cannot send or receive any more messages.
20397
+ *
20398
+ * This is useful for async/await style cleanup:
20399
+ *
20400
+ * @example
20401
+ * ```typescript
20402
+ * const connection = new ClientSideConnection(client, stream);
20403
+ * await connection.closed;
20404
+ * console.log('Connection closed - performing cleanup');
20405
+ * ```
20406
+ */
20407
+ get closed() {
20408
+ return this.connection.closed;
20409
+ }
20410
+ };
20329
20411
 
20330
20412
  // dist/command.js
20413
+ import path4 from "node:path";
20331
20414
  var HermesExecutableError = class extends Error {
20332
20415
  code = "HERMES_NOT_FOUND";
20333
20416
  };
@@ -22549,7 +22632,7 @@ import { access as access2 } from "node:fs/promises";
22549
22632
  import { createInterface } from "node:readline";
22550
22633
 
22551
22634
  // dist/gateway-delegation.js
22552
- import { mkdtemp, writeFile, rm } from "node:fs/promises";
22635
+ import { mkdtemp as mkdtemp2, writeFile as writeFile2, rm as rm2 } from "node:fs/promises";
22553
22636
  import os2 from "node:os";
22554
22637
  import path6 from "node:path";
22555
22638
  var HERMES_DELEGATION_GUIDANCE = `This Session runs inside codexhost.
@@ -22564,10 +22647,10 @@ async function prepareGatewayDelegation(environment) {
22564
22647
  if (!required2.every((key) => environment[key]))
22565
22648
  return { environment, bootstrap: "", dispose: async () => {
22566
22649
  } };
22567
- const directory = await mkdtemp(path6.join(os2.tmpdir(), "codexhost-hermes-delegation-"));
22650
+ const directory = await mkdtemp2(path6.join(os2.tmpdir(), "codexhost-hermes-delegation-"));
22568
22651
  const file2 = path6.join(directory, "SKILL.md");
22569
22652
  try {
22570
- await writeFile(file2, `---
22653
+ await writeFile2(file2, `---
22571
22654
  name: delegation
22572
22655
  description: Discover authorized codexhost agent collaboration.
22573
22656
  ---
@@ -22587,10 +22670,10 @@ from hermes_cli.plugins import PluginContext, PluginManifest, get_plugin_manager
22587
22670
  PluginContext(PluginManifest(name="codexhost-runtime"), get_plugin_manager()).register_skill(
22588
22671
  "delegation", Path(${JSON.stringify(file2)}))
22589
22672
  `,
22590
- dispose: () => rm(directory, { recursive: true, force: true })
22673
+ dispose: () => rm2(directory, { recursive: true, force: true })
22591
22674
  };
22592
22675
  } catch (error51) {
22593
- await rm(directory, { recursive: true, force: true });
22676
+ await rm2(directory, { recursive: true, force: true });
22594
22677
  throw error51;
22595
22678
  }
22596
22679
  }
@@ -24379,7 +24462,13 @@ function createHarnessAdapter(context) {
24379
24462
  return Object.assign(new HermesAdapter({
24380
24463
  ...environment[HERMES_COMMAND_ENV] ? { command: environment[HERMES_COMMAND_ENV] } : {},
24381
24464
  environment
24382
- }), { installation: createHermesInstallation(environment, environment[HERMES_COMMAND_ENV]) });
24465
+ }), {
24466
+ installation: createHermesInstallation(environment, environment[HERMES_COMMAND_ENV]),
24467
+ install: createHarnessInstaller(environment, {
24468
+ posix: "https://hermes-agent.nousresearch.com/install.sh",
24469
+ windows: "https://hermes-agent.nousresearch.com/install.ps1"
24470
+ })
24471
+ });
24383
24472
  }
24384
24473
  export {
24385
24474
  HERMES_COMMAND_ENV,