@juspay/neurolink 9.65.0 → 9.65.2

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 (266) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/adapters/video/videoAnalyzer.d.ts +1 -1
  3. package/dist/agent/directTools.d.ts +9 -17
  4. package/dist/agent/directTools.js +12 -8
  5. package/dist/autoresearch/tools.d.ts +2 -214
  6. package/dist/autoresearch/tools.js +1 -1
  7. package/dist/browser/neurolink.min.js +362 -368
  8. package/dist/client/reactHooks.js +16 -8
  9. package/dist/client/reactHooks.tsx +24 -9
  10. package/dist/core/baseProvider.d.ts +1 -6
  11. package/dist/core/baseProvider.js +1 -1
  12. package/dist/core/constants.d.ts +1 -0
  13. package/dist/core/constants.js +3 -0
  14. package/dist/core/modules/GenerationHandler.d.ts +2 -2
  15. package/dist/core/modules/GenerationHandler.js +3 -1
  16. package/dist/core/modules/MessageBuilder.d.ts +1 -15
  17. package/dist/core/modules/MessageBuilder.js +0 -14
  18. package/dist/core/modules/StreamHandler.js +1 -1
  19. package/dist/core/modules/ToolsManager.d.ts +1 -17
  20. package/dist/core/modules/ToolsManager.js +1 -17
  21. package/dist/core/redisConversationMemoryManager.js +0 -6
  22. package/dist/core/streamAnalytics.js +1 -1
  23. package/dist/evaluation/contextBuilder.d.ts +1 -4
  24. package/dist/evaluation/contextBuilder.js +0 -3
  25. package/dist/evaluation/index.d.ts +1 -4
  26. package/dist/evaluation/index.js +0 -3
  27. package/dist/files/fileTools.d.ts +2 -18
  28. package/dist/files/fileTools.js +3 -19
  29. package/dist/lib/adapters/video/videoAnalyzer.d.ts +1 -1
  30. package/dist/lib/agent/directTools.d.ts +9 -17
  31. package/dist/lib/agent/directTools.js +12 -8
  32. package/dist/lib/autoresearch/tools.d.ts +2 -214
  33. package/dist/lib/autoresearch/tools.js +1 -1
  34. package/dist/lib/client/reactHooks.js +16 -8
  35. package/dist/lib/core/baseProvider.d.ts +1 -6
  36. package/dist/lib/core/baseProvider.js +1 -1
  37. package/dist/lib/core/constants.d.ts +1 -0
  38. package/dist/lib/core/constants.js +3 -0
  39. package/dist/lib/core/modules/GenerationHandler.d.ts +2 -2
  40. package/dist/lib/core/modules/GenerationHandler.js +3 -1
  41. package/dist/lib/core/modules/MessageBuilder.d.ts +1 -15
  42. package/dist/lib/core/modules/MessageBuilder.js +0 -14
  43. package/dist/lib/core/modules/StreamHandler.js +1 -1
  44. package/dist/lib/core/modules/ToolsManager.d.ts +1 -17
  45. package/dist/lib/core/modules/ToolsManager.js +1 -17
  46. package/dist/lib/core/redisConversationMemoryManager.js +0 -6
  47. package/dist/lib/core/streamAnalytics.js +1 -1
  48. package/dist/lib/evaluation/contextBuilder.d.ts +1 -4
  49. package/dist/lib/evaluation/contextBuilder.js +0 -3
  50. package/dist/lib/evaluation/index.d.ts +1 -4
  51. package/dist/lib/evaluation/index.js +0 -3
  52. package/dist/lib/files/fileTools.d.ts +2 -18
  53. package/dist/lib/files/fileTools.js +3 -19
  54. package/dist/lib/memory/memoryRetrievalTools.d.ts +2 -126
  55. package/dist/lib/memory/memoryRetrievalTools.js +1 -9
  56. package/dist/lib/middleware/builtin/autoEvaluation.d.ts +0 -3
  57. package/dist/lib/middleware/builtin/autoEvaluation.js +0 -3
  58. package/dist/lib/middleware/builtin/guardrails.js +1 -1
  59. package/dist/lib/middleware/builtin/lifecycle.d.ts +0 -9
  60. package/dist/lib/middleware/builtin/lifecycle.js +0 -9
  61. package/dist/lib/middleware/factory.d.ts +1 -1
  62. package/dist/lib/middleware/factory.js +1 -1
  63. package/dist/lib/middleware/registry.d.ts +1 -1
  64. package/dist/lib/neurolink.d.ts +14 -2
  65. package/dist/lib/neurolink.js +46 -18
  66. package/dist/lib/processors/media/AudioProcessor.js +8 -3
  67. package/dist/lib/providers/amazonBedrock.js +1 -2
  68. package/dist/lib/providers/amazonSagemaker.d.ts +1 -7
  69. package/dist/lib/providers/amazonSagemaker.js +0 -6
  70. package/dist/lib/providers/anthropic.d.ts +1 -1
  71. package/dist/lib/providers/anthropic.js +2 -1
  72. package/dist/lib/providers/anthropicBaseProvider.d.ts +1 -1
  73. package/dist/lib/providers/anthropicBaseProvider.js +2 -1
  74. package/dist/lib/providers/azureOpenai.d.ts +1 -1
  75. package/dist/lib/providers/azureOpenai.js +2 -1
  76. package/dist/lib/providers/cloudflare.d.ts +1 -1
  77. package/dist/lib/providers/cloudflare.js +2 -1
  78. package/dist/lib/providers/cohere.d.ts +1 -1
  79. package/dist/lib/providers/cohere.js +2 -1
  80. package/dist/lib/providers/deepseek.d.ts +1 -1
  81. package/dist/lib/providers/deepseek.js +2 -1
  82. package/dist/lib/providers/fireworks.d.ts +1 -1
  83. package/dist/lib/providers/fireworks.js +2 -1
  84. package/dist/lib/providers/googleAiStudio.d.ts +1 -1
  85. package/dist/lib/providers/googleAiStudio.js +82 -6
  86. package/dist/lib/providers/googleNativeGemini3.d.ts +3 -6
  87. package/dist/lib/providers/googleNativeGemini3.js +104 -9
  88. package/dist/lib/providers/googleVertex.d.ts +1 -1
  89. package/dist/lib/providers/googleVertex.js +466 -165
  90. package/dist/lib/providers/groq.d.ts +1 -1
  91. package/dist/lib/providers/groq.js +2 -1
  92. package/dist/lib/providers/huggingFace.d.ts +1 -1
  93. package/dist/lib/providers/huggingFace.js +3 -1
  94. package/dist/lib/providers/ideogram.d.ts +1 -1
  95. package/dist/lib/providers/jina.d.ts +1 -1
  96. package/dist/lib/providers/litellm.d.ts +1 -1
  97. package/dist/lib/providers/litellm.js +12 -6
  98. package/dist/lib/providers/llamaCpp.d.ts +1 -1
  99. package/dist/lib/providers/llamaCpp.js +2 -1
  100. package/dist/lib/providers/lmStudio.d.ts +1 -1
  101. package/dist/lib/providers/lmStudio.js +2 -1
  102. package/dist/lib/providers/mistral.d.ts +1 -1
  103. package/dist/lib/providers/mistral.js +2 -1
  104. package/dist/lib/providers/nvidiaNim.d.ts +1 -1
  105. package/dist/lib/providers/nvidiaNim.js +2 -1
  106. package/dist/lib/providers/ollama.d.ts +1 -1
  107. package/dist/lib/providers/ollama.js +1 -2
  108. package/dist/lib/providers/openAI.d.ts +1 -1
  109. package/dist/lib/providers/openAI.js +3 -1
  110. package/dist/lib/providers/openRouter.d.ts +1 -1
  111. package/dist/lib/providers/openRouter.js +3 -1
  112. package/dist/lib/providers/openaiCompatible.d.ts +1 -1
  113. package/dist/lib/providers/openaiCompatible.js +3 -1
  114. package/dist/lib/providers/perplexity.d.ts +1 -1
  115. package/dist/lib/providers/perplexity.js +2 -1
  116. package/dist/lib/providers/providerTypeUtils.d.ts +2 -7
  117. package/dist/lib/providers/providerTypeUtils.js +0 -6
  118. package/dist/lib/providers/recraft.d.ts +1 -1
  119. package/dist/lib/providers/replicate.d.ts +1 -1
  120. package/dist/lib/providers/stability.d.ts +1 -1
  121. package/dist/lib/providers/togetherAi.d.ts +1 -1
  122. package/dist/lib/providers/togetherAi.js +2 -1
  123. package/dist/lib/providers/voyage.d.ts +1 -1
  124. package/dist/lib/providers/xai.d.ts +1 -1
  125. package/dist/lib/providers/xai.js +2 -1
  126. package/dist/lib/proxy/claudeFormat.d.ts +0 -15
  127. package/dist/lib/proxy/claudeFormat.js +1 -11
  128. package/dist/lib/rag/ragIntegration.d.ts +1 -12
  129. package/dist/lib/rag/ragIntegration.js +0 -8
  130. package/dist/lib/tasks/tools/taskTools.d.ts +2 -117
  131. package/dist/lib/tasks/tools/taskTools.js +1 -10
  132. package/dist/lib/types/aliases.d.ts +1 -1
  133. package/dist/lib/types/conversation.d.ts +17 -0
  134. package/dist/lib/types/evaluation.d.ts +1 -5
  135. package/dist/lib/types/evaluation.js +0 -4
  136. package/dist/lib/types/generate.d.ts +2 -22
  137. package/dist/lib/types/guardrails.d.ts +1 -1
  138. package/dist/lib/types/middleware.d.ts +8 -3
  139. package/dist/lib/types/providers.d.ts +2 -1
  140. package/dist/lib/types/rag.d.ts +1 -1
  141. package/dist/lib/types/rag.js +0 -6
  142. package/dist/lib/types/stream.d.ts +2 -11
  143. package/dist/lib/types/tools.d.ts +2 -1
  144. package/dist/lib/utils/generation.d.ts +8 -0
  145. package/dist/lib/utils/generation.js +9 -0
  146. package/dist/lib/utils/generationErrors.d.ts +10 -0
  147. package/dist/lib/utils/generationErrors.js +11 -0
  148. package/dist/lib/utils/messageBuilder.d.ts +1 -6
  149. package/dist/lib/utils/messageBuilder.js +0 -5
  150. package/dist/lib/utils/noOutputSentinel.d.ts +0 -13
  151. package/dist/lib/utils/noOutputSentinel.js +1 -14
  152. package/dist/lib/utils/providerRetry.js +1 -1
  153. package/dist/lib/utils/tool.d.ts +8 -0
  154. package/dist/lib/utils/tool.js +9 -0
  155. package/dist/lib/utils/toolCallRepair.d.ts +1 -16
  156. package/dist/lib/utils/toolCallRepair.js +1 -16
  157. package/dist/lib/utils/toolChoice.d.ts +1 -1
  158. package/dist/lib/utils/videoAnalysisProcessor.d.ts +1 -8
  159. package/dist/lib/utils/videoAnalysisProcessor.js +0 -7
  160. package/dist/memory/memoryRetrievalTools.d.ts +2 -126
  161. package/dist/memory/memoryRetrievalTools.js +1 -9
  162. package/dist/middleware/builtin/autoEvaluation.d.ts +0 -3
  163. package/dist/middleware/builtin/autoEvaluation.js +0 -3
  164. package/dist/middleware/builtin/guardrails.js +1 -1
  165. package/dist/middleware/builtin/lifecycle.d.ts +0 -9
  166. package/dist/middleware/builtin/lifecycle.js +0 -9
  167. package/dist/middleware/factory.d.ts +1 -1
  168. package/dist/middleware/factory.js +1 -1
  169. package/dist/middleware/registry.d.ts +1 -1
  170. package/dist/neurolink.d.ts +14 -2
  171. package/dist/neurolink.js +46 -18
  172. package/dist/processors/media/AudioProcessor.js +8 -3
  173. package/dist/providers/amazonBedrock.js +1 -2
  174. package/dist/providers/amazonSagemaker.d.ts +1 -7
  175. package/dist/providers/amazonSagemaker.js +0 -6
  176. package/dist/providers/anthropic.d.ts +1 -1
  177. package/dist/providers/anthropic.js +2 -1
  178. package/dist/providers/anthropicBaseProvider.d.ts +1 -1
  179. package/dist/providers/anthropicBaseProvider.js +2 -1
  180. package/dist/providers/azureOpenai.d.ts +1 -1
  181. package/dist/providers/azureOpenai.js +2 -1
  182. package/dist/providers/cloudflare.d.ts +1 -1
  183. package/dist/providers/cloudflare.js +2 -1
  184. package/dist/providers/cohere.d.ts +1 -1
  185. package/dist/providers/cohere.js +2 -1
  186. package/dist/providers/deepseek.d.ts +1 -1
  187. package/dist/providers/deepseek.js +2 -1
  188. package/dist/providers/fireworks.d.ts +1 -1
  189. package/dist/providers/fireworks.js +2 -1
  190. package/dist/providers/googleAiStudio.d.ts +1 -1
  191. package/dist/providers/googleAiStudio.js +82 -5
  192. package/dist/providers/googleNativeGemini3.d.ts +3 -6
  193. package/dist/providers/googleNativeGemini3.js +104 -9
  194. package/dist/providers/googleVertex.d.ts +1 -1
  195. package/dist/providers/googleVertex.js +466 -164
  196. package/dist/providers/groq.d.ts +1 -1
  197. package/dist/providers/groq.js +2 -1
  198. package/dist/providers/huggingFace.d.ts +1 -1
  199. package/dist/providers/huggingFace.js +3 -1
  200. package/dist/providers/ideogram.d.ts +1 -1
  201. package/dist/providers/jina.d.ts +1 -1
  202. package/dist/providers/litellm.d.ts +1 -1
  203. package/dist/providers/litellm.js +12 -6
  204. package/dist/providers/llamaCpp.d.ts +1 -1
  205. package/dist/providers/llamaCpp.js +2 -1
  206. package/dist/providers/lmStudio.d.ts +1 -1
  207. package/dist/providers/lmStudio.js +2 -1
  208. package/dist/providers/mistral.d.ts +1 -1
  209. package/dist/providers/mistral.js +2 -1
  210. package/dist/providers/nvidiaNim.d.ts +1 -1
  211. package/dist/providers/nvidiaNim.js +2 -1
  212. package/dist/providers/ollama.d.ts +1 -1
  213. package/dist/providers/ollama.js +1 -2
  214. package/dist/providers/openAI.d.ts +1 -1
  215. package/dist/providers/openAI.js +3 -1
  216. package/dist/providers/openRouter.d.ts +1 -1
  217. package/dist/providers/openRouter.js +3 -1
  218. package/dist/providers/openaiCompatible.d.ts +1 -1
  219. package/dist/providers/openaiCompatible.js +3 -1
  220. package/dist/providers/perplexity.d.ts +1 -1
  221. package/dist/providers/perplexity.js +2 -1
  222. package/dist/providers/providerTypeUtils.d.ts +2 -7
  223. package/dist/providers/providerTypeUtils.js +0 -6
  224. package/dist/providers/recraft.d.ts +1 -1
  225. package/dist/providers/replicate.d.ts +1 -1
  226. package/dist/providers/stability.d.ts +1 -1
  227. package/dist/providers/togetherAi.d.ts +1 -1
  228. package/dist/providers/togetherAi.js +2 -1
  229. package/dist/providers/voyage.d.ts +1 -1
  230. package/dist/providers/xai.d.ts +1 -1
  231. package/dist/providers/xai.js +2 -1
  232. package/dist/proxy/claudeFormat.d.ts +0 -15
  233. package/dist/proxy/claudeFormat.js +1 -11
  234. package/dist/rag/ragIntegration.d.ts +1 -12
  235. package/dist/rag/ragIntegration.js +0 -8
  236. package/dist/tasks/tools/taskTools.d.ts +2 -117
  237. package/dist/tasks/tools/taskTools.js +1 -10
  238. package/dist/types/aliases.d.ts +1 -1
  239. package/dist/types/conversation.d.ts +17 -0
  240. package/dist/types/evaluation.d.ts +1 -5
  241. package/dist/types/evaluation.js +0 -4
  242. package/dist/types/generate.d.ts +2 -22
  243. package/dist/types/guardrails.d.ts +1 -1
  244. package/dist/types/middleware.d.ts +8 -3
  245. package/dist/types/providers.d.ts +2 -1
  246. package/dist/types/rag.d.ts +1 -1
  247. package/dist/types/rag.js +0 -6
  248. package/dist/types/stream.d.ts +2 -11
  249. package/dist/types/tools.d.ts +2 -1
  250. package/dist/utils/generation.d.ts +8 -0
  251. package/dist/utils/generation.js +8 -0
  252. package/dist/utils/generationErrors.d.ts +10 -0
  253. package/dist/utils/generationErrors.js +10 -0
  254. package/dist/utils/messageBuilder.d.ts +1 -6
  255. package/dist/utils/messageBuilder.js +0 -5
  256. package/dist/utils/noOutputSentinel.d.ts +0 -13
  257. package/dist/utils/noOutputSentinel.js +1 -14
  258. package/dist/utils/providerRetry.js +1 -1
  259. package/dist/utils/tool.d.ts +8 -0
  260. package/dist/utils/tool.js +8 -0
  261. package/dist/utils/toolCallRepair.d.ts +1 -16
  262. package/dist/utils/toolCallRepair.js +1 -16
  263. package/dist/utils/toolChoice.d.ts +1 -1
  264. package/dist/utils/videoAnalysisProcessor.d.ts +1 -8
  265. package/dist/utils/videoAnalysisProcessor.js +0 -7
  266. package/package.json +2 -3
