@liberseek/boft-cli-win32-arm64 0.7.1 → 0.7.3

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.
@@ -15825,10 +15825,21 @@ var harnessCommandDescriptorSchema = external_exports.object({
15825
15825
  invocation: commandInvocationSchema,
15826
15826
  label: commandLabelSchema,
15827
15827
  description: commandDescriptionSchema.optional(),
15828
- argumentMode: external_exports.enum(["none", "text"])
15828
+ argumentMode: external_exports.enum(["none", "text"]),
15829
+ /**
15830
+ * Native distinction reported by the Harness. Omitted when the Harness does
15831
+ * not tell skills and commands apart; consumers treat that as "command".
15832
+ */
15833
+ kind: external_exports.enum(["command", "skill"]).optional()
15829
15834
  }).strict();
15830
15835
  var harnessCommandCatalogSchema = external_exports.object({
15831
- commands: external_exports.array(harnessCommandDescriptorSchema)
15836
+ commands: external_exports.array(harnessCommandDescriptorSchema),
15837
+ /**
15838
+ * `live` when the catalog includes what a native Session reports for its
15839
+ * workspace (custom commands, skills); `static` for Adapter built-ins only.
15840
+ * Omitted by Adapters; set by the Host on inspection results.
15841
+ */
15842
+ source: external_exports.enum(["live", "static"]).optional()
15832
15843
  }).strict().superRefine((catalog, context) => {
15833
15844
  const ids = /* @__PURE__ */ new Set();
15834
15845
  for (const [index, command] of catalog.commands.entries()) {
@@ -15842,7 +15853,11 @@ var harnessCommandCatalogSchema = external_exports.object({
15842
15853
  ids.add(command.id);
15843
15854
  }
15844
15855
  });
15845
- var harnessCommandsInspectParamsSchema = external_exports.object({ harnessId: harnessIdSchema }).strict();
15856
+ var harnessCommandsInspectParamsSchema = external_exports.object({
15857
+ harnessId: harnessIdSchema,
15858
+ /** Workspace of a draft without a Thread, for its live catalog when known. */
15859
+ cwd: external_exports.string().min(1).optional()
15860
+ }).strict();
15846
15861
  var threadCommandsInspectParamsSchema = external_exports.object({
15847
15862
  threadId: hostThreadIdSchema
15848
15863
  }).strict();
@@ -16187,6 +16202,155 @@ function parseHostUsage(value) {
16187
16202
  return { ...value };
16188
16203
  }
16189
16204
 
16205
+ // ../../harness-adapter/dist/live-command-catalog.js
16206
+ var COMMON_EXCLUDED_LIVE_COMMANDS = /* @__PURE__ */ new Set([
16207
+ // Session lifecycle
16208
+ "branch",
16209
+ "clear",
16210
+ "exit",
16211
+ "fork",
16212
+ "fresh",
16213
+ "new",
16214
+ "quit",
16215
+ "rename",
16216
+ "rename-chat",
16217
+ "reset",
16218
+ "resume",
16219
+ "rewind",
16220
+ "session",
16221
+ "sessions",
16222
+ // Desktop-owned configuration
16223
+ "autocompact",
16224
+ "color",
16225
+ "config",
16226
+ "effort",
16227
+ "fast",
16228
+ "keybindings",
16229
+ "model",
16230
+ "models",
16231
+ "output-style",
16232
+ "permissions",
16233
+ "settings",
16234
+ "statusline",
16235
+ "terminal-setup",
16236
+ "theme",
16237
+ "vim",
16238
+ // Trust and approval policy
16239
+ "always-approve",
16240
+ "auto-mode-setup",
16241
+ // Native login
16242
+ "login",
16243
+ "logout",
16244
+ // Work outliving the Turn
16245
+ "autopilot",
16246
+ "background",
16247
+ "bg",
16248
+ "goal",
16249
+ "jobs",
16250
+ "loop",
16251
+ "multitask",
16252
+ "queue",
16253
+ "remote-control",
16254
+ "schedule",
16255
+ "steer",
16256
+ // Native terminal UI
16257
+ "copy",
16258
+ "debug",
16259
+ "feedback",
16260
+ "heapdump",
16261
+ "share",
16262
+ "shell",
16263
+ // Plugin and MCP management
16264
+ "marketplace",
16265
+ "mcp",
16266
+ "plugins",
16267
+ "reload-plugins"
16268
+ ]);
16269
+ var COMMON_EXCLUDED_LIVE_COMMAND_PREFIXES = ["__", "hooks-"];
16270
+ function isExcludedLiveCommand(name, kind, extra = {}) {
16271
+ const normalized = name.trim().replace(/^\//u, "");
16272
+ if (new Set(extra.names ?? []).has(normalized))
16273
+ return true;
16274
+ if (extra.prefixes?.some((prefix) => normalized.startsWith(prefix)))
16275
+ return true;
16276
+ if (kind === "skill")
16277
+ return false;
16278
+ return COMMON_EXCLUDED_LIVE_COMMANDS.has(normalized) || COMMON_EXCLUDED_LIVE_COMMAND_PREFIXES.some((prefix) => normalized.startsWith(prefix));
16279
+ }
16280
+ function liveHarnessCommandPrompt(catalog, idPrefix, commandId, argumentText) {
16281
+ if (!commandId.startsWith(idPrefix))
16282
+ return null;
16283
+ const descriptor = catalog.commands.find(({ id }) => id === commandId);
16284
+ if (!descriptor)
16285
+ return null;
16286
+ const text = typeof argumentText === "string" ? argumentText.trim() : "";
16287
+ return text ? `${descriptor.invocation} ${text}` : descriptor.invocation;
16288
+ }
16289
+ function mergeLiveHarnessCommands(builtIns, idPrefix, live, exclusions = {}) {
16290
+ if (!live)
16291
+ return builtIns;
16292
+ const invocations = new Set(builtIns.commands.map(({ invocation }) => invocation));
16293
+ const ids = new Set(builtIns.commands.map(({ id }) => id));
16294
+ const dynamic = [];
16295
+ for (const command of live) {
16296
+ const name = command.name.trim().replace(/^\//u, "");
16297
+ if (!name || /\s/u.test(name))
16298
+ continue;
16299
+ if (isExcludedLiveCommand(name, command.kind, exclusions))
16300
+ continue;
16301
+ const invocation = `/${name}`;
16302
+ const id = `${idPrefix}${name.replace(/[^A-Za-z0-9._:-]/gu, "-")}`.slice(0, 128);
16303
+ if (invocations.has(invocation) || ids.has(id))
16304
+ continue;
16305
+ const description = command.description?.trim().slice(0, 512);
16306
+ const parsed = harnessCommandDescriptorSchema.safeParse({
16307
+ id,
16308
+ invocation,
16309
+ label: name.slice(0, 128),
16310
+ ...description ? { description } : {},
16311
+ argumentMode: "text",
16312
+ kind: command.kind
16313
+ });
16314
+ if (!parsed.success)
16315
+ continue;
16316
+ invocations.add(invocation);
16317
+ ids.add(id);
16318
+ dynamic.push(parsed.data);
16319
+ }
16320
+ return harnessCommandCatalogSchema.parse({ commands: [...builtIns.commands, ...dynamic] });
16321
+ }
16322
+
16323
+ // dist/omp-slash-commands.js
16324
+ var OMP_LIVE_COMMAND_ID_PREFIX = "omp.slash.";
16325
+ function isRecord2(value) {
16326
+ return typeof value === "object" && value !== null && !Array.isArray(value);
16327
+ }
16328
+ function parseOmpAvailableCommands(value) {
16329
+ if (!Array.isArray(value))
16330
+ return [];
16331
+ return value.flatMap((entry) => {
16332
+ if (!isRecord2(entry))
16333
+ return [];
16334
+ const name = typeof entry.name === "string" ? entry.name.trim().replace(/^\//u, "") : "";
16335
+ if (!name)
16336
+ return [];
16337
+ return [
16338
+ {
16339
+ name,
16340
+ description: typeof entry.description === "string" ? entry.description : "",
16341
+ source: typeof entry.source === "string" ? entry.source : null
16342
+ }
16343
+ ];
16344
+ });
16345
+ }
16346
+ function ompLiveCommands(native) {
16347
+ return native.filter(({ source }) => source !== "builtin").map((command) => ({
16348
+ name: command.name,
16349
+ description: command.description,
16350
+ kind: command.source === "skill" ? "skill" : "command"
16351
+ }));
16352
+ }
16353
+
16190
16354
  // dist/omp-model-catalog.js
16191
16355
  var OMP_MODEL_REF_PREFIX = "omp-model-v1.";
16192
16356
  var OMP_DRAFT_THINKING_OPTION_IDS = [
@@ -16302,11 +16466,11 @@ function normalizeOmpModelCatalog(nativeModels, effectiveModel, thinkingLevels,
16302
16466
  }
16303
16467
 
16304
16468
  // dist/omp-tool-presentation.js
16305
- function isRecord2(value) {
16469
+ function isRecord3(value) {
16306
16470
  return typeof value === "object" && value !== null && !Array.isArray(value);
16307
16471
  }
16308
16472
  function stringField(value, key) {
16309
- return isRecord2(value) && typeof value[key] === "string" ? value[key] : void 0;
16473
+ return isRecord3(value) && typeof value[key] === "string" ? value[key] : void 0;
16310
16474
  }
16311
16475
  function toolCommand(toolName, argumentsValue) {
16312
16476
  if (toolName === "bash") {
@@ -16328,7 +16492,7 @@ function projectOmpToolItem(input) {
16328
16492
 
16329
16493
  // dist/omp-history.js
16330
16494
  var ompHarnessId = harnessIdSchema.parse("omp");
16331
- function isRecord3(value) {
16495
+ function isRecord4(value) {
16332
16496
  return typeof value === "object" && value !== null && !Array.isArray(value);
16333
16497
  }
16334
16498
  function textContent(value) {
@@ -16336,12 +16500,12 @@ function textContent(value) {
16336
16500
  return value;
16337
16501
  if (!Array.isArray(value))
16338
16502
  return "";
16339
- return value.filter((part) => isRecord3(part) && part.type === "text" && typeof part.text === "string").map((part) => part.text).join("");
16503
+ return value.filter((part) => isRecord4(part) && part.type === "text" && typeof part.text === "string").map((part) => part.text).join("");
16340
16504
  }
16341
16505
  function thinkingContent(value) {
16342
16506
  if (!Array.isArray(value))
16343
16507
  return "";
16344
- return value.filter((part) => isRecord3(part) && part.type === "thinking" && typeof part.thinking === "string").map((part) => part.thinking).join("");
16508
+ return value.filter((part) => isRecord4(part) && part.type === "thinking" && typeof part.thinking === "string").map((part) => part.thinking).join("");
16345
16509
  }
16346
16510
  function validatedEntry(value) {
16347
16511
  if (typeof value.id !== "string" || value.id.length === 0 || value.parentId !== null && typeof value.parentId !== "string" || typeof value.type !== "string") {
@@ -16372,7 +16536,7 @@ function activeOmpEntries(history) {
16372
16536
  return reversed.reverse();
16373
16537
  }
16374
16538
  function message(entry) {
16375
- return entry.type === "message" && isRecord3(entry.message) ? entry.message : null;
16539
+ return entry.type === "message" && isRecord4(entry.message) ? entry.message : null;
16376
16540
  }
16377
16541
  function messageRole(entry) {
16378
16542
  const value = message(entry)?.role;
@@ -16434,7 +16598,7 @@ function snapshotItems(entries, outcome) {
16434
16598
  let projectedText = false;
16435
16599
  let projectedReasoning = false;
16436
16600
  for (const [ordinal, part] of content.entries()) {
16437
- if (!isRecord3(part))
16601
+ if (!isRecord4(part))
16438
16602
  continue;
16439
16603
  if (part.type === "thinking" && !projectedReasoning && reasoning.length > 0) {
16440
16604
  const item2 = {
@@ -16879,14 +17043,14 @@ function resolveOmpExecutable(input, dependencies = {}) {
16879
17043
  }
16880
17044
 
16881
17045
  // dist/omp-usage.js
16882
- function isRecord4(value) {
17046
+ function isRecord5(value) {
16883
17047
  return typeof value === "object" && value !== null && !Array.isArray(value);
16884
17048
  }
16885
17049
  function nonNegativeSafeInteger(value) {
16886
17050
  return typeof value === "number" && Number.isSafeInteger(value) && value >= 0 ? value : null;
16887
17051
  }
16888
17052
  function optionalOmpCacheHitRatePercent(value) {
16889
- if (!isRecord4(value) || value.role !== "assistant" || !isRecord4(value.usage))
17053
+ if (!isRecord5(value) || value.role !== "assistant" || !isRecord5(value.usage))
16890
17054
  return null;
16891
17055
  const input = nonNegativeSafeInteger(value.usage.input);
16892
17056
  const cacheRead = nonNegativeSafeInteger(value.usage.cacheRead);
@@ -16899,20 +17063,20 @@ function optionalOmpCacheHitRatePercent(value) {
16899
17063
  function latestOmpCacheHitRatePercent(history) {
16900
17064
  let latest = null;
16901
17065
  for (const entry of activeOmpEntries(history)) {
16902
- if (entry.type === "message" && isRecord4(entry.message) && entry.message.role === "assistant") {
17066
+ if (entry.type === "message" && isRecord5(entry.message) && entry.message.role === "assistant") {
16903
17067
  latest = optionalOmpCacheHitRatePercent(entry.message);
16904
17068
  }
16905
17069
  }
16906
17070
  return latest;
16907
17071
  }
16908
17072
  function responseData(response, operation) {
16909
- if (!isRecord4(response.data)) {
17073
+ if (!isRecord5(response.data)) {
16910
17074
  throw new Error(`Omp RPC ${operation} response has no data`);
16911
17075
  }
16912
17076
  return response.data;
16913
17077
  }
16914
17078
  function contextUsage(value) {
16915
- if (!isRecord4(value))
17079
+ if (!isRecord5(value))
16916
17080
  throw new Error("Omp RPC context Usage is invalid");
16917
17081
  return parseHostUsage({
16918
17082
  contextUsedTokens: value.tokens,
@@ -16922,15 +17086,15 @@ function contextUsage(value) {
16922
17086
  function parseOmpSessionUsage(response) {
16923
17087
  const data = responseData(response, "Session stats");
16924
17088
  const tokens = data.tokens;
16925
- if (tokens !== void 0 && !isRecord4(tokens)) {
17089
+ if (tokens !== void 0 && !isRecord5(tokens)) {
16926
17090
  throw new Error("Omp RPC Session stats tokens are invalid");
16927
17091
  }
16928
17092
  return parseHostUsage({
16929
- ...isRecord4(tokens) && tokens.input !== void 0 ? { inputTokens: tokens.input } : {},
16930
- ...isRecord4(tokens) && tokens.cacheRead !== void 0 ? { cachedInputTokens: tokens.cacheRead } : {},
16931
- ...isRecord4(tokens) && tokens.cacheWrite !== void 0 ? { cacheWriteInputTokens: tokens.cacheWrite } : {},
16932
- ...isRecord4(tokens) && tokens.output !== void 0 ? { outputTokens: tokens.output } : {},
16933
- ...isRecord4(tokens) && tokens.total !== void 0 ? { totalTokens: tokens.total } : {},
17093
+ ...isRecord5(tokens) && tokens.input !== void 0 ? { inputTokens: tokens.input } : {},
17094
+ ...isRecord5(tokens) && tokens.cacheRead !== void 0 ? { cachedInputTokens: tokens.cacheRead } : {},
17095
+ ...isRecord5(tokens) && tokens.cacheWrite !== void 0 ? { cacheWriteInputTokens: tokens.cacheWrite } : {},
17096
+ ...isRecord5(tokens) && tokens.output !== void 0 ? { outputTokens: tokens.output } : {},
17097
+ ...isRecord5(tokens) && tokens.total !== void 0 ? { totalTokens: tokens.total } : {},
16934
17098
  ...data.cost !== void 0 ? { totalCostUsd: data.cost } : {},
16935
17099
  ...data.contextUsage !== void 0 ? contextUsage(data.contextUsage) : {}
16936
17100
  });
@@ -16955,11 +17119,11 @@ import { open, realpath } from "node:fs/promises";
16955
17119
  import readline from "node:readline";
16956
17120
  var MAX_SESSION_HEADER_BYTES = 64 * 1024;
16957
17121
  var utf8Decoder = new TextDecoder("utf-8", { fatal: true });
16958
- function isRecord5(value) {
17122
+ function isRecord6(value) {
16959
17123
  return typeof value === "object" && value !== null && !Array.isArray(value);
16960
17124
  }
16961
17125
  function historyEntry(value) {
16962
- 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") {
17126
+ 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") {
16963
17127
  return null;
16964
17128
  }
16965
17129
  return value;
@@ -17012,7 +17176,7 @@ async function readOmpSessionHeader(sessionFile) {
17012
17176
  } catch {
17013
17177
  continue;
17014
17178
  }
17015
- if (!isRecord5(parsed) || parsed.type !== "session")
17179
+ if (!isRecord6(parsed) || parsed.type !== "session")
17016
17180
  continue;
17017
17181
  if (typeof parsed.id !== "string" || parsed.id.length === 0 || typeof parsed.cwd !== "string" || parsed.cwd.length === 0) {
17018
17182
  throw new Error("Omp Session header is invalid");
@@ -17136,7 +17300,7 @@ var OmpRpcUnsupportedCommandError = class extends Error {
17136
17300
  }
17137
17301
  };
17138
17302
  var textDecoder = new TextDecoder("utf-8", { fatal: true });
17139
- function isRecord6(value) {
17303
+ function isRecord7(value) {
17140
17304
  return typeof value === "object" && value !== null && !Array.isArray(value);
17141
17305
  }
17142
17306
  function message2(value) {
@@ -17148,13 +17312,13 @@ function nonBlankString(value) {
17148
17312
  function parseNativeModel(value, context) {
17149
17313
  if (value === null || value === void 0)
17150
17314
  return null;
17151
- if (!isRecord6(value) || !nonBlankString(value.provider) || !nonBlankString(value.id)) {
17315
+ if (!isRecord7(value) || !nonBlankString(value.provider) || !nonBlankString(value.id)) {
17152
17316
  throw new OmpRpcFaultError("protocolError", `Omp RPC returned an invalid ${context} Model`);
17153
17317
  }
17154
17318
  return { provider: value.provider, id: value.id };
17155
17319
  }
17156
17320
  function sessionStateData(response) {
17157
- const data = isRecord6(response.data) ? response.data : null;
17321
+ const data = isRecord7(response.data) ? response.data : null;
17158
17322
  if (!data)
17159
17323
  throw new OmpRpcFaultError("protocolError", "Omp RPC state response has no data");
17160
17324
  return data;
@@ -17169,7 +17333,7 @@ function parseSessionState(response) {
17169
17333
  if (thinkingLevel !== null && !thinkingLevel.success) {
17170
17334
  throw new OmpRpcFaultError("protocolError", "Omp RPC state has an invalid Thinking level");
17171
17335
  }
17172
- const thinking = isRecord6(data.model) && isRecord6(data.model.thinking) ? data.model.thinking : null;
17336
+ const thinking = isRecord7(data.model) && isRecord7(data.model.thinking) ? data.model.thinking : null;
17173
17337
  const availableThinkingLevels = thinking && Array.isArray(thinking.efforts) ? thinking.efforts.flatMap((level) => {
17174
17338
  const parsed = harnessThinkingOptionIdSchema.safeParse(level);
17175
17339
  return parsed.success ? [parsed.data] : [];
@@ -17192,25 +17356,25 @@ function parseSessionStreaming(response) {
17192
17356
  return isStreaming;
17193
17357
  }
17194
17358
  function parseAvailableModels(response) {
17195
- const data = isRecord6(response.data) ? response.data : null;
17359
+ const data = isRecord7(response.data) ? response.data : null;
17196
17360
  if (!data || !Array.isArray(data.models)) {
17197
17361
  throw new OmpRpcFaultError("protocolError", "Omp RPC Model catalog response has no models");
17198
17362
  }
17199
17363
  return data.models.map((model) => {
17200
17364
  const parsed = parseNativeModel(model, "catalog");
17201
- if (!parsed || !isRecord6(model) || typeof model.reasoning !== "boolean") {
17365
+ if (!parsed || !isRecord7(model) || typeof model.reasoning !== "boolean") {
17202
17366
  throw new OmpRpcFaultError("protocolError", "Omp RPC catalog contains a Model without reasoning capability");
17203
17367
  }
17204
17368
  return { ...parsed, reasoning: model.reasoning };
17205
17369
  });
17206
17370
  }
17207
17371
  function parseSubagentMessages(response) {
17208
- const data = isRecord6(response.data) ? response.data : null;
17372
+ const data = isRecord7(response.data) ? response.data : null;
17209
17373
  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)) {
17210
17374
  throw new OmpRpcFaultError("protocolError", "Omp RPC Subagent transcript response is invalid");
17211
17375
  }
17212
- const entries = data.entries.flatMap((value) => isRecord6(value) ? [value] : []);
17213
- const messages = data.messages.flatMap((value) => isRecord6(value) ? [value] : []);
17376
+ const entries = data.entries.flatMap((value) => isRecord7(value) ? [value] : []);
17377
+ const messages = data.messages.flatMap((value) => isRecord7(value) ? [value] : []);
17214
17378
  if (entries.length !== data.entries.length || messages.length !== data.messages.length) {
17215
17379
  throw new OmpRpcFaultError("protocolError", "Omp RPC Subagent transcript contains invalid data");
17216
17380
  }
@@ -17231,17 +17395,17 @@ function subagentStatus(value) {
17231
17395
  throw new OmpRpcFaultError("protocolError", "Omp RPC Subagent status is invalid");
17232
17396
  }
17233
17397
  function assistantText(value) {
17234
- if (!isRecord6(value) || value.role !== "assistant" || !Array.isArray(value.content))
17398
+ if (!isRecord7(value) || value.role !== "assistant" || !Array.isArray(value.content))
17235
17399
  return null;
17236
- return value.content.filter((content) => isRecord6(content) && content.type === "text" && typeof content.text === "string").map((content) => content.text).join("");
17400
+ return value.content.filter((content) => isRecord7(content) && content.type === "text" && typeof content.text === "string").map((content) => content.text).join("");
17237
17401
  }
17238
17402
  function assistantMessageId(value) {
17239
- if (!isRecord6(value) || value.role !== "assistant")
17403
+ if (!isRecord7(value) || value.role !== "assistant")
17240
17404
  return null;
17241
17405
  return nonBlankString(value.responseId) ? value.responseId : null;
17242
17406
  }
17243
17407
  function extractReasoningText(content) {
17244
- if (!isRecord6(content))
17408
+ if (!isRecord7(content))
17245
17409
  return null;
17246
17410
  const type = String(content.type ?? "");
17247
17411
  if (type === "thinking" || type === "reasoning" || type === "thought") {
@@ -17251,12 +17415,12 @@ function extractReasoningText(content) {
17251
17415
  return null;
17252
17416
  }
17253
17417
  function assistantReasoning(value) {
17254
- if (!isRecord6(value) || value.role !== "assistant" || !Array.isArray(value.content))
17418
+ if (!isRecord7(value) || value.role !== "assistant" || !Array.isArray(value.content))
17255
17419
  return null;
17256
17420
  return value.content.map(extractReasoningText).filter((text) => typeof text === "string").join("");
17257
17421
  }
17258
17422
  function assistantFailure(value) {
17259
- if (!isRecord6(value) || value.role !== "assistant")
17423
+ if (!isRecord7(value) || value.role !== "assistant")
17260
17424
  return void 0;
17261
17425
  if (value.stopReason !== "error" && value.stopReason !== "aborted")
17262
17426
  return null;
@@ -17276,7 +17440,7 @@ function signalProcessTree(child, signal) {
17276
17440
  try {
17277
17441
  process.kill(-child.pid, signal);
17278
17442
  } catch (error51) {
17279
- if (!isRecord6(error51) || error51.code !== "ESRCH")
17443
+ if (!isRecord7(error51) || error51.code !== "ESRCH")
17280
17444
  throw error51;
17281
17445
  }
17282
17446
  }
@@ -17353,6 +17517,7 @@ var OmpRpcSession = class {
17353
17517
  #failed = false;
17354
17518
  #pending = /* @__PURE__ */ new Map();
17355
17519
  #state = null;
17520
+ #availableCommands = null;
17356
17521
  #latestCacheHitRatePercent;
17357
17522
  #manualCompaction = null;
17358
17523
  #stderrTail = "";
@@ -17413,7 +17578,7 @@ var OmpRpcSession = class {
17413
17578
  this.#stderrTail = sanitizeDiagnosticTail(`${this.#stderrTail}${chunk.toString()}`);
17414
17579
  });
17415
17580
  child.once("error", (error51) => {
17416
- const kind = isRecord6(error51) && error51.code === "ENOENT" ? "notInstalled" : "unavailable";
17581
+ const kind = isRecord7(error51) && error51.code === "ENOENT" ? "notInstalled" : "unavailable";
17417
17582
  this.#fail(new OmpRpcFaultError(kind, `Omp RPC failed to start: ${error51.message}`, this.stderrTail));
17418
17583
  });
17419
17584
  child.once("exit", (code, signal) => {
@@ -17448,17 +17613,17 @@ var OmpRpcSession = class {
17448
17613
  return await readOmpSessionHistory(this.state.sessionFile);
17449
17614
  }
17450
17615
  const response = await this.#send("get_messages", {});
17451
- const data = isRecord6(response.data) ? response.data : null;
17616
+ const data = isRecord7(response.data) ? response.data : null;
17452
17617
  if (!data || !Array.isArray(data.messages)) {
17453
17618
  throw new OmpRpcFaultError("protocolError", "Omp RPC messages response has no messages");
17454
17619
  }
17455
17620
  let branchEntryIds = null;
17456
17621
  try {
17457
17622
  const branchResponse = await this.#send("get_branch_messages", {});
17458
- const branchData = isRecord6(branchResponse.data) ? branchResponse.data : null;
17623
+ const branchData = isRecord7(branchResponse.data) ? branchResponse.data : null;
17459
17624
  if (branchData && Array.isArray(branchData.messages)) {
17460
17625
  const parsed = branchData.messages.flatMap((entry) => {
17461
- if (!isRecord6(entry) || !nonBlankString(entry.entryId))
17626
+ if (!isRecord7(entry) || !nonBlankString(entry.entryId))
17462
17627
  return [];
17463
17628
  return [entry.entryId];
17464
17629
  });
@@ -17472,11 +17637,11 @@ var OmpRpcSession = class {
17472
17637
  let userIndex = 0;
17473
17638
  let parentId = null;
17474
17639
  const entries = data.messages.map((nativeMessage, index) => {
17475
- const role = isRecord6(nativeMessage) ? nativeMessage.role : void 0;
17640
+ const role = isRecord7(nativeMessage) ? nativeMessage.role : void 0;
17476
17641
  const branchId = role === "user" ? branchEntryIds?.[userIndex] : void 0;
17477
17642
  if (branchId)
17478
17643
  userIndex += 1;
17479
- const id = branchId ?? (isRecord6(nativeMessage) && nonBlankString(nativeMessage.id) ? nativeMessage.id : `omp-message-${index}`);
17644
+ const id = branchId ?? (isRecord7(nativeMessage) && nonBlankString(nativeMessage.id) ? nativeMessage.id : `omp-message-${index}`);
17480
17645
  const entry = { id, parentId, type: "message", message: nativeMessage };
17481
17646
  parentId = id;
17482
17647
  return entry;
@@ -17556,7 +17721,7 @@ var OmpRpcSession = class {
17556
17721
  throw new Error("Omp RPC Fork requires an Entry identity");
17557
17722
  try {
17558
17723
  const response = await this.#send("branch", { entryId });
17559
- const data = isRecord6(response.data) ? response.data : null;
17724
+ const data = isRecord7(response.data) ? response.data : null;
17560
17725
  if (!data || data.cancelled === true) {
17561
17726
  throw new OmpRpcFaultError("unavailable", "Omp RPC Fork was cancelled");
17562
17727
  }
@@ -17749,7 +17914,7 @@ var OmpRpcSession = class {
17749
17914
  continue;
17750
17915
  }
17751
17916
  const value = decoded;
17752
- if (!isRecord6(value) || typeof value.type !== "string") {
17917
+ if (!isRecord7(value) || typeof value.type !== "string") {
17753
17918
  throw new OmpRpcFaultError("protocolError", "Omp RPC returned an invalid envelope");
17754
17919
  }
17755
17920
  this.#handle(value);
@@ -17759,9 +17924,17 @@ var OmpRpcSession = class {
17759
17924
  newline = this.#buffer.indexOf(10);
17760
17925
  }
17761
17926
  }
17927
+ /** Latest `available_commands_update` of the running process, if any. */
17928
+ get availableCommands() {
17929
+ return this.#availableCommands;
17930
+ }
17762
17931
  #handle(value) {
17763
17932
  if (this.#closed || this.#failed)
17764
17933
  return;
17934
+ if (value.type === "available_commands_update") {
17935
+ this.#availableCommands = parseOmpAvailableCommands(value.commands);
17936
+ return;
17937
+ }
17765
17938
  if (value.type === "ready") {
17766
17939
  this.#readyResolve?.();
17767
17940
  this.#readyResolve = null;
@@ -17800,7 +17973,7 @@ var OmpRpcSession = class {
17800
17973
  this.#armCommandTimeout(id, pending);
17801
17974
  }
17802
17975
  }
17803
- const outcome = value.aborted === true ? "cancelled" : isRecord6(value.result) ? "succeeded" : "failed";
17976
+ const outcome = value.aborted === true ? "cancelled" : isRecord7(value.result) ? "succeeded" : "failed";
17804
17977
  const event = {
17805
17978
  type: "compaction.completed",
17806
17979
  outcome,
@@ -17833,12 +18006,12 @@ var OmpRpcSession = class {
17833
18006
  this.#startAssistantMessage(active, value.message);
17834
18007
  return;
17835
18008
  }
17836
- if (value.type === "message_update" && isRecord6(value.assistantMessageEvent)) {
18009
+ if (value.type === "message_update" && isRecord7(value.assistantMessageEvent)) {
17837
18010
  const event = value.assistantMessageEvent;
17838
18011
  const eventType = String(event.type ?? "");
17839
18012
  const isThinking = eventType === "thinking_delta" || eventType === "reasoning_delta" || eventType === "thought_delta" || eventType === "thinking" || eventType === "reasoning";
17840
18013
  const isText = eventType === "text_delta" || eventType === "text" || eventType === "content_block_delta";
17841
- 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;
18014
+ 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;
17842
18015
  if (isThinking && delta !== null && delta.length > 0) {
17843
18016
  const messageId = this.#ensureAssistantMessage(active, value.message);
17844
18017
  active.reasoningMessageOpen = true;
@@ -17878,7 +18051,7 @@ var OmpRpcSession = class {
17878
18051
  if (value.type === "agent_end" && Array.isArray(value.messages)) {
17879
18052
  for (let index = value.messages.length - 1; index >= 0; index -= 1) {
17880
18053
  const message3 = value.messages[index];
17881
- if (!isRecord6(message3) || message3.role !== "assistant")
18054
+ if (!isRecord7(message3) || message3.role !== "assistant")
17882
18055
  continue;
17883
18056
  this.#finalizeAssistantMessage(active, message3);
17884
18057
  break;
@@ -17895,8 +18068,8 @@ var OmpRpcSession = class {
17895
18068
  if (value.type !== "subagent_lifecycle" && value.type !== "subagent_progress" && value.type !== "subagent_event") {
17896
18069
  return false;
17897
18070
  }
17898
- const payload = isRecord6(value.payload) ? value.payload : null;
17899
- const progressPayload = value.type === "subagent_progress" && payload && isRecord6(payload.progress) ? payload.progress : null;
18071
+ const payload = isRecord7(value.payload) ? value.payload : null;
18072
+ const progressPayload = value.type === "subagent_progress" && payload && isRecord7(payload.progress) ? payload.progress : null;
17900
18073
  const nativeIdValue = progressPayload?.id ?? payload?.id;
17901
18074
  if (!payload || !nonBlankString(nativeIdValue)) {
17902
18075
  throw new OmpRpcFaultError("protocolError", "Omp RPC Subagent frame has no stable ID");
@@ -18473,7 +18646,7 @@ var ompCommandCatalog = harnessCommandCatalogSchema.parse({
18473
18646
  ]
18474
18647
  });
18475
18648
  var DEFAULT_TOOL_OUTPUT_LIMIT = 64e3;
18476
- function isRecord7(value) {
18649
+ function isRecord8(value) {
18477
18650
  return typeof value === "object" && value !== null && !Array.isArray(value);
18478
18651
  }
18479
18652
  function errorMessage(error51) {
@@ -18488,7 +18661,7 @@ var OmpAdapterFaultError = class extends Error {
18488
18661
  }
18489
18662
  };
18490
18663
  function normalizedError(error51, fallbackCode) {
18491
- if (isRecord7(error51) && error51.code === "ENOENT") {
18664
+ if (isRecord8(error51) && error51.code === "ENOENT") {
18492
18665
  return { code: "notInstalled", message: errorMessage(error51), retryable: false };
18493
18666
  }
18494
18667
  if (error51 instanceof OmpAdapterFaultError)
@@ -18565,7 +18738,7 @@ function nativeModelForHistory(state) {
18565
18738
  return nativeModelFromState(state);
18566
18739
  }
18567
18740
  function sessionFileFromRef(ref) {
18568
- if (ref.harnessId !== ompHarnessId2 || !isRecord7(ref.locator) || typeof ref.locator.sessionFile !== "string" || ref.locator.sessionFile.length === 0) {
18741
+ if (ref.harnessId !== ompHarnessId2 || !isRecord8(ref.locator) || typeof ref.locator.sessionFile !== "string" || ref.locator.sessionFile.length === 0) {
18569
18742
  throw new Error("Omp Native Session Ref has no resumable Session file");
18570
18743
  }
18571
18744
  return ref.locator.sessionFile;
@@ -18580,9 +18753,9 @@ function toolFailure(toolName) {
18580
18753
  function nativeText(value) {
18581
18754
  if (typeof value === "string")
18582
18755
  return value;
18583
- if (!isRecord7(value) || !Array.isArray(value.content))
18756
+ if (!isRecord8(value) || !Array.isArray(value.content))
18584
18757
  return "";
18585
- return value.content.filter((content) => isRecord7(content) && content.type === "text" && typeof content.text === "string").map(({ text }) => text).join("");
18758
+ return value.content.filter((content) => isRecord8(content) && content.type === "text" && typeof content.text === "string").map(({ text }) => text).join("");
18586
18759
  }
18587
18760
  function boundedOutput(value, limit) {
18588
18761
  const text = nativeText(value);
@@ -18598,17 +18771,17 @@ function outputText(output) {
18598
18771
  return output?.content.filter((content) => content.type === "text").map(({ text }) => text).join("") ?? "";
18599
18772
  }
18600
18773
  function stringField2(value, key) {
18601
- if (!isRecord7(value))
18774
+ if (!isRecord8(value))
18602
18775
  return void 0;
18603
18776
  const field = value[key];
18604
18777
  if (typeof field === "string" && field.length > 0)
18605
18778
  return field;
18606
- if (isRecord7(value.input)) {
18779
+ if (isRecord8(value.input)) {
18607
18780
  const nested = value.input[key];
18608
18781
  if (typeof nested === "string" && nested.length > 0)
18609
18782
  return nested;
18610
18783
  }
18611
- if (isRecord7(value.arguments)) {
18784
+ if (isRecord8(value.arguments)) {
18612
18785
  const nested = value.arguments[key];
18613
18786
  if (typeof nested === "string" && nested.length > 0)
18614
18787
  return nested;
@@ -18616,7 +18789,7 @@ function stringField2(value, key) {
18616
18789
  return void 0;
18617
18790
  }
18618
18791
  function numberField(value, key) {
18619
- if (!isRecord7(value))
18792
+ if (!isRecord8(value))
18620
18793
  return void 0;
18621
18794
  const field = value[key];
18622
18795
  return typeof field === "number" || field === null ? field : void 0;
@@ -18655,7 +18828,7 @@ function fileMutatingKind(toolName) {
18655
18828
  return null;
18656
18829
  }
18657
18830
  function nestedToolString(value, keys) {
18658
- if (!isRecord7(value))
18831
+ if (!isRecord8(value))
18659
18832
  return void 0;
18660
18833
  for (const key of keys) {
18661
18834
  const field = value[key];
@@ -18670,14 +18843,14 @@ function nestedToolString(value, keys) {
18670
18843
  return void 0;
18671
18844
  }
18672
18845
  function patchFromResult(result) {
18673
- if (!isRecord7(result))
18846
+ if (!isRecord8(result))
18674
18847
  return void 0;
18675
18848
  for (const key of ["patch", "diff", "unifiedDiff"]) {
18676
18849
  const field = result[key];
18677
18850
  if (typeof field === "string" && field.length > 0)
18678
18851
  return field;
18679
18852
  }
18680
- if (isRecord7(result.details)) {
18853
+ if (isRecord8(result.details)) {
18681
18854
  for (const key of ["patch", "diff", "unifiedDiff"]) {
18682
18855
  const field = result.details[key];
18683
18856
  if (typeof field === "string" && field.length > 0)
@@ -18828,7 +19001,7 @@ var OmpHarnessSession = class {
18828
19001
  subagents: { observe: true, readTranscript: true }
18829
19002
  };
18830
19003
  this.commands = {
18831
- list: async () => ({ ok: true, value: ompCommandCatalog }),
19004
+ list: async () => ({ ok: true, value: this.#liveCommandCatalog() }),
18832
19005
  execute: (command) => this.#executeHarnessCommand(command)
18833
19006
  };
18834
19007
  this.#transport = options.startedTransport ?? null;
@@ -19479,7 +19652,24 @@ var OmpHarnessSession = class {
19479
19652
  return { ok: false, error: normalized };
19480
19653
  }
19481
19654
  }
19655
+ /**
19656
+ * Built-ins plus the skills and extension commands of the running process.
19657
+ * Never starts the process just to list commands.
19658
+ */
19659
+ #liveCommandCatalog() {
19660
+ const native = this.#transport?.availableCommands ?? null;
19661
+ return mergeLiveHarnessCommands(ompCommandCatalog, OMP_LIVE_COMMAND_ID_PREFIX, native ? ompLiveCommands(native) : null);
19662
+ }
19482
19663
  async #executeHarnessCommand(command) {
19664
+ const livePrompt = liveHarnessCommandPrompt(this.#liveCommandCatalog(), OMP_LIVE_COMMAND_ID_PREFIX, command.commandId, command.arguments?.text);
19665
+ if (livePrompt !== null) {
19666
+ const started = await this.execute({
19667
+ type: "turn.start",
19668
+ turnId: command.turnId,
19669
+ input: [{ type: "text", text: livePrompt }]
19670
+ });
19671
+ return started.ok ? { ok: true, value: { turnId: command.turnId } } : started;
19672
+ }
19483
19673
  if (command.commandId !== "omp.compact") {
19484
19674
  return {
19485
19675
  ok: false,
@@ -20143,6 +20333,7 @@ var OmpHarnessSession = class {
20143
20333
  };
20144
20334
  var OmpAdapter = class {
20145
20335
  commandCatalog = ompCommandCatalog;
20336
+ liveCommandCatalog = true;
20146
20337
  harnessId = ompHarnessId2;
20147
20338
  subagents = {
20148
20339
  readSnapshot: async (input) => {