@codexhost/cli-darwin-x64 0.19.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 (63) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +45 -4
  4. package/app/console-web.js +1124 -684
  5. package/app/desktop-controller.mjs +197 -50
  6. package/app/host-runtime.mjs +36192 -29254
  7. package/app/plugins/antigravity/assets/icon.svg +1 -1
  8. package/app/plugins/antigravity/plugin.mjs +8863 -4094
  9. package/app/plugins/claude-code/plugin.mjs +173 -26
  10. package/app/plugins/codebuddy/plugin.mjs +71 -6
  11. package/app/plugins/codex-usage/plugin.mjs +56 -4
  12. package/app/plugins/copilot/plugin.mjs +48 -4
  13. package/app/plugins/cursor-cli/plugin.mjs +48 -4
  14. package/app/plugins/deepseek-harness/plugin.mjs +73 -9
  15. package/app/plugins/devin/plugin.mjs +47 -4
  16. package/app/plugins/grok/plugin.mjs +84 -13
  17. package/app/plugins/hermes/plugin.mjs +47 -4
  18. package/app/plugins/kimi-code/plugin.mjs +73 -14
  19. package/app/plugins/kiro-cli/plugin.mjs +48 -4
  20. package/app/plugins/omp/plugin.mjs +74 -7
  21. package/app/plugins/opencode/plugin.mjs +74 -13
  22. package/app/plugins/pi/plugin.mjs +75 -7
  23. package/app/plugins/qoder/plugin.mjs +85 -5
  24. package/app/plugins/qoder-cn/plugin.mjs +85 -5
  25. package/app/plugins/qwen-code/plugin.mjs +48 -4
  26. package/app/plugins/workbuddy/plugin.mjs +75 -9
  27. package/app/plugins/zcode/plugin.mjs +56 -4
  28. package/app/renderer-extension.js +1431 -737
  29. package/app/web/assets/index-BdmZfTRW.js +201 -0
  30. package/app/web/assets/index-DJW4bmyx.css +1 -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 +1130 -686
  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-ui-chat/client.js +74 -69
  46. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +7 -7
  47. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +27 -27
  48. package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
  49. package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +2 -2
  50. package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +1 -1
  51. package/app/web/plugins/deepseek-ai__dsh-client-ui-session/client.js +1 -1
  52. package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +1 -1
  53. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar/client.js +1 -1
  54. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.js +9 -9
  55. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
  56. package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +7 -7
  57. package/app/web-modules/server.mjs +1144 -731
  58. package/bin/codexhost +0 -0
  59. package/libexec/codexhost-shim +0 -0
  60. package/libexec/codexhost-updater +0 -0
  61. package/package.json +1 -1
  62. package/app/web/assets/index-BNQIOOHE.css +0 -1
  63. package/app/web/assets/index-Feo4BkqN.js +0 -199
@@ -15023,13 +15023,25 @@ var threadPermissionModeSelectParamsSchema = external_exports.object({
15023
15023
  var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
15024
15024
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
15025
15025
  var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
15026
+ var usageOutputTimingSchema = external_exports.object({
15027
+ version: external_exports.union([external_exports.literal(3), external_exports.literal(4)]).optional(),
15028
+ requestId: external_exports.string().min(1),
15029
+ turnId: external_exports.string().min(1).max(1024),
15030
+ outputTokens: nonNegativeSafeIntegerSchema,
15031
+ startedAtMs: nonNegativeSafeIntegerSchema,
15032
+ completedAtMs: nonNegativeSafeIntegerSchema
15033
+ }).strict().refine((value) => value.completedAtMs > value.startedAtMs);
15026
15034
  var usageMeasurementSchema = external_exports.object({
15035
+ version: external_exports.union([external_exports.literal(2), external_exports.literal(3), external_exports.literal(4)]).optional(),
15027
15036
  value: finiteNonNegativeNumberSchema,
15028
15037
  turnId: external_exports.string().min(1).max(1024),
15029
15038
  at: nonNegativeSafeIntegerSchema
15030
15039
  }).strict();
15031
15040
  var usageMeasurementsSchema = external_exports.object({
15032
- outputTokensPerSecond: usageMeasurementSchema.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
+ // Retain independent TTFT facts when dropping incompatible speed measurements.
15044
+ outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 4).optional().catch(void 0),
15033
15045
  timeToFirstOutputMs: usageMeasurementSchema.extend({ value: nonNegativeSafeIntegerSchema }).optional()
15034
15046
  }).strict();
15035
15047
  var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text) => text.length <= maximum));
