jeopi-catalog 16.2.13

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 (137) hide show
  1. package/CHANGELOG.md +523 -0
  2. package/README.md +43 -0
  3. package/dist/types/build.d.ts +3 -0
  4. package/dist/types/compat/anthropic.d.ts +11 -0
  5. package/dist/types/compat/apply.d.ts +7 -0
  6. package/dist/types/compat/devin.d.ts +9 -0
  7. package/dist/types/compat/openai.d.ts +28 -0
  8. package/dist/types/discovery/antigravity.d.ts +70 -0
  9. package/dist/types/discovery/codex.d.ts +38 -0
  10. package/dist/types/discovery/cursor-gen/agent_pb.d.ts +13022 -0
  11. package/dist/types/discovery/cursor.d.ts +23 -0
  12. package/dist/types/discovery/devin-gen/buf/validate/validate_pb.d.ts +1715 -0
  13. package/dist/types/discovery/devin-gen/exa/analytics_pb/analytics_pb.d.ts +693 -0
  14. package/dist/types/discovery/devin-gen/exa/api_server_pb/api_server_pb.d.ts +9158 -0
  15. package/dist/types/discovery/devin-gen/exa/auth_pb/auth_pb.d.ts +52 -0
  16. package/dist/types/discovery/devin-gen/exa/auto_cascade_common_pb/auto_cascade_common_pb.d.ts +276 -0
  17. package/dist/types/discovery/devin-gen/exa/bug_checker_pb/bug_checker_pb.d.ts +78 -0
  18. package/dist/types/discovery/devin-gen/exa/cascade_plugins_pb/cascade_plugins_pb.d.ts +999 -0
  19. package/dist/types/discovery/devin-gen/exa/chat_pb/chat_pb.d.ts +1704 -0
  20. package/dist/types/discovery/devin-gen/exa/code_edit/code_edit_pb/code_edit_pb.d.ts +656 -0
  21. package/dist/types/discovery/devin-gen/exa/codeium_common_pb/codeium_common_pb.d.ts +15014 -0
  22. package/dist/types/discovery/devin-gen/exa/context_module_pb/context_module_pb.d.ts +607 -0
  23. package/dist/types/discovery/devin-gen/exa/cortex_pb/cortex_pb.d.ts +11830 -0
  24. package/dist/types/discovery/devin-gen/exa/diff_action_pb/diff_action_pb.d.ts +248 -0
  25. package/dist/types/discovery/devin-gen/exa/index_pb/index_pb.d.ts +1747 -0
  26. package/dist/types/discovery/devin-gen/exa/knowledge_base_pb/knowledge_base_pb.d.ts +509 -0
  27. package/dist/types/discovery/devin-gen/exa/language_server_pb/language_server_pb.d.ts +9048 -0
  28. package/dist/types/discovery/devin-gen/exa/opensearch_clients_pb/opensearch_clients_pb.d.ts +1760 -0
  29. package/dist/types/discovery/devin-gen/exa/prompt_pb/prompt_pb.d.ts +286 -0
  30. package/dist/types/discovery/devin-gen/exa/reactive_component_pb/reactive_component_pb.d.ts +405 -0
  31. package/dist/types/discovery/devin-gen/exa/trust_pb/trust_pb.d.ts +582 -0
  32. package/dist/types/discovery/devin.d.ts +24 -0
  33. package/dist/types/discovery/gemini.d.ts +25 -0
  34. package/dist/types/discovery/gitlab-duo-workflow.d.ts +30 -0
  35. package/dist/types/discovery/index.d.ts +5 -0
  36. package/dist/types/discovery/openai-compatible.d.ts +74 -0
  37. package/dist/types/effort.d.ts +9 -0
  38. package/dist/types/fireworks-model-id.d.ts +23 -0
  39. package/dist/types/hosts.d.ts +137 -0
  40. package/dist/types/identity/bundled.d.ts +3 -0
  41. package/dist/types/identity/classify.d.ts +69 -0
  42. package/dist/types/identity/dialect.d.ts +3 -0
  43. package/dist/types/identity/family.d.ts +139 -0
  44. package/dist/types/identity/id.d.ts +12 -0
  45. package/dist/types/identity/index.d.ts +8 -0
  46. package/dist/types/identity/markers.d.ts +4 -0
  47. package/dist/types/identity/priority.d.ts +1 -0
  48. package/dist/types/identity/reference.d.ts +23 -0
  49. package/dist/types/index.d.ts +17 -0
  50. package/dist/types/model-cache.d.ts +17 -0
  51. package/dist/types/model-manager.d.ts +68 -0
  52. package/dist/types/model-thinking.d.ts +79 -0
  53. package/dist/types/models.d.ts +12 -0
  54. package/dist/types/provider-models/bundled-references.d.ts +11 -0
  55. package/dist/types/provider-models/descriptor-types.d.ts +74 -0
  56. package/dist/types/provider-models/descriptors.d.ts +427 -0
  57. package/dist/types/provider-models/google.d.ts +27 -0
  58. package/dist/types/provider-models/index.d.ts +6 -0
  59. package/dist/types/provider-models/ollama.d.ts +9 -0
  60. package/dist/types/provider-models/openai-compat.d.ts +450 -0
  61. package/dist/types/provider-models/special.d.ts +33 -0
  62. package/dist/types/types.d.ts +656 -0
  63. package/dist/types/utils.d.ts +20 -0
  64. package/dist/types/variant-collapse.d.ts +133 -0
  65. package/dist/types/wire/codex.d.ts +26 -0
  66. package/dist/types/wire/coreweave.d.ts +12 -0
  67. package/dist/types/wire/gemini-headers.d.ts +37 -0
  68. package/dist/types/wire/github-copilot.d.ts +45 -0
  69. package/package.json +101 -0
  70. package/src/build.ts +47 -0
  71. package/src/compat/anthropic.ts +93 -0
  72. package/src/compat/apply.ts +15 -0
  73. package/src/compat/devin.ts +12 -0
  74. package/src/compat/openai.ts +689 -0
  75. package/src/discovery/antigravity.ts +253 -0
  76. package/src/discovery/codex.ts +371 -0
  77. package/src/discovery/cursor-gen/agent_pb.ts +15274 -0
  78. package/src/discovery/cursor.ts +314 -0
  79. package/src/discovery/devin-gen/buf/validate/validate_pb.ts +1862 -0
  80. package/src/discovery/devin-gen/exa/analytics_pb/analytics_pb.ts +871 -0
  81. package/src/discovery/devin-gen/exa/api_server_pb/api_server_pb.ts +11083 -0
  82. package/src/discovery/devin-gen/exa/auth_pb/auth_pb.ts +71 -0
  83. package/src/discovery/devin-gen/exa/auto_cascade_common_pb/auto_cascade_common_pb.ts +348 -0
  84. package/src/discovery/devin-gen/exa/bug_checker_pb/bug_checker_pb.ts +103 -0
  85. package/src/discovery/devin-gen/exa/cascade_plugins_pb/cascade_plugins_pb.ts +1198 -0
  86. package/src/discovery/devin-gen/exa/chat_pb/chat_pb.ts +2063 -0
  87. package/src/discovery/devin-gen/exa/code_edit/code_edit_pb/code_edit_pb.ts +810 -0
  88. package/src/discovery/devin-gen/exa/codeium_common_pb/codeium_common_pb.ts +18354 -0
  89. package/src/discovery/devin-gen/exa/context_module_pb/context_module_pb.ts +732 -0
  90. package/src/discovery/devin-gen/exa/cortex_pb/cortex_pb.ts +14277 -0
  91. package/src/discovery/devin-gen/exa/diff_action_pb/diff_action_pb.ts +312 -0
  92. package/src/discovery/devin-gen/exa/index_pb/index_pb.ts +2106 -0
  93. package/src/discovery/devin-gen/exa/knowledge_base_pb/knowledge_base_pb.ts +623 -0
  94. package/src/discovery/devin-gen/exa/language_server_pb/language_server_pb.ts +10918 -0
  95. package/src/discovery/devin-gen/exa/opensearch_clients_pb/opensearch_clients_pb.ts +2125 -0
  96. package/src/discovery/devin-gen/exa/prompt_pb/prompt_pb.ts +361 -0
  97. package/src/discovery/devin-gen/exa/reactive_component_pb/reactive_component_pb.ts +450 -0
  98. package/src/discovery/devin-gen/exa/trust_pb/trust_pb.ts +712 -0
  99. package/src/discovery/devin.ts +151 -0
  100. package/src/discovery/gemini.ts +260 -0
  101. package/src/discovery/gitlab-duo-workflow.ts +855 -0
  102. package/src/discovery/index.ts +5 -0
  103. package/src/discovery/openai-compatible.ts +249 -0
  104. package/src/effort.ts +16 -0
  105. package/src/fireworks-model-id.ts +50 -0
  106. package/src/hosts.ts +129 -0
  107. package/src/identity/bundled.ts +28 -0
  108. package/src/identity/classify.ts +214 -0
  109. package/src/identity/dialect.ts +42 -0
  110. package/src/identity/family.ts +296 -0
  111. package/src/identity/id.ts +81 -0
  112. package/src/identity/index.ts +8 -0
  113. package/src/identity/markers.ts +49 -0
  114. package/src/identity/priority.ts +57 -0
  115. package/src/identity/reference.ts +148 -0
  116. package/src/index.ts +17 -0
  117. package/src/model-cache.ts +171 -0
  118. package/src/model-manager.ts +520 -0
  119. package/src/model-thinking.ts +760 -0
  120. package/src/models.json +88898 -0
  121. package/src/models.json.d.ts +9 -0
  122. package/src/models.ts +64 -0
  123. package/src/provider-models/bundled-references.ts +58 -0
  124. package/src/provider-models/descriptor-types.ts +79 -0
  125. package/src/provider-models/descriptors.ts +503 -0
  126. package/src/provider-models/google.ts +107 -0
  127. package/src/provider-models/index.ts +6 -0
  128. package/src/provider-models/ollama.ts +172 -0
  129. package/src/provider-models/openai-compat.ts +4283 -0
  130. package/src/provider-models/special.ts +159 -0
  131. package/src/types.ts +786 -0
  132. package/src/utils.ts +69 -0
  133. package/src/variant-collapse.ts +1065 -0
  134. package/src/wire/codex.ts +43 -0
  135. package/src/wire/coreweave.ts +51 -0
  136. package/src/wire/gemini-headers.ts +74 -0
  137. package/src/wire/github-copilot.ts +121 -0
