@codexhost/cli-win32-arm64 0.9.2 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/THIRD_PARTY_NOTICES.txt +0 -4
- package/app/codexhost-distribution.json +1 -1
- package/app/desktop-controller.mjs +49 -18
- package/app/host-runtime.mjs +980 -650
- package/app/plugins/antigravity/plugin.mjs +18 -3
- package/app/plugins/claude-code/plugin.mjs +214 -7
- package/app/plugins/codebuddy/plugin.mjs +103 -5
- package/app/plugins/cursor-cli/plugin.mjs +152 -53
- package/app/plugins/deepseek-harness/plugin.mjs +34 -21
- package/app/plugins/enabled.json +2 -1
- package/app/plugins/grok/plugin.mjs +272 -79
- package/app/plugins/hermes/plugin.mjs +162 -63
- package/app/plugins/kimi-code/manifest.json +11 -0
- package/app/plugins/kimi-code/plugin.mjs +24226 -0
- package/app/plugins/kiro-cli/plugin.mjs +257 -65
- package/app/plugins/omp/plugin.mjs +258 -67
- package/app/plugins/opencode/plugin.mjs +18 -3
- package/app/plugins/pi/plugin.mjs +211 -4
- package/app/plugins/qoder/plugin.mjs +279 -187
- package/app/plugins/qoder-cn/plugin.mjs +279 -187
- package/app/plugins/workbuddy/plugin.mjs +102 -5
- package/app/renderer-extension.js +1394 -520
- package/bin/codexhost.exe +0 -0
- package/libexec/codexhost-node-repl.exe +0 -0
- package/libexec/codexhost-shim.exe +0 -0
- package/libexec/codexhost-updater.exe +0 -0
- package/package.json +1 -1
- package/licenses/opencodex-LICENSE.txt +0 -21
|
@@ -15801,10 +15801,21 @@ var harnessCommandDescriptorSchema = external_exports.object({
|
|
|
15801
15801
|
invocation: commandInvocationSchema,
|
|
15802
15802
|
label: commandLabelSchema,
|
|
15803
15803
|
description: commandDescriptionSchema.optional(),
|
|
15804
|
-
argumentMode: external_exports.enum(["none", "text"])
|
|
15804
|
+
argumentMode: external_exports.enum(["none", "text"]),
|
|
15805
|
+
/**
|
|
15806
|
+
* Native distinction reported by the Harness. Omitted when the Harness does
|
|
15807
|
+
* not tell skills and commands apart; consumers treat that as "command".
|
|
15808
|
+
*/
|
|
15809
|
+
kind: external_exports.enum(["command", "skill"]).optional()
|
|
15805
15810
|
}).strict();
|
|
15806
15811
|
var harnessCommandCatalogSchema = external_exports.object({
|
|
15807
|
-
commands: external_exports.array(harnessCommandDescriptorSchema)
|
|
15812
|
+
commands: external_exports.array(harnessCommandDescriptorSchema),
|
|
15813
|
+
/**
|
|
15814
|
+
* `live` when the catalog includes what a native Session reports for its
|
|
15815
|
+
* workspace (custom commands, skills); `static` for Adapter built-ins only.
|
|
15816
|
+
* Omitted by Adapters; set by the Host on inspection results.
|
|
15817
|
+
*/
|
|
15818
|
+
source: external_exports.enum(["live", "static"]).optional()
|
|
15808
15819
|
}).strict().superRefine((catalog, context) => {
|
|
15809
15820
|
const ids = /* @__PURE__ */ new Set();
|
|
15810
15821
|
for (const [index, command] of catalog.commands.entries()) {
|
|
@@ -15818,7 +15829,11 @@ var harnessCommandCatalogSchema = external_exports.object({
|
|
|
15818
15829
|
ids.add(command.id);
|
|
15819
15830
|
}
|
|
15820
15831
|
});
|
|
15821
|
-
var harnessCommandsInspectParamsSchema = external_exports.object({
|
|
15832
|
+
var harnessCommandsInspectParamsSchema = external_exports.object({
|
|
15833
|
+
harnessId: harnessIdSchema,
|
|
15834
|
+
/** Workspace of a draft without a Thread, for its live catalog when known. */
|
|
15835
|
+
cwd: external_exports.string().min(1).optional()
|
|
15836
|
+
}).strict();
|
|
15822
15837
|
var threadCommandsInspectParamsSchema = external_exports.object({
|
|
15823
15838
|
threadId: hostThreadIdSchema
|
|
15824
15839
|
}).strict();
|
|
@@ -16157,6 +16172,155 @@ function parseHostUsage(value) {
|
|
|
16157
16172
|
return { ...value };
|
|
16158
16173
|
}
|
|
16159
16174
|
|
|
16175
|
+
// ../../harness-adapter/dist/live-command-catalog.js
|
|
16176
|
+
var COMMON_EXCLUDED_LIVE_COMMANDS = /* @__PURE__ */ new Set([
|
|
16177
|
+
// Session lifecycle
|
|
16178
|
+
"branch",
|
|
16179
|
+
"clear",
|
|
16180
|
+
"exit",
|
|
16181
|
+
"fork",
|
|
16182
|
+
"fresh",
|
|
16183
|
+
"new",
|
|
16184
|
+
"quit",
|
|
16185
|
+
"rename",
|
|
16186
|
+
"rename-chat",
|
|
16187
|
+
"reset",
|
|
16188
|
+
"resume",
|
|
16189
|
+
"rewind",
|
|
16190
|
+
"session",
|
|
16191
|
+
"sessions",
|
|
16192
|
+
// Desktop-owned configuration
|
|
16193
|
+
"autocompact",
|
|
16194
|
+
"color",
|
|
16195
|
+
"config",
|
|
16196
|
+
"effort",
|
|
16197
|
+
"fast",
|
|
16198
|
+
"keybindings",
|
|
16199
|
+
"model",
|
|
16200
|
+
"models",
|
|
16201
|
+
"output-style",
|
|
16202
|
+
"permissions",
|
|
16203
|
+
"settings",
|
|
16204
|
+
"statusline",
|
|
16205
|
+
"terminal-setup",
|
|
16206
|
+
"theme",
|
|
16207
|
+
"vim",
|
|
16208
|
+
// Trust and approval policy
|
|
16209
|
+
"always-approve",
|
|
16210
|
+
"auto-mode-setup",
|
|
16211
|
+
// Native login
|
|
16212
|
+
"login",
|
|
16213
|
+
"logout",
|
|
16214
|
+
// Work outliving the Turn
|
|
16215
|
+
"autopilot",
|
|
16216
|
+
"background",
|
|
16217
|
+
"bg",
|
|
16218
|
+
"goal",
|
|
16219
|
+
"jobs",
|
|
16220
|
+
"loop",
|
|
16221
|
+
"multitask",
|
|
16222
|
+
"queue",
|
|
16223
|
+
"remote-control",
|
|
16224
|
+
"schedule",
|
|
16225
|
+
"steer",
|
|
16226
|
+
// Native terminal UI
|
|
16227
|
+
"copy",
|
|
16228
|
+
"debug",
|
|
16229
|
+
"feedback",
|
|
16230
|
+
"heapdump",
|
|
16231
|
+
"share",
|
|
16232
|
+
"shell",
|
|
16233
|
+
// Plugin and MCP management
|
|
16234
|
+
"marketplace",
|
|
16235
|
+
"mcp",
|
|
16236
|
+
"plugins",
|
|
16237
|
+
"reload-plugins"
|
|
16238
|
+
]);
|
|
16239
|
+
var COMMON_EXCLUDED_LIVE_COMMAND_PREFIXES = ["__", "hooks-"];
|
|
16240
|
+
function isExcludedLiveCommand(name, kind, extra = {}) {
|
|
16241
|
+
const normalized = name.trim().replace(/^\//u, "");
|
|
16242
|
+
if (new Set(extra.names ?? []).has(normalized))
|
|
16243
|
+
return true;
|
|
16244
|
+
if (extra.prefixes?.some((prefix) => normalized.startsWith(prefix)))
|
|
16245
|
+
return true;
|
|
16246
|
+
if (kind === "skill")
|
|
16247
|
+
return false;
|
|
16248
|
+
return COMMON_EXCLUDED_LIVE_COMMANDS.has(normalized) || COMMON_EXCLUDED_LIVE_COMMAND_PREFIXES.some((prefix) => normalized.startsWith(prefix));
|
|
16249
|
+
}
|
|
16250
|
+
function liveHarnessCommandPrompt(catalog, idPrefix, commandId, argumentText) {
|
|
16251
|
+
if (!commandId.startsWith(idPrefix))
|
|
16252
|
+
return null;
|
|
16253
|
+
const descriptor = catalog.commands.find(({ id }) => id === commandId);
|
|
16254
|
+
if (!descriptor)
|
|
16255
|
+
return null;
|
|
16256
|
+
const text = typeof argumentText === "string" ? argumentText.trim() : "";
|
|
16257
|
+
return text ? `${descriptor.invocation} ${text}` : descriptor.invocation;
|
|
16258
|
+
}
|
|
16259
|
+
function mergeLiveHarnessCommands(builtIns, idPrefix, live, exclusions = {}) {
|
|
16260
|
+
if (!live)
|
|
16261
|
+
return builtIns;
|
|
16262
|
+
const invocations = new Set(builtIns.commands.map(({ invocation }) => invocation));
|
|
16263
|
+
const ids = new Set(builtIns.commands.map(({ id }) => id));
|
|
16264
|
+
const dynamic = [];
|
|
16265
|
+
for (const command of live) {
|
|
16266
|
+
const name = command.name.trim().replace(/^\//u, "");
|
|
16267
|
+
if (!name || /\s/u.test(name))
|
|
16268
|
+
continue;
|
|
16269
|
+
if (isExcludedLiveCommand(name, command.kind, exclusions))
|
|
16270
|
+
continue;
|
|
16271
|
+
const invocation = `/${name}`;
|
|
16272
|
+
const id = `${idPrefix}${name.replace(/[^A-Za-z0-9._:-]/gu, "-")}`.slice(0, 128);
|
|
16273
|
+
if (invocations.has(invocation) || ids.has(id))
|
|
16274
|
+
continue;
|
|
16275
|
+
const description = command.description?.trim().slice(0, 512);
|
|
16276
|
+
const parsed = harnessCommandDescriptorSchema.safeParse({
|
|
16277
|
+
id,
|
|
16278
|
+
invocation,
|
|
16279
|
+
label: name.slice(0, 128),
|
|
16280
|
+
...description ? { description } : {},
|
|
16281
|
+
argumentMode: "text",
|
|
16282
|
+
kind: command.kind
|
|
16283
|
+
});
|
|
16284
|
+
if (!parsed.success)
|
|
16285
|
+
continue;
|
|
16286
|
+
invocations.add(invocation);
|
|
16287
|
+
ids.add(id);
|
|
16288
|
+
dynamic.push(parsed.data);
|
|
16289
|
+
}
|
|
16290
|
+
return harnessCommandCatalogSchema.parse({ commands: [...builtIns.commands, ...dynamic] });
|
|
16291
|
+
}
|
|
16292
|
+
|
|
16293
|
+
// dist/omp-slash-commands.js
|
|
16294
|
+
var OMP_LIVE_COMMAND_ID_PREFIX = "omp.slash.";
|
|
16295
|
+
function isRecord2(value) {
|
|
16296
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16297
|
+
}
|
|
16298
|
+
function parseOmpAvailableCommands(value) {
|
|
16299
|
+
if (!Array.isArray(value))
|
|
16300
|
+
return [];
|
|
16301
|
+
return value.flatMap((entry) => {
|
|
16302
|
+
if (!isRecord2(entry))
|
|
16303
|
+
return [];
|
|
16304
|
+
const name = typeof entry.name === "string" ? entry.name.trim().replace(/^\//u, "") : "";
|
|
16305
|
+
if (!name)
|
|
16306
|
+
return [];
|
|
16307
|
+
return [
|
|
16308
|
+
{
|
|
16309
|
+
name,
|
|
16310
|
+
description: typeof entry.description === "string" ? entry.description : "",
|
|
16311
|
+
source: typeof entry.source === "string" ? entry.source : null
|
|
16312
|
+
}
|
|
16313
|
+
];
|
|
16314
|
+
});
|
|
16315
|
+
}
|
|
16316
|
+
function ompLiveCommands(native) {
|
|
16317
|
+
return native.filter(({ source }) => source !== "builtin").map((command) => ({
|
|
16318
|
+
name: command.name,
|
|
16319
|
+
description: command.description,
|
|
16320
|
+
kind: command.source === "skill" ? "skill" : "command"
|
|
16321
|
+
}));
|
|
16322
|
+
}
|
|
16323
|
+
|
|
16160
16324
|
// dist/omp-model-catalog.js
|
|
16161
16325
|
var OMP_MODEL_REF_PREFIX = "omp-model-v1.";
|
|
16162
16326
|
var OMP_DRAFT_THINKING_OPTION_IDS = [
|
|
@@ -16272,11 +16436,11 @@ function normalizeOmpModelCatalog(nativeModels, effectiveModel, thinkingLevels,
|
|
|
16272
16436
|
}
|
|
16273
16437
|
|
|
16274
16438
|
// dist/omp-tool-presentation.js
|
|
16275
|
-
function
|
|
16439
|
+
function isRecord3(value) {
|
|
16276
16440
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16277
16441
|
}
|
|
16278
16442
|
function stringField(value, key) {
|
|
16279
|
-
return
|
|
16443
|
+
return isRecord3(value) && typeof value[key] === "string" ? value[key] : void 0;
|
|
16280
16444
|
}
|
|
16281
16445
|
function toolCommand(toolName, argumentsValue) {
|
|
16282
16446
|
if (toolName === "bash") {
|
|
@@ -16298,7 +16462,7 @@ function projectOmpToolItem(input) {
|
|
|
16298
16462
|
|
|
16299
16463
|
// dist/omp-history.js
|
|
16300
16464
|
var ompHarnessId = harnessIdSchema.parse("omp");
|
|
16301
|
-
function
|
|
16465
|
+
function isRecord4(value) {
|
|
16302
16466
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16303
16467
|
}
|
|
16304
16468
|
function textContent(value) {
|
|
@@ -16306,12 +16470,12 @@ function textContent(value) {
|
|
|
16306
16470
|
return value;
|
|
16307
16471
|
if (!Array.isArray(value))
|
|
16308
16472
|
return "";
|
|
16309
|
-
return value.filter((part) =>
|
|
16473
|
+
return value.filter((part) => isRecord4(part) && part.type === "text" && typeof part.text === "string").map((part) => part.text).join("");
|
|
16310
16474
|
}
|
|
16311
16475
|
function thinkingContent(value) {
|
|
16312
16476
|
if (!Array.isArray(value))
|
|
16313
16477
|
return "";
|
|
16314
|
-
return value.filter((part) =>
|
|
16478
|
+
return value.filter((part) => isRecord4(part) && part.type === "thinking" && typeof part.thinking === "string").map((part) => part.thinking).join("");
|
|
16315
16479
|
}
|
|
16316
16480
|
function validatedEntry(value) {
|
|
16317
16481
|
if (typeof value.id !== "string" || value.id.length === 0 || value.parentId !== null && typeof value.parentId !== "string" || typeof value.type !== "string") {
|
|
@@ -16342,7 +16506,7 @@ function activeOmpEntries(history) {
|
|
|
16342
16506
|
return reversed.reverse();
|
|
16343
16507
|
}
|
|
16344
16508
|
function message(entry) {
|
|
16345
|
-
return entry.type === "message" &&
|
|
16509
|
+
return entry.type === "message" && isRecord4(entry.message) ? entry.message : null;
|
|
16346
16510
|
}
|
|
16347
16511
|
function messageRole(entry) {
|
|
16348
16512
|
const value = message(entry)?.role;
|
|
@@ -16404,7 +16568,7 @@ function snapshotItems(entries, outcome) {
|
|
|
16404
16568
|
let projectedText = false;
|
|
16405
16569
|
let projectedReasoning = false;
|
|
16406
16570
|
for (const [ordinal, part] of content.entries()) {
|
|
16407
|
-
if (!
|
|
16571
|
+
if (!isRecord4(part))
|
|
16408
16572
|
continue;
|
|
16409
16573
|
if (part.type === "thinking" && !projectedReasoning && reasoning.length > 0) {
|
|
16410
16574
|
const item2 = {
|
|
@@ -16849,14 +17013,14 @@ function resolveOmpExecutable(input, dependencies = {}) {
|
|
|
16849
17013
|
}
|
|
16850
17014
|
|
|
16851
17015
|
// dist/omp-usage.js
|
|
16852
|
-
function
|
|
17016
|
+
function isRecord5(value) {
|
|
16853
17017
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16854
17018
|
}
|
|
16855
17019
|
function nonNegativeSafeInteger(value) {
|
|
16856
17020
|
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0 ? value : null;
|
|
16857
17021
|
}
|
|
16858
17022
|
function optionalOmpCacheHitRatePercent(value) {
|
|
16859
|
-
if (!
|
|
17023
|
+
if (!isRecord5(value) || value.role !== "assistant" || !isRecord5(value.usage))
|
|
16860
17024
|
return null;
|
|
16861
17025
|
const input = nonNegativeSafeInteger(value.usage.input);
|
|
16862
17026
|
const cacheRead = nonNegativeSafeInteger(value.usage.cacheRead);
|
|
@@ -16869,20 +17033,20 @@ function optionalOmpCacheHitRatePercent(value) {
|
|
|
16869
17033
|
function latestOmpCacheHitRatePercent(history) {
|
|
16870
17034
|
let latest = null;
|
|
16871
17035
|
for (const entry of activeOmpEntries(history)) {
|
|
16872
|
-
if (entry.type === "message" &&
|
|
17036
|
+
if (entry.type === "message" && isRecord5(entry.message) && entry.message.role === "assistant") {
|
|
16873
17037
|
latest = optionalOmpCacheHitRatePercent(entry.message);
|
|
16874
17038
|
}
|
|
16875
17039
|
}
|
|
16876
17040
|
return latest;
|
|
16877
17041
|
}
|
|
16878
17042
|
function responseData(response, operation) {
|
|
16879
|
-
if (!
|
|
17043
|
+
if (!isRecord5(response.data)) {
|
|
16880
17044
|
throw new Error(`Omp RPC ${operation} response has no data`);
|
|
16881
17045
|
}
|
|
16882
17046
|
return response.data;
|
|
16883
17047
|
}
|
|
16884
17048
|
function contextUsage(value) {
|
|
16885
|
-
if (!
|
|
17049
|
+
if (!isRecord5(value))
|
|
16886
17050
|
throw new Error("Omp RPC context Usage is invalid");
|
|
16887
17051
|
return parseHostUsage({
|
|
16888
17052
|
contextUsedTokens: value.tokens,
|
|
@@ -16892,15 +17056,15 @@ function contextUsage(value) {
|
|
|
16892
17056
|
function parseOmpSessionUsage(response) {
|
|
16893
17057
|
const data = responseData(response, "Session stats");
|
|
16894
17058
|
const tokens = data.tokens;
|
|
16895
|
-
if (tokens !== void 0 && !
|
|
17059
|
+
if (tokens !== void 0 && !isRecord5(tokens)) {
|
|
16896
17060
|
throw new Error("Omp RPC Session stats tokens are invalid");
|
|
16897
17061
|
}
|
|
16898
17062
|
return parseHostUsage({
|
|
16899
|
-
...
|
|
16900
|
-
...
|
|
16901
|
-
...
|
|
16902
|
-
...
|
|
16903
|
-
...
|
|
17063
|
+
...isRecord5(tokens) && tokens.input !== void 0 ? { inputTokens: tokens.input } : {},
|
|
17064
|
+
...isRecord5(tokens) && tokens.cacheRead !== void 0 ? { cachedInputTokens: tokens.cacheRead } : {},
|
|
17065
|
+
...isRecord5(tokens) && tokens.cacheWrite !== void 0 ? { cacheWriteInputTokens: tokens.cacheWrite } : {},
|
|
17066
|
+
...isRecord5(tokens) && tokens.output !== void 0 ? { outputTokens: tokens.output } : {},
|
|
17067
|
+
...isRecord5(tokens) && tokens.total !== void 0 ? { totalTokens: tokens.total } : {},
|
|
16904
17068
|
...data.cost !== void 0 ? { totalCostUsd: data.cost } : {},
|
|
16905
17069
|
...data.contextUsage !== void 0 ? contextUsage(data.contextUsage) : {}
|
|
16906
17070
|
});
|
|
@@ -16925,11 +17089,11 @@ import { open, realpath } from "node:fs/promises";
|
|
|
16925
17089
|
import readline from "node:readline";
|
|
16926
17090
|
var MAX_SESSION_HEADER_BYTES = 64 * 1024;
|
|
16927
17091
|
var utf8Decoder = new TextDecoder("utf-8", { fatal: true });
|
|
16928
|
-
function
|
|
17092
|
+
function isRecord6(value) {
|
|
16929
17093
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16930
17094
|
}
|
|
16931
17095
|
function historyEntry(value) {
|
|
16932
|
-
if (!
|
|
17096
|
+
if (!isRecord6(value) || value.type === "title" || value.type === "session" || typeof value.id !== "string" || value.id.length === 0 || value.parentId !== null && typeof value.parentId !== "string" || typeof value.type !== "string") {
|
|
16933
17097
|
return null;
|
|
16934
17098
|
}
|
|
16935
17099
|
return value;
|
|
@@ -16982,7 +17146,7 @@ async function readOmpSessionHeader(sessionFile) {
|
|
|
16982
17146
|
} catch {
|
|
16983
17147
|
continue;
|
|
16984
17148
|
}
|
|
16985
|
-
if (!
|
|
17149
|
+
if (!isRecord6(parsed) || parsed.type !== "session")
|
|
16986
17150
|
continue;
|
|
16987
17151
|
if (typeof parsed.id !== "string" || parsed.id.length === 0 || typeof parsed.cwd !== "string" || parsed.cwd.length === 0) {
|
|
16988
17152
|
throw new Error("Omp Session header is invalid");
|
|
@@ -17106,7 +17270,7 @@ var OmpRpcUnsupportedCommandError = class extends Error {
|
|
|
17106
17270
|
}
|
|
17107
17271
|
};
|
|
17108
17272
|
var textDecoder = new TextDecoder("utf-8", { fatal: true });
|
|
17109
|
-
function
|
|
17273
|
+
function isRecord7(value) {
|
|
17110
17274
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
17111
17275
|
}
|
|
17112
17276
|
function message2(value) {
|
|
@@ -17118,13 +17282,13 @@ function nonBlankString(value) {
|
|
|
17118
17282
|
function parseNativeModel(value, context) {
|
|
17119
17283
|
if (value === null || value === void 0)
|
|
17120
17284
|
return null;
|
|
17121
|
-
if (!
|
|
17285
|
+
if (!isRecord7(value) || !nonBlankString(value.provider) || !nonBlankString(value.id)) {
|
|
17122
17286
|
throw new OmpRpcFaultError("protocolError", `Omp RPC returned an invalid ${context} Model`);
|
|
17123
17287
|
}
|
|
17124
17288
|
return { provider: value.provider, id: value.id };
|
|
17125
17289
|
}
|
|
17126
17290
|
function sessionStateData(response) {
|
|
17127
|
-
const data =
|
|
17291
|
+
const data = isRecord7(response.data) ? response.data : null;
|
|
17128
17292
|
if (!data)
|
|
17129
17293
|
throw new OmpRpcFaultError("protocolError", "Omp RPC state response has no data");
|
|
17130
17294
|
return data;
|
|
@@ -17139,7 +17303,7 @@ function parseSessionState(response) {
|
|
|
17139
17303
|
if (thinkingLevel !== null && !thinkingLevel.success) {
|
|
17140
17304
|
throw new OmpRpcFaultError("protocolError", "Omp RPC state has an invalid Thinking level");
|
|
17141
17305
|
}
|
|
17142
|
-
const thinking =
|
|
17306
|
+
const thinking = isRecord7(data.model) && isRecord7(data.model.thinking) ? data.model.thinking : null;
|
|
17143
17307
|
const availableThinkingLevels = thinking && Array.isArray(thinking.efforts) ? thinking.efforts.flatMap((level) => {
|
|
17144
17308
|
const parsed = harnessThinkingOptionIdSchema.safeParse(level);
|
|
17145
17309
|
return parsed.success ? [parsed.data] : [];
|
|
@@ -17162,25 +17326,25 @@ function parseSessionStreaming(response) {
|
|
|
17162
17326
|
return isStreaming;
|
|
17163
17327
|
}
|
|
17164
17328
|
function parseAvailableModels(response) {
|
|
17165
|
-
const data =
|
|
17329
|
+
const data = isRecord7(response.data) ? response.data : null;
|
|
17166
17330
|
if (!data || !Array.isArray(data.models)) {
|
|
17167
17331
|
throw new OmpRpcFaultError("protocolError", "Omp RPC Model catalog response has no models");
|
|
17168
17332
|
}
|
|
17169
17333
|
return data.models.map((model) => {
|
|
17170
17334
|
const parsed = parseNativeModel(model, "catalog");
|
|
17171
|
-
if (!parsed || !
|
|
17335
|
+
if (!parsed || !isRecord7(model) || typeof model.reasoning !== "boolean") {
|
|
17172
17336
|
throw new OmpRpcFaultError("protocolError", "Omp RPC catalog contains a Model without reasoning capability");
|
|
17173
17337
|
}
|
|
17174
17338
|
return { ...parsed, reasoning: model.reasoning };
|
|
17175
17339
|
});
|
|
17176
17340
|
}
|
|
17177
17341
|
function parseSubagentMessages(response) {
|
|
17178
|
-
const data =
|
|
17342
|
+
const data = isRecord7(response.data) ? response.data : null;
|
|
17179
17343
|
if (!data || !nonBlankString(data.sessionFile) || !Number.isSafeInteger(data.fromByte) || !Number.isSafeInteger(data.nextByte) || data.fromByte < 0 || data.nextByte < data.fromByte || typeof data.reset !== "boolean" || !Array.isArray(data.entries) || !Array.isArray(data.messages)) {
|
|
17180
17344
|
throw new OmpRpcFaultError("protocolError", "Omp RPC Subagent transcript response is invalid");
|
|
17181
17345
|
}
|
|
17182
|
-
const entries = data.entries.flatMap((value) =>
|
|
17183
|
-
const messages = data.messages.flatMap((value) =>
|
|
17346
|
+
const entries = data.entries.flatMap((value) => isRecord7(value) ? [value] : []);
|
|
17347
|
+
const messages = data.messages.flatMap((value) => isRecord7(value) ? [value] : []);
|
|
17184
17348
|
if (entries.length !== data.entries.length || messages.length !== data.messages.length) {
|
|
17185
17349
|
throw new OmpRpcFaultError("protocolError", "Omp RPC Subagent transcript contains invalid data");
|
|
17186
17350
|
}
|
|
@@ -17201,17 +17365,17 @@ function subagentStatus(value) {
|
|
|
17201
17365
|
throw new OmpRpcFaultError("protocolError", "Omp RPC Subagent status is invalid");
|
|
17202
17366
|
}
|
|
17203
17367
|
function assistantText(value) {
|
|
17204
|
-
if (!
|
|
17368
|
+
if (!isRecord7(value) || value.role !== "assistant" || !Array.isArray(value.content))
|
|
17205
17369
|
return null;
|
|
17206
|
-
return value.content.filter((content) =>
|
|
17370
|
+
return value.content.filter((content) => isRecord7(content) && content.type === "text" && typeof content.text === "string").map((content) => content.text).join("");
|
|
17207
17371
|
}
|
|
17208
17372
|
function assistantMessageId(value) {
|
|
17209
|
-
if (!
|
|
17373
|
+
if (!isRecord7(value) || value.role !== "assistant")
|
|
17210
17374
|
return null;
|
|
17211
17375
|
return nonBlankString(value.responseId) ? value.responseId : null;
|
|
17212
17376
|
}
|
|
17213
17377
|
function extractReasoningText(content) {
|
|
17214
|
-
if (!
|
|
17378
|
+
if (!isRecord7(content))
|
|
17215
17379
|
return null;
|
|
17216
17380
|
const type = String(content.type ?? "");
|
|
17217
17381
|
if (type === "thinking" || type === "reasoning" || type === "thought") {
|
|
@@ -17221,12 +17385,12 @@ function extractReasoningText(content) {
|
|
|
17221
17385
|
return null;
|
|
17222
17386
|
}
|
|
17223
17387
|
function assistantReasoning(value) {
|
|
17224
|
-
if (!
|
|
17388
|
+
if (!isRecord7(value) || value.role !== "assistant" || !Array.isArray(value.content))
|
|
17225
17389
|
return null;
|
|
17226
17390
|
return value.content.map(extractReasoningText).filter((text) => typeof text === "string").join("");
|
|
17227
17391
|
}
|
|
17228
17392
|
function assistantFailure(value) {
|
|
17229
|
-
if (!
|
|
17393
|
+
if (!isRecord7(value) || value.role !== "assistant")
|
|
17230
17394
|
return void 0;
|
|
17231
17395
|
if (value.stopReason !== "error" && value.stopReason !== "aborted")
|
|
17232
17396
|
return null;
|
|
@@ -17246,7 +17410,7 @@ function signalProcessTree(child, signal) {
|
|
|
17246
17410
|
try {
|
|
17247
17411
|
process.kill(-child.pid, signal);
|
|
17248
17412
|
} catch (error51) {
|
|
17249
|
-
if (!
|
|
17413
|
+
if (!isRecord7(error51) || error51.code !== "ESRCH")
|
|
17250
17414
|
throw error51;
|
|
17251
17415
|
}
|
|
17252
17416
|
}
|
|
@@ -17323,6 +17487,7 @@ var OmpRpcSession = class {
|
|
|
17323
17487
|
#failed = false;
|
|
17324
17488
|
#pending = /* @__PURE__ */ new Map();
|
|
17325
17489
|
#state = null;
|
|
17490
|
+
#availableCommands = null;
|
|
17326
17491
|
#latestCacheHitRatePercent;
|
|
17327
17492
|
#manualCompaction = null;
|
|
17328
17493
|
#stderrTail = "";
|
|
@@ -17383,7 +17548,7 @@ var OmpRpcSession = class {
|
|
|
17383
17548
|
this.#stderrTail = sanitizeDiagnosticTail(`${this.#stderrTail}${chunk.toString()}`);
|
|
17384
17549
|
});
|
|
17385
17550
|
child.once("error", (error51) => {
|
|
17386
|
-
const kind =
|
|
17551
|
+
const kind = isRecord7(error51) && error51.code === "ENOENT" ? "notInstalled" : "unavailable";
|
|
17387
17552
|
this.#fail(new OmpRpcFaultError(kind, `Omp RPC failed to start: ${error51.message}`, this.stderrTail));
|
|
17388
17553
|
});
|
|
17389
17554
|
child.once("exit", (code, signal) => {
|
|
@@ -17418,17 +17583,17 @@ var OmpRpcSession = class {
|
|
|
17418
17583
|
return await readOmpSessionHistory(this.state.sessionFile);
|
|
17419
17584
|
}
|
|
17420
17585
|
const response = await this.#send("get_messages", {});
|
|
17421
|
-
const data =
|
|
17586
|
+
const data = isRecord7(response.data) ? response.data : null;
|
|
17422
17587
|
if (!data || !Array.isArray(data.messages)) {
|
|
17423
17588
|
throw new OmpRpcFaultError("protocolError", "Omp RPC messages response has no messages");
|
|
17424
17589
|
}
|
|
17425
17590
|
let branchEntryIds = null;
|
|
17426
17591
|
try {
|
|
17427
17592
|
const branchResponse = await this.#send("get_branch_messages", {});
|
|
17428
|
-
const branchData =
|
|
17593
|
+
const branchData = isRecord7(branchResponse.data) ? branchResponse.data : null;
|
|
17429
17594
|
if (branchData && Array.isArray(branchData.messages)) {
|
|
17430
17595
|
const parsed = branchData.messages.flatMap((entry) => {
|
|
17431
|
-
if (!
|
|
17596
|
+
if (!isRecord7(entry) || !nonBlankString(entry.entryId))
|
|
17432
17597
|
return [];
|
|
17433
17598
|
return [entry.entryId];
|
|
17434
17599
|
});
|
|
@@ -17442,11 +17607,11 @@ var OmpRpcSession = class {
|
|
|
17442
17607
|
let userIndex = 0;
|
|
17443
17608
|
let parentId = null;
|
|
17444
17609
|
const entries = data.messages.map((nativeMessage, index) => {
|
|
17445
|
-
const role =
|
|
17610
|
+
const role = isRecord7(nativeMessage) ? nativeMessage.role : void 0;
|
|
17446
17611
|
const branchId = role === "user" ? branchEntryIds?.[userIndex] : void 0;
|
|
17447
17612
|
if (branchId)
|
|
17448
17613
|
userIndex += 1;
|
|
17449
|
-
const id = branchId ?? (
|
|
17614
|
+
const id = branchId ?? (isRecord7(nativeMessage) && nonBlankString(nativeMessage.id) ? nativeMessage.id : `omp-message-${index}`);
|
|
17450
17615
|
const entry = { id, parentId, type: "message", message: nativeMessage };
|
|
17451
17616
|
parentId = id;
|
|
17452
17617
|
return entry;
|
|
@@ -17526,7 +17691,7 @@ var OmpRpcSession = class {
|
|
|
17526
17691
|
throw new Error("Omp RPC Fork requires an Entry identity");
|
|
17527
17692
|
try {
|
|
17528
17693
|
const response = await this.#send("branch", { entryId });
|
|
17529
|
-
const data =
|
|
17694
|
+
const data = isRecord7(response.data) ? response.data : null;
|
|
17530
17695
|
if (!data || data.cancelled === true) {
|
|
17531
17696
|
throw new OmpRpcFaultError("unavailable", "Omp RPC Fork was cancelled");
|
|
17532
17697
|
}
|
|
@@ -17719,7 +17884,7 @@ var OmpRpcSession = class {
|
|
|
17719
17884
|
continue;
|
|
17720
17885
|
}
|
|
17721
17886
|
const value = decoded;
|
|
17722
|
-
if (!
|
|
17887
|
+
if (!isRecord7(value) || typeof value.type !== "string") {
|
|
17723
17888
|
throw new OmpRpcFaultError("protocolError", "Omp RPC returned an invalid envelope");
|
|
17724
17889
|
}
|
|
17725
17890
|
this.#handle(value);
|
|
@@ -17729,9 +17894,17 @@ var OmpRpcSession = class {
|
|
|
17729
17894
|
newline = this.#buffer.indexOf(10);
|
|
17730
17895
|
}
|
|
17731
17896
|
}
|
|
17897
|
+
/** Latest `available_commands_update` of the running process, if any. */
|
|
17898
|
+
get availableCommands() {
|
|
17899
|
+
return this.#availableCommands;
|
|
17900
|
+
}
|
|
17732
17901
|
#handle(value) {
|
|
17733
17902
|
if (this.#closed || this.#failed)
|
|
17734
17903
|
return;
|
|
17904
|
+
if (value.type === "available_commands_update") {
|
|
17905
|
+
this.#availableCommands = parseOmpAvailableCommands(value.commands);
|
|
17906
|
+
return;
|
|
17907
|
+
}
|
|
17735
17908
|
if (value.type === "ready") {
|
|
17736
17909
|
this.#readyResolve?.();
|
|
17737
17910
|
this.#readyResolve = null;
|
|
@@ -17770,7 +17943,7 @@ var OmpRpcSession = class {
|
|
|
17770
17943
|
this.#armCommandTimeout(id, pending);
|
|
17771
17944
|
}
|
|
17772
17945
|
}
|
|
17773
|
-
const outcome = value.aborted === true ? "cancelled" :
|
|
17946
|
+
const outcome = value.aborted === true ? "cancelled" : isRecord7(value.result) ? "succeeded" : "failed";
|
|
17774
17947
|
const event = {
|
|
17775
17948
|
type: "compaction.completed",
|
|
17776
17949
|
outcome,
|
|
@@ -17803,12 +17976,12 @@ var OmpRpcSession = class {
|
|
|
17803
17976
|
this.#startAssistantMessage(active, value.message);
|
|
17804
17977
|
return;
|
|
17805
17978
|
}
|
|
17806
|
-
if (value.type === "message_update" &&
|
|
17979
|
+
if (value.type === "message_update" && isRecord7(value.assistantMessageEvent)) {
|
|
17807
17980
|
const event = value.assistantMessageEvent;
|
|
17808
17981
|
const eventType = String(event.type ?? "");
|
|
17809
17982
|
const isThinking = eventType === "thinking_delta" || eventType === "reasoning_delta" || eventType === "thought_delta" || eventType === "thinking" || eventType === "reasoning";
|
|
17810
17983
|
const isText = eventType === "text_delta" || eventType === "text" || eventType === "content_block_delta";
|
|
17811
|
-
const delta = typeof event.delta === "string" ? event.delta : typeof event.thinking === "string" ? event.thinking : typeof event.reasoning === "string" ? event.reasoning : typeof event.text === "string" ? event.text :
|
|
17984
|
+
const delta = typeof event.delta === "string" ? event.delta : typeof event.thinking === "string" ? event.thinking : typeof event.reasoning === "string" ? event.reasoning : typeof event.text === "string" ? event.text : isRecord7(event.delta) && typeof event.delta.thinking === "string" ? event.delta.thinking : isRecord7(event.delta) && typeof event.delta.text === "string" ? event.delta.text : null;
|
|
17812
17985
|
if (isThinking && delta !== null && delta.length > 0) {
|
|
17813
17986
|
const messageId = this.#ensureAssistantMessage(active, value.message);
|
|
17814
17987
|
active.reasoningMessageOpen = true;
|
|
@@ -17848,7 +18021,7 @@ var OmpRpcSession = class {
|
|
|
17848
18021
|
if (value.type === "agent_end" && Array.isArray(value.messages)) {
|
|
17849
18022
|
for (let index = value.messages.length - 1; index >= 0; index -= 1) {
|
|
17850
18023
|
const message3 = value.messages[index];
|
|
17851
|
-
if (!
|
|
18024
|
+
if (!isRecord7(message3) || message3.role !== "assistant")
|
|
17852
18025
|
continue;
|
|
17853
18026
|
this.#finalizeAssistantMessage(active, message3);
|
|
17854
18027
|
break;
|
|
@@ -17865,8 +18038,8 @@ var OmpRpcSession = class {
|
|
|
17865
18038
|
if (value.type !== "subagent_lifecycle" && value.type !== "subagent_progress" && value.type !== "subagent_event") {
|
|
17866
18039
|
return false;
|
|
17867
18040
|
}
|
|
17868
|
-
const payload =
|
|
17869
|
-
const progressPayload = value.type === "subagent_progress" && payload &&
|
|
18041
|
+
const payload = isRecord7(value.payload) ? value.payload : null;
|
|
18042
|
+
const progressPayload = value.type === "subagent_progress" && payload && isRecord7(payload.progress) ? payload.progress : null;
|
|
17870
18043
|
const nativeIdValue = progressPayload?.id ?? payload?.id;
|
|
17871
18044
|
if (!payload || !nonBlankString(nativeIdValue)) {
|
|
17872
18045
|
throw new OmpRpcFaultError("protocolError", "Omp RPC Subagent frame has no stable ID");
|
|
@@ -18443,7 +18616,7 @@ var ompCommandCatalog = harnessCommandCatalogSchema.parse({
|
|
|
18443
18616
|
]
|
|
18444
18617
|
});
|
|
18445
18618
|
var DEFAULT_TOOL_OUTPUT_LIMIT = 64e3;
|
|
18446
|
-
function
|
|
18619
|
+
function isRecord8(value) {
|
|
18447
18620
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
18448
18621
|
}
|
|
18449
18622
|
function errorMessage(error51) {
|
|
@@ -18458,7 +18631,7 @@ var OmpAdapterFaultError = class extends Error {
|
|
|
18458
18631
|
}
|
|
18459
18632
|
};
|
|
18460
18633
|
function normalizedError(error51, fallbackCode) {
|
|
18461
|
-
if (
|
|
18634
|
+
if (isRecord8(error51) && error51.code === "ENOENT") {
|
|
18462
18635
|
return { code: "notInstalled", message: errorMessage(error51), retryable: false };
|
|
18463
18636
|
}
|
|
18464
18637
|
if (error51 instanceof OmpAdapterFaultError)
|
|
@@ -18535,7 +18708,7 @@ function nativeModelForHistory(state) {
|
|
|
18535
18708
|
return nativeModelFromState(state);
|
|
18536
18709
|
}
|
|
18537
18710
|
function sessionFileFromRef(ref) {
|
|
18538
|
-
if (ref.harnessId !== ompHarnessId2 || !
|
|
18711
|
+
if (ref.harnessId !== ompHarnessId2 || !isRecord8(ref.locator) || typeof ref.locator.sessionFile !== "string" || ref.locator.sessionFile.length === 0) {
|
|
18539
18712
|
throw new Error("Omp Native Session Ref has no resumable Session file");
|
|
18540
18713
|
}
|
|
18541
18714
|
return ref.locator.sessionFile;
|
|
@@ -18550,9 +18723,9 @@ function toolFailure(toolName) {
|
|
|
18550
18723
|
function nativeText(value) {
|
|
18551
18724
|
if (typeof value === "string")
|
|
18552
18725
|
return value;
|
|
18553
|
-
if (!
|
|
18726
|
+
if (!isRecord8(value) || !Array.isArray(value.content))
|
|
18554
18727
|
return "";
|
|
18555
|
-
return value.content.filter((content) =>
|
|
18728
|
+
return value.content.filter((content) => isRecord8(content) && content.type === "text" && typeof content.text === "string").map(({ text }) => text).join("");
|
|
18556
18729
|
}
|
|
18557
18730
|
function boundedOutput(value, limit) {
|
|
18558
18731
|
const text = nativeText(value);
|
|
@@ -18568,17 +18741,17 @@ function outputText(output) {
|
|
|
18568
18741
|
return output?.content.filter((content) => content.type === "text").map(({ text }) => text).join("") ?? "";
|
|
18569
18742
|
}
|
|
18570
18743
|
function stringField2(value, key) {
|
|
18571
|
-
if (!
|
|
18744
|
+
if (!isRecord8(value))
|
|
18572
18745
|
return void 0;
|
|
18573
18746
|
const field = value[key];
|
|
18574
18747
|
if (typeof field === "string" && field.length > 0)
|
|
18575
18748
|
return field;
|
|
18576
|
-
if (
|
|
18749
|
+
if (isRecord8(value.input)) {
|
|
18577
18750
|
const nested = value.input[key];
|
|
18578
18751
|
if (typeof nested === "string" && nested.length > 0)
|
|
18579
18752
|
return nested;
|
|
18580
18753
|
}
|
|
18581
|
-
if (
|
|
18754
|
+
if (isRecord8(value.arguments)) {
|
|
18582
18755
|
const nested = value.arguments[key];
|
|
18583
18756
|
if (typeof nested === "string" && nested.length > 0)
|
|
18584
18757
|
return nested;
|
|
@@ -18586,7 +18759,7 @@ function stringField2(value, key) {
|
|
|
18586
18759
|
return void 0;
|
|
18587
18760
|
}
|
|
18588
18761
|
function numberField(value, key) {
|
|
18589
|
-
if (!
|
|
18762
|
+
if (!isRecord8(value))
|
|
18590
18763
|
return void 0;
|
|
18591
18764
|
const field = value[key];
|
|
18592
18765
|
return typeof field === "number" || field === null ? field : void 0;
|
|
@@ -18625,7 +18798,7 @@ function fileMutatingKind(toolName) {
|
|
|
18625
18798
|
return null;
|
|
18626
18799
|
}
|
|
18627
18800
|
function nestedToolString(value, keys) {
|
|
18628
|
-
if (!
|
|
18801
|
+
if (!isRecord8(value))
|
|
18629
18802
|
return void 0;
|
|
18630
18803
|
for (const key of keys) {
|
|
18631
18804
|
const field = value[key];
|
|
@@ -18640,14 +18813,14 @@ function nestedToolString(value, keys) {
|
|
|
18640
18813
|
return void 0;
|
|
18641
18814
|
}
|
|
18642
18815
|
function patchFromResult(result) {
|
|
18643
|
-
if (!
|
|
18816
|
+
if (!isRecord8(result))
|
|
18644
18817
|
return void 0;
|
|
18645
18818
|
for (const key of ["patch", "diff", "unifiedDiff"]) {
|
|
18646
18819
|
const field = result[key];
|
|
18647
18820
|
if (typeof field === "string" && field.length > 0)
|
|
18648
18821
|
return field;
|
|
18649
18822
|
}
|
|
18650
|
-
if (
|
|
18823
|
+
if (isRecord8(result.details)) {
|
|
18651
18824
|
for (const key of ["patch", "diff", "unifiedDiff"]) {
|
|
18652
18825
|
const field = result.details[key];
|
|
18653
18826
|
if (typeof field === "string" && field.length > 0)
|
|
@@ -18798,7 +18971,7 @@ var OmpHarnessSession = class {
|
|
|
18798
18971
|
subagents: { observe: true, readTranscript: true }
|
|
18799
18972
|
};
|
|
18800
18973
|
this.commands = {
|
|
18801
|
-
list: async () => ({ ok: true, value:
|
|
18974
|
+
list: async () => ({ ok: true, value: this.#liveCommandCatalog() }),
|
|
18802
18975
|
execute: (command) => this.#executeHarnessCommand(command)
|
|
18803
18976
|
};
|
|
18804
18977
|
this.#transport = options.startedTransport ?? null;
|
|
@@ -19446,7 +19619,24 @@ var OmpHarnessSession = class {
|
|
|
19446
19619
|
return { ok: false, error: normalized };
|
|
19447
19620
|
}
|
|
19448
19621
|
}
|
|
19622
|
+
/**
|
|
19623
|
+
* Built-ins plus the skills and extension commands of the running process.
|
|
19624
|
+
* Never starts the process just to list commands.
|
|
19625
|
+
*/
|
|
19626
|
+
#liveCommandCatalog() {
|
|
19627
|
+
const native = this.#transport?.availableCommands ?? null;
|
|
19628
|
+
return mergeLiveHarnessCommands(ompCommandCatalog, OMP_LIVE_COMMAND_ID_PREFIX, native ? ompLiveCommands(native) : null);
|
|
19629
|
+
}
|
|
19449
19630
|
async #executeHarnessCommand(command) {
|
|
19631
|
+
const livePrompt = liveHarnessCommandPrompt(this.#liveCommandCatalog(), OMP_LIVE_COMMAND_ID_PREFIX, command.commandId, command.arguments?.text);
|
|
19632
|
+
if (livePrompt !== null) {
|
|
19633
|
+
const started = await this.execute({
|
|
19634
|
+
type: "turn.start",
|
|
19635
|
+
turnId: command.turnId,
|
|
19636
|
+
input: [{ type: "text", text: livePrompt }]
|
|
19637
|
+
});
|
|
19638
|
+
return started.ok ? { ok: true, value: { turnId: command.turnId } } : started;
|
|
19639
|
+
}
|
|
19450
19640
|
if (command.commandId !== "omp.compact") {
|
|
19451
19641
|
return {
|
|
19452
19642
|
ok: false,
|
|
@@ -20110,6 +20300,7 @@ var OmpHarnessSession = class {
|
|
|
20110
20300
|
};
|
|
20111
20301
|
var OmpAdapter = class {
|
|
20112
20302
|
commandCatalog = ompCommandCatalog;
|
|
20303
|
+
liveCommandCatalog = true;
|
|
20113
20304
|
harnessId = ompHarnessId2;
|
|
20114
20305
|
subagents = {
|
|
20115
20306
|
readSnapshot: async (input) => {
|