@bitkyc08/opencodex 2.92.0 → 2.93.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/bin/ocx.mjs +10 -5
  2. package/gui/dist/assets/{App-sUf_8afJ.js → App-CizjBqyk.js} +18 -18
  3. package/gui/dist/assets/{Tray-BSsxznDm.js → Tray-DamiMqcX.js} +1 -1
  4. package/gui/dist/assets/{index-BlFE_VB_.js → index-DQsht3vH.js} +12 -12
  5. package/gui/dist/assets/index-DRe8Hhfz.css +1 -0
  6. package/gui/dist/assets/{quota-summary-BRlbXgw0.js → quota-summary-BXu4zE8H.js} +1 -1
  7. package/gui/dist/index.html +2 -2
  8. package/package.json +5 -5
  9. package/src/adapters/anthropic.ts +28 -5
  10. package/src/adapters/coding-agent/batch-dispatcher.ts +122 -0
  11. package/src/adapters/coding-agent/profile.ts +54 -16
  12. package/src/adapters/coding-agent/turn.ts +30 -2
  13. package/src/adapters/command-code.ts +114 -7
  14. package/src/adapters/cursor/native-exec-fs.ts +11 -9
  15. package/src/adapters/devin/live-models.ts +4 -0
  16. package/src/adapters/google-wire-compiler.ts +1 -2
  17. package/src/adapters/kiro/reasoning.ts +2 -0
  18. package/src/adapters/kiro-refusal.ts +6 -1
  19. package/src/adapters/kiro-wire.ts +1 -1
  20. package/src/adapters/openai-chat/messages.ts +8 -2
  21. package/src/adapters/openai-chat/passthrough.ts +35 -14
  22. package/src/adapters/openai-chat/reasoning-replay.ts +27 -16
  23. package/src/adapters/openai-chat/reasoning-wire.ts +117 -8
  24. package/src/adapters/openai-chat/required-tool-result.ts +64 -0
  25. package/src/adapters/openai-chat.ts +7 -8
  26. package/src/adapters/openai-responses/passthrough.ts +7 -4
  27. package/src/adapters/openai-responses/reasoning.ts +13 -0
  28. package/src/adapters/openai-responses/request-strips.ts +1 -1
  29. package/src/adapters/qoder/adapter.ts +129 -8
  30. package/src/adapters/qoder/scaffold-guard.ts +5 -0
  31. package/src/adapters/reasoning-controls.ts +16 -0
  32. package/src/adapters/tool-call-id.ts +1 -3
  33. package/src/bridge/errors.ts +27 -0
  34. package/src/bridge.ts +1 -1
  35. package/src/chat/inbound.ts +4 -1
  36. package/src/chat/outbound.ts +9 -2
  37. package/src/chat/reasoning-details.ts +28 -5
  38. package/src/claude/desktop-first-party.ts +54 -4
  39. package/src/claude/desktop-picker.ts +11 -8
  40. package/src/claude/first-party-settings.ts +3 -1
  41. package/src/claude/inbound.ts +2 -1
  42. package/src/claude/intercept/local-ca.ts +2 -1
  43. package/src/claude/intercept/picker-ca-cleanup.ts +4 -2
  44. package/src/claude/intercept/picker-ca-startup.ts +3 -1
  45. package/src/claude/intercept/picker-models.ts +6 -3
  46. package/src/claude/intercept/picker-runtime.ts +3 -2
  47. package/src/claude/intercept/runtime.ts +6 -3
  48. package/src/claude/model-info.ts +31 -8
  49. package/src/cli/account-api.ts +11 -0
  50. package/src/cli/capabilities-agents-routing.ts +2 -2
  51. package/src/cli/capabilities-base.ts +7 -1
  52. package/src/cli/capabilities-observe-system.ts +10 -0
  53. package/src/cli/claude-desktop.ts +9 -8
  54. package/src/cli/claude.ts +3 -2
  55. package/src/cli/codex-shim-autorestore.ts +9 -0
  56. package/src/cli/combo-result.ts +7 -0
  57. package/src/cli/combo.ts +18 -0
  58. package/src/cli/cross-home-owner.ts +13 -1
  59. package/src/cli/dispatch.ts +25 -6
  60. package/src/cli/ensure-desired-integrations.ts +8 -6
  61. package/src/cli/export-command.ts +4 -1
  62. package/src/cli/help.ts +2 -1
  63. package/src/cli/index.ts +45 -45
  64. package/src/cli/integration-plan-dto.ts +4 -0
  65. package/src/cli/opencode.ts +20 -9
  66. package/src/cli/registry.ts +6 -4
  67. package/src/cli/root.ts +9 -0
  68. package/src/cli/status.ts +59 -1
  69. package/src/cli/stop-restore.ts +113 -0
  70. package/src/cli/sync-expectation.ts +60 -0
  71. package/src/cli/uninstall-integrations.ts +41 -7
  72. package/src/client/connect.ts +40 -3
  73. package/src/client/link-home.ts +10 -1
  74. package/src/client/machine-api.ts +3 -1
  75. package/src/client/sync-expectation.ts +118 -0
  76. package/src/clients/config-export/agent-clients.ts +96 -0
  77. package/src/clients/config-export/contracts.ts +25 -7
  78. package/src/clients/config-export/qoder.ts +38 -23
  79. package/src/clients/config-export/reasoning-metadata.ts +55 -8
  80. package/src/clients/config-export.ts +12 -0
  81. package/src/clients/lazycodex.ts +7 -2
  82. package/src/clients/reasoning-controls.ts +49 -0
  83. package/src/codex/auth-api/account-identity.ts +14 -0
  84. package/src/codex/auth-api/account-list.ts +29 -2
  85. package/src/codex/auth-api/http.ts +13 -0
  86. package/src/codex/auth-api/main-account-probe.ts +2 -2
  87. package/src/codex/auth-api/pool-mode-gate.ts +16 -3
  88. package/src/codex/auth-api/pool-quota-probe.ts +15 -0
  89. package/src/codex/auth-context.ts +15 -12
  90. package/src/codex/catalog/build-entries.ts +22 -0
  91. package/src/codex/catalog/configured-tiers.ts +70 -0
  92. package/src/codex/catalog/effort.ts +44 -10
  93. package/src/codex/catalog/gather-capture.ts +1 -0
  94. package/src/codex/catalog/heal-observation.ts +155 -13
  95. package/src/codex/catalog/metadata.ts +6 -0
  96. package/src/codex/catalog/model-hints.ts +60 -11
  97. package/src/codex/catalog/model-visibility.ts +3 -2
  98. package/src/codex/catalog/native-models.ts +18 -3
  99. package/src/codex/catalog/parsing.ts +10 -8
  100. package/src/codex/catalog/pinned-models.ts +2 -1
  101. package/src/codex/catalog/provider-models.ts +4 -5
  102. package/src/codex/catalog/retained-sync.ts +2 -1
  103. package/src/codex/catalog/routed-gather.ts +19 -20
  104. package/src/codex/catalog/write-audit.ts +3 -2
  105. package/src/codex/catalog-self-heal.ts +43 -23
  106. package/src/codex/collision-identity.ts +30 -5
  107. package/src/codex/convergence.ts +4 -3
  108. package/src/codex/data/roster-pinned-models.json +177 -1
  109. package/src/codex/desired-state.ts +6 -1
  110. package/src/codex/desktop-compatibility/installed-build.ts +88 -12
  111. package/src/codex/desktop-compatibility/runtime.ts +29 -5
  112. package/src/codex/desktop-compatibility/usage-controller.ts +2 -0
  113. package/src/codex/desktop-compatibility/windows-certificate-trust.ts +46 -12
  114. package/src/codex/inject/config-toml.ts +0 -18
  115. package/src/codex/inject/plan.ts +18 -3
  116. package/src/codex/inject/remove.ts +6 -2
  117. package/src/codex/inject.ts +1 -1
  118. package/src/codex/journal.ts +61 -1
  119. package/src/codex/model-entitlements.ts +1 -1
  120. package/src/codex/native-main-owner.ts +27 -1
  121. package/src/codex/native-profile-store.ts +2 -1
  122. package/src/codex/pool-credit-policy.ts +35 -1
  123. package/src/codex/quota-types.ts +3 -0
  124. package/src/codex/quota.ts +24 -4
  125. package/src/codex/role-auto-assign.ts +6 -2
  126. package/src/codex/subagent-defaults.ts +49 -4
  127. package/src/combos/failover.ts +17 -2
  128. package/src/combos/jev-decision-contract.ts +22 -1
  129. package/src/combos/jev-service-exchange.ts +3 -1
  130. package/src/combos/jev.ts +95 -9
  131. package/src/combos/resolve.ts +45 -1
  132. package/src/combos/types.ts +24 -0
  133. package/src/config/load-degrade.ts +5 -0
  134. package/src/config/paths.ts +19 -3
  135. package/src/config/pending-teardown.ts +22 -1
  136. package/src/config/provider-validation.ts +15 -4
  137. package/src/config/removed-opencode-free.ts +11 -0
  138. package/src/config/schema/leaf-validators.ts +5 -0
  139. package/src/generated/compatibility-version.json +314 -230
  140. package/src/generated/model-metadata.ts +5 -5
  141. package/src/images/loop.ts +16 -2
  142. package/src/integrations/catalog-refresh.ts +1 -1
  143. package/src/integrations/hermes-profiles.ts +251 -0
  144. package/src/integrations/merge.ts +8 -0
  145. package/src/integrations/mutation-plan.ts +19 -4
  146. package/src/integrations/registry.ts +5 -0
  147. package/src/integrations/state.ts +36 -1
  148. package/src/integrations/writer.ts +18 -4
  149. package/src/lib/bun-path-runtime.mjs +2 -1
  150. package/src/lib/errors.ts +62 -0
  151. package/src/lib/eventstream-decoder.ts +81 -37
  152. package/src/lib/opaque-proxy-tunnel.ts +32 -8
  153. package/src/lib/pinned-http.ts +35 -2
  154. package/src/lib/process-control.ts +13 -1
  155. package/src/lib/socks5-fetch.ts +59 -64
  156. package/src/lib/socks5-upload-waiter.ts +50 -0
  157. package/src/lib/sse-decoder.ts +7 -2
  158. package/src/lib/state-store-sweeper.ts +40 -14
  159. package/src/lib/windows-native-principal-worker.ts +14 -0
  160. package/src/lib/windows-native-principal.ts +188 -0
  161. package/src/lib/windows-secret-acl.ts +39 -3
  162. package/src/lib/windows-user-principal.ts +62 -18
  163. package/src/link/ssh-config.ts +35 -3
  164. package/src/providers/account-quota-disk.ts +12 -4
  165. package/src/providers/codebuddy-models.ts +6 -0
  166. package/src/providers/codex-capacity.ts +3 -1
  167. package/src/providers/derive.ts +28 -0
  168. package/src/providers/kiro-models.ts +3 -0
  169. package/src/providers/mimo-thinking.ts +12 -0
  170. package/src/providers/model-rename-fields.ts +1 -0
  171. package/src/providers/model-rename-migration.ts +10 -0
  172. package/src/providers/openai-sidecar-credit.ts +2 -2
  173. package/src/providers/reasoning-capabilities.ts +76 -0
  174. package/src/providers/registry/entries-core.ts +14 -12
  175. package/src/providers/registry/entries-extended.ts +63 -20
  176. package/src/providers/registry/model-ids.ts +2 -0
  177. package/src/providers/registry/model-seeds.ts +93 -28
  178. package/src/providers/registry/types.ts +10 -1
  179. package/src/providers/resolved-model-policy.ts +26 -6
  180. package/src/providers/routed-config.ts +9 -1
  181. package/src/providers/stale-model-roster-migration.ts +44 -7
  182. package/src/remote-control/workspace-pi-runtime.ts +11 -6
  183. package/src/responses/compaction-summary.ts +45 -0
  184. package/src/responses/muse-tool-name-alias.ts +1 -2
  185. package/src/responses/parser.ts +3 -2
  186. package/src/responses/schema.ts +1 -0
  187. package/src/responses/thought-signature-replay.ts +10 -2
  188. package/src/routing/capability.ts +8 -2
  189. package/src/routing/history/ingest.ts +28 -3
  190. package/src/server/auth-cors.ts +3 -2
  191. package/src/server/chat-completions.ts +7 -0
  192. package/src/server/chat-native-eligibility.ts +7 -0
  193. package/src/server/chat-native-reasoning.ts +14 -4
  194. package/src/server/direct-local-http.ts +5 -2
  195. package/src/server/effort-policy.ts +5 -1
  196. package/src/server/index/live-sideband.ts +18 -15
  197. package/src/server/index/serve-options.ts +5 -4
  198. package/src/server/management/agent-settings-routes.ts +27 -15
  199. package/src/server/management/combo-routes.ts +4 -0
  200. package/src/server/management/config-routes.ts +2 -2
  201. package/src/server/management/decision-discovery.ts +12 -2
  202. package/src/server/management/hermes-profile-routes.ts +156 -0
  203. package/src/server/management/integration-routes.ts +85 -24
  204. package/src/server/management/model-routes.ts +2 -2
  205. package/src/server/management/model-row-export-metadata.ts +25 -6
  206. package/src/server/management/model-rows.ts +15 -20
  207. package/src/server/management/native-integration-routes.ts +11 -8
  208. package/src/server/management/route-registry.ts +4 -0
  209. package/src/server/management-api.ts +5 -0
  210. package/src/server/models-capabilities.ts +21 -3
  211. package/src/server/responses/adapter-delivery.ts +11 -1
  212. package/src/server/responses/adapter-dispatch.ts +2 -2
  213. package/src/server/responses/codex-ws-exchange.ts +39 -9
  214. package/src/server/responses/codex-ws-session.ts +38 -4
  215. package/src/server/responses/codex-ws-wire.ts +6 -1
  216. package/src/server/responses/combo-required-tool-contract.ts +103 -0
  217. package/src/server/responses/combo-stream-preflight.ts +8 -1
  218. package/src/server/responses/compact.ts +4 -3
  219. package/src/server/responses/context-overflow.ts +8 -1
  220. package/src/server/responses/core-combo-failure.ts +10 -0
  221. package/src/server/responses/core-combo.ts +23 -15
  222. package/src/server/responses/core-lifetime.ts +3 -0
  223. package/src/server/responses/core-normalize.ts +11 -1
  224. package/src/server/responses/core-options.ts +2 -0
  225. package/src/server/responses/main-hard-lock-routing.ts +60 -44
  226. package/src/server/responses/passthrough-delivery.ts +40 -2
  227. package/src/server/responses/policy-fallback.ts +6 -1
  228. package/src/server/responses/request-compression.ts +12 -7
  229. package/src/server/responses/request-prepare.ts +22 -2
  230. package/src/server/responses/request-sidecar-auth.ts +2 -0
  231. package/src/server/responses/response-effects.ts +22 -10
  232. package/src/server/responses/sidecar-execution.ts +11 -3
  233. package/src/server/stop-teardown.ts +36 -1
  234. package/src/server/ws-bridge.ts +1 -1
  235. package/src/service/desktop-supervision.d.mts +7 -4
  236. package/src/service/desktop-supervision.mjs +90 -13
  237. package/src/service/ownership-mutation-lease.mjs +21 -7
  238. package/src/types/config.ts +8 -2
  239. package/src/types/provider.ts +20 -6
  240. package/src/types/request.ts +10 -0
  241. package/src/types.ts +1 -0
  242. package/src/update/bind-probe.ts +29 -0
  243. package/src/update/job.ts +10 -29
  244. package/src/update/npm-install-job.ps1 +173 -0
  245. package/src/update/npm-install.mjs +70 -0
  246. package/src/update/stop-contract.d.mts +1 -0
  247. package/src/update/stop-contract.mjs +14 -0
  248. package/src/update/stop-decision.d.mts +1 -1
  249. package/src/update/stop-decision.mjs +13 -3
  250. package/src/update/teardown-handover.ts +166 -0
  251. package/src/update/transactional-install.d.mts +14 -3
  252. package/src/update/transactional-install.mjs +33 -7
  253. package/src/usage/expected-prices.ts +64 -31
  254. package/src/usage/timeline.ts +19 -9
  255. package/src/vision/eligibility.ts +15 -5
  256. package/src/vision/plan.ts +2 -2
  257. package/src/web-search/loop.ts +16 -2
  258. package/gui/dist/assets/index-DPeB9HpV.css +0 -1
