@liberseek/boft-cli-linux-x64 0.7.6 → 0.7.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +85 -61
- package/app/console-web.js +678 -182
- package/app/desktop-controller.mjs +84 -22
- package/app/host-runtime.mjs +540 -132
- package/app/plugins/antigravity/plugin.mjs +809 -718
- package/app/plugins/claude-code/plugin.mjs +281 -117
- package/app/plugins/codebuddy/plugin.mjs +739 -664
- package/app/plugins/cursor-cli/plugin.mjs +451 -359
- package/app/plugins/deepseek-harness/plugin.mjs +25477 -26255
- package/app/plugins/grok/plugin.mjs +1405 -1313
- package/app/plugins/hermes/plugin.mjs +621 -472
- package/app/plugins/kimi-code/plugin.mjs +754 -674
- package/app/plugins/kiro-cli/plugin.mjs +15836 -15742
- package/app/plugins/muse/plugin.mjs +74 -55
- package/app/plugins/omp/plugin.mjs +1669 -1551
- package/app/plugins/opencode/plugin.mjs +745 -668
- package/app/plugins/pi/plugin.mjs +15810 -15699
- package/app/plugins/qoder/plugin.mjs +515 -393
- package/app/plugins/qoder-cn/plugin.mjs +181 -57
- package/app/plugins/workbuddy/plugin.mjs +74 -55
- package/app/renderer-extension.js +945 -379
- package/bin/boft +0 -0
- package/libexec/boft-shim +0 -0
- package/libexec/boft-updater +0 -0
- package/package.json +1 -1
|
@@ -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,
|
|
@@ -15180,71 +15600,29 @@ var codexThreadOwnershipSchema = external_exports.object({
|
|
|
15180
15600
|
threadId: hostThreadIdSchema,
|
|
15181
15601
|
owner: external_exports.literal("codex")
|
|
15182
15602
|
}).strict();
|
|
15183
|
-
var externalThreadOwnershipSchema = external_exports.object({
|
|
15184
|
-
threadId: hostThreadIdSchema,
|
|
15185
|
-
owner: external_exports.literal("external"),
|
|
15186
|
-
harnessId: external_exports.string().max(256).pipe(harnessIdSchema)
|
|
15187
|
-
}).strict();
|
|
15188
|
-
var threadOwnershipSchema = external_exports.discriminatedUnion("owner", [
|
|
15189
|
-
codexThreadOwnershipSchema,
|
|
15190
|
-
externalThreadOwnershipSchema
|
|
15191
|
-
]);
|
|
15192
|
-
var threadOwnershipListResultSchema = external_exports.object({
|
|
15193
|
-
threads: external_exports.array(threadOwnershipSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
|
|
15194
|
-
}).strict().superRefine(({ threads }, context) => {
|
|
15195
|
-
const seen = /* @__PURE__ */ new Set();
|
|
15196
|
-
for (const [index, thread] of threads.entries()) {
|
|
15197
|
-
if (seen.has(thread.threadId)) {
|
|
15198
|
-
context.addIssue({
|
|
15199
|
-
code: "custom",
|
|
15200
|
-
message: "Thread ownership-list results must be unique",
|
|
15201
|
-
path: ["threads", index, "threadId"]
|
|
15202
|
-
});
|
|
15203
|
-
}
|
|
15204
|
-
seen.add(thread.threadId);
|
|
15205
|
-
}
|
|
15206
|
-
});
|
|
15207
|
-
|
|
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)
|
|
15603
|
+
var externalThreadOwnershipSchema = external_exports.object({
|
|
15604
|
+
threadId: hostThreadIdSchema,
|
|
15605
|
+
owner: external_exports.literal("external"),
|
|
15606
|
+
harnessId: external_exports.string().max(256).pipe(harnessIdSchema)
|
|
15241
15607
|
}).strict();
|
|
15242
|
-
var
|
|
15243
|
-
|
|
15244
|
-
|
|
15245
|
-
|
|
15246
|
-
|
|
15247
|
-
|
|
15608
|
+
var threadOwnershipSchema = external_exports.discriminatedUnion("owner", [
|
|
15609
|
+
codexThreadOwnershipSchema,
|
|
15610
|
+
externalThreadOwnershipSchema
|
|
15611
|
+
]);
|
|
15612
|
+
var threadOwnershipListResultSchema = external_exports.object({
|
|
15613
|
+
threads: external_exports.array(threadOwnershipSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
|
|
15614
|
+
}).strict().superRefine(({ threads }, context) => {
|
|
15615
|
+
const seen = /* @__PURE__ */ new Set();
|
|
15616
|
+
for (const [index, thread] of threads.entries()) {
|
|
15617
|
+
if (seen.has(thread.threadId)) {
|
|
15618
|
+
context.addIssue({
|
|
15619
|
+
code: "custom",
|
|
15620
|
+
message: "Thread ownership-list results must be unique",
|
|
15621
|
+
path: ["threads", index, "threadId"]
|
|
15622
|
+
});
|
|
15623
|
+
}
|
|
15624
|
+
seen.add(thread.threadId);
|
|
15625
|
+
}
|
|
15248
15626
|
});
|
|
15249
15627
|
|
|
15250
15628
|
// ../../shared-contracts/dist/harness-route.js
|
|
@@ -15271,14 +15649,17 @@ 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),
|
|
15278
15656
|
latestVersion: external_exports.string().min(1).max(128),
|
|
15279
15657
|
updateAvailable: external_exports.boolean(),
|
|
15280
15658
|
canUpdate: external_exports.boolean(),
|
|
15281
|
-
|
|
15659
|
+
// Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
|
|
15660
|
+
message: external_exports.string().max(2048).optional(),
|
|
15661
|
+
messageCode: external_exports.string().min(1).max(128).optional(),
|
|
15662
|
+
latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
|
|
15282
15663
|
}).strict();
|
|
15283
15664
|
|
|
15284
15665
|
// ../../shared-contracts/dist/codex-accounts.js
|
|
@@ -15573,7 +15954,7 @@ var updateStatusSchema = external_exports.strictObject({
|
|
|
15573
15954
|
}
|
|
15574
15955
|
});
|
|
15575
15956
|
var updateEmptyParamsSchema = external_exports.strictObject({});
|
|
15576
|
-
var githubReleaseNotesUrlSchema = external_exports.string().max(300).regex(/^https:\/\/github\.com\/LiberSeek\/BOFT-CLI\/releases\/tag\/v[0-9A-Za-z.+-]+$/u, "release notes URL must identify a codexhost GitHub Release");
|
|
15957
|
+
var githubReleaseNotesUrlSchema = external_exports.string().max(300).regex(/^https:\/\/github\.com\/(LiberSeek|LIBERSEEK)\/BOFT-CLI\/releases\/tag\/v[0-9A-Za-z.+-]+$/u, "release notes URL must identify a codexhost GitHub Release");
|
|
15577
15958
|
var updateCheckResultSchema = external_exports.strictObject({
|
|
15578
15959
|
currentVersion: updateSemanticVersionSchema,
|
|
15579
15960
|
installation: updateInstallationSchema.nullable(),
|
|
@@ -19939,395 +20320,100 @@ var ClientSideConnection = class {
|
|
|
19939
20320
|
}
|
|
19940
20321
|
/**
|
|
19941
20322
|
* **UNSTABLE**: This capability is not part of the spec yet, and may be removed or changed at any point.
|
|
19942
|
-
*
|
|
19943
|
-
* Notifies the agent that a NES suggestion was accepted.
|
|
19944
|
-
*
|
|
19945
|
-
* @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");
|
|
20149
|
-
}
|
|
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
|
-
}
|
|
20323
|
+
*
|
|
20324
|
+
* Notifies the agent that a NES suggestion was accepted.
|
|
20325
|
+
*
|
|
20326
|
+
* @experimental
|
|
20327
|
+
*/
|
|
20328
|
+
unstable_acceptNes(params) {
|
|
20329
|
+
return this.connection.sendNotification(AGENT_METHODS.nes_accept, params);
|
|
20170
20330
|
}
|
|
20171
|
-
|
|
20172
|
-
|
|
20173
|
-
|
|
20174
|
-
|
|
20175
|
-
|
|
20176
|
-
|
|
20177
|
-
|
|
20178
|
-
|
|
20179
|
-
|
|
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);
|
|
20331
|
+
/**
|
|
20332
|
+
* **UNSTABLE**: This capability is not part of the spec yet, and may be removed or changed at any point.
|
|
20333
|
+
*
|
|
20334
|
+
* Notifies the agent that a NES suggestion was rejected.
|
|
20335
|
+
*
|
|
20336
|
+
* @experimental
|
|
20337
|
+
*/
|
|
20338
|
+
unstable_rejectNes(params) {
|
|
20339
|
+
return this.connection.sendNotification(AGENT_METHODS.nes_reject, params);
|
|
20229
20340
|
}
|
|
20230
|
-
|
|
20231
|
-
|
|
20232
|
-
|
|
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" }];
|
|
20341
|
+
request(method, params, options) {
|
|
20342
|
+
const spec = agentRequestSpecsByMethod[method];
|
|
20343
|
+
return this.connection.sendRequest(method, params, spec?.mapResponse, options);
|
|
20239
20344
|
}
|
|
20240
|
-
|
|
20241
|
-
|
|
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
|
+
notify(method, params) {
|
|
20346
|
+
return this.connection.sendNotification(method, params);
|
|
20249
20347
|
}
|
|
20250
|
-
|
|
20251
|
-
|
|
20252
|
-
|
|
20253
|
-
|
|
20254
|
-
|
|
20255
|
-
|
|
20256
|
-
|
|
20257
|
-
source: "install-root"
|
|
20258
|
-
});
|
|
20259
|
-
}
|
|
20348
|
+
/**
|
|
20349
|
+
* Extension method.
|
|
20350
|
+
*
|
|
20351
|
+
* @deprecated Use {@link request}.
|
|
20352
|
+
*/
|
|
20353
|
+
extMethod(method, params) {
|
|
20354
|
+
return this.request(method, params);
|
|
20260
20355
|
}
|
|
20261
|
-
|
|
20262
|
-
|
|
20263
|
-
|
|
20264
|
-
|
|
20265
|
-
|
|
20266
|
-
|
|
20267
|
-
|
|
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 };
|
|
20356
|
+
/**
|
|
20357
|
+
* Extension notification.
|
|
20358
|
+
*
|
|
20359
|
+
* @deprecated Use {@link notify}.
|
|
20360
|
+
*/
|
|
20361
|
+
extNotification(method, params) {
|
|
20362
|
+
return this.notify(method, params);
|
|
20272
20363
|
}
|
|
20273
|
-
|
|
20274
|
-
|
|
20275
|
-
|
|
20276
|
-
|
|
20277
|
-
|
|
20278
|
-
|
|
20279
|
-
|
|
20280
|
-
|
|
20281
|
-
|
|
20282
|
-
|
|
20283
|
-
|
|
20284
|
-
|
|
20285
|
-
|
|
20286
|
-
|
|
20287
|
-
|
|
20288
|
-
|
|
20289
|
-
|
|
20290
|
-
|
|
20291
|
-
|
|
20292
|
-
|
|
20293
|
-
|
|
20294
|
-
|
|
20295
|
-
|
|
20296
|
-
|
|
20297
|
-
|
|
20298
|
-
|
|
20299
|
-
|
|
20300
|
-
|
|
20301
|
-
|
|
20302
|
-
|
|
20303
|
-
|
|
20304
|
-
|
|
20305
|
-
|
|
20306
|
-
|
|
20307
|
-
|
|
20308
|
-
|
|
20309
|
-
|
|
20310
|
-
|
|
20311
|
-
|
|
20312
|
-
|
|
20313
|
-
|
|
20314
|
-
|
|
20315
|
-
|
|
20316
|
-
|
|
20317
|
-
|
|
20318
|
-
|
|
20319
|
-
|
|
20320
|
-
|
|
20321
|
-
|
|
20322
|
-
|
|
20323
|
-
})().finally(() => {
|
|
20324
|
-
updating = void 0;
|
|
20325
|
-
});
|
|
20326
|
-
return updating;
|
|
20327
|
-
};
|
|
20328
|
-
}
|
|
20364
|
+
/**
|
|
20365
|
+
* AbortSignal that aborts when the connection closes.
|
|
20366
|
+
*
|
|
20367
|
+
* This signal can be used to:
|
|
20368
|
+
* - Listen for connection closure: `connection.signal.addEventListener('abort', () => {...})`
|
|
20369
|
+
* - Check connection status synchronously: `if (connection.signal.aborted) {...}`
|
|
20370
|
+
* - Pass to other APIs (fetch, setTimeout) for automatic cancellation
|
|
20371
|
+
*
|
|
20372
|
+
* The connection closes when the underlying stream ends, either normally or due to an error.
|
|
20373
|
+
*
|
|
20374
|
+
* @example
|
|
20375
|
+
* ```typescript
|
|
20376
|
+
* const connection = new ClientSideConnection(client, stream);
|
|
20377
|
+
*
|
|
20378
|
+
* // Listen for closure
|
|
20379
|
+
* connection.signal.addEventListener('abort', () => {
|
|
20380
|
+
* console.log('Connection closed - performing cleanup');
|
|
20381
|
+
* });
|
|
20382
|
+
*
|
|
20383
|
+
* // Check status
|
|
20384
|
+
* if (connection.signal.aborted) {
|
|
20385
|
+
* console.log('Connection is already closed');
|
|
20386
|
+
* }
|
|
20387
|
+
*
|
|
20388
|
+
* // Pass to other APIs
|
|
20389
|
+
* fetch(url, { signal: connection.signal });
|
|
20390
|
+
* ```
|
|
20391
|
+
*/
|
|
20392
|
+
get signal() {
|
|
20393
|
+
return this.connection.signal;
|
|
20394
|
+
}
|
|
20395
|
+
/**
|
|
20396
|
+
* Promise that resolves when the connection closes.
|
|
20397
|
+
*
|
|
20398
|
+
* The connection closes when the underlying stream ends, either normally or due to an error.
|
|
20399
|
+
* Once closed, the connection cannot send or receive any more messages.
|
|
20400
|
+
*
|
|
20401
|
+
* This is useful for async/await style cleanup:
|
|
20402
|
+
*
|
|
20403
|
+
* @example
|
|
20404
|
+
* ```typescript
|
|
20405
|
+
* const connection = new ClientSideConnection(client, stream);
|
|
20406
|
+
* await connection.closed;
|
|
20407
|
+
* console.log('Connection closed - performing cleanup');
|
|
20408
|
+
* ```
|
|
20409
|
+
*/
|
|
20410
|
+
get closed() {
|
|
20411
|
+
return this.connection.closed;
|
|
20412
|
+
}
|
|
20413
|
+
};
|
|
20329
20414
|
|
|
20330
20415
|
// dist/command.js
|
|
20416
|
+
import path4 from "node:path";
|
|
20331
20417
|
var HermesExecutableError = class extends Error {
|
|
20332
20418
|
code = "HERMES_NOT_FOUND";
|
|
20333
20419
|
};
|
|
@@ -20772,8 +20858,9 @@ var HermesAcpTransport = class {
|
|
|
20772
20858
|
};
|
|
20773
20859
|
|
|
20774
20860
|
// dist/hermes-inventory.js
|
|
20775
|
-
import { spawn as spawn2 } from "node:child_process";
|
|
20861
|
+
import { execFile as execFile2, spawn as spawn2 } from "node:child_process";
|
|
20776
20862
|
import { access, readFile } from "node:fs/promises";
|
|
20863
|
+
import { promisify } from "node:util";
|
|
20777
20864
|
import path5 from "node:path";
|
|
20778
20865
|
|
|
20779
20866
|
// dist/hermes-models.js
|
|
@@ -20933,10 +21020,18 @@ for row in payload.get("providers") or []:
|
|
|
20933
21020
|
current_provider = str(getattr(context, "current_provider", "") or "").strip()
|
|
20934
21021
|
current_model = str(getattr(context, "current_model", "") or "").strip()
|
|
20935
21022
|
current_model_id = current_provider + ":" + current_model if current_provider and current_model else None
|
|
20936
|
-
|
|
21023
|
+
from hermes_cli import main as native_main
|
|
21024
|
+
check_configured = getattr(native_main, "_has_any_provider_configured", None)
|
|
21025
|
+
configured = bool(check_configured()) if callable(check_configured) else None
|
|
21026
|
+
print("codexhost_inventory=" + json.dumps({"models": rows, "currentModelId": current_model_id, "configured": configured}))
|
|
20937
21027
|
`;
|
|
20938
21028
|
var HermesInventoryError = class extends Error {
|
|
20939
21029
|
};
|
|
21030
|
+
var HermesConfigurationRequiredError = class extends HermesInventoryError {
|
|
21031
|
+
constructor() {
|
|
21032
|
+
super("Hermes has no configured Provider or API key. Run `hermes setup`, then check the connection again.");
|
|
21033
|
+
}
|
|
21034
|
+
};
|
|
20940
21035
|
var HermesInventoryTimeoutError = class extends HermesInventoryError {
|
|
20941
21036
|
constructor() {
|
|
20942
21037
|
super("Hermes model inventory probe timed out");
|
|
@@ -20969,9 +21064,9 @@ function inventoryPythonCandidates(hermesExecutable, platform = process.platform
|
|
|
20969
21064
|
candidates.push(pathApi.resolve(executableDirectory, "../../.hermes/hermes-agent", relativePython));
|
|
20970
21065
|
return [...new Set(candidates)];
|
|
20971
21066
|
}
|
|
20972
|
-
function runProbe(pythonExecutable, timeoutMs, environment) {
|
|
21067
|
+
function runProbe(pythonExecutable, timeoutMs, environment, arguments_ = ["-I", "-c", INVENTORY_PROBE_SCRIPT]) {
|
|
20973
21068
|
return new Promise((resolve, reject) => {
|
|
20974
|
-
const child = spawn2(pythonExecutable,
|
|
21069
|
+
const child = spawn2(pythonExecutable, arguments_, {
|
|
20975
21070
|
cwd: path5.dirname(pythonExecutable),
|
|
20976
21071
|
env: { ...process.env, ...environment },
|
|
20977
21072
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -20999,10 +21094,12 @@ function runProbe(pythonExecutable, timeoutMs, environment) {
|
|
|
20999
21094
|
return;
|
|
21000
21095
|
}
|
|
21001
21096
|
try {
|
|
21002
|
-
const
|
|
21097
|
+
const payload = stdout.split(/\r?\n/).find((line) => line.startsWith("codexhost_inventory="));
|
|
21098
|
+
const parsed2 = JSON.parse(payload ? payload.slice("codexhost_inventory=".length) : stdout.trim());
|
|
21003
21099
|
const models = (parsed2.models ?? []).filter((model) => typeof model?.modelId === "string" && model.modelId.length > 0);
|
|
21004
21100
|
resolve({
|
|
21005
21101
|
models,
|
|
21102
|
+
...typeof parsed2.configured === "boolean" ? { configured: parsed2.configured } : {},
|
|
21006
21103
|
currentModelId: typeof parsed2.currentModelId === "string" && parsed2.currentModelId.length > 0 ? parsed2.currentModelId : null
|
|
21007
21104
|
});
|
|
21008
21105
|
} catch {
|
|
@@ -21013,6 +21110,36 @@ function runProbe(pythonExecutable, timeoutMs, environment) {
|
|
|
21013
21110
|
}
|
|
21014
21111
|
async function readHermesModelInventory(hermesExecutable, timeoutMs = 2e4, options = {}) {
|
|
21015
21112
|
const platform = options.platform ?? process.platform;
|
|
21113
|
+
let command = null;
|
|
21114
|
+
try {
|
|
21115
|
+
const environment = { ...process.env, ...options.environment };
|
|
21116
|
+
const invocation = commandInvocation(hermesExecutable, [
|
|
21117
|
+
"--print-runtime-command",
|
|
21118
|
+
"--module",
|
|
21119
|
+
"timeit",
|
|
21120
|
+
"--",
|
|
21121
|
+
"-n",
|
|
21122
|
+
"1",
|
|
21123
|
+
"-r",
|
|
21124
|
+
"1",
|
|
21125
|
+
"-s",
|
|
21126
|
+
`exec(${JSON.stringify(INVENTORY_PROBE_SCRIPT)})`,
|
|
21127
|
+
"pass"
|
|
21128
|
+
], environment, platform);
|
|
21129
|
+
const { stdout } = await promisify(execFile2)(invocation.command, invocation.arguments, {
|
|
21130
|
+
env: environment,
|
|
21131
|
+
timeout: timeoutMs,
|
|
21132
|
+
maxBuffer: 64 * 1024,
|
|
21133
|
+
windowsHide: true,
|
|
21134
|
+
windowsVerbatimArguments: invocation.windowsVerbatimArguments
|
|
21135
|
+
});
|
|
21136
|
+
const value = JSON.parse(stdout.trim());
|
|
21137
|
+
if (Array.isArray(value) && value.length > 0 && value.every((entry) => typeof entry === "string"))
|
|
21138
|
+
command = value;
|
|
21139
|
+
} catch {
|
|
21140
|
+
}
|
|
21141
|
+
if (command?.[0])
|
|
21142
|
+
return runProbe(command[0], timeoutMs, options.environment, command.slice(1));
|
|
21016
21143
|
const candidates = [
|
|
21017
21144
|
await venvPythonFromShim(hermesExecutable, platform) ?? "",
|
|
21018
21145
|
...inventoryPythonCandidates(hermesExecutable, platform)
|
|
@@ -22549,7 +22676,7 @@ import { access as access2 } from "node:fs/promises";
|
|
|
22549
22676
|
import { createInterface } from "node:readline";
|
|
22550
22677
|
|
|
22551
22678
|
// dist/gateway-delegation.js
|
|
22552
|
-
import { mkdtemp, writeFile, rm } from "node:fs/promises";
|
|
22679
|
+
import { mkdtemp as mkdtemp2, writeFile as writeFile2, rm as rm2 } from "node:fs/promises";
|
|
22553
22680
|
import os2 from "node:os";
|
|
22554
22681
|
import path6 from "node:path";
|
|
22555
22682
|
var HERMES_DELEGATION_GUIDANCE = `This Session runs inside codexhost.
|
|
@@ -22564,10 +22691,10 @@ async function prepareGatewayDelegation(environment) {
|
|
|
22564
22691
|
if (!required2.every((key) => environment[key]))
|
|
22565
22692
|
return { environment, bootstrap: "", dispose: async () => {
|
|
22566
22693
|
} };
|
|
22567
|
-
const directory = await
|
|
22694
|
+
const directory = await mkdtemp2(path6.join(os2.tmpdir(), "codexhost-hermes-delegation-"));
|
|
22568
22695
|
const file2 = path6.join(directory, "SKILL.md");
|
|
22569
22696
|
try {
|
|
22570
|
-
await
|
|
22697
|
+
await writeFile2(file2, `---
|
|
22571
22698
|
name: delegation
|
|
22572
22699
|
description: Discover authorized codexhost agent collaboration.
|
|
22573
22700
|
---
|
|
@@ -22587,10 +22714,10 @@ from hermes_cli.plugins import PluginContext, PluginManifest, get_plugin_manager
|
|
|
22587
22714
|
PluginContext(PluginManifest(name="codexhost-runtime"), get_plugin_manager()).register_skill(
|
|
22588
22715
|
"delegation", Path(${JSON.stringify(file2)}))
|
|
22589
22716
|
`,
|
|
22590
|
-
dispose: () =>
|
|
22717
|
+
dispose: () => rm2(directory, { recursive: true, force: true })
|
|
22591
22718
|
};
|
|
22592
22719
|
} catch (error51) {
|
|
22593
|
-
await
|
|
22720
|
+
await rm2(directory, { recursive: true, force: true });
|
|
22594
22721
|
throw error51;
|
|
22595
22722
|
}
|
|
22596
22723
|
}
|
|
@@ -23238,12 +23365,12 @@ var HermesGatewayHistory = class {
|
|
|
23238
23365
|
};
|
|
23239
23366
|
|
|
23240
23367
|
// dist/gateway-configuration.js
|
|
23241
|
-
import { execFile as
|
|
23242
|
-
import { promisify } from "node:util";
|
|
23368
|
+
import { execFile as execFile3 } from "node:child_process";
|
|
23369
|
+
import { promisify as promisify2 } from "node:util";
|
|
23243
23370
|
async function resolveGatewayModel(transport, modelId) {
|
|
23244
23371
|
if (/\s/u.test(modelId) || modelId.startsWith("-"))
|
|
23245
23372
|
throw new Error("Invalid Hermes Model identifier");
|
|
23246
|
-
const result = await
|
|
23373
|
+
const result = await promisify2(execFile3)(transport.python, [
|
|
23247
23374
|
"-I",
|
|
23248
23375
|
"-c",
|
|
23249
23376
|
"import json,sys\nfrom hermes_cli.models import parse_model_input\np,m=parse_model_input(sys.argv[1], '')\nprint(json.dumps({'provider':p,'model':m}))",
|
|
@@ -23960,6 +24087,12 @@ var HermesAdapter = class {
|
|
|
23960
24087
|
this.#inventoryRead = readHermesModelInventory(executable, 2e4, {
|
|
23961
24088
|
...this.#options.environment ? { environment: this.#options.environment } : {}
|
|
23962
24089
|
}).then((inventory) => {
|
|
24090
|
+
if (inventory.configured === false) {
|
|
24091
|
+
this.#lastInventory = null;
|
|
24092
|
+
this.#inspectionCache = null;
|
|
24093
|
+
this.#inspectionCacheScope = null;
|
|
24094
|
+
throw new HermesConfigurationRequiredError();
|
|
24095
|
+
}
|
|
23963
24096
|
if (!this.#closed)
|
|
23964
24097
|
this.#lastInventory = inventory;
|
|
23965
24098
|
return inventory;
|
|
@@ -24281,6 +24414,12 @@ var HermesAdapter = class {
|
|
|
24281
24414
|
}
|
|
24282
24415
|
};
|
|
24283
24416
|
function inspectionFromTransportError(error51) {
|
|
24417
|
+
if (error51 instanceof HermesConfigurationRequiredError) {
|
|
24418
|
+
return {
|
|
24419
|
+
status: "unavailable",
|
|
24420
|
+
error: { code: "configurationRequired", message: error51.message, retryable: false }
|
|
24421
|
+
};
|
|
24422
|
+
}
|
|
24284
24423
|
if (error51 instanceof HermesTransportError) {
|
|
24285
24424
|
if (error51.kind === "notInstalled") {
|
|
24286
24425
|
return {
|
|
@@ -24336,6 +24475,7 @@ function createHermesInstallation(environment, command) {
|
|
|
24336
24475
|
latestVersion: "Unknown",
|
|
24337
24476
|
updateAvailable: false,
|
|
24338
24477
|
canUpdate: false,
|
|
24478
|
+
messageCode: "hermes-update-plan-unavailable",
|
|
24339
24479
|
message: "This Hermes release does not expose a safe update plan. Use the original installer."
|
|
24340
24480
|
};
|
|
24341
24481
|
const plan = await run(["update", "--plan"]);
|
|
@@ -24347,6 +24487,7 @@ function createHermesInstallation(environment, command) {
|
|
|
24347
24487
|
latestVersion: "Unknown",
|
|
24348
24488
|
updateAvailable: false,
|
|
24349
24489
|
canUpdate: false,
|
|
24490
|
+
messageCode: "hermes-externally-managed",
|
|
24350
24491
|
message: "This Hermes installation is managed externally. Update it through its desktop app, container, or original package manager."
|
|
24351
24492
|
};
|
|
24352
24493
|
const output = await run(["update", "--check"]);
|
|
@@ -24363,6 +24504,8 @@ function createHermesInstallation(environment, command) {
|
|
|
24363
24504
|
latestVersion,
|
|
24364
24505
|
updateAvailable,
|
|
24365
24506
|
canUpdate,
|
|
24507
|
+
...updateAvailable && !release ? { latestVersionKind: "tracking-branch" } : {},
|
|
24508
|
+
messageCode: canUpdate ? "hermes-update-channel" : "hermes-manual-update",
|
|
24366
24509
|
message: canUpdate ? "Uses Hermes's configured update channel. Gateway restarts are deferred; existing processes keep their running code." : "Use the native updater manually. Safe non-interactive updates require a clean source checkout, commit identity, and Gateway restart deferral."
|
|
24367
24510
|
};
|
|
24368
24511
|
},
|
|
@@ -24379,7 +24522,13 @@ function createHarnessAdapter(context) {
|
|
|
24379
24522
|
return Object.assign(new HermesAdapter({
|
|
24380
24523
|
...environment[HERMES_COMMAND_ENV] ? { command: environment[HERMES_COMMAND_ENV] } : {},
|
|
24381
24524
|
environment
|
|
24382
|
-
}), {
|
|
24525
|
+
}), {
|
|
24526
|
+
installation: createHermesInstallation(environment, environment[HERMES_COMMAND_ENV]),
|
|
24527
|
+
install: createHarnessInstaller(environment, {
|
|
24528
|
+
posix: "https://hermes-agent.nousresearch.com/install.sh",
|
|
24529
|
+
windows: "https://hermes-agent.nousresearch.com/install.ps1"
|
|
24530
|
+
})
|
|
24531
|
+
});
|
|
24383
24532
|
}
|
|
24384
24533
|
export {
|
|
24385
24534
|
HERMES_COMMAND_ENV,
|