@codexhost/cli-linux-arm64 0.18.0-beta.5 → 0.19.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.
Files changed (58) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +64 -4
  4. package/app/console-web.js +193 -73
  5. package/app/desktop-controller.mjs +274 -11
  6. package/app/host-runtime.mjs +12322 -2469
  7. package/app/plugins/antigravity/plugin.mjs +654 -216
  8. package/app/plugins/claude-code/plugin.mjs +138 -11
  9. package/app/plugins/codebuddy/plugin.mjs +152 -20
  10. package/app/plugins/codex-usage/plugin.mjs +59 -2
  11. package/app/plugins/copilot/plugin.mjs +59 -2
  12. package/app/plugins/cursor-cli/plugin.mjs +134 -12
  13. package/app/plugins/deepseek-harness/manifest.json +2 -2
  14. package/app/plugins/deepseek-harness/plugin.mjs +86 -7
  15. package/app/plugins/devin/plugin.mjs +59 -2
  16. package/app/plugins/grok/plugin.mjs +392 -269
  17. package/app/plugins/hermes/plugin.mjs +138 -14
  18. package/app/plugins/kimi-code/plugin.mjs +59 -2
  19. package/app/plugins/kiro-cli/plugin.mjs +287 -18
  20. package/app/plugins/omp/plugin.mjs +788 -627
  21. package/app/plugins/opencode/plugin.mjs +59 -2
  22. package/app/plugins/pi/plugin.mjs +899 -773
  23. package/app/plugins/qoder/plugin.mjs +61 -6
  24. package/app/plugins/qoder-cn/plugin.mjs +61 -6
  25. package/app/plugins/qwen-code/plugin.mjs +168 -94
  26. package/app/plugins/workbuddy/plugin.mjs +152 -20
  27. package/app/plugins/zcode/plugin.mjs +132 -5
  28. package/app/renderer-extension.js +739 -336
  29. package/app/web/assets/index-BNQIOOHE.css +1 -0
  30. package/app/web/assets/index-Feo4BkqN.js +199 -0
  31. package/app/web/codexhost-settings.js +151 -65
  32. package/app/web/index.html +2 -2
  33. package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
  34. package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +8 -8
  35. package/app/web/plugins/deepseek-ai__dsh-client-file-upload/client.js +1 -1
  36. package/app/web/plugins/deepseek-ai__dsh-client-locale/client.js +3 -3
  37. package/app/web/plugins/deepseek-ai__dsh-client-ui-attachment/client.js +1 -1
  38. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +129 -8
  39. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +65 -63
  40. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +95 -93
  41. package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
  42. package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +2 -2
  43. package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +1 -1
  44. package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +3 -3
  45. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.excel.js +1 -1
  46. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-files/client.js +1 -1
  47. package/app/web/plugins/deepseek-ai__dsh-client-ui-theme/client.js +1 -1
  48. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +16 -16
  49. package/app/web/plugins/deepseek-ai__dsh-client-ui-user-questions/client.js +1 -1
  50. package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +11 -11
  51. package/app/web/sw.js +40 -0
  52. package/app/web-modules/server.mjs +2339 -1514
  53. package/bin/codexhost +0 -0
  54. package/libexec/codexhost-shim +0 -0
  55. package/libexec/codexhost-updater +0 -0
  56. package/package.json +1 -1
  57. package/app/web/assets/index-C0aXz2jD.js +0 -199
  58. package/app/web/assets/index-C3lniEH1.css +0 -1
@@ -347,10 +347,6 @@ function createHarnessInstaller(environment, source) {
347
347
  };
348
348
  }
349
349
 
350
- // dist/kiro-adapter.js
351
- import { randomUUID } from "node:crypto";
352
- import path8 from "node:path";
353
-
354
350
  // ../../../node_modules/zod/v4/classic/external.js
355
351
  var external_exports = {};
