@codexhost/cli-linux-arm64 0.20.0 → 0.21.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 (50) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +26 -6
  4. package/app/console-web.js +34 -7
  5. package/app/desktop-controller.mjs +162 -51
  6. package/app/host-runtime.mjs +35562 -29076
  7. package/app/plugins/antigravity/assets/icon.svg +1 -1
  8. package/app/plugins/antigravity/plugin.mjs +1112 -822
  9. package/app/plugins/claude-code/plugin.mjs +152 -28
  10. package/app/plugins/codebuddy/plugin.mjs +35 -6
  11. package/app/plugins/codex-usage/plugin.mjs +35 -6
  12. package/app/plugins/copilot/plugin.mjs +27 -6
  13. package/app/plugins/cursor-cli/plugin.mjs +27 -6
  14. package/app/plugins/deepseek-harness/plugin.mjs +52 -11
  15. package/app/plugins/devin/plugin.mjs +27 -6
  16. package/app/plugins/grok/plugin.mjs +63 -15
  17. package/app/plugins/hermes/plugin.mjs +27 -6
  18. package/app/plugins/kimi-code/plugin.mjs +52 -16
  19. package/app/plugins/kiro-cli/plugin.mjs +27 -6
  20. package/app/plugins/omp/plugin.mjs +35 -6
  21. package/app/plugins/opencode/plugin.mjs +53 -15
  22. package/app/plugins/pi/plugin.mjs +35 -6
  23. package/app/plugins/qoder/plugin.mjs +42 -6
  24. package/app/plugins/qoder-cn/plugin.mjs +42 -6
  25. package/app/plugins/qwen-code/plugin.mjs +27 -6
  26. package/app/plugins/workbuddy/plugin.mjs +35 -6
  27. package/app/plugins/zcode/plugin.mjs +35 -6
  28. package/app/renderer-extension.js +26 -6
  29. package/app/web/assets/{index-D85gPBbQ.js → index-BdmZfTRW.js} +62 -62
  30. package/app/web/assets/{index-D6-hvggd.css → index-DJW4bmyx.css} +1 -1
  31. package/app/web/codexhost-settings.js +34 -7
  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 +3 -3
  35. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +68 -68
  36. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +6 -6
  37. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +22 -22
  38. package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
  39. package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +2 -2
  40. package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +1 -1
  41. package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +1 -1
  42. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar/client.js +1 -1
  43. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.js +9 -9
  44. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +1 -1
  45. package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +2 -2
  46. package/app/web-modules/server.mjs +1012 -667
  47. package/bin/codexhost +0 -0
  48. package/libexec/codexhost-shim +0 -0
  49. package/libexec/codexhost-updater +0 -0
  50. package/package.json +1 -1
@@ -15024,7 +15024,7 @@ var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonneg
15024
15024
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
15025
15025
  var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
15026
15026
  var usageOutputTimingSchema = external_exports.object({
15027
- version: external_exports.literal(3).optional(),
15027
+ version: external_exports.union([external_exports.literal(3), external_exports.literal(4)]).optional(),
15028
15028
  requestId: external_exports.string().min(1),
15029
15029
  turnId: external_exports.string().min(1).max(1024),
15030
15030
  outputTokens: nonNegativeSafeIntegerSchema,
@@ -15032,16 +15032,16 @@ var usageOutputTimingSchema = external_exports.object({
15032
15032
  completedAtMs: nonNegativeSafeIntegerSchema
15033
15033
  }).strict().refine((value) => value.completedAtMs > value.startedAtMs);
15034
15034
  var usageMeasurementSchema = external_exports.object({
15035
- version: external_exports.union([external_exports.literal(2), external_exports.literal(3)]).optional(),
15035
+ version: external_exports.union([external_exports.literal(2), external_exports.literal(3), external_exports.literal(4)]).optional(),
15036
15036
  value: finiteNonNegativeNumberSchema,
15037
15037
  turnId: external_exports.string().min(1).max(1024),
15038
15038
  at: nonNegativeSafeIntegerSchema
15039
15039
  }).strict();
15040
15040
  var usageMeasurementsSchema = external_exports.object({
15041
- // Unversioned intervals can omit hidden thinking time; do not restore them into averages.
15042
- outputTimings: external_exports.array(usageOutputTimingSchema).transform((values) => values.filter((value) => value.version === 3)).optional(),
15041
+ // Older intervals can omit hidden thinking time; do not restore them into averages.
15042
+ outputTimings: external_exports.array(usageOutputTimingSchema).transform((values) => values.filter((value) => value.version === 4)).optional(),
15043
15043
  // Retain independent TTFT facts when dropping incompatible speed measurements.
15044
- outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 3).optional().catch(void 0),
15044
+ outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 4).optional().catch(void 0),
15045
15045
  timeToFirstOutputMs: usageMeasurementSchema.extend({ value: nonNegativeSafeIntegerSchema }).optional()
15046
15046
  }).strict();
15047
15047
  var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text2) => text2.length <= maximum));
@@ -15507,6 +15507,11 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
15507
15507
  cursor: clientChannelCursorSchema,
15508
15508
  cwd: external_exports.string().optional()
15509
15509
  }),
15510
+ external_exports.object({
15511
+ type: external_exports.literal("harness-inspection-changed"),
15512
+ cursor: clientChannelCursorSchema,
15513
+ harnessId: external_exports.string().min(1)
15514
+ }),
15510
15515
  external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