package/src/index.ts ADDED
@@ -0,0 +1,17 @@
1
+ export * from "./compat/openai";
2
+ export * from "./discovery";
3
+ export * from "./effort";
4
+ export * from "./fireworks-model-id";
5
+ export * from "./identity";
6
+ export * from "./model-cache";
7
+ export * from "./model-manager";
8
+ export * from "./model-thinking";
9
+ export * from "./models";
10
+ export * from "./provider-models";
11
+ export * from "./types";
12
+ export * from "./utils";
13
+ export * from "./variant-collapse";
14
+ export * from "./wire/codex";
15
+ export * from "./wire/coreweave";
16
+ export * from "./wire/gemini-headers";
17
+ export * from "./wire/github-copilot";
@@ -0,0 +1,171 @@
1
+ /**
2
+ * SQLite-backed model cache for atomic cross-process access.
3
+ * Replaces per-provider JSON files with a single cache.db.
4
+ */
5
+ import { Database } from "bun:sqlite";
6
+ import { getModelDbPath } from "jeopi-utils";
7
+ import type { Api, Model, ModelSpec } from "./types";
8
+
9
+ // Rows persist ModelSpec JSON (sparse `compat`, never the resolved record);
10
+ // the model manager rebuilds via `buildModel` on load. v8 invalidates Codex
11
+ // discovery rows predating provider-native V2 compaction metadata; v7
12
+ // invalidated rows predating the Antigravity Gemini budget-mode migration
13
+ // (cached specs still carrying `thinking.mode: "google-level"` and the old
14
+ // 3.5-flash effort routing); v6 invalidated rows that may contain the retired
15
+ // unknown-limit sentinels (222222/8888); v5 invalidated rows predating
16
+ // effort-tier variant collapsing (raw `-low`/`-high`/`-thinking` member ids);
17
+ // v4 dropped the pre-efforts ThinkingConfig shape.
18
+ const CACHE_SCHEMA_VERSION = 8;
19
+
20
+ interface CacheRow {
21
+ provider_id: string;
22
+ version: number;
23
+ updated_at: number;
24
+ authoritative: number;
25
+ static_fingerprint: string;
26
+ models: string;
27
+ }
28
+
29
+ interface TableInfoRow {
30
+ name: string;
31
+ }
32
+
33
+ interface CacheEntry<TApi extends Api = Api> {
34
+ models: ModelSpec<TApi>[];
35
+ fresh: boolean;
36
+ authoritative: boolean;
37
+ updatedAt: number;
38
+ /**
39
+ * Hash of the static catalog slice that was merged into `models` when this
40
+ * row was written. `resolveProviderModels` compares against the current
41
+ * static fingerprint and bypasses the static+cache re-merge when they
42
+ * match — the cache already incorporates the same static state.
43
+ */
44
+ staticFingerprint: string;
45
+ }
46
+
47
+ let sharedDb: Database | null = null;
48
+ let sharedDbPath: string | null = null;
49
+
50
+ function openDb(resolvedPath: string): Database {
51
+ const db = new Database(resolvedPath, { create: true });
52
+ // Install the busy handler BEFORE any lock-taking statement. See
53
+ // https://github.com/can1357/oh-my-pi/issues/2421.
54
+ db.run("PRAGMA busy_timeout = 3000");
55
+ db.run("PRAGMA journal_mode = WAL");
56
+ db.run(`
57
+ CREATE TABLE IF NOT EXISTS model_cache (
58
+ provider_id TEXT PRIMARY KEY,
59
+ version INTEGER NOT NULL,
60
+ updated_at INTEGER NOT NULL,
61
+ authoritative INTEGER NOT NULL DEFAULT 0,
62
+ static_fingerprint TEXT NOT NULL DEFAULT '',
63
+ models TEXT NOT NULL
64
+ )
65
+ `);
66
+ migrateCacheSchema(db);
67
+ return db;
68
+ }
69
+
70
+ function getSharedDb(): Database {
71
+ const resolvedPath = getModelDbPath();
72
+ if (sharedDb && sharedDbPath === resolvedPath) {
73
+ return sharedDb;
74
+ }
75
+ if (sharedDb) {
76
+ sharedDb.close();
77
+ }
78
+ const db = openDb(resolvedPath);
79
+ sharedDb = db;
80
+ sharedDbPath = resolvedPath;
81
+ return db;
82
+ }
83
+
84
+ function withModelCacheDb<T>(dbPath: string | undefined, useDb: (db: Database) => T): T {
85
+ if (!dbPath) return useDb(getSharedDb());
86
+ const db = openDb(dbPath);
87
+ try {
88
+ return useDb(db);
89
+ } finally {
90
+ db.close();
91
+ }
92
+ }
93
+
94
+ function migrateCacheSchema(db: Database): void {
95
+ const stmt = db.prepare("PRAGMA table_info(model_cache)");
96
+ try {
97
+ const columns = stmt.all() as TableInfoRow[];
98
+ if (!columns.some(column => column.name === "static_fingerprint")) {
99
+ db.run("ALTER TABLE model_cache ADD COLUMN static_fingerprint TEXT NOT NULL DEFAULT ''");
100
+ }
101
+ } finally {
102
+ stmt.finalize();
103
+ }
104
+ // Delete rows written under any older schema so they cannot be reused. The
105
+ // legacy `UPDATE ... WHERE version = 2` migration silently promoted the very
106
+ // first cache version to whatever the current one is, defeating every
107
+ // subsequent invalidation (see #4146: pre-V2 Codex rows kept the legacy
108
+ // compaction path even after CACHE_SCHEMA_VERSION was bumped).
109
+ db.run("DELETE FROM model_cache WHERE version <> ?", [CACHE_SCHEMA_VERSION]);
110
+ }
111
+
112
+ export function readModelCache<TApi extends Api>(
113
+ providerId: string,
114
+ ttlMs: number,
115
+ now: () => number,
116
+ dbPath?: string,
117
+ ): CacheEntry<TApi> | null {
118
+ try {
119
+ return withModelCacheDb(dbPath, db => {
120
+ const stmt = db.query<CacheRow, [string]>("SELECT * FROM model_cache WHERE provider_id = ?");
121
+ try {
122
+ const row = stmt.get(providerId);
123
+ if (!row || row.version !== CACHE_SCHEMA_VERSION) {
124
+ return null;
125
+ }
126
+ const models = JSON.parse(row.models) as ModelSpec<TApi>[];
127
+ const ageMs = now() - row.updated_at;
128
+ const fresh = Number.isFinite(ageMs) && ageMs >= 0 && ageMs <= ttlMs;
129
+ return {
130
+ models,
131
+ fresh,
132
+ authoritative: row.authoritative === 1,
133
+ updatedAt: row.updated_at,
134
+ staticFingerprint: row.static_fingerprint ?? "",
135
+ };
136
+ } finally {
137
+ stmt.finalize();
138
+ }
139
+ });
140
+ } catch {
141
+ return null;
142
+ }
143
+ }
144
+
145
+ export function writeModelCache<TApi extends Api>(
146
+ providerId: string,
147
+ updatedAt: number,
148
+ models: Model<TApi>[],
149
+ authoritative: boolean,
150
+ staticFingerprint: string,
151
+ dbPath?: string,
152
+ ): void {
153
+ try {
154
+ withModelCacheDb(dbPath, db => {
155
+ db.run(
156
+ `INSERT OR REPLACE INTO model_cache (provider_id, version, updated_at, authoritative, static_fingerprint, models)
157
+ VALUES (?, ?, ?, ?, ?, ?)`,
158
+ [
159
+ providerId,
160
+ CACHE_SCHEMA_VERSION,
161
+ updatedAt,
162
+ authoritative ? 1 : 0,
163
+ staticFingerprint,
164
+ JSON.stringify(models.map(model => ({ ...model, compat: model.compatConfig, compatConfig: undefined }))),
165
+ ],
166
+ );
167
+ });
168
+ } catch {
169
+ // Cache writes are best-effort; failures should not break model resolution.
170
+ }
171
+ }