356
352
  __export(external_exports, {
@@ -15444,6 +15440,10 @@ var CLIENT_CHANNEL_VERSION = 1;
15444
15440
  var CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
15445
15441
  var clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict();
15446
15442
  var clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict();
15443
+ var clientThreadTreeReadParamsSchema = external_exports.object({}).strict();
15444
+ var clientThreadTreeSchema = external_exports.object({
15445
+ parents: external_exports.record(external_exports.string().min(1), external_exports.string().min(1))
15446
+ }).strict();
15447
15447
  var clientProjectlessWorkspaceSchema = external_exports.object({
15448
15448
  prompt: external_exports.string().max(16384).optional()
15449
15449
  }).strict();
@@ -15460,6 +15460,11 @@ var clientChannelCursorSchema = external_exports.object({
15460
15460
  sequence: external_exports.number().int().nonnegative()
15461
15461
  });
15462
15462
  var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
15463
+ external_exports.object({
15464
+ type: external_exports.literal("skills-changed"),
15465
+ cursor: clientChannelCursorSchema,
15466
+ cwd: external_exports.string().optional()
15467
+ }),
15463
15468
  external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
15464
15469
  external_exports.object({
15465
15470
  type: external_exports.literal("preferences-changed"),
@@ -15657,6 +15662,28 @@ var voiceTranscribeResultSchema = external_exports.discriminatedUnion("ok", [
15657
15662
  external_exports.object({ ok: external_exports.literal(false), error: external_exports.object({ code: voiceErrorCodeSchema }).strict() }).strict()
15658
15663
  ]);
15659
15664
 
15665
+ // ../../shared-contracts/dist/skills.js
15666
+ var skillsListParamsSchema = external_exports.object({
15667
+ threadId: hostThreadIdSchema.optional(),
15668
+ cwd: external_exports.string().min(1).optional()
15669
+ }).strict().refine((params) => !(params.threadId && params.cwd), {
15670
+ message: "Specify threadId or cwd, not both"
15671
+ });
15672
+ var librarySkillSchema = external_exports.object({
15673
+ name: external_exports.string().min(1).regex(/^[^\s[\]]+$/u),
15674
+ description: external_exports.string().optional(),
15675
+ path: external_exports.string().min(1),
15676
+ scope: external_exports.enum(["project", "global"]),
15677
+ source: external_exports.string().min(1)
15678
+ }).strict();
15679
+ var skillsListResultSchema = external_exports.object({
15680
+ revision: external_exports.number().int().nonnegative(),
15681
+ complete: external_exports.boolean(),
15682
+ skills: external_exports.array(librarySkillSchema),
15683
+ warnings: external_exports.array(external_exports.string()).optional()
15684
+ }).strict();
15685
+ var skillsChangedParamsSchema = external_exports.object({ cwd: external_exports.string().min(1).optional() }).strict();
15686
+
15660
15687
  // ../../shared-contracts/dist/web-access-tokens.js
15661
15688
  var webNetworkAccessUrlSchema = external_exports.object({
15662
15689
  /**
@@ -15762,8 +15789,8 @@ var REMOTE_THREAD_REPLY_MAX_BYTES = 16 * 1024 * 1024;
15762
15789
  var delegationReadParamsSchema = external_exports.strictObject({
15763
15790
  threadId: external_exports.string().min(1).max(1024),
15764
15791
  view: external_exports.enum(["result", "messages"]),
15765
- cursor: external_exports.string().min(1).max(8192).optional(),
15766
- limit: external_exports.number().int().min(1).max(100).optional()
15792
+ from: external_exports.number().int().min(1).max(Number.MAX_SAFE_INTEGER).optional(),
15793
+ to: external_exports.number().int().min(1).max(Number.MAX_SAFE_INTEGER).optional()
15767
15794
  });
15768
15795
 
15769
15796
  // ../../shared-contracts/dist/credential-imports.js
@@ -16716,6 +16743,17 @@ var updateStatusResultSchema = external_exports.strictObject({
16716
16743
  status: updateStatusSchema.nullable()
16717
16744
  });
16718
16745
 
16746
+ // ../../shared-contracts/dist/thread-watch-notice.js
16747
+ var THREAD_WATCH_NOTICE_OUTCOMES = [
16748
+ "completed",
16749
+ "failed",
16750
+ "interrupted",
16751
+ "timedOut",
16752
+ "unreadable",
16753
+ "notFound"
16754
+ ];
16755
+ var ENTRY_PATTERN = new RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)\): ` + `(${THREAD_WATCH_NOTICE_OUTCOMES.join("|")})(?:. (.+))?$`, "u");
16756
+
16719
16757
  // ../../shared-contracts/dist/remote-runtime.js
16720
16758
  var remoteUpdatePhaseSchema = external_exports.enum([
16721
16759
  "idle",
@@ -16763,6 +16801,14 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
16763
16801
  archived: external_exports.boolean()
16764
16802
  }),
16765
16803
  external_exports.strictObject({ kind: external_exports.literal("read"), ...thread }),
16804
+ external_exports.strictObject({
16805
+ kind: external_exports.literal("configure"),
16806
+ ...thread,
16807
+ epoch: identity,
16808
+ modelId: identity.optional(),
16809
+ thinkingOptionId: identity.optional(),
16810
+ permissionModeId: identity.optional()
16811
+ }).refine((value) => [value.modelId, value.thinkingOptionId, value.permissionModeId].filter((v) => v !== void 0).length === 1, "Select exactly one remote setting"),
16766
16812
  external_exports.strictObject({
16767
16813
  kind: external_exports.literal("prompt"),
16768
16814
  ...thread,
@@ -16835,6 +16881,13 @@ var remoteConnectionsReplySchema = external_exports.union([
16835
16881
  external_exports.strictObject({ error: external_exports.strictObject({ code: external_exports.number().int(), message: external_exports.string() }) })
16836
16882
  ]);
16837
16883
 
16884
+ // ../../shared-contracts/dist/thread-title.js
16885
+ var threadTitleInputSchema = external_exports.strictObject({
16886
+ prompt: external_exports.string().trim().min(1).max(2e3),
16887
+ cwd: external_exports.string().max(4096).nullable()
16888
+ });
16889
+ var threadTitleResultSchema = external_exports.string().trim().min(1).max(60).nullable();
16890
+
16838
16891
  // ../../shared-contracts/dist/web-ui-extensions.js
16839
16892
  var webUiExtensionIdSchema = external_exports.string().max(214).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u);
16840
16893
  var localizedTextSchema2 = external_exports.union([
@@ -16878,6 +16931,47 @@ var webUiExtensionRemoveSchema = external_exports.object({ id: webUiExtensionIdS
16878
16931
  // ../../shared-contracts/dist/index.js
16879
16932
  var workspaceContractVersionSchema = external_exports.literal(WORKSPACE_CONTRACT_VERSION);
16880
16933
 
16934
+ // dist/subagents.js
16935
+ function kiroChildSnapshot(parentId, item, childId) {
16936
+ const child = item.subagents.find((child2) => child2.nativeSubagentId === childId);
16937
+ if (!child)
16938
+ throw new Error("Kiro task does not belong to this parent");
16939
+ return {
16940
+ turns: [
16941
+ {
16942
+ nativeTurnRef: nativeTurnRefSchema.parse({
16943
+ harnessId: "kiro-cli",
16944
+ nativeSessionId: parentId,
16945
+ nativeTurnKey: childId,
16946
+ formatVersion: 1
16947
+ }),
16948
+ input: item.prompt ? [{ type: "text", text: item.prompt }] : [],
16949
+ items: child.resultSummary ? [
16950
+ {
16951
+ item: {
16952
+ type: "agentMessage",
16953
+ itemId: hostItemIdSchema.parse(`kiro-task-result-${childId}`),
16954
+ text: child.resultSummary
16955
+ },
16956
+ outcome: { status: "succeeded" }
16957
+ }
16958
+ ] : [],
16959
+ outcome: child.status === "pending" || child.status === "running" ? {
16960
+ status: "unknown",
16961
+ reason: "Kiro ACP exposes task summaries, not the child's internal step stream"
16962
+ } : child.status === "interrupted" ? { status: "cancelled" } : child.status === "failed" ? {
16963
+ status: "failed",
16964
+ error: {
16965
+ code: "nativeFailure",
16966
+ message: child.resultSummary || "Kiro task failed",
16967
+ retryable: false
16968
+ }
16969
+ } : { status: "succeeded" }
16970
+ }
16971
+ ]
16972
+ };
16973
+ }
16974
+
16881
16975
  // ../../harness-adapter/dist/approval.js
16882
16976
  function invalidRequest(message) {
16883
16977
  return { code: "invalidRequest", message, retryable: false };
@@ -17200,14 +17294,12 @@ var COMMON_EXCLUDED_LIVE_COMMANDS = /* @__PURE__ */ new Set([
17200
17294
  "reload-plugins"
17201
17295
  ]);
17202
17296
  var COMMON_EXCLUDED_LIVE_COMMAND_PREFIXES = ["__", "hooks-"];
17203
- function isExcludedLiveCommand(name, kind, extra = {}) {
17297
+ function isExcludedLiveCommand(name, extra = {}) {
17204
17298
  const normalized = name.trim().replace(/^\//u, "");
17205
17299
  if (new Set(extra.names ?? []).has(normalized))
17206
17300
  return true;
17207
17301
  if (extra.prefixes?.some((prefix) => normalized.startsWith(prefix)))
17208
17302
  return true;
17209
- if (kind === "skill")
17210
- return false;
17211
17303
  return COMMON_EXCLUDED_LIVE_COMMANDS.has(normalized) || COMMON_EXCLUDED_LIVE_COMMAND_PREFIXES.some((prefix) => normalized.startsWith(prefix));
17212
17304
  }
17213
17305
  function liveHarnessCommandPrompt(catalog, idPrefix, commandId, argumentText) {
@@ -17229,7 +17321,7 @@ function mergeLiveHarnessCommands(builtIns, idPrefix, live, exclusions = {}) {
17229
17321
  const name = command.name.trim().replace(/^\//u, "");
17230
17322
  if (!name || /\s/u.test(name))
17231
17323
  continue;
17232
- if (isExcludedLiveCommand(name, command.kind, exclusions))
17324
+ if (isExcludedLiveCommand(name, exclusions))
17233
17325
  continue;
17234
17326
  const invocation = `/${name}`;
17235
17327
  const id = `${idPrefix}${name.replace(/[^A-Za-z0-9._:-]/gu, "-")}`.slice(0, 128);
@@ -17241,8 +17333,7 @@ function mergeLiveHarnessCommands(builtIns, idPrefix, live, exclusions = {}) {
17241
17333
  invocation,
17242
17334
  label: name.slice(0, 128),
17243
17335
  ...description ? { description } : {},
17244
- argumentMode: "text",
17245
- kind: command.kind
17336
+ argumentMode: "text"
17246
17337
  });
17247
17338
  if (!parsed.success)
17248
17339
  continue;
@@ -17253,6 +17344,64 @@ function mergeLiveHarnessCommands(builtIns, idPrefix, live, exclusions = {}) {
17253
17344
  return harnessCommandCatalogSchema.parse({ commands: [...builtIns.commands, ...dynamic] });
17254
17345
  }
17255
17346
 
17347
+ // ../../harness-adapter/dist/subagent-configuration.js
17348
+ function subagentConfiguration(value) {
17349
+ if (typeof value !== "object" || value === null || Array.isArray(value))
17350
+ return {};
17351
+ const row = value;
17352
+ const text = (value2) => typeof value2 === "string" && value2.trim() ? value2 : void 0;
17353
+ const model2 = row.model === "inherit" ? void 0 : text(row.model);
17354
+ const reasoningEffort = text(row.reasoningEffort) ?? text(row.reasoning_effort) ?? text(row.thinking);
17355
+ return { ...model2 ? { model: model2 } : {}, ...reasoningEffort ? { reasoningEffort } : {} };
17356
+ }
17357
+ function inheritSubagentConfiguration(child, parent) {
17358
+ const native = subagentConfiguration(child);
17359
+ const model2 = native.model ?? parent.model;
17360
+ const reasoningEffort = native.reasoningEffort ?? parent.reasoningEffort;
17361
+ const next = { ...child };
17362
+ delete next.model;
17363
+ delete next.reasoningEffort;
17364
+ return { ...next, ...model2 ? { model: model2 } : {}, ...reasoningEffort ? { reasoningEffort } : {} };
17365
+ }
17366
+ function configureSubagentEvent(event, parent) {
17367
+ const children = (states) => states.map((child) => inheritSubagentConfiguration(child, parent));
17368
+ if (event.type === "item.started" && event.item.type === "subagentDelegation")
17369
+ return { ...event, item: { ...event.item, subagents: children(event.item.subagents) } };
17370
+ if (event.type === "item.updated" && event.update.type === "subagents.replace")
17371
+ return { ...event, update: { ...event.update, subagents: children(event.update.subagents) } };
17372
+ if (event.type === "item.completed" && event.snapshot.item.type === "subagentDelegation")
17373
+ return {
17374
+ ...event,
17375
+ snapshot: {
17376
+ ...event.snapshot,
17377
+ item: {
17378
+ ...event.snapshot.item,
17379
+ subagents: children(event.snapshot.item.subagents)
17380
+ }
17381
+ }
17382
+ };
17383
+ return event;
17384
+ }
17385
+ function configureSubagentSnapshot(snapshot, parent) {
17386
+ return {
17387
+ ...snapshot,
17388
+ turns: snapshot.turns.map((turn) => ({
17389
+ ...turn,
17390
+ items: turn.items.map((entry) => entry.item.type === "subagentDelegation" ? {
17391
+ ...entry,
17392
+ item: {
17393
+ ...entry.item,
17394
+ subagents: entry.item.subagents.map((child) => inheritSubagentConfiguration(child, parent))
17395
+ }
17396
+ } : entry)
17397
+ }))
17398
+ };
17399
+ }
17400
+
17401
+ // dist/kiro-adapter.js
17402
+ import { randomUUID } from "node:crypto";
17403
+ import path8 from "node:path";
17404
+
17256
17405
  // dist/acp-transport.js
17257
17406
  import { spawn, spawnSync } from "node:child_process";
17258
17407
  import { Readable, Writable } from "node:stream";
@@ -21446,10 +21595,9 @@ function parseKiroAvailableCommands(value) {
21446
21595
  });
21447
21596
  }
21448
21597
  function kiroLiveCommands(native) {
21449
- return native.map((command) => ({
21598
+ return native.filter((command) => command.type !== "skill").map((command) => ({
21450
21599
  name: command.name,
21451
- description: command.description,
21452
- kind: command.type === "skill" ? "skill" : "command"
21600
+ description: command.description
21453
21601
  }));
21454
21602
  }
21455
21603
 
@@ -23067,9 +23215,12 @@ function projectKiroToolCall(itemId, toolCall) {
23067
23215
  const input = isRecord8(toolCall.rawInput) ? toolCall.rawInput : {};
23068
23216
  const subagentState = {
23069
23217
  subagentId: subtaskId,
23218
+ nativeSubagentId: subtaskId,
23070
23219
  description: typeof input.prompt === "string" ? input.prompt : "Subagent task",
23220
+ ...subagentConfiguration(input),
23221
+ ...subagentConfiguration(kiroMeta),
23071
23222
  background: false,
23072
- status: toolCall.status === "completed" ? "completed" : toolCall.status === "failed" ? "failed" : "running",
23223
+ status: toolCall.status === "pending" ? "pending" : toolCall.status === "completed" ? "completed" : toolCall.status === "failed" ? "failed" : "running",
23073
23224
  ...typeof input.name === "string" ? { role: input.name } : {},
23074
23225
  ...typeof toolCall.rawOutput === "string" ? { resultSummary: toolCall.rawOutput } : {}
23075
23226
  };
@@ -23077,6 +23228,7 @@ function projectKiroToolCall(itemId, toolCall) {
23077
23228
  type: "subagentDelegation",
23078
23229
  itemId: hostItemId,
23079
23230
  operation: "spawn",
23231
+ ...typeof input.prompt === "string" ? { prompt: input.prompt } : {},
23080
23232
  subagents: [subagentState]
23081
23233
  };
23082
23234
  return subagentItem;
@@ -23200,6 +23352,15 @@ var KiroTurnOutput = class {
23200
23352
  this.emit({ kind: "event", event: { type: "item.started", turnId: this.turnId, item } });
23201
23353
  }
23202
23354
  #complete(item, outcome) {
23355
+ if (item.type === "subagentDelegation") {
23356
+ item = {
23357
+ ...item,
23358
+ subagents: item.subagents.map((child) => ({
23359
+ ...child,
23360
+ status: outcome.status === "cancelled" ? "interrupted" : outcome.status === "failed" ? "failed" : child.status
23361
+ }))
23362
+ };
23363
+ }
23203
23364
  this.emit({
23204
23365
  kind: "event",
23205
23366
  event: {
@@ -23208,6 +23369,26 @@ var KiroTurnOutput = class {
23208
23369
  snapshot: { item, outcome }
23209
23370
  }
23210
23371
  });
23372
+ if (item.type === "subagentDelegation") {
23373
+ for (const child of item.subagents)
23374
+ if (child.nativeSubagentId) {
23375
+ this.emit({
23376
+ kind: "event",
23377
+ event: {
23378
+ type: "subagent.state.changed",
23379
+ nativeSubagentId: child.nativeSubagentId,
23380
+ status: child.status
23381
+ }
23382
+ });
23383
+ this.emit({
23384
+ kind: "event",
23385
+ event: {
23386
+ type: "subagent.transcript.changed",
23387
+ nativeSubagentId: child.nativeSubagentId
23388
+ }
23389
+ });
23390
+ }
23391
+ }
23211
23392
  }
23212
23393
  #completeMessage(outcome, phase) {
23213
23394
  this.#appendText(this.#text.finish());
@@ -23303,6 +23484,17 @@ var KiroTurnOutput = class {
23303
23484
  const tool = { ...previous, event: merged, item, done };
23304
23485
  this.#tools.set(event.callId, tool);
23305
23486
  if (!done) {
23487
+ if (previous?.item.type === "subagentDelegation" && item.type === "subagentDelegation" && JSON.stringify(previous.item.subagents) !== JSON.stringify(item.subagents)) {
23488
+ this.emit({
23489
+ kind: "event",
23490
+ event: {
23491
+ type: "item.updated",
23492
+ turnId: this.turnId,
23493
+ itemId: item.itemId,
23494
+ update: { type: "subagents.replace", subagents: item.subagents }
23495
+ }
23496
+ });
23497
+ }
23306
23498
  this.#fileOutput(tool, event.content);
23307
23499
  return;
23308
23500
  }
@@ -23998,7 +24190,7 @@ var KIRO_SESSION_CAPABILITIES = {
23998
24190
  },
23999
24191
  subagents: {
24000
24192
  observe: true,
24001
- readTranscript: false
24193
+ readTranscript: true
24002
24194
  },
24003
24195
  autonomousTurns: {
24004
24196
  observe: false
@@ -24006,6 +24198,42 @@ var KIRO_SESSION_CAPABILITIES = {
24006
24198
  };
24007
24199
  var KiroAdapter = class {
24008
24200
  harnessId = harnessIdSchema.parse("kiro-cli");
24201
+ subagents = {
24202
+ readSnapshot: async ({ parent, nativeSubagentId }) => {
24203
+ try {
24204
+ if (parent.harnessId !== this.harnessId)
24205
+ throw new Error("Invalid Kiro parent");
24206
+ for (const session of this.#sessions) {
24207
+ if (session.initialState.nativeRef?.nativeSessionId !== parent.nativeSessionId)
24208
+ continue;
24209
+ const live = session.subagentSnapshot(nativeSubagentId);
24210
+ if (live)
24211
+ return { ok: true, value: live };
24212
+ }
24213
+ const locate = this.#deps.locateSession ?? locateKiroNativeSession;
24214
+ const location = await locate({ environment: this.#options.environment }, parent.nativeSessionId);
24215
+ if (!location)
24216
+ throw new Error("Kiro parent history was not found");
24217
+ const snapshot = await (this.#deps.readSnapshot ?? readKiroSnapshot)(location);
24218
+ const item = snapshot.turns.flatMap((turn) => turn.items).map(({ item: item2 }) => item2).find((item2) => item2.type === "subagentDelegation" && item2.subagents.some((child) => child.nativeSubagentId === nativeSubagentId));
24219
+ if (!item || item.type !== "subagentDelegation")
24220
+ throw new Error("Kiro task was not found in this parent");
24221
+ return {
24222
+ ok: true,
24223
+ value: kiroChildSnapshot(parent.nativeSessionId, item, nativeSubagentId)
24224
+ };
24225
+ } catch (error51) {
24226
+ return {
24227
+ ok: false,
24228
+ error: {
24229
+ code: "sessionNotFound",
24230
+ message: error51 instanceof Error ? error51.message : "Kiro task could not be read",
24231
+ retryable: false
24232
+ }
24233
+ };
24234
+ }
24235
+ }
24236
+ };
24009
24237
  commandCatalog = KIRO_COMMAND_CATALOG;
24010
24238
  liveCommandCatalog = true;
24011
24239
  sessionImport;
@@ -24472,7 +24700,45 @@ var KiroSession = class {
24472
24700
  });
24473
24701
  return this.#usageRefresh;
24474
24702
  }
24703
+ #subagentItems = /* @__PURE__ */ new Map();
24704
+ subagentSnapshot(id) {
24705
+ const item = this.#subagentItems.get(id);
24706
+ return item ? kiroChildSnapshot(this.#sessionId, item, id) : void 0;
24707
+ }
24708
+ #subagentEvent(event) {
24709
+ const configured = configureSubagentEvent(event, this.#subagentConfiguration());
24710
+ const item = configured.type === "item.started" ? configured.item : configured.type === "item.completed" ? configured.snapshot.item : void 0;
24711
+ if (configured.type === "item.updated" && configured.update.type === "subagents.replace") {
24712
+ for (const previous of this.#subagentItems.values()) {
24713
+ if (previous.itemId !== configured.itemId)
24714
+ continue;
24715
+ const next = { ...previous, subagents: structuredClone(configured.update.subagents) };
24716
+ for (const child of next.subagents)
24717
+ if (child.nativeSubagentId)
24718
+ this.#subagentItems.set(child.nativeSubagentId, next);
24719
+ break;
24720
+ }
24721
+ }
24722
+ if (item?.type === "subagentDelegation") {
24723
+ for (const child of item.subagents)
24724
+ if (child.nativeSubagentId)
24725
+ this.#subagentItems.set(child.nativeSubagentId, structuredClone(item));
24726
+ }
24727
+ return configured;
24728
+ }
24729
+ #subagentConfiguration() {
24730
+ const state = this.#state();
24731
+ const model2 = state.effectiveModel ? state.effectiveModel.id : void 0;
24732
+ return {
24733
+ ...model2 ? { model: model2 } : {},
24734
+ ...state.effectiveThinkingOptionId ? { reasoningEffort: state.effectiveThinkingOptionId } : {}
24735
+ };
24736
+ }
24475
24737
  async readSnapshot() {
24738
+ const result = await this.#readSnapshot();
24739
+ return result.ok ? { ok: true, value: configureSubagentSnapshot(result.value, this.#subagentConfiguration()) } : result;
24740
+ }
24741
+ async #readSnapshot() {
24476
24742
  if (this.#activeTurnId !== null || this.#configBusy) {
24477
24743
  return {
24478
24744
  ok: false,
@@ -24567,7 +24833,10 @@ var KiroSession = class {
24567
24833
  event: { type: "turn.started", turnId }
24568
24834
  });
24569
24835
  const userText2 = command.input.map((i) => i.text).join("\n");
24570
- const output = new KiroTurnOutput(turnId, this.#cwd, (event) => this.#channel.emit(event));
24836
+ const output = new KiroTurnOutput(turnId, this.#cwd, (output2) => this.#channel.emit(output2.kind === "event" ? {
24837
+ ...output2,
24838
+ event: this.#subagentEvent(output2.event)
24839
+ } : output2));
24571
24840
  let assignedUserMessageId;
24572
24841
  const stopped = new Promise((_resolve, reject) => {
24573
24842
  this.#stopTurn = () => reject(this.#faultError ?? new Error("Session closed"));