@karlorz/codexhost-cli-darwin-x64 0.20.0-1 → 0.21.0-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 (51) 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/cpa-live-voice-hook.js +26 -6
  6. package/app/desktop-controller.mjs +164 -51
  7. package/app/host-runtime.mjs +21746 -15276
  8. package/app/plugins/antigravity/assets/icon.svg +1 -1
  9. package/app/plugins/antigravity/plugin.mjs +1112 -822
  10. package/app/plugins/claude-code/plugin.mjs +152 -28
  11. package/app/plugins/codebuddy/plugin.mjs +35 -6
  12. package/app/plugins/codex-usage/plugin.mjs +35 -6
  13. package/app/plugins/copilot/plugin.mjs +27 -6
  14. package/app/plugins/cursor-cli/plugin.mjs +27 -6
  15. package/app/plugins/deepseek-harness/plugin.mjs +52 -11
  16. package/app/plugins/devin/plugin.mjs +27 -6
  17. package/app/plugins/grok/plugin.mjs +63 -15
  18. package/app/plugins/hermes/plugin.mjs +27 -6
  19. package/app/plugins/kimi-code/plugin.mjs +52 -16
  20. package/app/plugins/kiro-cli/plugin.mjs +27 -6
  21. package/app/plugins/omp/plugin.mjs +35 -6
  22. package/app/plugins/opencode/plugin.mjs +53 -15
  23. package/app/plugins/pi/plugin.mjs +35 -6
  24. package/app/plugins/qoder/plugin.mjs +42 -6
  25. package/app/plugins/qoder-cn/plugin.mjs +42 -6
  26. package/app/plugins/qwen-code/plugin.mjs +27 -6
  27. package/app/plugins/workbuddy/plugin.mjs +35 -6
  28. package/app/plugins/zcode/plugin.mjs +35 -6
  29. package/app/renderer-extension.js +26 -6
  30. package/app/web/assets/{index-D6-hvggd.css → index-DJW4bmyx.css} +1 -1
  31. package/app/web/assets/{index-B5OfOGb8.js → index-DLXdvkWR.js} +63 -63
  32. package/app/web/codexhost-settings.js +34 -7
  33. package/app/web/index.html +2 -2
  34. package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
  35. package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +57 -57
  36. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +68 -68
  37. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +6 -6
  38. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +22 -22
  39. package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
  40. package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +2 -2
  41. package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +1 -1
  42. package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +1 -1
  43. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar/client.js +1 -1
  44. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.js +9 -9
  45. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +16 -16
  46. package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +2 -2
  47. package/app/web-modules/server.mjs +1017 -672
  48. package/bin/codexhost +0 -0
  49. package/libexec/codexhost-shim +0 -0
  50. package/libexec/codexhost-updater +0 -0
  51. package/package.json +1 -1
@@ -15394,7 +15394,7 @@ var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonneg
15394
15394
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
15395
15395
  var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
15396
15396
  var usageOutputTimingSchema = external_exports.object({
15397
- version: external_exports.literal(3).optional(),
15397
+ version: external_exports.union([external_exports.literal(3), external_exports.literal(4)]).optional(),
15398
15398
  requestId: external_exports.string().min(1),
15399
15399
  turnId: external_exports.string().min(1).max(1024),
15400
15400
  outputTokens: nonNegativeSafeIntegerSchema,
@@ -15402,16 +15402,16 @@ var usageOutputTimingSchema = external_exports.object({
15402
15402
  completedAtMs: nonNegativeSafeIntegerSchema
15403
15403
  }).strict().refine((value) => value.completedAtMs > value.startedAtMs);
15404
15404
  var usageMeasurementSchema = external_exports.object({
15405
- version: external_exports.union([external_exports.literal(2), external_exports.literal(3)]).optional(),
15405
+ version: external_exports.union([external_exports.literal(2), external_exports.literal(3), external_exports.literal(4)]).optional(),
15406
15406
  value: finiteNonNegativeNumberSchema,
15407
15407
  turnId: external_exports.string().min(1).max(1024),
15408
15408
  at: nonNegativeSafeIntegerSchema
15409
15409
  }).strict();
15410
15410
  var usageMeasurementsSchema = external_exports.object({
15411
- // Unversioned intervals can omit hidden thinking time; do not restore them into averages.
15412
- outputTimings: external_exports.array(usageOutputTimingSchema).transform((values) => values.filter((value) => value.version === 3)).optional(),
15411
+ // Older intervals can omit hidden thinking time; do not restore them into averages.
15412
+ outputTimings: external_exports.array(usageOutputTimingSchema).transform((values) => values.filter((value) => value.version === 4)).optional(),
15413
15413
  // Retain independent TTFT facts when dropping incompatible speed measurements.
15414
- outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 3).optional().catch(void 0),
15414
+ outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 4).optional().catch(void 0),
15415
15415
  timeToFirstOutputMs: usageMeasurementSchema.extend({ value: nonNegativeSafeIntegerSchema }).optional()
15416
15416
  }).strict();
15417
15417
  var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text2) => text2.length <= maximum));
@@ -15925,6 +15925,11 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
15925
15925
  cursor: clientChannelCursorSchema,
15926
15926
  cwd: external_exports.string().optional()
15927
15927
  }),
15928
+ external_exports.object({
15929
+ type: external_exports.literal("harness-inspection-changed"),
15930
+ cursor: clientChannelCursorSchema,
15931
+ harnessId: external_exports.string().min(1)
15932
+ }),
15928
15933
  external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
