@tonyclaw/agent-inspector 4.0.1 → 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 +192 -109
  3. package/.output/server/_ssr/index.mjs +1 -1
  4. package/.output/server/_ssr/{router-CTHqmroT.mjs → router-BBY_zWRK.mjs} +91 -3
  5. package/.output/server/index.mjs +1 -1
  6. package/.output/ui/assets/{CompareDrawer-L3n4J-Or.js → CompareDrawer-rtNElN-B.js} +1 -1
  7. package/.output/ui/assets/{InspectorPet-D5o_3OZS.js → InspectorPet-QaAiuF3d.js} +1 -1
  8. package/.output/ui/assets/{ProxyViewerContainer-Ocagx75S.js → ProxyViewerContainer-6twNZHwl.js} +4 -4
  9. package/.output/ui/assets/{ReplayDialog-Bk7x1h-y.js → ReplayDialog-B7KlziO2.js} +1 -1
  10. package/.output/ui/assets/{RequestAnatomy-U4lzL7Sc.js → RequestAnatomy-2XVFBrW4.js} +1 -1
  11. package/.output/ui/assets/{ResponseView-LOWfvBLK.js → ResponseView-BULgzLVB.js} +1 -1
  12. package/.output/ui/assets/{StreamingChunkSequence-DPfsrrXQ.js → StreamingChunkSequence-DSkvkbns.js} +1 -1
  13. package/.output/ui/assets/{_sessionId-OdX2Jvt1.js → _sessionId-D2dmJi3G.js} +1 -1
  14. package/.output/ui/assets/{_sessionId-0MlWS-CO.js → _sessionId-DcS0s1Mr.js} +1 -1
  15. package/.output/ui/assets/{index-Du4qNOOt.js → index-B0TN1KKO.js} +2 -2
  16. package/.output/ui/assets/{index-gvFj_9K6.js → index-Bva1zHEs.js} +1 -1
  17. package/.output/ui/assets/{index-Ea-c8hPg.js → index-BzBExOxu.js} +1 -1
  18. package/.output/ui/assets/{index-zVVS53Hd.js → index-k6sRQz55.js} +1 -1
  19. package/.output/ui/assets/{json-viewer-C1WAMzg3.js → json-viewer-CWM4tY-j.js} +1 -1
  20. package/.output/ui/assets/{jszip.min-B8AKu2zm.js → jszip.min-BkWvRFlo.js} +1 -1
  21. package/.output/ui/index.html +1 -1
  22. package/package.json +5 -10
  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 -1433
  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 -258
  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,596 +0,0 @@
