@oh-my-pi/pi-catalog 18.11.2 → 18.12.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 (57) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/types/compat/behavior.d.ts +5 -0
  3. package/dist/types/compat/catalog-endpoint.d.ts +8 -0
  4. package/dist/types/compat/judgment-images.d.ts +25 -0
  5. package/dist/types/compat/request-compression.d.ts +21 -0
  6. package/dist/types/compat/request-size.d.ts +2 -1
  7. package/dist/types/compat/types.d.ts +2 -0
  8. package/dist/types/model-cache.d.ts +7 -0
  9. package/dist/types/provider-models/openai-compat.d.ts +0 -46
  10. package/dist/types/types.d.ts +14 -1
  11. package/package.json +4 -4
  12. package/src/build.ts +13 -0
  13. package/src/compat/axes.ts +51 -1
  14. package/src/compat/behavior.ts +9 -1
  15. package/src/compat/catalog-endpoint.ts +43 -0
  16. package/src/compat/judgment-images.ts +83 -0
  17. package/src/compat/request-compression.ts +41 -0
  18. package/src/compat/request-size.ts +3 -1
  19. package/src/compat/resolve.ts +34 -49
  20. package/src/compat/rules/README.md +17 -1
  21. package/src/compat/rules/auth/google-antigravity.kdl +1 -1
  22. package/src/compat/rules/classes/anthropic.kdl +2 -3
  23. package/src/compat/rules/classes/deepseek.kdl +4 -0
  24. package/src/compat/rules/classes/minimax.kdl +10 -0
  25. package/src/compat/rules/classes/openai.kdl +8 -0
  26. package/src/compat/rules/providers/anthropic.kdl +4 -0
  27. package/src/compat/rules/providers/azure.kdl +2 -0
  28. package/src/compat/rules/providers/cerebras.kdl +3 -0
  29. package/src/compat/rules/providers/cline-pass.kdl +16 -0
  30. package/src/compat/rules/providers/commandcode.kdl +10 -0
  31. package/src/compat/rules/providers/deepinfra.kdl +3 -1
  32. package/src/compat/rules/providers/devin.kdl +7 -1
  33. package/src/compat/rules/providers/factory-droid.kdl +6 -0
  34. package/src/compat/rules/providers/firepass.kdl +15 -0
  35. package/src/compat/rules/providers/fireworks.kdl +26 -0
  36. package/src/compat/rules/providers/github-copilot.kdl +24 -0
  37. package/src/compat/rules/providers/google-antigravity.kdl +11 -0
  38. package/src/compat/rules/providers/moonshot.kdl +2 -0
  39. package/src/compat/rules/providers/ollama-cloud.kdl +3 -0
  40. package/src/compat/rules/providers/openai-codex.kdl +9 -0
  41. package/src/compat/rules/providers/opencode-go.kdl +4 -0
  42. package/src/compat/rules/providers/opencode-zen.kdl +4 -0
  43. package/src/compat/rules/providers/openrouter.kdl +15 -0
  44. package/src/compat/rules/providers/tool-call-names.kdl +37 -0
  45. package/src/compat/rules/providers/typesafe.kdl +8 -0
  46. package/src/compat/rules/providers/umans.kdl +6 -0
  47. package/src/compat/rules/providers/venice.kdl +7 -0
  48. package/src/compat/rules/providers/xai-oauth.kdl +4 -0
  49. package/src/compat/rules/providers/zai.kdl +5 -0
  50. package/src/compat/rules/runtime/behavior.kdl +115 -4
  51. package/src/compat/rules.json +1 -1
  52. package/src/compat/types.ts +2 -0
  53. package/src/model-cache.ts +8 -0
  54. package/src/model-manager.ts +29 -20
  55. package/src/models.json +1 -1
  56. package/src/provider-models/openai-compat.ts +8 -90
  57. package/src/types.ts +14 -0
