@gtrabanco/pi-nan-provider 0.6.7 → 0.6.8
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.es.md +1 -1
- package/README.md +1 -1
- package/package.json +1 -1
- package/scripts/models.generated.ts +2 -2
- package/src/fetch-models.ts +27 -56
- package/src/mcp/nan-media.ts +4 -4
- package/src/mcp/stdio-client.ts +1 -1
package/README.es.md
CHANGED
|
@@ -137,7 +137,7 @@ Ambos puentes están **activados y son perezosos (lazy) por defecto**. Usa `/nan
|
|
|
137
137
|
| Variable | Por defecto | Descripción |
|
|
138
138
|
| :--- | :--- | :--- |
|
|
139
139
|
| `NAN_MEDIA_MCP` | — | Override por sesión (`0` o `false` para desactivar). |
|
|
140
|
-
| `NAN_MEDIA_MCP_VERSION` | `1.
|
|
140
|
+
| `NAN_MEDIA_MCP_VERSION` | `1.1.2` | Versión del servidor fijada (recomendado). |
|
|
141
141
|
| `NAN_MEDIA_MCP_COMMAND` | — | Override del comando personalizado. |
|
|
142
142
|
| `NAN_MEDIA_MCP_TIMEOUT_MS` | `120000` | Timeout por llamada. |
|
|
143
143
|
| `NAN_MCP_TOOLS` | — | Override para el puente oficial (`0` para desactivar). |
|
package/README.md
CHANGED
|
@@ -137,7 +137,7 @@ Both bridges are **enabled and lazy by default**. Use `/nan-mcp` to manage them.
|
|
|
137
137
|
| Variable | Default | Description |
|
|
138
138
|
| :--- | :--- | :--- |
|
|
139
139
|
| `NAN_MEDIA_MCP` | — | Per-session override (`0` or `false` to disable). |
|
|
140
|
-
| `NAN_MEDIA_MCP_VERSION` | `1.
|
|
140
|
+
| `NAN_MEDIA_MCP_VERSION` | `1.1.2` | Pinned server version (recommended). |
|
|
141
141
|
| `NAN_MEDIA_MCP_COMMAND` | — | Custom command override. |
|
|
142
142
|
| `NAN_MEDIA_MCP_TIMEOUT_MS` | `120000` | Per-call timeout. |
|
|
143
143
|
| `NAN_MCP_TOOLS` | — | Override for the official bridge (`0` to disable). |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gtrabanco/pi-nan-provider",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.8",
|
|
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 MCP bridges (official web search + optional community media server)",
|
|
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-09-
|
|
4
|
+
// Source: https://models.dev/api.json (provider "nan"), fetched 2026-09-14T20:40:55.922Z
|
|
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.
|
|
@@ -382,7 +382,7 @@ export const NAN_GENERATED_MODELS: readonly GeneratedModelEntry[] = [
|
|
|
382
382
|
export const GENERATED_CATALOG_META = {
|
|
383
383
|
source: "https://models.dev/api.json",
|
|
384
384
|
modelsDevProvider: "nan",
|
|
385
|
-
fetchedAt: "2026-09-
|
|
385
|
+
fetchedAt: "2026-09-14T20:40:55.922Z",
|
|
386
386
|
modelCount: 6,
|
|
387
387
|
models: ["deepseek-v4-flash","gemma4","glm5.3-flash","mimo-v2.5","qwen3.6","qwen3.8-flash"],
|
|
388
388
|
notes: [
|
package/src/fetch-models.ts
CHANGED
|
@@ -9,19 +9,16 @@
|
|
|
9
9
|
*
|
|
10
10
|
* 2. Runtime fetch of the provider's own `/models` endpoint. NaN runs
|
|
11
11
|
* LiteLLM behind an OpenAI-compatible facade, so the response carries
|
|
12
|
-
* only model `id`s — no capability fields. It is used
|
|
13
|
-
*
|
|
12
|
+
* only model `id`s — no capability fields. It is used as the authoritative
|
|
13
|
+
* list of what the endpoint returns for the API key.
|
|
14
14
|
*
|
|
15
|
-
* Merge: live IDs × generated capability data —
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* and non-chat endpoints never surface. On fetch failure, timeout, or an
|
|
23
|
-
* unusable response, callers fall back to the generated catalog so startup
|
|
24
|
-
* is never blocked.
|
|
15
|
+
* Merge: live IDs × generated capability data — all live IDs surface:
|
|
16
|
+
* a live ID with generated data keeps its generated capabilities, and an
|
|
17
|
+
* uncatalogued live ID (e.g. a new or undocumented model) gets conservative
|
|
18
|
+
* placeholder limits (the same defaults used in custom-provider.md's
|
|
19
|
+
* dynamic-discovery example) with no reasoning support — capabilities stay
|
|
20
|
+
* "unknown", nothing is fabricated. On fetch failure, timeout, or an unusable
|
|
21
|
+
* response, callers fall back to the generated catalog so startup is never blocked.
|
|
25
22
|
*/
|
|
26
23
|
|
|
27
24
|
import type { Model, OpenAICompletionsCompat } from "@earendil-works/pi-ai";
|
|
@@ -64,28 +61,6 @@ export const NAN_COMPAT_API = "openai-completions" as const;
|
|
|
64
61
|
*/
|
|
65
62
|
export const UNKNOWN_MODEL_LIMITS = { contextWindow: 128_000, maxTokens: 4_096 } as const;
|
|
66
63
|
|
|
67
|
-
/**
|
|
68
|
-
* The allowlist of model ids this package may surface. Everything a live
|
|
69
|
-
* /models response returns that is NOT here is dropped — so models that are
|
|
70
|
-
* undocumented (and might become available later, e.g. one NaN starts
|
|
71
|
-
* serving after a release) can never leak through the package.
|
|
72
|
-
*
|
|
73
|
-
* Every current chat model is listed: the six models.dev-documented entries
|
|
74
|
-
* plus the premium live-only glm5.3 (which NaN serves via /models but that
|
|
75
|
-
* models.dev omits — see the "unemittable" note in scripts/generate-models.ts).
|
|
76
|
-
* Non-chat endpoints (flux-2-klein, kokoro, whisper, qwen3-embedding, rerank)
|
|
77
|
-
* are deliberately excluded: they are MCP-bridge territory, not chat models.
|
|
78
|
-
*/
|
|
79
|
-
const ALLOWED_MODEL_IDS = [
|
|
80
|
-
"deepseek-v4-flash",
|
|
81
|
-
"gemma4",
|
|
82
|
-
"glm5.3-flash",
|
|
83
|
-
"glm5.3",
|
|
84
|
-
"mimo-v2.5",
|
|
85
|
-
"qwen3.6",
|
|
86
|
-
"qwen3.8-flash",
|
|
87
|
-
] as const;
|
|
88
|
-
|
|
89
64
|
/** Timeout for the live /models fetch; matches the pi-synthetic-provider precedent (~3s). */
|
|
90
65
|
export const DEFAULT_MODELS_TIMEOUT_MS = 3_000;
|
|
91
66
|
|
|
@@ -113,10 +88,9 @@ export function toModel(entry: GeneratedModelEntry, source: CatalogSource): Mode
|
|
|
113
88
|
};
|
|
114
89
|
}
|
|
115
90
|
|
|
116
|
-
/** The generated fallback catalog as pi-ai Models for the given provider
|
|
91
|
+
/** The generated fallback catalog as pi-ai Models for the given provider. */
|
|
117
92
|
export function baselineModels(source: CatalogSource): Model<"openai-completions">[] {
|
|
118
|
-
|
|
119
|
-
return NAN_GENERATED_MODELS.filter((entry) => allowed.has(entry.id)).map((entry) => toModel(entry, source));
|
|
93
|
+
return NAN_GENERATED_MODELS.map((entry) => toModel(entry, source));
|
|
120
94
|
}
|
|
121
95
|
|
|
122
96
|
export interface LiveModelListOptions {
|
|
@@ -174,12 +148,11 @@ export interface MergedCatalog {
|
|
|
174
148
|
}
|
|
175
149
|
|
|
176
150
|
/**
|
|
177
|
-
* Merge live model IDs with the generated capability catalog
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
* live ID is dropped.
|
|
151
|
+
* Merge live model IDs with the generated capability catalog. All live IDs
|
|
152
|
+
* surface: live IDs with generated data keep their generated capabilities;
|
|
153
|
+
* uncatalogued live IDs get conservative placeholder limits,
|
|
154
|
+
* `reasoning: false`, and zero cost (documented defaults, not invented
|
|
155
|
+
* capabilities).
|
|
183
156
|
*/
|
|
184
157
|
export function mergeLiveWithGenerated(
|
|
185
158
|
liveIds: readonly string[],
|
|
@@ -187,29 +160,27 @@ export function mergeLiveWithGenerated(
|
|
|
187
160
|
generated: readonly GeneratedModelEntry[] = NAN_GENERATED_MODELS,
|
|
188
161
|
): MergedCatalog {
|
|
189
162
|
const byId = new Map(generated.map((entry) => [entry.id, entry]));
|
|
190
|
-
const allowed = new Set<string>(ALLOWED_MODEL_IDS);
|
|
191
163
|
const models: Model<"openai-completions">[] = [];
|
|
192
164
|
const matched: string[] = [];
|
|
193
165
|
const unknown: string[] = [];
|
|
194
166
|
|
|
195
167
|
for (const id of liveIds) {
|
|
196
|
-
if (!allowed.has(id)) continue;
|
|
197
168
|
const entry = byId.get(id);
|
|
198
169
|
if (entry) {
|
|
199
170
|
models.push(toModel(entry, source));
|
|
200
171
|
matched.push(id);
|
|
201
172
|
} else {
|
|
202
|
-
//
|
|
203
|
-
//
|
|
204
|
-
//
|
|
205
|
-
//
|
|
206
|
-
//
|
|
207
|
-
//
|
|
208
|
-
//
|
|
209
|
-
//
|
|
210
|
-
//
|
|
211
|
-
//
|
|
212
|
-
//
|
|
173
|
+
// Placeholder for uncatalogued live ids (e.g. new or undocumented):
|
|
174
|
+
// limits are the documented safe envelope and capabilities stay
|
|
175
|
+
// "unknown". The compat keys are the same gateway-behavior flags
|
|
176
|
+
// applied to every catalog model in NAN_COMPAT: the NaN/LiteLLM
|
|
177
|
+
// gateway cuts SSE streams before finish_reason, so supportsFinishReason
|
|
178
|
+
// must stay true (pi-ai then raises the retryable "Stream ended without
|
|
179
|
+
// finish_reason" instead of silently stalling), and
|
|
180
|
+
// supportsUsageInStreaming stays false because NaN's schema does not
|
|
181
|
+
// document `stream_options`: the sanitizer strips it unless the model's
|
|
182
|
+
// effective compat opts in (issue #4), so false matches the default wire
|
|
183
|
+
// payload.
|
|
213
184
|
models.push({
|
|
214
185
|
id,
|
|
215
186
|
name: id,
|
package/src/mcp/nan-media.ts
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
* other env vars inherit from your environment (generated files land in
|
|
15
15
|
* ~/nan-mcp-output/ by default).
|
|
16
16
|
* - Version pinning follows the upstream server's own supply-chain guidance:
|
|
17
|
-
* NAN_MEDIA_MCP_VERSION (default "1.
|
|
18
|
-
* NAN_MEDIA_MCP_COMMAND (space-separated, e.g. "bunx nan-mcp-server@1.
|
|
17
|
+
* NAN_MEDIA_MCP_VERSION (default "1.1.2"), or pass a custom command with
|
|
18
|
+
* NAN_MEDIA_MCP_COMMAND (space-separated, e.g. "bunx nan-mcp-server@1.1.2").
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
import { Type, type TSchema } from "@earendil-works/pi-ai";
|
|
@@ -28,7 +28,7 @@ export const NAN_MEDIA_MCP_ENV = "NAN_MEDIA_MCP";
|
|
|
28
28
|
export const NAN_MEDIA_MCP_VERSION_ENV = "NAN_MEDIA_MCP_VERSION";
|
|
29
29
|
export const NAN_MEDIA_MCP_COMMAND_ENV = "NAN_MEDIA_MCP_COMMAND";
|
|
30
30
|
export const NAN_MEDIA_MCP_TIMEOUT_ENV = "NAN_MEDIA_MCP_TIMEOUT_MS";
|
|
31
|
-
export const DEFAULT_NAN_MEDIA_MCP_VERSION = "1.
|
|
31
|
+
export const DEFAULT_NAN_MEDIA_MCP_VERSION = "1.1.2";
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* The MCP tool names on the stdio nan-mcp-server that this package bridges as
|
|
@@ -143,7 +143,7 @@ function defineMediaTool<TParams extends TSchema>(spec: MediaToolSpec<TParams>):
|
|
|
143
143
|
/**
|
|
144
144
|
* Build the media tool set. Registered only when NAN_MEDIA_MCP=1 and the
|
|
145
145
|
* runtime supports registerTool; execution spawns the MCP server per call.
|
|
146
|
-
* Schemas mirror nan-mcp-server's zod input schemas (v1.
|
|
146
|
+
* Schemas mirror nan-mcp-server's zod input schemas (v1.1.2).
|
|
147
147
|
*/
|
|
148
148
|
export function createNanMediaTools(): ToolDefinition[] {
|
|
149
149
|
return [
|
package/src/mcp/stdio-client.ts
CHANGED
|
@@ -18,7 +18,7 @@ const PROTOCOL_VERSION = "2024-11-05";
|
|
|
18
18
|
const CLIENT_INFO = { name: "pi-nan-provider", version: "0.2.0" };
|
|
19
19
|
|
|
20
20
|
export interface StdioMcpCallOptions {
|
|
21
|
-
/** Command to spawn, e.g. ["npx", "-y", "nan-mcp-server@1.
|
|
21
|
+
/** Command to spawn, e.g. ["npx", "-y", "nan-mcp-server@1.1.2"]. */
|
|
22
22
|
command: readonly string[];
|
|
23
23
|
/** Extra environment for the child (merged over process.env). */
|
|
24
24
|
env?: Record<string, string | undefined>;
|