@rigelbuild/omp-catalog 18.0.3

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 (117) hide show
  1. package/CHANGELOG.md +1204 -0
  2. package/LICENSE +22 -0
  3. package/README.md +43 -0
  4. package/THIRD-PARTY-NOTICES.txt +22909 -0
  5. package/dist/types/build.d.ts +19 -0
  6. package/dist/types/compat/anthropic.d.ts +18 -0
  7. package/dist/types/compat/apply.d.ts +7 -0
  8. package/dist/types/compat/bedrock.d.ts +3 -0
  9. package/dist/types/compat/devin.d.ts +9 -0
  10. package/dist/types/compat/openai.d.ts +28 -0
  11. package/dist/types/discovery/antigravity.d.ts +70 -0
  12. package/dist/types/discovery/codex.d.ts +36 -0
  13. package/dist/types/discovery/cursor-proto.d.ts +5368 -0
  14. package/dist/types/discovery/cursor.d.ts +23 -0
  15. package/dist/types/discovery/devin-proto.d.ts +1549 -0
  16. package/dist/types/discovery/devin.d.ts +24 -0
  17. package/dist/types/discovery/gemini-cli.d.ts +33 -0
  18. package/dist/types/discovery/gemini.d.ts +25 -0
  19. package/dist/types/discovery/gitlab-duo-workflow.d.ts +30 -0
  20. package/dist/types/discovery/index.d.ts +7 -0
  21. package/dist/types/discovery/openai-compatible.d.ts +89 -0
  22. package/dist/types/discovery/protobuf.d.ts +102 -0
  23. package/dist/types/effort.d.ts +10 -0
  24. package/dist/types/fireworks-model-id.d.ts +23 -0
  25. package/dist/types/hosts.d.ts +169 -0
  26. package/dist/types/identity/bundled.d.ts +3 -0
  27. package/dist/types/identity/classify.d.ts +69 -0
  28. package/dist/types/identity/dialect.d.ts +3 -0
  29. package/dist/types/identity/family.d.ts +239 -0
  30. package/dist/types/identity/id.d.ts +12 -0
  31. package/dist/types/identity/index.d.ts +8 -0
  32. package/dist/types/identity/markers.d.ts +4 -0
  33. package/dist/types/identity/priority.d.ts +1 -0
  34. package/dist/types/identity/reference.d.ts +29 -0
  35. package/dist/types/index.d.ts +19 -0
  36. package/dist/types/model-cache.d.ts +23 -0
  37. package/dist/types/model-manager.d.ts +77 -0
  38. package/dist/types/model-thinking.d.ts +70 -0
  39. package/dist/types/model-tokenizer.d.ts +8 -0
  40. package/dist/types/models.d.ts +14 -0
  41. package/dist/types/openai-pricing.d.ts +17 -0
  42. package/dist/types/provider-models/bundled-references.d.ts +13 -0
  43. package/dist/types/provider-models/cache-provider-id.d.ts +11 -0
  44. package/dist/types/provider-models/descriptor-types.d.ts +76 -0
  45. package/dist/types/provider-models/descriptors.d.ts +505 -0
  46. package/dist/types/provider-models/google.d.ts +29 -0
  47. package/dist/types/provider-models/index.d.ts +7 -0
  48. package/dist/types/provider-models/ollama.d.ts +22 -0
  49. package/dist/types/provider-models/openai-compat.d.ts +646 -0
  50. package/dist/types/provider-models/special.d.ts +53 -0
  51. package/dist/types/types.d.ts +876 -0
  52. package/dist/types/utils.d.ts +20 -0
  53. package/dist/types/variant-collapse.d.ts +137 -0
  54. package/dist/types/wire/alibaba-token-plan.d.ts +22 -0
  55. package/dist/types/wire/codex.d.ts +66 -0
  56. package/dist/types/wire/coreweave.d.ts +12 -0
  57. package/dist/types/wire/gemini-headers.d.ts +62 -0
  58. package/dist/types/wire/github-copilot.d.ts +47 -0
  59. package/dist/types/wire/image-fetchers.d.ts +76 -0
  60. package/package.json +102 -0
  61. package/src/build.ts +103 -0
  62. package/src/compat/anthropic.ts +179 -0
  63. package/src/compat/apply.ts +15 -0
  64. package/src/compat/bedrock.ts +153 -0
  65. package/src/compat/devin.ts +12 -0
  66. package/src/compat/openai.ts +864 -0
  67. package/src/discovery/antigravity.ts +257 -0
  68. package/src/discovery/codex.ts +456 -0
  69. package/src/discovery/cursor-proto.ts +8329 -0
  70. package/src/discovery/cursor.ts +409 -0
  71. package/src/discovery/devin-proto.ts +2037 -0
  72. package/src/discovery/devin.ts +152 -0
  73. package/src/discovery/gemini-cli.ts +198 -0
  74. package/src/discovery/gemini.ts +260 -0
  75. package/src/discovery/gitlab-duo-workflow.ts +859 -0
  76. package/src/discovery/index.ts +7 -0
  77. package/src/discovery/openai-compatible.ts +266 -0
  78. package/src/discovery/protobuf.ts +1073 -0
  79. package/src/effort.ts +18 -0
  80. package/src/fireworks-model-id.ts +50 -0
  81. package/src/hosts.ts +178 -0
  82. package/src/identity/bundled.ts +28 -0
  83. package/src/identity/classify.ts +242 -0
  84. package/src/identity/dialect.ts +42 -0
  85. package/src/identity/family.ts +477 -0
  86. package/src/identity/id.ts +81 -0
  87. package/src/identity/index.ts +8 -0
  88. package/src/identity/markers.ts +49 -0
  89. package/src/identity/priority.ts +59 -0
  90. package/src/identity/reference.ts +167 -0
  91. package/src/index.ts +19 -0
  92. package/src/model-cache.ts +346 -0
  93. package/src/model-manager.ts +683 -0
  94. package/src/model-thinking.ts +925 -0
  95. package/src/model-tokenizer.ts +75 -0
  96. package/src/models.json +304657 -0
  97. package/src/models.json.d.ts +9 -0
  98. package/src/models.ts +108 -0
  99. package/src/openai-pricing.ts +29 -0
  100. package/src/provider-models/bundled-references.ts +87 -0
  101. package/src/provider-models/cache-provider-id.ts +97 -0
  102. package/src/provider-models/descriptor-types.ts +85 -0
  103. package/src/provider-models/descriptors.ts +585 -0
  104. package/src/provider-models/google.ts +117 -0
  105. package/src/provider-models/index.ts +7 -0
  106. package/src/provider-models/ollama.ts +204 -0
  107. package/src/provider-models/openai-compat.ts +6405 -0
  108. package/src/provider-models/special.ts +213 -0
  109. package/src/types.ts +1032 -0
  110. package/src/utils.ts +69 -0
  111. package/src/variant-collapse.ts +1555 -0
  112. package/src/wire/alibaba-token-plan.ts +54 -0
  113. package/src/wire/codex.ts +117 -0
  114. package/src/wire/coreweave.ts +51 -0
  115. package/src/wire/gemini-headers.ts +135 -0
  116. package/src/wire/github-copilot.ts +147 -0
  117. package/src/wire/image-fetchers.ts +159 -0