15511
15516
  external_exports.object({
15512
15517
  type: external_exports.literal("preferences-changed"),
@@ -15578,6 +15583,8 @@ var clientItemTruncationSchema = external_exports.object({
15578
15583
  var clientTurnSchema = external_exports.object({
15579
15584
  id: external_exports.string().min(1),
15580
15585
  status: external_exports.string().min(1),
15586
+ /** Native history has no terminal evidence; Desktop's status vocabulary cannot express this. */
15587
+ codexhostTurnOutcome: external_exports.object({ status: external_exports.literal("unknown"), reason: external_exports.string() }).optional(),
15581
15588
  items: external_exports.array(external_exports.object({ id: external_exports.string().min(1), type: external_exports.string().min(1) }).passthrough()),
15582
15589
  /** Original file operations, independent of the cumulative Desktop fileChange card.
15583
15590
  * Insert before the named non-file Item; null appends at the end of the Turn.
@@ -16794,6 +16801,7 @@ var THREAD_WATCH_NOTICE_OUTCOMES = [
16794
16801
  "completed",
16795
16802
  "failed",
16796
16803
  "interrupted",
16804
+ "needsInput",
16797
16805
  "timedOut",
16798
16806
  "unreadable",
16799
16807
  "notFound"
@@ -16840,13 +16848,25 @@ var target = { hostId: identity.regex(/^remote-(?:ssh(?:-|:)|control:)/u) };
16840
16848
  var thread = { ...target, threadId: identity };
16841
16849
  var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
16842
16850
  external_exports.strictObject({ kind: external_exports.literal("hosts") }),
16851
+ external_exports.strictObject({ kind: external_exports.literal("status"), ...thread }),
16843
16852
  external_exports.strictObject({
16844
16853
  kind: external_exports.literal("list"),
16845
16854
  ...target,
16846
16855
  cursor: external_exports.string().nullable(),
16847
16856
  archived: external_exports.boolean()
16848
16857
  }),
16849
- external_exports.strictObject({ kind: external_exports.literal("read"), ...thread }),
16858
+ external_exports.strictObject({
16859
+ kind: external_exports.literal("read"),
16860
+ ...thread,
16861
+ page: external_exports.strictObject({
16862
+ cursor: external_exports.string().min(1).max(8192).nullable(),
16863
+ epoch: identity.optional(),
16864
+ sortDirection: external_exports.enum(["asc", "desc"]).optional(),
16865
+ limit: external_exports.number().int().min(1).max(20).optional()
16866
+ }).refine((page) => page.cursor === null || page.epoch !== void 0, {
16867
+ message: "A history continuation requires its connection epoch"
16868
+ }).optional()
16869
+ }),
16850
16870
  external_exports.strictObject({
16851
16871
  kind: external_exports.literal("configure"),
16852
16872
  ...thread,
@@ -17135,6 +17155,7 @@ var requestTokenFields = [
17135
17155
  "cacheWrite1hInputTokens",
17136
17156
  "outputTokens",
17137
17157
  "reasoningOutputTokens",
17158
+ "timedOutputTokens",
17138
17159
  "startedAtMs",
17139
17160
  "completedAtMs"
17140
17161
  ];
@@ -15144,7 +15144,7 @@ var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonneg
15144
15144
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
15145
15145
  var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
15146
15146
  var usageOutputTimingSchema = external_exports.object({
15147
- version: external_exports.literal(3).optional(),
15147
+ version: external_exports.union([external_exports.literal(3), external_exports.literal(4)]).optional(),
15148
15148
  requestId: external_exports.string().min(1),
15149
15149
  turnId: external_exports.string().min(1).max(1024),
15150
15150
  outputTokens: nonNegativeSafeIntegerSchema,
@@ -15152,16 +15152,16 @@ var usageOutputTimingSchema = external_exports.object({
15152
15152
  completedAtMs: nonNegativeSafeIntegerSchema
15153
15153
  }).strict().refine((value) => value.completedAtMs > value.startedAtMs);
15154
15154
  var usageMeasurementSchema = external_exports.object({
15155
- version: external_exports.union([external_exports.literal(2), external_exports.literal(3)]).optional(),
15155
+ version: external_exports.union([external_exports.literal(2), external_exports.literal(3), external_exports.literal(4)]).optional(),
15156
15156
  value: finiteNonNegativeNumberSchema,
15157
15157
  turnId: external_exports.string().min(1).max(1024),
15158
15158
  at: nonNegativeSafeIntegerSchema
15159
15159
  }).strict();
15160
15160
  var usageMeasurementsSchema = external_exports.object({
15161
- // Unversioned intervals can omit hidden thinking time; do not restore them into averages.
15162
- outputTimings: external_exports.array(usageOutputTimingSchema).transform((values) => values.filter((value) => value.version === 3)).optional(),
15161
+ // Older intervals can omit hidden thinking time; do not restore them into averages.
15162
+ outputTimings: external_exports.array(usageOutputTimingSchema).transform((values) => values.filter((value) => value.version === 4)).optional(),
15163
15163
  // Retain independent TTFT facts when dropping incompatible speed measurements.
15164
- outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 3).optional().catch(void 0),
15164
+ outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 4).optional().catch(void 0),
15165
15165
  timeToFirstOutputMs: usageMeasurementSchema.extend({ value: nonNegativeSafeIntegerSchema }).optional()
15166
15166
  }).strict();
15167
15167
  var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text) => text.length <= maximum));
@@ -15627,6 +15627,11 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
15627
15627
  cursor: clientChannelCursorSchema,
15628
15628
  cwd: external_exports.string().optional()
15629
15629
  }),
15630
+ external_exports.object({
15631
+ type: external_exports.literal("harness-inspection-changed"),
15632
+ cursor: clientChannelCursorSchema,
15633
+ harnessId: external_exports.string().min(1)
15634
+ }),
15630
15635
  external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
15631
15636
  external_exports.object({
15632
15637
  type: external_exports.literal("preferences-changed"),
@@ -15698,6 +15703,8 @@ var clientItemTruncationSchema = external_exports.object({
15698
15703
  var clientTurnSchema = external_exports.object({
15699
15704
  id: external_exports.string().min(1),
15700
15705
  status: external_exports.string().min(1),
15706
+ /** Native history has no terminal evidence; Desktop's status vocabulary cannot express this. */
15707
+ codexhostTurnOutcome: external_exports.object({ status: external_exports.literal("unknown"), reason: external_exports.string() }).optional(),
15701
15708
  items: external_exports.array(external_exports.object({ id: external_exports.string().min(1), type: external_exports.string().min(1) }).passthrough()),
15702
15709
  /** Original file operations, independent of the cumulative Desktop fileChange card.
15703
15710
  * Insert before the named non-file Item; null appends at the end of the Turn.
@@ -16914,6 +16921,7 @@ var THREAD_WATCH_NOTICE_OUTCOMES = [
16914
16921
  "completed",
16915
16922
  "failed",
16916
16923
  "interrupted",
16924
+ "needsInput",
16917
16925
  "timedOut",
16918
16926
  "unreadable",
16919
16927
  "notFound"
@@ -16960,13 +16968,25 @@ var target = { hostId: identity.regex(/^remote-(?:ssh(?:-|:)|control:)/u) };
16960
16968
  var thread = { ...target, threadId: identity };
16961
16969
  var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
16962
16970
  external_exports.strictObject({ kind: external_exports.literal("hosts") }),
16971
+ external_exports.strictObject({ kind: external_exports.literal("status"), ...thread }),
16963
16972
  external_exports.strictObject({
16964
16973
  kind: external_exports.literal("list"),
16965
16974
  ...target,
16966
16975
  cursor: external_exports.string().nullable(),
16967
16976
  archived: external_exports.boolean()
16968
16977
  }),
16969
- external_exports.strictObject({ kind: external_exports.literal("read"), ...thread }),
16978
+ external_exports.strictObject({
16979
+ kind: external_exports.literal("read"),
16980
+ ...thread,
16981
+ page: external_exports.strictObject({
16982
+ cursor: external_exports.string().min(1).max(8192).nullable(),
16983
+ epoch: identity.optional(),
16984
+ sortDirection: external_exports.enum(["asc", "desc"]).optional(),
16985
+ limit: external_exports.number().int().min(1).max(20).optional()
16986
+ }).refine((page) => page.cursor === null || page.epoch !== void 0, {
16987
+ message: "A history continuation requires its connection epoch"
16988
+ }).optional()
16989
+ }),
16970
16990
  external_exports.strictObject({
16971
16991
  kind: external_exports.literal("configure"),
16972
16992
  ...thread,
@@ -17349,6 +17369,7 @@ var requestTokenFields = [
17349
17369
  "cacheWrite1hInputTokens",
17350
17370
  "outputTokens",
17351
17371
  "reasoningOutputTokens",
17372
+ "timedOutputTokens",
17352
17373
  "startedAtMs",
17353
17374
  "completedAtMs"
17354
17375
  ];
@@ -23603,6 +23624,14 @@ function parseKimiConfigToml(content) {
23603
23624
  item.provider = d.provider;
23604
23625
  if (typeof d.max_context_size === "number")
23605
23626
  item.maxContextSize = d.max_context_size;
23627
+ if (Array.isArray(d.capabilities)) {
23628
+ item.capabilities = d.capabilities.filter((value) => typeof value === "string");
23629
+ }
23630
+ if (Array.isArray(d.support_efforts)) {
23631
+ item.supportEfforts = d.support_efforts.filter((value) => typeof value === "string");
23632
+ }
23633
+ if (typeof d.default_effort === "string")
23634
+ item.defaultEffort = d.default_effort;
23606
23635
  }
23607
23636
  models.push(item);
23608
23637
  }
@@ -23633,30 +23662,37 @@ function resolveKimiContextWindow(modelAlias, config2) {
23633
23662
  }
23634
23663
  return 2e5;
23635
23664
  }
23665
+ function configuredThinkingOptions(model2) {
23666
+ const alwaysThinking = model2.capabilities?.includes("always_thinking") === true;
23667
+ if (!alwaysThinking && !model2.capabilities?.includes("thinking"))
23668
+ return [];
23669
+ const values = model2.supportEfforts?.length ? ["off", ...model2.supportEfforts] : ["off", "on"];
23670
+ return [...new Set(values)].filter((value) => !alwaysThinking || value !== "off").map((value) => harnessThinkingOptionSchema.parse({ id: value, label: formatThinkingLabel(value) }));
23671
+ }
23636
23672
  function buildModelCatalogFromConfig(config2, thinkingOptionsList) {
23637
- const thinkingOptions = thinkingOptionsList ?? [];
23638
- const thinkingIds = thinkingOptions.map((opt) => opt.id);
23673
+ const thinkingOptions = /* @__PURE__ */ new Map();
23639
23674
  const rawModels = config2.models.length > 0 ? config2.models : [{ alias: config2.defaultModel ?? "default" }];
23640
23675
  const models = rawModels.map((m) => {
23676
+ const options = thinkingOptionsList !== void 0 ? m.alias === config2.defaultModel ? thinkingOptionsList : [] : configuredThinkingOptions(m);
23677
+ for (const option of options)
23678
+ thinkingOptions.set(option.id, option);
23641
23679
  const label = m.model ? `${m.alias} (${m.model})` : m.alias;
23642
23680
  return harnessModelSchema.parse({
23643
23681
  ref: encodeKimiModelRef(m.alias),
23644
23682
  label: label.slice(0, 256),
23645
23683
  ...m.model ? { resolvedModelLabel: m.model.slice(0, 256) } : {},
23646
- ...thinkingOptionsList && m.alias === config2.defaultModel ? { supportedThinkingOptionIds: thinkingIds } : {}
23684
+ supportedThinkingOptionIds: options.map(({ id }) => id)
23647
23685
  });
23648
23686
  });
23649
23687
  const defaultModel = config2.defaultModel && models.some((m) => decodeKimiModelRefId(m.ref.id) === config2.defaultModel) ? encodeKimiModelRef(config2.defaultModel) : models[0]?.ref;
23650
- let defaultThinkingOptionId = void 0;
23651
- if (config2.thinking?.effort && thinkingIds.includes(config2.thinking.effort)) {
23652
- defaultThinkingOptionId = harnessThinkingOptionIdSchema.parse(config2.thinking.effort);
23653
- } else if (config2.thinking?.enabled === false && thinkingIds.includes("off")) {
23654
- defaultThinkingOptionId = harnessThinkingOptionIdSchema.parse("off");
23655
- }
23688
+ const selectedModel = models.find((model2) => model2.ref.id === defaultModel?.id);
23689
+ const configuredDefault = config2.models.find((model2) => encodeKimiModelRef(model2.alias).id === defaultModel?.id)?.defaultEffort;
23690
+ const requestedDefault = config2.thinking?.enabled === false ? "off" : config2.thinking?.effort ?? configuredDefault;
23691
+ const defaultThinkingOptionId = selectedModel?.supportedThinkingOptionIds?.find((id) => id === requestedDefault);
23656
23692
  return harnessModelCatalogSchema.parse({
23657
23693
  models,
23658
23694
  ...defaultModel ? { defaultModel } : {},
23659
- thinkingOptions,
23695
+ thinkingOptions: [...thinkingOptions.values()],
23660
23696
  ...defaultThinkingOptionId ? { defaultThinkingOptionId } : {}
23661
23697
  });
23662
23698
  }
@@ -14999,7 +14999,7 @@ var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonneg
14999
14999
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
15000
15000
  var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
15001
15001
  var usageOutputTimingSchema = external_exports.object({
15002
- version: external_exports.literal(3).optional(),
15002
+ version: external_exports.union([external_exports.literal(3), external_exports.literal(4)]).optional(),
15003
15003
  requestId: external_exports.string().min(1),
15004
15004
  turnId: external_exports.string().min(1).max(1024),
15005
15005
  outputTokens: nonNegativeSafeIntegerSchema,
@@ -15007,16 +15007,16 @@ var usageOutputTimingSchema = external_exports.object({
15007
15007
  completedAtMs: nonNegativeSafeIntegerSchema
15008
15008
  }).strict().refine((value) => value.completedAtMs > value.startedAtMs);
15009
15009
  var usageMeasurementSchema = external_exports.object({
15010
- version: external_exports.union([external_exports.literal(2), external_exports.literal(3)]).optional(),
15010
+ version: external_exports.union([external_exports.literal(2), external_exports.literal(3), external_exports.literal(4)]).optional(),
15011
15011
  value: finiteNonNegativeNumberSchema,
15012
15012
  turnId: external_exports.string().min(1).max(1024),
15013
15013
  at: nonNegativeSafeIntegerSchema
15014
15014
  }).strict();
15015
15015
  var usageMeasurementsSchema = external_exports.object({
15016
- // Unversioned intervals can omit hidden thinking time; do not restore them into averages.
15017
- outputTimings: external_exports.array(usageOutputTimingSchema).transform((values) => values.filter((value) => value.version === 3)).optional(),
15016
+ // Older intervals can omit hidden thinking time; do not restore them into averages.
15017
+ outputTimings: external_exports.array(usageOutputTimingSchema).transform((values) => values.filter((value) => value.version === 4)).optional(),
15018
15018
  // Retain independent TTFT facts when dropping incompatible speed measurements.
15019
- outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 3).optional().catch(void 0),
15019
+ outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 4).optional().catch(void 0),
15020
15020
  timeToFirstOutputMs: usageMeasurementSchema.extend({ value: nonNegativeSafeIntegerSchema }).optional()
15021
15021
  }).strict();
15022
15022
  var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text) => text.length <= maximum));
@@ -15482,6 +15482,11 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
15482
15482
  cursor: clientChannelCursorSchema,
15483
15483
  cwd: external_exports.string().optional()
15484
15484
  }),
