@nemesis-oss/ollama-sdk 1.4.1 → 1.5.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +23 -2
  3. package/dist/{compose-DfAqKAFj.d.ts → compose-DLStUfaF.d.ts} +2 -2
  4. package/dist/{compose-BR70yb4W.d.cts → compose-DS-UWFx8.d.cts} +2 -2
  5. package/dist/generated-api.d.cts +4 -3
  6. package/dist/generated-api.d.ts +4 -3
  7. package/dist/generated-runtime.cjs +161 -1
  8. package/dist/generated-runtime.cjs.map +1 -1
  9. package/dist/generated-runtime.d.cts +35 -2
  10. package/dist/generated-runtime.d.ts +35 -2
  11. package/dist/generated-runtime.js +160 -2
  12. package/dist/generated-runtime.js.map +1 -1
  13. package/dist/index.cjs +158 -1
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.cts +8 -8
  16. package/dist/index.d.ts +8 -8
  17. package/dist/index.js +158 -2
  18. package/dist/index.js.map +1 -1
  19. package/dist/mcp-generated.d.cts +4 -3
  20. package/dist/mcp-generated.d.ts +4 -3
  21. package/dist/mcp-http.d.cts +1 -1
  22. package/dist/mcp-http.d.ts +1 -1
  23. package/dist/mcp-stdio.d.cts +1 -1
  24. package/dist/mcp-stdio.d.ts +1 -1
  25. package/dist/{index-DIQ8NUbU.d.ts → runtime-CVQkbYgF.d.ts} +40 -2
  26. package/dist/{index-2RIErNT5.d.cts → runtime-IxRpUBjN.d.cts} +40 -2
  27. package/dist/skills.cjs.map +1 -1
  28. package/dist/skills.d.cts +3 -3
  29. package/dist/skills.d.ts +3 -3
  30. package/dist/skills.js.map +1 -1
  31. package/dist/{types-BQhgW-du.d.cts → types-5PAjLoCp.d.cts} +1 -1
  32. package/dist/{types-BQhgW-du.d.ts → types-5PAjLoCp.d.ts} +1 -1
  33. package/dist/{types-B9_axjum.d.cts → types-MOsWXEE7.d.cts} +1 -1
  34. package/dist/{types-B9_axjum.d.ts → types-MOsWXEE7.d.ts} +1 -1
  35. package/package.json +1 -1
