@nemesis-oss/ollama-sdk 1.1.0 → 1.4.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 (58) hide show
  1. package/CHANGELOG.md +43 -92
  2. package/README.md +749 -11
  3. package/dist/compose-BR70yb4W.d.cts +164 -0
  4. package/dist/compose-DfAqKAFj.d.ts +164 -0
  5. package/dist/generated-api.cjs +454 -0
  6. package/dist/generated-api.cjs.map +1 -0
  7. package/dist/generated-api.d.cts +1651 -0
  8. package/dist/generated-api.d.ts +1651 -0
  9. package/dist/generated-api.js +428 -0
  10. package/dist/generated-api.js.map +1 -0
  11. package/dist/generated-models-schemas.cjs +328 -0
  12. package/dist/generated-models-schemas.cjs.map +1 -0
  13. package/dist/generated-models-schemas.d.cts +463 -0
  14. package/dist/generated-models-schemas.d.ts +463 -0
  15. package/dist/generated-models-schemas.js +291 -0
  16. package/dist/generated-models-schemas.js.map +1 -0
  17. package/dist/generated-runtime.cjs +145 -0
  18. package/dist/generated-runtime.cjs.map +1 -0
  19. package/dist/generated-runtime.d.cts +2 -0
  20. package/dist/generated-runtime.d.ts +2 -0
  21. package/dist/generated-runtime.js +143 -0
  22. package/dist/generated-runtime.js.map +1 -0
  23. package/dist/index-2RIErNT5.d.cts +583 -0
  24. package/dist/index-DIQ8NUbU.d.ts +583 -0
  25. package/dist/index.cjs +2308 -184
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.cts +1123 -421
  28. package/dist/index.d.ts +1123 -421
  29. package/dist/index.js +2293 -185
  30. package/dist/index.js.map +1 -1
  31. package/dist/mcp/tools.json +1058 -0
  32. package/dist/mcp-generated.cjs +386 -0
  33. package/dist/mcp-generated.cjs.map +1 -0
  34. package/dist/mcp-generated.d.cts +35 -0
  35. package/dist/mcp-generated.d.ts +35 -0
  36. package/dist/mcp-generated.js +381 -0
  37. package/dist/mcp-generated.js.map +1 -0
  38. package/dist/mcp-http.cjs +100 -0
  39. package/dist/mcp-http.cjs.map +1 -0
  40. package/dist/mcp-http.d.cts +48 -0
  41. package/dist/mcp-http.d.ts +48 -0
  42. package/dist/mcp-http.js +96 -0
  43. package/dist/mcp-http.js.map +1 -0
  44. package/dist/mcp-stdio.cjs +49 -0
  45. package/dist/mcp-stdio.cjs.map +1 -0
  46. package/dist/mcp-stdio.d.cts +34 -0
  47. package/dist/mcp-stdio.d.ts +34 -0
  48. package/dist/mcp-stdio.js +47 -0
  49. package/dist/mcp-stdio.js.map +1 -0
  50. package/dist/skills.cjs.map +1 -1
  51. package/dist/skills.d.cts +3 -2
  52. package/dist/skills.d.ts +3 -2
  53. package/dist/skills.js.map +1 -1
  54. package/dist/types-B9_axjum.d.cts +66 -0
  55. package/dist/types-B9_axjum.d.ts +66 -0
  56. package/dist/{compose-DJjVpDrk.d.cts → types-BQhgW-du.d.cts} +118 -172
  57. package/dist/{compose-DJjVpDrk.d.ts → types-BQhgW-du.d.ts} +118 -172
  58. package/package.json +96 -5
