@bitkyc08/opencodex 2.99.0-preview.20261108 → 2.100.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 (258) hide show
  1. package/AGENTS_INSTALL.md +19 -1
  2. package/README.md +37 -33
  3. package/SPONSORS.md +5 -1
  4. package/bin/ocx.mjs +1 -1
  5. package/gui/dist/assets/{App-C1hGwaN1.css → App-COo8Yopd.css} +1 -1
  6. package/gui/dist/assets/App-CitvEefy.js +59 -0
  7. package/gui/dist/assets/Tray-CeKVWQyB.js +1 -0
  8. package/gui/dist/assets/{brand-mark-DpiBmFGI.js → brand-mark-M92UnxX2.js} +1 -1
  9. package/gui/dist/assets/index-BP47do6-.js +94 -0
  10. package/gui/dist/assets/index-DmDooSAG.css +2 -0
  11. package/gui/dist/assets/{segment-thumb-features-JcszQ18T.js → segment-thumb-features-CcxZBnxv.js} +1 -1
  12. package/gui/dist/classic/assets/App-aYgIQMxI.js +58 -0
  13. package/gui/dist/classic/assets/{Tray-5v86r9Az.js → Tray-D8jfUXpQ.js} +1 -1
  14. package/gui/dist/classic/assets/index-CfGqHooN.js +94 -0
  15. package/gui/dist/classic/assets/quota-summary-R-ih7OlS.js +1 -0
  16. package/gui/dist/classic/index.html +1 -1
  17. package/gui/dist/index.html +2 -2
  18. package/native/ocx-child/Cargo.lock +215 -0
  19. package/native/ocx-child/Cargo.toml +31 -0
  20. package/native/ocx-child/src/cli.rs +1901 -0
  21. package/native/ocx-child/src/codex_home.rs +429 -0
  22. package/native/ocx-child/src/codex_settings.rs +231 -0
  23. package/native/ocx-child/src/daemon.rs +363 -0
  24. package/native/ocx-child/src/http_wire.rs +619 -0
  25. package/native/ocx-child/src/journal.rs +977 -0
  26. package/native/ocx-child/src/lib.rs +22 -0
  27. package/native/ocx-child/src/main.rs +9 -0
  28. package/native/ocx-child/src/parity.rs +102 -0
  29. package/native/ocx-child/src/platform.rs +1487 -0
  30. package/native/ocx-child/src/relay.rs +1288 -0
  31. package/native/ocx-child/src/relay_auth.rs +166 -0
  32. package/native/ocx-child/src/routes.rs +236 -0
  33. package/native/ocx-child/src/state.rs +190 -0
  34. package/native/ocx-child/src/test_hooks.rs +58 -0
  35. package/native/ocx-child/src/toml_surgeon.rs +1156 -0
  36. package/package.json +8 -2
  37. package/src/adapters/anthropic.ts +28 -2
  38. package/src/adapters/claude-cli/adapter.ts +5 -25
  39. package/src/adapters/claude-cli/instruction-images.ts +31 -0
  40. package/src/adapters/claude-cli/stable-replay.ts +42 -14
  41. package/src/adapters/claude-cli/usage-admission.ts +53 -64
  42. package/src/adapters/coding-agent/protocol.ts +1 -1
  43. package/src/adapters/devin/live-models.ts +3 -0
  44. package/src/adapters/google-http.ts +3 -0
  45. package/src/adapters/google-vertex-key-project.ts +10 -2
  46. package/src/adapters/google.ts +40 -8
  47. package/src/adapters/kiro/usage.ts +3 -13
  48. package/src/adapters/openai-responses/passthrough.ts +5 -2
  49. package/src/adapters/openai-responses/request-strips.ts +32 -0
  50. package/src/adapters/openai-responses/tool-schema.ts +9 -4
  51. package/src/chat/inbound.ts +1 -1
  52. package/src/claude/auth-detect.ts +26 -8
  53. package/src/claude/inbound-content-options.ts +18 -3
  54. package/src/claude/inbound.ts +5 -2
  55. package/src/cli/bundled-bun-diagnostic.ts +91 -0
  56. package/src/cli/capabilities-agents-routing.ts +2 -2
  57. package/src/cli/capabilities-observe-system.ts +60 -0
  58. package/src/cli/combo-input.ts +6 -0
  59. package/src/cli/combo-result.ts +1 -1
  60. package/src/cli/combo.ts +4 -0
  61. package/src/cli/config-command.ts +16 -2
  62. package/src/cli/connect.ts +12 -10
  63. package/src/cli/dispatch.ts +4 -0
  64. package/src/cli/doctor.ts +11 -0
  65. package/src/cli/help.ts +1 -0
  66. package/src/cli/init.ts +4 -0
  67. package/src/cli/link-enrollment.ts +152 -25
  68. package/src/cli/link-local-control.ts +49 -0
  69. package/src/cli/link.ts +37 -10
  70. package/src/cli/provider-lifecycle-runtime.ts +4 -2
  71. package/src/cli/registry.ts +13 -0
  72. package/src/cli/star-prompt.ts +2 -0
  73. package/src/cli/status.ts +1 -1
  74. package/src/cli/telemetry-profile.ts +206 -0
  75. package/src/cli/telemetry.ts +260 -0
  76. package/src/client/hub-relay.ts +26 -0
  77. package/src/client/machine-api.ts +3 -0
  78. package/src/clients/config-export/t3code.ts +44 -5
  79. package/src/clients/omo-role-models.ts +1 -1
  80. package/src/codex/catalog/bundled.ts +44 -2
  81. package/src/codex/runtime.ts +12 -0
  82. package/src/codex/shim-restore-lock.ts +67 -30
  83. package/src/combos/types.ts +21 -1
  84. package/src/config/atomic-write.ts +24 -1
  85. package/src/config/diagnostics.ts +15 -0
  86. package/src/config/live-reconcile.ts +17 -0
  87. package/src/config/load-degrade.ts +16 -0
  88. package/src/config/provider-validation.ts +29 -0
  89. package/src/config/schema/config-schema.ts +24 -0
  90. package/src/config/schema/leaf-validators.ts +17 -0
  91. package/src/config/telemetry-carry.ts +30 -0
  92. package/src/config.ts +13 -1
  93. package/src/generated/compatibility-version.json +405 -153
  94. package/src/generated/model-metadata.ts +3 -3
  95. package/src/integrations/aside-profiles.ts +7 -1
  96. package/src/integrations/owned-refresh.ts +9 -2
  97. package/src/lab/artifacts/secure-fs.ts +12 -11
  98. package/src/lab/fabric/scratch.ts +11 -9
  99. package/src/lab/public/community.ts +2 -3
  100. package/src/lab/public/file-safety.ts +18 -20
  101. package/src/lab/public/mutation-lock.ts +109 -337
  102. package/src/lab/public/private-file.ts +4 -3
  103. package/src/lib/bun-runtime-preflight.ts +1 -1
  104. package/src/lib/codex-catalog-read-only.ts +122 -0
  105. package/src/lib/config-ownership.ts +49 -18
  106. package/src/lib/errors.ts +11 -0
  107. package/src/lib/gcp-adc.ts +167 -48
  108. package/src/lib/jsonc.ts +4 -2
  109. package/src/lib/local-control-socket.ts +88 -0
  110. package/src/lib/privacy.ts +15 -0
  111. package/src/lib/provider-client-headers.ts +3 -0
  112. package/src/lib/token-estimate.ts +13 -2
  113. package/src/link/child-binary-source.ts +228 -0
  114. package/src/link/ephemeral-child.ts +45 -0
  115. package/src/link/remote-plant.ts +306 -0
  116. package/src/link/remote-windows.ts +59 -5
  117. package/src/link/ssh-argv.ts +71 -8
  118. package/src/link/status-projection.ts +2 -0
  119. package/src/link/store.ts +5 -1
  120. package/src/oauth/claude-keychain-read.ts +165 -0
  121. package/src/oauth/local-token-detect.ts +14 -17
  122. package/src/protocols/envelope.ts +20 -2
  123. package/src/providers/api-key-selection.ts +8 -2
  124. package/src/providers/claude-cli-usage-state.ts +93 -0
  125. package/src/providers/github-copilot-auto.ts +25 -5
  126. package/src/providers/meta-muse-plan-refusal.ts +94 -0
  127. package/src/providers/model-rename-fields.ts +3 -0
  128. package/src/providers/quota/vendor-probes-key.ts +23 -4
  129. package/src/providers/quota/vendor-probes-oauth.ts +59 -0
  130. package/src/providers/quota/workbuddy.ts +2 -2
  131. package/src/providers/quota.ts +25 -18
  132. package/src/providers/registry/entries-core.ts +7 -4
  133. package/src/providers/registry/entries-extended.ts +39 -7
  134. package/src/providers/registry/model-seeds.ts +10 -2
  135. package/src/providers/resolved-model-policy.ts +4 -0
  136. package/src/providers/routed-config.ts +30 -3
  137. package/src/providers/stale-no-vision-seed-migration.ts +7 -0
  138. package/src/providers/vertex-environment-authority.ts +50 -0
  139. package/src/providers/workbuddy-credit-balance.ts +38 -6
  140. package/src/quota-pool/assemble.ts +14 -6
  141. package/src/router.ts +1 -0
  142. package/src/server/adapter-resolve.ts +11 -6
  143. package/src/server/audio-dictation.ts +21 -7
  144. package/src/server/auth-cors.ts +19 -0
  145. package/src/server/background-lifecycle.ts +71 -0
  146. package/src/server/chat-completions.ts +2 -0
  147. package/src/server/claude-messages.ts +30 -3
  148. package/src/server/index/live-sideband.ts +15 -1
  149. package/src/server/index/local-control-listener.ts +515 -0
  150. package/src/server/index/optional-listeners.ts +21 -1
  151. package/src/server/index/serve-options.ts +4 -3
  152. package/src/server/index/websocket-handler.ts +2 -0
  153. package/src/server/index.ts +3 -0
  154. package/src/server/management/combo-routes.ts +6 -1
  155. package/src/server/management/context.ts +1 -0
  156. package/src/server/management/link-child-preflight.ts +74 -0
  157. package/src/server/management/link-enrollment.ts +190 -25
  158. package/src/server/management/link-route-state.ts +6 -1
  159. package/src/server/management/link-routes.ts +27 -9
  160. package/src/server/management/model-rows.ts +4 -0
  161. package/src/server/management/oauth-account-routes.ts +9 -4
  162. package/src/server/management/provider-overwrite-carry.ts +9 -2
  163. package/src/server/management/provider-routes.ts +14 -0
  164. package/src/server/management/provider-thinking-display-patch.ts +54 -0
  165. package/src/server/management/route-registry.ts +7 -0
  166. package/src/server/management/session-routes.ts +4 -1
  167. package/src/server/management/telemetry-routes.ts +37 -0
  168. package/src/server/management/usage-aggregate-cache.ts +290 -67
  169. package/src/server/management-api.ts +11 -2
  170. package/src/server/messages-native-preflight.ts +166 -0
  171. package/src/server/messages-native.ts +143 -43
  172. package/src/server/messages-shared.ts +14 -0
  173. package/src/server/proxy-liveness.ts +99 -6
  174. package/src/server/request-log-conversation.ts +18 -2
  175. package/src/server/request-log.ts +7 -2
  176. package/src/server/responses/adapter-continuation.ts +1 -0
  177. package/src/server/responses/adapter-dispatch.ts +11 -28
  178. package/src/server/responses/adapter-failure-message.ts +68 -0
  179. package/src/server/responses/combo-stream-preflight.ts +14 -2
  180. package/src/server/responses/core-auth.ts +26 -5
  181. package/src/server/responses/core-codex-account.ts +8 -1
  182. package/src/server/responses/core-combo-failure.ts +6 -1
  183. package/src/server/responses/core-combo-native.ts +150 -37
  184. package/src/server/responses/core-combo.ts +15 -9
  185. package/src/server/responses/core-normalize.ts +1 -0
  186. package/src/server/responses/core-options.ts +7 -1
  187. package/src/server/responses/core-pipeline.ts +21 -1
  188. package/src/server/responses/fetch-helpers.ts +5 -0
  189. package/src/server/responses/opengateway-completion-guard.ts +7 -3
  190. package/src/server/responses/passthrough-delivery.ts +8 -1
  191. package/src/server/responses/passthrough-error.ts +22 -0
  192. package/src/server/responses/request-prepare.ts +7 -1
  193. package/src/server/responses/request-transport.ts +28 -5
  194. package/src/server/responses/run-turn-execution.ts +13 -0
  195. package/src/server/sse-frame-buffer.ts +5 -0
  196. package/src/server/ws-bridge.ts +10 -0
  197. package/src/service/launchd.ts +78 -4
  198. package/src/telemetry/aggregate.ts +348 -0
  199. package/src/telemetry/consent.ts +128 -0
  200. package/src/telemetry/contract.ts +403 -0
  201. package/src/telemetry/disclosure.ts +19 -0
  202. package/src/telemetry/install-id.ts +226 -0
  203. package/src/telemetry/payload.ts +129 -0
  204. package/src/telemetry/profile/client.ts +150 -0
  205. package/src/telemetry/profile/contract.ts +288 -0
  206. package/src/telemetry/profile/disclosure.ts +14 -0
  207. package/src/telemetry/profile/paths.ts +13 -0
  208. package/src/telemetry/profile/routes.ts +99 -0
  209. package/src/telemetry/profile/service.ts +234 -0
  210. package/src/telemetry/profile/state.ts +189 -0
  211. package/src/telemetry/profile/sync.ts +276 -0
  212. package/src/telemetry/routes.ts +183 -0
  213. package/src/telemetry/scheduler.ts +386 -0
  214. package/src/telemetry/sender.ts +97 -0
  215. package/src/telemetry/state.ts +334 -0
  216. package/src/types/combo-jev-effort-mode.ts +11 -0
  217. package/src/types/config.ts +3 -0
  218. package/src/types/provider.ts +11 -1
  219. package/src/types/request.ts +2 -0
  220. package/src/types/telemetry.ts +15 -0
  221. package/src/types/wire.ts +10 -0
  222. package/src/types.ts +5 -0
  223. package/src/update/index.ts +7 -1
  224. package/src/update/minisign.d.mts +17 -0
  225. package/src/update/minisign.mjs +88 -0
  226. package/src/update/signed-supply.d.mts +59 -0
  227. package/src/update/signed-supply.mjs +289 -0
  228. package/src/update/trust-root.json +38 -0
  229. package/src/update/update-bounded-json.d.mts +4 -0
  230. package/src/update/update-bounded-json.mjs +113 -0
  231. package/src/update/update-bytes.d.mts +2 -0
  232. package/src/update/update-bytes.mjs +23 -0
  233. package/src/update/update-candidate-id.d.mts +2 -0
  234. package/src/update/update-candidate-id.mjs +23 -0
  235. package/src/update/update-checkpoint-codec.d.mts +33 -0
  236. package/src/update/update-checkpoint-codec.mjs +217 -0
  237. package/src/update/update-contracts.d.mts +24 -0
  238. package/src/update/update-contracts.mjs +207 -0
  239. package/src/update/update-signature-threshold.d.mts +12 -0
  240. package/src/update/update-signature-threshold.mjs +47 -0
  241. package/src/update/update-signed-version.d.mts +5 -0
  242. package/src/update/update-signed-version.mjs +25 -0
  243. package/src/update/update-trust-anchor.d.mts +2 -0
  244. package/src/update/update-trust-anchor.mjs +2 -0
  245. package/src/usage/cache-diagnostic.ts +195 -50
  246. package/src/usage/expected-prices.ts +20 -2
  247. package/src/usage/filter-index.ts +1469 -0
  248. package/src/usage/ledger-scanner.ts +245 -4
  249. package/src/usage/source-filter.ts +10 -2
  250. package/src/usage/summary.ts +16 -0
  251. package/src/web-search/parse.ts +244 -38
  252. package/gui/dist/assets/App-CWz0areF.js +0 -59
  253. package/gui/dist/assets/Tray-BosDoskm.js +0 -1
  254. package/gui/dist/assets/index-CAxjGWkm.js +0 -94
  255. package/gui/dist/assets/index-bnUWypyz.css +0 -2
  256. package/gui/dist/classic/assets/App-BOEsFmiN.js +0 -58
  257. package/gui/dist/classic/assets/index-ClZ_zZ77.js +0 -94
  258. package/gui/dist/classic/assets/quota-summary-xwvDtvu7.js +0 -1
