@juspay/neurolink 7.51.1 → 7.51.3

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 (48) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/core/baseProvider.js +5 -1
  3. package/dist/core/conversationMemoryFactory.d.ts +1 -4
  4. package/dist/core/redisConversationMemoryManager.d.ts +4 -0
  5. package/dist/core/redisConversationMemoryManager.js +4 -0
  6. package/dist/lib/core/baseProvider.js +5 -1
  7. package/dist/lib/core/conversationMemoryFactory.d.ts +1 -4
  8. package/dist/lib/core/redisConversationMemoryManager.d.ts +4 -0
  9. package/dist/lib/core/redisConversationMemoryManager.js +4 -0
  10. package/dist/lib/neurolink.d.ts +2 -1
  11. package/dist/lib/types/common.d.ts +18 -61
  12. package/dist/lib/types/content.d.ts +21 -10
  13. package/dist/lib/types/contextTypes.d.ts +11 -11
  14. package/dist/lib/types/conversation.d.ts +27 -27
  15. package/dist/lib/types/domainTypes.d.ts +12 -12
  16. package/dist/lib/types/evaluationTypes.d.ts +12 -12
  17. package/dist/lib/types/externalMcp.d.ts +20 -20
  18. package/dist/lib/types/guardrails.d.ts +18 -18
  19. package/dist/lib/types/middlewareTypes.d.ts +86 -23
  20. package/dist/lib/types/providers.d.ts +72 -61
  21. package/dist/lib/types/providers.js +3 -0
  22. package/dist/lib/types/sdkTypes.d.ts +2 -2
  23. package/dist/lib/types/streamTypes.d.ts +8 -8
  24. package/dist/lib/types/tools.d.ts +79 -1
  25. package/dist/lib/types/utilities.d.ts +29 -0
  26. package/dist/lib/types/utilities.js +5 -0
  27. package/dist/lib/utils/providerConfig.d.ts +3 -22
  28. package/dist/lib/utils/timeout.d.ts +1 -16
  29. package/dist/neurolink.d.ts +2 -1
  30. package/dist/types/common.d.ts +18 -61
  31. package/dist/types/content.d.ts +21 -10
  32. package/dist/types/contextTypes.d.ts +11 -11
  33. package/dist/types/conversation.d.ts +27 -27
  34. package/dist/types/domainTypes.d.ts +12 -12
  35. package/dist/types/evaluationTypes.d.ts +12 -12
  36. package/dist/types/externalMcp.d.ts +20 -20
  37. package/dist/types/guardrails.d.ts +18 -18
  38. package/dist/types/middlewareTypes.d.ts +86 -23
  39. package/dist/types/providers.d.ts +72 -61
  40. package/dist/types/providers.js +3 -0
  41. package/dist/types/sdkTypes.d.ts +2 -2
  42. package/dist/types/streamTypes.d.ts +8 -8
  43. package/dist/types/tools.d.ts +79 -1
  44. package/dist/types/utilities.d.ts +29 -0
  45. package/dist/types/utilities.js +4 -0
  46. package/dist/utils/providerConfig.d.ts +3 -22
  47. package/dist/utils/timeout.d.ts +1 -16
  48. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [7.51.3](https://github.com/juspay/neurolink/compare/v7.51.2...v7.51.3) (2025-10-23)
2
+
3
+ ### Bug Fixes
4
+
5
+ - **(neurolink):** add Zod schema detection for inputSchema field in baseProvider ([5ad0c0a](https://github.com/juspay/neurolink/commit/5ad0c0a1750b92e0e4412243f5b872f30c258624))
6
+
7
+ ## [7.51.2](https://github.com/juspay/neurolink/compare/v7.51.1...v7.51.2) (2025-10-14)
8
+
1
9
  ## [7.51.1](https://github.com/juspay/neurolink/compare/v7.51.0...v7.51.1) (2025-10-13)
2
10
 
3
11
  ## [7.51.0](https://github.com/juspay/neurolink/compare/v7.50.0...v7.51.0) (2025-10-12)
@@ -771,10 +771,14 @@ export class BaseProvider {
771
771
  logger.debug(`[BaseProvider] Converting custom tool: ${toolName}`);
772
772
  let finalSchema;
773
773
  let originalInputSchema;
774
- // Prioritize parameters (Zod), then inputSchema (JSON Schema)
774
+ // Prioritize parameters (Zod), then inputSchema (Zod or JSON Schema)
775
775
  if (toolInfo.parameters && this.isZodSchema(toolInfo.parameters)) {
776
776
  finalSchema = toolInfo.parameters;
777
777
  }
778
+ else if (toolInfo.inputSchema &&
779
+ this.isZodSchema(toolInfo.inputSchema)) {
780
+ finalSchema = toolInfo.inputSchema;
781
+ }
778
782
  else if (toolInfo.inputSchema &&
779
783
  typeof toolInfo.inputSchema === "object") {
780
784
  // Use original JSON Schema with jsonSchema() wrapper - NO CONVERSION!
@@ -3,12 +3,9 @@
3
3
  * Creates appropriate conversation memory manager based on configuration
4
4
  */
5
5
  import type { ConversationMemoryConfig, RedisStorageConfig } from "../types/conversation.js";
6
+ import type { StorageType } from "../types/common.js";
6
7
  import { ConversationMemoryManager } from "./conversationMemoryManager.js";
7
8
  import { RedisConversationMemoryManager } from "./redisConversationMemoryManager.js";
8
- /**
9
- * Configuration for memory storage type
10
- */
11
- export type StorageType = "memory" | "redis";
12
9
  /**
13
10
  * Creates a conversation memory manager based on configuration
14
11
  */
@@ -3,6 +3,10 @@
3
3
  * Redis-based implementation of conversation storage with same interface as ConversationMemoryManager
4
4
  */
5
5
  import type { ConversationMemoryConfig, ConversationMemoryStats, ChatMessage, RedisStorageConfig, SessionMetadata, RedisConversationObject } from "../types/conversation.js";
6
+ /**
7
+ * Redis-based implementation of the ConversationMemoryManager
8
+ * Uses the same interface but stores data in Redis
9
+ */
6
10
  export declare class RedisConversationMemoryManager {
7
11
  config: ConversationMemoryConfig;
8
12
  private isInitialized;
@@ -8,6 +8,10 @@ import { DEFAULT_MAX_SESSIONS, MESSAGES_PER_TURN, } from "../config/conversation
8
8
  import { logger } from "../utils/logger.js";
9
9
  import { NeuroLink } from "../neurolink.js";
10
10
  import { createRedisClient, getSessionKey, getUserSessionsKey, getNormalizedConfig, serializeConversation, deserializeConversation, scanKeys, } from "../utils/redis.js";
11
+ /**
12
+ * Redis-based implementation of the ConversationMemoryManager
13
+ * Uses the same interface but stores data in Redis
14
+ */
11
15
  export class RedisConversationMemoryManager {
12
16
  config;
13
17
  isInitialized = false;
@@ -771,10 +771,14 @@ export class BaseProvider {
771
771
  logger.debug(`[BaseProvider] Converting custom tool: ${toolName}`);
772
772
  let finalSchema;
773
773
  let originalInputSchema;
774
- // Prioritize parameters (Zod), then inputSchema (JSON Schema)
774
+ // Prioritize parameters (Zod), then inputSchema (Zod or JSON Schema)
775
775
  if (toolInfo.parameters && this.isZodSchema(toolInfo.parameters)) {
776
776
  finalSchema = toolInfo.parameters;
777
777
  }
778
+ else if (toolInfo.inputSchema &&
779
+ this.isZodSchema(toolInfo.inputSchema)) {
780
+ finalSchema = toolInfo.inputSchema;
781
+ }
778
782
  else if (toolInfo.inputSchema &&
779
783
  typeof toolInfo.inputSchema === "object") {
780
784
  // Use original JSON Schema with jsonSchema() wrapper - NO CONVERSION!
@@ -3,12 +3,9 @@
3
3
  * Creates appropriate conversation memory manager based on configuration
4
4
  */
5
5
  import type { ConversationMemoryConfig, RedisStorageConfig } from "../types/conversation.js";
6
+ import type { StorageType } from "../types/common.js";
6
7
  import { ConversationMemoryManager } from "./conversationMemoryManager.js";
7
8
  import { RedisConversationMemoryManager } from "./redisConversationMemoryManager.js";
8
- /**
9
- * Configuration for memory storage type
10
- */
11
- export type StorageType = "memory" | "redis";
12
9
  /**
13
10
  * Creates a conversation memory manager based on configuration
14
11
  */
@@ -3,6 +3,10 @@
3
3
  * Redis-based implementation of conversation storage with same interface as ConversationMemoryManager
4
4
  */
5
5
  import type { ConversationMemoryConfig, ConversationMemoryStats, ChatMessage, RedisStorageConfig, SessionMetadata, RedisConversationObject } from "../types/conversation.js";
6
+ /**
7
+ * Redis-based implementation of the ConversationMemoryManager
8
+ * Uses the same interface but stores data in Redis
9
+ */
6
10
  export declare class RedisConversationMemoryManager {
7
11
  config: ConversationMemoryConfig;
8
12
  private isInitialized;
@@ -8,6 +8,10 @@ import { DEFAULT_MAX_SESSIONS, MESSAGES_PER_TURN, } from "../config/conversation
8
8
  import { logger } from "../utils/logger.js";
9
9
  import { NeuroLink } from "../neurolink.js";
10
10
  import { createRedisClient, getSessionKey, getUserSessionsKey, getNormalizedConfig, serializeConversation, deserializeConversation, scanKeys, } from "../utils/redis.js";
11
+ /**
12
+ * Redis-based implementation of the ConversationMemoryManager
13
+ * Uses the same interface but stores data in Redis
14
+ */
11
15
  export class RedisConversationMemoryManager {
12
16
  config;
13
17
  isInitialized = false;
@@ -11,7 +11,8 @@ import type { GenerateOptions, GenerateResult } from "./types/generateTypes.js";
11
11
  import type { StreamOptions, StreamResult } from "./types/streamTypes.js";
12
12
  import type { MCPServerInfo, MCPExecutableTool } from "./types/mcpTypes.js";
13
13
  import type { ToolInfo } from "./types/tools.js";
14
- import type { NeuroLinkEvents, TypedEventEmitter, ToolExecutionContext, ToolExecutionSummary } from "./types/common.js";
14
+ import type { NeuroLinkEvents, TypedEventEmitter } from "./types/common.js";
15
+ import type { ToolExecutionContext, ToolExecutionSummary } from "./types/tools.js";
15
16
  import type { JsonObject } from "./types/common.js";
16
17
  import type { BatchOperationResult } from "./types/typeAliases.js";
17
18
  import type { ConversationMemoryConfig, ChatMessage } from "./types/conversation.js";
@@ -13,38 +13,41 @@ export type UnknownRecord = Record<string, unknown>;
13
13
  * Type-safe array of unknown items
14
14
  */
15
15
  export type UnknownArray = unknown[];
16
+ /**
17
+ * Storage type for conversation memory factory
18
+ */
19
+ export type StorageType = "memory" | "redis";
16
20
  /**
17
21
  * JSON-serializable value type
18
22
  */
19
23
  export type JsonValue = string | number | boolean | null | JsonObject | JsonArray;
20
- export interface JsonObject {
24
+ export type JsonObject = {
21
25
  [key: string]: JsonValue;
22
- }
23
- export interface JsonArray extends Array<JsonValue> {
24
- }
26
+ };
27
+ export type JsonArray = JsonValue[];
25
28
  /**
26
29
  * Type-safe error handling
27
30
  */
28
- export interface ErrorInfo {
31
+ export type ErrorInfo = {
29
32
  message: string;
30
33
  code?: string | number;
31
34
  stack?: string;
32
35
  cause?: unknown;
33
- }
36
+ };
34
37
  /**
35
38
  * Generic success/error result type
36
39
  */
37
- export interface Result<T = unknown, E = ErrorInfo> {
40
+ export type Result<T = unknown, E = ErrorInfo> = {
38
41
  success: boolean;
39
42
  data?: T;
40
43
  error?: E;
41
- }
44
+ };
42
45
  /**
43
46
  * Function parameter type for dynamic functions
44
47
  */
45
- export interface FunctionParameters {
48
+ export type FunctionParameters = {
46
49
  [key: string]: unknown;
47
- }
50
+ };
48
51
  /**
49
52
  * Generic async function type
50
53
  */
@@ -73,54 +76,20 @@ export declare function getErrorMessage(error: unknown): string;
73
76
  * Safe error conversion
74
77
  */
75
78
  export declare function toErrorInfo(error: unknown): ErrorInfo;
76
- /**
77
- * NeuroLink Native Event System Types
78
- */
79
- /**
80
- * Tool execution event for real-time streaming
81
- */
82
- export interface ToolExecutionEvent {
83
- type: "tool:start" | "tool:end";
84
- tool: string;
85
- input?: unknown;
86
- result?: unknown;
87
- error?: string;
88
- timestamp: number;
89
- duration?: number;
90
- executionId: string;
91
- }
92
- /**
93
- * Tool execution summary for completed executions
94
- */
95
- export interface ToolExecutionSummary {
96
- tool: string;
97
- startTime: number;
98
- endTime: number;
99
- duration: number;
100
- success: boolean;
101
- result?: unknown;
102
- error?: string;
103
- executionId: string;
104
- metadata?: {
105
- serverId?: string;
106
- toolCategory?: "direct" | "custom" | "mcp";
107
- isExternal?: boolean;
108
- };
109
- }
110
79
  /**
111
80
  * Stream event types for real-time communication
112
81
  */
113
- export interface StreamEvent {
82
+ export type StreamEvent = {
114
83
  type: "stream:chunk" | "stream:complete" | "stream:error";
115
84
  content?: string;
116
85
  metadata?: JsonObject;
117
86
  timestamp: number;
118
- }
87
+ };
119
88
  /**
120
89
  * Enhanced NeuroLink event types
121
- * Flexible interface to support both typed and legacy event patterns
90
+ * Flexible type to support both typed and legacy event patterns
122
91
  */
123
- export interface NeuroLinkEvents {
92
+ export type NeuroLinkEvents = {
124
93
  "tool:start": unknown;
125
94
  "tool:end": unknown;
126
95
  "stream:start": unknown;
@@ -146,7 +115,7 @@ export interface NeuroLinkEvents {
146
115
  error: unknown;
147
116
  log: unknown;
148
117
  [key: string]: unknown;
149
- }
118
+ };
150
119
  /**
151
120
  * TypeScript utility for typed EventEmitter
152
121
  * Flexible interface to support both typed and legacy event patterns
@@ -159,15 +128,3 @@ export interface TypedEventEmitter<TEvents extends Record<string, unknown>> {
159
128
  listenerCount<K extends keyof TEvents>(event: K): number;
160
129
  listeners<K extends keyof TEvents>(event: K): Array<(...args: unknown[]) => void>;
161
130
  }
162
- /**
163
- * Tool execution context for tracking
164
- */
165
- export interface ToolExecutionContext {
166
- executionId: string;
167
- tool: string;
168
- startTime: number;
169
- endTime?: number;
170
- result?: unknown;
171
- error?: string;
172
- metadata?: JsonObject;
173
- }
@@ -59,46 +59,57 @@ export type Content = TextContent | ImageContent | CSVContent | PDFContent;
59
59
  /**
60
60
  * Vision capability information for providers
61
61
  */
62
- export interface VisionCapability {
62
+ export type VisionCapability = {
63
63
  provider: string;
64
64
  supportedModels: string[];
65
65
  maxImageSize?: number;
66
66
  supportedFormats: string[];
67
67
  maxImagesPerRequest?: number;
68
- }
68
+ };
69
69
  /**
70
70
  * Provider-specific image format requirements
71
71
  */
72
- export interface ProviderImageFormat {
72
+ export type ProviderImageFormat = {
73
73
  provider: string;
74
74
  format: "data_uri" | "base64" | "inline_data" | "source";
75
75
  requiresPrefix?: boolean;
76
76
  mimeTypeField?: string;
77
77
  dataField?: string;
78
- }
78
+ };
79
79
  /**
80
80
  * Image processing result
81
81
  */
82
- export interface ProcessedImage {
82
+ export type ProcessedImage = {
83
83
  data: string;
84
84
  mediaType: string;
85
85
  size: number;
86
86
  format: "data_uri" | "base64" | "inline_data" | "source";
87
- }
87
+ };
88
88
  /**
89
89
  * Multimodal message structure for provider adapters
90
90
  */
91
- export interface MultimodalMessage {
91
+ export type MultimodalMessage = {
92
92
  role: "user" | "assistant" | "system";
93
93
  content: Content[];
94
- }
94
+ };
95
+ /**
96
+ * Multimodal input type for options that may contain images or content arrays
97
+ */
98
+ export type MultimodalInput = {
99
+ text: string;
100
+ images?: Array<Buffer | string>;
101
+ content?: Array<TextContent | ImageContent>;
102
+ csvFiles?: Array<Buffer | string>;
103
+ pdfFiles?: Array<Buffer | string>;
104
+ files?: Array<Buffer | string>;
105
+ };
95
106
  /**
96
107
  * Provider-specific multimodal payload
97
108
  */
98
- export interface ProviderMultimodalPayload {
109
+ export type ProviderMultimodalPayload = {
99
110
  provider: string;
100
111
  model: string;
101
112
  messages?: MultimodalMessage[];
102
113
  contents?: unknown[];
103
114
  [key: string]: unknown;
104
- }
115
+ };
@@ -5,9 +5,9 @@
5
5
  import type { JsonObject } from "./common.js";
6
6
  import type { ExecutionContext } from "../types/tools.js";
7
7
  /**
8
- * Base context interface for all AI operations
8
+ * Base context type for all AI operations
9
9
  */
10
- export interface BaseContext {
10
+ export type BaseContext = {
11
11
  userId?: string;
12
12
  sessionId?: string;
13
13
  requestId?: string;
@@ -23,7 +23,7 @@ export interface BaseContext {
23
23
  departmentId?: string;
24
24
  projectId?: string;
25
25
  [key: string]: unknown;
26
- }
26
+ };
27
27
  /**
28
28
  * Context integration mode types
29
29
  */
@@ -31,18 +31,18 @@ type ContextIntegrationMode = "prompt_prefix" | "prompt_suffix" | "system_prompt
31
31
  /**
32
32
  * Context configuration for AI generation
33
33
  */
34
- export interface ContextConfig {
34
+ export type ContextConfig = {
35
35
  mode: ContextIntegrationMode;
36
36
  includeInPrompt?: boolean;
37
37
  includeInAnalytics?: boolean;
38
38
  includeInEvaluation?: boolean;
39
39
  template?: string;
40
40
  maxLength?: number;
41
- }
41
+ };
42
42
  /**
43
43
  * Context processing result
44
44
  */
45
- interface ProcessedContext {
45
+ type ProcessedContext = {
46
46
  originalContext: BaseContext;
47
47
  processedContext: string | null;
48
48
  config: ContextConfig;
@@ -52,17 +52,17 @@ interface ProcessedContext {
52
52
  template: string;
53
53
  mode: ContextIntegrationMode;
54
54
  };
55
- }
55
+ };
56
56
  /**
57
57
  * Configuration for framework fields exclusion
58
58
  * Can be customized per application or environment
59
59
  */
60
- export interface FrameworkFieldsConfig {
60
+ export type FrameworkFieldsConfig = {
61
61
  defaultFields: string[];
62
62
  additionalFields?: string[];
63
63
  overrideFields?: string[];
64
64
  includeFields?: string[];
65
- }
65
+ };
66
66
  /**
67
67
  * Factory for context processing
68
68
  */
@@ -150,11 +150,11 @@ export declare class ContextFactory {
150
150
  * Context conversion utilities for domain-specific data
151
151
  * Replaces hardcoded business context with generic domain context
152
152
  */
153
- interface ContextConversionOptions {
153
+ type ContextConversionOptions = {
154
154
  preserveLegacyFields?: boolean;
155
155
  validateDomainData?: boolean;
156
156
  includeMetadata?: boolean;
157
- }
157
+ };
158
158
  export declare class ContextConverter {
159
159
  /**
160
160
  * Convert legacy business context to generic domain context
@@ -4,12 +4,12 @@
4
4
  */
5
5
  import type { MemoryConfig } from "mem0ai/oss";
6
6
  /**
7
- * Mem0 configuration interface matching mem0ai/oss MemoryConfig structure
7
+ * Mem0 configuration type matching mem0ai/oss MemoryConfig structure
8
8
  */
9
9
  /**
10
10
  * Configuration for conversation memory feature
11
11
  */
12
- export interface ConversationMemoryConfig {
12
+ export type ConversationMemoryConfig = {
13
13
  /** Enable conversation memory feature */
14
14
  enabled: boolean;
15
15
  /** Maximum number of sessions to keep in memory (default: 50) */
@@ -30,12 +30,12 @@ export interface ConversationMemoryConfig {
30
30
  mem0Enabled?: boolean;
31
31
  /** Configuration for mem0 integration */
32
32
  mem0Config?: MemoryConfig;
33
- }
33
+ };
34
34
  /**
35
35
  * Complete memory for a conversation session
36
36
  * ULTRA-OPTIMIZED: Direct ChatMessage[] storage - zero conversion overhead
37
37
  */
38
- export interface SessionMemory {
38
+ export type SessionMemory = {
39
39
  /** Unique session identifier */
40
40
  sessionId: string;
41
41
  /** User identifier (optional) */
@@ -57,20 +57,20 @@ export interface SessionMemory {
57
57
  /** Custom data specific to the organization */
58
58
  customData?: Record<string, unknown>;
59
59
  };
60
- }
60
+ };
61
61
  /**
62
62
  * Statistics about conversation memory usage (simplified for pure in-memory storage)
63
63
  */
64
- export interface ConversationMemoryStats {
64
+ export type ConversationMemoryStats = {
65
65
  /** Total number of active sessions */
66
66
  totalSessions: number;
67
67
  /** Total number of conversation turns across all sessions */
68
68
  totalTurns: number;
69
- }
69
+ };
70
70
  /**
71
71
  * Chat message format for conversation history
72
72
  */
73
- export interface ChatMessage {
73
+ export type ChatMessage = {
74
74
  /** Role/type of the message */
75
75
  role: "user" | "assistant" | "system" | "tool_call" | "tool_result";
76
76
  /** Content of the message */
@@ -91,30 +91,30 @@ export interface ChatMessage {
91
91
  type?: string;
92
92
  error?: string;
93
93
  };
94
- }
94
+ };
95
95
  /**
96
96
  * Content format for multimodal messages (used internally)
97
97
  */
98
- export interface MessageContent {
98
+ export type MessageContent = {
99
99
  type: string;
100
100
  text?: string;
101
101
  image?: string;
102
102
  mimeType?: string;
103
103
  [key: string]: unknown;
104
- }
104
+ };
105
105
  /**
106
106
  * Extended chat message for multimodal support (internal use)
107
107
  */
108
- export interface MultimodalChatMessage {
108
+ export type MultimodalChatMessage = {
109
109
  /** Role of the message sender */
110
110
  role: "user" | "assistant" | "system";
111
111
  /** Content of the message - can be text or multimodal content array */
112
112
  content: string | MessageContent[];
113
- }
113
+ };
114
114
  /**
115
115
  * Events emitted by conversation memory system
116
116
  */
117
- export interface ConversationMemoryEvents {
117
+ export type ConversationMemoryEvents = {
118
118
  /** Emitted when a new session is created */
119
119
  "session:created": {
120
120
  sessionId: string;
@@ -139,7 +139,7 @@ export interface ConversationMemoryEvents {
139
139
  turnsIncluded: number;
140
140
  timestamp: number;
141
141
  };
142
- }
142
+ };
143
143
  /**
144
144
  * Error types specific to conversation memory
145
145
  */
@@ -152,14 +152,14 @@ export declare class ConversationMemoryError extends Error {
152
152
  * NeuroLink initialization options
153
153
  * Configuration for creating NeuroLink instances with conversation memory
154
154
  */
155
- export interface NeurolinkOptions {
155
+ export type NeurolinkOptions = {
156
156
  /** Conversation memory configuration */
157
157
  conversationMemory?: ConversationMemoryConfig;
158
158
  /** Session identifier for conversation context */
159
159
  sessionId?: string;
160
160
  /** Observability configuration */
161
161
  observability?: import("./observability.js").ObservabilityConfig;
162
- }
162
+ };
163
163
  /**
164
164
  * Session identifier for Redis storage operations
165
165
  */
@@ -171,17 +171,17 @@ export type SessionIdentifier = {
171
171
  * Lightweight session metadata for efficient session listing
172
172
  * Contains only essential information without heavy message arrays
173
173
  */
174
- export interface SessionMetadata {
174
+ export type SessionMetadata = {
175
175
  id: string;
176
176
  title: string;
177
177
  createdAt: string;
178
178
  updatedAt: string;
179
- }
179
+ };
180
180
  /**
181
181
  * Base conversation metadata (shared fields across all conversation types)
182
182
  * Contains essential conversation information without heavy data arrays
183
183
  */
184
- export interface ConversationBase {
184
+ export type ConversationBase = {
185
185
  /** Unique conversation identifier (UUID v4) */
186
186
  id: string;
187
187
  /** Auto-generated conversation title */
@@ -194,20 +194,20 @@ export interface ConversationBase {
194
194
  createdAt: string;
195
195
  /** When this conversation was last updated */
196
196
  updatedAt: string;
197
- }
197
+ };
198
198
  /**
199
199
  * Redis conversation storage object format
200
200
  * Contains conversation metadata and full message history
201
201
  */
202
- export interface RedisConversationObject extends ConversationBase {
202
+ export type RedisConversationObject = ConversationBase & {
203
203
  /** Array of conversation messages */
204
204
  messages: ChatMessage[];
205
- }
205
+ };
206
206
  /**
207
207
  * Full conversation data for session restoration and manipulation
208
208
  * Extends Redis storage object with additional loop mode metadata
209
209
  */
210
- export interface ConversationData extends RedisConversationObject {
210
+ export type ConversationData = RedisConversationObject & {
211
211
  /** Optional metadata for session variables and other loop mode data */
212
212
  metadata?: {
213
213
  /** Session variables set during loop mode */
@@ -217,12 +217,12 @@ export interface ConversationData extends RedisConversationObject {
217
217
  /** Additional metadata can be added here */
218
218
  [key: string]: unknown;
219
219
  };
220
- }
220
+ };
221
221
  /**
222
222
  * Conversation summary for listing and selection
223
223
  * Contains conversation preview information without heavy message arrays
224
224
  */
225
- export interface ConversationSummary extends ConversationBase {
225
+ export type ConversationSummary = ConversationBase & {
226
226
  /** First message preview (for conversation preview) */
227
227
  firstMessage: {
228
228
  content: string;
@@ -237,7 +237,7 @@ export interface ConversationSummary extends ConversationBase {
237
237
  messageCount: number;
238
238
  /** Human-readable time since last update (e.g., "2 hours ago") */
239
239
  duration: string;
240
- }
240
+ };
241
241
  /**
242
242
  * Redis storage configuration
243
243
  */
@@ -8,9 +8,9 @@ import type { JsonObject } from "./common.js";
8
8
  */
9
9
  export type DomainType = "healthcare" | "finance" | "analytics" | "ecommerce" | "education" | "legal" | "technology" | "generic";
10
10
  /**
11
- * Domain evaluation criteria interface
11
+ * Domain evaluation criteria type
12
12
  */
13
- export interface DomainEvaluationCriteria {
13
+ export type DomainEvaluationCriteria = {
14
14
  accuracyWeight: number;
15
15
  completenessWeight: number;
16
16
  relevanceWeight: number;
@@ -18,11 +18,11 @@ export interface DomainEvaluationCriteria {
18
18
  domainSpecificRules: string[];
19
19
  failurePatterns: string[];
20
20
  successPatterns: string[];
21
- }
21
+ };
22
22
  /**
23
- * Domain configuration interface
23
+ * Domain configuration type
24
24
  */
25
- export interface DomainConfig {
25
+ export type DomainConfig = {
26
26
  domainType: DomainType;
27
27
  domainName: string;
28
28
  description: string;
@@ -33,30 +33,30 @@ export interface DomainConfig {
33
33
  createdAt: number;
34
34
  updatedAt: number;
35
35
  };
36
- }
36
+ };
37
37
  /**
38
38
  * Domain template for factory registration
39
39
  */
40
- export interface DomainTemplate {
40
+ export type DomainTemplate = {
41
41
  domainType: DomainType;
42
42
  template: Partial<DomainConfig>;
43
43
  isDefault?: boolean;
44
- }
44
+ };
45
45
  /**
46
46
  * Domain validation rule
47
47
  */
48
- export interface DomainValidationRule {
48
+ export type DomainValidationRule = {
49
49
  ruleName: string;
50
50
  ruleType: "required" | "pattern" | "range" | "custom";
51
51
  validation: (value: unknown) => boolean;
52
52
  errorMessage: string;
53
- }
53
+ };
54
54
  /**
55
55
  * Domain configuration options for factory
56
56
  */
57
- export interface DomainConfigOptions {
57
+ export type DomainConfigOptions = {
58
58
  domainType: DomainType;
59
59
  customConfig?: Partial<DomainConfig>;
60
60
  validateDomainData?: boolean;
61
61
  includeDefaults?: boolean;
62
- }
62
+ };