@codexhost/cli-darwin-x64 0.20.0 → 0.22.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 +27 -6
  4. package/app/console-web.js +35 -7
  5. package/app/desktop-controller.mjs +166 -52
  6. package/app/host-runtime.mjs +35350 -28799
  7. package/app/plugins/antigravity/assets/icon.svg +1 -1
  8. package/app/plugins/antigravity/plugin.mjs +411 -231
  9. package/app/plugins/claude-code/plugin.mjs +538 -109
  10. package/app/plugins/codebuddy/plugin.mjs +36 -6
  11. package/app/plugins/codex-usage/plugin.mjs +36 -6
  12. package/app/plugins/copilot/plugin.mjs +28 -6
  13. package/app/plugins/cursor-cli/plugin.mjs +28 -6
  14. package/app/plugins/deepseek-harness/plugin.mjs +53 -11
  15. package/app/plugins/devin/plugin.mjs +28 -6
  16. package/app/plugins/grok/plugin.mjs +255 -192
  17. package/app/plugins/hermes/plugin.mjs +28 -6
  18. package/app/plugins/kimi-code/plugin.mjs +53 -16
  19. package/app/plugins/kiro-cli/plugin.mjs +28 -6
  20. package/app/plugins/omp/plugin.mjs +143 -28
  21. package/app/plugins/opencode/plugin.mjs +54 -15
  22. package/app/plugins/pi/plugin.mjs +154 -29
  23. package/app/plugins/qoder/plugin.mjs +43 -6
  24. package/app/plugins/qoder-cn/plugin.mjs +43 -6
  25. package/app/plugins/qwen-code/plugin.mjs +28 -6
  26. package/app/plugins/workbuddy/plugin.mjs +36 -6
  27. package/app/plugins/zcode/plugin.mjs +36 -6
  28. package/app/renderer-extension.js +27 -6
  29. package/app/web/assets/index-CN4a4sj0.js +201 -0
  30. package/app/web/assets/{index-D6-hvggd.css → index-DJW4bmyx.css} +1 -1
  31. package/app/web/codexhost-settings.js +35 -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 +7 -7
  35. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +9 -9
  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 +1123 -722
  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
  51. package/app/web/assets/index-D85gPBbQ.js +0 -201