package/dist/index.d.cts CHANGED
@@ -1,12 +1,12 @@
1
- import { F as FetchLike, M as Middleware, L as Logger, R as RequestLifecycleHook, H as HttpClient, a as OllamaStreamEvent, A as AbortableAsyncIterable, b as OllamaStreamEventType, P as ProgressStreamResult, B as BinaryBody, S as SseEvent, c as OllamaClientError, O as OllamaRuntime, C as ChatStreamResult, G as GenerateStreamResult, d as RawUsageSource, T as TokenUsage } from './index-2RIErNT5.cjs';
2
- export { D as DoneEvent, E as ErrorEvent, e as HttpBody, f as HttpClientOptions, g as HttpRequestOptions, h as LifecycleErrorEvent, i as LifecycleRetryEvent, j as LifecycleStartEvent, k as LifecycleSuccessEvent, l as LogFn, m as MessageEvent, n as MiddlewareContext, N as NANOS_PER_MS, o as NANOS_PER_SECOND, p as NOOP_LOGGER, q as NextFunction, r as OllamaAbortError, s as OllamaAgentMaxIterationsError, t as OllamaAgentMaxToolCallsError, u as OllamaAuthError, v as OllamaClientErrorOptions, w as OllamaErrorRequestContext, x as OllamaErrorResponseContext, y as OllamaGenericClientError, z as OllamaIncompatibleModelError, I as OllamaMcpError, J as OllamaModelRoutingError, K as OllamaNetworkError, Q as OllamaNotFoundError, U as OllamaQuotaExceededError, V as OllamaRateLimitError, W as OllamaServerError, X as OllamaSkillInvalidError, Y as OllamaSkillNotFoundError, Z as OllamaTimeoutError, _ as OllamaToolTimeoutError, $ as OllamaToolValidationError, a0 as OllamaUnsupportedCapabilityError, a1 as RequestContext, a2 as RequestLifecycleEvent, a3 as ResponseContext, a4 as ThinkingEvent, a5 as TokenEvent, a6 as ToolCallEvent, a7 as composeMiddleware, a8 as createConsoleLogger, a9 as extractUsage, aa as mapError, ab as parseSseStream } from './index-2RIErNT5.cjs';
3
- import { b as ThinkingMetadata, c as ModelResponse, S as ShowRequestOptions, d as ShowResponse, P as PullRequestOptions, e as ProgressResponse, f as PushRequestOptions, C as CreateRequestOptions, D as DeleteRequestOptions, g as StatusResponse, h as CopyRequestOptions, i as PsResponse, V as VersionResponse, j as ChatRequestOptions, k as ChatResponse, G as GenerateRequestOptions, l as GenerateResponse, E as EmbedRequestOptions, m as EmbedResponse, n as EmbeddingsRequestOptions, o as EmbeddingsResponse, W as WebSearchRequestOptions, p as WebSearchResponse, q as WebFetchRequestOptions, r as WebFetchResponse, T as ToolDefinition, a as ToolCall, M as Message, s as ModelOptions, t as ThinkValue } from './types-BQhgW-du.cjs';
4
- export { F as FormatOption, L as ListResponse, u as Logprob, v as LogprobToken, w as ModelDetails, R as RequestCancellationOptions, x as Role, y as ToolCallFunction, z as ToolFunctionDefinition, A as ToolParameters, B as ToolProperty, H as WebSearchResult } from './types-BQhgW-du.cjs';
1
+ import { F as FetchLike, M as Middleware, L as Logger, R as RequestLifecycleHook, H as HttpClient, c as OllamaStreamEvent, A as AbortableAsyncIterable, d as OllamaStreamEventType, P as ProgressStreamResult, B as BinaryBody, e as SseEvent, f as OllamaClientError, O as OllamaRuntime, C as ChatStreamResult, G as GenerateStreamResult, g as RawUsageSource, T as TokenUsage } from './runtime-IxRpUBjN.cjs';
2
+ export { D as DoneEvent, E as ErrorEvent, h as HttpBody, i as HttpClientOptions, j as HttpRequestOptions, k as LifecycleErrorEvent, l as LifecycleRetryEvent, m as LifecycleStartEvent, n as LifecycleSuccessEvent, o as LogFn, p as MessageEvent, q as MiddlewareContext, N as NANOS_PER_MS, r as NANOS_PER_SECOND, s as NOOP_LOGGER, t as NextFunction, u as OllamaAbortError, v as OllamaAgentMaxIterationsError, w as OllamaAgentMaxToolCallsError, x as OllamaAuthError, y as OllamaClientErrorOptions, z as OllamaErrorRequestContext, J as OllamaErrorResponseContext, K as OllamaGenericClientError, Q as OllamaIncompatibleModelError, U as OllamaMcpError, V as OllamaModelRoutingError, W as OllamaNetworkError, X as OllamaNotFoundError, Y as OllamaQuotaExceededError, Z as OllamaRateLimitError, _ as OllamaRequestValidationError, $ as OllamaServerError, a0 as OllamaSkillInvalidError, a1 as OllamaSkillNotFoundError, a2 as OllamaTimeoutError, a3 as OllamaToolTimeoutError, a4 as OllamaToolValidationError, a5 as OllamaUnsupportedCapabilityError, a6 as RequestContext, a7 as RequestLifecycleEvent, a8 as ResponseContext, a9 as ThinkingEvent, aa as TokenEvent, ab as ToolCallEvent, ac as composeMiddleware, ad as createConsoleLogger, ae as extractUsage, af as mapError, ag as parseSseStream } from './runtime-IxRpUBjN.cjs';
3
+ import { T as ThinkingMetadata, M as ModelResponse, S as ShowRequestOptions, a as ShowResponse, P as PullRequestOptions, b as ProgressResponse, c as PushRequestOptions, C as CreateRequestOptions, D as DeleteRequestOptions, d as StatusResponse, e as CopyRequestOptions, f as PsResponse, V as VersionResponse, g as ChatRequestOptions, h as ChatResponse, G as GenerateRequestOptions, i as GenerateResponse, E as EmbedRequestOptions, j as EmbedResponse, k as EmbeddingsRequestOptions, l as EmbeddingsResponse, W as WebSearchRequestOptions, m as WebSearchResponse, n as WebFetchRequestOptions, o as WebFetchResponse, p as ToolDefinition, q as ToolCall, r as Message, s as ModelOptions, t as ThinkValue } from './types-5PAjLoCp.cjs';
4
+ export { F as FormatOption, L as ListResponse, u as Logprob, v as LogprobToken, w as ModelDetails, R as RequestCancellationOptions, x as Role, y as ToolCallFunction, z as ToolFunctionDefinition, A as ToolParameters, B as ToolProperty, H as WebSearchResult } from './types-5PAjLoCp.cjs';
5
5
  import { z } from 'zod';
