@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
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* Core protocol and message types for the Ollama REST API.
|
|
5
3
|
*/
|
|
6
4
|
type Role = 'system' | 'user' | 'assistant' | 'tool' | 'thought';
|
|
5
|
+
/** Ollama native thinking control: booleans, null for model default, or model-defined levels. */
|
|
6
|
+
type ThinkValue = boolean | string | null;
|
|
7
|
+
/** Thinking capability metadata returned by `/api/show`. */
|
|
8
|
+
interface ThinkingMetadata {
|
|
9
|
+
readonly values: readonly (boolean | string)[];
|
|
10
|
+
readonly default?: boolean | string | null | undefined;
|
|
11
|
+
}
|
|
7
12
|
interface ToolCallFunction {
|
|
8
13
|
readonly name: string;
|
|
9
14
|
readonly arguments: Record<string, unknown>;
|
|
@@ -35,7 +40,16 @@ interface Message {
|
|
|
35
40
|
*/
|
|
36
41
|
readonly images?: readonly (string | Uint8Array)[] | undefined;
|
|
37
42
|
readonly tool_calls?: readonly ToolCall[] | undefined;
|
|
38
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* Ollama's native `/api/chat` field identifying which tool produced this result.
|
|
45
|
+
* For `role: 'tool'` messages this should be the registered tool's name.
|
|
46
|
+
*/
|
|
47
|
+
readonly tool_name?: string | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* @deprecated SDK-local correlation metadata only. Ollama's native `/api/chat` protocol
|
|
50
|
+
* does not use `tool_call_id`; native requests strip this field before transmission.
|
|
51
|
+
* OpenAI compatibility uses its own `OpenAIMessage.tool_call_id` type.
|
|
52
|
+
*/
|
|
39
53
|
readonly tool_call_id?: string | undefined;
|
|
40
54
|
readonly thinking?: string | undefined;
|
|
41
55
|
}
|
|
@@ -46,15 +60,20 @@ interface ToolProperty {
|
|
|
46
60
|
readonly items?: Record<string, unknown> | undefined;
|
|
47
61
|
readonly properties?: Record<string, unknown> | undefined;
|
|
48
62
|
readonly required?: readonly string[] | undefined;
|
|
63
|
+
/** Additional JSON Schema keywords are preserved for MCP/provider interoperability. */
|
|
64
|
+
readonly [keyword: string]: unknown;
|
|
65
|
+
}
|
|
66
|
+
interface ToolParameters {
|
|
67
|
+
readonly type: 'object';
|
|
68
|
+
readonly properties: Record<string, ToolProperty>;
|
|
69
|
+
readonly required?: readonly string[] | undefined;
|
|
70
|
+
/** Additional JSON Schema keywords such as $defs, anyOf, allOf, and additionalProperties. */
|
|
71
|
+
readonly [keyword: string]: unknown;
|
|
49
72
|
}
|
|
50
73
|
interface ToolFunctionDefinition {
|
|
51
74
|
readonly name: string;
|
|
52
75
|
readonly description: string;
|
|
53
|
-
readonly parameters:
|
|
54
|
-
readonly type: 'object';
|
|
55
|
-
readonly properties: Record<string, ToolProperty>;
|
|
56
|
-
readonly required?: readonly string[] | undefined;
|
|
57
|
-
};
|
|
76
|
+
readonly parameters: ToolParameters;
|
|
58
77
|
}
|
|
59
78
|
interface ToolDefinition {
|
|
60
79
|
readonly type: 'function';
|
|
@@ -80,6 +99,8 @@ interface ModelOptions {
|
|
|
80
99
|
readonly num_keep?: number | undefined;
|
|
81
100
|
readonly seed?: number | undefined;
|
|
82
101
|
readonly num_predict?: number | undefined;
|
|
102
|
+
/** Number of tokens to predict with a draft/speculative model, when supported. */
|
|
103
|
+
readonly draft_num_predict?: number | undefined;
|
|
83
104
|
readonly top_k?: number | undefined;
|
|
84
105
|
readonly top_p?: number | undefined;
|
|
85
106
|
readonly min_p?: number | undefined;
|
|
@@ -118,7 +139,17 @@ interface ChatRequestOptions extends RequestCancellationOptions {
|
|
|
118
139
|
readonly options?: ModelOptions | undefined;
|
|
119
140
|
readonly stream?: boolean | undefined;
|
|
120
141
|
readonly keep_alive?: string | number | undefined;
|
|
121
|
-
|
|
142
|
+
/**
|
|
143
|
+
* Controls thinking output. Use `client.capabilities(model).thinking` to discover
|
|
144
|
+
* model-defined string levels and the model default.
|
|
145
|
+
*/
|
|
146
|
+
readonly think?: ThinkValue | undefined;
|
|
147
|
+
/** Experimental image-generation width in pixels. */
|
|
148
|
+
readonly width?: number | undefined;
|
|
149
|
+
/** Experimental image-generation height in pixels. */
|
|
150
|
+
readonly height?: number | undefined;
|
|
151
|
+
/** Experimental image-generation diffusion steps. */
|
|
152
|
+
readonly steps?: number | undefined;
|
|
122
153
|
/** Whether to return log probabilities of the output tokens. See {@link ChatResponse.logprobs}. */
|
|
123
154
|
readonly logprobs?: boolean | undefined;
|
|
124
155
|
/** Number of most likely alternative tokens to return at each position. Requires `logprobs: true`. */
|
|
@@ -133,6 +164,8 @@ interface ChatResponse {
|
|
|
133
164
|
readonly total_duration?: number | undefined;
|
|
134
165
|
readonly load_duration?: number | undefined;
|
|
135
166
|
readonly prompt_eval_count?: number | undefined;
|
|
167
|
+
/** Number of prompt tokens read from the KV cache. */
|
|
168
|
+
readonly prompt_eval_cached_count?: number | undefined;
|
|
136
169
|
readonly prompt_eval_duration?: number | undefined;
|
|
137
170
|
readonly eval_count?: number | undefined;
|
|
138
171
|
readonly eval_duration?: number | undefined;
|
|
@@ -157,11 +190,17 @@ interface GenerateRequestOptions extends RequestCancellationOptions {
|
|
|
157
190
|
readonly images?: readonly (string | Uint8Array)[] | undefined;
|
|
158
191
|
readonly options?: ModelOptions | undefined;
|
|
159
192
|
readonly keep_alive?: string | number | undefined;
|
|
160
|
-
readonly think?:
|
|
193
|
+
readonly think?: ThinkValue | undefined;
|
|
161
194
|
/** Whether to return log probabilities of the output tokens. See {@link GenerateResponse.logprobs}. */
|
|
162
195
|
readonly logprobs?: boolean | undefined;
|
|
163
196
|
/** Number of most likely alternative tokens to return at each position. Requires `logprobs: true`. */
|
|
164
197
|
readonly top_logprobs?: number | undefined;
|
|
198
|
+
/** Experimental image-generation width in pixels. */
|
|
199
|
+
readonly width?: number | undefined;
|
|
200
|
+
/** Experimental image-generation height in pixels. */
|
|
201
|
+
readonly height?: number | undefined;
|
|
202
|
+
/** Experimental image-generation diffusion steps. */
|
|
203
|
+
readonly steps?: number | undefined;
|
|
165
204
|
}
|
|
166
205
|
interface GenerateResponse {
|
|
167
206
|
readonly model: string;
|
|
@@ -173,12 +212,20 @@ interface GenerateResponse {
|
|
|
173
212
|
readonly total_duration?: number | undefined;
|
|
174
213
|
readonly load_duration?: number | undefined;
|
|
175
214
|
readonly prompt_eval_count?: number | undefined;
|
|
215
|
+
/** Number of prompt tokens read from the KV cache. */
|
|
216
|
+
readonly prompt_eval_cached_count?: number | undefined;
|
|
176
217
|
readonly prompt_eval_duration?: number | undefined;
|
|
177
218
|
readonly eval_count?: number | undefined;
|
|
178
219
|
readonly eval_duration?: number | undefined;
|
|
179
220
|
readonly thinking?: string | undefined;
|
|
180
221
|
/** Present when the request set `logprobs: true`. */
|
|
181
222
|
readonly logprobs?: readonly Logprob[] | undefined;
|
|
223
|
+
/** Base64-encoded generated image data for image-generation models. */
|
|
224
|
+
readonly image?: string | undefined;
|
|
225
|
+
/** Number of completed image-generation steps. */
|
|
226
|
+
readonly completed?: number | undefined;
|
|
227
|
+
/** Total image-generation steps. */
|
|
228
|
+
readonly total?: number | undefined;
|
|
182
229
|
}
|
|
183
230
|
interface EmbedRequestOptions extends RequestCancellationOptions {
|
|
184
231
|
readonly model: string;
|
|
@@ -222,6 +269,8 @@ interface ModelResponse {
|
|
|
222
269
|
readonly details: ModelDetails;
|
|
223
270
|
readonly expires_at?: string | undefined;
|
|
224
271
|
readonly size_vram?: number | undefined;
|
|
272
|
+
/** Context window length reported for currently running models by /api/ps. */
|
|
273
|
+
readonly context_length?: number | undefined;
|
|
225
274
|
}
|
|
226
275
|
interface ListResponse {
|
|
227
276
|
readonly models: readonly ModelResponse[];
|
|
@@ -242,6 +291,8 @@ interface ShowResponse {
|
|
|
242
291
|
readonly messages?: readonly Message[] | undefined;
|
|
243
292
|
readonly model_info?: Record<string, unknown> | undefined;
|
|
244
293
|
readonly capabilities?: readonly string[] | undefined;
|
|
294
|
+
/** Model-defined thinking levels and default, when reported by Ollama. */
|
|
295
|
+
readonly thinking?: ThinkingMetadata | undefined;
|
|
245
296
|
readonly modified_at?: string | undefined;
|
|
246
297
|
}
|
|
247
298
|
interface ProgressResponse {
|
|
@@ -274,8 +325,12 @@ interface CreateRequestOptions extends RequestCancellationOptions {
|
|
|
274
325
|
readonly modelfile?: string | undefined;
|
|
275
326
|
readonly stream?: boolean | undefined;
|
|
276
327
|
readonly quantize?: string | undefined;
|
|
328
|
+
/** Quantization level to apply to draft weights during import. */
|
|
329
|
+
readonly draft_quantize?: string | undefined;
|
|
277
330
|
readonly from?: string | undefined;
|
|
278
331
|
readonly files?: Record<string, string> | undefined;
|
|
332
|
+
/** Draft source file names mapped to their SHA-256 digests. */
|
|
333
|
+
readonly draft_files?: Record<string, string> | undefined;
|
|
279
334
|
readonly adapters?: Record<string, string> | undefined;
|
|
280
335
|
readonly template?: string | undefined;
|
|
281
336
|
readonly renderer?: string | undefined;
|
|
@@ -285,6 +340,8 @@ interface CreateRequestOptions extends RequestCancellationOptions {
|
|
|
285
340
|
/** Modelfile `PARAMETER` instructions, e.g. `{ temperature: 0.7, stop: ['\n'] }`. */
|
|
286
341
|
readonly parameters?: Record<string, unknown> | undefined;
|
|
287
342
|
readonly messages?: readonly Message[] | undefined;
|
|
343
|
+
/** Minimum Ollama version required by the model. */
|
|
344
|
+
readonly requires?: string | undefined;
|
|
288
345
|
}
|
|
289
346
|
interface DeleteRequestOptions extends RequestCancellationOptions {
|
|
290
347
|
readonly model: string;
|
|
@@ -343,164 +400,4 @@ interface WebFetchResponse {
|
|
|
343
400
|
readonly links?: readonly string[] | undefined;
|
|
344
401
|
}
|
|
345
402
|
|
|
346
|
-
|
|
347
|
-
* Tool definition, handler, and execution types.
|
|
348
|
-
*/
|
|
349
|
-
|
|
350
|
-
interface ToolExecutionContext {
|
|
351
|
-
readonly signal?: AbortSignal | undefined;
|
|
352
|
-
}
|
|
353
|
-
type ToolHandler<TParams, TResult> = (params: TParams, context: ToolExecutionContext) => Promise<TResult> | TResult;
|
|
354
|
-
interface Tool<TParams = Record<string, unknown>, TResult = unknown> {
|
|
355
|
-
readonly name: string;
|
|
356
|
-
readonly description: string;
|
|
357
|
-
readonly schema: z.ZodType<TParams>;
|
|
358
|
-
readonly execute: ToolHandler<TParams, TResult>;
|
|
359
|
-
readonly definition: ToolDefinition;
|
|
360
|
-
/**
|
|
361
|
-
* Per-tool execution timeout in milliseconds, overriding the registry's default.
|
|
362
|
-
* Pass `0` to explicitly disable timeout enforcement for this tool.
|
|
363
|
-
*/
|
|
364
|
-
readonly timeoutMs?: number | undefined;
|
|
365
|
-
}
|
|
366
|
-
/**
|
|
367
|
-
* A `Tool` of *any* parameter shape, for heterogeneous collections — i.e. what
|
|
368
|
-
* `ToolRegistry` stores and accepts.
|
|
369
|
-
*
|
|
370
|
-
* `Tool<TParams>` is **invariant** in `TParams`, because `TParams` appears both
|
|
371
|
-
* covariantly (`schema: z.ZodType<TParams>`) and contravariantly
|
|
372
|
-
* (`execute: ToolHandler<TParams, …>`). That makes `Tool<never, unknown>` — the obvious-
|
|
373
|
-
* looking "bottom" type for a mixed collection — assignable from *nothing*: a perfectly
|
|
374
|
-
* ordinary `Tool<{ city: string }, string>` from `defineTool` is rejected by it. `any` is
|
|
375
|
-
* the standard escape hatch for exactly this case, and it is confined to this one alias:
|
|
376
|
-
* `defineTool` still infers `TParams` from the Zod schema and still type-checks `execute`
|
|
377
|
-
* against it, so tool authoring keeps full type safety. Only the registry's *storage*
|
|
378
|
-
* type is widened, and the registry never does anything with a tool's params beyond
|
|
379
|
-
* handing `schema.safeParse`'s validated output straight back to that same tool's
|
|
380
|
-
* `execute`.
|
|
381
|
-
*/
|
|
382
|
-
type AnyTool = Tool<any, unknown>;
|
|
383
|
-
interface ToolExecutionSuccess {
|
|
384
|
-
readonly toolName: string;
|
|
385
|
-
/** Echoes the originating {@link ToolCall.id}, if the call had one. */
|
|
386
|
-
readonly toolCallId?: string | undefined;
|
|
387
|
-
readonly success: true;
|
|
388
|
-
readonly result: unknown;
|
|
389
|
-
readonly outputString: string;
|
|
390
|
-
}
|
|
391
|
-
interface ToolExecutionFailure {
|
|
392
|
-
readonly toolName: string;
|
|
393
|
-
/** Echoes the originating {@link ToolCall.id}, if the call had one. */
|
|
394
|
-
readonly toolCallId?: string | undefined;
|
|
395
|
-
readonly success: false;
|
|
396
|
-
readonly error: Error;
|
|
397
|
-
readonly outputString: string;
|
|
398
|
-
}
|
|
399
|
-
type ToolExecutionResult = ToolExecutionSuccess | ToolExecutionFailure;
|
|
400
|
-
|
|
401
|
-
/**
|
|
402
|
-
* Tool registry for managing definitions and executing model tool calls.
|
|
403
|
-
*/
|
|
404
|
-
|
|
405
|
-
interface ToolRegistryOptions {
|
|
406
|
-
readonly tools?: readonly AnyTool[] | undefined;
|
|
407
|
-
readonly onError?: ((error: Error, toolCall: ToolCall) => string) | undefined;
|
|
408
|
-
/**
|
|
409
|
-
* Default per-call execution timeout in milliseconds, applied to any tool that
|
|
410
|
-
* doesn't declare its own `timeoutMs`. Undefined (the default) means no timeout is
|
|
411
|
-
* enforced, matching prior behavior. Recommended whenever tool arguments or
|
|
412
|
-
* implementations are influenced by model output you don't fully control, since an
|
|
413
|
-
* unbounded tool call can otherwise stall the entire agent loop indefinitely.
|
|
414
|
-
*
|
|
415
|
-
* Enforcement is cooperative: it races the tool's promise against a timer and
|
|
416
|
-
* reports a timeout failure, but cannot forcibly halt synchronous or non-abort-aware
|
|
417
|
-
* asynchronous work already in flight on the same thread. Tools that perform I/O
|
|
418
|
-
* should honor `ToolExecutionContext.signal` to stop promptly on timeout.
|
|
419
|
-
*/
|
|
420
|
-
readonly timeoutMs?: number | undefined;
|
|
421
|
-
/**
|
|
422
|
-
* Maximum number of tool calls executed concurrently by `executeToolCalls`.
|
|
423
|
-
* Undefined (the default) runs all calls in parallel, matching prior behavior.
|
|
424
|
-
*/
|
|
425
|
-
readonly maxConcurrency?: number | undefined;
|
|
426
|
-
/**
|
|
427
|
-
* Maximum length of a tool's `outputString` before it is truncated. Guards against a
|
|
428
|
-
* single tool call flooding the conversation history / model context (and process
|
|
429
|
-
* memory) with unbounded output. Undefined (the default) applies no limit.
|
|
430
|
-
*/
|
|
431
|
-
readonly maxOutputChars?: number | undefined;
|
|
432
|
-
}
|
|
433
|
-
declare class ToolRegistry {
|
|
434
|
-
private readonly tools;
|
|
435
|
-
private readonly onError?;
|
|
436
|
-
private readonly defaultTimeoutMs?;
|
|
437
|
-
private readonly maxConcurrency?;
|
|
438
|
-
private readonly maxOutputChars?;
|
|
439
|
-
constructor(toolsOrOptions?: readonly AnyTool[] | ToolRegistryOptions | undefined);
|
|
440
|
-
register(tool: AnyTool): this;
|
|
441
|
-
registerMany(tools: readonly AnyTool[]): this;
|
|
442
|
-
get(name: string): AnyTool | undefined;
|
|
443
|
-
definitions(): ToolDefinition[];
|
|
444
|
-
executeToolCall(toolCall: ToolCall, ctx?: ToolExecutionContext): Promise<ToolExecutionResult>;
|
|
445
|
-
private executeToolCallUninstrumented;
|
|
446
|
-
/**
|
|
447
|
-
* Executes every call in `toolCalls` and returns results in the same order, so results
|
|
448
|
-
* are always correlatable by array position regardless of `id`. Each result also echoes
|
|
449
|
-
* its call's `toolCallId` for callers who'd rather match by ID — see the {@link ToolCall}
|
|
450
|
-
* docs for how that id is produced. Runs fully in parallel (`Promise.all`) unless
|
|
451
|
-
* `maxConcurrency` was configured, in which case a bounded worker pool is used instead.
|
|
452
|
-
*/
|
|
453
|
-
executeToolCalls(toolCalls: readonly ToolCall[], ctx?: ToolExecutionContext): Promise<ToolExecutionResult[]>;
|
|
454
|
-
private runWithTimeout;
|
|
455
|
-
private truncateOutput;
|
|
456
|
-
private handleExecutionError;
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
/**
|
|
460
|
-
* SKILL.md frontmatter and skill registry types.
|
|
461
|
-
*/
|
|
462
|
-
interface SkillFrontmatter {
|
|
463
|
-
readonly name: string;
|
|
464
|
-
readonly description: string;
|
|
465
|
-
readonly 'allowed-tools'?: readonly string[] | undefined;
|
|
466
|
-
readonly [key: string]: unknown;
|
|
467
|
-
}
|
|
468
|
-
interface SkillSummary {
|
|
469
|
-
readonly name: string;
|
|
470
|
-
readonly description: string;
|
|
471
|
-
readonly path: string;
|
|
472
|
-
}
|
|
473
|
-
interface Skill extends SkillSummary {
|
|
474
|
-
readonly frontmatter: SkillFrontmatter;
|
|
475
|
-
readonly body: string;
|
|
476
|
-
readonly allowedTools?: readonly string[] | undefined;
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
/**
|
|
480
|
-
* Lightweight frontmatter parser for SKILL.md files.
|
|
481
|
-
*/
|
|
482
|
-
|
|
483
|
-
interface ParsedFrontmatter {
|
|
484
|
-
readonly frontmatter: SkillFrontmatter;
|
|
485
|
-
readonly body: string;
|
|
486
|
-
}
|
|
487
|
-
declare function parseFrontmatter(source: string, path?: string): ParsedFrontmatter;
|
|
488
|
-
|
|
489
|
-
/**
|
|
490
|
-
* Skill composition and context injection.
|
|
491
|
-
*/
|
|
492
|
-
|
|
493
|
-
interface ApplySkillOptions {
|
|
494
|
-
readonly messages: readonly Message[];
|
|
495
|
-
readonly tools?: ToolRegistry;
|
|
496
|
-
}
|
|
497
|
-
interface AppliedSkillResult {
|
|
498
|
-
readonly messages: readonly Message[];
|
|
499
|
-
readonly tools?: ToolRegistry;
|
|
500
|
-
}
|
|
501
|
-
/**
|
|
502
|
-
* Injects a skill's body into messages as a system prompt and applies allowed tool filters.
|
|
503
|
-
*/
|
|
504
|
-
declare function applySkill(skill: Skill, options: ApplySkillOptions): AppliedSkillResult;
|
|
505
|
-
|
|
506
|
-
export { type WebSearchResult as $, type AnyTool as A, type ModelDetails as B, type ChatResponse as C, type DeleteRequestOptions as D, type EmbedRequestOptions as E, type FormatOption as F, type GenerateResponse as G, type ParsedFrontmatter as H, type Role as I, type Skill as J, type SkillFrontmatter as K, type ListResponse as L, type Message as M, type SkillSummary as N, type ToolCallFunction as O, type ProgressResponse as P, type ToolExecutionContext as Q, type RequestCancellationOptions as R, type ShowRequestOptions as S, type ToolCall as T, type ToolExecutionFailure as U, type VersionResponse as V, type WebSearchRequestOptions as W, type ToolExecutionSuccess as X, type ToolFunctionDefinition as Y, type ToolProperty as Z, type ToolRegistryOptions as _, type ModelResponse as a, applySkill as a0, parseFrontmatter as a1, type ShowResponse as b, type PullRequestOptions as c, type PushRequestOptions as d, type CreateRequestOptions as e, type StatusResponse as f, type CopyRequestOptions as g, type PsResponse as h, type ChatRequestOptions as i, type GenerateRequestOptions as j, type EmbedResponse as k, type EmbeddingsRequestOptions as l, type EmbeddingsResponse as m, type WebSearchResponse as n, type WebFetchRequestOptions as o, type WebFetchResponse as p, type ToolHandler as q, type Tool as r, ToolRegistry as s, type ToolExecutionResult as t, type ModelOptions as u, type ToolDefinition as v, type AppliedSkillResult as w, type ApplySkillOptions as x, type Logprob as y, type LogprobToken as z };
|
|
403
|
+
export type { ToolParameters as A, ToolProperty as B, CreateRequestOptions as C, DeleteRequestOptions as D, EmbedRequestOptions as E, FormatOption as F, GenerateRequestOptions as G, WebSearchResult as H, ListResponse as L, Message as M, PullRequestOptions as P, RequestCancellationOptions as R, ShowRequestOptions as S, ToolDefinition as T, VersionResponse as V, WebSearchRequestOptions as W, ToolCall as a, ThinkingMetadata as b, ModelResponse as c, ShowResponse as d, ProgressResponse as e, PushRequestOptions as f, StatusResponse as g, CopyRequestOptions as h, PsResponse as i, ChatRequestOptions as j, ChatResponse as k, GenerateResponse as l, EmbedResponse as m, EmbeddingsRequestOptions as n, EmbeddingsResponse as o, WebSearchResponse as p, WebFetchRequestOptions as q, WebFetchResponse as r, ModelOptions as s, ThinkValue as t, Logprob as u, LogprobToken as v, ModelDetails as w, Role as x, ToolCallFunction as y, ToolFunctionDefinition as z };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nemesis-oss/ollama-sdk",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Production-grade TypeScript SDK for Ollama with native fetch, high availability failover, multi-turn tool calling, structured outputs, reasoning stream tokens, OpenAI/Anthropic bridges, MCP,
|
|
3
|
+
"version": "1.4.1",
|
|
4
|
+
"description": "Production-grade TypeScript SDK for Ollama with native fetch, high availability failover, multi-turn tool calling, structured outputs, reasoning stream tokens, OpenAI/Anthropic bridges, MCP, Web Stream adapters, and a contract-first hybrid architecture that generates TypeScript types, API classes, MCP tools, and Zod schemas from a single canonical IR.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ollama",
|
|
7
7
|
"ollama-client",
|
|
@@ -59,12 +59,90 @@
|
|
|
59
59
|
"default": "./dist/skills.cjs"
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
|
-
"./package.json": "./package.json"
|
|
62
|
+
"./package.json": "./package.json",
|
|
63
|
+
"./mcp/stdio": {
|
|
64
|
+
"import": {
|
|
65
|
+
"types": "./dist/mcp-stdio.d.ts",
|
|
66
|
+
"default": "./dist/mcp-stdio.js"
|
|
67
|
+
},
|
|
68
|
+
"require": {
|
|
69
|
+
"types": "./dist/mcp-stdio.d.cts",
|
|
70
|
+
"default": "./dist/mcp-stdio.cjs"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"./mcp/http": {
|
|
74
|
+
"import": {
|
|
75
|
+
"types": "./dist/mcp-http.d.ts",
|
|
76
|
+
"default": "./dist/mcp-http.js"
|
|
77
|
+
},
|
|
78
|
+
"require": {
|
|
79
|
+
"types": "./dist/mcp-http.d.cts",
|
|
80
|
+
"default": "./dist/mcp-http.cjs"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"./generated/runtime": {
|
|
84
|
+
"import": {
|
|
85
|
+
"types": "./dist/generated-runtime.d.ts",
|
|
86
|
+
"default": "./dist/generated-runtime.js"
|
|
87
|
+
},
|
|
88
|
+
"require": {
|
|
89
|
+
"types": "./dist/generated-runtime.d.cts",
|
|
90
|
+
"default": "./dist/generated-runtime.cjs"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"./generated/api": {
|
|
94
|
+
"import": {
|
|
95
|
+
"types": "./dist/generated-api.d.ts",
|
|
96
|
+
"default": "./dist/generated-api.js"
|
|
97
|
+
},
|
|
98
|
+
"require": {
|
|
99
|
+
"types": "./dist/generated-api.d.cts",
|
|
100
|
+
"default": "./dist/generated-api.cjs"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"./generated/models/schemas": {
|
|
104
|
+
"import": {
|
|
105
|
+
"types": "./dist/generated-models-schemas.d.ts",
|
|
106
|
+
"default": "./dist/generated-models-schemas.js"
|
|
107
|
+
},
|
|
108
|
+
"require": {
|
|
109
|
+
"types": "./dist/generated-models-schemas.d.cts",
|
|
110
|
+
"default": "./dist/generated-models-schemas.cjs"
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"./mcp/generated": {
|
|
114
|
+
"import": {
|
|
115
|
+
"types": "./dist/mcp-generated.d.ts",
|
|
116
|
+
"default": "./dist/mcp-generated.js"
|
|
117
|
+
},
|
|
118
|
+
"require": {
|
|
119
|
+
"types": "./dist/mcp-generated.d.cts",
|
|
120
|
+
"default": "./dist/mcp-generated.cjs"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
63
123
|
},
|
|
64
124
|
"typesVersions": {
|
|
65
125
|
"*": {
|
|
66
126
|
"skills": [
|
|
67
127
|
"dist/skills.d.ts"
|
|
128
|
+
],
|
|
129
|
+
"mcp/stdio": [
|
|
130
|
+
"dist/mcp-stdio.d.ts"
|
|
131
|
+
],
|
|
132
|
+
"mcp/http": [
|
|
133
|
+
"dist/mcp-http.d.ts"
|
|
134
|
+
],
|
|
135
|
+
"generated/runtime": [
|
|
136
|
+
"dist/generated-runtime.d.ts"
|
|
137
|
+
],
|
|
138
|
+
"generated/api": [
|
|
139
|
+
"dist/generated-api.d.ts"
|
|
140
|
+
],
|
|
141
|
+
"generated/models/schemas": [
|
|
142
|
+
"dist/generated-models-schemas.d.ts"
|
|
143
|
+
],
|
|
144
|
+
"mcp/generated": [
|
|
145
|
+
"dist/mcp-generated.d.ts"
|
|
68
146
|
]
|
|
69
147
|
}
|
|
70
148
|
},
|
|
@@ -95,21 +173,32 @@
|
|
|
95
173
|
"test:watch": "vitest",
|
|
96
174
|
"test:coverage": "vitest run --coverage",
|
|
97
175
|
"verify:edge-runtime": "tsx scripts/verify-edge-runtime.ts",
|
|
176
|
+
"verify:contract-parity": "tsx scripts/verify-contract-parity.ts",
|
|
177
|
+
"contract:fetch": "tsx scripts/fetch-contract.ts",
|
|
178
|
+
"contract:normalize": "tsx scripts/build-contract.ts",
|
|
179
|
+
"contract:validate": "tsx scripts/verify-contract.ts",
|
|
180
|
+
"contract:diff": "tsx scripts/diff-contract.ts",
|
|
181
|
+
"contract:generate": "tsx scripts/generate-contract.ts && prettier --write src/generated/",
|
|
182
|
+
"contract:drift": "tsx scripts/drift-contract.ts",
|
|
98
183
|
"bench": "vitest bench --run",
|
|
99
184
|
"bench:watch": "vitest bench",
|
|
100
185
|
"check:types": "npx --yes @arethetypeswrong/cli@latest --pack .",
|
|
101
|
-
"verify": "npm run typecheck && npm run lint && npm run test && npm run build && npm run verify:edge-runtime",
|
|
186
|
+
"verify": "npm run typecheck && npm run lint && npm run test && npm run build && npm run verify:edge-runtime && npm run verify:contract-parity",
|
|
102
187
|
"example": "tsx",
|
|
103
188
|
"lab": "tsx lab/run.ts",
|
|
104
|
-
"prepublishOnly": "npm run clean && npm run typecheck && npm run lint && npm test && npm run build && npm run verify:edge-runtime"
|
|
189
|
+
"prepublishOnly": "npm run clean && npm run typecheck && npm run lint && npm run test && npm run build && npm run verify:edge-runtime && npm run verify:contract-parity"
|
|
105
190
|
},
|
|
106
191
|
"peerDependencies": {
|
|
192
|
+
"@modelcontextprotocol/client": "^2.1.0",
|
|
107
193
|
"@opentelemetry/api": "^1.9.0",
|
|
108
194
|
"zod": "^3.22.0 || ^4.0.0"
|
|
109
195
|
},
|
|
110
196
|
"peerDependenciesMeta": {
|
|
111
197
|
"@opentelemetry/api": {
|
|
112
198
|
"optional": true
|
|
199
|
+
},
|
|
200
|
+
"@modelcontextprotocol/client": {
|
|
201
|
+
"optional": true
|
|
113
202
|
}
|
|
114
203
|
},
|
|
115
204
|
"devDependencies": {
|
|
@@ -120,6 +209,7 @@
|
|
|
120
209
|
"@opentelemetry/api": "^1.9.1",
|
|
121
210
|
"@opentelemetry/context-async-hooks": "^1.30.1",
|
|
122
211
|
"@opentelemetry/sdk-trace-base": "^1.30.1",
|
|
212
|
+
"@types/js-yaml": "^4.0.9",
|
|
123
213
|
"@types/node": "^22.20.0",
|
|
124
214
|
"@vitest/coverage-v8": "^4.1.9",
|
|
125
215
|
"cross-env": "^10.1.0",
|
|
@@ -127,6 +217,7 @@
|
|
|
127
217
|
"esbuild": "^0.27.7",
|
|
128
218
|
"eslint": "^9.39.4",
|
|
129
219
|
"eslint-config-prettier": "^9.1.2",
|
|
220
|
+
"js-yaml": "^5.4.2",
|
|
130
221
|
"prettier": "^3.9.4",
|
|
131
222
|
"tsup": "^8.5.1",
|
|
132
223
|
"tsx": "^4.23.0",
|