@vedmalex/ai-connect 0.6.0 → 0.7.0

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/README.md CHANGED
@@ -425,7 +425,9 @@ A `cli` route exposes the same management interfaces as other providers — `dis
425
425
  - **`static`** — build the catalog from the account's configured `models[]` (+ `contextWindow`). This is the default for a preset-less custom CLI that declares `models[]` (it previously reported `not_supported`); opt out with `discovery: { via: "none" }`.
426
426
  - **`none`** — no discovery.
427
427
 
428
- **Configured context window (GAP-A).** A model entry's `contextLength` is surfaced from the route's configured `contextWindow` only when discovery did not already report one (monotonic — a live discovered value always wins). Such entries are tagged `metadata.contextWindowSource: "configured"`. A consumer mapping `catalog.contextLength` into `resolveModelContextWindow`'s `discovered` slot should gate on `metadata.contextWindowSource !== "configured"` (otherwise feed it as the `configured` input) so the documented precedence `discovered > reference > configured > default` stays honest.
428
+ **Configured context window (GAP-A).** A model entry's `contextLength` is surfaced from the route's configured `contextWindow` only when discovery did not already report one (monotonic — a live discovered value always wins). Provenance is exposed on the typed field `ModelInfo.contextWindowSource`: `"discovered"` (read from a live API/cli list-command record), `"configured"` (surfaced from the route's `contextWindow`), or `undefined` (unknown). A consumer mapping `catalog.contextLength` into `resolveModelContextWindow`'s `discovered` slot should do so ONLY when `contextWindowSource === "discovered"` — treat `"configured"` as the `configured` input and `undefined` as unknown (do not promote it to the `discovered` slot) so the precedence `discovered > reference > configured > default` stays honest. (`metadata.contextWindowSource: "configured"` is retained as a back-compat alias on the configured-fill path.)
429
+
430
+ **Discovery diagnostics.** A model-discovery route report (and its catalog) may carry a `warnings: string[]`. In particular, a cli `discovery.via: "command"` route whose list command fails/times out/returns nothing and falls back to its static `models[]` catalog records a warning there, so a degraded fallback is distinguishable from a healthy static catalog.
429
431
 
430
432
  Current local transport scope:
431
433
 
@@ -1980,6 +1980,8 @@ function fillConfiguredContextLength(route, models) {
1980
1980
  return {
1981
1981
  ...entry,
1982
1982
  contextLength: configured,
1983
+ // FT-002: typed provenance (canonical) + metadata alias (back-compat).
1984
+ contextWindowSource: "configured",
1983
1985
  metadata: { ...entry.metadata ?? {}, contextWindowSource: "configured" }
1984
1986
  };
1985
1987
  });
@@ -3309,7 +3311,8 @@ function createClient(configOrInput, options = {}) {
3309
3311
  ...catalog.canonicalModelId ? { canonicalModelId: catalog.canonicalModelId } : {},
3310
3312
  ...catalog.resolvedModelId ? { resolvedModelId: catalog.resolvedModelId } : {},
3311
3313
  ...catalog.currentModelId ? { currentModelId: catalog.currentModelId } : {},
3312
- availableModels: catalog.availableModels
3314
+ availableModels: catalog.availableModels,
3315
+ ...catalog.warnings?.length ? { warnings: catalog.warnings } : {}
3313
3316
  });
3314
3317
  wideAttempts.push({
3315
3318
  index: wideAttempts.length + 1,
@@ -5012,7 +5015,7 @@ function parseOpenAiModelCatalog(route, payload) {
5012
5015
  modelId: entry.id,
5013
5016
  name: typeof entry.display_name === "string" ? entry.display_name : typeof entry.name === "string" ? entry.name : entry.id,
5014
5017
  ...typeof entry.description === "string" ? { description: entry.description } : {},
5015
- ...contextLength !== void 0 ? { contextLength } : {},
5018
+ ...contextLength !== void 0 ? { contextLength, contextWindowSource: "discovered" } : {},
5016
5019
  ...pricing ? { pricing } : {},
5017
5020
  ...free ? { free } : {},
5018
5021
  ...metadata ? {