@@ -15049,6 +15061,7 @@ var threadUsageSnapshotSchema = external_exports.object({
15049
15061
  cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
15050
15062
  outputTokens: nonNegativeSafeIntegerSchema.optional(),
15051
15063
  outputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
15064
+ sessionOutputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
15052
15065
  apiOutputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
15053
15066
  reasoningOutputTokens: nonNegativeSafeIntegerSchema.optional(),
15054
15067
  totalTokens: nonNegativeSafeIntegerSchema.optional(),
@@ -15460,6 +15473,10 @@ var threadSteeringInspectResultSchema = external_exports.object({
15460
15473
  delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
15461
15474
  }).strict();
15462
15475
 
15476
+ // ../../shared-contracts/dist/thread-archive-confirm.js
15477
+ var threadArchiveConfirmParamsSchema = external_exports.object({ threadId: hostThreadIdSchema }).strict();
15478
+ var threadArchiveConfirmResultSchema = external_exports.object({ confirmed: external_exports.boolean() }).strict();
15479
+
15463
15480
  // ../../shared-contracts/dist/client-channel.js
15464
15481
  var CLIENT_CHANNEL_VERSION = 1;
15465
15482
  var CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
@@ -15490,6 +15507,11 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
15490
15507
  cursor: clientChannelCursorSchema,
15491
15508
  cwd: external_exports.string().optional()
15492
15509
  }),
15510
+ external_exports.object({
15511
+ type: external_exports.literal("harness-inspection-changed"),
15512
+ cursor: clientChannelCursorSchema,
15513
+ harnessId: external_exports.string().min(1)
15514
+ }),
15493
15515
  external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
