@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.
@@ -15281,10 +15281,21 @@ var harnessCommandDescriptorSchema = external_exports.object({
15281
15281
  invocation: commandInvocationSchema,
15282
15282
  label: commandLabelSchema,
15283
15283
  description: commandDescriptionSchema.optional(),
15284
- argumentMode: external_exports.enum(["none", "text"])
15284
+ argumentMode: external_exports.enum(["none", "text"]),
15285
+ /**
15286
+ * Native distinction reported by the Harness. Omitted when the Harness does
15287
+ * not tell skills and commands apart; consumers treat that as "command".
15288
+ */
15289
+ kind: external_exports.enum(["command", "skill"]).optional()
15285
15290
  }).strict();
15286
15291
  var harnessCommandCatalogSchema = external_exports.object({
15287
- commands: external_exports.array(harnessCommandDescriptorSchema)
15292
+ commands: external_exports.array(harnessCommandDescriptorSchema),
15293
+ /**
15294
+ * `live` when the catalog includes what a native Session reports for its
15295
+ * workspace (custom commands, skills); `static` for Adapter built-ins only.
15296
+ * Omitted by Adapters; set by the Host on inspection results.
15297
+ */
15298
+ source: external_exports.enum(["live", "static"]).optional()
15288
15299
  }).strict().superRefine((catalog, context) => {
15289
15300
  const ids = /* @__PURE__ */ new Set();
15290
15301
  for (const [index, command] of catalog.commands.entries()) {
@@ -15298,7 +15309,11 @@ var harnessCommandCatalogSchema = external_exports.object({
15298
15309
  ids.add(command.id);
15299
15310
  }
15300
15311
  });
15301
- var harnessCommandsInspectParamsSchema = external_exports.object({ harnessId: harnessIdSchema }).strict();
15312
+ var harnessCommandsInspectParamsSchema = external_exports.object({
15313
+ harnessId: harnessIdSchema,
15314
+ /** Workspace of a draft without a Thread, for its live catalog when known. */
15315
+ cwd: external_exports.string().min(1).optional()
15316
+ }).strict();
15302
15317
  var threadCommandsInspectParamsSchema = external_exports.object({
15303
15318
  threadId: hostThreadIdSchema
15304
15319
  }).strict();
@@ -15637,6 +15652,124 @@ function parseHostUsage(value) {
15637
15652
  return { ...value };
15638
15653
  }
15639
15654
 
15655
+ // ../../harness-adapter/dist/live-command-catalog.js
15656
+ var COMMON_EXCLUDED_LIVE_COMMANDS = /* @__PURE__ */ new Set([
15657
+ // Session lifecycle
15658
+ "branch",
15659
+ "clear",
15660
+ "exit",
15661
+ "fork",
15662
+ "fresh",
15663
+ "new",
15664
+ "quit",
15665
+ "rename",
15666
+ "rename-chat",
15667
+ "reset",
15668
+ "resume",
15669
+ "rewind",
15670
+ "session",
15671
+ "sessions",
15672
+ // Desktop-owned configuration
15673
+ "autocompact",
15674
+ "color",
15675
+ "config",
15676
+ "effort",
15677
+ "fast",
15678
+ "keybindings",
15679
+ "model",
15680
+ "models",
15681
+ "output-style",
15682
+ "permissions",
15683
+ "settings",
15684
+ "statusline",
15685
+ "terminal-setup",
15686
+ "theme",
15687
+ "vim",
15688
+ // Trust and approval policy
15689
+ "always-approve",
15690
+ "auto-mode-setup",
15691
+ // Native login
15692
+ "login",
15693
+ "logout",
15694
+ // Work outliving the Turn
15695
+ "autopilot",
15696
+ "background",
15697
+ "bg",
15698
+ "goal",
15699
+ "jobs",
15700
+ "loop",
15701
+ "multitask",
15702
+ "queue",
15703
+ "remote-control",
15704
+ "schedule",
15705
+ "steer",
15706
+ // Native terminal UI
15707
+ "copy",
15708
+ "debug",
15709
+ "feedback",
15710
+ "heapdump",
15711
+ "share",
15712
+ "shell",
15713
+ // Plugin and MCP management
15714
+ "marketplace",
15715
+ "mcp",
15716
+ "plugins",
15717
+ "reload-plugins"
15718
+ ]);
15719
+ var COMMON_EXCLUDED_LIVE_COMMAND_PREFIXES = ["__", "hooks-"];
15720
+ function isExcludedLiveCommand(name, kind, extra = {}) {
15721
+ const normalized = name.trim().replace(/^\//u, "");
15722
+ if (new Set(extra.names ?? []).has(normalized))
15723
+ return true;
15724
+ if (extra.prefixes?.some((prefix) => normalized.startsWith(prefix)))
15725
+ return true;
15726
+ if (kind === "skill")
15727
+ return false;
15728
+ return COMMON_EXCLUDED_LIVE_COMMANDS.has(normalized) || COMMON_EXCLUDED_LIVE_COMMAND_PREFIXES.some((prefix) => normalized.startsWith(prefix));
15729
+ }
15730
+ function liveHarnessCommandPrompt(catalog, idPrefix, commandId, argumentText) {
15731
+ if (!commandId.startsWith(idPrefix))
15732
+ return null;
15733
+ const descriptor = catalog.commands.find(({ id }) => id === commandId);
15734
+ if (!descriptor)
15735
+ return null;
15736
+ const text = typeof argumentText === "string" ? argumentText.trim() : "";
15737
+ return text ? `${descriptor.invocation} ${text}` : descriptor.invocation;
15738
+ }
15739
+ function mergeLiveHarnessCommands(builtIns, idPrefix, live, exclusions = {}) {
15740
+ if (!live)
15741
+ return builtIns;
15742
+ const invocations = new Set(builtIns.commands.map(({ invocation }) => invocation));
15743
+ const ids = new Set(builtIns.commands.map(({ id }) => id));
15744
+ const dynamic = [];
15745
+ for (const command of live) {
15746
+ const name = command.name.trim().replace(/^\//u, "");
15747
+ if (!name || /\s/u.test(name))
15748
+ continue;
15749
+ if (isExcludedLiveCommand(name, command.kind, exclusions))
15750
+ continue;
15751
+ const invocation = `/${name}`;
15752
+ const id = `${idPrefix}${name.replace(/[^A-Za-z0-9._:-]/gu, "-")}`.slice(0, 128);
15753
+ if (invocations.has(invocation) || ids.has(id))
15754
+ continue;
15755
+ const description = command.description?.trim().slice(0, 512);
15756
+ const parsed = harnessCommandDescriptorSchema.safeParse({
15757
+ id,
15758
+ invocation,
15759
+ label: name.slice(0, 128),
15760
+ ...description ? { description } : {},
15761
+ argumentMode: "text",
15762
+ kind: command.kind
15763
+ });
15764
+ if (!parsed.success)
15765
+ continue;
15766
+ invocations.add(invocation);
15767
+ ids.add(id);
15768
+ dynamic.push(parsed.data);
15769
+ }
15770
+ return harnessCommandCatalogSchema.parse({ commands: [...builtIns.commands, ...dynamic] });
15771
+ }
15772
+
15640
15773
  // dist/acp-transport.js
15641
15774
  import { spawn, spawnSync } from "node:child_process";
15642
15775
  import { Readable, Writable } from "node:stream";
@@ -20030,6 +20163,38 @@ var ClientSideConnection = class {
20030
20163
  }
20031
20164
  };
20032
20165
 
20166
+ // dist/kiro-slash-commands.js
20167
+ var KIRO_LIVE_COMMAND_ID_PREFIX = "kiro.slash.";
20168
+ function isRecord3(value) {
20169
+ return typeof value === "object" && value !== null && !Array.isArray(value);
20170
+ }
20171
+ function parseKiroAvailableCommands(value) {
20172
+ if (!Array.isArray(value))
20173
+ return [];
20174
+ return value.flatMap((entry) => {
20175
+ if (!isRecord3(entry))
20176
+ return [];
20177
+ const name = typeof entry.name === "string" ? entry.name.trim().replace(/^\//u, "") : "";
20178
+ if (!name)
20179
+ return [];
20180
+ const kiro = isRecord3(entry._meta) && isRecord3(entry._meta.kiro) ? entry._meta.kiro : null;
20181
+ return [
20182
+ {
20183
+ name,
20184
+ description: typeof entry.description === "string" ? entry.description : "",
20185
+ type: typeof kiro?.type === "string" ? kiro.type : null
20186
+ }
20187
+ ];
20188
+ });
20189
+ }
20190
+ function kiroLiveCommands(native) {
20191
+ return native.map((command) => ({
20192
+ name: command.name,
20193
+ description: command.description,
20194
+ kind: command.type === "skill" ? "skill" : "command"
20195
+ }));
20196
+ }
20197
+
20033
20198
  // dist/command.js
20034
20199
  import path3 from "node:path";
20035
20200
  var KiroExecutableError = class extends Error {
@@ -20072,7 +20237,7 @@ var KIRO_DEFAULT_MODEL_CATALOG = {
20072
20237
  models: KIRO_DEFAULT_MODELS,
20073
20238
  thinkingOptions: []
20074
20239
  };
20075
- function isRecord3(value) {
20240
+ function isRecord4(value) {
20076
20241
  return typeof value === "object" && value !== null && !Array.isArray(value);
20077
20242
  }
20078
20243
  function nonBlank(value) {
@@ -20082,7 +20247,7 @@ function thinkingOptions(values) {
20082
20247
  const options = /* @__PURE__ */ new Map();
20083
20248
  for (const value of Array.isArray(values) ? values : []) {
20084
20249
  const option = typeof value === "string" ? { value, name: value.charAt(0).toUpperCase() + value.slice(1) } : value;
20085
- if (!isRecord3(option))
20250
+ if (!isRecord4(option))
20086
20251
  continue;
20087
20252
  const parsed = harnessThinkingOptionSchema.safeParse({
20088
20253
  id: option.value,
@@ -20094,8 +20259,8 @@ function thinkingOptions(values) {
20094
20259
  return [...options.values()];
20095
20260
  }
20096
20261
  function kiroThinkingState(configOptions) {
20097
- const option = Array.isArray(configOptions) ? configOptions.find((entry) => isRecord3(entry) && entry.id === "effortLevel") : void 0;
20098
- const availableThinkingOptions = kiroConfigValue(configOptions, "model") === "auto" || !isRecord3(option) ? [] : thinkingOptions(option.options);
20262
+ const option = Array.isArray(configOptions) ? configOptions.find((entry) => isRecord4(entry) && entry.id === "effortLevel") : void 0;
20263
+ const availableThinkingOptions = kiroConfigValue(configOptions, "model") === "auto" || !isRecord4(option) ? [] : thinkingOptions(option.options);
20099
20264
  const current = availableThinkingOptions.find(({ id }) => id === kiroConfigValue(configOptions, "effortLevel"));
20100
20265
  return {
20101
20266
  availableThinkingOptions,
@@ -20105,8 +20270,8 @@ function kiroThinkingState(configOptions) {
20105
20270
  function parseKiroModelCatalog(configOptions, fallback = KIRO_DEFAULT_MODEL_CATALOG) {
20106
20271
  if (!Array.isArray(configOptions))
20107
20272
  return fallback;
20108
- const modelConfig = configOptions.find((opt) => isRecord3(opt) && opt.id === "model");
20109
- if (!modelConfig || !isRecord3(modelConfig))
20273
+ const modelConfig = configOptions.find((opt) => isRecord4(opt) && opt.id === "model");
20274
+ if (!modelConfig || !isRecord4(modelConfig))
20110
20275
  return fallback;
20111
20276
  const rawOptions = modelConfig.options;
20112
20277
  if (!Array.isArray(rawOptions) || rawOptions.length === 0)
@@ -20117,7 +20282,7 @@ function parseKiroModelCatalog(configOptions, fallback = KIRO_DEFAULT_MODEL_CATA
20117
20282
  const currentThinking = kiroThinkingState(configOptions);
20118
20283
  let defaultEffort = currentThinking.effectiveThinkingOptionId;
20119
20284
  for (const option of rawOptions) {
20120
- if (!isRecord3(option))
20285
+ if (!isRecord4(option))
20121
20286
  continue;
20122
20287
  const value = option.value ?? option.id;
20123
20288
  const name = option.name ?? option.label ?? value;
@@ -20127,8 +20292,8 @@ function parseKiroModelCatalog(configOptions, fallback = KIRO_DEFAULT_MODEL_CATA
20127
20292
  if (!ref.success || seenRefs.has(ref.data.id))
20128
20293
  continue;
20129
20294
  seenRefs.add(ref.data.id);
20130
- const meta3 = isRecord3(option._meta) && isRecord3(option._meta.kiro) ? option._meta.kiro : void 0;
20131
- const currentEffortConfig = configOptions.some((entry) => isRecord3(entry) && entry.id === "effortLevel");
20295
+ const meta3 = isRecord4(option._meta) && isRecord4(option._meta.kiro) ? option._meta.kiro : void 0;
20296
+ const currentEffortConfig = configOptions.some((entry) => isRecord4(entry) && entry.id === "effortLevel");
20132
20297
  const supported = ref.data.id === "auto" ? [] : ref.data.id === modelConfig.currentValue && currentEffortConfig ? currentThinking.availableThinkingOptions ?? [] : meta3?.hasEffort === false ? [] : thinkingOptions(meta3?.effortLevels);
20133
20298
  for (const effort of supported)
20134
20299
  efforts.set(effort.id, effort);
@@ -20164,25 +20329,25 @@ function parseKiroModelCatalog(configOptions, fallback = KIRO_DEFAULT_MODEL_CATA
20164
20329
  function kiroConfigValue(configOptions, id) {
20165
20330
  if (!Array.isArray(configOptions))
20166
20331
  return void 0;
20167
- const option = configOptions.find((value) => isRecord3(value) && value.id === id);
20168
- return isRecord3(option) && nonBlank(option.currentValue) ? option.currentValue : void 0;
20332
+ const option = configOptions.find((value) => isRecord4(value) && value.id === id);
20333
+ return isRecord4(option) && nonBlank(option.currentValue) ? option.currentValue : void 0;
20169
20334
  }
20170
20335
  function confirmedKiroConfig(result, id, value) {
20171
- const options = isRecord3(result) ? result.configOptions : void 0;
20336
+ const options = isRecord4(result) ? result.configOptions : void 0;
20172
20337
  if (!Array.isArray(options) || kiroConfigValue(options, id) !== value) {
20173
20338
  throw new Error(`Kiro did not confirm ${id}=${value}`);
20174
20339
  }
20175
20340
  return options;
20176
20341
  }
20177
20342
  function parseKiroCliModels(result) {
20178
- const rows = isRecord3(result) ? result.models : result;
20343
+ const rows = isRecord4(result) ? result.models : result;
20179
20344
  if (!Array.isArray(rows))
20180
20345
  throw new Error("Kiro returned an invalid model catalog");
20181
20346
  const catalog = parseKiroModelCatalog([
20182
20347
  {
20183
20348
  id: "model",
20184
- options: rows.map((row) => isRecord3(row) ? { value: row.model_id, name: row.model_name, _meta: row._meta ?? { kiro: row } } : row),
20185
- ...isRecord3(result) ? { currentValue: result.default_model } : {}
20349
+ options: rows.map((row) => isRecord4(row) ? { value: row.model_id, name: row.model_name, _meta: row._meta ?? { kiro: row } } : row),
20350
+ ...isRecord4(result) ? { currentValue: result.default_model } : {}
20186
20351
  }
20187
20352
  ]);
20188
20353
  if (catalog.models.length === 0)
@@ -20201,7 +20366,7 @@ var KiroTransportError = class extends Error {
20201
20366
  this.name = "KiroTransportError";
20202
20367
  }
20203
20368
  };
20204
- function isRecord4(value) {
20369
+ function isRecord5(value) {
20205
20370
  return typeof value === "object" && value !== null && !Array.isArray(value);
20206
20371
  }
20207
20372
  function errorText(error51) {
@@ -20256,7 +20421,7 @@ function signalProcessTree(child, signal) {
20256
20421
  try {
20257
20422
  process.kill(-child.pid, signal);
20258
20423
  } catch (error51) {
20259
- if (!isRecord4(error51) || error51.code !== "ESRCH")
20424
+ if (!isRecord5(error51) || error51.code !== "ESRCH")
20260
20425
  throw error51;
20261
20426
  }
20262
20427
  }
@@ -20272,6 +20437,7 @@ var KiroAcpTransport = class {
20272
20437
  #initialize = null;
20273
20438
  #replay = null;
20274
20439
  #sessionId = null;
20440
+ #availableCommands = null;
20275
20441
  #stderrTail = "";
20276
20442
  #configUpdates = /* @__PURE__ */ new Set();
20277
20443
  constructor(options) {
@@ -20293,7 +20459,7 @@ var KiroAcpTransport = class {
20293
20459
  try {
20294
20460
  const initialize = await this.#ensureInitialized();
20295
20461
  const kiro = initialize.agentCapabilities?._meta?.kiro;
20296
- if (isRecord4(kiro) && Array.isArray(kiro.extensionMethods) && kiro.extensionMethods.includes("_kiro/config/template")) {
20462
+ if (isRecord5(kiro) && Array.isArray(kiro.extensionMethods) && kiro.extensionMethods.includes("_kiro/config/template")) {
20297
20463
  const connection = this.#connection;
20298
20464
  const method = initialize.authMethods?.[0];
20299
20465
  if (!connection || !method) {
@@ -20303,7 +20469,7 @@ var KiroAcpTransport = class {
20303
20469
  const deadline = Date.now() + this.#commandTimeoutMs;
20304
20470
  while (Date.now() < deadline) {
20305
20471
  const template = await withTimeout(connection.request("_kiro/config/template", {}), Math.max(1, deadline - Date.now()), "Kiro configuration discovery");
20306
- const catalog = parseKiroModelCatalog(isRecord4(template) ? template.configOptions : void 0);
20472
+ const catalog = parseKiroModelCatalog(isRecord5(template) ? template.configOptions : void 0);
20307
20473
  if (catalog.models.length > 0)
20308
20474
  return { ...initialize, catalog };
20309
20475
  await delay(Math.min(250, Math.max(0, deadline - Date.now())));
@@ -20480,7 +20646,7 @@ var KiroAcpTransport = class {
20480
20646
  }
20481
20647
  }
20482
20648
  }), this.#commandTimeoutMs, "Kiro Session fork");
20483
- if (!isRecord4(raw) || typeof raw.sessionId !== "string" || raw.sessionId.length === 0) {
20649
+ if (!isRecord5(raw) || typeof raw.sessionId !== "string" || raw.sessionId.length === 0) {
20484
20650
  throw new KiroTransportError("protocolError", "Kiro Fork returned no valid sessionId");
20485
20651
  }
20486
20652
  if (raw.sessionId === params.sourceSessionId) {
@@ -20496,7 +20662,7 @@ var KiroAcpTransport = class {
20496
20662
  cause: error51
20497
20663
  });
20498
20664
  }
20499
- const detail = isRecord4(error51.data) && typeof error51.data.details === "string" ? error51.data.details : error51.message;
20665
+ const detail = isRecord5(error51.data) && typeof error51.data.details === "string" ? error51.data.details : error51.message;
20500
20666
  if (/message.*not found/iu.test(detail)) {
20501
20667
  throw new KiroTransportError("checkpointNotFound", "Kiro no longer retains this fork position after compaction or rewind. Refresh history and fork from the latest retained position.", { cause: error51 });
20502
20668
  }
@@ -20613,12 +20779,23 @@ var KiroAcpTransport = class {
20613
20779
  this.#initialize = initialize;
20614
20780
  return initialize;
20615
20781
  }
20782
+ /** Latest ACP `available_commands_update` of the open Session, if any. */
20783
+ get availableCommands() {
20784
+ return this.#availableCommands;
20785
+ }
20616
20786
  #handleUpdate(params) {
20787
+ const commandsUpdate = params.update;
20788
+ if (commandsUpdate.sessionUpdate === "available_commands_update") {
20789
+ if (!this.#sessionId || params.sessionId === this.#sessionId) {
20790
+ this.#availableCommands = parseKiroAvailableCommands(commandsUpdate.availableCommands);
20791
+ }
20792
+ return;
20793
+ }
20617
20794
  for (const listener of this.#configUpdates)
20618
20795
  listener.update(params);
20619
20796
  const update = params.update;
20620
- const meta3 = isRecord4(update) && isRecord4(update._meta) ? update._meta : void 0;
20621
- const kiroMeta = meta3 && isRecord4(meta3.kiro) ? meta3.kiro : void 0;
20797
+ const meta3 = isRecord5(update) && isRecord5(update._meta) ? update._meta : void 0;
20798
+ const kiroMeta = meta3 && isRecord5(meta3.kiro) ? meta3.kiro : void 0;
20622
20799
  let event = null;
20623
20800
  if (update.sessionUpdate === "agent_message_chunk") {
20624
20801
  const isReplay = Boolean(kiroMeta?.replay);
@@ -20666,7 +20843,7 @@ var KiroAcpTransport = class {
20666
20843
  };
20667
20844
  } else if (update.sessionUpdate === "session_info_update") {
20668
20845
  if (kiroMeta?.kind === "summarization_completed") {
20669
- const summarization = isRecord4(kiroMeta.summarization) ? kiroMeta.summarization : void 0;
20846
+ const summarization = isRecord5(kiroMeta.summarization) ? kiroMeta.summarization : void 0;
20670
20847
  event = {
20671
20848
  type: "compaction.completed",
20672
20849
  outcome: summarization?.status === "success" ? "succeeded" : "failed",
@@ -20789,7 +20966,7 @@ var KIRO_COMMANDS = [
20789
20966
  var KIRO_COMMAND_CATALOG = harnessCommandCatalogSchema.parse({
20790
20967
  commands: KIRO_COMMANDS
20791
20968
  });
20792
- function isRecord5(value) {
20969
+ function isRecord6(value) {
20793
20970
  return typeof value === "object" && value !== null && !Array.isArray(value);
20794
20971
  }
20795
20972
  function cell(value) {
@@ -20820,11 +20997,11 @@ function formatKiroCommandResult(commandId, result) {
20820
20997
  return typeof value === "string" ? value.replace(/\bBearer\s+[A-Za-z0-9._~+/=-]+/giu, "Bearer [redacted]") : value;
20821
20998
  }, 2) ?? "null";
20822
20999
  const clean = JSON.parse(json2);
20823
- if (isRecord5(clean) && clean.success === false) {
21000
+ if (isRecord6(clean) && clean.success === false) {
20824
21001
  throw new Error("Kiro could not complete the requested query");
20825
21002
  }
20826
- const data = isRecord5(clean) && isRecord5(clean.data) ? clean.data : clean;
20827
- if (commandId === "kiro.usage" && isRecord5(data) && Array.isArray(data.usageBreakdowns)) {
21003
+ const data = isRecord6(clean) && isRecord6(clean.data) ? clean.data : clean;
21004
+ if (commandId === "kiro.usage" && isRecord6(data) && Array.isArray(data.usageBreakdowns)) {
20828
21005
  const sections = [
20829
21006
  "## Kiro Account Usage",
20830
21007
  table(["Account", "Value"], [
@@ -20833,7 +21010,7 @@ function formatKiroCommandResult(commandId, result) {
20833
21010
  ["Overages enabled", data.overagesEnabled]
20834
21011
  ]),
20835
21012
  "### Resources",
20836
- table(["Resource", "Used", "Limit", "Used (%)"], data.usageBreakdowns.filter(isRecord5).map((entry) => [
21013
+ table(["Resource", "Used", "Limit", "Used (%)"], data.usageBreakdowns.filter(isRecord6).map((entry) => [
20837
21014
  entry.displayName ?? entry.resourceType,
20838
21015
  entry.used,
20839
21016
  entry.hasLimit === false ? "No limit" : entry.limit,
@@ -20850,9 +21027,9 @@ function formatKiroCommandResult(commandId, result) {
20850
21027
  }
20851
21028
  return sections.join("\n\n");
20852
21029
  }
20853
- if (commandId === "kiro.context" && isRecord5(data) && isRecord5(data.breakdown)) {
21030
+ if (commandId === "kiro.context" && isRecord6(data) && isRecord6(data.breakdown)) {
20854
21031
  const breakdown = data.breakdown;
20855
- const percent = isRecord5(data.contextUsage) ? data.contextUsage.usagePercentage : data.usagePercentage;
21032
+ const percent = isRecord6(data.contextUsage) ? data.contextUsage.usagePercentage : data.usagePercentage;
20856
21033
  const sections = [
20857
21034
  "## Kiro Context Usage",
20858
21035
  ...typeof percent === "number" ? [`Context used: **${cell(percent)}%**`] : [],
@@ -20864,12 +21041,12 @@ function formatKiroCommandResult(commandId, result) {
20864
21041
  ["sessionFiles", "Session files"]
20865
21042
  ].flatMap(([key, label]) => {
20866
21043
  const entry = key ? breakdown[key] : void 0;
20867
- return isRecord5(entry) ? [[label, entry.tokens, entry.percent]] : [];
21044
+ return isRecord6(entry) ? [[label, entry.tokens, entry.percent]] : [];
20868
21045
  }))
20869
21046
  ];
20870
21047
  for (const key of ["contextFiles", "sessionFiles"]) {
20871
21048
  const entry = breakdown[key];
20872
- if (isRecord5(entry) && Array.isArray(entry.items) && entry.items.length > 0) {
21049
+ if (isRecord6(entry) && Array.isArray(entry.items) && entry.items.length > 0) {
20873
21050
  sections.push(`### ${key === "contextFiles" ? "Context Files" : "Session Files"}`, jsonBlock(JSON.stringify(entry.items, null, 2)));
20874
21051
  }
20875
21052
  }
@@ -21315,7 +21492,7 @@ function splitLines(text) {
21315
21492
  // dist/file-diff.js
21316
21493
  var DEFAULT_KIRO_FILE_CHANGE_TEXT_LIMIT = 4 * 1024 * 1024;
21317
21494
  var MAX_KIRO_FILE_CHANGES_PER_TOOL = 32;
21318
- function isRecord6(value) {
21495
+ function isRecord7(value) {
21319
21496
  return typeof value === "object" && value !== null && !Array.isArray(value);
21320
21497
  }
21321
21498
  function resolveFilePath(candidate) {
@@ -21388,7 +21565,7 @@ function projectKiroFileChanges(content, cwd, textLimit = DEFAULT_KIRO_FILE_CHAN
21388
21565
  return null;
21389
21566
  const candidates = [];
21390
21567
  for (const entry of content) {
21391
- if (isRecord6(entry) && entry.type === "diff")
21568
+ if (isRecord7(entry) && entry.type === "diff")
21392
21569
  candidates.push(entry);
21393
21570
  }
21394
21571
  if (candidates.length === 0 || candidates.length > MAX_KIRO_FILE_CHANGES_PER_TOOL)
@@ -21408,7 +21585,7 @@ function projectKiroFileChanges(content, cwd, textLimit = DEFAULT_KIRO_FILE_CHAN
21408
21585
  }
21409
21586
 
21410
21587
  // dist/projection.js
21411
- function isRecord7(value) {
21588
+ function isRecord8(value) {
21412
21589
  return typeof value === "object" && value !== null && !Array.isArray(value);
21413
21590
  }
21414
21591
  function projectKiroUserInput(interactionId, turnId, params, itemId) {
@@ -21488,7 +21665,7 @@ function projectKiroUserInput(interactionId, turnId, params, itemId) {
21488
21665
  }
21489
21666
  function projectKiroRequirementQuestion(interactionId, turnId, request) {
21490
21667
  const meta3 = request._meta?.kiro;
21491
- if (!isRecord7(meta3) || meta3.kind !== "analyze-requirements")
21668
+ if (!isRecord8(meta3) || meta3.kind !== "analyze-requirements")
21492
21669
  return null;
21493
21670
  if (request.options.length === 0 || request.options.some((option) => option.kind !== "allow_once" || !option.optionId.trim() || !option.name.trim()) || new Set(request.options.map((option) => option.optionId)).size !== request.options.length)
21494
21671
  throw new Error("Kiro returned invalid requirement choices");
@@ -21547,13 +21724,13 @@ function projectKiroPermission(interactionId, turnId, request) {
21547
21724
  const responses = /* @__PURE__ */ new Map();
21548
21725
  let description;
21549
21726
  const rawRequest = request;
21550
- const meta3 = isRecord7(rawRequest._meta) ? rawRequest._meta : void 0;
21551
- const kiroMeta = meta3 && isRecord7(meta3.kiro) ? meta3.kiro : void 0;
21727
+ const meta3 = isRecord8(rawRequest._meta) ? rawRequest._meta : void 0;
21728
+ const kiroMeta = meta3 && isRecord8(meta3.kiro) ? meta3.kiro : void 0;
21552
21729
  if (kiroMeta && kiroMeta.type === "turn_approval") {
21553
- const files = Array.isArray(kiroMeta.files) ? kiroMeta.files.flatMap((file2) => isRecord7(file2) && typeof file2.path === "string" ? [file2.path] : []) : [];
21730
+ const files = Array.isArray(kiroMeta.files) ? kiroMeta.files.flatMap((file2) => isRecord8(file2) && typeof file2.path === "string" ? [file2.path] : []) : [];
21554
21731
  description = ["Review modified files for this turn", ...files].join("\n");
21555
21732
  }
21556
- const consent = kiroMeta && isRecord7(kiroMeta.consent) ? kiroMeta.consent : void 0;
21733
+ const consent = kiroMeta && isRecord8(kiroMeta.consent) ? kiroMeta.consent : void 0;
21557
21734
  if (consent) {
21558
21735
  const resource = consent.triggeringResource ?? consent.resource;
21559
21736
  if (typeof resource === "string" && resource.trim())
@@ -21626,10 +21803,10 @@ function projectKiroPermission(interactionId, turnId, request) {
21626
21803
  function projectKiroToolCall(itemId, toolCall) {
21627
21804
  const hostItemId = hostItemIdSchema.parse(itemId);
21628
21805
  const meta3 = toolCall.metadata;
21629
- const kiroMeta = meta3 && isRecord7(meta3.kiro) ? meta3.kiro : void 0;
21806
+ const kiroMeta = meta3 && isRecord8(meta3.kiro) ? meta3.kiro : void 0;
21630
21807
  if (kiroMeta && kiroMeta.kind === "agent-subtask") {
21631
21808
  const subtaskId = typeof kiroMeta.agentSubtaskId === "string" ? kiroMeta.agentSubtaskId : toolCall.toolCallId;
21632
- const input = isRecord7(toolCall.rawInput) ? toolCall.rawInput : {};
21809
+ const input = isRecord8(toolCall.rawInput) ? toolCall.rawInput : {};
21633
21810
  const subagentState = {
21634
21811
  subagentId: subtaskId,
21635
21812
  description: typeof input.prompt === "string" ? input.prompt : "Subagent task",
@@ -21648,12 +21825,12 @@ function projectKiroToolCall(itemId, toolCall) {
21648
21825
  }
21649
21826
  if (toolCall.kind === "execute" || typeof toolCall.name === "string" && toolCall.name.toLowerCase().includes("execute")) {
21650
21827
  let command = "execute";
21651
- if (isRecord7(toolCall.rawInput) && typeof toolCall.rawInput.command === "string") {
21828
+ if (isRecord8(toolCall.rawInput) && typeof toolCall.rawInput.command === "string") {
21652
21829
  command = toolCall.rawInput.command;
21653
21830
  }
21654
21831
  let exitCode;
21655
21832
  let output2;
21656
- if (isRecord7(toolCall.rawOutput)) {
21833
+ if (isRecord8(toolCall.rawOutput)) {
21657
21834
  if (typeof toolCall.rawOutput.exitCode === "number") {
21658
21835
  exitCode = toolCall.rawOutput.exitCode;
21659
21836
  }
@@ -21684,7 +21861,7 @@ function projectKiroToolCall(itemId, toolCall) {
21684
21861
  type: "toolExecution",
21685
21862
  itemId: hostItemId,
21686
21863
  toolName: toolCall.name || toolCall.title || "tool",
21687
- arguments: isRecord7(toolCall.rawInput) ? toolCall.rawInput : {},
21864
+ arguments: isRecord8(toolCall.rawInput) ? toolCall.rawInput : {},
21688
21865
  ...output !== void 0 ? { output } : {}
21689
21866
  };
21690
21867
  return toolItem;
@@ -21894,7 +22071,7 @@ var KiroTurnOutput = class {
21894
22071
  };
21895
22072
 
21896
22073
  // dist/usage.js
21897
- function isRecord8(value) {
22074
+ function isRecord9(value) {
21898
22075
  return typeof value === "object" && value !== null && !Array.isArray(value);
21899
22076
  }
21900
22077
  function nonNegative(value) {
@@ -21904,7 +22081,7 @@ var KiroUsage = class {
21904
22081
  #credits = /* @__PURE__ */ new Map();
21905
22082
  #contextUsagePercent;
21906
22083
  observe(value) {
21907
- if (!isRecord8(value))
22084
+ if (!isRecord9(value))
21908
22085
  return;
21909
22086
  if (value.kind === "context_usage")
21910
22087
  this.context(value);
@@ -21913,8 +22090,8 @@ var KiroUsage = class {
21913
22090
  const key = Array.isArray(ids) && ids.length > 0 && ids.every((id) => typeof id === "string" && id.length > 0) ? `requests:${JSON.stringify([...new Set(ids)].sort())}` : typeof value.executionId === "string" && value.executionId.length > 0 ? `execution:${value.executionId}` : void 0;
21914
22091
  if (!key || !Array.isArray(value.promptTurnSummaries))
21915
22092
  return;
21916
- const credits = value.promptTurnSummaries.filter((entry) => isRecord8(entry) && entry.unit === "credit");
21917
- if (credits.length === 0 || !credits.every((entry) => isRecord8(entry) && nonNegative(entry.usage)))
22093
+ const credits = value.promptTurnSummaries.filter((entry) => isRecord9(entry) && entry.unit === "credit");
22094
+ if (credits.length === 0 || !credits.every((entry) => isRecord9(entry) && nonNegative(entry.usage)))
21918
22095
  return;
21919
22096
  const total = credits.reduce((sum, entry) => sum + entry.usage, 0);
21920
22097
  if (nonNegative(total))
@@ -21922,9 +22099,9 @@ var KiroUsage = class {
21922
22099
  }
21923
22100
  }
21924
22101
  context(value) {
21925
- if (!isRecord8(value))
22102
+ if (!isRecord9(value))
21926
22103
  return;
21927
- const percent = isRecord8(value.contextUsage) ? value.contextUsage.usagePercentage : value.usagePercentage;
22104
+ const percent = isRecord9(value.contextUsage) ? value.contextUsage.usagePercentage : value.usagePercentage;
21928
22105
  if (nonNegative(percent))
21929
22106
  this.#contextUsagePercent = percent;
21930
22107
  }
@@ -21979,7 +22156,7 @@ function encodeKiroPermissionMode(nativeValue) {
21979
22156
  }
21980
22157
 
21981
22158
  // dist/history.js
21982
- function isRecord9(value) {
22159
+ function isRecord10(value) {
21983
22160
  return typeof value === "object" && value !== null && !Array.isArray(value);
21984
22161
  }
21985
22162
  function kiroHomeDir(environment = process.env) {
@@ -22024,7 +22201,7 @@ async function readKiroNativeMessages(sessionDirectory) {
22024
22201
  const raw = await readFile(messagesFile, "utf8");
22025
22202
  return raw.split("\n").map((line) => line.trim()).filter((line) => line.length > 0).map((line) => {
22026
22203
  const row = JSON.parse(line);
22027
- if (!isRecord9(row) || typeof row.id !== "string" || !isRecord9(row.payload) || typeof row.payload.type !== "string")
22204
+ if (!isRecord10(row) || typeof row.id !== "string" || !isRecord10(row.payload) || typeof row.payload.type !== "string")
22028
22205
  throw new Error("Invalid Kiro history row");
22029
22206
  return row;
22030
22207
  });
@@ -22218,7 +22395,7 @@ async function readKiroSnapshot(location) {
22218
22395
  kind: row.payload.kind,
22219
22396
  rawInput: row.payload.args ?? row.payload.rawInput,
22220
22397
  rawOutput: result?.payload.content ?? result?.payload.rawOutput,
22221
- ...isRecord9(row.payload._meta) ? { metadata: row.payload._meta } : {},
22398
+ ...isRecord10(row.payload._meta) ? { metadata: row.payload._meta } : {},
22222
22399
  status: succeeded ? "completed" : "failed"
22223
22400
  }),
22224
22401
  outcome: toolOutcome
@@ -22287,7 +22464,7 @@ async function readKiroSnapshot(location) {
22287
22464
  }
22288
22465
 
22289
22466
  // dist/kiro-adapter.js
22290
- function isRecord10(value) {
22467
+ function isRecord11(value) {
22291
22468
  return typeof value === "object" && value !== null && !Array.isArray(value);
22292
22469
  }
22293
22470
  var KIRO_SESSION_CAPABILITIES = {
@@ -22313,6 +22490,7 @@ var KIRO_SESSION_CAPABILITIES = {
22313
22490
  var KiroAdapter = class {
22314
22491
  harnessId = harnessIdSchema.parse("kiro-cli");
22315
22492
  commandCatalog = KIRO_COMMAND_CATALOG;
22493
+ liveCommandCatalog = true;
22316
22494
  #options;
22317
22495
  #deps;
22318
22496
  #sessions = /* @__PURE__ */ new Set();
@@ -22384,7 +22562,7 @@ var KiroAdapter = class {
22384
22562
  const transport = this.#createTransport(cwd);
22385
22563
  try {
22386
22564
  const initialize = await transport.inspect();
22387
- const modelCatalog = isRecord10(initialize) && isRecord10(initialize.catalog) ? initialize.catalog : parseKiroModelCatalog(isRecord10(initialize) ? initialize.configOptions : void 0);
22565
+ const modelCatalog = isRecord11(initialize) && isRecord11(initialize.catalog) ? initialize.catalog : parseKiroModelCatalog(isRecord11(initialize) ? initialize.configOptions : void 0);
22388
22566
  if (modelCatalog.models.length === 0)
22389
22567
  throw new Error("Kiro returned no native model catalog");
22390
22568
  return {
@@ -22724,7 +22902,7 @@ var KiroSession = class {
22724
22902
  };
22725
22903
  this.outputs = this.#channel.outputs;
22726
22904
  this.commands = {
22727
- list: async () => ({ ok: true, value: KIRO_COMMAND_CATALOG }),
22905
+ list: async () => ({ ok: true, value: this.#liveCommandCatalog() }),
22728
22906
  execute: async (cmd) => this.#executeHarnessCommand(cmd)
22729
22907
  };
22730
22908
  }
@@ -22805,7 +22983,7 @@ var KiroSession = class {
22805
22983
  }
22806
22984
  };
22807
22985
  } catch (error51) {
22808
- if (this.#newSessionWithoutTurn && isRecord10(error51) && error51.code === "ENOENT") {
22986
+ if (this.#newSessionWithoutTurn && isRecord11(error51) && error51.code === "ENOENT") {
22809
22987
  return { ok: true, value: { turns: [], state: this.#state() } };
22810
22988
  }
22811
22989
  return {
@@ -22884,7 +23062,7 @@ var KiroSession = class {
22884
23062
  if (event.type === "usage") {
22885
23063
  this.observeUsage(event);
22886
23064
  const meta3 = event.metadata?.kiro;
22887
- if (isRecord10(meta3) && meta3.kind === "user_message_id_assigned" && typeof meta3.userMessageId === "string") {
23065
+ if (isRecord11(meta3) && meta3.kind === "user_message_id_assigned" && typeof meta3.userMessageId === "string") {
22888
23066
  assignedUserMessageId = meta3.userMessageId;
22889
23067
  }
22890
23068
  } else if (event.type === "compaction.completed") {
@@ -22966,7 +23144,7 @@ var KiroSession = class {
22966
23144
  });
22967
23145
  })
22968
23146
  ]);
22969
- if (isRecord10(promptResult) && promptResult.stopReason === "cancelled") {
23147
+ if (isRecord11(promptResult) && promptResult.stopReason === "cancelled") {
22970
23148
  turnOutcome = { status: "cancelled", reason: "User cancelled" };
22971
23149
  } else {
22972
23150
  turnOutcome = { status: "succeeded" };
@@ -23232,7 +23410,21 @@ var KiroSession = class {
23232
23410
  ...this.#thinking
23233
23411
  };
23234
23412
  }
23413
+ /** Built-ins plus the steering, agent and skill commands the open Session advertises. */
23414
+ #liveCommandCatalog() {
23415
+ const native = this.#transport.availableCommands ?? null;
23416
+ return mergeLiveHarnessCommands(KIRO_COMMAND_CATALOG, KIRO_LIVE_COMMAND_ID_PREFIX, native ? kiroLiveCommands(native) : null);
23417
+ }
23235
23418
  async #executeHarnessCommand(command) {
23419
+ const livePrompt = liveHarnessCommandPrompt(this.#liveCommandCatalog(), KIRO_LIVE_COMMAND_ID_PREFIX, command.commandId, command.arguments?.text);
23420
+ if (livePrompt !== null) {
23421
+ const started = await this.execute({
23422
+ type: "turn.start",
23423
+ turnId: hostTurnIdSchema.parse(command.turnId),
23424
+ input: [{ type: "text", text: livePrompt }]
23425
+ });
23426
+ return started.ok ? { ok: true, value: { turnId: command.turnId } } : started;
23427
+ }
23236
23428
  if (this.#closed)
23237
23429
  return {
23238
23430
  ok: false,
@@ -23281,7 +23473,7 @@ var KiroSession = class {
23281
23473
  }
23282
23474
  });
23283
23475
  const result2 = await Promise.race([stopped, this.#transport.compact()]);
23284
- if (isRecord10(result2) && result2.success === false) {
23476
+ if (isRecord11(result2) && result2.success === false) {
23285
23477
  throw new Error("Kiro context compaction did not complete");
23286
23478
  }
23287
23479
  this.#channel.emit({