@@ -2419,74 +2419,6 @@ export function zhipuCodingPlanModelManagerOptions(
2419
2419
  // 7.5 Fireworks
2420
2420
  // ---------------------------------------------------------------------------
2421
2421
 
2422
- /**
2423
- * Fireworks-published cap for the Kimi K2 family. Fireworks' `/v1/models`
2424
- * envelope generically reports `max_completion_tokens: 65536` for every Kimi
2425
- * deployment, but Kimi K2 (instruct / thinking / turbo) on Fireworks is
2426
- * documented to ship long reasoning traces that should be bounded — capping
2427
- * at 32,768 prevents handing callers a budget the router cannot honor.
2428
- * See https://github.com/can1357/oh-my-pi/issues/1849.
2429
- */
2430
- export const FIREWORKS_KIMI_MAX_TOKENS = 32_768;
2431
-
2432
- /**
2433
- * Fireworks' output ceiling for Kimi K2.7-Code specifically. Its `/v1/models`
2434
- * generic `max_completion_tokens` is 65,536 and Fireworks serves it in full —
2435
- * verified with a single completion emitting 58,971 output tokens and
2436
- * `max_tokens: 200000` accepted without error. Unlike the older K2.5/K2.6
2437
- * family (see {@link FIREWORKS_KIMI_MAX_TOKENS}), K2.7-Code is not clamped to
2438
- * 32,768; that ceiling only truncated it.
2439
- */
2440
- export const FIREWORKS_KIMI_K27_CODE_MAX_TOKENS = 65_536;
2441
-
2442
- /**
2443
- * Returns true for the Kimi K2.5 / K2.6 family served by Fireworks-backed
2444
- * providers (`fireworks` direct, `firepass` router) that share the 32,768
2445
- * `maxTokens` ceiling. Matches both the public catalog id (`kimi-k2.5`,
2446
- * `kimi-k2.6`, `kimi-k2.6-turbo`) and the canonical Fireworks wire id
2447
- * (`accounts/fireworks/{models,routers}/kimi-k2…`).
2448
- *
2449
- * K2.7-Code (incl. `-fast` / `-highspeed`) is deliberately excluded: unlike the
2450
- * earlier K2 family it serves its full context on Fireworks — verified with a
2451
- * single completion emitting 58,971 output tokens and `max_tokens: 200000`
2452
- * accepted without error — so the 32,768 cap would only truncate it. It inherits
2453
- * Fireworks' reported `max_completion_tokens` (65,536) instead.
2454
- */
2455
- export function isFireworksKimiK2ModelId(modelId: string): boolean {
2456
- const identity = classifyModel("fireworks", modelId, { lenient: true });
2457
- if (identity.class !== "kimi" || identity.family === "k2.7-code") return false;
2458
- return identity.family?.startsWith("k2") === true;
2459
- }
2460
-
2461
- /**
2462
- * Clamp the Kimi K2 family's `maxTokens` to {@link FIREWORKS_KIMI_MAX_TOKENS}
2463
- * on Fireworks-backed providers, leaving every other model untouched.
2464
- */
2465
- export function clampFireworksKimiMaxTokens(modelId: string, candidate: number): number;
2466
- export function clampFireworksKimiMaxTokens(modelId: string, candidate: number | null): number | null;
2467
- export function clampFireworksKimiMaxTokens(modelId: string, candidate: number | null): number | null {
2468
- if (candidate === null) return null;
2469
- return isFireworksKimiK2ModelId(modelId) ? Math.min(candidate, FIREWORKS_KIMI_MAX_TOKENS) : candidate;
2470
- }
2471
-
2472
- /**
2473
- * Kimi K2.7 Code's documented recommended output budget. Some provider
2474
- * discovery rows report the context-sized `max_completion_tokens` instead.
2475
- */
2476
- export const KIMI_K27_CODE_RECOMMENDED_MAX_TOKENS = 32_768;
2477
-
2478
- export function isKimiK27CodeModelId(modelId: string): boolean {
2479
- const identity = classifyModel("fireworks", modelId, { lenient: true });
2480
- return identity.class === "kimi" && identity.family === "k2.7-code";
2481
- }
2482
-
2483
- export function clampKimiK27CodeMaxTokens(modelId: string, candidate: number): number;
2484
- export function clampKimiK27CodeMaxTokens(modelId: string, candidate: number | null): number | null;
2485
- export function clampKimiK27CodeMaxTokens(modelId: string, candidate: number | null): number | null {
2486
- if (candidate === null) return null;
2487
- return isKimiK27CodeModelId(modelId) ? Math.min(candidate, KIMI_K27_CODE_RECOMMENDED_MAX_TOKENS) : candidate;
2488
- }
2489
-
2490
2422
  /**
2491
2423
  * Fireworks Fast variants we surface: the Fast table on
2492
2424
  * https://docs.fireworks.ai/serverless/serverless-modes, minus the US-only
@@ -2616,15 +2548,9 @@ function mapFireworksControlPlaneModel(
2616
2548
  const supportsImage = toBoolean(record.supportsImageInput) === true;
2617
2549
  const supportsTools = toBoolean(record.supportsTools);
2618
2550
  const contextWindow = toPositiveNumber(record.contextLength, reference?.contextWindow ?? null);
2619
- // The control plane reports no max-output budget. Default K2.7-Code to its
2620
- // verified 65,536 ceiling, the older K2.5/K2.6 family to the clamped 32,768,
2621
- // everyone else to the discovery fallback, then clamp.
2622
- const fallbackMaxTokens = isKimiK27CodeModelId(publicModelId)
2623
- ? FIREWORKS_KIMI_K27_CODE_MAX_TOKENS
2624
- : isFireworksKimiK2ModelId(publicModelId)
2625
- ? FIREWORKS_KIMI_MAX_TOKENS
2626
- : null;
2627
- const maxTokens = clampFireworksKimiMaxTokens(publicModelId, reference?.maxTokens ?? fallbackMaxTokens);
2551
+ // The control plane reports no max-output budget; Fireworks' per-model
2552
+ // output caps and fallbacks are rule-owned (providers/fireworks.kdl).
2553
+ const maxTokens = reference?.maxTokens ?? null;
2628
2554
  const base: ModelSpec<"openai-completions"> = reference ?? {
2629
2555
  id: publicModelId,
2630
2556
  name,
@@ -3064,8 +2990,9 @@ function buildClinePassFreeModel(id: string, liveCatalog?: ClinePassLiveCatalog)
3064
2990
  input: upstream?.input ?? live?.input ?? fallback.input,
3065
2991
  contextWindow: upstream?.contextWindow ?? live?.contextWindow ?? fallback.contextWindow,
3066
2992
  maxTokens: upstream?.maxTokens ?? live?.maxTokens ?? fallback.maxTokens,
3067
- // A non-reasoning reference must not carry the Cline effort ladder.
3068
- ...(reasoning ? {} : { thinking: undefined }),
2993
+ // No reasoning-effort control means no effort ladder: the cline-pass
2994
+ // rules trust only explicit thinking, so a copied ladder would surface.
2995
+ thinking: undefined,
3069
2996
  compat: { supportsReasoningEffort: false, wireModelIdMode: "raw" },
3070
2997
  };
3071
2998
  }
@@ -4708,11 +4635,7 @@ export function veniceModelManagerOptions(
4708
4635
  config,
4709
4636
  mapModel: (entry, defaults, reference) => {
4710
4637
  const model = mapWithBundledReference(entry, defaults, reference);
4711
- return {
4712
- ...model,
4713
- maxTokens: clampKimiK27CodeMaxTokens(defaults.id, model.maxTokens),
4714
- compat: { ...model.compat, supportsUsageInStreaming: false },
4715
- };
4638
+ return { ...model, compat: { ...model.compat, supportsUsageInStreaming: false } };
4716
4639
  },
4717
4640
  });
4718
4641
  }
@@ -7645,12 +7568,7 @@ const MODELS_DEV_PROVIDER_DESCRIPTORS_SPECIALIZED: readonly ModelsDevProviderDes
7645
7568
  // --- Synthetic ---
7646
7569
  openAiCompletionsDescriptor("synthetic", "synthetic", "https://api.synthetic.new/openai/v1"),
7647
7570
  // --- Venice AI ---
7648
- openAiCompletionsDescriptor("venice", "venice", "https://api.venice.ai/api/v1", {
7649
- transformModel: model => {
7650
- const maxTokens = clampKimiK27CodeMaxTokens(model.id, model.maxTokens);
7651
- return maxTokens === model.maxTokens ? model : { ...model, maxTokens };
7652
- },
7653
- }),
7571
+ openAiCompletionsDescriptor("venice", "venice", "https://api.venice.ai/api/v1"),
7654
7572
  // --- Ollama Cloud ---
7655
7573
  simpleModelsDevDescriptor("ollama-cloud", "ollama-cloud", "ollama-chat", "https://ollama.com"),
7656
7574
  // --- Xiaomi Token Plan ---
package/src/types.ts CHANGED
@@ -571,6 +571,8 @@ export interface OpenAICompat {
571
571
  reasoningDeltasMayBeCumulative?: boolean;
572
572
  /** Strip leaked DeepSeek chat-template special tokens from visible content deltas. Default: auto-detected. */
573
573
  stripDeepseekSpecialTokens?: boolean;
574
+ /** Drop assistant thinking blocks from replayed chat-completions history. Default: false. */
575
+ stripThinkingHistory?: boolean;
574
576
  /** Heal leaked chat-template/tool-call/thinking markup from visible content deltas. Default: auto-detected. */
575
577
  streamMarkupHealingPattern?: OpenAIStreamMarkupHealingPattern;
576
578
  /** Whether this wire may revise already-streamed text (`stream-revision` axis). Unassigned: append-only. */
@@ -1042,6 +1044,7 @@ export type ResolvedOpenAICompat = ResolvedOpenAISharedCompat &
1042
1044
  | "requiresAssistantAfterToolResult"
1043
1045
  | "requiresAssistantContentForToolCalls"
1044
1046
  | "stripDeepseekSpecialTokens"
1047
+ | "stripThinkingHistory"
1045
1048
  | "streamMarkupHealingPattern"
1046
1049
  | "reasoningDeltasMayBeCumulative"
1047
1050
  | "emptyLengthFinishIsContextError"
@@ -1080,6 +1083,9 @@ export type ResolvedOpenAICompat = ResolvedOpenAISharedCompat &
1080
1083
  cacheControlFormat?: OpenAICompat["cacheControlFormat"];
1081
1084
  thinkingKeep?: OpenAICompat["thinkingKeep"];
1082
1085
  streamIdleTimeoutMs?: number;
1086
+ stripThinkingHistory?: boolean;
1087
+ /** The configured `baseUrl` is the official OpenAI API (provider `openai`); unset otherwise. */
1088
+ officialEndpoint?: boolean;
1083
1089
  toolStrictMode: ResolvedToolStrictMode;
1084
1090
  /** The model sits behind Vercel AI Gateway. */
1085
1091
  isVercelGatewayHost: boolean;
@@ -1578,6 +1584,12 @@ export interface Model<TApi extends Api = Api> {
1578
1584
  * than OMP's general image pipeline. `stb` local backends reject WebP.
1579
1585
  */
1580
1586
  imageInputDecoder?: "stb";
1587
+ /**
1588
+ * Most images one request may carry, from user configuration. Replaces the
1589
+ * catalog's `image-count-budget` for hosts no rule names, such as a custom
1590
+ * gateway in front of a vendor with a higher limit.
1591
+ */
1592
+ imageCountBudget?: number;
1581
1593
  /**
1582
1594
  * Native provider tool-call support. `false` is the only unsupported signal:
1583
1595
  * `true` and `undefined` both mean callers may use native tools. Catalog and
@@ -1660,6 +1672,8 @@ export interface Model<TApi extends Api = Api> {
1660
1672
  contextWindow: number | null;
1661
1673
  /** Preserve the host's supplied window instead of applying inferred expansion or reference-price caps. */
1662
1674
  contextWindowAuthoritative?: boolean;
1675
+ /** The long-context price tier does not cap the runtime context window when extended context is off. */
1676
+ longContextWindowUncapped?: boolean;
1663
1677
  /** Optional larger prompt window available when extended context is enabled. */
1664
1678
  maxContextWindow?: number;
1665
1679
  maxTokens: number | null;