@codexhost/cli-win32-arm64 0.9.1 → 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.
@@ -15043,6 +15043,61 @@ function date4(params) {
15043
15043
  // ../../../node_modules/zod/v4/classic/external.js
15044
15044
  config(en_default());
15045
15045
 
15046
+ // ../../shared-contracts/dist/credential-imports.js
15047
+ var credentialSourceSchema = external_exports.object({
15048
+ id: external_exports.string().min(1).max(256),
15049
+ harnessId: external_exports.string().min(1),
15050
+ label: external_exports.string().min(1).max(512),
15051
+ provider: external_exports.enum(["openai-codex", "xai"])
15052
+ }).strict();
15053
+ var credentialImportNameSchema = external_exports.string().regex(/^[a-z][a-z0-9-]{0,47}$/);
15054
+ var credentialImportRecordSchema = external_exports.object({
15055
+ name: credentialImportNameSchema,
15056
+ source: credentialSourceSchema,
15057
+ importedAt: external_exports.string()
15058
+ }).strict();
15059
+ var credentialImportsRequestSchema = external_exports.discriminatedUnion("action", [
15060
+ external_exports.object({ action: external_exports.literal("list") }).strict(),
15061
+ external_exports.object({
15062
+ action: external_exports.literal("import"),
15063
+ sourceId: external_exports.string().min(1).max(256),
15064
+ name: credentialImportNameSchema,
15065
+ confirmed: external_exports.literal(true)
15066
+ }).strict(),
15067
+ external_exports.object({
15068
+ action: external_exports.literal("reimport"),
15069
+ sourceId: external_exports.string().min(1).max(256),
15070
+ name: credentialImportNameSchema,
15071
+ confirmed: external_exports.literal(true)
15072
+ }).strict(),
15073
+ external_exports.object({
15074
+ action: external_exports.literal("remove"),
15075
+ name: credentialImportNameSchema,
15076
+ confirmed: external_exports.literal(true)
15077
+ }).strict()
15078
+ ]);
15079
+ var credentialOtherLoginSchema = external_exports.object({
15080
+ provider: external_exports.string().min(1).max(128),
15081
+ type: external_exports.enum(["oauth", "api_key", "unknown"]),
15082
+ /** Best-effort account label (e.g. the email in a Codex token), derived locally when present. */
15083
+ label: external_exports.string().min(1).max(512).optional(),
15084
+ /** Recognized credential vendor, derived from the OAuth token issuer. Absent when unknown. */
15085
+ vendor: external_exports.enum(["openai-codex", "xai"]).optional()
15086
+ }).strict();
15087
+ var credentialImportsResultSchema = external_exports.object({
15088
+ sources: external_exports.array(credentialSourceSchema),
15089
+ targets: external_exports.array(external_exports.object({
15090
+ harnessId: external_exports.string(),
15091
+ providers: external_exports.array(external_exports.enum(["openai-codex", "xai"])),
15092
+ imports: external_exports.array(credentialImportRecordSchema),
15093
+ others: external_exports.array(credentialOtherLoginSchema).default([])
15094
+ }).strict())
15095
+ }).strict();
15096
+ var credentialImportsParamsSchema = external_exports.object({
15097
+ targetHarnessId: external_exports.string().min(1).max(128).optional(),
15098
+ request: credentialImportsRequestSchema
15099
+ }).strict();
15100
+
15046
15101
  // ../../shared-contracts/dist/version.js
15047
15102
  var WORKSPACE_CONTRACT_VERSION = 1;
15048
15103
 
@@ -15746,10 +15801,21 @@ var harnessCommandDescriptorSchema = external_exports.object({
15746
15801
  invocation: commandInvocationSchema,
15747
15802
  label: commandLabelSchema,
15748
15803
  description: commandDescriptionSchema.optional(),
15749
- 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()
15750
15810
  }).strict();
15751
15811
  var harnessCommandCatalogSchema = external_exports.object({
15752
- 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()
15753
15819
  }).strict().superRefine((catalog, context) => {
15754
15820
  const ids = /* @__PURE__ */ new Set();
15755
15821
  for (const [index, command] of catalog.commands.entries()) {
@@ -15763,7 +15829,11 @@ var harnessCommandCatalogSchema = external_exports.object({
15763
15829
  ids.add(command.id);
15764
15830
  }
15765
15831
  });
15766
- var harnessCommandsInspectParamsSchema = external_exports.object({ harnessId: harnessIdSchema }).strict();
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();
15767
15837
  var threadCommandsInspectParamsSchema = external_exports.object({
15768
15838
  threadId: hostThreadIdSchema
15769
15839
  }).strict();
@@ -16102,6 +16172,155 @@ function parseHostUsage(value) {
16102
16172
  return { ...value };
16103
16173
  }
16104
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
+
16105
16324
  // dist/omp-model-catalog.js
16106
16325
  var OMP_MODEL_REF_PREFIX = "omp-model-v1.";
16107
16326
  var OMP_DRAFT_THINKING_OPTION_IDS = [
@@ -16217,11 +16436,11 @@ function normalizeOmpModelCatalog(nativeModels, effectiveModel, thinkingLevels,
16217
16436
  }
16218
16437
 
16219
16438
  // dist/omp-tool-presentation.js
16220
- function isRecord2(value) {
16439
+ function isRecord3(value) {
16221
16440
  return typeof value === "object" && value !== null && !Array.isArray(value);
16222
16441
  }
16223
16442
  function stringField(value, key) {
16224
- return isRecord2(value) && typeof value[key] === "string" ? value[key] : void 0;
16443
+ return isRecord3(value) && typeof value[key] === "string" ? value[key] : void 0;
16225
16444
  }
16226
16445
  function toolCommand(toolName, argumentsValue) {
16227
16446
  if (toolName === "bash") {
@@ -16243,7 +16462,7 @@ function projectOmpToolItem(input) {
16243
16462
 
16244
16463
  // dist/omp-history.js
16245
16464
  var ompHarnessId = harnessIdSchema.parse("omp");
16246
- function isRecord3(value) {
16465
+ function isRecord4(value) {
16247
16466
  return typeof value === "object" && value !== null && !Array.isArray(value);
16248
16467
  }
16249
16468
  function textContent(value) {
@@ -16251,12 +16470,12 @@ function textContent(value) {
16251
16470
  return value;
16252
16471
  if (!Array.isArray(value))
16253
16472
  return "";
16254
- return value.filter((part) => isRecord3(part) && part.type === "text" && typeof part.text === "string").map((part) => part.text).join("");
16473
+ return value.filter((part) => isRecord4(part) && part.type === "text" && typeof part.text === "string").map((part) => part.text).join("");
16255
16474
  }
16256
16475
  function thinkingContent(value) {
16257
16476
  if (!Array.isArray(value))
16258
16477
  return "";
16259
- return value.filter((part) => isRecord3(part) && part.type === "thinking" && typeof part.thinking === "string").map((part) => part.thinking).join("");
16478
+ return value.filter((part) => isRecord4(part) && part.type === "thinking" && typeof part.thinking === "string").map((part) => part.thinking).join("");
16260
16479
  }
16261
16480
  function validatedEntry(value) {
16262
16481
  if (typeof value.id !== "string" || value.id.length === 0 || value.parentId !== null && typeof value.parentId !== "string" || typeof value.type !== "string") {
@@ -16287,7 +16506,7 @@ function activeOmpEntries(history) {
16287
16506
  return reversed.reverse();
16288
16507
  }
16289
16508
  function message(entry) {
16290
- return entry.type === "message" && isRecord3(entry.message) ? entry.message : null;
16509
+ return entry.type === "message" && isRecord4(entry.message) ? entry.message : null;
16291
16510
  }
16292
16511
  function messageRole(entry) {
16293
16512
  const value = message(entry)?.role;
@@ -16349,7 +16568,7 @@ function snapshotItems(entries, outcome) {
16349
16568
  let projectedText = false;
16350
16569
  let projectedReasoning = false;
16351
16570
  for (const [ordinal, part] of content.entries()) {
16352
- if (!isRecord3(part))
16571
+ if (!isRecord4(part))
16353
16572
  continue;
16354
16573
  if (part.type === "thinking" && !projectedReasoning && reasoning.length > 0) {
16355
16574
  const item2 = {
@@ -16794,14 +17013,14 @@ function resolveOmpExecutable(input, dependencies = {}) {
16794
17013
  }
16795
17014
 
16796
17015
  // dist/omp-usage.js
16797
- function isRecord4(value) {
17016
+ function isRecord5(value) {
16798
17017
  return typeof value === "object" && value !== null && !Array.isArray(value);
16799
17018
  }
16800
17019
  function nonNegativeSafeInteger(value) {
16801
17020
  return typeof value === "number" && Number.isSafeInteger(value) && value >= 0 ? value : null;
16802
17021
  }
16803
17022
  function optionalOmpCacheHitRatePercent(value) {
16804
- if (!isRecord4(value) || value.role !== "assistant" || !isRecord4(value.usage))
17023
+ if (!isRecord5(value) || value.role !== "assistant" || !isRecord5(value.usage))
16805
17024
  return null;
16806
17025
  const input = nonNegativeSafeInteger(value.usage.input);
16807
17026
  const cacheRead = nonNegativeSafeInteger(value.usage.cacheRead);
@@ -16814,20 +17033,20 @@ function optionalOmpCacheHitRatePercent(value) {
16814
17033
  function latestOmpCacheHitRatePercent(history) {
16815
17034
  let latest = null;
16816
17035
  for (const entry of activeOmpEntries(history)) {
16817
- if (entry.type === "message" && isRecord4(entry.message) && entry.message.role === "assistant") {
17036
+ if (entry.type === "message" && isRecord5(entry.message) && entry.message.role === "assistant") {
16818
17037
  latest = optionalOmpCacheHitRatePercent(entry.message);
16819
17038
  }
16820
17039
  }
16821
17040
  return latest;
16822
17041
  }
16823
17042
  function responseData(response, operation) {
16824
- if (!isRecord4(response.data)) {
17043
+ if (!isRecord5(response.data)) {
16825
17044
  throw new Error(`Omp RPC ${operation} response has no data`);
16826
17045
  }
16827
17046
  return response.data;
16828
17047
  }
16829
17048
  function contextUsage(value) {
16830
- if (!isRecord4(value))
17049
+ if (!isRecord5(value))
16831
17050
  throw new Error("Omp RPC context Usage is invalid");
16832
17051
  return parseHostUsage({
16833
17052
  contextUsedTokens: value.tokens,
@@ -16837,15 +17056,15 @@ function contextUsage(value) {
16837
17056
  function parseOmpSessionUsage(response) {
16838
17057
  const data = responseData(response, "Session stats");
16839
17058
  const tokens = data.tokens;
16840
- if (tokens !== void 0 && !isRecord4(tokens)) {
17059
+ if (tokens !== void 0 && !isRecord5(tokens)) {
16841
17060
  throw new Error("Omp RPC Session stats tokens are invalid");
16842
17061
  }
16843
17062
  return parseHostUsage({
16844
- ...isRecord4(tokens) && tokens.input !== void 0 ? { inputTokens: tokens.input } : {},
16845
- ...isRecord4(tokens) && tokens.cacheRead !== void 0 ? { cachedInputTokens: tokens.cacheRead } : {},
16846
- ...isRecord4(tokens) && tokens.cacheWrite !== void 0 ? { cacheWriteInputTokens: tokens.cacheWrite } : {},
16847
- ...isRecord4(tokens) && tokens.output !== void 0 ? { outputTokens: tokens.output } : {},
16848
- ...isRecord4(tokens) && tokens.total !== void 0 ? { totalTokens: tokens.total } : {},
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 } : {},
16849
17068
  ...data.cost !== void 0 ? { totalCostUsd: data.cost } : {},
16850
17069
  ...data.contextUsage !== void 0 ? contextUsage(data.contextUsage) : {}
16851
17070
  });
@@ -16870,11 +17089,11 @@ import { open, realpath } from "node:fs/promises";
16870
17089
  import readline from "node:readline";
16871
17090
  var MAX_SESSION_HEADER_BYTES = 64 * 1024;
16872
17091
  var utf8Decoder = new TextDecoder("utf-8", { fatal: true });
16873
- function isRecord5(value) {
17092
+ function isRecord6(value) {
16874
17093
  return typeof value === "object" && value !== null && !Array.isArray(value);
16875
17094
  }
16876
17095
  function historyEntry(value) {
16877
- if (!isRecord5(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") {
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") {
16878
17097
  return null;
16879
17098
  }
16880
17099
  return value;
@@ -16927,7 +17146,7 @@ async function readOmpSessionHeader(sessionFile) {
16927
17146
  } catch {
16928
17147
  continue;
16929
17148
  }
16930
- if (!isRecord5(parsed) || parsed.type !== "session")
17149
+ if (!isRecord6(parsed) || parsed.type !== "session")
16931
17150
  continue;
16932
17151
  if (typeof parsed.id !== "string" || parsed.id.length === 0 || typeof parsed.cwd !== "string" || parsed.cwd.length === 0) {
16933
17152
  throw new Error("Omp Session header is invalid");
@@ -17051,7 +17270,7 @@ var OmpRpcUnsupportedCommandError = class extends Error {
17051
17270
  }
17052
17271
  };
17053
17272
  var textDecoder = new TextDecoder("utf-8", { fatal: true });
17054
- function isRecord6(value) {
17273
+ function isRecord7(value) {
17055
17274
  return typeof value === "object" && value !== null && !Array.isArray(value);
17056
17275
  }
17057
17276
  function message2(value) {
@@ -17063,13 +17282,13 @@ function nonBlankString(value) {
17063
17282
  function parseNativeModel(value, context) {
17064
17283
  if (value === null || value === void 0)
17065
17284
  return null;
17066
- if (!isRecord6(value) || !nonBlankString(value.provider) || !nonBlankString(value.id)) {
17285
+ if (!isRecord7(value) || !nonBlankString(value.provider) || !nonBlankString(value.id)) {
17067
17286
  throw new OmpRpcFaultError("protocolError", `Omp RPC returned an invalid ${context} Model`);
17068
17287
  }
17069
17288
  return { provider: value.provider, id: value.id };
17070
17289
  }
17071
17290
  function sessionStateData(response) {
17072
- const data = isRecord6(response.data) ? response.data : null;
17291
+ const data = isRecord7(response.data) ? response.data : null;
17073
17292
  if (!data)
17074
17293
  throw new OmpRpcFaultError("protocolError", "Omp RPC state response has no data");
17075
17294
  return data;
@@ -17084,7 +17303,7 @@ function parseSessionState(response) {
17084
17303
  if (thinkingLevel !== null && !thinkingLevel.success) {
17085
17304
  throw new OmpRpcFaultError("protocolError", "Omp RPC state has an invalid Thinking level");
17086
17305
  }
17087
- const thinking = isRecord6(data.model) && isRecord6(data.model.thinking) ? data.model.thinking : null;
17306
+ const thinking = isRecord7(data.model) && isRecord7(data.model.thinking) ? data.model.thinking : null;
17088
17307
  const availableThinkingLevels = thinking && Array.isArray(thinking.efforts) ? thinking.efforts.flatMap((level) => {
17089
17308
  const parsed = harnessThinkingOptionIdSchema.safeParse(level);
17090
17309
  return parsed.success ? [parsed.data] : [];
@@ -17107,25 +17326,25 @@ function parseSessionStreaming(response) {
17107
17326
  return isStreaming;
17108
17327
  }
17109
17328
  function parseAvailableModels(response) {
17110
- const data = isRecord6(response.data) ? response.data : null;
17329
+ const data = isRecord7(response.data) ? response.data : null;
17111
17330
  if (!data || !Array.isArray(data.models)) {
17112
17331
  throw new OmpRpcFaultError("protocolError", "Omp RPC Model catalog response has no models");
17113
17332
  }
17114
17333
  return data.models.map((model) => {
17115
17334
  const parsed = parseNativeModel(model, "catalog");
17116
- if (!parsed || !isRecord6(model) || typeof model.reasoning !== "boolean") {
17335
+ if (!parsed || !isRecord7(model) || typeof model.reasoning !== "boolean") {
17117
17336
  throw new OmpRpcFaultError("protocolError", "Omp RPC catalog contains a Model without reasoning capability");
17118
17337
  }
17119
17338
  return { ...parsed, reasoning: model.reasoning };
17120
17339
  });
17121
17340
  }
17122
17341
  function parseSubagentMessages(response) {
17123
- const data = isRecord6(response.data) ? response.data : null;
17342
+ const data = isRecord7(response.data) ? response.data : null;
17124
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)) {
17125
17344
  throw new OmpRpcFaultError("protocolError", "Omp RPC Subagent transcript response is invalid");
17126
17345
  }
17127
- const entries = data.entries.flatMap((value) => isRecord6(value) ? [value] : []);
17128
- const messages = data.messages.flatMap((value) => isRecord6(value) ? [value] : []);
17346
+ const entries = data.entries.flatMap((value) => isRecord7(value) ? [value] : []);
17347
+ const messages = data.messages.flatMap((value) => isRecord7(value) ? [value] : []);
17129
17348
  if (entries.length !== data.entries.length || messages.length !== data.messages.length) {
17130
17349
  throw new OmpRpcFaultError("protocolError", "Omp RPC Subagent transcript contains invalid data");
17131
17350
  }
@@ -17146,17 +17365,17 @@ function subagentStatus(value) {
17146
17365
  throw new OmpRpcFaultError("protocolError", "Omp RPC Subagent status is invalid");
17147
17366
  }
17148
17367
  function assistantText(value) {
17149
- if (!isRecord6(value) || value.role !== "assistant" || !Array.isArray(value.content))
17368
+ if (!isRecord7(value) || value.role !== "assistant" || !Array.isArray(value.content))
17150
17369
  return null;
17151
- return value.content.filter((content) => isRecord6(content) && content.type === "text" && typeof content.text === "string").map((content) => content.text).join("");
17370
+ return value.content.filter((content) => isRecord7(content) && content.type === "text" && typeof content.text === "string").map((content) => content.text).join("");
17152
17371
  }
17153
17372
  function assistantMessageId(value) {
17154
- if (!isRecord6(value) || value.role !== "assistant")
17373
+ if (!isRecord7(value) || value.role !== "assistant")
17155
17374
  return null;
17156
17375
  return nonBlankString(value.responseId) ? value.responseId : null;
17157
17376
  }
17158
17377
  function extractReasoningText(content) {
17159
- if (!isRecord6(content))
17378
+ if (!isRecord7(content))
17160
17379
  return null;
17161
17380
  const type = String(content.type ?? "");
17162
17381
  if (type === "thinking" || type === "reasoning" || type === "thought") {
@@ -17166,12 +17385,12 @@ function extractReasoningText(content) {
17166
17385
  return null;
17167
17386
  }
17168
17387
  function assistantReasoning(value) {
17169
- if (!isRecord6(value) || value.role !== "assistant" || !Array.isArray(value.content))
17388
+ if (!isRecord7(value) || value.role !== "assistant" || !Array.isArray(value.content))
17170
17389
  return null;
17171
17390
  return value.content.map(extractReasoningText).filter((text) => typeof text === "string").join("");
17172
17391
  }
17173
17392
  function assistantFailure(value) {
17174
- if (!isRecord6(value) || value.role !== "assistant")
17393
+ if (!isRecord7(value) || value.role !== "assistant")
17175
17394
  return void 0;
17176
17395
  if (value.stopReason !== "error" && value.stopReason !== "aborted")
17177
17396
  return null;
@@ -17191,7 +17410,7 @@ function signalProcessTree(child, signal) {
17191
17410
  try {
17192
17411
  process.kill(-child.pid, signal);
17193
17412
  } catch (error51) {
17194
- if (!isRecord6(error51) || error51.code !== "ESRCH")
17413
+ if (!isRecord7(error51) || error51.code !== "ESRCH")
17195
17414
  throw error51;
17196
17415
  }
17197
17416
  }
@@ -17268,6 +17487,7 @@ var OmpRpcSession = class {
17268
17487
  #failed = false;
17269
17488
  #pending = /* @__PURE__ */ new Map();
17270
17489
  #state = null;
17490
+ #availableCommands = null;
17271
17491
  #latestCacheHitRatePercent;
17272
17492
  #manualCompaction = null;
17273
17493
  #stderrTail = "";
@@ -17328,7 +17548,7 @@ var OmpRpcSession = class {
17328
17548
  this.#stderrTail = sanitizeDiagnosticTail(`${this.#stderrTail}${chunk.toString()}`);
17329
17549
  });
17330
17550
  child.once("error", (error51) => {
17331
- const kind = isRecord6(error51) && error51.code === "ENOENT" ? "notInstalled" : "unavailable";
17551
+ const kind = isRecord7(error51) && error51.code === "ENOENT" ? "notInstalled" : "unavailable";
17332
17552
  this.#fail(new OmpRpcFaultError(kind, `Omp RPC failed to start: ${error51.message}`, this.stderrTail));
17333
17553
  });
17334
17554
  child.once("exit", (code, signal) => {
@@ -17363,17 +17583,17 @@ var OmpRpcSession = class {
17363
17583
  return await readOmpSessionHistory(this.state.sessionFile);
17364
17584
  }
17365
17585
  const response = await this.#send("get_messages", {});
17366
- const data = isRecord6(response.data) ? response.data : null;
17586
+ const data = isRecord7(response.data) ? response.data : null;
17367
17587
  if (!data || !Array.isArray(data.messages)) {
17368
17588
  throw new OmpRpcFaultError("protocolError", "Omp RPC messages response has no messages");
17369
17589
  }
17370
17590
  let branchEntryIds = null;
17371
17591
  try {
17372
17592
  const branchResponse = await this.#send("get_branch_messages", {});
17373
- const branchData = isRecord6(branchResponse.data) ? branchResponse.data : null;
17593
+ const branchData = isRecord7(branchResponse.data) ? branchResponse.data : null;
17374
17594
  if (branchData && Array.isArray(branchData.messages)) {
17375
17595
  const parsed = branchData.messages.flatMap((entry) => {
17376
- if (!isRecord6(entry) || !nonBlankString(entry.entryId))
17596
+ if (!isRecord7(entry) || !nonBlankString(entry.entryId))
17377
17597
  return [];
17378
17598
  return [entry.entryId];
17379
17599
  });
@@ -17387,11 +17607,11 @@ var OmpRpcSession = class {
17387
17607
  let userIndex = 0;
17388
17608
  let parentId = null;
17389
17609
  const entries = data.messages.map((nativeMessage, index) => {
17390
- const role = isRecord6(nativeMessage) ? nativeMessage.role : void 0;
17610
+ const role = isRecord7(nativeMessage) ? nativeMessage.role : void 0;
17391
17611
  const branchId = role === "user" ? branchEntryIds?.[userIndex] : void 0;
17392
17612
  if (branchId)
17393
17613
  userIndex += 1;
17394
- const id = branchId ?? (isRecord6(nativeMessage) && nonBlankString(nativeMessage.id) ? nativeMessage.id : `omp-message-${index}`);
17614
+ const id = branchId ?? (isRecord7(nativeMessage) && nonBlankString(nativeMessage.id) ? nativeMessage.id : `omp-message-${index}`);
17395
17615
  const entry = { id, parentId, type: "message", message: nativeMessage };
17396
17616
  parentId = id;
17397
17617
  return entry;
@@ -17471,7 +17691,7 @@ var OmpRpcSession = class {
17471
17691
  throw new Error("Omp RPC Fork requires an Entry identity");
17472
17692
  try {
17473
17693
  const response = await this.#send("branch", { entryId });
17474
- const data = isRecord6(response.data) ? response.data : null;
17694
+ const data = isRecord7(response.data) ? response.data : null;
17475
17695
  if (!data || data.cancelled === true) {
17476
17696
  throw new OmpRpcFaultError("unavailable", "Omp RPC Fork was cancelled");
17477
17697
  }
@@ -17664,7 +17884,7 @@ var OmpRpcSession = class {
17664
17884
  continue;
17665
17885
  }
17666
17886
  const value = decoded;
17667
- if (!isRecord6(value) || typeof value.type !== "string") {
17887
+ if (!isRecord7(value) || typeof value.type !== "string") {
17668
17888
  throw new OmpRpcFaultError("protocolError", "Omp RPC returned an invalid envelope");
17669
17889
  }
17670
17890
  this.#handle(value);
@@ -17674,9 +17894,17 @@ var OmpRpcSession = class {
17674
17894
  newline = this.#buffer.indexOf(10);
17675
17895
  }
17676
17896
  }
17897
+ /** Latest `available_commands_update` of the running process, if any. */
17898
+ get availableCommands() {
17899
+ return this.#availableCommands;
17900
+ }
17677
17901
  #handle(value) {
17678
17902
  if (this.#closed || this.#failed)
17679
17903
  return;
17904
+ if (value.type === "available_commands_update") {
17905
+ this.#availableCommands = parseOmpAvailableCommands(value.commands);
17906
+ return;
17907
+ }
17680
17908
  if (value.type === "ready") {
17681
17909
  this.#readyResolve?.();
17682
17910
  this.#readyResolve = null;
@@ -17715,7 +17943,7 @@ var OmpRpcSession = class {
17715
17943
  this.#armCommandTimeout(id, pending);
17716
17944
  }
17717
17945
  }
17718
- const outcome = value.aborted === true ? "cancelled" : isRecord6(value.result) ? "succeeded" : "failed";
17946
+ const outcome = value.aborted === true ? "cancelled" : isRecord7(value.result) ? "succeeded" : "failed";
17719
17947
  const event = {
17720
17948
  type: "compaction.completed",
17721
17949
  outcome,
@@ -17748,12 +17976,12 @@ var OmpRpcSession = class {
17748
17976
  this.#startAssistantMessage(active, value.message);
17749
17977
  return;
17750
17978
  }
17751
- if (value.type === "message_update" && isRecord6(value.assistantMessageEvent)) {
17979
+ if (value.type === "message_update" && isRecord7(value.assistantMessageEvent)) {
17752
17980
  const event = value.assistantMessageEvent;
17753
17981
  const eventType = String(event.type ?? "");
17754
17982
  const isThinking = eventType === "thinking_delta" || eventType === "reasoning_delta" || eventType === "thought_delta" || eventType === "thinking" || eventType === "reasoning";
17755
17983
  const isText = eventType === "text_delta" || eventType === "text" || eventType === "content_block_delta";
17756
- 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 : isRecord6(event.delta) && typeof event.delta.thinking === "string" ? event.delta.thinking : isRecord6(event.delta) && typeof event.delta.text === "string" ? event.delta.text : null;
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;
17757
17985
  if (isThinking && delta !== null && delta.length > 0) {
17758
17986
  const messageId = this.#ensureAssistantMessage(active, value.message);
17759
17987
  active.reasoningMessageOpen = true;
@@ -17793,7 +18021,7 @@ var OmpRpcSession = class {
17793
18021
  if (value.type === "agent_end" && Array.isArray(value.messages)) {
17794
18022
  for (let index = value.messages.length - 1; index >= 0; index -= 1) {
17795
18023
  const message3 = value.messages[index];
17796
- if (!isRecord6(message3) || message3.role !== "assistant")
18024
+ if (!isRecord7(message3) || message3.role !== "assistant")
17797
18025
  continue;
17798
18026
  this.#finalizeAssistantMessage(active, message3);
17799
18027
  break;
@@ -17810,8 +18038,8 @@ var OmpRpcSession = class {
17810
18038
  if (value.type !== "subagent_lifecycle" && value.type !== "subagent_progress" && value.type !== "subagent_event") {
17811
18039
  return false;
17812
18040
  }
17813
- const payload = isRecord6(value.payload) ? value.payload : null;
17814
- const progressPayload = value.type === "subagent_progress" && payload && isRecord6(payload.progress) ? payload.progress : null;
18041
+ const payload = isRecord7(value.payload) ? value.payload : null;
18042
+ const progressPayload = value.type === "subagent_progress" && payload && isRecord7(payload.progress) ? payload.progress : null;
17815
18043
  const nativeIdValue = progressPayload?.id ?? payload?.id;
17816
18044
  if (!payload || !nonBlankString(nativeIdValue)) {
17817
18045
  throw new OmpRpcFaultError("protocolError", "Omp RPC Subagent frame has no stable ID");
@@ -18388,7 +18616,7 @@ var ompCommandCatalog = harnessCommandCatalogSchema.parse({
18388
18616
  ]
18389
18617
  });
18390
18618
  var DEFAULT_TOOL_OUTPUT_LIMIT = 64e3;
18391
- function isRecord7(value) {
18619
+ function isRecord8(value) {
18392
18620
  return typeof value === "object" && value !== null && !Array.isArray(value);
18393
18621
  }
18394
18622
  function errorMessage(error51) {
@@ -18403,7 +18631,7 @@ var OmpAdapterFaultError = class extends Error {
18403
18631
  }
18404
18632
  };
18405
18633
  function normalizedError(error51, fallbackCode) {
18406
- if (isRecord7(error51) && error51.code === "ENOENT") {
18634
+ if (isRecord8(error51) && error51.code === "ENOENT") {
18407
18635
  return { code: "notInstalled", message: errorMessage(error51), retryable: false };
18408
18636
  }
18409
18637
  if (error51 instanceof OmpAdapterFaultError)
@@ -18480,7 +18708,7 @@ function nativeModelForHistory(state) {
18480
18708
  return nativeModelFromState(state);
18481
18709
  }
18482
18710
  function sessionFileFromRef(ref) {
18483
- if (ref.harnessId !== ompHarnessId2 || !isRecord7(ref.locator) || typeof ref.locator.sessionFile !== "string" || ref.locator.sessionFile.length === 0) {
18711
+ if (ref.harnessId !== ompHarnessId2 || !isRecord8(ref.locator) || typeof ref.locator.sessionFile !== "string" || ref.locator.sessionFile.length === 0) {
18484
18712
  throw new Error("Omp Native Session Ref has no resumable Session file");
18485
18713
  }
18486
18714
  return ref.locator.sessionFile;
@@ -18495,9 +18723,9 @@ function toolFailure(toolName) {
18495
18723
  function nativeText(value) {
18496
18724
  if (typeof value === "string")
18497
18725
  return value;
18498
- if (!isRecord7(value) || !Array.isArray(value.content))
18726
+ if (!isRecord8(value) || !Array.isArray(value.content))
18499
18727
  return "";
18500
- return value.content.filter((content) => isRecord7(content) && content.type === "text" && typeof content.text === "string").map(({ text }) => text).join("");
18728
+ return value.content.filter((content) => isRecord8(content) && content.type === "text" && typeof content.text === "string").map(({ text }) => text).join("");
18501
18729
  }
18502
18730
  function boundedOutput(value, limit) {
18503
18731
  const text = nativeText(value);
@@ -18513,17 +18741,17 @@ function outputText(output) {
18513
18741
  return output?.content.filter((content) => content.type === "text").map(({ text }) => text).join("") ?? "";
18514
18742
  }
18515
18743
  function stringField2(value, key) {
18516
- if (!isRecord7(value))
18744
+ if (!isRecord8(value))
18517
18745
  return void 0;
18518
18746
  const field = value[key];
18519
18747
  if (typeof field === "string" && field.length > 0)
18520
18748
  return field;
18521
- if (isRecord7(value.input)) {
18749
+ if (isRecord8(value.input)) {
18522
18750
  const nested = value.input[key];
18523
18751
  if (typeof nested === "string" && nested.length > 0)
18524
18752
  return nested;
18525
18753
  }
18526
- if (isRecord7(value.arguments)) {
18754
+ if (isRecord8(value.arguments)) {
18527
18755
  const nested = value.arguments[key];
18528
18756
  if (typeof nested === "string" && nested.length > 0)
18529
18757
  return nested;
@@ -18531,7 +18759,7 @@ function stringField2(value, key) {
18531
18759
  return void 0;
18532
18760
  }
18533
18761
  function numberField(value, key) {
18534
- if (!isRecord7(value))
18762
+ if (!isRecord8(value))
18535
18763
  return void 0;
18536
18764
  const field = value[key];
18537
18765
  return typeof field === "number" || field === null ? field : void 0;
@@ -18570,7 +18798,7 @@ function fileMutatingKind(toolName) {
18570
18798
  return null;
18571
18799
  }
18572
18800
  function nestedToolString(value, keys) {
18573
- if (!isRecord7(value))
18801
+ if (!isRecord8(value))
18574
18802
  return void 0;
18575
18803
  for (const key of keys) {
18576
18804
  const field = value[key];
@@ -18585,14 +18813,14 @@ function nestedToolString(value, keys) {
18585
18813
  return void 0;
18586
18814
  }
18587
18815
  function patchFromResult(result) {
18588
- if (!isRecord7(result))
18816
+ if (!isRecord8(result))
18589
18817
  return void 0;
18590
18818
  for (const key of ["patch", "diff", "unifiedDiff"]) {
18591
18819
  const field = result[key];
18592
18820
  if (typeof field === "string" && field.length > 0)
18593
18821
  return field;
18594
18822
  }
18595
- if (isRecord7(result.details)) {
18823
+ if (isRecord8(result.details)) {
18596
18824
  for (const key of ["patch", "diff", "unifiedDiff"]) {
18597
18825
  const field = result.details[key];
18598
18826
  if (typeof field === "string" && field.length > 0)
@@ -18743,7 +18971,7 @@ var OmpHarnessSession = class {
18743
18971
  subagents: { observe: true, readTranscript: true }
18744
18972
  };
18745
18973
  this.commands = {
18746
- list: async () => ({ ok: true, value: ompCommandCatalog }),
18974
+ list: async () => ({ ok: true, value: this.#liveCommandCatalog() }),
18747
18975
  execute: (command) => this.#executeHarnessCommand(command)
18748
18976
  };
18749
18977
  this.#transport = options.startedTransport ?? null;
@@ -19391,7 +19619,24 @@ var OmpHarnessSession = class {
19391
19619
  return { ok: false, error: normalized };
19392
19620
  }
19393
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
+ }
19394
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
+ }
19395
19640
  if (command.commandId !== "omp.compact") {
19396
19641
  return {
19397
19642
  ok: false,
@@ -20055,6 +20300,7 @@ var OmpHarnessSession = class {
20055
20300
  };
20056
20301
  var OmpAdapter = class {
20057
20302
  commandCatalog = ompCommandCatalog;
20303
+ liveCommandCatalog = true;
20058
20304
  harnessId = ompHarnessId2;
20059
20305
  subagents = {
20060
20306
  readSnapshot: async (input) => {