@bitkyc08/opencodex 2.30.0-preview.20260821 → 2.31.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 (61) hide show
  1. package/README.md +1 -1
  2. package/gui/dist/assets/index-DkcRs1fL.js +102 -0
  3. package/gui/dist/index.html +1 -1
  4. package/package.json +1 -1
  5. package/src/adapters/cursor/cursor-errors.ts +65 -6
  6. package/src/adapters/cursor/discovery.ts +7 -2
  7. package/src/adapters/cursor/effort-map.ts +6 -0
  8. package/src/adapters/cursor/h2-pool.ts +123 -0
  9. package/src/adapters/cursor/live-models.ts +21 -26
  10. package/src/adapters/cursor/live-transport.ts +213 -3
  11. package/src/adapters/cursor/native-exec-common.ts +17 -0
  12. package/src/adapters/cursor/native-exec.ts +9 -4
  13. package/src/adapters/cursor/protobuf-events.ts +5 -1
  14. package/src/adapters/cursor/protobuf-request.ts +11 -4
  15. package/src/adapters/cursor/tool-definitions.ts +20 -0
  16. package/src/adapters/cursor/transport.ts +10 -0
  17. package/src/adapters/cursor.ts +23 -5
  18. package/src/adapters/google.ts +16 -3
  19. package/src/adapters/openai-responses.ts +66 -20
  20. package/src/adapters/xai-web-search.ts +185 -0
  21. package/src/cli/agent.ts +2 -1
  22. package/src/cli/dispatch.ts +2 -2
  23. package/src/cli/doctor.ts +89 -0
  24. package/src/cli/help.ts +2 -0
  25. package/src/cli/registry.ts +7 -2
  26. package/src/codex/auth-context.ts +41 -2
  27. package/src/codex/catalog/effort.ts +1 -1
  28. package/src/codex/catalog/parsing.ts +2 -0
  29. package/src/codex/catalog/provider-fetch.ts +20 -5
  30. package/src/codex/coordinator-doctor.ts +332 -0
  31. package/src/codex/inject-coordination.ts +39 -6
  32. package/src/codex/transition-state.ts +12 -12
  33. package/src/generated/compatibility-version.json +74 -50
  34. package/src/lib/errors.ts +8 -2
  35. package/src/oauth/cursor.ts +21 -0
  36. package/src/providers/cursor-pool.ts +72 -0
  37. package/src/providers/derive.ts +3 -0
  38. package/src/providers/fastwire.ts +12 -1
  39. package/src/providers/openai-sidecar.ts +1 -0
  40. package/src/providers/registry.ts +25 -0
  41. package/src/providers/service-tier.ts +22 -7
  42. package/src/responses/custom-tool-compat.ts +24 -8
  43. package/src/responses/namespace-tool-compat.ts +2 -3
  44. package/src/router.ts +3 -0
  45. package/src/server/chat-completions.ts +4 -0
  46. package/src/server/chat-native.ts +20 -0
  47. package/src/server/management/agent-settings-routes.ts +16 -5
  48. package/src/server/management/config-routes.ts +25 -5
  49. package/src/server/management/vision-sidecar-options.ts +54 -19
  50. package/src/server/responses/compact.ts +1 -2
  51. package/src/server/responses/core.ts +54 -13
  52. package/src/service.ts +122 -14
  53. package/src/types/config.ts +9 -3
  54. package/src/types/provider.ts +6 -0
  55. package/src/usage/cost.ts +52 -38
  56. package/src/usage/expected-prices.ts +79 -9
  57. package/src/vision/backends.ts +97 -0
  58. package/src/vision/eligibility.ts +43 -22
  59. package/src/vision/index.ts +73 -5
  60. package/src/vision/routed-describe.ts +175 -0
  61. package/gui/dist/assets/index-eBA05kYB.js +0 -102
@@ -5,10 +5,11 @@
5
5
  * sequence it is, rather than doubling in length around the lock.
6
6
  */
7
7
  import { createHash } from "node:crypto";
8
- import { existsSync, readFileSync } from "node:fs";
8
+ import { existsSync, lstatSync, readFileSync } from "node:fs";
9
9
 
10
10
  import { atomicWriteFile } from "../config";
11
11
  import type { CodexWriteLockResult } from "./codex-write-lock";
12
+ import { inspectCodexCoordinatorPath } from "./coordinator-doctor";
12
13
  import { JOURNAL_PATH } from "./journal";
13
14
  import { CODEX_CONFIG_PATH, CODEX_PROFILE_PATH } from "./paths";
