@codexhost/cli-linux-arm64 0.18.0 → 0.20.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 (67) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +83 -5
  4. package/app/console-web.js +1172 -687
  5. package/app/desktop-controller.mjs +314 -15
  6. package/app/host-runtime.mjs +13158 -2853
  7. package/app/plugins/antigravity/plugin.mjs +8861 -3944
  8. package/app/plugins/claude-code/plugin.mjs +164 -14
  9. package/app/plugins/codebuddy/plugin.mjs +193 -25
  10. package/app/plugins/codex-usage/plugin.mjs +85 -5
  11. package/app/plugins/copilot/plugin.mjs +85 -5
  12. package/app/plugins/cursor-cli/plugin.mjs +160 -15
  13. package/app/plugins/deepseek-harness/manifest.json +2 -2
  14. package/app/plugins/deepseek-harness/plugin.mjs +112 -10
  15. package/app/plugins/devin/plugin.mjs +84 -5
  16. package/app/plugins/grok/plugin.mjs +418 -272
  17. package/app/plugins/hermes/plugin.mjs +163 -17
  18. package/app/plugins/kimi-code/plugin.mjs +85 -5
  19. package/app/plugins/kiro-cli/plugin.mjs +313 -21
  20. package/app/plugins/omp/plugin.mjs +1018 -819
  21. package/app/plugins/opencode/plugin.mjs +85 -5
  22. package/app/plugins/pi/plugin.mjs +828 -663
  23. package/app/plugins/qoder/plugin.mjs +109 -10
  24. package/app/plugins/qoder-cn/plugin.mjs +109 -10
  25. package/app/plugins/qwen-code/plugin.mjs +194 -97
  26. package/app/plugins/workbuddy/plugin.mjs +197 -28
  27. package/app/plugins/zcode/plugin.mjs +158 -8
  28. package/app/renderer-extension.js +2065 -1004
  29. package/app/web/assets/index-D6-hvggd.css +1 -0
  30. package/app/web/assets/index-D85gPBbQ.js +201 -0
  31. package/app/web/assets/langs/{graphql-B8vkg11W.js → graphql-ChAeyPkT.js} +1 -1
  32. package/app/web/assets/langs/{http-DmoDEjMt.js → http-BvreBIbD.js} +1 -1
  33. package/app/web/assets/langs/{php-DJ5ovfAM.js → php-D8omCIuJ.js} +1 -1
  34. package/app/web/assets/langs/{rst-U5-R5x3p.js → rst-Do7RLLCS.js} +1 -1
  35. package/app/web/assets/langs/{ruby-VKVsnS0H.js → ruby-rH_O_vse.js} +1 -1
  36. package/app/web/assets/langs/{svelte-C20lOv9V.js → svelte-xZy73wAj.js} +1 -1
  37. package/app/web/assets/langs/{vue-z6Y-lzP-.js → vue-C4DW8agZ.js} +1 -1
  38. package/app/web/assets/{vendor-dSL872WO.js → vendor-C9g2bw8s.js} +3 -3
  39. package/app/web/codexhost-settings.js +1178 -689
  40. package/app/web/index.html +4 -3
  41. package/app/web/plugins/deepseek-ai__dsh-api-gateway/client.js +2 -2
  42. package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
  43. package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +8 -8
  44. package/app/web/plugins/deepseek-ai__dsh-client-connection/client.js +1 -1
  45. package/app/web/plugins/deepseek-ai__dsh-client-file-upload/client.js +1 -1
  46. package/app/web/plugins/deepseek-ai__dsh-client-locale/client.js +3 -3
  47. package/app/web/plugins/deepseek-ai__dsh-client-ui-attachment/client.js +1 -1
  48. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +134 -8
  49. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +65 -63
  50. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +95 -93
  51. package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
  52. package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +2 -2
  53. package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +1 -1
  54. package/app/web/plugins/deepseek-ai__dsh-client-ui-session/client.js +1 -1
  55. package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +1 -1
  56. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.excel.js +1 -1
  57. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-files/client.js +1 -1
  58. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
  59. package/app/web/plugins/deepseek-ai__dsh-client-ui-user-questions/client.js +1 -1
  60. package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +11 -11
  61. package/app/web-modules/server.mjs +2468 -1575
  62. package/bin/codexhost +0 -0
  63. package/libexec/codexhost-shim +0 -0
  64. package/libexec/codexhost-updater +0 -0
  65. package/package.json +1 -1
  66. package/app/web/assets/index-C0aXz2jD.js +0 -199
  67. package/app/web/assets/index-C3lniEH1.css +0 -1
