@nemesis-oss/ollama-sdk 1.3.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +43 -212
- package/README.md +391 -18
- package/dist/compose-BR70yb4W.d.cts +164 -0
- package/dist/compose-DfAqKAFj.d.ts +164 -0
- package/dist/generated-api.cjs +497 -0
- package/dist/generated-api.cjs.map +1 -0
- package/dist/generated-api.d.cts +1651 -0
- package/dist/generated-api.d.ts +1651 -0
- package/dist/generated-api.js +471 -0
- package/dist/generated-api.js.map +1 -0
- package/dist/generated-models-schemas.cjs +328 -0
- package/dist/generated-models-schemas.cjs.map +1 -0
- package/dist/generated-models-schemas.d.cts +463 -0
- package/dist/generated-models-schemas.d.ts +463 -0
- package/dist/generated-models-schemas.js +291 -0
- package/dist/generated-models-schemas.js.map +1 -0
- package/dist/generated-runtime.cjs +205 -0
- package/dist/generated-runtime.cjs.map +1 -0
- package/dist/generated-runtime.d.cts +2 -0
- package/dist/generated-runtime.d.ts +2 -0
- package/dist/generated-runtime.js +203 -0
- package/dist/generated-runtime.js.map +1 -0
- package/dist/index-2RIErNT5.d.cts +583 -0
- package/dist/index-DIQ8NUbU.d.ts +583 -0
- package/dist/index.cjs +2041 -208
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +817 -453
- package/dist/index.d.ts +817 -453
- package/dist/index.js +2032 -209
- package/dist/index.js.map +1 -1
- package/dist/mcp/tools.json +1007 -0
- package/dist/mcp-generated.cjs +429 -0
- package/dist/mcp-generated.cjs.map +1 -0
- package/dist/mcp-generated.d.cts +35 -0
- package/dist/mcp-generated.d.ts +35 -0
- package/dist/mcp-generated.js +424 -0
- package/dist/mcp-generated.js.map +1 -0
- package/dist/mcp-http.cjs +100 -0
- package/dist/mcp-http.cjs.map +1 -0
- package/dist/mcp-http.d.cts +48 -0
- package/dist/mcp-http.d.ts +48 -0
- package/dist/mcp-http.js +96 -0
- package/dist/mcp-http.js.map +1 -0
- package/dist/mcp-stdio.cjs +49 -0
- package/dist/mcp-stdio.cjs.map +1 -0
- package/dist/mcp-stdio.d.cts +34 -0
- package/dist/mcp-stdio.d.ts +34 -0
- package/dist/mcp-stdio.js +47 -0
- package/dist/mcp-stdio.js.map +1 -0
- package/dist/skills.cjs.map +1 -1
- package/dist/skills.d.cts +3 -2
- package/dist/skills.d.ts +3 -2
- package/dist/skills.js.map +1 -1
- package/dist/types-B9_axjum.d.cts +66 -0
- package/dist/types-B9_axjum.d.ts +66 -0
- package/dist/{compose-CDWq8oxJ.d.cts → types-BQhgW-du.d.cts} +68 -171
- package/dist/{compose-CDWq8oxJ.d.ts → types-BQhgW-du.d.ts} +68 -171
- package/package.json +96 -5
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
// src/generated/models/ChatMessage.schema.ts
|
|
4
|
+
var ToolCallSchema = z.object({
|
|
5
|
+
function: z.object({
|
|
6
|
+
name: z.string(),
|
|
7
|
+
description: z.string().optional(),
|
|
8
|
+
arguments: z.object({}).optional()
|
|
9
|
+
}).optional()
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
// src/generated/models/ChatMessage.schema.ts
|
|
13
|
+
var ChatMessageSchema = z.object({
|
|
14
|
+
role: z.enum(["system", "user", "assistant", "tool"]),
|
|
15
|
+
content: z.string(),
|
|
16
|
+
images: z.array(z.string()).optional(),
|
|
17
|
+
tool_calls: z.array(ToolCallSchema).optional()
|
|
18
|
+
});
|
|
19
|
+
var ModelOptionsSchema = z.object({
|
|
20
|
+
seed: z.number().optional(),
|
|
21
|
+
temperature: z.number().optional(),
|
|
22
|
+
top_k: z.number().optional(),
|
|
23
|
+
top_p: z.number().optional(),
|
|
24
|
+
min_p: z.number().optional(),
|
|
25
|
+
stop: z.union([z.string(), z.array(z.string())]).optional(),
|
|
26
|
+
num_ctx: z.number().optional(),
|
|
27
|
+
num_predict: z.number().optional()
|
|
28
|
+
}).catchall(z.unknown());
|
|
29
|
+
var ThinkValueSchema = z.union([z.boolean(), z.string(), z.null()]);
|
|
30
|
+
var ToolDefinitionSchema = z.object({
|
|
31
|
+
type: z.enum(["function"]),
|
|
32
|
+
function: z.object({
|
|
33
|
+
name: z.string(),
|
|
34
|
+
description: z.string().optional(),
|
|
35
|
+
parameters: z.object({})
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// src/generated/models/ChatRequest.schema.ts
|
|
40
|
+
var ChatRequestSchema = z.object({
|
|
41
|
+
model: z.string(),
|
|
42
|
+
messages: z.array(ChatMessageSchema),
|
|
43
|
+
tools: z.array(ToolDefinitionSchema).optional(),
|
|
44
|
+
format: z.union([z.enum(["json"]), z.object({})]).optional(),
|
|
45
|
+
options: ModelOptionsSchema.optional(),
|
|
46
|
+
stream: z.boolean().optional(),
|
|
47
|
+
think: ThinkValueSchema.optional(),
|
|
48
|
+
keep_alive: z.union([z.string(), z.number()]).optional(),
|
|
49
|
+
logprobs: z.boolean().optional(),
|
|
50
|
+
top_logprobs: z.number().optional()
|
|
51
|
+
});
|
|
52
|
+
var TokenLogprobSchema = z.object({
|
|
53
|
+
token: z.string().optional(),
|
|
54
|
+
logprob: z.number().optional(),
|
|
55
|
+
bytes: z.array(z.number()).optional()
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// src/generated/models/Logprob.schema.ts
|
|
59
|
+
var LogprobSchema = z.object({
|
|
60
|
+
token: z.string().optional(),
|
|
61
|
+
logprob: z.number().optional(),
|
|
62
|
+
bytes: z.array(z.number()).optional(),
|
|
63
|
+
top_logprobs: z.array(TokenLogprobSchema).optional()
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// src/generated/models/ChatResponse.schema.ts
|
|
67
|
+
var ChatResponseSchema = z.object({
|
|
68
|
+
model: z.string().optional(),
|
|
69
|
+
created_at: z.string().optional(),
|
|
70
|
+
message: z.object({
|
|
71
|
+
role: z.enum(["assistant"]).optional(),
|
|
72
|
+
content: z.string().optional(),
|
|
73
|
+
thinking: z.string().optional(),
|
|
74
|
+
tool_calls: z.array(ToolCallSchema).optional(),
|
|
75
|
+
images: z.array(z.string()).optional()
|
|
76
|
+
}).optional(),
|
|
77
|
+
done: z.boolean().optional(),
|
|
78
|
+
done_reason: z.string().optional(),
|
|
79
|
+
total_duration: z.number().optional(),
|
|
80
|
+
load_duration: z.number().optional(),
|
|
81
|
+
prompt_eval_count: z.number().optional(),
|
|
82
|
+
prompt_eval_cached_count: z.number().optional(),
|
|
83
|
+
prompt_eval_duration: z.number().optional(),
|
|
84
|
+
eval_count: z.number().optional(),
|
|
85
|
+
eval_duration: z.number().optional(),
|
|
86
|
+
logprobs: z.array(LogprobSchema).optional()
|
|
87
|
+
});
|
|
88
|
+
var ChatStreamEventSchema = z.object({
|
|
89
|
+
model: z.string().optional(),
|
|
90
|
+
created_at: z.string().optional(),
|
|
91
|
+
message: z.object({
|
|
92
|
+
role: z.string().optional(),
|
|
93
|
+
content: z.string().optional(),
|
|
94
|
+
thinking: z.string().optional(),
|
|
95
|
+
tool_calls: z.array(ToolCallSchema).optional(),
|
|
96
|
+
images: z.array(z.string()).optional()
|
|
97
|
+
}).optional(),
|
|
98
|
+
done: z.boolean().optional()
|
|
99
|
+
});
|
|
100
|
+
var CopyRequestSchema = z.object({
|
|
101
|
+
source: z.string(),
|
|
102
|
+
destination: z.string()
|
|
103
|
+
});
|
|
104
|
+
var CreateRequestSchema = z.object({
|
|
105
|
+
model: z.string(),
|
|
106
|
+
from: z.string().optional(),
|
|
107
|
+
template: z.string().optional(),
|
|
108
|
+
renderer: z.string().optional(),
|
|
109
|
+
parser: z.string().optional(),
|
|
110
|
+
files: z.object({}).catchall(z.string()).optional(),
|
|
111
|
+
draft_files: z.object({}).catchall(z.string()).optional(),
|
|
112
|
+
license: z.union([z.string(), z.array(z.string())]).optional(),
|
|
113
|
+
system: z.string().optional(),
|
|
114
|
+
parameters: z.object({}).optional(),
|
|
115
|
+
messages: z.array(ChatMessageSchema).optional(),
|
|
116
|
+
quantize: z.string().optional(),
|
|
117
|
+
draft_quantize: z.string().optional(),
|
|
118
|
+
requires: z.string().optional(),
|
|
119
|
+
stream: z.boolean().optional()
|
|
120
|
+
});
|
|
121
|
+
var DeleteRequestSchema = z.object({
|
|
122
|
+
model: z.string()
|
|
123
|
+
});
|
|
124
|
+
var EmbedRequestSchema = z.object({
|
|
125
|
+
model: z.string(),
|
|
126
|
+
input: z.union([z.string(), z.array(z.string())]),
|
|
127
|
+
truncate: z.boolean().optional(),
|
|
128
|
+
dimensions: z.number().optional(),
|
|
129
|
+
keep_alive: z.string().optional(),
|
|
130
|
+
options: ModelOptionsSchema.optional()
|
|
131
|
+
});
|
|
132
|
+
var EmbedResponseSchema = z.object({
|
|
133
|
+
model: z.string().optional(),
|
|
134
|
+
embeddings: z.array(z.array(z.number())).optional(),
|
|
135
|
+
total_duration: z.number().optional(),
|
|
136
|
+
load_duration: z.number().optional(),
|
|
137
|
+
prompt_eval_count: z.number().optional()
|
|
138
|
+
});
|
|
139
|
+
var ErrorResponseSchema = z.object({
|
|
140
|
+
error: z.string().optional()
|
|
141
|
+
});
|
|
142
|
+
var GenerateRequestSchema = z.object({
|
|
143
|
+
model: z.string(),
|
|
144
|
+
prompt: z.string().optional(),
|
|
145
|
+
suffix: z.string().optional(),
|
|
146
|
+
images: z.array(z.string()).optional(),
|
|
147
|
+
format: z.union([z.string(), z.object({})]).optional(),
|
|
148
|
+
system: z.string().optional(),
|
|
149
|
+
stream: z.boolean().optional(),
|
|
150
|
+
think: ThinkValueSchema.optional(),
|
|
151
|
+
raw: z.boolean().optional(),
|
|
152
|
+
keep_alive: z.union([z.string(), z.number()]).optional(),
|
|
153
|
+
options: ModelOptionsSchema.optional(),
|
|
154
|
+
logprobs: z.boolean().optional(),
|
|
155
|
+
top_logprobs: z.number().optional()
|
|
156
|
+
});
|
|
157
|
+
var GenerateResponseSchema = z.object({
|
|
158
|
+
model: z.string().optional(),
|
|
159
|
+
created_at: z.string().optional(),
|
|
160
|
+
response: z.string().optional(),
|
|
161
|
+
thinking: z.string().optional(),
|
|
162
|
+
done: z.boolean().optional(),
|
|
163
|
+
done_reason: z.string().optional(),
|
|
164
|
+
total_duration: z.number().optional(),
|
|
165
|
+
load_duration: z.number().optional(),
|
|
166
|
+
prompt_eval_count: z.number().optional(),
|
|
167
|
+
prompt_eval_cached_count: z.number().optional(),
|
|
168
|
+
prompt_eval_duration: z.number().optional(),
|
|
169
|
+
eval_count: z.number().optional(),
|
|
170
|
+
eval_duration: z.number().optional(),
|
|
171
|
+
logprobs: z.array(LogprobSchema).optional()
|
|
172
|
+
});
|
|
173
|
+
var GenerateStreamEventSchema = z.object({
|
|
174
|
+
model: z.string().optional(),
|
|
175
|
+
created_at: z.string().optional(),
|
|
176
|
+
response: z.string().optional(),
|
|
177
|
+
thinking: z.string().optional(),
|
|
178
|
+
done: z.boolean().optional(),
|
|
179
|
+
done_reason: z.string().optional(),
|
|
180
|
+
total_duration: z.number().optional(),
|
|
181
|
+
load_duration: z.number().optional(),
|
|
182
|
+
prompt_eval_count: z.number().optional(),
|
|
183
|
+
prompt_eval_cached_count: z.number().optional(),
|
|
184
|
+
prompt_eval_duration: z.number().optional(),
|
|
185
|
+
eval_count: z.number().optional(),
|
|
186
|
+
eval_duration: z.number().optional()
|
|
187
|
+
});
|
|
188
|
+
var ModelSummarySchema = z.object({
|
|
189
|
+
name: z.string().optional(),
|
|
190
|
+
model: z.string().optional(),
|
|
191
|
+
remote_model: z.string().optional(),
|
|
192
|
+
remote_host: z.string().optional(),
|
|
193
|
+
modified_at: z.string().optional(),
|
|
194
|
+
size: z.number().optional(),
|
|
195
|
+
digest: z.string().optional(),
|
|
196
|
+
details: z.object({
|
|
197
|
+
format: z.string().optional(),
|
|
198
|
+
family: z.string().optional(),
|
|
199
|
+
families: z.array(z.string()).optional(),
|
|
200
|
+
parameter_size: z.string().optional(),
|
|
201
|
+
quantization_level: z.string().optional()
|
|
202
|
+
}).optional()
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
// src/generated/models/ListResponse.schema.ts
|
|
206
|
+
var ListResponseSchema = z.object({
|
|
207
|
+
models: z.array(ModelSummarySchema).optional()
|
|
208
|
+
});
|
|
209
|
+
var PsSchema = z.object({
|
|
210
|
+
name: z.string().optional(),
|
|
211
|
+
model: z.string().optional(),
|
|
212
|
+
size: z.number().optional(),
|
|
213
|
+
digest: z.string().optional(),
|
|
214
|
+
details: z.object({}).optional(),
|
|
215
|
+
expires_at: z.string().optional(),
|
|
216
|
+
size_vram: z.number().optional(),
|
|
217
|
+
context_length: z.number().optional()
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
// src/generated/models/PsResponse.schema.ts
|
|
221
|
+
var PsResponseSchema = z.object({
|
|
222
|
+
models: z.array(PsSchema).optional()
|
|
223
|
+
});
|
|
224
|
+
var PullRequestSchema = z.object({
|
|
225
|
+
model: z.string(),
|
|
226
|
+
insecure: z.boolean().optional(),
|
|
227
|
+
stream: z.boolean().optional()
|
|
228
|
+
});
|
|
229
|
+
var PushRequestSchema = z.object({
|
|
230
|
+
model: z.string(),
|
|
231
|
+
insecure: z.boolean().optional(),
|
|
232
|
+
stream: z.boolean().optional()
|
|
233
|
+
});
|
|
234
|
+
var ShowRequestSchema = z.object({
|
|
235
|
+
model: z.string(),
|
|
236
|
+
verbose: z.boolean().optional()
|
|
237
|
+
});
|
|
238
|
+
var ThinkingSchema = z.object({
|
|
239
|
+
values: z.array(z.union([z.boolean(), z.string()])),
|
|
240
|
+
default: z.union([z.boolean(), z.string()])
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
// src/generated/models/ShowResponse.schema.ts
|
|
244
|
+
var ShowResponseSchema = z.object({
|
|
245
|
+
thinking: ThinkingSchema.optional(),
|
|
246
|
+
parameters: z.string().optional(),
|
|
247
|
+
license: z.string().optional(),
|
|
248
|
+
modified_at: z.string().optional(),
|
|
249
|
+
details: z.object({}).optional(),
|
|
250
|
+
template: z.string().optional(),
|
|
251
|
+
capabilities: z.array(z.string()).optional(),
|
|
252
|
+
model_info: z.object({}).optional()
|
|
253
|
+
});
|
|
254
|
+
var StatusEventSchema = z.object({
|
|
255
|
+
status: z.string().optional(),
|
|
256
|
+
digest: z.string().optional(),
|
|
257
|
+
total: z.number().optional(),
|
|
258
|
+
completed: z.number().optional()
|
|
259
|
+
});
|
|
260
|
+
var StatusResponseSchema = z.object({
|
|
261
|
+
status: z.string().optional()
|
|
262
|
+
});
|
|
263
|
+
var VersionResponseSchema = z.object({
|
|
264
|
+
version: z.string().optional()
|
|
265
|
+
});
|
|
266
|
+
var WebFetchRequestSchema = z.object({
|
|
267
|
+
url: z.string()
|
|
268
|
+
});
|
|
269
|
+
var WebFetchResponseSchema = z.object({
|
|
270
|
+
title: z.string().optional(),
|
|
271
|
+
content: z.string().optional(),
|
|
272
|
+
links: z.array(z.string()).optional()
|
|
273
|
+
});
|
|
274
|
+
var WebSearchRequestSchema = z.object({
|
|
275
|
+
query: z.string(),
|
|
276
|
+
max_results: z.number().optional()
|
|
277
|
+
});
|
|
278
|
+
var WebSearchResultSchema = z.object({
|
|
279
|
+
title: z.string().optional(),
|
|
280
|
+
url: z.string().optional(),
|
|
281
|
+
content: z.string().optional()
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
// src/generated/models/WebSearchResponse.schema.ts
|
|
285
|
+
var WebSearchResponseSchema = z.object({
|
|
286
|
+
results: z.array(WebSearchResultSchema).optional()
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
export { ChatMessageSchema, ChatRequestSchema, ChatResponseSchema, ChatStreamEventSchema, CopyRequestSchema, CreateRequestSchema, DeleteRequestSchema, EmbedRequestSchema, EmbedResponseSchema, ErrorResponseSchema, GenerateRequestSchema, GenerateResponseSchema, GenerateStreamEventSchema, ListResponseSchema, LogprobSchema, ModelOptionsSchema, ModelSummarySchema, PsResponseSchema, PsSchema, PullRequestSchema, PushRequestSchema, ShowRequestSchema, ShowResponseSchema, StatusEventSchema, StatusResponseSchema, ThinkValueSchema, ThinkingSchema, TokenLogprobSchema, ToolCallSchema, ToolDefinitionSchema, VersionResponseSchema, WebFetchRequestSchema, WebFetchResponseSchema, WebSearchRequestSchema, WebSearchResponseSchema, WebSearchResultSchema };
|
|
290
|
+
//# sourceMappingURL=generated-models-schemas.js.map
|
|
291
|
+
//# sourceMappingURL=generated-models-schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/generated/models/ToolCall.schema.ts","../src/generated/models/ChatMessage.schema.ts","../src/generated/models/ModelOptions.schema.ts","../src/generated/models/ThinkValue.schema.ts","../src/generated/models/ToolDefinition.schema.ts","../src/generated/models/ChatRequest.schema.ts","../src/generated/models/TokenLogprob.schema.ts","../src/generated/models/Logprob.schema.ts","../src/generated/models/ChatResponse.schema.ts","../src/generated/models/ChatStreamEvent.schema.ts","../src/generated/models/CopyRequest.schema.ts","../src/generated/models/CreateRequest.schema.ts","../src/generated/models/DeleteRequest.schema.ts","../src/generated/models/EmbedRequest.schema.ts","../src/generated/models/EmbedResponse.schema.ts","../src/generated/models/ErrorResponse.schema.ts","../src/generated/models/GenerateRequest.schema.ts","../src/generated/models/GenerateResponse.schema.ts","../src/generated/models/GenerateStreamEvent.schema.ts","../src/generated/models/ModelSummary.schema.ts","../src/generated/models/ListResponse.schema.ts","../src/generated/models/Ps.schema.ts","../src/generated/models/PsResponse.schema.ts","../src/generated/models/PullRequest.schema.ts","../src/generated/models/PushRequest.schema.ts","../src/generated/models/ShowRequest.schema.ts","../src/generated/models/Thinking.schema.ts","../src/generated/models/ShowResponse.schema.ts","../src/generated/models/StatusEvent.schema.ts","../src/generated/models/StatusResponse.schema.ts","../src/generated/models/VersionResponse.schema.ts","../src/generated/models/WebFetchRequest.schema.ts","../src/generated/models/WebFetchResponse.schema.ts","../src/generated/models/WebSearchRequest.schema.ts","../src/generated/models/WebSearchResult.schema.ts","../src/generated/models/WebSearchResponse.schema.ts"],"names":["z"],"mapp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OT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\n\nexport const ToolCallSchema = z.object({\n function: z\n .object({\n name: z.string(),\n description: z.string().optional(),\n arguments: z.object({}).optional(),\n })\n .optional(),\n});\n","// AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\nimport { ToolCallSchema } from './ToolCall.schema.js';\n\nexport const ChatMessageSchema = z.object({\n role: z.enum(['system', 'user', 'assistant', 'tool']),\n content: z.string(),\n images: z.array(z.string()).optional(),\n tool_calls: z.array(ToolCallSchema).optional(),\n});\n","// AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\n\n/** Runtime options that control text generation */\nexport const ModelOptionsSchema = z\n .object({\n seed: z.number().optional(),\n temperature: z.number().optional(),\n top_k: z.number().optional(),\n top_p: z.number().optional(),\n min_p: z.number().optional(),\n stop: z.union([z.string(), z.array(z.string())]).optional(),\n num_ctx: z.number().optional(),\n num_predict: z.number().optional(),\n })\n .catchall(z.unknown());\n","// AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\n\n/** Controls a model's thinking output. Use `/api/show` to discover the supported values and default for the selected model. `true` requests thinking, `false` requests no thinking output, and `null` uses the model default. String values are model-defined; supported names must match `/api/show` exactly. Numbers are not supported. */\nexport const ThinkValueSchema = z.union([z.boolean(), z.string(), z.null()]);\n","// AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\n\nexport const ToolDefinitionSchema = z.object({\n type: z.enum(['function']),\n function: z.object({\n name: z.string(),\n description: z.string().optional(),\n parameters: z.object({}),\n }),\n});\n","// AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\nimport { ChatMessageSchema } from './ChatMessage.schema.js';\nimport { ModelOptionsSchema } from './ModelOptions.schema.js';\nimport { ThinkValueSchema } from './ThinkValue.schema.js';\nimport { ToolDefinitionSchema } from './ToolDefinition.schema.js';\n\nexport const ChatRequestSchema = z.object({\n model: z.string(),\n messages: z.array(ChatMessageSchema),\n tools: z.array(ToolDefinitionSchema).optional(),\n format: z.union([z.enum(['json']), z.object({})]).optional(),\n options: ModelOptionsSchema.optional(),\n stream: z.boolean().optional(),\n think: ThinkValueSchema.optional(),\n keep_alive: z.union([z.string(), z.number()]).optional(),\n logprobs: z.boolean().optional(),\n top_logprobs: z.number().optional(),\n});\n","// AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\n\n/** Log probability information for a single token alternative */\nexport const TokenLogprobSchema = z.object({\n token: z.string().optional(),\n logprob: z.number().optional(),\n bytes: z.array(z.number()).optional(),\n});\n","// AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\nimport { TokenLogprobSchema } from './TokenLogprob.schema.js';\n\n/** Log probability information for a generated token */\nexport const LogprobSchema = z.object({\n token: z.string().optional(),\n logprob: z.number().optional(),\n bytes: z.array(z.number()).optional(),\n top_logprobs: z.array(TokenLogprobSchema).optional(),\n});\n","// AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\nimport { LogprobSchema } from './Logprob.schema.js';\nimport { ToolCallSchema } from './ToolCall.schema.js';\n\nexport const ChatResponseSchema = z.object({\n model: z.string().optional(),\n created_at: z.string().optional(),\n message: z\n .object({\n role: z.enum(['assistant']).optional(),\n content: z.string().optional(),\n thinking: z.string().optional(),\n tool_calls: z.array(ToolCallSchema).optional(),\n images: z.array(z.string()).optional(),\n })\n .optional(),\n done: z.boolean().optional(),\n done_reason: z.string().optional(),\n total_duration: z.number().optional(),\n load_duration: z.number().optional(),\n prompt_eval_count: z.number().optional(),\n prompt_eval_cached_count: z.number().optional(),\n prompt_eval_duration: z.number().optional(),\n eval_count: z.number().optional(),\n eval_duration: z.number().optional(),\n logprobs: z.array(LogprobSchema).optional(),\n});\n","// AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\nimport { ToolCallSchema } from './ToolCall.schema.js';\n\nexport const ChatStreamEventSchema = z.object({\n model: z.string().optional(),\n created_at: z.string().optional(),\n message: z\n .object({\n role: z.string().optional(),\n content: z.string().optional(),\n thinking: z.string().optional(),\n tool_calls: z.array(ToolCallSchema).optional(),\n images: z.array(z.string()).optional(),\n })\n .optional(),\n done: z.boolean().optional(),\n});\n","// AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\n\nexport const CopyRequestSchema = z.object({\n source: z.string(),\n destination: z.string(),\n});\n","// AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\nimport { ChatMessageSchema } from './ChatMessage.schema.js';\n\nexport const CreateRequestSchema = z.object({\n model: z.string(),\n from: z.string().optional(),\n template: z.string().optional(),\n renderer: z.string().optional(),\n parser: z.string().optional(),\n files: z.object({}).catchall(z.string()).optional(),\n draft_files: z.object({}).catchall(z.string()).optional(),\n license: z.union([z.string(), z.array(z.string())]).optional(),\n system: z.string().optional(),\n parameters: z.object({}).optional(),\n messages: z.array(ChatMessageSchema).optional(),\n quantize: z.string().optional(),\n draft_quantize: z.string().optional(),\n requires: z.string().optional(),\n stream: z.boolean().optional(),\n});\n","// AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\n\nexport const DeleteRequestSchema = z.object({\n model: z.string(),\n});\n","// AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\nimport { ModelOptionsSchema } from './ModelOptions.schema.js';\n\nexport const EmbedRequestSchema = z.object({\n model: z.string(),\n input: z.union([z.string(), z.array(z.string())]),\n truncate: z.boolean().optional(),\n dimensions: z.number().optional(),\n keep_alive: z.string().optional(),\n options: ModelOptionsSchema.optional(),\n});\n","// AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\n\nexport const EmbedResponseSchema = z.object({\n model: z.string().optional(),\n embeddings: z.array(z.array(z.number())).optional(),\n total_duration: z.number().optional(),\n load_duration: z.number().optional(),\n prompt_eval_count: z.number().optional(),\n});\n","// AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\n\nexport const ErrorResponseSchema = z.object({\n error: z.string().optional(),\n});\n","// AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\nimport { ModelOptionsSchema } from './ModelOptions.schema.js';\nimport { ThinkValueSchema } from './ThinkValue.schema.js';\n\nexport const GenerateRequestSchema = z.object({\n model: z.string(),\n prompt: z.string().optional(),\n suffix: z.string().optional(),\n images: z.array(z.string()).optional(),\n format: z.union([z.string(), z.object({})]).optional(),\n system: z.string().optional(),\n stream: z.boolean().optional(),\n think: ThinkValueSchema.optional(),\n raw: z.boolean().optional(),\n keep_alive: z.union([z.string(), z.number()]).optional(),\n options: ModelOptionsSchema.optional(),\n logprobs: z.boolean().optional(),\n top_logprobs: z.number().optional(),\n});\n","// AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\nimport { LogprobSchema } from './Logprob.schema.js';\n\nexport const GenerateResponseSchema = z.object({\n model: z.string().optional(),\n created_at: z.string().optional(),\n response: z.string().optional(),\n thinking: z.string().optional(),\n done: z.boolean().optional(),\n done_reason: z.string().optional(),\n total_duration: z.number().optional(),\n load_duration: z.number().optional(),\n prompt_eval_count: z.number().optional(),\n prompt_eval_cached_count: z.number().optional(),\n prompt_eval_duration: z.number().optional(),\n eval_count: z.number().optional(),\n eval_duration: z.number().optional(),\n logprobs: z.array(LogprobSchema).optional(),\n});\n","// AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\n\nexport const GenerateStreamEventSchema = z.object({\n model: z.string().optional(),\n created_at: z.string().optional(),\n response: z.string().optional(),\n thinking: z.string().optional(),\n done: z.boolean().optional(),\n done_reason: z.string().optional(),\n total_duration: z.number().optional(),\n load_duration: z.number().optional(),\n prompt_eval_count: z.number().optional(),\n prompt_eval_cached_count: z.number().optional(),\n prompt_eval_duration: z.number().optional(),\n eval_count: z.number().optional(),\n eval_duration: z.number().optional(),\n});\n","// AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\n\n/** Summary information for a locally available model */\nexport const ModelSummarySchema = z.object({\n name: z.string().optional(),\n model: z.string().optional(),\n remote_model: z.string().optional(),\n remote_host: z.string().optional(),\n modified_at: z.string().optional(),\n size: z.number().optional(),\n digest: z.string().optional(),\n details: z\n .object({\n format: z.string().optional(),\n family: z.string().optional(),\n families: z.array(z.string()).optional(),\n parameter_size: z.string().optional(),\n quantization_level: z.string().optional(),\n })\n .optional(),\n});\n","// AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\nimport { ModelSummarySchema } from './ModelSummary.schema.js';\n\nexport const ListResponseSchema = z.object({\n models: z.array(ModelSummarySchema).optional(),\n});\n","// AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\n\nexport const PsSchema = z.object({\n name: z.string().optional(),\n model: z.string().optional(),\n size: z.number().optional(),\n digest: z.string().optional(),\n details: z.object({}).optional(),\n expires_at: z.string().optional(),\n size_vram: z.number().optional(),\n context_length: z.number().optional(),\n});\n","// AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\nimport { PsSchema } from './Ps.schema.js';\n\nexport const PsResponseSchema = z.object({\n models: z.array(PsSchema).optional(),\n});\n","// AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\n\nexport const PullRequestSchema = z.object({\n model: z.string(),\n insecure: z.boolean().optional(),\n stream: z.boolean().optional(),\n});\n","// AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\n\nexport const PushRequestSchema = z.object({\n model: z.string(),\n insecure: z.boolean().optional(),\n stream: z.boolean().optional(),\n});\n","// AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\n\nexport const ShowRequestSchema = z.object({\n model: z.string(),\n verbose: z.boolean().optional(),\n});\n","// AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\n\n/** Thinking controls advertised by a model. Models without thinking metadata omit this field. */\nexport const ThinkingSchema = z.object({\n values: z.array(z.union([z.boolean(), z.string()])),\n default: z.union([z.boolean(), z.string()]),\n});\n","// AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\nimport { ThinkingSchema } from './Thinking.schema.js';\n\nexport const ShowResponseSchema = z.object({\n thinking: ThinkingSchema.optional(),\n parameters: z.string().optional(),\n license: z.string().optional(),\n modified_at: z.string().optional(),\n details: z.object({}).optional(),\n template: z.string().optional(),\n capabilities: z.array(z.string()).optional(),\n model_info: z.object({}).optional(),\n});\n","// AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\n\nexport const StatusEventSchema = z.object({\n status: z.string().optional(),\n digest: z.string().optional(),\n total: z.number().optional(),\n completed: z.number().optional(),\n});\n","// AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\n\nexport const StatusResponseSchema = z.object({\n status: z.string().optional(),\n});\n","// AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\n\nexport const VersionResponseSchema = z.object({\n version: z.string().optional(),\n});\n","// AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\n\nexport const WebFetchRequestSchema = z.object({\n url: z.string(),\n});\n","// AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\n\nexport const WebFetchResponseSchema = z.object({\n title: z.string().optional(),\n content: z.string().optional(),\n links: z.array(z.string()).optional(),\n});\n","// AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\n\nexport const WebSearchRequestSchema = z.object({\n query: z.string(),\n max_results: z.number().optional(),\n});\n","// AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\n\nexport const WebSearchResultSchema = z.object({\n title: z.string().optional(),\n url: z.string().optional(),\n content: z.string().optional(),\n});\n","// AUTO-GENERATED by `npm run contract:generate`. DO NOT EDIT.\n// Source: contracts/ir/ollama.ir.json (canonical Ollama IR).\n// Pairs with ./<name>.ts (the TypeScript interface).\n\nimport { z } from 'zod';\nimport { WebSearchResultSchema } from './WebSearchResult.schema.js';\n\nexport const WebSearchResponseSchema = z.object({\n results: z.array(WebSearchResultSchema).optional(),\n});\n"]}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
|
|
4
|
+
var __typeError = (msg) => {
|
|
5
|
+
throw TypeError(msg);
|
|
6
|
+
};
|
|
7
|
+
var __using = (stack, value, async) => {
|
|
8
|
+
if (value != null) {
|
|
9
|
+
if (typeof value !== "object" && typeof value !== "function") __typeError("Object expected");
|
|
10
|
+
var dispose, inner;
|
|
11
|
+
dispose = value[__knownSymbol("asyncDispose")];
|
|
12
|
+
if (dispose === void 0) {
|
|
13
|
+
dispose = value[__knownSymbol("dispose")];
|
|
14
|
+
inner = dispose;
|
|
15
|
+
}
|
|
16
|
+
if (typeof dispose !== "function") __typeError("Object not disposable");
|
|
17
|
+
if (inner) dispose = function() {
|
|
18
|
+
try {
|
|
19
|
+
inner.call(this);
|
|
20
|
+
} catch (e) {
|
|
21
|
+
return Promise.reject(e);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
stack.push([async, dispose, value]);
|
|
25
|
+
} else {
|
|
26
|
+
stack.push([async]);
|
|
27
|
+
}
|
|
28
|
+
return value;
|
|
29
|
+
};
|
|
30
|
+
var __callDispose = (stack, error, hasError) => {
|
|
31
|
+
var E = typeof SuppressedError === "function" ? SuppressedError : function(e, s, m, _) {
|
|
32
|
+
return _ = Error(m), _.name = "SuppressedError", _.error = e, _.suppressed = s, _;
|
|
33
|
+
};
|
|
34
|
+
var fail = (e) => error = hasError ? new E(e, error, "An error was suppressed during disposal") : (hasError = true, e);
|
|
35
|
+
var next = (it) => {
|
|
36
|
+
while (it = stack.pop()) {
|
|
37
|
+
try {
|
|
38
|
+
var result = it[1] && it[1].call(it[2]);
|
|
39
|
+
if (it[0]) return Promise.resolve(result).then(next, (e) => (fail(e), next()));
|
|
40
|
+
} catch (e) {
|
|
41
|
+
fail(e);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (hasError) throw error;
|
|
45
|
+
};
|
|
46
|
+
return next();
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// src/errors.ts
|
|
50
|
+
var OllamaClientError = class extends Error {
|
|
51
|
+
code;
|
|
52
|
+
status;
|
|
53
|
+
retryable;
|
|
54
|
+
request;
|
|
55
|
+
response;
|
|
56
|
+
constructor(message, options) {
|
|
57
|
+
super(message, { cause: options.cause });
|
|
58
|
+
this.name = this.constructor.name;
|
|
59
|
+
this.code = options.code;
|
|
60
|
+
this.status = options.status;
|
|
61
|
+
this.retryable = options.retryable ?? false;
|
|
62
|
+
this.request = options.request;
|
|
63
|
+
this.response = options.response;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
var OllamaGenericClientError = class extends OllamaClientError {
|
|
67
|
+
constructor(message, options) {
|
|
68
|
+
super(message, { ...options, code: "client_error" });
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// src/utils.ts
|
|
73
|
+
function disposableReader(reader) {
|
|
74
|
+
return {
|
|
75
|
+
async [Symbol.asyncDispose]() {
|
|
76
|
+
try {
|
|
77
|
+
await reader.cancel();
|
|
78
|
+
} catch {
|
|
79
|
+
}
|
|
80
|
+
reader.releaseLock();
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// src/streaming/ndjson.ts
|
|
86
|
+
async function* parseNdjsonStream(stream) {
|
|
87
|
+
var _stack = [];
|
|
88
|
+
try {
|
|
89
|
+
const reader = stream.getReader();
|
|
90
|
+
const decoder = new TextDecoder();
|
|
91
|
+
let buffer = "";
|
|
92
|
+
const _reader = __using(_stack, disposableReader(reader), true);
|
|
93
|
+
while (true) {
|
|
94
|
+
const { done, value } = await reader.read();
|
|
95
|
+
if (done) break;
|
|
96
|
+
buffer += decoder.decode(value, { stream: true });
|
|
97
|
+
const lines = buffer.split("\n");
|
|
98
|
+
buffer = lines.pop() ?? "";
|
|
99
|
+
for (const line of lines) {
|
|
100
|
+
const trimmed = line.trim();
|
|
101
|
+
if (!trimmed) continue;
|
|
102
|
+
try {
|
|
103
|
+
yield JSON.parse(trimmed);
|
|
104
|
+
} catch (err) {
|
|
105
|
+
throw new OllamaGenericClientError(`Failed to parse stream JSON chunk: ${trimmed}`, {
|
|
106
|
+
cause: err
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (buffer.trim()) {
|
|
112
|
+
yield JSON.parse(buffer.trim());
|
|
113
|
+
}
|
|
114
|
+
} catch (_) {
|
|
115
|
+
var _error = _, _hasError = true;
|
|
116
|
+
} finally {
|
|
117
|
+
var _promise = __callDispose(_stack, _error, _hasError);
|
|
118
|
+
_promise && await _promise;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// src/generated/runtime/runtime.ts
|
|
123
|
+
function compareVersions(a, b) {
|
|
124
|
+
const pa = a.split(".").map((s) => Number.parseInt(s, 10) ?? 0);
|
|
125
|
+
const pb = b.split(".").map((s) => Number.parseInt(s, 10) ?? 0);
|
|
126
|
+
for (let i = 0; i < Math.max(pa.length, pb.length); i += 1) {
|
|
127
|
+
const va = pa[i] ?? 0;
|
|
128
|
+
const vb = pb[i] ?? 0;
|
|
129
|
+
if (va !== vb) return va - vb;
|
|
130
|
+
}
|
|
131
|
+
return 0;
|
|
132
|
+
}
|
|
133
|
+
function assertOperationAllowed(operation, options) {
|
|
134
|
+
const localMode = options.localMode ?? true;
|
|
135
|
+
if (!localMode && !operation.environment.cloud) {
|
|
136
|
+
throw new OllamaGenericClientError(
|
|
137
|
+
`Operation ${operation.operationId} (${operation.method} ${operation.path}) is local-only and not supported in cloud mode.`
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
if (operation.constraints?.minOllamaVersion && options.serverVersion && compareVersions(options.serverVersion, operation.constraints.minOllamaVersion) < 0) {
|
|
141
|
+
throw new OllamaGenericClientError(
|
|
142
|
+
`Operation ${operation.operationId} (${operation.method} ${operation.path}) requires Ollama >= ${operation.constraints.minOllamaVersion} (server reports ${options.serverVersion}).`
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
function shouldStream(req) {
|
|
147
|
+
if (req.body && typeof req.body === "object" && "stream" in req.body) {
|
|
148
|
+
const explicit = req.body.stream;
|
|
149
|
+
if (typeof explicit === "boolean") return explicit;
|
|
150
|
+
}
|
|
151
|
+
return Boolean(req.streamingDefault ?? req.operation.transport.streamingDefault);
|
|
152
|
+
}
|
|
153
|
+
function buildBody(req) {
|
|
154
|
+
if (req.body === void 0) return void 0;
|
|
155
|
+
if (typeof req.body !== "object" || req.body === null) return req.body;
|
|
156
|
+
const body = req.body;
|
|
157
|
+
if (req.operation.transport.streaming && req.operation.transport.streamingDefault && body.stream === void 0) {
|
|
158
|
+
return { ...body, stream: true };
|
|
159
|
+
}
|
|
160
|
+
return body;
|
|
161
|
+
}
|
|
162
|
+
var OllamaRuntime = class {
|
|
163
|
+
constructor(options) {
|
|
164
|
+
this.options = options;
|
|
165
|
+
}
|
|
166
|
+
options;
|
|
167
|
+
/**
|
|
168
|
+
* Invoke an operation. Called by every generated API method.
|
|
169
|
+
*
|
|
170
|
+
* Returns a `Promise<T>` for non-streaming operations, or an
|
|
171
|
+
* `AsyncGenerator<T>` for streaming operations. The generated API
|
|
172
|
+
* class's overloads pick the right return type at compile time.
|
|
173
|
+
*/
|
|
174
|
+
async invoke(req) {
|
|
175
|
+
assertOperationAllowed(req.operation, this.options);
|
|
176
|
+
const body = buildBody(req);
|
|
177
|
+
const streaming = shouldStream(req);
|
|
178
|
+
const httpReq = {
|
|
179
|
+
path: req.operation.path,
|
|
180
|
+
method: req.operation.method,
|
|
181
|
+
...body !== void 0 ? { body } : {},
|
|
182
|
+
...req.signal !== void 0 ? { signal: req.signal } : {},
|
|
183
|
+
// For streaming calls, request the raw Response so we can pipe it
|
|
184
|
+
// through parseNdjsonStream directly. This inherits middleware,
|
|
185
|
+
// retry, telemetry, and error-mapping from HttpClient — the
|
|
186
|
+
// previous Wave 3 implementation bypassed them with a direct
|
|
187
|
+
// `fetch()` call.
|
|
188
|
+
...streaming ? { raw: true } : {}
|
|
189
|
+
};
|
|
190
|
+
if (!streaming) {
|
|
191
|
+
return await this.options.http.request(httpReq);
|
|
192
|
+
}
|
|
193
|
+
const response = await this.options.http.request(httpReq);
|
|
194
|
+
if (!response.body) {
|
|
195
|
+
throw new OllamaGenericClientError(
|
|
196
|
+
`Operation ${req.operation.operationId}: streaming response had no body.`
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
return parseNdjsonStream(response.body);
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
exports.OllamaRuntime = OllamaRuntime;
|
|
204
|
+
//# sourceMappingURL=generated-runtime.cjs.map
|
|
205
|
+
//# sourceMappingURL=generated-runtime.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/errors.ts","../src/utils.ts","../src/streaming/ndjson.ts","../src/generated/runtime/runtime.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBO,IAAM,iBAAA,GAAN,cAAgC,KAAA,CAAM;AAAA,EAClC,IAAA;AAAA,EACA,MAAA;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AgC;AAAA,EAAhC,OAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAS7B,MAAM,OAAoB,GAAA,EAAgC;AACxD,IAAA,sBAAA,CAAuB,GAAA,CAAI,SAAA,EAAW,IAAA,CAAK,OAAO,CAAA;AAClD,IAAA,MAAM,IAAA,GAAO,UAAU,GAAG,CAAA;AAC1B,IAAA,MAAM,SAAA,GAAY,aAAa,GAAG,CAAA;AAKlC,IAAA,MAAM,OAAA,GAA8B;AAAA,MAClC,IAAA,EAAM,IAAI,SAAA,CAAU,IAAA;AAAA,MACpB,MAAA,EAAQ,IAAI,SAAA,CAAU,MAAA;AAAA,MACtB,GAAI,IAAA,KAAS,MAAA,GAAY,EAAE,IAAA,KAAS,EAAC;AAAA,MACrC,GAAI,IAAI,MAAA,KAAW,MAAA,GAAY,EAAE,MAAA,EAAQ,GAAA,CAAI,MAAA,EAAO,GAAI,EAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMzD,GAAI,SAAA,GAAY,EAAE,GAAA,EAAK,IAAA,KAAS;AAAC,KACnC;AAEA,IAAA,IAAI,CAAC,SAAA,EAAW;AACd,MAAA,OAAQ,MAAM,IAAA,CAAK,OAAA,CAAQ,IAAA,CAAK,QAAW,OAAO,CAAA;AAAA,IACpD;AAIA,IAAA,MAAM,WAAW,MAAM,IAAA,CAAK,OAAA,CAAQ,IAAA,CAAK,QAAkB,OAAO,CAAA;AAClE,IAAA,IAAI,CAAC,SAAS,IAAA,EAAM;AAClB,MAAA,MAAM,IAAI,wBAAA;AAAA,QACR,CAAA,UAAA,EAAa,GAAA,CAAI,SAAA,CAAU,WAAW,CAAA,iCAAA;AAAA,OACxC;AAAA,IACF;AACA,IAAA,OAAO,iBAAA,CAAqB,SAAS,IAAI,CAAA;AAAA,EAC3C;AACF","file":"generated-runtime.cjs","sourcesContent":["/**\n * Structured, typed error hierarchy for OllamaClient.\n */\n\nexport interface OllamaErrorRequestContext {\n readonly method?: string | undefined;\n readonly url?: string | undefined;\n readonly model?: string | undefined;\n}\n\nexport interface OllamaErrorResponseContext {\n readonly status?: number | undefined;\n readonly headers?: Record<string, string> | undefined;\n readonly body?: unknown;\n}\n\nexport interface OllamaClientErrorOptions extends ErrorOptions {\n readonly code: string;\n readonly status?: number | undefined;\n readonly retryable?: boolean | undefined;\n readonly request?: OllamaErrorRequestContext | undefined;\n readonly response?: OllamaErrorResponseContext | undefined;\n}\n\nexport class OllamaClientError extends Error {\n readonly code: string;\n readonly status?: number | undefined;\n readonly retryable: boolean;\n readonly request?: OllamaErrorRequestContext | undefined;\n readonly response?: OllamaErrorResponseContext | undefined;\n\n constructor(message: string, options: OllamaClientErrorOptions) {\n super(message, { cause: options.cause });\n this.name = this.constructor.name;\n this.code = options.code;\n this.status = options.status;\n this.retryable = options.retryable ?? false;\n this.request = options.request;\n this.response = options.response;\n }\n}\n\nexport class OllamaNetworkError extends OllamaClientError {\n constructor(\n message: string,\n options?: Omit<OllamaClientErrorOptions, 'code' | 'retryable'> | undefined,\n ) {\n super(message, { ...options, code: 'network_error', retryable: true });\n }\n}\n\nexport class OllamaTimeoutError extends OllamaClientError {\n readonly timeoutMs?: number | undefined;\n constructor(\n message: string,\n options?:\n | (Omit<OllamaClientErrorOptions, 'code' | 'retryable'> & { timeoutMs?: number | undefined })\n | undefined,\n ) {\n super(message, { ...options, code: 'timeout', retryable: true });\n this.timeoutMs = options?.timeoutMs;\n }\n}\n\nexport class OllamaAuthError extends OllamaClientError {\n constructor(\n message: string,\n options?: Omit<OllamaClientErrorOptions, 'code' | 'retryable'> | undefined,\n ) {\n super(message, { ...options, code: 'auth_error', retryable: false });\n }\n}\n\nexport class OllamaNotFoundError extends OllamaClientError {\n constructor(\n message: string,\n options?: Omit<OllamaClientErrorOptions, 'code' | 'retryable'> | undefined,\n ) {\n super(message, { ...options, code: 'not_found', retryable: false });\n }\n}\n\nexport class OllamaRateLimitError extends OllamaClientError {\n readonly retryAfterMs?: number | undefined;\n constructor(\n message: string,\n options?:\n | (Omit<OllamaClientErrorOptions, 'code' | 'retryable'> & {\n retryAfterMs?: number | undefined;\n })\n | undefined,\n ) {\n super(message, { ...options, code: 'rate_limited', retryable: true });\n this.retryAfterMs = options?.retryAfterMs;\n }\n}\n\n/**\n * Thrown client-side, before a network request is made, by `QuotaManager.assertCanProceed`\n * (see `src/quota.ts`) when issuing the request would exceed a configured usage budget for\n * one of its rolling windows. This is distinct from `OllamaRateLimitError`, which reflects\n * the server's own 429 response — Ollama Cloud does not expose account-level quota via the\n * API, so `QuotaManager` tracks usage against budgets the caller configures locally and\n * fails fast rather than waiting for the server to reject the request.\n */\nexport class OllamaQuotaExceededError extends OllamaClientError {\n readonly windowId: string;\n readonly resetAt: number;\n constructor(\n message: string,\n options: Omit<OllamaClientErrorOptions, 'code' | 'retryable'> & {\n windowId: string;\n resetAt: number;\n },\n ) {\n super(message, { ...options, code: 'quota_exceeded', retryable: false });\n this.windowId = options.windowId;\n this.resetAt = options.resetAt;\n }\n}\n\nexport class OllamaServerError extends OllamaClientError {\n constructor(\n message: string,\n options?: Omit<OllamaClientErrorOptions, 'code' | 'retryable'> | undefined,\n ) {\n super(message, { ...options, code: 'server_error', retryable: true });\n }\n}\n\nexport class OllamaAbortError extends OllamaClientError {\n constructor(\n message: string,\n options?: Omit<OllamaClientErrorOptions, 'code' | 'retryable'> | undefined,\n ) {\n super(message, { ...options, code: 'aborted', retryable: false });\n }\n}\n\nexport class OllamaToolValidationError extends OllamaClientError {\n readonly toolName: string;\n readonly issues?: unknown;\n constructor(\n message: string,\n options: Omit<OllamaClientErrorOptions, 'code'> & { toolName: string; issues?: unknown },\n ) {\n super(message, { ...options, code: 'tool_validation_error', retryable: false });\n this.toolName = options.toolName;\n this.issues = options.issues;\n }\n}\n\nexport class OllamaToolTimeoutError extends OllamaClientError {\n readonly toolName: string;\n readonly timeoutMs: number;\n constructor(\n message: string,\n options: Omit<OllamaClientErrorOptions, 'code' | 'retryable'> & {\n toolName: string;\n timeoutMs: number;\n },\n ) {\n super(message, { ...options, code: 'tool_timeout', retryable: false });\n this.toolName = options.toolName;\n this.timeoutMs = options.timeoutMs;\n }\n}\n\n/**\n * Thrown client-side, before a network request is made, when a request asks for a\n * capability an endpoint is known not to support (e.g. structured output `format` against\n * an Ollama Cloud endpoint — see `ModelCapabilities.supportsStructuredOutputRequest` in\n * `src/capabilities/capabilities.ts`). Its `code` is included in `DEFAULT_FAILOVER_CODES`\n * by default, so in a multi-endpoint setup it causes failover to the next candidate rather\n * than failing outright — it only surfaces to the caller if every candidate is rejected.\n */\nexport class OllamaUnsupportedCapabilityError extends OllamaClientError {\n readonly capability: string;\n constructor(\n message: string,\n options: Omit<OllamaClientErrorOptions, 'code' | 'retryable'> & { capability: string },\n ) {\n super(message, { ...options, code: 'unsupported_capability', retryable: false });\n this.capability = options.capability;\n }\n}\n\n/**\n * Thrown client-side, before any network call, when `config.endpoints` uses\n * `OllamaEndpoint.models` to scope endpoints/credentials to specific models and the\n * requested `model` isn't in any configured endpoint's allow-list. This is a routing\n * misconfiguration, not a connectivity problem — the SDK deliberately does not \"probe\"\n * unauthorized endpoints to find one that happens to work (that would burn quota on keys\n * that were never entitled to the model and produce non-deterministic startup behavior).\n */\nexport class OllamaModelRoutingError extends OllamaClientError {\n readonly model: string;\n readonly availableModels: readonly string[];\n constructor(\n message: string,\n options: Omit<OllamaClientErrorOptions, 'code' | 'retryable'> & {\n model: string;\n availableModels: readonly string[];\n },\n ) {\n super(message, { ...options, code: 'model_routing_error', retryable: false });\n this.model = options.model;\n this.availableModels = options.availableModels;\n }\n}\n\n/**\n * Thrown before an agent tool loop starts when the selected model's /api/show metadata\n * does not advertise a capability required by the loop.\n */\nexport class OllamaIncompatibleModelError extends OllamaClientError {\n readonly model: string;\n readonly capability: string;\n readonly reportedCapabilities: readonly string[];\n\n constructor(\n message: string,\n options: Omit<OllamaClientErrorOptions, 'code' | 'retryable'> & {\n model: string;\n capability: string;\n reportedCapabilities: readonly string[];\n },\n ) {\n super(message, { ...options, code: 'incompatible_model', retryable: false });\n this.model = options.model;\n this.capability = options.capability;\n this.reportedCapabilities = options.reportedCapabilities;\n }\n}\nexport class OllamaAgentMaxToolCallsError extends OllamaClientError {\n readonly maxToolCalls: number;\n readonly toolCallsExecuted: number;\n\n constructor(\n message: string,\n options: Omit<OllamaClientErrorOptions, 'code'> & {\n maxToolCalls: number;\n toolCallsExecuted: number;\n },\n ) {\n super(message, { ...options, code: 'agent_max_tool_calls_exceeded', retryable: false });\n this.maxToolCalls = options.maxToolCalls;\n this.toolCallsExecuted = options.toolCallsExecuted;\n }\n}\n\nexport class OllamaAgentMaxIterationsError extends OllamaClientError {\n readonly maxIterations: number;\n constructor(\n message: string,\n options: Omit<OllamaClientErrorOptions, 'code'> & { maxIterations: number },\n ) {\n super(message, { ...options, code: 'agent_max_iterations_exceeded', retryable: false });\n this.maxIterations = options.maxIterations;\n }\n}\n\nexport class OllamaMcpError extends OllamaClientError {\n readonly mcpMethod: 'listTools' | 'callTool';\n readonly toolName?: string | undefined;\n constructor(\n message: string,\n options: Omit<OllamaClientErrorOptions, 'code'> & {\n mcpMethod: 'listTools' | 'callTool';\n toolName?: string | undefined;\n },\n ) {\n super(message, { ...options, code: 'mcp_error', retryable: options.retryable ?? false });\n this.mcpMethod = options.mcpMethod;\n this.toolName = options.toolName;\n }\n}\n\nexport class OllamaSkillNotFoundError extends OllamaClientError {\n readonly skillName: string;\n constructor(\n message: string,\n options: Omit<OllamaClientErrorOptions, 'code'> & { skillName: string },\n ) {\n super(message, { ...options, code: 'skill_not_found', retryable: false });\n this.skillName = options.skillName;\n }\n}\n\nexport class OllamaSkillInvalidError extends OllamaClientError {\n readonly skillName: string;\n readonly path?: string | undefined;\n constructor(\n message: string,\n options: Omit<OllamaClientErrorOptions, 'code'> & {\n skillName: string;\n path?: string | undefined;\n },\n ) {\n super(message, { ...options, code: 'skill_invalid', retryable: false });\n this.skillName = options.skillName;\n this.path = options.path;\n }\n}\n\nexport class OllamaGenericClientError extends OllamaClientError {\n constructor(message: string, options?: Omit<OllamaClientErrorOptions, 'code'> | undefined) {\n super(message, { ...options, code: 'client_error' });\n }\n}\n\nfunction isDomAbortError(error: unknown): error is DOMException {\n return (\n typeof DOMException !== 'undefined' &&\n error instanceof DOMException &&\n error.name === 'AbortError'\n );\n}\n\nfunction statusToError(\n status: number,\n message: string,\n options: Omit<OllamaClientErrorOptions, 'code' | 'status'>,\n): OllamaClientError {\n if (status === 401 || status === 403) {\n return new OllamaAuthError(message, { ...options, status });\n }\n if (status === 404) {\n return new OllamaNotFoundError(message, { ...options, status });\n }\n if (status === 429) {\n return new OllamaRateLimitError(message, { ...options, status });\n }\n if (status >= 500) {\n return new OllamaServerError(message, { ...options, status });\n }\n return new OllamaGenericClientError(message, { ...options, status });\n}\n\n/**\n * Maps arbitrary thrown exceptions into structured OllamaClientError instances.\n */\nexport function mapError(\n error: unknown,\n context: {\n request?: OllamaErrorRequestContext | undefined;\n response?: OllamaErrorResponseContext | undefined;\n } = {},\n): OllamaClientError {\n if (error instanceof OllamaClientError) {\n return error;\n }\n if (isDomAbortError(error)) {\n return new OllamaAbortError(error.message || 'Request was aborted', {\n cause: error,\n request: context.request,\n });\n }\n if (error instanceof TypeError) {\n return new OllamaNetworkError(error.message || 'Network request failed', {\n cause: error,\n request: context.request,\n });\n }\n if (context.response?.status !== undefined) {\n const message = error instanceof Error ? error.message : String(error);\n return statusToError(context.response.status, message, {\n cause: error,\n request: context.request,\n response: context.response,\n });\n }\n const message = error instanceof Error ? error.message : String(error);\n return new OllamaGenericClientError(message, {\n cause: error,\n request: context.request,\n response: context.response,\n });\n}\n","/**\n * Cross-runtime helpers with no Node.js API dependency, so they stay safe to import from\n * the core client bundle (see ADR 0006 — Edge Runtime CI).\n */\n\n/**\n * Encodes an image to a base64 string, matching the wire format Ollama's `/api/chat` and\n * `/api/generate` `images` arrays expect.\n *\n * - A `string` is assumed to already be base64-encoded and is returned unchanged.\n * - A `Uint8Array` is base64-encoded using whichever universal primitive the runtime\n * exposes: `Buffer` on Node.js, `btoa` on browsers/Edge runtimes. Chunked so it doesn't\n * blow the engine's max call-stack/argument-count limits on large images.\n */\nexport async function encodeImage(image: Uint8Array | string): Promise<string> {\n if (typeof image === 'string') return image;\n\n const bufferCtor = (\n globalThis as { Buffer?: { from(data: Uint8Array): { toString(encoding: string): string } } }\n ).Buffer;\n if (bufferCtor !== undefined) return bufferCtor.from(image).toString('base64');\n\n const CHUNK_SIZE = 0x8000;\n let binary = '';\n for (let i = 0; i < image.length; i += CHUNK_SIZE) {\n binary += String.fromCharCode(...image.subarray(i, i + CHUNK_SIZE));\n }\n return btoa(binary);\n}\n\nasync function encodeImages(\n images: readonly (string | Uint8Array)[] | undefined,\n): Promise<readonly string[] | undefined> {\n if (images === undefined) return undefined;\n return Promise.all(images.map((image) => encodeImage(image)));\n}\n\n/**\n * Returns `req` unchanged if `req.images` has no `Uint8Array` entries (the common case),\n * otherwise a shallow copy with `images` base64-encoded. Keeps `chat`/`generate` request\n * bodies wire-compatible without requiring callers to pre-encode raw image bytes.\n */\nexport async function withEncodedImages<\n T extends { images?: readonly (string | Uint8Array)[] | undefined },\n>(req: T): Promise<T> {\n if (!req.images?.some((image) => image instanceof Uint8Array)) return req;\n return { ...req, images: await encodeImages(req.images) };\n}\n\n/**\n * Applies {@link withEncodedImages} to each message's `images` array. Returns `messages`\n * unchanged (same reference) if no message carries a `Uint8Array` image.\n */\nexport async function withEncodedMessageImages<\n T extends { images?: readonly (string | Uint8Array)[] | undefined },\n>(messages: readonly T[]): Promise<readonly T[]> {\n if (!messages.some((message) => message.images?.some((image) => image instanceof Uint8Array)))\n return messages;\n return Promise.all(messages.map((message) => withEncodedImages(message)));\n}\n\n// ─── Disposable helpers (TS 5.2+ `using` declarations) ──────────────────\n//\n// These wrappers turn cleanup operations into `Disposable` / `AsyncDisposable`\n// values so callers can use `using` / `await using` declarations instead of\n// try/finally blocks. This eliminates the \"forgot to clean up in the finally\n// block\" bug class for timer, reader, and span lifecycles.\n\n/** Wraps a `setTimeout` handle so `clearTimeout` runs at scope exit. */\nexport function disposableTimer(timer: ReturnType<typeof setTimeout>): Disposable {\n return {\n [Symbol.dispose]() {\n clearTimeout(timer);\n },\n };\n}\n\n/** Wraps a `ReadableStreamDefaultReader` so `cancel()` + `releaseLock()` run at scope exit. */\nexport function disposableReader<T>(reader: ReadableStreamDefaultReader<T>): AsyncDisposable {\n return {\n async [Symbol.asyncDispose]() {\n try {\n await reader.cancel();\n } catch {\n /* stream may already be closed */\n }\n reader.releaseLock();\n },\n };\n}\n\n/** Wraps an OpenTelemetry span so `span.end()` runs at scope exit. */\nexport function disposableSpan(span: { end(): void }): Disposable {\n return {\n [Symbol.dispose]() {\n span.end();\n },\n };\n}\n","/**\n * NDJSON (newline-delimited JSON) stream reader for native fetch Response bodies.\n */\n\nimport { OllamaGenericClientError } from '../errors.js';\nimport { disposableReader } from '../utils.js';\n\n/**\n * Parses a byte stream from fetch body into an async generator of typed JSON chunks.\n */\nexport async function* parseNdjsonStream<T>(\n stream: ReadableStream<Uint8Array>,\n): AsyncGenerator<T, void, undefined> {\n const reader = stream.getReader();\n const decoder = new TextDecoder();\n let buffer = '';\n await using _reader = disposableReader(reader);\n\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split('\\n');\n // Keep the last partial line in buffer\n buffer = lines.pop() ?? '';\n\n for (const line of lines) {\n const trimmed = line.trim();\n if (!trimmed) continue;\n try {\n yield JSON.parse(trimmed) as T;\n } catch (err) {\n throw new OllamaGenericClientError(`Failed to parse stream JSON chunk: ${trimmed}`, {\n cause: err,\n });\n }\n }\n }\n\n if (buffer.trim()) {\n yield JSON.parse(buffer.trim()) as T;\n }\n // reader.cancel() + reader.releaseLock() called automatically via `await using _reader`\n}\n","/**\n * OllamaRuntime — the runtime seam generated API classes delegate to.\n *\n * This is the only hand-written file in `src/generated/runtime/`. Every\n * generated method in `src/generated/api/*-api.ts` ends with:\n *\n * ```ts\n * return this.runtime.invoke({ operation: chatOp, body: request });\n * ```\n *\n * The runtime is responsible for:\n * - Method/path resolution (from {@link OperationDefinition})\n * - Streaming default application (when the request doesn't set `stream`)\n * - Environment guard (rejecting cloud calls for local-only operations)\n * - Version constraint guard (failing fast when the server is too old)\n * - Delegating to the existing {@link HttpClient} for transport, retry,\n * telemetry, NDJSON/SSE parsing\n *\n * It is intentionally a thin adapter — the existing transport, streaming,\n * middleware, and error-mapping layers are preserved verbatim. This file\n * only adds the contract-aware glue between generated API classes and the\n * existing HttpClient.\n */\nimport { HttpClient, type HttpRequestOptions } from '../../transport/http.js';\nimport { parseNdjsonStream } from '../../streaming/ndjson.js';\nimport { OllamaGenericClientError } from '../../errors.js';\nimport type { OperationDefinition, InvokeRequest } from './operation-definition.js';\n\n/** Constructor options for {@link OllamaRuntime}. */\nexport interface OllamaRuntimeOptions {\n readonly http: HttpClient;\n /**\n * Whether this runtime is targeting a local Ollama instance. Defaults to\n * `true`. When `false`, operations marked `environment.cloud === false`\n * (i.e. local-only like `/v1/systemone`) are rejected at request time.\n */\n readonly localMode?: boolean;\n /**\n * Server version, if known (typically from a prior `/api/version` call).\n * When set, operations with `constraints.minOllamaVersion` are checked\n * against this value at request time.\n */\n readonly serverVersion?: string;\n}\n\nfunction compareVersions(a: string, b: string): number {\n const pa = a.split('.').map((s) => Number.parseInt(s, 10) ?? 0);\n const pb = b.split('.').map((s) => Number.parseInt(s, 10) ?? 0);\n for (let i = 0; i < Math.max(pa.length, pb.length); i += 1) {\n const va = pa[i] ?? 0;\n const vb = pb[i] ?? 0;\n if (va !== vb) return va - vb;\n }\n return 0;\n}\n\n/**\n * Apply environment + version guards before delegating to HttpClient.\n *\n * Throws {@link OllamaGenericClientError} when:\n * - The operation is local-only and the runtime is in cloud mode.\n * - The operation has `constraints.minOllamaVersion` and the server is older.\n */\nfunction assertOperationAllowed(\n operation: OperationDefinition,\n options: OllamaRuntimeOptions,\n): void {\n const localMode = options.localMode ?? true;\n if (!localMode && !operation.environment.cloud) {\n throw new OllamaGenericClientError(\n `Operation ${operation.operationId} (${operation.method} ${operation.path}) ` +\n `is local-only and not supported in cloud mode.`,\n );\n }\n if (\n operation.constraints?.minOllamaVersion &&\n options.serverVersion &&\n compareVersions(options.serverVersion, operation.constraints.minOllamaVersion) < 0\n ) {\n throw new OllamaGenericClientError(\n `Operation ${operation.operationId} (${operation.method} ${operation.path}) ` +\n `requires Ollama >= ${operation.constraints.minOllamaVersion} ` +\n `(server reports ${options.serverVersion}).`,\n );\n }\n}\n\n/**\n * Decide whether the request should stream. If the request body explicitly\n * sets `stream`, that wins. Otherwise the operation's `streamingDefault`\n * from the contract is used.\n */\nfunction shouldStream(req: InvokeRequest): boolean {\n if (req.body && typeof req.body === 'object' && 'stream' in req.body) {\n const explicit = (req.body as { stream?: unknown }).stream;\n if (typeof explicit === 'boolean') return explicit;\n }\n return Boolean(req.streamingDefault ?? req.operation.transport.streamingDefault);\n}\n\n/**\n * Apply the streaming default to the request body if needed.\n *\n * If the operation streams by default and the body doesn't set `stream`,\n * add `stream: true`. The user can always override by setting `stream`\n * explicitly on the request.\n */\nfunction buildBody(req: InvokeRequest): unknown {\n if (req.body === undefined) return undefined;\n if (typeof req.body !== 'object' || req.body === null) return req.body;\n const body = req.body as Record<string, unknown>;\n if (\n req.operation.transport.streaming &&\n req.operation.transport.streamingDefault &&\n body.stream === undefined\n ) {\n return { ...body, stream: true };\n }\n return body;\n}\n\n/** The runtime seam. */\nexport class OllamaRuntime {\n constructor(private readonly options: OllamaRuntimeOptions) {}\n\n /**\n * Invoke an operation. Called by every generated API method.\n *\n * Returns a `Promise<T>` for non-streaming operations, or an\n * `AsyncGenerator<T>` for streaming operations. The generated API\n * class's overloads pick the right return type at compile time.\n */\n async invoke<T = unknown>(req: InvokeRequest): Promise<T> {\n assertOperationAllowed(req.operation, this.options);\n const body = buildBody(req);\n const streaming = shouldStream(req);\n\n // The HttpClient expects the narrow method union 'GET' | 'POST' |\n // 'DELETE' | 'HEAD' | undefined — cast through `as` because our\n // OperationDefinition.method is the wider HttpMethod type.\n const httpReq: HttpRequestOptions = {\n path: req.operation.path,\n method: req.operation.method as 'GET' | 'POST' | 'DELETE' | 'HEAD',\n ...(body !== undefined ? { body } : {}),\n ...(req.signal !== undefined ? { signal: req.signal } : {}),\n // For streaming calls, request the raw Response so we can pipe it\n // through parseNdjsonStream directly. This inherits middleware,\n // retry, telemetry, and error-mapping from HttpClient — the\n // previous Wave 3 implementation bypassed them with a direct\n // `fetch()` call.\n ...(streaming ? { raw: true } : {}),\n };\n\n if (!streaming) {\n return (await this.options.http.request<T>(httpReq)) as T;\n }\n\n // Streaming: HttpClient returns the raw Response (via the `raw: true`\n // option) so we can read its body as an NDJSON stream.\n const response = await this.options.http.request<Response>(httpReq);\n if (!response.body) {\n throw new OllamaGenericClientError(\n `Operation ${req.operation.operationId}: streaming response had no body.`,\n );\n }\n return parseNdjsonStream<T>(response.body) as unknown as T;\n }\n}\n"]}
|