@@ -1,14 +1,5 @@
1
- /**
2
- * Built-in agent tools for TaskManager.
3
- *
4
- * These tools allow the AI to self-schedule, manage, and inspect tasks
5
- * during conversations. Created per-instance via `createTaskTools()` factory,
6
- * following the same pattern as `createFileTools()` in files/fileTools.ts.
7
- *
8
- * @module tasks/tools/taskTools
9
- */
10
1
  import type { TaskManager } from "../taskManager.js";
11
- import type { TaskSchedule } from "../../types/index.js";
2
+ import type { Tool } from "../../types/index.js";
12
3
  /**
13
4
  * Create task management tools bound to a TaskManager instance.
14
5
  *
@@ -26,110 +17,4 @@ import type { TaskSchedule } from "../../types/index.js";
26
17
  * // tools.createTask, tools.listTasks, tools.getTaskRuns, etc.
27
18
  * ```
28
19
  */
29
- export declare function createTaskTools(manager: TaskManager): {
30
- createTask: import("ai").Tool<{
31
- name: string;
32
- prompt: string;
33
- schedule: {
34
- type: "once" | "cron" | "interval";
35
- expression?: string | undefined;
36
- timezone?: string | undefined;
37
- every?: number | undefined;
38
- at?: string | undefined;
39
- };
40
- mode?: "isolated" | "continuation" | undefined;
41
- }, {
42
- success: boolean;
43
- taskId: string;
44
- name: string;
45
- status: import("../../types/task.js").TaskStatus;
46
- mode: import("../../types/task.js").TaskExecutionMode;
47
- nextRunAt: string | undefined;
48
- schedule: TaskSchedule;
49
- error?: undefined;
50
- } | {
51
- success: boolean;
52
- error: string;
53
- taskId?: undefined;
54
- name?: undefined;
55
- status?: undefined;
56
- mode?: undefined;
57
- nextRunAt?: undefined;
58
- schedule?: undefined;
59
- }>;
60
- listTasks: import("ai").Tool<{
61
- status?: "completed" | "failed" | "cancelled" | "pending" | "active" | "paused" | undefined;
62
- }, {
63
- success: boolean;
64
- count: number;
65
- tasks: {
66
- taskId: string;
67
- name: string;
68
- status: import("../../types/task.js").TaskStatus;
69
- mode: import("../../types/task.js").TaskExecutionMode;
70
- schedule: TaskSchedule;
71
- runCount: number;
72
- lastRunAt: string | undefined;
73
- nextRunAt: string | undefined;
74
- }[];
75
- error?: undefined;
76
- } | {
77
- success: boolean;
78
- error: string;
79
- count?: undefined;
80
- tasks?: undefined;
81
- }>;
82
- getTaskRuns: import("ai").Tool<{
83
- taskId: string;
84
- limit?: number | undefined;
85
- }, {
86
- success: boolean;
87
- taskId: string;
88
- count: number;
89
- runs: {
90
- runId: string;
91
- status: "error" | "success";
92
- output: string | undefined;
93
- durationMs: number;
94
- timestamp: string;
95
- error: string | undefined;
96
- }[];
97
- error?: undefined;
98
- } | {
99
- success: boolean;
100
- error: string;
101
- taskId?: undefined;
102
- count?: undefined;
103
- runs?: undefined;
104
- }>;
105
- deleteTask: import("ai").Tool<{
106
- taskId: string;
107
- }, {
108
- success: boolean;
109
- error: string;
110
- deletedTask?: undefined;
111
- taskId?: undefined;
112
- } | {
113
- success: boolean;
114
- deletedTask: string;
115
- taskId: string;
116
- error?: undefined;
117
- }>;
118
- runTaskNow: import("ai").Tool<{
119
- taskId: string;
120
- }, {
121
- success: boolean;
122
- runId: string;
123
- status: "error" | "success";
124
- output: string | undefined;
125
- durationMs: number;
126
- error: string | undefined;
127
- } | {
128
- success: boolean;
129
- error: string;
130
- runId?: undefined;
131
- status?: undefined;
132
- output?: undefined;
133
- durationMs?: undefined;
134
- }>;
135
- };
20
+ export declare function createTaskTools(manager: TaskManager): Record<string, Tool>;
@@ -1,16 +1,7 @@
1
- /**
2
- * Built-in agent tools for TaskManager.
3
- *
4
- * These tools allow the AI to self-schedule, manage, and inspect tasks
5
- * during conversations. Created per-instance via `createTaskTools()` factory,
6
- * following the same pattern as `createFileTools()` in files/fileTools.ts.
7
- *
8
- * @module tasks/tools/taskTools
9
- */
10
- import { tool } from "ai";
11
1
  import { z } from "zod";