@@ -14662,13 +14662,25 @@ var threadPermissionModeSelectParamsSchema = external_exports.object({
14662
14662
  var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
14663
14663
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
14664
14664
  var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
14665
+ var usageOutputTimingSchema = external_exports.object({
14666
+ version: external_exports.literal(3).optional(),
14667
+ requestId: external_exports.string().min(1),
14668
+ turnId: external_exports.string().min(1).max(1024),
14669
+ outputTokens: nonNegativeSafeIntegerSchema,
14670
+ startedAtMs: nonNegativeSafeIntegerSchema,
14671
+ completedAtMs: nonNegativeSafeIntegerSchema
14672
+ }).strict().refine((value) => value.completedAtMs > value.startedAtMs);
14665
14673
  var usageMeasurementSchema = external_exports.object({
14674
+ version: external_exports.union([external_exports.literal(2), external_exports.literal(3)]).optional(),
14666
14675
  value: finiteNonNegativeNumberSchema,
14667
14676
  turnId: external_exports.string().min(1).max(1024),
14668
14677
  at: nonNegativeSafeIntegerSchema
14669
14678
  }).strict();
14670
14679
  var usageMeasurementsSchema = external_exports.object({
14671
- outputTokensPerSecond: usageMeasurementSchema.optional(),
14680
+ // Unversioned intervals can omit hidden thinking time; do not restore them into averages.
14681
+ outputTimings: external_exports.array(usageOutputTimingSchema).transform((values) => values.filter((value) => value.version === 3)).optional(),
14682
+ // Retain independent TTFT facts when dropping incompatible speed measurements.
14683
+ outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 3).optional().catch(void 0),
14672
14684
  timeToFirstOutputMs: usageMeasurementSchema.extend({ value: nonNegativeSafeIntegerSchema }).optional()
14673
14685
  }).strict();
14674
14686
  var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text2) => text2.length <= maximum));