6
- import { T as ToolHandler, e as Tool, f as AnyTool, g as ToolRegistry, h as ToolExecutionResult } from './compose-BR70yb4W.cjs';
7
- export { A as AppliedSkillResult, b as ApplySkillOptions, P as ParsedFrontmatter, a as Skill, c as SkillFrontmatter, S as SkillSummary, i as ToolExecutionContext, j as ToolExecutionFailure, k as ToolExecutionSuccess, l as ToolRegistryOptions, d as applySkill, p as parseFrontmatter } from './compose-BR70yb4W.cjs';
8
- import { a as McpClientLike, M as McpToolDescriptor } from './types-B9_axjum.cjs';
9
- export { b as McpCallToolResult, c as McpContentBlock, d as McpIcon, e as McpListToolsParams, f as McpListToolsResult, g as McpRequestOptions, h as McpToolAnnotations, i as McpToolExecution } from './types-B9_axjum.cjs';
6
+ import { T as ToolHandler, a as Tool, A as AnyTool, b as ToolRegistry, c as ToolExecutionResult } from './compose-DS-UWFx8.cjs';
7
+ export { d as AppliedSkillResult, e as ApplySkillOptions, P as ParsedFrontmatter, S as Skill, f as SkillFrontmatter, g as SkillSummary, h as ToolExecutionContext, i as ToolExecutionFailure, j as ToolExecutionSuccess, k as ToolRegistryOptions, l as applySkill, p as parseFrontmatter } from './compose-DS-UWFx8.cjs';
8
+ import { M as McpClientLike, a as McpToolDescriptor } from './types-MOsWXEE7.cjs';
9
+ export { b as McpCallToolResult, c as McpContentBlock, d as McpIcon, e as McpListToolsParams, f as McpListToolsResult, g as McpRequestOptions, h as McpToolAnnotations, i as McpToolExecution } from './types-MOsWXEE7.cjs';
10
10
  import * as Otel from '@opentelemetry/api';
11
11
 
