@codexhost/cli-darwin-x64 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.
@@ -14523,6 +14523,61 @@ function date4(params) {
14523
14523
  // ../../../node_modules/zod/v4/classic/external.js
14524
14524
  config(en_default());
14525
14525
 
14526
+ // ../../shared-contracts/dist/credential-imports.js
14527
+ var credentialSourceSchema = external_exports.object({
14528
+ id: external_exports.string().min(1).max(256),
14529
+ harnessId: external_exports.string().min(1),
14530
+ label: external_exports.string().min(1).max(512),
14531
+ provider: external_exports.enum(["openai-codex", "xai"])
14532
+ }).strict();
14533
+ var credentialImportNameSchema = external_exports.string().regex(/^[a-z][a-z0-9-]{0,47}$/);
14534
+ var credentialImportRecordSchema = external_exports.object({
14535
+ name: credentialImportNameSchema,
14536
+ source: credentialSourceSchema,
14537
+ importedAt: external_exports.string()
14538
+ }).strict();
14539
+ var credentialImportsRequestSchema = external_exports.discriminatedUnion("action", [
14540
+ external_exports.object({ action: external_exports.literal("list") }).strict(),
14541
+ external_exports.object({
14542
+ action: external_exports.literal("import"),
14543
+ sourceId: external_exports.string().min(1).max(256),
14544
+ name: credentialImportNameSchema,
14545
+ confirmed: external_exports.literal(true)
14546
+ }).strict(),
14547
+ external_exports.object({
14548
+ action: external_exports.literal("reimport"),
14549
+ sourceId: external_exports.string().min(1).max(256),
14550
+ name: credentialImportNameSchema,
14551
+ confirmed: external_exports.literal(true)
14552
+ }).strict(),
14553
+ external_exports.object({
14554
+ action: external_exports.literal("remove"),
14555
+ name: credentialImportNameSchema,
14556
+ confirmed: external_exports.literal(true)
14557
+ }).strict()
14558
+ ]);
14559
+ var credentialOtherLoginSchema = external_exports.object({
14560
+ provider: external_exports.string().min(1).max(128),
14561
+ type: external_exports.enum(["oauth", "api_key", "unknown"]),
14562
+ /** Best-effort account label (e.g. the email in a Codex token), derived locally when present. */
14563
+ label: external_exports.string().min(1).max(512).optional(),
14564
+ /** Recognized credential vendor, derived from the OAuth token issuer. Absent when unknown. */
14565
+ vendor: external_exports.enum(["openai-codex", "xai"]).optional()
14566
+ }).strict();
14567
+ var credentialImportsResultSchema = external_exports.object({
14568
+ sources: external_exports.array(credentialSourceSchema),
14569
+ targets: external_exports.array(external_exports.object({
14570
+ harnessId: external_exports.string(),
14571
+ providers: external_exports.array(external_exports.enum(["openai-codex", "xai"])),
14572
+ imports: external_exports.array(credentialImportRecordSchema),
14573
+ others: external_exports.array(credentialOtherLoginSchema).default([])
14574
+ }).strict())
14575
+ }).strict();
14576
+ var credentialImportsParamsSchema = external_exports.object({
14577
+ targetHarnessId: external_exports.string().min(1).max(128).optional(),
14578
+ request: credentialImportsRequestSchema
14579
+ }).strict();
14580
+
14526
14581
  // ../../shared-contracts/dist/version.js
14527
14582
  var WORKSPACE_CONTRACT_VERSION = 1;
14528
14583
 
@@ -15226,10 +15281,21 @@ var harnessCommandDescriptorSchema = external_exports.object({
15226
15281
  invocation: commandInvocationSchema,
15227
15282
  label: commandLabelSchema,
15228
15283
  description: commandDescriptionSchema.optional(),
15229
- 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()
15230
15290
  }).strict();
15231
15291
  var harnessCommandCatalogSchema = external_exports.object({
15232
- 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()
15233
15299
  }).strict().superRefine((catalog, context) => {
15234
15300
  const ids = /* @__PURE__ */ new Set();
15235
15301
  for (const [index, command] of catalog.commands.entries()) {
@@ -15243,7 +15309,11 @@ var harnessCommandCatalogSchema = external_exports.object({
15243
15309
  ids.add(command.id);
15244
15310
  }
15245
15311
  });
15246
- 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();
15247
15317
  var threadCommandsInspectParamsSchema = external_exports.object({
15248
15318
  threadId: hostThreadIdSchema
15249
15319
  }).strict();
@@ -15582,6 +15652,124 @@ function parseHostUsage(value) {
15582
15652
  return { ...value };
15583
15653
  }
15584
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
+
15585
15773
  // dist/acp-transport.js
15586
15774
  import { spawn, spawnSync } from "node:child_process";
15587
15775
  import { Readable, Writable } from "node:stream";
@@ -19975,6 +20163,38 @@ var ClientSideConnection = class {
19975
20163
  }
19976
20164
  };
19977
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
+
19978
20198
  // dist/command.js
19979
20199
  import path3 from "node:path";
19980
20200
  var KiroExecutableError = class extends Error {
@@ -20017,7 +20237,7 @@ var KIRO_DEFAULT_MODEL_CATALOG = {
20017
20237
  models: KIRO_DEFAULT_MODELS,
20018
20238
  thinkingOptions: []
20019
20239
  };
20020
- function isRecord3(value) {
20240
+ function isRecord4(value) {
20021
20241
  return typeof value === "object" && value !== null && !Array.isArray(value);
20022
20242
  }
20023
20243
  function nonBlank(value) {
@@ -20027,7 +20247,7 @@ function thinkingOptions(values) {
20027
20247
  const options = /* @__PURE__ */ new Map();
20028
20248
  for (const value of Array.isArray(values) ? values : []) {
20029
20249
  const option = typeof value === "string" ? { value, name: value.charAt(0).toUpperCase() + value.slice(1) } : value;
20030
- if (!isRecord3(option))
20250
+ if (!isRecord4(option))
20031
20251
  continue;
20032
20252
  const parsed = harnessThinkingOptionSchema.safeParse({
20033
20253
  id: option.value,
@@ -20039,8 +20259,8 @@ function thinkingOptions(values) {
20039
20259
  return [...options.values()];
20040
20260
  }
20041
20261
  function kiroThinkingState(configOptions) {
20042
- const option = Array.isArray(configOptions) ? configOptions.find((entry) => isRecord3(entry) && entry.id === "effortLevel") : void 0;
20043
- 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);
20044
20264
  const current = availableThinkingOptions.find(({ id }) => id === kiroConfigValue(configOptions, "effortLevel"));
20045
20265
  return {
20046
20266
  availableThinkingOptions,
@@ -20050,8 +20270,8 @@ function kiroThinkingState(configOptions) {
20050
20270
  function parseKiroModelCatalog(configOptions, fallback = KIRO_DEFAULT_MODEL_CATALOG) {
20051
20271
  if (!Array.isArray(configOptions))
20052
20272
  return fallback;
20053
- const modelConfig = configOptions.find((opt) => isRecord3(opt) && opt.id === "model");
20054
- if (!modelConfig || !isRecord3(modelConfig))
20273
+ const modelConfig = configOptions.find((opt) => isRecord4(opt) && opt.id === "model");
20274
+ if (!modelConfig || !isRecord4(modelConfig))
20055
20275
  return fallback;
20056
20276
  const rawOptions = modelConfig.options;
20057
20277
  if (!Array.isArray(rawOptions) || rawOptions.length === 0)
@@ -20062,7 +20282,7 @@ function parseKiroModelCatalog(configOptions, fallback = KIRO_DEFAULT_MODEL_CATA
20062
20282
  const currentThinking = kiroThinkingState(configOptions);
20063
20283
  let defaultEffort = currentThinking.effectiveThinkingOptionId;
20064
20284
  for (const option of rawOptions) {
20065
- if (!isRecord3(option))
20285
+ if (!isRecord4(option))
20066
20286
  continue;
20067
20287
  const value = option.value ?? option.id;
20068
20288
  const name = option.name ?? option.label ?? value;
@@ -20072,8 +20292,8 @@ function parseKiroModelCatalog(configOptions, fallback = KIRO_DEFAULT_MODEL_CATA
20072
20292
  if (!ref.success || seenRefs.has(ref.data.id))
20073
20293
  continue;
20074
20294
  seenRefs.add(ref.data.id);
20075
- const meta3 = isRecord3(option._meta) && isRecord3(option._meta.kiro) ? option._meta.kiro : void 0;
20076
- 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");
20077
20297
  const supported = ref.data.id === "auto" ? [] : ref.data.id === modelConfig.currentValue && currentEffortConfig ? currentThinking.availableThinkingOptions ?? [] : meta3?.hasEffort === false ? [] : thinkingOptions(meta3?.effortLevels);
20078
20298
  for (const effort of supported)
20079
20299
  efforts.set(effort.id, effort);
@@ -20109,25 +20329,25 @@ function parseKiroModelCatalog(configOptions, fallback = KIRO_DEFAULT_MODEL_CATA
20109
20329
  function kiroConfigValue(configOptions, id) {
20110
20330
  if (!Array.isArray(configOptions))
20111
20331
  return void 0;
20112
- const option = configOptions.find((value) => isRecord3(value) && value.id === id);
20113
- 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;
20114
20334
  }
20115
20335
  function confirmedKiroConfig(result, id, value) {
20116
- const options = isRecord3(result) ? result.configOptions : void 0;
20336
+ const options = isRecord4(result) ? result.configOptions : void 0;
20117
20337
  if (!Array.isArray(options) || kiroConfigValue(options, id) !== value) {
20118
20338
  throw new Error(`Kiro did not confirm ${id}=${value}`);
20119
20339
  }
20120
20340
  return options;
20121
20341
  }
20122
20342
  function parseKiroCliModels(result) {
20123
- const rows = isRecord3(result) ? result.models : result;
20343
+ const rows = isRecord4(result) ? result.models : result;
20124
20344
  if (!Array.isArray(rows))
20125
20345
  throw new Error("Kiro returned an invalid model catalog");
20126
20346
  const catalog = parseKiroModelCatalog([
20127
20347
  {
20128
20348
  id: "model",
20129
- options: rows.map((row) => isRecord3(row) ? { value: row.model_id, name: row.model_name, _meta: row._meta ?? { kiro: row } } : row),
20130
- ...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 } : {}
20131
20351
  }
20132
20352
  ]);
20133
20353
  if (catalog.models.length === 0)
@@ -20146,7 +20366,7 @@ var KiroTransportError = class extends Error {
20146
20366
  this.name = "KiroTransportError";
20147
20367
  }
20148
20368
  };
20149
- function isRecord4(value) {
20369
+ function isRecord5(value) {
20150
20370
  return typeof value === "object" && value !== null && !Array.isArray(value);
20151
20371
  }
20152
20372
  function errorText(error51) {
@@ -20201,7 +20421,7 @@ function signalProcessTree(child, signal) {
20201
20421
  try {
20202
20422
  process.kill(-child.pid, signal);
20203
20423
  } catch (error51) {
20204
- if (!isRecord4(error51) || error51.code !== "ESRCH")
20424
+ if (!isRecord5(error51) || error51.code !== "ESRCH")
20205
20425
  throw error51;
20206
20426
  }
20207
20427
  }
@@ -20217,6 +20437,7 @@ var KiroAcpTransport = class {
20217
20437
  #initialize = null;
20218
20438
  #replay = null;
20219
20439
  #sessionId = null;
20440
+ #availableCommands = null;
20220
20441
  #stderrTail = "";
20221
20442
  #configUpdates = /* @__PURE__ */ new Set();
20222
20443
  constructor(options) {
@@ -20238,7 +20459,7 @@ var KiroAcpTransport = class {
20238
20459
  try {
20239
20460
  const initialize = await this.#ensureInitialized();
20240
20461
  const kiro = initialize.agentCapabilities?._meta?.kiro;
20241
- 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")) {
20242
20463
  const connection = this.#connection;
20243
20464
  const method = initialize.authMethods?.[0];
20244
20465
  if (!connection || !method) {
@@ -20248,7 +20469,7 @@ var KiroAcpTransport = class {
20248
20469
  const deadline = Date.now() + this.#commandTimeoutMs;
20249
20470
  while (Date.now() < deadline) {
20250
20471
  const template = await withTimeout(connection.request("_kiro/config/template", {}), Math.max(1, deadline - Date.now()), "Kiro configuration discovery");
20251
- const catalog = parseKiroModelCatalog(isRecord4(template) ? template.configOptions : void 0);
20472
+ const catalog = parseKiroModelCatalog(isRecord5(template) ? template.configOptions : void 0);
20252
20473
  if (catalog.models.length > 0)
20253
20474
  return { ...initialize, catalog };
20254
20475
  await delay(Math.min(250, Math.max(0, deadline - Date.now())));
@@ -20425,7 +20646,7 @@ var KiroAcpTransport = class {
20425
20646
  }
20426
20647
  }
20427
20648
  }), this.#commandTimeoutMs, "Kiro Session fork");
20428
- if (!isRecord4(raw) || typeof raw.sessionId !== "string" || raw.sessionId.length === 0) {
20649
+ if (!isRecord5(raw) || typeof raw.sessionId !== "string" || raw.sessionId.length === 0) {
20429
20650
  throw new KiroTransportError("protocolError", "Kiro Fork returned no valid sessionId");
20430
20651
  }
20431
20652
  if (raw.sessionId === params.sourceSessionId) {
@@ -20441,7 +20662,7 @@ var KiroAcpTransport = class {
20441
20662
  cause: error51
20442
20663
  });
20443
20664
  }
20444
- 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;
20445
20666
  if (/message.*not found/iu.test(detail)) {
20446
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 });
20447
20668
  }
@@ -20558,12 +20779,23 @@ var KiroAcpTransport = class {
20558
20779
  this.#initialize = initialize;
20559
20780
  return initialize;
20560
20781
  }
20782
+ /** Latest ACP `available_commands_update` of the open Session, if any. */
20783
+ get availableCommands() {
20784
+ return this.#availableCommands;
20785
+ }
20561
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
+ }
20562
20794
  for (const listener of this.#configUpdates)
20563
20795
  listener.update(params);
20564
20796
  const update = params.update;
20565
- const meta3 = isRecord4(update) && isRecord4(update._meta) ? update._meta : void 0;
20566
- 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;
20567
20799
  let event = null;
20568
20800
  if (update.sessionUpdate === "agent_message_chunk") {
20569
20801
  const isReplay = Boolean(kiroMeta?.replay);
@@ -20611,7 +20843,7 @@ var KiroAcpTransport = class {
20611
20843
  };
20612
20844
  } else if (update.sessionUpdate === "session_info_update") {
20613
20845
  if (kiroMeta?.kind === "summarization_completed") {
20614
- const summarization = isRecord4(kiroMeta.summarization) ? kiroMeta.summarization : void 0;
20846
+ const summarization = isRecord5(kiroMeta.summarization) ? kiroMeta.summarization : void 0;
20615
20847
  event = {
20616
20848
  type: "compaction.completed",
20617
20849
  outcome: summarization?.status === "success" ? "succeeded" : "failed",
@@ -20734,7 +20966,7 @@ var KIRO_COMMANDS = [
20734
20966
  var KIRO_COMMAND_CATALOG = harnessCommandCatalogSchema.parse({
20735
20967
  commands: KIRO_COMMANDS
20736
20968
  });
20737
- function isRecord5(value) {
20969
+ function isRecord6(value) {
20738
20970
  return typeof value === "object" && value !== null && !Array.isArray(value);
20739
20971
  }
20740
20972
  function cell(value) {
@@ -20765,11 +20997,11 @@ function formatKiroCommandResult(commandId, result) {
20765
20997
  return typeof value === "string" ? value.replace(/\bBearer\s+[A-Za-z0-9._~+/=-]+/giu, "Bearer [redacted]") : value;
20766
20998
  }, 2) ?? "null";
20767
20999
  const clean = JSON.parse(json2);
20768
- if (isRecord5(clean) && clean.success === false) {
21000
+ if (isRecord6(clean) && clean.success === false) {
20769
21001
  throw new Error("Kiro could not complete the requested query");
20770
21002
  }
20771
- const data = isRecord5(clean) && isRecord5(clean.data) ? clean.data : clean;
20772
- 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)) {
20773
21005
  const sections = [
20774
21006
  "## Kiro Account Usage",
20775
21007
  table(["Account", "Value"], [
@@ -20778,7 +21010,7 @@ function formatKiroCommandResult(commandId, result) {
20778
21010
  ["Overages enabled", data.overagesEnabled]
20779
21011
  ]),
20780
21012
  "### Resources",
20781
- table(["Resource", "Used", "Limit", "Used (%)"], data.usageBreakdowns.filter(isRecord5).map((entry) => [
21013
+ table(["Resource", "Used", "Limit", "Used (%)"], data.usageBreakdowns.filter(isRecord6).map((entry) => [
20782
21014
  entry.displayName ?? entry.resourceType,
20783
21015
  entry.used,
20784
21016
  entry.hasLimit === false ? "No limit" : entry.limit,
@@ -20795,9 +21027,9 @@ function formatKiroCommandResult(commandId, result) {
20795
21027
  }
20796
21028
  return sections.join("\n\n");
20797
21029
  }
20798
- if (commandId === "kiro.context" && isRecord5(data) && isRecord5(data.breakdown)) {
21030
+ if (commandId === "kiro.context" && isRecord6(data) && isRecord6(data.breakdown)) {
20799
21031
  const breakdown = data.breakdown;
20800
- const percent = isRecord5(data.contextUsage) ? data.contextUsage.usagePercentage : data.usagePercentage;
21032
+ const percent = isRecord6(data.contextUsage) ? data.contextUsage.usagePercentage : data.usagePercentage;
20801
21033
  const sections = [
20802
21034
  "## Kiro Context Usage",
20803
21035
  ...typeof percent === "number" ? [`Context used: **${cell(percent)}%**`] : [],
@@ -20809,12 +21041,12 @@ function formatKiroCommandResult(commandId, result) {
20809
21041
  ["sessionFiles", "Session files"]
20810
21042
  ].flatMap(([key, label]) => {
20811
21043
  const entry = key ? breakdown[key] : void 0;
20812
- return isRecord5(entry) ? [[label, entry.tokens, entry.percent]] : [];
21044
+ return isRecord6(entry) ? [[label, entry.tokens, entry.percent]] : [];
20813
21045
  }))
20814
21046
  ];
20815
21047
  for (const key of ["contextFiles", "sessionFiles"]) {
20816
21048
  const entry = breakdown[key];
20817
- if (isRecord5(entry) && Array.isArray(entry.items) && entry.items.length > 0) {
21049
+ if (isRecord6(entry) && Array.isArray(entry.items) && entry.items.length > 0) {
20818
21050
  sections.push(`### ${key === "contextFiles" ? "Context Files" : "Session Files"}`, jsonBlock(JSON.stringify(entry.items, null, 2)));
20819
21051
  }
20820
21052
  }
@@ -21260,7 +21492,7 @@ function splitLines(text) {
21260
21492
  // dist/file-diff.js
21261
21493
  var DEFAULT_KIRO_FILE_CHANGE_TEXT_LIMIT = 4 * 1024 * 1024;
21262
21494
  var MAX_KIRO_FILE_CHANGES_PER_TOOL = 32;
21263
- function isRecord6(value) {
21495
+ function isRecord7(value) {
21264
21496
  return typeof value === "object" && value !== null && !Array.isArray(value);
21265
21497
  }
21266
21498
  function resolveFilePath(candidate) {
@@ -21333,7 +21565,7 @@ function projectKiroFileChanges(content, cwd, textLimit = DEFAULT_KIRO_FILE_CHAN
21333
21565
  return null;
21334
21566
  const candidates = [];
21335
21567
  for (const entry of content) {
21336
- if (isRecord6(entry) && entry.type === "diff")
21568
+ if (isRecord7(entry) && entry.type === "diff")
21337
21569
  candidates.push(entry);
21338
21570
  }
21339
21571
  if (candidates.length === 0 || candidates.length > MAX_KIRO_FILE_CHANGES_PER_TOOL)
@@ -21353,7 +21585,7 @@ function projectKiroFileChanges(content, cwd, textLimit = DEFAULT_KIRO_FILE_CHAN
21353
21585
  }
21354
21586
 
21355
21587
  // dist/projection.js
21356
- function isRecord7(value) {
21588
+ function isRecord8(value) {
21357
21589
  return typeof value === "object" && value !== null && !Array.isArray(value);
21358
21590
  }
21359
21591
  function projectKiroUserInput(interactionId, turnId, params, itemId) {
@@ -21433,7 +21665,7 @@ function projectKiroUserInput(interactionId, turnId, params, itemId) {
21433
21665
  }
21434
21666
  function projectKiroRequirementQuestion(interactionId, turnId, request) {
21435
21667
  const meta3 = request._meta?.kiro;
21436
- if (!isRecord7(meta3) || meta3.kind !== "analyze-requirements")
21668
+ if (!isRecord8(meta3) || meta3.kind !== "analyze-requirements")
21437
21669
  return null;
21438
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)
21439
21671
  throw new Error("Kiro returned invalid requirement choices");
@@ -21492,13 +21724,13 @@ function projectKiroPermission(interactionId, turnId, request) {
21492
21724
  const responses = /* @__PURE__ */ new Map();
21493
21725
  let description;
21494
21726
  const rawRequest = request;
21495
- const meta3 = isRecord7(rawRequest._meta) ? rawRequest._meta : void 0;
21496
- 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;
21497
21729
  if (kiroMeta && kiroMeta.type === "turn_approval") {
21498
- 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] : []) : [];
21499
21731
  description = ["Review modified files for this turn", ...files].join("\n");
21500
21732
  }
21501
- const consent = kiroMeta && isRecord7(kiroMeta.consent) ? kiroMeta.consent : void 0;
21733
+ const consent = kiroMeta && isRecord8(kiroMeta.consent) ? kiroMeta.consent : void 0;
21502
21734
  if (consent) {
21503
21735
  const resource = consent.triggeringResource ?? consent.resource;
21504
21736
  if (typeof resource === "string" && resource.trim())
@@ -21571,10 +21803,10 @@ function projectKiroPermission(interactionId, turnId, request) {
21571
21803
  function projectKiroToolCall(itemId, toolCall) {
21572
21804
  const hostItemId = hostItemIdSchema.parse(itemId);
21573
21805
  const meta3 = toolCall.metadata;
21574
- const kiroMeta = meta3 && isRecord7(meta3.kiro) ? meta3.kiro : void 0;
21806
+ const kiroMeta = meta3 && isRecord8(meta3.kiro) ? meta3.kiro : void 0;
21575
21807
  if (kiroMeta && kiroMeta.kind === "agent-subtask") {
21576
21808
  const subtaskId = typeof kiroMeta.agentSubtaskId === "string" ? kiroMeta.agentSubtaskId : toolCall.toolCallId;
21577
- const input = isRecord7(toolCall.rawInput) ? toolCall.rawInput : {};
21809
+ const input = isRecord8(toolCall.rawInput) ? toolCall.rawInput : {};
21578
21810
  const subagentState = {
21579
21811
  subagentId: subtaskId,
21580
21812
  description: typeof input.prompt === "string" ? input.prompt : "Subagent task",
@@ -21593,12 +21825,12 @@ function projectKiroToolCall(itemId, toolCall) {
21593
21825
  }
21594
21826
  if (toolCall.kind === "execute" || typeof toolCall.name === "string" && toolCall.name.toLowerCase().includes("execute")) {
21595
21827
  let command = "execute";
21596
- if (isRecord7(toolCall.rawInput) && typeof toolCall.rawInput.command === "string") {
21828
+ if (isRecord8(toolCall.rawInput) && typeof toolCall.rawInput.command === "string") {
21597
21829
  command = toolCall.rawInput.command;
21598
21830
  }
21599
21831
  let exitCode;
21600
21832
  let output2;
21601
- if (isRecord7(toolCall.rawOutput)) {
21833
+ if (isRecord8(toolCall.rawOutput)) {
21602
21834
  if (typeof toolCall.rawOutput.exitCode === "number") {
21603
21835
  exitCode = toolCall.rawOutput.exitCode;
21604
21836
  }
@@ -21629,7 +21861,7 @@ function projectKiroToolCall(itemId, toolCall) {
21629
21861
  type: "toolExecution",
21630
21862
  itemId: hostItemId,
21631
21863
  toolName: toolCall.name || toolCall.title || "tool",
21632
- arguments: isRecord7(toolCall.rawInput) ? toolCall.rawInput : {},
21864
+ arguments: isRecord8(toolCall.rawInput) ? toolCall.rawInput : {},
21633
21865
  ...output !== void 0 ? { output } : {}
21634
21866
  };
21635
21867
  return toolItem;
@@ -21839,7 +22071,7 @@ var KiroTurnOutput = class {
21839
22071
  };
21840
22072
 
21841
22073
  // dist/usage.js
21842
- function isRecord8(value) {
22074
+ function isRecord9(value) {
21843
22075
  return typeof value === "object" && value !== null && !Array.isArray(value);
21844
22076
  }
21845
22077
  function nonNegative(value) {
@@ -21849,7 +22081,7 @@ var KiroUsage = class {
21849
22081
  #credits = /* @__PURE__ */ new Map();
21850
22082
  #contextUsagePercent;
21851
22083
  observe(value) {
21852
- if (!isRecord8(value))
22084
+ if (!isRecord9(value))
21853
22085
  return;
21854
22086
  if (value.kind === "context_usage")
21855
22087
  this.context(value);
@@ -21858,8 +22090,8 @@ var KiroUsage = class {
21858
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;
21859
22091
  if (!key || !Array.isArray(value.promptTurnSummaries))
21860
22092
  return;
21861
- const credits = value.promptTurnSummaries.filter((entry) => isRecord8(entry) && entry.unit === "credit");
21862
- 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)))
21863
22095
  return;
21864
22096
  const total = credits.reduce((sum, entry) => sum + entry.usage, 0);
21865
22097
  if (nonNegative(total))
@@ -21867,9 +22099,9 @@ var KiroUsage = class {
21867
22099
  }
21868
22100
  }
21869
22101
  context(value) {
21870
- if (!isRecord8(value))
22102
+ if (!isRecord9(value))
21871
22103
  return;
21872
- const percent = isRecord8(value.contextUsage) ? value.contextUsage.usagePercentage : value.usagePercentage;
22104
+ const percent = isRecord9(value.contextUsage) ? value.contextUsage.usagePercentage : value.usagePercentage;
21873
22105
  if (nonNegative(percent))
21874
22106
  this.#contextUsagePercent = percent;
21875
22107
  }
@@ -21924,7 +22156,7 @@ function encodeKiroPermissionMode(nativeValue) {
21924
22156
  }
21925
22157
 
21926
22158
  // dist/history.js
21927
- function isRecord9(value) {
22159
+ function isRecord10(value) {
21928
22160
  return typeof value === "object" && value !== null && !Array.isArray(value);
21929
22161
  }
21930
22162
  function kiroHomeDir(environment = process.env) {
@@ -21969,7 +22201,7 @@ async function readKiroNativeMessages(sessionDirectory) {
21969
22201
  const raw = await readFile(messagesFile, "utf8");
21970
22202
  return raw.split("\n").map((line) => line.trim()).filter((line) => line.length > 0).map((line) => {
21971
22203
  const row = JSON.parse(line);
21972
- 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")
21973
22205
  throw new Error("Invalid Kiro history row");
21974
22206
  return row;
21975
22207
  });
@@ -22163,7 +22395,7 @@ async function readKiroSnapshot(location) {
22163
22395
  kind: row.payload.kind,
22164
22396
  rawInput: row.payload.args ?? row.payload.rawInput,
22165
22397
  rawOutput: result?.payload.content ?? result?.payload.rawOutput,
22166
- ...isRecord9(row.payload._meta) ? { metadata: row.payload._meta } : {},
22398
+ ...isRecord10(row.payload._meta) ? { metadata: row.payload._meta } : {},
22167
22399
  status: succeeded ? "completed" : "failed"
22168
22400
  }),
22169
22401
  outcome: toolOutcome
@@ -22232,7 +22464,7 @@ async function readKiroSnapshot(location) {
22232
22464
  }
22233
22465
 
22234
22466
  // dist/kiro-adapter.js
22235
- function isRecord10(value) {
22467
+ function isRecord11(value) {
22236
22468
  return typeof value === "object" && value !== null && !Array.isArray(value);
22237
22469
  }
22238
22470
  var KIRO_SESSION_CAPABILITIES = {
@@ -22258,6 +22490,7 @@ var KIRO_SESSION_CAPABILITIES = {
22258
22490
  var KiroAdapter = class {
22259
22491
  harnessId = harnessIdSchema.parse("kiro-cli");
22260
22492
  commandCatalog = KIRO_COMMAND_CATALOG;
22493
+ liveCommandCatalog = true;
22261
22494
  #options;
22262
22495
  #deps;
22263
22496
  #sessions = /* @__PURE__ */ new Set();
@@ -22329,7 +22562,7 @@ var KiroAdapter = class {
22329
22562
  const transport = this.#createTransport(cwd);
22330
22563
  try {
22331
22564
  const initialize = await transport.inspect();
22332
- 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);
22333
22566
  if (modelCatalog.models.length === 0)
22334
22567
  throw new Error("Kiro returned no native model catalog");
22335
22568
  return {
@@ -22669,7 +22902,7 @@ var KiroSession = class {
22669
22902
  };
22670
22903
  this.outputs = this.#channel.outputs;
22671
22904
  this.commands = {
22672
- list: async () => ({ ok: true, value: KIRO_COMMAND_CATALOG }),
22905
+ list: async () => ({ ok: true, value: this.#liveCommandCatalog() }),
22673
22906
  execute: async (cmd) => this.#executeHarnessCommand(cmd)
22674
22907
  };
22675
22908
  }
@@ -22750,7 +22983,7 @@ var KiroSession = class {
22750
22983
  }
22751
22984
  };
22752
22985
  } catch (error51) {
22753
- if (this.#newSessionWithoutTurn && isRecord10(error51) && error51.code === "ENOENT") {
22986
+ if (this.#newSessionWithoutTurn && isRecord11(error51) && error51.code === "ENOENT") {
22754
22987
  return { ok: true, value: { turns: [], state: this.#state() } };
22755
22988
  }
22756
22989
  return {
@@ -22829,7 +23062,7 @@ var KiroSession = class {
22829
23062
  if (event.type === "usage") {
22830
23063
  this.observeUsage(event);
22831
23064
  const meta3 = event.metadata?.kiro;
22832
- 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") {
22833
23066
  assignedUserMessageId = meta3.userMessageId;
22834
23067
  }
22835
23068
  } else if (event.type === "compaction.completed") {
@@ -22911,7 +23144,7 @@ var KiroSession = class {
22911
23144
  });
22912
23145
  })
22913
23146
  ]);
22914
- if (isRecord10(promptResult) && promptResult.stopReason === "cancelled") {
23147
+ if (isRecord11(promptResult) && promptResult.stopReason === "cancelled") {
22915
23148
  turnOutcome = { status: "cancelled", reason: "User cancelled" };
22916
23149
  } else {
22917
23150
  turnOutcome = { status: "succeeded" };
@@ -23177,7 +23410,21 @@ var KiroSession = class {
23177
23410
  ...this.#thinking
23178
23411
  };
23179
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
+ }
23180
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
+ }
23181
23428
  if (this.#closed)
23182
23429
  return {
23183
23430
  ok: false,
@@ -23226,7 +23473,7 @@ var KiroSession = class {
23226
23473
  }
23227
23474
  });
23228
23475
  const result2 = await Promise.race([stopped, this.#transport.compact()]);
23229
- if (isRecord10(result2) && result2.success === false) {
23476
+ if (isRecord11(result2) && result2.success === false) {
23230
23477
  throw new Error("Kiro context compaction did not complete");
23231
23478
  }
23232
23479
  this.#channel.emit({