@juspay/neurolink 9.65.1 → 9.66.0

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 (287) 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 +1 -5
  5. package/dist/autoresearch/tools.d.ts +2 -214
  6. package/dist/autoresearch/tools.js +1 -1
  7. package/dist/browser/neurolink.min.js +388 -386
  8. package/dist/cli/commands/proxy.js +154 -5
  9. package/dist/client/reactHooks.js +16 -8
  10. package/dist/client/reactHooks.tsx +24 -9
  11. package/dist/core/baseProvider.d.ts +1 -6
  12. package/dist/core/baseProvider.js +1 -1
  13. package/dist/core/modules/GenerationHandler.d.ts +2 -2
  14. package/dist/core/modules/GenerationHandler.js +3 -1
  15. package/dist/core/modules/MessageBuilder.d.ts +1 -15
  16. package/dist/core/modules/MessageBuilder.js +0 -14
  17. package/dist/core/modules/StreamHandler.js +1 -1
  18. package/dist/core/modules/ToolsManager.d.ts +1 -17
  19. package/dist/core/modules/ToolsManager.js +1 -17
  20. package/dist/core/streamAnalytics.js +1 -1
  21. package/dist/evaluation/contextBuilder.d.ts +1 -4
  22. package/dist/evaluation/contextBuilder.js +0 -3
  23. package/dist/evaluation/index.d.ts +1 -4
  24. package/dist/evaluation/index.js +0 -3
  25. package/dist/files/fileTools.d.ts +2 -18
  26. package/dist/files/fileTools.js +3 -19
  27. package/dist/lib/adapters/video/videoAnalyzer.d.ts +1 -1
  28. package/dist/lib/agent/directTools.d.ts +9 -17
  29. package/dist/lib/agent/directTools.js +1 -5
  30. package/dist/lib/autoresearch/tools.d.ts +2 -214
  31. package/dist/lib/autoresearch/tools.js +1 -1
  32. package/dist/lib/client/reactHooks.js +16 -8
  33. package/dist/lib/core/baseProvider.d.ts +1 -6
  34. package/dist/lib/core/baseProvider.js +1 -1
  35. package/dist/lib/core/modules/GenerationHandler.d.ts +2 -2
  36. package/dist/lib/core/modules/GenerationHandler.js +3 -1
  37. package/dist/lib/core/modules/MessageBuilder.d.ts +1 -15
  38. package/dist/lib/core/modules/MessageBuilder.js +0 -14
  39. package/dist/lib/core/modules/StreamHandler.js +1 -1
  40. package/dist/lib/core/modules/ToolsManager.d.ts +1 -17
  41. package/dist/lib/core/modules/ToolsManager.js +1 -17
  42. package/dist/lib/core/streamAnalytics.js +1 -1
  43. package/dist/lib/evaluation/contextBuilder.d.ts +1 -4
  44. package/dist/lib/evaluation/contextBuilder.js +0 -3
  45. package/dist/lib/evaluation/index.d.ts +1 -4
  46. package/dist/lib/evaluation/index.js +0 -3
  47. package/dist/lib/files/fileTools.d.ts +2 -18
  48. package/dist/lib/files/fileTools.js +3 -19
  49. package/dist/lib/memory/memoryRetrievalTools.d.ts +2 -126
  50. package/dist/lib/memory/memoryRetrievalTools.js +1 -9
  51. package/dist/lib/middleware/builtin/autoEvaluation.d.ts +0 -3
  52. package/dist/lib/middleware/builtin/autoEvaluation.js +0 -3
  53. package/dist/lib/middleware/builtin/guardrails.js +1 -1
  54. package/dist/lib/middleware/builtin/lifecycle.d.ts +0 -9
  55. package/dist/lib/middleware/builtin/lifecycle.js +0 -9
  56. package/dist/lib/middleware/factory.d.ts +1 -1
  57. package/dist/lib/middleware/factory.js +1 -1
  58. package/dist/lib/middleware/registry.d.ts +1 -1
  59. package/dist/lib/neurolink.d.ts +14 -2
  60. package/dist/lib/neurolink.js +46 -18
  61. package/dist/lib/processors/media/AudioProcessor.js +8 -3
  62. package/dist/lib/providers/amazonBedrock.js +1 -2
  63. package/dist/lib/providers/amazonSagemaker.d.ts +1 -7
  64. package/dist/lib/providers/amazonSagemaker.js +0 -6
  65. package/dist/lib/providers/anthropic.d.ts +1 -1
  66. package/dist/lib/providers/anthropic.js +2 -1
  67. package/dist/lib/providers/anthropicBaseProvider.d.ts +1 -1
  68. package/dist/lib/providers/anthropicBaseProvider.js +2 -1
  69. package/dist/lib/providers/azureOpenai.d.ts +1 -1
  70. package/dist/lib/providers/azureOpenai.js +2 -1
  71. package/dist/lib/providers/cloudflare.d.ts +1 -1
  72. package/dist/lib/providers/cloudflare.js +2 -1
  73. package/dist/lib/providers/cohere.d.ts +1 -1
  74. package/dist/lib/providers/cohere.js +2 -1
  75. package/dist/lib/providers/deepseek.d.ts +1 -1
  76. package/dist/lib/providers/deepseek.js +2 -1
  77. package/dist/lib/providers/fireworks.d.ts +1 -1
  78. package/dist/lib/providers/fireworks.js +2 -1
  79. package/dist/lib/providers/googleAiStudio.d.ts +1 -1
  80. package/dist/lib/providers/googleAiStudio.js +0 -1
  81. package/dist/lib/providers/googleNativeGemini3.d.ts +1 -1
  82. package/dist/lib/providers/googleNativeGemini3.js +1 -1
  83. package/dist/lib/providers/googleVertex.d.ts +1 -1
  84. package/dist/lib/providers/googleVertex.js +0 -1
  85. package/dist/lib/providers/groq.d.ts +1 -1
  86. package/dist/lib/providers/groq.js +2 -1
  87. package/dist/lib/providers/huggingFace.d.ts +1 -1
  88. package/dist/lib/providers/huggingFace.js +3 -1
  89. package/dist/lib/providers/ideogram.d.ts +1 -1
  90. package/dist/lib/providers/jina.d.ts +1 -1
  91. package/dist/lib/providers/litellm.d.ts +1 -1
  92. package/dist/lib/providers/litellm.js +12 -6
  93. package/dist/lib/providers/llamaCpp.d.ts +1 -1
  94. package/dist/lib/providers/llamaCpp.js +2 -1
  95. package/dist/lib/providers/lmStudio.d.ts +1 -1
  96. package/dist/lib/providers/lmStudio.js +2 -1
  97. package/dist/lib/providers/mistral.d.ts +1 -1
  98. package/dist/lib/providers/mistral.js +2 -1
  99. package/dist/lib/providers/nvidiaNim.d.ts +1 -1
  100. package/dist/lib/providers/nvidiaNim.js +2 -1
  101. package/dist/lib/providers/ollama.d.ts +1 -1
  102. package/dist/lib/providers/ollama.js +1 -2
  103. package/dist/lib/providers/openAI.d.ts +1 -1
  104. package/dist/lib/providers/openAI.js +3 -1
  105. package/dist/lib/providers/openRouter.d.ts +1 -1
  106. package/dist/lib/providers/openRouter.js +3 -1
  107. package/dist/lib/providers/openaiCompatible.d.ts +1 -1
  108. package/dist/lib/providers/openaiCompatible.js +3 -1
  109. package/dist/lib/providers/perplexity.d.ts +1 -1
  110. package/dist/lib/providers/perplexity.js +2 -1
  111. package/dist/lib/providers/providerTypeUtils.d.ts +2 -7
  112. package/dist/lib/providers/providerTypeUtils.js +0 -6
  113. package/dist/lib/providers/recraft.d.ts +1 -1
  114. package/dist/lib/providers/replicate.d.ts +1 -1
  115. package/dist/lib/providers/stability.d.ts +1 -1
  116. package/dist/lib/providers/togetherAi.d.ts +1 -1
  117. package/dist/lib/providers/togetherAi.js +2 -1
  118. package/dist/lib/providers/voyage.d.ts +1 -1
  119. package/dist/lib/providers/xai.d.ts +1 -1
  120. package/dist/lib/providers/xai.js +2 -1
  121. package/dist/lib/proxy/claudeFormat.d.ts +0 -15
  122. package/dist/lib/proxy/claudeFormat.js +1 -11
  123. package/dist/lib/proxy/modelRouter.d.ts +5 -1
  124. package/dist/lib/proxy/modelRouter.js +8 -0
  125. package/dist/lib/proxy/openaiFormat.d.ts +137 -0
  126. package/dist/lib/proxy/openaiFormat.js +801 -0
  127. package/dist/lib/proxy/proxyTranslationEngine.d.ts +124 -0
  128. package/dist/lib/proxy/proxyTranslationEngine.js +679 -0
  129. package/dist/lib/rag/ragIntegration.d.ts +1 -12
  130. package/dist/lib/rag/ragIntegration.js +0 -8
  131. package/dist/lib/server/routes/claudeProxyRoutes.d.ts +6 -5
  132. package/dist/lib/server/routes/claudeProxyRoutes.js +22 -355
  133. package/dist/lib/server/routes/index.d.ts +1 -0
  134. package/dist/lib/server/routes/index.js +10 -2
  135. package/dist/lib/server/routes/openaiProxyRoutes.d.ts +30 -0
  136. package/dist/lib/server/routes/openaiProxyRoutes.js +337 -0
  137. package/dist/lib/tasks/tools/taskTools.d.ts +2 -117
  138. package/dist/lib/tasks/tools/taskTools.js +1 -10
  139. package/dist/lib/types/aliases.d.ts +1 -1
  140. package/dist/lib/types/conversation.d.ts +1 -0
  141. package/dist/lib/types/evaluation.d.ts +1 -5
  142. package/dist/lib/types/evaluation.js +0 -4
  143. package/dist/lib/types/generate.d.ts +2 -22
  144. package/dist/lib/types/guardrails.d.ts +1 -1
  145. package/dist/lib/types/middleware.d.ts +8 -3
  146. package/dist/lib/types/providers.d.ts +2 -1
  147. package/dist/lib/types/proxy.d.ts +179 -0
  148. package/dist/lib/types/rag.d.ts +1 -1
  149. package/dist/lib/types/rag.js +0 -6
  150. package/dist/lib/types/server.d.ts +3 -0
  151. package/dist/lib/types/stream.d.ts +2 -11
  152. package/dist/lib/types/tools.d.ts +2 -1
  153. package/dist/lib/utils/generation.d.ts +8 -0
  154. package/dist/lib/utils/generation.js +9 -0
  155. package/dist/lib/utils/generationErrors.d.ts +10 -0
  156. package/dist/lib/utils/generationErrors.js +11 -0
  157. package/dist/lib/utils/messageBuilder.d.ts +1 -6
  158. package/dist/lib/utils/messageBuilder.js +0 -5
  159. package/dist/lib/utils/noOutputSentinel.d.ts +0 -13
  160. package/dist/lib/utils/noOutputSentinel.js +1 -14
  161. package/dist/lib/utils/providerRetry.js +1 -1
  162. package/dist/lib/utils/tool.d.ts +8 -0
  163. package/dist/lib/utils/tool.js +9 -0
  164. package/dist/lib/utils/toolCallRepair.d.ts +1 -16
  165. package/dist/lib/utils/toolCallRepair.js +1 -16
  166. package/dist/lib/utils/toolChoice.d.ts +1 -1
  167. package/dist/lib/utils/videoAnalysisProcessor.d.ts +1 -8
  168. package/dist/lib/utils/videoAnalysisProcessor.js +0 -7
  169. package/dist/memory/memoryRetrievalTools.d.ts +2 -126
  170. package/dist/memory/memoryRetrievalTools.js +1 -9
  171. package/dist/middleware/builtin/autoEvaluation.d.ts +0 -3
  172. package/dist/middleware/builtin/autoEvaluation.js +0 -3
  173. package/dist/middleware/builtin/guardrails.js +1 -1
  174. package/dist/middleware/builtin/lifecycle.d.ts +0 -9
  175. package/dist/middleware/builtin/lifecycle.js +0 -9
  176. package/dist/middleware/factory.d.ts +1 -1
  177. package/dist/middleware/factory.js +1 -1
  178. package/dist/middleware/registry.d.ts +1 -1
  179. package/dist/neurolink.d.ts +14 -2
  180. package/dist/neurolink.js +46 -18
  181. package/dist/processors/media/AudioProcessor.js +8 -3
  182. package/dist/providers/amazonBedrock.js +1 -2
  183. package/dist/providers/amazonSagemaker.d.ts +1 -7
  184. package/dist/providers/amazonSagemaker.js +0 -6
  185. package/dist/providers/anthropic.d.ts +1 -1
  186. package/dist/providers/anthropic.js +2 -1
  187. package/dist/providers/anthropicBaseProvider.d.ts +1 -1
  188. package/dist/providers/anthropicBaseProvider.js +2 -1
  189. package/dist/providers/azureOpenai.d.ts +1 -1
  190. package/dist/providers/azureOpenai.js +2 -1
  191. package/dist/providers/cloudflare.d.ts +1 -1
  192. package/dist/providers/cloudflare.js +2 -1
  193. package/dist/providers/cohere.d.ts +1 -1
  194. package/dist/providers/cohere.js +2 -1
  195. package/dist/providers/deepseek.d.ts +1 -1
  196. package/dist/providers/deepseek.js +2 -1
  197. package/dist/providers/fireworks.d.ts +1 -1
  198. package/dist/providers/fireworks.js +2 -1
  199. package/dist/providers/googleAiStudio.d.ts +1 -1
  200. package/dist/providers/googleNativeGemini3.d.ts +1 -1
  201. package/dist/providers/googleNativeGemini3.js +1 -1
  202. package/dist/providers/googleVertex.d.ts +1 -1
  203. package/dist/providers/groq.d.ts +1 -1
  204. package/dist/providers/groq.js +2 -1
  205. package/dist/providers/huggingFace.d.ts +1 -1
  206. package/dist/providers/huggingFace.js +3 -1
  207. package/dist/providers/ideogram.d.ts +1 -1
  208. package/dist/providers/jina.d.ts +1 -1
  209. package/dist/providers/litellm.d.ts +1 -1
  210. package/dist/providers/litellm.js +12 -6
  211. package/dist/providers/llamaCpp.d.ts +1 -1
  212. package/dist/providers/llamaCpp.js +2 -1
  213. package/dist/providers/lmStudio.d.ts +1 -1
  214. package/dist/providers/lmStudio.js +2 -1
  215. package/dist/providers/mistral.d.ts +1 -1
  216. package/dist/providers/mistral.js +2 -1
  217. package/dist/providers/nvidiaNim.d.ts +1 -1
  218. package/dist/providers/nvidiaNim.js +2 -1
  219. package/dist/providers/ollama.d.ts +1 -1
  220. package/dist/providers/ollama.js +1 -2
  221. package/dist/providers/openAI.d.ts +1 -1
  222. package/dist/providers/openAI.js +3 -1
  223. package/dist/providers/openRouter.d.ts +1 -1
  224. package/dist/providers/openRouter.js +3 -1
  225. package/dist/providers/openaiCompatible.d.ts +1 -1
  226. package/dist/providers/openaiCompatible.js +3 -1
  227. package/dist/providers/perplexity.d.ts +1 -1
  228. package/dist/providers/perplexity.js +2 -1
  229. package/dist/providers/providerTypeUtils.d.ts +2 -7
  230. package/dist/providers/providerTypeUtils.js +0 -6
  231. package/dist/providers/recraft.d.ts +1 -1
  232. package/dist/providers/replicate.d.ts +1 -1
  233. package/dist/providers/stability.d.ts +1 -1
  234. package/dist/providers/togetherAi.d.ts +1 -1
  235. package/dist/providers/togetherAi.js +2 -1
  236. package/dist/providers/voyage.d.ts +1 -1
  237. package/dist/providers/xai.d.ts +1 -1
  238. package/dist/providers/xai.js +2 -1
  239. package/dist/proxy/claudeFormat.d.ts +0 -15
  240. package/dist/proxy/claudeFormat.js +1 -11
  241. package/dist/proxy/modelRouter.d.ts +5 -1
  242. package/dist/proxy/modelRouter.js +8 -0
  243. package/dist/proxy/openaiFormat.d.ts +137 -0
  244. package/dist/proxy/openaiFormat.js +800 -0
  245. package/dist/proxy/proxyTranslationEngine.d.ts +124 -0
  246. package/dist/proxy/proxyTranslationEngine.js +678 -0
  247. package/dist/rag/ragIntegration.d.ts +1 -12
  248. package/dist/rag/ragIntegration.js +0 -8
  249. package/dist/server/routes/claudeProxyRoutes.d.ts +6 -5
  250. package/dist/server/routes/claudeProxyRoutes.js +22 -355
  251. package/dist/server/routes/index.d.ts +1 -0
  252. package/dist/server/routes/index.js +10 -2
  253. package/dist/server/routes/openaiProxyRoutes.d.ts +30 -0
  254. package/dist/server/routes/openaiProxyRoutes.js +336 -0
  255. package/dist/tasks/tools/taskTools.d.ts +2 -117
  256. package/dist/tasks/tools/taskTools.js +1 -10
  257. package/dist/types/aliases.d.ts +1 -1
  258. package/dist/types/conversation.d.ts +1 -0
  259. package/dist/types/evaluation.d.ts +1 -5
  260. package/dist/types/evaluation.js +0 -4
  261. package/dist/types/generate.d.ts +2 -22
  262. package/dist/types/guardrails.d.ts +1 -1
  263. package/dist/types/middleware.d.ts +8 -3
  264. package/dist/types/providers.d.ts +2 -1
  265. package/dist/types/proxy.d.ts +179 -0
  266. package/dist/types/rag.d.ts +1 -1
  267. package/dist/types/rag.js +0 -6
  268. package/dist/types/server.d.ts +3 -0
  269. package/dist/types/stream.d.ts +2 -11
  270. package/dist/types/tools.d.ts +2 -1
  271. package/dist/utils/generation.d.ts +8 -0
  272. package/dist/utils/generation.js +8 -0
  273. package/dist/utils/generationErrors.d.ts +10 -0
  274. package/dist/utils/generationErrors.js +10 -0
  275. package/dist/utils/messageBuilder.d.ts +1 -6
  276. package/dist/utils/messageBuilder.js +0 -5
  277. package/dist/utils/noOutputSentinel.d.ts +0 -13
  278. package/dist/utils/noOutputSentinel.js +1 -14
  279. package/dist/utils/providerRetry.js +1 -1
  280. package/dist/utils/tool.d.ts +8 -0
  281. package/dist/utils/tool.js +8 -0
  282. package/dist/utils/toolCallRepair.d.ts +1 -16
  283. package/dist/utils/toolCallRepair.js +1 -16
  284. package/dist/utils/toolChoice.d.ts +1 -1
  285. package/dist/utils/videoAnalysisProcessor.d.ts +1 -8
  286. package/dist/utils/videoAnalysisProcessor.js +0 -7
  287. package/package.json +2 -3
