@tonyclaw/agent-inspector 3.1.32 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (373) hide show
  1. package/.output/backend/nitro.json +1 -1
  2. package/.output/cli.js +241 -120
  3. package/.output/server/_ssr/index.mjs +1 -1
  4. package/.output/server/_ssr/{router-oXUk3MBR.mjs → router-BBY_zWRK.mjs} +91 -3
  5. package/.output/server/index.mjs +1 -1
  6. package/.output/ui/assets/{CompareDrawer-BtfPSpkV.js → CompareDrawer-rtNElN-B.js} +1 -1
  7. package/.output/ui/assets/{InspectorPet-D9DPPQ3n.js → InspectorPet-QaAiuF3d.js} +1 -1
  8. package/.output/ui/assets/{ProxyViewerContainer-Buu8vkCK.js → ProxyViewerContainer-6twNZHwl.js} +4 -4
  9. package/.output/ui/assets/{ReplayDialog-BER-QzpD.js → ReplayDialog-B7KlziO2.js} +1 -1
  10. package/.output/ui/assets/{RequestAnatomy-C8Zwxrr7.js → RequestAnatomy-2XVFBrW4.js} +1 -1
  11. package/.output/ui/assets/{ResponseView-DDpKdYk6.js → ResponseView-BULgzLVB.js} +1 -1
  12. package/.output/ui/assets/{StreamingChunkSequence-sMPGG7Sw.js → StreamingChunkSequence-DSkvkbns.js} +1 -1
  13. package/.output/ui/assets/{_sessionId-e4IheHnP.js → _sessionId-D2dmJi3G.js} +1 -1
  14. package/.output/ui/assets/{_sessionId-C5Uv72Fx.js → _sessionId-DcS0s1Mr.js} +1 -1
  15. package/.output/ui/assets/{index-B__qT0Yd.js → index-B0TN1KKO.js} +2 -2
  16. package/.output/ui/assets/{index-Be3bTCzi.js → index-Bva1zHEs.js} +1 -1
  17. package/.output/ui/assets/{index-C9q__p8J.js → index-BzBExOxu.js} +1 -1
  18. package/.output/ui/assets/{index-CtB0deSZ.js → index-k6sRQz55.js} +1 -1
  19. package/.output/ui/assets/{json-viewer-Db0AFp-7.js → json-viewer-CWM4tY-j.js} +1 -1
  20. package/.output/ui/assets/{jszip.min-DkY0Ym_q.js → jszip.min-BkWvRFlo.js} +1 -1
  21. package/.output/ui/index.html +1 -1
  22. package/package.json +8 -13
  23. package/src/assets/IDE/claudecode-color.svg +0 -1
  24. package/src/assets/IDE/codex-color.svg +0 -1
  25. package/src/assets/IDE/opencode.svg +0 -1
  26. package/src/assets/IDE/xiaomimimo.svg +0 -1
  27. package/src/assets/favicon.svg +0 -21
  28. package/src/assets/logos/alibaba.svg +0 -1
  29. package/src/assets/logos/anthropic.svg +0 -1
  30. package/src/assets/logos/claude-code.svg +0 -4
  31. package/src/assets/logos/deepseek.svg +0 -1
  32. package/src/assets/logos/minimax.jpeg +0 -0
  33. package/src/assets/logos/openai.svg +0 -1
  34. package/src/assets/logos/opencode.svg +0 -4
  35. package/src/assets/logos/qwen.webp +0 -0
  36. package/src/assets/logos/zhipuai.svg +0 -219
  37. package/src/backend/router.tsx +0 -36
  38. package/src/backend/routes/$.ts +0 -26
  39. package/src/backend/routes/__root.ts +0 -4
  40. package/src/backend/routes/api/-instances.ts +0 -7
  41. package/src/backend/routes/api/alerts.summary.ts +0 -28
  42. package/src/backend/routes/api/alerts.ts +0 -70
  43. package/src/backend/routes/api/config.paths.ts +0 -14
  44. package/src/backend/routes/api/config.ts +0 -73
  45. package/src/backend/routes/api/ecosystem.packages.$packageId.help.ts +0 -11
  46. package/src/backend/routes/api/ecosystem.packages.$packageId.install.ts +0 -11
  47. package/src/backend/routes/api/ecosystem.packages.$packageId.runner-presets.ts +0 -11
  48. package/src/backend/routes/api/ecosystem.packages.$packageId.upgrade.ts +0 -11
  49. package/src/backend/routes/api/ecosystem.packages.ts +0 -21
  50. package/src/backend/routes/api/ecosystem.recipes.$recipeId.run.ts +0 -11
  51. package/src/backend/routes/api/ecosystem.tasks.$taskId.ts +0 -16
  52. package/src/backend/routes/api/ecosystem.tasks.ts +0 -12
  53. package/src/backend/routes/api/groups.$groupId.evidence.ts +0 -55
  54. package/src/backend/routes/api/groups.$groupId.sessions.ts +0 -50
  55. package/src/backend/routes/api/groups.$groupId.ts +0 -93
  56. package/src/backend/routes/api/groups.ts +0 -79
  57. package/src/backend/routes/api/health.ts +0 -22
  58. package/src/backend/routes/api/instances.$name.connection.ts +0 -12
  59. package/src/backend/routes/api/instances.$name.restart.ts +0 -23
  60. package/src/backend/routes/api/instances.$name.start.ts +0 -18
  61. package/src/backend/routes/api/instances.$name.stop.ts +0 -23
  62. package/src/backend/routes/api/instances.$name.ts +0 -12
  63. package/src/backend/routes/api/instances.ts +0 -16
  64. package/src/backend/routes/api/knowledge.candidates.$candidateId.promote.ts +0 -32
  65. package/src/backend/routes/api/knowledge.candidates.$candidateId.ts +0 -50
  66. package/src/backend/routes/api/knowledge.candidates.ts +0 -10
  67. package/src/backend/routes/api/knowledge.project-context.ts +0 -29
  68. package/src/backend/routes/api/knowledge.search.ts +0 -62
  69. package/src/backend/routes/api/knowledge.sessions.$sessionId.candidates.ts +0 -26
  70. package/src/backend/routes/api/logs.$id.body.ts +0 -58
  71. package/src/backend/routes/api/logs.$id.chunks.ts +0 -37
  72. package/src/backend/routes/api/logs.$id.replay.ts +0 -297
  73. package/src/backend/routes/api/logs.$id.ts +0 -23
  74. package/src/backend/routes/api/logs.import.ts +0 -39
  75. package/src/backend/routes/api/logs.stream.ts +0 -174
  76. package/src/backend/routes/api/logs.ts +0 -214
  77. package/src/backend/routes/api/mcp.ts +0 -25
  78. package/src/backend/routes/api/models.ts +0 -10
  79. package/src/backend/routes/api/pi-agent.ts +0 -29
  80. package/src/backend/routes/api/providers.$providerId.model-metadata.ts +0 -173
  81. package/src/backend/routes/api/providers.$providerId.test.log.ts +0 -342
  82. package/src/backend/routes/api/providers.$providerId.ts +0 -111
  83. package/src/backend/routes/api/providers.export.ts +0 -44
  84. package/src/backend/routes/api/providers.import.ts +0 -81
  85. package/src/backend/routes/api/providers.scan.ts +0 -28
  86. package/src/backend/routes/api/providers.ts +0 -102
  87. package/src/backend/routes/api/runs.$runId.evidence.ts +0 -55
  88. package/src/backend/routes/api/runs.$runId.ts +0 -50
  89. package/src/backend/routes/api/runs.ts +0 -62
  90. package/src/backend/routes/api/runtime.ts +0 -46
  91. package/src/backend/routes/api/sessions.ts +0 -51
  92. package/src/backend/routes/api/storage.ts +0 -56
  93. package/src/backend/routes/livez.ts +0 -13
  94. package/src/backend/routes/metrics.ts +0 -14
  95. package/src/backend/routes/proxy/$.ts +0 -15
  96. package/src/backend/routes/readyz.ts +0 -18
  97. package/src/backend/start.ts +0 -10
  98. package/src/cli/alias.ts +0 -431
  99. package/src/cli/detect-tools.ts +0 -123
  100. package/src/cli/doctor.ts +0 -836
  101. package/src/cli/instance.ts +0 -1071
  102. package/src/cli/instanceApi.ts +0 -213
  103. package/src/cli/instanceArgs.ts +0 -301
  104. package/src/cli/instanceControl.ts +0 -191
  105. package/src/cli/instanceModel.ts +0 -276
  106. package/src/cli/instanceRegistry.ts +0 -731
  107. package/src/cli/networkHints.ts +0 -170
  108. package/src/cli/onboard.ts +0 -1668
  109. package/src/cli/onboardTarget.ts +0 -228
  110. package/src/cli/rustBackendPackage.ts +0 -458
  111. package/src/cli/startupOutput.ts +0 -16
  112. package/src/cli/templates/codex-skill-onboard.ts +0 -320
  113. package/src/cli/templates/command-onboard.ts +0 -25
  114. package/src/cli/templates/skill-onboard.ts +0 -625
  115. package/src/cli.ts +0 -1397
  116. package/src/components/OnboardingBanner.tsx +0 -115
  117. package/src/components/ProxyViewer.tsx +0 -2259
  118. package/src/components/ProxyViewerContainer.tsx +0 -1076
  119. package/src/components/alerts/AlertsDialog.tsx +0 -615
  120. package/src/components/clients/ClientLogo.tsx +0 -175
  121. package/src/components/ecosystem/AgentLabDialog.tsx +0 -947
  122. package/src/components/errors/SafeErrorBoundary.tsx +0 -201
  123. package/src/components/groups/GroupsDialog.tsx +0 -1304
  124. package/src/components/inspector-pet/InspectorPet.tsx +0 -398
  125. package/src/components/inspector-pet/InspectorPetCrab3D.tsx +0 -455
  126. package/src/components/inspector-pet/inspectorPetLogic.ts +0 -272
  127. package/src/components/pi-agent/PiAgentPanel.tsx +0 -446
  128. package/src/components/pi-agent/piAgentChatLogic.ts +0 -273
  129. package/src/components/providers/ImportWizardDialog.tsx +0 -281
  130. package/src/components/providers/ProviderCard.tsx +0 -347
  131. package/src/components/providers/ProviderForm.tsx +0 -1183
  132. package/src/components/providers/ProviderLogo.tsx +0 -122
  133. package/src/components/providers/ProviderTestResultsView.tsx +0 -734
  134. package/src/components/providers/ProvidersPanel.tsx +0 -714
  135. package/src/components/providers/SettingsDialog.tsx +0 -1042
  136. package/src/components/providers/providerFormCapabilities.ts +0 -36
  137. package/src/components/proxy-viewer/AgentTraceSummary.tsx +0 -902
  138. package/src/components/proxy-viewer/AnswerMarkdown.tsx +0 -51
  139. package/src/components/proxy-viewer/ApplicationBar.tsx +0 -123
  140. package/src/components/proxy-viewer/CompareDrawer.tsx +0 -984
  141. package/src/components/proxy-viewer/ConversationGroup.tsx +0 -208
  142. package/src/components/proxy-viewer/ConversationGroupList.tsx +0 -652
  143. package/src/components/proxy-viewer/ConversationHeader.tsx +0 -429
  144. package/src/components/proxy-viewer/LiveConnectionStatus.tsx +0 -186
  145. package/src/components/proxy-viewer/LogEntry.tsx +0 -1419
  146. package/src/components/proxy-viewer/LogEntryHeader.tsx +0 -596
  147. package/src/components/proxy-viewer/ProviderLogoStack.tsx +0 -57
  148. package/src/components/proxy-viewer/RawExportWarning.tsx +0 -77
  149. package/src/components/proxy-viewer/ReplayDialog.tsx +0 -636
  150. package/src/components/proxy-viewer/RequestToolsPanel.tsx +0 -299
  151. package/src/components/proxy-viewer/ResponseView.tsx +0 -202
  152. package/src/components/proxy-viewer/SessionLoadProgressBar.tsx +0 -61
  153. package/src/components/proxy-viewer/StreamingChunkSequence.tsx +0 -265
  154. package/src/components/proxy-viewer/ThreadConnector.tsx +0 -165
  155. package/src/components/proxy-viewer/ToolTraceEvents.tsx +0 -64
  156. package/src/components/proxy-viewer/TurnGroup.tsx +0 -383
  157. package/src/components/proxy-viewer/TurnGroupList.tsx +0 -156
  158. package/src/components/proxy-viewer/accessibility.ts +0 -8
  159. package/src/components/proxy-viewer/anatomy/RequestAnatomy.tsx +0 -887
  160. package/src/components/proxy-viewer/anatomy/SegmentBar.tsx +0 -222
  161. package/src/components/proxy-viewer/anatomy/contextIntelligence.ts +0 -737
  162. package/src/components/proxy-viewer/anatomy/sessionContextSummary.ts +0 -268
  163. package/src/components/proxy-viewer/anatomy/tokenEstimate.ts +0 -53
  164. package/src/components/proxy-viewer/anatomy/types.ts +0 -41
  165. package/src/components/proxy-viewer/anatomy/useAnatomyJump.ts +0 -114
  166. package/src/components/proxy-viewer/bodyHydration.ts +0 -123
  167. package/src/components/proxy-viewer/cacheTrend.ts +0 -50
  168. package/src/components/proxy-viewer/diff/DiffView.tsx +0 -321
  169. package/src/components/proxy-viewer/diff/computeDiff.ts +0 -178
  170. package/src/components/proxy-viewer/diff/index.ts +0 -3
  171. package/src/components/proxy-viewer/formats/anthropic/ContentBlocks.tsx +0 -194
  172. package/src/components/proxy-viewer/formats/anthropic/ResponseView.tsx +0 -81
  173. package/src/components/proxy-viewer/formats/anthropic/thinkingExtract.ts +0 -21
  174. package/src/components/proxy-viewer/formats/index.tsx +0 -47
  175. package/src/components/proxy-viewer/formats/openai/ResponseView.tsx +0 -442
  176. package/src/components/proxy-viewer/index.ts +0 -9
  177. package/src/components/proxy-viewer/lazy.ts +0 -41
  178. package/src/components/proxy-viewer/liveConnectionState.ts +0 -158
  179. package/src/components/proxy-viewer/log-formats/anthropic.ts +0 -191
  180. package/src/components/proxy-viewer/log-formats/index.ts +0 -23
  181. package/src/components/proxy-viewer/log-formats/openai.ts +0 -256
  182. package/src/components/proxy-viewer/log-formats/types.ts +0 -40
  183. package/src/components/proxy-viewer/log-formats/unknown.ts +0 -18
  184. package/src/components/proxy-viewer/logEntryVisibility.ts +0 -73
  185. package/src/components/proxy-viewer/logFocus.ts +0 -54
  186. package/src/components/proxy-viewer/proxyViewerContainerLogic.ts +0 -124
  187. package/src/components/proxy-viewer/proxyViewerLogic.ts +0 -488
  188. package/src/components/proxy-viewer/replayComparison.ts +0 -131
  189. package/src/components/proxy-viewer/requestDiff.ts +0 -277
  190. package/src/components/proxy-viewer/requestTools.ts +0 -220
  191. package/src/components/proxy-viewer/useCopyFeedback.ts +0 -38
  192. package/src/components/proxy-viewer/useKeyboardNavigation.ts +0 -232
  193. package/src/components/proxy-viewer/viewerState.ts +0 -176
  194. package/src/components/ui/badge.tsx +0 -47
  195. package/src/components/ui/button.tsx +0 -47
  196. package/src/components/ui/collapsible.tsx +0 -21
  197. package/src/components/ui/confirm-dialog.tsx +0 -51
  198. package/src/components/ui/crab-logo.tsx +0 -45
  199. package/src/components/ui/crab-variants.tsx +0 -467
  200. package/src/components/ui/dialog.tsx +0 -130
  201. package/src/components/ui/icon-trigger.ts +0 -2
  202. package/src/components/ui/json-viewer-bulk.ts +0 -132
  203. package/src/components/ui/json-viewer.tsx +0 -508
  204. package/src/components/ui/scroll-area.tsx +0 -54
  205. package/src/components/ui/select.tsx +0 -178
  206. package/src/components/ui/separator.tsx +0 -28
  207. package/src/components/ui/tabs.tsx +0 -88
  208. package/src/components/ui/tooltip.tsx +0 -51
  209. package/src/components/ui/transient-toast.tsx +0 -105
  210. package/src/contracts/anthropic.ts +0 -230
  211. package/src/contracts/index.ts +0 -59
  212. package/src/contracts/json.ts +0 -37
  213. package/src/contracts/log.ts +0 -139
  214. package/src/contracts/openai.ts +0 -267
  215. package/src/index.css +0 -11
  216. package/src/knowledge/candidateStore.ts +0 -94
  217. package/src/knowledge/distiller.ts +0 -98
  218. package/src/knowledge/openclawClient.ts +0 -161
  219. package/src/knowledge/openclawGatewayClient.ts +0 -249
  220. package/src/knowledge/openclawMarkdown.ts +0 -146
  221. package/src/knowledge/redactor.ts +0 -80
  222. package/src/knowledge/types.ts +0 -83
  223. package/src/lib/alertContract.ts +0 -76
  224. package/src/lib/apiClient.ts +0 -166
  225. package/src/lib/apiFormat.ts +0 -29
  226. package/src/lib/backendImplementation.ts +0 -16
  227. package/src/lib/basePath.ts +0 -107
  228. package/src/lib/browserRuntimeContract.ts +0 -124
  229. package/src/lib/browserRuntimeResolver.ts +0 -333
  230. package/src/lib/chunkLoadRecovery.ts +0 -83
  231. package/src/lib/claudeCodeStrip.ts +0 -98
  232. package/src/lib/clipboard.ts +0 -67
  233. package/src/lib/codingAgentEndpoints.ts +0 -54
  234. package/src/lib/ecosystemContract.ts +0 -130
  235. package/src/lib/export-logs.ts +0 -287
  236. package/src/lib/groupContract.ts +0 -166
  237. package/src/lib/instanceContract.ts +0 -239
  238. package/src/lib/jsonFile.ts +0 -46
  239. package/src/lib/logImportContract.ts +0 -12
  240. package/src/lib/managedInstance.ts +0 -112
  241. package/src/lib/mask.ts +0 -4
  242. package/src/lib/objectUtils.ts +0 -22
  243. package/src/lib/piAgentContract.ts +0 -102
  244. package/src/lib/providerContract.ts +0 -125
  245. package/src/lib/providerImportContract.ts +0 -27
  246. package/src/lib/providerModelMetadata.ts +0 -458
  247. package/src/lib/providerTestContract.ts +0 -170
  248. package/src/lib/providerTestPrompt.ts +0 -100
  249. package/src/lib/publicBasePathContext.ts +0 -137
  250. package/src/lib/resourceLimits.ts +0 -345
  251. package/src/lib/runContract.ts +0 -164
  252. package/src/lib/runtimeConfig.ts +0 -43
  253. package/src/lib/safeDiagnostic.ts +0 -38
  254. package/src/lib/safeFetch.ts +0 -508
  255. package/src/lib/serverPort.ts +0 -47
  256. package/src/lib/sessionInfoContract.ts +0 -78
  257. package/src/lib/sessionUrl.ts +0 -46
  258. package/src/lib/ssrfGuard.ts +0 -133
  259. package/src/lib/stopReason.ts +0 -130
  260. package/src/lib/themeMode.ts +0 -41
  261. package/src/lib/timeDisplay.ts +0 -22
  262. package/src/lib/toolTrace.ts +0 -290
  263. package/src/lib/uiScale.ts +0 -117
  264. package/src/lib/unknown.ts +0 -27
  265. package/src/lib/upstreamUrl.ts +0 -150
  266. package/src/lib/useAlerts.ts +0 -82
  267. package/src/lib/useGroupEvidence.ts +0 -37
  268. package/src/lib/useGroups.ts +0 -32
  269. package/src/lib/useOnboarding.ts +0 -93
  270. package/src/lib/useProviders.ts +0 -30
  271. package/src/lib/useStripConfig.ts +0 -154
  272. package/src/lib/useThemeMode.ts +0 -40
  273. package/src/lib/useUiScale.ts +0 -52
  274. package/src/lib/utils.ts +0 -78
  275. package/src/mcp/currentContext.ts +0 -65
  276. package/src/mcp/instanceHandlers.ts +0 -151
  277. package/src/mcp/loopback.ts +0 -88
  278. package/src/mcp/mode.ts +0 -75
  279. package/src/mcp/previewExtractor.ts +0 -233
  280. package/src/mcp/server.ts +0 -2274
  281. package/src/mcp/toolHandlers.ts +0 -1533
  282. package/src/proxy/alerts.ts +0 -664
  283. package/src/proxy/chunkStorage.ts +0 -123
  284. package/src/proxy/config.ts +0 -218
  285. package/src/proxy/constants.ts +0 -66
  286. package/src/proxy/dataDir.ts +0 -147
  287. package/src/proxy/ecosystemExecutionConfirmation.ts +0 -114
  288. package/src/proxy/ecosystemExecutionRoute.ts +0 -116
  289. package/src/proxy/ecosystemRegistry.ts +0 -296
  290. package/src/proxy/ecosystemTasks.ts +0 -415
  291. package/src/proxy/evidenceAnalysis.ts +0 -526
  292. package/src/proxy/evidenceExporter.ts +0 -235
  293. package/src/proxy/formats/anthropic/anthropicProvider.ts +0 -75
  294. package/src/proxy/formats/anthropic/handler.ts +0 -75
  295. package/src/proxy/formats/anthropic/index.ts +0 -13
  296. package/src/proxy/formats/anthropic/register.ts +0 -4
  297. package/src/proxy/formats/anthropic/schemas.ts +0 -6
  298. package/src/proxy/formats/anthropic/stream.ts +0 -205
  299. package/src/proxy/formats/handler.ts +0 -46
  300. package/src/proxy/formats/index.ts +0 -13
  301. package/src/proxy/formats/jsonSchema.ts +0 -2
  302. package/src/proxy/formats/openai/alibabaProvider.ts +0 -34
  303. package/src/proxy/formats/openai/codexMetadata.ts +0 -61
  304. package/src/proxy/formats/openai/handler.ts +0 -133
  305. package/src/proxy/formats/openai/index.ts +0 -33
  306. package/src/proxy/formats/openai/provider.ts +0 -50
  307. package/src/proxy/formats/openai/register.ts +0 -4
  308. package/src/proxy/formats/openai/schemas.ts +0 -25
  309. package/src/proxy/formats/openai/stream.ts +0 -600
  310. package/src/proxy/formats/openai/zhipuProvider.ts +0 -31
  311. package/src/proxy/formats/providerAdapter.ts +0 -50
  312. package/src/proxy/formats/providerRegistry.ts +0 -51
  313. package/src/proxy/formats/providers/index.ts +0 -3
  314. package/src/proxy/formats/registry.ts +0 -65
  315. package/src/proxy/groupEvidenceExporter.ts +0 -371
  316. package/src/proxy/groupStore.ts +0 -336
  317. package/src/proxy/handler.ts +0 -729
  318. package/src/proxy/identityProxy.ts +0 -1842
  319. package/src/proxy/jsonlRecovery.ts +0 -554
  320. package/src/proxy/logBodyChunks.ts +0 -91
  321. package/src/proxy/logFinalizer.ts +0 -777
  322. package/src/proxy/logFinalizer.worker.ts +0 -24
  323. package/src/proxy/logImportUpload.ts +0 -128
  324. package/src/proxy/logImporter.ts +0 -813
  325. package/src/proxy/logIndex.ts +0 -663
  326. package/src/proxy/logSearch.ts +0 -122
  327. package/src/proxy/logger.ts +0 -537
  328. package/src/proxy/openaiOrphanToolStrip.ts +0 -142
  329. package/src/proxy/platformCommands.ts +0 -253
  330. package/src/proxy/privateDataPath.ts +0 -419
  331. package/src/proxy/providerImporters.ts +0 -578
  332. package/src/proxy/providerScanStore.ts +0 -87
  333. package/src/proxy/providerSecretStore.ts +0 -216
  334. package/src/proxy/providers.ts +0 -998
  335. package/src/proxy/rawStreamCapture.ts +0 -342
  336. package/src/proxy/runFailures.ts +0 -94
  337. package/src/proxy/runStore.ts +0 -214
  338. package/src/proxy/runtimeAdmission.ts +0 -55
  339. package/src/proxy/runtimeHealth.ts +0 -221
  340. package/src/proxy/runtimeMetrics.ts +0 -149
  341. package/src/proxy/runtimeShutdown.ts +0 -157
  342. package/src/proxy/schemas.ts +0 -112
  343. package/src/proxy/sessionArchive.ts +0 -479
  344. package/src/proxy/sessionInfo.ts +0 -266
  345. package/src/proxy/sessionProcess.ts +0 -194
  346. package/src/proxy/sessionRuntime.ts +0 -121
  347. package/src/proxy/sessionSupervisor.ts +0 -305
  348. package/src/proxy/sessionWorkerEntry.ts +0 -26
  349. package/src/proxy/shutdownCoordinator.ts +0 -90
  350. package/src/proxy/socketTracker.ts +0 -639
  351. package/src/proxy/sqliteLogIndex.ts +0 -733
  352. package/src/proxy/storageLifecycle.ts +0 -432
  353. package/src/proxy/store.ts +0 -1773
  354. package/src/proxy/streamTiming.ts +0 -31
  355. package/src/proxy/toolSchemaWarnings.ts +0 -529
  356. package/src/proxy/uiAssetServer.ts +0 -106
  357. package/src/proxy/upstream.ts +0 -127
  358. package/src/services/alerts.ts +0 -12
  359. package/src/services/groups.ts +0 -119
  360. package/src/services/piAgent.ts +0 -421
  361. package/src/services/piAgentRetrieval.ts +0 -1180
  362. package/src/services/result.ts +0 -17
  363. package/src/services/runs.ts +0 -76
  364. package/src/ui/bootstrap.ts +0 -167
  365. package/src/ui/index.html +0 -38
  366. package/src/ui/logsStreamClient.ts +0 -20
  367. package/src/ui/main.tsx +0 -13
  368. package/src/ui/public/runtime-config.js +0 -2
  369. package/src/ui/router.tsx +0 -13
  370. package/src/ui/routes/__root.tsx +0 -69
  371. package/src/ui/routes/index.tsx +0 -35
  372. package/src/ui/routes/session/$sessionId.tsx +0 -50
  373. package/src/ui/runtimeDiscovery.ts +0 -50
