@juspay/neurolink 11.12.0 → 11.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1921) hide show
  1. package/CHANGELOG.md +13 -3
  2. package/dist/browser/neurolink.min.js +681 -842
  3. package/dist/cli/commands/agent.js +2 -2
  4. package/dist/cli/commands/auth.d.ts +1 -1
  5. package/dist/cli/commands/auth.js +11 -11
  6. package/dist/cli/commands/authProviders.d.ts +1 -1
  7. package/dist/cli/commands/authProviders.js +2 -2
  8. package/dist/cli/commands/autoresearch.js +5 -5
  9. package/dist/cli/commands/config.d.ts +1 -1
  10. package/dist/cli/commands/config.js +4 -4
  11. package/dist/cli/commands/docs.d.ts +1 -1
  12. package/dist/cli/commands/evaluate.d.ts +1 -1
  13. package/dist/cli/commands/evaluate.js +4 -4
  14. package/dist/cli/commands/mcp.js +14 -14
  15. package/dist/cli/commands/models.js +3 -3
  16. package/dist/cli/commands/observability.d.ts +1 -1
  17. package/dist/cli/commands/observability.js +3 -3
  18. package/dist/cli/commands/ollama.js +1 -1
  19. package/dist/cli/commands/proxy.d.ts +2 -2
  20. package/dist/cli/commands/proxy.js +87 -45
  21. package/dist/cli/commands/proxyAnalyze.d.ts +1 -1
  22. package/dist/cli/commands/proxyAnalyze.js +12 -3
  23. package/dist/cli/commands/proxyReplay.d.ts +1 -1
  24. package/dist/cli/commands/proxyReplay.js +2 -2
  25. package/dist/cli/commands/rag.js +10 -10
  26. package/dist/cli/commands/serve.js +7 -7
  27. package/dist/cli/commands/server.js +6 -6
  28. package/dist/cli/commands/setup-anthropic.d.ts +1 -1
  29. package/dist/cli/commands/setup-anthropic.js +3 -3
  30. package/dist/cli/commands/setup-azure.d.ts +1 -1
  31. package/dist/cli/commands/setup-azure.js +3 -3
  32. package/dist/cli/commands/setup-bedrock.d.ts +1 -1
  33. package/dist/cli/commands/setup-bedrock.js +3 -3
  34. package/dist/cli/commands/setup-gcp.d.ts +1 -1
  35. package/dist/cli/commands/setup-gcp.js +1 -1
  36. package/dist/cli/commands/setup-google-ai.d.ts +1 -1
  37. package/dist/cli/commands/setup-google-ai.js +4 -4
  38. package/dist/cli/commands/setup-huggingface.d.ts +1 -1
  39. package/dist/cli/commands/setup-huggingface.js +1 -1
  40. package/dist/cli/commands/setup-mistral.d.ts +1 -1
  41. package/dist/cli/commands/setup-mistral.js +3 -3
  42. package/dist/cli/commands/setup-openai.d.ts +1 -1
  43. package/dist/cli/commands/setup-openai.js +3 -3
  44. package/dist/cli/commands/setup.d.ts +1 -1
  45. package/dist/cli/commands/setup.js +4 -4
  46. package/dist/cli/commands/task.js +4 -4
  47. package/dist/cli/commands/telemetry.d.ts +1 -1
  48. package/dist/cli/commands/telemetry.js +4 -4
  49. package/dist/cli/commands/voiceServer.d.ts +1 -1
  50. package/dist/cli/commands/voiceServer.js +6 -2
  51. package/dist/cli/commands/workflow.js +5 -5
  52. package/dist/cli/errorHandler.js +3 -3
  53. package/dist/cli/factories/commandFactory.js +13 -13
  54. package/dist/cli/factories/ollamaCommandFactory.js +3 -3
  55. package/dist/cli/factories/sagemakerCommandFactory.js +5 -5
  56. package/dist/cli/index.js +1 -1
  57. package/dist/cli/loop/conversationSelector.d.ts +1 -1
  58. package/dist/cli/loop/conversationSelector.js +3 -3
  59. package/dist/cli/loop/optionsSchema.d.ts +1 -1
  60. package/dist/cli/loop/optionsSchema.js +1 -1
  61. package/dist/cli/loop/session.d.ts +1 -1
  62. package/dist/cli/loop/session.js +6 -6
  63. package/dist/cli/parser.js +5 -2
  64. package/dist/cli/proxy-clients/claudeCode.d.ts +1 -1
  65. package/dist/cli/proxy-clients/claudeCode.js +43 -11
  66. package/dist/cli/proxy-clients/codex.d.ts +1 -1
  67. package/dist/cli/proxy-clients/codex.js +1 -1
  68. package/dist/cli/proxy-clients/copilot.d.ts +1 -1
  69. package/dist/cli/proxy-clients/copilot.js +1 -1
  70. package/dist/cli/proxy-clients/openCode.d.ts +1 -1
  71. package/dist/cli/proxy-clients/openCode.js +38 -16
  72. package/dist/cli/proxy-clients/qwenCode.d.ts +1 -1
  73. package/dist/cli/proxy-clients/qwenCode.js +34 -10
  74. package/dist/cli/proxy-clients/registry.d.ts +1 -1
  75. package/dist/cli/proxy-clients/registry.js +10 -2
  76. package/dist/cli/proxy-clients/snapshot.d.ts +52 -0
  77. package/dist/cli/proxy-clients/snapshot.js +98 -0
  78. package/dist/cli/utils/audioFileUtils.d.ts +1 -1
  79. package/dist/cli/utils/audioPlayer.d.ts +1 -1
  80. package/dist/cli/utils/classifierRouterFlags.d.ts +1 -1
  81. package/dist/cli/utils/classifierRouterFlags.js +1 -1
  82. package/dist/cli/utils/completeSetup.d.ts +1 -1
  83. package/dist/cli/utils/completeSetup.js +1 -1
  84. package/dist/cli/utils/envManager.d.ts +1 -1
  85. package/dist/cli/utils/envManager.js +1 -1
  86. package/dist/cli/utils/inputValidation.js +2 -2
  87. package/dist/cli/utils/interactiveSetup.d.ts +2 -2
  88. package/dist/cli/utils/interactiveSetup.js +3 -3
  89. package/dist/cli/utils/ollamaUtils.d.ts +1 -1
  90. package/dist/cli/utils/ollamaUtils.js +1 -1
  91. package/dist/cli/utils/skillsFlags.d.ts +1 -1
  92. package/dist/cli/utils/toolRoutingFlags.d.ts +1 -1
  93. package/dist/cli/utils/toolRoutingFlags.js +1 -1
  94. package/dist/cli/utils/videoFileUtils.d.ts +1 -1
  95. package/dist/processors/data/XmlProcessor.d.ts +14 -0
  96. package/dist/processors/data/XmlProcessor.js +14 -0
  97. package/dist/processors/document/PptxProcessor.d.ts +9 -0
  98. package/dist/processors/document/PptxProcessor.js +9 -0
  99. package/dist/processors/media/VideoProcessor.js +30 -2
  100. package/dist/providers/amazonBedrock/client.js +1 -2
  101. package/dist/providers/googleAiStudio/client.js +6 -3
  102. package/dist/providers/googleVertex/client.js +6 -3
  103. package/dist/providers/googleVertex/index.d.ts +0 -1
  104. package/dist/providers/googleVertex/index.js +0 -1
  105. package/dist/proxy/codexUsage.d.ts +68 -0
  106. package/dist/proxy/codexUsage.js +246 -0
  107. package/dist/proxy/proxyAnalysis.js +87 -3
  108. package/dist/proxy/proxyFetch.d.ts +1 -0
  109. package/dist/proxy/proxyFetch.js +29 -0
  110. package/dist/proxy/proxyTracer.d.ts +13 -2
  111. package/dist/proxy/proxyTracer.js +29 -7
  112. package/dist/proxy/proxyTranslationEngine.js +22 -5
  113. package/dist/rag/document/loaders.js +49 -21
  114. package/dist/server/abstract/baseServerAdapter.d.ts +13 -0
  115. package/dist/server/abstract/baseServerAdapter.js +39 -1
  116. package/dist/server/adapters/expressAdapter.js +15 -5
  117. package/dist/server/adapters/fastifyAdapter.js +15 -5
  118. package/dist/server/adapters/koaAdapter.js +16 -6
  119. package/dist/server/routes/codexProxyRoutes.js +29 -1
  120. package/dist/server/routes/openaiProxyRoutes.js +5 -0
  121. package/dist/types/generate.d.ts +7 -0
  122. package/dist/types/proxy.d.ts +65 -0
  123. package/dist/types/stream.d.ts +1 -1
  124. package/dist/utils/pricing.d.ts +9 -0
  125. package/dist/utils/pricing.js +136 -1
  126. package/docs-site/mcp-server/search.js +20 -12
  127. package/docs-site/mcp-server/types.d.ts +12 -5
  128. package/docs-site/static/search-index.json +1 -0
  129. package/package.json +5 -6
  130. package/dist/lib/action/actionExecutor.d.ts +0 -29
  131. package/dist/lib/action/actionExecutor.js +0 -291
  132. package/dist/lib/action/actionInputs.d.ts +0 -25
  133. package/dist/lib/action/actionInputs.js +0 -294
  134. package/dist/lib/action/githubIntegration.d.ts +0 -21
  135. package/dist/lib/action/githubIntegration.js +0 -188
  136. package/dist/lib/action/index.d.ts +0 -7
  137. package/dist/lib/action/index.js +0 -13
  138. package/dist/lib/adapters/audioFormatSupport.d.ts +0 -53
  139. package/dist/lib/adapters/audioFormatSupport.js +0 -201
  140. package/dist/lib/adapters/imageFormatSupport.d.ts +0 -75
  141. package/dist/lib/adapters/imageFormatSupport.js +0 -284
  142. package/dist/lib/adapters/providerImageAdapter.d.ts +0 -51
  143. package/dist/lib/adapters/providerImageAdapter.js +0 -704
  144. package/dist/lib/adapters/replicate/auth.d.ts +0 -19
  145. package/dist/lib/adapters/replicate/auth.js +0 -33
  146. package/dist/lib/adapters/replicate/predictionLifecycle.d.ts +0 -46
  147. package/dist/lib/adapters/replicate/predictionLifecycle.js +0 -289
  148. package/dist/lib/adapters/tts/cartesiaHandler.d.ts +0 -12
  149. package/dist/lib/adapters/tts/cartesiaHandler.js +0 -131
  150. package/dist/lib/adapters/tts/googleTTSHandler.d.ts +0 -97
  151. package/dist/lib/adapters/tts/googleTTSHandler.js +0 -353
  152. package/dist/lib/adapters/video/directorPipeline.d.ts +0 -31
  153. package/dist/lib/adapters/video/directorPipeline.js +0 -523
  154. package/dist/lib/adapters/video/ffmpegAdapter.d.ts +0 -84
  155. package/dist/lib/adapters/video/ffmpegAdapter.js +0 -207
  156. package/dist/lib/adapters/video/frameExtractor.d.ts +0 -28
  157. package/dist/lib/adapters/video/frameExtractor.js +0 -144
  158. package/dist/lib/adapters/video/klingVideoHandler.d.ts +0 -37
  159. package/dist/lib/adapters/video/klingVideoHandler.js +0 -306
  160. package/dist/lib/adapters/video/replicateVideoHandler.d.ts +0 -29
  161. package/dist/lib/adapters/video/replicateVideoHandler.js +0 -168
  162. package/dist/lib/adapters/video/runwayVideoHandler.d.ts +0 -32
  163. package/dist/lib/adapters/video/runwayVideoHandler.js +0 -317
  164. package/dist/lib/adapters/video/vertexVideoHandler.d.ts +0 -119
  165. package/dist/lib/adapters/video/vertexVideoHandler.js +0 -804
  166. package/dist/lib/adapters/video/videoAnalyzer.d.ts +0 -26
  167. package/dist/lib/adapters/video/videoAnalyzer.js +0 -239
  168. package/dist/lib/adapters/video/videoMerger.d.ts +0 -22
  169. package/dist/lib/adapters/video/videoMerger.js +0 -172
  170. package/dist/lib/agent/agent.d.ts +0 -104
  171. package/dist/lib/agent/agent.js +0 -433
  172. package/dist/lib/agent/agentNetwork.d.ts +0 -87
  173. package/dist/lib/agent/agentNetwork.js +0 -501
  174. package/dist/lib/agent/agentToolRegistrar.d.ts +0 -48
  175. package/dist/lib/agent/agentToolRegistrar.js +0 -337
  176. package/dist/lib/agent/communication/index.d.ts +0 -9
  177. package/dist/lib/agent/communication/index.js +0 -10
  178. package/dist/lib/agent/communication/message-bus.d.ts +0 -113
  179. package/dist/lib/agent/communication/message-bus.js +0 -407
  180. package/dist/lib/agent/coordination/coordinator.d.ts +0 -83
  181. package/dist/lib/agent/coordination/coordinator.js +0 -599
  182. package/dist/lib/agent/coordination/index.d.ts +0 -10
  183. package/dist/lib/agent/coordination/index.js +0 -11
  184. package/dist/lib/agent/coordination/task-distributor.d.ts +0 -113
  185. package/dist/lib/agent/coordination/task-distributor.js +0 -586
  186. package/dist/lib/agent/directTools.d.ts +0 -306
  187. package/dist/lib/agent/directTools.js +0 -907
  188. package/dist/lib/agent/index.d.ts +0 -41
  189. package/dist/lib/agent/index.js +0 -49
  190. package/dist/lib/agent/isolatedAgentRunner.d.ts +0 -73
  191. package/dist/lib/agent/isolatedAgentRunner.js +0 -947
  192. package/dist/lib/agent/orchestration/index.d.ts +0 -10
  193. package/dist/lib/agent/orchestration/index.js +0 -11
  194. package/dist/lib/agent/orchestration/orchestrator.d.ts +0 -114
  195. package/dist/lib/agent/orchestration/orchestrator.js +0 -479
  196. package/dist/lib/agent/orchestration/topology.d.ts +0 -164
  197. package/dist/lib/agent/orchestration/topology.js +0 -521
  198. package/dist/lib/agent/prompts/routingPrompts.d.ts +0 -63
  199. package/dist/lib/agent/prompts/routingPrompts.js +0 -202
  200. package/dist/lib/agent/structuredRecovery.d.ts +0 -30
  201. package/dist/lib/agent/structuredRecovery.js +0 -105
  202. package/dist/lib/analytics/index.d.ts +0 -7
  203. package/dist/lib/analytics/index.js +0 -8
  204. package/dist/lib/analytics/parseQualityScore.d.ts +0 -9
  205. package/dist/lib/analytics/parseQualityScore.js +0 -30
  206. package/dist/lib/analytics/pricing.d.ts +0 -27
  207. package/dist/lib/analytics/pricing.js +0 -42
  208. package/dist/lib/analytics/service.d.ts +0 -36
  209. package/dist/lib/analytics/service.js +0 -394
  210. package/dist/lib/analytics/storage.d.ts +0 -19
  211. package/dist/lib/analytics/storage.js +0 -33
  212. package/dist/lib/artifacts/artifactStore.d.ts +0 -55
  213. package/dist/lib/artifacts/artifactStore.js +0 -145
  214. package/dist/lib/auth/AuthProviderFactory.d.ts +0 -69
  215. package/dist/lib/auth/AuthProviderFactory.js +0 -112
  216. package/dist/lib/auth/AuthProviderRegistry.d.ts +0 -33
  217. package/dist/lib/auth/AuthProviderRegistry.js +0 -191
  218. package/dist/lib/auth/RequestContext.d.ts +0 -23
  219. package/dist/lib/auth/RequestContext.js +0 -79
  220. package/dist/lib/auth/accountPool.d.ts +0 -68
  221. package/dist/lib/auth/accountPool.js +0 -179
  222. package/dist/lib/auth/anthropicOAuth.d.ts +0 -400
  223. package/dist/lib/auth/anthropicOAuth.js +0 -1143
  224. package/dist/lib/auth/authContext.d.ts +0 -198
  225. package/dist/lib/auth/authContext.js +0 -315
  226. package/dist/lib/auth/codexOAuth.d.ts +0 -67
  227. package/dist/lib/auth/codexOAuth.js +0 -203
  228. package/dist/lib/auth/errors.d.ts +0 -63
  229. package/dist/lib/auth/errors.js +0 -40
  230. package/dist/lib/auth/index.d.ts +0 -41
  231. package/dist/lib/auth/index.js +0 -86
  232. package/dist/lib/auth/middleware/AuthMiddleware.d.ts +0 -127
  233. package/dist/lib/auth/middleware/AuthMiddleware.js +0 -523
  234. package/dist/lib/auth/middleware/rateLimitByUser.d.ts +0 -193
  235. package/dist/lib/auth/middleware/rateLimitByUser.js +0 -559
  236. package/dist/lib/auth/providers/BaseAuthProvider.d.ts +0 -259
  237. package/dist/lib/auth/providers/BaseAuthProvider.js +0 -724
  238. package/dist/lib/auth/providers/CognitoProvider.d.ts +0 -61
  239. package/dist/lib/auth/providers/CognitoProvider.js +0 -308
  240. package/dist/lib/auth/providers/KeycloakProvider.d.ts +0 -61
  241. package/dist/lib/auth/providers/KeycloakProvider.js +0 -396
  242. package/dist/lib/auth/providers/auth0.d.ts +0 -59
  243. package/dist/lib/auth/providers/auth0.js +0 -275
  244. package/dist/lib/auth/providers/betterAuth.d.ts +0 -51
  245. package/dist/lib/auth/providers/betterAuth.js +0 -183
  246. package/dist/lib/auth/providers/clerk.d.ts +0 -65
  247. package/dist/lib/auth/providers/clerk.js +0 -318
  248. package/dist/lib/auth/providers/custom.d.ts +0 -64
  249. package/dist/lib/auth/providers/custom.js +0 -113
  250. package/dist/lib/auth/providers/firebase.d.ts +0 -63
  251. package/dist/lib/auth/providers/firebase.js +0 -231
  252. package/dist/lib/auth/providers/jwt.d.ts +0 -68
  253. package/dist/lib/auth/providers/jwt.js +0 -217
  254. package/dist/lib/auth/providers/oauth2.d.ts +0 -73
  255. package/dist/lib/auth/providers/oauth2.js +0 -304
  256. package/dist/lib/auth/providers/supabase.d.ts +0 -63
  257. package/dist/lib/auth/providers/supabase.js +0 -260
  258. package/dist/lib/auth/providers/workos.d.ts +0 -61
  259. package/dist/lib/auth/providers/workos.js +0 -289
  260. package/dist/lib/auth/serverBridge.d.ts +0 -14
  261. package/dist/lib/auth/serverBridge.js +0 -26
  262. package/dist/lib/auth/sessionManager.d.ts +0 -118
  263. package/dist/lib/auth/sessionManager.js +0 -511
  264. package/dist/lib/auth/tokenStore.d.ts +0 -283
  265. package/dist/lib/auth/tokenStore.js +0 -929
  266. package/dist/lib/autoresearch/config.d.ts +0 -11
  267. package/dist/lib/autoresearch/config.js +0 -109
  268. package/dist/lib/autoresearch/errors.d.ts +0 -40
  269. package/dist/lib/autoresearch/errors.js +0 -21
  270. package/dist/lib/autoresearch/index.d.ts +0 -23
  271. package/dist/lib/autoresearch/index.js +0 -35
  272. package/dist/lib/autoresearch/phasePolicy.d.ts +0 -9
  273. package/dist/lib/autoresearch/phasePolicy.js +0 -70
  274. package/dist/lib/autoresearch/promptCompiler.d.ts +0 -15
  275. package/dist/lib/autoresearch/promptCompiler.js +0 -121
  276. package/dist/lib/autoresearch/repoPolicy.d.ts +0 -32
  277. package/dist/lib/autoresearch/repoPolicy.js +0 -129
  278. package/dist/lib/autoresearch/resultRecorder.d.ts +0 -20
  279. package/dist/lib/autoresearch/resultRecorder.js +0 -131
  280. package/dist/lib/autoresearch/runner.d.ts +0 -10
  281. package/dist/lib/autoresearch/runner.js +0 -109
  282. package/dist/lib/autoresearch/stateStore.d.ts +0 -12
  283. package/dist/lib/autoresearch/stateStore.js +0 -164
  284. package/dist/lib/autoresearch/summaryParser.d.ts +0 -16
  285. package/dist/lib/autoresearch/summaryParser.js +0 -95
  286. package/dist/lib/autoresearch/tools.d.ts +0 -27
  287. package/dist/lib/autoresearch/tools.js +0 -618
  288. package/dist/lib/autoresearch/worker.d.ts +0 -71
  289. package/dist/lib/autoresearch/worker.js +0 -418
  290. package/dist/lib/avatar/index.d.ts +0 -26
  291. package/dist/lib/avatar/index.js +0 -86
  292. package/dist/lib/avatar/providers/DIDAvatar.d.ts +0 -49
  293. package/dist/lib/avatar/providers/DIDAvatar.js +0 -502
  294. package/dist/lib/avatar/providers/HeyGenAvatar.d.ts +0 -30
  295. package/dist/lib/avatar/providers/HeyGenAvatar.js +0 -338
  296. package/dist/lib/avatar/providers/ReplicateAvatar.d.ts +0 -36
  297. package/dist/lib/avatar/providers/ReplicateAvatar.js +0 -268
  298. package/dist/lib/client/aiSdkAdapter.d.ts +0 -196
  299. package/dist/lib/client/aiSdkAdapter.js +0 -498
  300. package/dist/lib/client/auth.d.ts +0 -248
  301. package/dist/lib/client/auth.js +0 -469
  302. package/dist/lib/client/errors.d.ts +0 -298
  303. package/dist/lib/client/errors.js +0 -553
  304. package/dist/lib/client/httpClient.d.ts +0 -296
  305. package/dist/lib/client/httpClient.js +0 -851
  306. package/dist/lib/client/index.d.ts +0 -103
  307. package/dist/lib/client/index.js +0 -174
  308. package/dist/lib/client/interceptors.d.ts +0 -207
  309. package/dist/lib/client/interceptors.js +0 -620
  310. package/dist/lib/client/reactHooks.d.ts +0 -238
  311. package/dist/lib/client/reactHooks.js +0 -1168
  312. package/dist/lib/client/sseClient.d.ts +0 -115
  313. package/dist/lib/client/sseClient.js +0 -575
  314. package/dist/lib/client/streamingClient.d.ts +0 -255
  315. package/dist/lib/client/streamingClient.js +0 -963
  316. package/dist/lib/client/wsClient.d.ts +0 -127
  317. package/dist/lib/client/wsClient.js +0 -450
  318. package/dist/lib/config/configManager.d.ts +0 -60
  319. package/dist/lib/config/configManager.js +0 -304
  320. package/dist/lib/config/conversationMemory.d.ts +0 -51
  321. package/dist/lib/config/conversationMemory.js +0 -87
  322. package/dist/lib/config/modelSpecificPrompts.d.ts +0 -9
  323. package/dist/lib/config/modelSpecificPrompts.js +0 -39
  324. package/dist/lib/config/taskClassificationConfig.d.ts +0 -51
  325. package/dist/lib/config/taskClassificationConfig.js +0 -149
  326. package/dist/lib/constants/contextWindows.d.ts +0 -89
  327. package/dist/lib/constants/contextWindows.js +0 -568
  328. package/dist/lib/constants/enums.d.ts +0 -979
  329. package/dist/lib/constants/enums.js +0 -1247
  330. package/dist/lib/constants/index.d.ts +0 -184
  331. package/dist/lib/constants/index.js +0 -209
  332. package/dist/lib/constants/networkErrorCodes.d.ts +0 -14
  333. package/dist/lib/constants/networkErrorCodes.js +0 -22
  334. package/dist/lib/constants/performance.d.ts +0 -366
  335. package/dist/lib/constants/performance.js +0 -390
  336. package/dist/lib/constants/retry.d.ts +0 -224
  337. package/dist/lib/constants/retry.js +0 -267
  338. package/dist/lib/constants/timeouts.d.ts +0 -225
  339. package/dist/lib/constants/timeouts.js +0 -183
  340. package/dist/lib/constants/tokens.d.ts +0 -294
  341. package/dist/lib/constants/tokens.js +0 -381
  342. package/dist/lib/constants/videoErrors.d.ts +0 -49
  343. package/dist/lib/constants/videoErrors.js +0 -51
  344. package/dist/lib/context/anthropicLoopGuard.d.ts +0 -47
  345. package/dist/lib/context/anthropicLoopGuard.js +0 -186
  346. package/dist/lib/context/budgetChecker.d.ts +0 -33
  347. package/dist/lib/context/budgetChecker.js +0 -132
  348. package/dist/lib/context/contextCompactor.d.ts +0 -19
  349. package/dist/lib/context/contextCompactor.js +0 -258
  350. package/dist/lib/context/effectiveHistory.d.ts +0 -52
  351. package/dist/lib/context/effectiveHistory.js +0 -106
  352. package/dist/lib/context/emergencyTruncation.d.ts +0 -21
  353. package/dist/lib/context/emergencyTruncation.js +0 -89
  354. package/dist/lib/context/errorDetection.d.ts +0 -36
  355. package/dist/lib/context/errorDetection.js +0 -190
  356. package/dist/lib/context/errors.d.ts +0 -19
  357. package/dist/lib/context/errors.js +0 -22
  358. package/dist/lib/context/fileSummarizationService.d.ts +0 -45
  359. package/dist/lib/context/fileSummarizationService.js +0 -256
  360. package/dist/lib/context/fileSummarizer.d.ts +0 -55
  361. package/dist/lib/context/fileSummarizer.js +0 -146
  362. package/dist/lib/context/fileTokenBudget.d.ts +0 -52
  363. package/dist/lib/context/fileTokenBudget.js +0 -128
  364. package/dist/lib/context/geminiLoopGuard.d.ts +0 -54
  365. package/dist/lib/context/geminiLoopGuard.js +0 -141
  366. package/dist/lib/context/loopGuardCore.d.ts +0 -43
  367. package/dist/lib/context/loopGuardCore.js +0 -146
  368. package/dist/lib/context/openaiCompatLoopGuard.d.ts +0 -42
  369. package/dist/lib/context/openaiCompatLoopGuard.js +0 -173
  370. package/dist/lib/context/prompts/summarizationPrompt.d.ts +0 -16
  371. package/dist/lib/context/prompts/summarizationPrompt.js +0 -118
  372. package/dist/lib/context/stages/fileReadDeduplicator.d.ts +0 -8
  373. package/dist/lib/context/stages/fileReadDeduplicator.js +0 -67
  374. package/dist/lib/context/stages/slidingWindowTruncator.d.ts +0 -15
  375. package/dist/lib/context/stages/slidingWindowTruncator.js +0 -237
  376. package/dist/lib/context/stages/structuredSummarizer.d.ts +0 -8
  377. package/dist/lib/context/stages/structuredSummarizer.js +0 -123
  378. package/dist/lib/context/stages/toolOutputPruner.d.ts +0 -8
  379. package/dist/lib/context/stages/toolOutputPruner.js +0 -53
  380. package/dist/lib/context/stepBudgetGuard.d.ts +0 -61
  381. package/dist/lib/context/stepBudgetGuard.js +0 -358
  382. package/dist/lib/context/summarizationEngine.d.ts +0 -45
  383. package/dist/lib/context/summarizationEngine.js +0 -162
  384. package/dist/lib/context/toolOutputLimits.d.ts +0 -36
  385. package/dist/lib/context/toolOutputLimits.js +0 -95
  386. package/dist/lib/context/toolPairRepair.d.ts +0 -43
  387. package/dist/lib/context/toolPairRepair.js +0 -242
  388. package/dist/lib/core/analytics.d.ts +0 -11
  389. package/dist/lib/core/analytics.js +0 -117
  390. package/dist/lib/core/baseProvider.d.ts +0 -500
  391. package/dist/lib/core/baseProvider.js +0 -2081
  392. package/dist/lib/core/constants.d.ts +0 -146
  393. package/dist/lib/core/constants.js +0 -278
  394. package/dist/lib/core/conversationMemoryFactory.d.ts +0 -19
  395. package/dist/lib/core/conversationMemoryFactory.js +0 -147
  396. package/dist/lib/core/conversationMemoryInitializer.d.ts +0 -14
  397. package/dist/lib/core/conversationMemoryInitializer.js +0 -129
  398. package/dist/lib/core/conversationMemoryManager.d.ts +0 -110
  399. package/dist/lib/core/conversationMemoryManager.js +0 -471
  400. package/dist/lib/core/dynamicModels.d.ts +0 -89
  401. package/dist/lib/core/dynamicModels.js +0 -337
  402. package/dist/lib/core/evaluation.d.ts +0 -18
  403. package/dist/lib/core/evaluation.js +0 -310
  404. package/dist/lib/core/evaluationProviders.d.ts +0 -60
  405. package/dist/lib/core/evaluationProviders.js +0 -249
  406. package/dist/lib/core/factory.d.ts +0 -54
  407. package/dist/lib/core/factory.js +0 -364
  408. package/dist/lib/core/geminiLoopAdapter.d.ts +0 -20
  409. package/dist/lib/core/geminiLoopAdapter.js +0 -171
  410. package/dist/lib/core/handlerRegistry.d.ts +0 -29
  411. package/dist/lib/core/handlerRegistry.js +0 -62
  412. package/dist/lib/core/infrastructure/baseError.d.ts +0 -21
  413. package/dist/lib/core/infrastructure/baseError.js +0 -23
  414. package/dist/lib/core/infrastructure/baseFactory.d.ts +0 -16
  415. package/dist/lib/core/infrastructure/baseFactory.js +0 -55
  416. package/dist/lib/core/infrastructure/baseRegistry.d.ts +0 -19
  417. package/dist/lib/core/infrastructure/baseRegistry.js +0 -54
  418. package/dist/lib/core/infrastructure/index.d.ts +0 -5
  419. package/dist/lib/core/infrastructure/index.js +0 -6
  420. package/dist/lib/core/infrastructure/retry.d.ts +0 -2
  421. package/dist/lib/core/infrastructure/retry.js +0 -21
  422. package/dist/lib/core/infrastructure/typedEventEmitter.d.ts +0 -8
  423. package/dist/lib/core/infrastructure/typedEventEmitter.js +0 -24
  424. package/dist/lib/core/loopEngine.d.ts +0 -21
  425. package/dist/lib/core/loopEngine.js +0 -272
  426. package/dist/lib/core/modelConfiguration.d.ts +0 -179
  427. package/dist/lib/core/modelConfiguration.js +0 -549
  428. package/dist/lib/core/modules/GenerationHandler.d.ts +0 -135
  429. package/dist/lib/core/modules/GenerationHandler.js +0 -1028
  430. package/dist/lib/core/modules/MessageBuilder.d.ts +0 -24
  431. package/dist/lib/core/modules/MessageBuilder.js +0 -311
  432. package/dist/lib/core/modules/StreamHandler.d.ts +0 -70
  433. package/dist/lib/core/modules/StreamHandler.js +0 -229
  434. package/dist/lib/core/modules/TelemetryHandler.d.ts +0 -70
  435. package/dist/lib/core/modules/TelemetryHandler.js +0 -229
  436. package/dist/lib/core/modules/ToolsManager.d.ts +0 -105
  437. package/dist/lib/core/modules/ToolsManager.js +0 -737
  438. package/dist/lib/core/modules/Utilities.d.ts +0 -90
  439. package/dist/lib/core/modules/Utilities.js +0 -347
  440. package/dist/lib/core/modules/structuredOutputPolicy.d.ts +0 -91
  441. package/dist/lib/core/modules/structuredOutputPolicy.js +0 -136
  442. package/dist/lib/core/nativeToolFormat.d.ts +0 -33
  443. package/dist/lib/core/nativeToolFormat.js +0 -31
  444. package/dist/lib/core/redisConversationMemoryManager.d.ts +0 -235
  445. package/dist/lib/core/redisConversationMemoryManager.js +0 -1724
  446. package/dist/lib/core/serviceRegistry.d.ts +0 -40
  447. package/dist/lib/core/serviceRegistry.js +0 -113
  448. package/dist/lib/core/streamAnalytics.d.ts +0 -27
  449. package/dist/lib/core/streamAnalytics.js +0 -132
  450. package/dist/lib/core/streamChannel.d.ts +0 -10
  451. package/dist/lib/core/streamChannel.js +0 -77
  452. package/dist/lib/core/toolDedup.d.ts +0 -51
  453. package/dist/lib/core/toolDedup.js +0 -197
  454. package/dist/lib/core/toolEvents.d.ts +0 -2
  455. package/dist/lib/core/toolEvents.js +0 -8
  456. package/dist/lib/core/toolExecutionRecorder.d.ts +0 -76
  457. package/dist/lib/core/toolExecutionRecorder.js +0 -261
  458. package/dist/lib/core/toolRouting.d.ts +0 -68
  459. package/dist/lib/core/toolRouting.js +0 -496
  460. package/dist/lib/core/toolRoutingCache.d.ts +0 -64
  461. package/dist/lib/core/toolRoutingCache.js +0 -155
  462. package/dist/lib/core/toolRoutingEmbedding.d.ts +0 -112
  463. package/dist/lib/core/toolRoutingEmbedding.js +0 -323
  464. package/dist/lib/dynamic/dynamicResolver.d.ts +0 -282
  465. package/dist/lib/dynamic/dynamicResolver.js +0 -634
  466. package/dist/lib/dynamic/index.d.ts +0 -10
  467. package/dist/lib/dynamic/index.js +0 -13
  468. package/dist/lib/dynamic/resolution.d.ts +0 -17
  469. package/dist/lib/dynamic/resolution.js +0 -22
  470. package/dist/lib/evaluation/BatchEvaluator.d.ts +0 -65
  471. package/dist/lib/evaluation/BatchEvaluator.js +0 -271
  472. package/dist/lib/evaluation/EvaluationAggregator.d.ts +0 -156
  473. package/dist/lib/evaluation/EvaluationAggregator.js +0 -378
  474. package/dist/lib/evaluation/EvaluatorFactory.d.ts +0 -102
  475. package/dist/lib/evaluation/EvaluatorFactory.js +0 -281
  476. package/dist/lib/evaluation/EvaluatorRegistry.d.ts +0 -111
  477. package/dist/lib/evaluation/EvaluatorRegistry.js +0 -185
  478. package/dist/lib/evaluation/contextBuilder.d.ts +0 -44
  479. package/dist/lib/evaluation/contextBuilder.js +0 -132
  480. package/dist/lib/evaluation/errors/EvaluationError.d.ts +0 -161
  481. package/dist/lib/evaluation/errors/EvaluationError.js +0 -207
  482. package/dist/lib/evaluation/errors/index.d.ts +0 -4
  483. package/dist/lib/evaluation/errors/index.js +0 -5
  484. package/dist/lib/evaluation/hooks/index.d.ts +0 -6
  485. package/dist/lib/evaluation/hooks/index.js +0 -7
  486. package/dist/lib/evaluation/hooks/langfuseAdapter.d.ts +0 -62
  487. package/dist/lib/evaluation/hooks/langfuseAdapter.js +0 -173
  488. package/dist/lib/evaluation/hooks/observabilityHooks.d.ts +0 -77
  489. package/dist/lib/evaluation/hooks/observabilityHooks.js +0 -187
  490. package/dist/lib/evaluation/index.d.ts +0 -41
  491. package/dist/lib/evaluation/index.js +0 -78
  492. package/dist/lib/evaluation/pipeline/evaluationPipeline.d.ts +0 -83
  493. package/dist/lib/evaluation/pipeline/evaluationPipeline.js +0 -397
  494. package/dist/lib/evaluation/pipeline/index.d.ts +0 -8
  495. package/dist/lib/evaluation/pipeline/index.js +0 -9
  496. package/dist/lib/evaluation/pipeline/pipelineBuilder.d.ts +0 -126
  497. package/dist/lib/evaluation/pipeline/pipelineBuilder.js +0 -261
  498. package/dist/lib/evaluation/pipeline/presets.d.ts +0 -66
  499. package/dist/lib/evaluation/pipeline/presets.js +0 -225
  500. package/dist/lib/evaluation/pipeline/strategies/batchStrategy.d.ts +0 -46
  501. package/dist/lib/evaluation/pipeline/strategies/batchStrategy.js +0 -242
  502. package/dist/lib/evaluation/pipeline/strategies/index.d.ts +0 -6
  503. package/dist/lib/evaluation/pipeline/strategies/index.js +0 -7
  504. package/dist/lib/evaluation/pipeline/strategies/samplingStrategy.d.ts +0 -76
  505. package/dist/lib/evaluation/pipeline/strategies/samplingStrategy.js +0 -247
  506. package/dist/lib/evaluation/prompts.d.ts +0 -22
  507. package/dist/lib/evaluation/prompts.js +0 -74
  508. package/dist/lib/evaluation/ragasEvaluator.d.ts +0 -28
  509. package/dist/lib/evaluation/ragasEvaluator.js +0 -127
  510. package/dist/lib/evaluation/reporting/index.d.ts +0 -6
  511. package/dist/lib/evaluation/reporting/index.js +0 -7
  512. package/dist/lib/evaluation/reporting/metricsCollector.d.ts +0 -88
  513. package/dist/lib/evaluation/reporting/metricsCollector.js +0 -286
  514. package/dist/lib/evaluation/reporting/reportGenerator.d.ts +0 -57
  515. package/dist/lib/evaluation/reporting/reportGenerator.js +0 -375
  516. package/dist/lib/evaluation/retryManager.d.ts +0 -39
  517. package/dist/lib/evaluation/retryManager.js +0 -79
  518. package/dist/lib/evaluation/scorers/baseScorer.d.ts +0 -82
  519. package/dist/lib/evaluation/scorers/baseScorer.js +0 -233
  520. package/dist/lib/evaluation/scorers/customScorerUtils.d.ts +0 -86
  521. package/dist/lib/evaluation/scorers/customScorerUtils.js +0 -382
  522. package/dist/lib/evaluation/scorers/index.d.ts +0 -10
  523. package/dist/lib/evaluation/scorers/index.js +0 -17
  524. package/dist/lib/evaluation/scorers/llm/answerRelevancyScorer.d.ts +0 -12
  525. package/dist/lib/evaluation/scorers/llm/answerRelevancyScorer.js +0 -100
  526. package/dist/lib/evaluation/scorers/llm/baseLLMScorer.d.ts +0 -69
  527. package/dist/lib/evaluation/scorers/llm/baseLLMScorer.js +0 -282
  528. package/dist/lib/evaluation/scorers/llm/biasDetectionScorer.d.ts +0 -12
  529. package/dist/lib/evaluation/scorers/llm/biasDetectionScorer.js +0 -128
  530. package/dist/lib/evaluation/scorers/llm/contextPrecisionScorer.d.ts +0 -12
  531. package/dist/lib/evaluation/scorers/llm/contextPrecisionScorer.js +0 -93
  532. package/dist/lib/evaluation/scorers/llm/contextRelevancyScorer.d.ts +0 -12
  533. package/dist/lib/evaluation/scorers/llm/contextRelevancyScorer.js +0 -108
  534. package/dist/lib/evaluation/scorers/llm/faithfulnessScorer.d.ts +0 -12
  535. package/dist/lib/evaluation/scorers/llm/faithfulnessScorer.js +0 -122
  536. package/dist/lib/evaluation/scorers/llm/hallucinationScorer.d.ts +0 -12
  537. package/dist/lib/evaluation/scorers/llm/hallucinationScorer.js +0 -141
  538. package/dist/lib/evaluation/scorers/llm/index.d.ts +0 -15
  539. package/dist/lib/evaluation/scorers/llm/index.js +0 -17
  540. package/dist/lib/evaluation/scorers/llm/promptAlignmentScorer.d.ts +0 -12
  541. package/dist/lib/evaluation/scorers/llm/promptAlignmentScorer.js +0 -107
  542. package/dist/lib/evaluation/scorers/llm/summarizationScorer.d.ts +0 -12
  543. package/dist/lib/evaluation/scorers/llm/summarizationScorer.js +0 -115
  544. package/dist/lib/evaluation/scorers/llm/toneConsistencyScorer.d.ts +0 -12
  545. package/dist/lib/evaluation/scorers/llm/toneConsistencyScorer.js +0 -107
  546. package/dist/lib/evaluation/scorers/llm/toxicityScorer.d.ts +0 -12
  547. package/dist/lib/evaluation/scorers/llm/toxicityScorer.js +0 -122
  548. package/dist/lib/evaluation/scorers/rule/baseRuleScorer.d.ts +0 -77
  549. package/dist/lib/evaluation/scorers/rule/baseRuleScorer.js +0 -234
  550. package/dist/lib/evaluation/scorers/rule/contentSimilarityScorer.d.ts +0 -81
  551. package/dist/lib/evaluation/scorers/rule/contentSimilarityScorer.js +0 -353
  552. package/dist/lib/evaluation/scorers/rule/formatScorer.d.ts +0 -107
  553. package/dist/lib/evaluation/scorers/rule/formatScorer.js +0 -471
  554. package/dist/lib/evaluation/scorers/rule/index.d.ts +0 -9
  555. package/dist/lib/evaluation/scorers/rule/index.js +0 -11
  556. package/dist/lib/evaluation/scorers/rule/keywordCoverageScorer.d.ts +0 -66
  557. package/dist/lib/evaluation/scorers/rule/keywordCoverageScorer.js +0 -348
  558. package/dist/lib/evaluation/scorers/rule/lengthScorer.d.ts +0 -74
  559. package/dist/lib/evaluation/scorers/rule/lengthScorer.js +0 -352
  560. package/dist/lib/evaluation/scorers/scorerBuilder.d.ts +0 -160
  561. package/dist/lib/evaluation/scorers/scorerBuilder.js +0 -421
  562. package/dist/lib/evaluation/scorers/scorerRegistry.d.ts +0 -65
  563. package/dist/lib/evaluation/scorers/scorerRegistry.js +0 -540
  564. package/dist/lib/evaluation/scoring.d.ts +0 -15
  565. package/dist/lib/evaluation/scoring.js +0 -61
  566. package/dist/lib/factories/providerDescriptors.d.ts +0 -18
  567. package/dist/lib/factories/providerDescriptors.js +0 -547
  568. package/dist/lib/factories/providerFactory.d.ts +0 -87
  569. package/dist/lib/factories/providerFactory.js +0 -199
  570. package/dist/lib/factories/providerRegistry.d.ts +0 -58
  571. package/dist/lib/factories/providerRegistry.js +0 -549
  572. package/dist/lib/features/ppt/constants.d.ts +0 -121
  573. package/dist/lib/features/ppt/constants.js +0 -897
  574. package/dist/lib/features/ppt/contentPlanner.d.ts +0 -47
  575. package/dist/lib/features/ppt/contentPlanner.js +0 -558
  576. package/dist/lib/features/ppt/index.d.ts +0 -11
  577. package/dist/lib/features/ppt/index.js +0 -33
  578. package/dist/lib/features/ppt/pptError.d.ts +0 -38
  579. package/dist/lib/features/ppt/pptError.js +0 -54
  580. package/dist/lib/features/ppt/presentationOrchestrator.d.ts +0 -37
  581. package/dist/lib/features/ppt/presentationOrchestrator.js +0 -231
  582. package/dist/lib/features/ppt/slideGenerator.d.ts +0 -56
  583. package/dist/lib/features/ppt/slideGenerator.js +0 -542
  584. package/dist/lib/features/ppt/slideRenderers.d.ts +0 -347
  585. package/dist/lib/features/ppt/slideRenderers.js +0 -2384
  586. package/dist/lib/features/ppt/slideTypeInference.d.ts +0 -91
  587. package/dist/lib/features/ppt/slideTypeInference.js +0 -406
  588. package/dist/lib/features/ppt/utils.d.ts +0 -103
  589. package/dist/lib/features/ppt/utils.js +0 -446
  590. package/dist/lib/files/fileReferenceRegistry.d.ts +0 -275
  591. package/dist/lib/files/fileReferenceRegistry.js +0 -1559
  592. package/dist/lib/files/fileTools.d.ts +0 -176
  593. package/dist/lib/files/fileTools.js +0 -435
  594. package/dist/lib/files/index.d.ts +0 -13
  595. package/dist/lib/files/index.js +0 -14
  596. package/dist/lib/files/streamingReader.d.ts +0 -93
  597. package/dist/lib/files/streamingReader.js +0 -322
  598. package/dist/lib/hitl/hitlErrors.d.ts +0 -38
  599. package/dist/lib/hitl/hitlErrors.js +0 -55
  600. package/dist/lib/hitl/hitlManager.d.ts +0 -100
  601. package/dist/lib/hitl/hitlManager.js +0 -461
  602. package/dist/lib/hitl/index.d.ts +0 -7
  603. package/dist/lib/hitl/index.js +0 -10
  604. package/dist/lib/image-gen/ImageGenService.d.ts +0 -146
  605. package/dist/lib/image-gen/ImageGenService.js +0 -349
  606. package/dist/lib/image-gen/imageGenTools.d.ts +0 -109
  607. package/dist/lib/image-gen/imageGenTools.js +0 -305
  608. package/dist/lib/image-gen/index.d.ts +0 -45
  609. package/dist/lib/image-gen/index.js +0 -49
  610. package/dist/lib/index.d.ts +0 -447
  611. package/dist/lib/index.js +0 -748
  612. package/dist/lib/knowledge/context.d.ts +0 -18
  613. package/dist/lib/knowledge/context.js +0 -92
  614. package/dist/lib/knowledge/defaults.d.ts +0 -24
  615. package/dist/lib/knowledge/defaults.js +0 -30
  616. package/dist/lib/knowledge/engine.d.ts +0 -35
  617. package/dist/lib/knowledge/engine.js +0 -180
  618. package/dist/lib/knowledge/index.d.ts +0 -15
  619. package/dist/lib/knowledge/index.js +0 -16
  620. package/dist/lib/knowledge/indexCache.d.ts +0 -19
  621. package/dist/lib/knowledge/indexCache.js +0 -110
  622. package/dist/lib/knowledge/knowledgeIndex.d.ts +0 -41
  623. package/dist/lib/knowledge/knowledgeIndex.js +0 -205
  624. package/dist/lib/knowledge/normalize.d.ts +0 -32
  625. package/dist/lib/knowledge/normalize.js +0 -75
  626. package/dist/lib/knowledge/resolve.d.ts +0 -18
  627. package/dist/lib/knowledge/resolve.js +0 -157
  628. package/dist/lib/knowledge/retrieval.d.ts +0 -16
  629. package/dist/lib/knowledge/retrieval.js +0 -222
  630. package/dist/lib/mcp/agentExposure.d.ts +0 -83
  631. package/dist/lib/mcp/agentExposure.js +0 -357
  632. package/dist/lib/mcp/auth/index.d.ts +0 -6
  633. package/dist/lib/mcp/auth/index.js +0 -12
  634. package/dist/lib/mcp/auth/oauthClientProvider.d.ts +0 -93
  635. package/dist/lib/mcp/auth/oauthClientProvider.js +0 -331
  636. package/dist/lib/mcp/auth/tokenStorage.d.ts +0 -56
  637. package/dist/lib/mcp/auth/tokenStorage.js +0 -135
  638. package/dist/lib/mcp/batching/index.d.ts +0 -1
  639. package/dist/lib/mcp/batching/index.js +0 -2
  640. package/dist/lib/mcp/batching/requestBatcher.d.ts +0 -130
  641. package/dist/lib/mcp/batching/requestBatcher.js +0 -468
  642. package/dist/lib/mcp/caching/index.d.ts +0 -1
  643. package/dist/lib/mcp/caching/index.js +0 -2
  644. package/dist/lib/mcp/caching/toolCache.d.ts +0 -154
  645. package/dist/lib/mcp/caching/toolCache.js +0 -434
  646. package/dist/lib/mcp/elicitation/elicitationManager.d.ts +0 -169
  647. package/dist/lib/mcp/elicitation/elicitationManager.js +0 -377
  648. package/dist/lib/mcp/elicitation/index.d.ts +0 -1
  649. package/dist/lib/mcp/elicitation/index.js +0 -3
  650. package/dist/lib/mcp/elicitationProtocol.d.ts +0 -139
  651. package/dist/lib/mcp/elicitationProtocol.js +0 -376
  652. package/dist/lib/mcp/enhancedToolDiscovery.d.ts +0 -125
  653. package/dist/lib/mcp/enhancedToolDiscovery.js +0 -482
  654. package/dist/lib/mcp/externalServerManager.d.ts +0 -189
  655. package/dist/lib/mcp/externalServerManager.js +0 -1525
  656. package/dist/lib/mcp/factory.d.ts +0 -60
  657. package/dist/lib/mcp/factory.js +0 -162
  658. package/dist/lib/mcp/flexibleToolValidator.d.ts +0 -46
  659. package/dist/lib/mcp/flexibleToolValidator.js +0 -162
  660. package/dist/lib/mcp/httpRateLimiter.d.ts +0 -152
  661. package/dist/lib/mcp/httpRateLimiter.js +0 -386
  662. package/dist/lib/mcp/httpRetryHandler.d.ts +0 -62
  663. package/dist/lib/mcp/httpRetryHandler.js +0 -180
  664. package/dist/lib/mcp/index.d.ts +0 -60
  665. package/dist/lib/mcp/index.js +0 -82
  666. package/dist/lib/mcp/mcpCircuitBreaker.d.ts +0 -123
  667. package/dist/lib/mcp/mcpCircuitBreaker.js +0 -428
  668. package/dist/lib/mcp/mcpClientFactory.d.ts +0 -109
  669. package/dist/lib/mcp/mcpClientFactory.js +0 -714
  670. package/dist/lib/mcp/mcpOutputNormalizer.d.ts +0 -47
  671. package/dist/lib/mcp/mcpOutputNormalizer.js +0 -183
  672. package/dist/lib/mcp/mcpRegistryClient.d.ts +0 -129
  673. package/dist/lib/mcp/mcpRegistryClient.js +0 -489
  674. package/dist/lib/mcp/mcpServerBase.d.ts +0 -162
  675. package/dist/lib/mcp/mcpServerBase.js +0 -377
  676. package/dist/lib/mcp/multiServerManager.d.ts +0 -182
  677. package/dist/lib/mcp/multiServerManager.js +0 -580
  678. package/dist/lib/mcp/registry.d.ts +0 -94
  679. package/dist/lib/mcp/registry.js +0 -159
  680. package/dist/lib/mcp/routing/index.d.ts +0 -1
  681. package/dist/lib/mcp/routing/index.js +0 -2
  682. package/dist/lib/mcp/routing/toolRouter.d.ts +0 -110
  683. package/dist/lib/mcp/routing/toolRouter.js +0 -417
  684. package/dist/lib/mcp/serverCapabilities.d.ts +0 -175
  685. package/dist/lib/mcp/serverCapabilities.js +0 -503
  686. package/dist/lib/mcp/servers/agent/directToolsServer.d.ts +0 -8
  687. package/dist/lib/mcp/servers/agent/directToolsServer.js +0 -152
  688. package/dist/lib/mcp/servers/aiProviders/aiAnalysisTools.d.ts +0 -6
  689. package/dist/lib/mcp/servers/aiProviders/aiAnalysisTools.js +0 -364
  690. package/dist/lib/mcp/servers/aiProviders/aiCoreServer.d.ts +0 -10
  691. package/dist/lib/mcp/servers/aiProviders/aiCoreServer.js +0 -232
  692. package/dist/lib/mcp/servers/aiProviders/aiWorkflowTools.d.ts +0 -5
  693. package/dist/lib/mcp/servers/aiProviders/aiWorkflowTools.js +0 -584
  694. package/dist/lib/mcp/servers/utilities/utilityServer.d.ts +0 -8
  695. package/dist/lib/mcp/servers/utilities/utilityServer.js +0 -327
  696. package/dist/lib/mcp/toolAnnotations.d.ts +0 -57
  697. package/dist/lib/mcp/toolAnnotations.js +0 -240
  698. package/dist/lib/mcp/toolConverter.d.ts +0 -87
  699. package/dist/lib/mcp/toolConverter.js +0 -259
  700. package/dist/lib/mcp/toolDiscoveryService.d.ts +0 -144
  701. package/dist/lib/mcp/toolDiscoveryService.js +0 -978
  702. package/dist/lib/mcp/toolIntegration.d.ts +0 -92
  703. package/dist/lib/mcp/toolIntegration.js +0 -335
  704. package/dist/lib/mcp/toolRegistry.d.ts +0 -151
  705. package/dist/lib/mcp/toolRegistry.js +0 -755
  706. package/dist/lib/memory/hippocampusInitializer.d.ts +0 -2
  707. package/dist/lib/memory/hippocampusInitializer.js +0 -50
  708. package/dist/lib/memory/memoryRetrievalTools.d.ts +0 -13
  709. package/dist/lib/memory/memoryRetrievalTools.js +0 -267
  710. package/dist/lib/middleware/builtin/analytics.d.ts +0 -16
  711. package/dist/lib/middleware/builtin/analytics.js +0 -133
  712. package/dist/lib/middleware/builtin/autoEvaluation.d.ts +0 -11
  713. package/dist/lib/middleware/builtin/autoEvaluation.js +0 -201
  714. package/dist/lib/middleware/builtin/guardrails.d.ts +0 -7
  715. package/dist/lib/middleware/builtin/guardrails.js +0 -110
  716. package/dist/lib/middleware/builtin/lifecycle.d.ts +0 -2
  717. package/dist/lib/middleware/builtin/lifecycle.js +0 -161
  718. package/dist/lib/middleware/factory.d.ts +0 -69
  719. package/dist/lib/middleware/factory.js +0 -328
  720. package/dist/lib/middleware/index.d.ts +0 -11
  721. package/dist/lib/middleware/index.js +0 -17
  722. package/dist/lib/middleware/registry.d.ts +0 -76
  723. package/dist/lib/middleware/registry.js +0 -296
  724. package/dist/lib/middleware/utils/guardrailsUtils.d.ts +0 -50
  725. package/dist/lib/middleware/utils/guardrailsUtils.js +0 -397
  726. package/dist/lib/models/anthropicModels.d.ts +0 -261
  727. package/dist/lib/models/anthropicModels.js +0 -556
  728. package/dist/lib/models/manifestRegistry.d.ts +0 -33
  729. package/dist/lib/models/manifestRegistry.js +0 -174
  730. package/dist/lib/models/manifests/anthropic.d.ts +0 -9
  731. package/dist/lib/models/manifests/anthropic.js +0 -346
  732. package/dist/lib/models/manifests/azure.d.ts +0 -2
  733. package/dist/lib/models/manifests/azure.js +0 -87
  734. package/dist/lib/models/manifests/bedrock.d.ts +0 -2
  735. package/dist/lib/models/manifests/bedrock.js +0 -75
  736. package/dist/lib/models/manifests/cloudflare.d.ts +0 -8
  737. package/dist/lib/models/manifests/cloudflare.js +0 -19
  738. package/dist/lib/models/manifests/cohere.d.ts +0 -8
  739. package/dist/lib/models/manifests/cohere.js +0 -19
  740. package/dist/lib/models/manifests/deepseek.d.ts +0 -8
  741. package/dist/lib/models/manifests/deepseek.js +0 -19
  742. package/dist/lib/models/manifests/fireworks.d.ts +0 -8
  743. package/dist/lib/models/manifests/fireworks.js +0 -19
  744. package/dist/lib/models/manifests/google-ai.d.ts +0 -2
  745. package/dist/lib/models/manifests/google-ai.js +0 -28
  746. package/dist/lib/models/manifests/groq.d.ts +0 -8
  747. package/dist/lib/models/manifests/groq.js +0 -19
  748. package/dist/lib/models/manifests/huggingface.d.ts +0 -8
  749. package/dist/lib/models/manifests/huggingface.js +0 -19
  750. package/dist/lib/models/manifests/ideogram.d.ts +0 -8
  751. package/dist/lib/models/manifests/ideogram.js +0 -19
  752. package/dist/lib/models/manifests/jina.d.ts +0 -8
  753. package/dist/lib/models/manifests/jina.js +0 -19
  754. package/dist/lib/models/manifests/litellm.d.ts +0 -8
  755. package/dist/lib/models/manifests/litellm.js +0 -19
  756. package/dist/lib/models/manifests/llamacpp.d.ts +0 -8
  757. package/dist/lib/models/manifests/llamacpp.js +0 -19
  758. package/dist/lib/models/manifests/lm-studio.d.ts +0 -8
  759. package/dist/lib/models/manifests/lm-studio.js +0 -19
  760. package/dist/lib/models/manifests/mistral.d.ts +0 -2
  761. package/dist/lib/models/manifests/mistral.js +0 -50
  762. package/dist/lib/models/manifests/nvidia-nim.d.ts +0 -8
  763. package/dist/lib/models/manifests/nvidia-nim.js +0 -19
  764. package/dist/lib/models/manifests/ollama.d.ts +0 -2
  765. package/dist/lib/models/manifests/ollama.js +0 -72
  766. package/dist/lib/models/manifests/openai-compatible.d.ts +0 -8
  767. package/dist/lib/models/manifests/openai-compatible.js +0 -19
  768. package/dist/lib/models/manifests/openai.d.ts +0 -11
  769. package/dist/lib/models/manifests/openai.js +0 -560
  770. package/dist/lib/models/manifests/openrouter.d.ts +0 -8
  771. package/dist/lib/models/manifests/openrouter.js +0 -19
  772. package/dist/lib/models/manifests/perplexity.d.ts +0 -8
  773. package/dist/lib/models/manifests/perplexity.js +0 -19
  774. package/dist/lib/models/manifests/recraft.d.ts +0 -8
  775. package/dist/lib/models/manifests/recraft.js +0 -19
  776. package/dist/lib/models/manifests/replicate.d.ts +0 -8
  777. package/dist/lib/models/manifests/replicate.js +0 -19
  778. package/dist/lib/models/manifests/sagemaker.d.ts +0 -8
  779. package/dist/lib/models/manifests/sagemaker.js +0 -19
  780. package/dist/lib/models/manifests/stability.d.ts +0 -8
  781. package/dist/lib/models/manifests/stability.js +0 -19
  782. package/dist/lib/models/manifests/together-ai.d.ts +0 -8
  783. package/dist/lib/models/manifests/together-ai.js +0 -19
  784. package/dist/lib/models/manifests/vertex.d.ts +0 -8
  785. package/dist/lib/models/manifests/vertex.js +0 -19
  786. package/dist/lib/models/manifests/voyage.d.ts +0 -8
  787. package/dist/lib/models/manifests/voyage.js +0 -19
  788. package/dist/lib/models/manifests/xai.d.ts +0 -8
  789. package/dist/lib/models/manifests/xai.js +0 -19
  790. package/dist/lib/models/modelRegistry.d.ts +0 -74
  791. package/dist/lib/models/modelRegistry.js +0 -2695
  792. package/dist/lib/models/modelResolver.d.ts +0 -74
  793. package/dist/lib/models/modelResolver.js +0 -470
  794. package/dist/lib/music/index.d.ts +0 -27
  795. package/dist/lib/music/index.js +0 -94
  796. package/dist/lib/music/providers/BeatovenMusic.d.ts +0 -31
  797. package/dist/lib/music/providers/BeatovenMusic.js +0 -334
  798. package/dist/lib/music/providers/ElevenLabsMusic.d.ts +0 -30
  799. package/dist/lib/music/providers/ElevenLabsMusic.js +0 -169
  800. package/dist/lib/music/providers/LyriaMusic.d.ts +0 -29
  801. package/dist/lib/music/providers/LyriaMusic.js +0 -173
  802. package/dist/lib/music/providers/ReplicateMusic.d.ts +0 -31
  803. package/dist/lib/music/providers/ReplicateMusic.js +0 -262
  804. package/dist/lib/neurolink.d.ts +0 -2662
  805. package/dist/lib/neurolink.js +0 -12946
  806. package/dist/lib/observability/exporterRegistry.d.ts +0 -133
  807. package/dist/lib/observability/exporterRegistry.js +0 -414
  808. package/dist/lib/observability/exporters/arizeExporter.d.ts +0 -32
  809. package/dist/lib/observability/exporters/arizeExporter.js +0 -139
  810. package/dist/lib/observability/exporters/baseExporter.d.ts +0 -117
  811. package/dist/lib/observability/exporters/baseExporter.js +0 -191
  812. package/dist/lib/observability/exporters/braintrustExporter.d.ts +0 -30
  813. package/dist/lib/observability/exporters/braintrustExporter.js +0 -155
  814. package/dist/lib/observability/exporters/datadogExporter.d.ts +0 -37
  815. package/dist/lib/observability/exporters/datadogExporter.js +0 -197
  816. package/dist/lib/observability/exporters/index.d.ts +0 -13
  817. package/dist/lib/observability/exporters/index.js +0 -14
  818. package/dist/lib/observability/exporters/laminarExporter.d.ts +0 -48
  819. package/dist/lib/observability/exporters/laminarExporter.js +0 -304
  820. package/dist/lib/observability/exporters/langfuseExporter.d.ts +0 -48
  821. package/dist/lib/observability/exporters/langfuseExporter.js +0 -210
  822. package/dist/lib/observability/exporters/langsmithExporter.d.ts +0 -26
  823. package/dist/lib/observability/exporters/langsmithExporter.js +0 -144
  824. package/dist/lib/observability/exporters/otelExporter.d.ts +0 -39
  825. package/dist/lib/observability/exporters/otelExporter.js +0 -165
  826. package/dist/lib/observability/exporters/posthogExporter.d.ts +0 -48
  827. package/dist/lib/observability/exporters/posthogExporter.js +0 -289
  828. package/dist/lib/observability/exporters/sentryExporter.d.ts +0 -32
  829. package/dist/lib/observability/exporters/sentryExporter.js +0 -167
  830. package/dist/lib/observability/index.d.ts +0 -23
  831. package/dist/lib/observability/index.js +0 -32
  832. package/dist/lib/observability/metricsAggregator.d.ts +0 -126
  833. package/dist/lib/observability/metricsAggregator.js +0 -553
  834. package/dist/lib/observability/otelBridge.d.ts +0 -49
  835. package/dist/lib/observability/otelBridge.js +0 -141
  836. package/dist/lib/observability/retryPolicy.d.ts +0 -154
  837. package/dist/lib/observability/retryPolicy.js +0 -384
  838. package/dist/lib/observability/sampling/index.d.ts +0 -4
  839. package/dist/lib/observability/sampling/index.js +0 -5
  840. package/dist/lib/observability/sampling/samplers.d.ts +0 -104
  841. package/dist/lib/observability/sampling/samplers.js +0 -217
  842. package/dist/lib/observability/spanProcessor.d.ts +0 -115
  843. package/dist/lib/observability/spanProcessor.js +0 -304
  844. package/dist/lib/observability/tokenTracker.d.ts +0 -109
  845. package/dist/lib/observability/tokenTracker.js +0 -416
  846. package/dist/lib/observability/utils/index.d.ts +0 -4
  847. package/dist/lib/observability/utils/index.js +0 -5
  848. package/dist/lib/observability/utils/safeMetadata.d.ts +0 -10
  849. package/dist/lib/observability/utils/safeMetadata.js +0 -26
  850. package/dist/lib/observability/utils/spanSerializer.d.ts +0 -119
  851. package/dist/lib/observability/utils/spanSerializer.js +0 -314
  852. package/dist/lib/processors/archive/ArchiveProcessor.d.ts +0 -323
  853. package/dist/lib/processors/archive/ArchiveProcessor.js +0 -1662
  854. package/dist/lib/processors/archive/index.d.ts +0 -33
  855. package/dist/lib/processors/archive/index.js +0 -44
  856. package/dist/lib/processors/archive/zipEntryReader.d.ts +0 -51
  857. package/dist/lib/processors/archive/zipEntryReader.js +0 -81
  858. package/dist/lib/processors/base/BaseFileProcessor.d.ts +0 -309
  859. package/dist/lib/processors/base/BaseFileProcessor.js +0 -769
  860. package/dist/lib/processors/base/index.d.ts +0 -13
  861. package/dist/lib/processors/base/index.js +0 -23
  862. package/dist/lib/processors/cli/fileProcessorCli.d.ts +0 -124
  863. package/dist/lib/processors/cli/fileProcessorCli.js +0 -392
  864. package/dist/lib/processors/cli/index.d.ts +0 -36
  865. package/dist/lib/processors/cli/index.js +0 -53
  866. package/dist/lib/processors/code/ConfigProcessor.d.ts +0 -169
  867. package/dist/lib/processors/code/ConfigProcessor.js +0 -405
  868. package/dist/lib/processors/code/SourceCodeProcessor.d.ts +0 -172
  869. package/dist/lib/processors/code/SourceCodeProcessor.js +0 -309
  870. package/dist/lib/processors/code/index.d.ts +0 -44
  871. package/dist/lib/processors/code/index.js +0 -65
  872. package/dist/lib/processors/config/fileExtensions.d.ts +0 -280
  873. package/dist/lib/processors/config/fileExtensions.js +0 -485
  874. package/dist/lib/processors/config/fileTypeRegistry.d.ts +0 -106
  875. package/dist/lib/processors/config/fileTypeRegistry.js +0 -702
  876. package/dist/lib/processors/config/index.d.ts +0 -33
  877. package/dist/lib/processors/config/index.js +0 -104
  878. package/dist/lib/processors/config/languageMap.d.ts +0 -62
  879. package/dist/lib/processors/config/languageMap.js +0 -414
  880. package/dist/lib/processors/config/mimeConstants.d.ts +0 -373
  881. package/dist/lib/processors/config/mimeConstants.js +0 -348
  882. package/dist/lib/processors/config/sizeLimits.d.ts +0 -198
  883. package/dist/lib/processors/config/sizeLimits.js +0 -262
  884. package/dist/lib/processors/data/JsonProcessor.d.ts +0 -120
  885. package/dist/lib/processors/data/JsonProcessor.js +0 -206
  886. package/dist/lib/processors/data/XmlProcessor.d.ts +0 -158
  887. package/dist/lib/processors/data/XmlProcessor.js +0 -288
  888. package/dist/lib/processors/data/YamlProcessor.d.ts +0 -161
  889. package/dist/lib/processors/data/YamlProcessor.js +0 -297
  890. package/dist/lib/processors/data/index.d.ts +0 -49
  891. package/dist/lib/processors/data/index.js +0 -83
  892. package/dist/lib/processors/document/ExcelProcessor.d.ts +0 -250
  893. package/dist/lib/processors/document/ExcelProcessor.js +0 -615
  894. package/dist/lib/processors/document/OpenDocumentProcessor.d.ts +0 -67
  895. package/dist/lib/processors/document/OpenDocumentProcessor.js +0 -236
  896. package/dist/lib/processors/document/PptxProcessor.d.ts +0 -77
  897. package/dist/lib/processors/document/PptxProcessor.js +0 -262
  898. package/dist/lib/processors/document/RtfProcessor.d.ts +0 -150
  899. package/dist/lib/processors/document/RtfProcessor.js +0 -364
  900. package/dist/lib/processors/document/WordProcessor.d.ts +0 -166
  901. package/dist/lib/processors/document/WordProcessor.js +0 -365
  902. package/dist/lib/processors/document/index.d.ts +0 -55
  903. package/dist/lib/processors/document/index.js +0 -100
  904. package/dist/lib/processors/errors/FileErrorCode.d.ts +0 -86
  905. package/dist/lib/processors/errors/FileErrorCode.js +0 -256
  906. package/dist/lib/processors/errors/errorHelpers.d.ts +0 -121
  907. package/dist/lib/processors/errors/errorHelpers.js +0 -387
  908. package/dist/lib/processors/errors/errorSerializer.d.ts +0 -96
  909. package/dist/lib/processors/errors/errorSerializer.js +0 -508
  910. package/dist/lib/processors/errors/index.d.ts +0 -46
  911. package/dist/lib/processors/errors/index.js +0 -50
  912. package/dist/lib/processors/index.d.ts +0 -79
  913. package/dist/lib/processors/index.js +0 -133
  914. package/dist/lib/processors/integration/FileProcessorIntegration.d.ts +0 -176
  915. package/dist/lib/processors/integration/FileProcessorIntegration.js +0 -279
  916. package/dist/lib/processors/integration/index.d.ts +0 -41
  917. package/dist/lib/processors/integration/index.js +0 -48
  918. package/dist/lib/processors/markup/HtmlProcessor.d.ts +0 -167
  919. package/dist/lib/processors/markup/HtmlProcessor.js +0 -252
  920. package/dist/lib/processors/markup/MarkdownProcessor.d.ts +0 -163
  921. package/dist/lib/processors/markup/MarkdownProcessor.js +0 -249
  922. package/dist/lib/processors/markup/SvgProcessor.d.ts +0 -154
  923. package/dist/lib/processors/markup/SvgProcessor.js +0 -245
  924. package/dist/lib/processors/markup/TextProcessor.d.ts +0 -133
  925. package/dist/lib/processors/markup/TextProcessor.js +0 -191
  926. package/dist/lib/processors/markup/index.d.ts +0 -66
  927. package/dist/lib/processors/markup/index.js +0 -111
  928. package/dist/lib/processors/media/AudioProcessor.d.ts +0 -266
  929. package/dist/lib/processors/media/AudioProcessor.js +0 -712
  930. package/dist/lib/processors/media/VideoProcessor.d.ts +0 -337
  931. package/dist/lib/processors/media/VideoProcessor.js +0 -1154
  932. package/dist/lib/processors/media/index.d.ts +0 -26
  933. package/dist/lib/processors/media/index.js +0 -30
  934. package/dist/lib/processors/registry/ProcessorRegistry.d.ts +0 -347
  935. package/dist/lib/processors/registry/ProcessorRegistry.js +0 -715
  936. package/dist/lib/processors/registry/index.d.ts +0 -2
  937. package/dist/lib/processors/registry/index.js +0 -10
  938. package/dist/lib/providers/amazonBedrock/client.d.ts +0 -93
  939. package/dist/lib/providers/amazonBedrock/client.js +0 -1178
  940. package/dist/lib/providers/amazonBedrock/constants.d.ts +0 -1
  941. package/dist/lib/providers/amazonBedrock/constants.js +0 -3
  942. package/dist/lib/providers/amazonBedrock/index.d.ts +0 -3
  943. package/dist/lib/providers/amazonBedrock/index.js +0 -4
  944. package/dist/lib/providers/amazonBedrock/inferenceProfile.d.ts +0 -72
  945. package/dist/lib/providers/amazonBedrock/inferenceProfile.js +0 -186
  946. package/dist/lib/providers/amazonBedrock/loopAdapter.d.ts +0 -36
  947. package/dist/lib/providers/amazonBedrock/loopAdapter.js +0 -278
  948. package/dist/lib/providers/amazonBedrock/utils.d.ts +0 -1
  949. package/dist/lib/providers/amazonBedrock/utils.js +0 -4
  950. package/dist/lib/providers/amazonSagemaker.d.ts +0 -108
  951. package/dist/lib/providers/amazonSagemaker.js +0 -292
  952. package/dist/lib/providers/anthropic/cacheControl.d.ts +0 -12
  953. package/dist/lib/providers/anthropic/cacheControl.js +0 -15
  954. package/dist/lib/providers/anthropic/client.d.ts +0 -149
  955. package/dist/lib/providers/anthropic/client.js +0 -1862
  956. package/dist/lib/providers/anthropic/constants.d.ts +0 -3
  957. package/dist/lib/providers/anthropic/constants.js +0 -7
  958. package/dist/lib/providers/anthropic/index.d.ts +0 -2
  959. package/dist/lib/providers/anthropic/index.js +0 -3
  960. package/dist/lib/providers/anthropic/loopAdapter.d.ts +0 -26
  961. package/dist/lib/providers/anthropic/loopAdapter.js +0 -326
  962. package/dist/lib/providers/anthropic/rateLimitCapture.d.ts +0 -82
  963. package/dist/lib/providers/anthropic/rateLimitCapture.js +0 -375
  964. package/dist/lib/providers/anthropic/structuredOutput.d.ts +0 -58
  965. package/dist/lib/providers/anthropic/structuredOutput.js +0 -98
  966. package/dist/lib/providers/anthropic/toolOutput.d.ts +0 -9
  967. package/dist/lib/providers/anthropic/toolOutput.js +0 -39
  968. package/dist/lib/providers/anthropicImageBlocks.d.ts +0 -47
  969. package/dist/lib/providers/anthropicImageBlocks.js +0 -223
  970. package/dist/lib/providers/azureOpenai.d.ts +0 -67
  971. package/dist/lib/providers/azureOpenai.js +0 -230
  972. package/dist/lib/providers/cohere.d.ts +0 -54
  973. package/dist/lib/providers/cohere.js +0 -183
  974. package/dist/lib/providers/configuredOpenAICompat.d.ts +0 -24
  975. package/dist/lib/providers/configuredOpenAICompat.js +0 -67
  976. package/dist/lib/providers/deepseek.d.ts +0 -47
  977. package/dist/lib/providers/deepseek.js +0 -121
  978. package/dist/lib/providers/googleAiStudio/client.d.ts +0 -92
  979. package/dist/lib/providers/googleAiStudio/client.js +0 -1658
  980. package/dist/lib/providers/googleAiStudio/index.d.ts +0 -1
  981. package/dist/lib/providers/googleAiStudio/index.js +0 -2
  982. package/dist/lib/providers/googleNativeGemini3/index.d.ts +0 -1
  983. package/dist/lib/providers/googleNativeGemini3/index.js +0 -2
  984. package/dist/lib/providers/googleNativeGemini3/utils.d.ts +0 -482
  985. package/dist/lib/providers/googleNativeGemini3/utils.js +0 -1527
  986. package/dist/lib/providers/googleVertex/client.d.ts +0 -415
  987. package/dist/lib/providers/googleVertex/client.js +0 -7015
  988. package/dist/lib/providers/googleVertex/constants.d.ts +0 -5
  989. package/dist/lib/providers/googleVertex/constants.js +0 -27
  990. package/dist/lib/providers/googleVertex/index.d.ts +0 -3
  991. package/dist/lib/providers/googleVertex/index.js +0 -4
  992. package/dist/lib/providers/googleVertex/utils.d.ts +0 -12
  993. package/dist/lib/providers/googleVertex/utils.js +0 -287
  994. package/dist/lib/providers/huggingFace/client.d.ts +0 -31
  995. package/dist/lib/providers/huggingFace/client.js +0 -103
  996. package/dist/lib/providers/huggingFace/index.d.ts +0 -1
  997. package/dist/lib/providers/huggingFace/index.js +0 -2
  998. package/dist/lib/providers/ideogram.d.ts +0 -34
  999. package/dist/lib/providers/ideogram.js +0 -184
  1000. package/dist/lib/providers/jina.d.ts +0 -58
  1001. package/dist/lib/providers/jina.js +0 -217
  1002. package/dist/lib/providers/litellm/client.d.ts +0 -84
  1003. package/dist/lib/providers/litellm/client.js +0 -504
  1004. package/dist/lib/providers/litellm/index.d.ts +0 -1
  1005. package/dist/lib/providers/litellm/index.js +0 -2
  1006. package/dist/lib/providers/llamaCpp.d.ts +0 -24
  1007. package/dist/lib/providers/llamaCpp.js +0 -80
  1008. package/dist/lib/providers/lmStudio.d.ts +0 -29
  1009. package/dist/lib/providers/lmStudio.js +0 -88
  1010. package/dist/lib/providers/nvidiaNim/client.d.ts +0 -60
  1011. package/dist/lib/providers/nvidiaNim/client.js +0 -291
  1012. package/dist/lib/providers/nvidiaNim/constants.d.ts +0 -1
  1013. package/dist/lib/providers/nvidiaNim/constants.js +0 -2
  1014. package/dist/lib/providers/nvidiaNim/index.d.ts +0 -2
  1015. package/dist/lib/providers/nvidiaNim/index.js +0 -3
  1016. package/dist/lib/providers/ollama/client.d.ts +0 -71
  1017. package/dist/lib/providers/ollama/client.js +0 -283
  1018. package/dist/lib/providers/ollama/constants.d.ts +0 -4
  1019. package/dist/lib/providers/ollama/constants.js +0 -6
  1020. package/dist/lib/providers/ollama/index.d.ts +0 -2
  1021. package/dist/lib/providers/ollama/index.js +0 -3
  1022. package/dist/lib/providers/openAI/client.d.ts +0 -76
  1023. package/dist/lib/providers/openAI/client.js +0 -503
  1024. package/dist/lib/providers/openAI/index.d.ts +0 -1
  1025. package/dist/lib/providers/openAI/index.js +0 -2
  1026. package/dist/lib/providers/openRouter/client.d.ts +0 -75
  1027. package/dist/lib/providers/openRouter/client.js +0 -402
  1028. package/dist/lib/providers/openRouter/constants.d.ts +0 -1
  1029. package/dist/lib/providers/openRouter/constants.js +0 -2
  1030. package/dist/lib/providers/openRouter/index.d.ts +0 -3
  1031. package/dist/lib/providers/openRouter/index.js +0 -4
  1032. package/dist/lib/providers/openRouter/utils.d.ts +0 -1
  1033. package/dist/lib/providers/openRouter/utils.js +0 -6
  1034. package/dist/lib/providers/openaiChatCompletionsBase.d.ts +0 -212
  1035. package/dist/lib/providers/openaiChatCompletionsBase.js +0 -1154
  1036. package/dist/lib/providers/openaiChatCompletionsClient.d.ts +0 -70
  1037. package/dist/lib/providers/openaiChatCompletionsClient.js +0 -684
  1038. package/dist/lib/providers/openaiCompatCatalog.d.ts +0 -24
  1039. package/dist/lib/providers/openaiCompatCatalog.js +0 -270
  1040. package/dist/lib/providers/openaiCompatible/client.d.ts +0 -21
  1041. package/dist/lib/providers/openaiCompatible/client.js +0 -91
  1042. package/dist/lib/providers/openaiCompatible/constants.d.ts +0 -1
  1043. package/dist/lib/providers/openaiCompatible/constants.js +0 -2
  1044. package/dist/lib/providers/openaiCompatible/index.d.ts +0 -3
  1045. package/dist/lib/providers/openaiCompatible/index.js +0 -4
  1046. package/dist/lib/providers/openaiCompatible/utils.d.ts +0 -5
  1047. package/dist/lib/providers/openaiCompatible/utils.js +0 -17
  1048. package/dist/lib/providers/providerTypeUtils.d.ts +0 -23
  1049. package/dist/lib/providers/providerTypeUtils.js +0 -41
  1050. package/dist/lib/providers/recraft.d.ts +0 -34
  1051. package/dist/lib/providers/recraft.js +0 -197
  1052. package/dist/lib/providers/replicate.d.ts +0 -74
  1053. package/dist/lib/providers/replicate.js +0 -416
  1054. package/dist/lib/providers/sagemaker/adaptive-semaphore.d.ts +0 -74
  1055. package/dist/lib/providers/sagemaker/adaptive-semaphore.js +0 -216
  1056. package/dist/lib/providers/sagemaker/client.d.ts +0 -161
  1057. package/dist/lib/providers/sagemaker/client.js +0 -509
  1058. package/dist/lib/providers/sagemaker/config.d.ts +0 -87
  1059. package/dist/lib/providers/sagemaker/config.js +0 -355
  1060. package/dist/lib/providers/sagemaker/detection.d.ts +0 -121
  1061. package/dist/lib/providers/sagemaker/detection.js +0 -607
  1062. package/dist/lib/providers/sagemaker/diagnostics.d.ts +0 -14
  1063. package/dist/lib/providers/sagemaker/diagnostics.js +0 -138
  1064. package/dist/lib/providers/sagemaker/error-constants.d.ts +0 -78
  1065. package/dist/lib/providers/sagemaker/error-constants.js +0 -228
  1066. package/dist/lib/providers/sagemaker/errors.d.ts +0 -90
  1067. package/dist/lib/providers/sagemaker/errors.js +0 -301
  1068. package/dist/lib/providers/sagemaker/index.d.ts +0 -34
  1069. package/dist/lib/providers/sagemaker/index.js +0 -69
  1070. package/dist/lib/providers/sagemaker/language-model.d.ts +0 -207
  1071. package/dist/lib/providers/sagemaker/language-model.js +0 -805
  1072. package/dist/lib/providers/sagemaker/parsers.d.ts +0 -111
  1073. package/dist/lib/providers/sagemaker/parsers.js +0 -644
  1074. package/dist/lib/providers/sagemaker/streaming.d.ts +0 -48
  1075. package/dist/lib/providers/sagemaker/streaming.js +0 -390
  1076. package/dist/lib/providers/sagemaker/structured-parser.d.ts +0 -117
  1077. package/dist/lib/providers/sagemaker/structured-parser.js +0 -626
  1078. package/dist/lib/providers/stability.d.ts +0 -37
  1079. package/dist/lib/providers/stability.js +0 -191
  1080. package/dist/lib/providers/voyage.d.ts +0 -46
  1081. package/dist/lib/providers/voyage.js +0 -176
  1082. package/dist/lib/proxy/accountCooldown.d.ts +0 -5
  1083. package/dist/lib/proxy/accountCooldown.js +0 -121
  1084. package/dist/lib/proxy/accountQuota.d.ts +0 -84
  1085. package/dist/lib/proxy/accountQuota.js +0 -459
  1086. package/dist/lib/proxy/accountQuotaRefreshCoordinator.d.ts +0 -19
  1087. package/dist/lib/proxy/accountQuotaRefreshCoordinator.js +0 -105
  1088. package/dist/lib/proxy/accountSelection.d.ts +0 -8
  1089. package/dist/lib/proxy/accountSelection.js +0 -26
  1090. package/dist/lib/proxy/accountUsage.d.ts +0 -45
  1091. package/dist/lib/proxy/accountUsage.js +0 -302
  1092. package/dist/lib/proxy/awsProxyIntegration.d.ts +0 -23
  1093. package/dist/lib/proxy/awsProxyIntegration.js +0 -286
  1094. package/dist/lib/proxy/claudeFormat.d.ts +0 -129
  1095. package/dist/lib/proxy/claudeFormat.js +0 -600
  1096. package/dist/lib/proxy/cloaking/index.d.ts +0 -43
  1097. package/dist/lib/proxy/cloaking/index.js +0 -88
  1098. package/dist/lib/proxy/cloaking/plugins/headerScrubber.d.ts +0 -9
  1099. package/dist/lib/proxy/cloaking/plugins/headerScrubber.js +0 -87
  1100. package/dist/lib/proxy/cloaking/plugins/sessionIdentity.d.ts +0 -11
  1101. package/dist/lib/proxy/cloaking/plugins/sessionIdentity.js +0 -42
  1102. package/dist/lib/proxy/cloaking/plugins/systemPromptInjector.d.ts +0 -11
  1103. package/dist/lib/proxy/cloaking/plugins/systemPromptInjector.js +0 -84
  1104. package/dist/lib/proxy/cloaking/plugins/tlsFingerprint.d.ts +0 -14
  1105. package/dist/lib/proxy/cloaking/plugins/tlsFingerprint.js +0 -39
  1106. package/dist/lib/proxy/cloaking/plugins/wordObfuscator.d.ts +0 -9
  1107. package/dist/lib/proxy/cloaking/plugins/wordObfuscator.js +0 -122
  1108. package/dist/lib/proxy/codexAccountUsage.d.ts +0 -26
  1109. package/dist/lib/proxy/codexAccountUsage.js +0 -174
  1110. package/dist/lib/proxy/globalInstaller.d.ts +0 -19
  1111. package/dist/lib/proxy/globalInstaller.js +0 -242
  1112. package/dist/lib/proxy/logCleanupScheduler.d.ts +0 -12
  1113. package/dist/lib/proxy/logCleanupScheduler.js +0 -74
  1114. package/dist/lib/proxy/logCleanupWorkerEntry.d.ts +0 -1
  1115. package/dist/lib/proxy/logCleanupWorkerEntry.js +0 -15
  1116. package/dist/lib/proxy/modelRouter.d.ts +0 -34
  1117. package/dist/lib/proxy/modelRouter.js +0 -74
  1118. package/dist/lib/proxy/oauthFetch.d.ts +0 -36
  1119. package/dist/lib/proxy/oauthFetch.js +0 -353
  1120. package/dist/lib/proxy/openaiFormat.d.ts +0 -139
  1121. package/dist/lib/proxy/openaiFormat.js +0 -817
  1122. package/dist/lib/proxy/providerTransportCoordinator.d.ts +0 -17
  1123. package/dist/lib/proxy/providerTransportCoordinator.js +0 -156
  1124. package/dist/lib/proxy/proxyActivity.d.ts +0 -8
  1125. package/dist/lib/proxy/proxyActivity.js +0 -117
  1126. package/dist/lib/proxy/proxyAnalysis.d.ts +0 -3
  1127. package/dist/lib/proxy/proxyAnalysis.js +0 -901
  1128. package/dist/lib/proxy/proxyConfig.d.ts +0 -42
  1129. package/dist/lib/proxy/proxyConfig.js +0 -700
  1130. package/dist/lib/proxy/proxyDispatcher.d.ts +0 -5
  1131. package/dist/lib/proxy/proxyDispatcher.js +0 -61
  1132. package/dist/lib/proxy/proxyEnv.d.ts +0 -3
  1133. package/dist/lib/proxy/proxyEnv.js +0 -73
  1134. package/dist/lib/proxy/proxyFetch.d.ts +0 -49
  1135. package/dist/lib/proxy/proxyFetch.js +0 -700
  1136. package/dist/lib/proxy/proxyHealth.d.ts +0 -20
  1137. package/dist/lib/proxy/proxyHealth.js +0 -76
  1138. package/dist/lib/proxy/proxyLifecycle.d.ts +0 -13
  1139. package/dist/lib/proxy/proxyLifecycle.js +0 -383
  1140. package/dist/lib/proxy/proxyPaths.d.ts +0 -17
  1141. package/dist/lib/proxy/proxyPaths.js +0 -42
  1142. package/dist/lib/proxy/proxyReplay.d.ts +0 -10
  1143. package/dist/lib/proxy/proxyReplay.js +0 -765
  1144. package/dist/lib/proxy/proxyTracer.d.ts +0 -117
  1145. package/dist/lib/proxy/proxyTracer.js +0 -726
  1146. package/dist/lib/proxy/proxyTranslationEngine.d.ts +0 -125
  1147. package/dist/lib/proxy/proxyTranslationEngine.js +0 -723
  1148. package/dist/lib/proxy/quietDetector.d.ts +0 -17
  1149. package/dist/lib/proxy/quietDetector.js +0 -125
  1150. package/dist/lib/proxy/quotaHeaders.d.ts +0 -73
  1151. package/dist/lib/proxy/quotaHeaders.js +0 -189
  1152. package/dist/lib/proxy/rawStreamCapture.d.ts +0 -2
  1153. package/dist/lib/proxy/rawStreamCapture.js +0 -129
  1154. package/dist/lib/proxy/requestLogger.d.ts +0 -78
  1155. package/dist/lib/proxy/requestLogger.js +0 -770
  1156. package/dist/lib/proxy/rollingProxyServer.d.ts +0 -3
  1157. package/dist/lib/proxy/rollingProxyServer.js +0 -220
  1158. package/dist/lib/proxy/rollingWorkerProcess.d.ts +0 -2
  1159. package/dist/lib/proxy/rollingWorkerProcess.js +0 -199
  1160. package/dist/lib/proxy/rollingWorkerProtocol.d.ts +0 -5
  1161. package/dist/lib/proxy/rollingWorkerProtocol.js +0 -46
  1162. package/dist/lib/proxy/rollingWorkerSupervisor.d.ts +0 -44
  1163. package/dist/lib/proxy/rollingWorkerSupervisor.js +0 -530
  1164. package/dist/lib/proxy/routingEvidence.d.ts +0 -17
  1165. package/dist/lib/proxy/routingEvidence.js +0 -59
  1166. package/dist/lib/proxy/routingPolicy.d.ts +0 -19
  1167. package/dist/lib/proxy/routingPolicy.js +0 -75
  1168. package/dist/lib/proxy/runtimeConfig.d.ts +0 -27
  1169. package/dist/lib/proxy/runtimeConfig.js +0 -448
  1170. package/dist/lib/proxy/snapshotPersistence.d.ts +0 -2
  1171. package/dist/lib/proxy/snapshotPersistence.js +0 -41
  1172. package/dist/lib/proxy/socketWorkerRuntime.d.ts +0 -14
  1173. package/dist/lib/proxy/socketWorkerRuntime.js +0 -322
  1174. package/dist/lib/proxy/sseInterceptor.d.ts +0 -41
  1175. package/dist/lib/proxy/sseInterceptor.js +0 -496
  1176. package/dist/lib/proxy/streamOutcome.d.ts +0 -5
  1177. package/dist/lib/proxy/streamOutcome.js +0 -104
  1178. package/dist/lib/proxy/systemRelocation.d.ts +0 -21
  1179. package/dist/lib/proxy/systemRelocation.js +0 -51
  1180. package/dist/lib/proxy/tokenRefresh.d.ts +0 -18
  1181. package/dist/lib/proxy/tokenRefresh.js +0 -257
  1182. package/dist/lib/proxy/updateChecker.d.ts +0 -17
  1183. package/dist/lib/proxy/updateChecker.js +0 -98
  1184. package/dist/lib/proxy/updateCoordinator.d.ts +0 -7
  1185. package/dist/lib/proxy/updateCoordinator.js +0 -60
  1186. package/dist/lib/proxy/updateState.d.ts +0 -69
  1187. package/dist/lib/proxy/updateState.js +0 -309
  1188. package/dist/lib/proxy/updaterSupervisor.d.ts +0 -3
  1189. package/dist/lib/proxy/updaterSupervisor.js +0 -58
  1190. package/dist/lib/proxy/usageStats.d.ts +0 -91
  1191. package/dist/lib/proxy/usageStats.js +0 -1154
  1192. package/dist/lib/proxy/utils/noProxyUtils.d.ts +0 -39
  1193. package/dist/lib/proxy/utils/noProxyUtils.js +0 -150
  1194. package/dist/lib/proxy/workerLog.d.ts +0 -6
  1195. package/dist/lib/proxy/workerLog.js +0 -42
  1196. package/dist/lib/rag/ChunkerFactory.d.ts +0 -91
  1197. package/dist/lib/rag/ChunkerFactory.js +0 -321
  1198. package/dist/lib/rag/ChunkerRegistry.d.ts +0 -91
  1199. package/dist/lib/rag/ChunkerRegistry.js +0 -422
  1200. package/dist/lib/rag/chunkers/BaseChunker.d.ts +0 -53
  1201. package/dist/lib/rag/chunkers/BaseChunker.js +0 -158
  1202. package/dist/lib/rag/chunkers/CharacterChunker.d.ts +0 -18
  1203. package/dist/lib/rag/chunkers/CharacterChunker.js +0 -29
  1204. package/dist/lib/rag/chunkers/HTMLChunker.d.ts +0 -19
  1205. package/dist/lib/rag/chunkers/HTMLChunker.js +0 -39
  1206. package/dist/lib/rag/chunkers/JSONChunker.d.ts +0 -19
  1207. package/dist/lib/rag/chunkers/JSONChunker.js +0 -69
  1208. package/dist/lib/rag/chunkers/LaTeXChunker.d.ts +0 -15
  1209. package/dist/lib/rag/chunkers/LaTeXChunker.js +0 -64
  1210. package/dist/lib/rag/chunkers/MarkdownChunker.d.ts +0 -37
  1211. package/dist/lib/rag/chunkers/MarkdownChunker.js +0 -315
  1212. package/dist/lib/rag/chunkers/RecursiveChunker.d.ts +0 -27
  1213. package/dist/lib/rag/chunkers/RecursiveChunker.js +0 -140
  1214. package/dist/lib/rag/chunkers/SemanticMarkdownChunker.d.ts +0 -22
  1215. package/dist/lib/rag/chunkers/SemanticMarkdownChunker.js +0 -139
  1216. package/dist/lib/rag/chunkers/SentenceChunker.d.ts +0 -19
  1217. package/dist/lib/rag/chunkers/SentenceChunker.js +0 -67
  1218. package/dist/lib/rag/chunkers/TokenChunker.d.ts +0 -19
  1219. package/dist/lib/rag/chunkers/TokenChunker.js +0 -62
  1220. package/dist/lib/rag/chunkers/index.d.ts +0 -15
  1221. package/dist/lib/rag/chunkers/index.js +0 -16
  1222. package/dist/lib/rag/chunking/characterChunker.d.ts +0 -16
  1223. package/dist/lib/rag/chunking/characterChunker.js +0 -143
  1224. package/dist/lib/rag/chunking/chunkerRegistry.d.ts +0 -67
  1225. package/dist/lib/rag/chunking/chunkerRegistry.js +0 -195
  1226. package/dist/lib/rag/chunking/htmlChunker.d.ts +0 -34
  1227. package/dist/lib/rag/chunking/htmlChunker.js +0 -248
  1228. package/dist/lib/rag/chunking/index.d.ts +0 -15
  1229. package/dist/lib/rag/chunking/index.js +0 -18
  1230. package/dist/lib/rag/chunking/jsonChunker.d.ts +0 -20
  1231. package/dist/lib/rag/chunking/jsonChunker.js +0 -282
  1232. package/dist/lib/rag/chunking/latexChunker.d.ts +0 -26
  1233. package/dist/lib/rag/chunking/latexChunker.js +0 -252
  1234. package/dist/lib/rag/chunking/markdownChunker.d.ts +0 -35
  1235. package/dist/lib/rag/chunking/markdownChunker.js +0 -383
  1236. package/dist/lib/rag/chunking/recursiveChunker.d.ts +0 -19
  1237. package/dist/lib/rag/chunking/recursiveChunker.js +0 -149
  1238. package/dist/lib/rag/chunking/semanticChunker.d.ts +0 -41
  1239. package/dist/lib/rag/chunking/semanticChunker.js +0 -306
  1240. package/dist/lib/rag/chunking/sentenceChunker.d.ts +0 -25
  1241. package/dist/lib/rag/chunking/sentenceChunker.js +0 -231
  1242. package/dist/lib/rag/chunking/tokenChunker.d.ts +0 -36
  1243. package/dist/lib/rag/chunking/tokenChunker.js +0 -184
  1244. package/dist/lib/rag/document/MDocument.d.ts +0 -198
  1245. package/dist/lib/rag/document/MDocument.js +0 -392
  1246. package/dist/lib/rag/document/index.d.ts +0 -5
  1247. package/dist/lib/rag/document/index.js +0 -6
  1248. package/dist/lib/rag/document/loaders.d.ts +0 -142
  1249. package/dist/lib/rag/document/loaders.js +0 -544
  1250. package/dist/lib/rag/errors/RAGError.d.ts +0 -244
  1251. package/dist/lib/rag/errors/RAGError.js +0 -275
  1252. package/dist/lib/rag/errors/index.d.ts +0 -6
  1253. package/dist/lib/rag/errors/index.js +0 -7
  1254. package/dist/lib/rag/graphRag/graphRAG.d.ts +0 -115
  1255. package/dist/lib/rag/graphRag/graphRAG.js +0 -402
  1256. package/dist/lib/rag/graphRag/index.d.ts +0 -4
  1257. package/dist/lib/rag/graphRag/index.js +0 -5
  1258. package/dist/lib/rag/index.d.ts +0 -104
  1259. package/dist/lib/rag/index.js +0 -144
  1260. package/dist/lib/rag/metadata/MetadataExtractorFactory.d.ts +0 -103
  1261. package/dist/lib/rag/metadata/MetadataExtractorFactory.js +0 -419
  1262. package/dist/lib/rag/metadata/MetadataExtractorRegistry.d.ts +0 -99
  1263. package/dist/lib/rag/metadata/MetadataExtractorRegistry.js +0 -363
  1264. package/dist/lib/rag/metadata/index.d.ts +0 -6
  1265. package/dist/lib/rag/metadata/index.js +0 -10
  1266. package/dist/lib/rag/metadata/metadataExtractor.d.ts +0 -69
  1267. package/dist/lib/rag/metadata/metadataExtractor.js +0 -281
  1268. package/dist/lib/rag/pipeline/RAGPipeline.d.ts +0 -105
  1269. package/dist/lib/rag/pipeline/RAGPipeline.js +0 -436
  1270. package/dist/lib/rag/pipeline/contextAssembly.d.ts +0 -80
  1271. package/dist/lib/rag/pipeline/contextAssembly.js +0 -342
  1272. package/dist/lib/rag/pipeline/index.d.ts +0 -5
  1273. package/dist/lib/rag/pipeline/index.js +0 -6
  1274. package/dist/lib/rag/ragIntegration.d.ts +0 -30
  1275. package/dist/lib/rag/ragIntegration.js +0 -327
  1276. package/dist/lib/rag/reranker/RerankerFactory.d.ts +0 -124
  1277. package/dist/lib/rag/reranker/RerankerFactory.js +0 -431
  1278. package/dist/lib/rag/reranker/RerankerRegistry.d.ts +0 -119
  1279. package/dist/lib/rag/reranker/RerankerRegistry.js +0 -403
  1280. package/dist/lib/rag/reranker/index.d.ts +0 -6
  1281. package/dist/lib/rag/reranker/index.js +0 -10
  1282. package/dist/lib/rag/reranker/reranker.d.ts +0 -70
  1283. package/dist/lib/rag/reranker/reranker.js +0 -307
  1284. package/dist/lib/rag/resilience/CircuitBreaker.d.ts +0 -142
  1285. package/dist/lib/rag/resilience/CircuitBreaker.js +0 -432
  1286. package/dist/lib/rag/resilience/RetryHandler.d.ts +0 -95
  1287. package/dist/lib/rag/resilience/RetryHandler.js +0 -305
  1288. package/dist/lib/rag/resilience/index.d.ts +0 -7
  1289. package/dist/lib/rag/resilience/index.js +0 -8
  1290. package/dist/lib/rag/retrieval/hybridSearch.d.ts +0 -53
  1291. package/dist/lib/rag/retrieval/hybridSearch.js +0 -339
  1292. package/dist/lib/rag/retrieval/index.d.ts +0 -5
  1293. package/dist/lib/rag/retrieval/index.js +0 -6
  1294. package/dist/lib/rag/retrieval/vectorQueryTool.d.ts +0 -72
  1295. package/dist/lib/rag/retrieval/vectorQueryTool.js +0 -325
  1296. package/dist/lib/rag/stores/chroma.d.ts +0 -90
  1297. package/dist/lib/rag/stores/chroma.js +0 -281
  1298. package/dist/lib/rag/stores/index.d.ts +0 -21
  1299. package/dist/lib/rag/stores/index.js +0 -22
  1300. package/dist/lib/rag/stores/pgvector.d.ts +0 -95
  1301. package/dist/lib/rag/stores/pgvector.js +0 -400
  1302. package/dist/lib/rag/stores/pinecone.d.ts +0 -85
  1303. package/dist/lib/rag/stores/pinecone.js +0 -159
  1304. package/dist/lib/routing/classifierRouter.d.ts +0 -52
  1305. package/dist/lib/routing/classifierRouter.js +0 -269
  1306. package/dist/lib/routing/classifierStrategies.d.ts +0 -23
  1307. package/dist/lib/routing/classifierStrategies.js +0 -156
  1308. package/dist/lib/routing/index.d.ts +0 -9
  1309. package/dist/lib/routing/index.js +0 -10
  1310. package/dist/lib/routing/modelPool.d.ts +0 -83
  1311. package/dist/lib/routing/modelPool.js +0 -243
  1312. package/dist/lib/routing/requestRouter.d.ts +0 -30
  1313. package/dist/lib/routing/requestRouter.js +0 -81
  1314. package/dist/lib/sdk/toolRegistration.d.ts +0 -74
  1315. package/dist/lib/sdk/toolRegistration.js +0 -383
  1316. package/dist/lib/server/abstract/baseServerAdapter.d.ts +0 -171
  1317. package/dist/lib/server/abstract/baseServerAdapter.js +0 -575
  1318. package/dist/lib/server/adapters/expressAdapter.d.ts +0 -70
  1319. package/dist/lib/server/adapters/expressAdapter.js +0 -487
  1320. package/dist/lib/server/adapters/fastifyAdapter.d.ts +0 -70
  1321. package/dist/lib/server/adapters/fastifyAdapter.js +0 -473
  1322. package/dist/lib/server/adapters/honoAdapter.d.ts +0 -77
  1323. package/dist/lib/server/adapters/honoAdapter.js +0 -633
  1324. package/dist/lib/server/adapters/index.d.ts +0 -7
  1325. package/dist/lib/server/adapters/index.js +0 -8
  1326. package/dist/lib/server/adapters/koaAdapter.d.ts +0 -79
  1327. package/dist/lib/server/adapters/koaAdapter.js +0 -511
  1328. package/dist/lib/server/errors.d.ts +0 -193
  1329. package/dist/lib/server/errors.js +0 -487
  1330. package/dist/lib/server/factory/serverAdapterFactory.d.ts +0 -73
  1331. package/dist/lib/server/factory/serverAdapterFactory.js +0 -161
  1332. package/dist/lib/server/index.d.ts +0 -46
  1333. package/dist/lib/server/index.js +0 -122
  1334. package/dist/lib/server/middleware/abortSignal.d.ts +0 -52
  1335. package/dist/lib/server/middleware/abortSignal.js +0 -112
  1336. package/dist/lib/server/middleware/auth.d.ts +0 -166
  1337. package/dist/lib/server/middleware/auth.js +0 -404
  1338. package/dist/lib/server/middleware/cache.d.ts +0 -161
  1339. package/dist/lib/server/middleware/cache.js +0 -370
  1340. package/dist/lib/server/middleware/common.d.ts +0 -108
  1341. package/dist/lib/server/middleware/common.js +0 -297
  1342. package/dist/lib/server/middleware/deprecation.d.ts +0 -40
  1343. package/dist/lib/server/middleware/deprecation.js +0 -191
  1344. package/dist/lib/server/middleware/index.d.ts +0 -12
  1345. package/dist/lib/server/middleware/index.js +0 -13
  1346. package/dist/lib/server/middleware/mcpBodyAttachment.d.ts +0 -42
  1347. package/dist/lib/server/middleware/mcpBodyAttachment.js +0 -64
  1348. package/dist/lib/server/middleware/rateLimit.d.ts +0 -70
  1349. package/dist/lib/server/middleware/rateLimit.js +0 -224
  1350. package/dist/lib/server/middleware/validation.d.ts +0 -69
  1351. package/dist/lib/server/middleware/validation.js +0 -393
  1352. package/dist/lib/server/openapi/generator.d.ts +0 -61
  1353. package/dist/lib/server/openapi/generator.js +0 -399
  1354. package/dist/lib/server/openapi/index.d.ts +0 -7
  1355. package/dist/lib/server/openapi/index.js +0 -37
  1356. package/dist/lib/server/openapi/schemas.d.ts +0 -94
  1357. package/dist/lib/server/openapi/schemas.js +0 -696
  1358. package/dist/lib/server/openapi/templates.d.ts +0 -108
  1359. package/dist/lib/server/openapi/templates.js +0 -375
  1360. package/dist/lib/server/routes/agentRoutes.d.ts +0 -9
  1361. package/dist/lib/server/routes/agentRoutes.js +0 -423
  1362. package/dist/lib/server/routes/claudeProxyRoutes.d.ts +0 -491
  1363. package/dist/lib/server/routes/claudeProxyRoutes.js +0 -6455
  1364. package/dist/lib/server/routes/codexProxyRoutes.d.ts +0 -64
  1365. package/dist/lib/server/routes/codexProxyRoutes.js +0 -454
  1366. package/dist/lib/server/routes/healthRoutes.d.ts +0 -9
  1367. package/dist/lib/server/routes/healthRoutes.js +0 -234
  1368. package/dist/lib/server/routes/index.d.ts +0 -25
  1369. package/dist/lib/server/routes/index.js +0 -66
  1370. package/dist/lib/server/routes/mcpRoutes.d.ts +0 -9
  1371. package/dist/lib/server/routes/mcpRoutes.js +0 -376
  1372. package/dist/lib/server/routes/memoryRoutes.d.ts +0 -11
  1373. package/dist/lib/server/routes/memoryRoutes.js +0 -366
  1374. package/dist/lib/server/routes/openApiRoutes.d.ts +0 -34
  1375. package/dist/lib/server/routes/openApiRoutes.js +0 -151
  1376. package/dist/lib/server/routes/openaiProxyRoutes.d.ts +0 -38
  1377. package/dist/lib/server/routes/openaiProxyRoutes.js +0 -399
  1378. package/dist/lib/server/routes/toolRoutes.d.ts +0 -9
  1379. package/dist/lib/server/routes/toolRoutes.js +0 -272
  1380. package/dist/lib/server/streaming/dataStream.d.ts +0 -212
  1381. package/dist/lib/server/streaming/dataStream.js +0 -502
  1382. package/dist/lib/server/streaming/index.d.ts +0 -5
  1383. package/dist/lib/server/streaming/index.js +0 -17
  1384. package/dist/lib/server/utils/redaction.d.ts +0 -68
  1385. package/dist/lib/server/utils/redaction.js +0 -321
  1386. package/dist/lib/server/utils/validation.d.ts +0 -153
  1387. package/dist/lib/server/utils/validation.js +0 -265
  1388. package/dist/lib/server/voice/frameBus.d.ts +0 -8
  1389. package/dist/lib/server/voice/frameBus.js +0 -25
  1390. package/dist/lib/server/voice/tokenCompare.d.ts +0 -14
  1391. package/dist/lib/server/voice/tokenCompare.js +0 -23
  1392. package/dist/lib/server/voice/turnManager.d.ts +0 -15
  1393. package/dist/lib/server/voice/turnManager.js +0 -36
  1394. package/dist/lib/server/voice/voiceServerApp.d.ts +0 -1
  1395. package/dist/lib/server/voice/voiceServerApp.js +0 -177
  1396. package/dist/lib/server/voice/voiceWebSocketHandler.d.ts +0 -24
  1397. package/dist/lib/server/voice/voiceWebSocketHandler.js +0 -669
  1398. package/dist/lib/server/websocket/WebSocketHandler.d.ts +0 -107
  1399. package/dist/lib/server/websocket/WebSocketHandler.js +0 -384
  1400. package/dist/lib/server/websocket/index.d.ts +0 -4
  1401. package/dist/lib/server/websocket/index.js +0 -5
  1402. package/dist/lib/services/server/ai/observability/instrumentation.d.ts +0 -229
  1403. package/dist/lib/services/server/ai/observability/instrumentation.js +0 -1244
  1404. package/dist/lib/session/globalSessionState.d.ts +0 -71
  1405. package/dist/lib/session/globalSessionState.js +0 -235
  1406. package/dist/lib/skills/skillMatcher.d.ts +0 -55
  1407. package/dist/lib/skills/skillMatcher.js +0 -170
  1408. package/dist/lib/skills/skillSessionTracker.d.ts +0 -52
  1409. package/dist/lib/skills/skillSessionTracker.js +0 -150
  1410. package/dist/lib/skills/skillStoreRedis.d.ts +0 -30
  1411. package/dist/lib/skills/skillStoreRedis.js +0 -114
  1412. package/dist/lib/skills/skillStoreS3.d.ts +0 -56
  1413. package/dist/lib/skills/skillStoreS3.js +0 -305
  1414. package/dist/lib/skills/skillStores.d.ts +0 -58
  1415. package/dist/lib/skills/skillStores.js +0 -341
  1416. package/dist/lib/skills/skillTools.d.ts +0 -35
  1417. package/dist/lib/skills/skillTools.js +0 -451
  1418. package/dist/lib/skills/skillsManager.d.ts +0 -78
  1419. package/dist/lib/skills/skillsManager.js +0 -281
  1420. package/dist/lib/tasks/autoresearchTaskExecutor.d.ts +0 -31
  1421. package/dist/lib/tasks/autoresearchTaskExecutor.js +0 -304
  1422. package/dist/lib/tasks/backends/bullmqBackend.d.ts +0 -33
  1423. package/dist/lib/tasks/backends/bullmqBackend.js +0 -206
  1424. package/dist/lib/tasks/backends/nodeTimeoutBackend.d.ts +0 -27
  1425. package/dist/lib/tasks/backends/nodeTimeoutBackend.js +0 -141
  1426. package/dist/lib/tasks/backends/taskBackendRegistry.d.ts +0 -31
  1427. package/dist/lib/tasks/backends/taskBackendRegistry.js +0 -66
  1428. package/dist/lib/tasks/errors.d.ts +0 -33
  1429. package/dist/lib/tasks/errors.js +0 -19
  1430. package/dist/lib/tasks/store/fileTaskStore.d.ts +0 -43
  1431. package/dist/lib/tasks/store/fileTaskStore.js +0 -179
  1432. package/dist/lib/tasks/store/redisTaskStore.d.ts +0 -43
  1433. package/dist/lib/tasks/store/redisTaskStore.js +0 -222
  1434. package/dist/lib/tasks/taskExecutor.d.ts +0 -22
  1435. package/dist/lib/tasks/taskExecutor.js +0 -170
  1436. package/dist/lib/tasks/taskManager.d.ts +0 -65
  1437. package/dist/lib/tasks/taskManager.js +0 -545
  1438. package/dist/lib/tasks/tools/taskTools.d.ts +0 -20
  1439. package/dist/lib/tasks/tools/taskTools.js +0 -265
  1440. package/dist/lib/telemetry/attributes.d.ts +0 -136
  1441. package/dist/lib/telemetry/attributes.js +0 -165
  1442. package/dist/lib/telemetry/index.d.ts +0 -20
  1443. package/dist/lib/telemetry/index.js +0 -28
  1444. package/dist/lib/telemetry/telemetryService.d.ts +0 -58
  1445. package/dist/lib/telemetry/telemetryService.js +0 -387
  1446. package/dist/lib/telemetry/traceContext.d.ts +0 -9
  1447. package/dist/lib/telemetry/traceContext.js +0 -19
  1448. package/dist/lib/telemetry/tracers.d.ts +0 -38
  1449. package/dist/lib/telemetry/tracers.js +0 -40
  1450. package/dist/lib/telemetry/withSpan.d.ts +0 -39
  1451. package/dist/lib/telemetry/withSpan.js +0 -138
  1452. package/dist/lib/tools/toolDiscovery.d.ts +0 -70
  1453. package/dist/lib/tools/toolDiscovery.js +0 -303
  1454. package/dist/lib/tools/toolGate.d.ts +0 -16
  1455. package/dist/lib/tools/toolGate.js +0 -51
  1456. package/dist/lib/tools/toolPolicy.d.ts +0 -40
  1457. package/dist/lib/tools/toolPolicy.js +0 -194
  1458. package/dist/lib/types/action.d.ts +0 -207
  1459. package/dist/lib/types/action.js +0 -7
  1460. package/dist/lib/types/agentNetwork.d.ts +0 -1199
  1461. package/dist/lib/types/agentNetwork.js +0 -8
  1462. package/dist/lib/types/aliases.d.ts +0 -368
  1463. package/dist/lib/types/aliases.js +0 -50
  1464. package/dist/lib/types/analytics.d.ts +0 -215
  1465. package/dist/lib/types/analytics.js +0 -6
  1466. package/dist/lib/types/artifact.d.ts +0 -70
  1467. package/dist/lib/types/artifact.js +0 -11
  1468. package/dist/lib/types/auth.d.ts +0 -1140
  1469. package/dist/lib/types/auth.js +0 -10
  1470. package/dist/lib/types/autoresearch.d.ts +0 -206
  1471. package/dist/lib/types/autoresearch.js +0 -18
  1472. package/dist/lib/types/avatar.d.ts +0 -150
  1473. package/dist/lib/types/avatar.js +0 -20
  1474. package/dist/lib/types/circuitBreakerErrors.d.ts +0 -30
  1475. package/dist/lib/types/circuitBreakerErrors.js +0 -35
  1476. package/dist/lib/types/classifierRouter.d.ts +0 -194
  1477. package/dist/lib/types/classifierRouter.js +0 -17
  1478. package/dist/lib/types/cli.d.ts +0 -1734
  1479. package/dist/lib/types/cli.js +0 -22
  1480. package/dist/lib/types/client.d.ts +0 -1287
  1481. package/dist/lib/types/client.js +0 -11
  1482. package/dist/lib/types/codex.d.ts +0 -95
  1483. package/dist/lib/types/codex.js +0 -15
  1484. package/dist/lib/types/common.d.ts +0 -434
  1485. package/dist/lib/types/common.js +0 -52
  1486. package/dist/lib/types/config.d.ts +0 -506
  1487. package/dist/lib/types/config.js +0 -54
  1488. package/dist/lib/types/content.d.ts +0 -18
  1489. package/dist/lib/types/content.js +0 -20
  1490. package/dist/lib/types/context.d.ts +0 -587
  1491. package/dist/lib/types/context.js +0 -401
  1492. package/dist/lib/types/conversation.d.ts +0 -637
  1493. package/dist/lib/types/conversation.js +0 -48
  1494. package/dist/lib/types/conversationMemoryInterface.d.ts +0 -59
  1495. package/dist/lib/types/conversationMemoryInterface.js +0 -7
  1496. package/dist/lib/types/domain.d.ts +0 -62
  1497. package/dist/lib/types/domain.js +0 -6
  1498. package/dist/lib/types/dynamic.d.ts +0 -110
  1499. package/dist/lib/types/dynamic.js +0 -10
  1500. package/dist/lib/types/elicitation.d.ts +0 -278
  1501. package/dist/lib/types/elicitation.js +0 -11
  1502. package/dist/lib/types/enums.d.ts +0 -9
  1503. package/dist/lib/types/enums.js +0 -10
  1504. package/dist/lib/types/errors.d.ts +0 -188
  1505. package/dist/lib/types/errors.js +0 -262
  1506. package/dist/lib/types/evaluation.d.ts +0 -647
  1507. package/dist/lib/types/evaluation.js +0 -2
  1508. package/dist/lib/types/evaluationProviders.d.ts +0 -104
  1509. package/dist/lib/types/evaluationProviders.js +0 -6
  1510. package/dist/lib/types/exporter.d.ts +0 -257
  1511. package/dist/lib/types/exporter.js +0 -6
  1512. package/dist/lib/types/externalMcp.d.ts +0 -349
  1513. package/dist/lib/types/externalMcp.js +0 -7
  1514. package/dist/lib/types/file.d.ts +0 -616
  1515. package/dist/lib/types/file.js +0 -5
  1516. package/dist/lib/types/fileReference.d.ts +0 -243
  1517. package/dist/lib/types/fileReference.js +0 -22
  1518. package/dist/lib/types/generate.d.ts +0 -1520
  1519. package/dist/lib/types/generate.js +0 -2
  1520. package/dist/lib/types/grounding.d.ts +0 -231
  1521. package/dist/lib/types/grounding.js +0 -12
  1522. package/dist/lib/types/guardrails.d.ts +0 -116
  1523. package/dist/lib/types/guardrails.js +0 -2
  1524. package/dist/lib/types/hitl.d.ts +0 -237
  1525. package/dist/lib/types/hitl.js +0 -9
  1526. package/dist/lib/types/imageGen.d.ts +0 -255
  1527. package/dist/lib/types/imageGen.js +0 -25
  1528. package/dist/lib/types/index.d.ts +0 -86
  1529. package/dist/lib/types/index.js +0 -98
  1530. package/dist/lib/types/ioProcessor.d.ts +0 -119
  1531. package/dist/lib/types/ioProcessor.js +0 -10
  1532. package/dist/lib/types/isolatedAgent.d.ts +0 -365
  1533. package/dist/lib/types/isolatedAgent.js +0 -12
  1534. package/dist/lib/types/knowledge.d.ts +0 -342
  1535. package/dist/lib/types/knowledge.js +0 -30
  1536. package/dist/lib/types/livekit.d.ts +0 -512
  1537. package/dist/lib/types/livekit.js +0 -13
  1538. package/dist/lib/types/loopEngine.d.ts +0 -306
  1539. package/dist/lib/types/loopEngine.js +0 -2
  1540. package/dist/lib/types/mcp.d.ts +0 -2135
  1541. package/dist/lib/types/mcp.js +0 -6
  1542. package/dist/lib/types/mcpOutput.d.ts +0 -40
  1543. package/dist/lib/types/mcpOutput.js +0 -9
  1544. package/dist/lib/types/memory.d.ts +0 -96
  1545. package/dist/lib/types/memory.js +0 -23
  1546. package/dist/lib/types/middleware.d.ts +0 -435
  1547. package/dist/lib/types/middleware.js +0 -2
  1548. package/dist/lib/types/model.d.ts +0 -342
  1549. package/dist/lib/types/model.js +0 -32
  1550. package/dist/lib/types/modelPool.d.ts +0 -47
  1551. package/dist/lib/types/modelPool.js +0 -11
  1552. package/dist/lib/types/multimodal.d.ts +0 -614
  1553. package/dist/lib/types/multimodal.js +0 -144
  1554. package/dist/lib/types/music.d.ts +0 -172
  1555. package/dist/lib/types/music.js +0 -21
  1556. package/dist/lib/types/nativeTools.d.ts +0 -16
  1557. package/dist/lib/types/nativeTools.js +0 -2
  1558. package/dist/lib/types/noOutputSentinel.d.ts +0 -26
  1559. package/dist/lib/types/noOutputSentinel.js +0 -2
  1560. package/dist/lib/types/observability.d.ts +0 -502
  1561. package/dist/lib/types/observability.js +0 -7
  1562. package/dist/lib/types/openaiCompatible.d.ts +0 -287
  1563. package/dist/lib/types/openaiCompatible.js +0 -2
  1564. package/dist/lib/types/ppt.d.ts +0 -1093
  1565. package/dist/lib/types/ppt.js +0 -37
  1566. package/dist/lib/types/processor.d.ts +0 -993
  1567. package/dist/lib/types/processor.js +0 -91
  1568. package/dist/lib/types/providers.d.ts +0 -2155
  1569. package/dist/lib/types/providers.js +0 -112
  1570. package/dist/lib/types/proxy.d.ts +0 -2724
  1571. package/dist/lib/types/proxy.js +0 -17
  1572. package/dist/lib/types/proxyClient.d.ts +0 -54
  1573. package/dist/lib/types/proxyClient.js +0 -2
  1574. package/dist/lib/types/rag.d.ts +0 -1332
  1575. package/dist/lib/types/rag.js +0 -2
  1576. package/dist/lib/types/realtime.d.ts +0 -243
  1577. package/dist/lib/types/realtime.js +0 -70
  1578. package/dist/lib/types/replicate.d.ts +0 -67
  1579. package/dist/lib/types/replicate.js +0 -10
  1580. package/dist/lib/types/requestRouter.d.ts +0 -75
  1581. package/dist/lib/types/requestRouter.js +0 -16
  1582. package/dist/lib/types/safeFetch.d.ts +0 -24
  1583. package/dist/lib/types/safeFetch.js +0 -7
  1584. package/dist/lib/types/scorer.d.ts +0 -564
  1585. package/dist/lib/types/scorer.js +0 -6
  1586. package/dist/lib/types/sdk.d.ts +0 -23
  1587. package/dist/lib/types/sdk.js +0 -9
  1588. package/dist/lib/types/server.d.ts +0 -1192
  1589. package/dist/lib/types/server.js +0 -68
  1590. package/dist/lib/types/service.d.ts +0 -79
  1591. package/dist/lib/types/service.js +0 -6
  1592. package/dist/lib/types/skills.d.ts +0 -427
  1593. package/dist/lib/types/skills.js +0 -17
  1594. package/dist/lib/types/span.d.ts +0 -247
  1595. package/dist/lib/types/span.js +0 -96
  1596. package/dist/lib/types/stream.d.ts +0 -771
  1597. package/dist/lib/types/stream.js +0 -2
  1598. package/dist/lib/types/streamDedup.d.ts +0 -14
  1599. package/dist/lib/types/streamDedup.js +0 -2
  1600. package/dist/lib/types/streaming.d.ts +0 -15
  1601. package/dist/lib/types/streaming.js +0 -2
  1602. package/dist/lib/types/stt.d.ts +0 -585
  1603. package/dist/lib/types/stt.js +0 -90
  1604. package/dist/lib/types/subscription.d.ts +0 -1064
  1605. package/dist/lib/types/subscription.js +0 -10
  1606. package/dist/lib/types/task.d.ts +0 -313
  1607. package/dist/lib/types/task.js +0 -37
  1608. package/dist/lib/types/taskClassification.d.ts +0 -52
  1609. package/dist/lib/types/taskClassification.js +0 -6
  1610. package/dist/lib/types/toolDedup.d.ts +0 -45
  1611. package/dist/lib/types/toolDedup.js +0 -14
  1612. package/dist/lib/types/toolResolution.d.ts +0 -83
  1613. package/dist/lib/types/toolResolution.js +0 -11
  1614. package/dist/lib/types/toolRouting.d.ts +0 -350
  1615. package/dist/lib/types/toolRouting.js +0 -19
  1616. package/dist/lib/types/tools.d.ts +0 -531
  1617. package/dist/lib/types/tools.js +0 -26
  1618. package/dist/lib/types/tts.d.ts +0 -195
  1619. package/dist/lib/types/tts.js +0 -65
  1620. package/dist/lib/types/utilities.d.ts +0 -310
  1621. package/dist/lib/types/utilities.js +0 -5
  1622. package/dist/lib/types/vectorStoreChroma.d.ts +0 -67
  1623. package/dist/lib/types/vectorStoreChroma.js +0 -12
  1624. package/dist/lib/types/vectorStorePinecone.d.ts +0 -48
  1625. package/dist/lib/types/vectorStorePinecone.js +0 -12
  1626. package/dist/lib/types/video.d.ts +0 -89
  1627. package/dist/lib/types/video.js +0 -15
  1628. package/dist/lib/types/voice.d.ts +0 -272
  1629. package/dist/lib/types/voice.js +0 -137
  1630. package/dist/lib/types/workflow.d.ts +0 -598
  1631. package/dist/lib/types/workflow.js +0 -24
  1632. package/dist/lib/utils/analyticsUtils.d.ts +0 -37
  1633. package/dist/lib/utils/analyticsUtils.js +0 -110
  1634. package/dist/lib/utils/anthropicCacheBreakpoints.d.ts +0 -43
  1635. package/dist/lib/utils/anthropicCacheBreakpoints.js +0 -151
  1636. package/dist/lib/utils/anthropicTraceSanitizer.d.ts +0 -7
  1637. package/dist/lib/utils/anthropicTraceSanitizer.js +0 -26
  1638. package/dist/lib/utils/async/delay.d.ts +0 -40
  1639. package/dist/lib/utils/async/delay.js +0 -43
  1640. package/dist/lib/utils/async/index.d.ts +0 -23
  1641. package/dist/lib/utils/async/index.js +0 -24
  1642. package/dist/lib/utils/async/retry.d.ts +0 -107
  1643. package/dist/lib/utils/async/retry.js +0 -172
  1644. package/dist/lib/utils/async/withTimeout.d.ts +0 -85
  1645. package/dist/lib/utils/async/withTimeout.js +0 -144
  1646. package/dist/lib/utils/asyncMutex.d.ts +0 -14
  1647. package/dist/lib/utils/asyncMutex.js +0 -61
  1648. package/dist/lib/utils/audioFormatDetector.d.ts +0 -15
  1649. package/dist/lib/utils/audioFormatDetector.js +0 -34
  1650. package/dist/lib/utils/avatarProcessor.d.ts +0 -78
  1651. package/dist/lib/utils/avatarProcessor.js +0 -173
  1652. package/dist/lib/utils/cloneOptions.d.ts +0 -36
  1653. package/dist/lib/utils/cloneOptions.js +0 -62
  1654. package/dist/lib/utils/conversationMemory.d.ts +0 -80
  1655. package/dist/lib/utils/conversationMemory.js +0 -670
  1656. package/dist/lib/utils/csvProcessor.d.ts +0 -221
  1657. package/dist/lib/utils/csvProcessor.js +0 -1527
  1658. package/dist/lib/utils/csvUtils.d.ts +0 -26
  1659. package/dist/lib/utils/csvUtils.js +0 -85
  1660. package/dist/lib/utils/errorClassifier.d.ts +0 -30
  1661. package/dist/lib/utils/errorClassifier.js +0 -183
  1662. package/dist/lib/utils/errorHandling.d.ts +0 -398
  1663. package/dist/lib/utils/errorHandling.js +0 -1282
  1664. package/dist/lib/utils/evaluationUtils.d.ts +0 -27
  1665. package/dist/lib/utils/evaluationUtils.js +0 -132
  1666. package/dist/lib/utils/factoryProcessing.d.ts +0 -71
  1667. package/dist/lib/utils/factoryProcessing.js +0 -590
  1668. package/dist/lib/utils/fileDetector.d.ts +0 -198
  1669. package/dist/lib/utils/fileDetector.js +0 -2806
  1670. package/dist/lib/utils/generation.d.ts +0 -8
  1671. package/dist/lib/utils/generation.js +0 -9
  1672. package/dist/lib/utils/generationErrors.d.ts +0 -10
  1673. package/dist/lib/utils/generationErrors.js +0 -11
  1674. package/dist/lib/utils/imageCache.d.ts +0 -124
  1675. package/dist/lib/utils/imageCache.js +0 -437
  1676. package/dist/lib/utils/imageDetection.d.ts +0 -15
  1677. package/dist/lib/utils/imageDetection.js +0 -53
  1678. package/dist/lib/utils/imageProcessor.d.ts +0 -296
  1679. package/dist/lib/utils/imageProcessor.js +0 -1158
  1680. package/dist/lib/utils/isoBmff.d.ts +0 -24
  1681. package/dist/lib/utils/isoBmff.js +0 -83
  1682. package/dist/lib/utils/json/coerce.d.ts +0 -30
  1683. package/dist/lib/utils/json/coerce.js +0 -412
  1684. package/dist/lib/utils/json/extract.d.ts +0 -112
  1685. package/dist/lib/utils/json/extract.js +0 -299
  1686. package/dist/lib/utils/json/index.d.ts +0 -36
  1687. package/dist/lib/utils/json/index.js +0 -37
  1688. package/dist/lib/utils/json/safeParse.d.ts +0 -130
  1689. package/dist/lib/utils/json/safeParse.js +0 -191
  1690. package/dist/lib/utils/lifecycleCallbacks.d.ts +0 -56
  1691. package/dist/lib/utils/lifecycleCallbacks.js +0 -100
  1692. package/dist/lib/utils/lifecycleTimeout.d.ts +0 -25
  1693. package/dist/lib/utils/lifecycleTimeout.js +0 -39
  1694. package/dist/lib/utils/logSanitize.d.ts +0 -285
  1695. package/dist/lib/utils/logSanitize.js +0 -555
  1696. package/dist/lib/utils/logger.d.ts +0 -273
  1697. package/dist/lib/utils/logger.js +0 -516
  1698. package/dist/lib/utils/loggingFetch.d.ts +0 -29
  1699. package/dist/lib/utils/loggingFetch.js +0 -60
  1700. package/dist/lib/utils/loopUtils.d.ts +0 -70
  1701. package/dist/lib/utils/loopUtils.js +0 -263
  1702. package/dist/lib/utils/markupSniff.d.ts +0 -37
  1703. package/dist/lib/utils/markupSniff.js +0 -125
  1704. package/dist/lib/utils/mcpDefaults.d.ts +0 -54
  1705. package/dist/lib/utils/mcpDefaults.js +0 -135
  1706. package/dist/lib/utils/mcpErrorText.d.ts +0 -37
  1707. package/dist/lib/utils/mcpErrorText.js +0 -95
  1708. package/dist/lib/utils/mediaDuration.d.ts +0 -23
  1709. package/dist/lib/utils/mediaDuration.js +0 -45
  1710. package/dist/lib/utils/messageBuilder.d.ts +0 -59
  1711. package/dist/lib/utils/messageBuilder.js +0 -2716
  1712. package/dist/lib/utils/mimeTypeHints.d.ts +0 -40
  1713. package/dist/lib/utils/mimeTypeHints.js +0 -122
  1714. package/dist/lib/utils/modelAliasResolver.d.ts +0 -17
  1715. package/dist/lib/utils/modelAliasResolver.js +0 -55
  1716. package/dist/lib/utils/modelChoices.d.ts +0 -75
  1717. package/dist/lib/utils/modelChoices.js +0 -698
  1718. package/dist/lib/utils/modelDetection.d.ts +0 -37
  1719. package/dist/lib/utils/modelDetection.js +0 -131
  1720. package/dist/lib/utils/modelRouter.d.ts +0 -91
  1721. package/dist/lib/utils/modelRouter.js +0 -293
  1722. package/dist/lib/utils/multimodalOptionsBuilder.d.ts +0 -74
  1723. package/dist/lib/utils/multimodalOptionsBuilder.js +0 -74
  1724. package/dist/lib/utils/musicProcessor.d.ts +0 -77
  1725. package/dist/lib/utils/musicProcessor.js +0 -190
  1726. package/dist/lib/utils/noOutputSentinel.d.ts +0 -67
  1727. package/dist/lib/utils/noOutputSentinel.js +0 -180
  1728. package/dist/lib/utils/observabilityHelpers.d.ts +0 -27
  1729. package/dist/lib/utils/observabilityHelpers.js +0 -48
  1730. package/dist/lib/utils/optionsConversion.d.ts +0 -47
  1731. package/dist/lib/utils/optionsConversion.js +0 -128
  1732. package/dist/lib/utils/optionsUtils.d.ts +0 -175
  1733. package/dist/lib/utils/optionsUtils.js +0 -970
  1734. package/dist/lib/utils/parameterValidation.d.ts +0 -200
  1735. package/dist/lib/utils/parameterValidation.js +0 -981
  1736. package/dist/lib/utils/pdfProcessor.d.ts +0 -137
  1737. package/dist/lib/utils/pdfProcessor.js +0 -689
  1738. package/dist/lib/utils/performance.d.ts +0 -93
  1739. package/dist/lib/utils/performance.js +0 -223
  1740. package/dist/lib/utils/piiDetector.d.ts +0 -24
  1741. package/dist/lib/utils/piiDetector.js +0 -221
  1742. package/dist/lib/utils/pricing.d.ts +0 -17
  1743. package/dist/lib/utils/pricing.js +0 -755
  1744. package/dist/lib/utils/promptRedaction.d.ts +0 -22
  1745. package/dist/lib/utils/promptRedaction.js +0 -63
  1746. package/dist/lib/utils/providerConfig.d.ts +0 -393
  1747. package/dist/lib/utils/providerConfig.js +0 -1363
  1748. package/dist/lib/utils/providerErrorClassification.d.ts +0 -58
  1749. package/dist/lib/utils/providerErrorClassification.js +0 -149
  1750. package/dist/lib/utils/providerHealth.d.ts +0 -253
  1751. package/dist/lib/utils/providerHealth.js +0 -1479
  1752. package/dist/lib/utils/providerRetry.d.ts +0 -68
  1753. package/dist/lib/utils/providerRetry.js +0 -230
  1754. package/dist/lib/utils/providerSetupMessages.d.ts +0 -8
  1755. package/dist/lib/utils/providerSetupMessages.js +0 -122
  1756. package/dist/lib/utils/providerUtils.d.ts +0 -38
  1757. package/dist/lib/utils/providerUtils.js +0 -366
  1758. package/dist/lib/utils/rateLimiter.d.ts +0 -75
  1759. package/dist/lib/utils/rateLimiter.js +0 -201
  1760. package/dist/lib/utils/redis.d.ts +0 -119
  1761. package/dist/lib/utils/redis.js +0 -530
  1762. package/dist/lib/utils/responseValidator.d.ts +0 -21
  1763. package/dist/lib/utils/responseValidator.js +0 -354
  1764. package/dist/lib/utils/retryAfter.d.ts +0 -7
  1765. package/dist/lib/utils/retryAfter.js +0 -44
  1766. package/dist/lib/utils/retryHandler.d.ts +0 -82
  1767. package/dist/lib/utils/retryHandler.js +0 -270
  1768. package/dist/lib/utils/retryability.d.ts +0 -27
  1769. package/dist/lib/utils/retryability.js +0 -45
  1770. package/dist/lib/utils/safeFetch.d.ts +0 -26
  1771. package/dist/lib/utils/safeFetch.js +0 -121
  1772. package/dist/lib/utils/sanitizers/filename.d.ts +0 -116
  1773. package/dist/lib/utils/sanitizers/filename.js +0 -366
  1774. package/dist/lib/utils/sanitizers/html.d.ts +0 -170
  1775. package/dist/lib/utils/sanitizers/html.js +0 -326
  1776. package/dist/lib/utils/sanitizers/index.d.ts +0 -26
  1777. package/dist/lib/utils/sanitizers/index.js +0 -30
  1778. package/dist/lib/utils/sanitizers/svg.d.ts +0 -71
  1779. package/dist/lib/utils/sanitizers/svg.js +0 -482
  1780. package/dist/lib/utils/schemaConversion.d.ts +0 -56
  1781. package/dist/lib/utils/schemaConversion.js +0 -656
  1782. package/dist/lib/utils/sizeGuard.d.ts +0 -34
  1783. package/dist/lib/utils/sizeGuard.js +0 -45
  1784. package/dist/lib/utils/ssrfGuard.d.ts +0 -60
  1785. package/dist/lib/utils/ssrfGuard.js +0 -446
  1786. package/dist/lib/utils/sttProcessor.d.ts +0 -125
  1787. package/dist/lib/utils/sttProcessor.js +0 -301
  1788. package/dist/lib/utils/systemMessages.d.ts +0 -29
  1789. package/dist/lib/utils/systemMessages.js +0 -45
  1790. package/dist/lib/utils/taskClassificationUtils.d.ts +0 -55
  1791. package/dist/lib/utils/taskClassificationUtils.js +0 -150
  1792. package/dist/lib/utils/taskClassifier.d.ts +0 -23
  1793. package/dist/lib/utils/taskClassifier.js +0 -95
  1794. package/dist/lib/utils/textEncoding.d.ts +0 -25
  1795. package/dist/lib/utils/textEncoding.js +0 -141
  1796. package/dist/lib/utils/thinkingConfig.d.ts +0 -76
  1797. package/dist/lib/utils/thinkingConfig.js +0 -105
  1798. package/dist/lib/utils/timeout.d.ts +0 -158
  1799. package/dist/lib/utils/timeout.js +0 -427
  1800. package/dist/lib/utils/tokenEstimation.d.ts +0 -90
  1801. package/dist/lib/utils/tokenEstimation.js +0 -187
  1802. package/dist/lib/utils/tokenLimits.d.ts +0 -53
  1803. package/dist/lib/utils/tokenLimits.js +0 -236
  1804. package/dist/lib/utils/tokenUtils.d.ts +0 -101
  1805. package/dist/lib/utils/tokenUtils.js +0 -323
  1806. package/dist/lib/utils/tool.d.ts +0 -8
  1807. package/dist/lib/utils/tool.js +0 -9
  1808. package/dist/lib/utils/toolCallRepair.d.ts +0 -14
  1809. package/dist/lib/utils/toolCallRepair.js +0 -286
  1810. package/dist/lib/utils/toolChoice.d.ts +0 -4
  1811. package/dist/lib/utils/toolChoice.js +0 -7
  1812. package/dist/lib/utils/toolEndEmitter.d.ts +0 -25
  1813. package/dist/lib/utils/toolEndEmitter.js +0 -65
  1814. package/dist/lib/utils/toolUtils.d.ts +0 -40
  1815. package/dist/lib/utils/toolUtils.js +0 -76
  1816. package/dist/lib/utils/transformationUtils.d.ts +0 -218
  1817. package/dist/lib/utils/transformationUtils.js +0 -578
  1818. package/dist/lib/utils/tripwireEvaluator.d.ts +0 -73
  1819. package/dist/lib/utils/tripwireEvaluator.js +0 -285
  1820. package/dist/lib/utils/tryImport.d.ts +0 -35
  1821. package/dist/lib/utils/tryImport.js +0 -95
  1822. package/dist/lib/utils/ttsProcessor.d.ts +0 -159
  1823. package/dist/lib/utils/ttsProcessor.js +0 -293
  1824. package/dist/lib/utils/typeUtils.d.ts +0 -77
  1825. package/dist/lib/utils/typeUtils.js +0 -98
  1826. package/dist/lib/utils/videoAnalysisProcessor.d.ts +0 -24
  1827. package/dist/lib/utils/videoAnalysisProcessor.js +0 -61
  1828. package/dist/lib/utils/videoProcessor.d.ts +0 -64
  1829. package/dist/lib/utils/videoProcessor.js +0 -196
  1830. package/dist/lib/voice/RealtimeVoiceAPI.d.ts +0 -186
  1831. package/dist/lib/voice/RealtimeVoiceAPI.js +0 -431
  1832. package/dist/lib/voice/audio-utils.d.ts +0 -135
  1833. package/dist/lib/voice/audio-utils.js +0 -435
  1834. package/dist/lib/voice/errors.d.ts +0 -123
  1835. package/dist/lib/voice/errors.js +0 -386
  1836. package/dist/lib/voice/index.d.ts +0 -49
  1837. package/dist/lib/voice/index.js +0 -177
  1838. package/dist/lib/voice/livekit/brain.d.ts +0 -21
  1839. package/dist/lib/voice/livekit/brain.js +0 -75
  1840. package/dist/lib/voice/livekit/config.d.ts +0 -52
  1841. package/dist/lib/voice/livekit/config.js +0 -134
  1842. package/dist/lib/voice/livekit/eventBridge.d.ts +0 -27
  1843. package/dist/lib/voice/livekit/eventBridge.js +0 -360
  1844. package/dist/lib/voice/livekit/index.d.ts +0 -22
  1845. package/dist/lib/voice/livekit/index.js +0 -23
  1846. package/dist/lib/voice/livekit/realtimeEventBridge.d.ts +0 -14
  1847. package/dist/lib/voice/livekit/realtimeEventBridge.js +0 -161
  1848. package/dist/lib/voice/livekit/realtimeMcpTools.d.ts +0 -31
  1849. package/dist/lib/voice/livekit/realtimeMcpTools.js +0 -206
  1850. package/dist/lib/voice/livekit/realtimeVoiceAgent.d.ts +0 -26
  1851. package/dist/lib/voice/livekit/realtimeVoiceAgent.js +0 -365
  1852. package/dist/lib/voice/livekit/roomContext.d.ts +0 -23
  1853. package/dist/lib/voice/livekit/roomContext.js +0 -57
  1854. package/dist/lib/voice/livekit/roomDispatch.d.ts +0 -24
  1855. package/dist/lib/voice/livekit/roomDispatch.js +0 -31
  1856. package/dist/lib/voice/livekit/schemaSanitizer.d.ts +0 -26
  1857. package/dist/lib/voice/livekit/schemaSanitizer.js +0 -144
  1858. package/dist/lib/voice/livekit/tokens.d.ts +0 -19
  1859. package/dist/lib/voice/livekit/tokens.js +0 -51
  1860. package/dist/lib/voice/livekit/vertexAuth.d.ts +0 -30
  1861. package/dist/lib/voice/livekit/vertexAuth.js +0 -73
  1862. package/dist/lib/voice/livekit/voiceAgent.d.ts +0 -32
  1863. package/dist/lib/voice/livekit/voiceAgent.js +0 -425
  1864. package/dist/lib/voice/livekit/voiceAgentWorker.d.ts +0 -29
  1865. package/dist/lib/voice/livekit/voiceAgentWorker.js +0 -122
  1866. package/dist/lib/voice/providers/AzureSTT.d.ts +0 -47
  1867. package/dist/lib/voice/providers/AzureSTT.js +0 -345
  1868. package/dist/lib/voice/providers/AzureTTS.d.ts +0 -59
  1869. package/dist/lib/voice/providers/AzureTTS.js +0 -349
  1870. package/dist/lib/voice/providers/CartesiaTTS.d.ts +0 -31
  1871. package/dist/lib/voice/providers/CartesiaTTS.js +0 -189
  1872. package/dist/lib/voice/providers/DeepgramSTT.d.ts +0 -40
  1873. package/dist/lib/voice/providers/DeepgramSTT.js +0 -550
  1874. package/dist/lib/voice/providers/ElevenLabsTTS.d.ts +0 -53
  1875. package/dist/lib/voice/providers/ElevenLabsTTS.js +0 -311
  1876. package/dist/lib/voice/providers/FishAudioTTS.d.ts +0 -27
  1877. package/dist/lib/voice/providers/FishAudioTTS.js +0 -183
  1878. package/dist/lib/voice/providers/GeminiLive.d.ts +0 -52
  1879. package/dist/lib/voice/providers/GeminiLive.js +0 -372
  1880. package/dist/lib/voice/providers/GoogleSTT.d.ts +0 -60
  1881. package/dist/lib/voice/providers/GoogleSTT.js +0 -454
  1882. package/dist/lib/voice/providers/OpenAIRealtime.d.ts +0 -47
  1883. package/dist/lib/voice/providers/OpenAIRealtime.js +0 -412
  1884. package/dist/lib/voice/providers/OpenAISTT.d.ts +0 -41
  1885. package/dist/lib/voice/providers/OpenAISTT.js +0 -286
  1886. package/dist/lib/voice/providers/OpenAITTS.d.ts +0 -55
  1887. package/dist/lib/voice/providers/OpenAITTS.js +0 -285
  1888. package/dist/lib/voice/stream-handler.d.ts +0 -166
  1889. package/dist/lib/voice/stream-handler.js +0 -514
  1890. package/dist/lib/workflow/LAYER-EXAMPLES.d.ts +0 -13
  1891. package/dist/lib/workflow/LAYER-EXAMPLES.js +0 -312
  1892. package/dist/lib/workflow/PROMPT-EXAMPLES.d.ts +0 -117
  1893. package/dist/lib/workflow/PROMPT-EXAMPLES.js +0 -246
  1894. package/dist/lib/workflow/config.d.ts +0 -376
  1895. package/dist/lib/workflow/config.js +0 -399
  1896. package/dist/lib/workflow/core/ensembleExecutor.d.ts +0 -55
  1897. package/dist/lib/workflow/core/ensembleExecutor.js +0 -451
  1898. package/dist/lib/workflow/core/judgeScorer.d.ts +0 -25
  1899. package/dist/lib/workflow/core/judgeScorer.js +0 -568
  1900. package/dist/lib/workflow/core/responseConditioner.d.ts +0 -21
  1901. package/dist/lib/workflow/core/responseConditioner.js +0 -243
  1902. package/dist/lib/workflow/core/workflowRegistry.d.ts +0 -72
  1903. package/dist/lib/workflow/core/workflowRegistry.js +0 -305
  1904. package/dist/lib/workflow/core/workflowRunner.d.ts +0 -61
  1905. package/dist/lib/workflow/core/workflowRunner.js +0 -642
  1906. package/dist/lib/workflow/index.d.ts +0 -21
  1907. package/dist/lib/workflow/index.js +0 -46
  1908. package/dist/lib/workflow/utils/workflowMetrics.d.ts +0 -74
  1909. package/dist/lib/workflow/utils/workflowMetrics.js +0 -312
  1910. package/dist/lib/workflow/utils/workflowValidation.d.ts +0 -29
  1911. package/dist/lib/workflow/utils/workflowValidation.js +0 -421
  1912. package/dist/lib/workflow/workflows/adaptiveWorkflow.d.ts +0 -72
  1913. package/dist/lib/workflow/workflows/adaptiveWorkflow.js +0 -367
  1914. package/dist/lib/workflow/workflows/consensusWorkflow.d.ts +0 -69
  1915. package/dist/lib/workflow/workflows/consensusWorkflow.js +0 -193
  1916. package/dist/lib/workflow/workflows/fallbackWorkflow.d.ts +0 -49
  1917. package/dist/lib/workflow/workflows/fallbackWorkflow.js +0 -226
  1918. package/dist/lib/workflow/workflows/multiJudgeWorkflow.d.ts +0 -70
  1919. package/dist/lib/workflow/workflows/multiJudgeWorkflow.js +0 -352
  1920. package/dist/providers/googleVertex/utils.d.ts +0 -12
  1921. package/dist/providers/googleVertex/utils.js +0 -286