12
12
  /**
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { F as FetchLike, M as Middleware, L as Logger, R as RequestLifecycleHook, H as HttpClient, a as OllamaStreamEvent, A as AbortableAsyncIterable, b as OllamaStreamEventType, P as ProgressStreamResult, B as BinaryBody, S as SseEvent, c as OllamaClientError, O as OllamaRuntime, C as ChatStreamResult, G as GenerateStreamResult, d as RawUsageSource, T as TokenUsage } from './index-DIQ8NUbU.js';
2
- export { D as DoneEvent, E as ErrorEvent, e as HttpBody, f as HttpClientOptions, g as HttpRequestOptions, h as LifecycleErrorEvent, i as LifecycleRetryEvent, j as LifecycleStartEvent, k as LifecycleSuccessEvent, l as LogFn, m as MessageEvent, n as MiddlewareContext, N as NANOS_PER_MS, o as NANOS_PER_SECOND, p as NOOP_LOGGER, q as NextFunction, r as OllamaAbortError, s as OllamaAgentMaxIterationsError, t as OllamaAgentMaxToolCallsError, u as OllamaAuthError, v as OllamaClientErrorOptions, w as OllamaErrorRequestContext, x as OllamaErrorResponseContext, y as OllamaGenericClientError, z as OllamaIncompatibleModelError, I as OllamaMcpError, J as OllamaModelRoutingError, K as OllamaNetworkError, Q as OllamaNotFoundError, U as OllamaQuotaExceededError, V as OllamaRateLimitError, W as OllamaServerError, X as OllamaSkillInvalidError, Y as OllamaSkillNotFoundError, Z as OllamaTimeoutError, _ as OllamaToolTimeoutError, $ as OllamaToolValidationError, a0 as OllamaUnsupportedCapabilityError, a1 as RequestContext, a2 as RequestLifecycleEvent, a3 as ResponseContext, a4 as ThinkingEvent, a5 as TokenEvent, a6 as ToolCallEvent, a7 as composeMiddleware, a8 as createConsoleLogger, a9 as extractUsage, aa as mapError, ab as parseSseStream } from './index-DIQ8NUbU.js';
3
- import { b as ThinkingMetadata, c as ModelResponse, S as ShowRequestOptions, d as ShowResponse, P as PullRequestOptions, e as ProgressResponse, f as PushRequestOptions, C as CreateRequestOptions, D as DeleteRequestOptions, g as StatusResponse, h as CopyRequestOptions, i as PsResponse, V as VersionResponse, j as ChatRequestOptions, k as ChatResponse, G as GenerateRequestOptions, l as GenerateResponse, E as EmbedRequestOptions, m as EmbedResponse, n as EmbeddingsRequestOptions, o as EmbeddingsResponse, W as WebSearchRequestOptions, p as WebSearchResponse, q as WebFetchRequestOptions, r as WebFetchResponse, T as ToolDefinition, a as ToolCall, M as Message, s as ModelOptions, t as ThinkValue } from './types-BQhgW-du.js';
4
- export { F as FormatOption, L as ListResponse, u as Logprob, v as LogprobToken, w as ModelDetails, R as RequestCancellationOptions, x as Role, y as ToolCallFunction, z as ToolFunctionDefinition, A as ToolParameters, B as ToolProperty, H as WebSearchResult } from './types-BQhgW-du.js';
1
+ import { F as FetchLike, M as Middleware, L as Logger, R as RequestLifecycleHook, H as HttpClient, c as OllamaStreamEvent, A as AbortableAsyncIterable, d as OllamaStreamEventType, P as ProgressStreamResult, B as BinaryBody, e as SseEvent, f as OllamaClientError, O as OllamaRuntime, C as ChatStreamResult, G as GenerateStreamResult, g as RawUsageSource, T as TokenUsage } from './runtime-CVQkbYgF.js';
2
+ export { D as DoneEvent, E as ErrorEvent, h as HttpBody, i as HttpClientOptions, j as HttpRequestOptions, k as LifecycleErrorEvent, l as LifecycleRetryEvent, m as LifecycleStartEvent, n as LifecycleSuccessEvent, o as LogFn, p as MessageEvent, q as MiddlewareContext, N as NANOS_PER_MS, r as NANOS_PER_SECOND, s as NOOP_LOGGER, t as NextFunction, u as OllamaAbortError, v as OllamaAgentMaxIterationsError, w as OllamaAgentMaxToolCallsError, x as OllamaAuthError, y as OllamaClientErrorOptions, z as OllamaErrorRequestContext, J as OllamaErrorResponseContext, K as OllamaGenericClientError, Q as OllamaIncompatibleModelError, U as OllamaMcpError, V as OllamaModelRoutingError, W as OllamaNetworkError, X as OllamaNotFoundError, Y as OllamaQuotaExceededError, Z as OllamaRateLimitError, _ as OllamaRequestValidationError, $ as OllamaServerError, a0 as OllamaSkillInvalidError, a1 as OllamaSkillNotFoundError, a2 as OllamaTimeoutError, a3 as OllamaToolTimeoutError, a4 as OllamaToolValidationError, a5 as OllamaUnsupportedCapabilityError, a6 as RequestContext, a7 as RequestLifecycleEvent, a8 as ResponseContext, a9 as ThinkingEvent, aa as TokenEvent, ab as ToolCallEvent, ac as composeMiddleware, ad as createConsoleLogger, ae as extractUsage, af as mapError, ag as parseSseStream } from './runtime-CVQkbYgF.js';
3
+ import { T as ThinkingMetadata, M as ModelResponse, S as ShowRequestOptions, a as ShowResponse, P as PullRequestOptions, b as ProgressResponse, c as PushRequestOptions, C as CreateRequestOptions, D as DeleteRequestOptions, d as StatusResponse, e as CopyRequestOptions, f as PsResponse, V as VersionResponse, g as ChatRequestOptions, h as ChatResponse, G as GenerateRequestOptions, i as GenerateResponse, E as EmbedRequestOptions, j as EmbedResponse, k as EmbeddingsRequestOptions, l as EmbeddingsResponse, W as WebSearchRequestOptions, m as WebSearchResponse, n as WebFetchRequestOptions, o as WebFetchResponse, p as ToolDefinition, q as ToolCall, r as Message, s as ModelOptions, t as ThinkValue } from './types-5PAjLoCp.js';
4
+ export { F as FormatOption, L as ListResponse, u as Logprob, v as LogprobToken, w as ModelDetails, R as RequestCancellationOptions, x as Role, y as ToolCallFunction, z as ToolFunctionDefinition, A as ToolParameters, B as ToolProperty, H as WebSearchResult } from './types-5PAjLoCp.js';
5
5
  import { z } from 'zod';
6
- import { T as ToolHandler, e as Tool, f as AnyTool, g as ToolRegistry, h as ToolExecutionResult } from './compose-DfAqKAFj.js';
7
- export { A as AppliedSkillResult, b as ApplySkillOptions, P as ParsedFrontmatter, a as Skill, c as SkillFrontmatter, S as SkillSummary, i as ToolExecutionContext, j as ToolExecutionFailure, k as ToolExecutionSuccess, l as ToolRegistryOptions, d as applySkill, p as parseFrontmatter } from './compose-DfAqKAFj.js';
8
- import { a as McpClientLike, M as McpToolDescriptor } from './types-B9_axjum.js';
9
- export { b as McpCallToolResult, c as McpContentBlock, d as McpIcon, e as McpListToolsParams, f as McpListToolsResult, g as McpRequestOptions, h as McpToolAnnotations, i as McpToolExecution } from './types-B9_axjum.js';
6
+ import { T as ToolHandler, a as Tool, A as AnyTool, b as ToolRegistry, c as ToolExecutionResult } from './compose-DLStUfaF.js';
7
+ export { d as AppliedSkillResult, e as ApplySkillOptions, P as ParsedFrontmatter, S as Skill, f as SkillFrontmatter, g as SkillSummary, h as ToolExecutionContext, i as ToolExecutionFailure, j as ToolExecutionSuccess, k as ToolRegistryOptions, l as applySkill, p as parseFrontmatter } from './compose-DLStUfaF.js';
8
+ import { M as McpClientLike, a as McpToolDescriptor } from './types-MOsWXEE7.js';
9
+ export { b as McpCallToolResult, c as McpContentBlock, d as McpIcon, e as McpListToolsParams, f as McpListToolsResult, g as McpRequestOptions, h as McpToolAnnotations, i as McpToolExecution } from './types-MOsWXEE7.js';
10
10
  import * as Otel from '@opentelemetry/api';
11
11
 
12
12
  /**
package/dist/index.js CHANGED
@@ -173,6 +173,15 @@ var OllamaToolValidationError = class extends OllamaClientError {
173
173
  this.issues = options.issues;
174
174
  }
175
175
  };
176
+ var OllamaRequestValidationError = class extends OllamaClientError {
177
+ operationId;
178
+ issues;
179
+ constructor(message, options) {
180
+ super(message, { ...options, code: "request_validation_error", retryable: false });
181
+ this.operationId = options.operationId;
182
+ this.issues = options.issues;
183
+ }
184
+ };
176
185
  var OllamaToolTimeoutError = class extends OllamaClientError {
177
186
  toolName;
178
187
  timeoutMs;
@@ -2737,6 +2746,136 @@ var AnthropicCompatClient = class {
2737
2746
  return this.createMessage(request, signal);
2738
2747
  }
2739
2748
  };
2749
+ var ToolCallSchema = z.object({
2750
+ function: z.object({
2751
+ name: z.string(),
2752
+ description: z.string().optional(),
2753
+ arguments: z.object({}).optional()
2754
+ }).optional()
2755
+ });
2756
+
2757
+ // src/generated/models/ChatMessage.schema.ts
2758
+ var ChatMessageSchema = z.object({
2759
+ role: z.enum(["system", "user", "assistant", "tool"]),
2760
+ content: z.string(),
2761
+ images: z.array(z.string()).optional(),
2762
+ tool_calls: z.array(ToolCallSchema).optional()
2763
+ });
2764
+ var ModelOptionsSchema = z.object({
2765
+ seed: z.number().optional(),
2766
+ temperature: z.number().optional(),
2767
+ top_k: z.number().optional(),
2768
+ top_p: z.number().optional(),
2769
+ min_p: z.number().optional(),
2770
+ stop: z.union([z.string(), z.array(z.string())]).optional(),
2771
+ num_ctx: z.number().optional(),
2772
+ num_predict: z.number().optional()
2773
+ }).catchall(z.unknown());
2774
+ var ThinkValueSchema = z.union([z.boolean(), z.string(), z.null()]);
2775
+ var ToolDefinitionSchema = z.object({
2776
+ type: z.enum(["function"]),
2777
+ function: z.object({
2778
+ name: z.string(),
2779
+ description: z.string().optional(),
2780
+ parameters: z.object({})
2781
+ })
2782
+ });
2783
+
2784
+ // src/generated/models/ChatRequest.schema.ts
2785
+ var ChatRequestSchema = z.object({
2786
+ model: z.string(),
2787
+ messages: z.array(ChatMessageSchema),
2788
+ tools: z.array(ToolDefinitionSchema).optional(),
2789
+ format: z.union([z.enum(["json"]), z.object({})]).optional(),
2790
+ options: ModelOptionsSchema.optional(),
2791
+ stream: z.boolean().optional(),
2792
+ think: ThinkValueSchema.optional(),
2793
+ keep_alive: z.union([z.string(), z.number()]).optional(),
2794
+ logprobs: z.boolean().optional(),
2795
+ top_logprobs: z.number().optional()
2796
+ });
2797
+ var GenerateRequestSchema = z.object({
2798
+ model: z.string(),
2799
+ prompt: z.string().optional(),
2800
+ suffix: z.string().optional(),
2801
+ images: z.array(z.string()).optional(),
2802
+ format: z.union([z.string(), z.object({})]).optional(),
2803
+ system: z.string().optional(),
2804
+ stream: z.boolean().optional(),
2805
+ think: ThinkValueSchema.optional(),
2806
+ raw: z.boolean().optional(),
2807
+ keep_alive: z.union([z.string(), z.number()]).optional(),
2808
+ options: ModelOptionsSchema.optional(),
2809
+ logprobs: z.boolean().optional(),
2810
+ top_logprobs: z.number().optional()
2811
+ });
2812
+ var EmbedRequestSchema = z.object({
2813
+ model: z.string(),
2814
+ input: z.union([z.string(), z.array(z.string())]),
2815
+ truncate: z.boolean().optional(),
2816
+ dimensions: z.number().optional(),
2817
+ keep_alive: z.string().optional(),
2818
+ options: ModelOptionsSchema.optional()
2819
+ });
2820
+ var CreateRequestSchema = z.object({
2821
+ model: z.string(),
2822
+ from: z.string().optional(),
2823
+ template: z.string().optional(),
2824
+ renderer: z.string().optional(),
2825
+ parser: z.string().optional(),
2826
+ files: z.object({}).catchall(z.string()).optional(),
2827
+ draft_files: z.object({}).catchall(z.string()).optional(),
2828
+ license: z.union([z.string(), z.array(z.string())]).optional(),
2829
+ system: z.string().optional(),
2830
+ parameters: z.object({}).optional(),
2831
+ messages: z.array(ChatMessageSchema).optional(),
2832
+ quantize: z.string().optional(),
2833
+ draft_quantize: z.string().optional(),
2834
+ requires: z.string().optional(),
2835
+ stream: z.boolean().optional()
2836
+ });
2837
+ var CopyRequestSchema = z.object({
2838
+ source: z.string(),
2839
+ destination: z.string()
2840
+ });
2841
+ var DeleteRequestSchema = z.object({
2842
+ model: z.string()
2843
+ });
2844
+ var PullRequestSchema = z.object({
2845
+ model: z.string(),
2846
+ insecure: z.boolean().optional(),
2847
+ stream: z.boolean().optional()
2848
+ });
2849
+ var PushRequestSchema = z.object({
2850
+ model: z.string(),
2851
+ insecure: z.boolean().optional(),
2852
+ stream: z.boolean().optional()
2853
+ });
2854
+ var ShowRequestSchema = z.object({
2855
+ model: z.string(),
2856
+ verbose: z.boolean().optional()
2857
+ });
2858
+
2859
+ // src/generated/runtime/schema-registry.ts
2860
+ var requestSchemas = {
2861
+ chat: ChatRequestSchema,
2862
+ generate: GenerateRequestSchema,
2863
+ embed: EmbedRequestSchema,
2864
+ create: CreateRequestSchema,
2865
+ copy: CopyRequestSchema,
2866
+ delete: DeleteRequestSchema,
2867
+ pull: PullRequestSchema,
2868
+ push: PushRequestSchema,
2869
+ show: ShowRequestSchema
2870
+ // Operations without a registered request schema (blobs, ps, tags,
2871
+ // version, systemOne, openai*, anthropic*) skip validation. This is
2872
+ // deliberate — the OpenAPI spec doesn't define request bodies for
2873
+ // GET/HEAD operations, and the compat-surface request schemas (OpenAI,
2874
+ // Anthropic) are richer than what the IR currently models.
2875
+ };
2876
+ function getRequestSchema(operationId) {
2877
+ return requestSchemas[operationId];
2878
+ }
2740
2879
 
2741
2880
  // src/generated/runtime/runtime.ts
2742
2881
  function compareVersions(a, b) {
@@ -2792,7 +2931,24 @@ var OllamaRuntime = class {
2792
2931
  */