12
2
  import { logger } from "../../utils/logger.js";
13
3
  import { TaskError } from "../errors.js";
4
+ import { tool } from "../../utils/tool.js";
14
5
  /**
15
6
  * Parse a schedule object from tool input.
16
7
  * Accepts: { type: "cron", expression } | { type: "interval", every } | { type: "once", at }
@@ -3,9 +3,9 @@
3
3
  * Centralizes commonly used complex types to improve readability and maintainability
4
4
  */
5
5
  import type { ZodTypeAny } from "zod";
6
- import type { Schema } from "ai";
7
6
  import type { JsonValue, Result, AsyncFunction } from "./common.js";
8
7
  import { zodToJsonSchema } from "zod-to-json-schema";
8
+ import type { Schema } from "./tools.js";
9
9
  /**
10
10
  * Type alias for complex Zod schema type to improve readability
11
11
  * Used across providers and validation systems
@@ -34,6 +34,7 @@
34
34
  */
35
35
  import type { HippocampusMemory, HippocampusStorageConfig } from "./memory.js";
36
36
  import type { ObservabilityConfig } from "./observability.js";
37
+ export type { ModelMessage, SystemModelMessage, UserModelMessage, AssistantModelMessage, ToolModelMessage, TextPart, ImagePart, FilePart, ToolCallPart, ToolResultPart, AssistantContent, UserContent, ToolContent, DataContent, } from "ai";
37
38
  /**
38
39
  * Legacy public alias for the Hippocampus storage configuration.
39
40
  * The structural definition lives in `./memory.ts`; this re-export keeps
@@ -544,3 +545,19 @@ export type ProviderDetails = {
544
545
  provider: string;
545
546
  model: string;
546
547
  };
548
+ /**
549
+ * Reduced ChatMessage shape used by callers (typically tests and history
550
+ * reconstructors) that pass synthetic entries into the Gemini history
551
+ * reconstructor without filling every `ChatMessage` field. Mirrors the
552
+ * fields actually read by `prependConversationMessages`.
553
+ */
554
+ export type MinimalChatMessage = {
555
+ role: ChatMessage["role"];
556
+ content: string;
557
+ tool?: string;
558
+ args?: Record<string, unknown>;
559
+ metadata?: {
560
+ stepIndex?: number;
561
+ thoughtSignature?: string;
562
+ };
563
+ };
@@ -1,13 +1,9 @@
1
- /**
2
- * Evaluation type definitions for NeuroLink
3
- * Provider performance tracking, evaluation configurations, and provider optimization types
4
- */
5
- import type { LanguageModelV3CallOptions } from "@ai-sdk/provider";
6
1
  import type { TokenUsage } from "./analytics.js";
