@oh-my-pi/pi-catalog 18.2.7 → 18.2.9

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 +26 -3
  2. package/README.md +18 -18
  3. package/dist/types/compat/auth-ids.d.ts +2 -2
  4. package/dist/types/compat/axes.d.ts +2 -2
  5. package/dist/types/compat/catalog-policy.d.ts +7 -0
  6. package/dist/types/compat/output-limits.d.ts +3 -0
  7. package/dist/types/compat/provider-ids.d.ts +1 -1
  8. package/dist/types/compat/tools.d.ts +5 -0
  9. package/dist/types/compat/types.d.ts +2 -2
  10. package/dist/types/provider-models/openai-compat.d.ts +26 -0
  11. package/dist/types/types.d.ts +5 -2
  12. package/dist/types/wire/singularityapi.d.ts +29 -0
  13. package/package.json +38 -38
  14. package/src/compat/auth-ids.ts +4 -0
  15. package/src/compat/axes.ts +21 -2
  16. package/src/compat/catalog-policy.ts +28 -0
  17. package/src/compat/output-limits.ts +12 -0
  18. package/src/compat/provider-ids.ts +2 -0
  19. package/src/compat/resolve.ts +4 -2
  20. package/src/compat/rules/README.md +34 -33
  21. package/src/compat/rules/auth/_order.kdl +1 -1
  22. package/src/compat/rules/auth/singularityapi-dev.kdl +22 -0
  23. package/src/compat/rules/auth/singularityapi-tech.kdl +23 -0
  24. package/src/compat/rules/classes/gpt-oss.kdl +3 -0
  25. package/src/compat/rules/classes/xai.kdl +3 -3
  26. package/src/compat/rules/providers/amazon-bedrock.kdl +1 -1
  27. package/src/compat/rules/providers/anthropic.kdl +1 -1
  28. package/src/compat/rules/providers/cloudflare-ai-gateway.kdl +1 -1
  29. package/src/compat/rules/providers/commandcode.kdl +1 -1
  30. package/src/compat/rules/providers/cursor.kdl +1 -1
  31. package/src/compat/rules/providers/google-antigravity.kdl +5 -0
  32. package/src/compat/rules/providers/kilo.kdl +1 -1
  33. package/src/compat/rules/providers/litellm.kdl +1 -1
  34. package/src/compat/rules/providers/native-tools.kdl +4 -0
  35. package/src/compat/rules/providers/openai.kdl +58 -0
  36. package/src/compat/rules/providers/opencode-zen.kdl +1 -1
  37. package/src/compat/rules/providers/openrouter.kdl +108 -0
  38. package/src/compat/rules/providers/output-limits.kdl +4 -0
  39. package/src/compat/rules/providers/singularityapi-dev.kdl +92 -0
  40. package/src/compat/rules/providers/singularityapi-tech.kdl +72 -0
  41. package/src/compat/rules/providers/tool-free-history.kdl +6 -0
  42. package/src/compat/rules/providers/vercel-ai-gateway.kdl +1 -1
  43. package/src/compat/rules/providers/xai-oauth.kdl +8 -1
  44. package/src/compat/rules/providers/xai.kdl +4 -4
  45. package/src/compat/rules/providers/xiaomi-token-plan-cn.kdl +23 -0
  46. package/src/compat/rules/providers/zenmux.kdl +1 -1
  47. package/src/compat/rules/runtime/behavior.kdl +2 -0
  48. package/src/compat/rules.json +1 -1
  49. package/src/compat/tools.ts +12 -0
  50. package/src/compat/types.ts +2 -2
  51. package/src/discovery/devin.ts +59 -34
  52. package/src/models.json +1 -1
  53. package/src/provider-models/cache-provider-id.ts +31 -0
  54. package/src/provider-models/descriptors.ts +4 -0
  55. package/src/provider-models/openai-compat.ts +390 -119
  56. package/src/types.ts +19 -1
  57. package/src/wire/singularityapi.ts +34 -0
