@nemesis-oss/ollama-sdk 1.7.0 → 1.9.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 (46) hide show
  1. package/CHANGELOG.md +168 -1
  2. package/README.md +181 -10
  3. package/dist/anthropic-5oYIRS6D.d.ts +1649 -0
  4. package/dist/anthropic-BIh45UXj.d.cts +1649 -0
  5. package/dist/{compose-DLStUfaF.d.ts → compose-DCVYMvOL.d.ts} +1 -1
  6. package/dist/{compose-DS-UWFx8.d.cts → compose-Dj6FdF2n.d.cts} +1 -1
  7. package/dist/generated-api.cjs +116 -9
  8. package/dist/generated-api.cjs.map +1 -1
  9. package/dist/generated-api.d.cts +321 -630
  10. package/dist/generated-api.d.ts +321 -630
  11. package/dist/generated-api.js +112 -10
  12. package/dist/generated-api.js.map +1 -1
  13. package/dist/generated-models-schemas.cjs +151 -3
  14. package/dist/generated-models-schemas.cjs.map +1 -1
  15. package/dist/generated-models-schemas.d.cts +228 -3
  16. package/dist/generated-models-schemas.d.ts +228 -3
  17. package/dist/generated-models-schemas.js +134 -4
  18. package/dist/generated-models-schemas.js.map +1 -1
  19. package/dist/generated-runtime.cjs +679 -60
  20. package/dist/generated-runtime.cjs.map +1 -1
  21. package/dist/generated-runtime.d.cts +22 -24
  22. package/dist/generated-runtime.d.ts +22 -24
  23. package/dist/generated-runtime.js +678 -61
  24. package/dist/generated-runtime.js.map +1 -1
  25. package/dist/index.cjs +2468 -132
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.cts +1666 -864
  28. package/dist/index.d.ts +1666 -864
  29. package/dist/index.js +2432 -133
  30. package/dist/index.js.map +1 -1
  31. package/dist/mcp/tools.json +306 -73
  32. package/dist/mcp-generated.cjs +138 -7
  33. package/dist/mcp-generated.cjs.map +1 -1
  34. package/dist/mcp-generated.d.cts +2 -2
  35. package/dist/mcp-generated.d.ts +2 -2
  36. package/dist/mcp-generated.js +138 -7
  37. package/dist/mcp-generated.js.map +1 -1
  38. package/dist/{runtime-qwD72cpn.d.ts → runtime-C3rfpkZw.d.ts} +286 -5
  39. package/dist/{runtime-bQ48I-RC.d.cts → runtime-D2W9TfCJ.d.cts} +286 -5
  40. package/dist/skills.cjs.map +1 -1
  41. package/dist/skills.d.cts +3 -3
  42. package/dist/skills.d.ts +3 -3
  43. package/dist/skills.js.map +1 -1
  44. package/dist/{types-5PAjLoCp.d.cts → types-DVcX_zMp.d.cts} +110 -10
  45. package/dist/{types-5PAjLoCp.d.ts → types-DVcX_zMp.d.ts} +110 -10
  46. package/package.json +9 -5
