@liberseek/boft-cli-win32-arm64 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.exe +0 -0
- package/libexec/boft-node-repl.exe +0 -0
- package/libexec/boft-shim.exe +0 -0
- package/libexec/boft-updater.exe +0 -0
- package/package.json +1 -1
|
@@ -5,6 +5,488 @@ var __export = (target, all) => {
|
|
|
5
5
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
+
// ../../harness-discovery/dist/environment.js
|
|
9
|
+
import fs from "node:fs";
|
|
10
|
+
import path from "node:path";
|
|
11
|
+
function targetPath(platform) {
|
|
12
|
+
return platform === "win32" ? path.win32 : path.posix;
|
|
13
|
+
}
|
|
14
|
+
function environmentValue(environment, name) {
|
|
15
|
+
const lowered = name.toLowerCase();
|
|
16
|
+
for (const [key, value] of Object.entries(environment)) {
|
|
17
|
+
if (key.toLowerCase() === lowered)
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
20
|
+
return void 0;
|
|
21
|
+
}
|
|
22
|
+
function pathDelimiter(platform) {
|
|
23
|
+
return platform === "win32" ? ";" : ":";
|
|
24
|
+
}
|
|
25
|
+
function pathDirectories(environment, platform) {
|
|
26
|
+
return (environmentValue(environment, "PATH") ?? "").split(pathDelimiter(platform)).map((directory) => directory.trim().replace(/^"|"$/gu, "")).filter(Boolean);
|
|
27
|
+
}
|
|
28
|
+
function executableExtensions(command, platform, environment) {
|
|
29
|
+
if (platform !== "win32")
|
|
30
|
+
return [""];
|
|
31
|
+
if (targetPath(platform).extname(command) !== "")
|
|
32
|
+
return [""];
|
|
33
|
+
return (environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").map((extension) => extension.trim()).filter(Boolean);
|
|
34
|
+
}
|
|
35
|
+
function isExecutableFile(filePath, platform) {
|
|
36
|
+
try {
|
|
37
|
+
fs.accessSync(filePath, platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK);
|
|
38
|
+
return fs.statSync(filePath).isFile();
|
|
39
|
+
} catch {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function subdirectoryNames(directory) {
|
|
44
|
+
try {
|
|
45
|
+
return fs.readdirSync(directory, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
46
|
+
} catch {
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function newestFirst(names) {
|
|
51
|
+
return [...names].sort((left, right) => right.localeCompare(left, void 0, { numeric: true }));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// ../../harness-discovery/dist/invocation.js
|
|
55
|
+
import path2 from "node:path";
|
|
56
|
+
function commandInvocation(command, arguments_, environment, platform = process.platform) {
|
|
57
|
+
const extension = path2.win32.extname(command).toLowerCase();
|
|
58
|
+
if (platform !== "win32" || ![".cmd", ".bat"].includes(extension)) {
|
|
59
|
+
return { command, arguments: [...arguments_], windowsVerbatimArguments: false };
|
|
60
|
+
}
|
|
61
|
+
const quote = (value) => `"${value.replaceAll("%", "%%").replaceAll('"', '""')}"`;
|
|
62
|
+
const commandLine = [command, ...arguments_].map(quote).join(" ");
|
|
63
|
+
return {
|
|
64
|
+
command: environmentValue(environment, "ComSpec") ?? "cmd.exe",
|
|
65
|
+
arguments: ["/d", "/v:off", "/s", "/c", `"${commandLine}"`],
|
|
66
|
+
windowsVerbatimArguments: true
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// ../../harness-discovery/dist/node-runtime.js
|
|
71
|
+
import path3 from "node:path";
|
|
72
|
+
function withNodeRuntimeOnPath(environment, runtimeExecutable = process.execPath, platform = process.platform) {
|
|
73
|
+
const pathKey = Object.keys(environment).find((name) => name.toLowerCase() === "path") ?? "PATH";
|
|
74
|
+
const delimiter = platform === "win32" ? ";" : ":";
|
|
75
|
+
const runtimeDirectory = path3.dirname(runtimeExecutable);
|
|
76
|
+
const directories = (environment[pathKey] ?? "").split(delimiter).filter(Boolean);
|
|
77
|
+
const equal = platform === "win32" ? (value) => value.toLowerCase() : (value) => value;
|
|
78
|
+
if (!directories.some((directory) => equal(directory) === equal(runtimeDirectory))) {
|
|
79
|
+
directories.push(runtimeDirectory);
|
|
80
|
+
}
|
|
81
|
+
return { ...environment, [pathKey]: directories.join(delimiter) };
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// ../../harness-discovery/dist/resolve.js
|
|
85
|
+
import os from "node:os";
|
|
86
|
+
|
|
87
|
+
// ../../harness-discovery/dist/version-managers.js
|
|
88
|
+
function versionManagerBinaryDirectories(context) {
|
|
89
|
+
const { platform, environment, home } = context;
|
|
90
|
+
const list = context.subdirectories ?? subdirectoryNames;
|
|
91
|
+
const pathFlavor = targetPath(platform);
|
|
92
|
+
const value = (name) => environmentValue(environment, name);
|
|
93
|
+
const directories = [];
|
|
94
|
+
const versioned = (root, ...tail) => {
|
|
95
|
+
for (const version2 of newestFirst(list(root))) {
|
|
96
|
+
directories.push(pathFlavor.join(root, version2, ...tail));
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
if (platform === "win32") {
|
|
100
|
+
const appData = value("APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming");
|
|
101
|
+
const localAppData = value("LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local");
|
|
102
|
+
versioned(pathFlavor.join(appData, "nvm"));
|
|
103
|
+
versioned(value("FNM_DIR") ?? pathFlavor.join(appData, "fnm", "node-versions"), "installation");
|
|
104
|
+
directories.push(pathFlavor.join(localAppData, "Volta", "bin"));
|
|
105
|
+
directories.push(pathFlavor.join(home, ".bun", "bin"));
|
|
106
|
+
const pnpmHome2 = value("PNPM_HOME");
|
|
107
|
+
if (pnpmHome2)
|
|
108
|
+
directories.push(pnpmHome2);
|
|
109
|
+
directories.push(pathFlavor.join(localAppData, "pnpm"));
|
|
110
|
+
return directories;
|
|
111
|
+
}
|
|
112
|
+
versioned(pathFlavor.join(value("NVM_DIR") ?? pathFlavor.join(home, ".nvm"), "versions", "node"), "bin");
|
|
113
|
+
const fnmRoots = [
|
|
114
|
+
value("FNM_DIR"),
|
|
115
|
+
pathFlavor.join(home, ".local", "share", "fnm"),
|
|
116
|
+
pathFlavor.join(home, "Library", "Application Support", "fnm")
|
|
117
|
+
].filter((root) => root !== void 0);
|
|
118
|
+
for (const root of fnmRoots) {
|
|
119
|
+
versioned(pathFlavor.join(root, "node-versions"), "installation", "bin");
|
|
120
|
+
}
|
|
121
|
+
const voltaHome = value("VOLTA_HOME") ?? pathFlavor.join(home, ".volta");
|
|
122
|
+
versioned(pathFlavor.join(voltaHome, "tools", "image", "node"), "bin");
|
|
123
|
+
directories.push(pathFlavor.join(voltaHome, "bin"));
|
|
124
|
+
const asdfHome = value("ASDF_DATA_DIR") ?? pathFlavor.join(home, ".asdf");
|
|
125
|
+
versioned(pathFlavor.join(asdfHome, "installs", "nodejs"), "bin");
|
|
126
|
+
directories.push(pathFlavor.join(asdfHome, "shims"));
|
|
127
|
+
const nodenvHome = value("NODENV_ROOT") ?? pathFlavor.join(home, ".nodenv");
|
|
128
|
+
versioned(pathFlavor.join(nodenvHome, "versions"), "bin");
|
|
129
|
+
directories.push(pathFlavor.join(nodenvHome, "shims"));
|
|
130
|
+
versioned(pathFlavor.join(value("N_PREFIX") ?? "/usr/local", "n", "versions", "node"), "bin");
|
|
131
|
+
directories.push(pathFlavor.join(home, ".bun", "bin"));
|
|
132
|
+
const pnpmHome = value("PNPM_HOME");
|
|
133
|
+
if (pnpmHome)
|
|
134
|
+
directories.push(pnpmHome);
|
|
135
|
+
directories.push(pathFlavor.join(home, "Library", "pnpm"));
|
|
136
|
+
directories.push(pathFlavor.join(home, ".local", "share", "pnpm"));
|
|
137
|
+
for (const prefix of ["/opt/homebrew/opt", "/usr/local/opt"]) {
|
|
138
|
+
for (const formula of newestFirst(list(prefix).filter((name) => name.startsWith("node@")))) {
|
|
139
|
+
directories.push(pathFlavor.join(prefix, formula, "bin"));
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return directories;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// ../../harness-discovery/dist/resolve.js
|
|
146
|
+
var VERSION_MANAGER_ROOTS = "<version-managers>";
|
|
147
|
+
function installRootExtensions(platform) {
|
|
148
|
+
return platform === "win32" ? [".exe", ".cmd"] : [""];
|
|
149
|
+
}
|
|
150
|
+
function resolveHomeDirectory(input) {
|
|
151
|
+
return input.homeDirectory ?? environmentValue(input.environment, "HOME") ?? environmentValue(input.environment, "USERPROFILE") ?? os.homedir();
|
|
152
|
+
}
|
|
153
|
+
function templateVariables(environment, platform, home) {
|
|
154
|
+
const pathFlavor = targetPath(platform);
|
|
155
|
+
return {
|
|
156
|
+
HOME: home,
|
|
157
|
+
USERPROFILE: home,
|
|
158
|
+
APPDATA: environmentValue(environment, "APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming"),
|
|
159
|
+
LOCALAPPDATA: environmentValue(environment, "LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local")
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
function joinTemplate(platform, value) {
|
|
163
|
+
const pathFlavor = targetPath(platform);
|
|
164
|
+
const segments = value.split("/");
|
|
165
|
+
const head = segments[0] ?? "";
|
|
166
|
+
const tail = segments.slice(1);
|
|
167
|
+
if (head === "")
|
|
168
|
+
return pathFlavor.join(pathFlavor.sep, ...tail);
|
|
169
|
+
return tail.length === 0 ? head : pathFlavor.join(head, ...tail);
|
|
170
|
+
}
|
|
171
|
+
function expandInstallRoot(template, environment, platform, home) {
|
|
172
|
+
const variables = templateVariables(environment, platform, home);
|
|
173
|
+
let unresolved = false;
|
|
174
|
+
const substituted = template.replace(/^~(?=\/|$)/u, home).replace(/\$\{(\w+)\}/gu, (_match, name) => {
|
|
175
|
+
const value = variables[name] ?? environmentValue(environment, name);
|
|
176
|
+
if (value === void 0 || value === "") {
|
|
177
|
+
unresolved = true;
|
|
178
|
+
return "";
|
|
179
|
+
}
|
|
180
|
+
return value;
|
|
181
|
+
});
|
|
182
|
+
return unresolved ? void 0 : joinTemplate(platform, substituted);
|
|
183
|
+
}
|
|
184
|
+
function installRootDirectories(spec, input, dependencies, platform, home) {
|
|
185
|
+
const templates = (platform === "win32" ? spec.installRoots?.windows : spec.installRoots?.posix) ?? [];
|
|
186
|
+
const directories = [];
|
|
187
|
+
for (const template of templates) {
|
|
188
|
+
if (template === VERSION_MANAGER_ROOTS) {
|
|
189
|
+
directories.push(...versionManagerBinaryDirectories({
|
|
190
|
+
platform,
|
|
191
|
+
environment: input.environment,
|
|
192
|
+
home,
|
|
193
|
+
...dependencies.subdirectories ? { subdirectories: dependencies.subdirectories } : {}
|
|
194
|
+
}));
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
const directory = expandInstallRoot(template, input.environment, platform, home);
|
|
198
|
+
if (directory !== void 0)
|
|
199
|
+
directories.push(directory);
|
|
200
|
+
}
|
|
201
|
+
return directories;
|
|
202
|
+
}
|
|
203
|
+
function harnessCandidates(spec, input, dependencies = {}) {
|
|
204
|
+
const platform = input.platform ?? process.platform;
|
|
205
|
+
const pathFlavor = targetPath(platform);
|
|
206
|
+
const configured = input.command ?? (spec.commandEnvironmentVariable ? environmentValue(input.environment, spec.commandEnvironmentVariable) : void 0);
|
|
207
|
+
const command = configured ?? spec.command;
|
|
208
|
+
if (pathFlavor.isAbsolute(command) || command.includes("/") || command.includes("\\")) {
|
|
209
|
+
return [{ candidate: command, source: "configured" }];
|
|
210
|
+
}
|
|
211
|
+
const candidates = [];
|
|
212
|
+
const extensions = executableExtensions(command, platform, input.environment);
|
|
213
|
+
for (const directory of pathDirectories(input.environment, platform)) {
|
|
214
|
+
for (const extension of extensions) {
|
|
215
|
+
candidates.push({
|
|
216
|
+
candidate: pathFlavor.join(directory, command + extension),
|
|
217
|
+
source: "path"
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
if (configured !== void 0)
|
|
222
|
+
return candidates;
|
|
223
|
+
const home = resolveHomeDirectory(input);
|
|
224
|
+
for (const directory of installRootDirectories(spec, input, dependencies, platform, home)) {
|
|
225
|
+
for (const extension of installRootExtensions(platform)) {
|
|
226
|
+
candidates.push({
|
|
227
|
+
candidate: pathFlavor.join(directory, spec.command + extension),
|
|
228
|
+
source: "install-root"
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return candidates;
|
|
233
|
+
}
|
|
234
|
+
function resolveHarnessExecutable(spec, input, dependencies = {}) {
|
|
235
|
+
const platform = input.platform ?? process.platform;
|
|
236
|
+
const isExecutable = dependencies.isExecutable ?? ((candidate) => isExecutableFile(candidate, platform));
|
|
237
|
+
const runnable = spec.runnableCandidate ?? ((candidate) => candidate);
|
|
238
|
+
const context = { platform, isExecutable };
|
|
239
|
+
for (const { candidate, source } of harnessCandidates(spec, input, dependencies)) {
|
|
240
|
+
const executable = runnable(candidate, context);
|
|
241
|
+
if (executable !== void 0 && isExecutable(executable))
|
|
242
|
+
return { executable, source };
|
|
243
|
+
}
|
|
244
|
+
return void 0;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// ../../harness-discovery/dist/installation.js
|
|
248
|
+
import { execFile } from "node:child_process";
|
|
249
|
+
import { homedir } from "node:os";
|
|
250
|
+
function runInstallationCommand(command, args, environment, timeout = 3e4) {
|
|
251
|
+
const env = withNodeRuntimeOnPath(environment);
|
|
252
|
+
const invocation = /\.[cm]?js$/i.test(command) ? commandInvocation(process.execPath, [command, ...args], env) : commandInvocation(command, args, env);
|
|
253
|
+
return new Promise((resolve, reject) => {
|
|
254
|
+
const child = execFile(invocation.command, invocation.arguments, {
|
|
255
|
+
env,
|
|
256
|
+
cwd: env.HOME ?? env.USERPROFILE ?? homedir(),
|
|
257
|
+
encoding: "utf8",
|
|
258
|
+
timeout,
|
|
259
|
+
killSignal: "SIGKILL",
|
|
260
|
+
maxBuffer: 1024 * 1024,
|
|
261
|
+
windowsHide: true,
|
|
262
|
+
windowsVerbatimArguments: invocation.windowsVerbatimArguments
|
|
263
|
+
}, (error51, stdout, stderr) => {
|
|
264
|
+
if (error51)
|
|
265
|
+
reject(new Error(error51.killed ? "Harness command timed out" : "Harness command failed; check the native installation and retry"));
|
|
266
|
+
else
|
|
267
|
+
resolve((stdout || stderr).trim());
|
|
268
|
+
});
|
|
269
|
+
child.stdin?.end();
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
function installationVersion(value) {
|
|
273
|
+
if (typeof value !== "string" || !/^v?\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?$/.test(value.trim()))
|
|
274
|
+
throw new Error("Harness returned an invalid version");
|
|
275
|
+
return value.trim().replace(/^v/, "");
|
|
276
|
+
}
|
|
277
|
+
function versionFromOutput(output) {
|
|
278
|
+
return installationVersion(output.match(/\b\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?\b/)?.[0]);
|
|
279
|
+
}
|
|
280
|
+
function newerInstallationVersion(current, latest) {
|
|
281
|
+
const a = installationVersion(current).replace(/\+.*/, "");
|
|
282
|
+
const b = installationVersion(latest).replace(/\+.*/, "");
|
|
283
|
+
const coreA = a.replace(/-.*/, "").split(".").map(BigInt);
|
|
284
|
+
const coreB = b.replace(/-.*/, "").split(".").map(BigInt);
|
|
285
|
+
for (let i = 0; i < Math.max(coreA.length, coreB.length); i++) {
|
|
286
|
+
if ((coreA[i] ?? 0n) !== (coreB[i] ?? 0n))
|
|
287
|
+
return (coreB[i] ?? 0n) > (coreA[i] ?? 0n);
|
|
288
|
+
}
|
|
289
|
+
const preA = a.includes("-") ? a.slice(a.indexOf("-") + 1).split(".") : [];
|
|
290
|
+
const preB = b.includes("-") ? b.slice(b.indexOf("-") + 1).split(".") : [];
|
|
291
|
+
if (!preA.length || !preB.length)
|
|
292
|
+
return !!preA.length && !preB.length;
|
|
293
|
+
for (let i = 0; i < Math.max(preA.length, preB.length); i++) {
|
|
294
|
+
const x = preA[i];
|
|
295
|
+
const y = preB[i];
|
|
296
|
+
if (x === y)
|
|
297
|
+
continue;
|
|
298
|
+
if (x === void 0 || y === void 0)
|
|
299
|
+
return x === void 0;
|
|
300
|
+
const numericX = /^\d+$/.test(x);
|
|
301
|
+
const numericY = /^\d+$/.test(y);
|
|
302
|
+
if (numericX && numericY) {
|
|
303
|
+
if (BigInt(x) === BigInt(y))
|
|
304
|
+
continue;
|
|
305
|
+
return BigInt(y) > BigInt(x);
|
|
306
|
+
}
|
|
307
|
+
if (numericX !== numericY)
|
|
308
|
+
return numericX;
|
|
309
|
+
return y > x;
|
|
310
|
+
}
|
|
311
|
+
return false;
|
|
312
|
+
}
|
|
313
|
+
function createInstallationManager(options) {
|
|
314
|
+
let checking;
|
|
315
|
+
let updating;
|
|
316
|
+
const check2 = () => checking ??= options.check().finally(() => {
|
|
317
|
+
checking = void 0;
|
|
318
|
+
});
|
|
319
|
+
return (action) => {
|
|
320
|
+
if (updating)
|
|
321
|
+
return updating;
|
|
322
|
+
if (action === "check")
|
|
323
|
+
return check2();
|
|
324
|
+
updating = (async () => {
|
|
325
|
+
const before = await check2();
|
|
326
|
+
if (!before.updateAvailable)
|
|
327
|
+
return before;
|
|
328
|
+
if (!before.canUpdate)
|
|
329
|
+
throw new Error(before.message ?? "This installation cannot be updated automatically");
|
|
330
|
+
await options.update(before);
|
|
331
|
+
const after = await check2();
|
|
332
|
+
if (after.currentVersion === before.currentVersion)
|
|
333
|
+
throw new Error("The Harness version did not change; check the native updater and retry");
|
|
334
|
+
return after;
|
|
335
|
+
})().finally(() => {
|
|
336
|
+
updating = void 0;
|
|
337
|
+
});
|
|
338
|
+
return updating;
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
async function fetchInstallationText(url2) {
|
|
342
|
+
const request = async () => {
|
|
343
|
+
const response = await fetch(url2, { signal: AbortSignal.timeout(15e3) });
|
|
344
|
+
if (!response.ok)
|
|
345
|
+
throw new Error("Could not check the latest Harness version");
|
|
346
|
+
return response.text();
|
|
347
|
+
};
|
|
348
|
+
try {
|
|
349
|
+
return await request();
|
|
350
|
+
} catch (error51) {
|
|
351
|
+
if (error51 instanceof DOMException && (error51.name === "AbortError" || error51.name === "TimeoutError"))
|
|
352
|
+
throw error51;
|
|
353
|
+
return request();
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
// ../../harness-discovery/dist/npm-installation.js
|
|
358
|
+
import { readFile, realpath } from "node:fs/promises";
|
|
359
|
+
import path4 from "node:path";
|
|
360
|
+
function referencesNpmBin(shim, name, bin) {
|
|
361
|
+
if (bin.includes(".."))
|
|
362
|
+
return false;
|
|
363
|
+
const target = `node_modules/${name}/${bin.replace(/^\.\//, "")}`.toLowerCase();
|
|
364
|
+
const text2 = shim.replaceAll("\\", "/").toLowerCase();
|
|
365
|
+
return text2.includes(`%dp0%/${target}"`) || text2.includes(`%~dp0/${target}"`);
|
|
366
|
+
}
|
|
367
|
+
async function npmInstallation(command, packages, environment) {
|
|
368
|
+
let selected = await realpath(command);
|
|
369
|
+
if (process.platform === "win32" && /\.(cmd|bat)$/i.test(selected)) {
|
|
370
|
+
const shim = (await readFile(selected, "utf8")).replaceAll("\\", "/");
|
|
371
|
+
const root = path4.dirname(selected);
|
|
372
|
+
for (const name of packages) {
|
|
373
|
+
const directory2 = path4.join(root, "node_modules", ...name.split("/"));
|
|
374
|
+
const metadata = await readFile(path4.join(directory2, "package.json"), "utf8").then((text2) => JSON.parse(text2)).catch(() => null);
|
|
375
|
+
const bins = typeof metadata?.bin === "string" ? [metadata.bin] : Object.values(metadata?.bin ?? {});
|
|
376
|
+
const bin = bins.find((entry) => referencesNpmBin(shim, name, entry));
|
|
377
|
+
if (bin) {
|
|
378
|
+
selected = await realpath(path4.join(directory2, bin));
|
|
379
|
+
break;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
let directory = path4.dirname(selected);
|
|
384
|
+
for (let depth = 0; depth < 8; depth++) {
|
|
385
|
+
const metadata = await readFile(path4.join(directory, "package.json"), "utf8").then((text2) => JSON.parse(text2)).catch(() => null);
|
|
386
|
+
if (metadata?.name && packages.includes(metadata.name)) {
|
|
387
|
+
const name = metadata.name;
|
|
388
|
+
const currentVersion = installationVersion(metadata.version);
|
|
389
|
+
const segments = name.split("/");
|
|
390
|
+
let modules = directory;
|
|
391
|
+
for (let index = 0; index < segments.length; index++)
|
|
392
|
+
modules = path4.dirname(modules);
|
|
393
|
+
const prefix = process.platform === "win32" ? path4.dirname(modules) : path4.dirname(path4.dirname(modules));
|
|
394
|
+
const globalRoot = process.platform === "win32" ? path4.join(prefix, "node_modules") : path4.join(prefix, "lib", "node_modules");
|
|
395
|
+
const env = withNodeRuntimeOnPath(environment);
|
|
396
|
+
const npm = resolveHarnessExecutable({ id: "npm", command: "npm", installRoots: { posix: [], windows: [] } }, { environment: env });
|
|
397
|
+
let globalInstall = modules === globalRoot;
|
|
398
|
+
if (process.platform === "win32") {
|
|
399
|
+
const project = (await Promise.all(["package.json", "package-lock.json", "npm-shrinkwrap.json"].map((file2) => readFile(path4.join(prefix, file2), "utf8").then(() => true, (error51) => error51.code !== "ENOENT")))).some(Boolean);
|
|
400
|
+
const bins = typeof metadata.bin === "string" ? { [name.split("/").at(-1) ?? name]: metadata.bin } : metadata.bin ?? {};
|
|
401
|
+
const launchers = await Promise.all(Object.entries(bins).map(async ([bin, entry]) => {
|
|
402
|
+
if (path4.basename(bin) !== bin || entry.includes(".."))
|
|
403
|
+
return false;
|
|
404
|
+
const target = await realpath(path4.join(directory, entry)).catch(() => "");
|
|
405
|
+
if (target.toLowerCase() !== selected.toLowerCase())
|
|
406
|
+
return false;
|
|
407
|
+
const shim = await readFile(path4.join(prefix, `${bin}.cmd`), "utf8").catch(() => "");
|
|
408
|
+
return referencesNpmBin(shim, name, entry);
|
|
409
|
+
}));
|
|
410
|
+
globalInstall = globalInstall && !project && launchers.some(Boolean);
|
|
411
|
+
}
|
|
412
|
+
const canUpdate = globalInstall && !!npm;
|
|
413
|
+
return {
|
|
414
|
+
prefix,
|
|
415
|
+
currentVersion,
|
|
416
|
+
canUpdate,
|
|
417
|
+
latest: async () => {
|
|
418
|
+
const data = JSON.parse(await fetchInstallationText(`https://registry.npmjs.org/${encodeURIComponent(name)}/latest`));
|
|
419
|
+
return installationVersion(data.version);
|
|
420
|
+
},
|
|
421
|
+
update: async (version2) => {
|
|
422
|
+
if (!canUpdate || !npm)
|
|
423
|
+
throw new Error("Use the original package manager to update this installation");
|
|
424
|
+
await runInstallationCommand(npm.executable, ["install", "--global", "--prefix", prefix, `${name}@${installationVersion(version2)}`], env, 3e5);
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
const parent = path4.dirname(directory);
|
|
429
|
+
if (parent === directory)
|
|
430
|
+
break;
|
|
431
|
+
directory = parent;
|
|
432
|
+
}
|
|
433
|
+
return null;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
// ../../harness-discovery/dist/installer.js
|
|
437
|
+
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
438
|
+
import { tmpdir } from "node:os";
|
|
439
|
+
import { join } from "node:path";
|
|
440
|
+
function createHarnessInstaller(environment, source) {
|
|
441
|
+
return async () => {
|
|
442
|
+
if (!["darwin", "linux", "win32"].includes(process.platform))
|
|
443
|
+
throw new Error("Unsupported installation platform");
|
|
444
|
+
const env = withNodeRuntimeOnPath(environment);
|
|
445
|
+
if ("npm" in source) {
|
|
446
|
+
const npm = resolveHarnessExecutable({
|
|
447
|
+
id: "npm",
|
|
448
|
+
command: "npm",
|
|
449
|
+
installRoots: {
|
|
450
|
+
posix: [
|
|
451
|
+
"~/.npm-global/bin",
|
|
452
|
+
"~/.local/bin",
|
|
453
|
+
VERSION_MANAGER_ROOTS,
|
|
454
|
+
"/opt/homebrew/bin",
|
|
455
|
+
"/usr/local/bin",
|
|
456
|
+
"/usr/bin"
|
|
457
|
+
],
|
|
458
|
+
windows: [
|
|
459
|
+
"${APPDATA}/npm",
|
|
460
|
+
VERSION_MANAGER_ROOTS,
|
|
461
|
+
"${ProgramFiles}/nodejs",
|
|
462
|
+
"${LOCALAPPDATA}/Programs/nodejs"
|
|
463
|
+
]
|
|
464
|
+
}
|
|
465
|
+
}, { environment: env });
|
|
466
|
+
if (!npm)
|
|
467
|
+
throw new Error("Install Node.js and npm first");
|
|
468
|
+
await runInstallationCommand(npm.executable, ["install", "--global", source.npm], {
|
|
469
|
+
...env,
|
|
470
|
+
...source.allowScripts ? { npm_config_allow_scripts: source.allowScripts } : {}
|
|
471
|
+
}, 6e5);
|
|
472
|
+
return;
|
|
473
|
+
}
|
|
474
|
+
const windows = process.platform === "win32";
|
|
475
|
+
const url2 = windows ? source.windows : source.posix;
|
|
476
|
+
if (new URL(url2).protocol !== "https:")
|
|
477
|
+
throw new Error("Installer requires HTTPS");
|
|
478
|
+
const script = await fetchInstallationText(url2);
|
|
479
|
+
const directory = await mkdtemp(join(tmpdir(), "codexhost-installer-"));
|
|
480
|
+
try {
|
|
481
|
+
const file2 = join(directory, windows ? "install.ps1" : "install.sh");
|
|
482
|
+
await writeFile(file2, script, { mode: 384 });
|
|
483
|
+
await runInstallationCommand(windows ? "powershell.exe" : source.shell ?? "bash", windows ? ["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-File", file2] : [file2], env, 6e5);
|
|
484
|
+
} finally {
|
|
485
|
+
await rm(directory, { recursive: true, force: true });
|
|
486
|
+
}
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
|
|
8
490
|
// ../../../node_modules/zod/v4/classic/external.js
|
|
9
491
|
var external_exports = {};
|
|
10
492
|
__export(external_exports, {
|
|
@@ -14589,6 +15071,71 @@ var harnessDisplaySetSchema = external_exports.strictObject({
|
|
|
14589
15071
|
initializeOnly: external_exports.boolean().optional()
|
|
14590
15072
|
});
|
|
14591
15073
|
|
|
15074
|
+
// ../../shared-contracts/dist/ids.js
|
|
15075
|
+
var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
15076
|
+
message: "Identifier must not be empty or whitespace"
|
|
15077
|
+
});
|
|
15078
|
+
var harnessIdSchema = opaqueIdSchema.brand();
|
|
15079
|
+
var hostThreadIdSchema = opaqueIdSchema.brand();
|
|
15080
|
+
var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
15081
|
+
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
15082
|
+
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
15083
|
+
|
|
15084
|
+
// ../../shared-contracts/dist/harness-plugins.js
|
|
15085
|
+
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
15086
|
+
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
15087
|
+
var HARNESS_PLUGIN_LIMIT = 128;
|
|
15088
|
+
var harnessPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u).refine((id) => id !== "codex", "The official Codex identity is reserved").pipe(harnessIdSchema);
|
|
15089
|
+
var relativeResourceSchema = external_exports.string().min(1).max(512).refine((value) => !/[\\\u0000:#?]/u.test(value) && !value.startsWith("/") && !value.split("/").some((part) => part === ".." || part === ""), "Plugin resources must be relative paths inside the plugin");
|
|
15090
|
+
var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
|
|
15091
|
+
var pluginPresentationShape = {
|
|
15092
|
+
id: harnessPluginIdSchema,
|
|
15093
|
+
name: external_exports.string().trim().min(1).max(128),
|
|
15094
|
+
version: external_exports.string().min(1).max(128),
|
|
15095
|
+
/** The factory accepts a persisted local entrypoint through its construction context. */
|
|
15096
|
+
launchCommand: external_exports.literal(true).optional(),
|
|
15097
|
+
links: external_exports.object({
|
|
15098
|
+
documentation: documentationUrlSchema.optional(),
|
|
15099
|
+
installation: documentationUrlSchema.optional()
|
|
15100
|
+
}).strict().optional()
|
|
15101
|
+
};
|
|
15102
|
+
var harnessPluginManifestSchema = external_exports.object({
|
|
15103
|
+
manifestVersion: external_exports.literal(1),
|
|
15104
|
+
...pluginPresentationShape,
|
|
15105
|
+
adapterApiVersion: external_exports.number().int().positive(),
|
|
15106
|
+
entry: relativeResourceSchema,
|
|
15107
|
+
icon: relativeResourceSchema.optional()
|
|
15108
|
+
}).strict();
|
|
15109
|
+
var harnessPluginIconSchema = external_exports.string().max(Math.ceil(HARNESS_PLUGIN_ICON_MAX_BYTES / 3) * 4 + 64).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u);
|
|
15110
|
+
var harnessPluginDescriptorSchema = external_exports.object({
|
|
15111
|
+
...pluginPresentationShape,
|
|
15112
|
+
icon: harnessPluginIconSchema.optional()
|
|
15113
|
+
}).strict();
|
|
15114
|
+
var harnessPluginListParamsSchema = external_exports.object({}).strict();
|
|
15115
|
+
var harnessPluginListResultSchema = external_exports.object({
|
|
15116
|
+
plugins: external_exports.array(harnessPluginDescriptorSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
15117
|
+
}).strict();
|
|
15118
|
+
var harnessPluginConfigurationSchema = external_exports.object({
|
|
15119
|
+
version: external_exports.literal(1),
|
|
15120
|
+
enabled: external_exports.array(harnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
15121
|
+
}).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
|
|
15122
|
+
message: "Enabled plugin IDs must be unique",
|
|
15123
|
+
path: ["enabled"]
|
|
15124
|
+
});
|
|
15125
|
+
|
|
15126
|
+
// ../../shared-contracts/dist/harness-long-context.js
|
|
15127
|
+
var HARNESS_LONG_CONTEXT_GET_METHOD = "codexhost/harness/long-context/get";
|
|
15128
|
+
var HARNESS_LONG_CONTEXT_SET_METHOD = "codexhost/harness/long-context/set";
|
|
15129
|
+
var harnessLongContextGetSchema = external_exports.object({
|
|
15130
|
+
harnessId: harnessPluginIdSchema
|
|
15131
|
+
}).strict();
|
|
15132
|
+
var harnessLongContextSetSchema = harnessLongContextGetSchema.extend({
|
|
15133
|
+
enabled: external_exports.boolean()
|
|
15134
|
+
});
|
|
15135
|
+
var harnessLongContextSchema = external_exports.object({
|
|
15136
|
+
enabled: external_exports.boolean()
|
|
15137
|
+
}).strict();
|
|
15138
|
+
|
|
14592
15139
|
// ../../shared-contracts/dist/console.js
|
|
14593
15140
|
var consoleAnnouncementSchema = external_exports.strictObject({
|
|
14594
15141
|
title: external_exports.string().trim().min(1).max(200),
|
|
@@ -14605,8 +15152,11 @@ var CONSOLE_HOST_METHODS = Object.freeze([
|
|
|
14605
15152
|
"codexhost/harness/display-settings/get",
|
|
14606
15153
|
"codexhost/harness/display-settings/set",
|
|
14607
15154
|
"codexhost/harness/inspect",
|
|
15155
|
+
"codexhost/harness/installation",
|
|
14608
15156
|
"codexhost/harness/launch-settings/get",
|
|
14609
15157
|
"codexhost/harness/launch-settings/set",
|
|
15158
|
+
HARNESS_LONG_CONTEXT_GET_METHOD,
|
|
15159
|
+
HARNESS_LONG_CONTEXT_SET_METHOD,
|
|
14610
15160
|
"codexhost/harness/web-ui/open",
|
|
14611
15161
|
"codexhost/harness/accounts/sources",
|
|
14612
15162
|
"codexhost/harness/accounts/list",
|
|
@@ -14666,16 +15216,6 @@ var loadedSessionsSchema = external_exports.array(external_exports.strictObject(
|
|
|
14666
15216
|
inactiveMs: external_exports.number().nonnegative()
|
|
14667
15217
|
}));
|
|
14668
15218
|
|
|
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
15219
|
// ../../shared-contracts/dist/manual-compaction.js
|
|
14680
15220
|
var threadManualCompactionStartedSchema = external_exports.strictObject({
|
|
14681
15221
|
threadId: hostThreadIdSchema,
|
|
@@ -15178,73 +15718,31 @@ var threadOwnershipListParamsSchema = external_exports.object({
|
|
|
15178
15718
|
});
|
|
15179
15719
|
var codexThreadOwnershipSchema = external_exports.object({
|
|
15180
15720
|
threadId: hostThreadIdSchema,
|
|
15181
|
-
owner: external_exports.literal("codex")
|
|
15182
|
-
}).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()
|
|
15721
|
+
owner: external_exports.literal("codex")
|
|
15237
15722
|
}).strict();
|
|
15238
|
-
var
|
|
15239
|
-
|
|
15240
|
-
|
|
15723
|
+
var externalThreadOwnershipSchema = external_exports.object({
|
|
15724
|
+
threadId: hostThreadIdSchema,
|
|
15725
|
+
owner: external_exports.literal("external"),
|
|
15726
|
+
harnessId: external_exports.string().max(256).pipe(harnessIdSchema)
|
|
15241
15727
|
}).strict();
|
|
15242
|
-
var
|
|
15243
|
-
|
|
15244
|
-
|
|
15245
|
-
|
|
15246
|
-
|
|
15247
|
-
|
|
15728
|
+
var threadOwnershipSchema = external_exports.discriminatedUnion("owner", [
|
|
15729
|
+
codexThreadOwnershipSchema,
|
|
15730
|
+
externalThreadOwnershipSchema
|
|
15731
|
+
]);
|
|
15732
|
+
var threadOwnershipListResultSchema = external_exports.object({
|
|
15733
|
+
threads: external_exports.array(threadOwnershipSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
|
|
15734
|
+
}).strict().superRefine(({ threads }, context) => {
|
|
15735
|
+
const seen = /* @__PURE__ */ new Set();
|
|
15736
|
+
for (const [index, thread] of threads.entries()) {
|
|
15737
|
+
if (seen.has(thread.threadId)) {
|
|
15738
|
+
context.addIssue({
|
|
15739
|
+
code: "custom",
|
|
15740
|
+
message: "Thread ownership-list results must be unique",
|
|
15741
|
+
path: ["threads", index, "threadId"]
|
|
15742
|
+
});
|
|
15743
|
+
}
|
|
15744
|
+
seen.add(thread.threadId);
|
|
15745
|
+
}
|
|
15248
15746
|
});
|
|
15249
15747
|
|
|
15250
15748
|
// ../../shared-contracts/dist/harness-route.js
|
|
@@ -15271,14 +15769,17 @@ var harnessLaunchSettingsSchema = external_exports.object({
|
|
|
15271
15769
|
// ../../shared-contracts/dist/harness-installation.js
|
|
15272
15770
|
var harnessInstallationParamsSchema = external_exports.object({
|
|
15273
15771
|
harnessId: harnessIdSchema,
|
|
15274
|
-
action: external_exports.enum(["check", "update"])
|
|
15772
|
+
action: external_exports.enum(["check", "update", "install"])
|
|
15275
15773
|
}).strict();
|
|
15276
15774
|
var harnessInstallationStateSchema = external_exports.object({
|
|
15277
15775
|
currentVersion: external_exports.string().min(1).max(128),
|
|
15278
15776
|
latestVersion: external_exports.string().min(1).max(128),
|
|
15279
15777
|
updateAvailable: external_exports.boolean(),
|
|
15280
15778
|
canUpdate: external_exports.boolean(),
|
|
15281
|
-
|
|
15779
|
+
// Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
|
|
15780
|
+
message: external_exports.string().max(2048).optional(),
|
|
15781
|
+
messageCode: external_exports.string().min(1).max(128).optional(),
|
|
15782
|
+
latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
|
|
15282
15783
|
}).strict();
|
|
15283
15784
|
|
|
15284
15785
|
// ../../shared-contracts/dist/codex-accounts.js
|
|
@@ -15573,7 +16074,7 @@ var updateStatusSchema = external_exports.strictObject({
|
|
|
15573
16074
|
}
|
|
15574
16075
|
});
|
|
15575
16076
|
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");
|
|
16077
|
+
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
16078
|
var updateCheckResultSchema = external_exports.strictObject({
|
|
15578
16079
|
currentVersion: updateSemanticVersionSchema,
|
|
15579
16080
|
installation: updateInstallationSchema.nullable(),
|
|
@@ -20075,605 +20576,177 @@ var ClientSideConnection = class {
|
|
|
20075
20576
|
*
|
|
20076
20577
|
* Notifies the agent that a document was saved.
|
|
20077
20578
|
*
|
|
20078
|
-
* @experimental
|
|
20079
|
-
*/
|
|
20080
|
-
unstable_didSaveDocument(params) {
|
|
20081
|
-
return this.connection.sendNotification(AGENT_METHODS.document_did_save, params);
|
|
20082
|
-
}
|
|
20083
|
-
/**
|
|
20084
|
-
* **UNSTABLE**: This capability is not part of the spec yet, and may be removed or changed at any point.
|
|
20085
|
-
*
|
|
20086
|
-
* Notifies the agent that a document received focus.
|
|
20087
|
-
*
|
|
20088
|
-
* @experimental
|
|
20089
|
-
*/
|
|
20090
|
-
unstable_didFocusDocument(params) {
|
|
20091
|
-
return this.connection.sendNotification(AGENT_METHODS.document_did_focus, params);
|
|
20092
|
-
}
|
|
20093
|
-
/**
|
|
20094
|
-
* **UNSTABLE**: This capability is not part of the spec yet, and may be removed or changed at any point.
|
|
20095
|
-
*
|
|
20096
|
-
* Notifies the agent that a NES suggestion was accepted.
|
|
20097
|
-
*
|
|
20098
|
-
* @experimental
|
|
20099
|
-
*/
|
|
20100
|
-
unstable_acceptNes(params) {
|
|
20101
|
-
return this.connection.sendNotification(AGENT_METHODS.nes_accept, params);
|
|
20102
|
-
}
|
|
20103
|
-
/**
|
|
20104
|
-
* **UNSTABLE**: This capability is not part of the spec yet, and may be removed or changed at any point.
|
|
20105
|
-
*
|
|
20106
|
-
* Notifies the agent that a NES suggestion was rejected.
|
|
20107
|
-
*
|
|
20108
|
-
* @experimental
|
|
20109
|
-
*/
|
|
20110
|
-
unstable_rejectNes(params) {
|
|
20111
|
-
return this.connection.sendNotification(AGENT_METHODS.nes_reject, params);
|
|
20112
|
-
}
|
|
20113
|
-
request(method, params, options) {
|
|
20114
|
-
const spec = agentRequestSpecsByMethod[method];
|
|
20115
|
-
return this.connection.sendRequest(method, params, spec?.mapResponse, options);
|
|
20116
|
-
}
|
|
20117
|
-
notify(method, params) {
|
|
20118
|
-
return this.connection.sendNotification(method, params);
|
|
20119
|
-
}
|
|
20120
|
-
/**
|
|
20121
|
-
* Extension method.
|
|
20122
|
-
*
|
|
20123
|
-
* @deprecated Use {@link request}.
|
|
20124
|
-
*/
|
|
20125
|
-
extMethod(method, params) {
|
|
20126
|
-
return this.request(method, params);
|
|
20127
|
-
}
|
|
20128
|
-
/**
|
|
20129
|
-
* Extension notification.
|
|
20130
|
-
*
|
|
20131
|
-
* @deprecated Use {@link notify}.
|
|
20132
|
-
*/
|
|
20133
|
-
extNotification(method, params) {
|
|
20134
|
-
return this.notify(method, params);
|
|
20135
|
-
}
|
|
20136
|
-
/**
|
|
20137
|
-
* AbortSignal that aborts when the connection closes.
|
|
20138
|
-
*
|
|
20139
|
-
* This signal can be used to:
|
|
20140
|
-
* - Listen for connection closure: `connection.signal.addEventListener('abort', () => {...})`
|
|
20141
|
-
* - Check connection status synchronously: `if (connection.signal.aborted) {...}`
|
|
20142
|
-
* - Pass to other APIs (fetch, setTimeout) for automatic cancellation
|
|
20143
|
-
*
|
|
20144
|
-
* The connection closes when the underlying stream ends, either normally or due to an error.
|
|
20145
|
-
*
|
|
20146
|
-
* @example
|
|
20147
|
-
* ```typescript
|
|
20148
|
-
* const connection = new ClientSideConnection(client, stream);
|
|
20149
|
-
*
|
|
20150
|
-
* // Listen for closure
|
|
20151
|
-
* connection.signal.addEventListener('abort', () => {
|
|
20152
|
-
* console.log('Connection closed - performing cleanup');
|
|
20153
|
-
* });
|
|
20154
|
-
*
|
|
20155
|
-
* // Check status
|
|
20156
|
-
* if (connection.signal.aborted) {
|
|
20157
|
-
* console.log('Connection is already closed');
|
|
20158
|
-
* }
|
|
20159
|
-
*
|
|
20160
|
-
* // Pass to other APIs
|
|
20161
|
-
* fetch(url, { signal: connection.signal });
|
|
20162
|
-
* ```
|
|
20163
|
-
*/
|
|
20164
|
-
get signal() {
|
|
20165
|
-
return this.connection.signal;
|
|
20166
|
-
}
|
|
20167
|
-
/**
|
|
20168
|
-
* Promise that resolves when the connection closes.
|
|
20169
|
-
*
|
|
20170
|
-
* The connection closes when the underlying stream ends, either normally or due to an error.
|
|
20171
|
-
* Once closed, the connection cannot send or receive any more messages.
|
|
20172
|
-
*
|
|
20173
|
-
* This is useful for async/await style cleanup:
|
|
20174
|
-
*
|
|
20175
|
-
* @example
|
|
20176
|
-
* ```typescript
|
|
20177
|
-
* const connection = new ClientSideConnection(client, stream);
|
|
20178
|
-
* await connection.closed;
|
|
20179
|
-
* console.log('Connection closed - performing cleanup');
|
|
20180
|
-
* ```
|
|
20181
|
-
*/
|
|
20182
|
-
get closed() {
|
|
20183
|
-
return this.connection.closed;
|
|
20184
|
-
}
|
|
20185
|
-
};
|
|
20186
|
-
|
|
20187
|
-
// dist/copy-cleanup.js
|
|
20188
|
-
import { randomBytes } from "node:crypto";
|
|
20189
|
-
import { createInterface } from "node:readline";
|
|
20190
|
-
import { stripVTControlCharacters } from "node:util";
|
|
20191
|
-
import { Readable } from "node:stream";
|
|
20192
|
-
var CodeBuddyCopyCleanup = class {
|
|
20193
|
-
copyId;
|
|
20194
|
-
cwd;
|
|
20195
|
-
password = randomBytes(32).toString("base64url");
|
|
20196
|
-
arguments = [
|
|
20197
|
-
"--acp",
|
|
20198
|
-
"--serve",
|
|
20199
|
-
"--host",
|
|
20200
|
-
"127.0.0.1",
|
|
20201
|
-
"--port",
|
|
20202
|
-
"0",
|
|
20203
|
-
"--auth",
|
|
20204
|
-
"password"
|
|
20205
|
-
];
|
|
20206
|
-
#endpoint;
|
|
20207
|
-
constructor(copyId, cwd) {
|
|
20208
|
-
this.copyId = copyId;
|
|
20209
|
-
this.cwd = cwd;
|
|
20210
|
-
}
|
|
20211
|
-
environment(environment) {
|
|
20212
|
-
return {
|
|
20213
|
-
...environment,
|
|
20214
|
-
CODEBUDDY_GATEWAY_AUTH: "password",
|
|
20215
|
-
CODEBUDDY_GATEWAY_PASSWORD: this.password,
|
|
20216
|
-
CODEBUDDY_GATEWAY_BASE_PATH: ""
|
|
20217
|
-
};
|
|
20218
|
-
}
|
|
20219
|
-
/** Native --serve banners include its password; never pass them to the ACP parser/logs. */
|
|
20220
|
-
protocolOutput(stdout) {
|
|
20221
|
-
return Readable.from(this.#protocolLines(stdout));
|
|
20222
|
-
}
|
|
20223
|
-
async *#protocolLines(stdout) {
|
|
20224
|
-
for await (const line of createInterface({ input: stdout })) {
|
|
20225
|
-
const endpoint = /^\s*Endpoint\s+(http:\/\/127\.0\.0\.1:\d+)\s*$/u.exec(stripVTControlCharacters(line));
|
|
20226
|
-
if (endpoint)
|
|
20227
|
-
this.#endpoint = endpoint[1];
|
|
20228
|
-
if (line.trimStart().startsWith("{"))
|
|
20229
|
-
yield Buffer.from(`${line}
|
|
20230
|
-
`);
|
|
20231
|
-
}
|
|
20232
|
-
}
|
|
20233
|
-
async remove() {
|
|
20234
|
-
if (!this.#endpoint)
|
|
20235
|
-
throw new CodeBuddyError("nativeFailure", `Native cleanup endpoint was not reported; temporary Session ${this.copyId} remains`);
|
|
20236
|
-
const response = await fetch(`${this.#endpoint}/api/v1/sessions/${encodeURIComponent(this.copyId)}?cwd=${encodeURIComponent(this.cwd)}`, {
|
|
20237
|
-
method: "DELETE",
|
|
20238
|
-
headers: { Authorization: `Bearer ${this.password}`, "x-codebuddy-request": "true" },
|
|
20239
|
-
signal: AbortSignal.timeout(5e3),
|
|
20240
|
-
redirect: "error"
|
|
20241
|
-
}).catch(() => {
|
|
20242
|
-
throw new CodeBuddyError("nativeFailure", `Native cleanup request failed; temporary Session ${this.copyId} remains`);
|
|
20243
|
-
});
|
|
20244
|
-
await response.body?.cancel();
|
|
20245
|
-
if (response.status !== 204)
|
|
20246
|
-
throw new CodeBuddyError("nativeFailure", `Native cleanup failed (${response.status}); temporary Session ${this.copyId} remains`);
|
|
20247
|
-
}
|
|
20248
|
-
};
|
|
20249
|
-
|
|
20250
|
-
// ../../harness-discovery/dist/environment.js
|
|
20251
|
-
import fs from "node:fs";
|
|
20252
|
-
import path from "node:path";
|
|
20253
|
-
function targetPath(platform) {
|
|
20254
|
-
return platform === "win32" ? path.win32 : path.posix;
|
|
20255
|
-
}
|
|
20256
|
-
function environmentValue(environment, name) {
|
|
20257
|
-
const lowered = name.toLowerCase();
|
|
20258
|
-
for (const [key, value] of Object.entries(environment)) {
|
|
20259
|
-
if (key.toLowerCase() === lowered)
|
|
20260
|
-
return value;
|
|
20261
|
-
}
|
|
20262
|
-
return void 0;
|
|
20263
|
-
}
|
|
20264
|
-
function pathDelimiter(platform) {
|
|
20265
|
-
return platform === "win32" ? ";" : ":";
|
|
20266
|
-
}
|
|
20267
|
-
function pathDirectories(environment, platform) {
|
|
20268
|
-
return (environmentValue(environment, "PATH") ?? "").split(pathDelimiter(platform)).map((directory) => directory.trim().replace(/^"|"$/gu, "")).filter(Boolean);
|
|
20269
|
-
}
|
|
20270
|
-
function executableExtensions(command, platform, environment) {
|
|
20271
|
-
if (platform !== "win32")
|
|
20272
|
-
return [""];
|
|
20273
|
-
if (targetPath(platform).extname(command) !== "")
|
|
20274
|
-
return [""];
|
|
20275
|
-
return (environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").map((extension) => extension.trim()).filter(Boolean);
|
|
20276
|
-
}
|
|
20277
|
-
function isExecutableFile(filePath, platform) {
|
|
20278
|
-
try {
|
|
20279
|
-
fs.accessSync(filePath, platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK);
|
|
20280
|
-
return fs.statSync(filePath).isFile();
|
|
20281
|
-
} catch {
|
|
20282
|
-
return false;
|
|
20283
|
-
}
|
|
20284
|
-
}
|
|
20285
|
-
function subdirectoryNames(directory) {
|
|
20286
|
-
try {
|
|
20287
|
-
return fs.readdirSync(directory, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
20288
|
-
} catch {
|
|
20289
|
-
return [];
|
|
20290
|
-
}
|
|
20291
|
-
}
|
|
20292
|
-
function newestFirst(names) {
|
|
20293
|
-
return [...names].sort((left, right) => right.localeCompare(left, void 0, { numeric: true }));
|
|
20294
|
-
}
|
|
20295
|
-
|
|
20296
|
-
// ../../harness-discovery/dist/invocation.js
|
|
20297
|
-
import path2 from "node:path";
|
|
20298
|
-
function commandInvocation(command, arguments_, environment, platform = process.platform) {
|
|
20299
|
-
const extension = path2.win32.extname(command).toLowerCase();
|
|
20300
|
-
if (platform !== "win32" || ![".cmd", ".bat"].includes(extension)) {
|
|
20301
|
-
return { command, arguments: [...arguments_], windowsVerbatimArguments: false };
|
|
20579
|
+
* @experimental
|
|
20580
|
+
*/
|
|
20581
|
+
unstable_didSaveDocument(params) {
|
|
20582
|
+
return this.connection.sendNotification(AGENT_METHODS.document_did_save, params);
|
|
20302
20583
|
}
|
|
20303
|
-
|
|
20304
|
-
|
|
20305
|
-
|
|
20306
|
-
|
|
20307
|
-
|
|
20308
|
-
|
|
20309
|
-
|
|
20310
|
-
|
|
20311
|
-
|
|
20312
|
-
// ../../harness-discovery/dist/node-runtime.js
|
|
20313
|
-
import path3 from "node:path";
|
|
20314
|
-
function withNodeRuntimeOnPath(environment, runtimeExecutable = process.execPath, platform = process.platform) {
|
|
20315
|
-
const pathKey = Object.keys(environment).find((name) => name.toLowerCase() === "path") ?? "PATH";
|
|
20316
|
-
const delimiter = platform === "win32" ? ";" : ":";
|
|
20317
|
-
const runtimeDirectory = path3.dirname(runtimeExecutable);
|
|
20318
|
-
const directories = (environment[pathKey] ?? "").split(delimiter).filter(Boolean);
|
|
20319
|
-
const equal = platform === "win32" ? (value) => value.toLowerCase() : (value) => value;
|
|
20320
|
-
if (!directories.some((directory) => equal(directory) === equal(runtimeDirectory))) {
|
|
20321
|
-
directories.push(runtimeDirectory);
|
|
20584
|
+
/**
|
|
20585
|
+
* **UNSTABLE**: This capability is not part of the spec yet, and may be removed or changed at any point.
|
|
20586
|
+
*
|
|
20587
|
+
* Notifies the agent that a document received focus.
|
|
20588
|
+
*
|
|
20589
|
+
* @experimental
|
|
20590
|
+
*/
|
|
20591
|
+
unstable_didFocusDocument(params) {
|
|
20592
|
+
return this.connection.sendNotification(AGENT_METHODS.document_did_focus, params);
|
|
20322
20593
|
}
|
|
20323
|
-
|
|
20324
|
-
|
|
20325
|
-
|
|
20326
|
-
|
|
20327
|
-
|
|
20328
|
-
|
|
20329
|
-
|
|
20330
|
-
|
|
20331
|
-
|
|
20332
|
-
const list = context.subdirectories ?? subdirectoryNames;
|
|
20333
|
-
const pathFlavor = targetPath(platform);
|
|
20334
|
-
const value = (name) => environmentValue(environment, name);
|
|
20335
|
-
const directories = [];
|
|
20336
|
-
const versioned = (root, ...tail) => {
|
|
20337
|
-
for (const version2 of newestFirst(list(root))) {
|
|
20338
|
-
directories.push(pathFlavor.join(root, version2, ...tail));
|
|
20339
|
-
}
|
|
20340
|
-
};
|
|
20341
|
-
if (platform === "win32") {
|
|
20342
|
-
const appData = value("APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming");
|
|
20343
|
-
const localAppData = value("LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local");
|
|
20344
|
-
versioned(pathFlavor.join(appData, "nvm"));
|
|
20345
|
-
versioned(value("FNM_DIR") ?? pathFlavor.join(appData, "fnm", "node-versions"), "installation");
|
|
20346
|
-
directories.push(pathFlavor.join(localAppData, "Volta", "bin"));
|
|
20347
|
-
directories.push(pathFlavor.join(home, ".bun", "bin"));
|
|
20348
|
-
const pnpmHome2 = value("PNPM_HOME");
|
|
20349
|
-
if (pnpmHome2)
|
|
20350
|
-
directories.push(pnpmHome2);
|
|
20351
|
-
directories.push(pathFlavor.join(localAppData, "pnpm"));
|
|
20352
|
-
return directories;
|
|
20594
|
+
/**
|
|
20595
|
+
* **UNSTABLE**: This capability is not part of the spec yet, and may be removed or changed at any point.
|
|
20596
|
+
*
|
|
20597
|
+
* Notifies the agent that a NES suggestion was accepted.
|
|
20598
|
+
*
|
|
20599
|
+
* @experimental
|
|
20600
|
+
*/
|
|
20601
|
+
unstable_acceptNes(params) {
|
|
20602
|
+
return this.connection.sendNotification(AGENT_METHODS.nes_accept, params);
|
|
20353
20603
|
}
|
|
20354
|
-
|
|
20355
|
-
|
|
20356
|
-
|
|
20357
|
-
|
|
20358
|
-
|
|
20359
|
-
|
|
20360
|
-
|
|
20361
|
-
|
|
20604
|
+
/**
|
|
20605
|
+
* **UNSTABLE**: This capability is not part of the spec yet, and may be removed or changed at any point.
|
|
20606
|
+
*
|
|
20607
|
+
* Notifies the agent that a NES suggestion was rejected.
|
|
20608
|
+
*
|
|
20609
|
+
* @experimental
|
|
20610
|
+
*/
|
|
20611
|
+
unstable_rejectNes(params) {
|
|
20612
|
+
return this.connection.sendNotification(AGENT_METHODS.nes_reject, params);
|
|
20362
20613
|
}
|
|
20363
|
-
|
|
20364
|
-
|
|
20365
|
-
|
|
20366
|
-
const asdfHome = value("ASDF_DATA_DIR") ?? pathFlavor.join(home, ".asdf");
|
|
20367
|
-
versioned(pathFlavor.join(asdfHome, "installs", "nodejs"), "bin");
|
|
20368
|
-
directories.push(pathFlavor.join(asdfHome, "shims"));
|
|
20369
|
-
const nodenvHome = value("NODENV_ROOT") ?? pathFlavor.join(home, ".nodenv");
|
|
20370
|
-
versioned(pathFlavor.join(nodenvHome, "versions"), "bin");
|
|
20371
|
-
directories.push(pathFlavor.join(nodenvHome, "shims"));
|
|
20372
|
-
versioned(pathFlavor.join(value("N_PREFIX") ?? "/usr/local", "n", "versions", "node"), "bin");
|
|
20373
|
-
directories.push(pathFlavor.join(home, ".bun", "bin"));
|
|
20374
|
-
const pnpmHome = value("PNPM_HOME");
|
|
20375
|
-
if (pnpmHome)
|
|
20376
|
-
directories.push(pnpmHome);
|
|
20377
|
-
directories.push(pathFlavor.join(home, "Library", "pnpm"));
|
|
20378
|
-
directories.push(pathFlavor.join(home, ".local", "share", "pnpm"));
|
|
20379
|
-
for (const prefix of ["/opt/homebrew/opt", "/usr/local/opt"]) {
|
|
20380
|
-
for (const formula of newestFirst(list(prefix).filter((name) => name.startsWith("node@")))) {
|
|
20381
|
-
directories.push(pathFlavor.join(prefix, formula, "bin"));
|
|
20382
|
-
}
|
|
20614
|
+
request(method, params, options) {
|
|
20615
|
+
const spec = agentRequestSpecsByMethod[method];
|
|
20616
|
+
return this.connection.sendRequest(method, params, spec?.mapResponse, options);
|
|
20383
20617
|
}
|
|
20384
|
-
|
|
20385
|
-
|
|
20386
|
-
|
|
20387
|
-
// ../../harness-discovery/dist/resolve.js
|
|
20388
|
-
var VERSION_MANAGER_ROOTS = "<version-managers>";
|
|
20389
|
-
function installRootExtensions(platform) {
|
|
20390
|
-
return platform === "win32" ? [".exe", ".cmd"] : [""];
|
|
20391
|
-
}
|
|
20392
|
-
function resolveHomeDirectory(input) {
|
|
20393
|
-
return input.homeDirectory ?? environmentValue(input.environment, "HOME") ?? environmentValue(input.environment, "USERPROFILE") ?? os.homedir();
|
|
20394
|
-
}
|
|
20395
|
-
function templateVariables(environment, platform, home) {
|
|
20396
|
-
const pathFlavor = targetPath(platform);
|
|
20397
|
-
return {
|
|
20398
|
-
HOME: home,
|
|
20399
|
-
USERPROFILE: home,
|
|
20400
|
-
APPDATA: environmentValue(environment, "APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming"),
|
|
20401
|
-
LOCALAPPDATA: environmentValue(environment, "LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local")
|
|
20402
|
-
};
|
|
20403
|
-
}
|
|
20404
|
-
function joinTemplate(platform, value) {
|
|
20405
|
-
const pathFlavor = targetPath(platform);
|
|
20406
|
-
const segments = value.split("/");
|
|
20407
|
-
const head = segments[0] ?? "";
|
|
20408
|
-
const tail = segments.slice(1);
|
|
20409
|
-
if (head === "")
|
|
20410
|
-
return pathFlavor.join(pathFlavor.sep, ...tail);
|
|
20411
|
-
return tail.length === 0 ? head : pathFlavor.join(head, ...tail);
|
|
20412
|
-
}
|
|
20413
|
-
function expandInstallRoot(template, environment, platform, home) {
|
|
20414
|
-
const variables = templateVariables(environment, platform, home);
|
|
20415
|
-
let unresolved = false;
|
|
20416
|
-
const substituted = template.replace(/^~(?=\/|$)/u, home).replace(/\$\{(\w+)\}/gu, (_match, name) => {
|
|
20417
|
-
const value = variables[name] ?? environmentValue(environment, name);
|
|
20418
|
-
if (value === void 0 || value === "") {
|
|
20419
|
-
unresolved = true;
|
|
20420
|
-
return "";
|
|
20421
|
-
}
|
|
20422
|
-
return value;
|
|
20423
|
-
});
|
|
20424
|
-
return unresolved ? void 0 : joinTemplate(platform, substituted);
|
|
20425
|
-
}
|
|
20426
|
-
function installRootDirectories(spec, input, dependencies, platform, home) {
|
|
20427
|
-
const templates = (platform === "win32" ? spec.installRoots?.windows : spec.installRoots?.posix) ?? [];
|
|
20428
|
-
const directories = [];
|
|
20429
|
-
for (const template of templates) {
|
|
20430
|
-
if (template === VERSION_MANAGER_ROOTS) {
|
|
20431
|
-
directories.push(...versionManagerBinaryDirectories({
|
|
20432
|
-
platform,
|
|
20433
|
-
environment: input.environment,
|
|
20434
|
-
home,
|
|
20435
|
-
...dependencies.subdirectories ? { subdirectories: dependencies.subdirectories } : {}
|
|
20436
|
-
}));
|
|
20437
|
-
continue;
|
|
20438
|
-
}
|
|
20439
|
-
const directory = expandInstallRoot(template, input.environment, platform, home);
|
|
20440
|
-
if (directory !== void 0)
|
|
20441
|
-
directories.push(directory);
|
|
20618
|
+
notify(method, params) {
|
|
20619
|
+
return this.connection.sendNotification(method, params);
|
|
20442
20620
|
}
|
|
20443
|
-
|
|
20444
|
-
|
|
20445
|
-
|
|
20446
|
-
|
|
20447
|
-
|
|
20448
|
-
|
|
20449
|
-
|
|
20450
|
-
if (pathFlavor.isAbsolute(command) || command.includes("/") || command.includes("\\")) {
|
|
20451
|
-
return [{ candidate: command, source: "configured" }];
|
|
20621
|
+
/**
|
|
20622
|
+
* Extension method.
|
|
20623
|
+
*
|
|
20624
|
+
* @deprecated Use {@link request}.
|
|
20625
|
+
*/
|
|
20626
|
+
extMethod(method, params) {
|
|
20627
|
+
return this.request(method, params);
|
|
20452
20628
|
}
|
|
20453
|
-
|
|
20454
|
-
|
|
20455
|
-
|
|
20456
|
-
|
|
20457
|
-
|
|
20458
|
-
|
|
20459
|
-
|
|
20460
|
-
});
|
|
20461
|
-
}
|
|
20629
|
+
/**
|
|
20630
|
+
* Extension notification.
|
|
20631
|
+
*
|
|
20632
|
+
* @deprecated Use {@link notify}.
|
|
20633
|
+
*/
|
|
20634
|
+
extNotification(method, params) {
|
|
20635
|
+
return this.notify(method, params);
|
|
20462
20636
|
}
|
|
20463
|
-
|
|
20464
|
-
|
|
20465
|
-
|
|
20466
|
-
|
|
20467
|
-
|
|
20468
|
-
|
|
20469
|
-
|
|
20470
|
-
|
|
20471
|
-
|
|
20472
|
-
|
|
20637
|
+
/**
|
|
20638
|
+
* AbortSignal that aborts when the connection closes.
|
|
20639
|
+
*
|
|
20640
|
+
* This signal can be used to:
|
|
20641
|
+
* - Listen for connection closure: `connection.signal.addEventListener('abort', () => {...})`
|
|
20642
|
+
* - Check connection status synchronously: `if (connection.signal.aborted) {...}`
|
|
20643
|
+
* - Pass to other APIs (fetch, setTimeout) for automatic cancellation
|
|
20644
|
+
*
|
|
20645
|
+
* The connection closes when the underlying stream ends, either normally or due to an error.
|
|
20646
|
+
*
|
|
20647
|
+
* @example
|
|
20648
|
+
* ```typescript
|
|
20649
|
+
* const connection = new ClientSideConnection(client, stream);
|
|
20650
|
+
*
|
|
20651
|
+
* // Listen for closure
|
|
20652
|
+
* connection.signal.addEventListener('abort', () => {
|
|
20653
|
+
* console.log('Connection closed - performing cleanup');
|
|
20654
|
+
* });
|
|
20655
|
+
*
|
|
20656
|
+
* // Check status
|
|
20657
|
+
* if (connection.signal.aborted) {
|
|
20658
|
+
* console.log('Connection is already closed');
|
|
20659
|
+
* }
|
|
20660
|
+
*
|
|
20661
|
+
* // Pass to other APIs
|
|
20662
|
+
* fetch(url, { signal: connection.signal });
|
|
20663
|
+
* ```
|
|
20664
|
+
*/
|
|
20665
|
+
get signal() {
|
|
20666
|
+
return this.connection.signal;
|
|
20473
20667
|
}
|
|
20474
|
-
|
|
20475
|
-
|
|
20476
|
-
|
|
20477
|
-
|
|
20478
|
-
|
|
20479
|
-
|
|
20480
|
-
|
|
20481
|
-
|
|
20482
|
-
|
|
20483
|
-
|
|
20484
|
-
|
|
20668
|
+
/**
|
|
20669
|
+
* Promise that resolves when the connection closes.
|
|
20670
|
+
*
|
|
20671
|
+
* The connection closes when the underlying stream ends, either normally or due to an error.
|
|
20672
|
+
* Once closed, the connection cannot send or receive any more messages.
|
|
20673
|
+
*
|
|
20674
|
+
* This is useful for async/await style cleanup:
|
|
20675
|
+
*
|
|
20676
|
+
* @example
|
|
20677
|
+
* ```typescript
|
|
20678
|
+
* const connection = new ClientSideConnection(client, stream);
|
|
20679
|
+
* await connection.closed;
|
|
20680
|
+
* console.log('Connection closed - performing cleanup');
|
|
20681
|
+
* ```
|
|
20682
|
+
*/
|
|
20683
|
+
get closed() {
|
|
20684
|
+
return this.connection.closed;
|
|
20485
20685
|
}
|
|
20486
|
-
|
|
20487
|
-
}
|
|
20686
|
+
};
|
|
20488
20687
|
|
|
20489
|
-
//
|
|
20490
|
-
import {
|
|
20491
|
-
import {
|
|
20492
|
-
|
|
20493
|
-
|
|
20494
|
-
|
|
20495
|
-
|
|
20496
|
-
|
|
20497
|
-
|
|
20498
|
-
|
|
20499
|
-
|
|
20500
|
-
|
|
20501
|
-
|
|
20502
|
-
|
|
20503
|
-
|
|
20504
|
-
|
|
20505
|
-
|
|
20506
|
-
|
|
20507
|
-
|
|
20508
|
-
|
|
20509
|
-
|
|
20510
|
-
|
|
20511
|
-
|
|
20512
|
-
});
|
|
20513
|
-
}
|
|
20514
|
-
function installationVersion(value) {
|
|
20515
|
-
if (typeof value !== "string" || !/^v?\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?$/.test(value.trim()))
|
|
20516
|
-
throw new Error("Harness returned an invalid version");
|
|
20517
|
-
return value.trim().replace(/^v/, "");
|
|
20518
|
-
}
|
|
20519
|
-
function versionFromOutput(output) {
|
|
20520
|
-
return installationVersion(output.match(/\b\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?\b/)?.[0]);
|
|
20521
|
-
}
|
|
20522
|
-
function newerInstallationVersion(current, latest) {
|
|
20523
|
-
const a = installationVersion(current).replace(/\+.*/, "");
|
|
20524
|
-
const b = installationVersion(latest).replace(/\+.*/, "");
|
|
20525
|
-
const coreA = a.replace(/-.*/, "").split(".").map(BigInt);
|
|
20526
|
-
const coreB = b.replace(/-.*/, "").split(".").map(BigInt);
|
|
20527
|
-
for (let i = 0; i < Math.max(coreA.length, coreB.length); i++) {
|
|
20528
|
-
if ((coreA[i] ?? 0n) !== (coreB[i] ?? 0n))
|
|
20529
|
-
return (coreB[i] ?? 0n) > (coreA[i] ?? 0n);
|
|
20688
|
+
// dist/copy-cleanup.js
|
|
20689
|
+
import { randomBytes } from "node:crypto";
|
|
20690
|
+
import { createInterface } from "node:readline";
|
|
20691
|
+
import { stripVTControlCharacters } from "node:util";
|
|
20692
|
+
import { Readable } from "node:stream";
|
|
20693
|
+
var CodeBuddyCopyCleanup = class {
|
|
20694
|
+
copyId;
|
|
20695
|
+
cwd;
|
|
20696
|
+
password = randomBytes(32).toString("base64url");
|
|
20697
|
+
arguments = [
|
|
20698
|
+
"--acp",
|
|
20699
|
+
"--serve",
|
|
20700
|
+
"--host",
|
|
20701
|
+
"127.0.0.1",
|
|
20702
|
+
"--port",
|
|
20703
|
+
"0",
|
|
20704
|
+
"--auth",
|
|
20705
|
+
"password"
|
|
20706
|
+
];
|
|
20707
|
+
#endpoint;
|
|
20708
|
+
constructor(copyId, cwd) {
|
|
20709
|
+
this.copyId = copyId;
|
|
20710
|
+
this.cwd = cwd;
|
|
20530
20711
|
}
|
|
20531
|
-
|
|
20532
|
-
|
|
20533
|
-
|
|
20534
|
-
|
|
20535
|
-
|
|
20536
|
-
|
|
20537
|
-
|
|
20538
|
-
if (x === y)
|
|
20539
|
-
continue;
|
|
20540
|
-
if (x === void 0 || y === void 0)
|
|
20541
|
-
return x === void 0;
|
|
20542
|
-
const numericX = /^\d+$/.test(x);
|
|
20543
|
-
const numericY = /^\d+$/.test(y);
|
|
20544
|
-
if (numericX && numericY) {
|
|
20545
|
-
if (BigInt(x) === BigInt(y))
|
|
20546
|
-
continue;
|
|
20547
|
-
return BigInt(y) > BigInt(x);
|
|
20548
|
-
}
|
|
20549
|
-
if (numericX !== numericY)
|
|
20550
|
-
return numericX;
|
|
20551
|
-
return y > x;
|
|
20712
|
+
environment(environment) {
|
|
20713
|
+
return {
|
|
20714
|
+
...environment,
|
|
20715
|
+
CODEBUDDY_GATEWAY_AUTH: "password",
|
|
20716
|
+
CODEBUDDY_GATEWAY_PASSWORD: this.password,
|
|
20717
|
+
CODEBUDDY_GATEWAY_BASE_PATH: ""
|
|
20718
|
+
};
|
|
20552
20719
|
}
|
|
20553
|
-
|
|
20554
|
-
|
|
20555
|
-
|
|
20556
|
-
let checking;
|
|
20557
|
-
let updating;
|
|
20558
|
-
const check2 = () => checking ??= options.check().finally(() => {
|
|
20559
|
-
checking = void 0;
|
|
20560
|
-
});
|
|
20561
|
-
return (action) => {
|
|
20562
|
-
if (updating)
|
|
20563
|
-
return updating;
|
|
20564
|
-
if (action === "check")
|
|
20565
|
-
return check2();
|
|
20566
|
-
updating = (async () => {
|
|
20567
|
-
const before = await check2();
|
|
20568
|
-
if (!before.updateAvailable)
|
|
20569
|
-
return before;
|
|
20570
|
-
if (!before.canUpdate)
|
|
20571
|
-
throw new Error(before.message ?? "This installation cannot be updated automatically");
|
|
20572
|
-
await options.update(before);
|
|
20573
|
-
const after = await check2();
|
|
20574
|
-
if (after.currentVersion === before.currentVersion)
|
|
20575
|
-
throw new Error("The Harness version did not change; check the native updater and retry");
|
|
20576
|
-
return after;
|
|
20577
|
-
})().finally(() => {
|
|
20578
|
-
updating = void 0;
|
|
20579
|
-
});
|
|
20580
|
-
return updating;
|
|
20581
|
-
};
|
|
20582
|
-
}
|
|
20583
|
-
async function fetchInstallationText(url2) {
|
|
20584
|
-
const request = async () => {
|
|
20585
|
-
const response = await fetch(url2, { signal: AbortSignal.timeout(15e3) });
|
|
20586
|
-
if (!response.ok)
|
|
20587
|
-
throw new Error("Could not check the latest Harness version");
|
|
20588
|
-
return response.text();
|
|
20589
|
-
};
|
|
20590
|
-
try {
|
|
20591
|
-
return await request();
|
|
20592
|
-
} catch (error51) {
|
|
20593
|
-
if (error51 instanceof DOMException && (error51.name === "AbortError" || error51.name === "TimeoutError"))
|
|
20594
|
-
throw error51;
|
|
20595
|
-
return request();
|
|
20720
|
+
/** Native --serve banners include its password; never pass them to the ACP parser/logs. */
|
|
20721
|
+
protocolOutput(stdout) {
|
|
20722
|
+
return Readable.from(this.#protocolLines(stdout));
|
|
20596
20723
|
}
|
|
20597
|
-
|
|
20598
|
-
|
|
20599
|
-
|
|
20600
|
-
|
|
20601
|
-
|
|
20602
|
-
|
|
20603
|
-
|
|
20604
|
-
|
|
20605
|
-
const target = `node_modules/${name}/${bin.replace(/^\.\//, "")}`.toLowerCase();
|
|
20606
|
-
const text2 = shim.replaceAll("\\", "/").toLowerCase();
|
|
20607
|
-
return text2.includes(`%dp0%/${target}"`) || text2.includes(`%~dp0/${target}"`);
|
|
20608
|
-
}
|
|
20609
|
-
async function npmInstallation(command, packages, environment) {
|
|
20610
|
-
let selected = await realpath(command);
|
|
20611
|
-
if (process.platform === "win32" && /\.(cmd|bat)$/i.test(selected)) {
|
|
20612
|
-
const shim = (await readFile(selected, "utf8")).replaceAll("\\", "/");
|
|
20613
|
-
const root = path4.dirname(selected);
|
|
20614
|
-
for (const name of packages) {
|
|
20615
|
-
const directory2 = path4.join(root, "node_modules", ...name.split("/"));
|
|
20616
|
-
const metadata = await readFile(path4.join(directory2, "package.json"), "utf8").then((text2) => JSON.parse(text2)).catch(() => null);
|
|
20617
|
-
const bins = typeof metadata?.bin === "string" ? [metadata.bin] : Object.values(metadata?.bin ?? {});
|
|
20618
|
-
const bin = bins.find((entry) => referencesNpmBin(shim, name, entry));
|
|
20619
|
-
if (bin) {
|
|
20620
|
-
selected = await realpath(path4.join(directory2, bin));
|
|
20621
|
-
break;
|
|
20622
|
-
}
|
|
20724
|
+
async *#protocolLines(stdout) {
|
|
20725
|
+
for await (const line of createInterface({ input: stdout })) {
|
|
20726
|
+
const endpoint = /^\s*Endpoint\s+(http:\/\/127\.0\.0\.1:\d+)\s*$/u.exec(stripVTControlCharacters(line));
|
|
20727
|
+
if (endpoint)
|
|
20728
|
+
this.#endpoint = endpoint[1];
|
|
20729
|
+
if (line.trimStart().startsWith("{"))
|
|
20730
|
+
yield Buffer.from(`${line}
|
|
20731
|
+
`);
|
|
20623
20732
|
}
|
|
20624
20733
|
}
|
|
20625
|
-
|
|
20626
|
-
|
|
20627
|
-
|
|
20628
|
-
|
|
20629
|
-
|
|
20630
|
-
|
|
20631
|
-
|
|
20632
|
-
|
|
20633
|
-
|
|
20634
|
-
|
|
20635
|
-
|
|
20636
|
-
|
|
20637
|
-
|
|
20638
|
-
|
|
20639
|
-
let globalInstall = modules === globalRoot;
|
|
20640
|
-
if (process.platform === "win32") {
|
|
20641
|
-
const project = (await Promise.all(["package.json", "package-lock.json", "npm-shrinkwrap.json"].map((file2) => readFile(path4.join(prefix, file2), "utf8").then(() => true, (error51) => error51.code !== "ENOENT")))).some(Boolean);
|
|
20642
|
-
const bins = typeof metadata.bin === "string" ? { [name.split("/").at(-1) ?? name]: metadata.bin } : metadata.bin ?? {};
|
|
20643
|
-
const launchers = await Promise.all(Object.entries(bins).map(async ([bin, entry]) => {
|
|
20644
|
-
if (path4.basename(bin) !== bin || entry.includes(".."))
|
|
20645
|
-
return false;
|
|
20646
|
-
const target = await realpath(path4.join(directory, entry)).catch(() => "");
|
|
20647
|
-
if (target.toLowerCase() !== selected.toLowerCase())
|
|
20648
|
-
return false;
|
|
20649
|
-
const shim = await readFile(path4.join(prefix, `${bin}.cmd`), "utf8").catch(() => "");
|
|
20650
|
-
return referencesNpmBin(shim, name, entry);
|
|
20651
|
-
}));
|
|
20652
|
-
globalInstall = globalInstall && !project && launchers.some(Boolean);
|
|
20653
|
-
}
|
|
20654
|
-
const canUpdate = globalInstall && !!npm;
|
|
20655
|
-
return {
|
|
20656
|
-
prefix,
|
|
20657
|
-
currentVersion,
|
|
20658
|
-
canUpdate,
|
|
20659
|
-
latest: async () => {
|
|
20660
|
-
const data = JSON.parse(await fetchInstallationText(`https://registry.npmjs.org/${encodeURIComponent(name)}/latest`));
|
|
20661
|
-
return installationVersion(data.version);
|
|
20662
|
-
},
|
|
20663
|
-
update: async (version2) => {
|
|
20664
|
-
if (!canUpdate || !npm)
|
|
20665
|
-
throw new Error("Use the original package manager to update this installation");
|
|
20666
|
-
await runInstallationCommand(npm.executable, ["install", "--global", "--prefix", prefix, `${name}@${installationVersion(version2)}`], env, 3e5);
|
|
20667
|
-
}
|
|
20668
|
-
};
|
|
20669
|
-
}
|
|
20670
|
-
const parent = path4.dirname(directory);
|
|
20671
|
-
if (parent === directory)
|
|
20672
|
-
break;
|
|
20673
|
-
directory = parent;
|
|
20734
|
+
async remove() {
|
|
20735
|
+
if (!this.#endpoint)
|
|
20736
|
+
throw new CodeBuddyError("nativeFailure", `Native cleanup endpoint was not reported; temporary Session ${this.copyId} remains`);
|
|
20737
|
+
const response = await fetch(`${this.#endpoint}/api/v1/sessions/${encodeURIComponent(this.copyId)}?cwd=${encodeURIComponent(this.cwd)}`, {
|
|
20738
|
+
method: "DELETE",
|
|
20739
|
+
headers: { Authorization: `Bearer ${this.password}`, "x-codebuddy-request": "true" },
|
|
20740
|
+
signal: AbortSignal.timeout(5e3),
|
|
20741
|
+
redirect: "error"
|
|
20742
|
+
}).catch(() => {
|
|
20743
|
+
throw new CodeBuddyError("nativeFailure", `Native cleanup request failed; temporary Session ${this.copyId} remains`);
|
|
20744
|
+
});
|
|
20745
|
+
await response.body?.cancel();
|
|
20746
|
+
if (response.status !== 204)
|
|
20747
|
+
throw new CodeBuddyError("nativeFailure", `Native cleanup failed (${response.status}); temporary Session ${this.copyId} remains`);
|
|
20674
20748
|
}
|
|
20675
|
-
|
|
20676
|
-
}
|
|
20749
|
+
};
|
|
20677
20750
|
|
|
20678
20751
|
// dist/command.js
|
|
20679
20752
|
var codeBuddyDiscoverySpec = {
|
|
@@ -20960,7 +21033,7 @@ function confirmedConfiguration(response, id, value, profile = CODEBUDDY_RUNTIME
|
|
|
20960
21033
|
// dist/derivation.js
|
|
20961
21034
|
import { randomUUID } from "node:crypto";
|
|
20962
21035
|
import { execFile as execFile3, spawn as spawn2 } from "node:child_process";
|
|
20963
|
-
import { lstat, mkdir, readFile as readFile3, realpath as realpath5, unlink, writeFile } from "node:fs/promises";
|
|
21036
|
+
import { lstat, mkdir, readFile as readFile3, realpath as realpath5, unlink, writeFile as writeFile2 } from "node:fs/promises";
|
|
20964
21037
|
import path6 from "node:path";
|
|
20965
21038
|
import { isDeepStrictEqual as isDeepStrictEqual3 } from "node:util";
|
|
20966
21039
|
|
|
@@ -22462,7 +22535,7 @@ async function bridgeCopyToTarget(sourceCwd, targetCwd, ref, contents, environme
|
|
|
22462
22535
|
if (!sameResolvedPath(realTargetDirectory, path6.join(realProjects, codeBuddyProjectSlug(targetCwd, profile))))
|
|
22463
22536
|
throw new CodeBuddyError("invalidRequest", "Cross-directory history bridge target escaped the native projects root");
|
|
22464
22537
|
const expected = Buffer.from(contents, "utf8");
|
|
22465
|
-
await
|
|
22538
|
+
await writeFile2(targetFile, expected, { flag: "wx", mode: 384 });
|
|
22466
22539
|
const bridge = { file: targetFile, expected };
|
|
22467
22540
|
try {
|
|
22468
22541
|
const persisted = await readFile3(targetFile);
|
|
@@ -22592,7 +22665,7 @@ async function verifiedChildFile(file2, expected) {
|
|
|
22592
22665
|
}
|
|
22593
22666
|
async function persistChildCopy(file2, expected) {
|
|
22594
22667
|
try {
|
|
22595
|
-
await
|
|
22668
|
+
await writeFile2(file2, expected, { flag: "wx", mode: 384 });
|
|
22596
22669
|
} catch (error51) {
|
|
22597
22670
|
if (record2(error51).code !== "EEXIST")
|
|
22598
22671
|
throw error51;
|
|
@@ -24009,6 +24082,7 @@ function createCodeBuddyInstallation(environment) {
|
|
|
24009
24082
|
updateAvailable: !!npm && newerInstallationVersion(currentVersion, latestVersion),
|
|
24010
24083
|
canUpdate,
|
|
24011
24084
|
...!canUpdate ? {
|
|
24085
|
+
messageCode: "codebuddy-npm-required",
|
|
24012
24086
|
message: "Use CodeBuddy's native updater or original package manager for this installation. Latest-version checks here require an identified npm installation."
|
|
24013
24087
|
} : {}
|
|
24014
24088
|
};
|
|
@@ -25051,7 +25125,8 @@ function createHarnessAdapter(context) {
|
|
|
25051
25125
|
});
|
|
25052
25126
|
const environment = { ...context.environment };
|
|
25053
25127
|
return Object.assign(new CodeBuddyAdapter({ environment }), {
|
|
25054
|
-
installation: createCodeBuddyInstallation(environment)
|
|
25128
|
+
installation: createCodeBuddyInstallation(environment),
|
|
25129
|
+
install: createHarnessInstaller(environment, { npm: "@tencent-ai/codebuddy-code" })
|
|
25055
25130
|
});
|
|
25056
25131
|
}
|
|
25057
25132
|
export {
|