@telefonica/ai-sdlc-opencode-plugin-v1-dev 1.0.3 → 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.
@@ -310,8 +310,9 @@ function modelRows(payload) {
310
310
  return payload.data;
311
311
  }
312
312
  function infoRows(payload) {
313
- if (!isRecord(payload) || !Array.isArray(payload.data)) return [];
314
- return payload.data.filter(isRecord);
313
+ if (!isRecord(payload) || !Array.isArray(payload.data)) return void 0;
314
+ if (!payload.data.every((entry) => isRecord(entry) && typeof entry.model_name === "string" && entry.model_name.length > 0 && isRecord(entry.model_info) && (entry.litellm_params === void 0 || isRecord(entry.litellm_params)))) return void 0;
315
+ return payload.data;
315
316
  }
316
317
  function usableModel(model) {
317
318
  return !model.mode || model.mode === "chat";
@@ -322,22 +323,27 @@ async function discoverModelsResult(options) {
322
323
  const [modelsResponse, infoResponse] = await Promise.all([fetchJSON(`${baseURL}/v1/models`, options, "models.discover"), fetchJSON(`${baseURL}/v1/model/info`, options, "models.discover")]);
323
324
  let result;
324
325
  if (!modelsResponse.ok) result = modelsResponse;
326
+ else if (!infoResponse.ok) result = infoResponse;
325
327
  else {
326
328
  const rows = modelRows(modelsResponse.value);
329
+ const metadataPayload = infoResponse.value;
330
+ const metadataRows = infoRows(metadataPayload);
327
331
  if (!rows) result = invalid("Invalid or empty /v1/models response");
332
+ else if (!metadataRows) result = invalid("Invalid /v1/model/info response");
328
333
  else {
329
334
  const infos = /* @__PURE__ */ new Map();
330
- if (infoResponse.ok) {
331
- for (const row of infoRows(infoResponse.value)) if (typeof row.model_name === "string") infos.set(row.model_name, row);
335
+ for (const row of metadataRows) infos.set(row.model_name, row);
336
+ if (!rows.every((row) => infos.has(row.id))) result = invalid("Incomplete /v1/model/info response");
337
+ else {
338
+ const models = rows.map((row) => {
339
+ const metadata = infos.get(row.id);
340
+ return normalizeModel(row, metadata.model_info, metadata.litellm_params);
341
+ }).filter(usableModel);
342
+ result = models.length > 0 ? {
343
+ ok: true,
344
+ value: models
345
+ } : invalid("No usable chat models in /v1/models response");
332
346
  }
333
- const models = rows.map((row) => {
334
- const metadata = infos.get(row.id);
335
- return normalizeModel(row, metadata?.model_info, metadata?.litellm_params);
336
- }).filter(usableModel);
337
- result = models.length > 0 ? {
338
- ok: true,
339
- value: models
340
- } : invalid("No usable chat models in /v1/models response");
341
347
  }
342
348
  }
343
349
  emitGatewayLog(options, {
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { f as unsanitizeModelId, i as normalizeProviderURL, o as discoverModels, t as DEV, u as PLUGIN_COPY } from "./flavor-8QVaVpzl.js";
1
+ import { f as unsanitizeModelId, i as normalizeProviderURL, o as discoverModels, t as DEV, u as PLUGIN_COPY } from "./flavor-CWgyuHyl.js";
2
2
  import { createHash, randomUUID } from "node:crypto";
3
3
  import { mkdir, readFile, rename, rm, stat, writeFile } from "node:fs/promises";
4
4
  import { homedir } from "node:os";
package/dist/tui.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as resolveUsagePercent, c as fetchJSON, d as PLUGIN_UI, l as isRecord, n as BUDGET_SOURCE_LABELS, r as monthlyUsageMetrics, s as emitGatewayLog, t as DEV, u as PLUGIN_COPY } from "./flavor-8QVaVpzl.js";
1
+ import { a as resolveUsagePercent, c as fetchJSON, d as PLUGIN_UI, l as isRecord, n as BUDGET_SOURCE_LABELS, r as monthlyUsageMetrics, s as emitGatewayLog, t as DEV, u as PLUGIN_COPY } from "./flavor-CWgyuHyl.js";
2
2
  import { For, createSignal } from "solid-js";
3
3
  import { createTextAttributes } from "@opentui/core";
4
4
  import { Fragment, jsx, jsxs } from "@opentui/solid/jsx-runtime";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telefonica/ai-sdlc-opencode-plugin-v1-dev",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "OpenCode 1.x plugin (dev environment): CDO.AI provider registration, model discovery, and budget panel",
5
5
  "type": "module",
6
6
  "exports": {