@tonyclaw/agent-inspector 3.0.45 → 3.0.46

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 (338) hide show
  1. package/.output/{nitro.json → backend/nitro.json} +3 -3
  2. package/.output/backend-public/assets/index-D4LX-sw-.js +11 -0
  3. package/.output/cli.js +2326 -516
  4. package/.output/server/_libs/extend.mjs +4 -8
  5. package/.output/server/_libs/jszip.mjs +9 -35
  6. package/.output/server/_libs/react-dom.mjs +2 -3
  7. package/.output/server/_libs/react.mjs +1 -27
  8. package/.output/server/_libs/tanstack__react-router.mjs +1 -329
  9. package/.output/server/_libs/tanstack__router-core.mjs +42 -100
  10. package/.output/server/_libs/use-sync-external-store.mjs +1 -64
  11. package/.output/server/_libs/ws.mjs +1 -1
  12. package/.output/server/_ssr/index.mjs +4 -4
  13. package/.output/server/_ssr/{publicBasePathContext-5264L3rX.mjs → publicBasePathContext-IH2ilOfu.mjs} +52 -24
  14. package/.output/server/_ssr/{router-BJ_ltLim.mjs → router-D18yUq36.mjs} +19770 -19447
  15. package/.output/server/_ssr/{start-C6MjPjxp.mjs → start-COQu_AgD.mjs} +1 -1
  16. package/.output/server/_tanstack-start-manifest_v-DnbdNeun.mjs +4 -0
  17. package/.output/server/index.mjs +5 -145
  18. package/.output/{public/assets/CompareDrawer-B3_TLTJh.js → ui/assets/CompareDrawer-DAUuIJ6G.js} +1 -1
  19. package/.output/{public/assets/InspectorPet-Cpn6hv4P.js → ui/assets/InspectorPet-BRBVjOWI.js} +1 -1
  20. package/.output/ui/assets/ProxyViewerContainer-D7Sq0ctc.js +59 -0
  21. package/.output/{public/assets/ReplayDialog-B3EKVdJk.js → ui/assets/ReplayDialog-nDLsjOhs.js} +1 -1
  22. package/.output/{public/assets/RequestAnatomy-COOQjyUC.js → ui/assets/RequestAnatomy-zd4BDgL0.js} +1 -1
  23. package/.output/ui/assets/ResponseView-AdIXGcSn.js +2 -0
  24. package/.output/ui/assets/StreamingChunkSequence-CesTz8He.js +1 -0
  25. package/.output/{public/assets/_sessionId-zbgYl7ZJ.js → ui/assets/_sessionId-BAfzrhSU.js} +1 -1
  26. package/.output/{public/assets/_sessionId-BJlM3nmt.js → ui/assets/_sessionId-QnBomgPD.js} +1 -1
  27. package/.output/ui/assets/favicon-DYEkHSNl.svg +21 -0
  28. package/.output/{public/assets/index-BIK4bPTv.js → ui/assets/index-BcsdxBAd.js} +1 -1
  29. package/.output/ui/assets/index-BvXp42al.css +1 -0
  30. package/.output/{public/assets/index-D2Qw6Ri2.js → ui/assets/index-D0rtCN9V.js} +1 -1
  31. package/.output/ui/assets/index-DHpwr08Z.js +73 -0
  32. package/.output/{public/assets/index-xF_NY8Yb.js → ui/assets/index-dNuk2dsU.js} +5 -5
  33. package/.output/ui/assets/json-viewer-BvFHglMb.js +1 -0
  34. package/.output/{public/assets/jszip.min-B_rfAUCe.js → ui/assets/jszip.min-B5Z7gNZB.js} +1 -1
  35. package/.output/ui/index.html +229 -0
  36. package/.output/ui/runtime-config.js +2 -0
  37. package/.output/workers/logFinalizer.worker.js +979 -414
  38. package/.output/workers/sessionWorkerEntry.js +979 -414
  39. package/README.md +175 -43
  40. package/docs/instance-control.openapi.yaml +59 -4
  41. package/package.json +25 -5
  42. package/scripts/generate-theme-scales.mjs +3 -3
  43. package/src/{router.tsx → backend/router.tsx} +3 -15
  44. package/src/backend/routes/$.ts +26 -0
  45. package/src/backend/routes/__root.ts +4 -0
  46. package/src/{routes → backend/routes}/api/-instances.ts +3 -3
  47. package/src/{routes → backend/routes}/api/alerts.summary.ts +3 -3
  48. package/src/{routes → backend/routes}/api/alerts.ts +4 -4
  49. package/src/{routes → backend/routes}/api/config.paths.ts +1 -1
  50. package/src/{routes → backend/routes}/api/config.ts +11 -2
  51. package/src/{routes → backend/routes}/api/ecosystem.packages.$packageId.help.ts +1 -1
  52. package/src/{routes → backend/routes}/api/ecosystem.packages.$packageId.install.ts +1 -1
  53. package/src/{routes → backend/routes}/api/ecosystem.packages.$packageId.runner-presets.ts +1 -1
  54. package/src/{routes → backend/routes}/api/ecosystem.packages.$packageId.upgrade.ts +1 -1
  55. package/src/{routes → backend/routes}/api/ecosystem.packages.ts +5 -1
  56. package/src/{routes → backend/routes}/api/ecosystem.recipes.$recipeId.run.ts +1 -1
  57. package/src/{routes → backend/routes}/api/ecosystem.tasks.$taskId.ts +1 -1
  58. package/src/{routes → backend/routes}/api/ecosystem.tasks.ts +1 -1
  59. package/src/{routes → backend/routes}/api/groups.$groupId.evidence.ts +2 -2
  60. package/src/{routes → backend/routes}/api/groups.$groupId.sessions.ts +2 -2
  61. package/src/{routes → backend/routes}/api/groups.$groupId.ts +2 -2
  62. package/src/{routes → backend/routes}/api/groups.ts +2 -2
  63. package/src/{routes → backend/routes}/api/health.ts +3 -3
  64. package/src/{routes → backend/routes}/api/instances.$name.connection.ts +1 -1
  65. package/src/{routes → backend/routes}/api/instances.$name.restart.ts +2 -2
  66. package/src/{routes → backend/routes}/api/instances.$name.start.ts +2 -2
  67. package/src/{routes → backend/routes}/api/instances.$name.stop.ts +2 -2
  68. package/src/{routes → backend/routes}/api/instances.$name.ts +1 -1
  69. package/src/{routes → backend/routes}/api/instances.ts +1 -1
  70. package/src/{routes → backend/routes}/api/knowledge.candidates.$candidateId.promote.ts +2 -2
  71. package/src/{routes → backend/routes}/api/knowledge.candidates.$candidateId.ts +2 -2
  72. package/src/{routes → backend/routes}/api/knowledge.candidates.ts +1 -1
  73. package/src/{routes → backend/routes}/api/knowledge.project-context.ts +2 -2
  74. package/src/{routes → backend/routes}/api/knowledge.search.ts +2 -2
  75. package/src/{routes → backend/routes}/api/knowledge.sessions.$sessionId.candidates.ts +3 -3
  76. package/src/{routes → backend/routes}/api/logs.$id.body.ts +6 -6
  77. package/src/{routes → backend/routes}/api/logs.$id.chunks.ts +5 -4
  78. package/src/{routes → backend/routes}/api/logs.$id.replay.ts +12 -11
  79. package/src/{routes → backend/routes}/api/logs.$id.ts +4 -3
  80. package/src/{routes → backend/routes}/api/logs.import.ts +3 -3
  81. package/src/{routes → backend/routes}/api/logs.stream.ts +11 -7
  82. package/src/{routes → backend/routes}/api/logs.ts +17 -9
  83. package/src/{routes → backend/routes}/api/mcp.ts +1 -1
  84. package/src/{routes → backend/routes}/api/models.ts +1 -1
  85. package/src/{routes → backend/routes}/api/pi-agent.ts +2 -2
  86. package/src/{routes → backend/routes}/api/providers.$providerId.model-metadata.ts +5 -5
  87. package/src/{routes → backend/routes}/api/providers.$providerId.test.log.ts +7 -7
  88. package/src/{routes → backend/routes}/api/providers.$providerId.ts +4 -4
  89. package/src/{routes → backend/routes}/api/providers.export.ts +1 -1
  90. package/src/{routes → backend/routes}/api/providers.import.ts +3 -3
  91. package/src/{routes → backend/routes}/api/providers.scan.ts +2 -2
  92. package/src/{routes → backend/routes}/api/providers.ts +9 -4
  93. package/src/{routes → backend/routes}/api/runs.$runId.evidence.ts +2 -2
  94. package/src/{routes → backend/routes}/api/runs.$runId.ts +2 -2
  95. package/src/{routes → backend/routes}/api/runs.ts +4 -4
  96. package/src/backend/routes/api/runtime.ts +46 -0
  97. package/src/{routes → backend/routes}/api/sessions.ts +3 -3
  98. package/src/{routes → backend/routes}/proxy/$.ts +1 -1
  99. package/src/{routes → backend/routes}/readyz.ts +1 -1
  100. package/src/{start.ts → backend/start.ts} +1 -1
  101. package/src/cli/alias.ts +2 -11
  102. package/src/cli/doctor.ts +32 -9
  103. package/src/cli/instance.ts +26 -13
  104. package/src/cli/instanceArgs.ts +30 -11
  105. package/src/cli/instanceControl.ts +0 -2
  106. package/src/cli/instanceModel.ts +9 -17
  107. package/src/cli/instanceRegistry.ts +0 -9
  108. package/src/cli/networkHints.ts +27 -14
  109. package/src/cli/onboard.ts +69 -2
  110. package/src/cli/onboardTarget.ts +89 -40
  111. package/src/cli/templates/codex-skill-onboard.ts +44 -14
  112. package/src/cli/templates/skill-onboard.ts +64 -28
  113. package/src/cli.ts +184 -61
  114. package/src/components/ProxyViewer.tsx +11 -9
  115. package/src/components/ProxyViewerContainer.tsx +12 -11
  116. package/src/components/pi-agent/PiAgentPanel.tsx +2 -2
  117. package/src/components/providers/ProviderCard.tsx +1 -1
  118. package/src/components/providers/ProviderTestResultsView.tsx +1 -1
  119. package/src/components/providers/SettingsDialog.tsx +159 -144
  120. package/src/components/proxy-viewer/ApplicationBar.tsx +2 -1
  121. package/src/components/proxy-viewer/LogEntry.tsx +1 -1
  122. package/src/components/proxy-viewer/log-formats/index.ts +1 -1
  123. package/src/contracts/index.ts +5 -0
  124. package/src/contracts/log.ts +33 -3
  125. package/src/knowledge/types.ts +3 -2
  126. package/src/lib/alertContract.ts +2 -2
  127. package/src/lib/apiClient.ts +30 -7
  128. package/src/lib/apiFormat.ts +29 -0
  129. package/src/lib/basePath.ts +29 -11
  130. package/src/lib/browserRuntimeContract.ts +124 -0
  131. package/src/lib/browserRuntimeResolver.ts +244 -0
  132. package/src/{proxy → lib}/claudeCodeStrip.ts +6 -7
  133. package/src/lib/codingAgentEndpoints.ts +38 -0
  134. package/src/lib/instanceContract.ts +27 -11
  135. package/src/lib/piAgentContract.ts +3 -2
  136. package/src/lib/publicBasePathContext.ts +40 -10
  137. package/src/lib/resourceLimits.ts +2 -0
  138. package/src/lib/runContract.ts +3 -3
  139. package/src/lib/sessionInfoContract.ts +3 -2
  140. package/src/mcp/instanceHandlers.ts +1 -0
  141. package/src/mcp/server.ts +19 -24
  142. package/src/proxy/config.ts +25 -30
  143. package/src/proxy/dataDir.ts +43 -7
  144. package/src/proxy/ecosystemTasks.ts +161 -70
  145. package/src/proxy/formats/registry.ts +6 -21
  146. package/src/proxy/handler.ts +129 -29
  147. package/src/proxy/identityProxy.ts +419 -39
  148. package/src/proxy/jsonlRecovery.ts +554 -0
  149. package/src/proxy/logFinalizer.ts +25 -10
  150. package/src/proxy/logImporter.ts +2 -1
  151. package/src/proxy/logIndex.ts +191 -95
  152. package/src/proxy/logger.ts +77 -14
  153. package/src/proxy/platformCommands.ts +41 -0
  154. package/src/proxy/privateDataPath.ts +310 -88
  155. package/src/proxy/rawStreamCapture.ts +194 -13
  156. package/src/proxy/runtimeAdmission.ts +5 -2
  157. package/src/proxy/runtimeHealth.ts +14 -1
  158. package/src/proxy/runtimeShutdown.ts +11 -1
  159. package/src/proxy/schemas.ts +7 -1
  160. package/src/proxy/sessionArchive.ts +78 -14
  161. package/src/proxy/sqliteLogIndex.ts +65 -2
  162. package/src/proxy/store.ts +141 -34
  163. package/src/proxy/uiAssetServer.ts +106 -0
  164. package/src/proxy/upstream.ts +29 -2
  165. package/src/ui/bootstrap.ts +167 -0
  166. package/src/ui/index.html +38 -0
  167. package/src/ui/logsStreamClient.ts +20 -0
  168. package/src/ui/main.tsx +13 -0
  169. package/src/ui/public/runtime-config.js +2 -0
  170. package/src/ui/router.tsx +13 -0
  171. package/src/ui/routes/__root.tsx +69 -0
  172. package/src/{routes → ui/routes}/index.tsx +2 -3
  173. package/src/{routes → ui/routes}/session/$sessionId.tsx +5 -11
  174. package/src/ui/runtimeDiscovery.ts +50 -0
  175. package/styles/globals.css +1 -0
  176. package/.output/public/assets/ProxyViewerContainer-BEAhuGOJ.js +0 -126
  177. package/.output/public/assets/ResponseView-DBCjkwye.js +0 -2
  178. package/.output/public/assets/StreamingChunkSequence-CuXhDgMo.js +0 -1
  179. package/.output/public/assets/index-BZo_8koU.js +0 -70
  180. package/.output/public/assets/index-ZWschkCh.css +0 -1
  181. package/.output/public/assets/json-viewer-B-Ao6pwW.js +0 -1
  182. package/.output/server/_libs/@radix-ui/react-accessible-icon+[...].mjs +0 -1
  183. package/.output/server/_libs/@radix-ui/react-dismissable-layer+[...].mjs +0 -344
  184. package/.output/server/_libs/@radix-ui/react-navigation-menu+[...].mjs +0 -2
  185. package/.output/server/_libs/@radix-ui/react-one-time-password-field+[...].mjs +0 -2
  186. package/.output/server/_libs/@radix-ui/react-password-toggle-field+[...].mjs +0 -2
  187. package/.output/server/_libs/@radix-ui/react-use-callback-ref+[...].mjs +0 -11
  188. package/.output/server/_libs/@radix-ui/react-use-controllable-state+[...].mjs +0 -69
  189. package/.output/server/_libs/@radix-ui/react-use-effect-event+[...].mjs +0 -1
  190. package/.output/server/_libs/@radix-ui/react-use-is-hydrated+[...].mjs +0 -28
  191. package/.output/server/_libs/@radix-ui/react-use-layout-effect+[...].mjs +0 -6
  192. package/.output/server/_libs/@radix-ui/react-visually-hidden+[...].mjs +0 -34
  193. package/.output/server/_libs/aria-hidden.mjs +0 -122
  194. package/.output/server/_libs/bail.mjs +0 -8
  195. package/.output/server/_libs/character-entities.mjs +0 -2130
  196. package/.output/server/_libs/class-variance-authority.mjs +0 -44
  197. package/.output/server/_libs/clsx.mjs +0 -16
  198. package/.output/server/_libs/comma-separated-tokens.mjs +0 -10
  199. package/.output/server/_libs/decode-named-character-reference+[...].mjs +0 -8
  200. package/.output/server/_libs/dequal.mjs +0 -27
  201. package/.output/server/_libs/detect-node-es.mjs +0 -1
  202. package/.output/server/_libs/devlop.mjs +0 -8
  203. package/.output/server/_libs/diff.mjs +0 -320
  204. package/.output/server/_libs/estree-util-is-identifier-name.mjs +0 -11
  205. package/.output/server/_libs/floating-ui__core.mjs +0 -725
  206. package/.output/server/_libs/floating-ui__dom.mjs +0 -622
  207. package/.output/server/_libs/floating-ui__react-dom.mjs +0 -292
  208. package/.output/server/_libs/floating-ui__utils.mjs +0 -320
  209. package/.output/server/_libs/get-nonce.mjs +0 -9
  210. package/.output/server/_libs/hast-util-to-jsx-runtime.mjs +0 -388
  211. package/.output/server/_libs/hast-util-whitespace.mjs +0 -10
  212. package/.output/server/_libs/html-url-attributes.mjs +0 -26
  213. package/.output/server/_libs/inline-style-parser.mjs +0 -142
  214. package/.output/server/_libs/is-plain-obj.mjs +0 -10
  215. package/.output/server/_libs/lucide-react.mjs +0 -1027
  216. package/.output/server/_libs/mdast-util-from-markdown.mjs +0 -717
  217. package/.output/server/_libs/mdast-util-to-hast.mjs +0 -710
  218. package/.output/server/_libs/mdast-util-to-string.mjs +0 -38
  219. package/.output/server/_libs/micromark-core-commonmark.mjs +0 -2259
  220. package/.output/server/_libs/micromark-factory-destination.mjs +0 -94
  221. package/.output/server/_libs/micromark-factory-label.mjs +0 -63
  222. package/.output/server/_libs/micromark-factory-space.mjs +0 -24
  223. package/.output/server/_libs/micromark-factory-title.mjs +0 -65
  224. package/.output/server/_libs/micromark-factory-whitespace.mjs +0 -22
  225. package/.output/server/_libs/micromark-util-character.mjs +0 -44
  226. package/.output/server/_libs/micromark-util-chunked.mjs +0 -36
  227. package/.output/server/_libs/micromark-util-classify-character+[...].mjs +0 -12
  228. package/.output/server/_libs/micromark-util-combine-extensions+[...].mjs +0 -41
  229. package/.output/server/_libs/micromark-util-decode-numeric-character-reference+[...].mjs +0 -19
  230. package/.output/server/_libs/micromark-util-decode-string.mjs +0 -21
  231. package/.output/server/_libs/micromark-util-encode.mjs +0 -1
  232. package/.output/server/_libs/micromark-util-html-tag-name.mjs +0 -69
  233. package/.output/server/_libs/micromark-util-normalize-identifier+[...].mjs +0 -6
  234. package/.output/server/_libs/micromark-util-resolve-all.mjs +0 -15
  235. package/.output/server/_libs/micromark-util-sanitize-uri.mjs +0 -41
  236. package/.output/server/_libs/micromark-util-subtokenize.mjs +0 -346
  237. package/.output/server/_libs/micromark.mjs +0 -906
  238. package/.output/server/_libs/property-information.mjs +0 -1209
  239. package/.output/server/_libs/radix-ui.mjs +0 -1
  240. package/.output/server/_libs/radix-ui__number.mjs +0 -6
  241. package/.output/server/_libs/radix-ui__primitive.mjs +0 -11
  242. package/.output/server/_libs/radix-ui__react-accordion.mjs +0 -1
  243. package/.output/server/_libs/radix-ui__react-alert-dialog.mjs +0 -1
  244. package/.output/server/_libs/radix-ui__react-arrow.mjs +0 -23
  245. package/.output/server/_libs/radix-ui__react-aspect-ratio.mjs +0 -1
  246. package/.output/server/_libs/radix-ui__react-avatar.mjs +0 -1
  247. package/.output/server/_libs/radix-ui__react-checkbox.mjs +0 -1
  248. package/.output/server/_libs/radix-ui__react-collapsible.mjs +0 -144
  249. package/.output/server/_libs/radix-ui__react-collection.mjs +0 -69
  250. package/.output/server/_libs/radix-ui__react-compose-refs.mjs +0 -38
  251. package/.output/server/_libs/radix-ui__react-context-menu.mjs +0 -1
  252. package/.output/server/_libs/radix-ui__react-context.mjs +0 -64
  253. package/.output/server/_libs/radix-ui__react-dialog.mjs +0 -280
  254. package/.output/server/_libs/radix-ui__react-direction.mjs +0 -9
  255. package/.output/server/_libs/radix-ui__react-dropdown-menu.mjs +0 -1
  256. package/.output/server/_libs/radix-ui__react-focus-guards.mjs +0 -39
  257. package/.output/server/_libs/radix-ui__react-focus-scope.mjs +0 -210
  258. package/.output/server/_libs/radix-ui__react-form.mjs +0 -1
  259. package/.output/server/_libs/radix-ui__react-hover-card.mjs +0 -1
  260. package/.output/server/_libs/radix-ui__react-id.mjs +0 -14
  261. package/.output/server/_libs/radix-ui__react-label.mjs +0 -1
  262. package/.output/server/_libs/radix-ui__react-menu.mjs +0 -1
  263. package/.output/server/_libs/radix-ui__react-menubar.mjs +0 -1
  264. package/.output/server/_libs/radix-ui__react-popover.mjs +0 -1
  265. package/.output/server/_libs/radix-ui__react-popper.mjs +0 -340
  266. package/.output/server/_libs/radix-ui__react-portal.mjs +0 -16
  267. package/.output/server/_libs/radix-ui__react-presence.mjs +0 -173
  268. package/.output/server/_libs/radix-ui__react-primitive.mjs +0 -42
  269. package/.output/server/_libs/radix-ui__react-progress.mjs +0 -1
  270. package/.output/server/_libs/radix-ui__react-radio-group.mjs +0 -1
  271. package/.output/server/_libs/radix-ui__react-roving-focus.mjs +0 -235
  272. package/.output/server/_libs/radix-ui__react-scroll-area.mjs +0 -731
  273. package/.output/server/_libs/radix-ui__react-select.mjs +0 -1207
  274. package/.output/server/_libs/radix-ui__react-separator.mjs +0 -28
  275. package/.output/server/_libs/radix-ui__react-slider.mjs +0 -1
  276. package/.output/server/_libs/radix-ui__react-slot.mjs +0 -132
  277. package/.output/server/_libs/radix-ui__react-switch.mjs +0 -1
  278. package/.output/server/_libs/radix-ui__react-tabs.mjs +0 -194
  279. package/.output/server/_libs/radix-ui__react-toast.mjs +0 -2
  280. package/.output/server/_libs/radix-ui__react-toggle-group.mjs +0 -1
  281. package/.output/server/_libs/radix-ui__react-toggle.mjs +0 -1
  282. package/.output/server/_libs/radix-ui__react-toolbar.mjs +0 -1
  283. package/.output/server/_libs/radix-ui__react-tooltip.mjs +0 -498
  284. package/.output/server/_libs/radix-ui__react-use-previous.mjs +0 -14
  285. package/.output/server/_libs/radix-ui__react-use-size.mjs +0 -39
  286. package/.output/server/_libs/react-markdown.mjs +0 -235
  287. package/.output/server/_libs/react-remove-scroll-bar.mjs +0 -82
  288. package/.output/server/_libs/react-remove-scroll.mjs +0 -328
  289. package/.output/server/_libs/react-style-singleton.mjs +0 -69
  290. package/.output/server/_libs/remark-parse.mjs +0 -19
  291. package/.output/server/_libs/remark-rehype.mjs +0 -21
  292. package/.output/server/_libs/space-separated-tokens.mjs +0 -6
  293. package/.output/server/_libs/style-to-js.mjs +0 -72
  294. package/.output/server/_libs/style-to-object.mjs +0 -38
  295. package/.output/server/_libs/swr.mjs +0 -947
  296. package/.output/server/_libs/tailwind-merge.mjs +0 -3255
  297. package/.output/server/_libs/tanstack__react-virtual.mjs +0 -130
  298. package/.output/server/_libs/tanstack__virtual-core.mjs +0 -1319
  299. package/.output/server/_libs/three.mjs +0 -26016
  300. package/.output/server/_libs/trim-lines.mjs +0 -41
  301. package/.output/server/_libs/trough.mjs +0 -85
  302. package/.output/server/_libs/tslib.mjs +0 -1
  303. package/.output/server/_libs/ungap__structured-clone.mjs +0 -212
  304. package/.output/server/_libs/unified.mjs +0 -661
  305. package/.output/server/_libs/unist-util-is.mjs +0 -100
  306. package/.output/server/_libs/unist-util-position.mjs +0 -27
  307. package/.output/server/_libs/unist-util-stringify-position.mjs +0 -27
  308. package/.output/server/_libs/unist-util-visit-parents.mjs +0 -82
  309. package/.output/server/_libs/unist-util-visit.mjs +0 -24
  310. package/.output/server/_libs/use-callback-ref.mjs +0 -66
  311. package/.output/server/_libs/use-sidecar.mjs +0 -106
  312. package/.output/server/_libs/vfile-message.mjs +0 -138
  313. package/.output/server/_libs/vfile.mjs +0 -467
  314. package/.output/server/_sessionId-CJ99gZFV.mjs +0 -84
  315. package/.output/server/_sessionId-DEjScBpK.mjs +0 -146
  316. package/.output/server/_ssr/CompareDrawer-DtOIMeQB.mjs +0 -1060
  317. package/.output/server/_ssr/InspectorPet-CXc4oCBQ.mjs +0 -938
  318. package/.output/server/_ssr/ProxyViewerContainer-DVPlwfkt.mjs +0 -17632
  319. package/.output/server/_ssr/ReplayDialog-BQEA95qC.mjs +0 -725
  320. package/.output/server/_ssr/RequestAnatomy-BMyd8B7Q.mjs +0 -837
  321. package/.output/server/_ssr/ResponseView-qrTaEIM8.mjs +0 -757
  322. package/.output/server/_ssr/StreamingChunkSequence-BFTL8mIy.mjs +0 -274
  323. package/.output/server/_ssr/index-Bcj1Hcy4.mjs +0 -135
  324. package/.output/server/_ssr/index-DW-M7XUG.mjs +0 -84
  325. package/.output/server/_ssr/json-viewer-DiI0Yjsn.mjs +0 -483
  326. package/.output/server/_tanstack-start-manifest_v-C6pXXX9R.mjs +0 -4
  327. package/.output/server/node_modules/tslib/modules/index.js +0 -70
  328. package/.output/server/node_modules/tslib/modules/package.json +0 -3
  329. package/.output/server/node_modules/tslib/package.json +0 -47
  330. package/.output/server/node_modules/tslib/tslib.js +0 -484
  331. package/.output/server/package.json +0 -9
  332. package/src/routes/__root.tsx +0 -170
  333. /package/.output/{public → ui}/assets/agent-inspector-58K1_MsC.ico +0 -0
  334. /package/.output/{public → ui}/assets/alibaba-TTwafVwX.svg +0 -0
  335. /package/.output/{public → ui}/assets/minimax-BPMzvuL-.jpeg +0 -0
  336. /package/.output/{public → ui}/assets/qwen-mMn3f5ul.webp +0 -0
  337. /package/.output/{public → ui}/assets/zhipuai-BPNAnxo-.svg +0 -0
  338. /package/src/{routes → backend/routes}/livez.ts +0 -0