7
2
  import type { GenerateResult } from "./generate.js";
8
3
  import type { ToolExecution } from "./tools.js";
9
4
  import type { JsonObject } from "./common.js";
10
5
  import type { AggregatedScores, EvaluationTraceContext, PipelineConfig, ReportConfig, ReportFormat, ScoreResult, ScorerInput } from "./scorer.js";
6
+ import type { LanguageModelV3CallOptions } from "./middleware.js";
11
7
  /**
12
8
  * Evaluation provider type as specified in core module refactoring
13
9
  */
@@ -1,6 +1,2 @@
1
- /**
2
- * Evaluation type definitions for NeuroLink
3
- * Provider performance tracking, evaluation configurations, and provider optimization types
4
- */
5
1
  export {};
6
2
  //# sourceMappingURL=evaluation.js.map
@@ -1,4 +1,3 @@
1
- import type { Schema, Tool, ToolChoice, StepResult, LanguageModel } from "ai";
2
1
  import type { AIProviderName } from "../constants/enums.js";
3
2
  import type { RAGConfig } from "./rag.js";
4
3
  import type { AnalyticsData, TokenUsage } from "./analytics.js";
@@ -17,6 +16,8 @@ import type { StandardRecord, ValidationSchema, ZodUnknownSchema } from "./alias
17
16
  import type { NeurolinkCredentials } from "./providers.js";