package/src/types.ts CHANGED
@@ -24,9 +24,23 @@ export type KnownApi =
24
24
  export type Api = KnownApi | (string & {});
25
25
 
26
26
  /** Catalog kinds used to isolate role-specific runners from session chat models. */
27
- export const MODEL_KINDS = ["chat", "tiny", "image", "tts", "stt", "search", "judge"] as const;
27
+ export const MODEL_KINDS = [
28
+ "chat",
29
+ "tiny",
30
+ "image",
31
+ "tts",
32
+ "stt",
33
+ "search",
34
+ "judge",
35
+ "embedding",
36
+ "rerank",
37
+ "video",
38
+ ] as const;
28
39
  /** Technical capability of a catalog model; absent model kinds mean chat. */
29
40
  export type ModelKind = (typeof MODEL_KINDS)[number];
41
+ /** Kinds a provider maps to a runner transport through `kind-apis` in its KDL; discovery drops rows of these kinds when the provider declares no API. */
42
+ export const KIND_API_KINDS = ["image", "tts", "stt", "embedding", "rerank", "video"] as const;
43
+ export type KindApiKind = (typeof KIND_API_KINDS)[number];
30
44
  /** Grounding transport available to chat models selected by the web role. */
31
45
  export type WebSearchGrounding = "gemini" | "anthropic" | "codex" | "xai" | "openrouter";
32
46
  /** Non-chat runner protocols accepted by catalog seeds, outside the chat dispatch union. */
@@ -39,6 +53,10 @@ export const RUNNER_APIS = [
39
53
  "openrouter-images",
40
54
  "xai-tts",
41
55
  "openai-speech",
56
+ "openai-embeddings",
57
+ "openrouter-rerank",
58
+ "openrouter-video",
59
+ "openai-transcriptions",
42
60
  ] as const;
43
61
 
44
62
  /** Resolve a model's kind while preserving chat semantics for existing catalog rows. */
@@ -0,0 +1,34 @@
1
+ /**
2
+ * SingularityAPI gateways, shared so a host migration — or a self-hosted
3
+ * proxy override — touches a single module.
4
+ *
5
+ * SingularityAPI ships two unrelated products behind one brand: the
6
+ * pay-as-you-go universal gateway (`singularityapi-dev`) and the
7
+ * slot-reserved DeepSeek lanes (`singularityapi-tech`). They accept disjoint
8
+ * keys, so each provider resolves its own canonical endpoint from here.
9
+ */
10
+ export const SINGULARITYAPI_DEV_API_BASE_URL = "https://api.singularityapi.dev/v1";
11
+ export const SINGULARITYAPI_TECH_API_BASE_URL = "https://api.singularityapi.tech/v1";
12
+
13
+ /**
14
+ * Resolve a configured SingularityAPI base URL onto its gateway's `/v1`
15
+ * surface.
16
+ *
17
+ * Every consumer must agree on this, because they key different things off the
18
+ * result: discovery and inference target it, and the model-cache namespace is
19
+ * hashed from it. `ModelRegistry` hashes the raw configured value while the
20
+ * model-manager options hash a `/v1`-suffixed one, so a disagreement would
21
+ * split the namespace discovery writes from the one the registry reads and the
22
+ * authoritative roster would never come back.
23
+ *
24
+ * `canonical` names the product the caller belongs to: a blank or
25
+ * whitespace-only value means "not configured" and resolves to that canonical
26
+ * host, while anything else keeps its host and gains the `/v1` segment if it
27
+ * omits one. Passing the wrong product's canonical URL would silently point a
28
+ * provider at the other gateway, so there is no default.
29
+ */
30
+ export function normalizeSingularityApiBaseUrl(baseUrl: string | undefined, canonical: string): string {
31
+ const trimmed = baseUrl?.trim().replace(/\/+$/, "");
32
+ if (!trimmed) return canonical;
33
+ return trimmed.endsWith("/v1") ? trimmed : `${trimmed}/v1`;
34
+ }