@@ -1,725 +0,0 @@
1
- import { r as reactExports, j as jsxRuntimeExports } from "../_libs/react.mjs";
2
- import { u as useProviders, f as fetchJsonWithTimeout, D as Dialog, b as DialogContent, c as DialogHeader, d as DialogTitle, T as Tabs, e as TabsList, h as TabsTrigger, i as TabsContent, j as TooltipProvider, k as Tooltip, l as TooltipTrigger, m as TooltipContent, n as dispatchLogFocusRequest, A as ApiTimeoutError } from "./ProxyViewerContainer-DVPlwfkt.mjs";
3
- import { B as Button, C as CapturedLogSchema } from "./router-BJ_ltLim.mjs";
4
- import { ResponseView } from "./ResponseView-qrTaEIM8.mjs";
5
- import "./publicBasePathContext-5264L3rX.mjs";
6
- import "node:crypto";
7
- import "node:path";
8
- import "node:fs";
9
- import "node:child_process";
10
- import "node:buffer";
11
- import "node:url";
12
- import "crypto";
13
- import "node:util";
14
- import "node:net";
15
- import "../_libs/modelcontextprotocol__server.mjs";
16
- import "../_libs/jszip.mjs";
17
- import "node:os";
18
- import { p as RotateCcw, aL as Braces, z as Minimize2 } from "../_libs/lucide-react.mjs";
19
- import { o as object, n as number, f as array, e as boolean, c as string } from "../_libs/zod.mjs";
20
- import "../_libs/swr.mjs";
21
- import "../_libs/use-sync-external-store.mjs";
22
- import "../_libs/dequal.mjs";
23
- import "../_libs/tanstack__react-virtual.mjs";
24
- import "../_libs/react-dom.mjs";
25
- import "util";
26
- import "async_hooks";
27
- import "stream";
28
- import "../_libs/tanstack__virtual-core.mjs";
29
- import "../_libs/class-variance-authority.mjs";
30
- import "../_libs/clsx.mjs";
31
- import "../_libs/diff.mjs";
32
- import "../_libs/radix-ui__react-dialog.mjs";
33
- import "../_libs/radix-ui__primitive.mjs";
34
- import "../_libs/radix-ui__react-compose-refs.mjs";
35
- import "../_libs/radix-ui__react-context.mjs";
36
- import "../_libs/radix-ui__react-id.mjs";
37
- import "../_libs/@radix-ui/react-use-layout-effect+[...].mjs";
38
- import "../_libs/@radix-ui/react-use-controllable-state+[...].mjs";
39
- import "../_libs/@radix-ui/react-dismissable-layer+[...].mjs";
40
- import "../_libs/radix-ui__react-primitive.mjs";
41
- import "../_libs/radix-ui__react-slot.mjs";
42
- import "../_libs/@radix-ui/react-use-callback-ref+[...].mjs";
43
- import "../_libs/radix-ui__react-focus-scope.mjs";
44
- import "../_libs/radix-ui__react-portal.mjs";
45
- import "../_libs/radix-ui__react-presence.mjs";
46
- import "../_libs/radix-ui__react-focus-guards.mjs";
47
- import "../_libs/react-remove-scroll.mjs";
48
- import "tslib";
49
- import "../_libs/react-remove-scroll-bar.mjs";
50
- import "../_libs/react-style-singleton.mjs";
51
- import "../_libs/get-nonce.mjs";
52
- import "../_libs/use-sidecar.mjs";
53
- import "../_libs/use-callback-ref.mjs";
54
- import "../_libs/aria-hidden.mjs";
55
- import "../_libs/radix-ui__react-tabs.mjs";
56
- import "../_libs/radix-ui__react-roving-focus.mjs";
57
- import "../_libs/radix-ui__react-collection.mjs";
58
- import "../_libs/radix-ui__react-direction.mjs";
59
- import "../_libs/@radix-ui/react-use-is-hydrated+[...].mjs";
60
- import "../_libs/radix-ui__react-select.mjs";
61
- import "../_libs/radix-ui__number.mjs";
62
- import "../_libs/radix-ui__react-popper.mjs";
63
- import "../_libs/floating-ui__react-dom.mjs";
64
- import "../_libs/floating-ui__dom.mjs";
65
- import "../_libs/floating-ui__core.mjs";
66
- import "../_libs/floating-ui__utils.mjs";
67
- import "../_libs/radix-ui__react-arrow.mjs";
68
- import "../_libs/radix-ui__react-use-size.mjs";
69
- import "../_libs/radix-ui__react-use-previous.mjs";
70
- import "../_libs/@radix-ui/react-visually-hidden+[...].mjs";
71
- import "../_libs/radix-ui__react-tooltip.mjs";
72
- import "../_libs/radix-ui__react-collapsible.mjs";
73
- import "../_libs/radix-ui__react-scroll-area.mjs";
74
- import "../_libs/tanstack__react-router.mjs";
75
- import "../_libs/tanstack__router-core.mjs";
76
- import "../_libs/cookie-es.mjs";
77
- import "../_libs/seroval.mjs";
78
- import "../_libs/seroval-plugins.mjs";
79
- import "node:stream";
80
- import "../_libs/tanstack__history.mjs";
81
- import "node:stream/web";
82
- import "../_libs/isbot.mjs";
83
- import "../_libs/tailwind-merge.mjs";
84
- import "node:fs/promises";
85
- import "node:worker_threads";
86
- import "node:readline";
87
- import "../_libs/conf.mjs";
88
- import "node:process";
89
- import "node:assert";
90
- import "../_libs/dot-prop.mjs";
91
- import "../_libs/env-paths.mjs";
92
- import "../_libs/atomically.mjs";
93
- import "node:events";
94
- import "../_libs/stubborn-fs.mjs";
95
- import "../_libs/stubborn-utils.mjs";
96
- import "../_libs/when-exit.mjs";
97
- import "../_libs/ajv.mjs";
98
- import "../_libs/fast-deep-equal.mjs";
99
- import "../_libs/json-schema-traverse.mjs";
100
- import "../_libs/fast-uri.mjs";
101
- import "../_libs/ajv-formats.mjs";
102
- import "../_libs/debounce-fn.mjs";
103
- import "../_libs/mimic-function.mjs";
104
- import "../_libs/semver.mjs";
105
- import "../_libs/uint8array-extras.mjs";
106
- import "node:dns/promises";
107
- import "node:assert/strict";
108
- import "node:async_hooks";
109
- import "../_libs/modelcontextprotocol__core.mjs";
110
- import "../_libs/readable-stream.mjs";
111
- import "events";
112
- import "node:string_decoder";
113
- import "../_libs/process-nextick-args.mjs";
114
- import "../_libs/isarray.mjs";
115
- import "../_libs/safe-buffer.mjs";
116
- import "buffer";
117
- import "../_libs/core-util-is.mjs";
118
- import "../_libs/inherits.mjs";
119
- import "../_libs/util-deprecate.mjs";
120
- import "../_libs/lie.mjs";
121
- import "../_libs/immediate.mjs";
122
- import "../_libs/setimmediate.mjs";
123
- import "../_libs/pako.mjs";
124
- import "../_libs/radix-ui__react-separator.mjs";
125
- function isJsonObject(value) {
126
- return typeof value === "object" && value !== null && !Array.isArray(value);
127
- }
128
- function byteLength(value) {
129
- if (value === null || value === void 0) return null;
130
- return new TextEncoder().encode(value).length;
131
- }
132
- function readRequestModel(body) {
133
- try {
134
- const parsed = JSON.parse(body);
135
- if (!isJsonObject(parsed)) return null;
136
- const model = parsed["model"];
137
- return typeof model === "string" && model.length > 0 ? model : null;
138
- } catch {
139
- return null;
140
- }
141
- }
142
- function replaceRequestModel(body, model) {
143
- try {
144
- const parsed = JSON.parse(body);
145
- if (!isJsonObject(parsed)) {
146
- return { body, error: "Request body must be a JSON object." };
147
- }
148
- return {
149
- body: JSON.stringify({ ...parsed, model }, null, 2),
150
- error: null
151
- };
152
- } catch {
153
- return { body, error: "Request body must be valid JSON before changing the replay model." };
154
- }
155
- }
156
- function buildReplayMetrics(input) {
157
- return {
158
- status: input.status ?? null,
159
- elapsedMs: input.elapsedMs ?? null,
160
- inputTokens: input.inputTokens ?? null,
161
- outputTokens: input.outputTokens ?? null,
162
- responseBytes: byteLength(input.responseText),
163
- streaming: input.streaming === true
164
- };
165
- }
166
- function numericDelta(original, replay) {
167
- if (original === null || replay === null) return null;
168
- return replay - original;
169
- }
170
- function buildReplayComparisons(original, replay) {
171
- return [
172
- {
173
- id: "status",
174
- label: "Status",
175
- original: original.status,
176
- replay: replay.status,
177
- delta: numericDelta(original.status, replay.status)
178
- },
179
- {
180
- id: "elapsed",
181
- label: "Elapsed",
182
- original: original.elapsedMs,
183
- replay: replay.elapsedMs,
184
- delta: numericDelta(original.elapsedMs, replay.elapsedMs)
185
- },
186
- {
187
- id: "input",
188
- label: "Input",
189
- original: original.inputTokens,
190
- replay: replay.inputTokens,
191
- delta: numericDelta(original.inputTokens, replay.inputTokens)
192
- },
193
- {
194
- id: "output",
195
- label: "Output",
196
- original: original.outputTokens,
197
- replay: replay.outputTokens,
198
- delta: numericDelta(original.outputTokens, replay.outputTokens)
199
- },
200
- {
201
- id: "bytes",
202
- label: "Bytes",
203
- original: original.responseBytes,
204
- replay: replay.responseBytes,
205
- delta: numericDelta(original.responseBytes, replay.responseBytes)
206
- },
207
- {
208
- id: "streaming",
209
- label: "Stream",
210
- original: original.streaming,
211
- replay: replay.streaming,
212
- delta: null
213
- }
214
- ];
215
- }
216
- const ReplayResultSchema = object({
217
- success: boolean(),
218
- error: string().optional(),
219
- responseStatus: number().nullable().optional(),
220
- responseText: string().nullable().optional(),
221
- inputTokens: number().nullable().optional(),
222
- outputTokens: number().nullable().optional(),
223
- elapsedMs: number().nullable().optional(),
224
- streaming: boolean().optional(),
225
- replayLogId: number().optional()
226
- });
227
- const ReplayHistorySchema = object({
228
- logs: array(CapturedLogSchema),
229
- total: number()
230
- });
231
- const REPLAY_TIMEOUT_MS = 6e4;
232
- const REPLAY_HISTORY_TIMEOUT_MS = 1e4;
233
- function formatJsonForEdit(value) {
234
- try {
235
- const parsed = JSON.parse(value);
236
- return JSON.stringify(parsed, null, 2);
237
- } catch {
238
- return value;
239
- }
240
- }
241
- function compactJsonForEdit(value) {
242
- try {
243
- const parsed = JSON.parse(value);
244
- return JSON.stringify(parsed);
245
- } catch {
246
- return value;
247
- }
248
- }
249
- function readJsonEditState(value) {
250
- try {
251
- JSON.parse(value);
252
- return { valid: true, message: "Valid JSON" };
253
- } catch (err) {
254
- return {
255
- valid: false,
256
- message: err instanceof Error ? err.message : "Invalid JSON"
257
- };
258
- }
259
- }
260
- function formatElapsed(ms) {
261
- if (ms < 1e3) return `${String(ms)}ms`;
262
- return `${(ms / 1e3).toFixed(1)}s`;
263
- }
264
- function formatMetricValue(value, metricId) {
265
- if (value === null) return "-";
266
- if (typeof value === "boolean") return value ? "stream" : "non-stream";
267
- switch (metricId) {
268
- case "elapsed":
269
- return formatElapsed(value);
270
- case "input":
271
- case "output":
272
- case "bytes":
273
- return value.toLocaleString();
274
- case "status":
275
- return String(value);
276
- case "streaming":
277
- return value ? "stream" : "non-stream";
278
- }
279
- }
280
- function formatDelta(delta, metricId) {
281
- if (delta === null) return "-";
282
- const sign = delta > 0 ? "+" : "";
283
- switch (metricId) {
284
- case "elapsed":
285
- return `${sign}${formatElapsed(delta)}`;
286
- case "input":
287
- case "output":
288
- case "bytes":
289
- case "status":
290
- return `${sign}${delta.toLocaleString()}`;
291
- case "streaming":
292
- return "-";
293
- }
294
- }
295
- function deltaToneClass(delta) {
296
- if (delta === null || delta === 0) return "text-muted-foreground";
297
- if (delta > 0) return "text-amber-400";
298
- return "text-emerald-400";
299
- }
300
- function ReplayComparisonTable({
301
- comparisons
302
- }) {
303
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "overflow-hidden rounded-md border border-border", children: [
304
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-[1fr_1fr_1fr_1fr] bg-muted/40 px-3 py-2 text-[11px] font-medium text-muted-foreground", children: [
305
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Metric" }),
306
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Original" }),
307
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Replay" }),
308
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Delta" })
309
- ] }),
310
- comparisons.map((comparison) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
311
- "div",
312
- {
313
- className: "grid grid-cols-[1fr_1fr_1fr_1fr] border-t border-border px-3 py-2 text-xs",
314
- children: [
315
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-muted-foreground", children: comparison.label }),
316
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-mono", children: formatMetricValue(comparison.original, comparison.id) }),
317
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-mono", children: formatMetricValue(comparison.replay, comparison.id) }),
318
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `font-mono ${deltaToneClass(comparison.delta)}`, children: formatDelta(comparison.delta, comparison.id) })
319
- ]
320
- },
321
- comparison.id
322
- ))
323
- ] });
324
- }
325
- function ReplayDialog({
326
- log,
327
- displayNumber,
328
- open,
329
- onOpenChange
330
- }) {
331
- const { providers } = useProviders();
332
- const originalBody = log.rawRequestBody ?? "{}";
333
- const [modifiedBody, setModifiedBody] = reactExports.useState(() => {
334
- return formatJsonForEdit(originalBody);
335
- });
336
- const [replayResult, setReplayResult] = reactExports.useState(null);
337
- const [replayHistory, setReplayHistory] = reactExports.useState([]);
338
- const [loading, setLoading] = reactExports.useState(false);
339
- const [error, setError] = reactExports.useState(null);
340
- const replayAbortRef = reactExports.useRef(null);
341
- const replayRequestIdRef = reactExports.useRef(0);
342
- const jsonEditState = reactExports.useMemo(() => readJsonEditState(modifiedBody), [modifiedBody]);
343
- const cancelReplay = reactExports.useCallback(() => {
344
- replayRequestIdRef.current += 1;
345
- replayAbortRef.current?.abort();
346
- replayAbortRef.current = null;
347
- setLoading(false);
348
- }, []);
349
- const refreshReplayHistory = reactExports.useCallback(async () => {
350
- if (!open) return;
351
- try {
352
- const data = await fetchJsonWithTimeout(
353
- `/api/logs?replayOf=${String(log.id)}`,
354
- ReplayHistorySchema,
355
- REPLAY_HISTORY_TIMEOUT_MS
356
- );
357
- setReplayHistory(data.logs);
358
- } catch {
359
- }
360
- }, [log.id, open]);
361
- reactExports.useEffect(() => {
362
- void refreshReplayHistory();
363
- }, [refreshReplayHistory]);
364
- reactExports.useEffect(() => {
365
- if (open) return void 0;
366
- cancelReplay();
367
- return void 0;
368
- }, [cancelReplay, open]);
369
- reactExports.useEffect(() => {
370
- return () => {
371
- replayRequestIdRef.current += 1;
372
- replayAbortRef.current?.abort();
373
- replayAbortRef.current = null;
374
- };
375
- }, []);
376
- async function handleReplay() {
377
- if (!jsonEditState.valid) {
378
- setError("Request body must be valid JSON before replay.");
379
- return;
380
- }
381
- replayAbortRef.current?.abort();
382
- const requestId = replayRequestIdRef.current + 1;
383
- replayRequestIdRef.current = requestId;
384
- const controller = new AbortController();
385
- replayAbortRef.current = controller;
386
- setLoading(true);
387
- setError(null);
388
- setReplayResult(null);
389
- try {
390
- const data = await fetchJsonWithTimeout(
391
- `/api/logs/${log.id}/replay`,
392
- ReplayResultSchema,
393
- REPLAY_TIMEOUT_MS,
394
- {
395
- method: "POST",
396
- headers: { "Content-Type": "application/json" },
397
- body: JSON.stringify({ modifiedBody }),
398
- signal: controller.signal
399
- }
400
- );
401
- if (replayRequestIdRef.current !== requestId) return;
402
- setReplayResult(data);
403
- await refreshReplayHistory();
404
- if (!data.success) {
405
- setError(data.error ?? "Replay failed");
406
- }
407
- } catch (err) {
408
- if (replayRequestIdRef.current !== requestId) return;
409
- if (err instanceof ApiTimeoutError || err instanceof DOMException && err.name === "AbortError") {
410
- setError("Replay timed out or was canceled.");
411
- return;
412
- }
413
- setError(err instanceof Error ? err.message : "Network error");
414
- } finally {
415
- if (replayRequestIdRef.current === requestId) {
416
- replayAbortRef.current = null;
417
- setLoading(false);
418
- }
419
- }
420
- }
421
- function handleClose() {
422
- cancelReplay();
423
- setReplayResult(null);
424
- setError(null);
425
- onOpenChange(false);
426
- }
427
- function handleBodyChange(value) {
428
- setModifiedBody(value);
429
- setReplayResult(null);
430
- setError(null);
431
- }
432
- function handleFormatBody() {
433
- handleBodyChange(formatJsonForEdit(modifiedBody));
434
- }
435
- function handleCompactBody() {
436
- handleBodyChange(compactJsonForEdit(modifiedBody));
437
- }
438
- function handleResetBody() {
439
- handleBodyChange(formatJsonForEdit(originalBody));
440
- }
441
- function handleOpenReplayLog(logId) {
442
- window.location.hash = `log-${String(logId)}`;
443
- dispatchLogFocusRequest({ logId, tab: "request" });
444
- onOpenChange(false);
445
- }
446
- const replayModelOptions = reactExports.useMemo(() => {
447
- const options = [];
448
- for (const provider of providers) {
449
- for (const model of provider.models) {
450
- if (model.trim().length === 0) continue;
451
- options.push({
452
- key: `${provider.id}:${model}`,
453
- providerName: provider.name,
454
- model
455
- });
456
- }
457
- }
458
- return options;
459
- }, [providers]);
460
- const currentReplayModel = readRequestModel(modifiedBody) ?? log.model ?? "";
461
- function handleReplayModelChange(model) {
462
- const result = replaceRequestModel(modifiedBody, model);
463
- if (result.error !== null) {
464
- setError(result.error);
465
- return;
466
- }
467
- handleBodyChange(formatJsonForEdit(result.body));
468
- }
469
- const originalMetrics = buildReplayMetrics({
470
- status: log.responseStatus,
471
- elapsedMs: log.elapsedMs,
472
- inputTokens: log.inputTokens,
473
- outputTokens: log.outputTokens,
474
- responseText: log.responseText,
475
- streaming: log.streaming
476
- });
477
- const replayMetrics = replayResult === null ? null : buildReplayMetrics({
478
- status: replayResult.responseStatus,
479
- elapsedMs: replayResult.elapsedMs,
480
- inputTokens: replayResult.inputTokens,
481
- outputTokens: replayResult.outputTokens,
482
- responseText: replayResult.responseText,
483
- streaming: replayResult.streaming
484
- });
485
- const replayComparisons = replayMetrics === null ? [] : buildReplayComparisons(originalMetrics, replayMetrics);
486
- const latestReplayHistory = replayHistory.slice(-5).reverse();
487
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Dialog, { open, onOpenChange: handleClose, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(DialogContent, { className: "max-w-4xl max-h-[85vh] overflow-auto", children: [
488
- /* @__PURE__ */ jsxRuntimeExports.jsx(DialogHeader, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(DialogTitle, { className: "flex items-center gap-2", children: [
489
- /* @__PURE__ */ jsxRuntimeExports.jsx(RotateCcw, { className: "size-4" }),
490
- /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { title: `Log ID ${String(log.id)}`, children: [
491
- "Replay Request #",
492
- displayNumber
493
- ] })
494
- ] }) }),
495
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Tabs, { defaultValue: "modified", children: [
496
- /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsList, { children: [
497
- /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "modified", children: "Modified Request" }),
498
- /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "original", children: "Original Response" }),
499
- replayResult && /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "replay", children: "Replay Response" }),
500
- replayResult && /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "compare", children: "Compare" })
501
- ] }),
502
- /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsContent, { value: "modified", className: "space-y-4", children: [
503
- replayModelOptions.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid gap-1.5", children: [
504
- /* @__PURE__ */ jsxRuntimeExports.jsx("label", { htmlFor: `replay-model-${String(log.id)}`, className: "text-sm font-medium", children: "Replay target" }),
505
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
506
- "select",
507
- {
508
- id: `replay-model-${String(log.id)}`,
509
- value: currentReplayModel,
510
- onChange: (event) => handleReplayModelChange(event.currentTarget.value),
511
- className: "h-8 rounded-md border border-input bg-background px-2 text-sm",
512
- children: [
513
- currentReplayModel === "" && /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "", children: "Select model" }),
514
- currentReplayModel !== "" && !replayModelOptions.some((option) => option.model === currentReplayModel) && /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: currentReplayModel, children: currentReplayModel }),
515
- replayModelOptions.map((option) => /* @__PURE__ */ jsxRuntimeExports.jsxs("option", { value: option.model, children: [
516
- option.providerName,
517
- " / ",
518
- option.model
519
- ] }, option.key))
520
- ]
521
- }
522
- )
523
- ] }),
524
- latestReplayHistory.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2 rounded-md border border-border bg-muted/20 px-3 py-2", children: [
525
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
526
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs font-medium", children: "Replay history" }),
527
- /* @__PURE__ */ jsxRuntimeExports.jsx(
528
- Button,
529
- {
530
- type: "button",
531
- variant: "ghost",
532
- size: "sm",
533
- onClick: () => {
534
- void refreshReplayHistory();
535
- },
536
- children: "Refresh"
537
- }
538
- )
539
- ] }),
540
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid gap-1", children: latestReplayHistory.map((historyLog) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
541
- "button",
542
- {
543
- type: "button",
544
- onClick: () => handleOpenReplayLog(historyLog.id),
545
- className: "grid grid-cols-[auto_1fr_auto_auto] items-center gap-2 rounded-sm px-2 py-1 text-left text-xs hover:bg-muted",
546
- children: [
547
- /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-mono text-emerald-600", children: [
548
- "#",
549
- historyLog.id
550
- ] }),
551
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate font-mono text-muted-foreground", children: historyLog.model ?? "unknown" }),
552
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-mono text-muted-foreground", children: historyLog.responseStatus ?? "-" }),
553
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-mono text-muted-foreground", children: historyLog.elapsedMs === null ? "-" : formatElapsed(historyLog.elapsedMs) })
554
- ]
555
- },
556
- historyLog.id
557
- )) })
558
- ] }),
559
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
560
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [
561
- /* @__PURE__ */ jsxRuntimeExports.jsx("label", { htmlFor: `replay-body-${String(log.id)}`, className: "text-sm font-medium", children: "Request Body" }),
562
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
563
- /* @__PURE__ */ jsxRuntimeExports.jsx(
564
- "span",
565
- {
566
- className: jsonEditState.valid ? "text-xs text-emerald-500" : "text-xs text-destructive",
567
- children: jsonEditState.message
568
- }
569
- ),
570
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
571
- Button,
572
- {
573
- type: "button",
574
- variant: "outline",
575
- size: "sm",
576
- onClick: handleFormatBody,
577
- disabled: !jsonEditState.valid,
578
- title: "Format JSON",
579
- children: [
580
- /* @__PURE__ */ jsxRuntimeExports.jsx(Braces, { className: "size-3.5" }),
581
- "Format"
582
- ]
583
- }
584
- ),
585
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
586
- Button,
587
- {
588
- type: "button",
589
- variant: "outline",
590
- size: "sm",
591
- onClick: handleCompactBody,
592
- disabled: !jsonEditState.valid,
593
- title: "Compact JSON",
594
- children: [
595
- /* @__PURE__ */ jsxRuntimeExports.jsx(Minimize2, { className: "size-3.5" }),
596
- "Compact"
597
- ]
598
- }
599
- ),
600
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
601
- Button,
602
- {
603
- type: "button",
604
- variant: "ghost",
605
- size: "sm",
606
- onClick: handleResetBody,
607
- title: "Reset to original request",
608
- children: [
609
- /* @__PURE__ */ jsxRuntimeExports.jsx(RotateCcw, { className: "size-3.5" }),
610
- "Reset"
611
- ]
612
- }
613
- )
614
- ] })
615
- ] }),
616
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
617
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
618
- "textarea",
619
- {
620
- id: `replay-body-${String(log.id)}`,
621
- className: "w-full min-h-80 p-3 font-mono text-xs leading-5 bg-muted rounded-md border border-input resize-y tabular-nums focus:outline-none focus:ring-2 focus:ring-ring",
622
- value: modifiedBody,
623
- onChange: (e) => handleBodyChange(e.target.value),
624
- spellCheck: false
625
- }
626
- ) }),
627
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: "Edit formatted JSON before re-sending to the provider" })
628
- ] }) })
629
- ] }),
630
- error !== null && error !== "" && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-destructive bg-destructive/10 px-3 py-2 rounded-md", children: error }),
631
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
632
- Button,
633
- {
634
- onClick: () => {
635
- void handleReplay();
636
- },
637
- disabled: loading || !jsonEditState.valid,
638
- children: loading ? "Replaying..." : "Replay"
639
- }
640
- ) }),
641
- replayResult !== null && /* @__PURE__ */ jsxRuntimeExports.jsx(ReplayComparisonTable, { comparisons: replayComparisons.slice(0, 4) }),
642
- replayResult?.success === true && replayResult.replayLogId !== void 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2 rounded-md border border-emerald-500/25 bg-emerald-500/10 px-3 py-2 text-xs text-emerald-600", children: [
643
- /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
644
- "Replay saved as test log #",
645
- replayResult.replayLogId,
646
- "."
647
- ] }),
648
- /* @__PURE__ */ jsxRuntimeExports.jsx(
649
- Button,
650
- {
651
- type: "button",
652
- variant: "outline",
653
- size: "sm",
654
- onClick: () => handleOpenReplayLog(replayResult.replayLogId ?? log.id),
655
- children: "Open saved log"
656
- }
657
- )
658
- ] }),
659
- replayResult && replayResult.success && /* @__PURE__ */ jsxRuntimeExports.jsxs(Tabs, { defaultValue: "parsed", children: [
660
- /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsList, { children: [
661
- /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "parsed", children: "Response" }),
662
- /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "raw", children: "Raw Response" })
663
- ] }),
664
- /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "parsed", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
665
- ResponseView,
666
- {
667
- responseText: replayResult.responseText ?? null,
668
- responseStatus: replayResult.responseStatus ?? null,
669
- streaming: replayResult.streaming ?? false,
670
- inputTokens: replayResult.inputTokens ?? null,
671
- outputTokens: replayResult.outputTokens ?? null,
672
- apiFormat: log.apiFormat
673
- }
674
- ) }),
675
- /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "raw", children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: "font-mono text-xs whitespace-pre-wrap bg-muted p-3 rounded-md max-h-96 overflow-auto", children: replayResult.responseText ?? "No response" }) })
676
- ] })
677
- ] }),
678
- /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "original", children: log.responseText !== null ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tabs, { defaultValue: "parsed", children: [
679
- /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsList, { children: [
680
- /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "parsed", children: "Response" }),
681
- /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "raw", children: "Raw Response" })
682
- ] }),
683
- /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "parsed", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
684
- ResponseView,
685
- {
686
- responseText: log.responseText,
687
- responseStatus: log.responseStatus,
688
- streaming: log.streaming,
689
- inputTokens: log.inputTokens,
690
- outputTokens: log.outputTokens,
691
- cacheCreationInputTokens: log.cacheCreationInputTokens,
692
- cacheReadInputTokens: log.cacheReadInputTokens,
693
- apiFormat: log.apiFormat
694
- }
695
- ) }),
696
- /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "raw", children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: "font-mono text-xs whitespace-pre-wrap bg-muted p-3 rounded-md max-h-96 overflow-auto", children: log.responseText }) })
697
- ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground italic", children: "No original response" }) }),
698
- replayResult && replayResult.success && /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "replay", children: (replayResult.responseText ?? null) !== null ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tabs, { defaultValue: "parsed", children: [
699
- /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsList, { children: [
700
- /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "parsed", children: "Response" }),
701
- /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "raw", children: "Raw Response" })
702
- ] }),
703
- /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "parsed", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
704
- ResponseView,
705
- {
706
- responseText: replayResult.responseText ?? null,
707
- responseStatus: replayResult.responseStatus ?? null,
708
- streaming: replayResult.streaming ?? false,
709
- inputTokens: replayResult.inputTokens ?? null,
710
- outputTokens: replayResult.outputTokens ?? null,
711
- apiFormat: log.apiFormat
712
- }
713
- ) }),
714
- /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "raw", children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: "font-mono text-xs whitespace-pre-wrap bg-muted p-3 rounded-md max-h-96 overflow-auto", children: replayResult.responseText ?? "" }) })
715
- ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground italic", children: "No replay response" }) }),
716
- replayResult && /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsContent, { value: "compare", className: "space-y-3", children: [
717
- /* @__PURE__ */ jsxRuntimeExports.jsx(ReplayComparisonTable, { comparisons: replayComparisons }),
718
- replayResult.success ? null : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive", children: replayResult.error ?? "Replay failed" })
719
- ] })
720
- ] })
721
- ] }) });
722
- }
723
- export {
724
- ReplayDialog
725
- };