1
- import {
2
- AlertTriangle,
3
- ArrowDown,
4
- ArrowUp,
5
- Check,
6
- ChevronDown,
7
- ChevronRight,
8
- ChevronsDown,
9
- ChevronsUp,
10
- Clock,
11
- Copy,
12
- FileDiff,
13
- FileTerminal,
14
- Gauge,
15
- Globe,
16
- History,
17
- Loader2,
18
- MessageSquare,
19
- OctagonAlert,
20
- Radio,
21
- RotateCcw,
22
- Wrench,
23
- Zap,
24
- } from "lucide-react";
25
- import type { JSX, MouseEvent } from "react";
26
- import { memo } from "react";
27
- import type { TimeDisplayFormat } from "../../lib/runtimeConfig";
28
- import { formatTimestamp } from "../../lib/timeDisplay";
29
- import { cn, formatTokens, getStatusCategory, type StatusCategory } from "../../lib/utils";
30
- import type { CapturedLog } from "../../contracts";
31
- import { Badge } from "../ui/badge";
32
- import { Button } from "../ui/button";
33
- import { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from "../ui/tooltip";
34
- import type { CacheTrend } from "./cacheTrend";
35
- import { ToolTraceEvents } from "./ToolTraceEvents";
36
- import type { ToolTraceEvent } from "./viewerState";
37
-
38
- const STATUS_BADGE_CLASSES: Record<StatusCategory, string> = {
39
- success: "bg-slate-300/[0.08] text-slate-100 border-transparent",
40
- client_error: "bg-amber-300/[0.10] text-amber-100 border-transparent",
41
- server_error: "bg-rose-400/[0.10] text-rose-100 border-transparent",
42
- pending: "bg-cyan-300/[0.08] text-cyan-100 border-transparent",
43
- };
44
-
45
- const STATUS_CUE_CLASSES: Record<
46
- StatusCategory,
47
- {
48
- frame: string;
49
- }
50
- > = {
51
- success: {
52
- frame: "border-cyan-200/15 bg-white/[0.04] text-text-strong",
53
- },
54
- client_error: {
55
- frame: "border-amber-300/25 bg-amber-300/[0.08] text-amber-100",
56
- },
57
- server_error: {
58
- frame: "border-rose-300/25 bg-rose-300/[0.08] text-rose-100",
59
- },
60
- pending: {
61
- frame: "border-cyan-300/25 bg-cyan-300/[0.08] text-cyan-100",
62
- },
63
- };
64
-
65
- const HEADER_ACTION_BUTTON_CLASS =
66
- "border border-transparent bg-white/[0.045] hover:bg-white/[0.075] size-8 text-muted-foreground shadow-none hover:text-cyan-100";
67
-
68
- const TELEMETRY_CHIP_CLASS = "bg-white/[0.045] flex h-7 items-center gap-1 rounded-md px-2 text-xs";
69
-
70
- function formatElapsed(ms: number): string {
71
- if (ms < 1000) return `${ms}ms`;
72
- return `${(ms / 1000).toFixed(1)}s`;
73
- }
74
-
75
- function formatTokenRate(tokensPerSecond: number): string {
76
- if (tokensPerSecond >= 10) return `${tokensPerSecond.toFixed(0)}/s`;
77
- return `${tokensPerSecond.toFixed(1)}/s`;
78
- }
79
-
80
- function statusCueLabel(category: StatusCategory, status: number | null): string {
81
- switch (category) {
82
- case "success":
83
- return status === null ? "OK" : String(status);
84
- case "client_error":
85
- return status === null ? "WARN" : String(status);
86
- case "server_error":
87
- return status === null ? "FAIL" : String(status);
88
- case "pending":
89
- return "ROLL";
90
- }
91
- }
92
-
93
- /**
94
- * Inline trend indicator: small arrow (up / down) plus the absolute
95
- * delta in compact form. Returns `null` when there is no trend to display.
96
- */
97
- function CacheTrendIndicator({ trend }: { trend: CacheTrend | null }): JSX.Element | null {
98
- if (trend === null) return null;
99
- const isUp = trend.direction === "up";
100
- const Icon = isUp ? ArrowUp : ArrowDown;
101
- const sign = isUp ? "+" : "-";
102
- return (
103
- <span className="flex items-center gap-0.5 text-muted-foreground tabular-nums">
104
- <Icon className={isUp ? "size-3 text-cyan-300" : "size-3 text-rose-400"} />
105
- <span className="font-mono">
106
- {sign}
107
- {formatTokens(trend.delta)}
108
- </span>
109
- </span>
110
- );
111
- }
112
-
113
- /**
114
- * Per-tab action bundle surfaced in the header when the tab is active.
115
- * - `copyText === null` - Copy button hidden (e.g. tab has no body to copy)
116
- * - `expansion === null` - Expand-all button hidden (e.g. flat dict, or
117
- * not valid JSON). When present, the button reflects the JSON viewer's
118
- * bulk-expansion state and the caller is responsible for forwarding the
119
- * matching `bulkDepth` / `bulkRevision` to the underlying viewer.
120
- * - `diffWithRaw` / `diffWithPrevious` - optional Diff buttons. Undefined
121
- * means "not applicable" (hidden). Today only the Request tab sets them.
122
- */
123
- export type HeaderTabAction = {
124
- copyLabel: string;
125
- copyText: string | null;
126
- copyCopied: boolean;
127
- onCopy: (event: MouseEvent) => void;
128
- expansion: {
129
- isExpanded: boolean;
130
- isPending: boolean;
131
- onToggle: () => void;
132
- } | null;
133
- /** Toggle for "Diff with Raw": display request body vs raw (pre-billing-strip). */
134
- diffWithRaw?: { active: boolean; onToggle: () => void };
135
- /** One-shot handler for "Diff with Previous": compare against the preceding log. */
136
- diffWithPrevious?: () => void;
137
- };
138
-
139
- /**
140
- * Tab actions keyed by Tabs value. Tabs without an entry (Context, Parsed
141
- * Response) leave the corresponding key unset, so the header renders no
142
- * action buttons for them. Typed as a record (rather than a `Partial<...>`
143
- * union) so the per-tab lookup in the header is type-safe.
144
- */
145
- export type HeaderTabActions = Record<string, HeaderTabAction | undefined>;
146
-
147
- export type LogEntryHeaderProps = {
148
- log: CapturedLog;
149
- /** Human-facing ordinal inside the current session. Internal actions still use `log.id`. */
150
- displayNumber: number;
151
- /** Number of messages in the request (supports both Anthropic and OpenAI formats). */
152
- messageCount?: number | null;
153
- /** Number of tools defined in the request (supports both Anthropic and OpenAI formats). */
154
- toolCount?: number | null;
155
- /** Tools actually called by this response, shown inline with the log telemetry. */
156
- toolEvents?: ToolTraceEvent[];
157
- expanded: boolean;
158
- onToggle: () => void;
159
- /** Per-log cache token trend (creation + read) relative to the previous log
160
- * in the same conversation group. When `undefined` or a field is `null`,
161
- * the corresponding cache span renders as it did before: no arrow.
162
- */
163
- cacheTrend?: { creation: CacheTrend | null; read: CacheTrend | null } | null;
164
- /** Currently-active tab value (matches the `Tabs` value prop). The header
165
- * uses this to pick the right entry from `tabActions`. */
166
- activeTab?: string;
167
- /** Per-tab Copy + Expand-all actions. Only tabs with an entry will show
168
- * buttons when active. Tabs without an entry (Context, Parsed Response)
169
- * render no header buttons. */
170
- tabActions?: HeaderTabActions;
171
- /** Re-send this request to the provider. Rendered in the header row when
172
- * `expanded` is true. */
173
- onReplay?: () => void;
174
- /** Slow-response threshold in seconds. `0` disables the warning indicator. */
175
- slowResponseThresholdSeconds?: number;
176
- /** Show client PID/project metadata on each log row. Parent process rows can disable this. */
177
- showClientMetadata?: boolean;
178
- /** Controls whether timestamps render as compact local time or full ISO strings. */
179
- timeDisplayFormat: TimeDisplayFormat;
180
- };
181
-
182
- export const LogEntryHeader = memo(function ({
183
- log,
184
- displayNumber,
185
- messageCount = null,
186
- toolCount = null,
187
- toolEvents = [],
188
- expanded,
189
- onToggle,
190
- cacheTrend = null,
191
- activeTab,
192
- tabActions,
193
- onReplay,
194
- slowResponseThresholdSeconds = 0,
195
- showClientMetadata = true,
196
- timeDisplayFormat,
197
- }: LogEntryHeaderProps): JSX.Element {
198
- const statusCategory = getStatusCategory(log.responseStatus);
199
- const isSlowResponse =
200
- log.elapsedMs !== null &&
201
- slowResponseThresholdSeconds > 0 &&
202
- log.elapsedMs > slowResponseThresholdSeconds * 1000;
203
-
204
- const hasTokens = log.inputTokens !== null || log.outputTokens !== null;
205
- const firstChunkMs = log.firstChunkMs ?? null;
206
- const tokensPerSecond = log.tokensPerSecond ?? null;
207
- const firstChunkLabel = firstChunkMs === null ? null : formatElapsed(firstChunkMs);
208
- const tokenRateLabel =
209
- tokensPerSecond === null || tokensPerSecond <= 0 ? null : formatTokenRate(tokensPerSecond);
210
- const warningCount = log.warnings?.length ?? 0;
211
- const hasClientPid = log.clientPid !== null && log.clientPid !== undefined;
212
- const hasClientProjectFolder =
213
- log.clientProjectFolder !== null &&
214
- log.clientProjectFolder !== undefined &&
215
- log.clientProjectFolder !== "";
216
- const hasClientCwd =
217
- log.clientCwd !== null && log.clientCwd !== undefined && log.clientCwd !== "";
218
- const statusCue = STATUS_CUE_CLASSES[statusCategory];
219
- const statusLabel = statusCueLabel(statusCategory, log.responseStatus);
220
- const showStatusBadge = statusCategory !== "success" || log.responseStatus !== 200;
221
- const showStandaloneStreamingIndicator =
222
- log.streaming && firstChunkLabel === null && tokenRateLabel === null;
223
-
224
- return (
225
- <TooltipProvider>
226
- <div
227
- id={`log-${log.id}`}
228
- role="button"
229
- tabIndex={0}
230
- data-nav-id={`log-${log.id}`}
231
- data-nav-action={expanded ? "collapse" : "expand"}
232
- className={cn(
233
- "group/header relative isolate flex min-w-0 cursor-pointer items-start gap-2 overflow-hidden px-3 py-2 transition-[background-color,border-color,box-shadow]",
234
- expanded ? "bg-white/[0.04]" : "bg-transparent hover:bg-white/[0.035]",
235
- "select-none",
236
- "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none",
237
- )}
238
- onClick={onToggle}
239
- onKeyDown={(e) => {
240
- if (e.key === "Enter" || e.key === " ") {
241
- e.preventDefault();
242
- onToggle();
243
- }
244
- }}
245
- >
246
- <span className="flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1">
247
- {/* Request ID */}
248
- <span
249
- className={cn(
250
- "inline-flex h-8 shrink-0 items-center rounded-md px-2 font-mono",
251
- statusCue.frame,
252
- )}
253
- >
254
- <span className="text-xs font-semibold tabular-nums" title={`Log ID ${String(log.id)}`}>
255
- #{displayNumber}
256
- </span>
257
- </span>
258
-
259
- {/* Request start time */}
260
- <span className="bg-white/[0.045] flex h-7 shrink-0 items-center gap-1 rounded-md px-2 text-xs text-muted-foreground">
261
- <Clock className="size-3" />
262
- <span className="font-mono tabular-nums" title={log.timestamp}>
263
- {formatTimestamp(log.timestamp, timeDisplayFormat)}
264
- </span>
265
- </span>
266
-
267
- {/* Response Status - only shown for non-200 or pending. Each category
268
- carries a distinct icon in addition to color so the meaning is
269
- legible without color perception. */}
270
- {showStatusBadge && (
271
- <Badge
272
- variant="outline"
273
- className={cn(
274
- "h-6 gap-1 rounded-md px-2 py-0 font-mono text-[10px] font-semibold uppercase tabular-nums shadow-[inset_0_1px_0_rgba(255,255,255,0.05)]",
275
- STATUS_BADGE_CLASSES[statusCategory],
276
- )}
277
- >
278
- {statusCategory === "success" ? (
279
- <Check className="size-3" aria-label="Success" />
280
- ) : statusCategory === "server_error" ? (
281
- <OctagonAlert className="size-3" aria-label="Server error" />
282
- ) : statusCategory === "client_error" ? (
283
- <AlertTriangle className="size-3" aria-label="Client error" />
284
- ) : (
285
- <Loader2 className="size-3 animate-spin" aria-label="Pending" />
286
- )}
287
- {statusLabel}
288
- </Badge>
289
- )}
290
-
291
- {warningCount > 0 && (
292
- <Tooltip>
293
- <TooltipTrigger asChild>
294
- <Badge
295
- variant="outline"
296
- className="h-6 gap-1 rounded-md border-amber-300/30 bg-amber-300/[0.10] px-2 py-0 font-mono text-[10px] tabular-nums text-amber-100"
297
- >
298
- <AlertTriangle className="size-3" aria-label="Tool schema warnings" />
299
- {warningCount}
300
- </Badge>
301
- </TooltipTrigger>
302
- <TooltipContent>
303
- {warningCount === 1
304
- ? "1 tool schema warning"
305
- : `${warningCount} tool schema warnings`}
306
- </TooltipContent>
307
- </Tooltip>
308
- )}
309
-
310
- {/* Elapsed time. Tooltip is only shown when this log exceeded the slow-
311
- response threshold - for normal-speed logs the elapsed value is
312
- self-explanatory, so we skip the tooltip wrapper to keep the row
313
- quiet. */}
314
- {log.elapsedMs !== null &&
315
- (isSlowResponse ? (
316
- <Tooltip>
317
- <TooltipTrigger asChild>
318
- <span
319
- className={cn(
320
- TELEMETRY_CHIP_CLASS,
321
- "shrink-0 border-amber-300/25 text-amber-200",
322
- )}
323
- >
324
- <Clock className="size-3" />
325
- <span className="font-mono tabular-nums">{formatElapsed(log.elapsedMs)}</span>
326
- <AlertTriangle className="size-3" aria-label="Slow response" />
327
- </span>
328
- </TooltipTrigger>
329
- <TooltipContent>
330
- Slow response: {formatElapsed(log.elapsedMs)} exceeds{" "}
331
- {formatElapsed(slowResponseThresholdSeconds * 1000)}
332
- </TooltipContent>
333
- </Tooltip>
334
- ) : (
335
- <span className={cn(TELEMETRY_CHIP_CLASS, "shrink-0 text-muted-foreground")}>
336
- <Clock className="size-3" />
337
- <span className="font-mono tabular-nums">{formatElapsed(log.elapsedMs)}</span>
338
- </span>
339
- ))}
340
-
341
- {/* Streaming timing */}
342
- {log.streaming && firstChunkLabel !== null && (
343
- <span className={cn(TELEMETRY_CHIP_CLASS, "shrink-0 text-cyan-300")}>
344
- <Radio className="size-3" />
345
- <span className="font-mono tabular-nums">first {firstChunkLabel}</span>
346
- </span>
347
- )}
348
- {log.streaming && tokenRateLabel !== null && (
349
- <span className={cn(TELEMETRY_CHIP_CLASS, "shrink-0 text-cyan-300")}>
350
- <Gauge className="size-3" />
351
- <span className="font-mono tabular-nums">{tokenRateLabel}</span>
352
- </span>
353
- )}
354
-
355
- {/* Token counts */}
356
- {hasTokens && (
357
- <span className={cn(TELEMETRY_CHIP_CLASS, "min-w-0 sm:shrink-0")}>
358
- <Zap className="size-3 text-muted-foreground" />
359
- <span className="flex min-w-0 flex-wrap items-center gap-x-1 font-mono tabular-nums">
360
- <span
361
- className={cn(
362
- "whitespace-nowrap",
363
- log.inputTokens !== null ? "text-blue-400" : "text-muted-foreground",
364
- )}
365
- >
366
- IN {log.inputTokens !== null ? formatTokens(log.inputTokens) : "n/a"}
367
- </span>
368
- <span className="text-muted-foreground">/</span>
369
- <span
370
- className={cn(
371
- "whitespace-nowrap",
372
- log.outputTokens !== null ? "text-amber-400" : "text-muted-foreground",
373
- )}
374
- >
375
- OUT {log.outputTokens !== null ? formatTokens(log.outputTokens) : "n/a"}
376
- </span>
377
- </span>
378
- </span>
379
- )}
380
- {/* Cache tokens */}
381
- {log.cacheCreationInputTokens !== null && log.cacheCreationInputTokens > 0 && (
382
- <span className={cn(TELEMETRY_CHIP_CLASS, "shrink-0")}>
383
- <CacheTrendIndicator trend={cacheTrend?.creation ?? null} />
384
- <span className="font-mono tabular-nums text-cyan-300">
385
- KV Cache +{formatTokens(log.cacheCreationInputTokens)}
386
- </span>
387
- </span>
388
- )}
389
- {log.cacheReadInputTokens !== null && log.cacheReadInputTokens > 0 && (
390
- <span className={cn(TELEMETRY_CHIP_CLASS, "shrink-0")}>
391
- <CacheTrendIndicator trend={cacheTrend?.read ?? null} />
392
- <span className="font-mono tabular-nums text-purple-400">
393
- KV Cache ~{formatTokens(log.cacheReadInputTokens)}
394
- </span>
395
- </span>
396
- )}
397
-
398
- {/* Message count */}
399
- {messageCount !== null && (
400
- <span className={cn(TELEMETRY_CHIP_CLASS, "shrink-0 text-muted-foreground")}>
401
- <MessageSquare className="size-3" />
402
- <span className="font-mono tabular-nums">{messageCount}</span>
403
- </span>
404
- )}
405
-
406
- {/* Tool count */}
407
- {toolCount !== null && (
408
- <span className={cn(TELEMETRY_CHIP_CLASS, "shrink-0 text-muted-foreground")}>
409
- <Wrench className="size-3" />
410
- <span className="font-mono tabular-nums">{toolCount}</span>
411
- </span>
412
- )}
413
-
414
- <ToolTraceEvents events={toolEvents} />
415
-
416
- {/* Origin */}
417
- {log.origin !== null && (
418
- <span
419
- className={cn(TELEMETRY_CHIP_CLASS, "hidden shrink-0 text-muted-foreground xl:flex")}
420
- title={`Origin: ${log.origin}`}
421
- >
422
- <Globe className="size-3" />
423
- <span className="font-mono tabular-nums truncate max-w-[120px]" title={log.origin}>
424
- {log.origin}
425
- </span>
426
- </span>
427
- )}
428
-
429
- {/* Client info (PID + project folder) */}
430
- {showClientMetadata && (hasClientPid || hasClientProjectFolder) && (
431
- <span className={cn(TELEMETRY_CHIP_CLASS, "hidden shrink-0 text-purple-300 xl:flex")}>
432
- <FileTerminal className="size-3" />
433
- {hasClientProjectFolder ? (
434
- <span className="font-mono tabular-nums">{log.clientProjectFolder}</span>
435
- ) : (
436
- <span className="font-mono tabular-nums">PID {log.clientPid}</span>
437
- )}
438
- </span>
439
- )}
440
-
441
- {/* Streaming indicator */}
442
- {showStandaloneStreamingIndicator && (
443
- <Radio className="size-3 shrink-0 text-muted-foreground/60" />
444
- )}
445
- </span>
446
-
447
- <span className="flex shrink-0 items-start gap-1.5">
448
- {/* Header actions - only when expanded, so the collapsed view stays
449
- compact. Buttons stop propagation so they don't toggle the log. */}
450
- {expanded && (
451
- <span
452
- className="flex items-center gap-1.5 shrink-0"
453
- onClick={(e) => e.stopPropagation()}
454
- onKeyDown={(e) => e.stopPropagation()}
455
- >
456
- {tabActions !== undefined &&
457
- activeTab !== undefined &&
458
- (() => {
459
- const action = tabActions[activeTab];
460
- if (action === undefined) return null;
461
- return (
462
- <>
463
- {action.expansion !== null && (
464
- <Tooltip>
465
- <TooltipTrigger asChild>
466
- <Button
467
- variant="outline"
468
- size="icon"
469
- className={HEADER_ACTION_BUTTON_CLASS}
470
- onClick={action.expansion.onToggle}
471
- disabled={action.expansion.isPending}
472
- aria-pressed={action.expansion.isExpanded}
473
- aria-label={
474
- action.expansion.isExpanded
475
- ? "Collapse all JSON"
476
- : "Expand all JSON"
477
- }
478
- >
479
- {action.expansion.isExpanded ? (
480
- <ChevronsUp className="size-3.5" />
481
- ) : (
482
- <ChevronsDown className="size-3.5" />
483
- )}
484
- </Button>
485
- </TooltipTrigger>
486
- <TooltipContent>
487
- {action.expansion.isExpanded
488
- ? "Collapse all JSON nodes"
489
- : "Expand all JSON nodes"}
490
- </TooltipContent>
491
- </Tooltip>
492
- )}
493
- {action.diffWithRaw !== undefined && (
494
- <Tooltip>
495
- <TooltipTrigger asChild>
496
- <Button
497
- variant="outline"
498
- size="icon"
499
- className={cn(
500
- HEADER_ACTION_BUTTON_CLASS,
501
- action.diffWithRaw.active &&
502
- "border-cyan-300/35 bg-cyan-400/15 text-cyan-100",
503
- )}
504
- onClick={action.diffWithRaw.onToggle}
505
- aria-pressed={action.diffWithRaw.active}
506
- aria-label={
507
- action.diffWithRaw.active ? "Hide raw diff" : "Diff with raw"
508
- }
509
- >
510
- <FileDiff className="size-3.5" />
511
- </Button>
512
- </TooltipTrigger>
513
- <TooltipContent>
514
- {action.diffWithRaw.active
515
- ? "Hide diff with raw request"
516
- : "Show diff between displayed and raw request body"}
517
- </TooltipContent>
518
- </Tooltip>
519
- )}
520
- {action.diffWithPrevious !== undefined && (
521
- <Tooltip>
522
- <TooltipTrigger asChild>
523
- <Button
524
- variant="outline"
525
- size="icon"
526
- className={HEADER_ACTION_BUTTON_CLASS}
527
- onClick={action.diffWithPrevious}
528
- aria-label="Diff with previous"
529
- >
530
- <History className="size-3.5" />
531
- </Button>
532
- </TooltipTrigger>
533
- <TooltipContent>
534
- Compare this request with the immediately preceding one
535
- </TooltipContent>
536
- </Tooltip>
537
- )}
538
- {action.copyText !== null && (
539
- <Tooltip>
540
- <TooltipTrigger asChild>
541
- <Button
542
- variant="outline"
543
- size="icon"
544
- className={HEADER_ACTION_BUTTON_CLASS}
545
- onClick={action.onCopy}
546
- aria-label={action.copyCopied ? "Copied" : action.copyLabel}
547
- >
548
- {action.copyCopied ? (
549
- <Check className="size-3.5 text-cyan-300" />
550
- ) : (
551
- <Copy className="size-3.5" />
552
- )}
553
- </Button>
554
- </TooltipTrigger>
555
- <TooltipContent>
556
- {action.copyCopied ? "Copied to clipboard" : action.copyLabel}
557
- </TooltipContent>
558
- </Tooltip>
559
- )}
560
- </>
561
- );
562
- })()}
563
- {onReplay !== undefined && (
564
- <Tooltip>
565
- <TooltipTrigger asChild>
566
- <Button
567
- variant="outline"
568
- size="icon"
569
- className={HEADER_ACTION_BUTTON_CLASS}
570
- onClick={onReplay}
571
- aria-label="Replay request"
572
- >
573
- <RotateCcw className="size-3.5" />
574
- </Button>
575
- </TooltipTrigger>
576
- <TooltipContent>Re-send this request to the provider</TooltipContent>
577
- </Tooltip>
578
- )}
579
- </span>
580
- )}
581
-
582
- <span
583
- className="bg-white/[0.045] hover:bg-white/[0.075] inline-flex size-8 shrink-0 items-center justify-center rounded-md text-text-strong"
584
- aria-hidden="true"
585
- >
586
- {expanded ? (
587
- <ChevronDown className="size-4 shrink-0" />
588
- ) : (
589
- <ChevronRight className="size-4 shrink-0" />
590
- )}
591
- </span>
592
- </span>
593
- </div>
594
- </TooltipProvider>
595
- );
596
- });
@@ -1,57 +0,0 @@
1
- import type { JSX } from "react";
2
- import { cn } from "../../lib/utils";
3
- import { ProviderLogo, type Provider } from "../providers/ProviderLogo";
4
- import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../ui/tooltip";
5
-
6
- const MAX_VISIBLE_LOGOS = 3;
7
-
8
- export type ProviderLogoStackItem = {
9
- provider: Provider;
10
- tooltip: string;
11
- };
12
-
13
- export function ProviderLogoStack({
14
- items,
15
- ariaLabel,
16
- className,
17
- }: {
18
- items: readonly ProviderLogoStackItem[];
19
- ariaLabel: string;
20
- className?: string;
21
- }): JSX.Element {
22
- if (items.length === 0) {
23
- return (
24
- <span className={cn("flex h-8 w-12 shrink-0 items-center", className)} aria-hidden="true" />
25
- );
26
- }
27
-
28
- const visibleItems = items.slice(0, MAX_VISIBLE_LOGOS);
29
- const overflowCount = items.length - visibleItems.length;
30
-
31
- return (
32
- <TooltipProvider delayDuration={150}>
33
- <span className={cn("flex h-8 w-12 shrink-0 items-center", className)} aria-label={ariaLabel}>
34
- {visibleItems.map((item, index) => (
35
- <Tooltip key={`${item.provider}-${String(index)}`}>
36
- <TooltipTrigger asChild>
37
- <span
38
- className={cn(
39
- "border border-border bg-muted/40 inline-flex size-6 shrink-0 items-center justify-center rounded-md",
40
- index > 0 && "-ml-2",
41
- )}
42
- >
43
- <ProviderLogo provider={item.provider} className="size-4" />
44
- </span>
45
- </TooltipTrigger>
46
- <TooltipContent>{item.tooltip}</TooltipContent>
47
- </Tooltip>
48
- ))}
49
- {overflowCount > 0 && (
50
- <span className="border border-border bg-muted/40 -ml-2 inline-flex h-6 min-w-6 shrink-0 items-center justify-center rounded-md px-1 font-mono text-[10px] text-muted-foreground">
51
- +{overflowCount}
52
- </span>
53
- )}
54
- </span>
55
- </TooltipProvider>
56
- );
57
- }