@monotykamary/pi-opencode-provider 1.0.9 → 1.0.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monotykamary/pi-opencode-provider",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "Opencode provider extension for pi - Access GPT, Claude, Gemini, GLM, MiniMax, Kimi and more through the opencode.ai API",
5
5
  "type": "module",
6
6
  "main": "index.ts",
@@ -46,8 +46,9 @@ function fetchJSON(url) {
46
46
 
47
47
  // Format cost for display
48
48
  function formatCost(cost) {
49
- if (cost === 0) return 'Free';
50
- return `$${cost.toFixed(2)}`;
49
+ if (cost === 0) return '';
50
+ if (cost === null || cost === undefined) return '—';
51
+ return '$' + cost.toFixed(2);
51
52
  }
52
53
 
53
54
  // Format number with K/M suffix
@@ -252,6 +253,31 @@ function updateDeprecatedModels(modelsJsonPath, newModels) {
252
253
  }
253
254
  }
254
255
 
256
+ /**
257
+ * Grace-period deprecated models (deprecatedAt within TTL) with metadata stripped.
258
+ * Keeps the README table serving models that are delisted but still within their
259
+ * 14-day grace window.
260
+ */
261
+ function withDeprecatedForReadme(models) {
262
+ const deprecatedPath = path.join(process.cwd(), 'deprecated-models.json');
263
+ let deprecated = {};
264
+ try {
265
+ const parsed = JSON.parse(fs.readFileSync(deprecatedPath, 'utf8'));
266
+ if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) deprecated = parsed;
267
+ } catch { /* no graveyard yet */ }
268
+ const now = Date.now();
269
+ const seen = new Set(models.map(m => m.id));
270
+ const extras = [];
271
+ for (const entry of Object.values(deprecated)) {
272
+ if (!entry || !entry.id || seen.has(entry.id)) continue;
273
+ const removedAt = Date.parse(entry.deprecatedAt || '');
274
+ if (Number.isNaN(removedAt) || now - removedAt > DEPRECATED_MODEL_TTL_MS) continue;
275
+ const m = { ...entry };
276
+ delete m.deprecatedAt;
277
+ extras.push(m);
278
+ }
279
+ return extras.length > 0 ? [...models, ...extras] : models;
280
+ }
255
281
  async function main() {
256
282
  console.log('Fetching models from API...');
257
283