14
15
  import {
@@ -43,21 +44,51 @@ export type CodexWriteCoordinationEligibility =
43
44
  | { kind: "legacy-uncoordinated"; reason: string }
44
45
  | { kind: "refused"; reason: string };
45
46
 
47
+ /**
48
+ * A live SQLite creator exposes a zero-byte pathname before BEGIN IMMEDIATE.
49
+ * Requiring a settled filesystem age makes that scheduling window remain on
50
+ * the coordinated path while old crash remnants can use the legacy boundary.
51
+ */
52
+ export const STABLE_ZERO_BYTE_COORDINATOR_AGE_MS = 1_000;
53
+
46
54
  export function codexWriteCoordinationEligibility(deps: {
47
55
  coordinatorPath: () => string;
48
56
  residue: () => { kind: string };
49
57
  integrationRecord: () => { kind: string };
58
+ nowMs?: () => number;
50
59
  }): CodexWriteCoordinationEligibility {
51
60
  let coordinatorExists: boolean;
61
+ let coordinatorIsStableZeroByte = false;
52
62
  try {
53
- coordinatorExists = existsSync(deps.coordinatorPath());
63
+ const path = deps.coordinatorPath();
64
+ coordinatorExists = existsSync(path);
65
+ if (coordinatorExists) {
66
+ const entry = lstatSync(path);
67
+ if (entry.isFile() && !entry.isSymbolicLink() && entry.size === 0) {
68
+ const diagnostic = inspectCodexCoordinatorPath(path);
69
+ if (diagnostic.kind === "zero-byte") {
70
+ const lastIdentityChange = Math.max(diagnostic.identity.mtimeMs, diagnostic.identity.ctimeMs);
71
+ coordinatorIsStableZeroByte = (deps.nowMs?.() ?? Date.now()) - lastIdentityChange
72
+ >= STABLE_ZERO_BYTE_COORDINATOR_AGE_MS;
73
+ }
74
+ }
75
+ }
54
76
  } catch (error) {
55
77
  return { kind: "refused", reason: `the coordinator path could not be resolved: ${String(error)}` };
56
78
  }
57
79
 
58
- // An existing coordinator is authoritative, and the lock owns validating it —
59
- // including the unversioned and rowless cases it must refuse rather than adopt.
60
- if (coordinatorExists) return { kind: "coordinated" };
80
+ // Every existing coordinator remains authoritative unless it is proven to be
81
+ // an old, immutable SQLite-empty remnant. The age gate is part of that proof:
82
+ // a live creator exposes the same zero-byte pathname briefly before taking N,
83
+ // and sending that fresh file down the legacy path would bypass its lock.
84
+ // Non-empty, fresh, unsafe, changed, unversioned, and rowless files therefore
85
+ // stay coordinated and are validated/refused by the transaction owner.
86
+ //
87
+ // We do NOT initialize or adopt it here. Clean homes still enter the
88
+ // coordinated path, whose SQLite transaction safely initializes it. Routed
89
+ // or indeterminate legacy homes keep the same uncoordinated compatibility
90
+ // boundary they would have had if the remnant pathname were absent.
91
+ if (coordinatorExists && !coordinatorIsStableZeroByte) return { kind: "coordinated" };
61
92
 
62
93
  const record = deps.integrationRecord();
63
94
  if (record.kind === "invalid") {
@@ -83,7 +114,9 @@ export function codexWriteCoordinationEligibility(deps: {
83
114
  */
84
115
  return {
85
116
  kind: "legacy-uncoordinated",
86
- reason: residue.kind === "residue"
117
+ reason: coordinatorIsStableZeroByte
118
+ ? "the coordinator is a zero-byte non-authoritative remnant and this routed home has not been adopted yet"
119
+ : residue.kind === "residue"
87
120
  ? "this home was routed before write coordination existed and has not been adopted yet"
88
121
  : "the existing native Codex state could not be classified, so it cannot seed a coordinator row",
89
122
  };
@@ -37,7 +37,7 @@ import {
37
37
  samePathIdentity,
38
38
  } from "./user-identity";
39
39
 
40
- const COORDINATOR_SCHEMA_VERSION = 1;
40
+ export const CODEX_COORDINATOR_SCHEMA_VERSION = 1;
41
41
  const DURABLE_HISTORY_STATUSES = new Set(["converged", "pending", "running", "blocked", "unknown"]);
42
42
  const DURABLE_HISTORY_REASONS = new Set([
43
43
  "db-busy",
@@ -241,7 +241,7 @@ function rowToState(row: TransitionRow | null): CodexTransitionState {
241
241
  };
242
242
  }
243
243
 
244
- function readState(database: Database): CodexTransitionState {
244
+ export function readCodexCoordinatorState(database: Database): CodexTransitionState {
245
245
  const row = database.query<TransitionRow, []>(SELECT_TRANSITION_ROW).get();
246
246
  return rowToState(row);
247
247
  }
@@ -282,7 +282,7 @@ function assertInitialStateCanBeCreated(): void {
282
282
 
283
283
  function initialize(database: Database, databaseWasAbsent: boolean): void {
284
284
  const version = database.query<{ user_version: number }, []>("PRAGMA user_version").get()?.user_version;
285
- if (version !== 0 && version !== COORDINATOR_SCHEMA_VERSION) {
285
+ if (version !== 0 && version !== CODEX_COORDINATOR_SCHEMA_VERSION) {
286
286
  throw new CodexCoordinatorTransactionError("The coordinator database schema version is unsupported.");
287
287
  }
288
288
  if (!databaseWasAbsent && version === 0) {
@@ -301,8 +301,8 @@ function initialize(database: Database, databaseWasAbsent: boolean): void {
301
301
  assertInitialStateCanBeCreated();
302
302
  database.query(INITIALIZE_TRANSITION_ROW).run(new Date().toISOString());
303
303
  }
304
- if (version === 0) database.exec(`PRAGMA user_version = ${COORDINATOR_SCHEMA_VERSION}`);
305
- readState(database);
304
+ if (version === 0) database.exec(`PRAGMA user_version = ${CODEX_COORDINATOR_SCHEMA_VERSION}`);
305
+ readCodexCoordinatorState(database);
306
306
  }
307
307
 
308
308
  function createCapability(
@@ -336,7 +336,7 @@ function createCapability(
336
336
  expected.nativeGeneration,
337
337
  expected.currentTxId,
338
338
  );
339
- const state = readState(database);
339
+ const state = readCodexCoordinatorState(database);
340
340
  const update: TransitionStateUpdate = result.changes === 1
341
341
  ? { kind: "updated", state }
342
342
  : { kind: "conflict", current: state };
@@ -451,7 +451,7 @@ export function openCodexCoordinatorTransaction(finalDatabasePath: string): Code
451
451
  capability,
452
452
  expectation() {
453
453
  requireOpen();
454
- const state = readState(db);
454
+ const state = readCodexCoordinatorState(db);
455
455
  return {
456
456
  nativeBefore: state.nativeGeneration,
457
457
  nativeAfter: state.nativeGeneration + 1,
@@ -460,7 +460,7 @@ export function openCodexCoordinatorTransaction(finalDatabasePath: string): Code
460
460
  },
461
461
  version() {
462
462
  requireOpen();
463
- const state = readState(db);
463
+ const state = readCodexCoordinatorState(db);
464
464
  return { nativeGeneration: state.nativeGeneration, currentTxId: state.currentTxId };
465
465
  },
466
466
  assertPublished(expectation) {
@@ -468,7 +468,7 @@ export function openCodexCoordinatorTransaction(finalDatabasePath: string): Code
468
468
  if (lastResult?.kind !== "updated") {
469
469
  throw new CodexCoordinatorTransactionError("The coordinator transition was not published.");
470
470
  }
471
- const state = readState(db);
471
+ const state = readCodexCoordinatorState(db);
472
472
  if (state.nativeGeneration !== expectation.nativeAfter || state.currentTxId !== expectation.txId) {
473
473
  throw new CodexCoordinatorTransactionError("The coordinator published a different transition.");
474
474
  }
@@ -540,7 +540,7 @@ function readCommittedState(): TransitionStateRead {
540
540
  try {
541
541
  database = new Database(path, { readonly: true });
542
542
  database.exec("PRAGMA busy_timeout = 0");
543
- return { kind: "ready", state: readState(database) };
543
+ return { kind: "ready", state: readCodexCoordinatorState(database) };
544
544
  } catch (error) {
545
545
  return mapUnavailable(error);
546
546
  } finally {
@@ -577,7 +577,7 @@ export const updateCodexHistoryTransition: UpdateCodexHistoryTransition = (expec
577
577
  database = new Database(currentCoordinatorDatabasePath(), { readwrite: true, create: false });
578
578
  database.exec("PRAGMA busy_timeout = 0; BEGIN IMMEDIATE");
579
579
  transactionOpen = true;
580
- const current = readState(database);
580
+ const current = readCodexCoordinatorState(database);
581
581
  if (current.nativeGeneration > 0 && current.historySchedule === null) {
582
582
  throw new CodexCoordinatorTransactionError("A positive transition cannot lose its direction.");
583
583
  }
@@ -594,7 +594,7 @@ export const updateCodexHistoryTransition: UpdateCodexHistoryTransition = (expec
594
594
  expected.currentTxId,
595
595
  expected.currentTxId,
596
596
  );
597
- const state = readState(database);
597
+ const state = readCodexCoordinatorState(database);
598
598
  database.exec("COMMIT");
599
599
  transactionOpen = false;
600
600
  return result.changes === 1
@@ -10,7 +10,7 @@
10
10
  },
11
11
  {
12
12
  "path": "package.json",
13
- "sha256": "e93619c60e2ad2e56d45c02fa28e0f3df982f60821532d3211d764c7f4e199b3"
13
+ "sha256": "3570a5627769ae9dd2796ee178f958ef4e8456479c934274c3b87f6de79f463e"
14
14
  },
15
15
  {
16
16
  "path": "scripts/model-metadata.source.json",
@@ -58,7 +58,7 @@
58
58
  },
59
59
  {
60
60
  "path": "src/adapters/cursor.ts",
61
- "sha256": "6042822bf8b0a1210208552584022ce20923153c197d97163ac73b92cb941827"
61
+ "sha256": "2648737b4e9216f6cf09fc4edf83da4fedaa483220f1716c6f66b6a7c6d15286"
62
62
  },
63
63
  {
64
64
  "path": "src/adapters/cursor/arg-codec.ts",
@@ -74,15 +74,15 @@
74
74
  },
75
75
  {
76
76
  "path": "src/adapters/cursor/cursor-errors.ts",
77
- "sha256": "0b84e2a511c90a66d68b6a995cdc8c6a1fdcfe3a0337b06cd14b93d2e18d66c9"
77
+ "sha256": "b5fb1069d88bf53b4f6de84017646c99452681c22a1bf4abbf6f4b2465a13be4"
78
78
  },
79
79
  {
80
80
  "path": "src/adapters/cursor/discovery.ts",
81
- "sha256": "cdebbff19a9d7e3a51ec0444c21a2d09aaf30e49858c4a791b28176096aa2607"
81
+ "sha256": "8a7275b3280e9629c0b7d0c25ee9d35d723f598bc18dea6bd2633e865ed0c43e"
82
82
  },
83
83
  {
84
84
  "path": "src/adapters/cursor/effort-map.ts",
85
- "sha256": "d046b326bea7c6b6deab265ac5b4137f1dd8f3178e7bfe94c9a88c359b6872fc"
85
+ "sha256": "495b443a1aabdec8358975f76f03b8f40c9981c9ec6120407d8027128e1a027f"
86
86
  },
87
87
  {
88
88
  "path": "src/adapters/cursor/exec-policy.ts",
@@ -96,6 +96,10 @@
96
96
  "path": "src/adapters/cursor/gen/agent_pb.ts",
97
97
  "sha256": "819da889962a89f5b761cb14e76786f6e455e85bb49f59fdaf6778474b106012"
98
98
  },
99
+ {
100
+ "path": "src/adapters/cursor/h2-pool.ts",
101
+ "sha256": "53bab2c504350ce2a985553e6e391a61bba900bb0b58d6c99675eea1e0c1c84e"
102
+ },
99
103
  {
100
104
  "path": "src/adapters/cursor/http1-bidi.ts",
101
105
  "sha256": "351a05fa5bab54709c5fcb1bbbaaae2974f041ea6033283b854812d97df53c7d"
@@ -110,7 +114,7 @@
110
114
  },
111
115
  {
112
116
  "path": "src/adapters/cursor/live-models.ts",
113
- "sha256": "5507dc1b485ff467d1aecdaae9f9fbce5bbdf28693470451001705a6d4e6d901"
117
+ "sha256": "a66d29f26e225cc49330bcf25aecb5a82b658ef631310843c4221fa2cfb9451f"
114
118
  },
115
119
  {
116
120
  "path": "src/adapters/cursor/live-smoke-gate.ts",
@@ -118,7 +122,7 @@
118
122
  },
119
123
  {
120
124
  "path": "src/adapters/cursor/live-transport.ts",
121
- "sha256": "f7ec1630801fb7fd240052807e0cbd1b32207e0b13e4c95874757f0686cf57c8"
125
+ "sha256": "cc994819e61adca9fdf7ed22a84c726e02b61db93abdd7dd4eb21051f633c08e"
122
126
  },
123
127
  {
124
128
  "path": "src/adapters/cursor/mcp-config.ts",
@@ -134,7 +138,7 @@
134
138
  },
135
139
  {
136
140
  "path": "src/adapters/cursor/native-exec-common.ts",
137
- "sha256": "e2329e2d9c55d1eca82486e209338a4eaf0c203491c5e1b26b25c3390357de8a"
141
+ "sha256": "4682a899e9e626fc7fe7a481bf565468c44641d30414d2e3de560c703ce090b8"
138
142
  },
139
143
  {
140
144
  "path": "src/adapters/cursor/native-exec-desktop.ts",
@@ -162,15 +166,15 @@
162
166
  },
163
167
  {
164
168
  "path": "src/adapters/cursor/native-exec.ts",
165
- "sha256": "949136306f67df7e68bf4bac1b63e560f8d48b8e0b246cefa147c98404b54c6f"
169
+ "sha256": "ac362545a8f421bd650e6ad12c1312172e3b8f27a388223f3578df13a9da438a"
166
170
  },
167
171
  {
168
172
  "path": "src/adapters/cursor/protobuf-events.ts",
169
- "sha256": "16faa16a8f5eeb5022a2f7332bd0739189bf3cd5b6dc1267730b14a78786bc08"
173
+ "sha256": "e6b77507b05bc21880dbb4fb158f53dd8ae81af67d4aa6af15f94f98f5208eac"
170
174
  },
171
175
  {
172
176
  "path": "src/adapters/cursor/protobuf-request.ts",
173
- "sha256": "d712426a8ee1b3c4de4d0705b1277e1edd1d5d96ad1c264fb852c2ff426dd50e"
177
+ "sha256": "56078daf901cd00fc05efd90cbc57e82ff516ee8eb5ebfa64aaf543638e67a59"
174
178
  },
175
179
  {
176
180
  "path": "src/adapters/cursor/request-builder.ts",
@@ -182,7 +186,7 @@
182
186
  },
183
187
  {
184
188
  "path": "src/adapters/cursor/tool-definitions.ts",
185
- "sha256": "28759b65e37ba797daa7377a3dd2b62f082a517891f28238bc8ce18ed4b7b3f3"
189
+ "sha256": "8544f4ce80f5dde32e2d7890542eaeaae966f222cb497e3c0ebf57bdc623c5d6"
186
190
  },
187
191
  {
188
192
  "path": "src/adapters/cursor/tool-result-normalize.ts",
@@ -194,7 +198,7 @@
194
198
  },
195
199
  {
196
200
  "path": "src/adapters/cursor/transport.ts",
197
- "sha256": "6359d967e5397cb238b647f89d542005d0ee5f677b8c31770fc29a3244ee9db4"
201
+ "sha256": "91d5379a51e358becf030d2946cb6ebfb8f3ad775da53ce29986e25f2e11f309"
198
202
  },
199
203
  {
200
204
  "path": "src/adapters/cursor/types.ts",
@@ -230,7 +234,7 @@
230
234
  },
231
235
  {
232
236
  "path": "src/adapters/google.ts",
233
- "sha256": "bc8f08993edc83f67ff9fdb4505069a37a69db4d52b9d5f1c30e6b17b246a8d9"
237
+ "sha256": "e6f8bd41b77ff65b54d7c81bee461ad4f7e12173dda83abc672599277b8df4e4"
234
238
  },
235
239
  {
236
240
  "path": "src/adapters/identity.ts",
@@ -302,7 +306,7 @@
302
306
  },
303
307
  {
304
308
  "path": "src/adapters/openai-responses.ts",
305
- "sha256": "4afab7b27fc8aaeb536d9f019af1b3234224f165940c2b2784036866fc972f17"
309
+ "sha256": "1ed5a3a018aa61b6a52c646aa9ee6985c5543ce5f21b8bac458cf69622a4e6d7"
306
310
  },
307
311
  {
308
312
  "path": "src/adapters/registry.ts",
@@ -328,6 +332,10 @@
328
332
  "path": "src/adapters/upstream-http-error.ts",
329
333
  "sha256": "4875e77e46d96131e7a3e6c0feb15a54ffcb3901efceac2360abe28b7a0f414b"
330
334
  },
335
+ {
336
+ "path": "src/adapters/xai-web-search.ts",
337
+ "sha256": "a9f760d3a1be552ceb74898dc8c00f6e6d3b35a38440030cc95f672e75049e81"
338
+ },
331
339
  {
332
340
  "path": "src/bridge.ts",
333
341
  "sha256": "8cd99bc0e94a97a54393b693f4d8a5aeb46124591b61f8c8eeedd3e5e05230fa"
@@ -442,7 +450,7 @@
442
450
  },
443
451
  {
444
452
  "path": "src/cli/agent.ts",
445
- "sha256": "c2cfc8b6150a34afda9777ba0d9a4945c7365f3577640653476e8c4b3dd76803"
453
+ "sha256": "c3286d93182fd523bb09337431e2224c96c9c5a345029cc1dff76519842d5f06"
446
454
  },
447
455
  {
448
456
  "path": "src/cli/catalog-prewarm.ts",
@@ -486,11 +494,11 @@
486
494
  },
487
495
  {
488
496
  "path": "src/cli/dispatch.ts",
489
- "sha256": "ecc362d37513b79443c714dbf193ea1da7fbb423bc53c308af2e378cf4e6b50c"
497
+ "sha256": "d98532573083b4df82216bca592818b1946847f9cc472335eaf949ea1bcf1e22"
490
498
  },
491
499
  {
492
500
  "path": "src/cli/doctor.ts",
493
- "sha256": "ce42bf3a086291ff48d4456f16b77cfc77100e0996cff32983ef137235a4b7cb"
501
+ "sha256": "f785624daa2881093a9d696ed92a0e3bc1b97f7d680a75ec52f9d3eaee835e82"
494
502
  },
495
503
  {
496
504
  "path": "src/cli/ensure-desired-integrations.ts",
@@ -502,7 +510,7 @@
502
510
  },
503
511
  {
504
512
  "path": "src/cli/help.ts",
505
- "sha256": "61727982fdc69846792c8e1d1d780bc801819bba9dadd589f36901f29685d9a4"
513
+ "sha256": "20433b67768897debb68132fee8964bfff100f9bd1736e7d71412bf7a1d267fb"
506
514
  },
507
515
  {
508
516
  "path": "src/cli/index.ts",
@@ -562,7 +570,7 @@
562
570
  },
563
571
  {
564
572
  "path": "src/cli/registry.ts",
565
- "sha256": "ba6b555b7e93afe0fe41d1ec9caf0f88c8b0783f102639b3a4abdf368a78d263"
573
+ "sha256": "4160286114b94ce7ada218a9456e30167ac1b6de9781d9c9a04799f8f244ed17"
566
574
  },
567
575
  {
568
576
  "path": "src/cli/root.ts",
@@ -674,7 +682,7 @@
674
682
  },
675
683
  {
676
684
  "path": "src/codex/auth-context.ts",
677
- "sha256": "c7bc48d325399fd22a5140d0c9b3a47746bacfff8a3d6d6192f717aa0dfd4535"
685
+ "sha256": "9703472fb40c9c2fc8876945646aa4d591de96cb3604da7ef8a0c21699a135cf"
678
686
  },
679
687
  {
680
688
  "path": "src/codex/autostart-health.ts",
@@ -710,7 +718,7 @@
710
718
  },
711
719
  {
712
720
  "path": "src/codex/catalog/effort.ts",
713
- "sha256": "b938d6f031422c4509c93d221236ce175dc49bd01eec32335e35ac58058e4d9c"
721
+ "sha256": "e9efbb137522a8952150a75cc04061af43e161203f57b2d02650973119e2316c"
714
722
  },
715
723
  {
716
724
  "path": "src/codex/catalog/filesystem-evidence.ts",
@@ -730,11 +738,11 @@
730
738
  },
731
739
  {
732
740
  "path": "src/codex/catalog/parsing.ts",
733
- "sha256": "fcc5e9dd4a6d8bffcc1aa30f5ffb4f1808c6aac986d1a5542305b946e44546e7"
741
+ "sha256": "a687cae14fdd365ed6eaba53e963022278ac1cbe35ce9ab8b25b7f9e868e6ac7"
734
742
  },
735
743
  {
736
744
  "path": "src/codex/catalog/provider-fetch.ts",
737
- "sha256": "2f79fd574e5bbd1da13b42d68013c0137a0718fa2234ad877e3ca3118494cd46"
745
+ "sha256": "fabaf7f7bc0de27dee84daf05eb5708ffc71d1492ab82c071e6dd83227bd8e2b"
738
746
  },
739
747
  {
740
748
  "path": "src/codex/catalog/sync.ts",
@@ -752,6 +760,10 @@
752
760
  "path": "src/codex/convergence.ts",
753
761
  "sha256": "4ab2e8828a32a1b6235528d0b9be18b24c7457c485972a00492a4a1675bb9c0a"
754
762
  },
763
+ {
764
+ "path": "src/codex/coordinator-doctor.ts",
765
+ "sha256": "8b96fccfcebec924abf6b1c03bb8ef17f6e89469fb6f556c1f0d517654eaf941"
766
+ },
755
767
  {
756
768
  "path": "src/codex/custom-model-catalog-migration.ts",
757
769
  "sha256": "eb6c1420bc61b27c67772255a20192cb94605c988f6b597608e69b6346464c77"
@@ -806,7 +818,7 @@
806
818
  },
807
819
  {
808
820
  "path": "src/codex/inject-coordination.ts",
809
- "sha256": "2b64a277f342eaf806ac4eadabe694bd7e64fe984c514d815bfdd4d2ce4f80f5"
821
+ "sha256": "3bdb01051c45223920fc57580b2303290a9b405fe36bbefada2b8e61f6d4b637"
810
822
  },
811
823
  {
812
824
  "path": "src/codex/inject.ts",
@@ -1018,7 +1030,7 @@
1018
1030
  },
1019
1031
  {
1020
1032
  "path": "src/codex/transition-state.ts",
1021
- "sha256": "f249df83f9f3366d18c868f51a04d3a85bcc0d659b437593186532e47b7d8586"
1033
+ "sha256": "774a8323d5dd36a9e7235018daf8fc0d6c2898f053d33e0a9d1da6b1964b71ac"
1022
1034
  },
1023
1035
  {
1024
1036
  "path": "src/codex/upstream-host-health.ts",
@@ -1738,7 +1750,7 @@
1738
1750
  },
1739
1751
  {
1740
1752
  "path": "src/lib/errors.ts",
1741
- "sha256": "576e12852255862f9241837b9c772d499ee0752ce34b43b080c3069e4f1d3f33"
1753
+ "sha256": "460d877ce68799cc64129940a11deeb14de97d60851fe8c3e3ff09b1ab3e4e55"
1742
1754
  },
1743
1755
  {
1744
1756
  "path": "src/lib/eventstream-decoder.ts",
@@ -1982,7 +1994,7 @@
1982
1994
  },
1983
1995
  {
1984
1996
  "path": "src/oauth/cursor.ts",
1985
- "sha256": "cb252292687c7cc79956c880de49c8a7cbeb6b9ee2c3f4eaab2dda9b8d640e36"
1997
+ "sha256": "afc515c357f5bc9f788c07e40a0a1fce6ef3d9887759906e5a48113a720d5673"
1986
1998
  },
1987
1999
  {
1988
2000
  "path": "src/oauth/github-copilot.ts",
@@ -2088,13 +2100,17 @@
2088
2100
  "path": "src/providers/context-cap.ts",
2089
2101
  "sha256": "153189b3a96f92081b5d401bbfa463e080bfead24c8d8c3ef8cd57f4a17dc421"
2090
2102
  },
2103
+ {
2104
+ "path": "src/providers/cursor-pool.ts",
2105
+ "sha256": "26c8cb42be69a3089577ed9907673d12705f5496ede163baaf288fc2c288bfcd"
2106
+ },
2091
2107
  {
2092
2108
  "path": "src/providers/derive.ts",
2093
- "sha256": "55027015be5e5bf25f2c9ab30c5b0652ef6bbdeeacd8bc904eb56466e8463f78"
2109
+ "sha256": "c4abf56b32203d353dbdab3f5485768f859098ae35f2463ed5b939e3d3edce58"
2094
2110
  },
2095
2111
  {
2096
2112
  "path": "src/providers/fastwire.ts",
2097
- "sha256": "28a8d63aed99fcd99b902b75e63f0df239a88554769273227815724a36f97416"
2113
+ "sha256": "b6609c8e6ec285074ea93cfaec0c997aed30adb2f52ef22b48129347e7525493"
2098
2114
  },
2099
2115
  {
2100
2116
  "path": "src/providers/free-directory.ts",
@@ -2138,7 +2154,7 @@
2138
2154
  },
2139
2155
  {
2140
2156
  "path": "src/providers/openai-sidecar.ts",
2141
- "sha256": "d07ec55e8600563fa9cbdb9e535cfecb8163b8235aa44547c9359f6ca8ce62d1"
2157
+ "sha256": "c555cf015441e53c7054ea627c84a2f8a7ab6982c7e065371088125ec0757d6d"
2142
2158
  },
2143
2159
  {
2144
2160
  "path": "src/providers/openai-tier-startup.ts",
@@ -2170,7 +2186,7 @@
2170
2186
  },
2171
2187
  {
2172
2188
  "path": "src/providers/registry.ts",
2173
- "sha256": "68af5ea5f483ace1f33d64d23b03ac778668c180e6b896b2e0f7043028217e05"
2189
+ "sha256": "7e674f4503f43248e68b94a657b233fe3194aa560f7ff7deacb820996148900a"
2174
2190
  },
2175
2191
  {
2176
2192
  "path": "src/providers/request-pacing.ts",
@@ -2178,7 +2194,7 @@
2178
2194
  },
2179
2195
  {
2180
2196
  "path": "src/providers/service-tier.ts",
2181
- "sha256": "56198ef6740a3b7dbd59c605669383dc52d4004032818c54b1a0289bf34e2c3f"
2197
+ "sha256": "657fc25f91b481b8300bd260e464ac31ba96f287192392e4187e6b7f74f5b890"
2182
2198
  },
2183
2199
  {
2184
2200
  "path": "src/providers/slug-codec.ts",
@@ -2206,7 +2222,7 @@
2206
2222
  },
2207
2223
  {
2208
2224
  "path": "src/responses/custom-tool-compat.ts",
2209
- "sha256": "f2b179e699e359423f0a90a33303c8a022100e57c1f228488252849ad0c2e0be"
2225
+ "sha256": "fbda1f4416df46f6102fce0ac061793c9038f0739ab8b919534b1cca857e1b98"
2210
2226
  },
2211
2227
  {
2212
2228
  "path": "src/responses/hosted-tool-policy.ts",
@@ -2214,7 +2230,7 @@
2214
2230
  },
2215
2231
  {
2216
2232
  "path": "src/responses/namespace-tool-compat.ts",
2217
- "sha256": "b1a7a25672210853f2ec3eaf273bc02bdcd6e38e671b3508cbb3e6865ed8441e"
2233
+ "sha256": "2094a2d9a7356e1c159a6a19ebf2947f0a1a78d1588caebfde02084c242aa4f6"
2218
2234
  },
2219
2235
  {
2220
2236
  "path": "src/responses/parser.ts",
@@ -2266,7 +2282,7 @@
2266
2282
  },
2267
2283
  {
2268
2284
  "path": "src/router.ts",
2269
- "sha256": "0efadab869f68b4049c5cb65b679b1316b3b73ff197671db8819852766c5ebc2"
2285
+ "sha256": "44f5eebeb8894345edf51120ce1c6b091fa0f81be5bac875bd944af0c9c9b2de"
2270
2286
  },
2271
2287
  {
2272
2288
  "path": "src/routing/analytics.ts",
@@ -2378,7 +2394,7 @@
2378
2394
  },
2379
2395
  {
2380
2396
  "path": "src/server/chat-completions.ts",
2381
- "sha256": "a1dcf1aa726fbdfc4bea1b7079cf7ef62aa17e8c9ce76021a97338d2b172bd4f"
2397
+ "sha256": "47403128f764b59654a5579c42297f07a393ee6fb365435d8cb950675d4f6990"
2382
2398
  },
2383
2399
  {
2384
2400
  "path": "src/server/chat-native-sse.ts",
@@ -2386,7 +2402,7 @@
2386
2402
  },
2387
2403
  {
2388
2404
  "path": "src/server/chat-native.ts",
2389
- "sha256": "73f1c79e390998bb6e3be373c27b43921c05a79e61ebe63a6a782255da3e777b"
2405
+ "sha256": "4ed4eddc8cfb62631feccc1ae57e0ac35b0baeeab861bca220debee5e9a8c8a8"
2390
2406
  },
2391
2407
  {
2392
2408
  "path": "src/server/claude-messages.ts",
@@ -2446,7 +2462,7 @@
2446
2462
  },
2447
2463
  {
2448
2464
  "path": "src/server/management/agent-settings-routes.ts",
2449
- "sha256": "5a609ba3b289dd78e06c93efa7a56725e2dad29b3f07f861b7910221a0d058cd"
2465
+ "sha256": "da00cb3480c4c48313c869e0cd264b49fcc9de9edf2b1e8b9fe90d16b25689ae"
2450
2466
  },
2451
2467
  {
2452
2468
  "path": "src/server/management/api-access.ts",
@@ -2466,7 +2482,7 @@
2466
2482
  },
2467
2483
  {
2468
2484
  "path": "src/server/management/config-routes.ts",
2469
- "sha256": "fbc2d13eb89b2376132dc9fc3580615de29782068c841b1a2626bc09009f9430"
2485
+ "sha256": "63aa2f28e3659d42805df08ca2bbdce98575b55a88ea15cb8fad756fbab5cec2"
2470
2486
  },
2471
2487
  {
2472
2488
  "path": "src/server/management/context.ts",
@@ -2554,7 +2570,7 @@
2554
2570
  },
2555
2571
  {
2556
2572
  "path": "src/server/management/vision-sidecar-options.ts",
2557
- "sha256": "8372cbc3c4b82c270a620e352d96b4914e2f44d098f6d383db104cfd411f6e2d"
2573
+ "sha256": "797f8328eff1a0eedc3a3c4345ab00bda62c39af7c141c60b1f3d8c7f7f0a798"
2558
2574
  },
2559
2575
  {
2560
2576
  "path": "src/server/management/web-search-sidecar-options.ts",
@@ -2662,11 +2678,11 @@
2662
2678
  },
2663
2679
  {
2664
2680
  "path": "src/server/responses/compact.ts",
2665
- "sha256": "26ce4c5c090d7de26f62384aa4bee31b7a8feca7737fd49a57dcd3528eae7331"
2681
+ "sha256": "8dcd6b33d2c0b9cc77649ee260e2769e400cfc05e4237ae7a547362257dba862"
2666
2682
  },
2667
2683
  {
2668
2684
  "path": "src/server/responses/core.ts",
2669
- "sha256": "8a8a9c7bca4a90936ae91fba056d8215916f1e189d64f99a97246d35ee1d4f58"
2685
+ "sha256": "4aa38a520acc867f483393d8b013fca055bbdfefdda83a12b01148b08f36caac"
2670
2686
  },
2671
2687
  {
2672
2688
  "path": "src/server/responses/empty-completion-guard.ts",
@@ -2754,7 +2770,7 @@
2754
2770
  },
2755
2771
  {
2756
2772
  "path": "src/service.ts",
2757
- "sha256": "a9babc47b0d3fd5e3f1fcd31f9be8438071ebad6d86fa716f52cecfc4d4a14e3"
2773
+ "sha256": "3c1198b34fbef2f69f0a8dff1ca3f604bb16e7bdbf96b0d59e9eac0bc29f848b"
2758
2774
  },
2759
2775
  {
2760
2776
  "path": "src/sidecar/auth.ts",
@@ -2846,11 +2862,11 @@
2846
2862
  },
2847
2863
  {
2848
2864
  "path": "src/types/config.ts",
2849
- "sha256": "17b8b0ea062aa3d5877d04536ace4fc52baebfce41bdcb4c7f88ead9fd809c09"
2865
+ "sha256": "473fde6d5b11a71b4e7712b3bc2863841d0ecb327f335c3979328850afa0700f"
2850
2866
  },
2851
2867
  {
2852
2868
  "path": "src/types/provider.ts",
2853
- "sha256": "151bd31beb4de0d27d31283fd5278f45eb52426429dac64fd156fc9b77c4f12d"
2869
+ "sha256": "6a37ade0ad24851f61705584e0c67f1c64335541ffcd5f337465ddd618249f39"
2854
2870
  },
2855
2871
  {
2856
2872
  "path": "src/types/request.ts",
@@ -2914,7 +2930,7 @@
2914
2930
  },
2915
2931
  {
2916
2932
  "path": "src/usage/cost.ts",
2917
- "sha256": "ccd83889f7cbed904d70c01fc37ea86e0d9761571d7e5bcda4f17c9093800883"
2933
+ "sha256": "c5fb9b72d23943f47941d35ad628d230c48560e7c98a16f6c5afa2361dffb52c"
2918
2934
  },
2919
2935
  {
2920
2936
  "path": "src/usage/debug.ts",
@@ -2922,7 +2938,7 @@
2922
2938
  },
2923
2939
  {
2924
2940
  "path": "src/usage/expected-prices.ts",
2925
- "sha256": "3b2874f24e7d53979fee5829f6b710b21cfefe06fb96f5cc887247aab5606acc"
2941
+ "sha256": "5d2b69ac87cee1e7acdf5e54bf56e5de309b7c4d1fb79b8d0333f9c88c08e24e"
2926
2942
  },
2927
2943
  {
2928
2944
  "path": "src/usage/log.ts",
@@ -2948,22 +2964,30 @@
2948
2964
  "path": "src/vision/anthropic-describe.ts",
2949
2965
  "sha256": "f71189755b7b4093646a4bfa9622f9cbafa4d85f5a49d510bbcd9ac74b1ca026"
2950
2966
  },
2967
+ {
2968
+ "path": "src/vision/backends.ts",
2969
+ "sha256": "f330298c7effd21e26fa200858b44742a97cc64100be2f84964faceb35a59eaa"
2970
+ },
2951
2971
  {
2952
2972
  "path": "src/vision/describe.ts",
2953
2973
  "sha256": "04673cb73b34adb94a450a07abcd14a8b80c80e3dad17584dbe344260f49984e"
2954
2974
  },
2955
2975
  {
2956
2976
  "path": "src/vision/eligibility.ts",
2957
- "sha256": "b1f76df0a4aae705419c3badf7d463612f73384679a52fc4a1413fa34369cb63"
2977
+ "sha256": "0cf9d282723759f9b85e2ee563e7492878d8fd0c5de0e50688d404ef6632f288"
2958
2978
  },
2959
2979
  {
2960
2980
  "path": "src/vision/index.ts",
2961
- "sha256": "35db81fe518fb8e5b7a4773cad1c4885d745705f269f04fd6440cb7d1e13cf63"
2981
+ "sha256": "8b46ba96b3c1cc5d4a57eb3b3edcc9d3f6c791fc6a5e5e26d4adc89afbcae116"
2962
2982
  },
2963
2983
  {
2964
2984
  "path": "src/vision/reasoning.ts",
2965
2985
  "sha256": "7b5ba571d9e727304f9cc053baaf82a5023fd2dad92f7fbf01af7edb8cfca21a"
2966
2986
  },
2987
+ {
2988
+ "path": "src/vision/routed-describe.ts",
2989
+ "sha256": "270bf4204b10a46611c9f978f26a68e45b567cdf38deb81f1ed762d4c76398f0"
2990
+ },
2967
2991
  {
2968
2992
  "path": "src/vision/timeout-bounds.ts",
2969
2993
  "sha256": "65a3124c6817cda51eb529520652576ffb1e92db433112162c0065104954eaba"
package/src/lib/errors.ts CHANGED
@@ -162,11 +162,16 @@ export function classifyError(status: number, type: string, message: string): Oc
162
162
  return { message, type: "invalid_request_error", code: "context_length_exceeded" };
163
163
  }
164
164
  // "Cursor resource limit exceeded" is emitted only for explicit request-size overflow
165
- // details (isCursorRequestTooLargeDetail in cursor-errors.ts); quota-style resource
166
- // exhaustion arrives as "Cursor rate limit exceeded" and falls through to 429 below.
165
+ // details (isCursorRequestTooLargeDetail in cursor-errors.ts); "Cursor context limit
166
+ // exceeded" is the bare payload-overflow shape (isCursorZeroTokenResourceExhausted);
167
+ // quota-style resource exhaustion arrives as "Cursor rate limit exceeded" and falls
168
+ // through to 429 below.
167
169
  if (text.includes("cursor resource limit exceeded")) {
168
170
  return { message, type: "invalid_request_error", code: "tool_catalog_too_large" };
169
171
  }
172
+ if (text.includes("cursor context limit exceeded")) {
173
+ return { message, type: "invalid_request_error", code: "context_length_exceeded" };
174
+ }
170
175
  // The Cursor adapter's classified rate-limit prefix is authoritative: its DETAIL may echo
171
176
  // quota wording ("... quota exhausted") that would otherwise hit the insufficient_quota
172
177
  // branch below and break the planned retry-with-backoff contract (WP3 review blocker 1).
@@ -306,6 +311,7 @@ export function inferHttpStatusFromAdapterMessage(message: string): number {
306
311
  // See classifyError: this prefix now only means explicit request-size overflow (400);
307
312
  // quota-style Cursor resource exhaustion carries the rate-limit prefix and maps to 429.
308
313
  if (lower.includes("cursor resource limit exceeded")) return 400;
314
+ if (lower.includes("cursor context limit exceeded")) return 400;
309
315
  if (
310
316
  lower.includes("resource_exhausted") ||
311
317
  lower.includes("resource exhausted") ||