15929
15934
  external_exports.object({
15930
15935
  type: external_exports.literal("preferences-changed"),
@@ -15996,6 +16001,8 @@ var clientItemTruncationSchema = external_exports.object({
15996
16001
  var clientTurnSchema = external_exports.object({
15997
16002
  id: external_exports.string().min(1),
15998
16003
  status: external_exports.string().min(1),
16004
+ /** Native history has no terminal evidence; Desktop's status vocabulary cannot express this. */
16005
+ codexhostTurnOutcome: external_exports.object({ status: external_exports.literal("unknown"), reason: external_exports.string() }).optional(),
15999
16006
  items: external_exports.array(external_exports.object({ id: external_exports.string().min(1), type: external_exports.string().min(1) }).passthrough()),
16000
16007
  /** Original file operations, independent of the cumulative Desktop fileChange card.
16001
16008
  * Insert before the named non-file Item; null appends at the end of the Turn.
@@ -17261,6 +17268,7 @@ var THREAD_WATCH_NOTICE_OUTCOMES = [
17261
17268
  "completed",
17262
17269
  "failed",
17263
17270
  "interrupted",
17271
+ "needsInput",
17264
17272
  "timedOut",
17265
17273
  "unreadable",
17266
17274
  "notFound"
@@ -17307,13 +17315,25 @@ var target = { hostId: identity.regex(/^remote-(?:ssh(?:-|:)|control:)/u) };
17307
17315
  var thread = { ...target, threadId: identity };
17308
17316
  var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
17309
17317
  external_exports.strictObject({ kind: external_exports.literal("hosts") }),
17318
+ external_exports.strictObject({ kind: external_exports.literal("status"), ...thread }),
17310
17319
  external_exports.strictObject({
17311
17320
  kind: external_exports.literal("list"),
17312
17321
  ...target,
17313
17322
  cursor: external_exports.string().nullable(),
17314
17323
  archived: external_exports.boolean()
17315
17324
  }),
17316
- external_exports.strictObject({ kind: external_exports.literal("read"), ...thread }),
17325
+ external_exports.strictObject({
17326
+ kind: external_exports.literal("read"),
17327
+ ...thread,
17328
+ page: external_exports.strictObject({
17329
+ cursor: external_exports.string().min(1).max(8192).nullable(),
17330
+ epoch: identity.optional(),
17331
+ sortDirection: external_exports.enum(["asc", "desc"]).optional(),
17332
+ limit: external_exports.number().int().min(1).max(20).optional()
17333
+ }).refine((page) => page.cursor === null || page.epoch !== void 0, {
17334
+ message: "A history continuation requires its connection epoch"
17335
+ }).optional()
17336
+ }),
17317
17337
  external_exports.strictObject({
17318
17338
  kind: external_exports.literal("configure"),
17319
17339
  ...thread,
@@ -17636,6 +17656,7 @@ var requestTokenFields = [
17636
17656
  "cacheWrite1hInputTokens",
17637
17657
  "outputTokens",
17638
17658
  "reasoningOutputTokens",
17659
+ "timedOutputTokens",
17639
17660
  "startedAtMs",
17640
17661
  "completedAtMs"
17641
17662
  ];
@@ -15514,7 +15514,7 @@ var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonneg
15514
15514
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
15515
15515
  var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
15516
15516
  var usageOutputTimingSchema = external_exports.object({
15517
- version: external_exports.literal(3).optional(),
15517
+ version: external_exports.union([external_exports.literal(3), external_exports.literal(4)]).optional(),
15518
15518
  requestId: external_exports.string().min(1),
15519
15519
  turnId: external_exports.string().min(1).max(1024),
15520
15520
  outputTokens: nonNegativeSafeIntegerSchema,
@@ -15522,16 +15522,16 @@ var usageOutputTimingSchema = external_exports.object({
15522
15522
  completedAtMs: nonNegativeSafeIntegerSchema
15523
15523
  }).strict().refine((value) => value.completedAtMs > value.startedAtMs);
15524
15524
  var usageMeasurementSchema = external_exports.object({
15525
- version: external_exports.union([external_exports.literal(2), external_exports.literal(3)]).optional(),
15525
+ version: external_exports.union([external_exports.literal(2), external_exports.literal(3), external_exports.literal(4)]).optional(),
15526
15526
  value: finiteNonNegativeNumberSchema,
15527
15527
  turnId: external_exports.string().min(1).max(1024),
15528
15528
  at: nonNegativeSafeIntegerSchema
15529
15529
  }).strict();
15530
15530
  var usageMeasurementsSchema = external_exports.object({
15531
- // Unversioned intervals can omit hidden thinking time; do not restore them into averages.
15532
- outputTimings: external_exports.array(usageOutputTimingSchema).transform((values) => values.filter((value) => value.version === 3)).optional(),
15531
+ // Older intervals can omit hidden thinking time; do not restore them into averages.
15532
+ outputTimings: external_exports.array(usageOutputTimingSchema).transform((values) => values.filter((value) => value.version === 4)).optional(),
15533
15533
  // Retain independent TTFT facts when dropping incompatible speed measurements.
15534
- outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 3).optional().catch(void 0),
15534
+ outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 4).optional().catch(void 0),
15535
15535
  timeToFirstOutputMs: usageMeasurementSchema.extend({ value: nonNegativeSafeIntegerSchema }).optional()
15536
15536
  }).strict();
15537
15537
  var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text) => text.length <= maximum));
@@ -16045,6 +16045,11 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
16045
16045
  cursor: clientChannelCursorSchema,
16046
16046
  cwd: external_exports.string().optional()
16047
16047
  }),
16048
+ external_exports.object({
16049
+ type: external_exports.literal("harness-inspection-changed"),
16050
+ cursor: clientChannelCursorSchema,
16051
+ harnessId: external_exports.string().min(1)
16052
+ }),
16048
16053
  external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
16049
16054
  external_exports.object({
16050
16055
  type: external_exports.literal("preferences-changed"),
@@ -16116,6 +16121,8 @@ var clientItemTruncationSchema = external_exports.object({
16116
16121
  var clientTurnSchema = external_exports.object({
16117
16122
  id: external_exports.string().min(1),
16118
16123
  status: external_exports.string().min(1),
16124
+ /** Native history has no terminal evidence; Desktop's status vocabulary cannot express this. */
16125
+ codexhostTurnOutcome: external_exports.object({ status: external_exports.literal("unknown"), reason: external_exports.string() }).optional(),
16119
16126
  items: external_exports.array(external_exports.object({ id: external_exports.string().min(1), type: external_exports.string().min(1) }).passthrough()),
16120
16127
  /** Original file operations, independent of the cumulative Desktop fileChange card.
16121
16128
  * Insert before the named non-file Item; null appends at the end of the Turn.
@@ -17381,6 +17388,7 @@ var THREAD_WATCH_NOTICE_OUTCOMES = [
17381
17388
  "completed",
17382
17389
  "failed",
17383
17390
  "interrupted",
17391
+ "needsInput",
17384
17392
  "timedOut",
17385
17393
  "unreadable",
17386
17394
  "notFound"
@@ -17427,13 +17435,25 @@ var target = { hostId: identity.regex(/^remote-(?:ssh(?:-|:)|control:)/u) };
17427
17435
  var thread = { ...target, threadId: identity };
17428
17436
  var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
17429
17437
  external_exports.strictObject({ kind: external_exports.literal("hosts") }),
17438
+ external_exports.strictObject({ kind: external_exports.literal("status"), ...thread }),
17430
17439
  external_exports.strictObject({
17431
17440
  kind: external_exports.literal("list"),
17432
17441
  ...target,
17433
17442
  cursor: external_exports.string().nullable(),
17434
17443
  archived: external_exports.boolean()
17435
17444
  }),
17436
- external_exports.strictObject({ kind: external_exports.literal("read"), ...thread }),
17445
+ external_exports.strictObject({
17446
+ kind: external_exports.literal("read"),
17447
+ ...thread,
17448
+ page: external_exports.strictObject({
17449
+ cursor: external_exports.string().min(1).max(8192).nullable(),
17450
+ epoch: identity.optional(),
17451
+ sortDirection: external_exports.enum(["asc", "desc"]).optional(),
17452
+ limit: external_exports.number().int().min(1).max(20).optional()
17453
+ }).refine((page) => page.cursor === null || page.epoch !== void 0, {
17454
+ message: "A history continuation requires its connection epoch"
17455
+ }).optional()
17456
+ }),
17437
17457
  external_exports.strictObject({
17438
17458
  kind: external_exports.literal("configure"),
17439
17459
  ...thread,
@@ -17850,6 +17870,7 @@ var requestTokenFields = [
17850
17870
  "cacheWrite1hInputTokens",
17851
17871
  "outputTokens",
17852
17872
  "reasoningOutputTokens",
17873
+ "timedOutputTokens",
17853
17874
  "startedAtMs",
17854
17875
  "completedAtMs"
17855
17876
  ];
@@ -24104,6 +24125,14 @@ function parseKimiConfigToml(content) {
24104
24125
  item.provider = d.provider;
24105
24126
  if (typeof d.max_context_size === "number")
24106
24127
  item.maxContextSize = d.max_context_size;
24128
+ if (Array.isArray(d.capabilities)) {
24129
+ item.capabilities = d.capabilities.filter((value) => typeof value === "string");
24130
+ }
24131
+ if (Array.isArray(d.support_efforts)) {
24132
+ item.supportEfforts = d.support_efforts.filter((value) => typeof value === "string");
24133
+ }
24134
+ if (typeof d.default_effort === "string")
24135
+ item.defaultEffort = d.default_effort;
24107
24136
  }
24108
24137
  models.push(item);
24109
24138
  }
@@ -24134,30 +24163,37 @@ function resolveKimiContextWindow(modelAlias, config2) {
24134
24163
  }
24135
24164
  return 2e5;
24136
24165
  }
24166
+ function configuredThinkingOptions(model2) {
24167
+ const alwaysThinking = model2.capabilities?.includes("always_thinking") === true;
24168
+ if (!alwaysThinking && !model2.capabilities?.includes("thinking"))
24169
+ return [];
24170
+ const values = model2.supportEfforts?.length ? ["off", ...model2.supportEfforts] : ["off", "on"];
24171
+ return [...new Set(values)].filter((value) => !alwaysThinking || value !== "off").map((value) => harnessThinkingOptionSchema.parse({ id: value, label: formatThinkingLabel(value) }));
24172
+ }
24137
24173
  function buildModelCatalogFromConfig(config2, thinkingOptionsList) {
24138
- const thinkingOptions = thinkingOptionsList ?? [];
24139
- const thinkingIds = thinkingOptions.map((opt) => opt.id);
24174
+ const thinkingOptions = /* @__PURE__ */ new Map();
24140
24175
  const rawModels = config2.models.length > 0 ? config2.models : [{ alias: config2.defaultModel ?? "default" }];
24141
24176
  const models = rawModels.map((m) => {
24177
+ const options = thinkingOptionsList !== void 0 ? m.alias === config2.defaultModel ? thinkingOptionsList : [] : configuredThinkingOptions(m);
24178
+ for (const option of options)
24179
+ thinkingOptions.set(option.id, option);
24142
24180
  const label = m.model ? `${m.alias} (${m.model})` : m.alias;
24143
24181
  return harnessModelSchema.parse({
24144
24182
  ref: encodeKimiModelRef(m.alias),
24145
24183
  label: label.slice(0, 256),
24146
24184
  ...m.model ? { resolvedModelLabel: m.model.slice(0, 256) } : {},
24147
- ...thinkingOptionsList && m.alias === config2.defaultModel ? { supportedThinkingOptionIds: thinkingIds } : {}
24185
+ supportedThinkingOptionIds: options.map(({ id }) => id)
24148
24186
  });
24149
24187
  });
24150
24188
  const defaultModel = config2.defaultModel && models.some((m) => decodeKimiModelRefId(m.ref.id) === config2.defaultModel) ? encodeKimiModelRef(config2.defaultModel) : models[0]?.ref;
24151
- let defaultThinkingOptionId = void 0;
24152
- if (config2.thinking?.effort && thinkingIds.includes(config2.thinking.effort)) {
24153
- defaultThinkingOptionId = harnessThinkingOptionIdSchema.parse(config2.thinking.effort);
24154
- } else if (config2.thinking?.enabled === false && thinkingIds.includes("off")) {
24155
- defaultThinkingOptionId = harnessThinkingOptionIdSchema.parse("off");
24156
- }
24189
+ const selectedModel = models.find((model2) => model2.ref.id === defaultModel?.id);
24190
+ const configuredDefault = config2.models.find((model2) => encodeKimiModelRef(model2.alias).id === defaultModel?.id)?.defaultEffort;
24191
+ const requestedDefault = config2.thinking?.enabled === false ? "off" : config2.thinking?.effort ?? configuredDefault;
24192
+ const defaultThinkingOptionId = selectedModel?.supportedThinkingOptionIds?.find((id) => id === requestedDefault);
24157
24193
  return harnessModelCatalogSchema.parse({
24158
24194
  models,
24159
24195
  ...defaultModel ? { defaultModel } : {},
24160
- thinkingOptions,
24196
+ thinkingOptions: [...thinkingOptions.values()],
24161
24197
  ...defaultThinkingOptionId ? { defaultThinkingOptionId } : {}
24162
24198
  });
24163
24199
  }
@@ -15369,7 +15369,7 @@ var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonneg
15369
15369
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
15370
15370
  var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
15371
15371
  var usageOutputTimingSchema = external_exports.object({
15372
- version: external_exports.literal(3).optional(),
15372
+ version: external_exports.union([external_exports.literal(3), external_exports.literal(4)]).optional(),
15373
15373
  requestId: external_exports.string().min(1),
15374
15374
  turnId: external_exports.string().min(1).max(1024),
15375
15375
  outputTokens: nonNegativeSafeIntegerSchema,
@@ -15377,16 +15377,16 @@ var usageOutputTimingSchema = external_exports.object({
15377
15377
  completedAtMs: nonNegativeSafeIntegerSchema
15378
15378
  }).strict().refine((value) => value.completedAtMs > value.startedAtMs);
15379
15379
  var usageMeasurementSchema = external_exports.object({
15380
- version: external_exports.union([external_exports.literal(2), external_exports.literal(3)]).optional(),
15380
+ version: external_exports.union([external_exports.literal(2), external_exports.literal(3), external_exports.literal(4)]).optional(),
15381
15381
  value: finiteNonNegativeNumberSchema,
15382
15382
  turnId: external_exports.string().min(1).max(1024),
15383
15383
  at: nonNegativeSafeIntegerSchema
15384
15384
  }).strict();
15385
15385
  var usageMeasurementsSchema = external_exports.object({
15386
- // Unversioned intervals can omit hidden thinking time; do not restore them into averages.
15387
- outputTimings: external_exports.array(usageOutputTimingSchema).transform((values) => values.filter((value) => value.version === 3)).optional(),
15386
+ // Older intervals can omit hidden thinking time; do not restore them into averages.
15387
+ outputTimings: external_exports.array(usageOutputTimingSchema).transform((values) => values.filter((value) => value.version === 4)).optional(),
15388
15388
  // Retain independent TTFT facts when dropping incompatible speed measurements.
15389
- outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 3).optional().catch(void 0),
15389
+ outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 4).optional().catch(void 0),
15390
15390
  timeToFirstOutputMs: usageMeasurementSchema.extend({ value: nonNegativeSafeIntegerSchema }).optional()
15391
15391
  }).strict();
15392
15392
  var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text) => text.length <= maximum));
@@ -15900,6 +15900,11 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
15900
15900
  cursor: clientChannelCursorSchema,
15901
15901
  cwd: external_exports.string().optional()
15902
15902
  }),