@@ -20,9 +20,11 @@ var operations_exports = {};
20
20
  __export(operations_exports, {
21
21
  allOperations: () => allOperations,
22
22
  anthropicMessagesOp: () => anthropicMessagesOp,
23
+ balanceOp: () => balanceOp,
23
24
  blobsOp: () => blobsOp,
24
25
  chatOp: () => chatOp,
25
26
  copyOp: () => copyOp,
27
+ createBlobOp: () => createBlobOp,
26
28
  createOp: () => createOp,
27
29
  deleteOp: () => deleteOp,
28
30
  embedOp: () => embedOp,
@@ -39,16 +41,39 @@ __export(operations_exports, {
39
41
  showOp: () => showOp,
40
42
  systemOneOp: () => systemOneOp,
41
43
  tagsOp: () => tagsOp,
42
- versionOp: () => versionOp
44
+ usageOp: () => usageOp,
45
+ versionOp: () => versionOp,
46
+ webFetchOp: () => webFetchOp,
47
+ webSearchOp: () => webSearchOp
43
48
  });
44
- var blobsOp, chatOp, copyOp, createOp, deleteOp, embedOp, generateOp, psOp, pullOp, pushOp, showOp, systemOneOp, tagsOp, versionOp, openaiChatCompletionsOp, openaiCompletionsOp, openaiEmbeddingsOp, openaiModelsOp, openaiModelsGetOneOp, openaiResponsesOp, anthropicMessagesOp, allOperations;
49
+ var balanceOp, blobsOp, chatOp, copyOp, createOp, createBlobOp, deleteOp, embedOp, generateOp, psOp, pullOp, pushOp, showOp, systemOneOp, tagsOp, usageOp, versionOp, webFetchOp, webSearchOp, openaiChatCompletionsOp, openaiCompletionsOp, openaiEmbeddingsOp, openaiModelsOp, openaiModelsGetOneOp, openaiResponsesOp, anthropicMessagesOp, allOperations;
45
50
  var init_operations = __esm({
46
51
  "src/generated/api/operations.ts"() {
52
+ balanceOp = {
53
+ operationId: "balance",
54
+ method: "GET",
55
+ path: "/api/balance",
56
+ response: { $ref: "#/schemas/BalanceResponse" },
57
+ environment: { local: false, cloud: true },
58
+ host: "https://ollama.com",
59
+ transport: { mode: "json", streaming: false },
60
+ capabilities: {},
61
+ status: { documented: true },
62
+ domain: "native",
63
+ notes: [
64
+ "Cloud-only account endpoint \u2014 targets https://ollama.com, not the local Ollama server.",
65
+ "Requires an Ollama Cloud API key (set via OllamaClient credentials).",
66
+ "Takes no parameters. For usage history see the usage operation.",
67
+ "Rate limited to 10 requests/minute per user; 429 responses carry a Retry-After header.",
68
+ "Use OllamaClient.balance() \u2014 the generated NativeApi class does not expose this operation."
69
+ ]
70
+ };
47
71
  blobsOp = {
48
72
  operationId: "blobs",
49
73
  method: "HEAD",
50
74
  path: "/api/blobs/{digest}",
51
75
  environment: { local: true, cloud: false },
76
+ parameters: [{ name: "digest", in: "path", required: true, schema: { type: "string" } }],
52
77
  transport: { mode: "json", streaming: false },
53
78
  capabilities: {},
54
79
  status: { documented: true },
@@ -103,6 +128,21 @@ var init_operations = __esm({
103
128
  domain: "native",
104
129
  notes: ["Model creation is local-only; Ollama Cloud does not support it."]
105
130
  };
131
+ createBlobOp = {
132
+ operationId: "createBlob",
133
+ method: "POST",
134
+ path: "/api/blobs/{digest}",
135
+ environment: { local: true, cloud: false },
136
+ parameters: [{ name: "digest", in: "path", required: true, schema: { type: "string" } }],
137
+ transport: { mode: "json", streaming: false },
138
+ capabilities: {},
139
+ status: { documented: true },
140
+ domain: "native",
141
+ notes: [
142
+ "POST endpoint for blob creation; takes a binary body (application/octet-stream).",
143
+ "Handled by OllamaClient.createBlob() \u2014 the generated NativeApi does not expose this operation because the runtime JSON-encodes request bodies."
144
+ ]
145
+ };
106
146
  deleteOp = {
107
147
  operationId: "delete",
108
148
  method: "DELETE",
@@ -197,23 +237,30 @@ var init_operations = __esm({
197
237
  operationId: "systemOne",
198
238
  method: "POST",
199
239
  path: "/v1/systemone",
240
+ request: { $ref: "#/schemas/SystemOneRequest" },
241
+ response: { $ref: "#/schemas/SystemOneResponse" },
200
242
  environment: { local: true, cloud: false },
201
243
  transport: { mode: "json", streaming: false },
202
244
  capabilities: {
203
245
  thinking: "unsupported",
204
246
  tools: "unsupported",
205
- vision: "unsupported",
247
+ vision: "model-dependent",
206
248
  structuredOutput: "unsupported",
207
249
  logprobs: "unsupported",
208
250
  embeddings: "unsupported"
209
251
  },
210
- constraints: { minOllamaVersion: "0.35.0", maxRequestBytes: 65536 },
252
+ constraints: {
253
+ minOllamaVersion: "0.35.0",
254
+ maxRequestBytes: 65536,
255
+ maxRequestBytesWithImages: 33554432
256
+ },
211
257
  status: { documented: true, experimental: true },
212
258
  domain: "native",
213
259
  notes: [
214
260
  "Local-only; Ollama Cloud rejects /v1/systemone.",
215
- "Hard 64 KiB request body limit enforced by the server.",
216
- "No images, no tools, no generation controls (temperature, top_p, etc.).",
261
+ "64 KiB request limit without images, 32 MiB with images (includes JSON/base64 overhead).",
262
+ "No tools, no generation controls (temperature, top_p, etc.).",
263
+ "Vision is model-dependent: images are accepted by vision-weighted models (Clef/Clef Flash) but not by text-only models.",
217
264
  "Experimental: behavioral surface may change between Ollama releases."
218
265
  ]
219
266
  };
@@ -228,6 +275,25 @@ var init_operations = __esm({
228
275
  status: { documented: true },
229
276
  domain: "native"
230
277
  };
278
+ usageOp = {
279
+ operationId: "usage",
280
+ method: "GET",
281
+ path: "/api/usage",
282
+ response: { $ref: "#/schemas/UsageResponse" },
283
+ environment: { local: false, cloud: true },
284
+ host: "https://ollama.com",
285
+ transport: { mode: "json", streaming: false },
286
+ capabilities: {},
287
+ status: { documented: true },
288
+ domain: "native",
289
+ notes: [
290
+ "Cloud-only account endpoint \u2014 targets https://ollama.com, not the local Ollama server.",
291
+ "Requires an Ollama Cloud API key (set via OllamaClient credentials).",
292
+ "Query parameters (not modeled by the generated runtime): range = 24h | 7d | 30d (server default 7d), scope = self | team (server default self; team scope requires a team admin).",
293
+ "Rate limited to 10 requests/minute per user; 429 responses carry a Retry-After header.",
294
+ "Use OllamaClient.usage() \u2014 the generated NativeApi class does not expose this operation."
295
+ ]
296
+ };
231
297
  versionOp = {
232
298
  operationId: "version",
233
299
  method: "GET",
@@ -239,6 +305,42 @@ var init_operations = __esm({
239
305
  status: { documented: true },
240
306
  domain: "native"
241
307
  };
308
+ webFetchOp = {
309
+ operationId: "webFetch",
310
+ method: "POST",
311
+ path: "/api/web_fetch",
312
+ request: { $ref: "#/schemas/WebFetchRequest" },
313
+ response: { $ref: "#/schemas/WebFetchResponse" },
314
+ environment: { local: false, cloud: true },
315
+ host: "https://ollama.com",
316
+ transport: { mode: "json", streaming: false },
317
+ capabilities: {},
318
+ status: { documented: true },
319
+ domain: "native",
320
+ notes: [
321
+ "Cloud-only capability endpoint \u2014 targets https://ollama.com, not the local Ollama server.",
322
+ "Requires an Ollama Cloud API key (set via OllamaClient credentials).",
323
+ "Use OllamaClient.webFetch() \u2014 the generated NativeApi class does not expose this operation."
324
+ ]
325
+ };
326
+ webSearchOp = {
327
+ operationId: "webSearch",
328
+ method: "POST",
329
+ path: "/api/web_search",
330
+ request: { $ref: "#/schemas/WebSearchRequest" },
331
+ response: { $ref: "#/schemas/WebSearchResponse" },
332
+ environment: { local: false, cloud: true },
333
+ host: "https://ollama.com",
334
+ transport: { mode: "json", streaming: false },
335
+ capabilities: {},
336
+ status: { documented: true },
337
+ domain: "native",
338
+ notes: [
339
+ "Cloud-only capability endpoint \u2014 targets https://ollama.com, not the local Ollama server.",
340
+ "Requires an Ollama Cloud API key (set via OllamaClient credentials).",
341
+ "Use OllamaClient.webSearch() \u2014 the generated NativeApi class does not expose this operation."
342
+ ]
343
+ };
242
344
  openaiChatCompletionsOp = {
243
345
  operationId: "openaiChatCompletions",
244
346
  method: "POST",
@@ -293,6 +395,7 @@ var init_operations = __esm({
293
395
  method: "GET",
294
396
  path: "/v1/models/{model}",
295
397
  environment: { local: true, cloud: true },
398
+ parameters: [{ name: "model", in: "path", required: true, schema: { type: "string" } }],
296
399
  transport: { mode: "json", streaming: false },
297
400
  capabilities: {},
298
401
  status: { documented: true },
@@ -327,10 +430,12 @@ var init_operations = __esm({
327
430
  ]
328
431
  };
329
432
  allOperations = [
433
+ balanceOp,
330
434
  blobsOp,
331
435
  chatOp,
332
436
  copyOp,
333
437
  createOp,
438
+ createBlobOp,
334
439
  deleteOp,
335
440
  embedOp,
336
441
  generateOp,
@@ -340,7 +445,10 @@ var init_operations = __esm({
340
445
  showOp,
341
446
  systemOneOp,
342
447
  tagsOp,
448
+ usageOp,
343
449
  versionOp,
450
+ webFetchOp,
451
+ webSearchOp,
344
452
  openaiChatCompletionsOp,
345
453
  openaiCompletionsOp,
346
454
  openaiEmbeddingsOp,
@@ -404,9 +512,32 @@ async function callGeneratedOllamaTool(runtime, name, args, options) {
404
512
  };
405
513
  }
406
514
  try {
515
+ const opParams = operation.parameters ?? [];
516
+ const pathParams = {};
517
+ const queryParams = {};
518
+ const headerParams = {};
519
+ const bodyArgs = {};
520
+ for (const [key, value] of Object.entries(args)) {
521
+ const paramDef = opParams.find((p) => p.name === key);
522
+ if (paramDef) {
523
+ if (paramDef.in === "path") {
524
+ pathParams[key] = String(value);
525
+ } else if (paramDef.in === "query") {
526
+ queryParams[key] = String(value);
527
+ } else if (paramDef.in === "header") {
528
+ headerParams[key] = String(value);
529
+ }
530
+ } else {
531
+ bodyArgs[key] = value;
532
+ }
533
+ }
534
+ const hasBody = Object.keys(bodyArgs).length > 0;
407
535
  const result = await runtime.invoke({
408
536
  operation,
409
- body: args,
537
+ body: hasBody ? bodyArgs : void 0,
538
+ ...Object.keys(pathParams).length > 0 ? { pathParams } : {},
539
+ ...Object.keys(queryParams).length > 0 ? { queryParams } : {},
540
+ ...Object.keys(headerParams).length > 0 ? { headerParams } : {},
410
541
  ...options?.signal !== void 0 ? { signal: options.signal } : {}
411
542
  });
412
543
  return {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/generated/api/operations.ts","../src/mcp/generated-bridge.ts"],"names":["dirname","fileURLToPath","resolve","readFileSync"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAA,kBAAA,GAAA,EAAA;AAAA,QAAA,CAAA,kBAAA,EAAA;AAAA,EAAA,aAAA,EAAA,MAAA,aAAA;AAAA,EAAA,mBAAA,EAAA,MAAA,mBAAA;AAAA,EAAA,OAAA,EAAA,MAAA,OAAA;AAAA,EAAA,MAAA,EAAA,MAAA,MAAA;AAAA,EAAA,MAAA,EAAA,MAAA,MAAA;AAAA,EAAA,QAAA,EAAA,MAAA,QAAA;AAAA,EAAA,QAAA,EAAA,MAAA,QAAA;AAAA,EAAA,OAAA,EAAA,MAAA,OAAA;AAAA,EAAA,UAAA,EAAA,MAAA,UAAA;AAAA,EAAA,uBAAA,EAAA,MAAA,uBAAA;AAAA,EAAA,mBAAA,EAAA,MAAA,mBAAA;AAAA,EAAA,kBAAA,EAAA,MAAA,kBAAA;AAAA,EAAA,oBAAA,EAAA,MAAA,oBAAA;AAAA,EAAA,cAAA,EAAA,MAAA,cAAA;AAAA,EAAA,iBAAA,EAAA,MAAA,iBAAA;AAAA,EAAA,IAAA,EAAA,MAAA,IAAA;AAAA,EAAA,MAAA,EAAA,MAAA,MAAA;AAAA,EAAA,MAAA,EAAA,MAAA,MAAA;AAAA,EAAA,MAAA,EAAA,MAAA,MAAA;AAAA,EAAA,WAAA,EAAA,MAAA,WAAA;AAAA,EAAA,MAAA,EAAA,MAAA,MAAA;AAAA,EAAA,SAAA,EAAA,MAAA;AAAA,CAAA,CAAA;AAAA,IASa,OAAA,EAcA,QAuBA,MAAA,EAYA,QAAA,EAcA,UAYA,OAAA,EAaA,UAAA,EAkBA,MAYA,MAAA,EAaA,MAAA,EAaA,QAgBA,WAAA,EAyBA,MAAA,EAYA,WAYA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A,EAAM,MAAA,EAAQ,IAAA,EAAM,IAAA,CAAK,SAAA,CAAU,MAAA,EAAQ,IAAA,EAAM,CAAC,CAAA,EAAG,CAAA;AAAA,MACjE,iBAAA,EAAmB;AAAA,KACrB;AAAA,EACF,SAAS,KAAA,EAAO;AACd,IAAA,MAAM,UAAU,KAAA,YAAiB,KAAA,GAAQ,KAAA,CAAM,OAAA,GAAU,OAAO,KAAK,CAAA;AACrE,IAAA,OAAO;AAAA,MACL,OAAA,EAAS,CAAC,EAAE,IAAA,EAAM,MAAA,EAAQ,IAAA,EAAM,CAAA,YAAA,EAAe,IAAI,CAAA,SAAA,EAAY,OAAO,CAAA,CAAA,EAAI,CAAA;AAAA,MAC1E,iBAAA,EAAmB,EAAE,KAAA,EAAO,aAAA,EAAe,MAAM,OAAA;AAAQ,KAC3D;AAAA,EACF;AACF","file":"mcp-generated.cjs","sourcesContent":["/**\n * AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n * Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n * Each OperationDefinition captures what Ollama exposes; the runtime\n * in src/generated/runtime/runtime.ts captures how the SDK behaves.\n */\n\nimport type { OperationDefinition } from '../runtime/operation-definition.js';\n\nexport const blobsOp = {\n operationId: 'blobs',\n method: 'HEAD',\n path: '/api/blobs/{digest}',\n environment: { local: true, cloud: false },\n transport: { mode: 'json', streaming: false },\n capabilities: {},\n status: { documented: true },\n domain: 'native',\n notes: [\n 'HEAD-only endpoint for blob existence checks; declared in OpenAPI but not in the legacy parity manifest.',\n ],\n} as const satisfies OperationDefinition;\n\nexport const chatOp = {\n operationId: 'chat',\n method: 'POST',\n path: '/api/chat',\n request: { $ref: '#/schemas/ChatRequest' },\n response: { $ref: '#/schemas/ChatResponse' },\n environment: { local: true, cloud: true },\n transport: { mode: 'ndjson', streaming: true, streamingDefault: true },\n capabilities: {\n thinking: 'model-dependent',\n tools: 'model-dependent',\n vision: 'model-dependent',\n structuredOutput: 'supported',\n logprobs: 'supported',\n },\n status: { documented: true },\n domain: 'native',\n notes: [\n 'Use /api/show to discover model-specific thinking values and defaults.',\n 'Structured output (format field) is rejected by Ollama Cloud.',\n ],\n} as const satisfies OperationDefinition;\n\nexport const copyOp = {\n operationId: 'copy',\n method: 'POST',\n path: '/api/copy',\n request: { $ref: '#/schemas/CopyRequest' },\n environment: { local: true, cloud: false },\n transport: { mode: 'json', streaming: false },\n capabilities: {},\n status: { documented: true },\n domain: 'native',\n} as const satisfies OperationDefinition;\n\nexport const createOp = {\n operationId: 'create',\n method: 'POST',\n path: '/api/create',\n request: { $ref: '#/schemas/CreateRequest' },\n response: { $ref: '#/schemas/StatusResponse' },\n environment: { local: true, cloud: false },\n transport: { mode: 'ndjson', streaming: true, streamingDefault: true },\n capabilities: { thinking: 'unsupported', tools: 'unsupported' },\n status: { documented: true },\n domain: 'native',\n notes: ['Model creation is local-only; Ollama Cloud does not support it.'],\n} as const satisfies OperationDefinition;\n\nexport const deleteOp = {\n operationId: 'delete',\n method: 'DELETE',\n path: '/api/delete',\n request: { $ref: '#/schemas/DeleteRequest' },\n environment: { local: true, cloud: false },\n transport: { mode: 'json', streaming: false },\n capabilities: {},\n status: { documented: true },\n domain: 'native',\n} as const satisfies OperationDefinition;\n\nexport const embedOp = {\n operationId: 'embed',\n method: 'POST',\n path: '/api/embed',\n request: { $ref: '#/schemas/EmbedRequest' },\n response: { $ref: '#/schemas/EmbedResponse' },\n environment: { local: true, cloud: true },\n transport: { mode: 'json', streaming: false },\n capabilities: { embeddings: 'supported' },\n status: { documented: true },\n domain: 'native',\n} as const satisfies OperationDefinition;\n\nexport const generateOp = {\n operationId: 'generate',\n method: 'POST',\n path: '/api/generate',\n request: { $ref: '#/schemas/GenerateRequest' },\n response: { $ref: '#/schemas/GenerateResponse' },\n environment: { local: true, cloud: true },\n transport: { mode: 'ndjson', streaming: true, streamingDefault: true },\n capabilities: {\n thinking: 'model-dependent',\n vision: 'supported',\n structuredOutput: 'supported',\n logprobs: 'supported',\n },\n status: { documented: true },\n domain: 'native',\n} as const satisfies OperationDefinition;\n\nexport const psOp = {\n operationId: 'ps',\n method: 'GET',\n path: '/api/ps',\n response: { $ref: '#/schemas/PsResponse' },\n environment: { local: true, cloud: true },\n transport: { mode: 'json', streaming: false },\n capabilities: {},\n status: { documented: true },\n domain: 'native',\n} as const satisfies OperationDefinition;\n\nexport const pullOp = {\n operationId: 'pull',\n method: 'POST',\n path: '/api/pull',\n request: { $ref: '#/schemas/PullRequest' },\n response: { $ref: '#/schemas/StatusResponse' },\n environment: { local: true, cloud: false },\n transport: { mode: 'ndjson', streaming: true, streamingDefault: true },\n capabilities: {},\n status: { documented: true },\n domain: 'native',\n} as const satisfies OperationDefinition;\n\nexport const pushOp = {\n operationId: 'push',\n method: 'POST',\n path: '/api/push',\n request: { $ref: '#/schemas/PushRequest' },\n response: { $ref: '#/schemas/StatusResponse' },\n environment: { local: true, cloud: false },\n transport: { mode: 'ndjson', streaming: true, streamingDefault: true },\n capabilities: {},\n status: { documented: true },\n domain: 'native',\n} as const satisfies OperationDefinition;\n\nexport const showOp = {\n operationId: 'show',\n method: 'POST',\n path: '/api/show',\n request: { $ref: '#/schemas/ShowRequest' },\n response: { $ref: '#/schemas/ShowResponse' },\n environment: { local: true, cloud: true },\n transport: { mode: 'json', streaming: false },\n capabilities: {},\n status: { documented: true },\n domain: 'native',\n notes: [\n 'Capabilities source: /api/show is the runtime source of truth for model-dependent capability values (tools, vision, thinking, embeddings).',\n ],\n} as const satisfies OperationDefinition;\n\nexport const systemOneOp = {\n operationId: 'systemOne',\n method: 'POST',\n path: '/v1/systemone',\n environment: { local: true, cloud: false },\n transport: { mode: 'json', streaming: false },\n capabilities: {\n thinking: 'unsupported',\n tools: 'unsupported',\n vision: 'unsupported',\n structuredOutput: 'unsupported',\n logprobs: 'unsupported',\n embeddings: 'unsupported',\n },\n constraints: { minOllamaVersion: '0.35.0', maxRequestBytes: 65536 },\n status: { documented: true, experimental: true },\n domain: 'native',\n notes: [\n 'Local-only; Ollama Cloud rejects /v1/systemone.',\n 'Hard 64 KiB request body limit enforced by the server.',\n 'No images, no tools, no generation controls (temperature, top_p, etc.).',\n 'Experimental: behavioral surface may change between Ollama releases.',\n ],\n} as const satisfies OperationDefinition;\n\nexport const tagsOp = {\n operationId: 'tags',\n method: 'GET',\n path: '/api/tags',\n response: { $ref: '#/schemas/ListResponse' },\n environment: { local: true, cloud: true },\n transport: { mode: 'json', streaming: false },\n capabilities: {},\n status: { documented: true },\n domain: 'native',\n} as const satisfies OperationDefinition;\n\nexport const versionOp = {\n operationId: 'version',\n method: 'GET',\n path: '/api/version',\n response: { $ref: '#/schemas/VersionResponse' },\n environment: { local: true, cloud: true },\n transport: { mode: 'json', streaming: false },\n capabilities: {},\n status: { documented: true },\n domain: 'native',\n} as const satisfies OperationDefinition;\n\nexport const openaiChatCompletionsOp = {\n operationId: 'openaiChatCompletions',\n method: 'POST',\n path: '/v1/chat/completions',\n environment: { local: true, cloud: true },\n transport: { mode: 'sse', streaming: true, streamingDefault: false },\n capabilities: {\n thinking: 'model-dependent',\n tools: 'model-dependent',\n vision: 'model-dependent',\n structuredOutput: 'supported',\n logprobs: 'supported',\n },\n status: { documented: true },\n domain: 'openai',\n notes: [\n 'Ollama exposes a subset of the OpenAI Chat Completions request fields; see docs/upstream/ollama-openai-compatibility.mdx.',\n ],\n} as const satisfies OperationDefinition;\n\nexport const openaiCompletionsOp = {\n operationId: 'openaiCompletions',\n method: 'POST',\n path: '/v1/completions',\n environment: { local: true, cloud: true },\n transport: { mode: 'sse', streaming: true, streamingDefault: false },\n capabilities: { logprobs: 'supported' },\n status: { documented: true },\n domain: 'openai',\n} as const satisfies OperationDefinition;\n\nexport const openaiEmbeddingsOp = {\n operationId: 'openaiEmbeddings',\n method: 'POST',\n path: '/v1/embeddings',\n environment: { local: true, cloud: true },\n transport: { mode: 'json', streaming: false },\n capabilities: { embeddings: 'supported' },\n status: { documented: true },\n domain: 'openai',\n} as const satisfies OperationDefinition;\n\nexport const openaiModelsOp = {\n operationId: 'openaiModels',\n method: 'GET',\n path: '/v1/models',\n environment: { local: true, cloud: true },\n transport: { mode: 'json', streaming: false },\n capabilities: {},\n status: { documented: true },\n domain: 'openai',\n} as const satisfies OperationDefinition;\n\nexport const openaiModelsGetOneOp = {\n operationId: 'openaiModelsGetOne',\n method: 'GET',\n path: '/v1/models/{model}',\n environment: { local: true, cloud: true },\n transport: { mode: 'json', streaming: false },\n capabilities: {},\n status: { documented: true },\n domain: 'openai',\n notes: ['Returns metadata for a single OpenAI-compat model by id.'],\n} as const satisfies OperationDefinition;\n\nexport const openaiResponsesOp = {\n operationId: 'openaiResponses',\n method: 'POST',\n path: '/v1/responses',\n environment: { local: true, cloud: true },\n transport: { mode: 'sse', streaming: true, streamingDefault: false },\n capabilities: { thinking: 'model-dependent', tools: 'model-dependent' },\n status: { documented: true },\n domain: 'openai',\n notes: [\n 'Ollama implements a subset of the OpenAI Responses API; previous_response_id and conversation are explicitly unsupported.',\n ],\n} as const satisfies OperationDefinition;\n\nexport const anthropicMessagesOp = {\n operationId: 'anthropicMessages',\n method: 'POST',\n path: '/v1/messages',\n environment: { local: true, cloud: true },\n transport: { mode: 'sse', streaming: true, streamingDefault: false },\n capabilities: { thinking: 'model-dependent', tools: 'model-dependent' },\n status: { documented: true },\n domain: 'anthropic',\n notes: [\n \"tool_choice and metadata are explicitly unsupported by Ollama's Anthropic compat layer.\",\n 'Nested cache_control fields under messages[].content[].cache_control are unsupported.',\n ],\n} as const satisfies OperationDefinition;\n\nexport const allOperations = [\n blobsOp,\n chatOp,\n copyOp,\n createOp,\n deleteOp,\n embedOp,\n generateOp,\n psOp,\n pullOp,\n pushOp,\n showOp,\n systemOneOp,\n tagsOp,\n versionOp,\n openaiChatCompletionsOp,\n openaiCompletionsOp,\n openaiEmbeddingsOp,\n openaiModelsOp,\n openaiModelsGetOneOp,\n openaiResponsesOp,\n anthropicMessagesOp,\n] as const;\n","/**\n * Generated Ollama MCP tools — runtime adapter.\n *\n * Reads the descriptor list from `src/generated/mcp/tools.json` (the Wave 6\n * MCP emitter output) and exposes them as a `McpToolDescriptor[]` that\n * `McpBridge` can register. The actual call execution delegates to the\n * generated `OllamaRuntime` via the user-provided runtime instance.\n *\n * Usage:\n * ```ts\n * import { NativeApi, OllamaRuntime } from '@nemesis-oss/ollama-sdk/runtime';\n * import { createGeneratedOllamaTools } from '@nemesis-oss/ollama-sdk/mcp/generated';\n *\n * const runtime = new OllamaRuntime({ http });\n * const tools = createGeneratedOllamaTools(runtime);\n * bridge.registerTools(tools);\n * ```\n *\n * This is a Wave 6 opt-in feature — the existing McpBridge continues to work\n * unchanged. Users who want generated MCP tools import this adapter\n * explicitly.\n */\nimport { readFileSync } from 'node:fs';\nimport { fileURLToPath } from 'node:url';\nimport { resolve, dirname } from 'node:path';\nimport type { McpToolDescriptor } from './types.js';\nimport { OllamaRuntime } from '../generated/runtime/runtime.js';\nimport type { OperationDefinition } from '../generated/runtime/operation-definition.js';\n\ninterface GeneratedToolEntry extends McpToolDescriptor {\n readonly _operationId: string;\n}\n\ninterface GeneratedToolsFile {\n readonly _comment?: string;\n readonly tools: readonly GeneratedToolEntry[];\n}\n\n/**\n * Resolve the path to `tools.json` across runtime environments:\n *\n * - **In source (development):** `src/generated/mcp/tools.json`\n * - **In the published tarball:** `dist/mcp/tools.json` (copied by tsup's\n * `onSuccess` hook; see tsup.config.ts)\n *\n * The dist bundle is at `dist/mcp-generated.js`, so the JSON sits two\n * directories up + into `mcp/`. The source file is at\n * `src/mcp/generated-bridge.ts`, so the JSON sits one directory up +\n * into `generated/mcp/`.\n */\nconst HERE = dirname(fileURLToPath(import.meta.url));\nconst TOOLS_JSON_PATH = (() => {\n // Try the source layout first (development), then fall back to the dist\n // layout (published). The order matters because in a tsx-run dev env\n // we may be executing from `src/mcp/generated-bridge.ts`, but in a\n // consumer install we're at `dist/mcp-generated.js`.\n const candidates = [\n resolve(HERE, '../generated/mcp/tools.json'), // source layout\n resolve(HERE, 'mcp/tools.json'), // dist layout (next to mcp-generated.js)\n resolve(HERE, '../mcp/tools.json'), // alt dist layout (sibling of bundled dir)\n ];\n for (const candidate of candidates) {\n try {\n readFileSync(candidate, 'utf8');\n return candidate;\n } catch {\n // try next candidate\n }\n }\n // Fall back to the source-layout path; the error will surface with a\n // clearer message when the loader is actually invoked.\n return candidates[0] ?? resolve(HERE, '../generated/mcp/tools.json');\n})();\n\nlet cachedTools: readonly GeneratedToolEntry[] | undefined;\n\n/** Load and cache the generated tool descriptors from tools.json. */\nexport function loadGeneratedOllamaTools(): readonly GeneratedToolEntry[] {\n if (cachedTools) return cachedTools;\n const raw = readFileSync(TOOLS_JSON_PATH, 'utf8');\n const parsed = JSON.parse(raw) as GeneratedToolsFile;\n cachedTools = parsed.tools;\n return cachedTools;\n}\n\n/** Drop the `_operationId` field before exposing the descriptor externally. */\nfunction publicDescriptor(entry: GeneratedToolEntry): McpToolDescriptor {\n const { _operationId, ...rest } = entry;\n void _operationId;\n return rest;\n}\n\n/**\n * Build a list of MCP tool descriptors for the generated Ollama operations.\n * Each tool can be invoked by name via {@link callGeneratedOllamaTool}.\n *\n * The descriptors are read once and cached for the lifetime of the process.\n */\nexport function listGeneratedOllamaTools(): readonly McpToolDescriptor[] {\n return loadGeneratedOllamaTools().map(publicDescriptor);\n}\n\n/**\n * Invoke a generated tool by name. The `name` must match a tool from\n * {@link listGeneratedOllamaTools}.\n *\n * Returns a `McpCallToolResult` containing the structured response. The\n * caller (typically `McpBridge`) is responsible for serializing the result\n * back over the MCP transport.\n */\nexport async function callGeneratedOllamaTool(\n runtime: OllamaRuntime,\n name: string,\n args: Record<string, unknown>,\n options?: { signal?: AbortSignal },\n): Promise<{ content: readonly { type: 'text'; text: string }[]; structuredContent: unknown }> {\n const tools = loadGeneratedOllamaTools();\n const entry = tools.find((t) => t.name === name);\n if (!entry) {\n return {\n content: [{ type: 'text', text: `Unknown tool: ${name}` }],\n structuredContent: { error: 'unknown_tool', name },\n };\n }\n\n // Look up the operation in the IR by id. We re-import the operations\n // module to avoid a circular dependency at module-load time.\n const operations = await import('../generated/api/operations.js');\n const opKey = `${entry._operationId}Op` as keyof typeof operations;\n const operation = operations[opKey] as OperationDefinition | undefined;\n if (!operation || typeof operation !== 'object' || !('operationId' in operation)) {\n return {\n content: [{ type: 'text', text: `Operation not found for ${name}` }],\n structuredContent: { error: 'operation_not_found', name },\n };\n }\n\n try {\n const result = await runtime.invoke<unknown>({\n operation,\n body: args,\n ...(options?.signal !== undefined ? { signal: options.signal } : {}),\n });\n return {\n content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],\n structuredContent: result,\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return {\n content: [{ type: 'text', text: `Ollama tool ${name} failed: ${message}` }],\n structuredContent: { error: 'tool_failed', name, message },\n };\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/generated/api/operations.ts","../src/mcp/generated-bridge.ts"],"names":["dirname","fileURLToPath","resolve","readFileSync"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAA,kBAAA,GAAA,EAAA;AAAA,QAAA,CAAA,kBAAA,EAAA;AAAA,EAAA,aAAA,EAAA,MAAA,aAAA;AAAA,EAAA,mBAAA,EAAA,MAAA,mBAAA;AAAA,EAAA,SAAA,EAAA,MAAA,SAAA;AAAA,EAAA,OAAA,EAAA,MAAA,OAAA;AAAA,EAAA,MAAA,EAAA,MAAA,MAAA;AAAA,EAAA,MAAA,EAAA,MAAA,MAAA;AAAA,EAAA,YAAA,EAAA,MAAA,YAAA;AAAA,EAAA,QAAA,EAAA,MAAA,QAAA;AAAA,EAAA,QAAA,EAAA,MAAA,QAAA;AAAA,EAAA,OAAA,EAAA,MAAA,OAAA;AAAA,EAAA,UAAA,EAAA,MAAA,UAAA;AAAA,EAAA,uBAAA,EAAA,MAAA,uBAAA;AAAA,EAAA,mBAAA,EAAA,MAAA,mBAAA;AAAA,EAAA,kBAAA,EAAA,MAAA,kBAAA;AAAA,EAAA,oBAAA,EAAA,M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:generate`. DO NOT EDIT.\n * Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n * Each OperationDefinition captures what Ollama exposes; the runtime\n * in src/generated/runtime/runtime.ts captures how the SDK behaves.\n */\n\nimport type { OperationDefinition } from '../runtime/operation-definition.js';\n\nexport const balanceOp = {\n operationId: 'balance',\n method: 'GET',\n path: '/api/balance',\n response: { $ref: '#/schemas/BalanceResponse' },\n environment: { local: false, cloud: true },\n host: 'https://ollama.com',\n transport: { mode: 'json', streaming: false },\n capabilities: {},\n status: { documented: true },\n domain: 'native',\n notes: [\n 'Cloud-only account endpoint — targets https://ollama.com, not the local Ollama server.',\n 'Requires an Ollama Cloud API key (set via OllamaClient credentials).',\n 'Takes no parameters. For usage history see the usage operation.',\n 'Rate limited to 10 requests/minute per user; 429 responses carry a Retry-After header.',\n 'Use OllamaClient.balance() — the generated NativeApi class does not expose this operation.',\n ],\n} as const satisfies OperationDefinition;\n\nexport const blobsOp = {\n operationId: 'blobs',\n method: 'HEAD',\n path: '/api/blobs/{digest}',\n environment: { local: true, cloud: false },\n parameters: [{ name: 'digest', in: 'path', required: true, schema: { type: 'string' } }],\n transport: { mode: 'json', streaming: false },\n capabilities: {},\n status: { documented: true },\n domain: 'native',\n notes: [\n 'HEAD-only endpoint for blob existence checks; declared in OpenAPI but not in the legacy parity manifest.',\n ],\n} as const satisfies OperationDefinition;\n\nexport const chatOp = {\n operationId: 'chat',\n method: 'POST',\n path: '/api/chat',\n request: { $ref: '#/schemas/ChatRequest' },\n response: { $ref: '#/schemas/ChatResponse' },\n environment: { local: true, cloud: true },\n transport: { mode: 'ndjson', streaming: true, streamingDefault: true },\n capabilities: {\n thinking: 'model-dependent',\n tools: 'model-dependent',\n vision: 'model-dependent',\n structuredOutput: 'supported',\n logprobs: 'supported',\n },\n status: { documented: true },\n domain: 'native',\n notes: [\n 'Use /api/show to discover model-specific thinking values and defaults.',\n 'Structured output (format field) is rejected by Ollama Cloud.',\n ],\n} as const satisfies OperationDefinition;\n\nexport const copyOp = {\n operationId: 'copy',\n method: 'POST',\n path: '/api/copy',\n request: { $ref: '#/schemas/CopyRequest' },\n environment: { local: true, cloud: false },\n transport: { mode: 'json', streaming: false },\n capabilities: {},\n status: { documented: true },\n domain: 'native',\n} as const satisfies OperationDefinition;\n\nexport const createOp = {\n operationId: 'create',\n method: 'POST',\n path: '/api/create',\n request: { $ref: '#/schemas/CreateRequest' },\n response: { $ref: '#/schemas/StatusResponse' },\n environment: { local: true, cloud: false },\n transport: { mode: 'ndjson', streaming: true, streamingDefault: true },\n capabilities: { thinking: 'unsupported', tools: 'unsupported' },\n status: { documented: true },\n domain: 'native',\n notes: ['Model creation is local-only; Ollama Cloud does not support it.'],\n} as const satisfies OperationDefinition;\n\nexport const createBlobOp = {\n operationId: 'createBlob',\n method: 'POST',\n path: '/api/blobs/{digest}',\n environment: { local: true, cloud: false },\n parameters: [{ name: 'digest', in: 'path', required: true, schema: { type: 'string' } }],\n transport: { mode: 'json', streaming: false },\n capabilities: {},\n status: { documented: true },\n domain: 'native',\n notes: [\n 'POST endpoint for blob creation; takes a binary body (application/octet-stream).',\n 'Handled by OllamaClient.createBlob() — the generated NativeApi does not expose this operation because the runtime JSON-encodes request bodies.',\n ],\n} as const satisfies OperationDefinition;\n\nexport const deleteOp = {\n operationId: 'delete',\n method: 'DELETE',\n path: '/api/delete',\n request: { $ref: '#/schemas/DeleteRequest' },\n environment: { local: true, cloud: false },\n transport: { mode: 'json', streaming: false },\n capabilities: {},\n status: { documented: true },\n domain: 'native',\n} as const satisfies OperationDefinition;\n\nexport const embedOp = {\n operationId: 'embed',\n method: 'POST',\n path: '/api/embed',\n request: { $ref: '#/schemas/EmbedRequest' },\n response: { $ref: '#/schemas/EmbedResponse' },\n environment: { local: true, cloud: true },\n transport: { mode: 'json', streaming: false },\n capabilities: { embeddings: 'supported' },\n status: { documented: true },\n domain: 'native',\n} as const satisfies OperationDefinition;\n\nexport const generateOp = {\n operationId: 'generate',\n method: 'POST',\n path: '/api/generate',\n request: { $ref: '#/schemas/GenerateRequest' },\n response: { $ref: '#/schemas/GenerateResponse' },\n environment: { local: true, cloud: true },\n transport: { mode: 'ndjson', streaming: true, streamingDefault: true },\n capabilities: {\n thinking: 'model-dependent',\n vision: 'supported',\n structuredOutput: 'supported',\n logprobs: 'supported',\n },\n status: { documented: true },\n domain: 'native',\n} as const satisfies OperationDefinition;\n\nexport const psOp = {\n operationId: 'ps',\n method: 'GET',\n path: '/api/ps',\n response: { $ref: '#/schemas/PsResponse' },\n environment: { local: true, cloud: true },\n transport: { mode: 'json', streaming: false },\n capabilities: {},\n status: { documented: true },\n domain: 'native',\n} as const satisfies OperationDefinition;\n\nexport const pullOp = {\n operationId: 'pull',\n method: 'POST',\n path: '/api/pull',\n request: { $ref: '#/schemas/PullRequest' },\n response: { $ref: '#/schemas/StatusResponse' },\n environment: { local: true, cloud: false },\n transport: { mode: 'ndjson', streaming: true, streamingDefault: true },\n capabilities: {},\n status: { documented: true },\n domain: 'native',\n} as const satisfies OperationDefinition;\n\nexport const pushOp = {\n operationId: 'push',\n method: 'POST',\n path: '/api/push',\n request: { $ref: '#/schemas/PushRequest' },\n response: { $ref: '#/schemas/StatusResponse' },\n environment: { local: true, cloud: false },\n transport: { mode: 'ndjson', streaming: true, streamingDefault: true },\n capabilities: {},\n status: { documented: true },\n domain: 'native',\n} as const satisfies OperationDefinition;\n\nexport const showOp = {\n operationId: 'show',\n method: 'POST',\n path: '/api/show',\n request: { $ref: '#/schemas/ShowRequest' },\n response: { $ref: '#/schemas/ShowResponse' },\n environment: { local: true, cloud: true },\n transport: { mode: 'json', streaming: false },\n capabilities: {},\n status: { documented: true },\n domain: 'native',\n notes: [\n 'Capabilities source: /api/show is the runtime source of truth for model-dependent capability values (tools, vision, thinking, embeddings).',\n ],\n} as const satisfies OperationDefinition;\n\nexport const systemOneOp = {\n operationId: 'systemOne',\n method: 'POST',\n path: '/v1/systemone',\n request: { $ref: '#/schemas/SystemOneRequest' },\n response: { $ref: '#/schemas/SystemOneResponse' },\n environment: { local: true, cloud: false },\n transport: { mode: 'json', streaming: false },\n capabilities: {\n thinking: 'unsupported',\n tools: 'unsupported',\n vision: 'model-dependent',\n structuredOutput: 'unsupported',\n logprobs: 'unsupported',\n embeddings: 'unsupported',\n },\n constraints: {\n minOllamaVersion: '0.35.0',\n maxRequestBytes: 65536,\n maxRequestBytesWithImages: 33554432,\n },\n status: { documented: true, experimental: true },\n domain: 'native',\n notes: [\n 'Local-only; Ollama Cloud rejects /v1/systemone.',\n '64 KiB request limit without images, 32 MiB with images (includes JSON/base64 overhead).',\n 'No tools, no generation controls (temperature, top_p, etc.).',\n 'Vision is model-dependent: images are accepted by vision-weighted models (Clef/Clef Flash) but not by text-only models.',\n 'Experimental: behavioral surface may change between Ollama releases.',\n ],\n} as const satisfies OperationDefinition;\n\nexport const tagsOp = {\n operationId: 'tags',\n method: 'GET',\n path: '/api/tags',\n response: { $ref: '#/schemas/ListResponse' },\n environment: { local: true, cloud: true },\n transport: { mode: 'json', streaming: false },\n capabilities: {},\n status: { documented: true },\n domain: 'native',\n} as const satisfies OperationDefinition;\n\nexport const usageOp = {\n operationId: 'usage',\n method: 'GET',\n path: '/api/usage',\n response: { $ref: '#/schemas/UsageResponse' },\n environment: { local: false, cloud: true },\n host: 'https://ollama.com',\n transport: { mode: 'json', streaming: false },\n capabilities: {},\n status: { documented: true },\n domain: 'native',\n notes: [\n 'Cloud-only account endpoint — targets https://ollama.com, not the local Ollama server.',\n 'Requires an Ollama Cloud API key (set via OllamaClient credentials).',\n 'Query parameters (not modeled by the generated runtime): range = 24h | 7d | 30d (server default 7d), scope = self | team (server default self; team scope requires a team admin).',\n 'Rate limited to 10 requests/minute per user; 429 responses carry a Retry-After header.',\n 'Use OllamaClient.usage() — the generated NativeApi class does not expose this operation.',\n ],\n} as const satisfies OperationDefinition;\n\nexport const versionOp = {\n operationId: 'version',\n method: 'GET',\n path: '/api/version',\n response: { $ref: '#/schemas/VersionResponse' },\n environment: { local: true, cloud: true },\n transport: { mode: 'json', streaming: false },\n capabilities: {},\n status: { documented: true },\n domain: 'native',\n} as const satisfies OperationDefinition;\n\nexport const webFetchOp = {\n operationId: 'webFetch',\n method: 'POST',\n path: '/api/web_fetch',\n request: { $ref: '#/schemas/WebFetchRequest' },\n response: { $ref: '#/schemas/WebFetchResponse' },\n environment: { local: false, cloud: true },\n host: 'https://ollama.com',\n transport: { mode: 'json', streaming: false },\n capabilities: {},\n status: { documented: true },\n domain: 'native',\n notes: [\n 'Cloud-only capability endpoint — targets https://ollama.com, not the local Ollama server.',\n 'Requires an Ollama Cloud API key (set via OllamaClient credentials).',\n 'Use OllamaClient.webFetch() — the generated NativeApi class does not expose this operation.',\n ],\n} as const satisfies OperationDefinition;\n\nexport const webSearchOp = {\n operationId: 'webSearch',\n method: 'POST',\n path: '/api/web_search',\n request: { $ref: '#/schemas/WebSearchRequest' },\n response: { $ref: '#/schemas/WebSearchResponse' },\n environment: { local: false, cloud: true },\n host: 'https://ollama.com',\n transport: { mode: 'json', streaming: false },\n capabilities: {},\n status: { documented: true },\n domain: 'native',\n notes: [\n 'Cloud-only capability endpoint — targets https://ollama.com, not the local Ollama server.',\n 'Requires an Ollama Cloud API key (set via OllamaClient credentials).',\n 'Use OllamaClient.webSearch() — the generated NativeApi class does not expose this operation.',\n ],\n} as const satisfies OperationDefinition;\n\nexport const openaiChatCompletionsOp = {\n operationId: 'openaiChatCompletions',\n method: 'POST',\n path: '/v1/chat/completions',\n environment: { local: true, cloud: true },\n transport: { mode: 'sse', streaming: true, streamingDefault: false },\n capabilities: {\n thinking: 'model-dependent',\n tools: 'model-dependent',\n vision: 'model-dependent',\n structuredOutput: 'supported',\n logprobs: 'supported',\n },\n status: { documented: true },\n domain: 'openai',\n notes: [\n 'Ollama exposes a subset of the OpenAI Chat Completions request fields; see docs/upstream/ollama-openai-compatibility.mdx.',\n ],\n} as const satisfies OperationDefinition;\n\nexport const openaiCompletionsOp = {\n operationId: 'openaiCompletions',\n method: 'POST',\n path: '/v1/completions',\n environment: { local: true, cloud: true },\n transport: { mode: 'sse', streaming: true, streamingDefault: false },\n capabilities: { logprobs: 'supported' },\n status: { documented: true },\n domain: 'openai',\n} as const satisfies OperationDefinition;\n\nexport const openaiEmbeddingsOp = {\n operationId: 'openaiEmbeddings',\n method: 'POST',\n path: '/v1/embeddings',\n environment: { local: true, cloud: true },\n transport: { mode: 'json', streaming: false },\n capabilities: { embeddings: 'supported' },\n status: { documented: true },\n domain: 'openai',\n} as const satisfies OperationDefinition;\n\nexport const openaiModelsOp = {\n operationId: 'openaiModels',\n method: 'GET',\n path: '/v1/models',\n environment: { local: true, cloud: true },\n transport: { mode: 'json', streaming: false },\n capabilities: {},\n status: { documented: true },\n domain: 'openai',\n} as const satisfies OperationDefinition;\n\nexport const openaiModelsGetOneOp = {\n operationId: 'openaiModelsGetOne',\n method: 'GET',\n path: '/v1/models/{model}',\n environment: { local: true, cloud: true },\n parameters: [{ name: 'model', in: 'path', required: true, schema: { type: 'string' } }],\n transport: { mode: 'json', streaming: false },\n capabilities: {},\n status: { documented: true },\n domain: 'openai',\n notes: ['Returns metadata for a single OpenAI-compat model by id.'],\n} as const satisfies OperationDefinition;\n\nexport const openaiResponsesOp = {\n operationId: 'openaiResponses',\n method: 'POST',\n path: '/v1/responses',\n environment: { local: true, cloud: true },\n transport: { mode: 'sse', streaming: true, streamingDefault: false },\n capabilities: { thinking: 'model-dependent', tools: 'model-dependent' },\n status: { documented: true },\n domain: 'openai',\n notes: [\n 'Ollama implements a subset of the OpenAI Responses API; previous_response_id and conversation are explicitly unsupported.',\n ],\n} as const satisfies OperationDefinition;\n\nexport const anthropicMessagesOp = {\n operationId: 'anthropicMessages',\n method: 'POST',\n path: '/v1/messages',\n environment: { local: true, cloud: true },\n transport: { mode: 'sse', streaming: true, streamingDefault: false },\n capabilities: { thinking: 'model-dependent', tools: 'model-dependent' },\n status: { documented: true },\n domain: 'anthropic',\n notes: [\n \"tool_choice and metadata are explicitly unsupported by Ollama's Anthropic compat layer.\",\n 'Nested cache_control fields under messages[].content[].cache_control are unsupported.',\n ],\n} as const satisfies OperationDefinition;\n\nexport const allOperations = [\n balanceOp,\n blobsOp,\n chatOp,\n copyOp,\n createOp,\n createBlobOp,\n deleteOp,\n embedOp,\n generateOp,\n psOp,\n pullOp,\n pushOp,\n showOp,\n systemOneOp,\n tagsOp,\n usageOp,\n versionOp,\n webFetchOp,\n webSearchOp,\n openaiChatCompletionsOp,\n openaiCompletionsOp,\n openaiEmbeddingsOp,\n openaiModelsOp,\n openaiModelsGetOneOp,\n openaiResponsesOp,\n anthropicMessagesOp,\n] as const;\n","/**\n * Generated Ollama MCP tools — runtime adapter.\n *\n * Reads the descriptor list from `src/generated/mcp/tools.json` (the Wave 6\n * MCP emitter output) and exposes them as a `McpToolDescriptor[]` that\n * `McpBridge` can register. The actual call execution delegates to the\n * generated `OllamaRuntime` via the user-provided runtime instance.\n *\n * Usage:\n * ```ts\n * import { NativeApi, OllamaRuntime } from '@nemesis-oss/ollama-sdk/runtime';\n * import { createGeneratedOllamaTools } from '@nemesis-oss/ollama-sdk/mcp/generated';\n *\n * const runtime = new OllamaRuntime({ http });\n * const tools = createGeneratedOllamaTools(runtime);\n * bridge.registerTools(tools);\n * ```\n *\n * This is a Wave 6 opt-in feature — the existing McpBridge continues to work\n * unchanged. Users who want generated MCP tools import this adapter\n * explicitly.\n */\nimport { readFileSync } from 'node:fs';\nimport { fileURLToPath } from 'node:url';\nimport { resolve, dirname } from 'node:path';\nimport type { McpToolDescriptor } from './types.js';\nimport { OllamaRuntime } from '../generated/runtime/runtime.js';\nimport type { OperationDefinition } from '../generated/runtime/operation-definition.js';\n\ninterface GeneratedToolEntry extends McpToolDescriptor {\n readonly _operationId: string;\n}\n\ninterface GeneratedToolsFile {\n readonly _comment?: string;\n readonly tools: readonly GeneratedToolEntry[];\n}\n\n/**\n * Resolve the path to `tools.json` across runtime environments:\n *\n * - **In source (development):** `src/generated/mcp/tools.json`\n * - **In the published tarball:** `dist/mcp/tools.json` (copied by tsup's\n * `onSuccess` hook; see tsup.config.ts)\n *\n * The dist bundle is at `dist/mcp-generated.js`, so the JSON sits two\n * directories up + into `mcp/`. The source file is at\n * `src/mcp/generated-bridge.ts`, so the JSON sits one directory up +\n * into `generated/mcp/`.\n */\nconst HERE = dirname(fileURLToPath(import.meta.url));\nconst TOOLS_JSON_PATH = (() => {\n // Try the source layout first (development), then fall back to the dist\n // layout (published). The order matters because in a tsx-run dev env\n // we may be executing from `src/mcp/generated-bridge.ts`, but in a\n // consumer install we're at `dist/mcp-generated.js`.\n const candidates = [\n resolve(HERE, '../generated/mcp/tools.json'), // source layout\n resolve(HERE, 'mcp/tools.json'), // dist layout (next to mcp-generated.js)\n resolve(HERE, '../mcp/tools.json'), // alt dist layout (sibling of bundled dir)\n ];\n for (const candidate of candidates) {\n try {\n readFileSync(candidate, 'utf8');\n return candidate;\n } catch {\n // try next candidate\n }\n }\n // Fall back to the source-layout path; the error will surface with a\n // clearer message when the loader is actually invoked.\n return candidates[0] ?? resolve(HERE, '../generated/mcp/tools.json');\n})();\n\nlet cachedTools: readonly GeneratedToolEntry[] | undefined;\n\n/** Load and cache the generated tool descriptors from tools.json. */\nexport function loadGeneratedOllamaTools(): readonly GeneratedToolEntry[] {\n if (cachedTools) return cachedTools;\n const raw = readFileSync(TOOLS_JSON_PATH, 'utf8');\n const parsed = JSON.parse(raw) as GeneratedToolsFile;\n cachedTools = parsed.tools;\n return cachedTools;\n}\n\n/** Drop the `_operationId` field before exposing the descriptor externally. */\nfunction publicDescriptor(entry: GeneratedToolEntry): McpToolDescriptor {\n const { _operationId, ...rest } = entry;\n void _operationId;\n return rest;\n}\n\n/**\n * Build a list of MCP tool descriptors for the generated Ollama operations.\n * Each tool can be invoked by name via {@link callGeneratedOllamaTool}.\n *\n * The descriptors are read once and cached for the lifetime of the process.\n */\nexport function listGeneratedOllamaTools(): readonly McpToolDescriptor[] {\n return loadGeneratedOllamaTools().map(publicDescriptor);\n}\n\n/**\n * Invoke a generated tool by name. The `name` must match a tool from\n * {@link listGeneratedOllamaTools}.\n *\n * Returns a `McpCallToolResult` containing the structured response. The\n * caller (typically `McpBridge`) is responsible for serializing the result\n * back over the MCP transport.\n */\nexport async function callGeneratedOllamaTool(\n runtime: OllamaRuntime,\n name: string,\n args: Record<string, unknown>,\n options?: { signal?: AbortSignal },\n): Promise<{ content: readonly { type: 'text'; text: string }[]; structuredContent: unknown }> {\n const tools = loadGeneratedOllamaTools();\n const entry = tools.find((t) => t.name === name);\n if (!entry) {\n return {\n content: [{ type: 'text', text: `Unknown tool: ${name}` }],\n structuredContent: { error: 'unknown_tool', name },\n };\n }\n\n // Look up the operation in the IR by id. We re-import the operations\n // module to avoid a circular dependency at module-load time.\n const operations = await import('../generated/api/operations.js');\n const opKey = `${entry._operationId}Op` as keyof typeof operations;\n const operation = operations[opKey] as OperationDefinition | undefined;\n if (!operation || typeof operation !== 'object' || !('operationId' in operation)) {\n return {\n content: [{ type: 'text', text: `Operation not found for ${name}` }],\n structuredContent: { error: 'operation_not_found', name },\n };\n }\n\n try {\n // Wave 15 (P0): split path/query/header parameters from the request\n // body. The MCP input schema may declare path parameters (e.g. `model`\n // for /v1/models/{model}) — those must be passed as `pathParams` to\n // the runtime, not put in the request body. The operation's\n // `parameters` field tells us which args are path/query/header vs body.\n const opParams = operation.parameters ?? [];\n const pathParams: Record<string, string> = {};\n const queryParams: Record<string, string> = {};\n const headerParams: Record<string, string> = {};\n const bodyArgs: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(args)) {\n const paramDef = opParams.find((p) => p.name === key);\n if (paramDef) {\n if (paramDef.in === 'path') {\n pathParams[key] = String(value);\n } else if (paramDef.in === 'query') {\n queryParams[key] = String(value);\n } else if (paramDef.in === 'header') {\n headerParams[key] = String(value);\n }\n } else {\n // Not a declared parameter → goes in the request body.\n bodyArgs[key] = value;\n }\n }\n\n const hasBody = Object.keys(bodyArgs).length > 0;\n const result = await runtime.invoke<unknown>({\n operation,\n body: hasBody ? bodyArgs : undefined,\n ...(Object.keys(pathParams).length > 0 ? { pathParams } : {}),\n ...(Object.keys(queryParams).length > 0 ? { queryParams } : {}),\n ...(Object.keys(headerParams).length > 0 ? { headerParams } : {}),\n ...(options?.signal !== undefined ? { signal: options.signal } : {}),\n });\n return {\n content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],\n structuredContent: result,\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return {\n content: [{ type: 'text', text: `Ollama tool ${name} failed: ${message}` }],\n structuredContent: { error: 'tool_failed', name, message },\n };\n }\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import { a as McpToolDescriptor } from './types-CI-gM2u5.cjs';
2
- import { O as OllamaRuntime } from './runtime-bQ48I-RC.cjs';
2
+ import { O as OllamaRuntime } from './runtime-D2W9TfCJ.cjs';
3
3
  import 'zod';
4
- import './types-5PAjLoCp.cjs';
4
+ import './types-DVcX_zMp.cjs';
5
5
 
6
6
  interface GeneratedToolEntry extends McpToolDescriptor {
7
7
  readonly _operationId: string;
@@ -1,7 +1,7 @@
1
1
  import { a as McpToolDescriptor } from './types-CI-gM2u5.js';
2
- import { O as OllamaRuntime } from './runtime-qwD72cpn.js';
2
+ import { O as OllamaRuntime } from './runtime-C3rfpkZw.js';
3
3
  import 'zod';
4
- import './types-5PAjLoCp.js';
4
+ import './types-DVcX_zMp.js';
5
5
 
6
6
  interface GeneratedToolEntry extends McpToolDescriptor {
7
7
  readonly _operationId: string;