@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,209 +5,576 @@ var __export = (target, all) => {
|
|
|
5
5
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
// dist/
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
// dist/grok-credential-export.js
|
|
12
|
-
import { createHash } from "node:crypto";
|
|
13
|
-
import { readFile } from "node:fs/promises";
|
|
14
|
-
import os from "node:os";
|
|
8
|
+
// ../../harness-discovery/dist/environment.js
|
|
9
|
+
import fs from "node:fs";
|
|
15
10
|
import path from "node:path";
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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) {
|
|
19
36
|
try {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (!Number.isFinite(expires))
|
|
30
|
-
return [];
|
|
31
|
-
return [
|
|
32
|
-
{
|
|
33
|
-
source: {
|
|
34
|
-
id: `grok:${createHash("sha256").update(entry.user_id).digest("hex")}`,
|
|
35
|
-
harnessId: "grok",
|
|
36
|
-
provider: "xai",
|
|
37
|
-
label: typeof entry.email === "string" && entry.email ? entry.email : "Grok"
|
|
38
|
-
},
|
|
39
|
-
oauth: { access: entry.key, refresh: entry.refresh_token, expires: expires - 3e5 }
|
|
40
|
-
}
|
|
41
|
-
];
|
|
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);
|
|
42
46
|
} catch {
|
|
43
47
|
return [];
|
|
44
48
|
}
|
|
45
49
|
}
|
|
50
|
+
function newestFirst(names) {
|
|
51
|
+
return [...names].sort((left, right) => right.localeCompare(left, void 0, { numeric: true }));
|
|
52
|
+
}
|
|
46
53
|
|
|
47
|
-
// dist/
|
|
48
|
-
import
|
|
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
|
+
}
|
|
49
69
|
|
|
50
|
-
//
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
mcp_message: "mcp/message",
|
|
64
|
-
session_list: "session/list",
|
|
65
|
-
session_delete: "session/delete",
|
|
66
|
-
session_fork: "session/fork",
|
|
67
|
-
session_resume: "session/resume",
|
|
68
|
-
session_close: "session/close",
|
|
69
|
-
logout: "logout",
|
|
70
|
-
nes_start: "nes/start",
|
|
71
|
-
nes_suggest: "nes/suggest",
|
|
72
|
-
nes_accept: "nes/accept",
|
|
73
|
-
nes_reject: "nes/reject",
|
|
74
|
-
nes_close: "nes/close",
|
|
75
|
-
document_did_open: "document/didOpen",
|
|
76
|
-
document_did_change: "document/didChange",
|
|
77
|
-
document_did_close: "document/didClose",
|
|
78
|
-
document_did_save: "document/didSave",
|
|
79
|
-
document_did_focus: "document/didFocus"
|
|
80
|
-
};
|
|
81
|
-
var CLIENT_METHODS = {
|
|
82
|
-
session_request_permission: "session/request_permission",
|
|
83
|
-
session_update: "session/update",
|
|
84
|
-
fs_write_text_file: "fs/write_text_file",
|
|
85
|
-
fs_read_text_file: "fs/read_text_file",
|
|
86
|
-
terminal_create: "terminal/create",
|
|
87
|
-
terminal_output: "terminal/output",
|
|
88
|
-
terminal_release: "terminal/release",
|
|
89
|
-
terminal_wait_for_exit: "terminal/wait_for_exit",
|
|
90
|
-
terminal_kill: "terminal/kill",
|
|
91
|
-
mcp_connect: "mcp/connect",
|
|
92
|
-
mcp_message: "mcp/message",
|
|
93
|
-
mcp_disconnect: "mcp/disconnect",
|
|
94
|
-
elicitation_create: "elicitation/create",
|
|
95
|
-
elicitation_complete: "elicitation/complete"
|
|
96
|
-
};
|
|
97
|
-
var PROTOCOL_METHODS = {
|
|
98
|
-
cancel_request: "$/cancel_request"
|
|
99
|
-
};
|
|
100
|
-
var PROTOCOL_VERSION = 1;
|
|
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
|
+
}
|
|
101
83
|
|
|
102
|
-
//
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
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
|
+
}, (error53, stdout, stderr) => {
|
|
264
|
+
if (error53)
|
|
265
|
+
reject(new Error(error53.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 createInstallationManager(options) {
|
|
278
|
+
let checking;
|
|
279
|
+
let updating;
|
|
280
|
+
const check2 = () => checking ??= options.check().finally(() => {
|
|
281
|
+
checking = void 0;
|
|
282
|
+
});
|
|
283
|
+
return (action) => {
|
|
284
|
+
if (updating)
|
|
285
|
+
return updating;
|
|
286
|
+
if (action === "check")
|
|
287
|
+
return check2();
|
|
288
|
+
updating = (async () => {
|
|
289
|
+
const before = await check2();
|
|
290
|
+
if (!before.updateAvailable)
|
|
291
|
+
return before;
|
|
292
|
+
if (!before.canUpdate)
|
|
293
|
+
throw new Error(before.message ?? "This installation cannot be updated automatically");
|
|
294
|
+
await options.update(before);
|
|
295
|
+
const after = await check2();
|
|
296
|
+
if (after.currentVersion === before.currentVersion)
|
|
297
|
+
throw new Error("The Harness version did not change; check the native updater and retry");
|
|
298
|
+
return after;
|
|
299
|
+
})().finally(() => {
|
|
300
|
+
updating = void 0;
|
|
301
|
+
});
|
|
302
|
+
return updating;
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
async function fetchInstallationText(url2) {
|
|
306
|
+
const request = async () => {
|
|
307
|
+
const response = await fetch(url2, { signal: AbortSignal.timeout(15e3) });
|
|
308
|
+
if (!response.ok)
|
|
309
|
+
throw new Error("Could not check the latest Harness version");
|
|
310
|
+
return response.text();
|
|
311
|
+
};
|
|
312
|
+
try {
|
|
313
|
+
return await request();
|
|
314
|
+
} catch (error53) {
|
|
315
|
+
if (error53 instanceof DOMException && (error53.name === "AbortError" || error53.name === "TimeoutError"))
|
|
316
|
+
throw error53;
|
|
317
|
+
return request();
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
// ../../harness-discovery/dist/installer.js
|
|
322
|
+
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
323
|
+
import { tmpdir } from "node:os";
|
|
324
|
+
import { join } from "node:path";
|
|
325
|
+
function createHarnessInstaller(environment, source) {
|
|
326
|
+
return async () => {
|
|
327
|
+
if (!["darwin", "linux", "win32"].includes(process.platform))
|
|
328
|
+
throw new Error("Unsupported installation platform");
|
|
329
|
+
const env = withNodeRuntimeOnPath(environment);
|
|
330
|
+
if ("npm" in source) {
|
|
331
|
+
const npm = resolveHarnessExecutable({
|
|
332
|
+
id: "npm",
|
|
333
|
+
command: "npm",
|
|
334
|
+
installRoots: {
|
|
335
|
+
posix: [
|
|
336
|
+
"~/.npm-global/bin",
|
|
337
|
+
"~/.local/bin",
|
|
338
|
+
VERSION_MANAGER_ROOTS,
|
|
339
|
+
"/opt/homebrew/bin",
|
|
340
|
+
"/usr/local/bin",
|
|
341
|
+
"/usr/bin"
|
|
342
|
+
],
|
|
343
|
+
windows: [
|
|
344
|
+
"${APPDATA}/npm",
|
|
345
|
+
VERSION_MANAGER_ROOTS,
|
|
346
|
+
"${ProgramFiles}/nodejs",
|
|
347
|
+
"${LOCALAPPDATA}/Programs/nodejs"
|
|
348
|
+
]
|
|
349
|
+
}
|
|
350
|
+
}, { environment: env });
|
|
351
|
+
if (!npm)
|
|
352
|
+
throw new Error("Install Node.js and npm first");
|
|
353
|
+
await runInstallationCommand(npm.executable, ["install", "--global", source.npm], {
|
|
354
|
+
...env,
|
|
355
|
+
...source.allowScripts ? { npm_config_allow_scripts: source.allowScripts } : {}
|
|
356
|
+
}, 6e5);
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
const windows = process.platform === "win32";
|
|
360
|
+
const url2 = windows ? source.windows : source.posix;
|
|
361
|
+
if (new URL(url2).protocol !== "https:")
|
|
362
|
+
throw new Error("Installer requires HTTPS");
|
|
363
|
+
const script = await fetchInstallationText(url2);
|
|
364
|
+
const directory = await mkdtemp(join(tmpdir(), "codexhost-installer-"));
|
|
365
|
+
try {
|
|
366
|
+
const file2 = join(directory, windows ? "install.ps1" : "install.sh");
|
|
367
|
+
await writeFile(file2, script, { mode: 384 });
|
|
368
|
+
await runInstallationCommand(windows ? "powershell.exe" : source.shell ?? "bash", windows ? ["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-File", file2] : [file2], env, 6e5);
|
|
369
|
+
} finally {
|
|
370
|
+
await rm(directory, { recursive: true, force: true });
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
// dist/grok-adapter.js
|
|
376
|
+
import { randomUUID } from "node:crypto";
|
|
377
|
+
|
|
378
|
+
// dist/grok-credential-export.js
|
|
379
|
+
import { createHash } from "node:crypto";
|
|
380
|
+
import { readFile } from "node:fs/promises";
|
|
381
|
+
import os2 from "node:os";
|
|
382
|
+
import path4 from "node:path";
|
|
383
|
+
async function readGrokCredentials(environment) {
|
|
384
|
+
if ([environment.XAI_API_KEY, environment.GROK_API_KEY, environment.GROK_TOKEN].some((v) => v?.trim()))
|
|
385
|
+
return [];
|
|
386
|
+
try {
|
|
387
|
+
const home = environment.GROK_HOME ?? path4.join(environment.HOME ?? os2.homedir(), ".grok");
|
|
388
|
+
const auth = JSON.parse(await readFile(path4.join(home, "auth.json"), "utf8"));
|
|
389
|
+
const client2 = "b1a00492-073a-47ea-816f-4c329264a828";
|
|
390
|
+
const entry = auth[`https://auth.x.ai::${client2}`] ?? auth["https://auth.x.ai"];
|
|
391
|
+
if (!entry || entry.oidc_issuer !== "https://auth.x.ai" || entry.oidc_client_id !== client2)
|
|
392
|
+
return [];
|
|
393
|
+
if (![entry.key, entry.refresh_token, entry.user_id].every((v) => typeof v === "string" && v.length))
|
|
394
|
+
return [];
|
|
395
|
+
const expires = Date.parse(entry.expires_at);
|
|
396
|
+
if (!Number.isFinite(expires))
|
|
397
|
+
return [];
|
|
398
|
+
return [
|
|
399
|
+
{
|
|
400
|
+
source: {
|
|
401
|
+
id: `grok:${createHash("sha256").update(entry.user_id).digest("hex")}`,
|
|
402
|
+
harnessId: "grok",
|
|
403
|
+
provider: "xai",
|
|
404
|
+
label: typeof entry.email === "string" && entry.email ? entry.email : "Grok"
|
|
405
|
+
},
|
|
406
|
+
oauth: { access: entry.key, refresh: entry.refresh_token, expires: expires - 3e5 }
|
|
407
|
+
}
|
|
408
|
+
];
|
|
409
|
+
} catch {
|
|
410
|
+
return [];
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
// dist/grok-adapter.js
|
|
415
|
+
import path12 from "node:path";
|
|
416
|
+
|
|
417
|
+
// ../../../node_modules/@agentclientprotocol/sdk/dist/schema/index.js
|
|
418
|
+
var AGENT_METHODS = {
|
|
419
|
+
initialize: "initialize",
|
|
420
|
+
authenticate: "authenticate",
|
|
421
|
+
providers_list: "providers/list",
|
|
422
|
+
providers_set: "providers/set",
|
|
423
|
+
providers_disable: "providers/disable",
|
|
424
|
+
session_new: "session/new",
|
|
425
|
+
session_load: "session/load",
|
|
426
|
+
session_set_mode: "session/set_mode",
|
|
427
|
+
session_set_config_option: "session/set_config_option",
|
|
428
|
+
session_prompt: "session/prompt",
|
|
429
|
+
session_cancel: "session/cancel",
|
|
430
|
+
mcp_message: "mcp/message",
|
|
431
|
+
session_list: "session/list",
|
|
432
|
+
session_delete: "session/delete",
|
|
433
|
+
session_fork: "session/fork",
|
|
434
|
+
session_resume: "session/resume",
|
|
435
|
+
session_close: "session/close",
|
|
436
|
+
logout: "logout",
|
|
437
|
+
nes_start: "nes/start",
|
|
438
|
+
nes_suggest: "nes/suggest",
|
|
439
|
+
nes_accept: "nes/accept",
|
|
440
|
+
nes_reject: "nes/reject",
|
|
441
|
+
nes_close: "nes/close",
|
|
442
|
+
document_did_open: "document/didOpen",
|
|
443
|
+
document_did_change: "document/didChange",
|
|
444
|
+
document_did_close: "document/didClose",
|
|
445
|
+
document_did_save: "document/didSave",
|
|
446
|
+
document_did_focus: "document/didFocus"
|
|
447
|
+
};
|
|
448
|
+
var CLIENT_METHODS = {
|
|
449
|
+
session_request_permission: "session/request_permission",
|
|
450
|
+
session_update: "session/update",
|
|
451
|
+
fs_write_text_file: "fs/write_text_file",
|
|
452
|
+
fs_read_text_file: "fs/read_text_file",
|
|
453
|
+
terminal_create: "terminal/create",
|
|
454
|
+
terminal_output: "terminal/output",
|
|
455
|
+
terminal_release: "terminal/release",
|
|
456
|
+
terminal_wait_for_exit: "terminal/wait_for_exit",
|
|
457
|
+
terminal_kill: "terminal/kill",
|
|
458
|
+
mcp_connect: "mcp/connect",
|
|
459
|
+
mcp_message: "mcp/message",
|
|
460
|
+
mcp_disconnect: "mcp/disconnect",
|
|
461
|
+
elicitation_create: "elicitation/create",
|
|
462
|
+
elicitation_complete: "elicitation/complete"
|
|
463
|
+
};
|
|
464
|
+
var PROTOCOL_METHODS = {
|
|
465
|
+
cancel_request: "$/cancel_request"
|
|
466
|
+
};
|
|
467
|
+
var PROTOCOL_VERSION = 1;
|
|
468
|
+
|
|
469
|
+
// ../../../node_modules/zod/v4/classic/external.js
|
|
470
|
+
var external_exports = {};
|
|
471
|
+
__export(external_exports, {
|
|
472
|
+
$brand: () => $brand,
|
|
473
|
+
$input: () => $input,
|
|
474
|
+
$output: () => $output,
|
|
475
|
+
NEVER: () => NEVER,
|
|
476
|
+
TimePrecision: () => TimePrecision,
|
|
477
|
+
ZodAny: () => ZodAny,
|
|
478
|
+
ZodArray: () => ZodArray,
|
|
479
|
+
ZodBase64: () => ZodBase64,
|
|
480
|
+
ZodBase64URL: () => ZodBase64URL,
|
|
481
|
+
ZodBigInt: () => ZodBigInt,
|
|
482
|
+
ZodBigIntFormat: () => ZodBigIntFormat,
|
|
483
|
+
ZodBoolean: () => ZodBoolean,
|
|
484
|
+
ZodCIDRv4: () => ZodCIDRv4,
|
|
485
|
+
ZodCIDRv6: () => ZodCIDRv6,
|
|
486
|
+
ZodCUID: () => ZodCUID,
|
|
487
|
+
ZodCUID2: () => ZodCUID2,
|
|
488
|
+
ZodCatch: () => ZodCatch,
|
|
489
|
+
ZodCodec: () => ZodCodec,
|
|
490
|
+
ZodCustom: () => ZodCustom,
|
|
491
|
+
ZodCustomStringFormat: () => ZodCustomStringFormat,
|
|
492
|
+
ZodDate: () => ZodDate,
|
|
493
|
+
ZodDefault: () => ZodDefault,
|
|
494
|
+
ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
|
|
495
|
+
ZodE164: () => ZodE164,
|
|
496
|
+
ZodEmail: () => ZodEmail,
|
|
497
|
+
ZodEmoji: () => ZodEmoji,
|
|
498
|
+
ZodEnum: () => ZodEnum,
|
|
499
|
+
ZodError: () => ZodError,
|
|
500
|
+
ZodExactOptional: () => ZodExactOptional,
|
|
501
|
+
ZodFile: () => ZodFile,
|
|
502
|
+
ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
|
|
503
|
+
ZodFunction: () => ZodFunction,
|
|
504
|
+
ZodGUID: () => ZodGUID,
|
|
505
|
+
ZodIPv4: () => ZodIPv4,
|
|
506
|
+
ZodIPv6: () => ZodIPv6,
|
|
507
|
+
ZodISODate: () => ZodISODate,
|
|
508
|
+
ZodISODateTime: () => ZodISODateTime,
|
|
509
|
+
ZodISODuration: () => ZodISODuration,
|
|
510
|
+
ZodISOTime: () => ZodISOTime,
|
|
511
|
+
ZodIntersection: () => ZodIntersection,
|
|
512
|
+
ZodIssueCode: () => ZodIssueCode,
|
|
513
|
+
ZodJWT: () => ZodJWT,
|
|
514
|
+
ZodKSUID: () => ZodKSUID,
|
|
515
|
+
ZodLazy: () => ZodLazy,
|
|
516
|
+
ZodLiteral: () => ZodLiteral,
|
|
517
|
+
ZodMAC: () => ZodMAC,
|
|
518
|
+
ZodMap: () => ZodMap,
|
|
519
|
+
ZodNaN: () => ZodNaN,
|
|
520
|
+
ZodNanoID: () => ZodNanoID,
|
|
521
|
+
ZodNever: () => ZodNever,
|
|
522
|
+
ZodNonOptional: () => ZodNonOptional,
|
|
523
|
+
ZodNull: () => ZodNull,
|
|
524
|
+
ZodNullable: () => ZodNullable,
|
|
525
|
+
ZodNumber: () => ZodNumber,
|
|
526
|
+
ZodNumberFormat: () => ZodNumberFormat,
|
|
527
|
+
ZodObject: () => ZodObject,
|
|
528
|
+
ZodOptional: () => ZodOptional,
|
|
529
|
+
ZodPipe: () => ZodPipe,
|
|
530
|
+
ZodPrefault: () => ZodPrefault,
|
|
531
|
+
ZodPreprocess: () => ZodPreprocess,
|
|
532
|
+
ZodPromise: () => ZodPromise,
|
|
533
|
+
ZodReadonly: () => ZodReadonly,
|
|
534
|
+
ZodRealError: () => ZodRealError,
|
|
535
|
+
ZodRecord: () => ZodRecord,
|
|
536
|
+
ZodSet: () => ZodSet,
|
|
537
|
+
ZodString: () => ZodString,
|
|
538
|
+
ZodStringFormat: () => ZodStringFormat,
|
|
539
|
+
ZodSuccess: () => ZodSuccess,
|
|
540
|
+
ZodSymbol: () => ZodSymbol,
|
|
541
|
+
ZodTemplateLiteral: () => ZodTemplateLiteral,
|
|
542
|
+
ZodTransform: () => ZodTransform,
|
|
543
|
+
ZodTuple: () => ZodTuple,
|
|
544
|
+
ZodType: () => ZodType,
|
|
545
|
+
ZodULID: () => ZodULID,
|
|
546
|
+
ZodURL: () => ZodURL,
|
|
547
|
+
ZodUUID: () => ZodUUID,
|
|
548
|
+
ZodUndefined: () => ZodUndefined,
|
|
549
|
+
ZodUnion: () => ZodUnion,
|
|
550
|
+
ZodUnknown: () => ZodUnknown,
|
|
551
|
+
ZodVoid: () => ZodVoid,
|
|
552
|
+
ZodXID: () => ZodXID,
|
|
553
|
+
ZodXor: () => ZodXor,
|
|
554
|
+
_ZodString: () => _ZodString,
|
|
555
|
+
_default: () => _default2,
|
|
556
|
+
_function: () => _function,
|
|
557
|
+
any: () => any,
|
|
558
|
+
array: () => array,
|
|
559
|
+
base64: () => base642,
|
|
560
|
+
base64url: () => base64url2,
|
|
561
|
+
bigint: () => bigint2,
|
|
562
|
+
boolean: () => boolean2,
|
|
563
|
+
catch: () => _catch2,
|
|
564
|
+
check: () => check,
|
|
565
|
+
cidrv4: () => cidrv42,
|
|
566
|
+
cidrv6: () => cidrv62,
|
|
567
|
+
clone: () => clone,
|
|
568
|
+
codec: () => codec,
|
|
569
|
+
coerce: () => coerce_exports,
|
|
570
|
+
config: () => config,
|
|
571
|
+
core: () => core_exports2,
|
|
572
|
+
cuid: () => cuid3,
|
|
573
|
+
cuid2: () => cuid22,
|
|
574
|
+
custom: () => custom,
|
|
575
|
+
date: () => date3,
|
|
576
|
+
decode: () => decode2,
|
|
577
|
+
decodeAsync: () => decodeAsync2,
|
|
211
578
|
describe: () => describe2,
|
|
212
579
|
discriminatedUnion: () => discriminatedUnion,
|
|
213
580
|
e164: () => e1642,
|
|
@@ -18792,6 +19159,71 @@ var harnessDisplaySetSchema = external_exports.strictObject({
|
|
|
18792
19159
|
initializeOnly: external_exports.boolean().optional()
|
|
18793
19160
|
});
|
|
18794
19161
|
|
|
19162
|
+
// ../../shared-contracts/dist/ids.js
|
|
19163
|
+
var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
19164
|
+
message: "Identifier must not be empty or whitespace"
|
|
19165
|
+
});
|
|
19166
|
+
var harnessIdSchema = opaqueIdSchema.brand();
|
|
19167
|
+
var hostThreadIdSchema = opaqueIdSchema.brand();
|
|
19168
|
+
var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
19169
|
+
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
19170
|
+
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
19171
|
+
|
|
19172
|
+
// ../../shared-contracts/dist/harness-plugins.js
|
|
19173
|
+
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
19174
|
+
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
19175
|
+
var HARNESS_PLUGIN_LIMIT = 128;
|
|
19176
|
+
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);
|
|
19177
|
+
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");
|
|
19178
|
+
var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
|
|
19179
|
+
var pluginPresentationShape = {
|
|
19180
|
+
id: harnessPluginIdSchema,
|
|
19181
|
+
name: external_exports.string().trim().min(1).max(128),
|
|
19182
|
+
version: external_exports.string().min(1).max(128),
|
|
19183
|
+
/** The factory accepts a persisted local entrypoint through its construction context. */
|
|
19184
|
+
launchCommand: external_exports.literal(true).optional(),
|
|
19185
|
+
links: external_exports.object({
|
|
19186
|
+
documentation: documentationUrlSchema.optional(),
|
|
19187
|
+
installation: documentationUrlSchema.optional()
|
|
19188
|
+
}).strict().optional()
|
|
19189
|
+
};
|
|
19190
|
+
var harnessPluginManifestSchema = external_exports.object({
|
|
19191
|
+
manifestVersion: external_exports.literal(1),
|
|
19192
|
+
...pluginPresentationShape,
|
|
19193
|
+
adapterApiVersion: external_exports.number().int().positive(),
|
|
19194
|
+
entry: relativeResourceSchema,
|
|
19195
|
+
icon: relativeResourceSchema.optional()
|
|
19196
|
+
}).strict();
|
|
19197
|
+
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);
|
|
19198
|
+
var harnessPluginDescriptorSchema = external_exports.object({
|
|
19199
|
+
...pluginPresentationShape,
|
|
19200
|
+
icon: harnessPluginIconSchema.optional()
|
|
19201
|
+
}).strict();
|
|
19202
|
+
var harnessPluginListParamsSchema = external_exports.object({}).strict();
|
|
19203
|
+
var harnessPluginListResultSchema = external_exports.object({
|
|
19204
|
+
plugins: external_exports.array(harnessPluginDescriptorSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
19205
|
+
}).strict();
|
|
19206
|
+
var harnessPluginConfigurationSchema = external_exports.object({
|
|
19207
|
+
version: external_exports.literal(1),
|
|
19208
|
+
enabled: external_exports.array(harnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
19209
|
+
}).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
|
|
19210
|
+
message: "Enabled plugin IDs must be unique",
|
|
19211
|
+
path: ["enabled"]
|
|
19212
|
+
});
|
|
19213
|
+
|
|
19214
|
+
// ../../shared-contracts/dist/harness-long-context.js
|
|
19215
|
+
var HARNESS_LONG_CONTEXT_GET_METHOD = "codexhost/harness/long-context/get";
|
|
19216
|
+
var HARNESS_LONG_CONTEXT_SET_METHOD = "codexhost/harness/long-context/set";
|
|
19217
|
+
var harnessLongContextGetSchema = external_exports.object({
|
|
19218
|
+
harnessId: harnessPluginIdSchema
|
|
19219
|
+
}).strict();
|
|
19220
|
+
var harnessLongContextSetSchema = harnessLongContextGetSchema.extend({
|
|
19221
|
+
enabled: external_exports.boolean()
|
|
19222
|
+
});
|
|
19223
|
+
var harnessLongContextSchema = external_exports.object({
|
|
19224
|
+
enabled: external_exports.boolean()
|
|
19225
|
+
}).strict();
|
|
19226
|
+
|
|
18795
19227
|
// ../../shared-contracts/dist/console.js
|
|
18796
19228
|
var consoleAnnouncementSchema = external_exports.strictObject({
|
|
18797
19229
|
title: external_exports.string().trim().min(1).max(200),
|
|
@@ -18808,8 +19240,11 @@ var CONSOLE_HOST_METHODS = Object.freeze([
|
|
|
18808
19240
|
"codexhost/harness/display-settings/get",
|
|
18809
19241
|
"codexhost/harness/display-settings/set",
|
|
18810
19242
|
"codexhost/harness/inspect",
|
|
19243
|
+
"codexhost/harness/installation",
|
|
18811
19244
|
"codexhost/harness/launch-settings/get",
|
|
18812
19245
|
"codexhost/harness/launch-settings/set",
|
|
19246
|
+
HARNESS_LONG_CONTEXT_GET_METHOD,
|
|
19247
|
+
HARNESS_LONG_CONTEXT_SET_METHOD,
|
|
18813
19248
|
"codexhost/harness/web-ui/open",
|
|
18814
19249
|
"codexhost/harness/accounts/sources",
|
|
18815
19250
|
"codexhost/harness/accounts/list",
|
|
@@ -18869,16 +19304,6 @@ var loadedSessionsSchema = external_exports.array(external_exports.strictObject(
|
|
|
18869
19304
|
inactiveMs: external_exports.number().nonnegative()
|
|
18870
19305
|
}));
|
|
18871
19306
|
|
|
18872
|
-
// ../../shared-contracts/dist/ids.js
|
|
18873
|
-
var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
18874
|
-
message: "Identifier must not be empty or whitespace"
|
|
18875
|
-
});
|
|
18876
|
-
var harnessIdSchema = opaqueIdSchema.brand();
|
|
18877
|
-
var hostThreadIdSchema = opaqueIdSchema.brand();
|
|
18878
|
-
var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
18879
|
-
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
18880
|
-
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
18881
|
-
|
|
18882
19307
|
// ../../shared-contracts/dist/manual-compaction.js
|
|
18883
19308
|
var threadManualCompactionStartedSchema = external_exports.strictObject({
|
|
18884
19309
|
threadId: hostThreadIdSchema,
|
|
@@ -19270,1194 +19695,855 @@ var harnessSessionCapabilitiesSchema = external_exports.object({
|
|
|
19270
19695
|
observe: external_exports.boolean(),
|
|
19271
19696
|
readTranscript: external_exports.boolean()
|
|
19272
19697
|
}).strict().optional(),
|
|
19273
|
-
autonomousTurns: external_exports.object({
|
|
19274
|
-
observe: external_exports.boolean()
|
|
19275
|
-
}).strict().optional(),
|
|
19276
|
-
input: external_exports.object({
|
|
19277
|
-
image: external_exports.boolean()
|
|
19278
|
-
}).strict().optional()
|
|
19279
|
-
}).strict();
|
|
19280
|
-
var harnessConfigurationStateSchema = external_exports.object({
|
|
19281
|
-
effectiveModel: harnessModelRefSchema.optional(),
|
|
19282
|
-
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
19283
|
-
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
19284
|
-
availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
|
|
19285
|
-
effectivePermissionModeId: harnessPermissionModeIdSchema.optional()
|
|
19286
|
-
}).strict().superRefine((state, context) => {
|
|
19287
|
-
if (state.effectiveThinkingOptionId && state.availableThinkingOptions && !state.availableThinkingOptions.some(({ id }) => id === state.effectiveThinkingOptionId)) {
|
|
19288
|
-
context.addIssue({
|
|
19289
|
-
code: "custom",
|
|
19290
|
-
message: "Effective Thinking option must be currently available",
|
|
19291
|
-
path: ["effectiveThinkingOptionId"]
|
|
19292
|
-
});
|
|
19293
|
-
}
|
|
19294
|
-
});
|
|
19295
|
-
var harnessWebUiCapabilitySchema = external_exports.object({
|
|
19296
|
-
open: external_exports.literal(true)
|
|
19297
|
-
}).strict();
|
|
19298
|
-
var readyHarnessInspectionSchema = external_exports.object({
|
|
19299
|
-
status: external_exports.literal("ready"),
|
|
19300
|
-
catalog: harnessModelCatalogSchema,
|
|
19301
|
-
permissionModes: harnessPermissionModeCatalogSchema.optional(),
|
|
19302
|
-
capabilities: harnessSessionCapabilitiesSchema,
|
|
19303
|
-
webUi: harnessWebUiCapabilitySchema.optional()
|
|
19304
|
-
}).strict().superRefine((inspection, context) => {
|
|
19305
|
-
const selectable = inspection.capabilities.configuration.selectPermissionMode;
|
|
19306
|
-
if (selectable !== Boolean(inspection.permissionModes)) {
|
|
19307
|
-
context.addIssue({
|
|
19308
|
-
code: "custom",
|
|
19309
|
-
message: "Permission Mode catalog and capability must agree",
|
|
19310
|
-
path: selectable ? ["permissionModes"] : ["capabilities", "configuration", "selectPermissionMode"]
|
|
19311
|
-
});
|
|
19312
|
-
}
|
|
19313
|
-
});
|
|
19314
|
-
var failedHarnessInspectionSchema = external_exports.object({
|
|
19315
|
-
status: external_exports.enum(["notInstalled", "unavailable", "error"]),
|
|
19316
|
-
error: codexhostErrorSchema
|
|
19317
|
-
}).strict();
|
|
19318
|
-
var harnessInspectionSchema = external_exports.union([
|
|
19319
|
-
readyHarnessInspectionSchema,
|
|
19320
|
-
failedHarnessInspectionSchema
|
|
19321
|
-
]);
|
|
19322
|
-
var harnessInspectParamsSchema = external_exports.object({
|
|
19323
|
-
harnessId: harnessIdSchema,
|
|
19324
|
-
cwd: nonBlankTextSchema2.max(16384).optional(),
|
|
19325
|
-
refresh: external_exports.boolean().optional()
|
|
19326
|
-
}).strict();
|
|
19327
|
-
var harnessWebUiOpenParamsSchema = external_exports.object({
|
|
19328
|
-
harnessId: harnessIdSchema
|
|
19329
|
-
}).strict();
|
|
19330
|
-
var harnessWebUiOpenResultSchema = external_exports.object({}).strict();
|
|
19331
|
-
var threadModelSelectParamsSchema = external_exports.object({
|
|
19332
|
-
threadId: hostThreadIdSchema,
|
|
19333
|
-
model: harnessModelRefSchema
|
|
19334
|
-
}).strict();
|
|
19335
|
-
var threadThinkingSelectParamsSchema = external_exports.object({
|
|
19336
|
-
threadId: hostThreadIdSchema,
|
|
19337
|
-
thinkingOptionId: harnessThinkingOptionIdSchema
|
|
19338
|
-
}).strict();
|
|
19339
|
-
var threadInspectionParamsSchema = external_exports.object({
|
|
19340
|
-
threadId: hostThreadIdSchema,
|
|
19341
|
-
includeReferenceCapability: external_exports.boolean().optional()
|
|
19342
|
-
}).strict();
|
|
19343
|
-
var codexThreadInspectionSchema = external_exports.object({
|
|
19344
|
-
owner: external_exports.literal("codex"),
|
|
19345
|
-
locked: external_exports.literal(true),
|
|
19346
|
-
supportsThreadReferences: external_exports.literal(true).optional()
|
|
19698
|
+
autonomousTurns: external_exports.object({
|
|
19699
|
+
observe: external_exports.boolean()
|
|
19700
|
+
}).strict().optional(),
|
|
19701
|
+
input: external_exports.object({
|
|
19702
|
+
image: external_exports.boolean()
|
|
19703
|
+
}).strict().optional()
|
|
19347
19704
|
}).strict();
|
|
19348
|
-
var
|
|
19349
|
-
owner: external_exports.literal("external"),
|
|
19350
|
-
harnessId: nonBlankTextSchema2.max(256),
|
|
19351
|
-
transportModelId: nonBlankTextSchema2.max(1024),
|
|
19705
|
+
var harnessConfigurationStateSchema = external_exports.object({
|
|
19352
19706
|
effectiveModel: harnessModelRefSchema.optional(),
|
|
19353
19707
|
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
19354
19708
|
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
19355
19709
|
availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
|
|
19356
|
-
effectivePermissionModeId: harnessPermissionModeIdSchema.optional()
|
|
19357
|
-
|
|
19358
|
-
|
|
19359
|
-
|
|
19360
|
-
|
|
19361
|
-
|
|
19362
|
-
|
|
19363
|
-
|
|
19364
|
-
codexThreadInspectionSchema,
|
|
19365
|
-
externalThreadInspectionSchema
|
|
19366
|
-
]);
|
|
19367
|
-
var threadOwnershipListParamsSchema = external_exports.object({
|
|
19368
|
-
threadIds: external_exports.array(hostThreadIdSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
|
|
19369
|
-
}).strict().superRefine(({ threadIds }, context) => {
|
|
19370
|
-
const seen = /* @__PURE__ */ new Set();
|
|
19371
|
-
for (const [index, threadId] of threadIds.entries()) {
|
|
19372
|
-
if (seen.has(threadId)) {
|
|
19373
|
-
context.addIssue({
|
|
19374
|
-
code: "custom",
|
|
19375
|
-
message: "Thread ownership-list IDs must be unique",
|
|
19376
|
-
path: ["threadIds", index]
|
|
19377
|
-
});
|
|
19378
|
-
}
|
|
19379
|
-
seen.add(threadId);
|
|
19710
|
+
effectivePermissionModeId: harnessPermissionModeIdSchema.optional()
|
|
19711
|
+
}).strict().superRefine((state, context) => {
|
|
19712
|
+
if (state.effectiveThinkingOptionId && state.availableThinkingOptions && !state.availableThinkingOptions.some(({ id }) => id === state.effectiveThinkingOptionId)) {
|
|
19713
|
+
context.addIssue({
|
|
19714
|
+
code: "custom",
|
|
19715
|
+
message: "Effective Thinking option must be currently available",
|
|
19716
|
+
path: ["effectiveThinkingOptionId"]
|
|
19717
|
+
});
|
|
19380
19718
|
}
|
|
19381
19719
|
});
|
|
19382
|
-
var
|
|
19383
|
-
|
|
19384
|
-
owner: external_exports.literal("codex")
|
|
19385
|
-
}).strict();
|
|
19386
|
-
var externalThreadOwnershipSchema = external_exports.object({
|
|
19387
|
-
threadId: hostThreadIdSchema,
|
|
19388
|
-
owner: external_exports.literal("external"),
|
|
19389
|
-
harnessId: external_exports.string().max(256).pipe(harnessIdSchema)
|
|
19720
|
+
var harnessWebUiCapabilitySchema = external_exports.object({
|
|
19721
|
+
open: external_exports.literal(true)
|
|
19390
19722
|
}).strict();
|
|
19391
|
-
var
|
|
19392
|
-
|
|
19393
|
-
|
|
19394
|
-
|
|
19395
|
-
|
|
19396
|
-
|
|
19397
|
-
}).strict().superRefine((
|
|
19398
|
-
const
|
|
19399
|
-
|
|
19400
|
-
|
|
19401
|
-
|
|
19402
|
-
|
|
19403
|
-
|
|
19404
|
-
|
|
19405
|
-
});
|
|
19406
|
-
}
|
|
19407
|
-
seen.add(thread.threadId);
|
|
19723
|
+
var readyHarnessInspectionSchema = external_exports.object({
|
|
19724
|
+
status: external_exports.literal("ready"),
|
|
19725
|
+
catalog: harnessModelCatalogSchema,
|
|
19726
|
+
permissionModes: harnessPermissionModeCatalogSchema.optional(),
|
|
19727
|
+
capabilities: harnessSessionCapabilitiesSchema,
|
|
19728
|
+
webUi: harnessWebUiCapabilitySchema.optional()
|
|
19729
|
+
}).strict().superRefine((inspection, context) => {
|
|
19730
|
+
const selectable = inspection.capabilities.configuration.selectPermissionMode;
|
|
19731
|
+
if (selectable !== Boolean(inspection.permissionModes)) {
|
|
19732
|
+
context.addIssue({
|
|
19733
|
+
code: "custom",
|
|
19734
|
+
message: "Permission Mode catalog and capability must agree",
|
|
19735
|
+
path: selectable ? ["permissionModes"] : ["capabilities", "configuration", "selectPermissionMode"]
|
|
19736
|
+
});
|
|
19408
19737
|
}
|
|
19409
19738
|
});
|
|
19410
|
-
|
|
19411
|
-
|
|
19412
|
-
|
|
19413
|
-
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
19414
|
-
var HARNESS_PLUGIN_LIMIT = 128;
|
|
19415
|
-
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);
|
|
19416
|
-
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");
|
|
19417
|
-
var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
|
|
19418
|
-
var pluginPresentationShape = {
|
|
19419
|
-
id: harnessPluginIdSchema,
|
|
19420
|
-
name: external_exports.string().trim().min(1).max(128),
|
|
19421
|
-
version: external_exports.string().min(1).max(128),
|
|
19422
|
-
/** The factory accepts a persisted local entrypoint through its construction context. */
|
|
19423
|
-
launchCommand: external_exports.literal(true).optional(),
|
|
19424
|
-
links: external_exports.object({
|
|
19425
|
-
documentation: documentationUrlSchema.optional(),
|
|
19426
|
-
installation: documentationUrlSchema.optional()
|
|
19427
|
-
}).strict().optional()
|
|
19428
|
-
};
|
|
19429
|
-
var harnessPluginManifestSchema = external_exports.object({
|
|
19430
|
-
manifestVersion: external_exports.literal(1),
|
|
19431
|
-
...pluginPresentationShape,
|
|
19432
|
-
adapterApiVersion: external_exports.number().int().positive(),
|
|
19433
|
-
entry: relativeResourceSchema,
|
|
19434
|
-
icon: relativeResourceSchema.optional()
|
|
19435
|
-
}).strict();
|
|
19436
|
-
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);
|
|
19437
|
-
var harnessPluginDescriptorSchema = external_exports.object({
|
|
19438
|
-
...pluginPresentationShape,
|
|
19439
|
-
icon: harnessPluginIconSchema.optional()
|
|
19440
|
-
}).strict();
|
|
19441
|
-
var harnessPluginListParamsSchema = external_exports.object({}).strict();
|
|
19442
|
-
var harnessPluginListResultSchema = external_exports.object({
|
|
19443
|
-
plugins: external_exports.array(harnessPluginDescriptorSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
19444
|
-
}).strict();
|
|
19445
|
-
var harnessPluginConfigurationSchema = external_exports.object({
|
|
19446
|
-
version: external_exports.literal(1),
|
|
19447
|
-
enabled: external_exports.array(harnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
19448
|
-
}).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
|
|
19449
|
-
message: "Enabled plugin IDs must be unique",
|
|
19450
|
-
path: ["enabled"]
|
|
19451
|
-
});
|
|
19452
|
-
|
|
19453
|
-
// ../../shared-contracts/dist/harness-route.js
|
|
19454
|
-
var harnessPluginRouteSchema = external_exports.object({
|
|
19455
|
-
harnessId: harnessPluginIdSchema,
|
|
19456
|
-
model: harnessModelRefSchema.optional(),
|
|
19457
|
-
thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
19458
|
-
permissionModeId: harnessPermissionModeIdSchema.optional()
|
|
19459
|
-
}).strict();
|
|
19460
|
-
|
|
19461
|
-
// ../../shared-contracts/dist/harness-launch-settings.js
|
|
19462
|
-
var harnessLaunchPathSchema = external_exports.string().trim().min(1).max(4096).refine((value) => !/[\u0000\r\n]/u.test(value), "Invalid entrypoint path");
|
|
19463
|
-
var harnessLaunchSettingsGetSchema = external_exports.object({
|
|
19464
|
-
harnessId: harnessPluginIdSchema
|
|
19465
|
-
}).strict();
|
|
19466
|
-
var harnessLaunchSettingsSetSchema = harnessLaunchSettingsGetSchema.extend({
|
|
19467
|
-
path: harnessLaunchPathSchema.nullable()
|
|
19468
|
-
});
|
|
19469
|
-
var harnessLaunchSettingsSchema = external_exports.object({
|
|
19470
|
-
path: harnessLaunchPathSchema.nullable(),
|
|
19471
|
-
restartRequired: external_exports.boolean()
|
|
19472
|
-
}).strict();
|
|
19473
|
-
|
|
19474
|
-
// ../../shared-contracts/dist/harness-installation.js
|
|
19475
|
-
var harnessInstallationParamsSchema = external_exports.object({
|
|
19476
|
-
harnessId: harnessIdSchema,
|
|
19477
|
-
action: external_exports.enum(["check", "update"])
|
|
19478
|
-
}).strict();
|
|
19479
|
-
var harnessInstallationStateSchema = external_exports.object({
|
|
19480
|
-
currentVersion: external_exports.string().min(1).max(128),
|
|
19481
|
-
latestVersion: external_exports.string().min(1).max(128),
|
|
19482
|
-
updateAvailable: external_exports.boolean(),
|
|
19483
|
-
canUpdate: external_exports.boolean(),
|
|
19484
|
-
message: external_exports.string().max(2048).optional()
|
|
19485
|
-
}).strict();
|
|
19486
|
-
|
|
19487
|
-
// ../../shared-contracts/dist/codex-accounts.js
|
|
19488
|
-
var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
|
|
19489
|
-
var nonBlankTextSchema3 = external_exports.string().trim().min(1);
|
|
19490
|
-
var codexAccountAuthKindSchema = external_exports.enum(["api", "chatgpt"]);
|
|
19491
|
-
var codexAccountSiteUrlPattern = /^https?:\/\/(?:\[[0-9a-fA-F:]+\]|[^/\s:@?#]+)(?::\d{1,5})?(?:[/?#][^\s]*)?$/u;
|
|
19492
|
-
function isCodexAccountSiteUrl(value) {
|
|
19493
|
-
return value.length > 0 && value.length <= 2048 && codexAccountSiteUrlPattern.test(value);
|
|
19494
|
-
}
|
|
19495
|
-
var externalUrlOpenParamsSchema = external_exports.object({
|
|
19496
|
-
url: external_exports.string().max(2048).refine(isCodexAccountSiteUrl, "External URL must be http(s)")
|
|
19497
|
-
}).strict();
|
|
19498
|
-
var externalUrlOpenResultSchema = external_exports.object({}).strict();
|
|
19499
|
-
var codexAccountPlanTypeSchema = external_exports.enum([
|
|
19500
|
-
"free",
|
|
19501
|
-
"go",
|
|
19502
|
-
"plus",
|
|
19503
|
-
"pro",
|
|
19504
|
-
"prolite",
|
|
19505
|
-
"team",
|
|
19506
|
-
"self_serve_business_prolite",
|
|
19507
|
-
"self_serve_business_usage_based",
|
|
19508
|
-
"business",
|
|
19509
|
-
"ent26",
|
|
19510
|
-
"enterprise_cbp_automation",
|
|
19511
|
-
"enterprise_cbp_usage_based",
|
|
19512
|
-
"enterprise",
|
|
19513
|
-
"edu",
|
|
19514
|
-
"edu_plus",
|
|
19515
|
-
"edu_pro",
|
|
19516
|
-
"unknown"
|
|
19517
|
-
]);
|
|
19518
|
-
var codexAccountSchema = external_exports.object({
|
|
19519
|
-
accountId: accountIdSchema,
|
|
19520
|
-
label: nonBlankTextSchema3.max(256),
|
|
19521
|
-
email: external_exports.string().email().max(320).optional(),
|
|
19522
|
-
planType: codexAccountPlanTypeSchema.optional(),
|
|
19523
|
-
authKind: codexAccountAuthKindSchema.optional(),
|
|
19524
|
-
authIdentity: nonBlankTextSchema3.max(256).optional(),
|
|
19525
|
-
siteUrl: external_exports.string().refine(isCodexAccountSiteUrl, "Account site URL must be http(s)").optional()
|
|
19526
|
-
}).strict();
|
|
19527
|
-
var codexAccountPhaseSchema = external_exports.enum(["ready", "unavailable"]);
|
|
19528
|
-
var codexAccountListResultSchema = external_exports.object({
|
|
19529
|
-
version: external_exports.literal(2),
|
|
19530
|
-
currentAccountId: accountIdSchema.nullable(),
|
|
19531
|
-
phase: codexAccountPhaseSchema,
|
|
19532
|
-
revision: external_exports.number().int().nonnegative(),
|
|
19533
|
-
instanceId: nonBlankTextSchema3.max(1024).optional(),
|
|
19534
|
-
accounts: external_exports.array(codexAccountSchema).max(1)
|
|
19535
|
-
}).strict();
|
|
19536
|
-
var codexAccountUsageParamsSchema = external_exports.object({ accountId: accountIdSchema, refresh: external_exports.boolean().optional() }).strict();
|
|
19537
|
-
var codexAccountUsageResultSchema = external_exports.object({
|
|
19538
|
-
accountId: accountIdSchema,
|
|
19539
|
-
usage: threadUsageSnapshotSchema.nullable(),
|
|
19540
|
-
accountCredits: accountCreditsSnapshotSchema.optional(),
|
|
19541
|
-
freshness: external_exports.enum(["live", "cached"]),
|
|
19542
|
-
observedAt: external_exports.string().datetime().nullable()
|
|
19543
|
-
}).strict();
|
|
19544
|
-
|
|
19545
|
-
// ../../shared-contracts/dist/harness-session-import.js
|
|
19546
|
-
var HARNESS_SESSION_IMPORT_ID_MAX_LENGTH = 1024;
|
|
19547
|
-
var HARNESS_SESSION_IMPORT_CWD_MAX_LENGTH = 16384;
|
|
19548
|
-
var HARNESS_SESSION_IMPORT_TITLE_MAX_LENGTH = 4096;
|
|
19549
|
-
var HARNESS_SESSION_IMPORT_LIST_MAX_LENGTH = 1e3;
|
|
19550
|
-
var HARNESS_SESSION_IMPORT_UPDATED_AT_MAX = 864e13;
|
|
19551
|
-
var nonBlankTextSchema4 = external_exports.string().refine((value) => value.trim().length > 0, "Value must not be empty or whitespace").refine((value) => !value.includes("\0"), "Value must not contain NUL");
|
|
19552
|
-
var harnessSessionImportIdSchema = nonBlankTextSchema4.max(HARNESS_SESSION_IMPORT_ID_MAX_LENGTH);
|
|
19553
|
-
var harnessSessionImportCandidateSchema = external_exports.object({
|
|
19554
|
-
nativeSessionId: harnessSessionImportIdSchema,
|
|
19555
|
-
title: nonBlankTextSchema4.max(HARNESS_SESSION_IMPORT_TITLE_MAX_LENGTH).nullable(),
|
|
19556
|
-
updatedAt: external_exports.number().int().nonnegative().max(HARNESS_SESSION_IMPORT_UPDATED_AT_MAX),
|
|
19557
|
-
cwd: nonBlankTextSchema4.max(HARNESS_SESSION_IMPORT_CWD_MAX_LENGTH),
|
|
19558
|
-
// Native file discovery cannot reliably observe another process's activity.
|
|
19559
|
-
running: external_exports.boolean().nullable()
|
|
19560
|
-
}).strict();
|
|
19561
|
-
var harnessSessionImportSourcesParamsSchema = external_exports.object({}).strict();
|
|
19562
|
-
var harnessSessionImportSourcesResultSchema = external_exports.object({
|
|
19563
|
-
harnesses: external_exports.array(external_exports.object({
|
|
19564
|
-
harnessId: harnessPluginIdSchema,
|
|
19565
|
-
name: nonBlankTextSchema4.max(128)
|
|
19566
|
-
}).strict()).max(128)
|
|
19567
|
-
}).strict();
|
|
19568
|
-
var harnessSessionListParamsSchema = external_exports.object({
|
|
19569
|
-
harnessId: harnessPluginIdSchema,
|
|
19570
|
-
query: external_exports.string().trim().max(4096).refine((value) => !value.includes("\0")).optional(),
|
|
19571
|
-
offset: external_exports.number().int().nonnegative().safe().optional(),
|
|
19572
|
-
limit: external_exports.number().int().min(1).max(HARNESS_SESSION_IMPORT_LIST_MAX_LENGTH).optional()
|
|
19573
|
-
}).strict();
|
|
19574
|
-
var harnessSessionListResultSchema = external_exports.object({
|
|
19575
|
-
candidates: external_exports.array(harnessSessionImportCandidateSchema).max(HARNESS_SESSION_IMPORT_LIST_MAX_LENGTH),
|
|
19576
|
-
total: external_exports.number().int().nonnegative().safe()
|
|
19577
|
-
}).strict();
|
|
19578
|
-
var harnessSessionImportParamsSchema = external_exports.object({
|
|
19579
|
-
harnessId: harnessPluginIdSchema,
|
|
19580
|
-
nativeSessionId: harnessSessionImportIdSchema
|
|
19739
|
+
var failedHarnessInspectionSchema = external_exports.object({
|
|
19740
|
+
status: external_exports.enum(["notInstalled", "unavailable", "error"]),
|
|
19741
|
+
error: codexhostErrorSchema
|
|
19581
19742
|
}).strict();
|
|
19582
|
-
var
|
|
19583
|
-
|
|
19743
|
+
var harnessInspectionSchema = external_exports.union([
|
|
19744
|
+
readyHarnessInspectionSchema,
|
|
19745
|
+
failedHarnessInspectionSchema
|
|
19746
|
+
]);
|
|
19747
|
+
var harnessInspectParamsSchema = external_exports.object({
|
|
19748
|
+
harnessId: harnessIdSchema,
|
|
19749
|
+
cwd: nonBlankTextSchema2.max(16384).optional(),
|
|
19750
|
+
refresh: external_exports.boolean().optional()
|
|
19584
19751
|
}).strict();
|
|
19585
|
-
|
|
19586
|
-
|
|
19587
|
-
var DEEPSEEK_MODERN_SESSION_LIST_MAX_LENGTH = HARNESS_SESSION_IMPORT_LIST_MAX_LENGTH;
|
|
19588
|
-
var DEEPSEEK_MODERN_HOST_THREAD_ID_MAX_LENGTH = 1024;
|
|
19589
|
-
var nonBlankTextSchema5 = external_exports.string().refine((value) => value.trim().length > 0, "Value must not be empty or whitespace").refine((value) => !value.includes("\0"), "Value must not contain NUL");
|
|
19590
|
-
var deepSeekModernSessionIdSchema = harnessSessionImportIdSchema;
|
|
19591
|
-
var deepSeekModernSessionCandidateSchema = harnessSessionImportCandidateSchema;
|
|
19592
|
-
var deepSeekModernSessionListParamsSchema = external_exports.object({}).strict();
|
|
19593
|
-
var deepSeekModernSessionListResultSchema = external_exports.object({
|
|
19594
|
-
candidates: external_exports.array(deepSeekModernSessionCandidateSchema).max(DEEPSEEK_MODERN_SESSION_LIST_MAX_LENGTH)
|
|
19752
|
+
var harnessWebUiOpenParamsSchema = external_exports.object({
|
|
19753
|
+
harnessId: harnessIdSchema
|
|
19595
19754
|
}).strict();
|
|
19596
|
-
var
|
|
19597
|
-
|
|
19755
|
+
var harnessWebUiOpenResultSchema = external_exports.object({}).strict();
|
|
19756
|
+
var threadModelSelectParamsSchema = external_exports.object({
|
|
19757
|
+
threadId: hostThreadIdSchema,
|
|
19758
|
+
model: harnessModelRefSchema
|
|
19598
19759
|
}).strict();
|
|
19599
|
-
var
|
|
19600
|
-
threadId:
|
|
19760
|
+
var threadThinkingSelectParamsSchema = external_exports.object({
|
|
19761
|
+
threadId: hostThreadIdSchema,
|
|
19762
|
+
thinkingOptionId: harnessThinkingOptionIdSchema
|
|
19601
19763
|
}).strict();
|
|
19602
|
-
|
|
19603
|
-
// ../../shared-contracts/dist/external-thread-fork.js
|
|
19604
|
-
var externalThreadForkParamsSchema = external_exports.object({
|
|
19764
|
+
var threadInspectionParamsSchema = external_exports.object({
|
|
19605
19765
|
threadId: hostThreadIdSchema,
|
|
19606
|
-
|
|
19766
|
+
includeReferenceCapability: external_exports.boolean().optional()
|
|
19607
19767
|
}).strict();
|
|
19608
|
-
var
|
|
19609
|
-
|
|
19768
|
+
var codexThreadInspectionSchema = external_exports.object({
|
|
19769
|
+
owner: external_exports.literal("codex"),
|
|
19770
|
+
locked: external_exports.literal(true),
|
|
19771
|
+
supportsThreadReferences: external_exports.literal(true).optional()
|
|
19610
19772
|
}).strict();
|
|
19611
|
-
|
|
19612
|
-
|
|
19613
|
-
|
|
19614
|
-
|
|
19615
|
-
|
|
19616
|
-
|
|
19617
|
-
|
|
19618
|
-
|
|
19619
|
-
|
|
19620
|
-
|
|
19621
|
-
|
|
19622
|
-
|
|
19623
|
-
|
|
19624
|
-
|
|
19625
|
-
* not tell skills and commands apart; consumers treat that as "command".
|
|
19626
|
-
*/
|
|
19627
|
-
kind: external_exports.enum(["command", "skill"]).optional()
|
|
19773
|
+
var externalThreadInspectionSchema = external_exports.object({
|
|
19774
|
+
owner: external_exports.literal("external"),
|
|
19775
|
+
harnessId: nonBlankTextSchema2.max(256),
|
|
19776
|
+
transportModelId: nonBlankTextSchema2.max(1024),
|
|
19777
|
+
effectiveModel: harnessModelRefSchema.optional(),
|
|
19778
|
+
resolvedModelLabel: harnessResolvedModelLabelSchema.optional(),
|
|
19779
|
+
effectiveThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
19780
|
+
availableThinkingOptions: harnessThinkingOptionsSchema.optional(),
|
|
19781
|
+
effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
|
|
19782
|
+
history: harnessHistoryCapabilitiesSchema,
|
|
19783
|
+
usage: threadUsageSnapshotSchema.optional(),
|
|
19784
|
+
/** True when the thread is a read-only child thread materialized for a subagent. */
|
|
19785
|
+
subagent: external_exports.boolean().optional(),
|
|
19786
|
+
locked: external_exports.literal(true)
|
|
19628
19787
|
}).strict();
|
|
19629
|
-
var
|
|
19630
|
-
|
|
19631
|
-
|
|
19632
|
-
|
|
19633
|
-
|
|
19634
|
-
|
|
19635
|
-
|
|
19636
|
-
|
|
19637
|
-
|
|
19638
|
-
|
|
19639
|
-
for (const [index, command] of catalog.commands.entries()) {
|
|
19640
|
-
if (ids.has(command.id)) {
|
|
19788
|
+
var threadInspectionSchema = external_exports.discriminatedUnion("owner", [
|
|
19789
|
+
codexThreadInspectionSchema,
|
|
19790
|
+
externalThreadInspectionSchema
|
|
19791
|
+
]);
|
|
19792
|
+
var threadOwnershipListParamsSchema = external_exports.object({
|
|
19793
|
+
threadIds: external_exports.array(hostThreadIdSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
|
|
19794
|
+
}).strict().superRefine(({ threadIds }, context) => {
|
|
19795
|
+
const seen = /* @__PURE__ */ new Set();
|
|
19796
|
+
for (const [index, threadId] of threadIds.entries()) {
|
|
19797
|
+
if (seen.has(threadId)) {
|
|
19641
19798
|
context.addIssue({
|
|
19642
19799
|
code: "custom",
|
|
19643
|
-
message: "
|
|
19644
|
-
path: ["
|
|
19800
|
+
message: "Thread ownership-list IDs must be unique",
|
|
19801
|
+
path: ["threadIds", index]
|
|
19645
19802
|
});
|
|
19646
19803
|
}
|
|
19647
|
-
|
|
19804
|
+
seen.add(threadId);
|
|
19648
19805
|
}
|
|
19649
19806
|
});
|
|
19650
|
-
var
|
|
19651
|
-
harnessId: harnessIdSchema,
|
|
19652
|
-
/** Workspace of a draft without a Thread, for its live catalog when known. */
|
|
19653
|
-
cwd: external_exports.string().min(1).optional()
|
|
19654
|
-
}).strict();
|
|
19655
|
-
var threadCommandsInspectParamsSchema = external_exports.object({
|
|
19656
|
-
threadId: hostThreadIdSchema
|
|
19657
|
-
}).strict();
|
|
19658
|
-
var threadCommandExecuteParamsSchema = external_exports.object({
|
|
19807
|
+
var codexThreadOwnershipSchema = external_exports.object({
|
|
19659
19808
|
threadId: hostThreadIdSchema,
|
|
19660
|
-
|
|
19661
|
-
turnId: hostTurnIdSchema.optional(),
|
|
19662
|
-
arguments: jsonObjectSchema.optional()
|
|
19809
|
+
owner: external_exports.literal("codex")
|
|
19663
19810
|
}).strict();
|
|
19664
|
-
var
|
|
19665
|
-
|
|
19666
|
-
|
|
19811
|
+
var externalThreadOwnershipSchema = external_exports.object({
|
|
19812
|
+
threadId: hostThreadIdSchema,
|
|
19813
|
+
owner: external_exports.literal("external"),
|
|
19814
|
+
harnessId: external_exports.string().max(256).pipe(harnessIdSchema)
|
|
19667
19815
|
}).strict();
|
|
19668
|
-
|
|
19669
|
-
|
|
19670
|
-
|
|
19671
|
-
var absentSchema = external_exports.never().optional();
|
|
19672
|
-
var methodSchema = external_exports.string().min(1);
|
|
19673
|
-
var jsonRpcIdSchema = external_exports.union([external_exports.string(), external_exports.number().int()]);
|
|
19674
|
-
var jsonRpcErrorSchema = external_exports.object({
|
|
19675
|
-
code: external_exports.number().int(),
|
|
19676
|
-
message: external_exports.string(),
|
|
19677
|
-
data: jsonValueSchema.optional()
|
|
19678
|
-
}).catchall(jsonValueSchema).superRefine(rejectExplicitUndefined(["data"]));
|
|
19679
|
-
var jsonRpcRequestSchema = external_exports.object({
|
|
19680
|
-
jsonrpc: jsonRpcVersionSchema,
|
|
19681
|
-
id: jsonRpcIdSchema,
|
|
19682
|
-
method: methodSchema,
|
|
19683
|
-
params: jsonValueSchema.optional(),
|
|
19684
|
-
result: absentSchema,
|
|
19685
|
-
error: absentSchema
|
|
19686
|
-
}).catchall(jsonValueSchema).superRefine(rejectExplicitUndefined(["jsonrpc", "params", "result", "error"]));
|
|
19687
|
-
var jsonRpcNotificationSchema = external_exports.object({
|
|
19688
|
-
jsonrpc: jsonRpcVersionSchema,
|
|
19689
|
-
id: absentSchema,
|
|
19690
|
-
method: methodSchema,
|
|
19691
|
-
params: jsonValueSchema.optional(),
|
|
19692
|
-
result: absentSchema,
|
|
19693
|
-
error: absentSchema
|
|
19694
|
-
}).catchall(jsonValueSchema).superRefine(rejectExplicitUndefined(["jsonrpc", "id", "params", "result", "error"]));
|
|
19695
|
-
var jsonRpcSuccessResponseSchema = external_exports.object({
|
|
19696
|
-
jsonrpc: jsonRpcVersionSchema,
|
|
19697
|
-
id: jsonRpcIdSchema,
|
|
19698
|
-
method: absentSchema,
|
|
19699
|
-
params: absentSchema,
|
|
19700
|
-
result: jsonValueSchema,
|
|
19701
|
-
error: absentSchema
|
|
19702
|
-
}).catchall(jsonValueSchema).superRefine(rejectExplicitUndefined(["jsonrpc", "method", "params", "error"]));
|
|
19703
|
-
var jsonRpcErrorResponseSchema = external_exports.object({
|
|
19704
|
-
jsonrpc: jsonRpcVersionSchema,
|
|
19705
|
-
id: jsonRpcIdSchema,
|
|
19706
|
-
method: absentSchema,
|
|
19707
|
-
params: absentSchema,
|
|
19708
|
-
result: absentSchema,
|
|
19709
|
-
error: jsonRpcErrorSchema
|
|
19710
|
-
}).catchall(jsonValueSchema).superRefine(rejectExplicitUndefined(["jsonrpc", "method", "params", "result"]));
|
|
19711
|
-
var jsonRpcEnvelopeSchema = external_exports.union([
|
|
19712
|
-
jsonRpcRequestSchema,
|
|
19713
|
-
jsonRpcNotificationSchema,
|
|
19714
|
-
jsonRpcSuccessResponseSchema,
|
|
19715
|
-
jsonRpcErrorResponseSchema
|
|
19716
|
-
]);
|
|
19717
|
-
|
|
19718
|
-
// ../../shared-contracts/dist/native-refs.js
|
|
19719
|
-
var nativeIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
19720
|
-
message: "Native identifier must not be empty or whitespace"
|
|
19721
|
-
});
|
|
19722
|
-
var nativeSessionRefV1RuntimeSchema = external_exports.strictObject({
|
|
19723
|
-
harnessId: harnessIdSchema,
|
|
19724
|
-
nativeSessionId: nativeIdSchema,
|
|
19725
|
-
locator: jsonValueSchema.optional(),
|
|
19726
|
-
formatVersion: external_exports.literal(1)
|
|
19727
|
-
}).superRefine(rejectExplicitUndefined(["locator"]));
|
|
19728
|
-
var nativeSessionRefV1Schema = nativeSessionRefV1RuntimeSchema;
|
|
19729
|
-
var nativeSessionRefSchema = nativeSessionRefV1Schema;
|
|
19730
|
-
var nativeTurnRefV1Schema = external_exports.strictObject({
|
|
19731
|
-
harnessId: harnessIdSchema,
|
|
19732
|
-
nativeSessionId: nativeIdSchema,
|
|
19733
|
-
nativeTurnKey: nativeIdSchema,
|
|
19734
|
-
formatVersion: external_exports.literal(1)
|
|
19735
|
-
});
|
|
19736
|
-
var nativeTurnRefSchema = nativeTurnRefV1Schema;
|
|
19737
|
-
var nativeCheckpointRefV1RuntimeSchema = external_exports.strictObject({
|
|
19738
|
-
harnessId: harnessIdSchema,
|
|
19739
|
-
nativeSessionId: nativeIdSchema,
|
|
19740
|
-
checkpointId: nativeIdSchema,
|
|
19741
|
-
locator: jsonValueSchema.optional(),
|
|
19742
|
-
formatVersion: external_exports.literal(1)
|
|
19743
|
-
}).superRefine(rejectExplicitUndefined(["locator"]));
|
|
19744
|
-
var nativeCheckpointRefV1Schema = nativeCheckpointRefV1RuntimeSchema;
|
|
19745
|
-
var nativeCheckpointRefSchema = nativeCheckpointRefV1Schema;
|
|
19746
|
-
|
|
19747
|
-
// ../../shared-contracts/dist/updates.js
|
|
19748
|
-
var UPDATE_ERROR_MAX_LENGTH = 500;
|
|
19749
|
-
var UPDATE_SEMVER_PATTERN = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/u;
|
|
19750
|
-
var updateSemanticVersionSchema = external_exports.string().regex(UPDATE_SEMVER_PATTERN);
|
|
19751
|
-
var updateInstallationSchema = external_exports.enum(["npm", "windows-installer", "macos-dmg"]);
|
|
19752
|
-
var updatePhaseSchema = external_exports.enum([
|
|
19753
|
-
"prepared",
|
|
19754
|
-
"downloading",
|
|
19755
|
-
"waiting-for-exit",
|
|
19756
|
-
"installing",
|
|
19757
|
-
"restarting",
|
|
19758
|
-
"succeeded",
|
|
19759
|
-
"failed"
|
|
19816
|
+
var threadOwnershipSchema = external_exports.discriminatedUnion("owner", [
|
|
19817
|
+
codexThreadOwnershipSchema,
|
|
19818
|
+
externalThreadOwnershipSchema
|
|
19760
19819
|
]);
|
|
19761
|
-
var
|
|
19762
|
-
|
|
19763
|
-
|
|
19764
|
-
|
|
19765
|
-
|
|
19766
|
-
|
|
19767
|
-
|
|
19768
|
-
|
|
19769
|
-
|
|
19770
|
-
|
|
19771
|
-
|
|
19772
|
-
|
|
19773
|
-
|
|
19774
|
-
|
|
19775
|
-
});
|
|
19776
|
-
}
|
|
19777
|
-
});
|
|
19778
|
-
var updateEmptyParamsSchema = external_exports.strictObject({});
|
|
19779
|
-
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");
|
|
19780
|
-
var updateCheckResultSchema = external_exports.strictObject({
|
|
19781
|
-
currentVersion: updateSemanticVersionSchema,
|
|
19782
|
-
installation: updateInstallationSchema.nullable(),
|
|
19783
|
-
latestVersion: updateSemanticVersionSchema.nullable(),
|
|
19784
|
-
updateAvailable: external_exports.boolean(),
|
|
19785
|
-
installationAvailable: external_exports.boolean(),
|
|
19786
|
-
releaseNotes: external_exports.string().min(1).max(2e4).nullable(),
|
|
19787
|
-
releaseNotesUrl: githubReleaseNotesUrlSchema.nullable(),
|
|
19788
|
-
status: updateStatusSchema.nullable(),
|
|
19789
|
-
error: external_exports.string().min(1).max(UPDATE_ERROR_MAX_LENGTH).nullable()
|
|
19790
|
-
});
|
|
19791
|
-
var updateStartResultSchema = external_exports.strictObject({
|
|
19792
|
-
status: updateStatusSchema
|
|
19820
|
+
var threadOwnershipListResultSchema = external_exports.object({
|
|
19821
|
+
threads: external_exports.array(threadOwnershipSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
|
|
19822
|
+
}).strict().superRefine(({ threads }, context) => {
|
|
19823
|
+
const seen = /* @__PURE__ */ new Set();
|
|
19824
|
+
for (const [index, thread] of threads.entries()) {
|
|
19825
|
+
if (seen.has(thread.threadId)) {
|
|
19826
|
+
context.addIssue({
|
|
19827
|
+
code: "custom",
|
|
19828
|
+
message: "Thread ownership-list results must be unique",
|
|
19829
|
+
path: ["threads", index, "threadId"]
|
|
19830
|
+
});
|
|
19831
|
+
}
|
|
19832
|
+
seen.add(thread.threadId);
|
|
19833
|
+
}
|
|
19793
19834
|
});
|
|
19794
|
-
|
|
19795
|
-
|
|
19835
|
+
|
|
19836
|
+
// ../../shared-contracts/dist/harness-route.js
|
|
19837
|
+
var harnessPluginRouteSchema = external_exports.object({
|
|
19838
|
+
harnessId: harnessPluginIdSchema,
|
|
19839
|
+
model: harnessModelRefSchema.optional(),
|
|
19840
|
+
thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
|
|
19841
|
+
permissionModeId: harnessPermissionModeIdSchema.optional()
|
|
19842
|
+
}).strict();
|
|
19843
|
+
|
|
19844
|
+
// ../../shared-contracts/dist/harness-launch-settings.js
|
|
19845
|
+
var harnessLaunchPathSchema = external_exports.string().trim().min(1).max(4096).refine((value) => !/[\u0000\r\n]/u.test(value), "Invalid entrypoint path");
|
|
19846
|
+
var harnessLaunchSettingsGetSchema = external_exports.object({
|
|
19847
|
+
harnessId: harnessPluginIdSchema
|
|
19848
|
+
}).strict();
|
|
19849
|
+
var harnessLaunchSettingsSetSchema = harnessLaunchSettingsGetSchema.extend({
|
|
19850
|
+
path: harnessLaunchPathSchema.nullable()
|
|
19796
19851
|
});
|
|
19852
|
+
var harnessLaunchSettingsSchema = external_exports.object({
|
|
19853
|
+
path: harnessLaunchPathSchema.nullable(),
|
|
19854
|
+
restartRequired: external_exports.boolean()
|
|
19855
|
+
}).strict();
|
|
19797
19856
|
|
|
19798
|
-
// ../../shared-contracts/dist/
|
|
19799
|
-
var
|
|
19857
|
+
// ../../shared-contracts/dist/harness-installation.js
|
|
19858
|
+
var harnessInstallationParamsSchema = external_exports.object({
|
|
19859
|
+
harnessId: harnessIdSchema,
|
|
19860
|
+
action: external_exports.enum(["check", "update", "install"])
|
|
19861
|
+
}).strict();
|
|
19862
|
+
var harnessInstallationStateSchema = external_exports.object({
|
|
19863
|
+
currentVersion: external_exports.string().min(1).max(128),
|
|
19864
|
+
latestVersion: external_exports.string().min(1).max(128),
|
|
19865
|
+
updateAvailable: external_exports.boolean(),
|
|
19866
|
+
canUpdate: external_exports.boolean(),
|
|
19867
|
+
// Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
|
|
19868
|
+
message: external_exports.string().max(2048).optional(),
|
|
19869
|
+
messageCode: external_exports.string().min(1).max(128).optional(),
|
|
19870
|
+
latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
|
|
19871
|
+
}).strict();
|
|
19800
19872
|
|
|
19801
|
-
// ../../
|
|
19802
|
-
|
|
19803
|
-
|
|
19804
|
-
|
|
19805
|
-
|
|
19806
|
-
|
|
19873
|
+
// ../../shared-contracts/dist/codex-accounts.js
|
|
19874
|
+
var accountIdSchema = external_exports.string().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u);
|
|
19875
|
+
var nonBlankTextSchema3 = external_exports.string().trim().min(1);
|
|
19876
|
+
var codexAccountAuthKindSchema = external_exports.enum(["api", "chatgpt"]);
|
|
19877
|
+
var codexAccountSiteUrlPattern = /^https?:\/\/(?:\[[0-9a-fA-F:]+\]|[^/\s:@?#]+)(?::\d{1,5})?(?:[/?#][^\s]*)?$/u;
|
|
19878
|
+
function isCodexAccountSiteUrl(value) {
|
|
19879
|
+
return value.length > 0 && value.length <= 2048 && codexAccountSiteUrlPattern.test(value);
|
|
19807
19880
|
}
|
|
19881
|
+
var externalUrlOpenParamsSchema = external_exports.object({
|
|
19882
|
+
url: external_exports.string().max(2048).refine(isCodexAccountSiteUrl, "External URL must be http(s)")
|
|
19883
|
+
}).strict();
|
|
19884
|
+
var externalUrlOpenResultSchema = external_exports.object({}).strict();
|
|
19885
|
+
var codexAccountPlanTypeSchema = external_exports.enum([
|
|
19886
|
+
"free",
|
|
19887
|
+
"go",
|
|
19888
|
+
"plus",
|
|
19889
|
+
"pro",
|
|
19890
|
+
"prolite",
|
|
19891
|
+
"team",
|
|
19892
|
+
"self_serve_business_prolite",
|
|
19893
|
+
"self_serve_business_usage_based",
|
|
19894
|
+
"business",
|
|
19895
|
+
"ent26",
|
|
19896
|
+
"enterprise_cbp_automation",
|
|
19897
|
+
"enterprise_cbp_usage_based",
|
|
19898
|
+
"enterprise",
|
|
19899
|
+
"edu",
|
|
19900
|
+
"edu_plus",
|
|
19901
|
+
"edu_pro",
|
|
19902
|
+
"unknown"
|
|
19903
|
+
]);
|
|
19904
|
+
var codexAccountSchema = external_exports.object({
|
|
19905
|
+
accountId: accountIdSchema,
|
|
19906
|
+
label: nonBlankTextSchema3.max(256),
|
|
19907
|
+
email: external_exports.string().email().max(320).optional(),
|
|
19908
|
+
planType: codexAccountPlanTypeSchema.optional(),
|
|
19909
|
+
authKind: codexAccountAuthKindSchema.optional(),
|
|
19910
|
+
authIdentity: nonBlankTextSchema3.max(256).optional(),
|
|
19911
|
+
siteUrl: external_exports.string().refine(isCodexAccountSiteUrl, "Account site URL must be http(s)").optional()
|
|
19912
|
+
}).strict();
|
|
19913
|
+
var codexAccountPhaseSchema = external_exports.enum(["ready", "unavailable"]);
|
|
19914
|
+
var codexAccountListResultSchema = external_exports.object({
|
|
19915
|
+
version: external_exports.literal(2),
|
|
19916
|
+
currentAccountId: accountIdSchema.nullable(),
|
|
19917
|
+
phase: codexAccountPhaseSchema,
|
|
19918
|
+
revision: external_exports.number().int().nonnegative(),
|
|
19919
|
+
instanceId: nonBlankTextSchema3.max(1024).optional(),
|
|
19920
|
+
accounts: external_exports.array(codexAccountSchema).max(1)
|
|
19921
|
+
}).strict();
|
|
19922
|
+
var codexAccountUsageParamsSchema = external_exports.object({ accountId: accountIdSchema, refresh: external_exports.boolean().optional() }).strict();
|
|
19923
|
+
var codexAccountUsageResultSchema = external_exports.object({
|
|
19924
|
+
accountId: accountIdSchema,
|
|
19925
|
+
usage: threadUsageSnapshotSchema.nullable(),
|
|
19926
|
+
accountCredits: accountCreditsSnapshotSchema.optional(),
|
|
19927
|
+
freshness: external_exports.enum(["live", "cached"]),
|
|
19928
|
+
observedAt: external_exports.string().datetime().nullable()
|
|
19929
|
+
}).strict();
|
|
19808
19930
|
|
|
19809
|
-
// ../../
|
|
19810
|
-
|
|
19811
|
-
|
|
19812
|
-
|
|
19813
|
-
|
|
19814
|
-
|
|
19815
|
-
|
|
19816
|
-
|
|
19817
|
-
|
|
19818
|
-
|
|
19819
|
-
|
|
19820
|
-
|
|
19821
|
-
|
|
19822
|
-
|
|
19823
|
-
|
|
19824
|
-
|
|
19825
|
-
|
|
19826
|
-
|
|
19827
|
-
|
|
19828
|
-
|
|
19829
|
-
|
|
19830
|
-
|
|
19831
|
-
|
|
19832
|
-
|
|
19833
|
-
|
|
19834
|
-
|
|
19835
|
-
|
|
19836
|
-
|
|
19837
|
-
|
|
19838
|
-
|
|
19839
|
-
|
|
19840
|
-
|
|
19841
|
-
|
|
19842
|
-
|
|
19843
|
-
|
|
19931
|
+
// ../../shared-contracts/dist/harness-session-import.js
|
|
19932
|
+
var HARNESS_SESSION_IMPORT_ID_MAX_LENGTH = 1024;
|
|
19933
|
+
var HARNESS_SESSION_IMPORT_CWD_MAX_LENGTH = 16384;
|
|
19934
|
+
var HARNESS_SESSION_IMPORT_TITLE_MAX_LENGTH = 4096;
|
|
19935
|
+
var HARNESS_SESSION_IMPORT_LIST_MAX_LENGTH = 1e3;
|
|
19936
|
+
var HARNESS_SESSION_IMPORT_UPDATED_AT_MAX = 864e13;
|
|
19937
|
+
var nonBlankTextSchema4 = external_exports.string().refine((value) => value.trim().length > 0, "Value must not be empty or whitespace").refine((value) => !value.includes("\0"), "Value must not contain NUL");
|
|
19938
|
+
var harnessSessionImportIdSchema = nonBlankTextSchema4.max(HARNESS_SESSION_IMPORT_ID_MAX_LENGTH);
|
|
19939
|
+
var harnessSessionImportCandidateSchema = external_exports.object({
|
|
19940
|
+
nativeSessionId: harnessSessionImportIdSchema,
|
|
19941
|
+
title: nonBlankTextSchema4.max(HARNESS_SESSION_IMPORT_TITLE_MAX_LENGTH).nullable(),
|
|
19942
|
+
updatedAt: external_exports.number().int().nonnegative().max(HARNESS_SESSION_IMPORT_UPDATED_AT_MAX),
|
|
19943
|
+
cwd: nonBlankTextSchema4.max(HARNESS_SESSION_IMPORT_CWD_MAX_LENGTH),
|
|
19944
|
+
// Native file discovery cannot reliably observe another process's activity.
|
|
19945
|
+
running: external_exports.boolean().nullable()
|
|
19946
|
+
}).strict();
|
|
19947
|
+
var harnessSessionImportSourcesParamsSchema = external_exports.object({}).strict();
|
|
19948
|
+
var harnessSessionImportSourcesResultSchema = external_exports.object({
|
|
19949
|
+
harnesses: external_exports.array(external_exports.object({
|
|
19950
|
+
harnessId: harnessPluginIdSchema,
|
|
19951
|
+
name: nonBlankTextSchema4.max(128)
|
|
19952
|
+
}).strict()).max(128)
|
|
19953
|
+
}).strict();
|
|
19954
|
+
var harnessSessionListParamsSchema = external_exports.object({
|
|
19955
|
+
harnessId: harnessPluginIdSchema,
|
|
19956
|
+
query: external_exports.string().trim().max(4096).refine((value) => !value.includes("\0")).optional(),
|
|
19957
|
+
offset: external_exports.number().int().nonnegative().safe().optional(),
|
|
19958
|
+
limit: external_exports.number().int().min(1).max(HARNESS_SESSION_IMPORT_LIST_MAX_LENGTH).optional()
|
|
19959
|
+
}).strict();
|
|
19960
|
+
var harnessSessionListResultSchema = external_exports.object({
|
|
19961
|
+
candidates: external_exports.array(harnessSessionImportCandidateSchema).max(HARNESS_SESSION_IMPORT_LIST_MAX_LENGTH),
|
|
19962
|
+
total: external_exports.number().int().nonnegative().safe()
|
|
19963
|
+
}).strict();
|
|
19964
|
+
var harnessSessionImportParamsSchema = external_exports.object({
|
|
19965
|
+
harnessId: harnessPluginIdSchema,
|
|
19966
|
+
nativeSessionId: harnessSessionImportIdSchema
|
|
19967
|
+
}).strict();
|
|
19968
|
+
var harnessSessionImportResultSchema = external_exports.object({
|
|
19969
|
+
threadId: nonBlankTextSchema4.max(1024).pipe(hostThreadIdSchema)
|
|
19970
|
+
}).strict();
|
|
19844
19971
|
|
|
19845
|
-
// ../../
|
|
19846
|
-
var
|
|
19847
|
-
|
|
19848
|
-
|
|
19849
|
-
|
|
19850
|
-
|
|
19851
|
-
|
|
19852
|
-
|
|
19853
|
-
|
|
19854
|
-
|
|
19855
|
-
|
|
19856
|
-
|
|
19857
|
-
|
|
19858
|
-
|
|
19859
|
-
|
|
19860
|
-
|
|
19861
|
-
};
|
|
19862
|
-
}
|
|
19863
|
-
};
|
|
19864
|
-
}
|
|
19865
|
-
emit(value) {
|
|
19866
|
-
if (this.#ended)
|
|
19867
|
-
return false;
|
|
19868
|
-
const resolve = this.#pending.shift();
|
|
19869
|
-
if (resolve)
|
|
19870
|
-
resolve({ done: false, value });
|
|
19871
|
-
else
|
|
19872
|
-
this.#values.push(value);
|
|
19873
|
-
return true;
|
|
19874
|
-
}
|
|
19875
|
-
end() {
|
|
19876
|
-
if (this.#ended)
|
|
19877
|
-
return;
|
|
19878
|
-
this.#ended = true;
|
|
19879
|
-
if (this.#values.length !== 0)
|
|
19880
|
-
return;
|
|
19881
|
-
for (const resolve of this.#pending.splice(0))
|
|
19882
|
-
resolve({ done: true, value: void 0 });
|
|
19883
|
-
}
|
|
19884
|
-
#next() {
|
|
19885
|
-
const value = this.#values.shift();
|
|
19886
|
-
if (value !== void 0)
|
|
19887
|
-
return Promise.resolve({ done: false, value });
|
|
19888
|
-
if (this.#ended)
|
|
19889
|
-
return Promise.resolve({ done: true, value: void 0 });
|
|
19890
|
-
return new Promise((resolve) => this.#pending.push(resolve));
|
|
19891
|
-
}
|
|
19892
|
-
};
|
|
19972
|
+
// ../../shared-contracts/dist/deepseek-modern-sessions.js
|
|
19973
|
+
var DEEPSEEK_MODERN_SESSION_LIST_MAX_LENGTH = HARNESS_SESSION_IMPORT_LIST_MAX_LENGTH;
|
|
19974
|
+
var DEEPSEEK_MODERN_HOST_THREAD_ID_MAX_LENGTH = 1024;
|
|
19975
|
+
var nonBlankTextSchema5 = external_exports.string().refine((value) => value.trim().length > 0, "Value must not be empty or whitespace").refine((value) => !value.includes("\0"), "Value must not contain NUL");
|
|
19976
|
+
var deepSeekModernSessionIdSchema = harnessSessionImportIdSchema;
|
|
19977
|
+
var deepSeekModernSessionCandidateSchema = harnessSessionImportCandidateSchema;
|
|
19978
|
+
var deepSeekModernSessionListParamsSchema = external_exports.object({}).strict();
|
|
19979
|
+
var deepSeekModernSessionListResultSchema = external_exports.object({
|
|
19980
|
+
candidates: external_exports.array(deepSeekModernSessionCandidateSchema).max(DEEPSEEK_MODERN_SESSION_LIST_MAX_LENGTH)
|
|
19981
|
+
}).strict();
|
|
19982
|
+
var deepSeekModernSessionImportParamsSchema = external_exports.object({
|
|
19983
|
+
nativeSessionId: deepSeekModernSessionIdSchema
|
|
19984
|
+
}).strict();
|
|
19985
|
+
var deepSeekModernSessionImportResultSchema = external_exports.object({
|
|
19986
|
+
threadId: nonBlankTextSchema5.max(DEEPSEEK_MODERN_HOST_THREAD_ID_MAX_LENGTH).pipe(hostThreadIdSchema)
|
|
19987
|
+
}).strict();
|
|
19893
19988
|
|
|
19894
|
-
// ../../
|
|
19895
|
-
var
|
|
19896
|
-
|
|
19897
|
-
|
|
19898
|
-
|
|
19899
|
-
|
|
19900
|
-
|
|
19901
|
-
}
|
|
19989
|
+
// ../../shared-contracts/dist/external-thread-fork.js
|
|
19990
|
+
var externalThreadForkParamsSchema = external_exports.object({
|
|
19991
|
+
threadId: hostThreadIdSchema,
|
|
19992
|
+
lastTurnId: hostTurnIdSchema
|
|
19993
|
+
}).strict();
|
|
19994
|
+
var externalThreadForkResultSchema = external_exports.object({
|
|
19995
|
+
threadId: hostThreadIdSchema
|
|
19996
|
+
}).strict();
|
|
19902
19997
|
|
|
19903
|
-
// ../../
|
|
19904
|
-
var
|
|
19905
|
-
|
|
19906
|
-
|
|
19907
|
-
|
|
19908
|
-
|
|
19909
|
-
|
|
19910
|
-
|
|
19911
|
-
|
|
19912
|
-
|
|
19913
|
-
"
|
|
19914
|
-
|
|
19915
|
-
|
|
19916
|
-
|
|
19917
|
-
|
|
19918
|
-
]
|
|
19919
|
-
|
|
19920
|
-
|
|
19921
|
-
|
|
19922
|
-
|
|
19923
|
-
|
|
19924
|
-
|
|
19925
|
-
|
|
19926
|
-
|
|
19927
|
-
|
|
19928
|
-
|
|
19929
|
-
|
|
19930
|
-
|
|
19931
|
-
|
|
19932
|
-
|
|
19933
|
-
|
|
19934
|
-
|
|
19935
|
-
|
|
19936
|
-
|
|
19937
|
-
throw new Error("Harness Usage must be an object");
|
|
19938
|
-
const keys = Object.keys(value);
|
|
19939
|
-
if (keys.length === 0)
|
|
19940
|
-
throw new Error("Harness Usage must contain a reliable field");
|
|
19941
|
-
for (const key of keys) {
|
|
19942
|
-
if (!usageFields.has(key)) {
|
|
19943
|
-
throw new Error(`Harness Usage contains unknown field '${key}'`);
|
|
19944
|
-
}
|
|
19945
|
-
}
|
|
19946
|
-
for (const field of ["totalCredits", "contextUsagePercent"]) {
|
|
19947
|
-
const candidate = value[field];
|
|
19948
|
-
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
|
|
19949
|
-
throw new Error(`Harness Usage '${field}' must be a finite non-negative number`);
|
|
19950
|
-
}
|
|
19951
|
-
}
|
|
19952
|
-
for (const field of tokenFields) {
|
|
19953
|
-
const candidate = value[field];
|
|
19954
|
-
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
|
|
19955
|
-
throw new Error(`Harness Usage '${field}' must be a non-negative safe integer`);
|
|
19956
|
-
}
|
|
19957
|
-
}
|
|
19958
|
-
for (const field of safeIntegerFields) {
|
|
19959
|
-
const candidate = value[field];
|
|
19960
|
-
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
|
|
19961
|
-
throw new Error(`Harness Usage '${field}' must be a non-negative safe integer`);
|
|
19962
|
-
}
|
|
19963
|
-
}
|
|
19964
|
-
if (value.outputTokensPerSecond !== void 0 && (typeof value.outputTokensPerSecond !== "number" || !Number.isFinite(value.outputTokensPerSecond) || value.outputTokensPerSecond < 0)) {
|
|
19965
|
-
throw new Error("Harness Usage 'outputTokensPerSecond' must be a finite non-negative number");
|
|
19966
|
-
}
|
|
19967
|
-
if (value.totalCostUsd !== void 0 && (typeof value.totalCostUsd !== "number" || !Number.isFinite(value.totalCostUsd) || value.totalCostUsd < 0)) {
|
|
19968
|
-
throw new Error("Harness Usage 'totalCostUsd' must be a finite non-negative number");
|
|
19969
|
-
}
|
|
19970
|
-
for (const field of ["totalCredits", "contextUsagePercent"]) {
|
|
19971
|
-
const candidate = value[field];
|
|
19972
|
-
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
|
|
19973
|
-
throw new Error(`Harness Usage '${field}' must be a finite non-negative number`);
|
|
19974
|
-
}
|
|
19975
|
-
}
|
|
19976
|
-
for (const field of percentFields) {
|
|
19977
|
-
const candidate = value[field];
|
|
19978
|
-
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0 || candidate > 100)) {
|
|
19979
|
-
throw new Error(`Harness Usage '${field}' must be between 0 and 100`);
|
|
19998
|
+
// ../../shared-contracts/dist/harness-commands.js
|
|
19999
|
+
var commandIdSchema = external_exports.string().trim().min(1).max(128).regex(/^[A-Za-z0-9._:-]+$/u).brand();
|
|
20000
|
+
var commandInvocationSchema = external_exports.string().min(1).max(128);
|
|
20001
|
+
var commandLabelSchema = external_exports.string().trim().min(1).max(128);
|
|
20002
|
+
var commandDescriptionSchema = external_exports.string().trim().min(1).max(512);
|
|
20003
|
+
var harnessCommandDescriptorSchema = external_exports.object({
|
|
20004
|
+
id: commandIdSchema,
|
|
20005
|
+
invocation: commandInvocationSchema,
|
|
20006
|
+
label: commandLabelSchema,
|
|
20007
|
+
description: commandDescriptionSchema.optional(),
|
|
20008
|
+
argumentMode: external_exports.enum(["none", "text"]),
|
|
20009
|
+
/**
|
|
20010
|
+
* Native distinction reported by the Harness. Omitted when the Harness does
|
|
20011
|
+
* not tell skills and commands apart; consumers treat that as "command".
|
|
20012
|
+
*/
|
|
20013
|
+
kind: external_exports.enum(["command", "skill"]).optional()
|
|
20014
|
+
}).strict();
|
|
20015
|
+
var harnessCommandCatalogSchema = external_exports.object({
|
|
20016
|
+
commands: external_exports.array(harnessCommandDescriptorSchema),
|
|
20017
|
+
/**
|
|
20018
|
+
* `live` when the catalog includes what a native Session reports for its
|
|
20019
|
+
* workspace (custom commands, skills); `static` for Adapter built-ins only.
|
|
20020
|
+
* Omitted by Adapters; set by the Host on inspection results.
|
|
20021
|
+
*/
|
|
20022
|
+
source: external_exports.enum(["live", "static"]).optional()
|
|
20023
|
+
}).strict().superRefine((catalog, context) => {
|
|
20024
|
+
const ids = /* @__PURE__ */ new Set();
|
|
20025
|
+
for (const [index, command] of catalog.commands.entries()) {
|
|
20026
|
+
if (ids.has(command.id)) {
|
|
20027
|
+
context.addIssue({
|
|
20028
|
+
code: "custom",
|
|
20029
|
+
message: "Harness command IDs must be unique",
|
|
20030
|
+
path: ["commands", index, "id"]
|
|
20031
|
+
});
|
|
19980
20032
|
}
|
|
20033
|
+
ids.add(command.id);
|
|
19981
20034
|
}
|
|
19982
|
-
|
|
19983
|
-
|
|
19984
|
-
|
|
19985
|
-
|
|
19986
|
-
|
|
19987
|
-
|
|
19988
|
-
|
|
19989
|
-
|
|
19990
|
-
|
|
19991
|
-
|
|
19992
|
-
|
|
19993
|
-
|
|
19994
|
-
|
|
19995
|
-
|
|
19996
|
-
|
|
19997
|
-
|
|
20035
|
+
});
|
|
20036
|
+
var harnessCommandsInspectParamsSchema = external_exports.object({
|
|
20037
|
+
harnessId: harnessIdSchema,
|
|
20038
|
+
/** Workspace of a draft without a Thread, for its live catalog when known. */
|
|
20039
|
+
cwd: external_exports.string().min(1).optional()
|
|
20040
|
+
}).strict();
|
|
20041
|
+
var threadCommandsInspectParamsSchema = external_exports.object({
|
|
20042
|
+
threadId: hostThreadIdSchema
|
|
20043
|
+
}).strict();
|
|
20044
|
+
var threadCommandExecuteParamsSchema = external_exports.object({
|
|
20045
|
+
threadId: hostThreadIdSchema,
|
|
20046
|
+
commandId: commandIdSchema,
|
|
20047
|
+
turnId: hostTurnIdSchema.optional(),
|
|
20048
|
+
arguments: jsonObjectSchema.optional()
|
|
20049
|
+
}).strict();
|
|
20050
|
+
var threadCommandExecuteResultSchema = external_exports.object({
|
|
20051
|
+
accepted: external_exports.literal(true),
|
|
20052
|
+
turnId: hostTurnIdSchema
|
|
20053
|
+
}).strict();
|
|
19998
20054
|
|
|
19999
|
-
// ../../
|
|
20000
|
-
var
|
|
20001
|
-
|
|
20002
|
-
|
|
20003
|
-
|
|
20004
|
-
|
|
20005
|
-
|
|
20006
|
-
|
|
20007
|
-
|
|
20008
|
-
|
|
20009
|
-
|
|
20010
|
-
|
|
20011
|
-
|
|
20012
|
-
|
|
20013
|
-
|
|
20014
|
-
|
|
20015
|
-
|
|
20016
|
-
|
|
20017
|
-
|
|
20018
|
-
|
|
20019
|
-
|
|
20020
|
-
|
|
20021
|
-
|
|
20022
|
-
|
|
20023
|
-
|
|
20024
|
-
|
|
20025
|
-
|
|
20026
|
-
|
|
20027
|
-
|
|
20028
|
-
|
|
20029
|
-
|
|
20030
|
-
|
|
20031
|
-
|
|
20032
|
-
|
|
20033
|
-
|
|
20034
|
-
|
|
20035
|
-
|
|
20036
|
-
|
|
20037
|
-
|
|
20038
|
-
|
|
20039
|
-
|
|
20040
|
-
|
|
20041
|
-
|
|
20042
|
-
|
|
20043
|
-
|
|
20044
|
-
|
|
20045
|
-
|
|
20046
|
-
"queue",
|
|
20047
|
-
"remote-control",
|
|
20048
|
-
"schedule",
|
|
20049
|
-
"steer",
|
|
20050
|
-
// Native terminal UI
|
|
20051
|
-
"copy",
|
|
20052
|
-
"debug",
|
|
20053
|
-
"feedback",
|
|
20054
|
-
"heapdump",
|
|
20055
|
-
"share",
|
|
20056
|
-
"shell",
|
|
20057
|
-
// Plugin and MCP management
|
|
20058
|
-
"marketplace",
|
|
20059
|
-
"mcp",
|
|
20060
|
-
"plugins",
|
|
20061
|
-
"reload-plugins"
|
|
20055
|
+
// ../../shared-contracts/dist/json-rpc.js
|
|
20056
|
+
var jsonRpcVersionSchema = external_exports.literal("2.0").optional();
|
|
20057
|
+
var absentSchema = external_exports.never().optional();
|
|
20058
|
+
var methodSchema = external_exports.string().min(1);
|
|
20059
|
+
var jsonRpcIdSchema = external_exports.union([external_exports.string(), external_exports.number().int()]);
|
|
20060
|
+
var jsonRpcErrorSchema = external_exports.object({
|
|
20061
|
+
code: external_exports.number().int(),
|
|
20062
|
+
message: external_exports.string(),
|
|
20063
|
+
data: jsonValueSchema.optional()
|
|
20064
|
+
}).catchall(jsonValueSchema).superRefine(rejectExplicitUndefined(["data"]));
|
|
20065
|
+
var jsonRpcRequestSchema = external_exports.object({
|
|
20066
|
+
jsonrpc: jsonRpcVersionSchema,
|
|
20067
|
+
id: jsonRpcIdSchema,
|
|
20068
|
+
method: methodSchema,
|
|
20069
|
+
params: jsonValueSchema.optional(),
|
|
20070
|
+
result: absentSchema,
|
|
20071
|
+
error: absentSchema
|
|
20072
|
+
}).catchall(jsonValueSchema).superRefine(rejectExplicitUndefined(["jsonrpc", "params", "result", "error"]));
|
|
20073
|
+
var jsonRpcNotificationSchema = external_exports.object({
|
|
20074
|
+
jsonrpc: jsonRpcVersionSchema,
|
|
20075
|
+
id: absentSchema,
|
|
20076
|
+
method: methodSchema,
|
|
20077
|
+
params: jsonValueSchema.optional(),
|
|
20078
|
+
result: absentSchema,
|
|
20079
|
+
error: absentSchema
|
|
20080
|
+
}).catchall(jsonValueSchema).superRefine(rejectExplicitUndefined(["jsonrpc", "id", "params", "result", "error"]));
|
|
20081
|
+
var jsonRpcSuccessResponseSchema = external_exports.object({
|
|
20082
|
+
jsonrpc: jsonRpcVersionSchema,
|
|
20083
|
+
id: jsonRpcIdSchema,
|
|
20084
|
+
method: absentSchema,
|
|
20085
|
+
params: absentSchema,
|
|
20086
|
+
result: jsonValueSchema,
|
|
20087
|
+
error: absentSchema
|
|
20088
|
+
}).catchall(jsonValueSchema).superRefine(rejectExplicitUndefined(["jsonrpc", "method", "params", "error"]));
|
|
20089
|
+
var jsonRpcErrorResponseSchema = external_exports.object({
|
|
20090
|
+
jsonrpc: jsonRpcVersionSchema,
|
|
20091
|
+
id: jsonRpcIdSchema,
|
|
20092
|
+
method: absentSchema,
|
|
20093
|
+
params: absentSchema,
|
|
20094
|
+
result: absentSchema,
|
|
20095
|
+
error: jsonRpcErrorSchema
|
|
20096
|
+
}).catchall(jsonValueSchema).superRefine(rejectExplicitUndefined(["jsonrpc", "method", "params", "result"]));
|
|
20097
|
+
var jsonRpcEnvelopeSchema = external_exports.union([
|
|
20098
|
+
jsonRpcRequestSchema,
|
|
20099
|
+
jsonRpcNotificationSchema,
|
|
20100
|
+
jsonRpcSuccessResponseSchema,
|
|
20101
|
+
jsonRpcErrorResponseSchema
|
|
20062
20102
|
]);
|
|
20063
|
-
|
|
20064
|
-
|
|
20065
|
-
|
|
20066
|
-
|
|
20067
|
-
|
|
20068
|
-
|
|
20069
|
-
|
|
20070
|
-
|
|
20071
|
-
|
|
20072
|
-
|
|
20073
|
-
}
|
|
20074
|
-
|
|
20075
|
-
|
|
20076
|
-
|
|
20077
|
-
|
|
20078
|
-
|
|
20079
|
-
|
|
20080
|
-
|
|
20081
|
-
|
|
20082
|
-
|
|
20083
|
-
|
|
20084
|
-
|
|
20085
|
-
|
|
20086
|
-
|
|
20087
|
-
|
|
20088
|
-
|
|
20089
|
-
|
|
20090
|
-
|
|
20091
|
-
|
|
20092
|
-
|
|
20093
|
-
|
|
20094
|
-
|
|
20095
|
-
|
|
20096
|
-
|
|
20097
|
-
|
|
20098
|
-
|
|
20099
|
-
|
|
20100
|
-
|
|
20101
|
-
|
|
20102
|
-
|
|
20103
|
-
|
|
20104
|
-
|
|
20105
|
-
|
|
20106
|
-
|
|
20103
|
+
|
|
20104
|
+
// ../../shared-contracts/dist/native-refs.js
|
|
20105
|
+
var nativeIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
20106
|
+
message: "Native identifier must not be empty or whitespace"
|
|
20107
|
+
});
|
|
20108
|
+
var nativeSessionRefV1RuntimeSchema = external_exports.strictObject({
|
|
20109
|
+
harnessId: harnessIdSchema,
|
|
20110
|
+
nativeSessionId: nativeIdSchema,
|
|
20111
|
+
locator: jsonValueSchema.optional(),
|
|
20112
|
+
formatVersion: external_exports.literal(1)
|
|
20113
|
+
}).superRefine(rejectExplicitUndefined(["locator"]));
|
|
20114
|
+
var nativeSessionRefV1Schema = nativeSessionRefV1RuntimeSchema;
|
|
20115
|
+
var nativeSessionRefSchema = nativeSessionRefV1Schema;
|
|
20116
|
+
var nativeTurnRefV1Schema = external_exports.strictObject({
|
|
20117
|
+
harnessId: harnessIdSchema,
|
|
20118
|
+
nativeSessionId: nativeIdSchema,
|
|
20119
|
+
nativeTurnKey: nativeIdSchema,
|
|
20120
|
+
formatVersion: external_exports.literal(1)
|
|
20121
|
+
});
|
|
20122
|
+
var nativeTurnRefSchema = nativeTurnRefV1Schema;
|
|
20123
|
+
var nativeCheckpointRefV1RuntimeSchema = external_exports.strictObject({
|
|
20124
|
+
harnessId: harnessIdSchema,
|
|
20125
|
+
nativeSessionId: nativeIdSchema,
|
|
20126
|
+
checkpointId: nativeIdSchema,
|
|
20127
|
+
locator: jsonValueSchema.optional(),
|
|
20128
|
+
formatVersion: external_exports.literal(1)
|
|
20129
|
+
}).superRefine(rejectExplicitUndefined(["locator"]));
|
|
20130
|
+
var nativeCheckpointRefV1Schema = nativeCheckpointRefV1RuntimeSchema;
|
|
20131
|
+
var nativeCheckpointRefSchema = nativeCheckpointRefV1Schema;
|
|
20132
|
+
|
|
20133
|
+
// ../../shared-contracts/dist/updates.js
|
|
20134
|
+
var UPDATE_ERROR_MAX_LENGTH = 500;
|
|
20135
|
+
var UPDATE_SEMVER_PATTERN = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/u;
|
|
20136
|
+
var updateSemanticVersionSchema = external_exports.string().regex(UPDATE_SEMVER_PATTERN);
|
|
20137
|
+
var updateInstallationSchema = external_exports.enum(["npm", "windows-installer", "macos-dmg"]);
|
|
20138
|
+
var updatePhaseSchema = external_exports.enum([
|
|
20139
|
+
"prepared",
|
|
20140
|
+
"downloading",
|
|
20141
|
+
"waiting-for-exit",
|
|
20142
|
+
"installing",
|
|
20143
|
+
"restarting",
|
|
20144
|
+
"succeeded",
|
|
20145
|
+
"failed"
|
|
20146
|
+
]);
|
|
20147
|
+
var updateStatusSchema = external_exports.strictObject({
|
|
20148
|
+
version: updateSemanticVersionSchema,
|
|
20149
|
+
installation: updateInstallationSchema,
|
|
20150
|
+
phase: updatePhaseSchema,
|
|
20151
|
+
updatedAt: external_exports.number().int().nonnegative(),
|
|
20152
|
+
downloadedBytes: external_exports.number().int().nonnegative().optional(),
|
|
20153
|
+
totalBytes: external_exports.number().int().positive().optional(),
|
|
20154
|
+
error: external_exports.string().min(1).max(UPDATE_ERROR_MAX_LENGTH).nullable()
|
|
20155
|
+
}).superRefine((status, context) => {
|
|
20156
|
+
if (status.downloadedBytes !== void 0 && status.totalBytes !== void 0 && status.downloadedBytes > status.totalBytes) {
|
|
20157
|
+
context.addIssue({
|
|
20158
|
+
code: "custom",
|
|
20159
|
+
path: ["downloadedBytes"],
|
|
20160
|
+
message: "downloadedBytes must not exceed totalBytes"
|
|
20107
20161
|
});
|
|
20108
|
-
if (!parsed.success)
|
|
20109
|
-
continue;
|
|
20110
|
-
invocations.add(invocation);
|
|
20111
|
-
ids.add(id);
|
|
20112
|
-
dynamic.push(parsed.data);
|
|
20113
20162
|
}
|
|
20114
|
-
|
|
20115
|
-
}
|
|
20163
|
+
});
|
|
20164
|
+
var updateEmptyParamsSchema = external_exports.strictObject({});
|
|
20165
|
+
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");
|
|
20166
|
+
var updateCheckResultSchema = external_exports.strictObject({
|
|
20167
|
+
currentVersion: updateSemanticVersionSchema,
|
|
20168
|
+
installation: updateInstallationSchema.nullable(),
|
|
20169
|
+
latestVersion: updateSemanticVersionSchema.nullable(),
|
|
20170
|
+
updateAvailable: external_exports.boolean(),
|
|
20171
|
+
installationAvailable: external_exports.boolean(),
|
|
20172
|
+
releaseNotes: external_exports.string().min(1).max(2e4).nullable(),
|
|
20173
|
+
releaseNotesUrl: githubReleaseNotesUrlSchema.nullable(),
|
|
20174
|
+
status: updateStatusSchema.nullable(),
|
|
20175
|
+
error: external_exports.string().min(1).max(UPDATE_ERROR_MAX_LENGTH).nullable()
|
|
20176
|
+
});
|
|
20177
|
+
var updateStartResultSchema = external_exports.strictObject({
|
|
20178
|
+
status: updateStatusSchema
|
|
20179
|
+
});
|
|
20180
|
+
var updateStatusResultSchema = external_exports.strictObject({
|
|
20181
|
+
status: updateStatusSchema.nullable()
|
|
20182
|
+
});
|
|
20116
20183
|
|
|
20117
|
-
// dist/
|
|
20118
|
-
|
|
20119
|
-
import { readdir, readFile as readFile2 } from "node:fs/promises";
|
|
20120
|
-
import os4 from "node:os";
|
|
20121
|
-
import path10 from "node:path";
|
|
20122
|
-
import { Readable, Writable } from "node:stream";
|
|
20184
|
+
// ../../shared-contracts/dist/index.js
|
|
20185
|
+
var workspaceContractVersionSchema = external_exports.literal(WORKSPACE_CONTRACT_VERSION);
|
|
20123
20186
|
|
|
20124
|
-
// dist/
|
|
20125
|
-
|
|
20126
|
-
|
|
20127
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
20128
|
-
}
|
|
20129
|
-
function parseGrokAvailableCommands(value) {
|
|
20130
|
-
if (!Array.isArray(value))
|
|
20131
|
-
return [];
|
|
20132
|
-
return value.flatMap((entry) => {
|
|
20133
|
-
if (!isRecord3(entry))
|
|
20134
|
-
return [];
|
|
20135
|
-
const name = typeof entry.name === "string" ? entry.name.trim().replace(/^\//u, "") : "";
|
|
20136
|
-
if (!name)
|
|
20137
|
-
return [];
|
|
20138
|
-
return [
|
|
20139
|
-
{
|
|
20140
|
-
name,
|
|
20141
|
-
description: typeof entry.description === "string" ? entry.description : "",
|
|
20142
|
-
meta: isRecord3(entry._meta) ? entry._meta : null
|
|
20143
|
-
}
|
|
20144
|
-
];
|
|
20145
|
-
});
|
|
20146
|
-
}
|
|
20147
|
-
function isGrokSkill(command) {
|
|
20148
|
-
const path13 = command.meta?.path;
|
|
20149
|
-
return typeof path13 === "string" && /(^|[\\/])SKILL\.md$/u.test(path13) || typeof command.meta?.qualifiedName === "string";
|
|
20187
|
+
// ../../harness-adapter/dist/approval.js
|
|
20188
|
+
function invalidRequest(message) {
|
|
20189
|
+
return { code: "invalidRequest", message, retryable: false };
|
|
20150
20190
|
}
|
|
20151
|
-
function
|
|
20152
|
-
return
|
|
20153
|
-
name: command.name,
|
|
20154
|
-
description: command.description,
|
|
20155
|
-
kind: isGrokSkill(command) ? "skill" : "command"
|
|
20156
|
-
}));
|
|
20191
|
+
function validateHostApprovalResponse(interaction, response) {
|
|
20192
|
+
return interaction.actions.some(({ id }) => id === response.actionId) ? null : invalidRequest("Approval Response contains an undeclared action ID");
|
|
20157
20193
|
}
|
|
20158
20194
|
|
|
20159
|
-
// dist/
|
|
20160
|
-
|
|
20161
|
-
|
|
20162
|
-
// ../../harness-discovery/dist/environment.js
|
|
20163
|
-
import fs from "node:fs";
|
|
20164
|
-
import path2 from "node:path";
|
|
20165
|
-
function targetPath(platform) {
|
|
20166
|
-
return platform === "win32" ? path2.win32 : path2.posix;
|
|
20167
|
-
}
|
|
20168
|
-
function environmentValue(environment, name) {
|
|
20169
|
-
const lowered = name.toLowerCase();
|
|
20170
|
-
for (const [key, value] of Object.entries(environment)) {
|
|
20171
|
-
if (key.toLowerCase() === lowered)
|
|
20172
|
-
return value;
|
|
20173
|
-
}
|
|
20174
|
-
return void 0;
|
|
20175
|
-
}
|
|
20176
|
-
function pathDelimiter(platform) {
|
|
20177
|
-
return platform === "win32" ? ";" : ":";
|
|
20178
|
-
}
|
|
20179
|
-
function pathDirectories(environment, platform) {
|
|
20180
|
-
return (environmentValue(environment, "PATH") ?? "").split(pathDelimiter(platform)).map((directory) => directory.trim().replace(/^"|"$/gu, "")).filter(Boolean);
|
|
20181
|
-
}
|
|
20182
|
-
function executableExtensions(command, platform, environment) {
|
|
20183
|
-
if (platform !== "win32")
|
|
20184
|
-
return [""];
|
|
20185
|
-
if (targetPath(platform).extname(command) !== "")
|
|
20186
|
-
return [""];
|
|
20187
|
-
return (environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").map((extension) => extension.trim()).filter(Boolean);
|
|
20195
|
+
// ../../harness-adapter/dist/question.js
|
|
20196
|
+
function invalidRequest2(message) {
|
|
20197
|
+
return { code: "invalidRequest", message, retryable: false };
|
|
20188
20198
|
}
|
|
20189
|
-
function
|
|
20190
|
-
|
|
20191
|
-
|
|
20192
|
-
return
|
|
20193
|
-
} catch {
|
|
20194
|
-
return false;
|
|
20199
|
+
function validateHostQuestionResponse(interaction, response) {
|
|
20200
|
+
const questionIds = new Set(interaction.questions.map(({ id }) => id));
|
|
20201
|
+
if (response.cancelled) {
|
|
20202
|
+
return Object.keys(response.answers).length === 0 ? null : invalidRequest2("Cancelled Question Response must not contain answers");
|
|
20195
20203
|
}
|
|
20196
|
-
|
|
20197
|
-
|
|
20198
|
-
|
|
20199
|
-
|
|
20200
|
-
} catch {
|
|
20201
|
-
return [];
|
|
20204
|
+
for (const answerId of Object.keys(response.answers)) {
|
|
20205
|
+
if (!questionIds.has(answerId)) {
|
|
20206
|
+
return invalidRequest2("Question Response contains an unknown Question ID");
|
|
20207
|
+
}
|
|
20202
20208
|
}
|
|
20203
|
-
|
|
20204
|
-
|
|
20205
|
-
|
|
20206
|
-
|
|
20207
|
-
|
|
20208
|
-
|
|
20209
|
-
|
|
20210
|
-
|
|
20211
|
-
|
|
20212
|
-
|
|
20213
|
-
|
|
20209
|
+
for (const question of interaction.questions) {
|
|
20210
|
+
const answers = response.answers[question.id] ?? [];
|
|
20211
|
+
if (!question.optional && answers.length === 0) {
|
|
20212
|
+
return invalidRequest2("Question Response omits a required answer");
|
|
20213
|
+
}
|
|
20214
|
+
if (question.type === "text") {
|
|
20215
|
+
if (answers.length > 1) {
|
|
20216
|
+
return invalidRequest2("Text Question accepts at most one answer");
|
|
20217
|
+
}
|
|
20218
|
+
continue;
|
|
20219
|
+
}
|
|
20220
|
+
if (!question.multiple && answers.length > 1) {
|
|
20221
|
+
return invalidRequest2("Single-choice Question accepts at most one answer");
|
|
20222
|
+
}
|
|
20223
|
+
const declared = new Set(question.options.map(({ value }) => value));
|
|
20224
|
+
if (!question.allowOther && answers.some((answer) => !declared.has(answer))) {
|
|
20225
|
+
return invalidRequest2("Question Response contains an undeclared choice");
|
|
20226
|
+
}
|
|
20214
20227
|
}
|
|
20215
|
-
|
|
20216
|
-
const commandLine = [command, ...arguments_].map(quote).join(" ");
|
|
20217
|
-
return {
|
|
20218
|
-
command: environmentValue(environment, "ComSpec") ?? "cmd.exe",
|
|
20219
|
-
arguments: ["/d", "/v:off", "/s", "/c", `"${commandLine}"`],
|
|
20220
|
-
windowsVerbatimArguments: true
|
|
20221
|
-
};
|
|
20228
|
+
return null;
|
|
20222
20229
|
}
|
|
20223
20230
|
|
|
20224
|
-
// ../../harness-
|
|
20225
|
-
|
|
20226
|
-
|
|
20227
|
-
|
|
20228
|
-
|
|
20229
|
-
|
|
20230
|
-
|
|
20231
|
-
|
|
20232
|
-
|
|
20233
|
-
|
|
20231
|
+
// ../../harness-adapter/dist/output-channel.js
|
|
20232
|
+
var HarnessOutputChannel = class {
|
|
20233
|
+
outputs;
|
|
20234
|
+
#consumerCreated = false;
|
|
20235
|
+
#ended = false;
|
|
20236
|
+
#pending = [];
|
|
20237
|
+
#values = [];
|
|
20238
|
+
constructor() {
|
|
20239
|
+
this.outputs = {
|
|
20240
|
+
[Symbol.asyncIterator]: () => {
|
|
20241
|
+
if (this.#consumerCreated) {
|
|
20242
|
+
throw new Error("Harness outputs allow only one consumer");
|
|
20243
|
+
}
|
|
20244
|
+
this.#consumerCreated = true;
|
|
20245
|
+
return {
|
|
20246
|
+
next: () => this.#next()
|
|
20247
|
+
};
|
|
20248
|
+
}
|
|
20249
|
+
};
|
|
20234
20250
|
}
|
|
20235
|
-
|
|
20236
|
-
|
|
20237
|
-
|
|
20238
|
-
|
|
20239
|
-
|
|
20240
|
-
|
|
20241
|
-
|
|
20242
|
-
|
|
20243
|
-
|
|
20244
|
-
const list = context.subdirectories ?? subdirectoryNames;
|
|
20245
|
-
const pathFlavor = targetPath(platform);
|
|
20246
|
-
const value = (name) => environmentValue(environment, name);
|
|
20247
|
-
const directories = [];
|
|
20248
|
-
const versioned = (root, ...tail) => {
|
|
20249
|
-
for (const version2 of newestFirst(list(root))) {
|
|
20250
|
-
directories.push(pathFlavor.join(root, version2, ...tail));
|
|
20251
|
-
}
|
|
20252
|
-
};
|
|
20253
|
-
if (platform === "win32") {
|
|
20254
|
-
const appData = value("APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming");
|
|
20255
|
-
const localAppData = value("LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local");
|
|
20256
|
-
versioned(pathFlavor.join(appData, "nvm"));
|
|
20257
|
-
versioned(value("FNM_DIR") ?? pathFlavor.join(appData, "fnm", "node-versions"), "installation");
|
|
20258
|
-
directories.push(pathFlavor.join(localAppData, "Volta", "bin"));
|
|
20259
|
-
directories.push(pathFlavor.join(home, ".bun", "bin"));
|
|
20260
|
-
const pnpmHome2 = value("PNPM_HOME");
|
|
20261
|
-
if (pnpmHome2)
|
|
20262
|
-
directories.push(pnpmHome2);
|
|
20263
|
-
directories.push(pathFlavor.join(localAppData, "pnpm"));
|
|
20264
|
-
return directories;
|
|
20251
|
+
emit(value) {
|
|
20252
|
+
if (this.#ended)
|
|
20253
|
+
return false;
|
|
20254
|
+
const resolve = this.#pending.shift();
|
|
20255
|
+
if (resolve)
|
|
20256
|
+
resolve({ done: false, value });
|
|
20257
|
+
else
|
|
20258
|
+
this.#values.push(value);
|
|
20259
|
+
return true;
|
|
20265
20260
|
}
|
|
20266
|
-
|
|
20267
|
-
|
|
20268
|
-
|
|
20269
|
-
|
|
20270
|
-
|
|
20271
|
-
|
|
20272
|
-
|
|
20273
|
-
|
|
20261
|
+
end() {
|
|
20262
|
+
if (this.#ended)
|
|
20263
|
+
return;
|
|
20264
|
+
this.#ended = true;
|
|
20265
|
+
if (this.#values.length !== 0)
|
|
20266
|
+
return;
|
|
20267
|
+
for (const resolve of this.#pending.splice(0))
|
|
20268
|
+
resolve({ done: true, value: void 0 });
|
|
20274
20269
|
}
|
|
20275
|
-
|
|
20276
|
-
|
|
20277
|
-
|
|
20278
|
-
|
|
20279
|
-
|
|
20280
|
-
|
|
20281
|
-
|
|
20282
|
-
versioned(pathFlavor.join(nodenvHome, "versions"), "bin");
|
|
20283
|
-
directories.push(pathFlavor.join(nodenvHome, "shims"));
|
|
20284
|
-
versioned(pathFlavor.join(value("N_PREFIX") ?? "/usr/local", "n", "versions", "node"), "bin");
|
|
20285
|
-
directories.push(pathFlavor.join(home, ".bun", "bin"));
|
|
20286
|
-
const pnpmHome = value("PNPM_HOME");
|
|
20287
|
-
if (pnpmHome)
|
|
20288
|
-
directories.push(pnpmHome);
|
|
20289
|
-
directories.push(pathFlavor.join(home, "Library", "pnpm"));
|
|
20290
|
-
directories.push(pathFlavor.join(home, ".local", "share", "pnpm"));
|
|
20291
|
-
for (const prefix of ["/opt/homebrew/opt", "/usr/local/opt"]) {
|
|
20292
|
-
for (const formula of newestFirst(list(prefix).filter((name) => name.startsWith("node@")))) {
|
|
20293
|
-
directories.push(pathFlavor.join(prefix, formula, "bin"));
|
|
20294
|
-
}
|
|
20270
|
+
#next() {
|
|
20271
|
+
const value = this.#values.shift();
|
|
20272
|
+
if (value !== void 0)
|
|
20273
|
+
return Promise.resolve({ done: false, value });
|
|
20274
|
+
if (this.#ended)
|
|
20275
|
+
return Promise.resolve({ done: true, value: void 0 });
|
|
20276
|
+
return new Promise((resolve) => this.#pending.push(resolve));
|
|
20295
20277
|
}
|
|
20296
|
-
|
|
20297
|
-
}
|
|
20278
|
+
};
|
|
20298
20279
|
|
|
20299
|
-
// ../../harness-
|
|
20300
|
-
var
|
|
20301
|
-
|
|
20302
|
-
|
|
20303
|
-
|
|
20304
|
-
|
|
20305
|
-
return
|
|
20306
|
-
}
|
|
20307
|
-
function templateVariables(environment, platform, home) {
|
|
20308
|
-
const pathFlavor = targetPath(platform);
|
|
20309
|
-
return {
|
|
20310
|
-
HOME: home,
|
|
20311
|
-
USERPROFILE: home,
|
|
20312
|
-
APPDATA: environmentValue(environment, "APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming"),
|
|
20313
|
-
LOCALAPPDATA: environmentValue(environment, "LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local")
|
|
20314
|
-
};
|
|
20280
|
+
// ../../harness-adapter/dist/diagnostics.js
|
|
20281
|
+
var DIAGNOSTIC_TAIL_MAX_LENGTH = 8e3;
|
|
20282
|
+
var SENSITIVE_VALUE_PATTERN = /(api[_-]?key|access[_-]?token|auth(?:orization)?|password|secret)(\s*[:=]\s*)([^\s,;]+)/giu;
|
|
20283
|
+
var BEARER_PATTERN = /\bBearer\s+[A-Za-z0-9._~+/=-]+/giu;
|
|
20284
|
+
function sanitizeDiagnosticTail(value) {
|
|
20285
|
+
const redacted = value.replace(BEARER_PATTERN, "Bearer [redacted]").replace(SENSITIVE_VALUE_PATTERN, "$1$2[redacted]");
|
|
20286
|
+
return redacted.length <= DIAGNOSTIC_TAIL_MAX_LENGTH ? redacted : redacted.slice(-DIAGNOSTIC_TAIL_MAX_LENGTH);
|
|
20315
20287
|
}
|
|
20316
|
-
|
|
20317
|
-
|
|
20318
|
-
|
|
20319
|
-
|
|
20320
|
-
|
|
20321
|
-
|
|
20322
|
-
|
|
20323
|
-
|
|
20288
|
+
|
|
20289
|
+
// ../../harness-adapter/dist/usage.js
|
|
20290
|
+
var tokenFields = [
|
|
20291
|
+
"inputTokens",
|
|
20292
|
+
"cachedInputTokens",
|
|
20293
|
+
"cacheWriteInputTokens",
|
|
20294
|
+
"outputTokens",
|
|
20295
|
+
"outputTokensPerSecond",
|
|
20296
|
+
"reasoningOutputTokens",
|
|
20297
|
+
"totalTokens",
|
|
20298
|
+
"contextWindowTokens",
|
|
20299
|
+
"contextUsedTokens"
|
|
20300
|
+
];
|
|
20301
|
+
var safeIntegerFields = [
|
|
20302
|
+
"planFiveHourResetsAtUnix",
|
|
20303
|
+
"planSevenDayResetsAtUnix"
|
|
20304
|
+
];
|
|
20305
|
+
var percentFields = [
|
|
20306
|
+
"cacheHitRatePercent",
|
|
20307
|
+
"planFiveHourUsedPercent",
|
|
20308
|
+
"planSevenDayUsedPercent"
|
|
20309
|
+
];
|
|
20310
|
+
var usageFields = /* @__PURE__ */ new Set([
|
|
20311
|
+
...tokenFields,
|
|
20312
|
+
...safeIntegerFields,
|
|
20313
|
+
...percentFields,
|
|
20314
|
+
"totalCostUsd",
|
|
20315
|
+
"totalCredits",
|
|
20316
|
+
"contextUsagePercent"
|
|
20317
|
+
]);
|
|
20318
|
+
function isRecord2(value) {
|
|
20319
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
20324
20320
|
}
|
|
20325
|
-
function
|
|
20326
|
-
|
|
20327
|
-
|
|
20328
|
-
const
|
|
20329
|
-
|
|
20330
|
-
|
|
20331
|
-
|
|
20332
|
-
|
|
20321
|
+
function parseHostUsage(value) {
|
|
20322
|
+
if (!isRecord2(value))
|
|
20323
|
+
throw new Error("Harness Usage must be an object");
|
|
20324
|
+
const keys = Object.keys(value);
|
|
20325
|
+
if (keys.length === 0)
|
|
20326
|
+
throw new Error("Harness Usage must contain a reliable field");
|
|
20327
|
+
for (const key of keys) {
|
|
20328
|
+
if (!usageFields.has(key)) {
|
|
20329
|
+
throw new Error(`Harness Usage contains unknown field '${key}'`);
|
|
20333
20330
|
}
|
|
20334
|
-
|
|
20335
|
-
|
|
20336
|
-
|
|
20337
|
-
|
|
20338
|
-
|
|
20339
|
-
const templates = (platform === "win32" ? spec.installRoots?.windows : spec.installRoots?.posix) ?? [];
|
|
20340
|
-
const directories = [];
|
|
20341
|
-
for (const template of templates) {
|
|
20342
|
-
if (template === VERSION_MANAGER_ROOTS) {
|
|
20343
|
-
directories.push(...versionManagerBinaryDirectories({
|
|
20344
|
-
platform,
|
|
20345
|
-
environment: input.environment,
|
|
20346
|
-
home,
|
|
20347
|
-
...dependencies.subdirectories ? { subdirectories: dependencies.subdirectories } : {}
|
|
20348
|
-
}));
|
|
20349
|
-
continue;
|
|
20331
|
+
}
|
|
20332
|
+
for (const field of ["totalCredits", "contextUsagePercent"]) {
|
|
20333
|
+
const candidate = value[field];
|
|
20334
|
+
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
|
|
20335
|
+
throw new Error(`Harness Usage '${field}' must be a finite non-negative number`);
|
|
20350
20336
|
}
|
|
20351
|
-
const directory = expandInstallRoot(template, input.environment, platform, home);
|
|
20352
|
-
if (directory !== void 0)
|
|
20353
|
-
directories.push(directory);
|
|
20354
20337
|
}
|
|
20355
|
-
|
|
20356
|
-
|
|
20357
|
-
|
|
20358
|
-
|
|
20359
|
-
|
|
20360
|
-
const configured = input.command ?? (spec.commandEnvironmentVariable ? environmentValue(input.environment, spec.commandEnvironmentVariable) : void 0);
|
|
20361
|
-
const command = configured ?? spec.command;
|
|
20362
|
-
if (pathFlavor.isAbsolute(command) || command.includes("/") || command.includes("\\")) {
|
|
20363
|
-
return [{ candidate: command, source: "configured" }];
|
|
20338
|
+
for (const field of tokenFields) {
|
|
20339
|
+
const candidate = value[field];
|
|
20340
|
+
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
|
|
20341
|
+
throw new Error(`Harness Usage '${field}' must be a non-negative safe integer`);
|
|
20342
|
+
}
|
|
20364
20343
|
}
|
|
20365
|
-
const
|
|
20366
|
-
|
|
20367
|
-
|
|
20368
|
-
|
|
20369
|
-
|
|
20370
|
-
|
|
20371
|
-
|
|
20372
|
-
|
|
20344
|
+
for (const field of safeIntegerFields) {
|
|
20345
|
+
const candidate = value[field];
|
|
20346
|
+
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
|
|
20347
|
+
throw new Error(`Harness Usage '${field}' must be a non-negative safe integer`);
|
|
20348
|
+
}
|
|
20349
|
+
}
|
|
20350
|
+
if (value.outputTokensPerSecond !== void 0 && (typeof value.outputTokensPerSecond !== "number" || !Number.isFinite(value.outputTokensPerSecond) || value.outputTokensPerSecond < 0)) {
|
|
20351
|
+
throw new Error("Harness Usage 'outputTokensPerSecond' must be a finite non-negative number");
|
|
20352
|
+
}
|
|
20353
|
+
if (value.totalCostUsd !== void 0 && (typeof value.totalCostUsd !== "number" || !Number.isFinite(value.totalCostUsd) || value.totalCostUsd < 0)) {
|
|
20354
|
+
throw new Error("Harness Usage 'totalCostUsd' must be a finite non-negative number");
|
|
20355
|
+
}
|
|
20356
|
+
for (const field of ["totalCredits", "contextUsagePercent"]) {
|
|
20357
|
+
const candidate = value[field];
|
|
20358
|
+
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
|
|
20359
|
+
throw new Error(`Harness Usage '${field}' must be a finite non-negative number`);
|
|
20373
20360
|
}
|
|
20374
20361
|
}
|
|
20375
|
-
|
|
20376
|
-
|
|
20377
|
-
|
|
20378
|
-
|
|
20379
|
-
for (const extension of installRootExtensions(platform)) {
|
|
20380
|
-
candidates.push({
|
|
20381
|
-
candidate: pathFlavor.join(directory, spec.command + extension),
|
|
20382
|
-
source: "install-root"
|
|
20383
|
-
});
|
|
20362
|
+
for (const field of percentFields) {
|
|
20363
|
+
const candidate = value[field];
|
|
20364
|
+
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0 || candidate > 100)) {
|
|
20365
|
+
throw new Error(`Harness Usage '${field}' must be between 0 and 100`);
|
|
20384
20366
|
}
|
|
20385
20367
|
}
|
|
20386
|
-
|
|
20387
|
-
|
|
20388
|
-
|
|
20389
|
-
|
|
20390
|
-
const isExecutable = dependencies.isExecutable ?? ((candidate) => isExecutableFile(candidate, platform));
|
|
20391
|
-
const runnable = spec.runnableCandidate ?? ((candidate) => candidate);
|
|
20392
|
-
const context = { platform, isExecutable };
|
|
20393
|
-
for (const { candidate, source } of harnessCandidates(spec, input, dependencies)) {
|
|
20394
|
-
const executable = runnable(candidate, context);
|
|
20395
|
-
if (executable !== void 0 && isExecutable(executable))
|
|
20396
|
-
return { executable, source };
|
|
20368
|
+
const hasContextUsed = value.contextUsedTokens !== void 0;
|
|
20369
|
+
const hasContextWindow = value.contextWindowTokens !== void 0;
|
|
20370
|
+
if (hasContextUsed !== hasContextWindow) {
|
|
20371
|
+
throw new Error("Harness Usage context fields must be provided together");
|
|
20397
20372
|
}
|
|
20398
|
-
|
|
20373
|
+
if (hasContextWindow && value.contextWindowTokens === 0) {
|
|
20374
|
+
throw new Error("Harness Usage 'contextWindowTokens' must be greater than zero");
|
|
20375
|
+
}
|
|
20376
|
+
if (value.planFiveHourResetsAtUnix !== void 0 && value.planFiveHourUsedPercent === void 0) {
|
|
20377
|
+
throw new Error("Harness Usage 'planFiveHourResetsAtUnix' must be provided with 'planFiveHourUsedPercent'");
|
|
20378
|
+
}
|
|
20379
|
+
if (value.planSevenDayResetsAtUnix !== void 0 && value.planSevenDayUsedPercent === void 0) {
|
|
20380
|
+
throw new Error("Harness Usage 'planSevenDayResetsAtUnix' must be provided with 'planSevenDayUsedPercent'");
|
|
20381
|
+
}
|
|
20382
|
+
return { ...value };
|
|
20399
20383
|
}
|
|
20400
20384
|
|
|
20401
|
-
// ../../harness-
|
|
20402
|
-
|
|
20403
|
-
|
|
20404
|
-
|
|
20405
|
-
|
|
20406
|
-
|
|
20407
|
-
|
|
20408
|
-
|
|
20409
|
-
|
|
20410
|
-
|
|
20411
|
-
|
|
20412
|
-
|
|
20413
|
-
|
|
20414
|
-
|
|
20415
|
-
|
|
20416
|
-
|
|
20417
|
-
|
|
20418
|
-
|
|
20419
|
-
|
|
20420
|
-
|
|
20421
|
-
|
|
20385
|
+
// ../../harness-adapter/dist/live-command-catalog.js
|
|
20386
|
+
var COMMON_EXCLUDED_LIVE_COMMANDS = /* @__PURE__ */ new Set([
|
|
20387
|
+
// Session lifecycle
|
|
20388
|
+
"branch",
|
|
20389
|
+
"clear",
|
|
20390
|
+
"exit",
|
|
20391
|
+
"fork",
|
|
20392
|
+
"fresh",
|
|
20393
|
+
"new",
|
|
20394
|
+
"quit",
|
|
20395
|
+
"rename",
|
|
20396
|
+
"rename-chat",
|
|
20397
|
+
"reset",
|
|
20398
|
+
"resume",
|
|
20399
|
+
"rewind",
|
|
20400
|
+
"session",
|
|
20401
|
+
"sessions",
|
|
20402
|
+
// Desktop-owned configuration
|
|
20403
|
+
"autocompact",
|
|
20404
|
+
"color",
|
|
20405
|
+
"config",
|
|
20406
|
+
"effort",
|
|
20407
|
+
"fast",
|
|
20408
|
+
"keybindings",
|
|
20409
|
+
"model",
|
|
20410
|
+
"models",
|
|
20411
|
+
"output-style",
|
|
20412
|
+
"permissions",
|
|
20413
|
+
"settings",
|
|
20414
|
+
"statusline",
|
|
20415
|
+
"terminal-setup",
|
|
20416
|
+
"theme",
|
|
20417
|
+
"vim",
|
|
20418
|
+
// Trust and approval policy
|
|
20419
|
+
"always-approve",
|
|
20420
|
+
"auto-mode-setup",
|
|
20421
|
+
// Native login
|
|
20422
|
+
"login",
|
|
20423
|
+
"logout",
|
|
20424
|
+
// Work outliving the Turn
|
|
20425
|
+
"autopilot",
|
|
20426
|
+
"background",
|
|
20427
|
+
"bg",
|
|
20428
|
+
"goal",
|
|
20429
|
+
"jobs",
|
|
20430
|
+
"loop",
|
|
20431
|
+
"multitask",
|
|
20432
|
+
"queue",
|
|
20433
|
+
"remote-control",
|
|
20434
|
+
"schedule",
|
|
20435
|
+
"steer",
|
|
20436
|
+
// Native terminal UI
|
|
20437
|
+
"copy",
|
|
20438
|
+
"debug",
|
|
20439
|
+
"feedback",
|
|
20440
|
+
"heapdump",
|
|
20441
|
+
"share",
|
|
20442
|
+
"shell",
|
|
20443
|
+
// Plugin and MCP management
|
|
20444
|
+
"marketplace",
|
|
20445
|
+
"mcp",
|
|
20446
|
+
"plugins",
|
|
20447
|
+
"reload-plugins"
|
|
20448
|
+
]);
|
|
20449
|
+
var COMMON_EXCLUDED_LIVE_COMMAND_PREFIXES = ["__", "hooks-"];
|
|
20450
|
+
function isExcludedLiveCommand(name, kind, extra = {}) {
|
|
20451
|
+
const normalized = name.trim().replace(/^\//u, "");
|
|
20452
|
+
if (new Set(extra.names ?? []).has(normalized))
|
|
20453
|
+
return true;
|
|
20454
|
+
if (extra.prefixes?.some((prefix) => normalized.startsWith(prefix)))
|
|
20455
|
+
return true;
|
|
20456
|
+
if (kind === "skill")
|
|
20457
|
+
return false;
|
|
20458
|
+
return COMMON_EXCLUDED_LIVE_COMMANDS.has(normalized) || COMMON_EXCLUDED_LIVE_COMMAND_PREFIXES.some((prefix) => normalized.startsWith(prefix));
|
|
20459
|
+
}
|
|
20460
|
+
function liveHarnessCommandPrompt(catalog, idPrefix, commandId, argumentText) {
|
|
20461
|
+
if (!commandId.startsWith(idPrefix))
|
|
20462
|
+
return null;
|
|
20463
|
+
const descriptor = catalog.commands.find(({ id }) => id === commandId);
|
|
20464
|
+
if (!descriptor)
|
|
20465
|
+
return null;
|
|
20466
|
+
const text = typeof argumentText === "string" ? argumentText.trim() : "";
|
|
20467
|
+
return text ? `${descriptor.invocation} ${text}` : descriptor.invocation;
|
|
20468
|
+
}
|
|
20469
|
+
function mergeLiveHarnessCommands(builtIns, idPrefix, live, exclusions = {}) {
|
|
20470
|
+
if (!live)
|
|
20471
|
+
return builtIns;
|
|
20472
|
+
const invocations = new Set(builtIns.commands.map(({ invocation }) => invocation));
|
|
20473
|
+
const ids = new Set(builtIns.commands.map(({ id }) => id));
|
|
20474
|
+
const dynamic = [];
|
|
20475
|
+
for (const command of live) {
|
|
20476
|
+
const name = command.name.trim().replace(/^\//u, "");
|
|
20477
|
+
if (!name || /\s/u.test(name))
|
|
20478
|
+
continue;
|
|
20479
|
+
if (isExcludedLiveCommand(name, command.kind, exclusions))
|
|
20480
|
+
continue;
|
|
20481
|
+
const invocation = `/${name}`;
|
|
20482
|
+
const id = `${idPrefix}${name.replace(/[^A-Za-z0-9._:-]/gu, "-")}`.slice(0, 128);
|
|
20483
|
+
if (invocations.has(invocation) || ids.has(id))
|
|
20484
|
+
continue;
|
|
20485
|
+
const description = command.description?.trim().slice(0, 512);
|
|
20486
|
+
const parsed = harnessCommandDescriptorSchema.safeParse({
|
|
20487
|
+
id,
|
|
20488
|
+
invocation,
|
|
20489
|
+
label: name.slice(0, 128),
|
|
20490
|
+
...description ? { description } : {},
|
|
20491
|
+
argumentMode: "text",
|
|
20492
|
+
kind: command.kind
|
|
20422
20493
|
});
|
|
20423
|
-
|
|
20424
|
-
|
|
20494
|
+
if (!parsed.success)
|
|
20495
|
+
continue;
|
|
20496
|
+
invocations.add(invocation);
|
|
20497
|
+
ids.add(id);
|
|
20498
|
+
dynamic.push(parsed.data);
|
|
20499
|
+
}
|
|
20500
|
+
return harnessCommandCatalogSchema.parse({ commands: [...builtIns.commands, ...dynamic] });
|
|
20425
20501
|
}
|
|
20426
|
-
|
|
20427
|
-
|
|
20428
|
-
|
|
20429
|
-
|
|
20502
|
+
|
|
20503
|
+
// dist/acp-transport.js
|
|
20504
|
+
import { spawn, spawnSync } from "node:child_process";
|
|
20505
|
+
import { readdir, readFile as readFile2 } from "node:fs/promises";
|
|
20506
|
+
import os4 from "node:os";
|
|
20507
|
+
import path10 from "node:path";
|
|
20508
|
+
import { Readable, Writable } from "node:stream";
|
|
20509
|
+
|
|
20510
|
+
// dist/grok-slash-commands.js
|
|
20511
|
+
var GROK_LIVE_COMMAND_ID_PREFIX = "grok.slash.";
|
|
20512
|
+
function isRecord3(value) {
|
|
20513
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
20430
20514
|
}
|
|
20431
|
-
function
|
|
20432
|
-
|
|
20433
|
-
|
|
20434
|
-
|
|
20435
|
-
|
|
20515
|
+
function parseGrokAvailableCommands(value) {
|
|
20516
|
+
if (!Array.isArray(value))
|
|
20517
|
+
return [];
|
|
20518
|
+
return value.flatMap((entry) => {
|
|
20519
|
+
if (!isRecord3(entry))
|
|
20520
|
+
return [];
|
|
20521
|
+
const name = typeof entry.name === "string" ? entry.name.trim().replace(/^\//u, "") : "";
|
|
20522
|
+
if (!name)
|
|
20523
|
+
return [];
|
|
20524
|
+
return [
|
|
20525
|
+
{
|
|
20526
|
+
name,
|
|
20527
|
+
description: typeof entry.description === "string" ? entry.description : "",
|
|
20528
|
+
meta: isRecord3(entry._meta) ? entry._meta : null
|
|
20529
|
+
}
|
|
20530
|
+
];
|
|
20436
20531
|
});
|
|
20437
|
-
|
|
20438
|
-
|
|
20439
|
-
|
|
20440
|
-
|
|
20441
|
-
|
|
20442
|
-
|
|
20443
|
-
|
|
20444
|
-
|
|
20445
|
-
|
|
20446
|
-
|
|
20447
|
-
|
|
20448
|
-
await options.update(before);
|
|
20449
|
-
const after = await check2();
|
|
20450
|
-
if (after.currentVersion === before.currentVersion)
|
|
20451
|
-
throw new Error("The Harness version did not change; check the native updater and retry");
|
|
20452
|
-
return after;
|
|
20453
|
-
})().finally(() => {
|
|
20454
|
-
updating = void 0;
|
|
20455
|
-
});
|
|
20456
|
-
return updating;
|
|
20457
|
-
};
|
|
20532
|
+
}
|
|
20533
|
+
function isGrokSkill(command) {
|
|
20534
|
+
const path13 = command.meta?.path;
|
|
20535
|
+
return typeof path13 === "string" && /(^|[\\/])SKILL\.md$/u.test(path13) || typeof command.meta?.qualifiedName === "string";
|
|
20536
|
+
}
|
|
20537
|
+
function grokLiveCommands(native) {
|
|
20538
|
+
return native.map((command) => ({
|
|
20539
|
+
name: command.name,
|
|
20540
|
+
description: command.description,
|
|
20541
|
+
kind: isGrokSkill(command) ? "skill" : "command"
|
|
20542
|
+
}));
|
|
20458
20543
|
}
|
|
20459
20544
|
|
|
20460
20545
|
// dist/command.js
|
|
20546
|
+
import path5 from "node:path";
|
|
20461
20547
|
var GrokExecutableError = class extends Error {
|
|
20462
20548
|
code = "GROK_NOT_FOUND";
|
|
20463
20549
|
};
|
|
@@ -25662,7 +25748,13 @@ function createHarnessAdapter(context) {
|
|
|
25662
25748
|
return Object.assign(new GrokAdapter({
|
|
25663
25749
|
...environment[GROK_COMMAND_ENV] ? { command: environment[GROK_COMMAND_ENV] } : {},
|
|
25664
25750
|
environment
|
|
25665
|
-
}), {
|
|
25751
|
+
}), {
|
|
25752
|
+
installation: createGrokInstallation(environment, environment[GROK_COMMAND_ENV]),
|
|
25753
|
+
install: createHarnessInstaller(environment, {
|
|
25754
|
+
npm: "@xai-official/grok",
|
|
25755
|
+
allowScripts: "@xai-official/grok"
|
|
25756
|
+
})
|
|
25757
|
+
});
|
|
25666
25758
|
}
|
|
25667
25759
|
export {
|
|
25668
25760
|
GROK_COMMAND_ENV,
|