18
17
  import type { FileWithMetadata } from "./file.js";
19
18
  import type { WorkflowConfig } from "./workflow.js";
19
+ import type { Schema, Tool, ToolChoice } from "./tools.js";
20
+ import type { StepResult, LanguageModel } from "./providers.js";
20
21
  /**
21
22
  * Generate function options type - Primary method for content generation
22
23
  * Supports multimodal content while maintaining backward compatibility
@@ -467,17 +468,6 @@ export type GenerateOptions = {
467
468
  * callers can correlate generation traces back to their own request lifecycle.
468
469
  */
469
470
  requestId?: string;
470
- /**
471
- * File reference registry for on-demand file processing.
472
- *
473
- * When set, files above the "tiny" size tier (>10KB) will be registered
474
- * as lightweight references instead of being fully loaded into the prompt.
475
- * The LLM can then access file content on-demand via file tools
476
- * (list_attached_files, read_file_section, search_in_file).
477
- *
478
- * @internal Set by NeuroLink SDK — not typically used directly by consumers.
479
- */
480
- fileRegistry?: unknown;
481
471
  /** Per-call middleware configuration. */
482
472
  middleware?: MiddlewareFactoryOptions;
483
473
  /** Callback invoked when generation completes successfully. */
@@ -988,16 +978,6 @@ export type TextGenerationOptions = {
988
978
  includeHeaders?: boolean;
989
979
  };
990
980
  enableSummarization?: boolean;
991
- /**
992
- * File reference registry for on-demand file processing (internal).
993
- *
994
- * When set, files above the "tiny" size tier (>10KB) will be registered
995
- * as lightweight references instead of being fully loaded into the prompt.
996
- * The LLM can then access file content on-demand via file tools.
997
- *
998
- * @internal Set by NeuroLink SDK — not typically used directly by consumers.
999
- */
1000
- fileRegistry?: unknown;
1001
981
  /**
1002
982
  * Skip injecting tool schemas into the system prompt.
1003
983
  * When true, tools are ONLY passed natively via the provider's `tools` parameter,
@@ -1,4 +1,4 @@
1
- import type { LanguageModel } from "ai";
1
+ import type { LanguageModel } from "./providers.js";
2
2
  /**
3
3
  * Result from precall evaluation of user input
4
4
  */
@@ -1,7 +1,12 @@
1
- import type { LanguageModelMiddleware } from "ai";
2
1
  import type { JsonValue } from "../types/common.js";
3
2
  import type { EvaluationData, GetPromptFunction } from "./evaluation.js";
4
3
  import type { AuthenticatedUser, RouteDefinition, ServerContext } from "./server.js";