2793
2932
  async invoke(req) {
2794
2933
  assertOperationAllowed(req.operation, this.options);
2795
- const body = buildBody(req);
2934
+ let body = buildBody(req);
2935
+ if (this.options.validateRequests === true && body !== void 0) {
2936
+ const schema = getRequestSchema(req.operation.operationId);
2937
+ if (schema) {
2938
+ const result = schema.safeParse(body);
2939
+ if (!result.success) {
2940
+ throw new OllamaRequestValidationError(
2941
+ `Request validation failed for operation "${req.operation.operationId}" (${req.operation.method} ${req.operation.path}): ` + result.error.issues.map((i) => `${i.path.join(".") || "<root>"}: ${i.message}`).join("; "),
2942
+ {
2943
+ operationId: req.operation.operationId,
2944
+ issues: result.error.issues,
2945
+ request: { method: req.operation.method, url: req.operation.path }
2946
+ }
2947
+ );
2948
+ }
2949
+ body = result.data;
2950
+ }
2951
+ }
2796
2952
  const streaming = shouldStream(req);
2797
2953
  const httpReq = {
2798
2954
  path: req.operation.path,
@@ -4214,6 +4370,6 @@ var Agent = class {
4214
4370
  }
4215
4371
  };
4216
4372
 
4217
- export { ATTR_GEN_AI_OPERATION_NAME, ATTR_GEN_AI_REQUEST_MODEL, ATTR_GEN_AI_RESPONSE_MODEL, ATTR_GEN_AI_SYSTEM, ATTR_GEN_AI_TOOL_CALL_ID, ATTR_GEN_AI_TOOL_NAME, ATTR_GEN_AI_USAGE_INPUT_TOKENS, ATTR_GEN_AI_USAGE_OUTPUT_TOKENS, ATTR_HTTP_REQUEST_METHOD, ATTR_HTTP_RESPONSE_STATUS_CODE, ATTR_OLLAMA_AGENT_ITERATION, ATTR_OLLAMA_AGENT_MAX_ITERATIONS, ATTR_OLLAMA_ENDPOINT_ATTEMPT, ATTR_OLLAMA_ENDPOINT_NAME, ATTR_SERVER_ADDRESS, ATTR_SERVER_PORT, ATTR_URL_FULL, Agent, AnthropicCompatClient, AnthropicMessagesStream, DEFAULT_BACKOFF, DEFAULT_BASE_URL, DEFAULT_FAILOVER_CODES, DEFAULT_RETRY_CONFIG, DEFAULT_TIMEOUT_MS, EndpointRegistry, GEN_AI_SYSTEM_OLLAMA, HttpClient, McpBridge, ModelsClient, NANOS_PER_MS, NANOS_PER_SECOND, NOOP_LOGGER, OLLAMA_CLOUD_BASE_URL, OllamaAbortError, OllamaAgentMaxIterationsError, OllamaAgentMaxToolCallsError, OllamaAuthError, OllamaClient, OllamaClientError, OllamaGenericClientError, OllamaIncompatibleModelError, OllamaMcpError, OllamaModelRoutingError, OllamaNetworkError, OllamaNotFoundError, OllamaQuotaExceededError, OllamaRateLimitError, OllamaServerError, OllamaSkillInvalidError, OllamaSkillNotFoundError, OllamaStream, OllamaTimeoutError, OllamaToolTimeoutError, OllamaToolValidationError, OllamaUnsupportedCapabilityError, OpenAIChatCompletionStream, OpenAICompatClient, OpenAICompletionStream, OpenAIResponsesStream, OpenAIResponsesStreamError, QuotaManager, ToolRegistry, addSpanEvent, applySkill, calculateBackoff, checkEndpointHealth, composeMiddleware, createConsoleLogger, createOllamaCloudFreeTierQuota, createTimeoutSignal, defineTool, detectModelCapabilities, encodeImage, extractUsage, inferRuntimeMode, listAllMcpTools, listAvailableModels, loadMcpTools, mapError, normalizeChatStream, normalizeGenerateStream, normalizeProgressStream, parseFrontmatter, parseNdjsonStream, parseSseStream, parseStructuredOutput, registerMcpTools, resolveCredentialEndpoints, setSpanError, toDataStream, toResponse, toTextStream, withRetry, withSpan, zodToJsonSchema };
4373
+ export { ATTR_GEN_AI_OPERATION_NAME, ATTR_GEN_AI_REQUEST_MODEL, ATTR_GEN_AI_RESPONSE_MODEL, ATTR_GEN_AI_SYSTEM, ATTR_GEN_AI_TOOL_CALL_ID, ATTR_GEN_AI_TOOL_NAME, ATTR_GEN_AI_USAGE_INPUT_TOKENS, ATTR_GEN_AI_USAGE_OUTPUT_TOKENS, ATTR_HTTP_REQUEST_METHOD, ATTR_HTTP_RESPONSE_STATUS_CODE, ATTR_OLLAMA_AGENT_ITERATION, ATTR_OLLAMA_AGENT_MAX_ITERATIONS, ATTR_OLLAMA_ENDPOINT_ATTEMPT, ATTR_OLLAMA_ENDPOINT_NAME, ATTR_SERVER_ADDRESS, ATTR_SERVER_PORT, ATTR_URL_FULL, Agent, AnthropicCompatClient, AnthropicMessagesStream, DEFAULT_BACKOFF, DEFAULT_BASE_URL, DEFAULT_FAILOVER_CODES, DEFAULT_RETRY_CONFIG, DEFAULT_TIMEOUT_MS, EndpointRegistry, GEN_AI_SYSTEM_OLLAMA, HttpClient, McpBridge, ModelsClient, NANOS_PER_MS, NANOS_PER_SECOND, NOOP_LOGGER, OLLAMA_CLOUD_BASE_URL, OllamaAbortError, OllamaAgentMaxIterationsError, OllamaAgentMaxToolCallsError, OllamaAuthError, OllamaClient, OllamaClientError, OllamaGenericClientError, OllamaIncompatibleModelError, OllamaMcpError, OllamaModelRoutingError, OllamaNetworkError, OllamaNotFoundError, OllamaQuotaExceededError, OllamaRateLimitError, OllamaRequestValidationError, OllamaServerError, OllamaSkillInvalidError, OllamaSkillNotFoundError, OllamaStream, OllamaTimeoutError, OllamaToolTimeoutError, OllamaToolValidationError, OllamaUnsupportedCapabilityError, OpenAIChatCompletionStream, OpenAICompatClient, OpenAICompletionStream, OpenAIResponsesStream, OpenAIResponsesStreamError, QuotaManager, ToolRegistry, addSpanEvent, applySkill, calculateBackoff, checkEndpointHealth, composeMiddleware, createConsoleLogger, createOllamaCloudFreeTierQuota, createTimeoutSignal, defineTool, detectModelCapabilities, encodeImage, extractUsage, inferRuntimeMode, listAllMcpTools, listAvailableModels, loadMcpTools, mapError, normalizeChatStream, normalizeGenerateStream, normalizeProgressStream, parseFrontmatter, parseNdjsonStream, parseSseStream, parseStructuredOutput, registerMcpTools, resolveCredentialEndpoints, setSpanError, toDataStream, toResponse, toTextStream, withRetry, withSpan, zodToJsonSchema };
4218
4374
  //# sourceMappingURL=index.js.map
4219
4375
  //# sourceMappingURL=index.js.map