pi-tensorix-provider 1.0.4 → 1.0.5
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.
- package/AGENTS.md +1 -0
- package/README.md +1 -5
- package/deprecated-models.json +1 -0
- package/index.ts +34 -1
- package/models.json +6 -70
- package/package.json +1 -1
- package/scripts/update-models.js +63 -0
package/AGENTS.md
CHANGED
|
@@ -7,6 +7,7 @@ The following files are **idempotent** and regenerated by `scripts/update-models
|
|
|
7
7
|
| File | Why it's auto-generated |
|
|
8
8
|
|------|------------------------|
|
|
9
9
|
| `models.json` | Built from the provider API. `update-models.js` fetches models, preserves curated data for known IDs, and writes this file. |
|
|
10
|
+
| `deprecated-models.json` | Graveyard for models the API delisted. update-models.js stamps them with deprecatedAt and pi keeps serving them for a 2-week grace period, then evicts them. Never edit by hand. |
|
|
10
11
|
| `README.md` (model table) | The table under `## Available Models` is replaced in-place by `update-models.js` after merging base models → patch → custom models. |
|
|
11
12
|
|
|
12
13
|
## Correct Files to Edit
|
package/README.md
CHANGED
|
@@ -31,21 +31,17 @@ _32 models — DeepSeek, Kimi, GLM, Qwen, MiniMax, Llama — all **free** for [p
|
|
|
31
31
|
| Deepseek R1 0528 | 131K | ❌ | ✅ | **Free** | **Free** |
|
|
32
32
|
| Deepseek V3.2 | 164K | ❌ | ✅ | **Free** | **Free** |
|
|
33
33
|
| Deepseek V4 Flash | 1.0M | ❌ | ✅ | **Free** | **Free** |
|
|
34
|
-
| Deepseek V4 Flash Backup | 131K | ❌ | ❌ | **Free** | **Free** |
|
|
35
34
|
| Deepseek V4 Pro | 1.0M | ❌ | ✅ | **Free** | **Free** |
|
|
36
|
-
| Glm 4.7 | 203K | ❌ | ✅ | **Free** | **Free** |
|
|
37
35
|
| Glm 5 | 203K | ❌ | ✅ | **Free** | **Free** |
|
|
38
36
|
| Glm 5 Turbo | 203K | ❌ | ✅ | **Free** | **Free** |
|
|
39
37
|
| Glm 5.1 | 203K | ❌ | ✅ | **Free** | **Free** |
|
|
40
38
|
| Glm 5.2 | 131K | ❌ | ❌ | **Free** | **Free** |
|
|
41
39
|
| Glm 5v Turbo | 203K | ✅ | ✅ | **Free** | **Free** |
|
|
42
40
|
| Gpt Oss 120b | 131K | ❌ | ✅ | **Free** | **Free** |
|
|
43
|
-
| Gpt Oss 20b | 131K | ❌ | ✅ | **Free** | **Free** |
|
|
44
|
-
| Hy3 | 131K | ❌ | ❌ | **Free** | **Free** |
|
|
45
41
|
| Kimi K2.5 | 262K | ✅ | ✅ | **Free** | **Free** |
|
|
46
42
|
| Kimi K2.6 | 262K | ✅ | ✅ | **Free** | **Free** |
|
|
47
43
|
| Kimi K2.7 Code | 131K | ❌ | ❌ | **Free** | **Free** |
|
|
48
|
-
|
|
|
44
|
+
| Kimi K3 | 131K | ❌ | ❌ | **Free** | **Free** |
|
|
49
45
|
| Minimax M2.5 | 205K | ❌ | ✅ | **Free** | **Free** |
|
|
50
46
|
| Minimax M3 | 131K | ❌ | ❌ | **Free** | **Free** |
|
|
51
47
|
| Nemotron 3 Super 120b A12b | 4K | ❌ | ❌ | **Free** | **Free** |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
package/index.ts
CHANGED
|
@@ -45,6 +45,7 @@ import { getAgentDir, type ExtensionAPI, type ModelRegistry } from "@earendil-wo
|
|
|
45
45
|
import modelsData from "./models.json" with { type: "json" };
|
|
46
46
|
import customModelsData from "./custom-models.json" with { type: "json" };
|
|
47
47
|
import patchData from "./patch.json" with { type: "json" };
|
|
48
|
+
import deprecatedData from "./deprecated-models.json" with { type: "json" };
|
|
48
49
|
import fs from "fs";
|
|
49
50
|
import path from "path";
|
|
50
51
|
|
|
@@ -129,7 +130,10 @@ function applyPatch(model: JsonModel, patch: PatchEntry): JsonModel {
|
|
|
129
130
|
function buildModels(base: JsonModel[], custom: JsonModel[], patch: PatchData): JsonModel[] {
|
|
130
131
|
const modelMap = new Map<string, JsonModel>();
|
|
131
132
|
|
|
132
|
-
|
|
133
|
+
// Seed with the base list plus grace-period deprecated models so patch.json
|
|
134
|
+
// entries apply to deprecated models exactly as while the model was live
|
|
135
|
+
// (withDeprecated keeps live data on id conflicts).
|
|
136
|
+
for (const model of withDeprecated(base)) {
|
|
133
137
|
modelMap.set(model.id, model);
|
|
134
138
|
}
|
|
135
139
|
|
|
@@ -257,6 +261,35 @@ function mergeWithEmbedded(liveModels: JsonModel[], embeddedModels: JsonModel[])
|
|
|
257
261
|
return result;
|
|
258
262
|
}
|
|
259
263
|
|
|
264
|
+
// Grace period for delisted models. When the provider API stops listing a
|
|
265
|
+
// model, update-models.js moves its last-known definition into
|
|
266
|
+
// deprecated-models.json (stamped with deprecatedAt) instead of dropping it.
|
|
267
|
+
// For 14 days the model keeps working here so in-flight sessions and saved
|
|
268
|
+
// model settings do not break; afterwards it is evicted permanently.
|
|
269
|
+
const DEPRECATED_MODEL_TTL_MS = 14 * 24 * 60 * 60 * 1000;
|
|
270
|
+
|
|
271
|
+
// Grace-period deprecated models with deprecation metadata stripped.
|
|
272
|
+
function activeDeprecatedModels(): JsonModel[] {
|
|
273
|
+
const now = Date.now();
|
|
274
|
+
const result: JsonModel[] = [];
|
|
275
|
+
for (const entry of Object.values(deprecatedData as Record<string, JsonModel & { deprecatedAt?: string }>)) {
|
|
276
|
+
if (!entry?.id) continue;
|
|
277
|
+
const removedAt = Date.parse(entry.deprecatedAt ?? "");
|
|
278
|
+
if (Number.isNaN(removedAt) || now - removedAt > DEPRECATED_MODEL_TTL_MS) continue;
|
|
279
|
+
const model = { ...entry } as JsonModel & { deprecatedAt?: string };
|
|
280
|
+
delete model.deprecatedAt;
|
|
281
|
+
result.push(model);
|
|
282
|
+
}
|
|
283
|
+
return result;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// Append grace-period deprecated models the list does not already have (live data wins).
|
|
287
|
+
function withDeprecated(models: JsonModel[]): JsonModel[] {
|
|
288
|
+
const seen = new Set(models.map((m) => m.id));
|
|
289
|
+
const extras = activeDeprecatedModels().filter((m) => !seen.has(m.id));
|
|
290
|
+
return extras.length > 0 ? [...models, ...extras] : models;
|
|
291
|
+
}
|
|
292
|
+
|
|
260
293
|
function loadStaleModels(embeddedModels: JsonModel[]): JsonModel[] {
|
|
261
294
|
const cached = loadCachedModels();
|
|
262
295
|
if (!cached || cached.length === 0) return embeddedModels;
|
package/models.json
CHANGED
|
@@ -15,22 +15,6 @@
|
|
|
15
15
|
"contextWindow": 131072,
|
|
16
16
|
"maxTokens": 131072
|
|
17
17
|
},
|
|
18
|
-
{
|
|
19
|
-
"id": "deepseek-v4-flash-backup",
|
|
20
|
-
"name": "Deepseek V4 Flash Backup",
|
|
21
|
-
"reasoning": false,
|
|
22
|
-
"input": [
|
|
23
|
-
"text"
|
|
24
|
-
],
|
|
25
|
-
"cost": {
|
|
26
|
-
"input": 0,
|
|
27
|
-
"output": 0,
|
|
28
|
-
"cacheRead": 0,
|
|
29
|
-
"cacheWrite": 0
|
|
30
|
-
},
|
|
31
|
-
"contextWindow": 131072,
|
|
32
|
-
"maxTokens": 131072
|
|
33
|
-
},
|
|
34
18
|
{
|
|
35
19
|
"id": "deepseek/deepseek-chat-v3.1",
|
|
36
20
|
"name": "Deepseek Chat V3.1",
|
|
@@ -192,8 +176,8 @@
|
|
|
192
176
|
"maxTokens": 131072
|
|
193
177
|
},
|
|
194
178
|
{
|
|
195
|
-
"id": "
|
|
196
|
-
"name": "
|
|
179
|
+
"id": "moonshotai/kimi-k3",
|
|
180
|
+
"name": "Kimi K3",
|
|
197
181
|
"reasoning": false,
|
|
198
182
|
"input": [
|
|
199
183
|
"text"
|
|
@@ -208,8 +192,8 @@
|
|
|
208
192
|
"maxTokens": 131072
|
|
209
193
|
},
|
|
210
194
|
{
|
|
211
|
-
"id": "
|
|
212
|
-
"name": "
|
|
195
|
+
"id": "nvidia/nemotron-3-super-120b-a12b",
|
|
196
|
+
"name": "Nemotron 3 Super 120b A12b",
|
|
213
197
|
"reasoning": false,
|
|
214
198
|
"input": [
|
|
215
199
|
"text"
|
|
@@ -224,8 +208,8 @@
|
|
|
224
208
|
"maxTokens": 131072
|
|
225
209
|
},
|
|
226
210
|
{
|
|
227
|
-
"id": "openai/gpt-oss-
|
|
228
|
-
"name": "Gpt Oss
|
|
211
|
+
"id": "openai/gpt-oss-120b",
|
|
212
|
+
"name": "Gpt Oss 120b",
|
|
229
213
|
"reasoning": false,
|
|
230
214
|
"input": [
|
|
231
215
|
"text"
|
|
@@ -319,54 +303,6 @@
|
|
|
319
303
|
"contextWindow": 131072,
|
|
320
304
|
"maxTokens": 131072
|
|
321
305
|
},
|
|
322
|
-
{
|
|
323
|
-
"id": "tencent/hy3",
|
|
324
|
-
"name": "Hy3",
|
|
325
|
-
"reasoning": false,
|
|
326
|
-
"input": [
|
|
327
|
-
"text"
|
|
328
|
-
],
|
|
329
|
-
"cost": {
|
|
330
|
-
"input": 0,
|
|
331
|
-
"output": 0,
|
|
332
|
-
"cacheRead": 0,
|
|
333
|
-
"cacheWrite": 0
|
|
334
|
-
},
|
|
335
|
-
"contextWindow": 131072,
|
|
336
|
-
"maxTokens": 131072
|
|
337
|
-
},
|
|
338
|
-
{
|
|
339
|
-
"id": "xiaomi/mimo-v2.5",
|
|
340
|
-
"name": "Mimo V2.5",
|
|
341
|
-
"reasoning": false,
|
|
342
|
-
"input": [
|
|
343
|
-
"text"
|
|
344
|
-
],
|
|
345
|
-
"cost": {
|
|
346
|
-
"input": 0,
|
|
347
|
-
"output": 0,
|
|
348
|
-
"cacheRead": 0,
|
|
349
|
-
"cacheWrite": 0
|
|
350
|
-
},
|
|
351
|
-
"contextWindow": 131072,
|
|
352
|
-
"maxTokens": 131072
|
|
353
|
-
},
|
|
354
|
-
{
|
|
355
|
-
"id": "z-ai/glm-4.7",
|
|
356
|
-
"name": "Glm 4.7",
|
|
357
|
-
"reasoning": false,
|
|
358
|
-
"input": [
|
|
359
|
-
"text"
|
|
360
|
-
],
|
|
361
|
-
"cost": {
|
|
362
|
-
"input": 0,
|
|
363
|
-
"output": 0,
|
|
364
|
-
"cacheRead": 0,
|
|
365
|
-
"cacheWrite": 0
|
|
366
|
-
},
|
|
367
|
-
"contextWindow": 131072,
|
|
368
|
-
"maxTokens": 131072
|
|
369
|
-
},
|
|
370
306
|
{
|
|
371
307
|
"id": "z-ai/glm-5",
|
|
372
308
|
"name": "Glm 5",
|
package/package.json
CHANGED
package/scripts/update-models.js
CHANGED
|
@@ -198,6 +198,67 @@ function cleanModelForJson(model) {
|
|
|
198
198
|
|
|
199
199
|
// ─── Main ──────────────────────────────────────────────────────────────────────
|
|
200
200
|
|
|
201
|
+
// Grace period for delisted models: update-models.js moves models the API no
|
|
202
|
+
// longer lists into deprecated-models.json (stamped with deprecatedAt) instead
|
|
203
|
+
// of dropping them; the runtime appends them back so sessions and saved model
|
|
204
|
+
// settings keep working, and after 14 days they are evicted permanently.
|
|
205
|
+
const DEPRECATED_MODEL_TTL_MS = 14 * 24 * 60 * 60 * 1000;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Reconcile deprecated-models.json against the freshly fetched model list.
|
|
209
|
+
* - in old models.json but not the API: moved into the deprecated file
|
|
210
|
+
* (deprecatedAt = now; preserved on repeat runs so the grace clock is not reset)
|
|
211
|
+
* - back in the API: resurrected (dropped from the deprecated file)
|
|
212
|
+
* - deprecatedAt older than 14 days: evicted permanently
|
|
213
|
+
* Must run BEFORE the new models.json is written; it reads the old file itself.
|
|
214
|
+
*/
|
|
215
|
+
function updateDeprecatedModels(modelsJsonPath, newModels) {
|
|
216
|
+
const deprecatedPath = path.join(path.dirname(modelsJsonPath), 'deprecated-models.json');
|
|
217
|
+
|
|
218
|
+
let oldModels = [];
|
|
219
|
+
try {
|
|
220
|
+
const parsed = JSON.parse(fs.readFileSync(modelsJsonPath, 'utf8'));
|
|
221
|
+
if (Array.isArray(parsed)) oldModels = parsed;
|
|
222
|
+
} catch { /* first run: no previous models.json */ }
|
|
223
|
+
|
|
224
|
+
let deprecated = {};
|
|
225
|
+
try {
|
|
226
|
+
const parsed = JSON.parse(fs.readFileSync(deprecatedPath, 'utf8'));
|
|
227
|
+
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) deprecated = parsed;
|
|
228
|
+
} catch { /* no graveyard yet */ }
|
|
229
|
+
|
|
230
|
+
const currentIds = new Set(newModels.map(m => m.id));
|
|
231
|
+
const now = new Date().toISOString();
|
|
232
|
+
const added = [];
|
|
233
|
+
const resurrected = [];
|
|
234
|
+
const evicted = [];
|
|
235
|
+
|
|
236
|
+
for (const old of oldModels) {
|
|
237
|
+
if (old && old.id && !currentIds.has(old.id) && !deprecated[old.id]) {
|
|
238
|
+
deprecated[old.id] = { ...old, deprecatedAt: now };
|
|
239
|
+
added.push(old.id);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
for (const [id, entry] of Object.entries(deprecated)) {
|
|
244
|
+
if (currentIds.has(id)) {
|
|
245
|
+
delete deprecated[id];
|
|
246
|
+
resurrected.push(id);
|
|
247
|
+
continue;
|
|
248
|
+
}
|
|
249
|
+
const removedAt = Date.parse(entry && entry.deprecatedAt ? entry.deprecatedAt : '');
|
|
250
|
+
if (Number.isNaN(removedAt) || Date.now() - removedAt > DEPRECATED_MODEL_TTL_MS) {
|
|
251
|
+
delete deprecated[id];
|
|
252
|
+
evicted.push(id);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
if (added.length > 0 || resurrected.length > 0 || evicted.length > 0) {
|
|
257
|
+
fs.writeFileSync(deprecatedPath, JSON.stringify(deprecated, null, 2) + '\n');
|
|
258
|
+
console.log('Updated deprecated-models.json ' + JSON.stringify({ added, resurrected, evicted }));
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
201
262
|
async function main() {
|
|
202
263
|
console.log(`Fetching models from ${MODELS_API_URL}...`);
|
|
203
264
|
|
|
@@ -244,6 +305,8 @@ async function main() {
|
|
|
244
305
|
|
|
245
306
|
// Update models.json — API-derived model list with curated specs preserved
|
|
246
307
|
const cleanModels = apiTransformed.map(cleanModelForJson);
|
|
308
|
+
// Move delisted models to deprecated-models.json BEFORE models.json is overwritten
|
|
309
|
+
updateDeprecatedModels(MODELS_JSON_PATH, cleanModels);
|
|
247
310
|
fs.writeFileSync(MODELS_JSON_PATH, JSON.stringify(cleanModels, null, 2) + '\n');
|
|
248
311
|
console.log('✓ Updated models.json (API model list with curated specs)');
|
|
249
312
|
|