@bitkyc08/opencodex 2.100.1 → 2.100.2

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 (163) hide show
  1. package/gui/dist/assets/App-BpJOzw4F.js +59 -0
  2. package/gui/dist/assets/Tray-BcaI-VCr.js +1 -0
  3. package/gui/dist/assets/{brand-mark-nr3ziR-T.js → brand-mark-DU-0Vdkr.js} +1 -1
  4. package/gui/dist/assets/index-Bbor_y80.js +94 -0
  5. package/gui/dist/assets/index-DJEkIDAi.css +2 -0
  6. package/gui/dist/assets/{segment-thumb-features-DKCVUUTi.js → segment-thumb-features-e9A_FogJ.js} +1 -1
  7. package/gui/dist/classic/assets/{App-CgPBKUP-.js → App-BrIlUiLc.js} +18 -18
  8. package/gui/dist/classic/assets/{Tray-BedmOsE7.js → Tray-DT146AhS.js} +1 -1
  9. package/gui/dist/classic/assets/index-DyJHagvT.js +94 -0
  10. package/gui/dist/classic/assets/quota-summary-CakPe9Ni.js +1 -0
  11. package/gui/dist/classic/index.html +1 -1
  12. package/gui/dist/index.html +2 -2
  13. package/package.json +2 -2
  14. package/src/adapters/client-fingerprint.ts +5 -3
  15. package/src/adapters/cursor/native-exec.ts +3 -2
  16. package/src/adapters/cursor/tool-guidance.ts +3 -3
  17. package/src/adapters/cursor/tool-wording.ts +10 -1
  18. package/src/adapters/devin/cloud-direct/tool-schema.ts +20 -2
  19. package/src/adapters/google-antigravity-wire.ts +13 -6
  20. package/src/adapters/google-truncation.ts +4 -2
  21. package/src/adapters/google.ts +8 -2
  22. package/src/adapters/openai-chat/tool-schema.ts +9 -0
  23. package/src/adapters/openai-responses/tool-schema.ts +18 -4
  24. package/src/adapters/run-turn-queue.ts +139 -5
  25. package/src/adapters/upstream-http-error.ts +4 -2
  26. package/src/bridge/sse.ts +8 -1
  27. package/src/claude/chat-tool-dispatch.ts +233 -0
  28. package/src/claude/inbound-tool-loading.ts +42 -17
  29. package/src/cli/account-api.ts +6 -0
  30. package/src/cli/account-extended.ts +60 -6
  31. package/src/cli/account-key-quota.ts +22 -2
  32. package/src/cli/account.ts +1 -1
  33. package/src/cli/capabilities-access-remote.ts +10 -0
  34. package/src/cli/capabilities-agents-routing.ts +2 -2
  35. package/src/cli/capabilities-base.ts +2 -2
  36. package/src/cli/claude.ts +19 -14
  37. package/src/cli/config-command.ts +24 -1
  38. package/src/cli/connect.ts +36 -3
  39. package/src/cli/gui-pair-client.ts +23 -2
  40. package/src/cli/help.ts +1 -1
  41. package/src/cli/hub.ts +18 -1
  42. package/src/cli/link-child-ops.ts +136 -0
  43. package/src/cli/link-status-child.ts +94 -0
  44. package/src/cli/link.ts +22 -9
  45. package/src/cli/registry.ts +3 -2
  46. package/src/cli/sync-command.ts +3 -1
  47. package/src/cli/sync-fanout.ts +8 -81
  48. package/src/client/link-readiness.ts +16 -6
  49. package/src/client/link-tunnel-status.ts +76 -0
  50. package/src/clients/config-export.ts +14 -1
  51. package/src/codex/account-resume-health.ts +41 -0
  52. package/src/codex/auth-api/login-flow.ts +6 -0
  53. package/src/codex/auth-api/routes.ts +35 -2
  54. package/src/codex/catalog/gather-capture.ts +2 -0
  55. package/src/codex/catalog/provider-models.ts +13 -8
  56. package/src/codex/convergence-types.ts +2 -0
  57. package/src/codex/quota.ts +111 -6
  58. package/src/combos/cooldown-store.ts +208 -0
  59. package/src/combos/failover.ts +432 -35
  60. package/src/config/salvage.ts +1 -0
  61. package/src/config/schema/config-schema.ts +6 -3
  62. package/src/config/schema/leaf-validators.ts +34 -12
  63. package/src/generated/compatibility-version.json +213 -121
  64. package/src/lib/catalog-etag.ts +10 -0
  65. package/src/lib/client-error-body.ts +15 -0
  66. package/src/lib/context-overflow-verdict.ts +266 -9
  67. package/src/lib/failure-detail.ts +72 -3
  68. package/src/lib/hard-refusal.ts +259 -0
  69. package/src/link/child-activity.ts +57 -0
  70. package/src/link/child-catalog-freshness.ts +149 -0
  71. package/src/link/child-gated-ocx.ts +117 -0
  72. package/src/link/child-observations.ts +205 -0
  73. package/src/link/child-observe.ts +121 -0
  74. package/src/link/child-ops-engine.ts +162 -0
  75. package/src/link/child-update-contract.ts +165 -0
  76. package/src/link/paths.ts +5 -0
  77. package/src/link/remote-windows.ts +42 -6
  78. package/src/link/ssh-argv.ts +126 -32
  79. package/src/link/status-projection.ts +73 -0
  80. package/src/link/sync-fanout-classify.ts +98 -0
  81. package/src/link/tunnel-state.ts +10 -4
  82. package/src/messaging/mcp-queue-rpc.ts +2 -1
  83. package/src/messaging/mcp-queue-server.ts +5 -0
  84. package/src/messaging/mcp-reply-tools.ts +24 -9
  85. package/src/messaging/mcp-reply-wait.ts +70 -0
  86. package/src/oauth/account-resume-health.ts +60 -0
  87. package/src/oauth/index.ts +1 -0
  88. package/src/oauth/store.ts +44 -1
  89. package/src/providers/api-key-pause-state.ts +23 -0
  90. package/src/providers/api-key-pause.ts +68 -10
  91. package/src/providers/api-key-selection-capture.ts +3 -1
  92. package/src/providers/api-key-selection.ts +3 -2
  93. package/src/providers/api-keys.ts +18 -5
  94. package/src/providers/claude-cli-usage-state.ts +11 -6
  95. package/src/providers/claude-cli-usage.ts +27 -9
  96. package/src/providers/codex-capacity.ts +11 -2
  97. package/src/providers/key-failover.ts +13 -6
  98. package/src/providers/model-discovery-config.ts +31 -0
  99. package/src/providers/model-discovery-diagnostic.ts +34 -3
  100. package/src/providers/model-discovery.ts +43 -7
  101. package/src/providers/model-rename-fields.ts +2 -0
  102. package/src/providers/openai-sidecar.ts +15 -2
  103. package/src/providers/provider-id-rewrite.ts +3 -0
  104. package/src/providers/quota/account-cache.ts +52 -34
  105. package/src/providers/quota/anthropic-usage-windows.ts +19 -9
  106. package/src/providers/quota/report-cache.ts +53 -5
  107. package/src/providers/quota/vendor-probes-key.ts +73 -0
  108. package/src/providers/quota/vendor-probes-oauth.ts +57 -3
  109. package/src/providers/quota-key-accounts.ts +12 -5
  110. package/src/providers/quota-mistral-budget.ts +18 -0
  111. package/src/providers/quota-types.ts +25 -0
  112. package/src/providers/quota.ts +22 -22
  113. package/src/providers/reasoning-metadata.ts +1051 -12
  114. package/src/quota/reset-observer.ts +4 -2
  115. package/src/quota/reset-seen-store.ts +9 -0
  116. package/src/quota/window-mapping.ts +1 -0
  117. package/src/quota-pool/assemble.ts +4 -1
  118. package/src/responses/hosted-tool-policy.ts +56 -12
  119. package/src/router.ts +2 -0
  120. package/src/server/auth-cors.ts +11 -8
  121. package/src/server/catalog-download.ts +3 -5
  122. package/src/server/chat-native.ts +11 -2
  123. package/src/server/claude-messages.ts +2 -1
  124. package/src/server/images.ts +41 -13
  125. package/src/server/index/link-listener.ts +16 -2
  126. package/src/server/index/link-relay-sessions.ts +43 -2
  127. package/src/server/index/optional-listeners.ts +18 -0
  128. package/src/server/management/config-routes.ts +7 -1
  129. package/src/server/management/context.ts +1 -1
  130. package/src/server/management/link-child-ops-routes.ts +116 -0
  131. package/src/server/management/link-route-state.ts +10 -0
  132. package/src/server/management/link-routes.ts +10 -0
  133. package/src/server/management/oauth-account-routes.ts +33 -4
  134. package/src/server/management/provider-overwrite-carry.ts +28 -3
  135. package/src/server/management/provider-routes.ts +16 -11
  136. package/src/server/management/route-registry.ts +3 -0
  137. package/src/server/messages-native.ts +5 -0
  138. package/src/server/request-log-failure-detail.ts +59 -1
  139. package/src/server/responses/adapter-dispatch.ts +35 -44
  140. package/src/server/responses/combo-stream-preflight.ts +146 -29
  141. package/src/server/responses/compact.ts +16 -5
  142. package/src/server/responses/context-overflow.ts +58 -2
  143. package/src/server/responses/core-combo-failure.ts +29 -4
  144. package/src/server/responses/core-combo-native.ts +3 -1
  145. package/src/server/responses/core-combo.ts +30 -3
  146. package/src/server/responses/core-errors.ts +3 -1
  147. package/src/server/responses/core-opaque-recovery.ts +45 -2
  148. package/src/server/responses/core-options.ts +12 -0
  149. package/src/server/responses/passthrough-dispatch.ts +30 -38
  150. package/src/server/responses/request-transport.ts +43 -14
  151. package/src/server/responses/reset-replay.ts +58 -2
  152. package/src/server/responses/run-turn-execution.ts +56 -30
  153. package/src/types/claude-tool-loading.ts +48 -0
  154. package/src/types/config.ts +5 -35
  155. package/src/types/provider.ts +21 -0
  156. package/src/types.ts +1 -0
  157. package/src/web-search/parse.ts +21 -2
  158. package/gui/dist/assets/App-g3Cm2xhZ.js +0 -59
  159. package/gui/dist/assets/Tray-BMDkAiXy.js +0 -1
  160. package/gui/dist/assets/index-Bziu8gTy.css +0 -2
  161. package/gui/dist/assets/index-OYzhQUNP.js +0 -94
  162. package/gui/dist/classic/assets/index-BR-HhNrp.js +0 -94
  163. package/gui/dist/classic/assets/quota-summary-CXKhvSmQ.js +0 -1