15494
15516
  external_exports.object({
15495
15517
  type: external_exports.literal("preferences-changed"),
@@ -15561,6 +15583,8 @@ var clientItemTruncationSchema = external_exports.object({
15561
15583
  var clientTurnSchema = external_exports.object({
15562
15584
  id: external_exports.string().min(1),
15563
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(),
15564
15588
  items: external_exports.array(external_exports.object({ id: external_exports.string().min(1), type: external_exports.string().min(1) }).passthrough()),
15565
15589
  /** Original file operations, independent of the cumulative Desktop fileChange card.
15566
15590
  * Insert before the named non-file Item; null appends at the end of the Turn.
@@ -15599,7 +15623,12 @@ var clientThreadSnapshotSchema = external_exports.object({
15599
15623
  /** Current interruptible Host Turn, including command Turns omitted from client history. */
15600
15624
  activeTurnId: external_exports.string().min(1).nullable().optional(),
15601
15625
  /** Most recent explicit command in this Host process; not native conversation history. */
15602
- command: external_exports.object({ name: external_exports.string().min(1), turn: clientTurnSchema }).optional(),
15626
+ command: external_exports.object({
15627
+ name: external_exports.string().min(1),
15628
+ turn: clientTurnSchema,
15629
+ /** First ordinary Turn started after this command; its retained result is not a new event. */
15630
+ subsequentTurnId: external_exports.string().min(1).optional()
15631
+ }).optional(),
15603
15632
  thread: external_exports.object({
15604
15633
  id: external_exports.string().min(1),
15605
15634
  cwd: external_exports.string(),
@@ -15807,7 +15836,6 @@ var webAccessStateSchema = external_exports.object({
15807
15836
  quotaUntil: external_exports.string().optional()
15808
15837
  }).strict().optional()
15809
15838
  }).strict();
15810
- var webLocalAccessRequiredDetailsSchema = external_exports.object({ url: external_exports.string() }).strict();
15811
15839
 
15812
15840
  // ../../shared-contracts/dist/delegation-read.js
15813
15841
  var REMOTE_THREAD_REPLY_MAX_BYTES = 16 * 1024 * 1024;
@@ -16773,6 +16801,7 @@ var THREAD_WATCH_NOTICE_OUTCOMES = [
16773
16801
  "completed",
16774
16802
  "failed",
16775
16803
  "interrupted",
16804
+ "needsInput",
16776
16805
  "timedOut",
16777
16806
  "unreadable",
16778
16807
  "notFound"
@@ -16819,13 +16848,25 @@ var target = { hostId: identity.regex(/^remote-(?:ssh(?:-|:)|control:)/u) };
16819
16848
  var thread = { ...target, threadId: identity };
16820
16849
  var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
16821
16850
  external_exports.strictObject({ kind: external_exports.literal("hosts") }),
16851
+ external_exports.strictObject({ kind: external_exports.literal("status"), ...thread }),
16822
16852
  external_exports.strictObject({
16823
16853
  kind: external_exports.literal("list"),
16824
16854
  ...target,
16825
16855
  cursor: external_exports.string().nullable(),
16826
16856
  archived: external_exports.boolean()
16827
16857
  }),
16828
- 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
+ }),
16829
16870
  external_exports.strictObject({
16830
16871
  kind: external_exports.literal("configure"),
16831
16872
  ...thread,
@@ -17102,6 +17143,7 @@ var usageFields = /* @__PURE__ */ new Set([
17102
17143
  "totalCredits",
17103
17144
  "contextUsagePercent",
17104
17145
  "outputTokensPerSecond",
17146
+ "sessionOutputTokensPerSecond",
17105
17147
  "apiOutputTokensPerSecond",
17106
17148
  "costSource",
17107
17149
  "unpricedModels"
@@ -17124,6 +17166,7 @@ function parseHostUsage(value) {
17124
17166
  for (const field2 of [
17125
17167
  "totalCredits",
17126
17168
  "contextUsagePercent",
17169
+ "sessionOutputTokensPerSecond",
17127
17170
  "apiOutputTokensPerSecond"
17128
17171
  ]) {
17129
17172
  const candidate = value[field2];
@@ -17202,6 +17245,7 @@ var requestTokenFields = [
17202
17245
  "cacheWrite1hInputTokens",
17203
17246
  "outputTokens",
17204
17247
  "reasoningOutputTokens",
17248
+ "timedOutputTokens",
17205
17249
  "startedAtMs",
17206
17250
  "completedAtMs"
17207
17251
  ];
@@ -25953,6 +25997,9 @@ var GrokTurnUsage = class {
25953
25997
  #compacting = false;
25954
25998
  #startedAtMs;
25955
25999
  #streamKey;
26000
+ #reasoningObserved = false;
26001
+ #textStartedOutput = false;
26002
+ #bufferedToolInput = false;
25956
26003
  #outputTokens = 0;
25957
26004
  #durationMs = 0;
25958
26005
  #latestCacheHit;
@@ -25966,8 +26013,7 @@ var GrokTurnUsage = class {
25966
26013
  }
25967
26014
  observe(event) {
25968
26015
  if (event.type === "compaction.started" || event.type === "compaction.completed") {
25969
- this.#startedAtMs = void 0;
25970
- this.#streamKey = void 0;
26016
+ this.#resetResponse();
25971
26017
  this.#compacting = event.type === "compaction.started";
25972
26018
  }
25973
26019
  if (this.#compacting)
@@ -25975,14 +26021,29 @@ var GrokTurnUsage = class {
25975
26021
  if (event.type === "subagent.spawned")
25976
26022
  this.#cacheComplete = false;
25977
26023
  if (event.type === "agent.text" || event.type === "agent.thought" || event.type === "tool.input.delta") {
25978
- if (!event.text)
26024
+ if (!event.text || event.type === "tool.input.delta" && !event.text.trim())
25979
26025
  return null;
25980
26026
  const key = event.metadata?.streamStartMs;
25981
26027
  if (key !== void 0 && this.#streamKey !== void 0 && key !== this.#streamKey)
25982
- this.#startedAtMs = void 0;
26028
+ this.#resetResponse();
25983
26029
  if (key !== void 0)
25984
26030
  this.#streamKey = key;
25985
- this.#startedAtMs ??= Date.now();
26031
+ if (this.#bufferedToolInput)
26032
+ return null;
26033
+ if (event.type === "tool.input.delta" && this.#startedAtMs === void 0) {
26034
+ try {
26035
+ JSON.parse(event.text);
26036
+ this.#bufferedToolInput = true;
26037
+ return null;
26038
+ } catch {
26039
+ }
26040
+ }
26041
+ if (event.type === "agent.thought")
26042
+ this.#reasoningObserved = true;
26043
+ if (this.#startedAtMs === void 0) {
26044
+ this.#startedAtMs = Date.now();
26045
+ this.#textStartedOutput = event.type === "agent.text";
26046
+ }
25986
26047
  }
25987
26048
  if (event.type !== "response.completed")
25988
26049
  return null;
@@ -25992,9 +26053,12 @@ var GrokTurnUsage = class {
25992
26053
  this.#seen.add(event.messageId);
25993
26054
  }
25994
26055
  const duration3 = this.#startedAtMs === void 0 ? 0 : Date.now() - this.#startedAtMs;
25995
- this.#startedAtMs = void 0;
25996
- this.#streamKey = void 0;
25997
26056
  const usage = usageFromResponse(event.usage);
26057
+ const outputTokens = usage?.outputTokens;
26058
+ const reasoningOutputTokens = usage?.reasoningOutputTokens;
26059
+ const completeOutputBoundary = this.#reasoningObserved || reasoningOutputTokens === 0;
26060
+ const timedOutputTokens = completeOutputBoundary ? outputTokens : this.#textStartedOutput && outputTokens !== void 0 && reasoningOutputTokens !== void 0 && reasoningOutputTokens > 0 && reasoningOutputTokens < outputTokens ? outputTokens - reasoningOutputTokens : void 0;
26061
+ this.#resetResponse();
25998
26062
  this.#latestCacheHit = usage?.cacheHitRatePercent;
25999
26063
  if (usage?.inputTokens === void 0 || usage.cachedInputTokens === void 0)
26000
26064
  this.#cacheComplete = false;
@@ -26004,13 +26068,20 @@ var GrokTurnUsage = class {
26004
26068
  if (value !== void 0)
26005
26069
  this.#totals[field2] = (this.#totals[field2] ?? 0) + value;
26006
26070
  }
26007
- if (duration3 > 0 && usage.outputTokens !== void 0) {
26008
- this.#outputTokens += usage.outputTokens;
26071
+ if (duration3 > 0 && timedOutputTokens !== void 0) {
26072
+ this.#outputTokens += timedOutputTokens;
26009
26073
  this.#durationMs += duration3;
26010
26074
  }
26011
26075
  }
26012
26076
  return this.snapshot();
26013
26077
  }
26078
+ #resetResponse() {
26079
+ this.#startedAtMs = void 0;
26080
+ this.#streamKey = void 0;
26081
+ this.#reasoningObserved = false;
26082
+ this.#textStartedOutput = false;
26083
+ this.#bufferedToolInput = false;
26084
+ }
26014
26085
  metrics() {
26015
26086
  return {
26016
26087
  ...this.#durationMs > 0 ? { outputTokensPerSecond: this.#outputTokens * 1e3 / this.#durationMs } : {},
@@ -15023,13 +15023,25 @@ var threadPermissionModeSelectParamsSchema = external_exports.object({
15023
15023
  var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
15024
15024
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
15025
15025
  var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
15026
+ var usageOutputTimingSchema = external_exports.object({
15027
+ version: external_exports.union([external_exports.literal(3), external_exports.literal(4)]).optional(),
15028
+ requestId: external_exports.string().min(1),
15029
+ turnId: external_exports.string().min(1).max(1024),
15030
+ outputTokens: nonNegativeSafeIntegerSchema,
15031
+ startedAtMs: nonNegativeSafeIntegerSchema,
15032
+ completedAtMs: nonNegativeSafeIntegerSchema
15033
+ }).strict().refine((value) => value.completedAtMs > value.startedAtMs);
15026
15034
  var usageMeasurementSchema = external_exports.object({
15035
+ version: external_exports.union([external_exports.literal(2), external_exports.literal(3), external_exports.literal(4)]).optional(),
15027
15036
  value: finiteNonNegativeNumberSchema,
15028
15037
  turnId: external_exports.string().min(1).max(1024),
15029
15038
  at: nonNegativeSafeIntegerSchema
15030
15039
  }).strict();
15031
15040
  var usageMeasurementsSchema = external_exports.object({
15032
- outputTokensPerSecond: usageMeasurementSchema.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
+ // Retain independent TTFT facts when dropping incompatible speed measurements.
15044
+ outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 4).optional().catch(void 0),
15033
15045
  timeToFirstOutputMs: usageMeasurementSchema.extend({ value: nonNegativeSafeIntegerSchema }).optional()
15034
15046
  }).strict();
15035
15047
  var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text2) => text2.length <= maximum));
@@ -15049,6 +15061,7 @@ var threadUsageSnapshotSchema = external_exports.object({
15049
15061
  cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
15050
15062
  outputTokens: nonNegativeSafeIntegerSchema.optional(),
15051
15063
  outputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
15064
+ sessionOutputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
15052
15065
  apiOutputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
15053
15066
  reasoningOutputTokens: nonNegativeSafeIntegerSchema.optional(),
15054
15067
  totalTokens: nonNegativeSafeIntegerSchema.optional(),
@@ -15460,6 +15473,10 @@ var threadSteeringInspectResultSchema = external_exports.object({
15460
15473
  delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
15461
15474
  }).strict();
15462
15475
 
15476
+ // ../../shared-contracts/dist/thread-archive-confirm.js
15477
+ var threadArchiveConfirmParamsSchema = external_exports.object({ threadId: hostThreadIdSchema }).strict();
15478
+ var threadArchiveConfirmResultSchema = external_exports.object({ confirmed: external_exports.boolean() }).strict();
15479
+
15463
15480
  // ../../shared-contracts/dist/client-channel.js
15464
15481
  var CLIENT_CHANNEL_VERSION = 1;
15465
15482
  var CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
@@ -15490,6 +15507,11 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
15490
15507
  cursor: clientChannelCursorSchema,
15491
15508
  cwd: external_exports.string().optional()
15492
15509
  }),
15510
+ external_exports.object({
15511
+ type: external_exports.literal("harness-inspection-changed"),
15512
+ cursor: clientChannelCursorSchema,
15513
+ harnessId: external_exports.string().min(1)
15514
+ }),
15493
15515
  external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
15494
15516
  external_exports.object({
15495
15517
  type: external_exports.literal("preferences-changed"),
@@ -15561,6 +15583,8 @@ var clientItemTruncationSchema = external_exports.object({
15561
15583
  var clientTurnSchema = external_exports.object({
15562
15584
  id: external_exports.string().min(1),
15563
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(),
15564
15588
  items: external_exports.array(external_exports.object({ id: external_exports.string().min(1), type: external_exports.string().min(1) }).passthrough()),
15565
15589
  /** Original file operations, independent of the cumulative Desktop fileChange card.
15566
15590
  * Insert before the named non-file Item; null appends at the end of the Turn.
@@ -15599,7 +15623,12 @@ var clientThreadSnapshotSchema = external_exports.object({
15599
15623
  /** Current interruptible Host Turn, including command Turns omitted from client history. */
15600
15624
  activeTurnId: external_exports.string().min(1).nullable().optional(),
15601
15625
  /** Most recent explicit command in this Host process; not native conversation history. */
15602
- command: external_exports.object({ name: external_exports.string().min(1), turn: clientTurnSchema }).optional(),
15626
+ command: external_exports.object({
15627
+ name: external_exports.string().min(1),
15628
+ turn: clientTurnSchema,
15629
+ /** First ordinary Turn started after this command; its retained result is not a new event. */
15630
+ subsequentTurnId: external_exports.string().min(1).optional()
15631
+ }).optional(),
15603
15632
  thread: external_exports.object({
15604
15633
  id: external_exports.string().min(1),
15605
15634
  cwd: external_exports.string(),
@@ -15807,7 +15836,6 @@ var webAccessStateSchema = external_exports.object({
15807
15836
  quotaUntil: external_exports.string().optional()
15808
15837
  }).strict().optional()
15809
15838
  }).strict();
15810
- var webLocalAccessRequiredDetailsSchema = external_exports.object({ url: external_exports.string() }).strict();
15811
15839
 
15812
15840
  // ../../shared-contracts/dist/delegation-read.js
15813
15841
  var REMOTE_THREAD_REPLY_MAX_BYTES = 16 * 1024 * 1024;
@@ -16773,6 +16801,7 @@ var THREAD_WATCH_NOTICE_OUTCOMES = [
16773
16801
  "completed",
16774
16802
  "failed",
16775
16803
  "interrupted",
16804
+ "needsInput",
16776
16805
  "timedOut",
16777
16806
  "unreadable",
16778
16807
  "notFound"
@@ -16819,13 +16848,25 @@ var target = { hostId: identity.regex(/^remote-(?:ssh(?:-|:)|control:)/u) };
16819
16848
  var thread = { ...target, threadId: identity };
16820
16849
  var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
16821
16850
  external_exports.strictObject({ kind: external_exports.literal("hosts") }),
16851
+ external_exports.strictObject({ kind: external_exports.literal("status"), ...thread }),
16822
16852
  external_exports.strictObject({
16823
16853
  kind: external_exports.literal("list"),
16824
16854
  ...target,
16825
16855
  cursor: external_exports.string().nullable(),
16826
16856
  archived: external_exports.boolean()
16827
16857
  }),
16828
- 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
+ }),
16829
16870
  external_exports.strictObject({
16830
16871
  kind: external_exports.literal("configure"),
16831
16872
  ...thread,
@@ -17102,6 +17143,7 @@ var usageFields = /* @__PURE__ */ new Set([
17102
17143
  "totalCredits",
17103
17144
  "contextUsagePercent",
17104
17145
  "outputTokensPerSecond",
17146
+ "sessionOutputTokensPerSecond",
17105
17147
  "apiOutputTokensPerSecond",
17106
17148
  "costSource",
17107
17149
  "unpricedModels"
@@ -17113,6 +17155,7 @@ var requestTokenFields = [
17113
17155
  "cacheWrite1hInputTokens",
17114
17156
  "outputTokens",
17115
17157
  "reasoningOutputTokens",
17158
+ "timedOutputTokens",
17116
17159
  "startedAtMs",
17117
17160
  "completedAtMs"
17118
17161
  ];
@@ -15143,13 +15143,25 @@ var threadPermissionModeSelectParamsSchema = external_exports.object({
15143
15143
  var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
15144
15144
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
15145
15145
  var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
15146
+ var usageOutputTimingSchema = external_exports.object({
15147
+ version: external_exports.union([external_exports.literal(3), external_exports.literal(4)]).optional(),
15148
+ requestId: external_exports.string().min(1),
15149
+ turnId: external_exports.string().min(1).max(1024),
15150
+ outputTokens: nonNegativeSafeIntegerSchema,
15151
+ startedAtMs: nonNegativeSafeIntegerSchema,
15152
+ completedAtMs: nonNegativeSafeIntegerSchema
15153
+ }).strict().refine((value) => value.completedAtMs > value.startedAtMs);
15146
15154
  var usageMeasurementSchema = external_exports.object({
15155
+ version: external_exports.union([external_exports.literal(2), external_exports.literal(3), external_exports.literal(4)]).optional(),
15147
15156
  value: finiteNonNegativeNumberSchema,
15148
15157
  turnId: external_exports.string().min(1).max(1024),
15149
15158
  at: nonNegativeSafeIntegerSchema
15150
15159
  }).strict();
15151
15160
  var usageMeasurementsSchema = external_exports.object({
15152
- outputTokensPerSecond: usageMeasurementSchema.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
+ // Retain independent TTFT facts when dropping incompatible speed measurements.
15164
+ outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 4).optional().catch(void 0),
15153
15165
  timeToFirstOutputMs: usageMeasurementSchema.extend({ value: nonNegativeSafeIntegerSchema }).optional()
15154
15166
  }).strict();
15155
15167
  var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text) => text.length <= maximum));
@@ -15169,6 +15181,7 @@ var threadUsageSnapshotSchema = external_exports.object({
15169
15181
  cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
15170
15182
  outputTokens: nonNegativeSafeIntegerSchema.optional(),
15171
15183
  outputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
15184
+ sessionOutputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
15172
15185
  apiOutputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
15173
15186
  reasoningOutputTokens: nonNegativeSafeIntegerSchema.optional(),
15174
15187
  totalTokens: nonNegativeSafeIntegerSchema.optional(),
@@ -15580,6 +15593,10 @@ var threadSteeringInspectResultSchema = external_exports.object({
15580
15593
  delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
15581
15594
  }).strict();
15582
15595
 
15596
+ // ../../shared-contracts/dist/thread-archive-confirm.js
15597
+ var threadArchiveConfirmParamsSchema = external_exports.object({ threadId: hostThreadIdSchema }).strict();
15598
+ var threadArchiveConfirmResultSchema = external_exports.object({ confirmed: external_exports.boolean() }).strict();
15599
+
15583
15600
  // ../../shared-contracts/dist/client-channel.js
15584
15601
  var CLIENT_CHANNEL_VERSION = 1;
15585
15602
  var CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
@@ -15610,6 +15627,11 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
15610
15627
  cursor: clientChannelCursorSchema,
15611
15628
  cwd: external_exports.string().optional()
15612
15629
  }),
15630
+ external_exports.object({
15631
+ type: external_exports.literal("harness-inspection-changed"),
15632
+ cursor: clientChannelCursorSchema,
15633
+ harnessId: external_exports.string().min(1)
15634
+ }),
15613
15635
  external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
15614
15636
  external_exports.object({
15615
15637
  type: external_exports.literal("preferences-changed"),
@@ -15681,6 +15703,8 @@ var clientItemTruncationSchema = external_exports.object({
15681
15703
  var clientTurnSchema = external_exports.object({
15682
15704
  id: external_exports.string().min(1),
15683
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(),
15684
15708
  items: external_exports.array(external_exports.object({ id: external_exports.string().min(1), type: external_exports.string().min(1) }).passthrough()),
15685
15709
  /** Original file operations, independent of the cumulative Desktop fileChange card.
15686
15710
  * Insert before the named non-file Item; null appends at the end of the Turn.
@@ -15719,7 +15743,12 @@ var clientThreadSnapshotSchema = external_exports.object({
15719
15743
  /** Current interruptible Host Turn, including command Turns omitted from client history. */
15720
15744
  activeTurnId: external_exports.string().min(1).nullable().optional(),
15721
15745
  /** Most recent explicit command in this Host process; not native conversation history. */
15722
- command: external_exports.object({ name: external_exports.string().min(1), turn: clientTurnSchema }).optional(),
15746
+ command: external_exports.object({
15747
+ name: external_exports.string().min(1),
15748
+ turn: clientTurnSchema,
15749
+ /** First ordinary Turn started after this command; its retained result is not a new event. */
15750
+ subsequentTurnId: external_exports.string().min(1).optional()
15751
+ }).optional(),
15723
15752
  thread: external_exports.object({
15724
15753
  id: external_exports.string().min(1),
15725
15754
  cwd: external_exports.string(),
@@ -15927,7 +15956,6 @@ var webAccessStateSchema = external_exports.object({
15927
15956
  quotaUntil: external_exports.string().optional()
15928
15957
  }).strict().optional()
15929
15958
  }).strict();
15930
- var webLocalAccessRequiredDetailsSchema = external_exports.object({ url: external_exports.string() }).strict();
15931
15959
 
15932
15960
  // ../../shared-contracts/dist/delegation-read.js
15933
15961
  var REMOTE_THREAD_REPLY_MAX_BYTES = 16 * 1024 * 1024;
@@ -16893,6 +16921,7 @@ var THREAD_WATCH_NOTICE_OUTCOMES = [
16893
16921
  "completed",
16894
16922
  "failed",
16895
16923
  "interrupted",
16924
+ "needsInput",
16896
16925
  "timedOut",
16897
16926
  "unreadable",
16898
16927
  "notFound"
@@ -16939,13 +16968,25 @@ var target = { hostId: identity.regex(/^remote-(?:ssh(?:-|:)|control:)/u) };
16939
16968
  var thread = { ...target, threadId: identity };
16940
16969
  var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
16941
16970
  external_exports.strictObject({ kind: external_exports.literal("hosts") }),
16971
+ external_exports.strictObject({ kind: external_exports.literal("status"), ...thread }),
16942
16972
  external_exports.strictObject({
16943
16973
  kind: external_exports.literal("list"),
16944
16974
  ...target,
16945
16975
  cursor: external_exports.string().nullable(),
16946
16976
  archived: external_exports.boolean()
16947
16977
  }),
16948
- 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
+ }),
16949
16990
  external_exports.strictObject({
16950
16991
  kind: external_exports.literal("configure"),
16951
16992
  ...thread,
@@ -17226,6 +17267,7 @@ var usageFields = /* @__PURE__ */ new Set([
17226
17267
  "totalCredits",
17227
17268
  "contextUsagePercent",
17228
17269
  "outputTokensPerSecond",
17270
+ "sessionOutputTokensPerSecond",
17229
17271
  "apiOutputTokensPerSecond",
17230
17272
  "costSource",
17231
17273
  "unpricedModels"
@@ -17248,6 +17290,7 @@ function parseHostUsage(value) {
17248
17290
  for (const field2 of [
17249
17291
  "totalCredits",
17250
17292
  "contextUsagePercent",
17293
+ "sessionOutputTokensPerSecond",
17251
17294
  "apiOutputTokensPerSecond"
17252
17295
  ]) {
17253
17296
  const candidate = value[field2];
@@ -17326,6 +17369,7 @@ var requestTokenFields = [
17326
17369
  "cacheWrite1hInputTokens",
17327
17370
  "outputTokens",
17328
17371
  "reasoningOutputTokens",
17372
+ "timedOutputTokens",
17329
17373
  "startedAtMs",
17330
17374
  "completedAtMs"
17331
17375
  ];
@@ -23580,6 +23624,14 @@ function parseKimiConfigToml(content) {
23580
23624
  item.provider = d.provider;
23581
23625
  if (typeof d.max_context_size === "number")
23582
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;
23583
23635
  }
23584
23636
  models.push(item);
23585
23637
  }
@@ -23610,30 +23662,37 @@ function resolveKimiContextWindow(modelAlias, config2) {
23610
23662
  }
23611
23663
  return 2e5;
23612
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
+ }
23613
23672
  function buildModelCatalogFromConfig(config2, thinkingOptionsList) {
23614
- const thinkingOptions = thinkingOptionsList ?? [];
23615
- const thinkingIds = thinkingOptions.map((opt) => opt.id);
23673
+ const thinkingOptions = /* @__PURE__ */ new Map();
23616
23674
  const rawModels = config2.models.length > 0 ? config2.models : [{ alias: config2.defaultModel ?? "default" }];
23617
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);
23618
23679
  const label = m.model ? `${m.alias} (${m.model})` : m.alias;
23619
23680
  return harnessModelSchema.parse({
23620
23681
  ref: encodeKimiModelRef(m.alias),
23621
23682
  label: label.slice(0, 256),
23622
23683
  ...m.model ? { resolvedModelLabel: m.model.slice(0, 256) } : {},
23623
- ...thinkingOptionsList && m.alias === config2.defaultModel ? { supportedThinkingOptionIds: thinkingIds } : {}
23684
+ supportedThinkingOptionIds: options.map(({ id }) => id)
23624
23685
  });
23625
23686
  });
23626
23687
  const defaultModel = config2.defaultModel && models.some((m) => decodeKimiModelRefId(m.ref.id) === config2.defaultModel) ? encodeKimiModelRef(config2.defaultModel) : models[0]?.ref;
23627
- let defaultThinkingOptionId = void 0;
23628
- if (config2.thinking?.effort && thinkingIds.includes(config2.thinking.effort)) {
23629
- defaultThinkingOptionId = harnessThinkingOptionIdSchema.parse(config2.thinking.effort);
23630
- } else if (config2.thinking?.enabled === false && thinkingIds.includes("off")) {
23631
- defaultThinkingOptionId = harnessThinkingOptionIdSchema.parse("off");
23632
- }
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);
23633
23692
  return harnessModelCatalogSchema.parse({
23634
23693
  models,
23635
23694
  ...defaultModel ? { defaultModel } : {},
23636
- thinkingOptions,
23695
+ thinkingOptions: [...thinkingOptions.values()],
23637
23696
  ...defaultThinkingOptionId ? { defaultThinkingOptionId } : {}
23638
23697
  });
23639
23698
  }