@codexhost/cli-darwin-x64 0.10.2 → 0.12.0
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/THIRD_PARTY_NOTICES.txt +4 -0
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +18001 -0
- package/app/console-web.js +27674 -0
- package/app/desktop-controller.mjs +452 -110
- package/app/host-runtime.mjs +6670 -1272
- package/app/plugins/antigravity/plugin.mjs +686 -305
- package/app/plugins/claude-code/plugin.mjs +2283 -1450
- package/app/plugins/codebuddy/plugin.mjs +1272 -506
- package/app/plugins/cursor-cli/manifest.json +1 -1
- package/app/plugins/cursor-cli/plugin.mjs +1295 -497
- package/app/plugins/deepseek-harness/plugin.mjs +4718 -4925
- package/app/plugins/enabled.json +2 -1
- package/app/plugins/grok/plugin.mjs +1012 -369
- package/app/plugins/hermes/plugin.mjs +18587 -22714
- package/app/plugins/kimi-code/plugin.mjs +1283 -355
- package/app/plugins/kiro-cli/plugin.mjs +840 -299
- package/app/plugins/omp/plugin.mjs +1045 -328
- package/app/plugins/opencode/plugin.mjs +5341 -1686
- package/app/plugins/pi/plugin.mjs +1343 -534
- package/app/plugins/qoder/plugin.mjs +913 -258
- package/app/plugins/qoder-cn/plugin.mjs +712 -49
- package/app/plugins/workbuddy/plugin.mjs +531 -44
- package/app/plugins/zcode/assets/icon.svg +8 -0
- package/app/plugins/zcode/manifest.json +14 -0
- package/app/plugins/zcode/plugin.mjs +19202 -0
- package/app/renderer-extension.js +5011 -1899
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/licenses/OpenCode-v2-Client-LICENSE.txt +21 -0
- package/package.json +1 -1
|
@@ -5,9 +5,351 @@ var __export = (target, all) => {
|
|
|
5
5
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
+
// ../../harness-discovery/dist/environment.js
|
|
9
|
+
import fs from "node:fs";
|
|
10
|
+
import path from "node:path";
|
|
11
|
+
function targetPath(platform) {
|
|
12
|
+
return platform === "win32" ? path.win32 : path.posix;
|
|
13
|
+
}
|
|
14
|
+
function environmentValue(environment, name) {
|
|
15
|
+
const lowered = name.toLowerCase();
|
|
16
|
+
for (const [key, value] of Object.entries(environment)) {
|
|
17
|
+
if (key.toLowerCase() === lowered)
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
20
|
+
return void 0;
|
|
21
|
+
}
|
|
22
|
+
function pathDelimiter(platform) {
|
|
23
|
+
return platform === "win32" ? ";" : ":";
|
|
24
|
+
}
|
|
25
|
+
function pathDirectories(environment, platform) {
|
|
26
|
+
return (environmentValue(environment, "PATH") ?? "").split(pathDelimiter(platform)).map((directory) => directory.trim().replace(/^"|"$/gu, "")).filter(Boolean);
|
|
27
|
+
}
|
|
28
|
+
function executableExtensions(command, platform, environment) {
|
|
29
|
+
if (platform !== "win32")
|
|
30
|
+
return [""];
|
|
31
|
+
if (targetPath(platform).extname(command) !== "")
|
|
32
|
+
return [""];
|
|
33
|
+
return (environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").map((extension) => extension.trim()).filter(Boolean);
|
|
34
|
+
}
|
|
35
|
+
function isExecutableFile(filePath, platform) {
|
|
36
|
+
try {
|
|
37
|
+
fs.accessSync(filePath, platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK);
|
|
38
|
+
return fs.statSync(filePath).isFile();
|
|
39
|
+
} catch {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function subdirectoryNames(directory) {
|
|
44
|
+
try {
|
|
45
|
+
return fs.readdirSync(directory, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
46
|
+
} catch {
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function newestFirst(names) {
|
|
51
|
+
return [...names].sort((left, right) => right.localeCompare(left, void 0, { numeric: true }));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// ../../harness-discovery/dist/invocation.js
|
|
55
|
+
import path2 from "node:path";
|
|
56
|
+
function commandInvocation(command, arguments_, environment, platform = process.platform) {
|
|
57
|
+
const extension = path2.win32.extname(command).toLowerCase();
|
|
58
|
+
if (platform !== "win32" || ![".cmd", ".bat"].includes(extension)) {
|
|
59
|
+
return { command, arguments: [...arguments_], windowsVerbatimArguments: false };
|
|
60
|
+
}
|
|
61
|
+
const quote = (value) => `"${value.replaceAll("%", "%%").replaceAll('"', '""')}"`;
|
|
62
|
+
const commandLine = [command, ...arguments_].map(quote).join(" ");
|
|
63
|
+
return {
|
|
64
|
+
command: environmentValue(environment, "ComSpec") ?? "cmd.exe",
|
|
65
|
+
arguments: ["/d", "/v:off", "/s", "/c", `"${commandLine}"`],
|
|
66
|
+
windowsVerbatimArguments: true
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// ../../harness-discovery/dist/node-runtime.js
|
|
71
|
+
import path3 from "node:path";
|
|
72
|
+
function withNodeRuntimeOnPath(environment, runtimeExecutable = process.execPath, platform = process.platform) {
|
|
73
|
+
const pathKey = Object.keys(environment).find((name) => name.toLowerCase() === "path") ?? "PATH";
|
|
74
|
+
const delimiter = platform === "win32" ? ";" : ":";
|
|
75
|
+
const runtimeDirectory = path3.dirname(runtimeExecutable);
|
|
76
|
+
const directories = (environment[pathKey] ?? "").split(delimiter).filter(Boolean);
|
|
77
|
+
const equal = platform === "win32" ? (value) => value.toLowerCase() : (value) => value;
|
|
78
|
+
if (!directories.some((directory) => equal(directory) === equal(runtimeDirectory))) {
|
|
79
|
+
directories.push(runtimeDirectory);
|
|
80
|
+
}
|
|
81
|
+
return { ...environment, [pathKey]: directories.join(delimiter) };
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// ../../harness-discovery/dist/resolve.js
|
|
85
|
+
import os from "node:os";
|
|
86
|
+
|
|
87
|
+
// ../../harness-discovery/dist/version-managers.js
|
|
88
|
+
function versionManagerBinaryDirectories(context) {
|
|
89
|
+
const { platform, environment, home } = context;
|
|
90
|
+
const list = context.subdirectories ?? subdirectoryNames;
|
|
91
|
+
const pathFlavor = targetPath(platform);
|
|
92
|
+
const value = (name) => environmentValue(environment, name);
|
|
93
|
+
const directories = [];
|
|
94
|
+
const versioned = (root, ...tail) => {
|
|
95
|
+
for (const version2 of newestFirst(list(root))) {
|
|
96
|
+
directories.push(pathFlavor.join(root, version2, ...tail));
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
if (platform === "win32") {
|
|
100
|
+
const appData = value("APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming");
|
|
101
|
+
const localAppData = value("LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local");
|
|
102
|
+
versioned(pathFlavor.join(appData, "nvm"));
|
|
103
|
+
versioned(value("FNM_DIR") ?? pathFlavor.join(appData, "fnm", "node-versions"), "installation");
|
|
104
|
+
directories.push(pathFlavor.join(localAppData, "Volta", "bin"));
|
|
105
|
+
directories.push(pathFlavor.join(home, ".bun", "bin"));
|
|
106
|
+
const pnpmHome2 = value("PNPM_HOME");
|
|
107
|
+
if (pnpmHome2)
|
|
108
|
+
directories.push(pnpmHome2);
|
|
109
|
+
directories.push(pathFlavor.join(localAppData, "pnpm"));
|
|
110
|
+
return directories;
|
|
111
|
+
}
|
|
112
|
+
versioned(pathFlavor.join(value("NVM_DIR") ?? pathFlavor.join(home, ".nvm"), "versions", "node"), "bin");
|
|
113
|
+
const fnmRoots = [
|
|
114
|
+
value("FNM_DIR"),
|
|
115
|
+
pathFlavor.join(home, ".local", "share", "fnm"),
|
|
116
|
+
pathFlavor.join(home, "Library", "Application Support", "fnm")
|
|
117
|
+
].filter((root) => root !== void 0);
|
|
118
|
+
for (const root of fnmRoots) {
|
|
119
|
+
versioned(pathFlavor.join(root, "node-versions"), "installation", "bin");
|
|
120
|
+
}
|
|
121
|
+
const voltaHome = value("VOLTA_HOME") ?? pathFlavor.join(home, ".volta");
|
|
122
|
+
versioned(pathFlavor.join(voltaHome, "tools", "image", "node"), "bin");
|
|
123
|
+
directories.push(pathFlavor.join(voltaHome, "bin"));
|
|
124
|
+
const asdfHome = value("ASDF_DATA_DIR") ?? pathFlavor.join(home, ".asdf");
|
|
125
|
+
versioned(pathFlavor.join(asdfHome, "installs", "nodejs"), "bin");
|
|
126
|
+
directories.push(pathFlavor.join(asdfHome, "shims"));
|
|
127
|
+
const nodenvHome = value("NODENV_ROOT") ?? pathFlavor.join(home, ".nodenv");
|
|
128
|
+
versioned(pathFlavor.join(nodenvHome, "versions"), "bin");
|
|
129
|
+
directories.push(pathFlavor.join(nodenvHome, "shims"));
|
|
130
|
+
versioned(pathFlavor.join(value("N_PREFIX") ?? "/usr/local", "n", "versions", "node"), "bin");
|
|
131
|
+
directories.push(pathFlavor.join(home, ".bun", "bin"));
|
|
132
|
+
const pnpmHome = value("PNPM_HOME");
|
|
133
|
+
if (pnpmHome)
|
|
134
|
+
directories.push(pnpmHome);
|
|
135
|
+
directories.push(pathFlavor.join(home, "Library", "pnpm"));
|
|
136
|
+
directories.push(pathFlavor.join(home, ".local", "share", "pnpm"));
|
|
137
|
+
for (const prefix of ["/opt/homebrew/opt", "/usr/local/opt"]) {
|
|
138
|
+
for (const formula of newestFirst(list(prefix).filter((name) => name.startsWith("node@")))) {
|
|
139
|
+
directories.push(pathFlavor.join(prefix, formula, "bin"));
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return directories;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// ../../harness-discovery/dist/resolve.js
|
|
146
|
+
var VERSION_MANAGER_ROOTS = "<version-managers>";
|
|
147
|
+
function installRootExtensions(platform) {
|
|
148
|
+
return platform === "win32" ? [".exe", ".cmd"] : [""];
|
|
149
|
+
}
|
|
150
|
+
function resolveHomeDirectory(input) {
|
|
151
|
+
return input.homeDirectory ?? environmentValue(input.environment, "HOME") ?? environmentValue(input.environment, "USERPROFILE") ?? os.homedir();
|
|
152
|
+
}
|
|
153
|
+
function templateVariables(environment, platform, home) {
|
|
154
|
+
const pathFlavor = targetPath(platform);
|
|
155
|
+
return {
|
|
156
|
+
HOME: home,
|
|
157
|
+
USERPROFILE: home,
|
|
158
|
+
APPDATA: environmentValue(environment, "APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming"),
|
|
159
|
+
LOCALAPPDATA: environmentValue(environment, "LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local")
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
function joinTemplate(platform, value) {
|
|
163
|
+
const pathFlavor = targetPath(platform);
|
|
164
|
+
const segments = value.split("/");
|
|
165
|
+
const head = segments[0] ?? "";
|
|
166
|
+
const tail = segments.slice(1);
|
|
167
|
+
if (head === "")
|
|
168
|
+
return pathFlavor.join(pathFlavor.sep, ...tail);
|
|
169
|
+
return tail.length === 0 ? head : pathFlavor.join(head, ...tail);
|
|
170
|
+
}
|
|
171
|
+
function expandInstallRoot(template, environment, platform, home) {
|
|
172
|
+
const variables = templateVariables(environment, platform, home);
|
|
173
|
+
let unresolved = false;
|
|
174
|
+
const substituted = template.replace(/^~(?=\/|$)/u, home).replace(/\$\{(\w+)\}/gu, (_match, name) => {
|
|
175
|
+
const value = variables[name] ?? environmentValue(environment, name);
|
|
176
|
+
if (value === void 0 || value === "") {
|
|
177
|
+
unresolved = true;
|
|
178
|
+
return "";
|
|
179
|
+
}
|
|
180
|
+
return value;
|
|
181
|
+
});
|
|
182
|
+
return unresolved ? void 0 : joinTemplate(platform, substituted);
|
|
183
|
+
}
|
|
184
|
+
function installRootDirectories(spec, input, dependencies, platform, home) {
|
|
185
|
+
const templates = (platform === "win32" ? spec.installRoots?.windows : spec.installRoots?.posix) ?? [];
|
|
186
|
+
const directories = [];
|
|
187
|
+
for (const template of templates) {
|
|
188
|
+
if (template === VERSION_MANAGER_ROOTS) {
|
|
189
|
+
directories.push(...versionManagerBinaryDirectories({
|
|
190
|
+
platform,
|
|
191
|
+
environment: input.environment,
|
|
192
|
+
home,
|
|
193
|
+
...dependencies.subdirectories ? { subdirectories: dependencies.subdirectories } : {}
|
|
194
|
+
}));
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
const directory = expandInstallRoot(template, input.environment, platform, home);
|
|
198
|
+
if (directory !== void 0)
|
|
199
|
+
directories.push(directory);
|
|
200
|
+
}
|
|
201
|
+
return directories;
|
|
202
|
+
}
|
|
203
|
+
function harnessCandidates(spec, input, dependencies = {}) {
|
|
204
|
+
const platform = input.platform ?? process.platform;
|
|
205
|
+
const pathFlavor = targetPath(platform);
|
|
206
|
+
const configured = input.command ?? (spec.commandEnvironmentVariable ? environmentValue(input.environment, spec.commandEnvironmentVariable) : void 0);
|
|
207
|
+
const command = configured ?? spec.command;
|
|
208
|
+
if (pathFlavor.isAbsolute(command) || command.includes("/") || command.includes("\\")) {
|
|
209
|
+
return [{ candidate: command, source: "configured" }];
|
|
210
|
+
}
|
|
211
|
+
const candidates = [];
|
|
212
|
+
const extensions = executableExtensions(command, platform, input.environment);
|
|
213
|
+
for (const directory of pathDirectories(input.environment, platform)) {
|
|
214
|
+
for (const extension of extensions) {
|
|
215
|
+
candidates.push({
|
|
216
|
+
candidate: pathFlavor.join(directory, command + extension),
|
|
217
|
+
source: "path"
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
if (configured !== void 0)
|
|
222
|
+
return candidates;
|
|
223
|
+
const home = resolveHomeDirectory(input);
|
|
224
|
+
for (const directory of installRootDirectories(spec, input, dependencies, platform, home)) {
|
|
225
|
+
for (const extension of installRootExtensions(platform)) {
|
|
226
|
+
candidates.push({
|
|
227
|
+
candidate: pathFlavor.join(directory, spec.command + extension),
|
|
228
|
+
source: "install-root"
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return candidates;
|
|
233
|
+
}
|
|
234
|
+
function resolveHarnessExecutable(spec, input, dependencies = {}) {
|
|
235
|
+
const platform = input.platform ?? process.platform;
|
|
236
|
+
const isExecutable = dependencies.isExecutable ?? ((candidate) => isExecutableFile(candidate, platform));
|
|
237
|
+
const runnable = spec.runnableCandidate ?? ((candidate) => candidate);
|
|
238
|
+
const context = { platform, isExecutable };
|
|
239
|
+
for (const { candidate, source } of harnessCandidates(spec, input, dependencies)) {
|
|
240
|
+
const executable = runnable(candidate, context);
|
|
241
|
+
if (executable !== void 0 && isExecutable(executable))
|
|
242
|
+
return { executable, source };
|
|
243
|
+
}
|
|
244
|
+
return void 0;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// ../../harness-discovery/dist/installation.js
|
|
248
|
+
import { execFile } from "node:child_process";
|
|
249
|
+
import { homedir } from "node:os";
|
|
250
|
+
function runInstallationCommand(command, args, environment, timeout = 3e4) {
|
|
251
|
+
const env = withNodeRuntimeOnPath(environment);
|
|
252
|
+
const invocation = /\.[cm]?js$/i.test(command) ? commandInvocation(process.execPath, [command, ...args], env) : commandInvocation(command, args, env);
|
|
253
|
+
return new Promise((resolve, reject) => {
|
|
254
|
+
const child = execFile(invocation.command, invocation.arguments, {
|
|
255
|
+
env,
|
|
256
|
+
cwd: env.HOME ?? env.USERPROFILE ?? homedir(),
|
|
257
|
+
encoding: "utf8",
|
|
258
|
+
timeout,
|
|
259
|
+
killSignal: "SIGKILL",
|
|
260
|
+
maxBuffer: 1024 * 1024,
|
|
261
|
+
windowsHide: true,
|
|
262
|
+
windowsVerbatimArguments: invocation.windowsVerbatimArguments
|
|
263
|
+
}, (error51, stdout, stderr) => {
|
|
264
|
+
if (error51)
|
|
265
|
+
reject(new Error(error51.killed ? "Harness command timed out" : "Harness command failed; check the native installation and retry"));
|
|
266
|
+
else
|
|
267
|
+
resolve((stdout || stderr).trim());
|
|
268
|
+
});
|
|
269
|
+
child.stdin?.end();
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
function installationVersion(value) {
|
|
273
|
+
if (typeof value !== "string" || !/^v?\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?$/.test(value.trim()))
|
|
274
|
+
throw new Error("Harness returned an invalid version");
|
|
275
|
+
return value.trim().replace(/^v/, "");
|
|
276
|
+
}
|
|
277
|
+
function versionFromOutput(output) {
|
|
278
|
+
return installationVersion(output.match(/\b\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?\b/)?.[0]);
|
|
279
|
+
}
|
|
280
|
+
async function fetchInstallationText(url2) {
|
|
281
|
+
const request = async () => {
|
|
282
|
+
const response = await fetch(url2, { signal: AbortSignal.timeout(15e3) });
|
|
283
|
+
if (!response.ok)
|
|
284
|
+
throw new Error("Could not check the latest Harness version");
|
|
285
|
+
return response.text();
|
|
286
|
+
};
|
|
287
|
+
try {
|
|
288
|
+
return await request();
|
|
289
|
+
} catch (error51) {
|
|
290
|
+
if (error51 instanceof DOMException && (error51.name === "AbortError" || error51.name === "TimeoutError"))
|
|
291
|
+
throw error51;
|
|
292
|
+
return request();
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// ../../harness-discovery/dist/installer.js
|
|
297
|
+
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
298
|
+
import { tmpdir } from "node:os";
|
|
299
|
+
import { join } from "node:path";
|
|
300
|
+
function createHarnessInstaller(environment, source) {
|
|
301
|
+
return async () => {
|
|
302
|
+
if (!["darwin", "linux", "win32"].includes(process.platform))
|
|
303
|
+
throw new Error("Unsupported installation platform");
|
|
304
|
+
const env = withNodeRuntimeOnPath(environment);
|
|
305
|
+
if ("npm" in source) {
|
|
306
|
+
const npm = resolveHarnessExecutable({
|
|
307
|
+
id: "npm",
|
|
308
|
+
command: "npm",
|
|
309
|
+
installRoots: {
|
|
310
|
+
posix: [
|
|
311
|
+
"~/.npm-global/bin",
|
|
312
|
+
"~/.local/bin",
|
|
313
|
+
VERSION_MANAGER_ROOTS,
|
|
314
|
+
"/opt/homebrew/bin",
|
|
315
|
+
"/usr/local/bin",
|
|
316
|
+
"/usr/bin"
|
|
317
|
+
],
|
|
318
|
+
windows: [
|
|
319
|
+
"${APPDATA}/npm",
|
|
320
|
+
VERSION_MANAGER_ROOTS,
|
|
321
|
+
"${ProgramFiles}/nodejs",
|
|
322
|
+
"${LOCALAPPDATA}/Programs/nodejs"
|
|
323
|
+
]
|
|
324
|
+
}
|
|
325
|
+
}, { environment: env });
|
|
326
|
+
if (!npm)
|
|
327
|
+
throw new Error("Install Node.js and npm first");
|
|
328
|
+
await runInstallationCommand(npm.executable, ["install", "--global", source.npm], {
|
|
329
|
+
...env,
|
|
330
|
+
...source.allowScripts ? { npm_config_allow_scripts: source.allowScripts } : {}
|
|
331
|
+
}, 6e5);
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
const windows = process.platform === "win32";
|
|
335
|
+
const url2 = windows ? source.windows : source.posix;
|
|
336
|
+
if (new URL(url2).protocol !== "https:")
|
|
337
|
+
throw new Error("Installer requires HTTPS");
|
|
338
|
+
const script = await fetchInstallationText(url2);
|
|
339
|
+
const directory = await mkdtemp(join(tmpdir(), "codexhost-installer-"));
|
|
340
|
+
try {
|
|
341
|
+
const file2 = join(directory, windows ? "install.ps1" : "install.sh");
|
|
342
|
+
await writeFile(file2, script, { mode: 384 });
|
|
343
|
+
await runInstallationCommand(windows ? "powershell.exe" : source.shell ?? "bash", windows ? ["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-File", file2] : [file2], env, 6e5);
|
|
344
|
+
} finally {
|
|
345
|
+
await rm(directory, { recursive: true, force: true });
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
|
|
8
350
|
// dist/kiro-adapter.js
|
|
9
351
|
import { randomUUID } from "node:crypto";
|
|
10
|
-
import
|
|
352
|
+
import path8 from "node:path";
|
|
11
353
|
|
|
12
354
|
// ../../../node_modules/zod/v4/classic/external.js
|
|
13
355
|
var external_exports = {};
|
|
@@ -775,10 +1117,10 @@ function mergeDefs(...defs) {
|
|
|
775
1117
|
function cloneDef(schema) {
|
|
776
1118
|
return mergeDefs(schema._zod.def);
|
|
777
1119
|
}
|
|
778
|
-
function getElementAtPath(obj,
|
|
779
|
-
if (!
|
|
1120
|
+
function getElementAtPath(obj, path9) {
|
|
1121
|
+
if (!path9)
|
|
780
1122
|
return obj;
|
|
781
|
-
return
|
|
1123
|
+
return path9.reduce((acc, key) => acc?.[key], obj);
|
|
782
1124
|
}
|
|
783
1125
|
function promiseAllObject(promisesObj) {
|
|
784
1126
|
const keys = Object.keys(promisesObj);
|
|
@@ -1187,11 +1529,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
1187
1529
|
}
|
|
1188
1530
|
return false;
|
|
1189
1531
|
}
|
|
1190
|
-
function prefixIssues(
|
|
1532
|
+
function prefixIssues(path9, issues) {
|
|
1191
1533
|
return issues.map((iss) => {
|
|
1192
1534
|
var _a3;
|
|
1193
1535
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
1194
|
-
iss.path.unshift(
|
|
1536
|
+
iss.path.unshift(path9);
|
|
1195
1537
|
return iss;
|
|
1196
1538
|
});
|
|
1197
1539
|
}
|
|
@@ -1338,16 +1680,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
1338
1680
|
}
|
|
1339
1681
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
1340
1682
|
const fieldErrors = { _errors: [] };
|
|
1341
|
-
const processError = (error52,
|
|
1683
|
+
const processError = (error52, path9 = []) => {
|
|
1342
1684
|
for (const issue2 of error52.issues) {
|
|
1343
1685
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1344
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1686
|
+
issue2.errors.map((issues) => processError({ issues }, [...path9, ...issue2.path]));
|
|
1345
1687
|
} else if (issue2.code === "invalid_key") {
|
|
1346
|
-
processError({ issues: issue2.issues }, [...
|
|
1688
|
+
processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
|
|
1347
1689
|
} else if (issue2.code === "invalid_element") {
|
|
1348
|
-
processError({ issues: issue2.issues }, [...
|
|
1690
|
+
processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
|
|
1349
1691
|
} else {
|
|
1350
|
-
const fullpath = [...
|
|
1692
|
+
const fullpath = [...path9, ...issue2.path];
|
|
1351
1693
|
if (fullpath.length === 0) {
|
|
1352
1694
|
fieldErrors._errors.push(mapper(issue2));
|
|
1353
1695
|
} else {
|
|
@@ -1374,17 +1716,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
1374
1716
|
}
|
|
1375
1717
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
1376
1718
|
const result = { errors: [] };
|
|
1377
|
-
const processError = (error52,
|
|
1719
|
+
const processError = (error52, path9 = []) => {
|
|
1378
1720
|
var _a3, _b;
|
|
1379
1721
|
for (const issue2 of error52.issues) {
|
|
1380
1722
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1381
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1723
|
+
issue2.errors.map((issues) => processError({ issues }, [...path9, ...issue2.path]));
|
|
1382
1724
|
} else if (issue2.code === "invalid_key") {
|
|
1383
|
-
processError({ issues: issue2.issues }, [...
|
|
1725
|
+
processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
|
|
1384
1726
|
} else if (issue2.code === "invalid_element") {
|
|
1385
|
-
processError({ issues: issue2.issues }, [...
|
|
1727
|
+
processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
|
|
1386
1728
|
} else {
|
|
1387
|
-
const fullpath = [...
|
|
1729
|
+
const fullpath = [...path9, ...issue2.path];
|
|
1388
1730
|
if (fullpath.length === 0) {
|
|
1389
1731
|
result.errors.push(mapper(issue2));
|
|
1390
1732
|
continue;
|
|
@@ -1416,8 +1758,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
1416
1758
|
}
|
|
1417
1759
|
function toDotPath(_path) {
|
|
1418
1760
|
const segs = [];
|
|
1419
|
-
const
|
|
1420
|
-
for (const seg of
|
|
1761
|
+
const path9 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
1762
|
+
for (const seg of path9) {
|
|
1421
1763
|
if (typeof seg === "number")
|
|
1422
1764
|
segs.push(`[${seg}]`);
|
|
1423
1765
|
else if (typeof seg === "symbol")
|
|
@@ -14109,13 +14451,13 @@ function resolveRef(ref, ctx) {
|
|
|
14109
14451
|
if (!ref.startsWith("#")) {
|
|
14110
14452
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
14111
14453
|
}
|
|
14112
|
-
const
|
|
14113
|
-
if (
|
|
14454
|
+
const path9 = ref.slice(1).split("/").filter(Boolean);
|
|
14455
|
+
if (path9.length === 0) {
|
|
14114
14456
|
return ctx.rootSchema;
|
|
14115
14457
|
}
|
|
14116
14458
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
14117
|
-
if (
|
|
14118
|
-
const key =
|
|
14459
|
+
if (path9[0] === defsKey) {
|
|
14460
|
+
const key = path9[1];
|
|
14119
14461
|
if (!key || !ctx.defs[key]) {
|
|
14120
14462
|
throw new Error(`Reference not found: ${ref}`);
|
|
14121
14463
|
}
|
|
@@ -14578,7 +14920,57 @@ var credentialImportsParamsSchema = external_exports.object({
|
|
|
14578
14920
|
request: credentialImportsRequestSchema
|
|
14579
14921
|
}).strict();
|
|
14580
14922
|
|
|
14581
|
-
// ../../shared-contracts/dist/
|
|
14923
|
+
// ../../shared-contracts/dist/harness-display-settings.js
|
|
14924
|
+
var harnessDisplayEntriesSchema = external_exports.array(external_exports.strictObject({
|
|
14925
|
+
agent: external_exports.string().min(1).max(128),
|
|
14926
|
+
section: external_exports.enum(["main", "more", "auto"])
|
|
14927
|
+
})).max(256).refine((entries) => new Set(entries.map((entry) => entry.agent)).size === entries.length, "Duplicate Harness IDs");
|
|
14928
|
+
var harnessDisplaySettingsSchema = external_exports.strictObject({
|
|
14929
|
+
entries: harnessDisplayEntriesSchema.nullable()
|
|
14930
|
+
});
|
|
14931
|
+
var harnessDisplayGetSchema = external_exports.strictObject({});
|
|
14932
|
+
var harnessDisplaySetSchema = external_exports.strictObject({
|
|
14933
|
+
entries: harnessDisplayEntriesSchema,
|
|
14934
|
+
/** Import legacy Desktop preferences only if no shared settings exist yet. */
|
|
14935
|
+
initializeOnly: external_exports.boolean().optional()
|
|
14936
|
+
});
|
|
14937
|
+
|
|
14938
|
+
// ../../shared-contracts/dist/console.js
|
|
14939
|
+
var consoleAnnouncementSchema = external_exports.strictObject({
|
|
14940
|
+
title: external_exports.string().trim().min(1).max(200),
|
|
14941
|
+
type: external_exports.enum(["info", "warning", "danger"]),
|
|
14942
|
+
body: external_exports.string().trim().min(1).max(16 * 1024)
|
|
14943
|
+
});
|
|
14944
|
+
var consoleOpenParamsSchema = external_exports.strictObject({});
|
|
14945
|
+
var consoleOpenResultSchema = external_exports.strictObject({
|
|
14946
|
+
/** The console address. */
|
|
14947
|
+
url: external_exports.string().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)
|
|
14948
|
+
});
|
|
14949
|
+
var CONSOLE_HOST_METHODS = Object.freeze([
|
|
14950
|
+
"codexhost/harness/plugins/list",
|
|
14951
|
+
"codexhost/harness/display-settings/get",
|
|
14952
|
+
"codexhost/harness/display-settings/set",
|
|
14953
|
+
"codexhost/harness/inspect",
|
|
14954
|
+
"codexhost/harness/installation",
|
|
14955
|
+
"codexhost/harness/launch-settings/get",
|
|
14956
|
+
"codexhost/harness/launch-settings/set",
|
|
14957
|
+
"codexhost/harness/web-ui/open",
|
|
14958
|
+
"codexhost/harness/accounts/sources",
|
|
14959
|
+
"codexhost/harness/accounts/list",
|
|
14960
|
+
"codexhost/harness/accounts/inspect",
|
|
14961
|
+
"codexhost/harness/credential-imports",
|
|
14962
|
+
"codexhost/harness/session-import/sources",
|
|
14963
|
+
"codexhost/harness/session-import/list",
|
|
14964
|
+
"codexhost/harness/session-import/import",
|
|
14965
|
+
"codexhost/account/list",
|
|
14966
|
+
"codexhost/account/refresh",
|
|
14967
|
+
"codexhost/account/usage/inspect",
|
|
14968
|
+
"codexhost/update/check",
|
|
14969
|
+
"codexhost/update/start",
|
|
14970
|
+
"codexhost/update/status"
|
|
14971
|
+
]);
|
|
14972
|
+
|
|
14973
|
+
// ../../shared-contracts/dist/version.js
|
|
14582
14974
|
var WORKSPACE_CONTRACT_VERSION = 1;
|
|
14583
14975
|
|
|
14584
14976
|
// ../../shared-contracts/dist/idle-release.js
|
|
@@ -14631,6 +15023,12 @@ var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
|
14631
15023
|
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
14632
15024
|
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
14633
15025
|
|
|
15026
|
+
// ../../shared-contracts/dist/manual-compaction.js
|
|
15027
|
+
var threadManualCompactionStartedSchema = external_exports.strictObject({
|
|
15028
|
+
threadId: hostThreadIdSchema,
|
|
15029
|
+
turnId: hostTurnIdSchema
|
|
15030
|
+
});
|
|
15031
|
+
|
|
14634
15032
|
// ../../shared-contracts/dist/thread-usage.js
|
|
14635
15033
|
var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
|
|
14636
15034
|
var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
|
|
@@ -14691,6 +15089,10 @@ var threadUsageSnapshotSchema = external_exports.object({
|
|
|
14691
15089
|
var usagePercentSchema = external_exports.number().finite().min(0).max(100);
|
|
14692
15090
|
var accountCreditsProductUsageSchema = external_exports.object({
|
|
14693
15091
|
product: external_exports.string().min(1),
|
|
15092
|
+
used: external_exports.number().finite().nonnegative().optional(),
|
|
15093
|
+
// Zero is a real empty cap, not an absent field.
|
|
15094
|
+
limit: external_exports.number().finite().nonnegative().optional(),
|
|
15095
|
+
unit: external_exports.string().min(1).max(32).optional(),
|
|
14694
15096
|
usagePercent: usagePercentSchema,
|
|
14695
15097
|
resetsAt: external_exports.string().min(1).optional()
|
|
14696
15098
|
}).strict();
|
|
@@ -14700,6 +15102,10 @@ var accountResetCreditsSchema = external_exports.object({
|
|
|
14700
15102
|
expiresAt: external_exports.array(external_exports.string().min(1)).min(1).max(32).optional()
|
|
14701
15103
|
}).strict();
|
|
14702
15104
|
var accountCreditsSnapshotSchema = external_exports.object({
|
|
15105
|
+
used: external_exports.number().finite().nonnegative().optional(),
|
|
15106
|
+
// Zero is a real empty cap, not an absent field.
|
|
15107
|
+
limit: external_exports.number().finite().nonnegative().optional(),
|
|
15108
|
+
unit: external_exports.string().min(1).max(32).optional(),
|
|
14703
15109
|
/** Native label when the primary limit is scoped to a model or product group. */
|
|
14704
15110
|
label: external_exports.string().min(1).optional(),
|
|
14705
15111
|
usedPercent: usagePercentSchema,
|
|
@@ -14719,12 +15125,27 @@ var threadUsageInspectionSchema = external_exports.object({
|
|
|
14719
15125
|
}).strict();
|
|
14720
15126
|
|
|
14721
15127
|
// ../../shared-contracts/dist/harness-accounts.js
|
|
14722
|
-
var
|
|
15128
|
+
var accountBalanceSnapshotSchema = external_exports.object({
|
|
15129
|
+
amount: external_exports.number().finite().nonnegative(),
|
|
15130
|
+
/** ISO 4217 code as reported by the Provider, for example `CNY`. */
|
|
15131
|
+
currency: external_exports.string().trim().min(1).max(8),
|
|
15132
|
+
/** Native label when the Harness exposes several Billing Sources. */
|
|
15133
|
+
label: external_exports.string().trim().min(1).max(128).optional()
|
|
15134
|
+
}).strict();
|
|
15135
|
+
var harnessAccountSnapshotObject = external_exports.object({
|
|
14723
15136
|
email: external_exports.string().trim().min(1).max(320).optional(),
|
|
14724
15137
|
label: external_exports.string().trim().min(1).max(256).optional(),
|
|
14725
15138
|
plan: external_exports.string().trim().min(1).max(128).optional(),
|
|
14726
|
-
credits: accountCreditsSnapshotSchema
|
|
15139
|
+
credits: accountCreditsSnapshotSchema.optional(),
|
|
15140
|
+
balance: accountBalanceSnapshotSchema.optional()
|
|
14727
15141
|
}).strict();
|
|
15142
|
+
function requireReportedQuota(schema) {
|
|
15143
|
+
return schema.refine((value) => {
|
|
15144
|
+
const reported = value;
|
|
15145
|
+
return reported.credits !== void 0 || reported.balance !== void 0;
|
|
15146
|
+
}, { message: "Account must report either credits or a balance" });
|
|
15147
|
+
}
|
|
15148
|
+
var harnessAccountSnapshotSchema = requireReportedQuota(harnessAccountSnapshotObject);
|
|
14728
15149
|
var harnessAccountIdentityShape = {
|
|
14729
15150
|
harnessId: harnessIdSchema,
|
|
14730
15151
|
harnessName: external_exports.string().trim().min(1).max(128)
|
|
@@ -14735,11 +15156,13 @@ var harnessAccountSourceListResultSchema = external_exports.object({ sources: ex
|
|
|
14735
15156
|
var harnessAccountInspectParamsSchema = external_exports.object({ harnessId: harnessIdSchema, refresh: external_exports.boolean().optional() }).strict();
|
|
14736
15157
|
var harnessAccountInspectResultSchema = external_exports.object({
|
|
14737
15158
|
...harnessAccountIdentityShape,
|
|
14738
|
-
account: harnessAccountSnapshotSchema.nullable()
|
|
15159
|
+
account: harnessAccountSnapshotSchema.nullable(),
|
|
15160
|
+
/** Every Billing Source from one Harness; `account` remains the first for older clients. */
|
|
15161
|
+
accounts: external_exports.array(harnessAccountSnapshotSchema).max(8).optional()
|
|
14739
15162
|
}).strict();
|
|
14740
15163
|
var harnessAccountListParamsSchema = external_exports.object({ refresh: external_exports.boolean().optional() }).strict();
|
|
14741
15164
|
var harnessAccountListResultSchema = external_exports.object({
|
|
14742
|
-
accounts: external_exports.array(
|
|
15165
|
+
accounts: external_exports.array(requireReportedQuota(harnessAccountSnapshotObject.extend(harnessAccountIdentityShape))).max(128)
|
|
14743
15166
|
}).strict();
|
|
14744
15167
|
|
|
14745
15168
|
// ../../shared-contracts/dist/json-value.js
|
|
@@ -14877,6 +15300,8 @@ var harnessModelSchema = external_exports.object({
|
|
|
14877
15300
|
ref: harnessModelRefSchema,
|
|
14878
15301
|
label: nonBlankTextSchema2.max(HARNESS_MODEL_LABEL_MAX_LENGTH),
|
|
14879
15302
|
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
15303
|
+
/** Optional opaque selection for this same Model with priority processing enabled. */
|
|
15304
|
+
fastModel: harnessModelRefSchema.optional(),
|
|
14880
15305
|
supportedThinkingOptionIds: external_exports.array(harnessThinkingOptionIdSchema).optional()
|
|
14881
15306
|
}).strict();
|
|
14882
15307
|
var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionSchema).superRefine((options, context) => {
|
|
@@ -14909,6 +15334,16 @@ var harnessModelCatalogSchema = external_exports.object({
|
|
|
14909
15334
|
});
|
|
14910
15335
|
}
|
|
14911
15336
|
refs.add(model.ref.id);
|
|
15337
|
+
if (model.fastModel) {
|
|
15338
|
+
if (refs.has(model.fastModel.id) || catalog.models.some((entry) => entry.ref.id === model.fastModel?.id)) {
|
|
15339
|
+
context.addIssue({
|
|
15340
|
+
code: "custom",
|
|
15341
|
+
message: "Fast Model refs must be distinct and unique",
|
|
15342
|
+
path: ["models", index, "fastModel"]
|
|
15343
|
+
});
|
|
15344
|
+
}
|
|
15345
|
+
refs.add(model.fastModel.id);
|
|
15346
|
+
}
|
|
14912
15347
|
const supportedThinkingIds = /* @__PURE__ */ new Set();
|
|
14913
15348
|
for (const [optionIndex, optionId] of (model.supportedThinkingOptionIds ?? []).entries()) {
|
|
14914
15349
|
if (supportedThinkingIds.has(optionId)) {
|
|
@@ -15028,11 +15463,13 @@ var threadThinkingSelectParamsSchema = external_exports.object({
|
|
|
15028
15463
|
thinkingOptionId: harnessThinkingOptionIdSchema
|
|
15029
15464
|
}).strict();
|
|
15030
15465
|
var threadInspectionParamsSchema = external_exports.object({
|
|
15031
|
-
threadId: hostThreadIdSchema
|
|
15466
|
+
threadId: hostThreadIdSchema,
|
|
15467
|
+
includeReferenceCapability: external_exports.boolean().optional()
|
|
15032
15468
|
}).strict();
|
|
15033
15469
|
var codexThreadInspectionSchema = external_exports.object({
|
|
15034
15470
|
owner: external_exports.literal("codex"),
|
|
15035
|
-
locked: external_exports.literal(true)
|
|
15471
|
+
locked: external_exports.literal(true),
|
|
15472
|
+
supportsThreadReferences: external_exports.literal(true).optional()
|
|
15036
15473
|
}).strict();
|
|
15037
15474
|
var externalThreadInspectionSchema = external_exports.object({
|
|
15038
15475
|
owner: external_exports.literal("external"),
|
|
@@ -15158,6 +15595,22 @@ var harnessLaunchSettingsSchema = external_exports.object({
|
|
|
15158
15595
|
restartRequired: external_exports.boolean()
|
|
15159
15596
|
}).strict();
|
|
15160
15597
|
|
|
15598
|
+
// ../../shared-contracts/dist/harness-installation.js
|
|
15599
|
+
var harnessInstallationParamsSchema = external_exports.object({
|
|
15600
|
+
harnessId: harnessIdSchema,
|
|
15601
|
+
action: external_exports.enum(["check", "update", "install"])
|
|
15602
|
+
}).strict();
|
|
15603
|
+
var harnessInstallationStateSchema = external_exports.object({
|
|
15604
|
+
currentVersion: external_exports.string().min(1).max(128),
|
|
15605
|
+
latestVersion: external_exports.string().min(1).max(128),
|
|
15606
|
+
updateAvailable: external_exports.boolean(),
|
|
15607
|
+
canUpdate: external_exports.boolean(),
|
|
15608
|
+
// Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
|
|
15609
|
+
message: external_exports.string().max(2048).optional(),
|
|
15610
|
+
messageCode: external_exports.string().min(1).max(128).optional(),
|
|
15611
|
+
latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
|
|
15612
|
+
}).strict();
|
|
15613
|
+
|
|
15161
15614
|
// ../../shared-contracts/dist/codex-accounts.js
|
|
15162
15615
|
var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
|
|
15163
15616
|
var nonBlankTextSchema3 = external_exports.string().trim().min(1);
|
|
@@ -15457,6 +15910,38 @@ var updateStatusResultSchema = external_exports.strictObject({
|
|
|
15457
15910
|
status: updateStatusSchema.nullable()
|
|
15458
15911
|
});
|
|
15459
15912
|
|
|
15913
|
+
// ../../shared-contracts/dist/remote-runtime.js
|
|
15914
|
+
var remoteUpdatePhaseSchema = external_exports.enum([
|
|
15915
|
+
"idle",
|
|
15916
|
+
"installing",
|
|
15917
|
+
"restarting",
|
|
15918
|
+
"succeeded",
|
|
15919
|
+
"failed"
|
|
15920
|
+
]);
|
|
15921
|
+
var runtimeStatusSchema = external_exports.object({
|
|
15922
|
+
runningVersion: external_exports.string().nullable(),
|
|
15923
|
+
installedVersion: external_exports.string().nullable(),
|
|
15924
|
+
restartRequired: external_exports.boolean(),
|
|
15925
|
+
remote: external_exports.boolean(),
|
|
15926
|
+
updateSupported: external_exports.boolean(),
|
|
15927
|
+
update: external_exports.object({
|
|
15928
|
+
phase: remoteUpdatePhaseSchema,
|
|
15929
|
+
targetVersion: external_exports.string().nullable(),
|
|
15930
|
+
error: external_exports.string().nullable()
|
|
15931
|
+
})
|
|
15932
|
+
});
|
|
15933
|
+
var remoteUpdateParamsSchema = external_exports.object({
|
|
15934
|
+
version: external_exports.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u)
|
|
15935
|
+
}).strict();
|
|
15936
|
+
var remoteSshSetupParamsSchema = external_exports.object({
|
|
15937
|
+
hostname: external_exports.string().min(1).max(1024).refine((value) => !value.startsWith("-") && !/\s/u.test(value)),
|
|
15938
|
+
port: external_exports.number().int().min(1).max(65535).nullable(),
|
|
15939
|
+
identity: external_exports.string().max(4096).nullable(),
|
|
15940
|
+
action: external_exports.enum(["inspect", "install", "update", "repair"]),
|
|
15941
|
+
version: external_exports.string().regex(/^\d+\.\d+\.\d+$/u).nullable()
|
|
15942
|
+
}).strict();
|
|
15943
|
+
var remoteSshSetupResultSchema = external_exports.object({ state: external_exports.enum(["installed", "not-installed"]) }).strict();
|
|
15944
|
+
|
|
15460
15945
|
// ../../shared-contracts/dist/index.js
|
|
15461
15946
|
var workspaceContractVersionSchema = external_exports.literal(WORKSPACE_CONTRACT_VERSION);
|
|
15462
15947
|
|
|
@@ -15773,235 +16258,10 @@ function mergeLiveHarnessCommands(builtIns, idPrefix, live, exclusions = {}) {
|
|
|
15773
16258
|
// dist/acp-transport.js
|
|
15774
16259
|
import { spawn, spawnSync } from "node:child_process";
|
|
15775
16260
|
import { Readable, Writable } from "node:stream";
|
|
15776
|
-
import { execFile } from "node:child_process";
|
|
16261
|
+
import { execFile as execFile2 } from "node:child_process";
|
|
15777
16262
|
import { promisify } from "node:util";
|
|
15778
16263
|
import { setTimeout as delay } from "node:timers/promises";
|
|
15779
16264
|
|
|
15780
|
-
// ../../harness-discovery/dist/environment.js
|
|
15781
|
-
import fs from "node:fs";
|
|
15782
|
-
import path from "node:path";
|
|
15783
|
-
function targetPath(platform) {
|
|
15784
|
-
return platform === "win32" ? path.win32 : path.posix;
|
|
15785
|
-
}
|
|
15786
|
-
function environmentValue(environment, name) {
|
|
15787
|
-
const lowered = name.toLowerCase();
|
|
15788
|
-
for (const [key, value] of Object.entries(environment)) {
|
|
15789
|
-
if (key.toLowerCase() === lowered)
|
|
15790
|
-
return value;
|
|
15791
|
-
}
|
|
15792
|
-
return void 0;
|
|
15793
|
-
}
|
|
15794
|
-
function pathDelimiter(platform) {
|
|
15795
|
-
return platform === "win32" ? ";" : ":";
|
|
15796
|
-
}
|
|
15797
|
-
function pathDirectories(environment, platform) {
|
|
15798
|
-
return (environmentValue(environment, "PATH") ?? "").split(pathDelimiter(platform)).map((directory) => directory.trim().replace(/^"|"$/gu, "")).filter(Boolean);
|
|
15799
|
-
}
|
|
15800
|
-
function executableExtensions(command, platform, environment) {
|
|
15801
|
-
if (platform !== "win32")
|
|
15802
|
-
return [""];
|
|
15803
|
-
if (targetPath(platform).extname(command) !== "")
|
|
15804
|
-
return [""];
|
|
15805
|
-
return (environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").map((extension) => extension.trim()).filter(Boolean);
|
|
15806
|
-
}
|
|
15807
|
-
function isExecutableFile(filePath, platform) {
|
|
15808
|
-
try {
|
|
15809
|
-
fs.accessSync(filePath, platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK);
|
|
15810
|
-
return fs.statSync(filePath).isFile();
|
|
15811
|
-
} catch {
|
|
15812
|
-
return false;
|
|
15813
|
-
}
|
|
15814
|
-
}
|
|
15815
|
-
function subdirectoryNames(directory) {
|
|
15816
|
-
try {
|
|
15817
|
-
return fs.readdirSync(directory, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
15818
|
-
} catch {
|
|
15819
|
-
return [];
|
|
15820
|
-
}
|
|
15821
|
-
}
|
|
15822
|
-
function newestFirst(names) {
|
|
15823
|
-
return [...names].sort((left, right) => right.localeCompare(left, void 0, { numeric: true }));
|
|
15824
|
-
}
|
|
15825
|
-
|
|
15826
|
-
// ../../harness-discovery/dist/invocation.js
|
|
15827
|
-
import path2 from "node:path";
|
|
15828
|
-
function commandInvocation(command, arguments_, environment, platform = process.platform) {
|
|
15829
|
-
const extension = path2.win32.extname(command).toLowerCase();
|
|
15830
|
-
if (platform !== "win32" || ![".cmd", ".bat"].includes(extension)) {
|
|
15831
|
-
return { command, arguments: [...arguments_], windowsVerbatimArguments: false };
|
|
15832
|
-
}
|
|
15833
|
-
const quote = (value) => `"${value.replaceAll("%", "%%").replaceAll('"', '""')}"`;
|
|
15834
|
-
const commandLine = [command, ...arguments_].map(quote).join(" ");
|
|
15835
|
-
return {
|
|
15836
|
-
command: environmentValue(environment, "ComSpec") ?? "cmd.exe",
|
|
15837
|
-
arguments: ["/d", "/v:off", "/s", "/c", `"${commandLine}"`],
|
|
15838
|
-
windowsVerbatimArguments: true
|
|
15839
|
-
};
|
|
15840
|
-
}
|
|
15841
|
-
|
|
15842
|
-
// ../../harness-discovery/dist/resolve.js
|
|
15843
|
-
import os from "node:os";
|
|
15844
|
-
|
|
15845
|
-
// ../../harness-discovery/dist/version-managers.js
|
|
15846
|
-
function versionManagerBinaryDirectories(context) {
|
|
15847
|
-
const { platform, environment, home } = context;
|
|
15848
|
-
const list = context.subdirectories ?? subdirectoryNames;
|
|
15849
|
-
const pathFlavor = targetPath(platform);
|
|
15850
|
-
const value = (name) => environmentValue(environment, name);
|
|
15851
|
-
const directories = [];
|
|
15852
|
-
const versioned = (root, ...tail) => {
|
|
15853
|
-
for (const version2 of newestFirst(list(root))) {
|
|
15854
|
-
directories.push(pathFlavor.join(root, version2, ...tail));
|
|
15855
|
-
}
|
|
15856
|
-
};
|
|
15857
|
-
if (platform === "win32") {
|
|
15858
|
-
const appData = value("APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming");
|
|
15859
|
-
const localAppData = value("LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local");
|
|
15860
|
-
versioned(pathFlavor.join(appData, "nvm"));
|
|
15861
|
-
versioned(value("FNM_DIR") ?? pathFlavor.join(appData, "fnm", "node-versions"), "installation");
|
|
15862
|
-
directories.push(pathFlavor.join(localAppData, "Volta", "bin"));
|
|
15863
|
-
directories.push(pathFlavor.join(home, ".bun", "bin"));
|
|
15864
|
-
const pnpmHome2 = value("PNPM_HOME");
|
|
15865
|
-
if (pnpmHome2)
|
|
15866
|
-
directories.push(pnpmHome2);
|
|
15867
|
-
directories.push(pathFlavor.join(localAppData, "pnpm"));
|
|
15868
|
-
return directories;
|
|
15869
|
-
}
|
|
15870
|
-
versioned(pathFlavor.join(value("NVM_DIR") ?? pathFlavor.join(home, ".nvm"), "versions", "node"), "bin");
|
|
15871
|
-
const fnmRoots = [
|
|
15872
|
-
value("FNM_DIR"),
|
|
15873
|
-
pathFlavor.join(home, ".local", "share", "fnm"),
|
|
15874
|
-
pathFlavor.join(home, "Library", "Application Support", "fnm")
|
|
15875
|
-
].filter((root) => root !== void 0);
|
|
15876
|
-
for (const root of fnmRoots) {
|
|
15877
|
-
versioned(pathFlavor.join(root, "node-versions"), "installation", "bin");
|
|
15878
|
-
}
|
|
15879
|
-
const voltaHome = value("VOLTA_HOME") ?? pathFlavor.join(home, ".volta");
|
|
15880
|
-
versioned(pathFlavor.join(voltaHome, "tools", "image", "node"), "bin");
|
|
15881
|
-
directories.push(pathFlavor.join(voltaHome, "bin"));
|
|
15882
|
-
const asdfHome = value("ASDF_DATA_DIR") ?? pathFlavor.join(home, ".asdf");
|
|
15883
|
-
versioned(pathFlavor.join(asdfHome, "installs", "nodejs"), "bin");
|
|
15884
|
-
directories.push(pathFlavor.join(asdfHome, "shims"));
|
|
15885
|
-
const nodenvHome = value("NODENV_ROOT") ?? pathFlavor.join(home, ".nodenv");
|
|
15886
|
-
versioned(pathFlavor.join(nodenvHome, "versions"), "bin");
|
|
15887
|
-
directories.push(pathFlavor.join(nodenvHome, "shims"));
|
|
15888
|
-
versioned(pathFlavor.join(value("N_PREFIX") ?? "/usr/local", "n", "versions", "node"), "bin");
|
|
15889
|
-
directories.push(pathFlavor.join(home, ".bun", "bin"));
|
|
15890
|
-
const pnpmHome = value("PNPM_HOME");
|
|
15891
|
-
if (pnpmHome)
|
|
15892
|
-
directories.push(pnpmHome);
|
|
15893
|
-
directories.push(pathFlavor.join(home, "Library", "pnpm"));
|
|
15894
|
-
directories.push(pathFlavor.join(home, ".local", "share", "pnpm"));
|
|
15895
|
-
for (const prefix of ["/opt/homebrew/opt", "/usr/local/opt"]) {
|
|
15896
|
-
for (const formula of newestFirst(list(prefix).filter((name) => name.startsWith("node@")))) {
|
|
15897
|
-
directories.push(pathFlavor.join(prefix, formula, "bin"));
|
|
15898
|
-
}
|
|
15899
|
-
}
|
|
15900
|
-
return directories;
|
|
15901
|
-
}
|
|
15902
|
-
|
|
15903
|
-
// ../../harness-discovery/dist/resolve.js
|
|
15904
|
-
var VERSION_MANAGER_ROOTS = "<version-managers>";
|
|
15905
|
-
function installRootExtensions(platform) {
|
|
15906
|
-
return platform === "win32" ? [".exe", ".cmd"] : [""];
|
|
15907
|
-
}
|
|
15908
|
-
function resolveHomeDirectory(input) {
|
|
15909
|
-
return input.homeDirectory ?? environmentValue(input.environment, "HOME") ?? environmentValue(input.environment, "USERPROFILE") ?? os.homedir();
|
|
15910
|
-
}
|
|
15911
|
-
function templateVariables(environment, platform, home) {
|
|
15912
|
-
const pathFlavor = targetPath(platform);
|
|
15913
|
-
return {
|
|
15914
|
-
HOME: home,
|
|
15915
|
-
USERPROFILE: home,
|
|
15916
|
-
APPDATA: environmentValue(environment, "APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming"),
|
|
15917
|
-
LOCALAPPDATA: environmentValue(environment, "LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local")
|
|
15918
|
-
};
|
|
15919
|
-
}
|
|
15920
|
-
function joinTemplate(platform, value) {
|
|
15921
|
-
const pathFlavor = targetPath(platform);
|
|
15922
|
-
const segments = value.split("/");
|
|
15923
|
-
const head = segments[0] ?? "";
|
|
15924
|
-
const tail = segments.slice(1);
|
|
15925
|
-
if (head === "")
|
|
15926
|
-
return pathFlavor.join(pathFlavor.sep, ...tail);
|
|
15927
|
-
return tail.length === 0 ? head : pathFlavor.join(head, ...tail);
|
|
15928
|
-
}
|
|
15929
|
-
function expandInstallRoot(template, environment, platform, home) {
|
|
15930
|
-
const variables = templateVariables(environment, platform, home);
|
|
15931
|
-
let unresolved = false;
|
|
15932
|
-
const substituted = template.replace(/^~(?=\/|$)/u, home).replace(/\$\{(\w+)\}/gu, (_match, name) => {
|
|
15933
|
-
const value = variables[name] ?? environmentValue(environment, name);
|
|
15934
|
-
if (value === void 0 || value === "") {
|
|
15935
|
-
unresolved = true;
|
|
15936
|
-
return "";
|
|
15937
|
-
}
|
|
15938
|
-
return value;
|
|
15939
|
-
});
|
|
15940
|
-
return unresolved ? void 0 : joinTemplate(platform, substituted);
|
|
15941
|
-
}
|
|
15942
|
-
function installRootDirectories(spec, input, dependencies, platform, home) {
|
|
15943
|
-
const templates = (platform === "win32" ? spec.installRoots?.windows : spec.installRoots?.posix) ?? [];
|
|
15944
|
-
const directories = [];
|
|
15945
|
-
for (const template of templates) {
|
|
15946
|
-
if (template === VERSION_MANAGER_ROOTS) {
|
|
15947
|
-
directories.push(...versionManagerBinaryDirectories({
|
|
15948
|
-
platform,
|
|
15949
|
-
environment: input.environment,
|
|
15950
|
-
home,
|
|
15951
|
-
...dependencies.subdirectories ? { subdirectories: dependencies.subdirectories } : {}
|
|
15952
|
-
}));
|
|
15953
|
-
continue;
|
|
15954
|
-
}
|
|
15955
|
-
const directory = expandInstallRoot(template, input.environment, platform, home);
|
|
15956
|
-
if (directory !== void 0)
|
|
15957
|
-
directories.push(directory);
|
|
15958
|
-
}
|
|
15959
|
-
return directories;
|
|
15960
|
-
}
|
|
15961
|
-
function harnessCandidates(spec, input, dependencies = {}) {
|
|
15962
|
-
const platform = input.platform ?? process.platform;
|
|
15963
|
-
const pathFlavor = targetPath(platform);
|
|
15964
|
-
const configured = input.command ?? (spec.commandEnvironmentVariable ? environmentValue(input.environment, spec.commandEnvironmentVariable) : void 0);
|
|
15965
|
-
const command = configured ?? spec.command;
|
|
15966
|
-
if (pathFlavor.isAbsolute(command) || command.includes("/") || command.includes("\\")) {
|
|
15967
|
-
return [{ candidate: command, source: "configured" }];
|
|
15968
|
-
}
|
|
15969
|
-
const candidates = [];
|
|
15970
|
-
const extensions = executableExtensions(command, platform, input.environment);
|
|
15971
|
-
for (const directory of pathDirectories(input.environment, platform)) {
|
|
15972
|
-
for (const extension of extensions) {
|
|
15973
|
-
candidates.push({
|
|
15974
|
-
candidate: pathFlavor.join(directory, command + extension),
|
|
15975
|
-
source: "path"
|
|
15976
|
-
});
|
|
15977
|
-
}
|
|
15978
|
-
}
|
|
15979
|
-
if (configured !== void 0)
|
|
15980
|
-
return candidates;
|
|
15981
|
-
const home = resolveHomeDirectory(input);
|
|
15982
|
-
for (const directory of installRootDirectories(spec, input, dependencies, platform, home)) {
|
|
15983
|
-
for (const extension of installRootExtensions(platform)) {
|
|
15984
|
-
candidates.push({
|
|
15985
|
-
candidate: pathFlavor.join(directory, spec.command + extension),
|
|
15986
|
-
source: "install-root"
|
|
15987
|
-
});
|
|
15988
|
-
}
|
|
15989
|
-
}
|
|
15990
|
-
return candidates;
|
|
15991
|
-
}
|
|
15992
|
-
function resolveHarnessExecutable(spec, input, dependencies = {}) {
|
|
15993
|
-
const platform = input.platform ?? process.platform;
|
|
15994
|
-
const isExecutable = dependencies.isExecutable ?? ((candidate) => isExecutableFile(candidate, platform));
|
|
15995
|
-
const runnable = spec.runnableCandidate ?? ((candidate) => candidate);
|
|
15996
|
-
const context = { platform, isExecutable };
|
|
15997
|
-
for (const { candidate, source } of harnessCandidates(spec, input, dependencies)) {
|
|
15998
|
-
const executable = runnable(candidate, context);
|
|
15999
|
-
if (executable !== void 0 && isExecutable(executable))
|
|
16000
|
-
return { executable, source };
|
|
16001
|
-
}
|
|
16002
|
-
return void 0;
|
|
16003
|
-
}
|
|
16004
|
-
|
|
16005
16265
|
// ../../../node_modules/@agentclientprotocol/sdk/dist/schema/index.js
|
|
16006
16266
|
var AGENT_METHODS = {
|
|
16007
16267
|
initialize: "initialize",
|
|
@@ -20196,7 +20456,7 @@ function kiroLiveCommands(native) {
|
|
|
20196
20456
|
}
|
|
20197
20457
|
|
|
20198
20458
|
// dist/command.js
|
|
20199
|
-
import
|
|
20459
|
+
import path4 from "node:path";
|
|
20200
20460
|
var KiroExecutableError = class extends Error {
|
|
20201
20461
|
code = "KIRO_NOT_FOUND";
|
|
20202
20462
|
};
|
|
@@ -20225,7 +20485,7 @@ function resolveKiroExecutable(input = {}, dependencies = {}) {
|
|
|
20225
20485
|
}, dependencies);
|
|
20226
20486
|
if (!resolution)
|
|
20227
20487
|
throw new KiroExecutableError("Kiro CLI is not installed");
|
|
20228
|
-
return targetPath(platform).isAbsolute(resolution.executable) ? resolution.executable :
|
|
20488
|
+
return targetPath(platform).isAbsolute(resolution.executable) ? resolution.executable : path4.resolve(resolution.executable);
|
|
20229
20489
|
}
|
|
20230
20490
|
function kiroInvocation(command, platform = process.platform) {
|
|
20231
20491
|
return commandInvocation(command, ["acp", "--agent-engine", "v3", "--auth-method", "cli"], process.env, platform);
|
|
@@ -20372,18 +20632,19 @@ function isRecord5(value) {
|
|
|
20372
20632
|
function errorText(error51) {
|
|
20373
20633
|
return error51 instanceof Error ? error51.message : String(error51);
|
|
20374
20634
|
}
|
|
20375
|
-
function classifyStartupError(error51) {
|
|
20376
|
-
if (error51 instanceof KiroTransportError)
|
|
20377
|
-
return error51;
|
|
20635
|
+
function classifyStartupError(error51, stderr = "") {
|
|
20378
20636
|
if (error51 instanceof KiroExecutableError) {
|
|
20379
20637
|
return new KiroTransportError("notInstalled", error51.message, { cause: error51 });
|
|
20380
20638
|
}
|
|
20381
|
-
const text = errorText(error51)
|
|
20382
|
-
|
|
20383
|
-
|
|
20639
|
+
const text = `${errorText(error51)}
|
|
20640
|
+
${stderr}`.toLowerCase();
|
|
20641
|
+
if (text.includes("auth_required") || text.includes("authentication") || text.includes("not logged in") || text.includes("not log in") || text.includes("sign in") || text.includes("unauthorized")) {
|
|
20642
|
+
return new KiroTransportError("authenticationRequired", "Kiro CLI authentication is required (run `kiro-cli login`)", {
|
|
20384
20643
|
cause: error51
|
|
20385
20644
|
});
|
|
20386
20645
|
}
|
|
20646
|
+
if (error51 instanceof KiroTransportError)
|
|
20647
|
+
return error51;
|
|
20387
20648
|
return new KiroTransportError("unavailable", "Kiro CLI could not start", { cause: error51 });
|
|
20388
20649
|
}
|
|
20389
20650
|
var KiroRequestTimeoutError = class extends KiroTransportError {
|
|
@@ -20482,7 +20743,7 @@ var KiroAcpTransport = class {
|
|
|
20482
20743
|
environment
|
|
20483
20744
|
});
|
|
20484
20745
|
const invocation = commandInvocation(executable, ["chat", "--list-models", "--format", "json"], environment, process.platform);
|
|
20485
|
-
const { stdout } = await promisify(
|
|
20746
|
+
const { stdout } = await promisify(execFile2)(invocation.command, invocation.arguments, {
|
|
20486
20747
|
cwd: this.#options.cwd,
|
|
20487
20748
|
env: environment,
|
|
20488
20749
|
windowsHide: true,
|
|
@@ -20493,9 +20754,8 @@ var KiroAcpTransport = class {
|
|
|
20493
20754
|
});
|
|
20494
20755
|
return { ...initialize, catalog: parseKiroCliModels(JSON.parse(stdout)) };
|
|
20495
20756
|
} catch (error51) {
|
|
20496
|
-
const classified = classifyStartupError(error51);
|
|
20497
20757
|
await this.close().catch(() => void 0);
|
|
20498
|
-
throw
|
|
20758
|
+
throw classifyStartupError(error51, this.#stderrTail);
|
|
20499
20759
|
}
|
|
20500
20760
|
}
|
|
20501
20761
|
async open(input) {
|
|
@@ -20583,9 +20843,8 @@ var KiroAcpTransport = class {
|
|
|
20583
20843
|
replay
|
|
20584
20844
|
};
|
|
20585
20845
|
} catch (error51) {
|
|
20586
|
-
const classified = classifyStartupError(error51);
|
|
20587
20846
|
await this.close().catch(() => void 0);
|
|
20588
|
-
throw
|
|
20847
|
+
throw classifyStartupError(error51, this.#stderrTail);
|
|
20589
20848
|
}
|
|
20590
20849
|
}
|
|
20591
20850
|
async setConfigOption(configId, value) {
|
|
@@ -21071,7 +21330,7 @@ ${fence}`;
|
|
|
21071
21330
|
|
|
21072
21331
|
// dist/file-diff.js
|
|
21073
21332
|
import { Buffer as Buffer2 } from "node:buffer";
|
|
21074
|
-
import
|
|
21333
|
+
import path5 from "node:path";
|
|
21075
21334
|
import { fileURLToPath } from "node:url";
|
|
21076
21335
|
|
|
21077
21336
|
// ../../../node_modules/diff/libesm/diff/base.js
|
|
@@ -21174,16 +21433,16 @@ var Diff = class {
|
|
|
21174
21433
|
}
|
|
21175
21434
|
}
|
|
21176
21435
|
}
|
|
21177
|
-
addToPath(
|
|
21178
|
-
const last =
|
|
21436
|
+
addToPath(path9, added, removed, oldPosInc, options) {
|
|
21437
|
+
const last = path9.lastComponent;
|
|
21179
21438
|
if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
|
|
21180
21439
|
return {
|
|
21181
|
-
oldPos:
|
|
21440
|
+
oldPos: path9.oldPos + oldPosInc,
|
|
21182
21441
|
lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
|
|
21183
21442
|
};
|
|
21184
21443
|
} else {
|
|
21185
21444
|
return {
|
|
21186
|
-
oldPos:
|
|
21445
|
+
oldPos: path9.oldPos + oldPosInc,
|
|
21187
21446
|
lastComponent: { count: 1, added, removed, previousComponent: last }
|
|
21188
21447
|
};
|
|
21189
21448
|
}
|
|
@@ -21503,23 +21762,23 @@ function resolveFilePath(candidate) {
|
|
|
21503
21762
|
}
|
|
21504
21763
|
try {
|
|
21505
21764
|
if (candidate.startsWith("file:")) {
|
|
21506
|
-
return
|
|
21765
|
+
return path5.resolve(fileURLToPath(new URL(candidate)));
|
|
21507
21766
|
}
|
|
21508
|
-
return
|
|
21767
|
+
return path5.resolve(candidate);
|
|
21509
21768
|
} catch {
|
|
21510
21769
|
try {
|
|
21511
21770
|
const withoutScheme = candidate.replace(/^file:\/\/\/?/iu, "");
|
|
21512
|
-
return
|
|
21771
|
+
return path5.resolve(decodeURIComponent(withoutScheme));
|
|
21513
21772
|
} catch {
|
|
21514
21773
|
return null;
|
|
21515
21774
|
}
|
|
21516
21775
|
}
|
|
21517
21776
|
}
|
|
21518
21777
|
function displayPath(nativePath, cwd) {
|
|
21519
|
-
const resolvedCwd =
|
|
21520
|
-
const resolvedPath =
|
|
21521
|
-
const relative =
|
|
21522
|
-
const inside = relative.length > 0 && relative !== ".." && !relative.startsWith(`..${
|
|
21778
|
+
const resolvedCwd = path5.resolve(cwd);
|
|
21779
|
+
const resolvedPath = path5.resolve(nativePath);
|
|
21780
|
+
const relative = path5.relative(resolvedCwd, resolvedPath);
|
|
21781
|
+
const inside = relative.length > 0 && relative !== ".." && !relative.startsWith(`..${path5.sep}`);
|
|
21523
21782
|
const selected = inside ? relative : resolvedPath;
|
|
21524
21783
|
const normalized = selected.replaceAll("\\", "/");
|
|
21525
21784
|
if (normalized.length === 0 || normalized === ".")
|
|
@@ -22125,7 +22384,7 @@ var KiroUsage = class {
|
|
|
22125
22384
|
// dist/history.js
|
|
22126
22385
|
import { access, readdir, readFile } from "node:fs/promises";
|
|
22127
22386
|
import os2 from "node:os";
|
|
22128
|
-
import
|
|
22387
|
+
import path6 from "node:path";
|
|
22129
22388
|
|
|
22130
22389
|
// dist/permission-modes.js
|
|
22131
22390
|
var KIRO_DEFAULT_PERMISSION_MODE_ID = harnessPermissionModeIdSchema.parse("autopilot");
|
|
@@ -22161,12 +22420,12 @@ function isRecord10(value) {
|
|
|
22161
22420
|
}
|
|
22162
22421
|
function kiroHomeDir(environment = process.env) {
|
|
22163
22422
|
const home = environment.HOME ?? environment.USERPROFILE ?? os2.homedir();
|
|
22164
|
-
return environment.KIRO_HOME ??
|
|
22423
|
+
return environment.KIRO_HOME ?? path6.join(home, ".kiro");
|
|
22165
22424
|
}
|
|
22166
22425
|
async function locateKiroNativeSession(input, sessionId) {
|
|
22167
22426
|
if (!sessionId || sessionId.trim().length === 0)
|
|
22168
22427
|
return null;
|
|
22169
|
-
const root =
|
|
22428
|
+
const root = path6.join(input.homeDirectory ?? kiroHomeDir(input.environment), "sessions");
|
|
22170
22429
|
let entries;
|
|
22171
22430
|
try {
|
|
22172
22431
|
entries = await readdir(root, { withFileTypes: true });
|
|
@@ -22176,14 +22435,14 @@ async function locateKiroNativeSession(input, sessionId) {
|
|
|
22176
22435
|
for (const entry of entries) {
|
|
22177
22436
|
if (!entry.isDirectory() || entry.name === "cli")
|
|
22178
22437
|
continue;
|
|
22179
|
-
const sessionDir =
|
|
22180
|
-
const metaFile =
|
|
22438
|
+
const sessionDir = path6.join(root, entry.name, sessionId);
|
|
22439
|
+
const metaFile = path6.join(sessionDir, "session.json");
|
|
22181
22440
|
try {
|
|
22182
22441
|
await access(metaFile);
|
|
22183
22442
|
const content = await readFile(metaFile, "utf8");
|
|
22184
22443
|
const meta3 = JSON.parse(content);
|
|
22185
22444
|
if (meta3 && meta3.id === sessionId) {
|
|
22186
|
-
const cwd = Array.isArray(meta3.workspacePaths) && meta3.workspacePaths.length > 0 ?
|
|
22445
|
+
const cwd = Array.isArray(meta3.workspacePaths) && meta3.workspacePaths.length > 0 ? path6.resolve(meta3.workspacePaths[0]) : process.cwd();
|
|
22187
22446
|
return {
|
|
22188
22447
|
sessionDirectory: sessionDir,
|
|
22189
22448
|
sessionMeta: meta3,
|
|
@@ -22197,7 +22456,7 @@ async function locateKiroNativeSession(input, sessionId) {
|
|
|
22197
22456
|
return null;
|
|
22198
22457
|
}
|
|
22199
22458
|
async function readKiroNativeMessages(sessionDirectory) {
|
|
22200
|
-
const messagesFile =
|
|
22459
|
+
const messagesFile = path6.join(sessionDirectory, "messages.jsonl");
|
|
22201
22460
|
const raw = await readFile(messagesFile, "utf8");
|
|
22202
22461
|
return raw.split("\n").map((line) => line.trim()).filter((line) => line.length > 0).map((line) => {
|
|
22203
22462
|
const row = JSON.parse(line);
|
|
@@ -22218,7 +22477,7 @@ async function readKiroSessionMessages(location, ancestors = /* @__PURE__ */ new
|
|
|
22218
22477
|
if (first?.payload.operationType !== "Summary" || !location.sessionMeta.parentSessionId) {
|
|
22219
22478
|
return rows;
|
|
22220
22479
|
}
|
|
22221
|
-
const parent = await locateKiroNativeSession({ homeDirectory:
|
|
22480
|
+
const parent = await locateKiroNativeSession({ homeDirectory: path6.resolve(location.sessionDirectory, "../../..") }, location.sessionMeta.parentSessionId);
|
|
22222
22481
|
if (!parent)
|
|
22223
22482
|
throw new Error("Kiro fork's archived parent history was not found");
|
|
22224
22483
|
const parentRows = await readKiroSessionMessages(parent, ancestors);
|
|
@@ -22463,10 +22722,265 @@ async function readKiroSnapshot(location) {
|
|
|
22463
22722
|
};
|
|
22464
22723
|
}
|
|
22465
22724
|
|
|
22466
|
-
// dist/
|
|
22725
|
+
// dist/session-import.js
|
|
22726
|
+
import { opendir, readFile as readFile2, stat } from "node:fs/promises";
|
|
22727
|
+
import path7 from "node:path";
|
|
22728
|
+
|
|
22729
|
+
// ../../harness-adapter/dist/session-import.js
|
|
22730
|
+
import { lstat } from "node:fs/promises";
|
|
22731
|
+
var SessionImportChangedError = class extends Error {
|
|
22732
|
+
constructor(message = "Native Session changed during discovery; refresh and retry") {
|
|
22733
|
+
super(message);
|
|
22734
|
+
this.name = "SessionImportChangedError";
|
|
22735
|
+
}
|
|
22736
|
+
};
|
|
22737
|
+
function isMissingFileError(error51) {
|
|
22738
|
+
return typeof error51 === "object" && error51 !== null && "code" in error51 && error51.code === "ENOENT";
|
|
22739
|
+
}
|
|
22740
|
+
function sameFileFingerprint(left, right) {
|
|
22741
|
+
return left === null || right === null ? left === right : left.dev === right.dev && left.ino === right.ino && left.size === right.size && left.mtimeMs === right.mtimeMs && left.ctimeMs === right.ctimeMs;
|
|
22742
|
+
}
|
|
22743
|
+
var STORAGE_ACCESS_ERRORS = /* @__PURE__ */ new Set(["EACCES", "EPERM", "EIO", "EMFILE", "ENFILE"]);
|
|
22744
|
+
function isStorageAccessError(error51) {
|
|
22745
|
+
return typeof error51 === "object" && error51 !== null && "code" in error51 && typeof error51.code === "string" && STORAGE_ACCESS_ERRORS.has(error51.code);
|
|
22746
|
+
}
|
|
22747
|
+
async function optionalLstat(file2) {
|
|
22748
|
+
try {
|
|
22749
|
+
return await lstat(file2);
|
|
22750
|
+
} catch (error51) {
|
|
22751
|
+
if (isMissingFileError(error51))
|
|
22752
|
+
return null;
|
|
22753
|
+
throw error51;
|
|
22754
|
+
}
|
|
22755
|
+
}
|
|
22756
|
+
async function readStableFiles(files, read) {
|
|
22757
|
+
const before = await Promise.all(files.map(optionalLstat));
|
|
22758
|
+
const value = await read(before);
|
|
22759
|
+
const after = await Promise.all(files.map(optionalLstat));
|
|
22760
|
+
if (before.some((info, index) => !sameFileFingerprint(info, after[index] ?? null)))
|
|
22761
|
+
throw new SessionImportChangedError();
|
|
22762
|
+
return value;
|
|
22763
|
+
}
|
|
22764
|
+
function sessionImportTitle(value, maxLength = HARNESS_SESSION_IMPORT_TITLE_MAX_LENGTH) {
|
|
22765
|
+
if (typeof value !== "string")
|
|
22766
|
+
return null;
|
|
22767
|
+
const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
|
|
22768
|
+
if (!normalized)
|
|
22769
|
+
return null;
|
|
22770
|
+
if (normalized.length <= maxLength)
|
|
22771
|
+
return normalized;
|
|
22772
|
+
const characters = [...normalized];
|
|
22773
|
+
if (characters.length <= maxLength)
|
|
22774
|
+
return normalized;
|
|
22775
|
+
return `${characters.slice(0, maxLength - 1).join("").trimEnd()}…`;
|
|
22776
|
+
}
|
|
22777
|
+
function sessionImportCandidate(input) {
|
|
22778
|
+
const time3 = typeof input.updatedAt === "number" ? input.updatedAt : typeof input.updatedAt === "string" ? Date.parse(input.updatedAt) : Number.NaN;
|
|
22779
|
+
const parsed = harnessSessionImportCandidateSchema.safeParse({
|
|
22780
|
+
nativeSessionId: input.nativeSessionId,
|
|
22781
|
+
cwd: input.cwd,
|
|
22782
|
+
title: typeof input.title === "string" && input.title.trim().length > 0 ? input.title : null,
|
|
22783
|
+
updatedAt: Math.floor(time3),
|
|
22784
|
+
// Unknown must stay unknown; only an explicit boolean is a native statement.
|
|
22785
|
+
running: typeof input.running === "boolean" ? input.running : null
|
|
22786
|
+
});
|
|
22787
|
+
return parsed.success ? parsed.data : null;
|
|
22788
|
+
}
|
|
22789
|
+
var SessionImportScope = class {
|
|
22790
|
+
#abort = new AbortController();
|
|
22791
|
+
#options;
|
|
22792
|
+
#pending = /* @__PURE__ */ new Set();
|
|
22793
|
+
constructor(options) {
|
|
22794
|
+
this.#options = options;
|
|
22795
|
+
}
|
|
22796
|
+
#closed() {
|
|
22797
|
+
return {
|
|
22798
|
+
ok: false,
|
|
22799
|
+
error: { code: "invalidState", message: this.#options.closedMessage, retryable: false }
|
|
22800
|
+
};
|
|
22801
|
+
}
|
|
22802
|
+
read(operation) {
|
|
22803
|
+
const signal = this.#abort.signal;
|
|
22804
|
+
if (signal.aborted)
|
|
22805
|
+
return Promise.resolve(this.#closed());
|
|
22806
|
+
let started;
|
|
22807
|
+
try {
|
|
22808
|
+
started = operation(signal);
|
|
22809
|
+
} catch (error51) {
|
|
22810
|
+
started = Promise.reject(error51 instanceof Error ? error51 : new Error("Session read failed"));
|
|
22811
|
+
}
|
|
22812
|
+
const request = started.then((value) => signal.aborted ? this.#closed() : { ok: true, value }).catch(() => signal.aborted ? this.#closed() : {
|
|
22813
|
+
ok: false,
|
|
22814
|
+
error: {
|
|
22815
|
+
code: "unavailable",
|
|
22816
|
+
message: this.#options.unavailableMessage,
|
|
22817
|
+
retryable: true
|
|
22818
|
+
}
|
|
22819
|
+
}).finally(() => this.#pending.delete(request));
|
|
22820
|
+
this.#pending.add(request);
|
|
22821
|
+
return request;
|
|
22822
|
+
}
|
|
22823
|
+
/** `read` for `resolveCandidate`: a null source is the selected Session having disappeared. */
|
|
22824
|
+
async resolve(operation) {
|
|
22825
|
+
const result = await this.read(operation);
|
|
22826
|
+
if (!result.ok)
|
|
22827
|
+
return result;
|
|
22828
|
+
return result.value ? { ok: true, value: result.value } : {
|
|
22829
|
+
ok: false,
|
|
22830
|
+
error: {
|
|
22831
|
+
code: "sessionNotFound",
|
|
22832
|
+
message: this.#options.notFoundMessage,
|
|
22833
|
+
retryable: false
|
|
22834
|
+
}
|
|
22835
|
+
};
|
|
22836
|
+
}
|
|
22837
|
+
/** Idempotent. Resolves after every started read has settled. */
|
|
22838
|
+
async close() {
|
|
22839
|
+
this.#abort.abort();
|
|
22840
|
+
await Promise.allSettled(this.#pending);
|
|
22841
|
+
}
|
|
22842
|
+
};
|
|
22843
|
+
|
|
22844
|
+
// dist/session-import.js
|
|
22845
|
+
var MAX_METADATA_BYTES = 1024 * 1024;
|
|
22846
|
+
var NON_WORKSPACE_DIRECTORIES = /* @__PURE__ */ new Set(["cli"]);
|
|
22467
22847
|
function isRecord11(value) {
|
|
22468
22848
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22469
22849
|
}
|
|
22850
|
+
function userText(row) {
|
|
22851
|
+
const { content, text } = row.payload;
|
|
22852
|
+
return kiroVisibleText(typeof content === "string" ? content : text ?? "");
|
|
22853
|
+
}
|
|
22854
|
+
var KiroSessionImport = class {
|
|
22855
|
+
#environment;
|
|
22856
|
+
#scope = new SessionImportScope({
|
|
22857
|
+
closedMessage: "Kiro Session import is closed",
|
|
22858
|
+
unavailableMessage: "Kiro sessions could not be read; close native clients, check storage access and retry",
|
|
22859
|
+
notFoundMessage: "Kiro Session is no longer importable"
|
|
22860
|
+
});
|
|
22861
|
+
constructor(environment) {
|
|
22862
|
+
this.#environment = { ...environment };
|
|
22863
|
+
}
|
|
22864
|
+
listCandidates() {
|
|
22865
|
+
return this.#scope.read(async (signal) => {
|
|
22866
|
+
const candidates = [];
|
|
22867
|
+
for (const [, directories] of await this.#sessionDirectories(signal)) {
|
|
22868
|
+
if (directories.length !== 1 || !directories[0])
|
|
22869
|
+
continue;
|
|
22870
|
+
try {
|
|
22871
|
+
const candidate = await this.#candidate(directories[0], signal);
|
|
22872
|
+
if (candidate)
|
|
22873
|
+
candidates.push(candidate);
|
|
22874
|
+
} catch (error51) {
|
|
22875
|
+
if (!(error51 instanceof SessionImportChangedError))
|
|
22876
|
+
throw error51;
|
|
22877
|
+
}
|
|
22878
|
+
}
|
|
22879
|
+
return candidates;
|
|
22880
|
+
});
|
|
22881
|
+
}
|
|
22882
|
+
resolveCandidate(nativeSessionId) {
|
|
22883
|
+
return this.#scope.resolve(async (signal) => {
|
|
22884
|
+
const directories = (await this.#sessionDirectories(signal)).get(nativeSessionId);
|
|
22885
|
+
if (directories?.length !== 1 || !directories[0])
|
|
22886
|
+
return null;
|
|
22887
|
+
const candidate = await this.#candidate(directories[0], signal);
|
|
22888
|
+
if (!candidate)
|
|
22889
|
+
return null;
|
|
22890
|
+
return {
|
|
22891
|
+
candidate,
|
|
22892
|
+
nativeRef: nativeSessionRefSchema.parse({
|
|
22893
|
+
harnessId: "kiro-cli",
|
|
22894
|
+
nativeSessionId,
|
|
22895
|
+
formatVersion: 1
|
|
22896
|
+
})
|
|
22897
|
+
};
|
|
22898
|
+
});
|
|
22899
|
+
}
|
|
22900
|
+
close() {
|
|
22901
|
+
return this.#scope.close();
|
|
22902
|
+
}
|
|
22903
|
+
/** Session ID to every directory claiming it. Enumerated links are not followed. */
|
|
22904
|
+
async #sessionDirectories(signal) {
|
|
22905
|
+
const root = path7.join(kiroHomeDir(this.#environment), "sessions");
|
|
22906
|
+
const found = /* @__PURE__ */ new Map();
|
|
22907
|
+
const info = await optionalLstat(root);
|
|
22908
|
+
if (!info)
|
|
22909
|
+
return found;
|
|
22910
|
+
if (!info.isDirectory())
|
|
22911
|
+
throw new Error("Kiro Session store is not a directory");
|
|
22912
|
+
for await (const workspace of await opendir(root)) {
|
|
22913
|
+
signal.throwIfAborted();
|
|
22914
|
+
if (!workspace.isDirectory() || NON_WORKSPACE_DIRECTORIES.has(workspace.name))
|
|
22915
|
+
continue;
|
|
22916
|
+
const workspaceDirectory = path7.join(root, workspace.name);
|
|
22917
|
+
const sessions = await opendir(workspaceDirectory).catch((error51) => {
|
|
22918
|
+
if (isMissingFileError(error51))
|
|
22919
|
+
return null;
|
|
22920
|
+
throw error51;
|
|
22921
|
+
});
|
|
22922
|
+
if (!sessions)
|
|
22923
|
+
continue;
|
|
22924
|
+
for await (const session of sessions) {
|
|
22925
|
+
signal.throwIfAborted();
|
|
22926
|
+
if (!session.isDirectory())
|
|
22927
|
+
continue;
|
|
22928
|
+
const directories = found.get(session.name) ?? [];
|
|
22929
|
+
directories.push(path7.join(workspaceDirectory, session.name));
|
|
22930
|
+
found.set(session.name, directories);
|
|
22931
|
+
}
|
|
22932
|
+
}
|
|
22933
|
+
return found;
|
|
22934
|
+
}
|
|
22935
|
+
async #candidate(sessionDirectory, signal) {
|
|
22936
|
+
signal.throwIfAborted();
|
|
22937
|
+
const files = [
|
|
22938
|
+
path7.join(sessionDirectory, "session.json"),
|
|
22939
|
+
path7.join(sessionDirectory, "messages.jsonl")
|
|
22940
|
+
];
|
|
22941
|
+
return readStableFiles(files, async ([metadata, messages]) => {
|
|
22942
|
+
if (!metadata?.isFile() || !messages?.isFile() || metadata.size > MAX_METADATA_BYTES)
|
|
22943
|
+
return null;
|
|
22944
|
+
try {
|
|
22945
|
+
const meta3 = JSON.parse(await readFile2(files[0], { encoding: "utf8", signal }));
|
|
22946
|
+
if (!isRecord11(meta3) || meta3.id !== path7.basename(sessionDirectory))
|
|
22947
|
+
return null;
|
|
22948
|
+
const workspacePath = Array.isArray(meta3.workspacePaths) ? meta3.workspacePaths[0] : void 0;
|
|
22949
|
+
if (typeof workspacePath !== "string" || !path7.isAbsolute(workspacePath) || workspacePath.includes("\0"))
|
|
22950
|
+
return null;
|
|
22951
|
+
const cwd = path7.resolve(workspacePath);
|
|
22952
|
+
if (!(await stat(cwd)).isDirectory())
|
|
22953
|
+
return null;
|
|
22954
|
+
signal.throwIfAborted();
|
|
22955
|
+
const rows = await readKiroSessionMessages({
|
|
22956
|
+
sessionDirectory,
|
|
22957
|
+
sessionMeta: meta3,
|
|
22958
|
+
cwd
|
|
22959
|
+
});
|
|
22960
|
+
const firstUser = rows.find((row) => row.payload.type === "user");
|
|
22961
|
+
if (!firstUser)
|
|
22962
|
+
return null;
|
|
22963
|
+
const modified = typeof meta3.lastModifiedAt === "string" ? Date.parse(meta3.lastModifiedAt) : Number.NaN;
|
|
22964
|
+
return sessionImportCandidate({
|
|
22965
|
+
nativeSessionId: meta3.id,
|
|
22966
|
+
cwd,
|
|
22967
|
+
title: sessionImportTitle(meta3.title) ?? sessionImportTitle(userText(firstUser)),
|
|
22968
|
+
updatedAt: Number.isFinite(modified) && modified >= 0 ? modified : messages.mtimeMs
|
|
22969
|
+
});
|
|
22970
|
+
} catch (error51) {
|
|
22971
|
+
signal.throwIfAborted();
|
|
22972
|
+
if (isStorageAccessError(error51))
|
|
22973
|
+
throw error51;
|
|
22974
|
+
return null;
|
|
22975
|
+
}
|
|
22976
|
+
});
|
|
22977
|
+
}
|
|
22978
|
+
};
|
|
22979
|
+
|
|
22980
|
+
// dist/kiro-adapter.js
|
|
22981
|
+
function isRecord12(value) {
|
|
22982
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22983
|
+
}
|
|
22470
22984
|
var KIRO_SESSION_CAPABILITIES = {
|
|
22471
22985
|
configuration: {
|
|
22472
22986
|
selectModel: true,
|
|
@@ -22491,6 +23005,7 @@ var KiroAdapter = class {
|
|
|
22491
23005
|
harnessId = harnessIdSchema.parse("kiro-cli");
|
|
22492
23006
|
commandCatalog = KIRO_COMMAND_CATALOG;
|
|
22493
23007
|
liveCommandCatalog = true;
|
|
23008
|
+
sessionImport;
|
|
22494
23009
|
#options;
|
|
22495
23010
|
#deps;
|
|
22496
23011
|
#sessions = /* @__PURE__ */ new Set();
|
|
@@ -22499,9 +23014,10 @@ var KiroAdapter = class {
|
|
|
22499
23014
|
constructor(options = {}, deps = {}) {
|
|
22500
23015
|
this.#options = options;
|
|
22501
23016
|
this.#deps = deps;
|
|
23017
|
+
this.sessionImport = new KiroSessionImport({ ...process.env, ...options.environment });
|
|
22502
23018
|
}
|
|
22503
23019
|
async inspect(input = {}) {
|
|
22504
|
-
const cwd =
|
|
23020
|
+
const cwd = path8.resolve(input.cwd ?? process.cwd());
|
|
22505
23021
|
const cached2 = this.#inspectionCache.get(cwd);
|
|
22506
23022
|
if (!input.refresh && cached2) {
|
|
22507
23023
|
if (cached2.refreshAfter <= Date.now()) {
|
|
@@ -22562,7 +23078,7 @@ var KiroAdapter = class {
|
|
|
22562
23078
|
const transport = this.#createTransport(cwd);
|
|
22563
23079
|
try {
|
|
22564
23080
|
const initialize = await transport.inspect();
|
|
22565
|
-
const modelCatalog =
|
|
23081
|
+
const modelCatalog = isRecord12(initialize) && isRecord12(initialize.catalog) ? initialize.catalog : parseKiroModelCatalog(isRecord12(initialize) ? initialize.configOptions : void 0);
|
|
22566
23082
|
if (modelCatalog.models.length === 0)
|
|
22567
23083
|
throw new Error("Kiro returned no native model catalog");
|
|
22568
23084
|
return {
|
|
@@ -22578,7 +23094,7 @@ var KiroAdapter = class {
|
|
|
22578
23094
|
status: "error",
|
|
22579
23095
|
error: {
|
|
22580
23096
|
code: "authenticationRequired",
|
|
22581
|
-
message: "Kiro CLI authentication is required",
|
|
23097
|
+
message: "Kiro CLI authentication is required (run `kiro-cli login`)",
|
|
22582
23098
|
retryable: false
|
|
22583
23099
|
}
|
|
22584
23100
|
};
|
|
@@ -22816,6 +23332,7 @@ var KiroAdapter = class {
|
|
|
22816
23332
|
async close() {
|
|
22817
23333
|
try {
|
|
22818
23334
|
await Promise.all([
|
|
23335
|
+
this.sessionImport.close(),
|
|
22819
23336
|
...this.#inspectionInFlight.values(),
|
|
22820
23337
|
...[...this.#sessions].map((session) => session.close())
|
|
22821
23338
|
]);
|
|
@@ -22983,7 +23500,7 @@ var KiroSession = class {
|
|
|
22983
23500
|
}
|
|
22984
23501
|
};
|
|
22985
23502
|
} catch (error51) {
|
|
22986
|
-
if (this.#newSessionWithoutTurn &&
|
|
23503
|
+
if (this.#newSessionWithoutTurn && isRecord12(error51) && error51.code === "ENOENT") {
|
|
22987
23504
|
return { ok: true, value: { turns: [], state: this.#state() } };
|
|
22988
23505
|
}
|
|
22989
23506
|
return {
|
|
@@ -23044,7 +23561,7 @@ var KiroSession = class {
|
|
|
23044
23561
|
kind: "event",
|
|
23045
23562
|
event: { type: "turn.started", turnId }
|
|
23046
23563
|
});
|
|
23047
|
-
const
|
|
23564
|
+
const userText2 = command.input.map((i) => i.text).join("\n");
|
|
23048
23565
|
const output = new KiroTurnOutput(turnId, this.#cwd, (event) => this.#channel.emit(event));
|
|
23049
23566
|
let assignedUserMessageId;
|
|
23050
23567
|
const stopped = new Promise((_resolve, reject) => {
|
|
@@ -23055,14 +23572,14 @@ var KiroSession = class {
|
|
|
23055
23572
|
try {
|
|
23056
23573
|
const promptResult = await Promise.race([
|
|
23057
23574
|
stopped,
|
|
23058
|
-
this.#transport.runTurn(
|
|
23575
|
+
this.#transport.runTurn(userText2, (event) => {
|
|
23059
23576
|
if (this.#closed || this.#activeTurnId !== turnId)
|
|
23060
23577
|
return;
|
|
23061
23578
|
output.accept(event);
|
|
23062
23579
|
if (event.type === "usage") {
|
|
23063
23580
|
this.observeUsage(event);
|
|
23064
23581
|
const meta3 = event.metadata?.kiro;
|
|
23065
|
-
if (
|
|
23582
|
+
if (isRecord12(meta3) && meta3.kind === "user_message_id_assigned" && typeof meta3.userMessageId === "string") {
|
|
23066
23583
|
assignedUserMessageId = meta3.userMessageId;
|
|
23067
23584
|
}
|
|
23068
23585
|
} else if (event.type === "compaction.completed") {
|
|
@@ -23144,7 +23661,7 @@ var KiroSession = class {
|
|
|
23144
23661
|
});
|
|
23145
23662
|
})
|
|
23146
23663
|
]);
|
|
23147
|
-
if (
|
|
23664
|
+
if (isRecord12(promptResult) && promptResult.stopReason === "cancelled") {
|
|
23148
23665
|
turnOutcome = { status: "cancelled", reason: "User cancelled" };
|
|
23149
23666
|
} else {
|
|
23150
23667
|
turnOutcome = { status: "succeeded" };
|
|
@@ -23473,7 +23990,7 @@ var KiroSession = class {
|
|
|
23473
23990
|
}
|
|
23474
23991
|
});
|
|
23475
23992
|
const result2 = await Promise.race([stopped, this.#transport.compact()]);
|
|
23476
|
-
if (
|
|
23993
|
+
if (isRecord12(result2) && result2.success === false) {
|
|
23477
23994
|
throw new Error("Kiro context compaction did not complete");
|
|
23478
23995
|
}
|
|
23479
23996
|
this.#channel.emit({
|
|
@@ -23613,13 +24130,37 @@ var KiroSession = class {
|
|
|
23613
24130
|
}
|
|
23614
24131
|
};
|
|
23615
24132
|
|
|
24133
|
+
// dist/installation.js
|
|
24134
|
+
function createKiroInstallation(environment, command) {
|
|
24135
|
+
return async (action) => {
|
|
24136
|
+
if (action === "update")
|
|
24137
|
+
throw new Error("Use Kiro CLI's original installer to update");
|
|
24138
|
+
const executable = resolveKiroExecutable({ environment, ...command ? { command } : {} });
|
|
24139
|
+
const currentVersion = versionFromOutput(await runInstallationCommand(executable, ["--version"], environment));
|
|
24140
|
+
return {
|
|
24141
|
+
currentVersion,
|
|
24142
|
+
latestVersion: "Unknown",
|
|
24143
|
+
updateAvailable: false,
|
|
24144
|
+
canUpdate: false,
|
|
24145
|
+
messageCode: "kiro-native-updater",
|
|
24146
|
+
message: "Use Kiro CLI's original installer or native updater to check for and install updates."
|
|
24147
|
+
};
|
|
24148
|
+
};
|
|
24149
|
+
}
|
|
24150
|
+
|
|
23616
24151
|
// dist/plugin.js
|
|
23617
24152
|
var CODEXHOST_KIRO_COMMAND = "CODEXHOST_KIRO_COMMAND";
|
|
23618
24153
|
function createHarnessAdapter(context) {
|
|
23619
24154
|
const environment = { ...context.environment };
|
|
23620
|
-
return new KiroAdapter({
|
|
24155
|
+
return Object.assign(new KiroAdapter({
|
|
23621
24156
|
...environment[CODEXHOST_KIRO_COMMAND] ? { command: environment[CODEXHOST_KIRO_COMMAND] } : {},
|
|
23622
24157
|
environment
|
|
24158
|
+
}), {
|
|
24159
|
+
installation: createKiroInstallation(environment, environment[CODEXHOST_KIRO_COMMAND]),
|
|
24160
|
+
install: createHarnessInstaller(environment, {
|
|
24161
|
+
posix: "https://cli.kiro.dev/install",
|
|
24162
|
+
windows: "https://cli.kiro.dev/install.ps1"
|
|
24163
|
+
})
|
|
23623
24164
|
});
|
|
23624
24165
|
}
|
|
23625
24166
|
export {
|