@@ -14688,6 +14700,7 @@ var threadUsageSnapshotSchema = external_exports.object({
14688
14700
  cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
14689
14701
  outputTokens: nonNegativeSafeIntegerSchema.optional(),
14690
14702
  outputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
14703
+ sessionOutputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
14691
14704
  apiOutputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
14692
14705
  reasoningOutputTokens: nonNegativeSafeIntegerSchema.optional(),
14693
14706
  totalTokens: nonNegativeSafeIntegerSchema.optional(),
@@ -15099,11 +15112,19 @@ var threadSteeringInspectResultSchema = external_exports.object({
15099
15112
  delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
15100
15113
  }).strict();
15101
15114
 
15115
+ // ../../shared-contracts/dist/thread-archive-confirm.js
15116
+ var threadArchiveConfirmParamsSchema = external_exports.object({ threadId: hostThreadIdSchema }).strict();
15117
+ var threadArchiveConfirmResultSchema = external_exports.object({ confirmed: external_exports.boolean() }).strict();
15118
+
15102
15119
  // ../../shared-contracts/dist/client-channel.js
15103
15120
  var CLIENT_CHANNEL_VERSION = 1;
15104
15121
  var CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
15105
15122
  var clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict();
15106
15123
  var clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict();
15124
+ var clientThreadTreeReadParamsSchema = external_exports.object({}).strict();
15125
+ var clientThreadTreeSchema = external_exports.object({
15126
+ parents: external_exports.record(external_exports.string().min(1), external_exports.string().min(1))
15127
+ }).strict();
15107
15128
  var clientProjectlessWorkspaceSchema = external_exports.object({
15108
15129
  prompt: external_exports.string().max(16384).optional()
15109
15130
  }).strict();
@@ -15120,6 +15141,11 @@ var clientChannelCursorSchema = external_exports.object({
15120
15141
  sequence: external_exports.number().int().nonnegative()
15121
15142
  });
15122
15143
  var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
15144
+ external_exports.object({
15145
+ type: external_exports.literal("skills-changed"),
15146
+ cursor: clientChannelCursorSchema,
15147
+ cwd: external_exports.string().optional()
15148
+ }),
15123
15149
  external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
15124
15150
  external_exports.object({
15125
15151
  type: external_exports.literal("preferences-changed"),
@@ -15229,7 +15255,12 @@ var clientThreadSnapshotSchema = external_exports.object({
15229
15255
  /** Current interruptible Host Turn, including command Turns omitted from client history. */
15230
15256
  activeTurnId: external_exports.string().min(1).nullable().optional(),
15231
15257
  /** Most recent explicit command in this Host process; not native conversation history. */
15232
- command: external_exports.object({ name: external_exports.string().min(1), turn: clientTurnSchema }).optional(),
15258
+ command: external_exports.object({
15259
+ name: external_exports.string().min(1),
15260
+ turn: clientTurnSchema,
15261
+ /** First ordinary Turn started after this command; its retained result is not a new event. */
15262
+ subsequentTurnId: external_exports.string().min(1).optional()
15263
+ }).optional(),
15233
15264
  thread: external_exports.object({
15234
15265
  id: external_exports.string().min(1),
15235
15266
  cwd: external_exports.string(),
@@ -15317,6 +15348,28 @@ var voiceTranscribeResultSchema = external_exports.discriminatedUnion("ok", [
15317
15348
  external_exports.object({ ok: external_exports.literal(false), error: external_exports.object({ code: voiceErrorCodeSchema }).strict() }).strict()
15318
15349
  ]);
15319
15350
 
15351
+ // ../../shared-contracts/dist/skills.js
15352
+ var skillsListParamsSchema = external_exports.object({
15353
+ threadId: hostThreadIdSchema.optional(),
15354
+ cwd: external_exports.string().min(1).optional()
15355
+ }).strict().refine((params) => !(params.threadId && params.cwd), {
15356
+ message: "Specify threadId or cwd, not both"
15357
+ });
15358
+ var librarySkillSchema = external_exports.object({
15359
+ name: external_exports.string().min(1).regex(/^[^\s[\]]+$/u),
15360
+ description: external_exports.string().optional(),
15361
+ path: external_exports.string().min(1),
15362
+ scope: external_exports.enum(["project", "global"]),
15363
+ source: external_exports.string().min(1)
15364
+ }).strict();
15365
+ var skillsListResultSchema = external_exports.object({
15366
+ revision: external_exports.number().int().nonnegative(),
15367
+ complete: external_exports.boolean(),
15368
+ skills: external_exports.array(librarySkillSchema),
15369
+ warnings: external_exports.array(external_exports.string()).optional()
15370
+ }).strict();
15371
+ var skillsChangedParamsSchema = external_exports.object({ cwd: external_exports.string().min(1).optional() }).strict();
15372
+
15320
15373
  // ../../shared-contracts/dist/web-access-tokens.js
15321
15374
  var webNetworkAccessUrlSchema = external_exports.object({
15322
15375
  /**
@@ -15415,15 +15468,14 @@ var webAccessStateSchema = external_exports.object({
15415
15468
  quotaUntil: external_exports.string().optional()
15416
15469
  }).strict().optional()
15417
15470
  }).strict();
15418
- var webLocalAccessRequiredDetailsSchema = external_exports.object({ url: external_exports.string() }).strict();
15419
15471
 
15420
15472
  // ../../shared-contracts/dist/delegation-read.js
15421
15473
  var REMOTE_THREAD_REPLY_MAX_BYTES = 16 * 1024 * 1024;
15422
15474
  var delegationReadParamsSchema = external_exports.strictObject({
15423
15475
  threadId: external_exports.string().min(1).max(1024),
15424
15476
  view: external_exports.enum(["result", "messages"]),
15425
- cursor: external_exports.string().min(1).max(8192).optional(),
15426
- limit: external_exports.number().int().min(1).max(100).optional()
15477
+ from: external_exports.number().int().min(1).max(Number.MAX_SAFE_INTEGER).optional(),
15478
+ to: external_exports.number().int().min(1).max(Number.MAX_SAFE_INTEGER).optional()
15427
15479
  });
15428
15480
 
15429
15481
  // ../../shared-contracts/dist/credential-imports.js
@@ -16376,6 +16428,17 @@ var updateStatusResultSchema = external_exports.strictObject({
16376
16428
  status: updateStatusSchema.nullable()
16377
16429
  });
16378
16430
 
16431
+ // ../../shared-contracts/dist/thread-watch-notice.js
16432
+ var THREAD_WATCH_NOTICE_OUTCOMES = [
16433
+ "completed",
16434
+ "failed",
16435
+ "interrupted",
16436
+ "timedOut",
16437
+ "unreadable",
16438
+ "notFound"
16439
+ ];
16440
+ var ENTRY_PATTERN = new RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)\): ` + `(${THREAD_WATCH_NOTICE_OUTCOMES.join("|")})(?:. (.+))?$`, "u");
16441
+
16379
16442
  // ../../shared-contracts/dist/remote-runtime.js
16380
16443
  var remoteUpdatePhaseSchema = external_exports.enum([
16381
16444
  "idle",
@@ -16423,6 +16486,14 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
16423
16486
  archived: external_exports.boolean()
16424
16487
  }),
16425
16488
  external_exports.strictObject({ kind: external_exports.literal("read"), ...thread }),
16489
+ external_exports.strictObject({
16490
+ kind: external_exports.literal("configure"),
16491
+ ...thread,
16492
+ epoch: identity,
16493
+ modelId: identity.optional(),
16494
+ thinkingOptionId: identity.optional(),
16495
+ permissionModeId: identity.optional()
16496
+ }).refine((value) => [value.modelId, value.thinkingOptionId, value.permissionModeId].filter((v) => v !== void 0).length === 1, "Select exactly one remote setting"),
16426
16497
  external_exports.strictObject({
16427
16498
  kind: external_exports.literal("prompt"),
16428
16499
  ...thread,
@@ -16495,6 +16566,13 @@ var remoteConnectionsReplySchema = external_exports.union([
16495
16566
  external_exports.strictObject({ error: external_exports.strictObject({ code: external_exports.number().int(), message: external_exports.string() }) })
16496
16567
  ]);
16497
16568
 
16569
+ // ../../shared-contracts/dist/thread-title.js
16570
+ var threadTitleInputSchema = external_exports.strictObject({
16571
+ prompt: external_exports.string().trim().min(1).max(2e3),
16572
+ cwd: external_exports.string().max(4096).nullable()
16573
+ });
16574
+ var threadTitleResultSchema = external_exports.string().trim().min(1).max(60).nullable();
16575
+
16498
16576
  // ../../shared-contracts/dist/web-ui-extensions.js
16499
16577
  var webUiExtensionIdSchema = external_exports.string().max(214).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u);
16500
16578
  var localizedTextSchema2 = external_exports.union([
@@ -16701,6 +16779,7 @@ var usageFields = /* @__PURE__ */ new Set([
16701
16779
  "totalCredits",
16702
16780
  "contextUsagePercent",
16703
16781
  "outputTokensPerSecond",
16782
+ "sessionOutputTokensPerSecond",
16704
16783
  "apiOutputTokensPerSecond",
16705
16784
  "costSource",
16706
16785
  "unpricedModels"
@@ -16723,6 +16802,7 @@ function parseHostUsage(value) {
16723
16802
  for (const field2 of [
16724
16803
  "totalCredits",
16725
16804
  "contextUsagePercent",
16805
+ "sessionOutputTokensPerSecond",
16726
16806
  "apiOutputTokensPerSecond"
16727
16807
  ]) {
16728
16808
  const candidate = value[field2];
@@ -16924,17 +17004,69 @@ var COMMON_EXCLUDED_LIVE_COMMANDS = /* @__PURE__ */ new Set([
16924
17004
  "reload-plugins"
16925
17005
  ]);
16926
17006
  var COMMON_EXCLUDED_LIVE_COMMAND_PREFIXES = ["__", "hooks-"];
16927
- function isExcludedLiveCommand(name, kind, extra = {}) {
17007
+ function isExcludedLiveCommand(name, extra = {}) {
16928
17008
  const normalized = name.trim().replace(/^\//u, "");
16929
17009
  if (new Set(extra.names ?? []).has(normalized))
16930
17010
  return true;
16931
17011
  if (extra.prefixes?.some((prefix) => normalized.startsWith(prefix)))
16932
17012
  return true;
16933
- if (kind === "skill")
16934
- return false;
16935
17013
  return COMMON_EXCLUDED_LIVE_COMMANDS.has(normalized) || COMMON_EXCLUDED_LIVE_COMMAND_PREFIXES.some((prefix) => normalized.startsWith(prefix));
16936
17014
  }
16937
17015
 
17016
+ // ../../harness-adapter/dist/subagent-configuration.js
17017
+ function subagentConfiguration(value) {
17018
+ if (typeof value !== "object" || value === null || Array.isArray(value))
17019
+ return {};
17020
+ const row = value;
17021
+ const text2 = (value2) => typeof value2 === "string" && value2.trim() ? value2 : void 0;
17022
+ const model2 = row.model === "inherit" ? void 0 : text2(row.model);
17023
+ const reasoningEffort = text2(row.reasoningEffort) ?? text2(row.reasoning_effort) ?? text2(row.thinking);
17024
+ return { ...model2 ? { model: model2 } : {}, ...reasoningEffort ? { reasoningEffort } : {} };
17025
+ }
17026
+ function inheritSubagentConfiguration(child, parent) {
17027
+ const native = subagentConfiguration(child);
17028
+ const model2 = native.model ?? parent.model;
17029
+ const reasoningEffort = native.reasoningEffort ?? parent.reasoningEffort;
17030
+ const next = { ...child };
17031
+ delete next.model;
17032
+ delete next.reasoningEffort;
17033
+ return { ...next, ...model2 ? { model: model2 } : {}, ...reasoningEffort ? { reasoningEffort } : {} };
17034
+ }
17035
+ function configureSubagentEvent(event, parent) {
17036
+ const children = (states) => states.map((child) => inheritSubagentConfiguration(child, parent));
17037
+ if (event.type === "item.started" && event.item.type === "subagentDelegation")
17038
+ return { ...event, item: { ...event.item, subagents: children(event.item.subagents) } };
17039
+ if (event.type === "item.updated" && event.update.type === "subagents.replace")
17040
+ return { ...event, update: { ...event.update, subagents: children(event.update.subagents) } };
17041
+ if (event.type === "item.completed" && event.snapshot.item.type === "subagentDelegation")
17042
+ return {
17043
+ ...event,
17044
+ snapshot: {
17045
+ ...event.snapshot,
17046
+ item: {
17047
+ ...event.snapshot.item,
17048
+ subagents: children(event.snapshot.item.subagents)
17049
+ }
17050
+ }
17051
+ };
17052
+ return event;
17053
+ }
17054
+ function configureSubagentSnapshot(snapshot, parent) {
17055
+ return {
17056
+ ...snapshot,
17057
+ turns: snapshot.turns.map((turn) => ({
17058
+ ...turn,
17059
+ items: turn.items.map((entry) => entry.item.type === "subagentDelegation" ? {
17060
+ ...entry,
17061
+ item: {
17062
+ ...entry.item,
17063
+ subagents: entry.item.subagents.map((child) => inheritSubagentConfiguration(child, parent))
17064
+ }
17065
+ } : entry)
17066
+ }))
17067
+ };
17068
+ }
17069
+
16938
17070
  // ../../harness-broker/dist/protocol.js
16939
17071
  var HARNESS_BROKER_PROTOCOL_VERSION = 1;
16940
17072
  var HARNESS_BROKER_MAX_FRAME_BYTES = 8 * 1024 * 1024;
@@ -18912,8 +19044,7 @@ function commandCatalog(value, profile = CODEBUDDY_RUNTIME_PROFILE) {
18912
19044
  return {
18913
19045
  commands: rows(value).flatMap((entry) => {
18914
19046
  const name = text(entry.name).replace(/^\//u, "");
18915
- const skill = record3(entry._meta).type === "skill";
18916
- if (excluded.has(name) || seen.has(name) || isExcludedLiveCommand(name, skill ? "skill" : "command"))
19047
+ if (record3(entry._meta).type === "skill" || excluded.has(name) || seen.has(name) || isExcludedLiveCommand(name))
18917
19048
  return [];
18918
19049
  const parsed = harnessCommandCatalogSchema.safeParse({
18919
19050
  commands: [
@@ -18921,14 +19052,13 @@ function commandCatalog(value, profile = CODEBUDDY_RUNTIME_PROFILE) {
18921
19052
  id: `${profile.harnessId}.${name}`,
18922
19053
  invocation: `/${name}`,
18923
19054
  label: name,
18924
- ...name === "compact" && !skill ? {
19055
+ ...name === "compact" ? {
18925
19056
  localizations: {
18926
19057
  "zh-CN": { label: "压缩上下文", description: "压缩当前对话上下文" }
18927
19058
  }
18928
19059
  } : {},
18929
19060
  ...text(entry.description).trim() ? { description: text(entry.description).trim().slice(0, 512) } : {},
18930
- argumentMode: name === "compact" || record3(entry.input).hint || record3(entry._meta).type === "skill" ? "text" : "none",
18931
- ...record3(entry._meta).type === "skill" ? { kind: "skill" } : {}
19061
+ argumentMode: name === "compact" || record3(entry.input).hint ? "text" : "none"
18932
19062
  }
18933
19063
  ]
18934
19064
  });
@@ -19032,10 +19162,15 @@ var CodeBuddyTurnOutput = class {
19032
19162
  snapshot: structuredClone({ item, outcome })
19033
19163
  });
19034
19164
  }
19165
+ hasItem(itemId) {
19166
+ return this.#items.has(itemId);
19167
+ }
19035
19168
  replayCommandResult(items) {
19036
19169
  if (this.#items.size)
19037
19170
  return;
19038
19171
  for (const snapshot of items) {
19172
+ if (this.hasItem(snapshot.item.itemId))
19173
+ continue;
19039
19174
  const item = structuredClone(snapshot.item);
19040
19175
  this.#start(item);
19041
19176
  this.#finish(item, snapshot.outcome);
@@ -19213,7 +19348,7 @@ function codeBuddyDelegation(callId, input, status, childId, displayName = "Code
19213
19348
  ...nativeId ? { nativeSubagentId: nativeId } : {},
19214
19349
  description: text(args.description) || `${displayName} Subagent`,
19215
19350
  ...text(args.subagent_type) ? { role: text(args.subagent_type) } : {},
19216
- ...text(args.model) ? { model: text(args.model) } : {},
19351
+ ...subagentConfiguration(args),
19217
19352
  background: args.run_in_background === true,
19218
19353
  status
19219
19354
  }
@@ -19664,6 +19799,8 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
19664
19799
  current.completedAtMs = row.timestamp;
19665
19800
  }
19666
19801
  } else if (row.type === "function_call") {
19802
+ if (row.status === "incomplete" && data.isPartialAborted === true && data.discard === true)
19803
+ continue;
19667
19804
  let input = row.arguments;
19668
19805
  if (typeof input === "string") {
19669
19806
  try {
@@ -25041,6 +25178,9 @@ function referencedChildren(rows2) {
25041
25178
  const children = /* @__PURE__ */ new Map();
25042
25179
  for (const row of rows2) {
25043
25180
  if (row.type === "function_call" && row.name === "Agent") {
25181
+ const data = record3(row.providerData);
25182
+ if (row.status === "incomplete" && data.isPartialAborted === true && data.discard === true)
25183
+ continue;
25044
25184
  const callId2 = text(row.callId);
25045
25185
  if (!callId2 || calls.has(callId2))
25046
25186
  throw new CodeBuddyError("protocolError", "Agent delegation identity is ambiguous");
@@ -26085,6 +26225,9 @@ var CodeBuddySubagents = class {
26085
26225
  begin(turnId) {
26086
26226
  this.#turnId = turnId;
26087
26227
  }
26228
+ hasItem(itemId) {
26229
+ return [...this.#calls.values()].some((call) => call.turnId === this.#turnId && call.item.itemId === itemId);
26230
+ }
26088
26231
  state(id) {
26089
26232
  return [...this.#calls.values()].map((call) => call.item.subagents[0]).findLast((child) => child?.nativeSubagentId === id);
26090
26233
  }
@@ -26219,9 +26362,13 @@ var CodeBuddySubagents = class {
26219
26362
  const snapshot = await (this.options.read ? this.options.read(parent, id, this.options.cwd, this.options.environment, "running", this.profile) : this.#observer.read(id, "running"));
26220
26363
  if (this.#closed || call.observationDone)
26221
26364
  continue;
26222
- const observedModel = snapshot.turns.at(-1)?.model;
26223
- if (observedModel)
26224
- this.#update(call, { model: nativeModel(observedModel) });
26365
+ const observedModel = snapshot.turns.at(-1)?.model ?? snapshot.state?.effectiveModel;
26366
+ const reasoningEffort = snapshot.state?.effectiveThinkingOptionId;
26367
+ if (observedModel || reasoningEffort)
26368
+ this.#update(call, {
26369
+ ...observedModel ? { model: nativeModel(observedModel) } : {},
26370
+ ...reasoningEffort ? { reasoningEffort } : {}
26371
+ });
26225
26372
  const signature = JSON.stringify(snapshot);
26226
26373
  if (signature !== call.signature) {
26227
26374
  call.signature = signature;
@@ -26354,7 +26501,7 @@ var CodeBuddySession = class {
26354
26501
  }
26355
26502
  if (this.#replaying)
26356
26503
  return;
26357
- if (this.subagents.update(update))
26504
+ if ((text(record3(update._meta)["codebuddy.ai/parentToolCallId"]) || !this.#active?.output.hasItem(`tool-${text(update.toolCallId)}`)) && this.subagents.update(update))
26358
26505
  return;
26359
26506
  if (update.sessionUpdate === "config_option_update" && this.#config)
26360
26507
  this.#apply(configuration(update.configOptions, this.profile));
@@ -26364,10 +26511,7 @@ var CodeBuddySession = class {
26364
26511
  contextWindowTokens: update.size,
26365
26512
  contextUsagePercent: update.used / update.size * 100
26366
26513
  };
26367
- this.#emit({
26368
- type: "session.usage.changed",
26369
- usage: { ...this.#usage, ...this.#context }
26370
- });
26514
+ this.#emitUsage();
26371
26515
  void this.refreshUsage();
26372
26516
  }
26373
26517
  this.#active?.output.update(update);
@@ -26437,8 +26581,16 @@ var CodeBuddySession = class {
26437
26581
  this.initialUsage = this.#usage;
26438
26582
  }
26439
26583
  #emit(event) {
26584
+ event = configureSubagentEvent(event, this.#subagentConfiguration());
26440
26585
  this.#channel.emit({ kind: "event", event });
26441
26586
  }
26587
+ #emitUsage() {
26588
+ const usage = { ...this.#usage, ...this.#context };
26589
+ this.#emit({
26590
+ type: "session.usage.changed",
26591
+ usage: Object.keys(usage).length ? usage : null
26592
+ });
26593
+ }
26442
26594
  /** Publishes native requests not yet metered; the first read also declares completeness. */
26443
26595
  #meterHistory(history, historical) {
26444
26596
  const { requests, complete } = historyUsageRequests(history, historical);
@@ -26452,6 +26604,10 @@ var CodeBuddySession = class {
26452
26604
  this.#emit({ type: "usage.history", complete });
26453
26605
  }
26454
26606
  #apply(config2, emit = true) {
26607
+ if (this.#state.effectiveModel && this.#state.effectiveModel.id !== config2.state.effectiveModel?.id) {
26608
+ this.#context = {};
26609
+ this.#emitUsage();
26610
+ }
26455
26611
  this.#config = config2;
26456
26612
  if (this.#ref && record3(this.#ref.locator).codebuddyDerived === 1)
26457
26613
  this.#ref = nativeSessionRefSchema.parse({
@@ -26511,13 +26667,25 @@ var CodeBuddySession = class {
26511
26667
  return;
26512
26668
  this.#usage = historyUsage(history);
26513
26669
  this.#meterHistory(history, false);
26514
- this.#emit({ type: "session.usage.changed", usage: { ...this.#usage, ...this.#context } });
26670
+ this.#emitUsage();
26515
26671
  } catch {
26516
26672
  } finally {
26517
26673
  this.#refreshingUsage = false;
26518
26674
  }
26519
26675
  }
26676
+ #subagentConfiguration() {
26677
+ const state = this.#state;
26678
+ const model2 = state.effectiveModel ? nativeModel(state.effectiveModel) : void 0;
26679
+ return {
26680
+ ...model2 ? { model: model2 } : {},
26681
+ ...state.effectiveThinkingOptionId ? { reasoningEffort: state.effectiveThinkingOptionId } : {}
26682
+ };
26683
+ }
26520
26684
  async readSnapshot() {
26685
+ const result = await this.#readSnapshot();
26686
+ return result.ok ? { ok: true, value: configureSubagentSnapshot(result.value, this.#subagentConfiguration()) } : result;
26687
+ }
26688
+ async #readSnapshot() {
26521
26689
  if (this.#closed || this.#fault)
26522
26690
  return failure("invalidState", "Session is closed or faulted", this.profile);
26523
26691
  if (this.#busy || this.#active)
@@ -26626,7 +26794,7 @@ var CodeBuddySession = class {
26626
26794
  throw new CodeBuddyError("protocolError", "Could not identify exactly one persisted Native Turn");
26627
26795
  active.output.confirmCompaction(snapshot.turns.flatMap((turn) => turn.items).filter((snapshot2) => !active.beforeItems.has(snapshot2.item.itemId)));
26628
26796
  if (active.nativeCommand)
26629
- active.output.replayCommandResult(added[0]?.items ?? []);
26797
+ active.output.replayCommandResult((added[0]?.items ?? []).filter(({ item }) => !this.subagents.hasItem(item.itemId)));
26630
26798
  const nativeTurnRef = added[0]?.nativeTurnRef;
26631
26799
  if (nativeTurnRef)
26632
26800
  this.#hasTurn = true;
@@ -26644,7 +26812,7 @@ var CodeBuddySession = class {
26644
26812
  ...added[0]?.checkpoint ? { checkpoint: added[0].checkpoint } : {}
26645
26813
  }, nativeTurnRef);
26646
26814
  if (this.#usage)
26647
- this.#emit({ type: "session.usage.changed", usage: { ...this.#usage, ...this.#context } });
26815
+ this.#emitUsage();
26648
26816
  } catch (error51) {
26649
26817
  if (!active.done)
26650
26818
  this.#finish(active, { status: "failed", error: nativeError(error51, this.profile) });
@@ -27266,7 +27434,8 @@ require(process.argv[1]);`, bundle.cli] : [],
27266
27434
  ...acpArguments,
27267
27435
  ...serve ? ["--serve", "--host", "127.0.0.1", "--port", "0", "--auth", "password"] : []
27268
27436
  ], childEnvironment, platform),
27269
- environment: childEnvironment
27437
+ environment: childEnvironment,
27438
+ ...bundle ? { bundledCliPath: bundle.cli } : {}
27270
27439
  };
27271
27440
  }
27272
27441
 
@@ -27365,8 +27534,8 @@ async function readProductJson(file2) {
27365
27534
  return JSON.parse(await readFile5(file2, "utf8"));
27366
27535
  }
27367
27536
  function bundledFallbackProductPath(invocation) {
27368
- const cli = invocation.arguments[0];
27369
- if (!cli || cli.startsWith("-"))
27537
+ const cli = invocation.bundledCliPath;
27538
+ if (!cli)
27370
27539
  return;
27371
27540
  return path11.join(path11.dirname(path11.dirname(cli)), "product.json");
27372
27541
  }