@@ -2,7 +2,7 @@
2
2
  import { createHmac, randomBytes } from "node:crypto";
3
3
  import { appendFileSync, chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
4
4
  import { join } from "node:path";
5
- import { CODEX_AFFINITY_DEBUG_SAFE_HEADERS } from "../codex/affinity-debug";
5
+ import { codexConversationIdentity } from "../codex/lineage";
6
6
  import { getConfigDir } from "../config";
7
7
  import { recordOwnedConfigPath } from "../lib/config-ownership";
8
8
  import type { CacheTelemetryProvenance } from "./log";
@@ -10,6 +10,8 @@ import type { CacheTelemetryProvenance } from "./log";
10
10
  const CACHE_DEBUG_KEY = randomBytes(32);
11
11
  const MAX_BLOCKS = 128;
12
12
  const MAX_DRAFTS = 512;
13
+ const SESSION_HEADERS = ["session_id", "session-id", "thread-id", "x-session-id"] as const;
14
+ type SessionHeaders = Record<typeof SESSION_HEADERS[number], TaggedPresence>;
13
15
  export const CACHE_DEBUG_MAX_LINES = 200;
14
16
  export const CACHE_DEBUG_KEEP_LINES = 100;
15
17
 
@@ -20,11 +22,24 @@ export interface PrefixFingerprint {
20
22
  instructions: TaggedSequence;
21
23
  tools: TaggedSequence;
22
24
  messages: TaggedSequence;
25
+ unsupported?: true;
23
26
  }
27
+ type PrefixSection = "instructions" | "tools" | "messages";
28
+ export type PrefixComparison =
29
+ | { status: "first" | "equal" }
30
+ | { status: "append-only" | "different" | "truncated"; section: PrefixSection; index: number }
31
+ | { status: "uncomparable"; reason: "missing-session" | "missing-observation" | "unsupported-shape" };
24
32
  export interface CacheDiagnosticDraft {
25
33
  promptCacheKey?: { inbound?: TaggedPresence; outbound?: TaggedPresence };
26
- session?: { inboundHeader?: TaggedPresence; outboundHeader?: TaggedPresence };
34
+ session?: {
35
+ inboundHeader?: TaggedPresence;
36
+ outboundHeader?: TaggedPresence;
37
+ inboundHeaders?: SessionHeaders;
38
+ outboundHeaders?: SessionHeaders;
39
+ };
27
40
  prefix?: { inbound?: PrefixFingerprint; outbound?: PrefixFingerprint };
41
+ /** The shared Pool key derivation's result, not a binding lookup or selection decision. */
42
+ accountAffinity?: { inbound?: TaggedPresence; outbound?: TaggedPresence };
28
43
  }
29
44
 
30
45
  export interface CacheDiagnosticFinalFacts {
@@ -49,9 +64,43 @@ export interface CacheDiagnosticFinalFacts {
49
64
 
50
65
  const drafts = new Map<string, CacheDiagnosticDraft>();
51
66
  const bodyDrafts = new WeakMap<object, CacheDiagnosticDraft>();
67
+ // Internal only: neither the caller principal nor its tag belongs in the diagnostic record.
68
+ const callerScopes = new WeakMap<object, string>();
69
+ interface PreviousObservation {
70
+ prefix?: CacheDiagnosticDraft["prefix"];
71
+ promptCacheKey?: CacheDiagnosticDraft["promptCacheKey"];
72
+ account: TaggedPresence;
73
+ }
74
+ // Finalization order, process-local only. Keys include the diagnostic destination so changing
75
+ // OPENCODEX_HOME cannot join histories. Neither keys nor values retain raw session/account data.
76
+ const previousObservations = new Map<string, PreviousObservation>();
77
+ // Retention epoch: every on/off transition starts a new one. Nothing observed in an earlier epoch
78
+ // may be compared, merged or written after it, so turning diagnostics off forgets the history.
79
+ let diagnosticGeneration = 0;
80
+ let lastEnabled = false;
81
+ const draftGenerations = new WeakMap<object, number>();
52
82
 
53
83
  export function isCacheDiagnosticEnabled(): boolean {
54
- return process.env.OPENCODEX_CACHE_DEBUG === "1";
84
+ const enabled = process.env.OPENCODEX_CACHE_DEBUG === "1";
85
+ if (enabled !== lastEnabled) {
86
+ lastEnabled = enabled;
87
+ diagnosticGeneration++;
88
+ drafts.clear();
89
+ previousObservations.clear();
90
+ }
91
+ return enabled;
92
+ }
93
+
94
+ function stamp<T extends object>(draft: T): T {
95
+ draftGenerations.set(draft, diagnosticGeneration);
96
+ return draft;
97
+ }
98
+
99
+ /** A draft stamped in an earlier epoch; unstamped partial observations are not drafts. */
100
+ function staleDraft(value: unknown): boolean {
101
+ if (!value || typeof value !== "object") return false;
102
+ const generation = draftGenerations.get(value);
103
+ return generation !== undefined && generation !== diagnosticGeneration;
55
104
  }
56
105
 
57
106
  export function cacheDiagnosticPath(): string {
@@ -79,14 +128,27 @@ function taggedPresence(value: unknown, domain: string, source?: PromptCacheKeyS
79
128
  return { present: true, tag: tag(domain, value), ...(source ? { source } : {}) };
80
129
  }
81
130
 
82
- function sessionPresence(headers: Headers | HeadersInit): TaggedPresence {
131
+ function accountAffinityKey(headers: HeadersInit): TaggedPresence {
132
+ // codexPoolAffinityKey is exactly this read-only identity projection. Import its leaf
133
+ // derivation, not auth-context (which brings credential resolution and routing with it).
134
+ // Parent-only inputs may consult existing TTL-bounded lineage; this call records nothing.
135
+ const normalized = headers instanceof Headers ? headers : new Headers(headers);
136
+ return taggedPresence(codexConversationIdentity(normalized)?.conversationKey, "cache-debug:codex-pool-affinity-key");
137
+ }
138
+
139
+ function sessionHeaders(headers: HeadersInit): SessionHeaders {
83
140
  const normalized = headers instanceof Headers ? headers : new Headers(headers);
84
- const values = CODEX_AFFINITY_DEBUG_SAFE_HEADERS.flatMap(name => {
141
+ return Object.fromEntries(SESSION_HEADERS.map(name => {
85
142
  const value = normalized.get(name);
86
- return value === null ? [] : [[name, value] as const];
87
- });
88
- return values.length === 0
89
- ? { present: false }
143
+ return [name, value === null ? { present: false } : {
144
+ present: true, tag: tag("cache-debug:session-header", value),
145
+ }];
146
+ })) as SessionHeaders;
147
+ }
148
+
149
+ function sessionPresence(headers: SessionHeaders): TaggedPresence {
150
+ const values = SESSION_HEADERS.filter(name => headers[name].present).map(name => [name, headers[name].tag]);
151
+ return values.length === 0 ? { present: false }
90
152
  : { present: true, tag: tag("cache-debug:session-headers", canonicalJson(values)) };
91
153
  }
92
154
 
@@ -102,25 +164,21 @@ function sequence(blocks: unknown[], domain: string): TaggedSequence {
102
164
 
103
165
  function requestBlocks(body: Record<string, unknown>): { instructions: unknown[]; messages: unknown[] } {
104
166
  const instructions = body.instructions;
105
- // The spread is load-bearing: an array-valued instructions field must be copied, never
106
- // aliased, because the pushes below would otherwise mutate the live request body that
107
- // the adapter is about to serialize upstream.
108
- const instructionRows = instructions === undefined || instructions === null
109
- ? [] : Array.isArray(instructions) ? [...instructions] : [instructions];
110
- const input = Array.isArray(body.input) ? body.input : Array.isArray(body.messages) ? body.messages : [];
111
- const messages: unknown[] = [];
112
- for (const block of input) {
113
- if (block && typeof block === "object" && !Array.isArray(block)) {
114
- const row = block as Record<string, unknown>;
115
- if (row.role === "system" || row.role === "developer") {
116
- const content = row.content;
117
- instructionRows.push(...(Array.isArray(content) ? content : [content]));
118
- continue;
119
- }
120
- }
121
- messages.push(block);
167
+ // Build fresh rows: pushes below must never mutate an array-valued instructions field
168
+ // in the live request body. Include the source so moving text between fields is visible.
169
+ const instructionRows: unknown[] = instructions === undefined || instructions === null
170
+ ? [] : (Array.isArray(instructions) ? instructions : [instructions])
171
+ .map(content => ({ source: "instructions", content }));
172
+ if (body.system !== undefined && body.system !== null) {
173
+ instructionRows.push(...(Array.isArray(body.system) ? body.system : [body.system])
174
+ .map(content => ({ source: "system", content })));
122
175
  }
123
- return { instructions: instructionRows, messages };
176
+ const input = typeof body.input === "string" ? [body.input]
177
+ : Array.isArray(body.input) ? body.input : Array.isArray(body.messages) ? body.messages : [];
178
+ // Keep every input/messages row in wire order, including system/developer updates.
179
+ // Extracting those roles into instructions misclassifies a genuine tail append as a
180
+ // top-level prefix rewrite. Whole-row tags still detect role, position and content edits.
181
+ return { instructions: instructionRows, messages: input };
124
182
  }
125
183
 
126
184
  export function prefixFingerprint(body: unknown): PrefixFingerprint {
@@ -128,30 +186,91 @@ export function prefixFingerprint(body: unknown): PrefixFingerprint {
128
186
  ? body as Record<string, unknown> : {};
129
187
  const tools = Array.isArray(record.tools) ? record.tools : [];
130
188
  const blocks = requestBlocks(record);
189
+ const unsupported = !body || typeof body !== "object" || Array.isArray(body)
190
+ || (record.input !== undefined && typeof record.input !== "string" && !Array.isArray(record.input))
191
+ || (record.messages !== undefined && !Array.isArray(record.messages))
192
+ || (record.tools !== undefined && !Array.isArray(record.tools));
131
193
  return {
132
194
  instructions: sequence(blocks.instructions, "cache-debug:prefix:instructions"),
133
195
  tools: sequence(tools, "cache-debug:prefix:tools"),
134
196
  messages: sequence(blocks.messages, "cache-debug:prefix:messages"),
197
+ ...(unsupported ? { unsupported: true as const } : {}),
135
198
  };
136
199
  }
137
200
 
138
- function firstDivergence(inbound: PrefixFingerprint, outbound: PrefixFingerprint):
139
- { section: "instructions" | "tools" | "messages"; index: number } | undefined {
201
+ function comparePrefixes(before?: PrefixFingerprint, after?: PrefixFingerprint): PrefixComparison {
202
+ if (!before || !after) return { status: "uncomparable", reason: "missing-observation" };
203
+ if (before.unsupported || after.unsupported) return { status: "uncomparable", reason: "unsupported-shape" };
140
204
  for (const section of ["instructions", "tools", "messages"] as const) {
141
- const before = inbound[section].tags;
142
- const after = outbound[section].tags;
143
- const compared = Math.min(before.length, after.length);
205
+ const left = before[section];
206
+ const right = after[section];
207
+ const compared = Math.min(left.tags.length, right.tags.length);
144
208
  for (let index = 0; index < compared; index += 1) {
145
- if (before[index] !== after[index]) return { section, index };
209
+ if (left.tags[index] !== right.tags[index]) return { status: "different", section, index };
210
+ }
211
+ // A hidden difference here could precede any difference in later sections. Do not
212
+ // infer equality, append-only, or an exact first divergence from an unobserved tail.
213
+ if (compared < Math.min(left.count, right.count)) return { status: "truncated", section, index: compared };
214
+ if (left.count !== right.count) {
215
+ // Only message-tail growth is append-only. Growing instructions/tools changes the
216
+ // cache prefix before the conversation even when all existing section tags match.
217
+ return { status: section === "messages" && right.count > left.count ? "append-only" : "different", section, index: compared };
146
218
  }
147
- if (inbound[section].count !== outbound[section].count) return { section, index: compared };
148
219
  }
149
- return undefined;
220
+ return { status: "equal" };
221
+ }
222
+
223
+ type PresenceComparison = "first" | "equal" | "changed" | "uncomparable";
224
+ function comparePresence(before?: TaggedPresence, after?: TaggedPresence): PresenceComparison {
225
+ if (!before || !after) return "uncomparable";
226
+ return before.present === after.present && before.tag === after.tag ? "equal" : "changed";
227
+ }
228
+
229
+ function continuation(facts: CacheDiagnosticFinalFacts, draft: CacheDiagnosticDraft, account: TaggedPresence) {
230
+ const headers = draft.session?.inboundHeaders;
231
+ // Diagnostic correlation ONLY, not the account affinity identity or proof of a binding.
232
+ // All available inbound identifiers participate. Do not use prompt_cache_key (which may
233
+ // legitimately rotate), synthesized outbound IDs, or unrelated affinity headers as identity.
234
+ const identity = headers && SESSION_HEADERS.filter(name => headers[name].present
235
+ && headers[name].tag !== tag("cache-debug:session-header", ""))
236
+ .map(name => [name, headers[name].tag]);
237
+ const callerScope = callerScopes.get(draft);
238
+ const key = identity?.length && callerScope ? tag("cache-debug:history", canonicalJson([
239
+ getConfigDir(), callerScope, facts.protocol, facts.model, identity,
240
+ ])) : undefined;
241
+ const previous = key ? previousObservations.get(key) : undefined;
242
+ const compare = (side: "inbound" | "outbound"): PrefixComparison => {
243
+ if (!identity?.length) return { status: "uncomparable", reason: "missing-session" };
244
+ if (!callerScope) return { status: "uncomparable", reason: "missing-observation" };
245
+ const current = draft.prefix?.[side];
246
+ if (!current) return { status: "uncomparable", reason: "missing-observation" };
247
+ if (current.unsupported) return { status: "uncomparable", reason: "unsupported-shape" };
248
+ return previous ? comparePrefixes(previous.prefix?.[side], current) : { status: "first" };
249
+ };
250
+ const presence = (side: "inbound" | "outbound"): PresenceComparison => !key || !draft.promptCacheKey?.[side] ? "uncomparable"
251
+ : !previous ? "first" : comparePresence(previous.promptCacheKey?.[side], draft.promptCacheKey?.[side]);
252
+ const result = {
253
+ inbound: compare("inbound"),
254
+ outbound: compare("outbound"),
255
+ promptCacheKey: { inbound: presence("inbound"), outbound: presence("outbound") },
256
+ account: !key ? "uncomparable" : !previous ? "first" : comparePresence(previous.account, account),
257
+ };
258
+ if (key) {
259
+ previousObservations.delete(key);
260
+ previousObservations.set(key, {
261
+ prefix: { ...draft.prefix }, promptCacheKey: { ...draft.promptCacheKey }, account,
262
+ });
263
+ while (previousObservations.size > MAX_DRAFTS) previousObservations.delete(previousObservations.keys().next().value!);
264
+ }
265
+ return result;
150
266
  }
151
267
 
152
268
  export function observe(requestId: string, observation: Partial<CacheDiagnosticDraft>): CacheDiagnosticDraft {
153
- const draft = drafts.get(requestId) ?? {};
269
+ if (!isCacheDiagnosticEnabled() || staleDraft(observation)) return {};
270
+ const draft = drafts.get(requestId) ?? stamp({});
154
271
  Object.assign(draft, observation);
272
+ const callerScope = callerScopes.get(observation);
273
+ if (callerScope) callerScopes.set(draft, callerScope);
155
274
  drafts.delete(requestId);
156
275
  drafts.set(requestId, draft);
157
276
  while (drafts.size > MAX_DRAFTS) drafts.delete(drafts.keys().next().value!);
@@ -162,16 +281,22 @@ export function observeInbound(
162
281
  body: unknown,
163
282
  headers: Headers,
164
283
  source: PromptCacheKeySource = "caller",
284
+ admissionPrincipal?: string,
165
285
  ): CacheDiagnosticDraft {
166
286
  if (!isCacheDiagnosticEnabled()) return {};
167
287
  try {
168
288
  const record = body && typeof body === "object" && !Array.isArray(body)
169
289
  ? body as Record<string, unknown> : {};
170
- const draft: CacheDiagnosticDraft = {
290
+ const inboundHeaders = sessionHeaders(headers);
291
+ const draft: CacheDiagnosticDraft = stamp({
171
292
  promptCacheKey: { inbound: taggedPresence(record.prompt_cache_key, "cache-debug:prompt-cache-key", source) },
172
- session: { inboundHeader: sessionPresence(headers) },
293
+ session: { inboundHeader: sessionPresence(inboundHeaders), inboundHeaders },
173
294
  prefix: { inbound: prefixFingerprint(body) },
174
- };
295
+ accountAffinity: { inbound: accountAffinityKey(headers) },
296
+ });
297
+ // Admission owns caller identity; bridges may remove or replace Authorization.
298
+ // No trusted principal (including unauthenticated loopback) means no history join.
299
+ if (admissionPrincipal) callerScopes.set(draft, tag("cache-debug:caller-scope", admissionPrincipal));
175
300
  if (body && typeof body === "object") bodyDrafts.set(body, draft);
176
301
  return draft;
177
302
  } catch {
@@ -186,6 +311,7 @@ export function observeInbound(
186
311
  */
187
312
  export function rebindCacheDiagnosticBodyAlias(body: unknown, draft: CacheDiagnosticDraft | undefined): void {
188
313
  if (!isCacheDiagnosticEnabled() || !draft) return;
314
+ if (staleDraft(draft)) return;
189
315
  if (body && typeof body === "object") bodyDrafts.set(body, draft);
190
316
  }
191
317
 
@@ -199,7 +325,7 @@ export function observeOutbound(
199
325
  try {
200
326
  if (!inboundBody || typeof inboundBody !== "object") return;
201
327
  const draft = bodyDrafts.get(inboundBody);
202
- if (!draft) return;
328
+ if (!draft || staleDraft(draft)) return;
203
329
  const record = outboundBody && typeof outboundBody === "object" && !Array.isArray(outboundBody)
204
330
  ? outboundBody as Record<string, unknown> : {};
205
331
  const outbound = taggedPresence(record.prompt_cache_key, "cache-debug:prompt-cache-key", source);
@@ -208,8 +334,10 @@ export function observeOutbound(
208
334
  outbound.source = inboundKey.source;
209
335
  }
210
336
  (draft.promptCacheKey ??= {}).outbound = outbound;
211
- (draft.session ??= {}).outboundHeader = sessionPresence(headers);
337
+ const outboundHeaders = sessionHeaders(headers);
338
+ Object.assign(draft.session ??= {}, { outboundHeader: sessionPresence(outboundHeaders), outboundHeaders });
212
339
  (draft.prefix ??= {}).outbound = prefixFingerprint(outboundBody);
340
+ (draft.accountAffinity ??= {}).outbound = accountAffinityKey(headers);
213
341
  } catch {
214
342
  /* diagnostics must never affect request handling */
215
343
  }
@@ -231,13 +359,20 @@ function trimRollingFile(path: string): void {
231
359
 
232
360
  export function appendFinalCacheDiagnostic(facts: CacheDiagnosticFinalFacts): void {
233
361
  if (!isCacheDiagnosticEnabled()) return;
362
+ if (staleDraft(facts.draft)) {
363
+ drafts.delete(facts.requestId);
364
+ return;
365
+ }
234
366
  try {
235
367
  const draft = facts.draft ? observe(facts.requestId, facts.draft) : drafts.get(facts.requestId) ?? {};
236
368
  drafts.delete(facts.requestId);
237
369
  const inboundKey = draft.promptCacheKey?.inbound;
238
370
  const outboundKey = draft.promptCacheKey?.outbound;
239
- const inboundPrefix = draft.prefix?.inbound ?? prefixFingerprint(undefined);
240
- const outboundPrefix = draft.prefix?.outbound ?? prefixFingerprint(undefined);
371
+ const inboundPrefix = draft.prefix?.inbound;
372
+ const outboundPrefix = draft.prefix?.outbound;
373
+ const comparison = comparePrefixes(inboundPrefix, outboundPrefix);
374
+ // Only explicit account facts are evidence; never infer an account from provider text.
375
+ const account = taggedPresence(facts.accountLogLabel, "cache-debug:account-log-label");
241
376
  const record = {
242
377
  version: 1 as const,
243
378
  ts: Date.now(),
@@ -251,23 +386,33 @@ export function appendFinalCacheDiagnostic(facts: CacheDiagnosticFinalFacts): vo
251
386
  outbound: outboundKey ?? { present: false },
252
387
  ...(inboundKey?.present && outboundKey?.present ? { equal: inboundKey.tag === outboundKey.tag } : {}),
253
388
  },
389
+ accountAffinity: {
390
+ derivation: "codexConversationIdentity",
391
+ evidence: "derived-key-not-binding",
392
+ // Missing observation stays omitted, distinct from an observed absent key.
393
+ ...draft.accountAffinity,
394
+ },
254
395
  session: {
396
+ purpose: "diagnostic-correlation-only",
255
397
  inboundHeader: draft.session?.inboundHeader ?? { present: false },
256
398
  outboundHeader: draft.session?.outboundHeader ?? { present: false },
399
+ inboundHeaders: draft.session?.inboundHeaders,
400
+ outboundHeaders: draft.session?.outboundHeaders,
257
401
  },
258
402
  prefix: {
259
403
  inbound: inboundPrefix,
260
404
  outbound: outboundPrefix,
261
- ...(firstDivergence(inboundPrefix, outboundPrefix)
262
- ? { firstDivergentBlock: firstDivergence(inboundPrefix, outboundPrefix) }
263
- : {}),
405
+ comparison,
406
+ ...(comparison.status === "different" || comparison.status === "append-only"
407
+ ? { firstDivergentBlock: { section: comparison.section, index: comparison.index } } : {}),
264
408
  },
409
+ continuation: continuation(facts, draft, account),
265
410
  route: {
266
411
  provider: facts.provider,
267
412
  model: facts.model,
268
- ...(facts.accountLogLabel
269
- ? { accountTag: tag("cache-debug:account-log-label", facts.accountLogLabel) }
270
- : {}),
413
+ ...(account.present ? { accountTag: account.tag } : {}),
414
+ // Preserve reported route labels, never infer key presence or an actual binding
415
+ // from them: even `new_bind` can be reported when no affinity key was derived.
271
416
  ...(facts.affinityMove ? { affinityMove: facts.affinityMove } : {}),
272
417
  ...(facts.affinityReason ? { affinityReason: facts.affinityReason } : {}),
273
418
  },
@@ -295,7 +440,7 @@ export function appendFinalCacheDiagnostic(facts: CacheDiagnosticFinalFacts): vo
295
440
  const CACHE_DIAGNOSTIC_HOOK = Symbol.for("opencodex.cache-diagnostic.v1");
296
441
  interface CacheDiagnosticHooks {
297
442
  enabled(): boolean;
298
- observeInbound(body: unknown, headers: Headers, source: PromptCacheKeySource): CacheDiagnosticDraft;
443
+ observeInbound(body: unknown, headers: Headers, source: PromptCacheKeySource, admissionPrincipal?: string): CacheDiagnosticDraft;
299
444
  rebind(body: unknown, draft: CacheDiagnosticDraft | undefined): void;
300
445
  finalize(facts: CacheDiagnosticFinalFacts): void;
301
446
  }
@@ -141,6 +141,10 @@ const CLAUDE_OPUS_46: Cost4 = { input: 5, output: 25, cacheRead: 0.5, cacheWrite
141
141
  // (0.25) on Fable 5.1 — NOT the 0.1x (1.00) that Fable 5 and every other family use;
142
142
  // the pricing page footnote calls this out explicitly. Verified 2026-09-02.
143
143
  const CLAUDE_FABLE_51: Cost4 = { input: 10, output: 50, cacheRead: 0.25, cacheWrite: 12.5 };
144
+ // Claude Fable 5.2 (claude-fable-5-2, released 2026-11-09): 8 / 40, 5m cache write 10.00, and the
145
+ // same 0.025x cache-hit footnote as Fable 5.1 (0.20). Fast mode is exactly 2x (16 / 80) and is
146
+ // priced through PRIORITY_PRICING_RULES below. Verified 2026-11-10.
147
+ const CLAUDE_FABLE_52: Cost4 = { input: 8, output: 40, cacheRead: 0.2, cacheWrite: 10 };
144
148
  // Opus 5 was first priced from the maintainer's confirmation that it matched Opus 4.6. The
145
149
  // pricing page now lists it at that same 5 / 25 / 0.50 / 6.25 tuple (re-verified 2026-09-23).
146
150
  const CLAUDE_OPUS_5 = CLAUDE_OPUS_46;
@@ -157,6 +161,8 @@ const CLAUDE_HAIKU_55: Cost4 = { input: 0.1, output: 0.5, cacheRead: 0.01, cache
157
161
  const ANTHROPIC_PRICING = "https://platform.claude.com/docs/en/about-claude/pricing (official; 5m cache-write tier)";
158
162
  const CLAUDE_OPUS_5_SOURCE = `anthropic official Claude Opus 5 ${ANTHROPIC_PRICING}`;
159
163
  const CLAUDE_OPUS_55_SOURCE = `anthropic official Claude Opus 5.5 ${ANTHROPIC_PRICING}; cache hit = 0.05x base input`;
164
+ const CLAUDE_FABLE_52_SOURCE = `anthropic official Claude Fable 5.2 ${ANTHROPIC_PRICING}; cache hit = 0.025x base input`;
165
+ const CURSOR_FABLE_52_PRICING = "https://cursor.com/docs/models/claude-fable-5-2 (same list rate as Anthropic: 8 / 40, cache write 10, cache read 0.20)";
160
166
  const CLAUDE_SONNET_55_SOURCE = `anthropic official Claude Sonnet 5.5 ${ANTHROPIC_PRICING}; cache hit = 0.05x base input (2026-10-08 cut)`;
161
167
  const CLAUDE_HAIKU_55_SOURCE = `anthropic official Claude Haiku 5.5 ${ANTHROPIC_PRICING}; >100K prompt prices every token category at 5x`;
162
168
  const CURSOR_HAIKU_55_PRICING = "https://cursor.com/docs/models/claude-haiku-5-5 (same base and >100K rates as Anthropic)";
@@ -303,6 +309,7 @@ const DEVIN_KIMI_K3: Cost4 = { input: 3, output: 15, cacheRead: 0.3, cacheWrite:
303
309
  const DEVIN_KIMI_K27: Cost4 = { input: 0.95, output: 4, cacheRead: 0.19, cacheWrite: 0 };
304
310
  const DEVIN_GROK: Cost4 = { input: 2, output: 6, cacheRead: 0.3, cacheWrite: 0 };
305
311
  const DEVIN_PRICING = "https://docs.devin.ai/desktop/models (official modelCostData table, 2026-09-13; list rates for self-serve overage / enterprise ACU conversion on a subscription surface)";
312
+ const DEVIN_FABLE_52_SOURCE = "https://docs.devin.ai/desktop/models (Claude Fable 5.2 listed at 8 / 40, cache read 0.20, cache write 10, 2026-11-10; uid claude-fable-5-2-<effort>, seed collapses to the base)";
306
313
  const DEVIN_SWE2_NOTE = "list rate; $0 self-serve through 2026-10-08 and 75%-off enterprise through 2026-12-31 are time-boxed promos, not baked in";
307
314
 
308
315
  export const EXPECTED_PRICE_OVERLAYS: readonly ExpectedPriceOverlay[] = [
@@ -326,6 +333,15 @@ export const EXPECTED_PRICE_OVERLAYS: readonly ExpectedPriceOverlay[] = [
326
333
  { provider: "anthropic-apikey", modelId: "claude-fable-5-1", cost4: CLAUDE_FABLE_51, source: `anthropic official Claude Fable 5.1 ${ANTHROPIC_PRICING}; cache hit = 0.025x base input`, verifiedAt: "2026-09-02", status: "verified" },
327
334
  // Cursor canonicalizes every Fable 5.1 spelling onto this sole overlay row.
328
335
  { provider: "cursor", modelId: "claude-fable-5-1", cost4: CLAUDE_FABLE_51, source: `anthropic official Claude Fable 5.1 ${ANTHROPIC_PRICING}; cache hit = 0.025x base input; vendor list price applied to the Cursor surface`, verifiedAt: "2026-09-02", status: "verified-derived" },
336
+ // Fable 5.2 also has a generated jawcode row; these overlays cover pooled OAuth labels the same
337
+ // way the Fable 5.1 rows do. Cursor canonicalizes the bare and thinking spellings onto its row.
338
+ { provider: "anthropic", modelId: "claude-fable-5-2", cost4: CLAUDE_FABLE_52, source: CLAUDE_FABLE_52_SOURCE, verifiedAt: "2026-11-10", status: "verified" },
339
+ { provider: "anthropic-apikey", modelId: "claude-fable-5-2", cost4: CLAUDE_FABLE_52, source: CLAUDE_FABLE_52_SOURCE, verifiedAt: "2026-11-10", status: "verified" },
340
+ { provider: "cursor", modelId: "claude-fable-5-2", cost4: CLAUDE_FABLE_52, source: CURSOR_FABLE_52_PRICING, verifiedAt: "2026-11-10", status: "verified" },
341
+ // Kilo and Vercel are not generated bundles, and the vendor fallback cannot map these two ids
342
+ // onto claude-fable-5-2: Kilo's latest alias now serves 5.2, and Vercel lists the 2x fast tuple.
343
+ { provider: "kilo", modelId: "~anthropic/claude-fable-latest", cost4: CLAUDE_FABLE_52, source: "https://api.kilo.ai/api/openrouter/models (alias listed at the Fable 5.2 rate, 2026-11-10)", verifiedAt: "2026-11-10", status: "verified" },
344
+ { provider: "vercel-ai-gateway", modelId: "anthropic/claude-fable-5.2-fast", cost4: { input: 16, output: 80, cacheRead: 0.4, cacheWrite: 20 }, source: "https://ai-gateway.vercel.sh/v1/models (Fable 5.2 fast row, 2x list)", verifiedAt: "2026-11-10", status: "verified" },
329
345
  // claude-opus-5 is exposed by three providers but absent from the jawcode bundle, so
330
346
  // cost resolution returned null and the Logs `~$` column rendered an em dash. The
331
347
  // model-level vendor fallback only searches jawcode metadata, never overlays, so one
@@ -566,6 +582,7 @@ export const EXPECTED_PRICE_OVERLAYS: readonly ExpectedPriceOverlay[] = [
566
582
  { provider: "devin-cli", modelId: "claude-opus-5", cost4: CLAUDE_OPUS_46, source: DEVIN_PRICING, verifiedAt: "2026-09-13", status: "verified-derived" },
567
583
  { provider: "devin-cli", modelId: "claude-opus-5-5", cost4: CLAUDE_OPUS_55, source: `derived: live Devin catalog lists claude-opus-5-5 but Devin's modelCostData table does not yet; Anthropic list price shown as estimate ${ANTHROPIC_PRICING}`, verifiedAt: "2026-09-23", status: "verified-derived" },
568
584
  { provider: "devin-cli", modelId: "claude-fable-5-1", cost4: CLAUDE_FABLE_51, source: DEVIN_PRICING, verifiedAt: "2026-09-13", status: "verified-derived" },
585
+ { provider: "devin-cli", modelId: "claude-fable-5-2", cost4: CLAUDE_FABLE_52, source: DEVIN_FABLE_52_SOURCE, verifiedAt: "2026-11-10", status: "verified-derived" },
569
586
  { provider: "devin-cli", modelId: "claude-sonnet-5-5", cost4: CLAUDE_SONNET_55, source: DEVIN_SONNET_55_SOURCE, verifiedAt: "2026-10-08", status: "verified-derived" },
570
587
  { provider: "devin-cli", modelId: "claude-sonnet-5", cost4: DEVIN_SONNET_5, source: DEVIN_PRICING, verifiedAt: "2026-09-13", status: "verified-derived" },
571
588
  { provider: "devin-cli", modelId: "glm-5-3", cost4: GLM_53, source: DEVIN_PRICING, verifiedAt: "2026-09-13", status: "verified-derived" },
@@ -587,6 +604,7 @@ export const EXPECTED_PRICE_OVERLAYS: readonly ExpectedPriceOverlay[] = [
587
604
  { provider: "devin", modelId: "claude-opus-4-8", cost4: CLAUDE_OPUS_46, source: DEVIN_PRICING, verifiedAt: "2026-09-13", status: "verified-derived" },
588
605
  { provider: "devin", modelId: "claude-opus-5-5", cost4: CLAUDE_OPUS_55, source: `derived: live Devin catalog lists claude-opus-5-5 but Devin's modelCostData table does not yet; Anthropic list price shown as estimate ${ANTHROPIC_PRICING}`, verifiedAt: "2026-09-23", status: "verified-derived" },
589
606
  { provider: "devin", modelId: "claude-fable-5-1", cost4: CLAUDE_FABLE_51, source: DEVIN_PRICING, verifiedAt: "2026-09-13", status: "verified-derived" },
607
+ { provider: "devin", modelId: "claude-fable-5-2", cost4: CLAUDE_FABLE_52, source: DEVIN_FABLE_52_SOURCE, verifiedAt: "2026-11-10", status: "verified-derived" },
590
608
  { provider: "devin", modelId: "claude-sonnet-5-5", cost4: CLAUDE_SONNET_55, source: DEVIN_SONNET_55_SOURCE, verifiedAt: "2026-10-08", status: "verified-derived" },
591
609
  { provider: "devin", modelId: "claude-sonnet-5", cost4: DEVIN_SONNET_5, source: DEVIN_PRICING, verifiedAt: "2026-09-13", status: "verified-derived" },
592
610
  { provider: "devin", modelId: "glm-5-2", cost4: GLM_52, source: `enterprise list column (self-serve shows an unannounced 0 promo); ${DEVIN_PRICING}`, verifiedAt: "2026-09-13", status: "verified-derived" },
@@ -724,13 +742,13 @@ export const PRIORITY_PRICING_RULES: readonly PriorityPricingRule[] = [
724
742
  })),
725
743
  // Claude Code subscription fast draws usage credits at API fast rates, so OAuth is included.
726
744
  ...["anthropic", "anthropic-apikey"].flatMap(provider =>
727
- ["claude-opus-5-5", "claude-opus-5", "claude-opus-4-8"].map((modelId): PriorityPricingRule => ({
745
+ ["claude-fable-5-2", "claude-opus-5-5", "claude-opus-5", "claude-opus-4-8"].map((modelId): PriorityPricingRule => ({
728
746
  provider,
729
747
  modelId,
730
748
  multiplier: 2,
731
749
  requiresResponseConfirmation: true,
732
750
  source: ANTHROPIC_FAST_PRICING,
733
- verifiedAt: "2026-09-23",
751
+ verifiedAt: modelId === "claude-fable-5-2" ? "2026-11-10" : "2026-09-23",
734
752
  })),
735
753
  ),
736
754
  ...[