@@ -16,11 +16,12 @@ import {
16
16
  kiroUsageContextForAccount,
17
17
  } from "./kiro-usage";
18
18
  import { mapQuotaRoster, readProviderApiKeyQuotas, type ProviderApiKeyQuota } from "./quota-key-accounts";
19
+ import { mistralUnknownBudgetWindows } from "./quota-mistral-budget";
19
20
  import type { OcxConfig, OcxProviderConfig } from "../types";
20
21
  import { isPassiveRead } from "../lib/passive-read";
21
22
  import type { ProviderQuota, QuotaFailureCode } from "./quota-types";
22
23
  import {
23
- accountReportCurrent,
24
+ accountReportCurrent, observedQuotaFor,
24
25
  AUTHORITATIVE_EMPTY_QUOTA,
25
26
  bumpProviderQuotaInvalidationEpoch,
26
27
  captureProviderReportEpochs, providerReportEpochChanged,
@@ -33,7 +34,7 @@ import {
33
34
  isProviderQuotaReportCurrent,
34
35
  LAST_GOOD_MAX_AGE_MS,
35
36
  providerQuotaBeforePublishForTests,
36
- routingEvidence, publishCollectedDecisionQuota,
37
+ routingEvidence, publishCollectedDecisionQuota, keyReportCredentialIds, keyReportCredentialCurrent, validateJoinedReports,
37
38
  setProviderQuotaReportCache,
38
39
  TERMINAL_QUOTA_FAILURE,
39
40
  type CodexAuthAccountsSnapshotPromise,
@@ -175,15 +176,17 @@ let pendingProviderObservation: Promise<void> = Promise.resolve();
175
176
  /**
176
177
  * Stable per-account observation key for one provider report.
177
178
  *
178
- * OAuth providers key by active account id. Key-auth providers have NO account set, so
179
- * every key in `apiKeyPool` would collapse onto "default" and rotating from a spent key to
180
- * a fresh one would read as a reset (measured: 97% -> 12% fired a false surprise). The
181
- * cache key already discriminates these at cacheKey() via apiKeyPoolEntryId, so this
182
- * mirrors that discriminator instead of inventing a second notion of identity.
179
+ * OAuth providers key by active account id. A probe-bound key report instead carries the
180
+ * full digest of the credential it actually sent (report-cache), because the 8-character
181
+ * apiKeyPoolEntryId is a cache discriminator, not an identity: two distinct keys can share
182
+ * it, and that collision must not hand one key's baseline to another. Providers without
183
+ * that binding keep the legacy id byte for byte, so their persisted baselines survive.
183
184
  */
184
- function providerObservationAccountKey(provider: string, config: OcxConfig): string {
185
+ function providerObservationAccountKey(provider: string, config: OcxConfig, report?: ProviderQuotaReport): string {
185
186
  const oauthAccountId = getAccountSet(provider)?.activeAccountId;
186
187
  if (oauthAccountId !== undefined) return `${provider}\u0000${oauthAccountId}`;
188
+ const probed = report && keyReportCredentialIds.get(report);
189
+ if (probed) return `${provider}\u0000key:${probed}`;
187
190
  const providerConfig = config.providers[provider];
188
191
  const resolvedKey = typeof providerConfig?.apiKey === "string"
189
192
  ? resolveEnvValue(providerConfig.apiKey)?.trim()
@@ -207,8 +210,9 @@ function notifyProviderQuotaSnapshot(
207
210
  // Claude CLI rows are display-only: one reset key would span every account that signs in.
208
211
  const observations = reports.filter(report => config.providers[report.provider]?.adapter !== "claude-cli").map(report => ({
209
212
  scope: report.provider,
210
- accountKey: providerObservationAccountKey(report.provider, config),
211
- quota: report.quota,
213
+ accountKey: providerObservationAccountKey(report.provider, config, report),
214
+ quota: observedQuotaFor.get(report) ?? report.quota,
215
+ ...(report.source === "mistral:budget" ? { retainUnknownWindows: mistralUnknownBudgetWindows(report.quota) } : {}),
212
216
  }));
213
217
  if (observations.length === 0) return;
214
218
  pendingProviderObservation = pendingProviderObservation
@@ -216,13 +220,7 @@ function notifyProviderQuotaSnapshot(
216
220
  const observer = await import("../quota/reset-observer");
217
221
  if (!observer.hasQuotaResetSink()) return;
218
222
  const { providerWindowObservations } = await import("../quota/window-mapping");
219
- for (const observation of observations) {
220
- observer.observeQuotaSnapshot({
221
- scope: observation.scope,
222
- accountKey: observation.accountKey,
223
- windows: providerWindowObservations(observation.quota),
224
- });
225
- }
223
+ for (const observation of observations) observer.observeQuotaSnapshot({ scope: observation.scope, accountKey: observation.accountKey, windows: providerWindowObservations(observation.quota), ...(observation.retainUnknownWindows ? { retainUnknownWindows: observation.retainUnknownWindows } : {}) });
226
224
  })
227
225
  .catch(() => {
228
226
  // Detection is best-effort: a quota refresh must never fail because of it. Swallowing
@@ -238,7 +236,7 @@ export function flushProviderQuotaObservationsForTests(): Promise<void> {
238
236
  /** Collect provider quota reports, using the cache unless refresh is forced, and publish the secret-free decision evidence from the collected reports. */
239
237
  export async function fetchProviderQuotaReports(config: OcxConfig, forceRefresh = false): Promise<ProviderQuotaResponse> {
240
238
  // A passive read (a Remote Link Child's, #6959) shows the held reports and starts nothing.
241
- if (isPassiveRead()) { const held = heldProviderQuotaReports(Object.keys(config.providers)); return { ...held, reports: refreshHeldClaudeCliReports(config, held.reports) }; }
239
+ if (isPassiveRead()) { const held = heldProviderQuotaReports(config); return { ...held, reports: refreshHeldClaudeCliReports(config, held.reports) }; }
242
240
  // A Pool report's cache signature and provider fetch must share one account snapshot.
243
241
  // Preserve force semantics when deciding whether that snapshot refreshes upstream data.
244
242
  const prefetchedCodexSnapshot = hasCodexPoolProvider(config)
@@ -258,16 +256,18 @@ export async function fetchProviderQuotaReports(config: OcxConfig, forceRefresh
258
256
  // configured passive provider makes this predicate permanently false, so every dashboard
259
257
  // poll re-probes every OTHER provider upstream instead of serving the 5-minute cache.
260
258
  const currentCache = getProviderQuotaReportCache();
259
+ // The cache key is a cheap discriminator, not an identity: the stored response is
260
+ // re-validated against this caller's configuration before it is served.
261
261
  const cacheFresh = currentCache && currentCache.key === key && now - currentCache.ts < CACHE_TTL_MS
262
262
  && currentCache.response.reports.every(item =>
263
263
  (item.observed === true || now - item.updatedAt < LAST_GOOD_MAX_AGE_MS)
264
- && (config.providers[item.provider]?.adapter === "claude-cli" || isProviderQuotaReportCurrent(item)));
264
+ && (config.providers[item.provider]?.adapter === "claude-cli" || isProviderQuotaReportCurrent(item)) && keyReportCredentialCurrent(item, config.providers[item.provider]));
265
265
  if (!forceRefresh && cacheFresh) {
266
266
  const response = currentCache!.response, reports = refreshHeldClaudeCliReports(config, response.reports);
267
267
  return reports === response.reports ? response : { ...response, reports };
268
268
  }
269
269
  const joinable = inflight.get(key);
270
- if (!forceRefresh && joinable && joinable.epoch === invalidationEpoch) return joinable.promise;
270
+ if (!forceRefresh && joinable && joinable.epoch === invalidationEpoch) return validateJoinedReports(await joinable.promise, config);
271
271
  // A forced probe takes commit authority: older in-flight probes must not overwrite its result.
272
272
  if (forceRefresh) bumpProviderQuotaInvalidationEpoch();
273
273
  const epoch = invalidationEpoch;
@@ -309,11 +309,11 @@ export async function fetchProviderQuotaReports(config: OcxConfig, forceRefresh
309
309
  // Same exemption as the fast path. A passive row reaching `previous` is not a probe
310
310
  // that went quiet — there is no probe — so age cannot condemn it.
311
311
  if (item.observed !== true && item.updatedAt < cutoff) continue;
312
- if (isProviderQuotaReportCurrent(item)) byProvider.set(item.provider, item);
312
+ if (isProviderQuotaReportCurrent(item) && keyReportCredentialCurrent(item, config.providers[item.provider])) byProvider.set(item.provider, item);
313
313
  else generationMismatchedProviders.add(item.provider);
314
314
  }
315
315
  for (const item of fresh) {
316
- if (isProviderQuotaReportCurrent(item)) {
316
+ if (isProviderQuotaReportCurrent(item) && keyReportCredentialCurrent(item, config.providers[item.provider])) {
317
317
  byProvider.set(item.provider, item);
318
318
  generationMismatchedProviders.delete(item.provider);
319
319
  } else {