@@ -1,4 +1,5 @@
1
- import { closeSync, constants, fstatSync, lstatSync, openSync, readSync, realpathSync, type Stats } from "node:fs";
1
+ import { closeSync, constants, fstatSync, lstatSync, openSync, readlinkSync, readSync, realpathSync, statSync, type BigIntStats } from "node:fs";
2
+ import { basename, dirname, isAbsolute, join, parse, resolve } from "node:path";
2
3
  import { readCodexHomeJournal } from "../codex-home-owner";
3
4
  import { samePath, type RawCatalog } from "./parsing";
4
5
 
@@ -9,10 +10,151 @@ export interface CatalogObservation {
9
10
  readonly catalog: RawCatalog | null;
10
11
  }
11
12
 
12
- /** Canonical path equality when available; unavailable paths retain lexical equality. */
13
+ export type CatalogHealPathComparison = "same" | "different" | "unknown";
14
+ export const CATALOG_HEAL_MAX_LINKS = 40;
15
+ // Small catalog-path comparisons need only a handful of reads; unusual paths defer.
16
+ export const CATALOG_HEAL_MAX_PATH_READS = 64;
17
+ type PathRead = <T>(read: () => T) => T;
18
+ type LinkObservation = { path: string; stat: BigIntStats; value: string; parent: string; parentStat: BigIntStats; resolved?: string; resolvedStat?: BigIntStats };
19
+ type PathObservation = {
20
+ kind: "native" | "hardlink"; path: string; stat: BigIntStats; links: LinkObservation[];
21
+ canonical: string; parent: string; parentStat: BigIntStats;
22
+ } | { kind: "unavailable"; hardlink: boolean };
23
+
24
+ function unchanged(before: BigIntStats, after: BigIntStats): boolean {
25
+ return before.dev === after.dev && before.ino === after.ino && before.mode === after.mode
26
+ && before.nlink === after.nlink && before.size === after.size
27
+ && before.mtimeNs === after.mtimeNs && before.ctimeNs === after.ctimeNs;
28
+ }
29
+
30
+ /** Windows normalizes ".." lexically across reparse points; POSIX resolves each component. */
31
+ function resolveLinkTarget(base: string, value: string, read: PathRead, links: LinkObservation[]): string {
32
+ if (process.platform === "win32") return resolve(base, value);
33
+ let current = base;
34
+ if (isAbsolute(value)) current = parse(value).root;
35
+ const segments = (isAbsolute(value) ? value.slice(parse(value).root.length) : value).split("/");
36
+ for (let index = 0; index < segments.length; index += 1) {
37
+ const segment = segments[index];
38
+ if (segment === "" || segment === ".") continue;
39
+ if (segment === "..") { current = dirname(current); continue; }
40
+ const next = join(current, segment);
41
+ if (index === segments.length - 1) return next;
42
+ const stat = read(() => lstatSync(next, { bigint: true }));
43
+ if (stat.isSymbolicLink()) {
44
+ // Keep the intermediate link inside the same revalidation snapshot as leaf hops.
45
+ const parent = current, parentStat = read(() => statSync(parent, { bigint: true })), target = read(() => readlinkSync(next));
46
+ const resolvedStat = read(() => statSync(next, { bigint: true }));
47
+ // POSIX refuses ".." across a non-directory; statSync follows the link.
48
+ if (!resolvedStat.isDirectory()) throw new Error("Link target crosses a non-directory");
49
+ const resolved = read(() => realpathSync.native(next));
50
+ links.push({ path: next, stat, value: target, parent, parentStat, resolved, resolvedStat });
51
+ current = resolved;
52
+ }
53
+ else if (stat.isDirectory()) current = next;
54
+ else throw new Error("Link target crosses a non-directory");
55
+ }
56
+ return current;
57
+ }
58
+
59
+ /** @internal Path observation seam; production callers supply the fixed read budget below. */
60
+ export function inspectHealPath(path: string, read: PathRead): PathObservation {
61
+ let hardlink = false;
62
+ let observedEntry = false;
63
+ const links: LinkObservation[] = [];
64
+ try {
65
+ for (let count = 0; count < CATALOG_HEAL_MAX_LINKS; count += 1) {
66
+ const stat = read(() => lstatSync(path, { bigint: true }));
67
+ observedEntry = true;
68
+ if (stat.isSymbolicLink()) {
69
+ const parent = dirname(path), parentStat = read(() => statSync(parent, { bigint: true })), value = read(() => readlinkSync(path));
70
+ links.push({ path, stat, value, parent, parentStat });
71
+ path = resolveLinkTarget(read(() => realpathSync.native(parent)), value, read, links);
72
+ continue;
73
+ }
74
+ // Keep native leaf aliases outside the macOS multi-link FD-name bug.
75
+ hardlink = process.platform === "darwin" && stat.isFile() && stat.nlink > 1n;
76
+ const parent = read(() => realpathSync.native(dirname(path))), parentStat = read(() => statSync(parent, { bigint: true }));
77
+ if (!parentStat.isDirectory() || !unchanged(parentStat, read(() => statSync(dirname(path), { bigint: true })))) throw new Error("Changed parent");
78
+ return { kind: hardlink ? "hardlink" : "native", path, stat, links, parent, parentStat,
79
+ canonical: hardlink ? join(parent, basename(path)) : read(() => realpathSync.native(path)) };
80
+ }
81
+ // Hop exhaustion requires identity evidence; it must never fall back to lexical comparison.
82
+ return { kind: "unavailable", hardlink: true };
83
+ } catch { /* Observed entry evidence cannot fall back to lexical identity after a failed lookup. */ }
84
+ return { kind: "unavailable", hardlink: hardlink || observedEntry };
85
+ }
86
+
87
+ function revalidateHealPath(seen: Exclude<PathObservation, { kind: "unavailable" }>, read: PathRead): boolean {
88
+ if (!unchanged(seen.stat, read(() => lstatSync(seen.path, { bigint: true })))) return false;
89
+ for (const link of seen.links) {
90
+ if (!unchanged(link.stat, read(() => lstatSync(link.path, { bigint: true }))) || read(() => readlinkSync(link.path)) !== link.value
91
+ || !unchanged(link.parentStat, read(() => statSync(link.parent, { bigint: true })))) return false;
92
+ const resolved = link.resolved, resolvedStat = link.resolvedStat;
93
+ if (resolved !== undefined && resolvedStat !== undefined
94
+ && !unchanged(resolvedStat, read(() => statSync(resolved, { bigint: true })))) return false;
95
+ }
96
+ return unchanged(seen.parentStat, read(() => statSync(seen.parent, { bigint: true })))
97
+ && unchanged(seen.parentStat, read(() => statSync(dirname(seen.path), { bigint: true })));
98
+ }
99
+
100
+ /** Retain publication entry/link/parent evidence across its catalog read, within one budget. */
101
+ export function retainCatalogHealPath(path: string): (signature: string) => boolean {
102
+ let reads = 0;
103
+ const read: PathRead = fn => {
104
+ if (reads++ >= CATALOG_HEAL_MAX_PATH_READS) throw new Error("Catalog path read limit reached");
105
+ return fn();
106
+ };
107
+ const seen = inspectHealPath(path, read);
108
+ return observedSignature => {
109
+ try {
110
+ return seen.kind !== "unavailable" && signature(seen.stat) === observedSignature && revalidateHealPath(seen, read);
111
+ } catch { return false; }
112
+ };
113
+ }
114
+
115
+ /** Entry uncertainty is distinct from a proven different path, especially for releases. */
116
+ export function compareCatalogHealPaths(left: string, right: string): CatalogHealPathComparison {
117
+ let reads = 0, exhausted = false;
118
+ const read: PathRead = fn => {
119
+ if (reads >= CATALOG_HEAL_MAX_PATH_READS) { exhausted = true; throw new Error("Catalog path read limit reached"); }
120
+ reads += 1;
121
+ return fn();
122
+ };
123
+ const a = inspectHealPath(left, read), b = inspectHealPath(right, read);
124
+ if (exhausted) return "unknown";
125
+ const needsEntry = a.kind === "hardlink" || b.kind === "hardlink"
126
+ || (a.kind === "unavailable" && a.hardlink) || (b.kind === "unavailable" && b.hardlink);
127
+ if (!needsEntry) {
128
+ if (a.kind === "unavailable" || b.kind === "unavailable") {
129
+ try {
130
+ if ((a.kind !== "unavailable" && !revalidateHealPath(a, read))
131
+ || (b.kind !== "unavailable" && !revalidateHealPath(b, read))) return "unknown";
132
+ return samePath(left, right) ? "same" : "different";
133
+ } catch { return "unknown"; }
134
+ }
135
+ const result = samePath(a.canonical, b.canonical) ? "same" : "different";
136
+ // Native normalization must not hide changed entries, links or parents on any platform.
137
+ try {
138
+ return revalidateHealPath(a, read) && revalidateHealPath(b, read) ? result : "unknown";
139
+ } catch { return "unknown"; }
140
+ }
141
+ if (a.kind === "unavailable" || b.kind === "unavailable") return "unknown";
142
+ try {
143
+ let result: CatalogHealPathComparison = "unknown";
144
+ if (a.stat.dev !== b.stat.dev || a.stat.ino !== b.stat.ino) result = "different";
145
+ else if (a.kind === "hardlink" && b.kind === "hardlink") {
146
+ if (a.parentStat.dev !== b.parentStat.dev || a.parentStat.ino !== b.parentStat.ino) result = "different";
147
+ else if (basename(a.path) === basename(b.path)) result = "same";
148
+ // Bun 1.4.3 opendir/Glob eagerly enumerate the whole directory. Without a
149
+ // bounded entry-name primitive, aliases and sibling hardlinks stay unknown.
150
+ }
151
+ return revalidateHealPath(a, read) && revalidateHealPath(b, read) ? result : "unknown";
152
+ } catch { return "unknown"; }
153
+ }
154
+
155
+ /** Admission-style convenience; release consumers must retain the unknown result. */
13
156
  export function sameCatalogHealPath(left: string, right: string): boolean {
14
- try { return samePath(realpathSync.native(left), realpathSync.native(right)); }
15
- catch { return samePath(left, right); }
157
+ return compareCatalogHealPaths(left, right) === "same";
16
158
  }