@@ -1,2724 +0,0 @@
1
- /**
2
- * Proxy type definitions for NeuroLink
3
- *
4
- * Consolidates all proxy-related types from:
5
- * - src/lib/proxy/claudeFormat.ts (Claude API types, SSE types, internal result)
6
- * - src/lib/proxy/cloaking/types.ts (cloaking pipeline types)
7
- * - src/lib/proxy/cloaking/plugins/ (plugin option types)
8
- * - src/lib/proxy/modelRouter.ts (routing types)
9
- * - src/lib/proxy/proxyConfig.ts (config file types)
10
- * - src/lib/proxy/requestLogger.ts (log entry type)
11
- * - src/lib/proxy/usageStats.ts (stats types)
12
- * - src/lib/proxy/tokenRefresh.ts (refresh types)
13
- * - src/lib/proxy/accountQuota.ts (quota type)
14
- * - src/lib/server/routes/claudeProxyRoutes.ts (runtime state, deps)
15
- */
16
- import type { Counter, Histogram, Span } from "@opentelemetry/api";
17
- import type { Hono } from "hono";
18
- import type { Ora } from "ora";
19
- import type { MCPToolRegistry } from "../mcp/toolRegistry.js";
20
- import type { ProxyTracer } from "../proxy/proxyTracer.js";
21
- import type { ACCOUNT_COOLING_REASONS, PROXY_ACCOUNT_TYPES, PROXY_ACCOUNT_ROUTING_MODES, PROXY_ACCOUNT_ROUTING_REASONS, PROXY_ACCOUNT_ROUTING_STRATEGIES } from "../proxy/routingEvidence.js";
22
- import type { FallbackEntry, ModelMapping, ProxyRoutingConfig, CloakingConfig } from "./subscription.js";
23
- import type { RouteDeprecation } from "./server.js";
24
- /**
25
- * Type describing the ModelRouter contract.
26
- * Defined here to avoid a circular dependency between types and implementation.
27
- */
28
- export type ModelRouterInterface = {
29
- resolve(requestedModel: string): RouteResult;
30
- isClaudeTarget(requestedModel: string): boolean;
31
- getFallbackChain(): FallbackEntry[];
32
- isAutoFallbackEnabled?(): boolean;
33
- getMaxInflightPerAccount?(): number | undefined;
34
- getModelMappings?: () => ModelMapping[];
35
- getPassthroughModels?: () => string[];
36
- };
37
- /** A single text block in a Claude content array. */
38
- export type ClaudeTextBlock = {
39
- type: "text";
40
- text: string;
41
- };
42
- /** A single image block in a Claude content array. */
43
- export type ClaudeImageBlock = {
44
- type: "image";
45
- source: {
46
- type: "base64" | "url";
47
- media_type?: string;
48
- data?: string;
49
- url?: string;
50
- };
51
- };
52
- /** Tool-use block returned by Claude in assistant messages. */
53
- export type ClaudeToolUseBlock = {
54
- type: "tool_use";
55
- id: string;
56
- name: string;
57
- input: Record<string, unknown>;
58
- };
59
- /** Tool-result block sent back by the caller. */
60
- export type ClaudeToolResultBlock = {
61
- type: "tool_result";
62
- tool_use_id: string;
63
- content: string | ClaudeContentBlock[];
64
- };
65
- /** A thinking/reasoning block in a Claude content array. */
66
- export type ClaudeThinkingBlock = {
67
- type: "thinking";
68
- thinking: string;
69
- };
70
- export type ClaudeContentBlock = ClaudeTextBlock | ClaudeImageBlock | ClaudeToolUseBlock | ClaudeToolResultBlock | ClaudeThinkingBlock;
71
- /** A single message in a Claude conversation. */
72
- export type ClaudeMessage = {
73
- role: "user" | "assistant";
74
- content: string | ClaudeContentBlock[];
75
- };
76
- /** Tool definition in the Claude Messages API format. */
77
- export type ClaudeTool = {
78
- name: string;
79
- description?: string;
80
- input_schema: Record<string, unknown>;
81
- };
82
- /** Metadata attached to a Claude Messages API request. */
83
- export type ClaudeMetadata = {
84
- user_id?: string;
85
- };
86
- /**
87
- * Inbound Claude Messages API request body.
88
- * Matches POST /v1/messages.
89
- */
90
- export type ClaudeRequest = {
91
- model: string;
92
- messages: ClaudeMessage[];
93
- max_tokens: number;
94
- system?: string | Array<{
95
- type: "text";
96
- text: string;
97
- }>;
98
- temperature?: number;
99
- top_p?: number;
100
- top_k?: number;
101
- stop_sequences?: string[];
102
- stream?: boolean;
103
- tools?: ClaudeTool[];
104
- tool_choice?: {
105
- type: "auto" | "any" | "none";
106
- } | {
107
- type: "tool";
108
- name: string;
109
- };
110
- thinking?: {
111
- type: string;
112
- budget_tokens?: number;
113
- };
114
- metadata?: ClaudeMetadata;
115
- };
116
- /** Usage counters returned in a Claude response. */
117
- export type ClaudeUsage = {
118
- input_tokens: number;
119
- output_tokens: number;
120
- cache_creation_input_tokens?: number;
121
- cache_read_input_tokens?: number;
122
- };
123
- /** Non-streaming response matching the Claude Messages API. */
124
- export type ClaudeResponse = {
125
- id: string;
126
- type: "message";
127
- role: "assistant";
128
- content: ClaudeContentBlock[];
129
- model: string;
130
- stop_reason: string | null;
131
- stop_sequence: string | null;
132
- usage: ClaudeUsage;
133
- };
134
- /** Claude API error envelope. */
135
- export type ClaudeErrorResponse = {
136
- type: "error";
137
- error: {
138
- type: string;
139
- message: string;
140
- };
141
- };
142
- /** Content block descriptor for content_block_start events. */
143
- export type SSEContentBlockDescriptor = {
144
- type: "text";
145
- text: "";
146
- } | {
147
- type: "thinking";
148
- thinking: "";
149
- } | {
150
- type: "tool_use";
151
- id: string;
152
- name: string;
153
- input: "";
154
- };
155
- /** Delta descriptor for content_block_delta events. */
156
- export type SSEDeltaDescriptor = {
157
- type: "text_delta";
158
- text: string;
159
- } | {
160
- type: "thinking_delta";
161
- thinking: string;
162
- } | {
163
- type: "input_json_delta";
164
- partial_json: string;
165
- };
166
- export type SSEMessageStart = {
167
- type: "message_start";
168
- message: Omit<ClaudeResponse, "content"> & {
169
- content: [];
170
- };
171
- };
172
- export type SSEContentBlockStart = {
173
- type: "content_block_start";
174
- index: number;
175
- content_block: SSEContentBlockDescriptor;
176
- };
177
- export type SSEContentBlockDelta = {
178
- type: "content_block_delta";
179
- index: number;
180
- delta: SSEDeltaDescriptor;
181
- };
182
- export type SSEContentBlockStop = {
183
- type: "content_block_stop";
184
- index: number;
185
- };
186
- export type SSEMessageDelta = {
187
- type: "message_delta";
188
- delta: {
189
- stop_reason: string | null;
190
- stop_sequence: string | null;
191
- };
192
- usage: {
193
- output_tokens: number;
194
- };
195
- };
196
- export type SSEMessageStop = {
197
- type: "message_stop";
198
- };
199
- export type SSEPing = {
200
- type: "ping";
201
- };
202
- export type SSEEvent = SSEMessageStart | SSEContentBlockStart | SSEContentBlockDelta | SSEContentBlockStop | SSEMessageDelta | SSEMessageStop | SSEPing;
203
- /**
204
- * Minimal subset of NeuroLink's GenerateResult that the proxy layer consumes.
205
- * Kept intentionally narrow so the proxy layer does not depend on every
206
- * field of the full type.
207
- */
208
- export type InternalResult = {
209
- content: string;
210
- model?: string;
211
- finishReason?: string;
212
- /** Thinking/reasoning text from provider (Anthropic thinking blocks, Gemini thought parts) */
213
- reasoning?: string;
214
- usage?: {
215
- input: number;
216
- output: number;
217
- total: number;
218
- cacheCreationTokens?: number;
219
- cacheReadTokens?: number;
220
- };
221
- toolCalls?: Array<{
222
- toolCallId: string;
223
- toolName: string;
224
- args: Record<string, unknown>;
225
- }>;
226
- };
227
- /**
228
- * Parsed representation of a Claude request, ready for NeuroLink's
229
- * generate() / stream() pipeline.
230
- */
231
- export type ParsedClaudeRequest = {
232
- model: string;
233
- maxTokens: number;
234
- temperature?: number;
235
- topP?: number;
236
- topK?: number;
237
- systemPrompt?: string | Array<{
238
- type: string;
239
- text: string;
240
- }>;
241
- stream: boolean;
242
- /** Flat prompt string derived from the last user message. */
243
- prompt: string;
244
- /** Images extracted from content blocks (base64 data URIs or URLs). */
245
- images: string[];
246
- /**
247
- * Full conversation history converted to NeuroLink's ChatMessage shape.
248
- * Includes all messages, not just the last one.
249
- */
250
- conversationMessages: Array<{
251
- role: string;
252
- content: string;
253
- }>;
254
- /** Tools translated to AI SDK-compatible shape for provider fallback. */
255
- tools: Record<string, {
256
- description?: string;
257
- inputSchema: unknown;
258
- execute?: (...args: unknown[]) => unknown;
259
- }>;
260
- /**
261
- * Tool choice mapping from Claude format.
262
- * - "auto" -> let the model decide
263
- * - "required" -> force tool use (any tool)
264
- * - "none" -> no tool use
265
- */
266
- toolChoice?: "auto" | "required" | "none";
267
- /** When toolChoice came from `{type: "tool", name: "..."}`, the tool name. */
268
- toolChoiceName?: string;
269
- /** Thinking configuration parsed from the request. */
270
- thinkingConfig?: {
271
- enabled: boolean;
272
- budgetTokens?: number;
273
- thinkingLevel?: "minimal" | "low" | "medium" | "high";
274
- };
275
- /** Original request metadata (if any). */
276
- metadata?: ClaudeMetadata;
277
- /** Stop sequences from the original request. */
278
- stopSequences?: string[];
279
- };
280
- /** Lifecycle state for the SSE serializer. */
281
- export type StreamLifecycleState = "idle" | "streaming" | "done" | "error";
282
- /** The type of content block currently being streamed. */
283
- export type ContentBlockType = "text" | "thinking" | "tool_use" | null;
284
- /** Minimal account shape needed by the cloaking pipeline. */
285
- export type CloakingAccount = {
286
- id: string;
287
- type: "api_key" | "oauth";
288
- status: "healthy" | "quota_exceeded" | "error";
289
- consecutiveFailures: number;
290
- requestCount: number;
291
- lastUsed: number;
292
- apiKey?: string;
293
- };
294
- /** Request envelope for cloaking pipeline. */
295
- export type CloakingRequest = {
296
- headers: Record<string, string | undefined>;
297
- body: {
298
- messages: Array<{
299
- role: string;
300
- content: string | Array<Record<string, unknown>>;
301
- }>;
302
- system?: string | Array<{
303
- type: string;
304
- text: string;
305
- }>;
306
- metadata?: Record<string, unknown>;
307
- [key: string]: unknown;
308
- };
309
- url: string;
310
- };
311
- /** Response envelope for cloaking pipeline. */
312
- export type CloakingResponse = {
313
- headers: Record<string, string | undefined>;
314
- body: Record<string, unknown>;
315
- status: number;
316
- };
317
- /** Cloaking mode configuration. */
318
- export type CloakingMode = "auto" | "always" | "never";
319
- /** Context passed through the cloaking pipeline. */
320
- export type CloakingContext = {
321
- request: CloakingRequest;
322
- account: CloakingAccount;
323
- config: {
324
- mode: CloakingMode;
325
- plugins: Record<string, unknown>;
326
- };
327
- response?: {
328
- headers: Record<string, string>;
329
- body: unknown;
330
- };
331
- };
332
- /** Plugin interface for cloaking pipeline. */
333
- export type CloakingPlugin = {
334
- /** Human-readable name for logging / debugging. */
335
- name: string;
336
- /** Execution order -- lower numbers run first in processRequest. */
337
- order: number;
338
- /** Whether this plugin is active. Disabled plugins are skipped. */
339
- enabled: boolean;
340
- /**
341
- * Transform the outgoing request before it reaches the upstream API.
342
- * Must return a (possibly mutated) context.
343
- */
344
- transformRequest: (ctx: CloakingContext) => Promise<CloakingContext>;
345
- /**
346
- * Transform the incoming response before it reaches the client.
347
- * Optional -- plugins that only touch requests can skip this.
348
- */
349
- transformResponse?: (ctx: CloakingContext) => Promise<CloakingContext>;
350
- };
351
- /** Options for the HeaderScrubber cloaking plugin. */
352
- export type HeaderScrubberOptions = {
353
- /** Additional header names (lower-cased) to strip. */
354
- extraHeaders?: string[];
355
- };
356
- /** Options for the SystemPromptInjector cloaking plugin. */
357
- export type SystemPromptInjectorOptions = {
358
- /** IDE name to inject (default: "vscode"). */
359
- ide?: string;
360
- /** IDE version (default: "1.96.2"). */
361
- ideVersion?: string;
362
- /** Platform string (default: "darwin"). */
363
- platform?: string;
364
- /** Working directory to inject (default: "/home/user/project"). */
365
- cwd?: string;
366
- /** Extra preamble to prepend. */
367
- preamble?: string;
368
- };
369
- /** Options for the TlsFingerprint cloaking plugin. */
370
- export type TlsFingerprintOptions = {
371
- /** Target fingerprint profile (e.g. "chrome-131", "node-22", "claude-code"). */
372
- profile?: string;
373
- /** Whether the stub should log a warning that it is a no-op. */
374
- warnOnUse?: boolean;
375
- };
376
- /**
377
- * Proxy operating mode:
378
- * - "full" — managed accounts, retry, rotation, polyfill (default)
379
- * - "passthrough" — no polyfill/retry/rotation, but body is still parsed and re-serialized
380
- * - "transparent" — zero-mutation byte relay: raw body forwarded as-is, minimal header filtering,
381
- * SSE interceptor for cache metrics only (bytes pass through unmodified)
382
- */
383
- export type ProxyMode = "full" | "passthrough" | "transparent";
384
- export type RouteResult = {
385
- provider: string | null;
386
- model: string;
387
- };
388
- /** Individual account configuration within a proxy config file. */
389
- export type ProxyAccountConfig = {
390
- /** Human-readable name for the account */
391
- name: string;
392
- /** API key or token (may contain env var references) */
393
- apiKey: string;
394
- /** Base URL override for the provider endpoint */
395
- baseUrl?: string;
396
- /** Organization ID (e.g., OpenAI orgs) */
397
- orgId?: string;
398
- /** Weight for weighted round-robin selection (default: 1) */
399
- weight?: number;
400
- /** Whether this account is currently enabled (default: true) */
401
- enabled?: boolean;
402
- /** Maximum requests per minute for this account */
403
- rateLimit?: number;
404
- /** Arbitrary metadata attached to the account */
405
- metadata?: Record<string, unknown>;
406
- };
407
- /** Top-level proxy configuration structure. */
408
- export type ProxyConfigFile = {
409
- /** Configuration schema version */
410
- version?: number;
411
- /** Default provider name to apply when not specified per-account */
412
- defaultProvider?: string;
413
- /** Default base URL applied to accounts that omit baseUrl */
414
- defaultBaseUrl?: string;
415
- /** Map of provider names to their account lists */
416
- accounts: Record<string, ProxyAccountConfig[]>;
417
- /** Routing configuration (strategy, model mappings, fallback chain) */
418
- routing?: Partial<ProxyRoutingConfig>;
419
- /** Cloaking plugin configuration */
420
- cloaking?: CloakingConfig;
421
- };
422
- /** Options for loadProxyConfig. */
423
- export type LoadProxyConfigOptions = {
424
- /** Resolve environment variables in string values (default: true) */
425
- resolveEnv?: boolean;
426
- /** Custom environment object (defaults to process.env) */
427
- env?: Record<string, string | undefined>;
428
- };
429
- export type ProxyAccountRoutingStrategy = (typeof PROXY_ACCOUNT_ROUTING_STRATEGIES)[number];
430
- export type ProxyAccountRoutingMode = (typeof PROXY_ACCOUNT_ROUTING_MODES)[number];
431
- export type ProxyAccountRoutingReason = (typeof PROXY_ACCOUNT_ROUTING_REASONS)[number];
432
- export type ProxyAccountType = (typeof PROXY_ACCOUNT_TYPES)[number];
433
- export type ProxyQuotaFreshness = "unknown" | "fresh" | "stale_known" | "refresh_due";
434
- export type ProxyQuotaRefreshReason = "startup_unknown" | "handoff_prewarm" | "ambiguous_snapshot" | "manual";
435
- export type ProxyQuotaSaturationKind = "none" | "soft" | "hard";
436
- export type ProxyTransportScope = "shared_provider_transport" | "connection_transport" | "account_specific";
437
- export type ProxyNetworkTransportScope = Exclude<ProxyTransportScope, "account_specific">;
438
- export type ProxyProviderTransportProbeOutcome = "recovered" | "failed" | "abandoned";
439
- export type ProxyProviderTransportPermit = {
440
- allowed: true;
441
- probe: boolean;
442
- generation: number;
443
- } | {
444
- allowed: false;
445
- errorCode: string | null;
446
- transportScope: ProxyNetworkTransportScope;
447
- };
448
- export type ProxyAccountRoutingCandidate = {
449
- account: string;
450
- accountType: ProxyAccountType;
451
- sourceIndex: number;
452
- rank: number;
453
- configuredPrimary: boolean;
454
- usable: boolean;
455
- saturated: boolean;
456
- quotaObserved: boolean;
457
- quotaStale: boolean;
458
- quotaFreshness?: ProxyQuotaFreshness;
459
- refreshNeeded?: boolean;
460
- refreshReason?: ProxyQuotaRefreshReason | null;
461
- refreshInFlight?: boolean;
462
- lastRefreshAttemptAt?: number | null;
463
- lastRefreshSuccessAt?: number | null;
464
- nextRefreshEligibleAt?: number | null;
465
- saturationKind?: ProxyQuotaSaturationKind;
466
- softLimitOverrideReason?: "overage" | "weekly_expiry" | null;
467
- quotaLastUpdated: number | null;
468
- quotaAgeMs: number | null;
469
- coolingActive: boolean;
470
- coolingReason: AccountCoolingReason | null;
471
- coolingUntil: number | null;
472
- unifiedStatus: string | null;
473
- fallbackStatus?: string | null;
474
- upgradePaths?: string | null;
475
- overageEligible?: boolean;
476
- overageStatus: string | null;
477
- sessionStatus: string | null;
478
- sessionUsed: number | null;
479
- sessionResetAt: number | null;
480
- sessionResetBucket: number | null;
481
- weeklyStatus: string | null;
482
- weeklyUsed: number | null;
483
- weeklyResetAt: number | null;
484
- /** Display name of the model-scoped window that matched the requested model
485
- * (e.g. "Fable"), or null when the account reports no scoped cap for it.
486
- * Optional so schema-v1 readers of older records stay valid. */
487
- scopedModel?: string | null;
488
- scopedStatus?: string | null;
489
- scopedUsed?: number | null;
490
- scopedResetAt?: number | null;
491
- };
492
- export type ProxyAccountRoutingDecision = {
493
- schemaVersion: 1;
494
- evaluatedAt: string;
495
- strategy: ProxyAccountRoutingStrategy;
496
- mode: ProxyAccountRoutingMode;
497
- selectionReason: ProxyAccountRoutingReason;
498
- quotaRoutingEnabled: boolean;
499
- quotaInputsUsed: boolean;
500
- sessionSoftLimit: number;
501
- sessionResetToleranceMs: number;
502
- configuredPrimaryAccount: string | null;
503
- configuredPrimaryMatched: boolean;
504
- rotationOffset: number;
505
- initialAccount: string;
506
- candidates: ProxyAccountRoutingCandidate[];
507
- };
508
- export type ProxyAccountSortMetrics = {
509
- usable: boolean;
510
- saturated: boolean;
511
- hasQuota: boolean;
512
- quotaEvidenceRank: number;
513
- quotaStale: boolean;
514
- quotaFreshness: ProxyQuotaFreshness;
515
- refreshNeeded: boolean;
516
- refreshReason: ProxyQuotaRefreshReason | null;
517
- refreshInFlight: boolean;
518
- lastRefreshAttemptAt: number | null;
519
- lastRefreshSuccessAt: number | null;
520
- nextRefreshEligibleAt: number | null;
521
- saturationKind: ProxyQuotaSaturationKind;
522
- softLimitOverrideReason: "overage" | "weekly_expiry" | null;
523
- quotaLastUpdated: number | null;
524
- quotaAgeMs: number | null;
525
- coolingActive: boolean;
526
- coolingReason: AccountCoolingReason | null;
527
- coolingUntil: number;
528
- unifiedStatus: string | null;
529
- fallbackStatus?: string | null;
530
- upgradePaths?: string | null;
531
- overageEligible?: boolean;
532
- overageStatus: string | null;
533
- sessionStatus: string | null;
534
- sessionUsed: number | null;
535
- sessionResetBucket: number;
536
- sessionReset: number;
537
- weeklyStatus: string | null;
538
- weeklyReset: number;
539
- weeklyUsed: number | null;
540
- weeklyUsedForSort: number;
541
- /** Model-scoped weekly window matching the requested model. All null/false
542
- * when the account reports no scoped cap for it (the common case), which
543
- * makes every scoped comparator rung a no-op for unscoped traffic. */
544
- scopedModel: string | null;
545
- scopedStatus: string | null;
546
- scopedUsed: number | null;
547
- scopedReset: number;
548
- scopedUsedForSort: number;
549
- scopedSaturated: boolean;
550
- };
551
- export type RequestLogEntry = {
552
- timestamp: string;
553
- requestId: string;
554
- method: string;
555
- path: string;
556
- model: string;
557
- stream: boolean;
558
- toolCount: number;
559
- account: string;
560
- accountType: string;
561
- responseStatus: number;
562
- responseTimeMs: number;
563
- errorType?: string;
564
- errorMessage?: string;
565
- /** Low-level transport code such as ETIMEDOUT or EADDRNOTAVAIL. */
566
- errorCode?: string;
567
- /** Whether changing credentials can affect this transport failure. */
568
- transportScope?: ProxyTransportScope;
569
- inputTokens?: number;
570
- outputTokens?: number;
571
- cacheCreationTokens?: number;
572
- cacheReadTokens?: number;
573
- /** OTel trace ID for correlation with distributed traces */
574
- traceId?: string;
575
- /** OTel span ID for correlation with distributed traces */
576
- spanId?: string;
577
- /** Exact secret-free inputs and result of initial account selection. */
578
- routingDecision?: ProxyAccountRoutingDecision;
579
- };
580
- export type RequestAttemptLogEntry = {
581
- timestamp: string;
582
- requestId: string;
583
- attempt: number;
584
- method: string;
585
- path: string;
586
- model: string;
587
- stream: boolean;
588
- toolCount: number;
589
- account: string;
590
- accountType: string;
591
- responseStatus: number;
592
- /** End-to-end request age when this attempt completed. */
593
- responseTimeMs: number;
594
- /** Time spent in this specific account attempt. */
595
- attemptDurationMs?: number;
596
- errorType?: string;
597
- errorMessage?: string;
598
- /** Low-level transport code such as ETIMEDOUT or EADDRNOTAVAIL. */
599
- errorCode?: string;
600
- /** Whether changing credentials can affect this transport failure. */
601
- transportScope?: ProxyTransportScope;
602
- /** Whether this failed attempt may be retried without changing the request. */
603
- retryable?: boolean;
604
- /** Distinguishes short-lived admission throttles from exhausted quota windows. */
605
- rateLimitKind?: "transient" | "quota";
606
- /** Reset-aware cooldown reason selected for a rate-limited attempt. */
607
- cooldownReason?: "transient" | "session" | "weekly" | "unified";
608
- inputTokens?: number;
609
- outputTokens?: number;
610
- cacheCreationTokens?: number;
611
- cacheReadTokens?: number;
612
- /** OTel trace ID for correlation with distributed traces */
613
- traceId?: string;
614
- /** OTel span ID for correlation with distributed traces */
615
- spanId?: string;
616
- };
617
- export type ProxyBodyCaptureInput = {
618
- phase: string;
619
- headers?: Record<string, string>;
620
- body?: unknown;
621
- bodySize?: number;
622
- contentType?: string;
623
- responseStatus?: number;
624
- durationMs?: number;
625
- account?: string;
626
- accountType?: string;
627
- attempt?: number;
628
- metadata?: Record<string, unknown>;
629
- };
630
- export type ProxyBodyCaptureLogger = (capture: ProxyBodyCaptureInput) => void;
631
- export type ClaudeFinalRequestLogger = (status: number, accountLabel: string, accountType: string, errorType?: string, errorMessage?: string, extra?: {
632
- inputTokens?: number;
633
- outputTokens?: number;
634
- cacheCreationTokens?: number;
635
- cacheReadTokens?: number;
636
- errorCode?: string;
637
- transportScope?: ProxyTransportScope;
638
- }) => void;
639
- export type ClaudeLoggedErrorBuilder = (status: number, message: string, errorType?: string, extra?: {
640
- account?: string;
641
- accountType?: string;
642
- attempt?: number;
643
- errorCode?: string;
644
- transportScope?: ProxyTransportScope;
645
- }) => ClaudeErrorResponse;
646
- export type ClaudeRequestRuntimeContext = {
647
- tracer?: ProxyTracer;
648
- requestStartTime: number;
649
- logProxyBody: ProxyBodyCaptureLogger;
650
- logFinalRequest: ClaudeFinalRequestLogger;
651
- buildLoggedClaudeError: ClaudeLoggedErrorBuilder;
652
- };
653
- export type RoutedClaudeRequestRuntimeContext = ClaudeRequestRuntimeContext & {
654
- setRoutingDecision: (decision: ProxyAccountRoutingDecision) => void;
655
- };
656
- export type AnthropicAttemptLogger = (status: number, errorType?: string, errorMessage?: string, extra?: {
657
- inputTokens?: number;
658
- outputTokens?: number;
659
- cacheCreationTokens?: number;
660
- cacheReadTokens?: number;
661
- retryable?: boolean;
662
- /** Low-level transport code such as ETIMEDOUT or EADDRNOTAVAIL. */
663
- errorCode?: string;
664
- transportScope?: ProxyTransportScope;
665
- rateLimitKind?: "transient" | "quota";
666
- cooldownReason?: "transient" | "session" | "weekly" | "unified";
667
- /** Override for nested retries whose attempt starts after this logger. */
668
- attemptDurationMs?: number;
669
- /** Override used when one account selection performs an OAuth retry fetch. */
670
- attempt?: number;
671
- }) => void;
672
- export type AnthropicLoopState = {
673
- lastError: unknown;
674
- sawRateLimit: boolean;
675
- sawNetworkError: boolean;
676
- sawTransientFailure: boolean;
677
- invalidRequestFailure: {
678
- status: number;
679
- body: string;
680
- contentType?: string;
681
- } | null;
682
- authFailureMessage: string | null;
683
- authCooldownMessage: string | null;
684
- entitlementFailure: AnthropicEntitlementFailure | null;
685
- scopedExhaustion: AnthropicScopedExhaustion | null;
686
- fallbackFailureMessage?: string;
687
- attemptNumber: number;
688
- lastTransportErrorCode?: string;
689
- lastTransportScope?: ProxyNetworkTransportScope;
690
- };
691
- export type AnthropicUpstreamBody = {
692
- bodyStr: string;
693
- sessionId?: string;
694
- };
695
- export type AnthropicUpstreamBodyBuilder = (token: string) => AnthropicUpstreamBody;
696
- export type LoadedClaudeAccountContext = {
697
- accounts: ProxyPassthroughAccount[];
698
- enabledAccounts: ProxyPassthroughAccount[];
699
- orderedAccounts: ProxyPassthroughAccount[];
700
- bodyStr: string;
701
- requestStart: number;
702
- toolCount: number;
703
- url: string;
704
- clientHeaders: Record<string, string | undefined>;
705
- isClaudeClientRequest: boolean;
706
- };
707
- export type AnthropicSuccessResult = {
708
- retryNextAccount: true;
709
- failure?: {
710
- message: string;
711
- rateLimit: boolean;
712
- retryDelayMs?: number;
713
- };
714
- } | {
715
- response: Response | unknown;
716
- holdsAccountAdmission?: boolean;
717
- };
718
- /** A release handle for one in-flight request admitted to an OAuth account. */
719
- export type AccountAdmissionLease = {
720
- release(): void;
721
- };
722
- /** A cancellable queued request for per-account admission capacity. */
723
- export type QueuedAccountAdmission = {
724
- accountKey: string;
725
- promise: Promise<AccountAdmissionLease>;
726
- cancel(): void;
727
- };
728
- /** One queued request waiting for per-account admission capacity. */
729
- export type AccountAdmissionWaiter = {
730
- capacity: number;
731
- resolve: (lease: AccountAdmissionLease) => void;
732
- };
733
- /** In-process request admission state for an OAuth account. */
734
- export type AccountAdmissionState = {
735
- active: number;
736
- waiters: AccountAdmissionWaiter[];
737
- };
738
- /** Result of buffering only enough upstream SSE to make a retry-safe decision. */
739
- export type AnthropicStreamPreflightResult = {
740
- kind: "ready";
741
- chunks: Uint8Array[];
742
- } | {
743
- kind: "empty";
744
- chunks: Uint8Array[];
745
- } | {
746
- kind: "transport_error";
747
- chunks: Uint8Array[];
748
- error: unknown;
749
- } | {
750
- kind: "sse_error";
751
- chunks: Uint8Array[];
752
- errorType: string;
753
- message: string;
754
- };
755
- /** One complete Server-Sent Event extracted from an incremental buffer. */
756
- export type ParsedSSEEvent = {
757
- event: string;
758
- data: string;
759
- };
760
- /** Complete SSE events plus the trailing partial frame. */
761
- export type ParsedSSEBuffer = {
762
- events: ParsedSSEEvent[];
763
- remainder: string;
764
- };
765
- export type AnthropicAuthRetryResult = {
766
- response?: Response | unknown;
767
- holdsAccountAdmission?: boolean;
768
- continueLoop: boolean;
769
- /** Failure-path pacing before rotating after provider-wide overload. */
770
- retryDelayMs?: number;
771
- lastError: unknown;
772
- authFailureMessage: string | null;
773
- entitlementFailure: AnthropicEntitlementFailure | null;
774
- sawRateLimit: boolean;
775
- sawTransientFailure: boolean;
776
- sawNetworkError: boolean;
777
- upstreamSpan?: Span;
778
- };
779
- export type AnthropicNonOkResult = {
780
- response?: Response | unknown;
781
- continueLoop: boolean;
782
- retrySameAccount?: boolean;
783
- /** Failure-path pacing before rotating after provider-wide overload. */
784
- retryDelayMs?: number;
785
- lastError: unknown;
786
- authFailureMessage: string | null;
787
- sawTransientFailure: boolean;
788
- invalidRequestFailure: {
789
- status: number;
790
- body: string;
791
- contentType?: string;
792
- } | null;
793
- entitlementFailure: AnthropicEntitlementFailure | null;
794
- upstreamSpan?: Span;
795
- };
796
- export type PreparedAnthropicAccountAttempt = {
797
- continueLoop: boolean;
798
- lastError: unknown;
799
- authFailureMessage: string | null;
800
- headers?: Record<string, string>;
801
- buildUpstreamBody?: AnthropicUpstreamBodyBuilder;
802
- finalBodyStr?: string;
803
- fetchStartMs?: number;
804
- upstreamSpan?: Span;
805
- };
806
- /** How to cool an account after a genuine (non-anti-abuse) 429, derived from
807
- * the response's quota headers + retry-after. */
808
- export type RateLimitCoolingReason = Exclude<AccountCoolingReason, "auth">;
809
- export type AccountCooldownPlan = {
810
- reason: RateLimitCoolingReason;
811
- /** Epoch-ms until which the account should not be used. */
812
- coolingUntil: number;
813
- /** When true (unified/5h/7d rejected), rotate immediately — retrying the
814
- * same account is futile until its window resets. When false (transient
815
- * burst), a small number of jittered same-account retries is allowed first. */
816
- rotateImmediately: boolean;
817
- };
818
- export type ProxyQuotaCooldownUpdate = {
819
- kind: "cooled";
820
- coolingUntil: number;
821
- coolingReason: AccountCoolingReason;
822
- } | {
823
- kind: "cleared";
824
- coolingUntil: number;
825
- } | null;
826
- export type TransientRateLimitRetryBudget = {
827
- coolingUntil: number;
828
- retriesClaimed: number;
829
- };
830
- export type AnthropicUpstreamFetchResult = {
831
- continueLoop: boolean;
832
- retrySameAccount?: boolean;
833
- transportScope?: ProxyNetworkTransportScope;
834
- errorCode?: string;
835
- /** When set, the caller should wait this many ms before retrying (from upstream retry-after). */
836
- retryAfterMs?: number;
837
- /** Set on a genuine 429: how long / why to cool this account before rotating. */
838
- cooldownPlan?: AccountCooldownPlan;
839
- /** Quota snapshot parsed from the response headers (429 or success), if present. */
840
- quota?: AccountQuota;
841
- /** A terminal upstream rejection already captured and classified by the
842
- * fetch layer. The route must finalize it directly instead of feeding it
843
- * through the generic non-OK handler a second time. */
844
- terminalError?: {
845
- status: number;
846
- body: string;
847
- headers: Record<string, string>;
848
- errorType: "construction_rejection";
849
- };
850
- response?: Response;
851
- lastError: unknown;
852
- sawRateLimit: boolean;
853
- sawNetworkError: boolean;
854
- upstreamSpan?: Span;
855
- };
856
- export type ProxyTerminalErrorCategory = "authentication" | "client_cancelled" | "fallback_exhausted" | "invalid_request" | "proxy_error" | "rate_limit" | "stream_error" | "unclassified" | "upstream_error" | "other";
857
- /** Compact, redacted terminal failure retained independently of body logs. */
858
- export type ProxyTerminalErrorSummary = {
859
- id: string;
860
- at: number;
861
- status: number;
862
- category: ProxyTerminalErrorCategory;
863
- requestId?: string;
864
- account?: string;
865
- accountType?: string;
866
- errorType?: string;
867
- errorCode?: string;
868
- terminalOutcome?: string;
869
- message?: string;
870
- };
871
- /** Optional terminal context supplied when a final request error is recorded. */
872
- export type ProxyTerminalErrorDetails = {
873
- requestId?: string;
874
- errorType?: string;
875
- errorCode?: string;
876
- terminalOutcome?: string;
877
- message?: string;
878
- };
879
- export type AccountStats = {
880
- label: string;
881
- type: string;
882
- attemptCount: number;
883
- /** Failed upstream attempts, including retries that later recovered. */
884
- attemptErrorCount: number;
885
- /** Final requests successfully completed by this account. */
886
- successCount: number;
887
- /** Final requests that terminated as errors on this account. */
888
- errorCount: number;
889
- /** All upstream attempts that returned 429. */
890
- rateLimitCount: number;
891
- transientRateLimitCount: number;
892
- quotaRateLimitCount: number;
893
- lastAttemptAt: number;
894
- lastErrorAt?: number;
895
- };
896
- export type ProxyStats = {
897
- startedAt: number;
898
- totalAttempts: number;
899
- totalAttemptErrors: number;
900
- totalRequests: number;
901
- totalSuccess: number;
902
- totalErrors: number;
903
- totalRateLimits: number;
904
- totalTransientRateLimits: number;
905
- totalQuotaRateLimits: number;
906
- accounts: Record<string, AccountStats>;
907
- };
908
- /** Bounded terminal-error state stored separately from counters and body logs. */
909
- export type ProxyTerminalErrorJournal = {
910
- startedAt: number;
911
- totalErrors: number;
912
- counts: Record<ProxyTerminalErrorCategory, number>;
913
- recent: ProxyTerminalErrorSummary[];
914
- };
915
- export type ProxyUsageStatsSnapshot = {
916
- stats: ProxyStats;
917
- statsVersion: number;
918
- terminalErrors: ProxyTerminalErrorJournal;
919
- terminalErrorsVersion: number;
920
- };
921
- /** Durability and reconciliation state for the proxy usage counters. */
922
- export type ProxyStatsPersistenceStatus = {
923
- enabled: boolean;
924
- filePath: string | null;
925
- revision: number;
926
- pendingMutations: number;
927
- inFlightMutations: number;
928
- unpersistedMutations: number;
929
- lastFlushedAt: number | null;
930
- lastReconciledAt: number | null;
931
- lastRecoveryAt: number | null;
932
- lastError: string | null;
933
- terminalErrorsFilePath?: string | null;
934
- terminalErrorsRevision?: number;
935
- terminalErrorsPending?: number;
936
- terminalErrorsInFlight?: number;
937
- terminalErrorsUnpersisted?: number;
938
- terminalErrorsLastFlushedAt?: number | null;
939
- terminalErrorsLastRecoveryAt?: number | null;
940
- terminalErrorsLastError?: string | null;
941
- };
942
- /** Versioned on-disk snapshot shared by overlapping proxy workers. */
943
- export type PersistedProxyStatsSnapshot = {
944
- schemaVersion: 1;
945
- revision: number;
946
- updatedAt: number;
947
- stats: ProxyStats;
948
- };
949
- /** Versioned terminal-error snapshot isolated from rolling-worker counter writes. */
950
- export type PersistedProxyTerminalErrorSnapshot = {
951
- schemaVersion: 1;
952
- revision: number;
953
- updatedAt: number;
954
- journal: ProxyTerminalErrorJournal;
955
- };
956
- /** Ownership metadata for the proxy statistics cross-process lock. */
957
- export type ProxyStatsLockOwner = {
958
- token: string;
959
- pid: number;
960
- acquiredAt: number;
961
- };
962
- /** Construction options for an isolated proxy statistics store. */
963
- export type ProxyUsageStatsStoreOptions = {
964
- filePath?: string;
965
- terminalErrorsFilePath?: string;
966
- flushIntervalMs?: number;
967
- lockTimeoutMs?: number;
968
- staleLockMs?: number;
969
- now?: () => number;
970
- };
971
- export type RefreshableAccount = {
972
- token: string;
973
- refreshToken?: string;
974
- expiresAt?: number;
975
- label: string;
976
- };
977
- export type RefreshResult = {
978
- success: boolean;
979
- error?: string;
980
- status?: number;
981
- };
982
- /** Result shared by callers waiting on the same rotating refresh token. */
983
- export type SharedRefreshResult = {
984
- result: RefreshResult;
985
- token: string;
986
- refreshToken?: string;
987
- expiresAt?: number;
988
- };
989
- export type TokenPersistTarget = string | {
990
- credPath: string;
991
- } | {
992
- providerKey: string;
993
- };
994
- export type AccountQuota = {
995
- /** Top-level unified status. A rejected value can be authoritative even
996
- * while both 5h and 7d sub-window statuses still report allowed. */
997
- unifiedStatus?: string;
998
- /** 0.0-1.0 (from unified-5h-utilization) */
999
- sessionUsed: number;
1000
- /** "allowed" | "throttled" | "rejected" */
1001
- sessionStatus: string;
1002
- /** Unix timestamp (seconds) when the 5h window resets */
1003
- sessionResetAt: number;
1004
- /** 0.0-1.0 (from unified-7d-utilization) */
1005
- weeklyUsed: number;
1006
- /** "allowed" | "throttled" | "rejected" */
1007
- weeklyStatus: string;
1008
- /** Unix timestamp (seconds) when the 7d window resets */
1009
- weeklyResetAt: number;
1010
- /** 0.0-1.0 (from fallback-percentage) */
1011
- fallbackPercentage: number;
1012
- /** Provider fallback availability, for example "available". */
1013
- fallbackStatus?: string;
1014
- /** Comma-separated provider upgrade paths, for example "overage". */
1015
- upgradePaths?: string;
1016
- /** "allowed" | "rejected" */
1017
- overageStatus: string;
1018
- /** Whether Anthropic reports that paid overage is actively serving traffic. */
1019
- overageInUse?: boolean;
1020
- /** Why overage is unavailable, verbatim from
1021
- * anthropic-ratelimit-unified-overage-disabled-reason (e.g.
1022
- * "org_level_disabled"). Present only when the provider states one. */
1023
- overageDisabledReason?: string;
1024
- /** Authoritative extra-usage switch from the usage API's
1025
- * `extra_usage.is_enabled`. Unlike the header trio this is reported even for
1026
- * an account that has never served a request. */
1027
- overageEnabled?: boolean;
1028
- /** Which window Anthropic considers binding right now, verbatim from
1029
- * anthropic-ratelimit-unified-representative-claim (e.g. "five_hour"). */
1030
- representativeClaim?: string;
1031
- /** Epoch ms when we last captured this data */
1032
- lastUpdated: number;
1033
- /** Dynamic per-plan limit buckets from the usage API `limits[]` array
1034
- * (session / weekly_all / model-scoped weeklies such as Fable / future
1035
- * kinds). Absent on purely header-sourced snapshots. */
1036
- windows?: AccountQuotaWindow[];
1037
- /** Epoch ms when `windows` was last refreshed from the usage API. */
1038
- windowsUpdatedAt?: number;
1039
- /** Provenance of this snapshot's numbers. */
1040
- source?: AccountQuotaSource;
1041
- };
1042
- /** Where an AccountQuota snapshot came from.
1043
- * - "headers" : passive capture of anthropic-ratelimit-unified-* response
1044
- * headers on a routed request (the automatic path).
1045
- * - "usage-api" : an explicit refresh against Anthropic's OAuth usage
1046
- * endpoint (manual refetch path). */
1047
- export type AccountQuotaSource = "headers" | "usage-api";
1048
- /** One dynamic limit bucket from the usage API. Provider vocabulary (`kind`,
1049
- * `group`, `severity`) is preserved verbatim so buckets Anthropic adds later
1050
- * survive storage and display without a code change. */
1051
- export type AccountQuotaWindow = {
1052
- /** Provider kind, verbatim ("session", "weekly_all", "weekly_scoped", ...). */
1053
- kind: string;
1054
- /** Provider group, verbatim ("session" | "weekly" | future values). */
1055
- group?: string;
1056
- /** 0.0-1.0 utilization (provider percent / 100). */
1057
- used: number;
1058
- /** Provider severity, verbatim ("normal", ...). */
1059
- severity?: string;
1060
- /** Derived "allowed" | "rejected" (see usageToQuota status mapping). */
1061
- status: string;
1062
- /** Unix timestamp (seconds) when this window resets; 0 when unparseable. */
1063
- resetsAt: number;
1064
- isActive?: boolean;
1065
- /** Model display name for model-scoped windows (e.g. "Fable"). */
1066
- scopeModel?: string;
1067
- /** Wire model id for the scope when the provider reports one
1068
- * (`scope.model.id`), which matches a request's `model` exactly and so beats
1069
- * display-name matching. Often null in practice. */
1070
- scopeModelId?: string;
1071
- /** Surface scope when the provider reports one. */
1072
- scopeSurface?: string;
1073
- /** Epoch ms this individual window was observed. Lets a header-derived window
1074
- * and a usage-API window on the same account age independently — the flat
1075
- * `lastUpdated` refreshes on every response and would otherwise make a
1076
- * days-old scoped window look current. */
1077
- updatedAt?: number;
1078
- /** Provenance of this window, mirroring AccountQuotaSource. */
1079
- source?: AccountQuotaSource;
1080
- /** Raw unified header token for header-derived windows, e.g. "7d_oi". */
1081
- headerWindow?: string;
1082
- };
1083
- /** One utilization window from the OAuth usage endpoint (wire shape, loose). */
1084
- export type AnthropicUsageWindow = {
1085
- /** 0-100 percent (note: NOT the 0-1 fraction used by headers). */
1086
- utilization?: number | null;
1087
- /** ISO-8601 timestamp. */
1088
- resets_at?: string | null;
1089
- };
1090
- /** One entry of the usage endpoint's generic `limits[]` array (wire shape). */
1091
- export type AnthropicUsageLimit = {
1092
- kind?: string;
1093
- group?: string;
1094
- /** 0-100 percent. */
1095
- percent?: number | null;
1096
- severity?: string | null;
1097
- resets_at?: string | null;
1098
- scope?: {
1099
- model?: {
1100
- id?: string | null;
1101
- display_name?: string | null;
1102
- } | null;
1103
- surface?: string | null;
1104
- } | null;
1105
- is_active?: boolean | null;
1106
- };
1107
- /** Response body of GET https://api.anthropic.com/api/oauth/usage (loose —
1108
- * unknown keys are ignored, known keys may be absent or null). */
1109
- export type AnthropicUsageResponse = {
1110
- five_hour?: AnthropicUsageWindow | null;
1111
- seven_day?: AnthropicUsageWindow | null;
1112
- limits?: AnthropicUsageLimit[] | null;
1113
- extra_usage?: {
1114
- is_enabled?: boolean | null;
1115
- } | null;
1116
- };
1117
- /** Outcome of one account's usage-endpoint fetch. Return-not-throw. */
1118
- export type AccountUsageFetchResult = {
1119
- ok: true;
1120
- usage: AnthropicUsageResponse;
1121
- } | {
1122
- ok: false;
1123
- reason: "not_oauth" | "auth" | "http" | "network" | "parse";
1124
- error: string;
1125
- status?: number;
1126
- };
1127
- export type ProxyQuotaRefreshRuntimeState = {
1128
- inFlight: boolean;
1129
- lastAttemptAt?: number;
1130
- lastSuccessAt?: number;
1131
- nextEligibleAt?: number;
1132
- consecutiveFailures: number;
1133
- lastFailureReason?: string;
1134
- lastCompletedTrigger?: string;
1135
- coalesced: number;
1136
- };
1137
- export type ProxyQuotaRefreshMetrics = {
1138
- attempted: number;
1139
- succeeded: number;
1140
- failed: number;
1141
- coalesced: number;
1142
- backoffSuppressed: number;
1143
- triggerDeduplicated: number;
1144
- };
1145
- export type ProxyQuotaRefreshRunResult = {
1146
- kind: "completed";
1147
- result: AccountUsageFetchResult;
1148
- /** Lower bound for the freshness of the returned usage snapshot. */
1149
- startedAt: number;
1150
- } | {
1151
- kind: "backoff";
1152
- nextEligibleAt: number;
1153
- } | {
1154
- kind: "not_due";
1155
- };
1156
- /** Per-account result inside a GET /limits response. */
1157
- export type ProxyLimitsAccountResult = {
1158
- /** Account label (quota-store key). */
1159
- account: string;
1160
- /** Token-store key ("anthropic:<label>"). */
1161
- key: string;
1162
- type: ProxyAccountType;
1163
- status: "refreshed" | "throttled" | "skipped_api_key" | "snapshot" | "error";
1164
- /** Fresh quota on "refreshed"; last known snapshot otherwise (may be null). */
1165
- quota: AccountQuota | null;
1166
- error?: string;
1167
- coolingUntil?: number;
1168
- coolingReason?: AccountCoolingReason;
1169
- };
1170
- /** Response body of the proxy's GET /limits endpoint. */
1171
- export type ProxyLimitsRefreshResponse = {
1172
- fetchedAt: number;
1173
- /** True when served from stored state without contacting Anthropic. */
1174
- snapshot: boolean;
1175
- results: ProxyLimitsAccountResult[];
1176
- /** Process-local refresh activity; contains no credentials or response body. */
1177
- refreshMetrics?: ProxyQuotaRefreshMetrics;
1178
- };
1179
- /**
1180
- * Provenance of the quota numbers attached to a single proxy response.
1181
- * - "live" : parsed from THIS upstream response's headers.
1182
- * - "snapshot" : the last known snapshot for the serving account; the upstream
1183
- * response carried no quota headers.
1184
- * - "none" : no Anthropic account served this request (fallback provider,
1185
- * or a failure before any account was reached).
1186
- *
1187
- * Consumers must not treat "snapshot" as current. Without this distinction a
1188
- * stale reading is indistinguishable from a fresh one.
1189
- */
1190
- export type ProxyQuotaSource = "live" | "snapshot" | "none";
1191
- /** Aggregate account-pool headroom at the moment a response was produced. */
1192
- export type ProxyPoolHeadroom = {
1193
- /** Accounts eligible to serve a request right now (not cooling/disabled). */
1194
- available: number;
1195
- /** Accounts currently in a cooldown window. */
1196
- cooling: number;
1197
- /** Best session headroom across available accounts, as a percentage 0-100.
1198
- * Undefined when no available account has a quota snapshot. */
1199
- bestSessionLeftPct?: number;
1200
- };
1201
- /**
1202
- * Everything the proxy knows about limits and routing for one response.
1203
- * Consumed by `buildQuotaResponseHeaders` — kept as data (not headers) so the
1204
- * assembly stays pure and testable.
1205
- */
1206
- export type ProxyQuotaHeaderContext = {
1207
- quota: AccountQuota | null;
1208
- source: ProxyQuotaSource;
1209
- /** Account label that served the request; omitted for fallback/no-account. */
1210
- accountLabel?: string;
1211
- accountType?: string;
1212
- /** Which upstream actually produced the response ("anthropic" or a fallback
1213
- * provider name). Lets a consumer avoid attributing quota to the wrong one. */
1214
- servedBy?: string;
1215
- /** 1-based attempt index within the routing loop. */
1216
- attempt?: number;
1217
- /** Epoch ms until which the serving account is cooling, when applicable. */
1218
- coolingUntil?: number;
1219
- coolingReason?: AccountCoolingReason;
1220
- pool?: ProxyPoolHeadroom;
1221
- };
1222
- /** Why an account is currently cooling. Drives cooldown duration and logging.
1223
- * - "weekly" : 7d unified limit rejected — cool until the weekly reset.
1224
- * - "session" : 5h unified limit rejected — cool until the session reset.
1225
- * - "unified" : top-level unified limit rejected — cool for retry-after.
1226
- * - "transient" : short per-minute/burst 429 — cool for retry-after only.
1227
- * - "auth" : transient refresh failure with bounded backoff. */
1228
- export type AccountCoolingReason = (typeof ACCOUNT_COOLING_REASONS)[number];
1229
- /** Restart-safe cooldown snapshot for one account. */
1230
- export type PersistedAccountCooldown = {
1231
- coolingUntil: number;
1232
- reason: AccountCoolingReason;
1233
- updatedAt: number;
1234
- };
1235
- /** Normalized Anthropic account keys eligible for proxy routing. */
1236
- export type AccountAllowlist = ReadonlySet<string>;
1237
- /** Runtime state for a proxy account. */
1238
- export type RuntimeAccountState = {
1239
- consecutiveRefreshFailures: number;
1240
- permanentlyDisabled: boolean;
1241
- lastToken?: string;
1242
- lastRefreshToken?: string;
1243
- /** Epoch-ms timestamp until which the account should not be used for new
1244
- * requests. Set from the actual Anthropic reset/retry window or from
1245
- * bounded refresh backoff. Other requests arriving during this window skip
1246
- * the account rather than hammering it. */
1247
- coolingUntil?: number;
1248
- /** Why the account is cooling (set alongside coolingUntil). */
1249
- coolingReason?: AccountCoolingReason;
1250
- /** Latest quota snapshot parsed from Anthropic `anthropic-ratelimit-unified-*`
1251
- * headers on ANY response (success or 429). Drives proactive, reset-aware
1252
- * selection so we don't have to eat a 429 to discover an account is spent. */
1253
- quota?: AccountQuota;
1254
- };
1255
- /** A passthrough account used in the proxy route handler. */
1256
- export type ProxyPassthroughAccount = {
1257
- key: string;
1258
- label: string;
1259
- token: string;
1260
- refreshToken?: string;
1261
- expiresAt?: number;
1262
- type: ProxyAccountType;
1263
- persistTarget?: TokenPersistTarget;
1264
- };
1265
- /** Dependencies for creating Claude proxy routes. */
1266
- export type ClaudeProxyDeps = {
1267
- modelRouter?: ModelRouterInterface;
1268
- };
1269
- /** Rate limit store entry (Koa adapter). */
1270
- export type KoaRateLimitEntry = {
1271
- count: number;
1272
- resetAt: number;
1273
- };
1274
- /** Rate limit context (Fastify adapter). */
1275
- export type FastifyRateLimitContext = {
1276
- ttl: number;
1277
- ban?: boolean;
1278
- };
1279
- /** Rate limit store entry (Hono adapter). */
1280
- export type HonoRateLimitEntry = {
1281
- count: number;
1282
- resetAt: number;
1283
- };
1284
- /** Information about a deprecated route. */
1285
- export type DeprecatedRouteInfo = {
1286
- method: string;
1287
- path: string;
1288
- deprecation: RouteDeprecation;
1289
- };
1290
- /** Cache entry for response caching middleware. */
1291
- export type ResponseCacheEntry<T = unknown> = {
1292
- value: T;
1293
- expiresAt: number;
1294
- };
1295
- /** Close handler for data stream writers. */
1296
- export type CloseHandler = () => void;
1297
- /** Cached session entry with TTL for the SessionIdentity cloaking plugin. */
1298
- export type CachedSession = {
1299
- userId: string;
1300
- expiresAt: number;
1301
- };
1302
- /** Model tier classification for proxy routing decisions. */
1303
- export type ClaudeProxyModelTier = "opus" | "sonnet" | "haiku" | "other";
1304
- /** A single provider attempt in the proxy translation plan. */
1305
- export type ProxyTranslationAttempt = {
1306
- provider?: string;
1307
- model?: string;
1308
- label: string;
1309
- };
1310
- /** Ordered plan of provider attempts for a proxy request. */
1311
- export type ProxyTranslationPlan = {
1312
- requestedModel: string;
1313
- modelTier: ClaudeProxyModelTier;
1314
- attempts: ProxyTranslationAttempt[];
1315
- skipped: never[];
1316
- };
1317
- /** Mutable readiness state tracked by the proxy process. */
1318
- export type ProxyReadinessState = {
1319
- startTimeMs: number;
1320
- acceptingConnections: boolean;
1321
- ready: boolean;
1322
- /** True only while the updater is draining inference traffic. */
1323
- drainingForUpdate: boolean;
1324
- readyAtMs?: number;
1325
- };
1326
- /** Structured response returned by the proxy /health endpoint. */
1327
- export type ProxyHealthResponse = {
1328
- status: "ok" | "starting";
1329
- ready: boolean;
1330
- acceptingConnections: boolean;
1331
- drainingForUpdate: boolean;
1332
- strategy: string;
1333
- passthrough: boolean;
1334
- version: string;
1335
- startedAt: string;
1336
- readyAt: string | null;
1337
- uptime: number;
1338
- healthPath: "/health";
1339
- statusPath: "/status";
1340
- };
1341
- export type ProxyPaths = {
1342
- /** Base directory for proxy state files */
1343
- stateDir: string;
1344
- /** logs/ — request/response logs */
1345
- logsDir: string;
1346
- /** account-quotas.json — per-account rate limit state */
1347
- quotaFile: string;
1348
- /** account-cooldowns.json — restart-safe account cooldown state */
1349
- cooldownFile: string;
1350
- /** proxy-usage-stats.json — restart- and handoff-safe usage counters */
1351
- statsFile?: string;
1352
- /** Whether this is a dev-mode isolated instance */
1353
- isDev: boolean;
1354
- };
1355
- /** OTel metric instruments used by the proxy tracer. */
1356
- export type ProxyMetrics = {
1357
- requestsTotal: Counter;
1358
- requestDuration: Histogram;
1359
- tokensInput: Counter;
1360
- tokensOutput: Counter;
1361
- tokensCacheRead: Counter;
1362
- tokensCacheCreation: Counter;
1363
- tokensReasoning: Counter;
1364
- costTotal: Counter;
1365
- errorsTotal: Counter;
1366
- retriesTotal: Counter;
1367
- modelSubstitutionTotal: Counter;
1368
- requestBodySize: Histogram;
1369
- responseBodySize: Histogram;
1370
- fallbackAttemptsTotal: Counter;
1371
- fallbackSuccessTotal: Counter;
1372
- fallbackFailureTotal: Counter;
1373
- };
1374
- /** Context for a proxy request at the root span level. */
1375
- export type ProxyRequestContext = {
1376
- requestId: string;
1377
- method: string;
1378
- path: string;
1379
- model: string;
1380
- stream: boolean;
1381
- toolCount: number;
1382
- /** Names of the tools advertised in the request (what the caller exposed). */
1383
- toolNames?: string[];
1384
- sessionId?: string;
1385
- userAgent?: string;
1386
- clientApp?: string;
1387
- };
1388
- /** Response-side details parsed from the upstream reply (model, finish, tools). */
1389
- export type ResponseInfoContext = {
1390
- responseModel?: string;
1391
- finishReason?: string;
1392
- stopSequence?: string;
1393
- /** Names of the tools the model actually invoked (tool_use blocks). */
1394
- toolCalls?: string[];
1395
- };
1396
- /** Context recorded when an account is selected for a proxy request. */
1397
- export type AccountSelectionContext = {
1398
- strategy: string;
1399
- accountsTotal: number;
1400
- accountsHealthy: number;
1401
- selectedAccount: string;
1402
- accountType: string;
1403
- rateLimitBefore5h?: number;
1404
- rateLimitBefore7d?: number;
1405
- };
1406
- /** Context for a single upstream attempt (one per retry). */
1407
- export type UpstreamAttemptContext = {
1408
- attempt: number;
1409
- account: string;
1410
- polyfillHeaders: boolean;
1411
- polyfillBody: boolean;
1412
- upstreamUrl: string;
1413
- };
1414
- /** Token usage and rate-limit utilisation recorded at end of request. */
1415
- export type UsageContext = {
1416
- inputTokens: number;
1417
- outputTokens: number;
1418
- cacheCreationTokens: number;
1419
- cacheReadTokens: number;
1420
- reasoningTokens?: number;
1421
- rateLimitAfter5h?: number;
1422
- rateLimitAfter7d?: number;
1423
- };
1424
- /** Where a proxy env file path was sourced from. */
1425
- export type ProxyEnvSource = "cli" | "environment" | "default" | "none";
1426
- /** Result of resolving which proxy env file to load. */
1427
- export type ProxyEnvResolution = {
1428
- path?: string;
1429
- source: ProxyEnvSource;
1430
- required: boolean;
1431
- };
1432
- /** Result of loading the proxy env file. */
1433
- export type ProxyEnvLoadResult = {
1434
- loaded: boolean;
1435
- path?: string;
1436
- source: ProxyEnvSource;
1437
- };
1438
- /** Options controlling proxy env file resolution. */
1439
- export type ProxyEnvOptions = {
1440
- explicitEnvFile?: string;
1441
- env?: NodeJS.ProcessEnv;
1442
- homeDir?: string;
1443
- };
1444
- /** Snapshot of proxy-related environment variables captured at startup. */
1445
- export type ProxyEnvironmentSnapshot = {
1446
- httpsProxy?: string;
1447
- httpProxy?: string;
1448
- allProxy?: string;
1449
- socksProxy?: string;
1450
- noProxy?: string;
1451
- };
1452
- /** Result of a traffic-quiet check. */
1453
- export type QuietStatus = {
1454
- isQuiet: boolean;
1455
- lastActivityAt: Date | null;
1456
- silenceDurationMs: number;
1457
- };
1458
- /** In-process proxy request activity used to protect streaming restarts. */
1459
- export type ProxyActivitySnapshot = {
1460
- activeRequests: number;
1461
- lastActivityAt: Date | null;
1462
- };
1463
- /** Activity payload exposed by the running proxy status endpoint. */
1464
- export type ProxyRuntimeActivity = {
1465
- activeRequests: number;
1466
- lastActivityAt: string | null;
1467
- };
1468
- /** Terminal state observed while the HTTP adapter relays a response body. */
1469
- export type ProxyResponseTerminalOutcome = "completed" | "bodyless" | "client_cancelled" | "stream_error";
1470
- /** Non-blocking callbacks for response lifecycle metadata. */
1471
- export type ProxyResponseTrackingObserver = {
1472
- onFirstChunk?: (details: {
1473
- /** Decoded response-body bytes observed by the adapter. */
1474
- observedBodyBytes: number;
1475
- responseChunks: 1;
1476
- }) => void;
1477
- onTerminal?: (details: {
1478
- outcome: ProxyResponseTerminalOutcome;
1479
- /** Decoded response-body bytes observed by the adapter. */
1480
- observedBodyBytes: number;
1481
- responseChunks: number;
1482
- }) => void;
1483
- };
1484
- /** Versioned lifecycle event names persisted by the proxy adapter. */
1485
- export type ProxyLifecycleEventName = "request_accepted" | "response_headers" | "response_first_chunk" | "request_terminal";
1486
- /** Client-facing terminal classifications recorded by lifecycle metadata. */
1487
- export type ProxyLifecycleTerminalOutcome = ProxyResponseTerminalOutcome | "handler_error";
1488
- /** Content-free lifecycle event accepted by the bounded metadata logger. */
1489
- export type ProxyLifecycleEventInput = {
1490
- event: ProxyLifecycleEventName;
1491
- requestId: string;
1492
- method: string;
1493
- path: string;
1494
- model?: string;
1495
- stream?: boolean;
1496
- toolCount?: number;
1497
- sessionHash?: string;
1498
- requestBytes?: number;
1499
- responseStatus?: number;
1500
- /** Decoded response-body bytes observed by the adapter. */
1501
- observedBodyBytes?: number;
1502
- responseChunks?: number;
1503
- elapsedMs?: number;
1504
- terminalOutcome?: ProxyLifecycleTerminalOutcome;
1505
- errorType?: string;
1506
- errorCode?: string;
1507
- timestampMs?: number;
1508
- monotonicMs?: number;
1509
- };
1510
- /** Data-quality counters for the bounded lifecycle metadata sink. */
1511
- export type ProxyLifecycleLoggerSnapshot = {
1512
- enabled: boolean;
1513
- schemaVersion: number;
1514
- processInstanceId: string;
1515
- nextSequence: number;
1516
- attempted: number;
1517
- enqueued: number;
1518
- written: number;
1519
- dropped: number;
1520
- queueDrops: number;
1521
- invalidDrops: number;
1522
- writeDrops: number;
1523
- writeFailures: number;
1524
- /** Events requeued after a transient lifecycle metadata write failure. */
1525
- writeRetries: number;
1526
- pending: number;
1527
- inFlight: number;
1528
- flushing: boolean;
1529
- };
1530
- /** Lifecycle logger configuration. Queue overrides are used by stress tests. */
1531
- export type ProxyLifecycleLoggerOptions = {
1532
- enabled: boolean;
1533
- logDir?: string;
1534
- queueCapacity?: number;
1535
- batchSize?: number;
1536
- flushIntervalMs?: number;
1537
- /** Bounded retries for a metadata batch that cannot be appended immediately. */
1538
- maxWriteRetries?: number;
1539
- };
1540
- /** Serialized lifecycle line awaiting a bounded batch write. */
1541
- export type QueuedProxyLifecycleEvent = {
1542
- logDir: string;
1543
- date: string;
1544
- record: Record<string, unknown>;
1545
- writeRetries: number;
1546
- };
1547
- /** Percentile summary used by offline proxy log analysis. */
1548
- export type ProxyLatencySummary = {
1549
- count: number;
1550
- p50: number | null;
1551
- p95: number | null;
1552
- p99: number | null;
1553
- max: number | null;
1554
- };
1555
- /** Per-account request and rate-limit totals reconstructed from JSONL logs. */
1556
- export type ProxyAnalysisAccount = {
1557
- account: string;
1558
- accountType: string;
1559
- attempts: number;
1560
- attemptErrors: number;
1561
- finalRequests: number;
1562
- finalErrors: number;
1563
- transientRateLimits: number;
1564
- quotaRateLimits: number;
1565
- unclassifiedRateLimits: number;
1566
- };
1567
- /** Offline report generated from proxy request, attempt, and lifecycle logs. */
1568
- export type ProxyAnalysisStreamName = "lifecycle" | "requests" | "attempts" | "debug";
1569
- export type ProxyAnalysisReport = {
1570
- generatedAt: string;
1571
- since: string;
1572
- until: string;
1573
- logsDir: string;
1574
- files: {
1575
- lifecycle: number;
1576
- requests: number;
1577
- attempts: number;
1578
- debug: number;
1579
- };
1580
- coverage: {
1581
- lifecycle: boolean;
1582
- finalRequests: boolean;
1583
- attempts: boolean;
1584
- attemptLatency: boolean;
1585
- cacheUsage: boolean;
1586
- routingDecisions: boolean;
1587
- /** True only when every stream needed for cross-stream request/attempt
1588
- * reconciliation begins at or before the requested analysis window. */
1589
- comparableRequestAttempts: boolean;
1590
- };
1591
- dataQuality: {
1592
- linesRead: number;
1593
- malformedLines: number;
1594
- unsupportedLifecycleLines: number;
1595
- lifecycleSequenceGaps: number;
1596
- lifecycleSequenceDuplicates: number;
1597
- streams: Record<ProxyAnalysisStreamName, {
1598
- observedFrom: string | null;
1599
- observedTo: string | null;
1600
- startsAtOrBeforeRequestedWindow: boolean;
1601
- /** Whether this stream can support claims covering the full window. */
1602
- completeWindow: boolean;
1603
- }>;
1604
- bodyArtifacts: {
1605
- capturesIndexed: number;
1606
- artifactsReferenced: number;
1607
- artifactsPresent: number;
1608
- artifactsMissing: number;
1609
- invalidPaths: number;
1610
- writeFailures: number;
1611
- truncatedCaptures: number;
1612
- };
1613
- routingDecisions: {
1614
- valid: number;
1615
- invalid: number;
1616
- absent: number;
1617
- };
1618
- };
1619
- lifecycle: {
1620
- accepted: number;
1621
- headers: number;
1622
- firstChunks: number;
1623
- terminal: number;
1624
- unsettled: number;
1625
- terminalOutcomes: Record<string, number>;
1626
- errorTypes: Record<string, number>;
1627
- errorCodes: Record<string, number>;
1628
- };
1629
- requests: {
1630
- completed: number;
1631
- success: number;
1632
- errors: number;
1633
- finalRateLimits: number;
1634
- recoveredAfterRetry: number;
1635
- errorTypes: Record<string, number>;
1636
- errorCodes: Record<string, number>;
1637
- };
1638
- attempts: {
1639
- total: number;
1640
- errors: number;
1641
- errorTypes: Record<string, number>;
1642
- errorCodes: Record<string, number>;
1643
- transportScopes: Record<string, number>;
1644
- };
1645
- rateLimits: {
1646
- attemptRateLimits: number;
1647
- transient: number;
1648
- quota: number;
1649
- unclassified: number;
1650
- };
1651
- latencyMs: {
1652
- headers: ProxyLatencySummary;
1653
- firstChunk: ProxyLatencySummary;
1654
- terminal: ProxyLatencySummary;
1655
- finalRequest: ProxyLatencySummary;
1656
- attempt: ProxyLatencySummary;
1657
- singleAttemptDelta: ProxyLatencySummary;
1658
- };
1659
- cache: {
1660
- requestsWithUsage: number;
1661
- requestsWithCacheRead: number;
1662
- cacheReadTokens: number;
1663
- cacheCreationTokens: number;
1664
- inputTokens: number;
1665
- requestHitRate: number | null;
1666
- };
1667
- routing: {
1668
- modes: Record<string, number>;
1669
- selectionReasons: Record<string, number>;
1670
- initialAccounts: Record<string, number>;
1671
- finalAccountChanges: number;
1672
- finalOutsideCandidateSet: number;
1673
- /** Number of routing decisions aggregated before sampling records. */
1674
- totalRecords: number;
1675
- /** Most recent bounded sample retained for offline inspection. */
1676
- records: ProxyAnalysisRoutingRecord[];
1677
- };
1678
- accounts: ProxyAnalysisAccount[];
1679
- };
1680
- /** Inputs for the offline proxy JSONL analyzer. */
1681
- export type ProxyAnalysisOptions = {
1682
- logsDir?: string;
1683
- since?: string;
1684
- until?: string;
1685
- nowMs?: number;
1686
- };
1687
- /** Attempt timing retained while joining offline proxy log records. */
1688
- export type ProxyAnalysisAttemptRecord = {
1689
- count: number;
1690
- hadError: boolean;
1691
- totalDurationMs: number;
1692
- durationCount: number;
1693
- };
1694
- /** Final request fields retained while joining offline proxy log records. */
1695
- export type ProxyAnalysisFinalRequestRecord = {
1696
- timestamp: string;
1697
- status: number;
1698
- durationMs: number | null;
1699
- account: string;
1700
- accountType: string;
1701
- inputTokens: number | null;
1702
- cacheReadTokens: number | null;
1703
- cacheCreationTokens: number | null;
1704
- errorType: string | null;
1705
- errorCode: string | null;
1706
- routingDecision: ProxyAccountRoutingDecision | null;
1707
- };
1708
- /** Validated account-routing evidence joined to a final request log. */
1709
- export type ProxyAnalysisRoutingRecord = {
1710
- requestId: string;
1711
- timestamp: string;
1712
- responseStatus: number;
1713
- finalAccount: string;
1714
- finalAccountType: string;
1715
- decision: ProxyAccountRoutingDecision;
1716
- };
1717
- /** Request metadata retained by the HTTP adapter for terminal error logging. */
1718
- export type RuntimeRequestMetadata = {
1719
- requestId: string;
1720
- method: string;
1721
- path: string;
1722
- startedAt: number;
1723
- model: string;
1724
- stream: boolean;
1725
- toolCount: number;
1726
- /** Admission decision captured before an updater drain can race the route. */
1727
- rejectForUpdate?: boolean;
1728
- terminalErrorType?: string;
1729
- terminalErrorCode?: string;
1730
- };
1731
- /** Accumulated upstream body capture from a raw stream. */
1732
- export type RawStreamCapture = {
1733
- totalBytes: number;
1734
- text: string;
1735
- truncated: boolean;
1736
- };
1737
- /** Transformed stream pair used to capture upstream bodies without buffering. */
1738
- export type RawStreamCaptureResult = {
1739
- stream: TransformStream<Uint8Array, Uint8Array>;
1740
- capture: Promise<RawStreamCapture>;
1741
- };
1742
- /** Single captured body/headers entry written to disk by the proxy logger. */
1743
- export type ProxyBodyCaptureEntry = {
1744
- timestamp: string;
1745
- requestId: string;
1746
- phase: string;
1747
- model: string;
1748
- stream: boolean;
1749
- headers?: Record<string, string>;
1750
- body?: unknown;
1751
- bodySize?: number;
1752
- contentType?: string;
1753
- responseStatus?: number;
1754
- durationMs?: number;
1755
- account?: string;
1756
- accountType?: string;
1757
- attempt?: number;
1758
- traceId?: string;
1759
- spanId?: string;
1760
- metadata?: Record<string, unknown>;
1761
- };
1762
- /** JSON object retained in deterministic proxy replay artifacts. */
1763
- export type ProxyReplayJsonRecord = Record<string, unknown>;
1764
- /** One verified body-capture record in a proxy replay bundle. */
1765
- export type ProxyReplayCapture = {
1766
- timestamp: string;
1767
- phase: string;
1768
- attempt: number | null;
1769
- model: string | null;
1770
- stream: boolean | null;
1771
- account: string | null;
1772
- accountType: string | null;
1773
- responseStatus: number | null;
1774
- durationMs: number | null;
1775
- contentType: string | null;
1776
- headers: Record<string, string>;
1777
- body: string | null;
1778
- bodySha256: string | null;
1779
- bodyTruncated: boolean;
1780
- observedBodyBytes: number | null;
1781
- metadata: ProxyReplayJsonRecord | null;
1782
- source: {
1783
- indexFile: string;
1784
- indexLine: number;
1785
- artifactPath: string | null;
1786
- };
1787
- issues: string[];
1788
- };
1789
- /** Deterministic, redacted reconstruction of one captured proxy request. */
1790
- export type ProxyReplayBundle = {
1791
- schemaVersion: 1;
1792
- kind: "neurolink.proxy.replay-bundle";
1793
- requestId: string;
1794
- selectedAttempt: number;
1795
- source: {
1796
- logsDirectory: string;
1797
- indexFiles: string[];
1798
- };
1799
- completeness: {
1800
- captures: number;
1801
- phasesPresent: string[];
1802
- missingRequiredPhases: string[];
1803
- truncatedCaptures: number;
1804
- artifactsWithIssues: number;
1805
- replayable: boolean;
1806
- blockers: string[];
1807
- };
1808
- request: {
1809
- method: string;
1810
- url: string | null;
1811
- headers: Record<string, string>;
1812
- requiredHeaderInputs: string[];
1813
- body: string | null;
1814
- bodySha256: string | null;
1815
- bodyTruncated: boolean;
1816
- contentType: string | null;
1817
- account: string | null;
1818
- accountType: string | null;
1819
- model: string | null;
1820
- stream: boolean | null;
1821
- };
1822
- capturedResponse: ProxyReplayCapture | null;
1823
- captures: ProxyReplayCapture[];
1824
- };
1825
- /** Redacted direct-upstream response and comparison with captured evidence. */
1826
- export type ProxyReplayComparison = {
1827
- schemaVersion: 1;
1828
- kind: "neurolink.proxy.replay-comparison";
1829
- requestId: string;
1830
- selectedAttempt: number;
1831
- endpoint: string;
1832
- request: {
1833
- method: string;
1834
- headers: Record<string, string>;
1835
- bodySha256: string;
1836
- bodyBytes: number;
1837
- usedBodyOverride: boolean;
1838
- };
1839
- captured: {
1840
- status: number | null;
1841
- contentType: string | null;
1842
- bodySha256: string | null;
1843
- bodyBytes: number | null;
1844
- bodyTruncated: boolean;
1845
- jsonShape: string[] | null;
1846
- } | null;
1847
- direct: {
1848
- status: number;
1849
- headers: Record<string, string>;
1850
- contentType: string | null;
1851
- body: string;
1852
- bodySha256: string;
1853
- observedBodyBytes: number;
1854
- storedBodyBytes: number;
1855
- bodyTruncated: boolean;
1856
- timeToHeadersMs: number;
1857
- totalMs: number;
1858
- jsonShape: string[] | null;
1859
- };
1860
- comparison: {
1861
- statusMatches: boolean | null;
1862
- contentTypeMatches: boolean | null;
1863
- bodyHashMatches: boolean | null;
1864
- jsonShapeMatches: boolean | null;
1865
- };
1866
- };
1867
- /** Inputs for deterministic proxy replay bundle export. */
1868
- export type ExportProxyReplayOptions = {
1869
- requestId: string;
1870
- logsDir?: string;
1871
- attempt?: number;
1872
- };
1873
- /** Inputs for an explicitly authorized direct-upstream comparison. */
1874
- export type CompareProxyReplayOptions = {
1875
- execute: boolean;
1876
- headerValues?: Record<string, string>;
1877
- bodyOverride?: string;
1878
- urlOverride?: string;
1879
- timeoutMs?: number;
1880
- now?: () => number;
1881
- fetchImpl?: typeof fetch;
1882
- };
1883
- /** Persisted artifact produced when a body is stored to disk. */
1884
- export type StoredBodyArtifact = {
1885
- bodyPath?: string;
1886
- bodySha256?: string;
1887
- redactedBodyBytes?: number;
1888
- storedFileBytes?: number;
1889
- redactedBody?: string;
1890
- bodyTruncated?: boolean;
1891
- bodyWriteFailed?: boolean;
1892
- };
1893
- /** File the proxy logger tracks for rotation and cleanup. */
1894
- export type ManagedLogFile = {
1895
- path: string;
1896
- mtime: number;
1897
- size: number;
1898
- };
1899
- /** Individual content block observed during an SSE stream. */
1900
- export type SSEContentBlock = {
1901
- index: number;
1902
- type: "text" | "thinking" | "tool_use" | "tool_result";
1903
- /** Accumulated text for text blocks. Capped at MAX_BLOCK_CONTENT_BYTES. */
1904
- text?: string;
1905
- /** Accumulated thinking content. Capped at MAX_BLOCK_CONTENT_BYTES. */
1906
- thinking?: string;
1907
- /** Tool name for tool_use blocks. */
1908
- toolName?: string;
1909
- /** Tool call id for tool_use blocks. */
1910
- toolId?: string;
1911
- /** Accumulated partial JSON input for tool_use blocks. Capped at MAX_BLOCK_CONTENT_BYTES. */
1912
- toolInput?: string;
1913
- };
1914
- /** Aggregated telemetry resolved when an SSE stream completes. */
1915
- export type SSETelemetry = {
1916
- messageId: string;
1917
- model: string;
1918
- usage: {
1919
- inputTokens: number;
1920
- outputTokens: number;
1921
- cacheCreationInputTokens: number;
1922
- cacheReadInputTokens: number;
1923
- totalTokens: number;
1924
- };
1925
- contentBlocks: SSEContentBlock[];
1926
- stopReason: string | null;
1927
- stopSequence: string | null;
1928
- eventCount: number;
1929
- streamDurationMs: number;
1930
- totalBytesReceived: number;
1931
- events: Array<{
1932
- type: string;
1933
- timestamp: number;
1934
- data: string;
1935
- }>;
1936
- /** Error carried as a terminal SSE `event: error`, if one was observed. */
1937
- streamErrorMessage?: string;
1938
- rawText?: string;
1939
- };
1940
- /** Terminal outcome of a response body after the HTTP headers were sent. */
1941
- export type StreamTerminalOutcome = {
1942
- kind: "completed";
1943
- } | {
1944
- kind: "upstream_error";
1945
- message: string;
1946
- } | {
1947
- kind: "client_cancelled";
1948
- };
1949
- /** First-writer-wins tracker for an upstream streaming response. */
1950
- export type StreamTerminalOutcomeTracker = {
1951
- outcome: Promise<StreamTerminalOutcome>;
1952
- complete: () => void;
1953
- fail: (message: string) => void;
1954
- cancel: () => void;
1955
- };
1956
- /** Mutable accumulator the SSE interceptor uses internally. */
1957
- export type TelemetryAccumulator = {
1958
- messageId: string;
1959
- model: string;
1960
- inputTokens: number;
1961
- outputTokens: number;
1962
- cacheCreationInputTokens: number;
1963
- cacheReadInputTokens: number;
1964
- contentBlocks: SSEContentBlock[];
1965
- blockByteCounts: Map<number, number>;
1966
- stopReason: string | null;
1967
- stopSequence: string | null;
1968
- eventCount: number;
1969
- startTime: number;
1970
- totalBytesReceived: number;
1971
- events: Array<{
1972
- type: string;
1973
- timestamp: number;
1974
- data: string;
1975
- }>;
1976
- rawTextChunks?: string[];
1977
- rawTextBytes: number;
1978
- rawTextTruncated: boolean;
1979
- eventLogTruncated: boolean;
1980
- streamErrorMessage?: string;
1981
- };
1982
- /** Result of createSSEInterceptor: the pass-through stream and a telemetry promise. */
1983
- export type SSEInterceptorResult = {
1984
- stream: TransformStream<Uint8Array, Uint8Array>;
1985
- telemetry: Promise<SSETelemetry>;
1986
- };
1987
- /** Options for createSSEInterceptor. */
1988
- export type SSEInterceptorOptions = {
1989
- captureRawText?: boolean;
1990
- };
1991
- /** Outcome of a proxy auto-update version check against npm. */
1992
- export type UpdateCheckResult = {
1993
- currentVersion: string;
1994
- latestVersion: string;
1995
- updateAvailable: boolean;
1996
- };
1997
- /** Result of one local proxy health probe by the updater or fail-open guard. */
1998
- export type ProxyHealthProbe = {
1999
- healthy: boolean;
2000
- durationMs: number;
2001
- failure: "http_status" | "network" | "timeout" | null;
2002
- statusCode: number | null;
2003
- errorCode: string | null;
2004
- };
2005
- /** Parsed major.minor.patch components of a semver string. */
2006
- export type SemVer = {
2007
- major: number;
2008
- minor: number;
2009
- patch: number;
2010
- };
2011
- /** Entry describing a version suppressed from auto-update. */
2012
- export type SuppressedVersion = {
2013
- suppressedAt: string;
2014
- reason: string;
2015
- };
2016
- /** Persisted state for the proxy auto-update feature. */
2017
- export type UpdateState = {
2018
- lastCheckAt: string;
2019
- lastCheckVersion: string;
2020
- suppressedVersions: Record<string, SuppressedVersion>;
2021
- /**
2022
- * Last package version whose stable trampoline was successfully validated.
2023
- *
2024
- * Optional because `UpdateState` is part of the published type surface and a
2025
- * required addition would break every downstream object literal — and because
2026
- * state files written before this field existed legitimately omit it.
2027
- * `loadUpdateState()` always materializes it, so runtime readers see a value.
2028
- */
2029
- installedVersion?: string | null;
2030
- lastUpdateAt: string | null;
2031
- lastUpdateVersion: string | null;
2032
- /** Installed by the updater but not yet confirmed as the running version. */
2033
- pendingRestartVersion: string | null;
2034
- /** Why an available update has not yet reached a safe install/restart boundary. */
2035
- deferredUpdate: {
2036
- version: string;
2037
- since: string;
2038
- updatedAt: string;
2039
- reason: "waiting_for_quiet" | "draining" | "drain_timeout" | "drain_unavailable" | "activity_unavailable";
2040
- activeRequests: number | null;
2041
- } | null;
2042
- /** Last updater failure, retained until a successful update or replacement. */
2043
- lastFailure: {
2044
- at: string;
2045
- version: string;
2046
- stage: "check" | "install" | "validation" | "restart" | "health";
2047
- message: string;
2048
- } | null;
2049
- };
2050
- /** Result from waiting for a non-disruptive updater execution window. */
2051
- export type ProxyUpdateWindowResult = {
2052
- ready: boolean;
2053
- draining: boolean;
2054
- reason?: "stopping" | "parent_stopped" | "drain_failed" | "drain_timeout";
2055
- };
2056
- /** Dependencies and timing controls for the updater's safe-window coordinator. */
2057
- export type ProxyUpdateWindowOptions = {
2058
- quietThresholdMs: number;
2059
- quietWaitMs: number;
2060
- drainWaitMs: number;
2061
- pollIntervalMs: number;
2062
- getActivity: () => Promise<ProxyRuntimeActivity | null>;
2063
- setDraining: (draining: boolean) => Promise<boolean>;
2064
- isStopping: () => boolean;
2065
- isParentAlive: () => boolean;
2066
- onPhase?: (phase: "waiting_for_quiet" | "draining" | "drain_timeout", activity: ProxyRuntimeActivity | null) => void;
2067
- now?: () => number;
2068
- sleep?: (ms: number) => Promise<void>;
2069
- };
2070
- /** Result of validating a newly installed CLI through the stable trampoline. */
2071
- export type InstalledVersionValidation = {
2072
- version?: string;
2073
- attempts: number;
2074
- failure?: string;
2075
- };
2076
- /** Supported global package managers for proxy self-updates. */
2077
- export type GlobalInstallerKind = "npm" | "pnpm";
2078
- /** Result of probing one global package-manager executable. */
2079
- export type GlobalInstallerProbe = {
2080
- kind: GlobalInstallerKind;
2081
- bin: string;
2082
- version?: string;
2083
- globalRoot?: string;
2084
- globalBinDir?: string;
2085
- working: boolean;
2086
- installable: boolean;
2087
- matchesCurrentInstall: boolean;
2088
- reason?: string;
2089
- };
2090
- /** Selected package manager plus all candidates considered. */
2091
- export type GlobalInstallerResolution = {
2092
- installer?: GlobalInstallerProbe;
2093
- tried: GlobalInstallerProbe[];
2094
- };
2095
- /** Injectable command runner used by global-installer tests. */
2096
- export type GlobalInstallerExecFile = typeof import("node:child_process").execFileSync;
2097
- /** Overrides used while resolving the global package manager. */
2098
- export type ResolveGlobalInstallerOptions = {
2099
- entryScript?: string;
2100
- env?: NodeJS.ProcessEnv;
2101
- homeDir?: string;
2102
- execFileSync?: GlobalInstallerExecFile;
2103
- };
2104
- /** Options for validating a newly installed CLI through its stable executable. */
2105
- export type ValidateInstalledVersionOptions = {
2106
- binPath: string;
2107
- expectedVersion: string;
2108
- maxAttempts?: number;
2109
- delayMs?: number;
2110
- timeoutMs?: number;
2111
- execFileSync?: GlobalInstallerExecFile;
2112
- sleep?: (ms: number) => Promise<void>;
2113
- };
2114
- /** Dependencies and callbacks used to supervise the updater worker process. */
2115
- export type UpdaterWorkerSupervisorOptions = {
2116
- spawnWorker: () => number | undefined;
2117
- isProcessRunning: (pid: number) => boolean;
2118
- stopWorker: (pid: number) => void;
2119
- onPidChange?: (pid: number | undefined) => void;
2120
- log?: (message: string) => void;
2121
- intervalMs?: number;
2122
- };
2123
- /** Handle used by the proxy process to inspect and stop updater supervision. */
2124
- export type UpdaterWorkerSupervisor = {
2125
- currentPid: () => number | undefined;
2126
- checkNow: () => number | undefined;
2127
- stop: () => void;
2128
- };
2129
- export type ProxyWorkerControlMessage = {
2130
- type: "proxy-worker:activate";
2131
- generation: number;
2132
- } | {
2133
- type: "proxy-worker:drain";
2134
- generation: number;
2135
- } | {
2136
- type: "proxy-worker:shutdown";
2137
- generation: number;
2138
- } | {
2139
- type: "proxy-worker:socket-commit";
2140
- generation: number;
2141
- socketId: string;
2142
- } | {
2143
- type: "proxy-worker:socket-cancel";
2144
- generation: number;
2145
- socketId: string;
2146
- };
2147
- export type ProxyWorkerStatusMessage = {
2148
- type: "proxy-worker:ready";
2149
- generation: number;
2150
- pid: number;
2151
- version: string;
2152
- } | {
2153
- type: "proxy-worker:drained";
2154
- generation: number;
2155
- pid: number;
2156
- } | {
2157
- type: "proxy-worker:activated";
2158
- generation: number;
2159
- pid: number;
2160
- } | {
2161
- type: "proxy-worker:fatal";
2162
- generation: number;
2163
- pid: number;
2164
- message: string;
2165
- } | {
2166
- type: "proxy-worker:socket-accepted";
2167
- generation: number;
2168
- pid: number;
2169
- socketId: string;
2170
- } | {
2171
- type: "proxy-worker:replacement-requested";
2172
- generation: number;
2173
- pid: number;
2174
- reason: "environment";
2175
- };
2176
- export type ProxyWorkerSocketMessage = {
2177
- type: "proxy-worker:socket";
2178
- generation: number;
2179
- socketId: string;
2180
- };
2181
- export type ProxyWorkerIpcMessage = ProxyWorkerControlMessage | ProxyWorkerStatusMessage | ProxyWorkerSocketMessage;
2182
- export type TransferableProxySocket = Pick<import("node:net").Socket, "destroy" | "end" | "pause" | "resume" | "once">;
2183
- /** A transferred socket whose temporary handoff listeners can be detached. */
2184
- export type DetachableTransferableProxySocket = TransferableProxySocket & Pick<import("node:net").Socket, "off">;
2185
- export type RollingWorkerHandle = {
2186
- pid: number;
2187
- sendControl: (message: ProxyWorkerControlMessage) => void;
2188
- sendSocket: (generation: number, socket: TransferableProxySocket, callback: (error?: Error | null) => void) => void;
2189
- terminate: (signal?: NodeJS.Signals) => void;
2190
- onMessage: (listener: (message: ProxyWorkerStatusMessage) => void) => () => void;
2191
- onExit: (listener: (code: number | null, signal: string | null) => void) => () => void;
2192
- };
2193
- export type SpawnProxySocketWorkerOptions = {
2194
- generation: number;
2195
- expectedVersion: string;
2196
- command: string;
2197
- args: string[];
2198
- env?: NodeJS.ProcessEnv;
2199
- stdout?: "inherit" | "ignore";
2200
- stderr?: "inherit" | "ignore";
2201
- socketAckTimeoutMs?: number;
2202
- };
2203
- export type RollingWorkerFailureDetails = {
2204
- workerPid?: number;
2205
- workerExitCode?: number | null;
2206
- workerExitSignal?: string | null;
2207
- supervisorAction?: "none" | "sigkill_after_transfer_failure";
2208
- };
2209
- export type RollingWorkerSupervisorEvent = {
2210
- at: string;
2211
- type: "activated" | "failure" | "failed_transfer" | "rejected_socket";
2212
- generation: number | null;
2213
- version: string | null;
2214
- phase?: "startup" | "activation" | "runtime" | "transfer";
2215
- reason?: string;
2216
- };
2217
- export type RollingWorkerSupervisorSnapshot = {
2218
- generation: number;
2219
- active: {
2220
- pid: number;
2221
- version: string;
2222
- generation: number;
2223
- } | null;
2224
- candidate: {
2225
- pid: number;
2226
- expectedVersion: string;
2227
- generation: number;
2228
- } | null;
2229
- draining: Array<{
2230
- pid: number;
2231
- version: string;
2232
- generation: number;
2233
- }>;
2234
- queuedSockets: number;
2235
- rejectedSockets: number;
2236
- failedTransfers: number;
2237
- /** Bounded generation-scoped evidence for attributing lifetime counters. */
2238
- recentEvents: RollingWorkerSupervisorEvent[];
2239
- lastFailure: ({
2240
- at: string;
2241
- generation: number;
2242
- version: string;
2243
- phase: "startup" | "activation" | "runtime" | "transfer";
2244
- message: string;
2245
- } & RollingWorkerFailureDetails) | null;
2246
- };
2247
- export type RollingWorkerSupervisorOptions = {
2248
- spawnWorker: (generation: number, expectedVersion: string) => RollingWorkerHandle;
2249
- readyTimeoutMs?: number;
2250
- socketQueueLimit?: number;
2251
- socketQueueTimeoutMs?: number;
2252
- shutdownTimeoutMs?: number;
2253
- onStateChange?: (snapshot: RollingWorkerSupervisorSnapshot) => void;
2254
- onReplacementRequested?: (request: {
2255
- generation: number;
2256
- pid: number;
2257
- reason: "environment";
2258
- }) => void;
2259
- log?: (message: string) => void;
2260
- };
2261
- export type RollingProxyServerOptions = {
2262
- host: string;
2263
- port: number;
2264
- initialVersion: string;
2265
- spawnWorker: (generation: number, expectedVersion: string) => RollingWorkerHandle;
2266
- readyTimeoutMs?: number;
2267
- socketQueueLimit?: number;
2268
- socketQueueTimeoutMs?: number;
2269
- shutdownTimeoutMs?: number;
2270
- recoveryDelayMs?: number;
2271
- maxRecoveryDelayMs?: number;
2272
- onStateChange?: (snapshot: RollingWorkerSupervisorSnapshot) => void;
2273
- log?: (message: string) => void;
2274
- };
2275
- export type RollingProxyServer = {
2276
- address: {
2277
- host: string;
2278
- port: number;
2279
- };
2280
- replace: (expectedVersion: string) => Promise<RollingWorkerSupervisorSnapshot>;
2281
- snapshot: () => RollingWorkerSupervisorSnapshot;
2282
- close: () => Promise<void>;
2283
- };
2284
- export type RollingManagedWorker = {
2285
- handle: RollingWorkerHandle;
2286
- generation: number;
2287
- version: string;
2288
- dispose: () => void;
2289
- pendingTransfers: number;
2290
- drainRequested: boolean;
2291
- };
2292
- export type RollingCandidateWorker = RollingManagedWorker & {
2293
- expectedVersion: string;
2294
- activationRequested: boolean;
2295
- settle: (error?: Error) => void;
2296
- };
2297
- export type RollingQueuedSocket = {
2298
- socket: TransferableProxySocket;
2299
- timeout: NodeJS.Timeout;
2300
- };
2301
- export type SocketWorkerRuntime = {
2302
- acceptSocket: (socket: TransferableProxySocket) => void;
2303
- drain: () => void;
2304
- close: () => void;
2305
- snapshot: () => {
2306
- draining: boolean;
2307
- sockets: number;
2308
- activeRequests: number;
2309
- drained: boolean;
2310
- };
2311
- };
2312
- export type SocketWorkerRuntimeOptions = {
2313
- onDrained?: () => void;
2314
- };
2315
- /** Shape of the dynamically-imported js-yaml module. `dump` is optional —
2316
- * read-only consumers (proxy config loader) only need `load`; writers
2317
- * (CLI primary-account commands) check `dump` before calling. */
2318
- export type YamlModule = {
2319
- load(content: string): unknown;
2320
- dump?: (obj: unknown, opts?: Record<string, unknown>) => string;
2321
- default?: {
2322
- load(content: string): unknown;
2323
- dump?: (obj: unknown, opts?: Record<string, unknown>) => string;
2324
- };
2325
- };
2326
- /** Snapshot of a parsed proxy config file used by CLI primary-account
2327
- * read/edit/write helpers. Tracks the original format and whether comments
2328
- * were present (so the CLI can warn that comments will not round-trip). */
2329
- export type CliProxyConfigDoc = {
2330
- data: Record<string, unknown>;
2331
- format: "yaml" | "json";
2332
- hadComments: boolean;
2333
- };
2334
- /** Primary-account info exposed by the proxy `/status` endpoint.
2335
- * `source` is "configured" when the operator's `routing.primaryAccount` is
2336
- * authenticated and enabled, otherwise "fallback" — either no primary set
2337
- * or the configured one is missing/disabled. */
2338
- export type ProxyStatusPrimaryAccount = {
2339
- configured: string | null;
2340
- key: string | null;
2341
- label: string | null;
2342
- source: "configured" | "fallback";
2343
- };
2344
- /** Parsed fields captured from a Claude Code client request body. */
2345
- export type ClaudeSnapshotBody = {
2346
- metadataUserId?: string;
2347
- billingHeader?: string;
2348
- agentBlock?: string;
2349
- sessionId?: string;
2350
- };
2351
- /** Snapshot of headers and body from a Claude Code request, used for polyfill. */
2352
- export type ClaudeSnapshot = {
2353
- accountKey: string;
2354
- capturedAt: string;
2355
- source: "claude-code";
2356
- headers: Record<string, string>;
2357
- body?: ClaudeSnapshotBody;
2358
- };
2359
- /** Parsed shape of a Claude API error body. */
2360
- export type ParsedClaudeError = {
2361
- errorType?: string;
2362
- message?: string;
2363
- /** `error.details.error_code`, e.g. "oauth_not_allowed_for_organization".
2364
- * Absent on payloads that carry no details object. */
2365
- errorCode?: string;
2366
- };
2367
- /**
2368
- * Accounts rejected by an organization/plan entitlement policy during a single
2369
- * request. Anthropic answers such an account with a `permission_error` that no
2370
- * amount of retrying or token refreshing can fix, but which a *different*
2371
- * account may not hit at all — so it drives rotation, and is reported to the
2372
- * client only once every account has been tried.
2373
- */
2374
- export type AnthropicEntitlementFailure = {
2375
- status: number;
2376
- /** Labels of every account that rejected this request on entitlement. */
2377
- accounts: string[];
2378
- /** Upstream message from the first such rejection. */
2379
- message: string;
2380
- errorCode?: string;
2381
- };
2382
- /**
2383
- * Every account's model-scoped window for the requested model is spent. Unlike
2384
- * a cooldown this is per-model: the same accounts stay healthy for every other
2385
- * model, so the client is told to switch model rather than to back off.
2386
- */
2387
- export type AnthropicScopedExhaustion = {
2388
- /** Wire model id from the request. */
2389
- model: string;
2390
- /** Display name of the exhausted window, e.g. "Fable". */
2391
- scopeModel: string;
2392
- /** Epoch ms of the soonest reset across the exhausted accounts. */
2393
- earliestResetMs: number;
2394
- accounts: string[];
2395
- /** Provider reason overage is unavailable, e.g. "org_level_disabled". */
2396
- overageDisabledReason?: string;
2397
- };
2398
- /** ora spinner instance held by proxy CLI commands, nullable when --quiet. */
2399
- export type ProxySpinner = Ora | null;
2400
- /** Load-balancing strategy used by the proxy across accounts. */
2401
- export type ProxyStartStrategy = "round-robin" | "fill-first";
2402
- /** Alias for the model router's constructor configuration. */
2403
- export type ProxyModelRouterConfig = ProxyRoutingConfig;
2404
- /** Partial proxy config consumed by the start command. */
2405
- export type LoadedProxyConfig = {
2406
- routing?: Partial<ProxyModelRouterConfig> & {
2407
- strategy?: ProxyStartStrategy;
2408
- };
2409
- };
2410
- /** Routing values captured once when a proxy request begins. */
2411
- export type ProxyRequestRoutingSnapshot = {
2412
- generation: number;
2413
- strategy: ProxyStartStrategy;
2414
- modelRouter?: ModelRouterInterface;
2415
- passthrough: boolean;
2416
- primaryAccountKey?: string;
2417
- accountAllowlist?: ReadonlySet<string>;
2418
- quotaRoutingEnabled: boolean;
2419
- sessionSoftLimit: number;
2420
- sessionResetToleranceMs: number;
2421
- /** Operator policy on spending paid extra usage once a subscription window is
2422
- * spent. Only "never" can override the provider's own signal. */
2423
- useOverage: ProxyOveragePolicy;
2424
- };
2425
- /** Operator policy for paid extra usage. */
2426
- export type ProxyOveragePolicy = "auto" | "always" | "never";
2427
- /** Immutable last-known-good proxy configuration published at runtime. */
2428
- export type ProxyRuntimeConfigSnapshot = ProxyRequestRoutingSnapshot & {
2429
- loadedAt: string;
2430
- configHash: string;
2431
- proxyConfig: LoadedProxyConfig | null;
2432
- };
2433
- /** Source that requested a runtime configuration reload. */
2434
- export type ProxyRuntimeConfigReloadSource = "startup" | "watch" | "sighup" | "manual";
2435
- /** Result returned after a serialized runtime configuration reload attempt. */
2436
- export type ProxyRuntimeConfigReloadResult = {
2437
- applied: boolean;
2438
- changed: boolean;
2439
- generation: number;
2440
- environmentChanged?: boolean;
2441
- error?: string;
2442
- };
2443
- /** Safe runtime configuration diagnostics exposed through proxy status. */
2444
- export type ProxyRuntimeConfigStatus = {
2445
- configPath: string;
2446
- envFilePath?: string;
2447
- generation: number;
2448
- loadedAt: string;
2449
- configHash: string;
2450
- watching: boolean;
2451
- lastReloadAttemptAt?: string;
2452
- lastReloadAt?: string;
2453
- lastReloadSource?: ProxyRuntimeConfigReloadSource;
2454
- lastReloadError?: string;
2455
- consecutiveFailures: number;
2456
- };
2457
- /** Constructor options for the proxy runtime configuration store. */
2458
- export type ProxyRuntimeConfigStoreOptions = {
2459
- configPath: string;
2460
- configRequired: boolean;
2461
- envFilePath?: string;
2462
- envFileRequired?: boolean;
2463
- baseEnv: Record<string, string | undefined>;
2464
- strategyOverride?: ProxyStartStrategy;
2465
- passthrough: boolean;
2466
- watchIntervalMs?: number;
2467
- watchDebounceMs?: number;
2468
- };
2469
- /** Runtime configuration provider captured by route factories. */
2470
- export type ProxyRuntimeConfigProvider = () => ProxyRequestRoutingSnapshot;
2471
- /** Optional runtime configuration wiring for Claude proxy route factories. */
2472
- export type ClaudeProxyRouteRuntimeOptions = {
2473
- accountAllowlist?: AccountAllowlist;
2474
- runtimeConfigProvider: ProxyRuntimeConfigProvider;
2475
- };
2476
- /** Listener invoked after a new configuration generation is published. */
2477
- export type ProxyRuntimeConfigListener = (snapshot: ProxyRuntimeConfigSnapshot) => void;
2478
- /** Listener invoked after every successful or rejected reload attempt. */
2479
- export type ProxyRuntimeConfigReloadListener = (result: ProxyRuntimeConfigReloadResult, status: ProxyRuntimeConfigStatus) => void;
2480
- /**
2481
- * Handle for a NeuroLink runtime created by the proxy start command.
2482
- * The `neurolink` field is typed structurally (only the method used by the
2483
- * proxy layer is exposed) so types/proxy.ts does not depend on the full
2484
- * NeuroLink class.
2485
- */
2486
- export type ProxyNeurolinkRuntime = {
2487
- neurolink: {
2488
- getToolRegistry(): MCPToolRegistry;
2489
- };
2490
- logsDir: string;
2491
- };
2492
- /** Data passed to the isolated proxy log-retention worker. */
2493
- export type ProxyLogCleanupWorkerData = {
2494
- logsDir: string;
2495
- maxAgeDays: number;
2496
- maxSizeMb: number;
2497
- };
2498
- /** Lifecycle handle for non-blocking proxy log retention. */
2499
- export type ProxyLogCleanupScheduler = {
2500
- trigger: () => boolean;
2501
- stop: () => Promise<void>;
2502
- };
2503
- /** Hono app + readiness state created by the proxy start command. */
2504
- export type ProxyStartApp = {
2505
- app: Hono;
2506
- readiness: ProxyReadinessState;
2507
- };
2508
- /** Stats shape consumed by the proxy status printer. */
2509
- export type StatusStats = {
2510
- startedAt?: number;
2511
- totalAttempts?: number;
2512
- totalAttemptErrors?: number;
2513
- totalRequests: number;
2514
- totalSuccess: number;
2515
- totalErrors: number;
2516
- totalRateLimits: number;
2517
- totalTransientRateLimits?: number;
2518
- totalQuotaRateLimits?: number;
2519
- terminalErrors?: ProxyTerminalErrorJournal;
2520
- lastTerminalError?: ProxyTerminalErrorSummary | null;
2521
- terminalErrorDetailsComparable?: boolean;
2522
- terminalErrorDetailsMissing?: number;
2523
- terminalErrorDetailsExcess?: number;
2524
- /** Whether this status response reconciled shared state or used local memory. */
2525
- snapshotSource?: "reconciled" | "memory";
2526
- accounts?: {
2527
- label: string;
2528
- type: string;
2529
- attempts?: number;
2530
- requests?: number;
2531
- success?: number;
2532
- errors?: number;
2533
- attemptErrors?: number;
2534
- rateLimits?: number;
2535
- transientRateLimits?: number;
2536
- quotaRateLimits?: number;
2537
- cooling: boolean;
2538
- allowed?: boolean;
2539
- expired?: boolean;
2540
- status?: "active" | "cooling" | "disabled" | "expired" | "excluded" | "removed" | "internal" | "unattributed";
2541
- }[];
2542
- persistence?: ProxyStatsPersistenceStatus;
2543
- };
2544
- /** Sub-action of the `proxy telemetry` CLI command. */
2545
- export type ProxyTelemetryAction = "setup" | "start" | "stop" | "status" | "logs" | "import-dashboard";
2546
- /** Wire format a proxy request is using. */
2547
- export type ProxyFormat = "claude" | "openai";
2548
- /**
2549
- * Common adapter interface that hides the differences between
2550
- * Claude and OpenAI stream serializers from the unified translation engine.
2551
- */
2552
- export type StreamSerializerAdapter = {
2553
- start(): Iterable<string>;
2554
- pushDelta(text: string): Iterable<string>;
2555
- pushToolUse(id: string, name: string, input: unknown): Iterable<string>;
2556
- finish(finishReason: string, usage: {
2557
- input: number;
2558
- output: number;
2559
- total: number;
2560
- }): Iterable<string>;
2561
- emitError(message: string): Iterable<string>;
2562
- };
2563
- /** OpenAI content part in a user message. */
2564
- export type OpenAIContentPartText = {
2565
- type: "text";
2566
- text: string;
2567
- };
2568
- export type OpenAIContentPartImage = {
2569
- type: "image_url";
2570
- image_url: {
2571
- url: string;
2572
- detail?: "auto" | "low" | "high";
2573
- };
2574
- };
2575
- export type OpenAIContentPart = OpenAIContentPartText | OpenAIContentPartImage;
2576
- /** OpenAI message types. */
2577
- export type OpenAISystemMessage = {
2578
- role: "system";
2579
- content: string;
2580
- };
2581
- export type OpenAIUserMessage = {
2582
- role: "user";
2583
- content: string | OpenAIContentPart[];
2584
- };
2585
- export type OpenAIAssistantMessage = {
2586
- role: "assistant";
2587
- content?: string | null;
2588
- tool_calls?: OpenAIToolCall[];
2589
- };
2590
- export type OpenAIToolMessage = {
2591
- role: "tool";
2592
- tool_call_id: string;
2593
- content: string;
2594
- };
2595
- export type OpenAIMessage = OpenAISystemMessage | OpenAIUserMessage | OpenAIAssistantMessage | OpenAIToolMessage;
2596
- /** OpenAI tool call (in assistant messages and responses). */
2597
- export type OpenAIToolCall = {
2598
- id: string;
2599
- type: "function";
2600
- function: {
2601
- name: string;
2602
- arguments: string;
2603
- };
2604
- };
2605
- /** OpenAI tool definition. */
2606
- export type OpenAIToolDef = {
2607
- type: "function";
2608
- function: {
2609
- name: string;
2610
- description?: string;
2611
- parameters: Record<string, unknown>;
2612
- };
2613
- };
2614
- /** OpenAI tool_choice options. */
2615
- export type OpenAIToolChoice = "auto" | "required" | "none" | {
2616
- type: "function";
2617
- function: {
2618
- name: string;
2619
- };
2620
- };
2621
- /** OpenAI Chat Completions request body. */
2622
- export type OpenAICompletionRequest = {
2623
- model: string;
2624
- messages: OpenAIMessage[];
2625
- tools?: OpenAIToolDef[];
2626
- tool_choice?: OpenAIToolChoice;
2627
- stream?: boolean;
2628
- temperature?: number;
2629
- top_p?: number;
2630
- max_tokens?: number;
2631
- max_completion_tokens?: number;
2632
- stop?: string | string[];
2633
- n?: number;
2634
- response_format?: {
2635
- type: "text" | "json_object" | "json_schema";
2636
- json_schema?: unknown;
2637
- };
2638
- stream_options?: {
2639
- include_usage?: boolean;
2640
- };
2641
- };
2642
- /** OpenAI usage counters. */
2643
- export type OpenAIUsage = {
2644
- prompt_tokens: number;
2645
- completion_tokens: number;
2646
- total_tokens: number;
2647
- };
2648
- /** OpenAI non-streaming response. */
2649
- export type OpenAICompletionResponse = {
2650
- id: string;
2651
- object: "chat.completion";
2652
- created: number;
2653
- model: string;
2654
- choices: Array<{
2655
- index: number;
2656
- message: {
2657
- role: "assistant";
2658
- content: string | null;
2659
- tool_calls?: OpenAIToolCall[];
2660
- };
2661
- finish_reason: "stop" | "tool_calls" | "length" | "content_filter" | null;
2662
- }>;
2663
- usage: OpenAIUsage;
2664
- };
2665
- /** OpenAI streaming chunk. */
2666
- export type OpenAIStreamChunk = {
2667
- id: string;
2668
- object: "chat.completion.chunk";
2669
- created: number;
2670
- model: string;
2671
- choices: Array<{
2672
- index: number;
2673
- delta: {
2674
- role?: "assistant";
2675
- content?: string;
2676
- tool_calls?: Array<{
2677
- index: number;
2678
- id?: string;
2679
- type?: "function";
2680
- function?: {
2681
- name?: string;
2682
- arguments?: string;
2683
- };
2684
- }>;
2685
- };
2686
- finish_reason: string | null;
2687
- }>;
2688
- usage?: OpenAIUsage;
2689
- };
2690
- /** OpenAI error response. */
2691
- export type OpenAIErrorResponse = {
2692
- error: {
2693
- message: string;
2694
- type: string;
2695
- code: string | null;
2696
- };
2697
- };
2698
- /** Parsed OpenAI request — intermediate form for NeuroLink pipeline. */
2699
- export type ParsedOpenAIRequest = {
2700
- model: string;
2701
- maxTokens?: number;
2702
- temperature?: number;
2703
- topP?: number;
2704
- systemPrompt?: string;
2705
- stream: boolean;
2706
- prompt: string;
2707
- images: string[];
2708
- conversationMessages: Array<{
2709
- role: string;
2710
- content: string;
2711
- }>;
2712
- tools: Record<string, {
2713
- description?: string;
2714
- inputSchema: unknown;
2715
- execute?: (...args: unknown[]) => unknown;
2716
- }>;
2717
- toolChoice?: "auto" | "required" | "none";
2718
- toolChoiceName?: string;
2719
- stopSequences?: string[];
2720
- responseFormat?: {
2721
- type: string;
2722
- jsonSchema?: unknown;
2723
- };
2724
- };