@spinabot/brigade 1.19.3 → 1.20.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.
Files changed (52) hide show
  1. package/convex/config.d.ts +2 -2
  2. package/convex/schema.d.ts +4 -4
  3. package/dist/agents/agent-loop.d.ts.map +1 -1
  4. package/dist/agents/agent-loop.js +55 -10
  5. package/dist/agents/agent-loop.js.map +1 -1
  6. package/dist/agents/content-quality-retry.d.ts.map +1 -1
  7. package/dist/agents/content-quality-retry.js +3 -22
  8. package/dist/agents/content-quality-retry.js.map +1 -1
  9. package/dist/agents/error-classifier.d.ts.map +1 -1
  10. package/dist/agents/error-classifier.js +2 -0
  11. package/dist/agents/error-classifier.js.map +1 -1
  12. package/dist/agents/memory/extract.d.ts.map +1 -1
  13. package/dist/agents/memory/extract.js +7 -0
  14. package/dist/agents/memory/extract.js.map +1 -1
  15. package/dist/agents/model-resolution.d.ts.map +1 -1
  16. package/dist/agents/model-resolution.js +9 -3
  17. package/dist/agents/model-resolution.js.map +1 -1
  18. package/dist/agents/ollama-native/ollama-json.d.ts +6 -0
  19. package/dist/agents/ollama-native/ollama-json.d.ts.map +1 -0
  20. package/dist/agents/ollama-native/ollama-json.js +126 -0
  21. package/dist/agents/ollama-native/ollama-json.js.map +1 -0
  22. package/dist/agents/ollama-native/register.d.ts +12 -0
  23. package/dist/agents/ollama-native/register.d.ts.map +1 -0
  24. package/dist/agents/ollama-native/register.js +37 -0
  25. package/dist/agents/ollama-native/register.js.map +1 -0
  26. package/dist/agents/ollama-native/stream.d.ts +59 -0
  27. package/dist/agents/ollama-native/stream.d.ts.map +1 -0
  28. package/dist/agents/ollama-native/stream.js +532 -0
  29. package/dist/agents/ollama-native/stream.js.map +1 -0
  30. package/dist/agents/thinking-fallback.d.ts.map +1 -1
  31. package/dist/agents/thinking-fallback.js +32 -10
  32. package/dist/agents/thinking-fallback.js.map +1 -1
  33. package/dist/buildstamp.json +1 -1
  34. package/dist/cli/commands/connect.d.ts.map +1 -1
  35. package/dist/cli/commands/connect.js +14 -25
  36. package/dist/cli/commands/connect.js.map +1 -1
  37. package/dist/cli/commands/update.d.ts +0 -6
  38. package/dist/cli/commands/update.d.ts.map +1 -1
  39. package/dist/cli/commands/update.js +9 -124
  40. package/dist/cli/commands/update.js.map +1 -1
  41. package/dist/cli/program/build-program.d.ts.map +1 -1
  42. package/dist/cli/program/build-program.js +1 -5
  43. package/dist/cli/program/build-program.js.map +1 -1
  44. package/dist/core/server.js +5 -24
  45. package/dist/core/server.js.map +1 -1
  46. package/dist/integrations/ollama.d.ts +29 -28
  47. package/dist/integrations/ollama.d.ts.map +1 -1
  48. package/dist/integrations/ollama.js +217 -61
  49. package/dist/integrations/ollama.js.map +1 -1
  50. package/dist/providers/catalog.js +1 -1
  51. package/dist/providers/validate-key.js +1 -1
  52. package/package.json +5 -2
@@ -9,12 +9,9 @@
9
9
  * via the `~/.brigade/models.json` mechanism Pi exposes for custom providers.
10
10
  * Each model the user has pulled becomes a Pi `Model<"openai-completions">`.
11
11
  *
12
- * Capability detection is AUTHORITATIVE where possible: Ollama's POST /api/show
13
- * returns a `capabilities` array (e.g. ["completion","tools","thinking","vision"])
14
- * that tells us directly whether a model REASONS, supports TOOLS, and accepts
15
- * IMAGES. We read that first and only fall back to name-pattern guessing when the
16
- * probe is unavailable (older daemon / offline). Context window still isn't
17
- * reported, so that stays a safe default.
12
+ * Capability inference is best-effort Ollama doesn't tell us a model's
13
+ * context window or whether it reasons. We pattern-match the model name
14
+ * against well-known families and fall back to safe defaults.
18
15
  */