4
+ import type { LanguageModelMiddleware as BaseLanguageModelMiddleware } from "ai";
5
+ export type { LanguageModelMiddleware } from "ai";
6
+ export type { LanguageModelV3, LanguageModelV3CallOptions, LanguageModelV3Message, LanguageModelV3StreamPart, LanguageModelV3ToolCall, LanguageModelV3ToolChoice, LanguageModelV3Source, LanguageModelV3Middleware, JSONSchema7, } from "@ai-sdk/provider";
7
+ import type { LanguageModelV3 } from "@ai-sdk/provider";
8
+ export type LanguageModelV3GenerateResult = Awaited<ReturnType<LanguageModelV3["doGenerate"]>>;
9
+ export type LanguageModelV3StreamResult = Awaited<ReturnType<LanguageModelV3["doStream"]>>;
5
10
  /**
6
11
  * Metadata type for NeuroLink middleware
7
12
  * Provides additional information about middleware without affecting execution
@@ -24,7 +29,7 @@ export type NeuroLinkMiddlewareMetadata = {
24
29
  * NeuroLink middleware with metadata
25
30
  * Combines standard AI SDK middleware with NeuroLink-specific metadata
26
31
  */
27
- export type NeuroLinkMiddleware = LanguageModelMiddleware & {
32
+ export type NeuroLinkMiddleware = BaseLanguageModelMiddleware & {
28
33
  /** Middleware metadata */
29
34
  readonly metadata: NeuroLinkMiddlewareMetadata;
30
35
  };
@@ -192,7 +197,7 @@ export type MiddlewareRegistryEntry = {
192
197
  /**
193
198
  * Middleware factory function type
194
199
  */
195
- export type MiddlewareFactory = (config: Record<string, unknown>) => LanguageModelMiddleware;
200
+ export type MiddlewareFactory = (config: Record<string, unknown>) => BaseLanguageModelMiddleware;
196
201
  /**
197
202
  * Middleware validation result
198
203
  */
@@ -4,12 +4,13 @@
4
4
  import type { UnknownRecord, JsonValue, StreamingCapability } from "./common.js";
5
5
  import type { ProviderError } from "./errors.js";
6
6
  import { AIProviderName, AnthropicModels, BedrockModels, DeepSeekModels, GoogleAIModels, LlamaCppModels, LMStudioModels, NvidiaNimModels, OpenAIModels, VertexModels } from "../constants/enums.js";
7
- import type { Tool } from "ai";
8
7
  import type { ValidationSchema } from "./aliases.js";
9
8
  import type { EnhancedGenerateResult, GenerateResult, TextGenerationOptions } from "./generate.js";
10
9
  import type { StreamOptions, StreamResult } from "./stream.js";
11
10
  import type { ExternalMCPToolInfo } from "./externalMcp.js";
12
11
  import type { ClaudeSubscriptionTier, AnthropicAuthMethod, AnthropicAuthConfig, SubscriptionInfo, OAuthToken } from "./subscription.js";
12
+ import type { Tool } from "./tools.js";
13
+ export type { LanguageModel, EmbeddingModel, ImageModel, GenerateTextResult, StepResult, ToolCallRepairFunction, PrepareStepFunction, PrepareStepResult, FinishReason, LanguageModelUsage, LanguageModelRequestMetadata, LanguageModelResponseMetadata, } from "ai";
13
14
  export type { ClaudeSubscriptionTier, AnthropicAuthMethod, AnthropicAuthConfig, SubscriptionInfo, } from "./subscription.js";
14
15
  /**
15
16
  * Generic AI SDK model interface
@@ -1,3 +1,4 @@
1
+ import type { Tool } from "./tools.js";
1
2
  /**
2
3
  * RAG Type Definitions
3
4
  *
@@ -525,7 +526,6 @@ export type RAGCircuitBreakerEvents = {
525
526
  timestamp: Date;
526
527
  }];
527
528
  };
528
- import type { Tool } from "ai";
529
529
  /** Prepared RAG tool ready for injection into generate/stream. */
530
530
  export type RAGPreparedTool = {
531
531
  /** The tool to inject into the tools Record */
@@ -1,8 +1,2 @@
1
- /**
2
- * RAG Type Definitions
3
- *
4
- * Canonical type file for all RAG (Retrieval-Augmented Generation) interfaces.
5
- * All exported interfaces from src/lib/rag/ are collected here as type aliases.
6
- */
7
1
  export {};
8
2
  //# sourceMappingURL=rag.js.map
@@ -1,4 +1,3 @@
1
- import type { LanguageModel, StepResult, Tool, ToolChoice } from "ai";
2
1
  import type { AIProviderName } from "../constants/enums.js";
3
2
  import type { EvaluationData } from "./evaluation.js";
4
3
  import type { RAGConfig } from "./rag.js";
@@ -16,6 +15,8 @@ import type { STTOptions, STTResult } from "./stt.js";
16
15
  import type { StandardRecord, ValidationSchema } from "./aliases.js";
17
16
  import type { FileWithMetadata } from "./file.js";
18
17
  import type { WorkflowConfig } from "./workflow.js";
18
+ import type { LanguageModel, StepResult } from "./providers.js";
19
+ import type { Tool, ToolChoice } from "./tools.js";
19
20
  /**
20
21
  * Progress tracking and metadata for streaming operations
21
22
  */
@@ -433,16 +434,6 @@ export type StreamOptions = {
433
434
  * ```
434
435
  */
435
436
  rag?: RAGConfig;
436
- /**
437
- * File reference registry for on-demand file processing (internal).
438
- *
439
- * When set, files above the "tiny" size tier (>10KB) will be registered
440
- * as lightweight references instead of being fully loaded into the prompt.
441
- * The LLM can then access file content on-demand via file tools.
442
- *
443
- * @internal Set by NeuroLink SDK — not typically used directly by consumers.
444
- */
445
- fileRegistry?: unknown;
446
437
  /** BZ-1341: Override fallback provider name (takes precedence over env/model config). */
447
438
  fallbackProvider?: string;
448
439
  /** BZ-1341: Override fallback model name (takes precedence over env/model config). */
@@ -3,13 +3,14 @@
3
3
  * argument patterns, execution metadata, context, and result types.
4
4
  */
5
5
  import { z } from "zod";
6
- import type { Tool } from "ai";
7
6
  import type { ErrorInfo, JsonObject, JsonValue, Result, UnknownRecord } from "./common.js";
8
7
  import type { StandardRecord, StringArray, ZodUnknownSchema } from "./aliases.js";
9
8
  import type { ValidationError } from "../utils/parameterValidation.js";
10
9
  import type { MCPToolAnnotations } from "./mcp.js";
11
10
  import type { Logger } from "./utilities.js";
12
11
  import type { HITLExecutionState } from "./hitl.js";
12
+ import type { Tool } from "ai";
13
+ export type { Tool, ToolSet, ToolChoice, ToolCallOptions, ToolExecuteFunction, ToolApprovalRequest, ToolApprovalResponse, InferToolInput, InferToolOutput, Schema, FlexibleSchema, InferSchema, } from "ai";
13
14
  /**
14
15
  * Commonly used Zod schema type aliases for cleaner type declarations
15
16
  */
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Generation, streaming, embedding, and middleware-composition primitives.
3
+ *
4
+ * Today these resolve through the upstream generation library; this file is
5
+ * the only internal source so the implementation can be replaced without
6
+ * touching call sites.
7
+ */
8
+ export { generateText, streamText, generateObject, streamObject, embed, embedMany, wrapLanguageModel, experimental_transcribe, } from "ai";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Generation, streaming, embedding, and middleware-composition primitives.
3
+ *
4
+ * Today these resolve through the upstream generation library; this file is
5
+ * the only internal source so the implementation can be replaced without
6
+ * touching call sites.
7
+ */
8
+ export { generateText, streamText, generateObject, streamObject, embed, embedMany, wrapLanguageModel, experimental_transcribe, } from "ai";
9
+ //# sourceMappingURL=generation.js.map
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Error classes surfaced by the generation pipeline.
3
+ *
4
+ * Used with `.isInstance(e)` checks and instanceof guards in retry,
5
+ * tool-call repair, and stream handling. Today these resolve through the
6
+ * upstream generation library; this file is the only internal source so the
7
+ * implementation can be replaced without touching call sites.
8
+ */
9
+ export { NoOutputGeneratedError, NoObjectGeneratedError, NoSuchToolError, InvalidToolInputError, } from "ai";
10
+ export { APICallError } from "@ai-sdk/provider";
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Error classes surfaced by the generation pipeline.
3
+ *
4
+ * Used with `.isInstance(e)` checks and instanceof guards in retry,
5
+ * tool-call repair, and stream handling. Today these resolve through the
6
+ * upstream generation library; this file is the only internal source so the
7
+ * implementation can be replaced without touching call sites.
8
+ */
9
+ export { NoOutputGeneratedError, NoObjectGeneratedError, NoSuchToolError, InvalidToolInputError, } from "ai";
10
+ export { APICallError } from "@ai-sdk/provider";
11
+ //# sourceMappingURL=generationErrors.js.map
@@ -1,10 +1,5 @@
1
- /**
2
- * Message Builder Utility
3
- * Centralized logic for building message arrays from TextGenerationOptions
4
- * Enhanced with multimodal support for images
5
- */
6
- import type { ModelMessage } from "ai";
7
1
  import type { GenerateOptions, MultimodalChatMessage, StreamOptions, TextGenerationOptions } from "../types/index.js";
2
+ import type { ModelMessage } from "../types/index.js";
8
3
  /**
9
4
  * Type-safe conversion from MultimodalChatMessage[] to ModelMessage[]
10
5
  * Filters out invalid content and ensures strict ModelMessage contract compliance
@@ -1,8 +1,3 @@
1
- /**
2
- * Message Builder Utility
3
- * Centralized logic for building message arrays from TextGenerationOptions
4
- * Enhanced with multimodal support for images
5
- */
6
1
  import { existsSync, readFileSync, statSync } from "fs";
7
2
  import { getGlobalDispatcher, interceptors, request } from "undici";
8
3
  import { MultimodalLogger, ProviderImageAdapter, } from "../adapters/providerImageAdapter.js";
@@ -1,16 +1,3 @@
1
- /**
2
- * Curator P3-6: shared builder for the `NoOutputGeneratedError` sentinel
3
- * chunk. Each provider's stream-transformation generator catches the AI
4
- * SDK's `NoOutputGeneratedError` and yields this sentinel so downstream
5
- * telemetry has finish reason + token usage + provider error context
6
- * instead of just `{ noOutput: true, errorType: "..." }`.
7
- *
8
- * The AI SDK rejects `result.finishReason` / `result.totalUsage` in this
9
- * branch today (see `ai/src/generate-text/stream-text.ts` ~L1078); we
10
- * still attempt to await them so a future SDK version surfacing partial
11
- * values populates the sentinel automatically. When they reject we keep
12
- * conservative defaults (`finishReason: "error"`, zero usage).
13
- */
14
1
  import type { StreamNoOutputSentinel, StreamNoOutputSentinelResultLike } from "../types/index.js";
15
2
  export declare function buildNoOutputSentinel(error: unknown, result?: StreamNoOutputSentinelResultLike,
16
3
  /**
@@ -1,18 +1,5 @@
1
- /**
2
- * Curator P3-6: shared builder for the `NoOutputGeneratedError` sentinel
3
- * chunk. Each provider's stream-transformation generator catches the AI
4
- * SDK's `NoOutputGeneratedError` and yields this sentinel so downstream
5
- * telemetry has finish reason + token usage + provider error context
6
- * instead of just `{ noOutput: true, errorType: "..." }`.
7
- *
8
- * The AI SDK rejects `result.finishReason` / `result.totalUsage` in this
9
- * branch today (see `ai/src/generate-text/stream-text.ts` ~L1078); we
10
- * still attempt to await them so a future SDK version surfacing partial
11
- * values populates the sentinel automatically. When they reject we keep
12
- * conservative defaults (`finishReason: "error"`, zero usage).
13
- */
14
- import { NoOutputGeneratedError } from "ai";
15
1
  import { trace, context as otelContext } from "@opentelemetry/api";
2
+ import { NoOutputGeneratedError } from "./generationErrors.js";
16
3
  export async function buildNoOutputSentinel(error, result,
17
4
  /**
18
5
  * Reviewer follow-up: AI SDK v6 wraps the AI SDK's
@@ -14,8 +14,8 @@
14
14
  * @module utils/providerRetry
15
15
  */
16
16
  import {} from "@opentelemetry/api";
17
- import { APICallError } from "@ai-sdk/provider";
18
17
  import { logger } from "./logger.js";
18
+ import { APICallError } from "./generationErrors.js";
19
19
  /** Maximum number of retry attempts after the initial call (total = 1 + MAX_PROVIDER_RETRIES). */
20
20
  export const MAX_PROVIDER_RETRIES = 2;
21
21
  /** Base delay in ms for exponential backoff between retries. */
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Tool definition helpers + structured-output spec.
3
+ *
4
+ * Today these resolve through the upstream generation library; this file is
5
+ * the only internal source for them so the implementation can be replaced
6
+ * without touching call sites.
7
+ */
8
+ export { tool, jsonSchema, Output, stepCountIs } from "ai";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Tool definition helpers + structured-output spec.
3
+ *
4
+ * Today these resolve through the upstream generation library; this file is
5
+ * the only internal source for them so the implementation can be replaced
6
+ * without touching call sites.
7
+ */
8
+ export { tool, jsonSchema, Output, stepCountIs } from "ai";
9
+ //# sourceMappingURL=tool.js.map
@@ -1,19 +1,4 @@
1
- /**
2
- * Schema-Driven Tool Call Repair (BZ-665)
3
- *
4
- * Implements `experimental_repairToolCall` for the Vercel AI SDK.
5
- * When an LLM sends a wrong tool name or wrong parameter names,
6
- * this module attempts deterministic, schema-driven repair:
7
- *
8
- * 1. Tool name: case-insensitive → substring → Levenshtein
9
- * 2. Param names: compare against JSON schema properties dynamically
10
- * 3. Type coercion: string→number, JSON string→object/array per schema
11
- *
12
- * Zero static alias maps. The tool's JSON schema is the only source of truth.
13
- *
14
- * @module utils/toolCallRepair
15
- */
16
- import type { ToolCallRepairFunction, ToolSet } from "ai";
1
+ import type { ToolCallRepairFunction, ToolSet } from "../types/index.js";
17
2
  /**
18
3
  * Create an `experimental_repairToolCall` handler for streamText/generateText.
19
4
  * Fully dynamic — reads the tool schema at repair time, no configuration needed.
@@ -1,18 +1,3 @@
1
- /**
2
- * Schema-Driven Tool Call Repair (BZ-665)
3
- *
4
- * Implements `experimental_repairToolCall` for the Vercel AI SDK.
5
- * When an LLM sends a wrong tool name or wrong parameter names,
6
- * this module attempts deterministic, schema-driven repair:
7
- *
8
- * 1. Tool name: case-insensitive → substring → Levenshtein
9
- * 2. Param names: compare against JSON schema properties dynamically
10
- * 3. Type coercion: string→number, JSON string→object/array per schema
11
- *
12
- * Zero static alias maps. The tool's JSON schema is the only source of truth.
13
- *
14
- * @module utils/toolCallRepair
15
- */
16
1
  import { logger } from "./logger.js";
17
2
  /**
18
3
  * Create an `experimental_repairToolCall` handler for streamText/generateText.
@@ -21,7 +6,7 @@ import { logger } from "./logger.js";
21
6
  export function createToolCallRepair() {
22
7
  return async ({ toolCall, tools, inputSchema, error }) => {
23
8
  // Import error classes lazily to avoid circular deps at module level
24
- const { NoSuchToolError: NoSuchTool, InvalidToolInputError: InvalidInput } = await import("ai");
9
+ const { NoSuchToolError: NoSuchTool, InvalidToolInputError: InvalidInput } = await import("./generationErrors.js");
25
10
  if (NoSuchTool.isInstance(error)) {
26
11
  return repairToolName(toolCall, Object.keys(tools));
27
12
  }
@@ -1,4 +1,4 @@
1
- import type { Tool, ToolChoice } from "ai";
1
+ import type { Tool, ToolChoice } from "../types/index.js";
2
2
  export declare function resolveToolChoice(options: {
3
3
  toolChoice?: ToolChoice<Record<string, Tool>>;
4
4
  }, tools: Record<string, Tool> | undefined, shouldUseTools: boolean): ToolChoice<Record<string, Tool>> | "none";
@@ -1,12 +1,5 @@
1
- /**
2
- * Video Analysis Processor
3
- *
4
- * Formats video analysis results into human-readable text
5
- *
6
- * @module utils/videoAnalysisProcessor
7
- */
8
- import type { ModelMessage } from "ai";
9
1
  import { AIProviderName } from "../constants/enums.js";
2
+ import type { ModelMessage } from "../types/index.js";
10
3
  /**
11
4
  * Check if messages contain video frames (images)
12
5
  * Only checks user messages to match buildContentParts behavior
@@ -1,10 +1,3 @@
1
- /**
2
- * Video Analysis Processor
3
- *
4
- * Formats video analysis results into human-readable text
5
- *
6
- * @module utils/videoAnalysisProcessor
7
- */
8
1
  import { AIProviderName } from "../constants/enums.js";
9
2
  import { logger } from "./logger.js";
10
3
  /**