@@ -234,6 +234,122 @@ async function clearClaudeProxySettings(expectedBaseUrl) {
234
234
  fs.writeFileSync(CLAUDE_SETTINGS_PATH, JSON.stringify(settings, null, 2));
235
235
  return hadBaseUrl || hadToolSearch;
236
236
  }
237
+ // =============================================================================
238
+ // OPENCODE AUTO-CONFIGURATION
239
+ // =============================================================================
240
+ function getOpenCodeConfigDir() {
241
+ if (process.platform === "darwin") {
242
+ return join(homedir(), "Library", "Application Support", "opencode");
243
+ }
244
+ // Linux/other: XDG_CONFIG_HOME or ~/.config
245
+ return join(process.env.XDG_CONFIG_HOME || join(homedir(), ".config"), "opencode");
246
+ }
247
+ const OPENCODE_CONFIG_PATH = join(getOpenCodeConfigDir(), "opencode.json");
248
+ /**
249
+ * Key under which we persist the snapshot of the user's pre-existing
250
+ * `provider.neurolink` config inside `opencode.json` itself. Persisting (rather
251
+ * than relying on in-process state) means restoration still works even if the
252
+ * proxy crashes or shutdown handlers run in a different process.
253
+ *
254
+ * Mirrors the Claude pattern (`__proxy_original_env` inside Claude's settings).
255
+ */
256
+ const OPENCODE_ORIGINAL_KEY = "__proxy_original_neurolink";
257
+ async function setOpenCodeProxySettings(baseUrl, proxyKey) {
258
+ const fs = await import("fs");
259
+ const configDir = getOpenCodeConfigDir();
260
+ try {
261
+ fs.accessSync(configDir);
262
+ }
263
+ catch {
264
+ // OpenCode not installed — config directory does not exist, skip silently
265
+ return;
266
+ }
267
+ let config;
268
+ try {
269
+ config = JSON.parse(fs.readFileSync(OPENCODE_CONFIG_PATH, "utf8"));
270
+ }
271
+ catch {
272
+ // file missing/invalid — create fresh config object
273
+ config = { provider: {} };
274
+ }
275
+ const provider = (config.provider ?? {});
276
+ // Persist a snapshot of the user's pre-existing provider.neurolink — but
277
+ // only the first time we touch the file. Subsequent set() calls must NOT
278
+ // overwrite the snapshot (otherwise after the proxy writes its own block,
279
+ // the next set() would store the proxy's block as the "original" and
280
+ // permanently lose the user's real config on the next clear()).
281
+ if (!(OPENCODE_ORIGINAL_KEY in config)) {
282
+ config[OPENCODE_ORIGINAL_KEY] =
283
+ "neurolink" in provider
284
+ ? JSON.parse(JSON.stringify(provider.neurolink))
285
+ : null;
286
+ }
287
+ provider.neurolink = {
288
+ id: "neurolink",
289
+ name: "NeuroLink Proxy",
290
+ npm: "@ai-sdk/openai-compatible",
291
+ env: [],
292
+ models: {},
293
+ options: {
294
+ baseURL: baseUrl,
295
+ apiKey: proxyKey || "neurolink-proxy",
296
+ },
297
+ };
298
+ config.provider = provider;
299
+ fs.writeFileSync(OPENCODE_CONFIG_PATH, JSON.stringify(config, null, 2));
300
+ }
301
+ async function clearOpenCodeProxySettings(expectedBaseUrl) {
302
+ const fs = await import("fs");
303
+ let config;
304
+ try {
305
+ config = JSON.parse(fs.readFileSync(OPENCODE_CONFIG_PATH, "utf8"));
306
+ }
307
+ catch {
308
+ return false;
309
+ }
310
+ const provider = config.provider;
311
+ if (!provider || !("neurolink" in provider)) {
312
+ return false;
313
+ }
314
+ // Check if our proxy URL matches before removing
315
+ const existing = provider.neurolink;
316
+ if (expectedBaseUrl && existing) {
317
+ const options = existing.options;
318
+ if (options && typeof options.baseURL === "string") {
319
+ if (options.baseURL !== expectedBaseUrl) {
320
+ // User configured a different URL; do not clobber
321
+ return false;
322
+ }
323
+ }
324
+ }
325
+ const hadNeurolink = "neurolink" in provider;
326
+ // Restore from the snapshot persisted at first set(), regardless of process
327
+ // identity. Only delete provider.neurolink when the snapshot says the user
328
+ // explicitly had no entry before — never on an "undefined" snapshot, since
329
+ // that would mean the snapshot was lost and we cannot prove the entry is ours.
330
+ if (OPENCODE_ORIGINAL_KEY in config) {
331
+ const snapshot = config[OPENCODE_ORIGINAL_KEY];
332
+ if (snapshot === null) {
333
+ // User had no provider.neurolink before the proxy started — safe to remove.
334
+ delete provider.neurolink;
335
+ }
336
+ else {
337
+ provider.neurolink = snapshot;
338
+ }
339
+ delete config[OPENCODE_ORIGINAL_KEY];
340
+ }
341
+ else {
342
+ // No snapshot present — refuse to delete to avoid destroying a config
343
+ // the proxy may not own (e.g. a user wrote their own `neurolink` block
344
+ // before the snapshot key was introduced, or this is being cleared from
345
+ // a process that never ran set()).
346
+ logger.debug("[proxy] OpenCode clear: no original-provider snapshot found, leaving provider.neurolink intact");
347
+ return false;
348
+ }
349
+ config.provider = provider;
350
+ fs.writeFileSync(OPENCODE_CONFIG_PATH, JSON.stringify(config, null, 2));
351
+ return hadNeurolink;
352
+ }
237
353
  async function isProxyHealthy(host, port, timeoutMs) {
238
354
  try {
239
355
  const response = await fetch(`http://${host}:${port}/health`, {
@@ -533,9 +649,10 @@ function printProxyBanner(url, strategy) {
533
649
  logger.always(` ${chalk.bold("PID:")} ${chalk.cyan(process.pid)}`);
534
650
  logger.always("");
535
651
  logger.always(chalk.bold("Endpoints:"));
536
- logger.always(` ${chalk.blue("POST")} /v1/messages Proxy to Anthropic`);
537
- logger.always(` ${chalk.green("GET")} /health Health check`);
538
- logger.always(` ${chalk.green("GET")} /status Detailed status`);
652
+ logger.always(` ${chalk.blue("POST")} /v1/messages Claude proxy (Anthropic format)`);
653
+ logger.always(` ${chalk.blue("POST")} /v1/chat/completions OpenAI-compatible proxy`);
654
+ logger.always(` ${chalk.green("GET")} /health Health check`);
655
+ logger.always(` ${chalk.green("GET")} /status — Detailed status`);
539
656
  logger.always("");
540
657
  logger.always(chalk.bold("Set in Claude Code:"));
541
658
  logger.always(` ${chalk.cyan(`ANTHROPIC_BASE_URL=${url}`)}`);
@@ -706,6 +823,7 @@ async function resolveBootPrimaryAccountKey(primaryEmail) {
706
823
  }
707
824
  async function createProxyStartApp(params) {
708
825
  const { createClaudeProxyRoutes } = await import("../../lib/server/routes/claudeProxyRoutes.js");
826
+ const { createOpenAIProxyRoutes } = await import("../../lib/server/routes/openaiProxyRoutes.js");
709
827
  const { Hono } = await import("hono");
710
828
  const app = new Hono();
711
829
  const readiness = createProxyReadinessState();
@@ -724,7 +842,9 @@ async function createProxyStartApp(params) {
724
842
  }, 502);
725
843
  });
726
844
  const routeGroup = createClaudeProxyRoutes(params.modelRouter, "", params.strategy, params.passthrough, params.primaryAccountKey);
727
- for (const route of routeGroup.routes) {
845
+ const openaiRouteGroup = createOpenAIProxyRoutes(params.modelRouter, "", params.port);
846
+ const allProxyRoutes = [...routeGroup.routes, ...openaiRouteGroup.routes];
847
+ for (const route of allProxyRoutes) {
728
848
  const method = route.method.toLowerCase();
729
849
  app[method](route.path, async (c) => {
730
850
  const emptyBody = {};
@@ -1025,6 +1145,13 @@ function registerProxyShutdownHandlers(params) {
1025
1145
  catch {
1026
1146
  // non-fatal
1027
1147
  }
1148
+ try {
1149
+ const shutdownHost = params.host === "0.0.0.0" ? "localhost" : params.host;
1150
+ await clearOpenCodeProxySettings(`http://${shutdownHost}:${params.port}/v1`);
1151
+ }
1152
+ catch {
1153
+ // non-fatal
1154
+ }
1028
1155
  }
1029
1156
  try {
1030
1157
  params.server.close?.();
@@ -1114,6 +1241,15 @@ async function startProxyRuntime(params) {
1114
1241
  logger.debug("[proxy] Failed to auto-configure Claude Code: " +
1115
1242
  (error instanceof Error ? error.message : String(error)));
1116
1243
  }
1244
+ try {
1245
+ await setOpenCodeProxySettings(`${url}/v1`);
1246
+ logger.always(chalk.green(" ✓ Auto-configured OpenCode settings"));
1247
+ logger.always(chalk.dim(" Restart OpenCode to connect through proxy"));
1248
+ }
1249
+ catch (error) {
1250
+ logger.debug("[proxy] Failed to auto-configure OpenCode: " +
1251
+ (error instanceof Error ? error.message : String(error)));
1252
+ }
1117
1253
  }
1118
1254
  else {
1119
1255
  logger.always(chalk.dim(" ⊘ Dev mode: skipping client auto-configuration"));
@@ -1808,6 +1944,12 @@ export const proxyGuardCommand = {
1808
1944
  }
1809
1945
  // Restart failed or launchd not installed — clean up Claude settings
1810
1946
  const cleared = await clearClaudeProxySettings(expectedBaseUrl);
1947
+ try {
1948
+ await clearOpenCodeProxySettings(`${expectedBaseUrl}/v1`);
1949
+ }
1950
+ catch {
1951
+ // non-fatal
1952
+ }
1811
1953
  const state = loadProxyState();
1812
1954
  if (state &&
1813
1955
  state.host === host &&
@@ -1916,9 +2058,16 @@ export const proxySetupCommand = {
1916
2058
  console.info(chalk.green(" ✓ Claude Code configured"));
1917
2059
  }
1918
2060
  catch (e) {
1919
- console.info(chalk.yellow(` ⚠ Could not auto-configure: ${e instanceof Error ? e.message : String(e)}`));
2061
+ console.info(chalk.yellow(` ⚠ Could not auto-configure Claude Code: ${e instanceof Error ? e.message : String(e)}`));
1920
2062
  console.info(chalk.yellow(` Set manually: ANTHROPIC_BASE_URL=${url}`));
1921
2063
  }
2064
+ try {
2065
+ await setOpenCodeProxySettings(`${url}/v1`);
2066
+ console.info(chalk.green(" ✓ OpenCode configured"));
2067
+ }
2068
+ catch (e) {
2069
+ console.info(chalk.yellow(` ⚠ Could not auto-configure OpenCode: ${e instanceof Error ? e.message : String(e)}`));
2070
+ }
1922
2071
  // Done!
1923
2072
  console.info("");
1924
2073
  console.info(chalk.bold.green("Setup complete!"));
@@ -254,8 +254,9 @@ export function useChat(options = {}) {
254
254
  */
255
255
  const handleSubmit = useCallback((e, submitOptions) => {
256
256
  e?.preventDefault?.();
257
- if (!input.trim())
257
+ if (!input.trim()) {
258
258
  return;
259
+ }
259
260
  const message = {
260
261
  role: "user",
261
262
  content: input,
@@ -271,8 +272,9 @@ export function useChat(options = {}) {
271
272
  // Read from the ref so we always have the latest messages
272
273
  const currentMessages = messagesRef.current;
273
274
  const lastUserMessageIndex = currentMessages.findLastIndex((m) => m.role === "user");
274
- if (lastUserMessageIndex === -1)
275
+ if (lastUserMessageIndex === -1) {
275
276
  return null;
277
+ }
276
278
  const lastUserMessage = currentMessages[lastUserMessageIndex];
277
279
  // Remove messages after the last user message
278
280
  setMessages((prev) => prev.slice(0, lastUserMessageIndex));
@@ -742,8 +744,9 @@ export function useVoice(options = {}) {
742
744
  const synthesisRef = useRef(null);
743
745
  // Check browser support
744
746
  const isSupported = useMemo(() => {
745
- if (typeof window === "undefined")
747
+ if (typeof window === "undefined") {
746
748
  return false;
749
+ }
747
750
  const hasSpeechRecognition = "SpeechRecognition" in window || "webkitSpeechRecognition" in window;
748
751
  const hasSpeechSynthesis = "speechSynthesis" in window;
749
752
  return hasSpeechRecognition || hasSpeechSynthesis;
@@ -752,12 +755,14 @@ export function useVoice(options = {}) {
752
755
  * Initialize speech recognition
753
756
  */
754
757
  const initRecognition = useCallback(() => {
755
- if (typeof window === "undefined")
758
+ if (typeof window === "undefined") {
756
759
  return null;
760
+ }
757
761
  const SpeechRecognitionCtor = window.SpeechRecognition ||
758
762
  window.webkitSpeechRecognition;
759
- if (!SpeechRecognitionCtor)
763
+ if (!SpeechRecognitionCtor) {
760
764
  return null;
765
+ }
761
766
  const recognition = new SpeechRecognitionCtor();
762
767
  recognition.continuous = true;
763
768
  recognition.interimResults = true;
@@ -795,8 +800,9 @@ export function useVoice(options = {}) {
795
800
  * Start listening for voice input
796
801
  */
797
802
  const startListening = useCallback(() => {
798
- if (!enableSpeechRecognition)
803
+ if (!enableSpeechRecognition) {
799
804
  return;
805
+ }
800
806
  if (!recognitionRef.current) {
801
807
  recognitionRef.current = initRecognition();
802
808
  }
@@ -820,8 +826,9 @@ export function useVoice(options = {}) {
820
826
  * Speak text using TTS
821
827
  */
822
828
  const speak = useCallback(async (text) => {
823
- if (typeof window === "undefined")
829
+ if (typeof window === "undefined") {
824
830
  return;
831
+ }
825
832
  setIsSpeaking(true);
826
833
  onSpeechStart?.();
827
834
  try {
@@ -1002,8 +1009,9 @@ export function useStream(options = {}) {
1002
1009
  let fullText = "";
1003
1010
  while (true) {
1004
1011
  const { done, value } = await reader.read();
1005
- if (done)
1012
+ if (done) {
1006
1013
  break;
1014
+ }
1007
1015
  buffer += decoder.decode(value, { stream: true });
1008
1016
  const lines = buffer.split("\n");
1009
1017
  buffer = lines.pop() ?? "";
@@ -27,7 +27,6 @@ import {
27
27
  import type { ReactNode } from "react";
28
28
 
29
29
  import type {
30
- ClientConfig,
31
30
  ClientApiError,
32
31
  NeuroLinkProviderProps,
33
32
  UseChatOptions,
@@ -361,7 +360,9 @@ export function useChat(options: UseChatOptions = {}): UseChatReturn {
361
360
  ) => {
362
361
  e?.preventDefault?.();
363
362
 
364
- if (!input.trim()) return;
363
+ if (!input.trim()) {
364
+ return;
365
+ }
365
366
 
366
367
  const message: Omit<ChatMessage, "id" | "createdAt"> = {
367
368
  role: "user",
@@ -384,7 +385,9 @@ export function useChat(options: UseChatOptions = {}): UseChatReturn {
384
385
  const lastUserMessageIndex = currentMessages.findLastIndex(
385
386
  (m: ChatMessage) => m.role === "user",
386
387
  );
387
- if (lastUserMessageIndex === -1) return null;
388
+ if (lastUserMessageIndex === -1) {
389
+ return null;
390
+ }
388
391
 
389
392
  const lastUserMessage = currentMessages[lastUserMessageIndex];
390
393
 
@@ -977,7 +980,9 @@ export function useVoice(options: UseVoiceOptions = {}): UseVoiceReturn {
977
980
 
978
981
  // Check browser support
979
982
  const isSupported = useMemo(() => {
980
- if (typeof window === "undefined") return false;
983
+ if (typeof window === "undefined") {
984
+ return false;
985
+ }
981
986
  const hasSpeechRecognition =
982
987
  "SpeechRecognition" in window || "webkitSpeechRecognition" in window;
983
988
  const hasSpeechSynthesis = "speechSynthesis" in window;
@@ -988,7 +993,9 @@ export function useVoice(options: UseVoiceOptions = {}): UseVoiceReturn {
988
993
  * Initialize speech recognition
989
994
  */
990
995
  const initRecognition = useCallback(() => {
991
- if (typeof window === "undefined") return null;
996
+ if (typeof window === "undefined") {
997
+ return null;
998
+ }
992
999
 
993
1000
  const SpeechRecognitionCtor =
994
1001
  (
@@ -1002,7 +1009,9 @@ export function useVoice(options: UseVoiceOptions = {}): UseVoiceReturn {
1002
1009
  }
1003
1010
  ).webkitSpeechRecognition;
1004
1011
 
1005
- if (!SpeechRecognitionCtor) return null;
1012
+ if (!SpeechRecognitionCtor) {
1013
+ return null;
1014
+ }
1006
1015
 
1007
1016
  const recognition = new SpeechRecognitionCtor();
1008
1017
  recognition.continuous = true;
@@ -1047,7 +1056,9 @@ export function useVoice(options: UseVoiceOptions = {}): UseVoiceReturn {
1047
1056
  * Start listening for voice input
1048
1057
  */
1049
1058
  const startListening = useCallback(() => {
1050
- if (!enableSpeechRecognition) return;
1059
+ if (!enableSpeechRecognition) {
1060
+ return;
1061
+ }
1051
1062
 
1052
1063
  if (!recognitionRef.current) {
1053
1064
  recognitionRef.current = initRecognition();
@@ -1076,7 +1087,9 @@ export function useVoice(options: UseVoiceOptions = {}): UseVoiceReturn {
1076
1087
  */
1077
1088
  const speak = useCallback(
1078
1089
  async (text: string): Promise<void> => {
1079
- if (typeof window === "undefined") return;
1090
+ if (typeof window === "undefined") {
1091
+ return;
1092
+ }
1080
1093
 
1081
1094
  setIsSpeaking(true);
1082
1095
  onSpeechStart?.();
@@ -1286,7 +1299,9 @@ export function useStream(options: UseStreamOptions = {}): UseStreamReturn {
1286
1299
 
1287
1300
  while (true) {
1288
1301
  const { done, value } = await reader.read();
1289
- if (done) break;
1302
+ if (done) {
1303
+ break;
1304
+ }
1290
1305
 
1291
1306
  buffer += decoder.decode(value, { stream: true });
1292
1307
  const lines = buffer.split("\n");
@@ -1,9 +1,9 @@
1
- import type { LanguageModel, ModelMessage, Tool, ToolCallRepairFunction, ToolSet } from "ai";
2
1
  import type { AIProviderName } from "../constants/enums.js";
3
2
  import type { EvaluationData } from "../index.js";
4
3
  import type { NeuroLink } from "../neurolink.js";
5
4
  import type { UnknownRecord, MiddlewareFactoryOptions, StreamOptions, StreamResult, AIProvider, AnalyticsData, EnhancedGenerateResult, TextGenerationOptions, TextGenerationResult, ValidationSchema } from "../types/index.js";
6
5
  import { TelemetryHandler } from "./modules/TelemetryHandler.js";
6
+ import type { LanguageModel, ModelMessage, Tool, ToolCallRepairFunction, ToolSet } from "../types/index.js";
7
7
  /**
8
8
  * Abstract base class for all AI providers
9
9
  * Tools are integrated as first-class citizens - always available by default
@@ -20,11 +20,6 @@ export declare abstract class BaseProvider implements AIProvider {
20
20
  protected sessionId?: string;
21
21
  protected userId?: string;
22
22
  protected neurolink?: NeuroLink;
23
- /** @internal Trace context propagated from NeuroLink SDK for span hierarchy */
24
- protected _traceContext: {
25
- traceId: string;
26
- parentSpanId: string;
27
- } | null;
28
23
  setTraceContext(ctx: {
29
24
  traceId: string;
30
25
  parentSpanId: string;
@@ -1,5 +1,4 @@
1
1
  import { context, SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
2
- import { generateText } from "ai";
3
2
  import { directAgentTools } from "../agent/directTools.js";
4
3
  import { IMAGE_GENERATION_MODELS } from "../core/constants.js";
5
4
  import { MiddlewareFactory } from "../middleware/factory.js";
@@ -21,6 +20,7 @@ import { StreamHandler } from "./modules/StreamHandler.js";
21
20
  import { TelemetryHandler } from "./modules/TelemetryHandler.js";
22
21
  import { ToolsManager } from "./modules/ToolsManager.js";
23
22
  import { Utilities } from "./modules/Utilities.js";
23
+ import { generateText } from "../utils/generation.js";
24
24
  /**
25
25
  * Abstract base class for all AI providers
26
26
  * Tools are integrated as first-class citizens - always available by default
@@ -12,9 +12,9 @@
12
12
  *
13
13
  * @module core/modules/GenerationHandler
14
14
  */
15
- import type { LanguageModel, ModelMessage, Tool } from "ai";
16
- import { generateText } from "ai";
17
15
  import type { AIProviderName, EnhancedGenerateResult, NeuroLinkEvents, StandardRecord, TextGenerationOptions, TypedEventEmitter } from "../../types/index.js";
16
+ import type { LanguageModel, ModelMessage, Tool } from "../../types/index.js";
17
+ import { generateText } from "../../utils/generation.js";
18
18
  /**
19
19
  * GenerationHandler class - Handles text generation operations for AI providers
20
20
  */
@@ -13,7 +13,6 @@
13
13
  * @module core/modules/GenerationHandler
14
14
  */
15
15
  import { SpanKind, SpanStatusCode } from "@opentelemetry/api";
16
- import { generateText, NoObjectGeneratedError, Output, stepCountIs } from "ai";
17
16
  import { getModelId } from "../../providers/providerTypeUtils.js";
18
17
  import { tracers } from "../../telemetry/tracers.js";
19
18
  import { logger } from "../../utils/logger.js";
@@ -22,6 +21,9 @@ import { calculateCost } from "../../utils/pricing.js";
22
21
  import { withProviderRetry } from "../../utils/providerRetry.js";
23
22
  import { calculateCacheSavingsPercent, extractCacheCreationTokens, extractCacheReadTokens, extractTokenUsage, } from "../../utils/tokenUtils.js";
24
23
  import { DEFAULT_MAX_STEPS } from "../constants.js";
24
+ import { NoObjectGeneratedError } from "../../utils/generationErrors.js";
25
+ import { Output, stepCountIs } from "../../utils/tool.js";
26
+ import { generateText } from "../../utils/generation.js";
25
27
  const genTracer = tracers.generation;
26
28
  /**
27
29
  * Safely preview-serialize a value for debug logging.
@@ -1,19 +1,5 @@
1
- /**
2
- * Message Builder Module
3
- *
4
- * Handles all message construction logic for AI providers.
5
- * Extracted from BaseProvider to follow Single Responsibility Principle.
6
- *
7
- * Responsibilities:
8
- * - Building messages from text generation options
9
- * - Building messages from stream options
10
- * - Multimodal input detection
11
- * - Message format conversion (to ModelMessage[])
12
- *
13
- * @module core/modules/MessageBuilder
14
- */
15
- import type { ModelMessage } from "ai";
16
1
  import type { AIProviderName, TextGenerationOptions, StreamOptions } from "../../types/index.js";
2
+ import type { ModelMessage } from "../../types/index.js";
17
3
  /**
18
4
  * MessageBuilder class - Handles message construction for AI providers
19
5
  */
@@ -1,17 +1,3 @@
1
- /**
2
- * Message Builder Module
3
- *
4
- * Handles all message construction logic for AI providers.
5
- * Extracted from BaseProvider to follow Single Responsibility Principle.
6
- *
7
- * Responsibilities:
8
- * - Building messages from text generation options
9
- * - Building messages from stream options
10
- * - Multimodal input detection
11
- * - Message format conversion (to ModelMessage[])
12
- *
13
- * @module core/modules/MessageBuilder
14
- */
15
1
  import { tracers, ATTR, withSpan } from "../../telemetry/index.js";
16
2
  import { logger } from "../../utils/logger.js";
17
3
  import { buildMessagesArray, buildMultimodalMessagesArray, } from "../../utils/messageBuilder.js";
@@ -20,7 +20,7 @@ import { buildNoOutputSentinel, detectPostStreamNoOutput, stampNoOutputSpan, } f
20
20
  import { STEP_LIMITS } from "../constants.js";
21
21
  import { createAnalytics } from "../analytics.js";
22
22
  import { nanoid } from "nanoid";
23
- import { NoOutputGeneratedError } from "ai";
23
+ import { NoOutputGeneratedError } from "../../utils/generationErrors.js";
24
24
  /**
25
25
  * StreamHandler class - Handles streaming operations for AI providers
26
26
  */
@@ -1,22 +1,6 @@
1
- /**
2
- * Tools Manager Module
3
- *
4
- * Handles all tool registration, discovery, and execution for AI providers.
5
- * Extracted from BaseProvider to follow Single Responsibility Principle.
6
- *
7
- * Responsibilities:
8
- * - Tool registration (direct, custom, MCP, external MCP)
9
- * - Tool discovery and aggregation
10
- * - Tool creation from definitions and schemas
11
- * - Tool executor setup
12
- * - Session context management for MCP tools
13
- * - Event emission wrapping for tool execution
14
- *
15
- * @module core/modules/ToolsManager
16
- */
17
- import type { Tool } from "ai";
18
1
  import type { AIProviderName, ToolUtilities } from "../../types/index.js";
19
2
  import type { NeuroLink } from "../../neurolink.js";
3
+ import type { Tool } from "../../types/index.js";
20
4
  /**
21
5
  * ToolsManager class - Handles all tool management operations
22
6
  */
@@ -1,20 +1,3 @@
1
- /**
2
- * Tools Manager Module
3
- *
4
- * Handles all tool registration, discovery, and execution for AI providers.
5
- * Extracted from BaseProvider to follow Single Responsibility Principle.
6
- *
7
- * Responsibilities:
8
- * - Tool registration (direct, custom, MCP, external MCP)
9
- * - Tool discovery and aggregation
10
- * - Tool creation from definitions and schemas
11
- * - Tool executor setup
12
- * - Session context management for MCP tools
13
- * - Event emission wrapping for tool execution
14
- *
15
- * @module core/modules/ToolsManager
16
- */
17
- import { tool as createAISDKTool, jsonSchema } from "ai";
18
1
  import { z } from "zod";
19
2
  import { createToolEventPayload } from "../toolEvents.js";
20
3
  import { tracers, ATTR, withSpan } from "../../telemetry/index.js";
@@ -23,6 +6,7 @@ import { logger } from "../../utils/logger.js";
23
6
  import { getKeyCount } from "../../utils/transformationUtils.js";
24
7
  import { convertJsonSchemaToZod } from "../../utils/schemaConversion.js";
25
8
  import { generateToolOutputPreview } from "../../context/toolOutputLimits.js";
9
+ import { tool as createAISDKTool, jsonSchema } from "../../utils/tool.js";
26
10
  /**
27
11
  * ToolsManager class - Handles all tool management operations
28
12
  */
@@ -1,7 +1,7 @@
1
1
  import { createAnalytics } from "./analytics.js";
2
2
  import { logger } from "../utils/logger.js";
3
3
  import { extractTokenUsage, createEmptyTokenUsage, } from "../utils/tokenUtils.js";
4
- import { NoOutputGeneratedError } from "ai";
4
+ import { NoOutputGeneratedError } from "../utils/generationErrors.js";
5
5
  /**
6
6
  * Base implementation for collecting analytics from Vercel AI SDK stream results
7
7
  */
@@ -1,8 +1,5 @@
1
- /**
2
- * @file Implements the ContextBuilder class for creating rich evaluation context.
3
- */
4
- import type { LanguageModelV3CallOptions } from "@ai-sdk/provider";
5
1
  import type { EnhancedEvaluationContext, EvaluationResult, GenerateResult } from "../types/index.js";
2
+ import type { LanguageModelV3CallOptions } from "../types/index.js";
6
3
  /**
7
4
  * Builds the enhanced context required for a RAGAS-style evaluation.
8
5
  * This class gathers data from the generation options and results to create a
@@ -1,6 +1,3 @@
1
- /**
2
- * @file Implements the ContextBuilder class for creating rich evaluation context.
3
- */
4
1
  import { logger } from "../utils/logger.js";
5
2
  /**
6
3
  * Builds the enhanced context required for a RAGAS-style evaluation.
@@ -1,8 +1,5 @@
1
- /**
2
- * @file This file exports the main Evaluator class, which serves as the central entry point for the evaluation system.
3
- */
4
- import type { LanguageModelV3CallOptions } from "@ai-sdk/provider";
5
1
  import type { EvaluationData, GenerateResult, AutoEvaluationConfig, EvaluationConfig } from "../types/index.js";
2
+ import type { LanguageModelV3CallOptions } from "../types/index.js";
6
3
  export * from "./errors/index.js";
7
4
  export * from "./hooks/index.js";
8
5
  export * from "./pipeline/index.js";
@@ -1,6 +1,3 @@
1
- /**
2
- * @file This file exports the main Evaluator class, which serves as the central entry point for the evaluation system.
3
- */
4
1
  import { ContextBuilder } from "./contextBuilder.js";
5
2
  import { RAGASEvaluator } from "./ragasEvaluator.js";
6
3
  import { mapToEvaluationData } from "./scoring.js";
@@ -1,27 +1,11 @@
1
- /**
2
- * On-Demand File Access Tools
3
- *
4
- * Exposes file operations as LLM tools via the Vercel AI SDK `tool()` pattern.
5
- * These tools allow the LLM to access file content lazily — only reading
6
- * the specific sections, lines, or search results it needs.
7
- *
8
- * Tools:
9
- * - list_attached_files: List all registered files with metadata
10
- * - read_file_section: Read specific line range with token budget
11
- * - search_in_file: Search for patterns within a file
12
- * - get_file_preview: Get the preview/summary of a file
13
- * - extract_file_content: Targeted extraction for any file type (video frames,
14
- * PDF pages, spreadsheet ranges, archive entries, PPTX slides)
15
- *
16
- * @module files/fileTools
17
- */
18
1
  import type { FileReferenceRegistry } from "./fileReferenceRegistry.js";
19
2
  /**
20
3
  * Create file access tools bound to a FileReferenceRegistry instance.
21
4
  *
22
5
  * These tools follow the same pattern as the existing directAgentTools
23
6
  * (getCurrentTime, readFile, etc.) in src/lib/agent/directTools.ts.
24
- * They use `tool()` from the Vercel AI SDK with zod parameter schemas.
7
+ * They use NeuroLink's `tool()` helper from `../utils/tool.js` with Zod
8
+ * parameter schemas.
25
9
  *
26
10
  * @param registry - The FileReferenceRegistry instance to bind to
27
11
  * @returns Record of tool name to tool definition