@@ -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,26 @@ 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
+ }),
16906
+ external_exports.strictObject({ kind: external_exports.literal("usage"), ...thread, epoch: identity }),
16886
16907
  external_exports.strictObject({
16887
16908
  kind: external_exports.literal("configure"),
16888
16909
  ...thread,
@@ -17115,18 +17136,6 @@ function sanitizeDiagnosticTail(value) {
17115
17136
  return redacted.length <= DIAGNOSTIC_TAIL_MAX_LENGTH ? redacted : redacted.slice(-DIAGNOSTIC_TAIL_MAX_LENGTH);
17116
17137
  }
17117
17138
 
17118
- // ../../harness-adapter/dist/steer.js
17119
- function unsupportedSteer(harnessLabel) {
17120
- return {
17121
- ok: false,
17122
- error: {
17123
- code: "unsupported",
17124
- message: `${harnessLabel} cannot steer an active Turn natively`,
17125
- retryable: false
17126
- }
17127
- };
17128
- }
17129
-
17130
17139
  // ../../harness-adapter/dist/usage.js
17131
17140
  var tokenFields = [
17132
17141
  "inputTokens",
@@ -17261,6 +17270,7 @@ var requestTokenFields = [
17261
17270
  "cacheWrite1hInputTokens",
17262
17271
  "outputTokens",
17263
17272
  "reasoningOutputTokens",
17273
+ "timedOutputTokens",
17264
17274
  "startedAtMs",
17265
17275
  "completedAtMs"
17266
17276
  ];
@@ -17313,6 +17323,14 @@ function parseHostUsageRequest(value) {
17313
17323
  if (request.startedAtMs === void 0 !== (request.completedAtMs === void 0)) {
17314
17324
  throw new Error("Harness Usage request timing fields must be provided together");
17315
17325
  }
17326
+ if (request.timedOutputTokens !== void 0) {
17327
+ if (request.startedAtMs === void 0) {
17328
+ throw new Error("Harness Usage request 'timedOutputTokens' requires timing fields");
17329
+ }
17330
+ if (request.timedOutputTokens > request.outputTokens) {
17331
+ throw new Error("Harness Usage request 'timedOutputTokens' must not exceed 'outputTokens'");
17332
+ }
17333
+ }
17316
17334
  if (request.startedAtMs !== void 0 && request.completedAtMs !== void 0 && request.completedAtMs < request.startedAtMs) {
17317
17335
  throw new Error("Harness Usage request 'completedAtMs' must not precede 'startedAtMs'");
17318
17336
  }
@@ -18754,6 +18772,15 @@ var OmpRpcFaultError = class extends Error {
18754
18772
  this.name = "OmpRpcFaultError";
18755
18773
  }
18756
18774
  };
18775
+ var OmpRpcSteerRejectedError = class extends Error {
18776
+ };
18777
+ var OmpRpcSteerTargetEndedError = class extends OmpRpcFaultError {
18778
+ history;
18779
+ constructor(history) {
18780
+ super("protocolError", "Omp Turn ended before steer admission could be confirmed. Delivery is unknown; do not automatically resend the input");
18781
+ this.history = history;
18782
+ }
18783
+ };
18757
18784
  var OmpRpcUnsupportedCommandError = class extends Error {
18758
18785
  command;
18759
18786
  constructor(command) {
@@ -19277,6 +19304,30 @@ var OmpRpcSession = class {
19277
19304
  throw fault;
19278
19305
  }
19279
19306
  }
19307
+ async steer(message3) {
19308
+ if (!this.#child || !this.#state || this.#closed || this.#failed) {
19309
+ throw new Error("Omp RPC Session is unavailable");
19310
+ }
19311
+ if (message3.length === 0)
19312
+ throw new Error("Omp steer text must not be empty");
19313
+ const target2 = this.#activeTurn;
19314
+ let targetEnded = false;
19315
+ const response = await this.#send("steer", { message: message3 }, void 0, () => {
19316
+ targetEnded = target2 !== null && this.#activeTurn !== target2;
19317
+ });
19318
+ if (isRecord8(response.data) && response.data.disposition !== void 0 && response.data.disposition !== "queued") {
19319
+ throw new Error("Omp steer was handled without confirming same-Turn queue admission");
19320
+ }
19321
+ if (targetEnded) {
19322
+ let history;
19323
+ try {
19324
+ history = await this.getEntries();
19325
+ } finally {
19326
+ await this.close().catch(() => void 0);
19327
+ }
19328
+ throw new OmpRpcSteerTargetEndedError(history);
19329
+ }
19330
+ }
19280
19331
  async runTurn(text, onEvent) {
19281
19332
  if (!this.#child || !this.#state || this.#closed || this.#failed) {
19282
19333
  throw new Error("Omp RPC Session is unavailable");
@@ -19844,7 +19895,9 @@ var OmpRpcSession = class {
19844
19895
  pending.resolve(value);
19845
19896
  } else {
19846
19897
  const error51 = typeof value.error === "string" ? value.error : "Omp RPC command failed";
19847
- if (value.command === pending.command && error51 === `Unknown command: ${pending.command}`) {
19898
+ if (pending.command === "steer" && value.command === "steer" && value.success === false) {
19899
+ pending.reject(new OmpRpcSteerRejectedError(error51));
19900
+ } else if (value.command === pending.command && error51 === `Unknown command: ${pending.command}`) {
19848
19901
  pending.reject(new OmpRpcUnsupportedCommandError(pending.command));
19849
19902
  } else {
19850
19903
  pending.reject(new Error(error51));
@@ -20124,7 +20177,7 @@ var OmpRpcSession = class {
20124
20177
  child.stdin.write(frame, (error51) => error51 ? reject(error51) : resolve());
20125
20178
  });
20126
20179
  }
20127
- #send(type, payload, id = `codexhost-${randomUUID()}`) {
20180
+ #send(type, payload, id = `codexhost-${randomUUID()}`, onResponse) {
20128
20181
  const child = this.#child;
20129
20182
  if (!child?.stdin.writable || this.#closed || this.#failed) {
20130
20183
  return Promise.reject(new Error("Omp RPC stdin is unavailable"));
@@ -20132,7 +20185,10 @@ var OmpRpcSession = class {
20132
20185
  return new Promise((resolve, reject) => {
20133
20186
  const pending = {
20134
20187
  command: type,
20135
- resolve,
20188
+ resolve: (response) => {
20189
+ onResponse?.();
20190
+ resolve(response);
20191
+ },
20136
20192
  reject,
20137
20193
  timeout: null
20138
20194
  };
@@ -21467,7 +21523,7 @@ var OmpHarnessSession = class {
21467
21523
  this.#toolOutputLimit = options.toolOutputLimit;
21468
21524
  this.#permissionMode = options.permissionMode;
21469
21525
  this.#permissionModeId = options.permissionModeId;
21470
- this.capabilities = {
21526
+ this.capabilities = ((session) => ({
21471
21527
  configuration: {
21472
21528
  selectModel: true,
21473
21529
  selectThinkingOption: options.supportsThinkingSelection,
@@ -21475,8 +21531,11 @@ var OmpHarnessSession = class {
21475
21531
  permissionModeScope: "live"
21476
21532
  },
21477
21533
  history: { fork: true, forkAcrossCwd: true, rollbackLastTurn: true },
21478
- subagents: { observe: true, readTranscript: true }
21479
- };
21534
+ subagents: { observe: true, readTranscript: true },
21535
+ get steer() {
21536
+ return session.#canSteerActiveTurn();
21537
+ }
21538
+ }))(this);
21480
21539
  this.commands = {
21481
21540
  list: async () => ({ ok: true, value: this.#liveCommandCatalog() }),
21482
21541
  execute: (command) => this.#executeHarnessCommand(command)
@@ -21617,7 +21676,7 @@ var OmpHarnessSession = class {
21617
21676
  if (command.type === "turn.cancel")
21618
21677
  return this.#cancel(command);
21619
21678
  if (command.type === "turn.steer")
21620
- return unsupportedSteer("OMP");
21679
+ return this.#steer(command);
21621
21680
  if (command.type === "interaction.respond")
21622
21681
  return this.#respond(command);
21623
21682
  if (command.type === "model.select")
@@ -21687,6 +21746,9 @@ var OmpHarnessSession = class {
21687
21746
  agentMessageId: null,
21688
21747
  compactionItem: null,
21689
21748
  sawAssistantMessage: false,
21749
+ acceptedSteerCount: 0,
21750
+ acceptingSteers: true,
21751
+ pendingSteers: /* @__PURE__ */ new Set(),
21690
21752
  reasoningItem: null,
21691
21753
  tools: /* @__PURE__ */ new Map(),
21692
21754
  interactions: /* @__PURE__ */ new Map(),
@@ -22044,6 +22106,47 @@ var OmpHarnessSession = class {
22044
22106
  return { ok: false, error: normalizedError(error51, "nativeFailure") };
22045
22107
  }
22046
22108
  }
22109
+ #canSteerActiveTurn() {
22110
+ const active = this.#active;
22111
+ return Boolean(this.#phase === "open" && active && !active.cancellationRequested && active.acceptingSteers && active.tools.size > 0 && this.#transport);
22112
+ }
22113
+ async #steer(command) {
22114
+ const text = command.input.map((input) => input.text).join("\n");
22115
+ if (text.length === 0) {
22116
+ return {
22117
+ ok: false,
22118
+ error: {
22119
+ code: "invalidRequest",
22120
+ message: "Omp steer text must not be empty",
22121
+ retryable: false
22122
+ }
22123
+ };
22124
+ }
22125
+ const active = this.#active;
22126
+ const transport = this.#transport;
22127
+ if (!active || !transport || active.command.turnId !== command.turnId || !this.#canSteerActiveTurn()) {
22128
+ return { ok: false, error: invalidState("Omp Turn is not accepting native input") };
22129
+ }
22130
+ let accepted;
22131
+ try {
22132
+ accepted = transport.steer(text).then(() => {
22133
+ active.acceptedSteerCount += 1;
22134
+ });
22135
+ active.pendingSteers.add(accepted);
22136
+ await accepted;
22137
+ return { ok: true, value: { accepted: true } };
22138
+ } catch (error51) {
22139
+ if (error51 instanceof OmpRpcSteerRejectedError) {
22140
+ return { ok: false, error: invalidState(error51.message) };
22141
+ }
22142
+ if (error51 instanceof OmpRpcSteerTargetEndedError)
22143
+ active.steerFailure = error51;
22144
+ throw error51;
22145
+ } finally {
22146
+ if (accepted)
22147
+ active.pendingSteers.delete(accepted);
22148
+ }
22149
+ }
22047
22150
  async #cancel(command) {
22048
22151
  const active = this.#active;
22049
22152
  if (!active || active.command.turnId !== command.turnId) {
@@ -22154,6 +22257,9 @@ var OmpHarnessSession = class {
22154
22257
  agentMessageId: null,
22155
22258
  compactionItem: null,
22156
22259
  sawAssistantMessage: false,
22260
+ acceptedSteerCount: 0,
22261
+ acceptingSteers: false,
22262
+ pendingSteers: /* @__PURE__ */ new Set(),
22157
22263
  reasoningItem: null,
22158
22264
  tools: /* @__PURE__ */ new Map(),
22159
22265
  interactions: /* @__PURE__ */ new Map(),
@@ -22655,13 +22761,18 @@ var OmpHarnessSession = class {
22655
22761
  });
22656
22762
  }
22657
22763
  async #completedTurnIdentity(active, transport) {
22658
- const snapshot = mapOmpSnapshot(await transport.getEntries(), {
22764
+ active.acceptingSteers = false;
22765
+ await Promise.allSettled([...active.pendingSteers]);
22766
+ const history = active.steerFailure?.history ?? await transport.getEntries();
22767
+ const snapshot = mapOmpSnapshot(history, {
22659
22768
  sessionId: transport.state.sessionId,
22660
22769
  model: nativeModelForHistory(transport.state)
22661
22770
  });
22662
22771
  const created = snapshot.turns.filter((turn2) => !active.beforeNativeTurnKeys.has(turn2.nativeTurnRef.nativeTurnKey));
22663
- if (created.length !== 1) {
22664
- throw new Error(`Omp Turn persisted ${created.length} new User Entries; exactly one is required`);
22772
+ const expected = 1 + active.acceptedSteerCount;
22773
+ if (created.length !== expected) {
22774
+ const countText = expected === 1 ? "one" : `${expected}`;
22775
+ throw new Error(`Omp Turn persisted ${created.length} new User Entries; exactly ${countText} is required`);
22665
22776
  }
22666
22777
  const turn = created[0];
22667
22778
  if (!turn?.checkpoint)
@@ -22704,6 +22815,10 @@ var OmpHarnessSession = class {
22704
22815
  ...ephemeral ? { ephemeral } : {}
22705
22816
  });
22706
22817
  active.resolveCompletion();
22818
+ if (active.steerFailure) {
22819
+ this.#fault(active.steerFailure);
22820
+ return;
22821
+ }
22707
22822
  queueMicrotask(() => {
22708
22823
  if (this.#phase === "open")
22709
22824
  void this.#refreshUsage(active.command.turnId);
@@ -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,26 @@ 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
+ }),
17049
+ external_exports.strictObject({ kind: external_exports.literal("usage"), ...thread, epoch: identity }),
17029
17050
  external_exports.strictObject({
17030
17051
  kind: external_exports.literal("configure"),
17031
17052
  ...thread,
@@ -17404,6 +17425,7 @@ var requestTokenFields = [
17404
17425
  "cacheWrite1hInputTokens",
17405
17426
  "outputTokens",
17406
17427
  "reasoningOutputTokens",
17428
+ "timedOutputTokens",
17407
17429
  "startedAtMs",
17408
17430
  "completedAtMs"
17409
17431
  ];
@@ -17456,6 +17478,14 @@ function parseHostUsageRequest(value) {
17456
17478
  if (request.startedAtMs === void 0 !== (request.completedAtMs === void 0)) {
17457
17479
  throw new Error("Harness Usage request timing fields must be provided together");
17458
17480
  }
17481
+ if (request.timedOutputTokens !== void 0) {
17482
+ if (request.startedAtMs === void 0) {
17483
+ throw new Error("Harness Usage request 'timedOutputTokens' requires timing fields");
17484
+ }
17485
+ if (request.timedOutputTokens > request.outputTokens) {
17486
+ throw new Error("Harness Usage request 'timedOutputTokens' must not exceed 'outputTokens'");
17487
+ }
17488
+ }
17459
17489
  if (request.startedAtMs !== void 0 && request.completedAtMs !== void 0 && request.completedAtMs < request.startedAtMs) {
17460
17490
  throw new Error("Harness Usage request 'completedAtMs' must not precede 'startedAtMs'");
17461
17491
  }
@@ -17463,11 +17493,12 @@ function parseHostUsageRequest(value) {
17463
17493
  }
17464
17494
 
17465
17495
  // dist/v2/usage.js
17466
- function v2UsageRequest(message, historical, firstOutputAtMs) {
17496
+ function v2UsageRequest(message, historical, timing) {
17467
17497
  if (message.type !== "assistant" || !message.tokens)
17468
17498
  return null;
17469
17499
  const { input, output, reasoning, cache } = message.tokens;
17470
17500
  const { streamed } = message.time;
17501
+ const firstOutputAtMs = timing?.firstOutputAtMs;
17471
17502
  return parseHostUsageRequest({
17472
17503
  requestId: message.id,
17473
17504
  ...historical ? { historical: true } : {},
@@ -17481,8 +17512,8 @@ function v2UsageRequest(message, historical, firstOutputAtMs) {
17481
17512
  outputTokens: output + reasoning,
17482
17513
  reasoningOutputTokens: reasoning,
17483
17514
  // 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 } : {}
17515
+ // Without a stream end or a boundary covering reasoning, retain usage without timing.
17516
+ ...!historical && (reasoning === 0 || timing?.reasoningObserved) && firstOutputAtMs !== void 0 && streamed !== void 0 && streamed >= firstOutputAtMs ? { startedAtMs: firstOutputAtMs, completedAtMs: streamed } : {}
17486
17517
  });
17487
17518
  }
17488
17519
 
@@ -28123,8 +28154,6 @@ var V2Session = class {
28123
28154
  #cacheHitRatePercent;
28124
28155
  /** Assistant messages already published as usage requests. */
28125
28156
  #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
28157
  constructor(client2, connection, info, catalog, policy, limit, onClosed) {
28129
28158
  this.client = client2;
28130
28159
  this.connection = connection;
@@ -28288,6 +28317,7 @@ var V2Session = class {
28288
28317
  baseline: /* @__PURE__ */ new Set(),
28289
28318
  live: /* @__PURE__ */ new Map(),
28290
28319
  assistants: /* @__PURE__ */ new Set(),
28320
+ outputTiming: /* @__PURE__ */ new Map(),
28291
28321
  transient: /* @__PURE__ */ new Map(),
28292
28322
  interactions: /* @__PURE__ */ new Map(),
28293
28323
  replying: /* @__PURE__ */ new Set(),
@@ -28338,8 +28368,16 @@ var V2Session = class {
28338
28368
  const active = this.#active;
28339
28369
  if (!active || !("data" in event) || !("sessionID" in event.data) || event.data.sessionID !== this.info.id)
28340
28370
  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());
28371
+ 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)) {
28372
+ const id = event.data.assistantMessageID;
28373
+ const timing = active.outputTiming.get(id) ?? {
28374
+ firstOutputAtMs: Date.now(),
28375
+ reasoningObserved: false
28376
+ };
28377
+ if (event.type === "session.reasoning.started" || event.type === "session.reasoning.delta")
28378
+ timing.reasoningObserved = true;
28379
+ active.outputTiming.set(id, timing);
28380
+ }
28343
28381
  if (event.type === "session.step.started")
28344
28382
  active.assistants.add(event.data.assistantMessageID);
28345
28383
  if ((event.type === "session.text.delta" || event.type === "session.reasoning.delta") && active.assistants.has(event.data.assistantMessageID)) {
@@ -28366,8 +28404,9 @@ var V2Session = class {
28366
28404
  for (const message of messages) {
28367
28405
  let request;
28368
28406
  try {
28369
- request = v2UsageRequest(message, historical, this.#firstOutputAt.get(message.id));
28407
+ request = v2UsageRequest(message, historical, this.#active?.outputTiming.get(message.id));
28370
28408
  } catch {
28409
+ this.#active?.outputTiming.delete(message.id);
28371
28410
  this.#cacheHitRatePercent = void 0;
28372
28411
  if (this.#meteredMessages.has(message.id))
28373
28412
  continue;
@@ -28383,7 +28422,7 @@ var V2Session = class {
28383
28422
  if (this.#meteredMessages.has(message.id))
28384
28423
  continue;
28385
28424
  this.#meteredMessages.add(message.id);
28386
- this.#firstOutputAt.delete(message.id);
28425
+ this.#active?.outputTiming.delete(message.id);
28387
28426
  this.#emit({ type: "usage.request", request });
28388
28427
  }
28389
28428
  if (this.#cacheHitRatePercent !== previousCacheHitRate)