@@ -0,0 +1,386 @@
1
+ 'use strict';
2
+
3
+ var fs = require('fs');
4
+ var url = require('url');
5
+ var path = require('path');
6
+
7
+ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
8
+ var __defProp = Object.defineProperty;
9
+ var __getOwnPropNames = Object.getOwnPropertyNames;
10
+ var __esm = (fn, res) => function __init() {
11
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
12
+ };
13
+ var __export = (target, all) => {
14
+ for (var name in all)
15
+ __defProp(target, name, { get: all[name], enumerable: true });
16
+ };
17
+
18
+ // src/generated/api/operations.ts
19
+ var operations_exports = {};
20
+ __export(operations_exports, {
21
+ allOperations: () => allOperations,
22
+ anthropicMessagesOp: () => anthropicMessagesOp,
23
+ blobsOp: () => blobsOp,
24
+ chatOp: () => chatOp,
25
+ copyOp: () => copyOp,
26
+ createOp: () => createOp,
27
+ deleteOp: () => deleteOp,
28
+ embedOp: () => embedOp,
29
+ generateOp: () => generateOp,
30
+ openaiChatCompletionsOp: () => openaiChatCompletionsOp,
31
+ openaiCompletionsOp: () => openaiCompletionsOp,
32
+ openaiEmbeddingsOp: () => openaiEmbeddingsOp,
33
+ openaiModelsGetOneOp: () => openaiModelsGetOneOp,
34
+ openaiModelsOp: () => openaiModelsOp,
35
+ openaiResponsesOp: () => openaiResponsesOp,
36
+ psOp: () => psOp,
37
+ pullOp: () => pullOp,
38
+ pushOp: () => pushOp,
39
+ showOp: () => showOp,
40
+ systemOneOp: () => systemOneOp,
41
+ tagsOp: () => tagsOp,
42
+ versionOp: () => versionOp
43
+ });
44
+ var blobsOp, chatOp, copyOp, createOp, deleteOp, embedOp, generateOp, psOp, pullOp, pushOp, showOp, systemOneOp, tagsOp, versionOp, openaiChatCompletionsOp, openaiCompletionsOp, openaiEmbeddingsOp, openaiModelsOp, openaiModelsGetOneOp, openaiResponsesOp, anthropicMessagesOp, allOperations;
45
+ var init_operations = __esm({
46
+ "src/generated/api/operations.ts"() {
47
+ blobsOp = {
48
+ operationId: "blobs",
49
+ method: "HEAD",
50
+ path: "/api/blobs/{digest}",
51
+ environment: { local: true, cloud: false },
52
+ transport: { mode: "json", streaming: false },
53
+ capabilities: {},
54
+ status: { documented: true },
55
+ domain: "native",
56
+ notes: ["HEAD-only endpoint for blob existence checks; declared in OpenAPI but not in the legacy parity manifest."]
57
+ };
58
+ chatOp = {
59
+ operationId: "chat",
60
+ method: "POST",
61
+ path: "/api/chat",
62
+ request: { $ref: "#/schemas/ChatRequest" },
63
+ response: { $ref: "#/schemas/ChatResponse" },
64
+ environment: { local: true, cloud: true },
65
+ transport: { mode: "ndjson", streaming: true, streamingDefault: true },
66
+ capabilities: { thinking: "model-dependent", tools: "model-dependent", vision: "model-dependent", structuredOutput: "supported", logprobs: "supported" },
67
+ status: { documented: true },
68
+ domain: "native",
69
+ notes: ["Use /api/show to discover model-specific thinking values and defaults.", "Structured output (format field) is rejected by Ollama Cloud."]
70
+ };
71
+ copyOp = {
72
+ operationId: "copy",
73
+ method: "POST",
74
+ path: "/api/copy",
75
+ request: { $ref: "#/schemas/CopyRequest" },
76
+ environment: { local: true, cloud: false },
77
+ transport: { mode: "json", streaming: false },
78
+ capabilities: {},
79
+ status: { documented: true },
80
+ domain: "native"
81
+ };
82
+ createOp = {
83
+ operationId: "create",
84
+ method: "POST",
85
+ path: "/api/create",
86
+ request: { $ref: "#/schemas/CreateRequest" },
87
+ response: { $ref: "#/schemas/StatusResponse" },
88
+ environment: { local: true, cloud: false },
89
+ transport: { mode: "ndjson", streaming: true, streamingDefault: true },
90
+ capabilities: { thinking: "unsupported", tools: "unsupported" },
91
+ status: { documented: true },
92
+ domain: "native",
93
+ notes: ["Model creation is local-only; Ollama Cloud does not support it."]
94
+ };
95
+ deleteOp = {
96
+ operationId: "delete",
97
+ method: "DELETE",
98
+ path: "/api/delete",
99
+ request: { $ref: "#/schemas/DeleteRequest" },
100
+ environment: { local: true, cloud: false },
101
+ transport: { mode: "json", streaming: false },
102
+ capabilities: {},
103
+ status: { documented: true },
104
+ domain: "native"
105
+ };
106
+ embedOp = {
107
+ operationId: "embed",
108
+ method: "POST",
109
+ path: "/api/embed",
110
+ request: { $ref: "#/schemas/EmbedRequest" },
111
+ response: { $ref: "#/schemas/EmbedResponse" },
112
+ environment: { local: true, cloud: true },
113
+ transport: { mode: "json", streaming: false },
114
+ capabilities: { embeddings: "supported" },
115
+ status: { documented: true },
116
+ domain: "native"
117
+ };
118
+ generateOp = {
119
+ operationId: "generate",
120
+ method: "POST",
121
+ path: "/api/generate",
122
+ request: { $ref: "#/schemas/GenerateRequest" },
123
+ response: { $ref: "#/schemas/GenerateResponse" },
124
+ environment: { local: true, cloud: true },
125
+ transport: { mode: "ndjson", streaming: true, streamingDefault: true },
126
+ capabilities: { thinking: "model-dependent", vision: "supported", structuredOutput: "supported", logprobs: "supported" },
127
+ status: { documented: true },
128
+ domain: "native"
129
+ };
130
+ psOp = {
131
+ operationId: "ps",
132
+ method: "GET",
133
+ path: "/api/ps",
134
+ response: { $ref: "#/schemas/PsResponse" },
135
+ environment: { local: true, cloud: true },
136
+ transport: { mode: "json", streaming: false },
137
+ capabilities: {},
138
+ status: { documented: true },
139
+ domain: "native"
140
+ };
141
+ pullOp = {
142
+ operationId: "pull",
143
+ method: "POST",
144
+ path: "/api/pull",
145
+ request: { $ref: "#/schemas/PullRequest" },
146
+ response: { $ref: "#/schemas/StatusResponse" },
147
+ environment: { local: true, cloud: false },
148
+ transport: { mode: "ndjson", streaming: true, streamingDefault: true },
149
+ capabilities: {},
150
+ status: { documented: true },
151
+ domain: "native"
152
+ };
153
+ pushOp = {
154
+ operationId: "push",
155
+ method: "POST",
156
+ path: "/api/push",
157
+ request: { $ref: "#/schemas/PushRequest" },
158
+ response: { $ref: "#/schemas/StatusResponse" },
159
+ environment: { local: true, cloud: false },
160
+ transport: { mode: "ndjson", streaming: true, streamingDefault: true },
161
+ capabilities: {},
162
+ status: { documented: true },
163
+ domain: "native"
164
+ };
165
+ showOp = {
166
+ operationId: "show",
167
+ method: "POST",
168
+ path: "/api/show",
169
+ request: { $ref: "#/schemas/ShowRequest" },
170
+ response: { $ref: "#/schemas/ShowResponse" },
171
+ environment: { local: true, cloud: true },
172
+ transport: { mode: "json", streaming: false },
173
+ capabilities: {},
174
+ status: { documented: true },
175
+ domain: "native",
176
+ notes: ["Capabilities source: /api/show is the runtime source of truth for model-dependent capability values (tools, vision, thinking, embeddings)."]
177
+ };
178
+ systemOneOp = {
179
+ operationId: "systemOne",
180
+ method: "POST",
181
+ path: "/v1/systemone",
182
+ environment: { local: true, cloud: false },
183
+ transport: { mode: "json", streaming: false },
184
+ capabilities: { thinking: "unsupported", tools: "unsupported", vision: "unsupported", structuredOutput: "unsupported", logprobs: "unsupported", embeddings: "unsupported" },
185
+ constraints: { minOllamaVersion: "0.35.0", maxRequestBytes: 65536 },
186
+ status: { documented: true, experimental: true },
187
+ domain: "native",
188
+ notes: ["Local-only; Ollama Cloud rejects /v1/systemone.", "Hard 64 KiB request body limit enforced by the server.", "No images, no tools, no generation controls (temperature, top_p, etc.).", "Experimental: behavioral surface may change between Ollama releases."]
189
+ };
190
+ tagsOp = {
191
+ operationId: "tags",
192
+ method: "GET",
193
+ path: "/api/tags",
194
+ response: { $ref: "#/schemas/ListResponse" },
195
+ environment: { local: true, cloud: true },
196
+ transport: { mode: "json", streaming: false },
197
+ capabilities: {},
198
+ status: { documented: true },
199
+ domain: "native"
200
+ };
201
+ versionOp = {
202
+ operationId: "version",
203
+ method: "GET",
204
+ path: "/api/version",
205
+ response: { $ref: "#/schemas/VersionResponse" },
206
+ environment: { local: true, cloud: true },
207
+ transport: { mode: "json", streaming: false },
208
+ capabilities: {},
209
+ status: { documented: true },
210
+ domain: "native"
211
+ };
212
+ openaiChatCompletionsOp = {
213
+ operationId: "openaiChatCompletions",
214
+ method: "POST",
215
+ path: "/v1/chat/completions",
216
+ environment: { local: true, cloud: true },
217
+ transport: { mode: "sse", streaming: true, streamingDefault: false },
218
+ capabilities: { thinking: "model-dependent", tools: "model-dependent", vision: "model-dependent", structuredOutput: "supported", logprobs: "supported" },
219
+ status: { documented: true },
220
+ domain: "openai",
221
+ notes: ["Ollama exposes a subset of the OpenAI Chat Completions request fields; see docs/upstream/ollama-openai-compatibility.mdx."]
222
+ };
223
+ openaiCompletionsOp = {
224
+ operationId: "openaiCompletions",
225
+ method: "POST",
226
+ path: "/v1/completions",
227
+ environment: { local: true, cloud: true },
228
+ transport: { mode: "sse", streaming: true, streamingDefault: false },
229
+ capabilities: { logprobs: "supported" },
230
+ status: { documented: true },
231
+ domain: "openai"
232
+ };
233
+ openaiEmbeddingsOp = {
234
+ operationId: "openaiEmbeddings",
235
+ method: "POST",
236
+ path: "/v1/embeddings",
237
+ environment: { local: true, cloud: true },
238
+ transport: { mode: "json", streaming: false },
239
+ capabilities: { embeddings: "supported" },
240
+ status: { documented: true },
241
+ domain: "openai"
242
+ };
243
+ openaiModelsOp = {
244
+ operationId: "openaiModels",
245
+ method: "GET",
246
+ path: "/v1/models",
247
+ environment: { local: true, cloud: true },
248
+ transport: { mode: "json", streaming: false },
249
+ capabilities: {},
250
+ status: { documented: true },
251
+ domain: "openai"
252
+ };
253
+ openaiModelsGetOneOp = {
254
+ operationId: "openaiModelsGetOne",
255
+ method: "GET",
256
+ path: "/v1/models/{model}",
257
+ environment: { local: true, cloud: true },
258
+ transport: { mode: "json", streaming: false },
259
+ capabilities: {},
260
+ status: { documented: true },
261
+ domain: "openai",
262
+ notes: ["Returns metadata for a single OpenAI-compat model by id."]
263
+ };
264
+ openaiResponsesOp = {
265
+ operationId: "openaiResponses",
266
+ method: "POST",
267
+ path: "/v1/responses",
268
+ environment: { local: true, cloud: true },
269
+ transport: { mode: "sse", streaming: true, streamingDefault: false },
270
+ capabilities: { thinking: "model-dependent", tools: "model-dependent" },
271
+ status: { documented: true },
272
+ domain: "openai",
273
+ notes: ["Ollama implements a subset of the OpenAI Responses API; previous_response_id and conversation are explicitly unsupported."]
274
+ };
275
+ anthropicMessagesOp = {
276
+ operationId: "anthropicMessages",
277
+ method: "POST",
278
+ path: "/v1/messages",
279
+ environment: { local: true, cloud: true },
280
+ transport: { mode: "sse", streaming: true, streamingDefault: false },
281
+ capabilities: { thinking: "model-dependent", tools: "model-dependent" },
282
+ status: { documented: true },
283
+ domain: "anthropic",
284
+ notes: ["tool_choice and metadata are explicitly unsupported by Ollama's Anthropic compat layer.", "Nested cache_control fields under messages[].content[].cache_control are unsupported."]
285
+ };
286
+ allOperations = [
287
+ blobsOp,
288
+ chatOp,
289
+ copyOp,
290
+ createOp,
291
+ deleteOp,
292
+ embedOp,
293
+ generateOp,
294
+ psOp,
295
+ pullOp,
296
+ pushOp,
297
+ showOp,
298
+ systemOneOp,
299
+ tagsOp,
300
+ versionOp,
301
+ openaiChatCompletionsOp,
302
+ openaiCompletionsOp,
303
+ openaiEmbeddingsOp,
304
+ openaiModelsOp,
305
+ openaiModelsGetOneOp,
306
+ openaiResponsesOp,
307
+ anthropicMessagesOp
308
+ ];
309
+ }
310
+ });
311
+ var HERE = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('mcp-generated.cjs', document.baseURI).href))));
312
+ var TOOLS_JSON_PATH = (() => {
313
+ const candidates = [
314
+ path.resolve(HERE, "../generated/mcp/tools.json"),
315
+ // source layout
316
+ path.resolve(HERE, "mcp/tools.json"),
317
+ // dist layout (next to mcp-generated.js)
318
+ path.resolve(HERE, "../mcp/tools.json")
319
+ // alt dist layout (sibling of bundled dir)
320
+ ];
321
+ for (const candidate of candidates) {
322
+ try {
323
+ fs.readFileSync(candidate, "utf8");
324
+ return candidate;
325
+ } catch {
326
+ }
327
+ }
328
+ return candidates[0] ?? path.resolve(HERE, "../generated/mcp/tools.json");
329
+ })();
330
+ var cachedTools;
331
+ function loadGeneratedOllamaTools() {
332
+ if (cachedTools) return cachedTools;
333
+ const raw = fs.readFileSync(TOOLS_JSON_PATH, "utf8");
334
+ const parsed = JSON.parse(raw);
335
+ cachedTools = parsed.tools;
336
+ return cachedTools;
337
+ }
338
+ function publicDescriptor(entry) {
339
+ const { _operationId, ...rest } = entry;
340
+ return rest;
341
+ }
342
+ function listGeneratedOllamaTools() {
343
+ return loadGeneratedOllamaTools().map(publicDescriptor);
344
+ }
345
+ async function callGeneratedOllamaTool(runtime, name, args, options) {
346
+ const tools = loadGeneratedOllamaTools();
347
+ const entry = tools.find((t) => t.name === name);
348
+ if (!entry) {
349
+ return {
350
+ content: [{ type: "text", text: `Unknown tool: ${name}` }],
351
+ structuredContent: { error: "unknown_tool", name }
352
+ };
353
+ }
354
+ const operations = await Promise.resolve().then(() => (init_operations(), operations_exports));
355
+ const opKey = `${entry._operationId}Op`;
356
+ const operation = operations[opKey];
357
+ if (!operation || typeof operation !== "object" || !("operationId" in operation)) {
358
+ return {
359
+ content: [{ type: "text", text: `Operation not found for ${name}` }],
360
+ structuredContent: { error: "operation_not_found", name }
361
+ };
362
+ }
363
+ try {
364
+ const result = await runtime.invoke({
365
+ operation,
366
+ body: args,
367
+ ...options?.signal !== void 0 ? { signal: options.signal } : {}
368
+ });
369
+ return {
370
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
371
+ structuredContent: result
372
+ };
373
+ } catch (error) {
374
+ const message = error instanceof Error ? error.message : String(error);
375
+ return {
376
+ content: [{ type: "text", text: `Ollama tool ${name} failed: ${message}` }],
377
+ structuredContent: { error: "tool_failed", name, message }
378
+ };
379
+ }
380
+ }
381
+
382
+ exports.callGeneratedOllamaTool = callGeneratedOllamaTool;
383
+ exports.listGeneratedOllamaTools = listGeneratedOllamaTools;
384
+ exports.loadGeneratedOllamaTools = loadGeneratedOllamaTools;
385
+ //# sourceMappingURL=mcp-generated.cjs.map
386
+ //# sourceMappingURL=mcp-generated.cjs.map
@@ -0,0 +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;A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BAAA,EAAmB,EAAE,KAAA,EAAO,qBAAA,EAAuB,IAAA;AAAK,KAC1D;AAAA,EACF;AAEA,EAAA,IAAI;AACF,IAAA,MAAM,MAAA,GAAS,MAAM,OAAA,CAAQ,MAAA,CAAgB;AAAA,MAC3C,SAAA;AAAA,MACA,IAAA,EAAM,IAAA;AAAA,MACN,GAAI,SAAS,MAAA,KAAW,KAAA,CAAA,GAAY,EAAE,MAAA,EAAQ,OAAA,CAAQ,MAAA,EAAO,GAAI;AAAC,KACnE,CAAA;AACD,IAAA,OAAO;AAAA,MACL,OAAA,EAAS,CAAC,EAAE,IAAA,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: ['HEAD-only endpoint for blob existence checks; declared in OpenAPI but not in the legacy parity manifest.'],\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: { thinking: 'model-dependent', tools: 'model-dependent', vision: 'model-dependent', structuredOutput: 'supported', logprobs: 'supported' },\n status: { documented: true},\n domain: 'native',\n notes: ['Use /api/show to discover model-specific thinking values and defaults.', 'Structured output (format field) is rejected by Ollama Cloud.'],\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: { thinking: 'model-dependent', vision: 'supported', structuredOutput: 'supported', logprobs: 'supported' },\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: ['Capabilities source: /api/show is the runtime source of truth for model-dependent capability values (tools, vision, thinking, embeddings).'],\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: { thinking: 'unsupported', tools: 'unsupported', vision: 'unsupported', structuredOutput: 'unsupported', logprobs: 'unsupported', embeddings: 'unsupported' },\n constraints: { minOllamaVersion: '0.35.0', maxRequestBytes: 65536 },\n status: { documented: true, experimental: true},\n domain: 'native',\n notes: ['Local-only; Ollama Cloud rejects /v1/systemone.', 'Hard 64 KiB request body limit enforced by the server.', 'No images, no tools, no generation controls (temperature, top_p, etc.).', 'Experimental: behavioral surface may change between Ollama releases.'],\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: { thinking: 'model-dependent', tools: 'model-dependent', vision: 'model-dependent', structuredOutput: 'supported', logprobs: 'supported' },\n status: { documented: true},\n domain: 'openai',\n notes: ['Ollama exposes a subset of the OpenAI Chat Completions request fields; see docs/upstream/ollama-openai-compatibility.mdx.'],\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: ['Ollama implements a subset of the OpenAI Responses API; previous_response_id and conversation are explicitly unsupported.'],\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: ['tool_choice and metadata are explicitly unsupported by Ollama\\'s Anthropic compat layer.', 'Nested cache_control fields under messages[].content[].cache_control are unsupported.'],\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"]}
@@ -0,0 +1,35 @@
1
+ import { M as McpToolDescriptor } from './types-B9_axjum.cjs';
2
+ import { O as OllamaRuntime } from './index-2RIErNT5.cjs';
3
+ import './types-BQhgW-du.cjs';
4
+
5
+ interface GeneratedToolEntry extends McpToolDescriptor {
6
+ readonly _operationId: string;
7
+ }
8
+ /** Load and cache the generated tool descriptors from tools.json. */
9
+ declare function loadGeneratedOllamaTools(): readonly GeneratedToolEntry[];
10
+ /**
11
+ * Build a list of MCP tool descriptors for the generated Ollama operations.
12
+ * Each tool can be invoked by name via {@link callGeneratedOllamaTool}.
13
+ *
14
+ * The descriptors are read once and cached for the lifetime of the process.
15
+ */
16
+ declare function listGeneratedOllamaTools(): readonly McpToolDescriptor[];
17
+ /**
18
+ * Invoke a generated tool by name. The `name` must match a tool from
19
+ * {@link listGeneratedOllamaTools}.
20
+ *
21
+ * Returns a `McpCallToolResult` containing the structured response. The
22
+ * caller (typically `McpBridge`) is responsible for serializing the result
23
+ * back over the MCP transport.
24
+ */
25
+ declare function callGeneratedOllamaTool(runtime: OllamaRuntime, name: string, args: Record<string, unknown>, options?: {
26
+ signal?: AbortSignal;
27
+ }): Promise<{
28
+ content: readonly {
29
+ type: 'text';
30
+ text: string;
31
+ }[];
32
+ structuredContent: unknown;
33
+ }>;
34
+
35
+ export { callGeneratedOllamaTool, listGeneratedOllamaTools, loadGeneratedOllamaTools };
@@ -0,0 +1,35 @@
1
+ import { M as McpToolDescriptor } from './types-B9_axjum.js';
2
+ import { O as OllamaRuntime } from './index-DIQ8NUbU.js';
3
+ import './types-BQhgW-du.js';
4
+
5
+ interface GeneratedToolEntry extends McpToolDescriptor {
6
+ readonly _operationId: string;
7
+ }
8
+ /** Load and cache the generated tool descriptors from tools.json. */
9
+ declare function loadGeneratedOllamaTools(): readonly GeneratedToolEntry[];
10
+ /**
11
+ * Build a list of MCP tool descriptors for the generated Ollama operations.
12
+ * Each tool can be invoked by name via {@link callGeneratedOllamaTool}.
13
+ *
14
+ * The descriptors are read once and cached for the lifetime of the process.
15
+ */
16
+ declare function listGeneratedOllamaTools(): readonly McpToolDescriptor[];
17
+ /**
18
+ * Invoke a generated tool by name. The `name` must match a tool from
19
+ * {@link listGeneratedOllamaTools}.
20
+ *
21
+ * Returns a `McpCallToolResult` containing the structured response. The
22
+ * caller (typically `McpBridge`) is responsible for serializing the result
23
+ * back over the MCP transport.
24
+ */
25
+ declare function callGeneratedOllamaTool(runtime: OllamaRuntime, name: string, args: Record<string, unknown>, options?: {
26
+ signal?: AbortSignal;
27
+ }): Promise<{
28
+ content: readonly {
29
+ type: 'text';
30
+ text: string;
31
+ }[];
32
+ structuredContent: unknown;
33
+ }>;
34
+
35
+ export { callGeneratedOllamaTool, listGeneratedOllamaTools, loadGeneratedOllamaTools };