19
16
  export interface OllamaModelSummary {
20
17
  id: string;
@@ -42,21 +39,16 @@ export interface InferredCapabilities {
42
39
  }
43
40
  export declare function inferOllamaModelCapabilities(modelId: string): InferredCapabilities;
44
41
  /**
45
- * AUTHORITATIVE capability probe POST /api/show for one model and return its
46
- * lower-cased `capabilities` array. This is the source of truth for whether a
47
- * model REASONS (`"thinking"`), supports TOOLS (`"tools"`), and accepts IMAGES
48
- * (`"vision"`) far better than guessing from the model name. Best-effort:
49
- * returns null on any failure (older Ollama, daemon down, timeout) so callers
50
- * fall back to `inferOllamaModelCapabilities`.
51
- */
52
- export declare function fetchOllamaCapabilities(modelId: string, baseUrl?: string): Promise<string[] | null>;
53
- /**
54
- * Write Brigade's Ollama provider entry into Pi's `~/.brigade/models.json`.
55
- * Pi's `ModelRegistry.refresh()` picks this up and exposes the models as
56
- * regular Pi models from then on.
42
+ * Write Brigade's Ollama provider entry into Pi's `~/.brigade/models.json` as a
43
+ * NATIVE provider — `api:"ollama"` (dispatched to our /api/chat transport) with
44
+ * the base URL (no `/v1`). Pi's `ModelRegistry.refresh()` picks this up and
45
+ * exposes the models as regular Pi models from then on.
57
46
  *
58
- * We MERGE rather than overwrite the user (or other providers) may have
59
- * existing entries in the file we shouldn't clobber.
47
+ * Other providers' entries in the file are left untouched (we only rewrite the
48
+ * `ollama` key). Within the `ollama` entry, discovery OWNS the model list +
49
+ * capabilities (they're re-derived every run), but an operator-set real apiKey
50
+ * and custom headers are PRESERVED across the rewrite — only the keyless sentinel
51
+ * is replaced.
60
52
  */
61
53
  export declare function writeOllamaToModelsJson(modelsJsonPath: string, baseUrl: string, models: OllamaModelSummary[]): Promise<void>;
62
54
  /**
@@ -66,14 +58,23 @@ export declare function writeOllamaToModelsJson(modelsJsonPath: string, baseUrl:
66
58
  *
67
59
  * Called when the model registry MISSES an `ollama/<model>` id: the user has
68
60
  * almost certainly `ollama pull`ed a model since onboarding. We re-query the
69
- * local daemon, merge the full catalog into models.json (capability inference
70
- * + zero cost + the OpenAI-compatible provider routing), and report whether the
71
- * requested model now exists. Best-effort: never throws — on any failure
72
- * (daemon down, no models) it returns `false` and the caller surfaces the
73
- * normal "not registered" guidance.
61
+ * local daemon, merge the full catalog into models.json (native `api:"ollama"`
62
+ * routing + capability inference + zero cost), and return the CANONICAL catalog
63
+ * id of the requested model (or `null` if it isn't installed). Best-effort:
64
+ * never throws — on any failure (daemon down, no models) it returns `null` and
65
+ * the caller surfaces the normal "not registered" guidance.
74
66
  *
75
- * The caller is responsible for `modelRegistry.refresh()` + re-`find()` after
76
- * this resolves true, so Pi picks up the freshly-written entries.
67
+ * The caller is responsible for `modelRegistry.refresh()` + re-`find()` with the
68
+ * returned canonical id after this resolves non-null, so Pi picks up the
69
+ * freshly-written entries.
70
+ */
71
+ export declare function rediscoverOllamaModel(modelsJsonPath: string, modelId: string, baseUrl?: string): Promise<string | null>;
72
+ /**
73
+ * One-time migration: rewrite a pre-existing OpenAI-compat Ollama provider entry
74
+ * (`api:"openai-completions"` + a `/v1` base URL) to the native shape
75
+ * (`api:"ollama"`, base URL without `/v1`). Idempotent + best-effort — existing
76
+ * users would otherwise stay silently on the degraded `/v1` path (no reliable
77
+ * native tool_calls) until they re-onboarded. Returns true when it rewrote.
77
78
  */
78
- export declare function rediscoverOllamaModel(modelsJsonPath: string, modelId: string, baseUrl?: string): Promise<boolean>;
79
+ export declare function migrateOllamaProviderToNative(modelsJsonPath: string): Promise<boolean>;
79
80
  //# sourceMappingURL=ollama.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ollama.d.ts","sourceRoot":"","sources":["../../src/integrations/ollama.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAwBH,MAAM,WAAW,kBAAkB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,GAAE,MAAyB,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAqC5G;AAED;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACpC,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,K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OAAO,EAAE,MAAM,GAAG,oBAAoB,CAgElF;AA6DD;;;;;;;;;;;GAWG;AACH,wBAAsB,uBAAuB,CAC5C,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,kBAAkB,EAAE,GAC1B,OAAO,CAAC,IAAI,CAAC,CAqFf;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,qBAAqB,CAC1C,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,MAAyB,GAChC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAkCxB;AAED;;;;;;GAMG;AACH,wBAAsB,6BAA6B,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAiC5F"}
@@ -9,24 +9,58 @@
9
9
  * via the `~/.brigade/models.json` mechanism Pi exposes for custom providers.
10
10
  * Each model the user has pulled becomes a Pi `Model<"openai-completions">`.
11
11
  *
12
- * Capability detection is AUTHORITATIVE where possible: Ollama's POST /api/show
13
- * returns a `capabilities` array (e.g. ["completion","tools","thinking","vision"])
14
- * that tells us directly whether a model REASONS, supports TOOLS, and accepts
15
- * IMAGES. We read that first and only fall back to name-pattern guessing when the
16
- * probe is unavailable (older daemon / offline). Context window still isn't
17
- * reported, so that stays a safe default.
12
+ * Capability inference is best-effort Ollama doesn't tell us a model's
13
+ * context window or whether it reasons. We pattern-match the model name
14
+ * against well-known families and fall back to safe defaults.
18
15
  */
19
16
  import * as fs from "node:fs/promises";
20
17
  import path from "node:path";
21
18
  import { tryGetRuntimeContext } from "../storage/runtime-context.js";
22
- const DEFAULT_BASE_URL = "http://localhost:11434";
19
+ import { classifyUrlForSsrf } from "../infra/net/fetch-guard.js";
20
+ // 127.0.0.1, not "localhost": on IPv6-preferring hosts "localhost" resolves to
21
+ // ::1 while Ollama binds IPv4 → ECONNREFUSED. Use the explicit v4 loopback.
22
+ const DEFAULT_BASE_URL = "http://127.0.0.1:11434";
23
23
  const TIMEOUT_MS = 5000;
24
+ // Placeholder apiKeys Brigade writes for keyless local Ollama. Treated as "no
25
+ // real credential" so a re-discovery rewrite doesn't mistake a sentinel for an
26
+ // operator-set key worth preserving. Kept in sync with the stream transport's set.
27
+ const OLLAMA_SENTINEL_API_KEYS = new Set([
28
+ "ollama-local-no-auth-required",
29
+ "ollama-local",
30
+ "ollama",
31
+ ]);
32
+ // Cap simultaneous /api/show probes so a box with many pulled models doesn't
33
+ // fire dozens of concurrent requests (which stalls onboarding/rediscovery).
34
+ const SHOW_PROBE_CONCURRENCY = 8;
35
+ /** Map over items with a bounded worker pool (results keyed by input index). */
36
+ async function mapWithConcurrency(items, limit, fn) {
37
+ const results = new Array(items.length);
38
+ let next = 0;
39
+ const worker = async () => {
40
+ while (next < items.length) {
41
+ const idx = next++;
42
+ results[idx] = await fn(items[idx]);
43
+ }
44
+ };
45
+ await Promise.all(Array.from({ length: Math.min(Math.max(1, limit), items.length || 1) }, worker));
46
+ return results;
47
+ }
24
48
  /**
25
49
  * Hit Ollama's `/api/tags` and return the user's locally-installed models.
26
50
  * Throws a friendly error if the server isn't running or returns no models.
27
51
  */
28
52
  export async function discoverOllamaModels(baseUrl = DEFAULT_BASE_URL) {
29
- const url = `${baseUrl.replace(/\/$/, "")}/api/tags`;
53
+ // Strip a trailing `/v1` (someone may pass the OpenAI-compat endpoint) + any
54
+ // trailing slashes, matching fetchOllamaModelInfo + writeOllamaToModelsJson —
55
+ // `/api/tags` is a native path, so `.../v1/api/tags` would 404.
56
+ const url = `${baseUrl.replace(/\/+$/, "").replace(/\/v1$/i, "")}/api/tags`;
57
+ // SSRF guard on the config-driven base URL. allowPrivateNetwork lets local /
58
+ // LAN Ollama through; only genuinely dangerous targets (cloud-metadata /
59
+ // link-local) are refused — no real Ollama listens there.
60
+ const ssrfReason = await classifyUrlForSsrf(url, { allowPrivateNetwork: true });
61
+ if (ssrfReason) {
62
+ throw new Error(`That Ollama server address isn't allowed (${ssrfReason}). Point it at your local or network Ollama.`);
63
+ }
30
64
  const controller = new AbortController();
31
65
  const timer = setTimeout(() => controller.abort(), TIMEOUT_MS);
32
66
  let response;
@@ -73,14 +107,29 @@ export function inferOllamaModelCapabilities(modelId) {
73
107
  // - `qwen3.5*` — base chat, not the reasoning fork
74
108
  // Originally `^qwen3\b` matched all of these and triggered the bug.
75
109
  //
76
- // Reasoning patterns that ARE safe to mark:
77
- // - `deepseek-r1*` — explicit r1 (reasoning) line
78
- // - `qwq*` — Qwen with Questions (reasoning fork)
79
- // - `*-thinking*` — explicit thinking variant naming convention
80
- // - `o1*` / `o3*` OpenAI o-series via Ollama (rare)
110
+ // Reasoning patterns that ARE safe to mark (dedicated reasoning models — they
111
+ // return STRUCTURED tool_calls + native `thinking` even with thinking on, so
112
+ // no prose-narration risk; anchored so they can't catch a tool-caller sibling):
113
+ // - `deepseek-r1*` — explicit r1 (reasoning) line
114
+ // - `qwq*` Qwen with Questions (reasoning fork)
115
+ // - `*-thinking*` — explicit thinking variant naming convention
116
+ // - `gpt-oss*` — OpenAI open-weight reasoning (harmony format)
117
+ // - `magistral*` — Mistral's reasoning model (`^magistral` ≠ `mistral*`)
118
+ // - `phi4*-reasoning*` — Phi-4 reasoning variants (bare `phi4` stays non-reasoning)
119
+ // - `exaone-deep*` — LG EXAONE Deep reasoning line (`exaone3.5` excluded)
120
+ // - `smallthinker*` — SmallThinker ("thinker" ≠ "thinking", so anchored)
121
+ // - `o1*` / `o3*` — OpenAI o-series via Ollama (rare)
122
+ // Deliberately EXCLUDED (hybrid think/non-think, default non-reasoning, strong
123
+ // tool-callers): `qwen3`, `cogito`, `deepseek-v3.1` — forcing thinking on risks
124
+ // the prose-narration bug with no automatic net. Opt in via /thinking instead.
81
125
  const reasoning = /^deepseek-r1\b/.test(id) ||
82
126
  /^qwq\b/.test(id) ||
83
127
  /-thinking\b/.test(id) ||
128
+ /^gpt-oss\b/.test(id) ||
129
+ /^magistral\b/.test(id) ||
130
+ /^phi4(?:-mini)?-reasoning\b/.test(id) ||
131
+ /^exaone-deep\b/.test(id) ||
132
+ /^smallthinker\b/.test(id) ||
84
133
  /\bo1\b/.test(id) ||
85
134
  /\bo3\b/.test(id);
86
135
  // Vision-capable families — text+image input.
@@ -102,45 +151,67 @@ export function inferOllamaModelCapabilities(modelId) {
102
151
  return { reasoning, contextWindow, maxTokens, input };
103
152
  }
104
153
  /**
105
- * AUTHORITATIVE capability probe POST /api/show for one model and return its
106
- * lower-cased `capabilities` array. This is the source of truth for whether a
107
- * model REASONS (`"thinking"`), supports TOOLS (`"tools"`), and accepts IMAGES
108
- * (`"vision"`) far better than guessing from the model name. Best-effort:
109
- * returns null on any failure (older Ollama, daemon down, timeout) so callers
110
- * fall back to `inferOllamaModelCapabilities`.
154
+ * Best-effort per-model probe of Ollama's `/api/show`. Returns whether the model
155
+ * accepts images (`vision` capability) and its real trained context window
156
+ * (`<arch>.context_length`). Any failure yields nulls so the caller falls back
157
+ * to the name-heuristic. NOTE: we deliberately do NOT derive `reasoning` from
158
+ * the `thinking` capability defaulting local models to thinking-on turns them
159
+ * into narrators that emit tool intent as prose instead of structured calls, so
160
+ * reasoning stays name-heuristic (thinking off by default; opt in via /thinking).
111
161
  */
112
- export async function fetchOllamaCapabilities(modelId, baseUrl = DEFAULT_BASE_URL) {
113
- const url = `${baseUrl.replace(/\/$/, "")}/api/show`;
162
+ async function fetchOllamaModelInfo(modelId, baseUrl = DEFAULT_BASE_URL) {
163
+ const url = `${baseUrl.replace(/\/+$/, "").replace(/\/v1$/i, "")}/api/show`;
164
+ // SSRF guard (same config-driven base URL as the turn traffic). Best-effort
165
+ // probe: on a blocked target, fall back to the name-heuristic rather than throw.
166
+ if (await classifyUrlForSsrf(url, { allowPrivateNetwork: true })) {
167
+ return { vision: null, contextLength: null };
168
+ }
114
169
  const controller = new AbortController();
115
170
  const timer = setTimeout(() => controller.abort(), TIMEOUT_MS);
116
171
  try {
117
172
  const res = await fetch(url, {
118
173
  method: "POST",
119
174
  headers: { "Content-Type": "application/json" },
120
- body: JSON.stringify({ model: modelId }),
175
+ // Send both keys — modern Ollama reads `model`; older builds read `name`.
176
+ body: JSON.stringify({ model: modelId, name: modelId }),
121
177
  signal: controller.signal,
122
178
  });
123
179
  if (!res.ok)
124
- return null;
180
+ return { vision: null, contextLength: null };
125
181
  const body = (await res.json());
126
- if (!Array.isArray(body.capabilities))
127
- return null;
128
- return body.capabilities.map((c) => String(c).toLowerCase());
182
+ const caps = Array.isArray(body.capabilities)
183
+ ? body.capabilities.map((c) => String(c).toLowerCase())
184
+ : null;
185
+ const vision = caps ? caps.includes("vision") : null;
186
+ let contextLength = null;
187
+ if (body.model_info && typeof body.model_info === "object") {
188
+ for (const [k, v] of Object.entries(body.model_info)) {
189
+ if (k.endsWith(".context_length") && typeof v === "number" && Number.isFinite(v) && v > 0) {
190
+ contextLength = Math.floor(v);
191
+ break;
192
+ }
193
+ }
194
+ }
195
+ return { vision, contextLength };
129
196
  }
130
197
  catch {
131
- return null;
198
+ return { vision: null, contextLength: null };
132
199
  }
133
200
  finally {
134
201
  clearTimeout(timer);
135
202
  }
136
203
  }
137
204
  /**
138
- * Write Brigade's Ollama provider entry into Pi's `~/.brigade/models.json`.
139
- * Pi's `ModelRegistry.refresh()` picks this up and exposes the models as
140
- * regular Pi models from then on.
205
+ * Write Brigade's Ollama provider entry into Pi's `~/.brigade/models.json` as a
206
+ * NATIVE provider — `api:"ollama"` (dispatched to our /api/chat transport) with
207
+ * the base URL (no `/v1`). Pi's `ModelRegistry.refresh()` picks this up and
208
+ * exposes the models as regular Pi models from then on.
141
209
  *
142
- * We MERGE rather than overwrite the user (or other providers) may have
143
- * existing entries in the file we shouldn't clobber.
210
+ * Other providers' entries in the file are left untouched (we only rewrite the
211
+ * `ollama` key). Within the `ollama` entry, discovery OWNS the model list +
212
+ * capabilities (they're re-derived every run), but an operator-set real apiKey
213
+ * and custom headers are PRESERVED across the rewrite — only the keyless sentinel
214
+ * is replaced.
144
215
  */
145
216
  export async function writeOllamaToModelsJson(modelsJsonPath, baseUrl, models) {
146
217
  let existing = { providers: {} };
@@ -153,31 +224,51 @@ export async function writeOllamaToModelsJson(modelsJsonPath, baseUrl, models) {
153
224
  catch {
154
225
  // File missing or unparseable — start fresh. Pi treats an absent file as no config.
155
226
  }
156
- // Prefer Ollama's own /api/show `capabilities` (authoritative for reasoning /
157
- // tools / vision); fall back to the name heuristic only when the probe fails.
158
- // Probes run in parallel, so total added latency is ~one request, not N.
159
- const modelDefs = await Promise.all(models.map(async (m) => {
160
- const guess = inferOllamaModelCapabilities(m.id);
161
- const caps = await fetchOllamaCapabilities(m.id, baseUrl);
162
- const reasoning = caps ? caps.includes("thinking") : guess.reasoning;
163
- const vision = caps ? caps.includes("vision") : guess.input.includes("image");
227
+ // Native transport: base URL WITHOUT /v1 (Brigade registers api:"ollama" /api/chat).
228
+ const nativeBaseUrl = baseUrl.replace(/\/+$/, "").replace(/\/v1$/i, "");
229
+ // Probe /api/show for real vision + context (bounded concurrency, best-effort);
230
+ // fall back to the name-heuristic when unreachable. Reasoning stays name-heuristic.
231
+ const modelDefs = await mapWithConcurrency(models, SHOW_PROBE_CONCURRENCY, async (m) => {
232
+ const caps = inferOllamaModelCapabilities(m.id);
233
+ const info = await fetchOllamaModelInfo(m.id, baseUrl);
234
+ const vision = info.vision ?? caps.input.includes("image");
164
235
  const input = vision ? ["text", "image"] : ["text"];
236
+ const contextWindow = info.contextLength ?? caps.contextWindow;
165
237
  return {
166
238
  id: m.id,
167
239
  name: m.name + (m.parameterSize ? ` (${m.parameterSize})` : ""),
168
- reasoning,
240
+ reasoning: caps.reasoning,
169
241
  input,
170
- contextWindow: guess.contextWindow,
171
- maxTokens: guess.maxTokens,
242
+ contextWindow,
243
+ maxTokens: caps.maxTokens,
172
244
  cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, // local = free
245
+ // Per-model baseUrl (belt-and-suspenders): the native stream reads
246
+ // model.baseUrl, so carry it on each model in case Pi's registry doesn't
247
+ // propagate the provider baseUrl onto registry-loaded models.
248
+ baseUrl: nativeBaseUrl,
173
249
  };
174
- }));
250
+ });
251
+ // Preserve operator-set auth across a re-discovery rewrite: a remote/authed
252
+ // Ollama proxy may carry a REAL apiKey and/or custom headers under this entry.
253
+ // Discovery owns the model LIST, but must not silently wipe credentials — only
254
+ // fall back to the sentinel when no real key was set.
255
+ const prevOllama = existing.providers["ollama"];
256
+ const prevApiKey = typeof prevOllama?.apiKey === "string" && !OLLAMA_SENTINEL_API_KEYS.has(prevOllama.apiKey)
257
+ ? prevOllama.apiKey
258
+ : undefined;
259
+ const prevHeaders = prevOllama?.headers && typeof prevOllama.headers === "object" && !Array.isArray(prevOllama.headers)
260
+ ? prevOllama.headers
261
+ : undefined;
175
262
  existing.providers["ollama"] = {
176
- baseUrl: `${baseUrl.replace(/\/$/, "")}/v1`,
177
- api: "openai-completions",
178
- // Ollama ignores the API key but Pi requires apiKey to be set when defining
179
- // custom models for non-built-in providers. Use a sentinel value.
180
- apiKey: "ollama-local-no-auth-required",
263
+ // Native transport: base URL WITHOUT /v1; Brigade registers api:"ollama"
264
+ // (→ /api/chat) so tool-calls + thinking come back structured.
265
+ baseUrl: nativeBaseUrl,
266
+ api: "ollama",
267
+ // Ollama (local) ignores the API key, but Pi requires apiKey to be set when
268
+ // defining custom models for a non-built-in provider. Preserve a real
269
+ // operator key if one was set; otherwise use a sentinel value.
270
+ apiKey: prevApiKey ?? "ollama-local-no-auth-required",
271
+ ...(prevHeaders ? { headers: prevHeaders } : {}),
181
272
  models: modelDefs,
182
273
  };
183
274
  // In convex mode resolveModelsPath routes to the OS cache dir, which may
@@ -207,14 +298,15 @@ export async function writeOllamaToModelsJson(modelsJsonPath, baseUrl, models) {
207
298
  *
208
299
  * Called when the model registry MISSES an `ollama/<model>` id: the user has
209
300
  * almost certainly `ollama pull`ed a model since onboarding. We re-query the
210
- * local daemon, merge the full catalog into models.json (capability inference
211
- * + zero cost + the OpenAI-compatible provider routing), and report whether the
212
- * requested model now exists. Best-effort: never throws — on any failure
213
- * (daemon down, no models) it returns `false` and the caller surfaces the
214
- * normal "not registered" guidance.
301
+ * local daemon, merge the full catalog into models.json (native `api:"ollama"`
302
+ * routing + capability inference + zero cost), and return the CANONICAL catalog
303
+ * id of the requested model (or `null` if it isn't installed). Best-effort:
304
+ * never throws — on any failure (daemon down, no models) it returns `null` and
305
+ * the caller surfaces the normal "not registered" guidance.
215
306
  *
216
- * The caller is responsible for `modelRegistry.refresh()` + re-`find()` after
217
- * this resolves true, so Pi picks up the freshly-written entries.
307
+ * The caller is responsible for `modelRegistry.refresh()` + re-`find()` with the
308
+ * returned canonical id after this resolves non-null, so Pi picks up the
309
+ * freshly-written entries.
218
310
  */
219
311
  export async function rediscoverOllamaModel(modelsJsonPath, modelId, baseUrl = DEFAULT_BASE_URL) {
220
312
  let discovered;
@@ -224,13 +316,77 @@ export async function rediscoverOllamaModel(modelsJsonPath, modelId, baseUrl = D
224
316
  catch {
225
317
  // Daemon unreachable / no models — let the caller surface the standard
226
318
  // guidance (run `ollama pull`, check the daemon is up).
227
- return false;
319
+ return null;
228
320
  }
229
321
  if (discovered.length === 0)
322
+ return null;
323
+ // Honor the "never throws" contract: writeOllamaToModelsJson can throw on an fs
324
+ // error (EACCES/ENOSPC/read-only cache dir). Swallow it → null so the caller
325
+ // surfaces the standard "not registered" guidance instead of an opaque reject.
326
+ try {
327
+ await writeOllamaToModelsJson(modelsJsonPath, baseUrl, discovered);
328
+ }
329
+ catch {
330
+ return null;
331
+ }
332
+ // Return the CANONICAL catalog id that matched, so the caller re-finds the
333
+ // EXACT id Pi registered (Pi's find is an exact id match — NOT tolerant). We
334
+ // match on id OR name, tolerating a leading `ollama/` provider prefix AND a
335
+ // missing `:latest` tag: a composed ref (`ollama/llama3.2`) or a tag-less id
336
+ // (`qwen3` when only `qwen3:latest` is installed) must resolve to the real
337
+ // catalog id, else it's a hard "model not registered" (Ollama has no synth
338
+ // fallback) EVEN THOUGH the model is pulled + in the catalog.
339
+ const wanted = modelId.trim().replace(/^ollama\//i, "");
340
+ const match = discovered.find((m) => m.id === wanted ||
341
+ m.name === wanted ||
342
+ m.id === `${wanted}:latest` ||
343
+ m.name === `${wanted}:latest`);
344
+ return match ? match.id : null;
345
+ }
346
+ /**
347
+ * One-time migration: rewrite a pre-existing OpenAI-compat Ollama provider entry
348
+ * (`api:"openai-completions"` + a `/v1` base URL) to the native shape
349
+ * (`api:"ollama"`, base URL without `/v1`). Idempotent + best-effort — existing
350
+ * users would otherwise stay silently on the degraded `/v1` path (no reliable
351
+ * native tool_calls) until they re-onboarded. Returns true when it rewrote.
352
+ */
353
+ export async function migrateOllamaProviderToNative(modelsJsonPath) {
354
+ let parsed;
355
+ try {
356
+ parsed = JSON.parse(await fs.readFile(modelsJsonPath, "utf8"));
357
+ }
358
+ catch {
359
+ return false; // no/invalid file → nothing to migrate
360
+ }
361
+ const entry = parsed.providers?.ollama;
362
+ if (!entry)
230
363
  return false;
231
- await writeOllamaToModelsJson(modelsJsonPath, baseUrl, discovered);
232
- // Match on id OR name — `/api/tags` reports both, and the user may have
233
- // typed either form when picking the model.
234
- return discovered.some((m) => m.id === modelId || m.name === modelId);
364
+ const baseUrl = typeof entry.baseUrl === "string" ? entry.baseUrl : "";
365
+ const needsMigration = entry.api !== "ollama" || /\/v1\/?$/i.test(baseUrl);
366
+ if (!needsMigration)
367
+ return false;
368
+ entry.api = "ollama";
369
+ if (baseUrl)
370
+ entry.baseUrl = baseUrl.replace(/\/+$/, "").replace(/\/v1$/i, "");
371
+ try {
372
+ await fs.writeFile(modelsJsonPath, JSON.stringify(parsed, null, 2), "utf8");
373
+ }
374
+ catch {
375
+ return false;
376
+ }
377
+ // Convex mode: the file above is the regenerable OS-cache mirror; the DURABLE
378
+ // copy is the sealed "models" blob. Push the migrated catalog there too, or the
379
+ // migration fixes only the cache and the next boot re-materialises the stale
380
+ // blob (openai-completions/v1) — migration would silently re-run forever and
381
+ // never persist. Mirrors writeOllamaToModelsJson's blob push.
382
+ const rctx = tryGetRuntimeContext();
383
+ if (rctx?.mode === "convex") {
384
+ await rctx.store.auth
385
+ .writeAuthFileBlob("main", "models", parsed)
386
+ .catch((err) => {
387
+ console.error(`brigade: models catalog migrate→convex failed — ${err.message}`);
388
+ });
389
+ }
390
+ return true;
235
391
  }
236
392
  //# sourceMappingURL=ollama.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ollama.js","sourceRoot":"","sources":["../../src/integrations/ollama.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE,MAAM,gBAAgB,GAAG,wBAAwB,CAAC;AAClD,MAAM,UAAU,GAAG,IAAI,CAAC;AAwBxB;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,UAAkB,gBAAgB;IAC5E,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC;IACrD,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;IACzC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,UAAU,CAAC,CAAC;IAE/D,IAAI,QAAkB,CAAC;IACvB,IAAI,CAAC;QACJ,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5D,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACd,IAAI,GAAG,YAAY,KAAK,IAAI,GAAG,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;YACvD,MAAM,IAAI,KAAK,CAAC,gCAAgC,UAAU,GAAG,IAAI,mCAAmC,CAAC,CAAC;QACvG,CAAC;QACD,MAAM,IAAI,KAA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,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;IACvE,MAAM,cAAc,GAAG,KAAK,CAAC,GAAG,KAAK,QAAQ,IAAI,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3E,IAAI,CAAC,cAAc;QAAE,OAAO,KAAK,CAAC;IAClC,KAAK,CAAC,GAAG,GAAG,QAAQ,CAAC;IACrB,IAAI,OAAO;QAAE,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAC/E,IAAI,CAAC;QACJ,MAAM,EAAE,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAC7E,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,KAAK,CAAC;IACd,CAAC;IACD,8EAA8E;IAC9E,gFAAgF;IAChF,6EAA6E;IAC7E,6EAA6E;IAC7E,8DAA8D;IAC9D,MAAM,IAAI,GAAG,oBAAoB,EAAE,CAAC;IACpC,IAAI,IAAI,EAAE,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI;aACnB,iBAAiB,CAAC,MAAM,EAAE,QAAiB,EAAE,MAAiC,CAAC;aAC/E,KAAK,CAAC,CAAC,GAAU,EAAE,EAAE;YACrB,OAAO,CAAC,KAAK,CAAC,mDAAmD,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;QACjF,CAAC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC"}
@@ -173,7 +173,7 @@ export const PROVIDERS = [
173
173
  envVar: "", // no env key
174
174
  noAuth: true,
175
175
  local: true,
176
- baseUrl: "http://localhost:11434",
176
+ baseUrl: "http://127.0.0.1:11434",
177
177
  },
178
178
  {
179
179
  id: "custom",
@@ -32,7 +32,7 @@ function buildRequest(providerId, apiKey) {
32
32
  case "ollama":
33
33
  // Ollama runs locally; `/api/tags` is auth-free and lists installed models.
34
34
  return {
35
- url: "http://localhost:11434/api/tags",
35
+ url: "http://127.0.0.1:11434/api/tags",
36
36
  init: { method: "GET" },
37
37
  };
38
38
  case "anthropic": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spinabot/brigade",
3
- "version": "1.19.3",
3
+ "version": "1.20.0",
4
4
  "description": "Brigade — your personal AI crew",
5
5
  "homepage": "https://brigade.spinabot.com",
6
6
  "author": "Spinabot <hello@brigade-agent.ai>",
@@ -248,7 +248,10 @@
248
248
  },
249
249
  "exceljs": {
250
250
  "uuid": "^11.1.1"
251
- }
251
+ },
252
+ "@earendil-works/pi-ai": "0.79.9",
253
+ "@earendil-works/pi-agent-core": "0.79.9",
254
+ "@earendil-works/pi-tui": "0.79.9"
252
255
  },
253
256
  "keywords": [
254
257
  "ai",