15903
+ external_exports.object({
15904
+ type: external_exports.literal("harness-inspection-changed"),
15905
+ cursor: clientChannelCursorSchema,
15906
+ harnessId: external_exports.string().min(1)
15907
+ }),
15903
15908
  external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
15904
15909
  external_exports.object({
15905
15910
  type: external_exports.literal("preferences-changed"),
@@ -15971,6 +15976,8 @@ var clientItemTruncationSchema = external_exports.object({
15971
15976
  var clientTurnSchema = external_exports.object({
15972
15977
  id: external_exports.string().min(1),
15973
15978
  status: external_exports.string().min(1),
15979
+ /** Native history has no terminal evidence; Desktop's status vocabulary cannot express this. */
15980
+ codexhostTurnOutcome: external_exports.object({ status: external_exports.literal("unknown"), reason: external_exports.string() }).optional(),
15974
15981
  items: external_exports.array(external_exports.object({ id: external_exports.string().min(1), type: external_exports.string().min(1) }).passthrough()),
15975
15982
  /** Original file operations, independent of the cumulative Desktop fileChange card.
15976
15983
  * Insert before the named non-file Item; null appends at the end of the Turn.
@@ -17236,6 +17243,7 @@ var THREAD_WATCH_NOTICE_OUTCOMES = [
17236
17243
  "completed",
17237
17244
  "failed",
17238
17245
  "interrupted",
17246
+ "needsInput",
17239
17247
  "timedOut",
17240
17248
  "unreadable",
17241
17249
  "notFound"
@@ -17282,13 +17290,25 @@ var target = { hostId: identity.regex(/^remote-(?:ssh(?:-|:)|control:)/u) };
17282
17290
  var thread = { ...target, threadId: identity };
17283
17291
  var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
17284
17292
  external_exports.strictObject({ kind: external_exports.literal("hosts") }),
17293
+ external_exports.strictObject({ kind: external_exports.literal("status"), ...thread }),
17285
17294
  external_exports.strictObject({
17286
17295
  kind: external_exports.literal("list"),
17287
17296
  ...target,
17288
17297
  cursor: external_exports.string().nullable(),
17289
17298
  archived: external_exports.boolean()
17290
17299
  }),
17291
- external_exports.strictObject({ kind: external_exports.literal("read"), ...thread }),
17300
+ external_exports.strictObject({
17301
+ kind: external_exports.literal("read"),
17302
+ ...thread,
17303
+ page: external_exports.strictObject({
17304
+ cursor: external_exports.string().min(1).max(8192).nullable(),
17305
+ epoch: identity.optional(),
17306
+ sortDirection: external_exports.enum(["asc", "desc"]).optional(),
17307
+ limit: external_exports.number().int().min(1).max(20).optional()
17308
+ }).refine((page) => page.cursor === null || page.epoch !== void 0, {
17309
+ message: "A history continuation requires its connection epoch"
17310
+ }).optional()
17311
+ }),
17292
17312
  external_exports.strictObject({
17293
17313
  kind: external_exports.literal("configure"),
17294
17314
  ...thread,
@@ -17742,6 +17762,7 @@ var requestTokenFields = [
17742
17762
  "cacheWrite1hInputTokens",
17743
17763
  "outputTokens",
17744
17764
  "reasoningOutputTokens",
17765
+ "timedOutputTokens",
17745
17766
  "startedAtMs",
17746
17767
  "completedAtMs"
17747
17768
  ];
@@ -15430,7 +15430,7 @@ var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonneg
15430
15430
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
15431
15431
  var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
15432
15432
  var usageOutputTimingSchema = external_exports.object({
15433
- version: external_exports.literal(3).optional(),
15433
+ version: external_exports.union([external_exports.literal(3), external_exports.literal(4)]).optional(),
15434
15434
  requestId: external_exports.string().min(1),
15435
15435
  turnId: external_exports.string().min(1).max(1024),
15436
15436
  outputTokens: nonNegativeSafeIntegerSchema,
@@ -15438,16 +15438,16 @@ var usageOutputTimingSchema = external_exports.object({
15438
15438
  completedAtMs: nonNegativeSafeIntegerSchema
15439
15439
  }).strict().refine((value) => value.completedAtMs > value.startedAtMs);
15440
15440
  var usageMeasurementSchema = external_exports.object({
15441
- version: external_exports.union([external_exports.literal(2), external_exports.literal(3)]).optional(),
15441
+ version: external_exports.union([external_exports.literal(2), external_exports.literal(3), external_exports.literal(4)]).optional(),
15442
15442
  value: finiteNonNegativeNumberSchema,
15443
15443
  turnId: external_exports.string().min(1).max(1024),
15444
15444
  at: nonNegativeSafeIntegerSchema
15445
15445
  }).strict();
15446
15446
  var usageMeasurementsSchema = external_exports.object({
15447
- // Unversioned intervals can omit hidden thinking time; do not restore them into averages.
15448
- outputTimings: external_exports.array(usageOutputTimingSchema).transform((values) => values.filter((value) => value.version === 3)).optional(),
15447
+ // Older intervals can omit hidden thinking time; do not restore them into averages.
15448
+ outputTimings: external_exports.array(usageOutputTimingSchema).transform((values) => values.filter((value) => value.version === 4)).optional(),
15449
15449
  // Retain independent TTFT facts when dropping incompatible speed measurements.
15450
- outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 3).optional().catch(void 0),
15450
+ outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 4).optional().catch(void 0),
15451
15451
  timeToFirstOutputMs: usageMeasurementSchema.extend({ value: nonNegativeSafeIntegerSchema }).optional()
15452
15452
  }).strict();
15453
15453
  var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text) => text.length <= maximum));
@@ -15961,6 +15961,11 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
15961
15961
  cursor: clientChannelCursorSchema,
15962
15962
  cwd: external_exports.string().optional()
15963
15963
  }),
15964
+ external_exports.object({
15965
+ type: external_exports.literal("harness-inspection-changed"),
15966
+ cursor: clientChannelCursorSchema,
15967
+ harnessId: external_exports.string().min(1)
15968
+ }),
15964
15969
  external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
15965
15970
  external_exports.object({
15966
15971
  type: external_exports.literal("preferences-changed"),
@@ -16032,6 +16037,8 @@ var clientItemTruncationSchema = external_exports.object({
16032
16037
  var clientTurnSchema = external_exports.object({
16033
16038
  id: external_exports.string().min(1),
16034
16039
  status: external_exports.string().min(1),
16040
+ /** Native history has no terminal evidence; Desktop's status vocabulary cannot express this. */
16041
+ codexhostTurnOutcome: external_exports.object({ status: external_exports.literal("unknown"), reason: external_exports.string() }).optional(),
16035
16042
  items: external_exports.array(external_exports.object({ id: external_exports.string().min(1), type: external_exports.string().min(1) }).passthrough()),
16036
16043
  /** Original file operations, independent of the cumulative Desktop fileChange card.
16037
16044
  * Insert before the named non-file Item; null appends at the end of the Turn.
@@ -17297,6 +17304,7 @@ var THREAD_WATCH_NOTICE_OUTCOMES = [
17297
17304
  "completed",
17298
17305
  "failed",
17299
17306
  "interrupted",
17307
+ "needsInput",
17300
17308
  "timedOut",
17301
17309
  "unreadable",
17302
17310
  "notFound"
@@ -17343,13 +17351,25 @@ var target = { hostId: identity.regex(/^remote-(?:ssh(?:-|:)|control:)/u) };
17343
17351
  var thread = { ...target, threadId: identity };
17344
17352
  var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
17345
17353
  external_exports.strictObject({ kind: external_exports.literal("hosts") }),
17354
+ external_exports.strictObject({ kind: external_exports.literal("status"), ...thread }),
17346
17355
  external_exports.strictObject({
17347
17356
  kind: external_exports.literal("list"),
17348
17357
  ...target,
17349
17358
  cursor: external_exports.string().nullable(),
17350
17359
  archived: external_exports.boolean()
17351
17360
  }),
17352
- external_exports.strictObject({ kind: external_exports.literal("read"), ...thread }),
17361
+ external_exports.strictObject({
17362
+ kind: external_exports.literal("read"),
17363
+ ...thread,
17364
+ page: external_exports.strictObject({
17365
+ cursor: external_exports.string().min(1).max(8192).nullable(),
17366
+ epoch: identity.optional(),
17367
+ sortDirection: external_exports.enum(["asc", "desc"]).optional(),
17368
+ limit: external_exports.number().int().min(1).max(20).optional()
17369
+ }).refine((page) => page.cursor === null || page.epoch !== void 0, {
17370
+ message: "A history continuation requires its connection epoch"
17371
+ }).optional()
17372
+ }),
17353
17373
  external_exports.strictObject({
17354
17374
  kind: external_exports.literal("configure"),
17355
17375
  ...thread,
@@ -17762,6 +17782,7 @@ var requestTokenFields = [
17762
17782
  "cacheWrite1hInputTokens",
17763
17783
  "outputTokens",
17764
17784
  "reasoningOutputTokens",
17785
+ "timedOutputTokens",
17765
17786
  "startedAtMs",
17766
17787
  "completedAtMs"
17767
17788
  ];
@@ -17814,6 +17835,14 @@ function parseHostUsageRequest(value) {
17814
17835
  if (request.startedAtMs === void 0 !== (request.completedAtMs === void 0)) {
17815
17836
  throw new Error("Harness Usage request timing fields must be provided together");
17816
17837
  }
17838
+ if (request.timedOutputTokens !== void 0) {
17839
+ if (request.startedAtMs === void 0) {
17840
+ throw new Error("Harness Usage request 'timedOutputTokens' requires timing fields");
17841
+ }
17842
+ if (request.timedOutputTokens > request.outputTokens) {
17843
+ throw new Error("Harness Usage request 'timedOutputTokens' must not exceed 'outputTokens'");
17844
+ }
17845
+ }
17817
17846
  if (request.startedAtMs !== void 0 && request.completedAtMs !== void 0 && request.completedAtMs < request.startedAtMs) {
17818
17847
  throw new Error("Harness Usage request 'completedAtMs' must not precede 'startedAtMs'");
17819
17848
  }
@@ -15573,7 +15573,7 @@ var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonneg
15573
15573
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
15574
15574
  var cacheHitRatePercentSchema = external_exports.number().finite().min(0).max(100);
15575
15575
  var usageOutputTimingSchema = external_exports.object({
15576
- version: external_exports.literal(3).optional(),
15576
+ version: external_exports.union([external_exports.literal(3), external_exports.literal(4)]).optional(),
15577
15577
  requestId: external_exports.string().min(1),
15578
15578
  turnId: external_exports.string().min(1).max(1024),
15579
15579
  outputTokens: nonNegativeSafeIntegerSchema,
@@ -15581,16 +15581,16 @@ var usageOutputTimingSchema = external_exports.object({
15581
15581
  completedAtMs: nonNegativeSafeIntegerSchema
15582
15582
  }).strict().refine((value) => value.completedAtMs > value.startedAtMs);
15583
15583
  var usageMeasurementSchema = external_exports.object({
15584
- version: external_exports.union([external_exports.literal(2), external_exports.literal(3)]).optional(),
15584
+ version: external_exports.union([external_exports.literal(2), external_exports.literal(3), external_exports.literal(4)]).optional(),
15585
15585
  value: finiteNonNegativeNumberSchema,
15586
15586
  turnId: external_exports.string().min(1).max(1024),
15587
15587
  at: nonNegativeSafeIntegerSchema
15588
15588
  }).strict();
15589
15589
  var usageMeasurementsSchema = external_exports.object({
15590
- // Unversioned intervals can omit hidden thinking time; do not restore them into averages.
15591
- outputTimings: external_exports.array(usageOutputTimingSchema).transform((values) => values.filter((value) => value.version === 3)).optional(),
15590
+ // Older intervals can omit hidden thinking time; do not restore them into averages.
15591
+ outputTimings: external_exports.array(usageOutputTimingSchema).transform((values) => values.filter((value) => value.version === 4)).optional(),
15592
15592
  // Retain independent TTFT facts when dropping incompatible speed measurements.
15593
- outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 3).optional().catch(void 0),
15593
+ outputTokensPerSecond: usageMeasurementSchema.refine((value) => value.version === 4).optional().catch(void 0),
15594
15594
  timeToFirstOutputMs: usageMeasurementSchema.extend({ value: nonNegativeSafeIntegerSchema }).optional()
15595
15595
  }).strict();
15596
15596
  var indicatorTextSchema = (maximum) => harnessLocalizedTextSchema.refine((entries) => Object.values(entries).every((text) => text.length <= maximum));
@@ -16104,6 +16104,11 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
16104
16104
  cursor: clientChannelCursorSchema,
16105
16105
  cwd: external_exports.string().optional()
16106
16106
  }),
16107
+ external_exports.object({
16108
+ type: external_exports.literal("harness-inspection-changed"),
16109
+ cursor: clientChannelCursorSchema,
16110
+ harnessId: external_exports.string().min(1)
16111
+ }),
16107
16112
  external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
16108
16113
  external_exports.object({
16109
16114
  type: external_exports.literal("preferences-changed"),
@@ -16175,6 +16180,8 @@ var clientItemTruncationSchema = external_exports.object({
16175
16180
  var clientTurnSchema = external_exports.object({
16176
16181
  id: external_exports.string().min(1),
16177
16182
  status: external_exports.string().min(1),
16183
+ /** Native history has no terminal evidence; Desktop's status vocabulary cannot express this. */
16184
+ codexhostTurnOutcome: external_exports.object({ status: external_exports.literal("unknown"), reason: external_exports.string() }).optional(),
16178
16185
  items: external_exports.array(external_exports.object({ id: external_exports.string().min(1), type: external_exports.string().min(1) }).passthrough()),
16179
16186
  /** Original file operations, independent of the cumulative Desktop fileChange card.
16180
16187
  * Insert before the named non-file Item; null appends at the end of the Turn.
@@ -17440,6 +17447,7 @@ var THREAD_WATCH_NOTICE_OUTCOMES = [
17440
17447
  "completed",
17441
17448
  "failed",
17442
17449
  "interrupted",
17450
+ "needsInput",
17443
17451
  "timedOut",
17444
17452
  "unreadable",
17445
17453
  "notFound"
@@ -17486,13 +17494,25 @@ var target = { hostId: identity.regex(/^remote-(?:ssh(?:-|:)|control:)/u) };
17486
17494
  var thread = { ...target, threadId: identity };
17487
17495
  var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
17488
17496
  external_exports.strictObject({ kind: external_exports.literal("hosts") }),
17497
+ external_exports.strictObject({ kind: external_exports.literal("status"), ...thread }),
17489
17498
  external_exports.strictObject({
17490
17499
  kind: external_exports.literal("list"),
17491
17500
  ...target,
17492
17501
  cursor: external_exports.string().nullable(),
17493
17502
  archived: external_exports.boolean()
17494
17503
  }),
17495
- external_exports.strictObject({ kind: external_exports.literal("read"), ...thread }),
17504
+ external_exports.strictObject({
17505
+ kind: external_exports.literal("read"),
17506
+ ...thread,
17507
+ page: external_exports.strictObject({
17508
+ cursor: external_exports.string().min(1).max(8192).nullable(),
17509
+ epoch: identity.optional(),
17510
+ sortDirection: external_exports.enum(["asc", "desc"]).optional(),
17511
+ limit: external_exports.number().int().min(1).max(20).optional()
17512
+ }).refine((page) => page.cursor === null || page.epoch !== void 0, {
17513
+ message: "A history continuation requires its connection epoch"
17514
+ }).optional()
17515
+ }),
17496
17516
  external_exports.strictObject({
17497
17517
  kind: external_exports.literal("configure"),
17498
17518
  ...thread,
@@ -17905,6 +17925,7 @@ var requestTokenFields = [
17905
17925
  "cacheWrite1hInputTokens",
17906
17926
  "outputTokens",
17907
17927
  "reasoningOutputTokens",
17928
+ "timedOutputTokens",
17908
17929
  "startedAtMs",
17909
17930
  "completedAtMs"
17910
17931
  ];
@@ -17957,6 +17978,14 @@ function parseHostUsageRequest(value) {
17957
17978
  if (request.startedAtMs === void 0 !== (request.completedAtMs === void 0)) {
17958
17979
  throw new Error("Harness Usage request timing fields must be provided together");
17959
17980
  }
17981
+ if (request.timedOutputTokens !== void 0) {
17982
+ if (request.startedAtMs === void 0) {
17983
+ throw new Error("Harness Usage request 'timedOutputTokens' requires timing fields");
17984
+ }
17985
+ if (request.timedOutputTokens > request.outputTokens) {
17986
+ throw new Error("Harness Usage request 'timedOutputTokens' must not exceed 'outputTokens'");
17987
+ }
17988
+ }
17960
17989
  if (request.startedAtMs !== void 0 && request.completedAtMs !== void 0 && request.completedAtMs < request.startedAtMs) {
17961
17990
  throw new Error("Harness Usage request 'completedAtMs' must not precede 'startedAtMs'");
17962
17991
  }
@@ -17964,11 +17993,12 @@ function parseHostUsageRequest(value) {
17964
17993
  }
17965
17994
 
17966
17995
  // dist/v2/usage.js
17967
- function v2UsageRequest(message, historical, firstOutputAtMs) {
17996
+ function v2UsageRequest(message, historical, timing) {
17968
17997
  if (message.type !== "assistant" || !message.tokens)
17969
17998
  return null;
17970
17999
  const { input, output, reasoning, cache } = message.tokens;
17971
18000
  const { streamed } = message.time;
18001
+ const firstOutputAtMs = timing?.firstOutputAtMs;
17972
18002
  return parseHostUsageRequest({
17973
18003
  requestId: message.id,
17974
18004
  ...historical ? { historical: true } : {},
@@ -17982,8 +18012,8 @@ function v2UsageRequest(message, historical, firstOutputAtMs) {
17982
18012
  outputTokens: output + reasoning,
17983
18013
  reasoningOutputTokens: reasoning,
17984
18014
  // End at stream completion, not step completion, which can include tool execution.
17985
- // Without a native stream end, keep the usage but do not guess its generation duration.
17986
- ...!historical && firstOutputAtMs !== void 0 && streamed !== void 0 && streamed >= firstOutputAtMs ? { startedAtMs: firstOutputAtMs, completedAtMs: streamed } : {}
18015
+ // Without a stream end or a boundary covering reasoning, retain usage without timing.
18016
+ ...!historical && (reasoning === 0 || timing?.reasoningObserved) && firstOutputAtMs !== void 0 && streamed !== void 0 && streamed >= firstOutputAtMs ? { startedAtMs: firstOutputAtMs, completedAtMs: streamed } : {}
17987
18017
  });
17988
18018
  }
17989
18019
 
@@ -28634,8 +28664,6 @@ var V2Session = class {
28634
28664
  #cacheHitRatePercent;
28635
28665
  /** Assistant messages already published as usage requests. */
28636
28666
  #meteredMessages = /* @__PURE__ */ new Set();
28637
- /** Adapter receive time of each assistant message's first reasoning, text or tool input. */
28638
- #firstOutputAt = /* @__PURE__ */ new Map();
28639
28667
  constructor(client2, connection, info, catalog, policy, limit, onClosed) {
28640
28668
  this.client = client2;
28641
28669
  this.connection = connection;
@@ -28799,6 +28827,7 @@ var V2Session = class {
28799
28827
  baseline: /* @__PURE__ */ new Set(),
28800
28828
  live: /* @__PURE__ */ new Map(),
28801
28829
  assistants: /* @__PURE__ */ new Set(),
28830
+ outputTiming: /* @__PURE__ */ new Map(),
28802
28831
  transient: /* @__PURE__ */ new Map(),
28803
28832
  interactions: /* @__PURE__ */ new Map(),
28804
28833
  replying: /* @__PURE__ */ new Set(),
@@ -28849,8 +28878,16 @@ var V2Session = class {
28849
28878
  const active = this.#active;
28850
28879
  if (!active || !("data" in event) || !("sessionID" in event.data) || event.data.sessionID !== this.info.id)
28851
28880
  return;
28852
- if (FIRST_OUTPUT_EVENTS.has(event.type) && "assistantMessageID" in event.data && typeof event.data.assistantMessageID === "string" && !this.#firstOutputAt.has(event.data.assistantMessageID))
28853
- this.#firstOutputAt.set(event.data.assistantMessageID, Date.now());
28881
+ 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)) {
28882
+ const id = event.data.assistantMessageID;
28883
+ const timing = active.outputTiming.get(id) ?? {
28884
+ firstOutputAtMs: Date.now(),
28885
+ reasoningObserved: false
28886
+ };
28887
+ if (event.type === "session.reasoning.started" || event.type === "session.reasoning.delta")
28888
+ timing.reasoningObserved = true;
28889
+ active.outputTiming.set(id, timing);
28890
+ }
28854
28891
  if (event.type === "session.step.started")
28855
28892
  active.assistants.add(event.data.assistantMessageID);
28856
28893
  if ((event.type === "session.text.delta" || event.type === "session.reasoning.delta") && active.assistants.has(event.data.assistantMessageID)) {
@@ -28877,8 +28914,9 @@ var V2Session = class {
28877
28914
  for (const message of messages) {
28878
28915
  let request;
28879
28916
  try {
28880
- request = v2UsageRequest(message, historical, this.#firstOutputAt.get(message.id));
28917
+ request = v2UsageRequest(message, historical, this.#active?.outputTiming.get(message.id));
28881
28918
  } catch {
28919
+ this.#active?.outputTiming.delete(message.id);
28882
28920
  this.#cacheHitRatePercent = void 0;
28883
28921
  if (this.#meteredMessages.has(message.id))
28884
28922
  continue;
@@ -28894,7 +28932,7 @@ var V2Session = class {
28894
28932
  if (this.#meteredMessages.has(message.id))
28895
28933
  continue;
28896
28934
  this.#meteredMessages.add(message.id);
28897
- this.#firstOutputAt.delete(message.id);
28935
+ this.#active?.outputTiming.delete(message.id);
28898
28936
  this.#emit({ type: "usage.request", request });
28899
28937
  }
28900
28938
  if (this.#cacheHitRatePercent !== previousCacheHitRate)