@liberseek/boft-cli-linux-x64 0.7.5 → 0.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +17950 -0
- package/app/console-web.js +27484 -0
- package/app/desktop-controller.mjs +221 -33
- package/app/host-runtime.mjs +3590 -1251
- package/app/plugins/antigravity/plugin.mjs +726 -357
- package/app/plugins/claude-code/plugin.mjs +3067 -2208
- package/app/plugins/codebuddy/plugin.mjs +798 -386
- package/app/plugins/cursor-cli/manifest.json +1 -1
- package/app/plugins/cursor-cli/plugin.mjs +1230 -555
- package/app/plugins/deepseek-harness/plugin.mjs +4761 -4967
- package/app/plugins/grok/plugin.mjs +670 -361
- package/app/plugins/hermes/plugin.mjs +764 -441
- package/app/plugins/kimi-code/plugin.mjs +1095 -428
- package/app/plugins/kiro-cli/plugin.mjs +603 -332
- package/app/plugins/muse/plugin.mjs +189 -58
- package/app/plugins/omp/plugin.mjs +689 -334
- package/app/plugins/opencode/plugin.mjs +946 -478
- package/app/plugins/pi/plugin.mjs +1325 -587
- package/app/plugins/qoder/plugin.mjs +756 -308
- package/app/plugins/qoder-cn/plugin.mjs +555 -99
- package/app/plugins/workbuddy/plugin.mjs +192 -58
- package/app/renderer-extension.js +3703 -1703
- package/bin/boft +0 -0
- package/libexec/boft-shim +0 -0
- package/libexec/boft-updater +0 -0
- package/package.json +2 -2
|
@@ -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, {
|
|
@@ -771,10 +1133,10 @@ function mergeDefs(...defs) {
|
|
|
771
1133
|
function cloneDef(schema) {
|
|
772
1134
|
return mergeDefs(schema._zod.def);
|
|
773
1135
|
}
|
|
774
|
-
function getElementAtPath(obj,
|
|
775
|
-
if (!
|
|
1136
|
+
function getElementAtPath(obj, path8) {
|
|
1137
|
+
if (!path8)
|
|
776
1138
|
return obj;
|
|
777
|
-
return
|
|
1139
|
+
return path8.reduce((acc, key) => acc?.[key], obj);
|
|
778
1140
|
}
|
|
779
1141
|
function promiseAllObject(promisesObj) {
|
|
780
1142
|
const keys = Object.keys(promisesObj);
|
|
@@ -1183,11 +1545,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
1183
1545
|
}
|
|
1184
1546
|
return false;
|
|
1185
1547
|
}
|
|
1186
|
-
function prefixIssues(
|
|
1548
|
+
function prefixIssues(path8, issues) {
|
|
1187
1549
|
return issues.map((iss) => {
|
|
1188
1550
|
var _a3;
|
|
1189
1551
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
1190
|
-
iss.path.unshift(
|
|
1552
|
+
iss.path.unshift(path8);
|
|
1191
1553
|
return iss;
|
|
1192
1554
|
});
|
|
1193
1555
|
}
|
|
@@ -1334,16 +1696,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
1334
1696
|
}
|
|
1335
1697
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
1336
1698
|
const fieldErrors = { _errors: [] };
|
|
1337
|
-
const processError = (error52,
|
|
1699
|
+
const processError = (error52, path8 = []) => {
|
|
1338
1700
|
for (const issue2 of error52.issues) {
|
|
1339
1701
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1340
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1702
|
+
issue2.errors.map((issues) => processError({ issues }, [...path8, ...issue2.path]));
|
|
1341
1703
|
} else if (issue2.code === "invalid_key") {
|
|
1342
|
-
processError({ issues: issue2.issues }, [...
|
|
1704
|
+
processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
|
|
1343
1705
|
} else if (issue2.code === "invalid_element") {
|
|
1344
|
-
processError({ issues: issue2.issues }, [...
|
|
1706
|
+
processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
|
|
1345
1707
|
} else {
|
|
1346
|
-
const fullpath = [...
|
|
1708
|
+
const fullpath = [...path8, ...issue2.path];
|
|
1347
1709
|
if (fullpath.length === 0) {
|
|
1348
1710
|
fieldErrors._errors.push(mapper(issue2));
|
|
1349
1711
|
} else {
|
|
@@ -1370,17 +1732,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
1370
1732
|
}
|
|
1371
1733
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
1372
1734
|
const result = { errors: [] };
|
|
1373
|
-
const processError = (error52,
|
|
1735
|
+
const processError = (error52, path8 = []) => {
|
|
1374
1736
|
var _a3, _b;
|
|
1375
1737
|
for (const issue2 of error52.issues) {
|
|
1376
1738
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1377
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1739
|
+
issue2.errors.map((issues) => processError({ issues }, [...path8, ...issue2.path]));
|
|
1378
1740
|
} else if (issue2.code === "invalid_key") {
|
|
1379
|
-
processError({ issues: issue2.issues }, [...
|
|
1741
|
+
processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
|
|
1380
1742
|
} else if (issue2.code === "invalid_element") {
|
|
1381
|
-
processError({ issues: issue2.issues }, [...
|
|
1743
|
+
processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
|
|
1382
1744
|
} else {
|
|
1383
|
-
const fullpath = [...
|
|
1745
|
+
const fullpath = [...path8, ...issue2.path];
|
|
1384
1746
|
if (fullpath.length === 0) {
|
|
1385
1747
|
result.errors.push(mapper(issue2));
|
|
1386
1748
|
continue;
|
|
@@ -1412,8 +1774,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
1412
1774
|
}
|
|
1413
1775
|
function toDotPath(_path) {
|
|
1414
1776
|
const segs = [];
|
|
1415
|
-
const
|
|
1416
|
-
for (const seg of
|
|
1777
|
+
const path8 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
1778
|
+
for (const seg of path8) {
|
|
1417
1779
|
if (typeof seg === "number")
|
|
1418
1780
|
segs.push(`[${seg}]`);
|
|
1419
1781
|
else if (typeof seg === "symbol")
|
|
@@ -14105,13 +14467,13 @@ function resolveRef(ref, ctx) {
|
|
|
14105
14467
|
if (!ref.startsWith("#")) {
|
|
14106
14468
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
14107
14469
|
}
|
|
14108
|
-
const
|
|
14109
|
-
if (
|
|
14470
|
+
const path8 = ref.slice(1).split("/").filter(Boolean);
|
|
14471
|
+
if (path8.length === 0) {
|
|
14110
14472
|
return ctx.rootSchema;
|
|
14111
14473
|
}
|
|
14112
14474
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
14113
|
-
if (
|
|
14114
|
-
const key =
|
|
14475
|
+
if (path8[0] === defsKey) {
|
|
14476
|
+
const key = path8[1];
|
|
14115
14477
|
if (!key || !ctx.defs[key]) {
|
|
14116
14478
|
throw new Error(`Reference not found: ${ref}`);
|
|
14117
14479
|
}
|
|
@@ -14574,6 +14936,123 @@ var credentialImportsParamsSchema = external_exports.object({
|
|
|
14574
14936
|
request: credentialImportsRequestSchema
|
|
14575
14937
|
}).strict();
|
|
14576
14938
|
|
|
14939
|
+
// ../../shared-contracts/dist/harness-display-settings.js
|
|
14940
|
+
var harnessDisplayEntriesSchema = external_exports.array(external_exports.strictObject({
|
|
14941
|
+
agent: external_exports.string().min(1).max(128),
|
|
14942
|
+
section: external_exports.enum(["main", "more", "auto"])
|
|
14943
|
+
})).max(256).refine((entries) => new Set(entries.map((entry) => entry.agent)).size === entries.length, "Duplicate Harness IDs");
|
|
14944
|
+
var harnessDisplaySettingsSchema = external_exports.strictObject({
|
|
14945
|
+
entries: harnessDisplayEntriesSchema.nullable()
|
|
14946
|
+
});
|
|
14947
|
+
var harnessDisplayGetSchema = external_exports.strictObject({});
|
|
14948
|
+
var harnessDisplaySetSchema = external_exports.strictObject({
|
|
14949
|
+
entries: harnessDisplayEntriesSchema,
|
|
14950
|
+
/** Import legacy Desktop preferences only if no shared settings exist yet. */
|
|
14951
|
+
initializeOnly: external_exports.boolean().optional()
|
|
14952
|
+
});
|
|
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
|
+
|
|
15019
|
+
// ../../shared-contracts/dist/console.js
|
|
15020
|
+
var consoleAnnouncementSchema = external_exports.strictObject({
|
|
15021
|
+
title: external_exports.string().trim().min(1).max(200),
|
|
15022
|
+
type: external_exports.enum(["info", "warning", "danger"]),
|
|
15023
|
+
body: external_exports.string().trim().min(1).max(16 * 1024)
|
|
15024
|
+
});
|
|
15025
|
+
var consoleOpenParamsSchema = external_exports.strictObject({});
|
|
15026
|
+
var consoleOpenResultSchema = external_exports.strictObject({
|
|
15027
|
+
/** The console address. */
|
|
15028
|
+
url: external_exports.string().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)
|
|
15029
|
+
});
|
|
15030
|
+
var CONSOLE_HOST_METHODS = Object.freeze([
|
|
15031
|
+
"codexhost/harness/plugins/list",
|
|
15032
|
+
"codexhost/harness/display-settings/get",
|
|
15033
|
+
"codexhost/harness/display-settings/set",
|
|
15034
|
+
"codexhost/harness/inspect",
|
|
15035
|
+
"codexhost/harness/installation",
|
|
15036
|
+
"codexhost/harness/launch-settings/get",
|
|
15037
|
+
"codexhost/harness/launch-settings/set",
|
|
15038
|
+
HARNESS_LONG_CONTEXT_GET_METHOD,
|
|
15039
|
+
HARNESS_LONG_CONTEXT_SET_METHOD,
|
|
15040
|
+
"codexhost/harness/web-ui/open",
|
|
15041
|
+
"codexhost/harness/accounts/sources",
|
|
15042
|
+
"codexhost/harness/accounts/list",
|
|
15043
|
+
"codexhost/harness/accounts/inspect",
|
|
15044
|
+
"codexhost/harness/credential-imports",
|
|
15045
|
+
"codexhost/harness/session-import/sources",
|
|
15046
|
+
"codexhost/harness/session-import/list",
|
|
15047
|
+
"codexhost/harness/session-import/import",
|
|
15048
|
+
"codexhost/account/list",
|
|
15049
|
+
"codexhost/account/refresh",
|
|
15050
|
+
"codexhost/account/usage/inspect",
|
|
15051
|
+
"codexhost/update/check",
|
|
15052
|
+
"codexhost/update/start",
|
|
15053
|
+
"codexhost/update/status"
|
|
15054
|
+
]);
|
|
15055
|
+
|
|
14577
15056
|
// ../../shared-contracts/dist/version.js
|
|
14578
15057
|
var WORKSPACE_CONTRACT_VERSION = 1;
|
|
14579
15058
|
|
|
@@ -14617,15 +15096,11 @@ var loadedSessionsSchema = external_exports.array(external_exports.strictObject(
|
|
|
14617
15096
|
inactiveMs: external_exports.number().nonnegative()
|
|
14618
15097
|
}));
|
|
14619
15098
|
|
|
14620
|
-
// ../../shared-contracts/dist/
|
|
14621
|
-
var
|
|
14622
|
-
|
|
15099
|
+
// ../../shared-contracts/dist/manual-compaction.js
|
|
15100
|
+
var threadManualCompactionStartedSchema = external_exports.strictObject({
|
|
15101
|
+
threadId: hostThreadIdSchema,
|
|
15102
|
+
turnId: hostTurnIdSchema
|
|
14623
15103
|
});
|
|
14624
|
-
var harnessIdSchema = opaqueIdSchema.brand();
|
|
14625
|
-
var hostThreadIdSchema = opaqueIdSchema.brand();
|
|
14626
|
-
var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
14627
|
-
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
14628
|
-
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
14629
15104
|
|
|
14630
15105
|
// ../../shared-contracts/dist/thread-usage.js
|
|
14631
15106
|
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
|
|
@@ -14687,6 +15162,10 @@ var threadUsageSnapshotSchema = external_exports.object({
|
|
|
14687
15162
|
var usagePercentSchema = external_exports.number().finite().min(0).max(100);
|
|
14688
15163
|
var accountCreditsProductUsageSchema = external_exports.object({
|
|
14689
15164
|
product: external_exports.string().min(1),
|
|
15165
|
+
used: external_exports.number().finite().nonnegative().optional(),
|
|
15166
|
+
// Zero is a real empty cap, not an absent field.
|
|
15167
|
+
limit: external_exports.number().finite().nonnegative().optional(),
|
|
15168
|
+
unit: external_exports.string().min(1).max(32).optional(),
|
|
14690
15169
|
usagePercent: usagePercentSchema,
|
|
14691
15170
|
resetsAt: external_exports.string().min(1).optional()
|
|
14692
15171
|
}).strict();
|
|
@@ -14696,11 +15175,14 @@ var accountResetCreditsSchema = external_exports.object({
|
|
|
14696
15175
|
expiresAt: external_exports.array(external_exports.string().min(1)).min(1).max(32).optional()
|
|
14697
15176
|
}).strict();
|
|
14698
15177
|
var accountCreditsSnapshotSchema = external_exports.object({
|
|
15178
|
+
used: external_exports.number().finite().nonnegative().optional(),
|
|
15179
|
+
// Zero is a real empty cap, not an absent field.
|
|
15180
|
+
limit: external_exports.number().finite().nonnegative().optional(),
|
|
15181
|
+
unit: external_exports.string().trim().min(1).max(32).optional(),
|
|
14699
15182
|
/** Native label when the primary limit is scoped to a model or product group. */
|
|
14700
15183
|
label: external_exports.string().min(1).optional(),
|
|
14701
15184
|
usedPercent: usagePercentSchema.optional(),
|
|
14702
15185
|
remaining: external_exports.number().finite().optional(),
|
|
14703
|
-
unit: external_exports.string().trim().min(1).max(32).optional(),
|
|
14704
15186
|
resetsAt: external_exports.string().min(1).optional(),
|
|
14705
15187
|
periodType: external_exports.enum(["weekly", "monthly", "five_hour", "seven_day", "unknown"]),
|
|
14706
15188
|
productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
|
|
@@ -14731,12 +15213,27 @@ var threadUsageInspectionSchema = external_exports.object({
|
|
|
14731
15213
|
}).strict();
|
|
14732
15214
|
|
|
14733
15215
|
// ../../shared-contracts/dist/harness-accounts.js
|
|
14734
|
-
var
|
|
15216
|
+
var accountBalanceSnapshotSchema = external_exports.object({
|
|
15217
|
+
amount: external_exports.number().finite().nonnegative(),
|
|
15218
|
+
/** ISO 4217 code as reported by the Provider, for example `CNY`. */
|
|
15219
|
+
currency: external_exports.string().trim().min(1).max(8),
|
|
15220
|
+
/** Native label when the Harness exposes several Billing Sources. */
|
|
15221
|
+
label: external_exports.string().trim().min(1).max(128).optional()
|
|
15222
|
+
}).strict();
|
|
15223
|
+
var harnessAccountSnapshotObject = external_exports.object({
|
|
14735
15224
|
email: external_exports.string().trim().min(1).max(320).optional(),
|
|
14736
15225
|
label: external_exports.string().trim().min(1).max(256).optional(),
|
|
14737
15226
|
plan: external_exports.string().trim().min(1).max(128).optional(),
|
|
14738
|
-
credits: accountCreditsSnapshotSchema
|
|
15227
|
+
credits: accountCreditsSnapshotSchema.optional(),
|
|
15228
|
+
balance: accountBalanceSnapshotSchema.optional()
|
|
14739
15229
|
}).strict();
|
|
15230
|
+
function requireReportedQuota(schema) {
|
|
15231
|
+
return schema.refine((value) => {
|
|
15232
|
+
const reported = value;
|
|
15233
|
+
return reported.credits !== void 0 || reported.balance !== void 0;
|
|
15234
|
+
}, { message: "Account must report either credits or a balance" });
|
|
15235
|
+
}
|
|
15236
|
+
var harnessAccountSnapshotSchema = requireReportedQuota(harnessAccountSnapshotObject);
|
|
14740
15237
|
var harnessAccountIdentityShape = {
|
|
14741
15238
|
harnessId: harnessIdSchema,
|
|
14742
15239
|
harnessName: external_exports.string().trim().min(1).max(128)
|
|
@@ -14747,11 +15244,13 @@ var harnessAccountSourceListResultSchema = external_exports.object({ sources: ex
|
|
|
14747
15244
|
var harnessAccountInspectParamsSchema = external_exports.object({ harnessId: harnessIdSchema, refresh: external_exports.boolean().optional() }).strict();
|
|
14748
15245
|
var harnessAccountInspectResultSchema = external_exports.object({
|
|
14749
15246
|
...harnessAccountIdentityShape,
|
|
14750
|
-
account: harnessAccountSnapshotSchema.nullable()
|
|
15247
|
+
account: harnessAccountSnapshotSchema.nullable(),
|
|
15248
|
+
/** Every Billing Source from one Harness; `account` remains the first for older clients. */
|
|
15249
|
+
accounts: external_exports.array(harnessAccountSnapshotSchema).max(8).optional()
|
|
14751
15250
|
}).strict();
|
|
14752
15251
|
var harnessAccountListParamsSchema = external_exports.object({ refresh: external_exports.boolean().optional() }).strict();
|
|
14753
15252
|
var harnessAccountListResultSchema = external_exports.object({
|
|
14754
|
-
accounts: external_exports.array(
|
|
15253
|
+
accounts: external_exports.array(requireReportedQuota(harnessAccountSnapshotObject.extend(harnessAccountIdentityShape))).max(128)
|
|
14755
15254
|
}).strict();
|
|
14756
15255
|
|
|
14757
15256
|
// ../../shared-contracts/dist/json-value.js
|
|
@@ -14889,6 +15388,8 @@ var harnessModelSchema = external_exports.object({
|
|
|
14889
15388
|
ref: harnessModelRefSchema,
|
|
14890
15389
|
label: nonBlankTextSchema2.max(HARNESS_MODEL_LABEL_MAX_LENGTH),
|
|
14891
15390
|
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
15391
|
+
/** Optional opaque selection for this same Model with priority processing enabled. */
|
|
15392
|
+
fastModel: harnessModelRefSchema.optional(),
|
|
14892
15393
|
supportedThinkingOptionIds: external_exports.array(harnessThinkingOptionIdSchema).optional()
|
|
14893
15394
|
}).strict();
|
|
14894
15395
|
var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context) => {
|
|
@@ -14921,6 +15422,16 @@ var harnessModelCatalogSchema = external_exports.object({
|
|
|
14921
15422
|
});
|
|
14922
15423
|
}
|
|
14923
15424
|
refs.add(model.ref.id);
|
|
15425
|
+
if (model.fastModel) {
|
|
15426
|
+
if (refs.has(model.fastModel.id) || catalog.models.some((entry) => entry.ref.id === model.fastModel?.id)) {
|
|
15427
|
+
context.addIssue({
|
|
15428
|
+
code: "custom",
|
|
15429
|
+
message: "Fast Model refs must be distinct and unique",
|
|
15430
|
+
path: ["models", index, "fastModel"]
|
|
15431
|
+
});
|
|
15432
|
+
}
|
|
15433
|
+
refs.add(model.fastModel.id);
|
|
15434
|
+
}
|
|
14924
15435
|
const supportedThinkingIds = /* @__PURE__ */ new Set();
|
|
14925
15436
|
for (const [optionIndex, optionId] of (model.supportedThinkingOptionIds ?? []).entries()) {
|
|
14926
15437
|
if (supportedThinkingIds.has(optionId)) {
|
|
@@ -15043,11 +15554,13 @@ var threadThinkingSelectParamsSchema = external_exports.object({
|
|
|
15043
15554
|
thinkingOptionId: harnessThinkingOptionIdSchema
|
|
15044
15555
|
}).strict();
|
|
15045
15556
|
var threadInspectionParamsSchema = external_exports.object({
|
|
15046
|
-
threadId: hostThreadIdSchema
|
|
15557
|
+
threadId: hostThreadIdSchema,
|
|
15558
|
+
includeReferenceCapability: external_exports.boolean().optional()
|
|
15047
15559
|
}).strict();
|
|
15048
15560
|
var codexThreadInspectionSchema = external_exports.object({
|
|
15049
15561
|
owner: external_exports.literal("codex"),
|
|
15050
|
-
locked: external_exports.literal(true)
|
|
15562
|
+
locked: external_exports.literal(true),
|
|
15563
|
+
supportsThreadReferences: external_exports.literal(true).optional()
|
|
15051
15564
|
}).strict();
|
|
15052
15565
|
var externalThreadInspectionSchema = external_exports.object({
|
|
15053
15566
|
owner: external_exports.literal("external"),
|
|
@@ -15112,48 +15625,6 @@ var threadOwnershipListResultSchema = external_exports.object({
|
|
|
15112
15625
|
}
|
|
15113
15626
|
});
|
|
15114
15627
|
|
|
15115
|
-
// ../../shared-contracts/dist/harness-plugins.js
|
|
15116
|
-
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
15117
|
-
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
15118
|
-
var HARNESS_PLUGIN_LIMIT = 128;
|
|
15119
|
-
var harnessPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u).refine((id) => id !== "codex", "The official Codex identity is reserved").pipe(harnessIdSchema);
|
|
15120
|
-
var relativeResourceSchema = external_exports.string().min(1).max(512).refine((value) => !/[\\\u0000:#?]/u.test(value) && !value.startsWith("/") && !value.split("/").some((part) => part === ".." || part === ""), "Plugin resources must be relative paths inside the plugin");
|
|
15121
|
-
var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
|
|
15122
|
-
var pluginPresentationShape = {
|
|
15123
|
-
id: harnessPluginIdSchema,
|
|
15124
|
-
name: external_exports.string().trim().min(1).max(128),
|
|
15125
|
-
version: external_exports.string().min(1).max(128),
|
|
15126
|
-
/** The factory accepts a persisted local entrypoint through its construction context. */
|
|
15127
|
-
launchCommand: external_exports.literal(true).optional(),
|
|
15128
|
-
links: external_exports.object({
|
|
15129
|
-
documentation: documentationUrlSchema.optional(),
|
|
15130
|
-
installation: documentationUrlSchema.optional()
|
|
15131
|
-
}).strict().optional()
|
|
15132
|
-
};
|
|
15133
|
-
var harnessPluginManifestSchema = external_exports.object({
|
|
15134
|
-
manifestVersion: external_exports.literal(1),
|
|
15135
|
-
...pluginPresentationShape,
|
|
15136
|
-
adapterApiVersion: external_exports.number().int().positive(),
|
|
15137
|
-
entry: relativeResourceSchema,
|
|
15138
|
-
icon: relativeResourceSchema.optional()
|
|
15139
|
-
}).strict();
|
|
15140
|
-
var harnessPluginIconSchema = external_exports.string().max(Math.ceil(HARNESS_PLUGIN_ICON_MAX_BYTES / 3) * 4 + 64).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u);
|
|
15141
|
-
var harnessPluginDescriptorSchema = external_exports.object({
|
|
15142
|
-
...pluginPresentationShape,
|
|
15143
|
-
icon: harnessPluginIconSchema.optional()
|
|
15144
|
-
}).strict();
|
|
15145
|
-
var harnessPluginListParamsSchema = external_exports.object({}).strict();
|
|
15146
|
-
var harnessPluginListResultSchema = external_exports.object({
|
|
15147
|
-
plugins: external_exports.array(harnessPluginDescriptorSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
15148
|
-
}).strict();
|
|
15149
|
-
var harnessPluginConfigurationSchema = external_exports.object({
|
|
15150
|
-
version: external_exports.literal(1),
|
|
15151
|
-
enabled: external_exports.array(harnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
15152
|
-
}).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
|
|
15153
|
-
message: "Enabled plugin IDs must be unique",
|
|
15154
|
-
path: ["enabled"]
|
|
15155
|
-
});
|
|
15156
|
-
|
|
15157
15628
|
// ../../shared-contracts/dist/harness-route.js
|
|
15158
15629
|
var harnessPluginRouteSchema = external_exports.object({
|
|
15159
15630
|
harnessId: harnessPluginIdSchema,
|
|
@@ -15175,10 +15646,31 @@ var harnessLaunchSettingsSchema = external_exports.object({
|
|
|
15175
15646
|
restartRequired: external_exports.boolean()
|
|
15176
15647
|
}).strict();
|
|
15177
15648
|
|
|
15649
|
+
// ../../shared-contracts/dist/harness-installation.js
|
|
15650
|
+
var harnessInstallationParamsSchema = external_exports.object({
|
|
15651
|
+
harnessId: harnessIdSchema,
|
|
15652
|
+
action: external_exports.enum(["check", "update", "install"])
|
|
15653
|
+
}).strict();
|
|
15654
|
+
var harnessInstallationStateSchema = external_exports.object({
|
|
15655
|
+
currentVersion: external_exports.string().min(1).max(128),
|
|
15656
|
+
latestVersion: external_exports.string().min(1).max(128),
|
|
15657
|
+
updateAvailable: external_exports.boolean(),
|
|
15658
|
+
canUpdate: external_exports.boolean(),
|
|
15659
|
+
message: external_exports.string().max(2048).optional()
|
|
15660
|
+
}).strict();
|
|
15661
|
+
|
|
15178
15662
|
// ../../shared-contracts/dist/codex-accounts.js
|
|
15179
15663
|
var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
|
|
15180
15664
|
var nonBlankTextSchema3 = external_exports.string().trim().min(1);
|
|
15181
15665
|
var codexAccountAuthKindSchema = external_exports.enum(["api", "chatgpt"]);
|
|
15666
|
+
var codexAccountSiteUrlPattern = /^https?:\/\/(?:\[[0-9a-fA-F:]+\]|[^/\s:@?#]+)(?::\d{1,5})?(?:[/?#][^\s]*)?$/u;
|
|
15667
|
+
function isCodexAccountSiteUrl(value) {
|
|
15668
|
+
return value.length > 0 && value.length <= 2048 && codexAccountSiteUrlPattern.test(value);
|
|
15669
|
+
}
|
|
15670
|
+
var externalUrlOpenParamsSchema = external_exports.object({
|
|
15671
|
+
url: external_exports.string().max(2048).refine(isCodexAccountSiteUrl, "External URL must be http(s)")
|
|
15672
|
+
}).strict();
|
|
15673
|
+
var externalUrlOpenResultSchema = external_exports.object({}).strict();
|
|
15182
15674
|
var codexAccountPlanTypeSchema = external_exports.enum([
|
|
15183
15675
|
"free",
|
|
15184
15676
|
"go",
|
|
@@ -15204,7 +15696,8 @@ var codexAccountSchema = external_exports.object({
|
|
|
15204
15696
|
email: external_exports.string().email().max(320).optional(),
|
|
15205
15697
|
planType: codexAccountPlanTypeSchema.optional(),
|
|
15206
15698
|
authKind: codexAccountAuthKindSchema.optional(),
|
|
15207
|
-
authIdentity: nonBlankTextSchema3.max(256).optional()
|
|
15699
|
+
authIdentity: nonBlankTextSchema3.max(256).optional(),
|
|
15700
|
+
siteUrl: external_exports.string().refine(isCodexAccountSiteUrl, "Account site URL must be http(s)").optional()
|
|
15208
15701
|
}).strict();
|
|
15209
15702
|
var codexAccountPhaseSchema = external_exports.enum(["ready", "unavailable"]);
|
|
15210
15703
|
var codexAccountListResultSchema = external_exports.object({
|
|
@@ -19834,317 +20327,90 @@ var ClientSideConnection = class {
|
|
|
19834
20327
|
}
|
|
19835
20328
|
/**
|
|
19836
20329
|
* **UNSTABLE**: This capability is not part of the spec yet, and may be removed or changed at any point.
|
|
19837
|
-
*
|
|
19838
|
-
* Notifies the agent that a NES suggestion was rejected.
|
|
19839
|
-
*
|
|
19840
|
-
* @experimental
|
|
19841
|
-
*/
|
|
19842
|
-
unstable_rejectNes(params) {
|
|
19843
|
-
return this.connection.sendNotification(AGENT_METHODS.nes_reject, params);
|
|
19844
|
-
}
|
|
19845
|
-
request(method, params, options) {
|
|
19846
|
-
const spec = agentRequestSpecsByMethod[method];
|
|
19847
|
-
return this.connection.sendRequest(method, params, spec?.mapResponse, options);
|
|
19848
|
-
}
|
|
19849
|
-
notify(method, params) {
|
|
19850
|
-
return this.connection.sendNotification(method, params);
|
|
19851
|
-
}
|
|
19852
|
-
/**
|
|
19853
|
-
* Extension method.
|
|
19854
|
-
*
|
|
19855
|
-
* @deprecated Use {@link request}.
|
|
19856
|
-
*/
|
|
19857
|
-
extMethod(method, params) {
|
|
19858
|
-
return this.request(method, params);
|
|
19859
|
-
}
|
|
19860
|
-
/**
|
|
19861
|
-
* Extension notification.
|
|
19862
|
-
*
|
|
19863
|
-
* @deprecated Use {@link notify}.
|
|
19864
|
-
*/
|
|
19865
|
-
extNotification(method, params) {
|
|
19866
|
-
return this.notify(method, params);
|
|
19867
|
-
}
|
|
19868
|
-
/**
|
|
19869
|
-
* AbortSignal that aborts when the connection closes.
|
|
19870
|
-
*
|
|
19871
|
-
* This signal can be used to:
|
|
19872
|
-
* - Listen for connection closure: `connection.signal.addEventListener('abort', () => {...})`
|
|
19873
|
-
* - Check connection status synchronously: `if (connection.signal.aborted) {...}`
|
|
19874
|
-
* - Pass to other APIs (fetch, setTimeout) for automatic cancellation
|
|
19875
|
-
*
|
|
19876
|
-
* The connection closes when the underlying stream ends, either normally or due to an error.
|
|
19877
|
-
*
|
|
19878
|
-
* @example
|
|
19879
|
-
* ```typescript
|
|
19880
|
-
* const connection = new ClientSideConnection(client, stream);
|
|
19881
|
-
*
|
|
19882
|
-
* // Listen for closure
|
|
19883
|
-
* connection.signal.addEventListener('abort', () => {
|
|
19884
|
-
* console.log('Connection closed - performing cleanup');
|
|
19885
|
-
* });
|
|
19886
|
-
*
|
|
19887
|
-
* // Check status
|
|
19888
|
-
* if (connection.signal.aborted) {
|
|
19889
|
-
* console.log('Connection is already closed');
|
|
19890
|
-
* }
|
|
19891
|
-
*
|
|
19892
|
-
* // Pass to other APIs
|
|
19893
|
-
* fetch(url, { signal: connection.signal });
|
|
19894
|
-
* ```
|
|
19895
|
-
*/
|
|
19896
|
-
get signal() {
|
|
19897
|
-
return this.connection.signal;
|
|
19898
|
-
}
|
|
19899
|
-
/**
|
|
19900
|
-
* Promise that resolves when the connection closes.
|
|
19901
|
-
*
|
|
19902
|
-
* The connection closes when the underlying stream ends, either normally or due to an error.
|
|
19903
|
-
* Once closed, the connection cannot send or receive any more messages.
|
|
19904
|
-
*
|
|
19905
|
-
* This is useful for async/await style cleanup:
|
|
19906
|
-
*
|
|
19907
|
-
* @example
|
|
19908
|
-
* ```typescript
|
|
19909
|
-
* const connection = new ClientSideConnection(client, stream);
|
|
19910
|
-
* await connection.closed;
|
|
19911
|
-
* console.log('Connection closed - performing cleanup');
|
|
19912
|
-
* ```
|
|
19913
|
-
*/
|
|
19914
|
-
get closed() {
|
|
19915
|
-
return this.connection.closed;
|
|
19916
|
-
}
|
|
19917
|
-
};
|
|
19918
|
-
|
|
19919
|
-
// dist/command.js
|
|
19920
|
-
import path3 from "node:path";
|
|
19921
|
-
|
|
19922
|
-
// ../../harness-discovery/dist/environment.js
|
|
19923
|
-
import fs from "node:fs";
|
|
19924
|
-
import path from "node:path";
|
|
19925
|
-
function targetPath(platform) {
|
|
19926
|
-
return platform === "win32" ? path.win32 : path.posix;
|
|
19927
|
-
}
|
|
19928
|
-
function environmentValue(environment, name) {
|
|
19929
|
-
const lowered = name.toLowerCase();
|
|
19930
|
-
for (const [key, value] of Object.entries(environment)) {
|
|
19931
|
-
if (key.toLowerCase() === lowered)
|
|
19932
|
-
return value;
|
|
19933
|
-
}
|
|
19934
|
-
return void 0;
|
|
19935
|
-
}
|
|
19936
|
-
function pathDelimiter(platform) {
|
|
19937
|
-
return platform === "win32" ? ";" : ":";
|
|
19938
|
-
}
|
|
19939
|
-
function pathDirectories(environment, platform) {
|
|
19940
|
-
return (environmentValue(environment, "PATH") ?? "").split(pathDelimiter(platform)).map((directory) => directory.trim().replace(/^"|"$/gu, "")).filter(Boolean);
|
|
19941
|
-
}
|
|
19942
|
-
function executableExtensions(command, platform, environment) {
|
|
19943
|
-
if (platform !== "win32")
|
|
19944
|
-
return [""];
|
|
19945
|
-
if (targetPath(platform).extname(command) !== "")
|
|
19946
|
-
return [""];
|
|
19947
|
-
return (environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").map((extension) => extension.trim()).filter(Boolean);
|
|
19948
|
-
}
|
|
19949
|
-
function isExecutableFile(filePath, platform) {
|
|
19950
|
-
try {
|
|
19951
|
-
fs.accessSync(filePath, platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK);
|
|
19952
|
-
return fs.statSync(filePath).isFile();
|
|
19953
|
-
} catch {
|
|
19954
|
-
return false;
|
|
19955
|
-
}
|
|
19956
|
-
}
|
|
19957
|
-
function subdirectoryNames(directory) {
|
|
19958
|
-
try {
|
|
19959
|
-
return fs.readdirSync(directory, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
19960
|
-
} catch {
|
|
19961
|
-
return [];
|
|
19962
|
-
}
|
|
19963
|
-
}
|
|
19964
|
-
function newestFirst(names) {
|
|
19965
|
-
return [...names].sort((left, right) => right.localeCompare(left, void 0, { numeric: true }));
|
|
19966
|
-
}
|
|
19967
|
-
|
|
19968
|
-
// ../../harness-discovery/dist/invocation.js
|
|
19969
|
-
import path2 from "node:path";
|
|
19970
|
-
function commandInvocation(command, arguments_, environment, platform = process.platform) {
|
|
19971
|
-
const extension = path2.win32.extname(command).toLowerCase();
|
|
19972
|
-
if (platform !== "win32" || ![".cmd", ".bat"].includes(extension)) {
|
|
19973
|
-
return { command, arguments: [...arguments_], windowsVerbatimArguments: false };
|
|
19974
|
-
}
|
|
19975
|
-
const quote = (value) => `"${value.replaceAll("%", "%%").replaceAll('"', '""')}"`;
|
|
19976
|
-
const commandLine = [command, ...arguments_].map(quote).join(" ");
|
|
19977
|
-
return {
|
|
19978
|
-
command: environmentValue(environment, "ComSpec") ?? "cmd.exe",
|
|
19979
|
-
arguments: ["/d", "/v:off", "/s", "/c", `"${commandLine}"`],
|
|
19980
|
-
windowsVerbatimArguments: true
|
|
19981
|
-
};
|
|
19982
|
-
}
|
|
19983
|
-
|
|
19984
|
-
// ../../harness-discovery/dist/resolve.js
|
|
19985
|
-
import os from "node:os";
|
|
19986
|
-
|
|
19987
|
-
// ../../harness-discovery/dist/version-managers.js
|
|
19988
|
-
function versionManagerBinaryDirectories(context) {
|
|
19989
|
-
const { platform, environment, home } = context;
|
|
19990
|
-
const list = context.subdirectories ?? subdirectoryNames;
|
|
19991
|
-
const pathFlavor = targetPath(platform);
|
|
19992
|
-
const value = (name) => environmentValue(environment, name);
|
|
19993
|
-
const directories = [];
|
|
19994
|
-
const versioned = (root, ...tail) => {
|
|
19995
|
-
for (const version2 of newestFirst(list(root))) {
|
|
19996
|
-
directories.push(pathFlavor.join(root, version2, ...tail));
|
|
19997
|
-
}
|
|
19998
|
-
};
|
|
19999
|
-
if (platform === "win32") {
|
|
20000
|
-
const appData = value("APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming");
|
|
20001
|
-
const localAppData = value("LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local");
|
|
20002
|
-
versioned(pathFlavor.join(appData, "nvm"));
|
|
20003
|
-
versioned(value("FNM_DIR") ?? pathFlavor.join(appData, "fnm", "node-versions"), "installation");
|
|
20004
|
-
directories.push(pathFlavor.join(localAppData, "Volta", "bin"));
|
|
20005
|
-
directories.push(pathFlavor.join(home, ".bun", "bin"));
|
|
20006
|
-
const pnpmHome2 = value("PNPM_HOME");
|
|
20007
|
-
if (pnpmHome2)
|
|
20008
|
-
directories.push(pnpmHome2);
|
|
20009
|
-
directories.push(pathFlavor.join(localAppData, "pnpm"));
|
|
20010
|
-
return directories;
|
|
20011
|
-
}
|
|
20012
|
-
versioned(pathFlavor.join(value("NVM_DIR") ?? pathFlavor.join(home, ".nvm"), "versions", "node"), "bin");
|
|
20013
|
-
const fnmRoots = [
|
|
20014
|
-
value("FNM_DIR"),
|
|
20015
|
-
pathFlavor.join(home, ".local", "share", "fnm"),
|
|
20016
|
-
pathFlavor.join(home, "Library", "Application Support", "fnm")
|
|
20017
|
-
].filter((root) => root !== void 0);
|
|
20018
|
-
for (const root of fnmRoots) {
|
|
20019
|
-
versioned(pathFlavor.join(root, "node-versions"), "installation", "bin");
|
|
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);
|
|
20020
20337
|
}
|
|
20021
|
-
|
|
20022
|
-
|
|
20023
|
-
|
|
20024
|
-
const asdfHome = value("ASDF_DATA_DIR") ?? pathFlavor.join(home, ".asdf");
|
|
20025
|
-
versioned(pathFlavor.join(asdfHome, "installs", "nodejs"), "bin");
|
|
20026
|
-
directories.push(pathFlavor.join(asdfHome, "shims"));
|
|
20027
|
-
const nodenvHome = value("NODENV_ROOT") ?? pathFlavor.join(home, ".nodenv");
|
|
20028
|
-
versioned(pathFlavor.join(nodenvHome, "versions"), "bin");
|
|
20029
|
-
directories.push(pathFlavor.join(nodenvHome, "shims"));
|
|
20030
|
-
versioned(pathFlavor.join(value("N_PREFIX") ?? "/usr/local", "n", "versions", "node"), "bin");
|
|
20031
|
-
directories.push(pathFlavor.join(home, ".bun", "bin"));
|
|
20032
|
-
const pnpmHome = value("PNPM_HOME");
|
|
20033
|
-
if (pnpmHome)
|
|
20034
|
-
directories.push(pnpmHome);
|
|
20035
|
-
directories.push(pathFlavor.join(home, "Library", "pnpm"));
|
|
20036
|
-
directories.push(pathFlavor.join(home, ".local", "share", "pnpm"));
|
|
20037
|
-
for (const prefix of ["/opt/homebrew/opt", "/usr/local/opt"]) {
|
|
20038
|
-
for (const formula of newestFirst(list(prefix).filter((name) => name.startsWith("node@")))) {
|
|
20039
|
-
directories.push(pathFlavor.join(prefix, formula, "bin"));
|
|
20040
|
-
}
|
|
20338
|
+
request(method, params, options) {
|
|
20339
|
+
const spec = agentRequestSpecsByMethod[method];
|
|
20340
|
+
return this.connection.sendRequest(method, params, spec?.mapResponse, options);
|
|
20041
20341
|
}
|
|
20042
|
-
|
|
20043
|
-
|
|
20044
|
-
|
|
20045
|
-
// ../../harness-discovery/dist/resolve.js
|
|
20046
|
-
var VERSION_MANAGER_ROOTS = "<version-managers>";
|
|
20047
|
-
function installRootExtensions(platform) {
|
|
20048
|
-
return platform === "win32" ? [".exe", ".cmd"] : [""];
|
|
20049
|
-
}
|
|
20050
|
-
function resolveHomeDirectory(input) {
|
|
20051
|
-
return input.homeDirectory ?? environmentValue(input.environment, "HOME") ?? environmentValue(input.environment, "USERPROFILE") ?? os.homedir();
|
|
20052
|
-
}
|
|
20053
|
-
function templateVariables(environment, platform, home) {
|
|
20054
|
-
const pathFlavor = targetPath(platform);
|
|
20055
|
-
return {
|
|
20056
|
-
HOME: home,
|
|
20057
|
-
USERPROFILE: home,
|
|
20058
|
-
APPDATA: environmentValue(environment, "APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming"),
|
|
20059
|
-
LOCALAPPDATA: environmentValue(environment, "LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local")
|
|
20060
|
-
};
|
|
20061
|
-
}
|
|
20062
|
-
function joinTemplate(platform, value) {
|
|
20063
|
-
const pathFlavor = targetPath(platform);
|
|
20064
|
-
const segments = value.split("/");
|
|
20065
|
-
const head = segments[0] ?? "";
|
|
20066
|
-
const tail = segments.slice(1);
|
|
20067
|
-
if (head === "")
|
|
20068
|
-
return pathFlavor.join(pathFlavor.sep, ...tail);
|
|
20069
|
-
return tail.length === 0 ? head : pathFlavor.join(head, ...tail);
|
|
20070
|
-
}
|
|
20071
|
-
function expandInstallRoot(template, environment, platform, home) {
|
|
20072
|
-
const variables = templateVariables(environment, platform, home);
|
|
20073
|
-
let unresolved = false;
|
|
20074
|
-
const substituted = template.replace(/^~(?=\/|$)/u, home).replace(/\$\{(\w+)\}/gu, (_match, name) => {
|
|
20075
|
-
const value = variables[name] ?? environmentValue(environment, name);
|
|
20076
|
-
if (value === void 0 || value === "") {
|
|
20077
|
-
unresolved = true;
|
|
20078
|
-
return "";
|
|
20079
|
-
}
|
|
20080
|
-
return value;
|
|
20081
|
-
});
|
|
20082
|
-
return unresolved ? void 0 : joinTemplate(platform, substituted);
|
|
20083
|
-
}
|
|
20084
|
-
function installRootDirectories(spec, input, dependencies, platform, home) {
|
|
20085
|
-
const templates = (platform === "win32" ? spec.installRoots?.windows : spec.installRoots?.posix) ?? [];
|
|
20086
|
-
const directories = [];
|
|
20087
|
-
for (const template of templates) {
|
|
20088
|
-
if (template === VERSION_MANAGER_ROOTS) {
|
|
20089
|
-
directories.push(...versionManagerBinaryDirectories({
|
|
20090
|
-
platform,
|
|
20091
|
-
environment: input.environment,
|
|
20092
|
-
home,
|
|
20093
|
-
...dependencies.subdirectories ? { subdirectories: dependencies.subdirectories } : {}
|
|
20094
|
-
}));
|
|
20095
|
-
continue;
|
|
20096
|
-
}
|
|
20097
|
-
const directory = expandInstallRoot(template, input.environment, platform, home);
|
|
20098
|
-
if (directory !== void 0)
|
|
20099
|
-
directories.push(directory);
|
|
20342
|
+
notify(method, params) {
|
|
20343
|
+
return this.connection.sendNotification(method, params);
|
|
20100
20344
|
}
|
|
20101
|
-
|
|
20102
|
-
|
|
20103
|
-
|
|
20104
|
-
|
|
20105
|
-
|
|
20106
|
-
|
|
20107
|
-
|
|
20108
|
-
if (pathFlavor.isAbsolute(command) || command.includes("/") || command.includes("\\")) {
|
|
20109
|
-
return [{ candidate: command, source: "configured" }];
|
|
20345
|
+
/**
|
|
20346
|
+
* Extension method.
|
|
20347
|
+
*
|
|
20348
|
+
* @deprecated Use {@link request}.
|
|
20349
|
+
*/
|
|
20350
|
+
extMethod(method, params) {
|
|
20351
|
+
return this.request(method, params);
|
|
20110
20352
|
}
|
|
20111
|
-
|
|
20112
|
-
|
|
20113
|
-
|
|
20114
|
-
|
|
20115
|
-
|
|
20116
|
-
|
|
20117
|
-
|
|
20118
|
-
});
|
|
20119
|
-
}
|
|
20353
|
+
/**
|
|
20354
|
+
* Extension notification.
|
|
20355
|
+
*
|
|
20356
|
+
* @deprecated Use {@link notify}.
|
|
20357
|
+
*/
|
|
20358
|
+
extNotification(method, params) {
|
|
20359
|
+
return this.notify(method, params);
|
|
20120
20360
|
}
|
|
20121
|
-
|
|
20122
|
-
|
|
20123
|
-
|
|
20124
|
-
|
|
20125
|
-
|
|
20126
|
-
|
|
20127
|
-
|
|
20128
|
-
|
|
20129
|
-
|
|
20130
|
-
|
|
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;
|
|
20131
20391
|
}
|
|
20132
|
-
|
|
20133
|
-
|
|
20134
|
-
|
|
20135
|
-
|
|
20136
|
-
|
|
20137
|
-
|
|
20138
|
-
|
|
20139
|
-
|
|
20140
|
-
|
|
20141
|
-
|
|
20142
|
-
|
|
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;
|
|
20143
20409
|
}
|
|
20144
|
-
|
|
20145
|
-
}
|
|
20410
|
+
};
|
|
20146
20411
|
|
|
20147
20412
|
// dist/command.js
|
|
20413
|
+
import path4 from "node:path";
|
|
20148
20414
|
var HermesExecutableError = class extends Error {
|
|
20149
20415
|
code = "HERMES_NOT_FOUND";
|
|
20150
20416
|
};
|
|
@@ -20167,7 +20433,7 @@ function resolveHermesExecutable(input = {}) {
|
|
|
20167
20433
|
});
|
|
20168
20434
|
if (!resolution)
|
|
20169
20435
|
throw new HermesExecutableError("Hermes CLI is not installed");
|
|
20170
|
-
return targetPath(platform).isAbsolute(resolution.executable) ? resolution.executable :
|
|
20436
|
+
return targetPath(platform).isAbsolute(resolution.executable) ? resolution.executable : path4.resolve(resolution.executable);
|
|
20171
20437
|
}
|
|
20172
20438
|
function hermesInvocation(command, platform = process.platform) {
|
|
20173
20439
|
return commandInvocation(command, ["acp"], process.env, platform);
|
|
@@ -20591,7 +20857,7 @@ var HermesAcpTransport = class {
|
|
|
20591
20857
|
// dist/hermes-inventory.js
|
|
20592
20858
|
import { spawn as spawn2 } from "node:child_process";
|
|
20593
20859
|
import { access, readFile } from "node:fs/promises";
|
|
20594
|
-
import
|
|
20860
|
+
import path5 from "node:path";
|
|
20595
20861
|
|
|
20596
20862
|
// dist/hermes-models.js
|
|
20597
20863
|
var HERMES_MODE_DEFAULT = "default";
|
|
@@ -20764,7 +21030,7 @@ async function venvPythonFromShim(hermesExecutable, platform = process.platform)
|
|
|
20764
21030
|
const shim = await readFile(hermesExecutable, "utf8");
|
|
20765
21031
|
if (platform === "win32") {
|
|
20766
21032
|
const target = WINDOWS_VENV_HERMES_SHIM_PATTERN.exec(shim)?.[1];
|
|
20767
|
-
return target ?
|
|
21033
|
+
return target ? path5.win32.join(path5.win32.dirname(target), "python.exe") : null;
|
|
20768
21034
|
}
|
|
20769
21035
|
return POSIX_VENV_PYTHON_SHIM_PATTERN.exec(shim)?.[1] ?? null;
|
|
20770
21036
|
} catch {
|
|
@@ -20772,7 +21038,7 @@ async function venvPythonFromShim(hermesExecutable, platform = process.platform)
|
|
|
20772
21038
|
}
|
|
20773
21039
|
}
|
|
20774
21040
|
function inventoryPythonCandidates(hermesExecutable, platform = process.platform) {
|
|
20775
|
-
const pathApi = platform === "win32" ?
|
|
21041
|
+
const pathApi = platform === "win32" ? path5.win32 : path5.posix;
|
|
20776
21042
|
const executableDirectory = pathApi.dirname(hermesExecutable);
|
|
20777
21043
|
const environmentDirectory = pathApi.basename(executableDirectory).toLowerCase();
|
|
20778
21044
|
const candidates = [];
|
|
@@ -20789,7 +21055,7 @@ function inventoryPythonCandidates(hermesExecutable, platform = process.platform
|
|
|
20789
21055
|
function runProbe(pythonExecutable, timeoutMs, environment) {
|
|
20790
21056
|
return new Promise((resolve, reject) => {
|
|
20791
21057
|
const child = spawn2(pythonExecutable, ["-I", "-c", INVENTORY_PROBE_SCRIPT], {
|
|
20792
|
-
cwd:
|
|
21058
|
+
cwd: path5.dirname(pythonExecutable),
|
|
20793
21059
|
env: { ...process.env, ...environment },
|
|
20794
21060
|
stdio: ["ignore", "pipe", "pipe"]
|
|
20795
21061
|
});
|
|
@@ -21091,16 +21357,16 @@ var Diff = class {
|
|
|
21091
21357
|
}
|
|
21092
21358
|
}
|
|
21093
21359
|
}
|
|
21094
|
-
addToPath(
|
|
21095
|
-
const last =
|
|
21360
|
+
addToPath(path8, added, removed, oldPosInc, options) {
|
|
21361
|
+
const last = path8.lastComponent;
|
|
21096
21362
|
if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
|
|
21097
21363
|
return {
|
|
21098
|
-
oldPos:
|
|
21364
|
+
oldPos: path8.oldPos + oldPosInc,
|
|
21099
21365
|
lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
|
|
21100
21366
|
};
|
|
21101
21367
|
} else {
|
|
21102
21368
|
return {
|
|
21103
|
-
oldPos:
|
|
21369
|
+
oldPos: path8.oldPos + oldPosInc,
|
|
21104
21370
|
lastComponent: { count: 1, added, removed, previousComponent: last }
|
|
21105
21371
|
};
|
|
21106
21372
|
}
|
|
@@ -21415,8 +21681,8 @@ function hermesFileChanges(update) {
|
|
|
21415
21681
|
for (const block of update.content ?? []) {
|
|
21416
21682
|
if (block.type !== "diff")
|
|
21417
21683
|
continue;
|
|
21418
|
-
const { path:
|
|
21419
|
-
if (!
|
|
21684
|
+
const { path: path8, oldText, newText } = block;
|
|
21685
|
+
if (!path8.trim() || /[\0\r\n]/u.test(path8) || typeof newText !== "string")
|
|
21420
21686
|
continue;
|
|
21421
21687
|
if (oldText === newText)
|
|
21422
21688
|
continue;
|
|
@@ -21424,10 +21690,10 @@ function hermesFileChanges(update) {
|
|
|
21424
21690
|
if (bytes > MAX_DIFF_BYTES || changes.length === MAX_DIFFS)
|
|
21425
21691
|
return [];
|
|
21426
21692
|
changes.push({
|
|
21427
|
-
path:
|
|
21693
|
+
path: path8,
|
|
21428
21694
|
kind: "update",
|
|
21429
21695
|
diffScope: "fragment",
|
|
21430
|
-
unifiedDiff: createTwoFilesPatch(
|
|
21696
|
+
unifiedDiff: createTwoFilesPatch(path8, path8, oldText ?? "", newText, "", "", {
|
|
21431
21697
|
context: 3
|
|
21432
21698
|
})
|
|
21433
21699
|
});
|
|
@@ -22366,9 +22632,9 @@ import { access as access2 } from "node:fs/promises";
|
|
|
22366
22632
|
import { createInterface } from "node:readline";
|
|
22367
22633
|
|
|
22368
22634
|
// dist/gateway-delegation.js
|
|
22369
|
-
import { mkdtemp, writeFile, rm } from "node:fs/promises";
|
|
22635
|
+
import { mkdtemp as mkdtemp2, writeFile as writeFile2, rm as rm2 } from "node:fs/promises";
|
|
22370
22636
|
import os2 from "node:os";
|
|
22371
|
-
import
|
|
22637
|
+
import path6 from "node:path";
|
|
22372
22638
|
var HERMES_DELEGATION_GUIDANCE = `This Session runs inside codexhost.
|
|
22373
22639
|
When the user authorizes cross-Harness delegation, discover the executable named by CODEXHOST_CLI_PATH through your native terminal tool. Read its --help and harness list, then use delegate start and thread send/read/wait/cancel as documented. Prefer --format compact. Preserve CODEXHOST_RUNTIME_ENDPOINT, CODEXHOST_RUNTIME_TOKEN and CODEXHOST_THREAD_ID in these calls: they identify the Runtime and parent Thread. Never print their values or substitute another executable. Native Hermes delegate_task remains available for Hermes subagents.`;
|
|
22374
22640
|
var required2 = [
|
|
@@ -22381,10 +22647,10 @@ async function prepareGatewayDelegation(environment) {
|
|
|
22381
22647
|
if (!required2.every((key) => environment[key]))
|
|
22382
22648
|
return { environment, bootstrap: "", dispose: async () => {
|
|
22383
22649
|
} };
|
|
22384
|
-
const directory = await
|
|
22385
|
-
const file2 =
|
|
22650
|
+
const directory = await mkdtemp2(path6.join(os2.tmpdir(), "codexhost-hermes-delegation-"));
|
|
22651
|
+
const file2 = path6.join(directory, "SKILL.md");
|
|
22386
22652
|
try {
|
|
22387
|
-
await
|
|
22653
|
+
await writeFile2(file2, `---
|
|
22388
22654
|
name: delegation
|
|
22389
22655
|
description: Discover authorized codexhost agent collaboration.
|
|
22390
22656
|
---
|
|
@@ -22404,10 +22670,10 @@ from hermes_cli.plugins import PluginContext, PluginManifest, get_plugin_manager
|
|
|
22404
22670
|
PluginContext(PluginManifest(name="codexhost-runtime"), get_plugin_manager()).register_skill(
|
|
22405
22671
|
"delegation", Path(${JSON.stringify(file2)}))
|
|
22406
22672
|
`,
|
|
22407
|
-
dispose: () =>
|
|
22673
|
+
dispose: () => rm2(directory, { recursive: true, force: true })
|
|
22408
22674
|
};
|
|
22409
22675
|
} catch (error51) {
|
|
22410
|
-
await
|
|
22676
|
+
await rm2(directory, { recursive: true, force: true });
|
|
22411
22677
|
throw error51;
|
|
22412
22678
|
}
|
|
22413
22679
|
}
|
|
@@ -23054,6 +23320,29 @@ var HermesGatewayHistory = class {
|
|
|
23054
23320
|
}
|
|
23055
23321
|
};
|
|
23056
23322
|
|
|
23323
|
+
// dist/gateway-configuration.js
|
|
23324
|
+
import { execFile as execFile2 } from "node:child_process";
|
|
23325
|
+
import { promisify } from "node:util";
|
|
23326
|
+
async function resolveGatewayModel(transport, modelId) {
|
|
23327
|
+
if (/\s/u.test(modelId) || modelId.startsWith("-"))
|
|
23328
|
+
throw new Error("Invalid Hermes Model identifier");
|
|
23329
|
+
const result = await promisify(execFile2)(transport.python, [
|
|
23330
|
+
"-I",
|
|
23331
|
+
"-c",
|
|
23332
|
+
"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}))",
|
|
23333
|
+
modelId
|
|
23334
|
+
], {
|
|
23335
|
+
cwd: transport.cwd,
|
|
23336
|
+
env: { ...process.env, ...transport.environment },
|
|
23337
|
+
timeout: 2e4,
|
|
23338
|
+
maxBuffer: 1024 * 1024
|
|
23339
|
+
});
|
|
23340
|
+
const value = JSON.parse(result.stdout.trim());
|
|
23341
|
+
if (!value || typeof value !== "object" || !("provider" in value) || !("model" in value) || typeof value.provider !== "string" || typeof value.model !== "string")
|
|
23342
|
+
throw new Error("Hermes returned an invalid Model choice");
|
|
23343
|
+
return { provider: value.provider, model: value.model };
|
|
23344
|
+
}
|
|
23345
|
+
|
|
23057
23346
|
// dist/gateway-session-transport.js
|
|
23058
23347
|
var hermesGatewayThinkingOptions = [
|
|
23059
23348
|
"none",
|
|
@@ -23085,14 +23374,14 @@ function gatewayDiff(text2) {
|
|
|
23085
23374
|
if (!text2 || text2.length > 1024 * 1024)
|
|
23086
23375
|
return [];
|
|
23087
23376
|
const result = [];
|
|
23088
|
-
let
|
|
23377
|
+
let path8 = "";
|
|
23089
23378
|
let inHunk = false;
|
|
23090
23379
|
let oldLines = [], newLines = [];
|
|
23091
23380
|
const flush = () => {
|
|
23092
|
-
if (
|
|
23381
|
+
if (path8)
|
|
23093
23382
|
result.push({
|
|
23094
23383
|
type: "diff",
|
|
23095
|
-
path:
|
|
23384
|
+
path: path8,
|
|
23096
23385
|
oldText: oldLines.join("\n"),
|
|
23097
23386
|
newText: newLines.join("\n")
|
|
23098
23387
|
});
|
|
@@ -23105,24 +23394,24 @@ function gatewayDiff(text2) {
|
|
|
23105
23394
|
if (header) {
|
|
23106
23395
|
flush();
|
|
23107
23396
|
inHunk = false;
|
|
23108
|
-
|
|
23397
|
+
path8 = (header[2] === "/dev/null" ? header[1] ?? "" : header[2] ?? "").replace(/^[ab]\//u, "");
|
|
23109
23398
|
continue;
|
|
23110
23399
|
}
|
|
23111
23400
|
if (line.startsWith("--- ") && !inHunk) {
|
|
23112
23401
|
flush();
|
|
23113
|
-
|
|
23402
|
+
path8 = line.slice(4).replace(/^a\//u, "");
|
|
23114
23403
|
} else if (line.startsWith("+++ ") && !inHunk) {
|
|
23115
23404
|
const next = line.slice(4);
|
|
23116
23405
|
if (next !== "/dev/null")
|
|
23117
|
-
|
|
23406
|
+
path8 = next.replace(/^b\//u, "");
|
|
23118
23407
|
} else if (line.startsWith("@@")) {
|
|
23119
23408
|
inHunk = true;
|
|
23120
23409
|
continue;
|
|
23121
|
-
} else if (
|
|
23410
|
+
} else if (path8 && line.startsWith("-"))
|
|
23122
23411
|
oldLines.push(line.slice(1));
|
|
23123
|
-
else if (
|
|
23412
|
+
else if (path8 && line.startsWith("+"))
|
|
23124
23413
|
newLines.push(line.slice(1));
|
|
23125
|
-
else if (
|
|
23414
|
+
else if (path8 && line.startsWith(" ")) {
|
|
23126
23415
|
oldLines.push(line.slice(1));
|
|
23127
23416
|
newLines.push(line.slice(1));
|
|
23128
23417
|
}
|
|
@@ -23208,11 +23497,10 @@ var HermesGatewaySessionTransport = class {
|
|
|
23208
23497
|
return optionId;
|
|
23209
23498
|
}
|
|
23210
23499
|
async setModel(modelId) {
|
|
23211
|
-
|
|
23212
|
-
throw new Error("Invalid Hermes Model identifier");
|
|
23500
|
+
const choice = await resolveGatewayModel(this.transport, modelId);
|
|
23213
23501
|
const result = await this.transport.request("config.set", {
|
|
23214
23502
|
key: "model",
|
|
23215
|
-
value: modelId,
|
|
23503
|
+
value: choice.provider ? `${choice.model} --provider ${choice.provider}` : modelId,
|
|
23216
23504
|
scope: "session",
|
|
23217
23505
|
session_id: this.sessionId
|
|
23218
23506
|
});
|
|
@@ -23522,35 +23810,10 @@ var HermesGatewaySessionTransport = class {
|
|
|
23522
23810
|
};
|
|
23523
23811
|
|
|
23524
23812
|
// dist/gateway-open.js
|
|
23525
|
-
import
|
|
23813
|
+
import path7 from "node:path";
|
|
23526
23814
|
import { realpath } from "node:fs/promises";
|
|
23527
|
-
|
|
23528
|
-
// dist/gateway-configuration.js
|
|
23529
|
-
import { execFile } from "node:child_process";
|
|
23530
|
-
import { promisify } from "node:util";
|
|
23531
|
-
async function resolveGatewayModel(transport, modelId) {
|
|
23532
|
-
if (/\s/u.test(modelId) || modelId.startsWith("-"))
|
|
23533
|
-
throw new Error("Invalid Hermes Model identifier");
|
|
23534
|
-
const result = await promisify(execFile)(transport.python, [
|
|
23535
|
-
"-I",
|
|
23536
|
-
"-c",
|
|
23537
|
-
"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}))",
|
|
23538
|
-
modelId
|
|
23539
|
-
], {
|
|
23540
|
-
cwd: transport.cwd,
|
|
23541
|
-
env: { ...process.env, ...transport.environment },
|
|
23542
|
-
timeout: 2e4,
|
|
23543
|
-
maxBuffer: 1024 * 1024
|
|
23544
|
-
});
|
|
23545
|
-
const value = JSON.parse(result.stdout.trim());
|
|
23546
|
-
if (!value || typeof value !== "object" || !("provider" in value) || !("model" in value) || typeof value.provider !== "string" || typeof value.model !== "string")
|
|
23547
|
-
throw new Error("Hermes returned an invalid Model choice");
|
|
23548
|
-
return { provider: value.provider, model: value.model };
|
|
23549
|
-
}
|
|
23550
|
-
|
|
23551
|
-
// dist/gateway-open.js
|
|
23552
23815
|
async function sameDirectory(left, right) {
|
|
23553
|
-
return await realpath(left).catch(() =>
|
|
23816
|
+
return await realpath(left).catch(() => path7.resolve(left)) === await realpath(right).catch(() => path7.resolve(right));
|
|
23554
23817
|
}
|
|
23555
23818
|
var gatewayCapabilities = {
|
|
23556
23819
|
configuration: {
|
|
@@ -24138,13 +24401,73 @@ function failure(code, message, retryable = false) {
|
|
|
24138
24401
|
return { ok: false, error: { code, message, retryable } };
|
|
24139
24402
|
}
|
|
24140
24403
|
|
|
24404
|
+
// dist/installation.js
|
|
24405
|
+
function createHermesInstallation(environment, command) {
|
|
24406
|
+
let executable;
|
|
24407
|
+
return createInstallationManager({
|
|
24408
|
+
async check() {
|
|
24409
|
+
executable = resolveHermesExecutable({ environment, ...command ? { command } : {} });
|
|
24410
|
+
const run = (args) => runInstallationCommand(executable, args, environment);
|
|
24411
|
+
const versionOutput = await run(["--version"]);
|
|
24412
|
+
const version2 = versionOutput.match(/^Hermes Agent v?([\w.+?-]{1,96})(?:\s|$)/m)?.[1];
|
|
24413
|
+
if (!version2)
|
|
24414
|
+
throw new Error("Hermes returned an unknown version response");
|
|
24415
|
+
const help = await run(["update", "--help"]);
|
|
24416
|
+
if (!help.includes("--plan") || !help.includes("--check"))
|
|
24417
|
+
return {
|
|
24418
|
+
currentVersion: version2,
|
|
24419
|
+
latestVersion: "Unknown",
|
|
24420
|
+
updateAvailable: false,
|
|
24421
|
+
canUpdate: false,
|
|
24422
|
+
message: "This Hermes release does not expose a safe update plan. Use the original installer."
|
|
24423
|
+
};
|
|
24424
|
+
const plan = await run(["update", "--plan"]);
|
|
24425
|
+
const sha = plan.match(/Install:.* @ ([a-f0-9]{8,40})\)/i)?.[1];
|
|
24426
|
+
const currentVersion = `${version2}${sha ? ` @ ${sha}` : ""}`;
|
|
24427
|
+
if (!/Install:\s*git\b/i.test(plan) || /NOT updatable in place/i.test(plan))
|
|
24428
|
+
return {
|
|
24429
|
+
currentVersion,
|
|
24430
|
+
latestVersion: "Unknown",
|
|
24431
|
+
updateAvailable: false,
|
|
24432
|
+
canUpdate: false,
|
|
24433
|
+
message: "This Hermes installation is managed externally. Update it through its desktop app, container, or original package manager."
|
|
24434
|
+
};
|
|
24435
|
+
const output = await run(["update", "--check"]);
|
|
24436
|
+
const updateAvailable = /(?:selected release|update) available/i.test(output);
|
|
24437
|
+
if (!updateAvailable && !/up.to.date/i.test(output))
|
|
24438
|
+
throw new Error("Hermes update check returned an unknown response");
|
|
24439
|
+
const release = output.match(/Selected release available:\s*([\w.+-]+)/i)?.[1];
|
|
24440
|
+
const latestVersion = updateAvailable ? release ?? "Tracking branch (new commits)" : currentVersion;
|
|
24441
|
+
const root = versionOutput.match(/^Install directory:\s*(.+)$/m)?.[1]?.trim();
|
|
24442
|
+
const clean = root ? await runInstallationCommand("git", ["-C", root, "status", "--porcelain"], environment).then((output2) => !output2.trim(), () => false) : false;
|
|
24443
|
+
const canUpdate = !!sha && clean && help.includes("--yes") && help.includes("--no-gateway-restart");
|
|
24444
|
+
return {
|
|
24445
|
+
currentVersion,
|
|
24446
|
+
latestVersion,
|
|
24447
|
+
updateAvailable,
|
|
24448
|
+
canUpdate,
|
|
24449
|
+
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."
|
|
24450
|
+
};
|
|
24451
|
+
},
|
|
24452
|
+
async update() {
|
|
24453
|
+
await runInstallationCommand(executable, ["update", "--yes", "--no-gateway-restart"], environment, 3e5);
|
|
24454
|
+
}
|
|
24455
|
+
});
|
|
24456
|
+
}
|
|
24457
|
+
|
|
24141
24458
|
// dist/plugin.js
|
|
24142
24459
|
var HERMES_COMMAND_ENV = "CODEXHOST_HERMES_COMMAND";
|
|
24143
24460
|
function createHarnessAdapter(context) {
|
|
24144
24461
|
const environment = { ...context.environment };
|
|
24145
|
-
return new HermesAdapter({
|
|
24462
|
+
return Object.assign(new HermesAdapter({
|
|
24146
24463
|
...environment[HERMES_COMMAND_ENV] ? { command: environment[HERMES_COMMAND_ENV] } : {},
|
|
24147
24464
|
environment
|
|
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
|
+
})
|
|
24148
24471
|
});
|
|
24149
24472
|
}
|
|
24150
24473
|
export {
|