@@ -1,600 +0,0 @@
1
- import type { CapturedLog, JsonValue } from "../../schemas";
2
- import { trustAsJsonValue } from "../jsonSchema";
3
- import {
4
- OpenAISSERawChunkSchema,
5
- OpenAIResponsesResponseSchema,
6
- OpenAIResponsesSSEventSchema,
7
- type OpenAIResponsesResponse,
8
- } from "./schemas";
9
-
10
- type ParsedSseEvent = {
11
- event: string | null;
12
- data: string;
13
- };
14
-
15
- type CollectedChunk = {
16
- index: number;
17
- timestamp: number;
18
- type: string;
19
- data: JsonValue;
20
- };
21
-
22
- type ResponseFunctionCall = {
23
- id?: string;
24
- call_id?: string;
25
- type: "function_call";
26
- name?: string;
27
- arguments: string;
28
- status?: string;
29
- };
30
-
31
- const MAX_CHUNKS = 1000;
32
-
33
- function readProperty(value: unknown, key: string): unknown {
34
- if (value === null || typeof value !== "object" || Array.isArray(value)) return undefined;
35
- return Object.getOwnPropertyDescriptor(value, key)?.value;
36
- }
37
-
38
- function readStringProperty(value: unknown, key: string): string | null {
39
- const property = readProperty(value, key);
40
- return typeof property === "string" ? property : null;
41
- }
42
-
43
- function readNumberProperty(value: unknown, key: string): number | null {
44
- const property = readProperty(value, key);
45
- return typeof property === "number" && Number.isFinite(property) ? property : null;
46
- }
47
-
48
- function readObjectProperty(value: unknown, key: string): unknown | null {
49
- const property = readProperty(value, key);
50
- return property !== null && typeof property === "object" && !Array.isArray(property)
51
- ? property
52
- : null;
53
- }
54
-
55
- function readArrayProperty(value: unknown, key: string): unknown[] {
56
- const property = readProperty(value, key);
57
- return Array.isArray(property) ? property : [];
58
- }
59
-
60
- function parseSseEvents(raw: string): ParsedSseEvent[] {
61
- const events: ParsedSseEvent[] = [];
62
- let event: string | null = null;
63
- let dataLines: string[] = [];
64
-
65
- const commit = (): void => {
66
- if (event === null && dataLines.length === 0) return;
67
- events.push({ event, data: dataLines.join("\n") });
68
- event = null;
69
- dataLines = [];
70
- };
71
-
72
- for (const rawLine of raw.split("\n")) {
73
- const line = rawLine.endsWith("\r") ? rawLine.slice(0, -1) : rawLine;
74
- if (line === "") {
75
- commit();
76
- continue;
77
- }
78
- if (line.startsWith(":")) continue;
79
-
80
- const separatorIndex = line.indexOf(":");
81
- const field = separatorIndex === -1 ? line : line.slice(0, separatorIndex);
82
- const rawValue = separatorIndex === -1 ? "" : line.slice(separatorIndex + 1);
83
- const value = rawValue.startsWith(" ") ? rawValue.slice(1) : rawValue;
84
-
85
- switch (field) {
86
- case "event":
87
- event = value;
88
- break;
89
- case "data":
90
- if (
91
- event === null &&
92
- dataLines.length > 0 &&
93
- (value.startsWith("{") || value === "[DONE]")
94
- ) {
95
- commit();
96
- }
97
- dataLines.push(value);
98
- break;
99
- default:
100
- break;
101
- }
102
- }
103
-
104
- commit();
105
- return events;
106
- }
107
-
108
- function parseJson(data: string): unknown | null {
109
- try {
110
- return JSON.parse(data);
111
- } catch {
112
- return null;
113
- }
114
- }
115
-
116
- function eventTypeFor(event: ParsedSseEvent, parsed: unknown): string {
117
- if (event.event !== null && event.event !== "") return event.event;
118
- const typed = OpenAIResponsesSSEventSchema.safeParse(parsed);
119
- return typed.success ? typed.data.type : "";
120
- }
121
-
122
- function isResponsesEvent(event: ParsedSseEvent): boolean {
123
- if (event.data === "[DONE]") return false;
124
- const parsed = parseJson(event.data);
125
- const type = eventTypeFor(event, parsed);
126
- return type.startsWith("response.") || type === "error";
127
- }
128
-
129
- function collectChunk(
130
- chunks: CollectedChunk[],
131
- chunkIndex: number,
132
- streamStartMs: number,
133
- type: string,
134
- parsed: unknown,
135
- ): void {
136
- if (chunks.length >= MAX_CHUNKS) return;
137
- chunks.push({
138
- index: chunkIndex,
139
- timestamp: Date.now() - streamStartMs,
140
- type,
141
- data: trustAsJsonValue(parsed),
142
- });
143
- }
144
-
145
- function setErrorFromPayload(log: CapturedLog, payload: unknown): void {
146
- const errorObject = readObjectProperty(payload, "error");
147
- const message =
148
- readStringProperty(errorObject, "message") ??
149
- readStringProperty(payload, "message") ??
150
- readStringProperty(payload, "error");
151
- if (message !== null && message.length > 0) {
152
- log.error = message;
153
- }
154
- }
155
-
156
- function extractChatCompletionsStream(
157
- events: ParsedSseEvent[],
158
- log: CapturedLog,
159
- fallbackModel: string | undefined,
160
- collectChunks: boolean,
161
- ): string {
162
- let id = "";
163
- let model = "";
164
- let completionContent = "";
165
- let reasoningContent = "";
166
- let finishReason: string | null = null;
167
- let promptTokens = 0;
168
- let completionTokens = 0;
169
- let usageCaptured = false;
170
- let started = false;
171
- type ToolCallEntry = {
172
- index: number;
173
- id?: string;
174
- type: "function";
175
- function: { name: string; arguments: string };
176
- };
177
- const toolCalls: Map<number, ToolCallEntry> = new Map();
178
-
179
- let chunkIndex = 0;
180
- let streamStartMs = 0;
181
- const chunks: CollectedChunk[] = [];
182
-
183
- for (const event of events) {
184
- if (event.data === "[DONE]") break;
185
-
186
- const parsed = parseJson(event.data);
187
- if (parsed === null) continue;
188
- setErrorFromPayload(log, parsed);
189
-
190
- const chunkResult = OpenAISSERawChunkSchema.safeParse(parsed);
191
- if (!chunkResult.success) continue;
192
- const chunk = chunkResult.data;
193
-
194
- if (chunkIndex === 0) streamStartMs = Date.now();
195
- if (collectChunks) {
196
- collectChunk(chunks, chunkIndex, streamStartMs, "chat.completion.chunk", chunk);
197
- }
198
- chunkIndex++;
199
-
200
- if (!started) {
201
- id = chunk.id;
202
- model = chunk.model;
203
- started = true;
204
- }
205
-
206
- if (!usageCaptured && chunk.usage !== undefined && chunk.usage !== null) {
207
- promptTokens = chunk.usage.prompt_tokens ?? 0;
208
- completionTokens = chunk.usage.completion_tokens ?? 0;
209
- log.inputTokens = promptTokens;
210
-
211
- const usage = readObjectProperty(parsed, "usage");
212
- const details = readObjectProperty(usage, "prompt_tokens_details");
213
- const cachedTokens = readNumberProperty(details, "cached_tokens");
214
- if (cachedTokens !== null) {
215
- log.cacheReadInputTokens = cachedTokens;
216
- }
217
- usageCaptured = true;
218
- }
219
-
220
- for (const choice of chunk.choices) {
221
- const delta = choice.delta;
222
- if (delta.content !== undefined && delta.content !== null) {
223
- completionContent += delta.content;
224
- }
225
- if (delta.reasoning_content !== undefined && delta.reasoning_content !== null) {
226
- reasoningContent += delta.reasoning_content;
227
- }
228
- if (delta.thinking !== undefined && delta.thinking !== null) {
229
- reasoningContent += delta.thinking;
230
- }
231
- const thinkValue = delta.think;
232
- if (thinkValue !== undefined && thinkValue !== null) {
233
- reasoningContent += thinkValue;
234
- }
235
- if (choice.finish_reason !== undefined && choice.finish_reason !== null) {
236
- finishReason = choice.finish_reason;
237
- }
238
- if (delta.tool_calls !== undefined && delta.tool_calls !== null) {
239
- for (const tc of delta.tool_calls) {
240
- let existing = toolCalls.get(tc.index);
241
- if (existing === undefined) {
242
- existing = {
243
- index: tc.index,
244
- type: "function",
245
- function: { name: "", arguments: "" },
246
- };
247
- toolCalls.set(tc.index, existing);
248
- }
249
- if (tc.id !== undefined) existing.id = tc.id;
250
- if (tc.function?.name !== undefined) existing.function.name += tc.function.name;
251
- if (tc.function?.arguments !== undefined) {
252
- existing.function.arguments += tc.function.arguments;
253
- }
254
- }
255
- }
256
- }
257
- }
258
-
259
- if (collectChunks) {
260
- log.streamingChunks = {
261
- chunks,
262
- truncated: chunkIndex > MAX_CHUNKS,
263
- };
264
- }
265
-
266
- if (!usageCaptured) {
267
- completionTokens = Math.ceil(completionContent.length / 4);
268
- }
269
-
270
- log.outputTokens = completionTokens;
271
-
272
- const message: Record<string, unknown> = {
273
- role: "assistant",
274
- content: completionContent,
275
- };
276
- if (reasoningContent.length > 0) message.reasoning_content = reasoningContent;
277
- if (toolCalls.size > 0) message.tool_calls = [...toolCalls.values()];
278
-
279
- return JSON.stringify({
280
- id,
281
- object: "chat.completion",
282
- created: Math.floor(Date.now() / 1000),
283
- model: model !== "" ? model : (fallbackModel ?? ""),
284
- choices: [
285
- {
286
- index: 0,
287
- message,
288
- finish_reason: finishReason,
289
- },
290
- ],
291
- usage: {
292
- prompt_tokens: promptTokens,
293
- completion_tokens: completionTokens,
294
- total_tokens: promptTokens + completionTokens,
295
- },
296
- });
297
- }
298
-
299
- function parseResponsesResponse(value: unknown): OpenAIResponsesResponse | null {
300
- const fromResponseProperty = OpenAIResponsesResponseSchema.safeParse(
301
- readProperty(value, "response"),
302
- );
303
- if (fromResponseProperty.success) return fromResponseProperty.data;
304
- const direct = OpenAIResponsesResponseSchema.safeParse(value);
305
- return direct.success ? direct.data : null;
306
- }
307
-
308
- function responseTextFromOutput(response: OpenAIResponsesResponse): string {
309
- if (response.output_text !== undefined && response.output_text.length > 0) {
310
- return response.output_text;
311
- }
312
-
313
- const parts: string[] = [];
314
- for (const outputItem of response.output ?? []) {
315
- const content = readArrayProperty(outputItem, "content");
316
- for (const contentPart of content) {
317
- const type = readStringProperty(contentPart, "type");
318
- const text = readStringProperty(contentPart, "text");
319
- if ((type === "output_text" || type === "text") && text !== null && text.length > 0) {
320
- parts.push(text);
321
- }
322
- }
323
- }
324
- return parts.join("\n");
325
- }
326
-
327
- function updateUsageFromResponse(
328
- response: OpenAIResponsesResponse,
329
- log: CapturedLog,
330
- ): { inputTokens: number | null; outputTokens: number | null } {
331
- const usage = response.usage;
332
- const inputTokens = usage?.input_tokens ?? null;
333
- const outputTokens = usage?.output_tokens ?? null;
334
- if (inputTokens !== null) log.inputTokens = inputTokens;
335
- if (outputTokens !== null) log.outputTokens = outputTokens;
336
- const cachedTokens = usage?.input_tokens_details?.cached_tokens ?? null;
337
- if (cachedTokens !== null) log.cacheReadInputTokens = cachedTokens;
338
- return { inputTokens, outputTokens };
339
- }
340
-
341
- function functionCallKey(payload: unknown, fallbackIndex: number): string {
342
- const itemId = readStringProperty(payload, "item_id");
343
- if (itemId !== null && itemId.length > 0) return itemId;
344
- const outputIndex = readNumberProperty(payload, "output_index");
345
- if (outputIndex !== null) return String(outputIndex);
346
- return `function-${String(fallbackIndex)}`;
347
- }
348
-
349
- function ensureFunctionCall(
350
- calls: Map<string, ResponseFunctionCall>,
351
- key: string,
352
- ): ResponseFunctionCall {
353
- const existing = calls.get(key);
354
- if (existing !== undefined) return existing;
355
- const created: ResponseFunctionCall = {
356
- type: "function_call",
357
- arguments: "",
358
- };
359
- calls.set(key, created);
360
- return created;
361
- }
362
-
363
- function updateFunctionCallFromItem(
364
- calls: Map<string, ResponseFunctionCall>,
365
- key: string,
366
- item: unknown,
367
- ): void {
368
- if (readStringProperty(item, "type") !== "function_call") return;
369
- const call = ensureFunctionCall(calls, key);
370
- const id = readStringProperty(item, "id");
371
- const callId = readStringProperty(item, "call_id");
372
- const name = readStringProperty(item, "name");
373
- const args = readStringProperty(item, "arguments");
374
- const status = readStringProperty(item, "status");
375
- if (id !== null) call.id = id;
376
- if (callId !== null) call.call_id = callId;
377
- if (name !== null) call.name = name;
378
- if (args !== null) call.arguments = args;
379
- if (status !== null) call.status = status;
380
- }
381
-
382
- function outputFromCollected(
383
- outputText: string,
384
- calls: Map<string, ResponseFunctionCall>,
385
- ): unknown[] {
386
- const output: unknown[] = [];
387
- if (outputText.length > 0) {
388
- output.push({
389
- type: "message",
390
- role: "assistant",
391
- content: [{ type: "output_text", text: outputText, annotations: [] }],
392
- });
393
- }
394
- for (const call of calls.values()) {
395
- output.push(call);
396
- }
397
- return output;
398
- }
399
-
400
- function responseUsage(
401
- inputTokens: number | null,
402
- outputTokens: number | null,
403
- outputText: string,
404
- ): Record<string, unknown> {
405
- const finalOutputTokens = outputTokens ?? Math.ceil(outputText.length / 4);
406
- return {
407
- input_tokens: inputTokens,
408
- output_tokens: finalOutputTokens,
409
- total_tokens: inputTokens === null ? finalOutputTokens : inputTokens + finalOutputTokens,
410
- };
411
- }
412
-
413
- function normalizeResponsesResponse(input: {
414
- completedResponse: OpenAIResponsesResponse | null;
415
- responseId: string;
416
- model: string;
417
- status: string | null;
418
- outputText: string;
419
- calls: Map<string, ResponseFunctionCall>;
420
- inputTokens: number | null;
421
- outputTokens: number | null;
422
- }): Record<string, unknown> {
423
- const completedText =
424
- input.completedResponse === null ? "" : responseTextFromOutput(input.completedResponse);
425
- const outputText = completedText.length > 0 ? completedText : input.outputText;
426
- const completedOutput = input.completedResponse?.output;
427
- const output =
428
- completedOutput !== undefined && completedOutput.length > 0
429
- ? completedOutput
430
- : outputFromCollected(outputText, input.calls);
431
- const usage =
432
- input.completedResponse?.usage ??
433
- responseUsage(input.inputTokens, input.outputTokens, outputText);
434
-
435
- return {
436
- ...(input.completedResponse ?? {}),
437
- id: input.completedResponse?.id ?? input.responseId,
438
- object: "response",
439
- created_at: input.completedResponse?.created_at ?? Math.floor(Date.now() / 1000),
440
- status: input.completedResponse?.status ?? input.status ?? "completed",
441
- model: input.completedResponse?.model ?? input.model,
442
- output,
443
- output_text: outputText,
444
- usage,
445
- };
446
- }
447
-
448
- function extractResponsesStream(
449
- events: ParsedSseEvent[],
450
- log: CapturedLog,
451
- fallbackModel: string | undefined,
452
- collectChunks: boolean,
453
- ): string {
454
- let completedResponse: OpenAIResponsesResponse | null = null;
455
- let responseId = "";
456
- let model = fallbackModel ?? "";
457
- let status: string | null = null;
458
- let outputText = "";
459
- let inputTokens: number | null = null;
460
- let outputTokens: number | null = null;
461
- let chunkIndex = 0;
462
- let streamStartMs = 0;
463
- const chunks: CollectedChunk[] = [];
464
- const calls: Map<string, ResponseFunctionCall> = new Map();
465
-
466
- for (const event of events) {
467
- if (event.data === "[DONE]") break;
468
- const parsed = parseJson(event.data);
469
- if (parsed === null) continue;
470
- const type = eventTypeFor(event, parsed);
471
-
472
- if (chunkIndex === 0) streamStartMs = Date.now();
473
- if (collectChunks) {
474
- collectChunk(
475
- chunks,
476
- chunkIndex,
477
- streamStartMs,
478
- type === "" ? "response.event" : type,
479
- parsed,
480
- );
481
- }
482
- chunkIndex++;
483
-
484
- setErrorFromPayload(log, parsed);
485
- if (type === "error") continue;
486
-
487
- const response = parseResponsesResponse(parsed);
488
- if (response !== null) {
489
- completedResponse = response;
490
- responseId = response.id;
491
- model = response.model ?? model;
492
- status = response.status ?? status;
493
- const usage = updateUsageFromResponse(response, log);
494
- inputTokens = usage.inputTokens ?? inputTokens;
495
- outputTokens = usage.outputTokens ?? outputTokens;
496
- setErrorFromPayload(log, response);
497
- }
498
-
499
- const delta = readStringProperty(parsed, "delta");
500
- switch (type) {
501
- case "response.output_text.delta":
502
- if (delta !== null) outputText += delta;
503
- break;
504
- case "response.output_text.done": {
505
- const text = readStringProperty(parsed, "text");
506
- if (outputText.length === 0 && text !== null) outputText = text;
507
- break;
508
- }
509
- case "response.function_call_arguments.delta": {
510
- if (delta !== null) {
511
- const call = ensureFunctionCall(calls, functionCallKey(parsed, calls.size));
512
- call.arguments += delta;
513
- }
514
- break;
515
- }
516
- case "response.function_call_arguments.done": {
517
- const args = readStringProperty(parsed, "arguments");
518
- if (args !== null) {
519
- const call = ensureFunctionCall(calls, functionCallKey(parsed, calls.size));
520
- call.arguments = args;
521
- }
522
- break;
523
- }
524
- case "response.output_item.added":
525
- case "response.output_item.done": {
526
- const item = readObjectProperty(parsed, "item");
527
- updateFunctionCallFromItem(calls, functionCallKey(parsed, calls.size), item);
528
- break;
529
- }
530
- case "response.failed":
531
- case "response.incomplete":
532
- status = type.slice("response.".length);
533
- break;
534
- case "response.completed":
535
- status = "completed";
536
- break;
537
- case "response.created":
538
- case "response.in_progress":
539
- case "response.content_part.added":
540
- case "response.content_part.done":
541
- case "":
542
- break;
543
- default:
544
- break;
545
- }
546
- }
547
-
548
- if (collectChunks) {
549
- log.streamingChunks = {
550
- chunks,
551
- truncated: chunkIndex > MAX_CHUNKS,
552
- };
553
- }
554
-
555
- const normalized = normalizeResponsesResponse({
556
- completedResponse,
557
- responseId,
558
- model,
559
- status,
560
- outputText,
561
- calls,
562
- inputTokens,
563
- outputTokens,
564
- });
565
- const normalizedResponse = OpenAIResponsesResponseSchema.safeParse(normalized);
566
- if (normalizedResponse.success) {
567
- const finalUsage = updateUsageFromResponse(normalizedResponse.data, log);
568
- if (finalUsage.outputTokens === null) {
569
- const finalText = responseTextFromOutput(normalizedResponse.data);
570
- const estimatedOutputTokens = Math.ceil(finalText.length / 4);
571
- log.outputTokens = estimatedOutputTokens;
572
- }
573
- return JSON.stringify(normalizedResponse.data);
574
- }
575
-
576
- if (log.outputTokens === null) {
577
- const finalText = readStringProperty(normalized, "output_text") ?? outputText;
578
- const estimatedOutputTokens = Math.ceil(finalText.length / 4);
579
- log.outputTokens = estimatedOutputTokens;
580
- }
581
-
582
- return JSON.stringify(normalized);
583
- }
584
-
585
- /**
586
- * Extract OpenAI streaming response and return normalized JSON.
587
- * Optionally collects SSE chunks into log.streamingChunks for debugging/display.
588
- */
589
- export function extractOpenAIStream(
590
- raw: string,
591
- log: CapturedLog,
592
- fallbackModel?: string,
593
- collectChunks: boolean = true,
594
- ): string {
595
- const events = parseSseEvents(raw);
596
- if (events.some(isResponsesEvent)) {
597
- return extractResponsesStream(events, log, fallbackModel, collectChunks);
598
- }
599
- return extractChatCompletionsStream(events, log, fallbackModel, collectChunks);
600
- }
@@ -1,31 +0,0 @@
1
- import type { CapturedLog } from "../../schemas";
2
- import type { ProviderAdapter } from "../providerAdapter";
3
- import { registry } from "../providers";
4
- import { extractOpenAIStream } from "./stream";
5
-
6
- const DEFAULT_ZHIPU_UPSTREAM = "https://open.bigmodel.cn/api/paas/v4";
7
- const ZHIPU_MODEL_PREFIXES = ["glm-", "charglm-", "cogview-", "embedding-", "rerank-"];
8
-
9
- export const zhipuProvider: ProviderAdapter = {
10
- name: "zhipu",
11
-
12
- matches(model: string): boolean {
13
- const normalized = model.toLowerCase().replace(/\s+/g, "-");
14
- return ZHIPU_MODEL_PREFIXES.some((prefix) => normalized.startsWith(prefix));
15
- },
16
-
17
- getUpstreamBase(_isChatCompletions: boolean, providerConfig?: { baseUrl?: string }): string {
18
- return providerConfig?.baseUrl ?? DEFAULT_ZHIPU_UPSTREAM;
19
- },
20
-
21
- extractStream(
22
- raw: string,
23
- log: CapturedLog,
24
- fallbackModel?: string,
25
- collectChunks?: boolean,
26
- ): string {
27
- return extractOpenAIStream(raw, log, fallbackModel, collectChunks);
28
- },
29
- };
30
-
31
- registry.register(zhipuProvider);
@@ -1,50 +0,0 @@
1
- import type { ApiFormat, CapturedLog } from "../../contracts";
2
-
3
- /**
4
- * Provider Adapter Interface
5
- *
6
- * Defines the contract that all provider adapters must implement to support
7
- * different LLM APIs (Anthropic, OpenAI, etc.).
8
- */
9
- export type ProviderAdapter = {
10
- /** Provider identifier (e.g., "anthropic", "openai") */
11
- name: string;
12
-
13
- /**
14
- * Check if this provider handles the given model.
15
- * @param model - Model name from request
16
- * @returns true if this provider should handle the model
17
- */
18
- matches(model: string): boolean;
19
-
20
- /**
21
- * Get the upstream base URL for this provider.
22
- * @param isChatCompletions - Whether the request uses OpenAI chat completions format
23
- * @param providerConfig - Optional provider configuration for custom base URL
24
- * @returns Upstream base URL
25
- */
26
- getUpstreamBase(isChatCompletions: boolean, providerConfig?: { baseUrl?: string }): string;
27
-
28
- /**
29
- * Extract structured response from streaming data.
30
- * @param raw - Raw SSE stream data
31
- * @param log - Captured log entry to update
32
- * @param fallbackModel - Fallback model name if not in stream
33
- * @param collectChunks - Whether to collect SSE chunks into log.streamingChunks
34
- * @returns JSON string of structured response
35
- */
36
- extractStream(
37
- raw: string,
38
- log: CapturedLog,
39
- fallbackModel?: string,
40
- collectChunks?: boolean,
41
- ): string;
42
-
43
- /**
44
- * Optional request transformation hook.
45
- * @param body - Original request body
46
- * @param apiFormat - Request format (anthropic/openai/unknown)
47
- * @returns Transformed body or null to use original
48
- */
49
- transformRequest?(body: string, apiFormat: ApiFormat): string | null;
50
- };