17
159
 
18
160
  /** Resolve authority without reading catalog bytes or cleaning journal evidence. */
@@ -32,29 +174,29 @@ export function selectCatalogHealPath(
32
174
  catch { return null; }
33
175
  }
34
176
 
35
- function signature(stat: Stats): string {
36
- return `${stat.dev}:${stat.ino}:${stat.size}:${stat.mtimeMs}:${stat.ctimeMs}`;
177
+ function signature(stat: BigIntStats): string {
178
+ return `${stat.dev}:${stat.ino}:${stat.size}:${stat.mtimeNs}:${stat.ctimeNs}`;
37
179
  }
38
180
 
39
181
  /** Bounded regular descriptor reads; never open a FIFO/device or follow a replaced symlink. */
40
182
  export function observeCatalogHealFile(path: string, readContent: boolean): CatalogObservation | null {
41
183
  let fd: number | undefined;
42
184
  try {
43
- const before = lstatSync(path);
44
- if (!before.isFile() || before.size > CATALOG_HEAL_MAX_BYTES) return null;
185
+ const before = lstatSync(path, { bigint: true });
186
+ if (!before.isFile() || before.size > BigInt(CATALOG_HEAL_MAX_BYTES)) return null;
45
187
  if (!readContent) return { signature: signature(before), catalog: null };
46
188
  fd = openSync(path, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0) | (constants.O_NONBLOCK ?? 0));
47
- const opened = fstatSync(fd);
48
- if (!opened.isFile() || opened.size > CATALOG_HEAL_MAX_BYTES || signature(before) !== signature(opened)) return null;
49
- const bytes = Buffer.alloc(opened.size + 1);
189
+ const opened = fstatSync(fd, { bigint: true });
190
+ if (!opened.isFile() || opened.size > BigInt(CATALOG_HEAL_MAX_BYTES) || signature(before) !== signature(opened)) return null;
191
+ const bytes = Buffer.alloc(Number(opened.size) + 1);
50
192
  let length = 0;
51
193
  while (length < bytes.length) {
52
194
  const count = readSync(fd, bytes, length, bytes.length - length, null);
53
195
  if (count === 0) break;
54
196
  length += count;
55
197
  }
56
- if (length !== opened.size || signature(fstatSync(fd)) !== signature(opened)
57
- || signature(lstatSync(path)) !== signature(opened)) return null;
198
+ if (length !== Number(opened.size) || signature(fstatSync(fd, { bigint: true })) !== signature(opened)
199
+ || signature(lstatSync(path, { bigint: true })) !== signature(opened)) return null;
58
200
  let catalog: RawCatalog | null = null;
59
201
  try {
60
202
  const value: unknown = JSON.parse(bytes.subarray(0, length).toString("utf8"));
@@ -44,12 +44,14 @@ import {
44
44
  ACCOUNT_GATED_NATIVE_OPENAI_MODELS,
45
45
  NATIVE_GPT6_CONTEXT,
46
46
  NATIVE_GPT61_SOL_CONTEXT,
47
+ NATIVE_GPT61_TERRA_CONTEXT,
47
48
  NATIVE_DAYBREAK_BLUE_MODEL,
48
49
  NATIVE_GPT6_ASTRA_MINOR_MODEL,
49
50
  NATIVE_GPT6_ASTRA_MODEL,
50
51
  NATIVE_GPT6_LUNA_MODEL,
51
52
  NATIVE_GPT6_SOL_MODEL,
52
53
  NATIVE_GPT61_SOL_MODEL,
54
+ NATIVE_GPT61_TERRA_MODEL,
53
55
  NATIVE_RESERVE_MODEL,
54
56
  NATIVE_OPENAI_CAPABILITY_ALIAS_MODELS,
55
57
  NATIVE_OPENAI_MODELS,
@@ -76,6 +78,7 @@ export {
76
78
  NATIVE_GPT6_LUNA_MODEL,
77
79
  NATIVE_GPT6_SOL_MODEL,
78
80
  NATIVE_GPT61_SOL_MODEL,
81
+ NATIVE_GPT61_TERRA_MODEL,
79
82
  NATIVE_OPENAI_CAPABILITY_ALIAS_MODELS,
80
83
  NATIVE_OPENAI_MODELS,
81
84
  SELF_DESCRIBED_NATIVE_OPENAI_MODELS,
@@ -97,6 +100,8 @@ export const DOCUMENTED_NATIVE_OPENAI_ADDITIONS = [
97
100
  NATIVE_GPT6_SOL_MODEL, NATIVE_GPT6_LUNA_MODEL,
98
101
  // GPT-6.1 Sol needs client_version >= 0.153.0 upstream; older installed catalogs lack it.
99
102
  NATIVE_GPT61_SOL_MODEL,
103
+ // Terra's pinned row has the same client floor and backfills older installed catalogs too.
104
+ NATIVE_GPT61_TERRA_MODEL,
100
105
  ];
101
106
 
102
107
  export function configuredNativeAliasSlugs(
@@ -207,6 +212,7 @@ export const NATIVE_OPENAI_CONTEXT_OVERRIDES: Record<string, { contextWindow?: n
207
212
  // GPT-6.1 Sol's row (openai/codex models.json after #49318) ships 272,000 / 872,000, but OpenAI
208
213
  // raised its Codex & Work default to 500,000 on 2026-10-11; the 872,000 ceiling is unchanged.
209
214
  [NATIVE_GPT61_SOL_MODEL]: { ...NATIVE_GPT61_SOL_CONTEXT },
215
+ [NATIVE_GPT61_TERRA_MODEL]: { ...NATIVE_GPT61_TERRA_CONTEXT },
210
216
  // Astra Minor borrows Astra's row, so it inherits Astra's numbers. No account we hold can reach
211
217
  // it, so this is inheritance, not a measurement.
212
218
  [NATIVE_GPT6_ASTRA_MINOR_MODEL]: { ...NATIVE_GPT6_CONTEXT },
@@ -1,7 +1,7 @@
1
1
  import { canInferVendorContext, vendorContextInference } from "./vendor-context";
2
2
  import { effectiveProviderAlias, effectiveProviderAliasDecision } from "../../providers/default-aliases";
3
3
  import { initialModelSelectionPending } from "../../providers/initial-model-selection";
4
- import { supportsConfiguredUltraFast } from "./configured-tiers";
4
+ import { supportsConfiguredFlex, supportsConfiguredUltraFast } from "./configured-tiers";
5
5
  import { execFileSync } from "node:child_process";
6
6
  import { createHash, createHmac, randomBytes } from "node:crypto";
7
7
  import { copyFileSync, existsSync, mkdirSync, readFileSync, realpathSync } from "node:fs";
@@ -34,6 +34,7 @@ import {
34
34
  } from "../../oauth";
35
35
  import type { OcxConfig, OcxProviderConfig } from "../../types";
36
36
  import { modelInList } from "../../types";
37
+ import { declaredModelCapabilities, REASONING_CAPABILITY_FIELDS } from "../../providers/reasoning-capabilities";
37
38
  import { CODEX_REASONING_LEVELS, codexEffortRank, configuredReasoningEfforts, modelRecordValue, sanitizeCodexReasoningEfforts } from "../../reasoning-effort";
38
39
  import { isModelVisionSidecarConsumer } from "../../vision/eligibility";
39
40
  import { getModelMetadata, getModelMetadataCaseInsensitive, listModelMetadata, resolveMetadataProvider, type ModelMetadata } from "../../generated/model-metadata";
@@ -260,7 +261,17 @@ export function withVisionSidecarInput(
260
261
  ): CatalogModel {
261
262
  if (!enabled || !provider || !isModelVisionSidecarConsumer(provider, model.id)) return model;
262
263
  const modalities = model.inputModalities ?? ["text"];
263
- return modalities.includes("image") ? model : { ...model, inputModalities: [...modalities, "image"] };
264
+ return modalities.includes("image") ? model
265
+ : copyReasoningHintSource(model, { ...model, inputModalities: [...modalities, "image"] });
266
+ }
267
+
268
+ const reasoningHintSources = new WeakMap<CatalogModel, Partial<CatalogModel>>();
269
+
270
+ /** Forward discovery provenance only across transparent clones, never custom reasoning overrides. */
271
+ export function copyReasoningHintSource(source: CatalogModel, clone: CatalogModel): CatalogModel {
272
+ const reasoningSource = reasoningHintSources.get(source);
273
+ if (reasoningSource) reasoningHintSources.set(clone, reasoningSource);
274
+ return clone;
264
275
  }
265
276
 
266
277
  /** Reapply configured limits and captured wire capabilities without trusting stale discovery hints. */
@@ -302,10 +313,25 @@ export function applyProviderConfigHints(
302
313
  const resolvedModalities = staticPolicy.model.inputModalities ?? model.inputModalities
303
314
  ?? (azureMetadata?.input ? modelInputModalities({ id: model.id, input_modalities: azureMetadata.input }, undefined) : undefined);
304
315
  const inputModalities = resolvedModalities ? [...resolvedModalities] : undefined;
305
- const reasoningEfforts = configuredReasoningEfforts(prov, model.id);
316
+ const reasoningSource = reasoningHintSources.get(model) ?? model;
317
+ const declaredCapabilities = declaredModelCapabilities(prov.modelCapabilities, model.id);
318
+ const reasoningCapabilities: Partial<CatalogModel> = {};
319
+ for (const field of REASONING_CAPABILITY_FIELDS) {
320
+ const value = modelInList(prov.noReasoningModels, model.id) ? staticPolicy.model[field]
321
+ : declaredCapabilities?.[field] ?? reasoningSource[field] ?? staticPolicy.model[field];
322
+ if (typeof value === "boolean") reasoningCapabilities[field] = value;
323
+ }
324
+ if (reasoningCapabilities.supportsReasoning === false) {
325
+ reasoningCapabilities.supportsThinkingToggle = false;
326
+ reasoningCapabilities.supportsReasoningEffort = false;
327
+ reasoningCapabilities.defaultThinkingEnabled = false;
328
+ }
329
+ const reasoningEfforts = reasoningCapabilities.supportsReasoningEffort === false ? []
330
+ : configuredReasoningEfforts(prov, model.id) ?? reasoningSource.reasoningEfforts;
306
331
  const suppressSyntheticMax = modelRecordValue(prov.modelSuppressSyntheticMax, model.id)
307
332
  ?? (model.antigravityEffortWireModelIds !== undefined);
308
- const defaultReasoningEffort = staticPolicy.model.defaultReasoningEffort ?? model.defaultReasoningEffort;
333
+ const defaultReasoningEffort = reasoningCapabilities.supportsReasoningEffort === false ? undefined
334
+ : staticPolicy.model.defaultReasoningEffort ?? reasoningSource.defaultReasoningEffort;
309
335
  const supportsReasoningSummaries = staticPolicy.model.supportsReasoningSummaries;
310
336
  const supportsVerbosity = staticPolicy.model.supportsVerbosity;
311
337
  const fastPolicy = fastPolicyForModel(prov, model.id, name);
@@ -319,9 +345,16 @@ export function applyProviderConfigHints(
319
345
  contextCapped: previousContextCapped,
320
346
  supportsServiceTier: _staleServiceTier,
321
347
  supportsUltraFastTier: _staleUltraFastTier,
348
+ supportsFlexTier: _staleFlexTier,
322
349
  fastTierDescription: _staleFastTierDescription,
323
350
  providerAlias: _staleProviderAlias,
324
351
  suppressSyntheticMax: _staleSuppressSyntheticMax,
352
+ supportsReasoning: _staleSupportsReasoning,
353
+ supportsThinkingToggle: _staleThinkingToggle,
354
+ supportsReasoningEffort: _staleReasoningEffort,
355
+ defaultThinkingEnabled: _staleDefaultThinking,
356
+ reasoningEfforts: _staleReasoningEfforts,
357
+ defaultReasoningEffort: _staleDefaultEffort,
325
358
  ...modelWithoutServiceTier
326
359
  } = model;
327
360
  // 已发现窗口只允许被配置值压低;缺窗口时,已开的 Context cap 就是实际窗口。
@@ -355,11 +388,13 @@ export function applyProviderConfigHints(
355
388
  }
356
389
  : {}),
357
390
  ...(maxOutputTokens !== undefined ? { maxOutputTokens } : {}),
391
+ ...reasoningCapabilities,
358
392
  ...(defaultReasoningEffort ? { defaultReasoningEffort } : {}),
359
393
  ...(typeof supportsReasoningSummaries === "boolean" ? { supportsReasoningSummaries } : {}),
360
394
  ...(typeof supportsVerbosity === "boolean" ? { supportsVerbosity } : {}),
361
395
  ...(typeof supportsServiceTier === "boolean" ? { supportsServiceTier } : {}),
362
396
  supportsUltraFastTier: supportsConfiguredUltraFast(fastPolicy),
397
+ supportsFlexTier: supportsConfiguredFlex(fastPolicy),
363
398
  ...(supportsServiceTier === true && fastPolicy.fastTierDescription !== undefined
364
399
  ? { fastTierDescription: fastPolicy.fastTierDescription }
365
400
  : {}),
@@ -387,8 +422,7 @@ export function applyProviderConfigHints(
387
422
  : withCap;
388
423
  const softCandidates = [model.autoCompactTokenLimit, configuredAutoCompact]
389
424
  .filter((value): value is number => typeof value === "number" && value > 0);
390
- if (contextWindow === undefined || softCandidates.length === 0) return withHardBounds;
391
- return {
425
+ const result = contextWindow === undefined || softCandidates.length === 0 ? withHardBounds : {
392
426
  ...withHardBounds,
393
427
  autoCompactTokenLimit: clampAutoCompactTokenLimit(
394
428
  contextWindow,
@@ -396,6 +430,10 @@ export function applyProviderConfigHints(
396
430
  Math.min(...softCandidates),
397
431
  ),
398
432
  };
433
+ reasoningHintSources.set(result, Object.fromEntries([
434
+ ...REASONING_CAPABILITY_FIELDS, "reasoningEfforts", "defaultReasoningEffort",
435
+ ].map(field => [field, reasoningSource[field as keyof CatalogModel]])));
436
+ return result;
399
437
  }
400
438
 
401
439
  /** Project a configured row, optionally deferring sidecar attachment metadata until publication. */
@@ -468,13 +506,13 @@ export const CALLABLE_CONFIGURED_COMPATIBILITY_MODELS: Readonly<Record<string, R
468
506
  "codebuddy-cn": new Set([
469
507
  "default",
470
508
  ]),
471
- // MiniMax serves MiniMax-M3.1-Flash-Preview to Token Plan keys, but its /v1/models roster
472
- // does not list the preview (probed 2026-09-30), so a live roster would drop it.
509
+ // MiniMax serves MiniMax-M3.1-Flash to Token Plan keys, but its /v1/models roster
510
+ // does not list Flash (probed 2026-10-21), so a live roster would drop it.
473
511
  minimax: new Set([
474
- "MiniMax-M3.1-Flash-Preview",
512
+ "MiniMax-M3.1-Flash",
475
513
  ]),
476
514
  "minimax-cn": new Set([
477
- "MiniMax-M3.1-Flash-Preview",
515
+ "MiniMax-M3.1-Flash",
478
516
  ]),
479
517
  kimi: new Set([
480
518
  "k3[1m]",
@@ -695,6 +733,15 @@ export function discoveredPricingStatus(item: ProviderModelsApiItem): "free" | "
695
733
  export function catalogHintsFromModelsApiItem(providerName: string, item: ProviderModelsApiItem): Partial<CatalogModel> {
696
734
  const metadata = plainRecord(item.metadata);
697
735
  const capabilityRecord = plainRecord(metadata?.capabilities) ?? plainRecord(item.capabilities);
736
+ const reasoningCapabilities: Partial<CatalogModel> = {};
737
+ for (const [wire, field] of [
738
+ ["supports_reasoning", "supportsReasoning"],
739
+ ["supports_thinking_toggle", "supportsThinkingToggle"],
740
+ ["supports_reasoning_effort", "supportsReasoningEffort"],
741
+ ["default_thinking_enabled", "defaultThinkingEnabled"],
742
+ ] as const) {
743
+ if (typeof capabilityRecord?.[wire] === "boolean") reasoningCapabilities[field] = capabilityRecord[wire];
744
+ }
698
745
  const limits = plainRecord(metadata?.limits);
699
746
  const capabilityLimits = plainRecord(plainRecord(item.capabilities)?.limits);
700
747
  const contextWindow =
@@ -746,7 +793,8 @@ export function catalogHintsFromModelsApiItem(providerName: string, item: Provid
746
793
  ?? item.reasoning_efforts
747
794
  ?? reasoningParameters?.efforts;
748
795
  const listedReasoningEfforts = normalizedStringList(rawReasoningEfforts, 8, 24);
749
- const reasoningEfforts = listedReasoningEfforts
796
+ const reasoningEfforts = reasoningCapabilities.supportsReasoning === false || reasoningCapabilities.supportsReasoningEffort === false ? []
797
+ : listedReasoningEfforts
750
798
  ? sanitizeCodexReasoningEfforts(listedReasoningEfforts)
751
799
  : typeof rawReasoningEfforts === "boolean"
752
800
  ? (rawReasoningEfforts
@@ -764,6 +812,7 @@ export function catalogHintsFromModelsApiItem(providerName: string, item: Provid
764
812
  ...(contextWindow && contextWindow > 0 ? { contextWindow } : {}),
765
813
  ...(maxInputTokens && maxInputTokens > 0 ? { maxInputTokens } : {}),
766
814
  ...(maxOutputTokens !== undefined ? { maxOutputTokens } : {}),
815
+ ...reasoningCapabilities,
767
816
  ...(reasoningEfforts !== undefined ? { reasoningEfforts } : {}),
768
817
  ...(inputModalities ? { inputModalities } : {}),
769
818
  ...(capabilities ? { capabilities } : {}),
@@ -102,7 +102,7 @@ import type {
102
102
  CatalogSourceEvidence,
103
103
  CatalogTrustedOpenAiApiPolicySnapshot,
104
104
  } from "../convergence-types";
105
- import { CALLABLE_CONFIGURED_COMPATIBILITY_MODELS, applyProviderConfigHints } from "./model-hints";
105
+ import { CALLABLE_CONFIGURED_COMPATIBILITY_MODELS, applyProviderConfigHints, copyReasoningHintSource } from "./model-hints";
106
106
 
107
107
  const DATED_VARIANT_YYYYMMDD = /^(\d{4})(\d{2})(\d{2})$/;
108
108
  const DATED_VARIANT_YYMMDD = /^(2\d)(\d{2})(\d{2})$/;
@@ -250,7 +250,8 @@ export function mergeConfiguredModelsIntoLiveCatalog(opts: {
250
250
  if (present.has(candidate.id)) continue;
251
251
  const dated = out.find(live => isDatedVariantId(live.id, candidate.id));
252
252
  if (dated) {
253
- out.push(applyProviderConfigHints(name, prov, { ...dated, id: candidate.id }, contextCap, metadataModelIdCaseFold, undefined, metadataConfigDir, includeVisionSidecar));
253
+ const alias = copyReasoningHintSource(dated, { ...dated, id: candidate.id });
254
+ out.push(applyProviderConfigHints(name, prov, alias, contextCap, metadataModelIdCaseFold, undefined, metadataConfigDir, includeVisionSidecar));
254
255
  present.add(candidate.id);
255
256
  continue;
256
257
  }
@@ -38,8 +38,8 @@ export const NATIVE_GPT6_SOL_MODEL = "gpt-6-sol";
38
38
  export const NATIVE_GPT6_LUNA_MODEL = "gpt-6-luna";
39
39
 
40
40
  /**
41
- * GPT-6.1 Sol, announced 2026-09-29 (https://openai.com/index/introducing-gpt-6-1-sol/). Only Sol
42
- * moved to 6.1; Astra and Luna stay on GPT-6.
41
+ * GPT-6.1 Sol, announced 2026-09-29 (https://openai.com/index/introducing-gpt-6-1-sol/).
42
+ * Astra and Luna stay on GPT-6.
43
43
  *
44
44
  * SELF-DESCRIBED: its row is pinned verbatim in `src/codex/data/roster-pinned-models.json` from
45
45
  * openai/codex `codex-rs/models-manager/models.json` after #49318, which also made it the Codex
@@ -49,6 +49,14 @@ export const NATIVE_GPT6_LUNA_MODEL = "gpt-6-luna";
49
49
  */
50
50
  export const NATIVE_GPT61_SOL_MODEL = "gpt-6.1-sol";
51
51
 
52
+ /**
53
+ * GPT-6.1 Terra, announced 2026-10-26 (https://openai.com/index/introducing-gpt-6-1-terra/).
54
+ * Its verbatim openai/codex models.json row is roster-pinned (captured 2026-10-27):
55
+ * low..ultra, default low, native 500,000 / 872,000 context, multi-agent v2, Fast only.
56
+ * Self-described and ungated alongside GPT-5.6 Terra; no default or roster migration.
57
+ */
58
+ export const NATIVE_GPT61_TERRA_MODEL = "gpt-6.1-terra";
59
+
52
60
  /**
53
61
  * Unreleased GPT-6 Astra variant. No public row exists anywhere — neither the codex-rs bundle nor
54
62
  * the 2026-09-23 main-account roster probe carries it — so it is ACCOUNT-GATED: hidden and
@@ -64,7 +72,7 @@ export const NATIVE_GPT6_ASTRA_MINOR_MODEL = "gpt-6-astra-minor";
64
72
  * Context pair every GPT-6 native ships in its upstream row: a 272,000-token default window
65
73
  * against an 872,000-token ceiling (and input limit) reached only through the long-window opt-in.
66
74
  * The built-in GPT-6 rows and every configured native (below) inherit this one value, except
67
- * GPT-6.1 Sol, whose default window is NATIVE_GPT61_SOL_CONTEXT.
75
+ * GPT-6.1 Sol and Terra, whose default windows are 500,000.
68
76
  */
69
77
  export const NATIVE_GPT6_CONTEXT: Readonly<{ contextWindow: number; maxContextWindow: number; maxInputTokens: number }> =
70
78
  Object.freeze({ contextWindow: 272_000, maxContextWindow: 872_000, maxInputTokens: 872_000 });
@@ -81,6 +89,10 @@ export const NATIVE_GPT6_CONTEXT: Readonly<{ contextWindow: number; maxContextWi
81
89
  export const NATIVE_GPT61_SOL_CONTEXT: Readonly<{ contextWindow: number; maxContextWindow: number; maxInputTokens: number }> =
82
90
  Object.freeze({ ...NATIVE_GPT6_CONTEXT, contextWindow: 500_000 });
83
91
 
92
+ /** GPT-6.1 Terra's native row ships 500,000 default / 872,000 maximum (not the API window). */
93
+ export const NATIVE_GPT61_TERRA_CONTEXT: Readonly<{ contextWindow: number; maxContextWindow: number; maxInputTokens: number }> =
94
+ Object.freeze({ ...NATIVE_GPT6_CONTEXT, contextWindow: 500_000 });
95
+
84
96
  /** Pinned row a configured native borrows its capability metadata from: the current Sol. */
85
97
  export const CONFIGURED_NATIVE_OPENAI_TEMPLATE_MODEL = NATIVE_GPT61_SOL_MODEL;
86
98
 
@@ -149,6 +161,7 @@ const selfDescribedNativeModels = new Set<string>([
149
161
  NATIVE_GPT6_SOL_MODEL,
150
162
  NATIVE_GPT6_LUNA_MODEL,
151
163
  NATIVE_GPT61_SOL_MODEL,
164
+ NATIVE_GPT61_TERRA_MODEL,
152
165
  ]);
153
166
 
154
167
  export const SELF_DESCRIBED_NATIVE_OPENAI_MODELS: ReadonlySet<string> = selfDescribedNativeModels;
@@ -252,6 +265,7 @@ const BUILT_IN_NATIVE_OPENAI_MODELS: readonly string[] = Object.freeze([
252
265
  NATIVE_GPT6_ASTRA_MODEL,
253
266
  NATIVE_GPT6_SOL_MODEL, NATIVE_GPT6_LUNA_MODEL,
254
267
  NATIVE_GPT61_SOL_MODEL,
268
+ NATIVE_GPT61_TERRA_MODEL,
255
269
  NATIVE_GPT6_ASTRA_MINOR_MODEL,
256
270
  ]);
257
271
 
@@ -397,4 +411,5 @@ export const NATIVE_MAIN_DRAIN_SENTINEL_MODELS: ReadonlySet<string> = new Set([
397
411
  NATIVE_GPT6_SOL_MODEL,
398
412
  NATIVE_GPT6_LUNA_MODEL,
399
413
  NATIVE_GPT61_SOL_MODEL,
414
+ NATIVE_GPT61_TERRA_MODEL,
400
415
  ]);
@@ -104,6 +104,10 @@ export interface CatalogModel {
104
104
  description?: string;
105
105
  owned_by?: string;
106
106
  reasoningEfforts?: string[];
107
+ supportsReasoning?: boolean;
108
+ supportsThinkingToggle?: boolean;
109
+ supportsReasoningEffort?: boolean;
110
+ defaultThinkingEnabled?: boolean;
107
111
  /** Exact CCA family evidence, retained through the in-memory discovery cache. */
108
112
  antigravityEffortWireModelIds?: Partial<Record<"low" | "medium" | "high", string>>;
109
113
  /** Suppress only catalog synthesis of a missing max rung; provider-declared max survives. */
@@ -133,6 +137,8 @@ export interface CatalogModel {
133
137
  supportsServiceTier?: boolean;
134
138
  /** Captured eligible service-tier wire explicitly maps ultrafast to ultrafast. */
135
139
  supportsUltraFastTier?: boolean;
140
+ /** Explicitly verified exact Flex wire and foreign caller-tier forwarding on this route. */
141
+ supportsFlexTier?: boolean;
136
142
  /** Optional provider-specific copy for the advertised Fast tier. */
137
143
  fastTierDescription?: string;
138
144
  supportsReasoningSummaries?: boolean;
@@ -184,15 +190,11 @@ export const ROUTED_MODEL_COMPATIBILITY_EXCLUSIONS = new Set([
184
190
  "opencode-go/mimo-v2-omni",
185
191
  "opencode-go/mimo-v2-pro",
186
192
  /*
187
- * DeepSeek retired `deepseek-v4-pro` on 2026-09-14 04:00 UTC and routes its requests to
188
- * V4.1-Flash (api-docs.deepseek.com/news/news260910). Deleting the registry rows removes
189
- * the model on providers that publish a static roster, but every provider below discovers
190
- * its models live — there, a deleted row does not remove anything, it only strips the
191
- * context window, the effort ladder and the text-only hint, so the retired model would
192
- * keep appearing with its capabilities broken. Excluding the slug is what actually takes
193
- * it out of the routed catalog.
193
+ * These third-party exclusions originated in the superseded V4 Pro retirement plan.
194
+ * First-party service continues (api-docs.deepseek.com/updates/); these gateway routes
195
+ * remain excluded pending provider-specific verification. Live discovery can reintroduce
196
+ * a model removed from a static registry, so these exclusions act on the routed catalog.
194
197
  */
195
- "deepseek/deepseek-v4-pro",
196
198
  "opencode-go/deepseek-v4-pro",
197
199
  "command-code/deepseek-deepseek-v4-pro",
198
200
  "commandcode/deepseek-deepseek-v4-pro",
@@ -12,7 +12,8 @@ import rosterPinnedModels from "../data/roster-pinned-models.json";
12
12
  * `chatgpt.com/backend-api/codex/models?client_version=0.155.0` on 2026-09-23, the day after
13
13
  * https://openai.com/index/introducing-gpt-6-sol-and-luna/, and `gpt-6.1-sol`, copied on
14
14
  * 2026-09-30 from openai/codex `codex-rs/models-manager/models.json` after #49318 (bundled
15
- * upstream, but newer than this build's `upstream-models.json` pin).
15
+ * upstream, but newer than this build's `upstream-models.json` pin), and `gpt-6.1-terra`,
16
+ * copied verbatim from the same upstream file on 2026-10-27 after its 2026-10-26 release.
16
17
  *
17
18
  * The snapshot always wins: a roster row is appended only when its slug is absent from the
18
19
  * snapshot. Once a codex-rs refresh bundles Sol or Luna, that row takes over automatically and
@@ -210,11 +210,10 @@ export async function fetchProviderModelsWithAuth(
210
210
  ...(prov.models ?? []),
211
211
  ...(prov.retainModels ?? []),
212
212
  ])];
213
- const configured: CatalogModel[] = configuredIds.map(id => ({
214
- id,
215
- provider: name,
216
- ...catalogHintsFromProviderConfig(name, prov, id, contextCap, metadataModelIdCaseFold, captured.effectiveAlias, metadataConfigDir, false),
217
- }));
213
+ const configured: CatalogModel[] = configuredIds.map(id => applyProviderConfigHints(
214
+ name, prov, { id, provider: name }, contextCap, metadataModelIdCaseFold,
215
+ captured.effectiveAlias, metadataConfigDir, false,
216
+ ));
218
217
  const withConfiguredRetention = (
219
218
  models: CatalogModel[],
220
219
  options?: { retainComboTargets?: boolean; warnDrops?: boolean },
@@ -1,5 +1,5 @@
1
1
  import { projectAntigravitySelectedModels } from "../../providers/antigravity-effort-families";
2
- import { configuredUltraFastSlugs } from "./configured-tiers";
2
+ import { configuredUltraFastSlugs, retainedFlexPolicyBySlug } from "./configured-tiers";
3
3
  import { existsSync, readFileSync } from "node:fs";
4
4
  import { join } from "node:path";
5
5
  import { initializeConfigOwnership } from "../../lib/config-ownership";
@@ -511,6 +511,7 @@ function writeRetainedCatalogSync({
511
511
  catalog.models = mergeCatalogEntriesFromObservedState({
512
512
  ultraFastTier: ultraFastTierEnabled(config),
513
513
  configuredUltraFastSlugs: configuredUltraFastSlugs(orderedGoModels),
514
+ retainedFlexPolicyBySlug: retainedFlexPolicyBySlug(config.providers ?? {}, catalogModelsForMerge, orderedGoModels),
514
515
  modelPickerOrder,
515
516
  accountSelectors,
516
517
  catalogModels: catalogModelsForMerge,