@@ -0,0 +1,179 @@
1
+ /**
2
+ * Anthropic-messages compat builder — the anthropic-side analogue of
3
+ * `./openai`. Runs exactly once per model (from `buildModel`); detect-time
4
+ * defaults come from provider ids, strict host checks, and model-id
5
+ * classification, with explicit spec overrides assigned on top.
6
+ */
7
+ import { hostMatchesUrl, modelMatchesHost } from "../hosts";
8
+ import {
9
+ hasOpus47ApiRestrictions,
10
+ isAnthropicFableOrMythosModel,
11
+ isKimiK3ModelId,
12
+ supportsMidConversationSystemMessages,
13
+ } from "../identity/family";
14
+ import type { ModelSpec, ResolvedAnthropicCompat } from "../types";
15
+ import { applyCompatOverrides } from "./apply";
16
+
17
+ const OFFICIAL_ANTHROPIC_URL = "https://api.anthropic.com";
18
+
19
+ /**
20
+ * Official first-party Anthropic API. A missing baseUrl is official on purpose:
21
+ * request dispatch falls back to `https://api.anthropic.com`. This is the one
22
+ * auth-sensitive host check — OAuth credentials are attached based on it — so
23
+ * it requires the exact origin or a path boundary (`/`) after it; a bare
24
+ * prefix check would accept lookalikes like `https://api.anthropic.com.evil.com`.
25
+ */
26
+ export function isOfficialAnthropicApiUrl(baseUrl?: string): boolean {
27
+ if (!baseUrl) return true;
28
+ const lower = baseUrl.toLowerCase();
29
+ return lower === OFFICIAL_ANTHROPIC_URL || lower.startsWith(`${OFFICIAL_ANTHROPIC_URL}/`);
30
+ }
31
+
32
+ /**
33
+ * Kimi models whose native endpoints (api.kimi.com, api.moonshot.ai) keep
34
+ * thinking enabled server-side no matter what the request carries: they
35
+ * reject disabled thinking (#3852) AND reject forced tool_choice
36
+ * (`tool_choice 'specified' is incompatible with thinking enabled`), so compat
37
+ * must keep thinking on and downgrade forced choices to `auto`. Covers the
38
+ * K2.7 Code family — public id, its Highspeed variant, and the kimi-code
39
+ * `kimi-for-coding[-highspeed]` aliases — plus K3 (`kimi-k3`, bare `k3` on
40
+ * kimi-code). Broader than the `compat/openai.ts` mirror: the OpenAI surface
41
+ * has its own per-dialect policies (K3 forced-choice guard, explicit disable
42
+ * shapes), while this surface has no working way to force a tool.
43
+ * Native-only host gating is the caller's responsibility.
44
+ */
45
+ const KIMI_K27_CODE_MODEL_PATTERN = /(?:^|\/)kimi[-._]?k2(?:[._-]?|p)7[-._]?code(?:[-._]?highspeed)?$/i;
46
+
47
+ function matchesKimiMandatoryThinkingModel(spec: ModelSpec<"anthropic-messages">): boolean {
48
+ if (KIMI_K27_CODE_MODEL_PATTERN.test(spec.id)) return true;
49
+ if (spec.id === "kimi-for-coding" || spec.id === "kimi-for-coding-highspeed") return true;
50
+ return isKimiK3ModelId(spec.id) || spec.id === "k3";
51
+ }
52
+
53
+ const CLOUDFLARE_ANTHROPIC_GATEWAY_URL_MARKER = /gateway\.ai\.cloudflare\.com\/.+\/anthropic(?:\/|$)/i;
54
+ const VERTEX_ANTHROPIC_URL_MARKER = /aiplatform\.googleapis\.com\/.+\/publishers\/anthropic\//i;
55
+ const BEDROCK_ANTHROPIC_URL_MARKER = /(?:^|\/\/|\.)bedrock-runtime\.[a-z0-9-]+\.amazonaws\.com/i;
56
+ const AZURE_ANTHROPIC_URL_MARKER = /(?:^|\/\/|\.)[a-z0-9-]+\.(?:inference|services)\.ai\.azure\.com/i;
57
+
58
+ /**
59
+ * Cloudflare AI Gateway's `/anthropic` route forwards to signature-enforcing
60
+ * Anthropic (same failure class as GitHub Copilot #2851 / ZenMux #4192).
61
+ * Detection is by baseUrl marker rather than provider id: users routinely
62
+ * declare `provider: "custom"` (or other free-form ids) in `models.yml` for
63
+ * their own Cloudflare gateway account.
64
+ */
65
+ function isCloudflareAnthropicGateway(baseUrl?: string): boolean {
66
+ return baseUrl !== undefined && CLOUDFLARE_ANTHROPIC_GATEWAY_URL_MARKER.test(baseUrl);
67
+ }
68
+
69
+ /**
70
+ * Google Vertex's `publishers/anthropic/models/…:streamRawPredict` route
71
+ * proxies Claude through Google's identity layer and returns full thinking
72
+ * signatures, so it is a SIGNING endpoint.
73
+ */
74
+ function isVertexAnthropicRoute(baseUrl?: string): boolean {
75
+ return baseUrl !== undefined && VERTEX_ANTHROPIC_URL_MARKER.test(baseUrl);
76
+ }
77
+
78
+ /**
79
+ * AWS Bedrock's Anthropic route (`bedrock-runtime.<region>.amazonaws.com`)
80
+ * forwards Claude requests through Anthropic's signature protocol. Users can
81
+ * front Bedrock with a custom `anthropic-messages` provider entry in
82
+ * `models.yml`; the URL marker makes those signing by default without
83
+ * requiring a provider-id list.
84
+ */
85
+ function isBedrockAnthropicRoute(baseUrl?: string): boolean {
86
+ return baseUrl !== undefined && BEDROCK_ANTHROPIC_URL_MARKER.test(baseUrl);
87
+ }
88
+
89
+ /**
90
+ * Azure AI Inference / Foundry Anthropic route
91
+ * (`<resource>.inference.ai.azure.com`, `<resource>.services.ai.azure.com`).
92
+ * Fronts Claude behind Azure identity and enforces Anthropic signatures on
93
+ * replay.
94
+ */
95
+ function isAzureAnthropicRoute(baseUrl?: string): boolean {
96
+ return baseUrl !== undefined && AZURE_ANTHROPIC_URL_MARKER.test(baseUrl);
97
+ }
98
+
99
+ /**
100
+ * Known non-official URLs that enforce Anthropic thinking signatures on replay.
101
+ *
102
+ * Runtime routing calls this with the effective URL because a model's resolved
103
+ * compat can be stale after Foundry or a provider base-URL override reroutes it.
104
+ */
105
+ export function isAnthropicSigningProxyUrl(baseUrl?: string): boolean {
106
+ return (
107
+ hostMatchesUrl(baseUrl, "githubCopilot") ||
108
+ hostMatchesUrl(baseUrl, "zenmux") ||
109
+ isCloudflareAnthropicGateway(baseUrl) ||
110
+ isVertexAnthropicRoute(baseUrl) ||
111
+ isBedrockAnthropicRoute(baseUrl) ||
112
+ isAzureAnthropicRoute(baseUrl)
113
+ );
114
+ }
115
+
116
+ /** Build the resolved anthropic-messages compat record for a model spec. */
117
+ export function buildAnthropicCompat(spec: ModelSpec<"anthropic-messages">): ResolvedAnthropicCompat {
118
+ const baseUrl = spec.baseUrl;
119
+ const official = isOfficialAnthropicApiUrl(baseUrl);
120
+ // Z.AI's Anthropic-compatible proxy lives at `api.z.ai/api/anthropic`.
121
+ const isZai = modelMatchesHost(spec, "zai");
122
+ // GitHub Copilot's `anthropic-messages` proxy (api.githubcopilot.com/v1/messages)
123
+ // rejects the per-tool `eager_input_streaming` field with
124
+ // `tools.0.custom.eager_input_streaming: Extra inputs are not permitted` and
125
+ // doesn't whitelist the `fine-grained-tool-streaming-2025-05-14` beta either
126
+ // (issue #2558), so eager tool-input streaming is unavailable on this host.
127
+ const isCopilot = modelMatchesHost(spec, "githubCopilot");
128
+ // ZenMux's `anthropic-messages` route (zenmux.ai/api/anthropic) forwards to
129
+ // signature-enforcing Anthropic — same failure class as GitHub Copilot #2851
130
+ // (issue #4192).
131
+ const isZenmux = modelMatchesHost(spec, "zenmux");
132
+ const requiresThinkingEnabled = modelMatchesHost(spec, "moonshotNative") && matchesKimiMandatoryThinkingModel(spec);
133
+ const isAzure = isAzureAnthropicRoute(baseUrl);
134
+ const signingEndpoint = official || isCopilot || isZenmux || isAnthropicSigningProxyUrl(baseUrl);
135
+ const compat: ResolvedAnthropicCompat = {
136
+ officialEndpoint: official,
137
+ signingEndpoint,
138
+ disableStrictTools: isAzure,
139
+ disableAdaptiveThinking: false,
140
+ allowAnthropicHeaderOverrides: false,
141
+ supportsEagerToolInputStreaming: official,
142
+ // Long cache retention is only sent to the official API by default;
143
+ // proxies opt in explicitly via `compat.supportsLongCacheRetention: true`.
144
+ supportsLongCacheRetention: official,
145
+ // First-party Claude API only. Bedrock/Vertex/Foundry and other
146
+ // Anthropic-compatible gateways reject mid-conversation system roles, so
147
+ // detection requires the canonical api.anthropic.com host plus a
148
+ // supported model id.
149
+ supportsMidConversationSystem: official && supportsMidConversationSystemMessages(spec.id),
150
+ supportsForcedToolChoice: !requiresThinkingEnabled && !isAnthropicFableOrMythosModel(spec.id),
151
+ // Opus 4.7+ and Fable/Mythos reject temperature/top_p/top_k with a 400.
152
+ supportsSamplingParams: !hasOpus47ApiRestrictions(spec.id),
153
+ // Z.AI workaround (issue #814): its proxy deserializes tool_result blocks
154
+ // into a class that reads `.id`.
155
+ requiresToolResultId: isZai,
156
+ requiresThinkingEnabled,
157
+ // Official Anthropic and Anthropic-compatible signing proxies enforce
158
+ // signature-based thinking-chain integrity, so unsigned thinking blocks
159
+ // must stay text there. Every other `anthropic-messages` reasoning
160
+ // endpoint replays unsigned thinking natively so the reasoning chain
161
+ // survives continuation and doesn't destabilize the next tool-call
162
+ // arguments (#2005, #2257, #2265, #3288, #3433, #3434). Opaque custom
163
+ // signing proxies remain the reporter's responsibility to mark with
164
+ // `compat.replayUnsignedThinking: false`; the transport surfaces a
165
+ // pointed remediation the first time the signing 400 fires (#4297).
166
+ //
167
+ // Known signing Anthropic-messages hosts (Copilot, ZenMux, Cloudflare
168
+ // AI Gateway `/anthropic`, Google Vertex `publishers/anthropic`, AWS
169
+ // Bedrock `bedrock-runtime.<region>.amazonaws.com`, and Azure
170
+ // AI Inference / Foundry `<res>.(inference|services).ai.azure.com`)
171
+ // are excluded automatically because they can be recognised by provider
172
+ // id or baseUrl marker.
173
+ replayUnsignedThinking: !signingEndpoint && (Boolean(spec.reasoning) || modelMatchesHost(spec, "deepseekFamily")),
174
+ escapeBuiltinToolNames: modelMatchesHost(spec, "umans"),
175
+ streamIdleTimeoutMs: spec.compat?.streamIdleTimeoutMs,
176
+ };
177
+ applyCompatOverrides(compat, spec.compat);
178
+ return compat;
179
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Assign defined override values onto a freshly-built resolved compat record,
3
+ * in place. Keys the record doesn't declare are ignored (loosely-typed config
4
+ * may carry junk). `buildModel` is the only intended caller — the record being
5
+ * mutated is the single per-model allocation; nothing here runs per request.
6
+ */
7
+ export function applyCompatOverrides(compat: object, overrides: object | undefined): void {
8
+ if (!overrides) return;
9
+ for (const key in overrides) {
10
+ const value = (overrides as Record<string, unknown>)[key];
11
+ if (value !== undefined && key in compat) {
12
+ (compat as Record<string, unknown>)[key] = value;
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,153 @@
1
+ import { supportsAdaptiveThinkingDisplay } from "../identity/family";
2
+ import type { ModelSpec, ResolvedBedrockCompat } from "../types";
3
+ import { applyCompatOverrides } from "./apply";
4
+
5
+ const NO_EXPLICIT_CHECKPOINTS: ResolvedBedrockCompat = {
6
+ promptCacheMode: "none",
7
+ supportsLongPromptCacheRetention: false,
8
+ promptCacheMinimumTokens: 0,
9
+ promptCacheMaximumCheckpoints: 0,
10
+ };
11
+ const EXPLICIT_CHECKPOINTS_1024_5M: ResolvedBedrockCompat = {
12
+ promptCacheMode: "explicit",
13
+ supportsLongPromptCacheRetention: false,
14
+ promptCacheMinimumTokens: 1024,
15
+ promptCacheMaximumCheckpoints: 4,
16
+ };
17
+
18
+ const EXPLICIT_CHECKPOINTS_1024_1H: ResolvedBedrockCompat = {
19
+ promptCacheMode: "explicit",
20
+ supportsLongPromptCacheRetention: true,
21
+ promptCacheMinimumTokens: 1024,
22
+ promptCacheMaximumCheckpoints: 4,
23
+ };
24
+
25
+ const EXPLICIT_CHECKPOINTS_2048_5M: ResolvedBedrockCompat = {
26
+ promptCacheMode: "explicit",
27
+ supportsLongPromptCacheRetention: false,
28
+ promptCacheMinimumTokens: 2048,
29
+ promptCacheMaximumCheckpoints: 4,
30
+ };
31
+
32
+ const EXPLICIT_CHECKPOINTS_4096_5M: ResolvedBedrockCompat = {
33
+ promptCacheMode: "explicit",
34
+ supportsLongPromptCacheRetention: false,
35
+ promptCacheMinimumTokens: 4096,
36
+ promptCacheMaximumCheckpoints: 4,
37
+ };
38
+
39
+ const EXPLICIT_CHECKPOINTS_4096_1H: ResolvedBedrockCompat = {
40
+ promptCacheMode: "explicit",
41
+ supportsLongPromptCacheRetention: true,
42
+ promptCacheMinimumTokens: 4096,
43
+ promptCacheMaximumCheckpoints: 4,
44
+ };
45
+
46
+ // AWS モデルカード: 512 トークン、最大 4 個のキャッシュチェックポイント、5 分と 1 時間の TTL。
47
+ // https://docs.aws.amazon.com/bedrock/latest/userguide/model-card-anthropic-claude-opus-5.html
48
+ const EXPLICIT_CHECKPOINTS_512_1H: ResolvedBedrockCompat = {
49
+ promptCacheMode: "explicit",
50
+ supportsLongPromptCacheRetention: true,
51
+ promptCacheMinimumTokens: 512,
52
+ promptCacheMaximumCheckpoints: 4,
53
+ };
54
+
55
+ /**
56
+ * Explicit Nova cache points complement Bedrock's automatic prefix caching:
57
+ * AWS recommends them for consistent cache hits and input-cost savings. Keep
58
+ * these exact documented model and inference-profile IDs conservative rather
59
+ * than treating arbitrary Nova-like application profiles as checkpoint-capable.
60
+ */
61
+ function detectedBedrockCompat(modelId: string): ResolvedBedrockCompat {
62
+ const id = modelId.toLowerCase();
63
+
64
+ if (
65
+ id === "amazon.nova-lite-v1:0" ||
66
+ id === "us.amazon.nova-lite-v1:0" ||
67
+ id === "amazon.nova-micro-v1:0" ||
68
+ id === "us.amazon.nova-micro-v1:0" ||
69
+ id === "amazon.nova-pro-v1:0" ||
70
+ id === "us.amazon.nova-pro-v1:0" ||
71
+ id === "amazon.nova-premier-v1:0" ||
72
+ id === "us.amazon.nova-premier-v1:0" ||
73
+ id === "amazon.nova-2-lite-v1:0" ||
74
+ id === "us.amazon.nova-2-lite-v1:0" ||
75
+ id === "eu.amazon.nova-2-lite-v1:0" ||
76
+ id === "jp.amazon.nova-2-lite-v1:0" ||
77
+ id === "global.amazon.nova-2-lite-v1:0"
78
+ ) {
79
+ return EXPLICIT_CHECKPOINTS_1024_5M;
80
+ }
81
+
82
+ // https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-caching.html
83
+ // This list is deliberately sourced from AWS model cards, not cache pricing:
84
+ // https://docs.aws.amazon.com/bedrock/latest/userguide/model-cards.html
85
+ if (
86
+ id.includes("anthropic.claude-opus-4-5") ||
87
+ id.includes("anthropic.claude-sonnet-4-5") ||
88
+ id.includes("anthropic.claude-haiku-4-5") ||
89
+ id.includes("anthropic.claude-opus-4-7") ||
90
+ id.includes("anthropic.claude-opus-4-8") ||
91
+ id.includes("anthropic.claude-sonnet-5")
92
+ ) {
93
+ return EXPLICIT_CHECKPOINTS_4096_1H;
94
+ }
95
+ if (id.includes("anthropic.claude-opus-5")) {
96
+ return EXPLICIT_CHECKPOINTS_512_1H;
97
+ }
98
+ if (id.includes("anthropic.claude-opus-4-6")) {
99
+ return EXPLICIT_CHECKPOINTS_4096_5M;
100
+ }
101
+ if (id.includes("anthropic.claude-3-5-haiku")) {
102
+ return EXPLICIT_CHECKPOINTS_2048_5M;
103
+ }
104
+ if (id.includes("anthropic.claude-fable-5")) {
105
+ return EXPLICIT_CHECKPOINTS_1024_1H;
106
+ }
107
+
108
+ if (
109
+ id.includes("anthropic.claude-opus-4-1") ||
110
+ id.includes("anthropic.claude-opus-4-20250514") ||
111
+ id.includes("anthropic.claude-sonnet-4-20250514") ||
112
+ id.includes("anthropic.claude-sonnet-4-6") ||
113
+ id.includes("anthropic.claude-3-7-sonnet") ||
114
+ id.includes("anthropic.claude-3-5-sonnet-20241022-v2")
115
+ ) {
116
+ return EXPLICIT_CHECKPOINTS_1024_5M;
117
+ }
118
+
119
+ return NO_EXPLICIT_CHECKPOINTS;
120
+ }
121
+
122
+ /**
123
+ * Bedrock ConverseStream sends no ping/keepalive events, so a reasoning model
124
+ * that goes quiet mid-thinking (summarized-display gaps, `omitted` thinking,
125
+ * or the wedged long tool-call generation of issue #4900) reads as a dead
126
+ * stream to the generic 300s idle watchdog and dies with "Provider stream
127
+ * stalled while waiting for the next event" (issue #4758's Bedrock variant).
128
+ * Widen the floor to 600s for reasoning models, mirroring the GLM coding-plan
129
+ * floor; explicit `spec.compat.streamIdleTimeoutMs` overrides still win.
130
+ */
131
+ const BEDROCK_REASONING_STREAM_IDLE_TIMEOUT_MS = 600_000;
132
+ /**
133
+ * Adaptive-thinking Claude (Opus 4.7+, Sonnet/Opus 5, Fable/Mythos 5) reasons
134
+ * for much longer stretches, and starting with Opus 4.7 / Fable 5 the
135
+ * Anthropic-side display default is `omitted` (issue #1373), so quiet gaps run
136
+ * longest on exactly this family — Fable 5 being the worst offender in the
137
+ * field. Direct Anthropic keeps these streams alive with ping keepalives and
138
+ * tolerates up to 3x the 300s idle budget of real-event silence (#4900);
139
+ * pingless Bedrock needs the same 900s tolerance in the raw idle floor.
140
+ */
141
+ const BEDROCK_ADAPTIVE_THINKING_STREAM_IDLE_TIMEOUT_MS = 900_000;
142
+
143
+ /** Resolve Bedrock Converse prompt-cache and stream-watchdog compat once per model. */
144
+ export function buildBedrockCompat(spec: ModelSpec<"bedrock-converse-stream">): ResolvedBedrockCompat {
145
+ const compat = { ...detectedBedrockCompat(spec.id) };
146
+ compat.streamIdleTimeoutMs = spec.reasoning
147
+ ? supportsAdaptiveThinkingDisplay(spec.id)
148
+ ? BEDROCK_ADAPTIVE_THINKING_STREAM_IDLE_TIMEOUT_MS
149
+ : BEDROCK_REASONING_STREAM_IDLE_TIMEOUT_MS
150
+ : undefined;
151
+ applyCompatOverrides(compat, spec.compat);
152
+ return compat;
153
+ }
@@ -0,0 +1,12 @@
1
+ import type { ModelSpec, ResolvedDevinCompat } from "../types";
2
+
3
+ /**
4
+ * Resolve devin-agent (Codeium Cascade) compat. Cascade has no wire
5
+ * reasoning/effort field — effort is selected by routing to a sibling model id
6
+ * (the `thinking.effortRouting` baked by variant-collapse). So the thinking
7
+ * deriver must never fabricate an effort ladder from identity for these models;
8
+ * only explicit routed metadata counts.
9
+ */
10
+ export function buildDevinCompat(_spec: ModelSpec<"devin-agent">): ResolvedDevinCompat {
11
+ return { trustExplicitThinkingOnly: true };
12
+ }