@juspay/neurolink 7.53.3 → 7.53.5

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 (52) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +1 -0
  3. package/dist/cli/commands/config.d.ts +18 -18
  4. package/dist/cli/loop/optionsSchema.js +5 -0
  5. package/dist/core/baseProvider.js +19 -4
  6. package/dist/index.d.ts +1 -1
  7. package/dist/lib/agent/directTools.d.ts +3 -3
  8. package/dist/lib/core/baseProvider.js +19 -4
  9. package/dist/lib/index.d.ts +1 -1
  10. package/dist/lib/neurolink.js +2 -0
  11. package/dist/lib/providers/sagemaker/language-model.d.ts +2 -2
  12. package/dist/lib/types/common.d.ts +5 -5
  13. package/dist/lib/types/generateTypes.d.ts +3 -0
  14. package/dist/lib/types/modelTypes.d.ts +31 -14
  15. package/dist/lib/types/tools.d.ts +16 -1
  16. package/dist/lib/types/utilities.d.ts +131 -0
  17. package/dist/lib/types/utilities.js +1 -1
  18. package/dist/lib/utils/errorHandling.d.ts +2 -28
  19. package/dist/lib/utils/errorHandling.js +1 -20
  20. package/dist/lib/utils/logger.d.ts +2 -23
  21. package/dist/lib/utils/modelRouter.d.ts +1 -17
  22. package/dist/lib/utils/optionsConversion.d.ts +0 -5
  23. package/dist/lib/utils/optionsUtils.d.ts +1 -70
  24. package/dist/lib/utils/parameterValidation.d.ts +9 -22
  25. package/dist/lib/utils/performance.d.ts +1 -13
  26. package/dist/lib/utils/promptRedaction.d.ts +1 -8
  27. package/dist/lib/utils/providerUtils.d.ts +2 -10
  28. package/dist/lib/utils/redis.d.ts +1 -1
  29. package/dist/lib/utils/redis.js +0 -1
  30. package/dist/lib/utils/retryHandler.d.ts +1 -8
  31. package/dist/neurolink.js +2 -0
  32. package/dist/providers/sagemaker/language-model.d.ts +2 -2
  33. package/dist/types/common.d.ts +5 -5
  34. package/dist/types/generateTypes.d.ts +3 -0
  35. package/dist/types/modelTypes.d.ts +17 -0
  36. package/dist/types/tools.d.ts +16 -1
  37. package/dist/types/utilities.d.ts +131 -0
  38. package/dist/types/utilities.js +1 -1
  39. package/dist/utils/errorHandling.d.ts +2 -28
  40. package/dist/utils/errorHandling.js +1 -20
  41. package/dist/utils/logger.d.ts +2 -23
  42. package/dist/utils/modelRouter.d.ts +1 -17
  43. package/dist/utils/optionsConversion.d.ts +0 -5
  44. package/dist/utils/optionsUtils.d.ts +1 -70
  45. package/dist/utils/parameterValidation.d.ts +9 -22
  46. package/dist/utils/performance.d.ts +1 -13
  47. package/dist/utils/promptRedaction.d.ts +1 -8
  48. package/dist/utils/providerUtils.d.ts +2 -10
  49. package/dist/utils/redis.d.ts +1 -1
  50. package/dist/utils/redis.js +0 -1
  51. package/dist/utils/retryHandler.d.ts +1 -8
  52. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [7.53.5](https://github.com/juspay/neurolink/compare/v7.53.4...v7.53.5) (2025-11-06)
2
+
3
+ ## [7.53.4](https://github.com/juspay/neurolink/compare/v7.53.3...v7.53.4) (2025-11-05)
4
+
5
+ ### Bug Fixes
6
+
7
+ - **(sdk):** structured object response in generate function ([f16d597](https://github.com/juspay/neurolink/commit/f16d597f8e9a64f24a7a6ad5344c93add524c23d))
8
+
1
9
  ## [7.53.3](https://github.com/juspay/neurolink/compare/v7.53.2...v7.53.3) (2025-11-03)
2
10
 
3
11
  ## [7.53.2](https://github.com/juspay/neurolink/compare/v7.53.1...v7.53.2) (2025-10-28)
package/README.md CHANGED
@@ -25,6 +25,7 @@ Extracted from production systems at Juspay and battle-tested at enterprise scal
25
25
 
26
26
  ## What's New (Q4 2025)
27
27
 
28
+ - **Structured Output with Zod Schemas** – Type-safe JSON generation with automatic validation using `schema` + `output.format: "json"` in `generate()`. → [Structured Output Guide](docs/features/structured-output.md)
28
29
  - **CSV File Support** – Attach CSV files to prompts for AI-powered data analysis with auto-detection. → [CSV Guide](docs/features/multimodal-chat.md#csv-file-support)
29
30
  - **PDF File Support** – Process PDF documents with native visual analysis for Vertex AI, Anthropic, Bedrock, AI Studio. → [PDF Guide](docs/features/pdf-support.md)
30
31
  - **LiteLLM Integration** – Access 100+ AI models from all major providers through unified interface. → [Setup Guide](docs/LITELLM-INTEGRATION.md)
@@ -18,9 +18,9 @@ declare const ConfigSchema: z.ZodObject<{
18
18
  apiKey?: string | undefined;
19
19
  baseURL?: string | undefined;
20
20
  }, {
21
- model?: string | undefined;
22
21
  apiKey?: string | undefined;
23
22
  baseURL?: string | undefined;
23
+ model?: string | undefined;
24
24
  }>>;
25
25
  bedrock: z.ZodOptional<z.ZodObject<{
26
26
  region: z.ZodOptional<z.ZodString>;
@@ -73,8 +73,8 @@ declare const ConfigSchema: z.ZodObject<{
73
73
  model: string;
74
74
  apiKey?: string | undefined;
75
75
  }, {
76
- model?: string | undefined;
77
76
  apiKey?: string | undefined;
77
+ model?: string | undefined;
78
78
  }>>;
79
79
  azure: z.ZodOptional<z.ZodObject<{
80
80
  apiKey: z.ZodOptional<z.ZodString>;
@@ -87,8 +87,8 @@ declare const ConfigSchema: z.ZodObject<{
87
87
  endpoint?: string | undefined;
88
88
  deploymentId?: string | undefined;
89
89
  }, {
90
- model?: string | undefined;
91
90
  apiKey?: string | undefined;
91
+ model?: string | undefined;
92
92
  endpoint?: string | undefined;
93
93
  deploymentId?: string | undefined;
94
94
  }>>;
@@ -99,8 +99,8 @@ declare const ConfigSchema: z.ZodObject<{
99
99
  model: string;
100
100
  apiKey?: string | undefined;
101
101
  }, {
102
- model?: string | undefined;
103
102
  apiKey?: string | undefined;
103
+ model?: string | undefined;
104
104
  }>>;
105
105
  huggingface: z.ZodOptional<z.ZodObject<{
106
106
  apiKey: z.ZodOptional<z.ZodString>;
@@ -109,8 +109,8 @@ declare const ConfigSchema: z.ZodObject<{
109
109
  model: string;
110
110
  apiKey?: string | undefined;
111
111
  }, {
112
- model?: string | undefined;
113
112
  apiKey?: string | undefined;
113
+ model?: string | undefined;
114
114
  }>>;
115
115
  ollama: z.ZodOptional<z.ZodObject<{
116
116
  baseUrl: z.ZodDefault<z.ZodString>;
@@ -132,8 +132,8 @@ declare const ConfigSchema: z.ZodObject<{
132
132
  model: string;
133
133
  apiKey?: string | undefined;
134
134
  }, {
135
- model?: string | undefined;
136
135
  apiKey?: string | undefined;
136
+ model?: string | undefined;
137
137
  }>>;
138
138
  }, "strip", z.ZodTypeAny, {
139
139
  bedrock?: {
@@ -193,9 +193,9 @@ declare const ConfigSchema: z.ZodObject<{
193
193
  sessionToken?: string | undefined;
194
194
  } | undefined;
195
195
  openai?: {
196
- model?: string | undefined;
197
196
  apiKey?: string | undefined;
198
197
  baseURL?: string | undefined;
198
+ model?: string | undefined;
199
199
  } | undefined;
200
200
  vertex?: {
201
201
  model?: string | undefined;
@@ -207,22 +207,22 @@ declare const ConfigSchema: z.ZodObject<{
207
207
  privateKey?: string | undefined;
208
208
  } | undefined;
209
209
  anthropic?: {
210
- model?: string | undefined;
211
210
  apiKey?: string | undefined;
211
+ model?: string | undefined;
212
212
  } | undefined;
213
213
  azure?: {
214
- model?: string | undefined;
215
214
  apiKey?: string | undefined;
215
+ model?: string | undefined;
216
216
  endpoint?: string | undefined;
217
217
  deploymentId?: string | undefined;
218
218
  } | undefined;
219
219
  "google-ai"?: {
220
- model?: string | undefined;
221
220
  apiKey?: string | undefined;
221
+ model?: string | undefined;
222
222
  } | undefined;
223
223
  huggingface?: {
224
- model?: string | undefined;
225
224
  apiKey?: string | undefined;
225
+ model?: string | undefined;
226
226
  } | undefined;
227
227
  ollama?: {
228
228
  timeout?: number | undefined;
@@ -230,8 +230,8 @@ declare const ConfigSchema: z.ZodObject<{
230
230
  baseUrl?: string | undefined;
231
231
  } | undefined;
232
232
  mistral?: {
233
- model?: string | undefined;
234
233
  apiKey?: string | undefined;
234
+ model?: string | undefined;
235
235
  } | undefined;
236
236
  }>>;
237
237
  profiles: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>;
@@ -562,9 +562,9 @@ declare const ConfigSchema: z.ZodObject<{
562
562
  sessionToken?: string | undefined;
563
563
  } | undefined;
564
564
  openai?: {
565
- model?: string | undefined;
566
565
  apiKey?: string | undefined;
567
566
  baseURL?: string | undefined;
567
+ model?: string | undefined;
568
568
  } | undefined;
569
569
  vertex?: {
570
570
  model?: string | undefined;
@@ -576,22 +576,22 @@ declare const ConfigSchema: z.ZodObject<{
576
576
  privateKey?: string | undefined;
577
577
  } | undefined;
578
578
  anthropic?: {
579
- model?: string | undefined;
580
579
  apiKey?: string | undefined;
580
+ model?: string | undefined;
581
581
  } | undefined;
582
582
  azure?: {
583
- model?: string | undefined;
584
583
  apiKey?: string | undefined;
584
+ model?: string | undefined;
585
585
  endpoint?: string | undefined;
586
586
  deploymentId?: string | undefined;
587
587
  } | undefined;
588
588
  "google-ai"?: {
589
- model?: string | undefined;
590
589
  apiKey?: string | undefined;
590
+ model?: string | undefined;
591
591
  } | undefined;
592
592
  huggingface?: {
593
- model?: string | undefined;
594
593
  apiKey?: string | undefined;
594
+ model?: string | undefined;
595
595
  } | undefined;
596
596
  ollama?: {
597
597
  timeout?: number | undefined;
@@ -599,8 +599,8 @@ declare const ConfigSchema: z.ZodObject<{
599
599
  baseUrl?: string | undefined;
600
600
  } | undefined;
601
601
  mistral?: {
602
- model?: string | undefined;
603
602
  apiKey?: string | undefined;
603
+ model?: string | undefined;
604
604
  } | undefined;
605
605
  } | undefined;
606
606
  defaultProvider?: "bedrock" | "openai" | "vertex" | "anthropic" | "azure" | "google-ai" | "huggingface" | "ollama" | "mistral" | "auto" | undefined;
@@ -24,6 +24,11 @@ export const textGenerationOptionsSchema = {
24
24
  type: "number",
25
25
  description: "The maximum number of tokens to generate.",
26
26
  },
27
+ output: {
28
+ type: "string",
29
+ description: "AI response format - specify just the format value (e.g., 'json', 'structured'). Note: This is automatically transformed to { format: value } for the API.",
30
+ allowedValues: ["text", "json", "structured", "none"],
31
+ },
27
32
  systemPrompt: {
28
33
  type: "string",
29
34
  description: "The system prompt to guide the AI's behavior.",
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { generateText, tool as createAISDKTool, jsonSchema } from "ai";
2
+ import { generateText, tool as createAISDKTool, jsonSchema, Output } from "ai";
3
3
  import { AIProviderName } from "../constants/enums.js";
4
4
  import { MiddlewareFactory } from "../middleware/factory.js";
5
5
  import { logger } from "../utils/logger.js";
@@ -301,6 +301,9 @@ export class BaseProvider {
301
301
  */
302
302
  async executeGeneration(model, messages, tools, options) {
303
303
  const shouldUseTools = !options.disableTools && this.supportsTools();
304
+ const useStructuredOutput = !!options.schema &&
305
+ (options.output?.format === "json" ||
306
+ options.output?.format === "structured");
304
307
  return await generateText({
305
308
  model,
306
309
  messages,
@@ -309,6 +312,10 @@ export class BaseProvider {
309
312
  toolChoice: shouldUseTools ? "auto" : "none",
310
313
  temperature: options.temperature,
311
314
  maxTokens: options.maxTokens,
315
+ ...(useStructuredOutput &&
316
+ options.schema && {
317
+ experimental_output: Output.object({ schema: options.schema }),
318
+ }),
312
319
  experimental_telemetry: this.getStreamTelemetryConfig(options, "generate"),
313
320
  onStepFinish: ({ toolCalls, toolResults }) => {
314
321
  logger.info("Tool execution completed", { toolResults, toolCalls });
@@ -439,9 +446,17 @@ export class BaseProvider {
439
446
  /**
440
447
  * Format the enhanced result
441
448
  */
442
- formatEnhancedResult(generateResult, tools, toolsUsed, toolExecutions) {
449
+ formatEnhancedResult(generateResult, tools, toolsUsed, toolExecutions, options) {
450
+ // Only access experimental_output if we set a schema
451
+ // (accessing it when not set throws an error)
452
+ const useStructuredOutput = !!options.schema &&
453
+ (options.output?.format === "json" ||
454
+ options.output?.format === "structured");
455
+ const content = useStructuredOutput
456
+ ? JSON.stringify(generateResult.experimental_output)
457
+ : generateResult.text;
443
458
  return {
444
- content: generateResult.text,
459
+ content,
445
460
  usage: {
446
461
  input: generateResult.usage?.promptTokens || 0,
447
462
  output: generateResult.usage?.completionTokens || 0,
@@ -579,7 +594,7 @@ export class BaseProvider {
579
594
  const responseTime = Date.now() - startTime;
580
595
  await this.recordPerformanceMetrics(generateResult.usage, responseTime);
581
596
  const { toolsUsed, toolExecutions } = this.extractToolInformation(generateResult);
582
- const enhancedResult = this.formatEnhancedResult(generateResult, tools, toolsUsed, toolExecutions);
597
+ const enhancedResult = this.formatEnhancedResult(generateResult, tools, toolsUsed, toolExecutions, options);
583
598
  return await this.enhanceResult(enhancedResult, options, startTime);
584
599
  }
585
600
  catch (error) {
package/dist/index.d.ts CHANGED
@@ -86,7 +86,7 @@ export declare function createBestAIProvider(requestedProvider?: string, modelNa
86
86
  export { initializeMCPEcosystem, listMCPs, executeMCP, getMCPStats, mcpLogger, } from "./mcp/index.js";
87
87
  export type { McpMetadata, DiscoveredMcp } from "./types/mcpTypes.js";
88
88
  export type { ExecutionContext, ToolInfo, ToolExecutionResult, } from "./types/tools.js";
89
- export type { LogLevel } from "./utils/logger.js";
89
+ export type { LogLevel } from "./types/utilities.js";
90
90
  export declare function initializeTelemetry(): Promise<boolean>;
91
91
  export declare function getTelemetryStatus(): Promise<{
92
92
  enabled: boolean;
@@ -352,13 +352,13 @@ export declare const directAgentTools: {
352
352
  column: z.ZodDefault<z.ZodOptional<z.ZodString>>;
353
353
  maxRows: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
354
354
  }, "strip", z.ZodTypeAny, {
355
+ operation: "count_by_column" | "sum_by_column" | "average_by_column" | "min_max_by_column" | "describe";
355
356
  maxRows: number;
356
357
  filePath: string;
357
- operation: "count_by_column" | "sum_by_column" | "average_by_column" | "min_max_by_column" | "describe";
358
358
  column: string;
359
359
  }, {
360
- filePath: string;
361
360
  operation: "count_by_column" | "sum_by_column" | "average_by_column" | "min_max_by_column" | "describe";
361
+ filePath: string;
362
362
  maxRows?: number | undefined;
363
363
  column?: string | undefined;
364
364
  }>, {
@@ -379,9 +379,9 @@ export declare const directAgentTools: {
379
379
  column: string;
380
380
  }> & {
381
381
  execute: (args: {
382
+ operation: "count_by_column" | "sum_by_column" | "average_by_column" | "min_max_by_column" | "describe";
382
383
  maxRows: number;
383
384
  filePath: string;
384
- operation: "count_by_column" | "sum_by_column" | "average_by_column" | "min_max_by_column" | "describe";
385
385
  column: string;
386
386
  }, options: import("ai").ToolExecutionOptions) => PromiseLike<{
387
387
  success: boolean;
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { generateText, tool as createAISDKTool, jsonSchema } from "ai";
2
+ import { generateText, tool as createAISDKTool, jsonSchema, Output } from "ai";
3
3
  import { AIProviderName } from "../constants/enums.js";
4
4
  import { MiddlewareFactory } from "../middleware/factory.js";
5
5
  import { logger } from "../utils/logger.js";
@@ -301,6 +301,9 @@ export class BaseProvider {
301
301
  */
302
302
  async executeGeneration(model, messages, tools, options) {
303
303
  const shouldUseTools = !options.disableTools && this.supportsTools();
304
+ const useStructuredOutput = !!options.schema &&
305
+ (options.output?.format === "json" ||
306
+ options.output?.format === "structured");
304
307
  return await generateText({
305
308
  model,
306
309
  messages,
@@ -309,6 +312,10 @@ export class BaseProvider {
309
312
  toolChoice: shouldUseTools ? "auto" : "none",
310
313
  temperature: options.temperature,
311
314
  maxTokens: options.maxTokens,
315
+ ...(useStructuredOutput &&
316
+ options.schema && {
317
+ experimental_output: Output.object({ schema: options.schema }),
318
+ }),
312
319
  experimental_telemetry: this.getStreamTelemetryConfig(options, "generate"),
313
320
  onStepFinish: ({ toolCalls, toolResults }) => {
314
321
  logger.info("Tool execution completed", { toolResults, toolCalls });
@@ -439,9 +446,17 @@ export class BaseProvider {
439
446
  /**
440
447
  * Format the enhanced result
441
448
  */
442
- formatEnhancedResult(generateResult, tools, toolsUsed, toolExecutions) {
449
+ formatEnhancedResult(generateResult, tools, toolsUsed, toolExecutions, options) {
450
+ // Only access experimental_output if we set a schema
451
+ // (accessing it when not set throws an error)
452
+ const useStructuredOutput = !!options.schema &&
453
+ (options.output?.format === "json" ||
454
+ options.output?.format === "structured");
455
+ const content = useStructuredOutput
456
+ ? JSON.stringify(generateResult.experimental_output)
457
+ : generateResult.text;
443
458
  return {
444
- content: generateResult.text,
459
+ content,
445
460
  usage: {
446
461
  input: generateResult.usage?.promptTokens || 0,
447
462
  output: generateResult.usage?.completionTokens || 0,
@@ -579,7 +594,7 @@ export class BaseProvider {
579
594
  const responseTime = Date.now() - startTime;
580
595
  await this.recordPerformanceMetrics(generateResult.usage, responseTime);
581
596
  const { toolsUsed, toolExecutions } = this.extractToolInformation(generateResult);
582
- const enhancedResult = this.formatEnhancedResult(generateResult, tools, toolsUsed, toolExecutions);
597
+ const enhancedResult = this.formatEnhancedResult(generateResult, tools, toolsUsed, toolExecutions, options);
583
598
  return await this.enhanceResult(enhancedResult, options, startTime);
584
599
  }
585
600
  catch (error) {
@@ -86,7 +86,7 @@ export declare function createBestAIProvider(requestedProvider?: string, modelNa
86
86
  export { initializeMCPEcosystem, listMCPs, executeMCP, getMCPStats, mcpLogger, } from "./mcp/index.js";
87
87
  export type { McpMetadata, DiscoveredMcp } from "./types/mcpTypes.js";
88
88
  export type { ExecutionContext, ToolInfo, ToolExecutionResult, } from "./types/tools.js";
89
- export type { LogLevel } from "./utils/logger.js";
89
+ export type { LogLevel } from "./types/utilities.js";
90
90
  export declare function initializeTelemetry(): Promise<boolean>;
91
91
  export declare function getTelemetryStatus(): Promise<{
92
92
  enabled: boolean;
@@ -1221,6 +1221,8 @@ export class NeuroLink {
1221
1221
  temperature: options.temperature,
1222
1222
  maxTokens: options.maxTokens,
1223
1223
  systemPrompt: options.systemPrompt,
1224
+ schema: options.schema,
1225
+ output: options.output,
1224
1226
  disableTools: options.disableTools,
1225
1227
  enableAnalytics: options.enableAnalytics,
1226
1228
  enableEvaluation: options.enableEvaluation,
@@ -131,7 +131,7 @@ export declare class SageMakerLanguageModel implements LanguageModelV1 {
131
131
  provider: string;
132
132
  specificationVersion: string;
133
133
  endpointName: string;
134
- modelType: "custom" | "huggingface" | "mistral" | "claude" | "llama" | "jumpstart" | undefined;
134
+ modelType: "huggingface" | "mistral" | "llama" | "claude" | "jumpstart" | "custom" | undefined;
135
135
  region: string;
136
136
  };
137
137
  /**
@@ -178,7 +178,7 @@ export declare class SageMakerLanguageModel implements LanguageModelV1 {
178
178
  provider: string;
179
179
  specificationVersion: string;
180
180
  endpointName: string;
181
- modelType: "custom" | "huggingface" | "mistral" | "claude" | "llama" | "jumpstart" | undefined;
181
+ modelType: "huggingface" | "mistral" | "llama" | "claude" | "jumpstart" | "custom" | undefined;
182
182
  region: string;
183
183
  };
184
184
  }
@@ -120,11 +120,11 @@ export type NeuroLinkEvents = {
120
120
  * TypeScript utility for typed EventEmitter
121
121
  * Flexible interface to support both typed and legacy event patterns
122
122
  */
123
- export interface TypedEventEmitter<TEvents extends Record<string, unknown>> {
124
- on<K extends keyof TEvents>(event: K, listener: (...args: unknown[]) => void): this;
123
+ export type TypedEventEmitter<TEvents extends Record<string, unknown>> = {
124
+ on<K extends keyof TEvents>(event: K, listener: (...args: unknown[]) => void): TypedEventEmitter<TEvents>;
125
125
  emit<K extends keyof TEvents>(event: K, ...args: unknown[]): boolean;
126
- off<K extends keyof TEvents>(event: K, listener: (...args: unknown[]) => void): this;
127
- removeAllListeners<K extends keyof TEvents>(event?: K): this;
126
+ off<K extends keyof TEvents>(event: K, listener: (...args: unknown[]) => void): TypedEventEmitter<TEvents>;
127
+ removeAllListeners<K extends keyof TEvents>(event?: K): TypedEventEmitter<TEvents>;
128
128
  listenerCount<K extends keyof TEvents>(event: K): number;
129
129
  listeners<K extends keyof TEvents>(event: K): Array<(...args: unknown[]) => void>;
130
- }
130
+ };
@@ -157,6 +157,9 @@ export type TextGenerationOptions = {
157
157
  maxTokens?: number;
158
158
  systemPrompt?: string;
159
159
  schema?: ZodUnknownSchema | Schema<unknown>;
160
+ output?: {
161
+ format?: "text" | "structured" | "json";
162
+ };
160
163
  tools?: Record<string, Tool>;
161
164
  timeout?: number | string;
162
165
  disableTools?: boolean;
@@ -5,6 +5,7 @@
5
5
  import { z } from "zod";
6
6
  import type { JsonValue } from "./common.js";
7
7
  import { AIProviderName } from "../constants/enums.js";
8
+ import type { TaskType } from "./taskClassificationTypes.js";
8
9
  /**
9
10
  * Model performance tier definition
10
11
  */
@@ -87,10 +88,10 @@ export declare const ModelConfigSchema: z.ZodObject<{
87
88
  contextWindow: z.ZodNumber;
88
89
  releaseDate: z.ZodString;
89
90
  }, "strip", z.ZodTypeAny, {
90
- id: string;
91
- displayName: string;
92
91
  capabilities: string[];
92
+ id: string;
93
93
  deprecated: boolean;
94
+ displayName: string;
94
95
  pricing: {
95
96
  input: number;
96
97
  output: number;
@@ -98,10 +99,10 @@ export declare const ModelConfigSchema: z.ZodObject<{
98
99
  contextWindow: number;
99
100
  releaseDate: string;
100
101
  }, {
101
- id: string;
102
- displayName: string;
103
102
  capabilities: string[];
103
+ id: string;
104
104
  deprecated: boolean;
105
+ displayName: string;
105
106
  pricing: {
106
107
  input: number;
107
108
  output: number;
@@ -133,10 +134,10 @@ export declare const ModelRegistrySchema: z.ZodObject<{
133
134
  contextWindow: z.ZodNumber;
134
135
  releaseDate: z.ZodString;
135
136
  }, "strip", z.ZodTypeAny, {
136
- id: string;
137
- displayName: string;
138
137
  capabilities: string[];
138
+ id: string;
139
139
  deprecated: boolean;
140
+ displayName: string;
140
141
  pricing: {
141
142
  input: number;
142
143
  output: number;
@@ -144,10 +145,10 @@ export declare const ModelRegistrySchema: z.ZodObject<{
144
145
  contextWindow: number;
145
146
  releaseDate: string;
146
147
  }, {
147
- id: string;
148
- displayName: string;
149
148
  capabilities: string[];
149
+ id: string;
150
150
  deprecated: boolean;
151
+ displayName: string;
151
152
  pricing: {
152
153
  input: number;
153
154
  output: number;
@@ -159,11 +160,12 @@ export declare const ModelRegistrySchema: z.ZodObject<{
159
160
  defaults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
160
161
  }, "strip", z.ZodTypeAny, {
161
162
  version: string;
163
+ lastUpdated: string;
162
164
  models: Record<string, Record<string, {
163
- id: string;
164
- displayName: string;
165
165
  capabilities: string[];
166
+ id: string;
166
167
  deprecated: boolean;
168
+ displayName: string;
167
169
  pricing: {
168
170
  input: number;
169
171
  output: number;
@@ -171,16 +173,16 @@ export declare const ModelRegistrySchema: z.ZodObject<{
171
173
  contextWindow: number;
172
174
  releaseDate: string;
173
175
  }>>;
174
- lastUpdated: string;
175
176
  aliases?: Record<string, string> | undefined;
176
177
  defaults?: Record<string, string> | undefined;
177
178
  }, {
178
179
  version: string;
180
+ lastUpdated: string;
179
181
  models: Record<string, Record<string, {
180
- id: string;
181
- displayName: string;
182
182
  capabilities: string[];
183
+ id: string;
183
184
  deprecated: boolean;
185
+ displayName: string;
184
186
  pricing: {
185
187
  input: number;
186
188
  output: number;
@@ -188,7 +190,6 @@ export declare const ModelRegistrySchema: z.ZodObject<{
188
190
  contextWindow: number;
189
191
  releaseDate: string;
190
192
  }>>;
191
- lastUpdated: string;
192
193
  aliases?: Record<string, string> | undefined;
193
194
  defaults?: Record<string, string> | undefined;
194
195
  }>;
@@ -328,3 +329,19 @@ export type ModelComparison = {
328
329
  };
329
330
  };
330
331
  };
332
+ export type ModelRoute = {
333
+ provider: string;
334
+ model: string;
335
+ reasoning: string;
336
+ confidence: number;
337
+ };
338
+ export type ModelRoutingOptions = {
339
+ /** Override the task classification */
340
+ forceTaskType?: TaskType;
341
+ /** Require specific performance characteristics */
342
+ requireFast?: boolean;
343
+ /** Require specific capability (reasoning, creativity, etc.) */
344
+ requireCapability?: string;
345
+ /** Fallback strategy if primary choice fails */
346
+ fallbackStrategy?: "fast" | "reasoning" | "auto";
347
+ };
@@ -4,7 +4,8 @@
4
4
  */
5
5
  import { z } from "zod";
6
6
  import type { ErrorInfo, JsonObject, JsonValue, Result, UnknownRecord } from "./common.js";
7
- import type { StandardRecord, ZodUnknownSchema } from "./typeAliases.js";
7
+ import type { StandardRecord, StringArray, ZodUnknownSchema } from "./typeAliases.js";
8
+ import type { ValidationError } from "../utils/parameterValidation.js";
8
9
  /**
9
10
  * Commonly used Zod schema type aliases for cleaner type declarations
10
11
  */
@@ -336,6 +337,20 @@ export type ToolCallResult = {
336
337
  result: ToolResult;
337
338
  formattedForAI: string;
338
339
  };
340
+ /**
341
+ * Result of a validation operation
342
+ * Contains validation status, errors, warnings, and suggestions for improvement
343
+ */
344
+ export type EnhancedValidationResult = {
345
+ /** Whether the validation passed without errors */
346
+ isValid: boolean;
347
+ /** Array of validation errors that must be fixed */
348
+ errors: ValidationError[];
349
+ /** Array of warning messages that should be addressed */
350
+ warnings: string[];
351
+ /** Array of suggestions to improve the validated object */
352
+ suggestions: StringArray;
353
+ };
339
354
  /**
340
355
  * Type guard for tool result
341
356
  */