@gtrabanco/pi-nan-provider 1.5.1 → 1.5.2

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/CONTRIBUTING.md CHANGED
@@ -1,6 +1,15 @@
1
1
  # Contributing to @gtrabanco/pi-nan-provider
2
2
 
3
- Thanks for contributing! Read [`AGENTS.md`](AGENTS.md) first — it contains the binding rules for this repo (the One Rule, no fabricated model metadata, one shared provider implementation, verified pi API facts, and the versioning policy). This document covers the mechanics.
3
+ Thanks for contributing! Read [`AGENTS.md`](AGENTS.md) first — it contains the binding rules for this repo (the One Rule, no fabricated model metadata, one shared provider implementation, verified pi API facts, the versioning policy, and AI content policies). This document covers the mechanics.
4
+
5
+ ## AI-generated contributions
6
+
7
+ **Changes made with AI are welcome.** Whether you wrote a feature, fixed a bug, or improved docs using an AI assistant, the only requirement is transparency:
8
+
9
+ - **Code and committed files** (source, tests, docs, configs): never add AI authorship stamps or metadata inside the code itself (no `// Generated by AI`, no `Author: AI`, no co-author fields). Clean, direct code only.
10
+ - **GitHub PRs and comments**: when a PR description, comment, or issue body is generated (wholly or substantially) by AI, append a sign-off line in the language of the conversation, e.g. "Automatically generated using AI" or similar. People have the right to know whether they are talking to another person, a person steering an AI, or an autonomous AI — so always disclose when content was AI-generated.
11
+
12
+ Full policy is in [`AGENTS.md`](AGENTS.md) under *AI-generated content must be signed*.
4
13
 
5
14
  ## Setup
6
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gtrabanco/pi-nan-provider",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "description": "NaN Builders (api.nan.builders) model provider for pi - OpenAI-compatible registration with a models.dev-generated fallback, tier-aware live catalog, and an optional community media MCP bridge",
5
5
  "keywords": [
6
6
  "pi",
@@ -1,7 +1,7 @@
1
1
  // This file is auto-generated by scripts/generate-models.ts
2
2
  // Do not edit manually — run `bun run generate-models` to update.
3
3
  //
4
- // Source: https://models.dev/api.json (provider "nan"), fetched 2026-11-10T14:00:46.087Z
4
+ // Source: https://models.dev/api.json (provider "nan"), fetched 2026-11-10T15:52:24.186Z
5
5
  // Provenance: every contextWindow/maxTokens/input/cost value traces to
6
6
  // models.dev or to the per-entry notes below. Nothing is invented; entries
7
7
  // models.dev documents incompletely are omitted and flagged instead.
@@ -703,7 +703,7 @@ export const NAN_GENERATED_MODELS: readonly GeneratedModelEntry[] = [
703
703
  export const GENERATED_CATALOG_META = {
704
704
  source: "https://models.dev/api.json",
705
705
  modelsDevProvider: "nan",
706
- fetchedAt: "2026-11-10T14:00:46.087Z",
706
+ fetchedAt: "2026-11-10T15:52:24.186Z",
707
707
  modelCount: 11,
708
708
  models: ["deepseek-v4-flash","deepseek-v4-pro","gemma4","glm5.3","glm5.3-flash","hy4","kimi-k3.1-pro","mimo-v2.6-flash","qwen3.6","qwen3.8-flash","qwen3.8-max"],
709
709
  notes: [
@@ -50,6 +50,7 @@ import {
50
50
  applyOverlay,
51
51
  type OverlayEntry,
52
52
  NAN_GENERATED_MODELS,
53
+ NON_CHAT_MODEL_IDS,
53
54
  } from "./fetch-models.ts";
54
55
  import { resolveOpenAICompletionsApi } from "./pi-ai-loader.ts";
55
56
  import { sanitizeOpenAICompatPayload } from "./openai-compat-sanitizer.ts";
@@ -181,16 +182,31 @@ function withStaleCatalogOverlay(
181
182
  // read without rebuilding the catalog.
182
183
  const policy = <T extends { headers?: Record<string, string> }>(m: T): T =>
183
184
  providerAttributionEnabled() ? m : stripProviderAttribution(m);
185
+ // Issue #32: a pre-#15 models-store.json persists non-chat endpoint ids
186
+ // (kokoro, whisper, rerank, …) as CHAT entries. The #19 overlay corrects
187
+ // capabilities but cannot drop ids, so those entries surfaced as chat models
188
+ // and a catalog refresh did not clear them. Drop them on the read paths,
189
+ // keyed on the runtime source of truth (NON_CHAT_MODEL_IDS), but ONLY for
190
+ // chat-type entries: flux-2-klein / qwen-image-2.1 are legitimate baseline
191
+ // IMAGE models (type: "image") and must survive. Healthy paths are already
192
+ // clean (baselineModels and mergeLiveWithGenerated exclude non-chat ids),
193
+ // so this filter is a no-op outside the stale-restore scenario.
194
+ const isStoredNonChatChatEntry = <T extends { id: string; type?: string }>(m: T): boolean =>
195
+ m.type !== "image" && NON_CHAT_MODEL_IDS[m.id] !== undefined;
184
196
  return {
185
197
  ...provider,
186
198
  getModels: () => {
187
199
  const models = provider.getModels();
188
- return models.map((m) => policy(applyOverlay(m, overlayMap))) as typeof models;
200
+ return models
201
+ .filter((m) => !isStoredNonChatChatEntry(m))
202
+ .map((m) => policy(applyOverlay(m, overlayMap))) as typeof models;
189
203
  },
190
204
  getAllModels: () => {
191
205
  const all = provider.getAllModels?.();
192
206
  if (!all) return [];
193
- return all.map((m) => policy(applyOverlay(m, overlayMap)));
207
+ return all
208
+ .filter((m) => !isStoredNonChatChatEntry(m))
209
+ .map((m) => policy(applyOverlay(m, overlayMap)));
194
210
  },
195
211
  };
196
212
  }