15485
+ external_exports.object({
15486
+ type: external_exports.literal("harness-inspection-changed"),
15487
+ cursor: clientChannelCursorSchema,
15488
+ harnessId: external_exports.string().min(1)
15489
+ }),
15485
15490
  external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
15486
15491
  external_exports.object({
15487
15492
  type: external_exports.literal("preferences-changed"),
@@ -15553,6 +15558,8 @@ var clientItemTruncationSchema = external_exports.object({
15553
15558
  var clientTurnSchema = external_exports.object({
15554
15559
  id: external_exports.string().min(1),
15555
15560
  status: external_exports.string().min(1),
15561
+ /** Native history has no terminal evidence; Desktop's status vocabulary cannot express this. */
15562
+ codexhostTurnOutcome: external_exports.object({ status: external_exports.literal("unknown"), reason: external_exports.string() }).optional(),
15556
15563
  items: external_exports.array(external_exports.object({ id: external_exports.string().min(1), type: external_exports.string().min(1) }).passthrough()),
15557
15564
  /** Original file operations, independent of the cumulative Desktop fileChange card.
15558
15565
  * Insert before the named non-file Item; null appends at the end of the Turn.
@@ -16769,6 +16776,7 @@ var THREAD_WATCH_NOTICE_OUTCOMES = [
16769
16776
  "completed",
16770
16777
  "failed",
16771
16778
  "interrupted",
16779
+ "needsInput",
16772
16780
  "timedOut",
16773
16781
  "unreadable",
16774
16782
  "notFound"
@@ -16815,13 +16823,25 @@ var target = { hostId: identity.regex(/^remote-(?:ssh(?:-|:)|control:)/u) };
16815
16823
  var thread = { ...target, threadId: identity };
16816
16824
  var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
16817
16825
  external_exports.strictObject({ kind: external_exports.literal("hosts") }),
16826
+ external_exports.strictObject({ kind: external_exports.literal("status"), ...thread }),
16818
16827
  external_exports.strictObject({
16819
16828
  kind: external_exports.literal("list"),
16820
16829
  ...target,
16821
16830
  cursor: external_exports.string().nullable(),
16822
16831
  archived: external_exports.boolean()
16823
16832
  }),
16824
- external_exports.strictObject({ kind: external_exports.literal("read"), ...thread }),
16833
+ external_exports.strictObject({
16834
+ kind: external_exports.literal("read"),
16835
+ ...thread,
16836
+ page: external_exports.strictObject({
16837
+ cursor: external_exports.string().min(1).max(8192).nullable(),
16838
+ epoch: identity.optional(),
16839
+ sortDirection: external_exports.enum(["asc", "desc"]).optional(),
16840
+ limit: external_exports.number().int().min(1).max(20).optional()
16841
+ }).refine((page) => page.cursor === null || page.epoch !== void 0, {
16842
+ message: "A history continuation requires its connection epoch"
16843
+ }).optional()
16844
+ }),
16825
16845
  external_exports.strictObject({
16826
16846
  kind: external_exports.literal("configure"),
16827
16847
  ...thread,
@@ -17241,6 +17261,7 @@ var requestTokenFields = [
17241
17261
  "cacheWrite1hInputTokens",
17242
17262
  "outputTokens",
17243
17263
  "reasoningOutputTokens",
17264
+ "timedOutputTokens",
17244
17265
  "startedAtMs",
17245
17266
  "completedAtMs"
17246
17267
  ];
@@ -15060,7 +15060,7 @@ var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonneg
15060
15060
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
15061
15061
  var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
15062
15062
  var usageOutputTimingSchema = external_exports.object({
15063
- version: external_exports.literal(3).optional(),
15063
+ version: external_exports.union([external_exports.literal(3), external_exports.literal(4)]).optional(),
15064
15064
  requestId: external_exports.string().min(1),
15065
15065
  turnId: external_exports.string().min(1).max(1024),
15066
15066
  outputTokens: nonNegativeSafeIntegerSchema,
@@ -15068,16 +15068,16 @@ var usageOutputTimingSchema = external_exports.object({
15068
15068
  completedAtMs: nonNegativeSafeIntegerSchema
15069
15069
  }).strict().refine((value) => value.completedAtMs > value.startedAtMs);
15070
15070
  var usageMeasurementSchema = external_exports.object({
15071
- version: external_exports.union([external_exports.literal(2), external_exports.literal(3)]).optional(),
15071
+ version: external_exports.union([external_exports.literal(2), external_exports.literal(3), external_exports.literal(4)]).optional(),
15072
15072
  value: finiteNonNegativeNumberSchema,
15073
15073
  turnId: external_exports.string().min(1).max(1024),
15074
15074
  at: nonNegativeSafeIntegerSchema
15075
15075
  }).strict();
15076
15076
  var usageMeasurementsSchema = external_exports.object({
15077
- // Unversioned intervals can omit hidden thinking time; do not restore them into averages.
15078
- outputTimings: external_exports.array(usageOutputTimingSchema).transform((values) => values.filter((value) => value.version === 3)).optional(),
15077
+ // Older intervals can omit hidden thinking time; do not restore them into averages.
15078
+ outputTimings: external_exports.array(usageOutputTimingSchema).transform((values) => values.filter((value) => value.version === 4)).optional(),
15079
15079
  // Retain independent TTFT facts when dropping incompatible speed measurements.
15080
- outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 3).optional().catch(void 0),
15080
+ outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 4).optional().catch(void 0),
15081
15081
  timeToFirstOutputMs: usageMeasurementSchema.extend({ value: nonNegativeSafeIntegerSchema }).optional()
15082
15082
  }).strict();
15083
15083
  var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text) => text.length <= maximum));
@@ -15543,6 +15543,11 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
15543
15543
  cursor: clientChannelCursorSchema,
15544
15544
  cwd: external_exports.string().optional()
15545
15545
  }),
15546
+ external_exports.object({
15547
+ type: external_exports.literal("harness-inspection-changed"),
15548
+ cursor: clientChannelCursorSchema,
15549
+ harnessId: external_exports.string().min(1)
15550
+ }),
15546
15551
  external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
15547
15552
  external_exports.object({
15548
15553
  type: external_exports.literal("preferences-changed"),
@@ -15614,6 +15619,8 @@ var clientItemTruncationSchema = external_exports.object({
15614
15619
  var clientTurnSchema = external_exports.object({
15615
15620
  id: external_exports.string().min(1),
15616
15621
  status: external_exports.string().min(1),
15622
+ /** Native history has no terminal evidence; Desktop's status vocabulary cannot express this. */
15623
+ codexhostTurnOutcome: external_exports.object({ status: external_exports.literal("unknown"), reason: external_exports.string() }).optional(),
15617
15624
  items: external_exports.array(external_exports.object({ id: external_exports.string().min(1), type: external_exports.string().min(1) }).passthrough()),
15618
15625
  /** Original file operations, independent of the cumulative Desktop fileChange card.
15619
15626
  * Insert before the named non-file Item; null appends at the end of the Turn.
@@ -16830,6 +16837,7 @@ var THREAD_WATCH_NOTICE_OUTCOMES = [
16830
16837
  "completed",
16831
16838
  "failed",
16832
16839
  "interrupted",
16840
+ "needsInput",
16833
16841
  "timedOut",
16834
16842
  "unreadable",
16835
16843
  "notFound"
@@ -16876,13 +16884,25 @@ var target = { hostId: identity.regex(/^remote-(?:ssh(?:-|:)|control:)/u) };
16876
16884
  var thread = { ...target, threadId: identity };
16877
16885
  var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
16878
16886
  external_exports.strictObject({ kind: external_exports.literal("hosts") }),
16887
+ external_exports.strictObject({ kind: external_exports.literal("status"), ...thread }),
16879
16888
  external_exports.strictObject({
16880
16889
  kind: external_exports.literal("list"),
16881
16890
  ...target,
16882
16891
  cursor: external_exports.string().nullable(),
16883
16892
  archived: external_exports.boolean()
16884
16893
  }),
16885
- external_exports.strictObject({ kind: external_exports.literal("read"), ...thread }),
16894
+ external_exports.strictObject({
16895
+ kind: external_exports.literal("read"),
16896
+ ...thread,
16897
+ page: external_exports.strictObject({
16898
+ cursor: external_exports.string().min(1).max(8192).nullable(),
16899
+ epoch: identity.optional(),
16900
+ sortDirection: external_exports.enum(["asc", "desc"]).optional(),
16901
+ limit: external_exports.number().int().min(1).max(20).optional()
16902
+ }).refine((page) => page.cursor === null || page.epoch !== void 0, {
16903
+ message: "A history continuation requires its connection epoch"
16904
+ }).optional()
16905
+ }),
16886
16906
  external_exports.strictObject({
16887
16907
  kind: external_exports.literal("configure"),
16888
16908
  ...thread,
@@ -17261,6 +17281,7 @@ var requestTokenFields = [
17261
17281
  "cacheWrite1hInputTokens",
17262
17282
  "outputTokens",
17263
17283
  "reasoningOutputTokens",
17284
+ "timedOutputTokens",
17264
17285
  "startedAtMs",
17265
17286
  "completedAtMs"
17266
17287
  ];
@@ -17313,6 +17334,14 @@ function parseHostUsageRequest(value) {
17313
17334
  if (request.startedAtMs === void 0 !== (request.completedAtMs === void 0)) {
17314
17335
  throw new Error("Harness Usage request timing fields must be provided together");
17315
17336
  }
17337
+ if (request.timedOutputTokens !== void 0) {
17338
+ if (request.startedAtMs === void 0) {
17339
+ throw new Error("Harness Usage request 'timedOutputTokens' requires timing fields");
17340
+ }
17341
+ if (request.timedOutputTokens > request.outputTokens) {
17342
+ throw new Error("Harness Usage request 'timedOutputTokens' must not exceed 'outputTokens'");
17343
+ }
17344
+ }
17316
17345
  if (request.startedAtMs !== void 0 && request.completedAtMs !== void 0 && request.completedAtMs < request.startedAtMs) {
17317
17346
  throw new Error("Harness Usage request 'completedAtMs' must not precede 'startedAtMs'");
17318
17347
  }
@@ -15203,7 +15203,7 @@ var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonneg
15203
15203
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
15204
15204
  var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
15205
15205
  var usageOutputTimingSchema = external_exports.object({
15206
- version: external_exports.literal(3).optional(),
15206
+ version: external_exports.union([external_exports.literal(3), external_exports.literal(4)]).optional(),
15207
15207
  requestId: external_exports.string().min(1),
15208
15208
  turnId: external_exports.string().min(1).max(1024),
15209
15209
  outputTokens: nonNegativeSafeIntegerSchema,
@@ -15211,16 +15211,16 @@ var usageOutputTimingSchema = external_exports.object({
15211
15211
  completedAtMs: nonNegativeSafeIntegerSchema
15212
15212
  }).strict().refine((value) => value.completedAtMs > value.startedAtMs);
15213
15213
  var usageMeasurementSchema = external_exports.object({
15214
- version: external_exports.union([external_exports.literal(2), external_exports.literal(3)]).optional(),
15214
+ version: external_exports.union([external_exports.literal(2), external_exports.literal(3), external_exports.literal(4)]).optional(),
15215
15215
  value: finiteNonNegativeNumberSchema,
15216
15216
  turnId: external_exports.string().min(1).max(1024),
15217
15217
  at: nonNegativeSafeIntegerSchema
15218
15218
  }).strict();
15219
15219
  var usageMeasurementsSchema = external_exports.object({
15220
- // Unversioned intervals can omit hidden thinking time; do not restore them into averages.
15221
- outputTimings: external_exports.array(usageOutputTimingSchema).transform((values) => values.filter((value) => value.version === 3)).optional(),
15220
+ // Older intervals can omit hidden thinking time; do not restore them into averages.
15221
+ outputTimings: external_exports.array(usageOutputTimingSchema).transform((values) => values.filter((value) => value.version === 4)).optional(),
15222
15222
  // Retain independent TTFT facts when dropping incompatible speed measurements.
15223
- outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 3).optional().catch(void 0),
15223
+ outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 4).optional().catch(void 0),
15224
15224
  timeToFirstOutputMs: usageMeasurementSchema.extend({ value: nonNegativeSafeIntegerSchema }).optional()
15225
15225
  }).strict();
15226
15226
  var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text) => text.length <= maximum));
@@ -15686,6 +15686,11 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
15686
15686
  cursor: clientChannelCursorSchema,
15687
15687
  cwd: external_exports.string().optional()
15688
15688
  }),
15689
+ external_exports.object({
15690
+ type: external_exports.literal("harness-inspection-changed"),
15691
+ cursor: clientChannelCursorSchema,
15692
+ harnessId: external_exports.string().min(1)
15693
+ }),
15689
15694
  external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
15690
15695
  external_exports.object({
15691
15696
  type: external_exports.literal("preferences-changed"),
@@ -15757,6 +15762,8 @@ var clientItemTruncationSchema = external_exports.object({
15757
15762
  var clientTurnSchema = external_exports.object({
15758
15763
  id: external_exports.string().min(1),
15759
15764
  status: external_exports.string().min(1),
15765
+ /** Native history has no terminal evidence; Desktop's status vocabulary cannot express this. */
15766
+ codexhostTurnOutcome: external_exports.object({ status: external_exports.literal("unknown"), reason: external_exports.string() }).optional(),
15760
15767
  items: external_exports.array(external_exports.object({ id: external_exports.string().min(1), type: external_exports.string().min(1) }).passthrough()),
15761
15768
  /** Original file operations, independent of the cumulative Desktop fileChange card.
15762
15769
  * Insert before the named non-file Item; null appends at the end of the Turn.
@@ -16973,6 +16980,7 @@ var THREAD_WATCH_NOTICE_OUTCOMES = [
16973
16980
  "completed",
16974
16981
  "failed",
16975
16982
  "interrupted",
16983
+ "needsInput",
16976
16984
  "timedOut",
16977
16985
  "unreadable",
16978
16986
  "notFound"
@@ -17019,13 +17027,25 @@ var target = { hostId: identity.regex(/^remote-(?:ssh(?:-|:)|control:)/u) };
17019
17027
  var thread = { ...target, threadId: identity };
17020
17028
  var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
17021
17029
  external_exports.strictObject({ kind: external_exports.literal("hosts") }),
17030
+ external_exports.strictObject({ kind: external_exports.literal("status"), ...thread }),
17022
17031
  external_exports.strictObject({
17023
17032
  kind: external_exports.literal("list"),
17024
17033
  ...target,
17025
17034
  cursor: external_exports.string().nullable(),
17026
17035
  archived: external_exports.boolean()
17027
17036
  }),
17028
- external_exports.strictObject({ kind: external_exports.literal("read"), ...thread }),
17037
+ external_exports.strictObject({
17038
+ kind: external_exports.literal("read"),
17039
+ ...thread,
17040
+ page: external_exports.strictObject({
17041
+ cursor: external_exports.string().min(1).max(8192).nullable(),
17042
+ epoch: identity.optional(),
17043
+ sortDirection: external_exports.enum(["asc", "desc"]).optional(),
17044
+ limit: external_exports.number().int().min(1).max(20).optional()
17045
+ }).refine((page) => page.cursor === null || page.epoch !== void 0, {
17046
+ message: "A history continuation requires its connection epoch"
17047
+ }).optional()
17048
+ }),
17029
17049
  external_exports.strictObject({
17030
17050
  kind: external_exports.literal("configure"),
17031
17051
  ...thread,
@@ -17404,6 +17424,7 @@ var requestTokenFields = [
17404
17424
  "cacheWrite1hInputTokens",
17405
17425
  "outputTokens",
17406
17426
  "reasoningOutputTokens",
17427
+ "timedOutputTokens",
17407
17428
  "startedAtMs",
17408
17429
  "completedAtMs"
17409
17430
  ];
@@ -17456,6 +17477,14 @@ function parseHostUsageRequest(value) {
17456
17477
  if (request.startedAtMs === void 0 !== (request.completedAtMs === void 0)) {
17457
17478
  throw new Error("Harness Usage request timing fields must be provided together");
17458
17479
  }
17480
+ if (request.timedOutputTokens !== void 0) {
17481
+ if (request.startedAtMs === void 0) {
17482
+ throw new Error("Harness Usage request 'timedOutputTokens' requires timing fields");
17483
+ }
17484
+ if (request.timedOutputTokens > request.outputTokens) {
17485
+ throw new Error("Harness Usage request 'timedOutputTokens' must not exceed 'outputTokens'");
17486
+ }
17487
+ }
17459
17488
  if (request.startedAtMs !== void 0 && request.completedAtMs !== void 0 && request.completedAtMs < request.startedAtMs) {
17460
17489
  throw new Error("Harness Usage request 'completedAtMs' must not precede 'startedAtMs'");
17461
17490
  }
@@ -17463,11 +17492,12 @@ function parseHostUsageRequest(value) {
17463
17492
  }
17464
17493
 
17465
17494
  // dist/v2/usage.js
17466
- function v2UsageRequest(message, historical, firstOutputAtMs) {
17495
+ function v2UsageRequest(message, historical, timing) {
17467
17496
  if (message.type !== "assistant" || !message.tokens)
17468
17497
  return null;
17469
17498
  const { input, output, reasoning, cache } = message.tokens;
17470
17499
  const { streamed } = message.time;
17500
+ const firstOutputAtMs = timing?.firstOutputAtMs;
17471
17501
  return parseHostUsageRequest({
17472
17502
  requestId: message.id,
17473
17503
  ...historical ? { historical: true } : {},
@@ -17481,8 +17511,8 @@ function v2UsageRequest(message, historical, firstOutputAtMs) {
17481
17511
  outputTokens: output + reasoning,
17482
17512
  reasoningOutputTokens: reasoning,
17483
17513
  // End at stream completion, not step completion, which can include tool execution.
17484
- // Without a native stream end, keep the usage but do not guess its generation duration.
17485
- ...!historical && firstOutputAtMs !== void 0 && streamed !== void 0 && streamed >= firstOutputAtMs ? { startedAtMs: firstOutputAtMs, completedAtMs: streamed } : {}
17514
+ // Without a stream end or a boundary covering reasoning, retain usage without timing.
17515
+ ...!historical && (reasoning === 0 || timing?.reasoningObserved) && firstOutputAtMs !== void 0 && streamed !== void 0 && streamed >= firstOutputAtMs ? { startedAtMs: firstOutputAtMs, completedAtMs: streamed } : {}
17486
17516
  });
17487
17517
  }
17488
17518
 
@@ -28123,8 +28153,6 @@ var V2Session = class {
28123
28153
  #cacheHitRatePercent;
28124
28154
  /** Assistant messages already published as usage requests. */
28125
28155
  #meteredMessages = /* @__PURE__ */ new Set();
28126
- /** Adapter receive time of each assistant message's first reasoning, text or tool input. */
28127
- #firstOutputAt = /* @__PURE__ */ new Map();
28128
28156
  constructor(client2, connection, info, catalog, policy, limit, onClosed) {
28129
28157
  this.client = client2;
28130
28158
  this.connection = connection;
@@ -28288,6 +28316,7 @@ var V2Session = class {
28288
28316
  baseline: /* @__PURE__ */ new Set(),
28289
28317
  live: /* @__PURE__ */ new Map(),
28290
28318
  assistants: /* @__PURE__ */ new Set(),
28319
+ outputTiming: /* @__PURE__ */ new Map(),
28291
28320
  transient: /* @__PURE__ */ new Map(),
28292
28321
  interactions: /* @__PURE__ */ new Map(),
28293
28322
  replying: /* @__PURE__ */ new Set(),
@@ -28338,8 +28367,16 @@ var V2Session = class {
28338
28367
  const active = this.#active;
28339
28368
  if (!active || !("data" in event) || !("sessionID" in event.data) || event.data.sessionID !== this.info.id)
28340
28369
  return;
28341
- if (FIRST_OUTPUT_EVENTS.has(event.type) && "assistantMessageID" in event.data && typeof event.data.assistantMessageID === "string" && !this.#firstOutputAt.has(event.data.assistantMessageID))
28342
- this.#firstOutputAt.set(event.data.assistantMessageID, Date.now());
28370
+ if (FIRST_OUTPUT_EVENTS.has(event.type) && "assistantMessageID" in event.data && typeof event.data.assistantMessageID === "string" && !this.#meteredMessages.has(event.data.assistantMessageID) && (!event.type.endsWith(".delta") || "delta" in event.data && event.data.delta.length > 0)) {
28371
+ const id = event.data.assistantMessageID;
28372
+ const timing = active.outputTiming.get(id) ?? {
28373
+ firstOutputAtMs: Date.now(),
28374
+ reasoningObserved: false
28375
+ };
28376
+ if (event.type === "session.reasoning.started" || event.type === "session.reasoning.delta")
28377
+ timing.reasoningObserved = true;
28378
+ active.outputTiming.set(id, timing);
28379
+ }
28343
28380
  if (event.type === "session.step.started")
28344
28381
  active.assistants.add(event.data.assistantMessageID);
28345
28382
  if ((event.type === "session.text.delta" || event.type === "session.reasoning.delta") && active.assistants.has(event.data.assistantMessageID)) {
@@ -28366,8 +28403,9 @@ var V2Session = class {
28366
28403
  for (const message of messages) {
28367
28404
  let request;
28368
28405
  try {
28369
- request = v2UsageRequest(message, historical, this.#firstOutputAt.get(message.id));
28406
+ request = v2UsageRequest(message, historical, this.#active?.outputTiming.get(message.id));
28370
28407
  } catch {
28408
+ this.#active?.outputTiming.delete(message.id);
28371
28409
  this.#cacheHitRatePercent = void 0;
28372
28410
  if (this.#meteredMessages.has(message.id))
28373
28411
  continue;
@@ -28383,7 +28421,7 @@ var V2Session = class {
28383
28421
  if (this.#meteredMessages.has(message.id))
28384
28422
  continue;
28385
28423
  this.#meteredMessages.add(message.id);
28386
- this.#firstOutputAt.delete(message.id);
28424
+ this.#active?.outputTiming.delete(message.id);
28387
28425
  this.#emit({ type: "usage.request", request });
28388
28426
  }
28389
28427
  if (this.#cacheHitRatePercent !== previousCacheHitRate)