@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,757 +0,0 @@
1
- import { r as reactExports, j as jsxRuntimeExports } from "../_libs/react.mjs";
2
- import { x as formatTokens, m as cn, z as getStatusCategory, s as safeGetOwnProperty } from "./router-BJ_ltLim.mjs";
3
- import { g as getLogFormatAdapter, q as AnswerMarkdown, B as Badge, s as Collapsible, t as CollapsibleTrigger, v as CollapsibleContent, w as ScrollArea, x as LazyJsonViewer, y as safeJsonValue } from "./ProxyViewerContainer-DVPlwfkt.mjs";
4
- import "./publicBasePathContext-5264L3rX.mjs";
5
- import "node:crypto";
6
- import "node:path";
7
- import "node:fs";
8
- import "node:child_process";
9
- import "node:buffer";
10
- import "node:url";
11
- import "crypto";
12
- import "node:util";
13
- import "node:net";
14
- import "../_libs/modelcontextprotocol__server.mjs";
15
- import "../_libs/jszip.mjs";
16
- import "node:os";
17
- import { ac as Zap, T as TriangleAlert, v as CircleStop, ae as Brain, c as ChevronDown, t as ChevronRight, l as Terminal } from "../_libs/lucide-react.mjs";
18
- import { R as Root } from "../_libs/radix-ui__react-separator.mjs";
19
- import "../_libs/tanstack__react-router.mjs";
20
- import "../_libs/tanstack__router-core.mjs";
21
- import "../_libs/cookie-es.mjs";
22
- import "../_libs/seroval.mjs";
23
- import "../_libs/seroval-plugins.mjs";
24
- import "node:stream";
25
- import "../_libs/tanstack__history.mjs";
26
- import "node:stream/web";
27
- import "../_libs/react-dom.mjs";
28
- import "util";
29
- import "async_hooks";
30
- import "stream";
31
- import "../_libs/isbot.mjs";
32
- import "../_libs/swr.mjs";
33
- import "../_libs/use-sync-external-store.mjs";
34
- import "../_libs/dequal.mjs";
35
- import "../_libs/class-variance-authority.mjs";
36
- import "../_libs/clsx.mjs";
37
- import "../_libs/tailwind-merge.mjs";
38
- import "node:fs/promises";
39
- import "node:worker_threads";
40
- import "node:readline";
41
- import "../_libs/conf.mjs";
42
- import "node:process";
43
- import "node:assert";
44
- import "../_libs/dot-prop.mjs";
45
- import "../_libs/env-paths.mjs";
46
- import "../_libs/atomically.mjs";
47
- import "node:events";
48
- import "../_libs/stubborn-fs.mjs";
49
- import "../_libs/stubborn-utils.mjs";
50
- import "../_libs/when-exit.mjs";
51
- import "../_libs/ajv.mjs";
52
- import "../_libs/fast-deep-equal.mjs";
53
- import "../_libs/json-schema-traverse.mjs";
54
- import "../_libs/fast-uri.mjs";
55
- import "../_libs/ajv-formats.mjs";
56
- import "../_libs/debounce-fn.mjs";
57
- import "../_libs/mimic-function.mjs";
58
- import "../_libs/semver.mjs";
59
- import "../_libs/uint8array-extras.mjs";
60
- import "node:dns/promises";
61
- import "node:assert/strict";
62
- import "../_libs/zod.mjs";
63
- import "node:async_hooks";
64
- import "../_libs/modelcontextprotocol__core.mjs";
65
- import "../_libs/readable-stream.mjs";
66
- import "events";
67
- import "node:string_decoder";
68
- import "../_libs/process-nextick-args.mjs";
69
- import "../_libs/isarray.mjs";
70
- import "../_libs/safe-buffer.mjs";
71
- import "buffer";
72
- import "../_libs/core-util-is.mjs";
73
- import "../_libs/inherits.mjs";
74
- import "../_libs/util-deprecate.mjs";
75
- import "../_libs/lie.mjs";
76
- import "../_libs/immediate.mjs";
77
- import "../_libs/setimmediate.mjs";
78
- import "../_libs/pako.mjs";
79
- import "../_libs/tanstack__react-virtual.mjs";
80
- import "../_libs/tanstack__virtual-core.mjs";
81
- import "../_libs/diff.mjs";
82
- import "../_libs/radix-ui__react-dialog.mjs";
83
- import "../_libs/radix-ui__primitive.mjs";
84
- import "../_libs/radix-ui__react-compose-refs.mjs";
85
- import "../_libs/radix-ui__react-context.mjs";
86
- import "../_libs/radix-ui__react-id.mjs";
87
- import "../_libs/@radix-ui/react-use-layout-effect+[...].mjs";
88
- import "../_libs/@radix-ui/react-use-controllable-state+[...].mjs";
89
- import "../_libs/@radix-ui/react-dismissable-layer+[...].mjs";
90
- import "../_libs/radix-ui__react-primitive.mjs";
91
- import "../_libs/radix-ui__react-slot.mjs";
92
- import "../_libs/@radix-ui/react-use-callback-ref+[...].mjs";
93
- import "../_libs/radix-ui__react-focus-scope.mjs";
94
- import "../_libs/radix-ui__react-portal.mjs";
95
- import "../_libs/radix-ui__react-presence.mjs";
96
- import "../_libs/radix-ui__react-focus-guards.mjs";
97
- import "../_libs/react-remove-scroll.mjs";
98
- import "tslib";
99
- import "../_libs/react-remove-scroll-bar.mjs";
100
- import "../_libs/react-style-singleton.mjs";
101
- import "../_libs/get-nonce.mjs";
102
- import "../_libs/use-sidecar.mjs";
103
- import "../_libs/use-callback-ref.mjs";
104
- import "../_libs/aria-hidden.mjs";
105
- import "../_libs/radix-ui__react-tabs.mjs";
106
- import "../_libs/radix-ui__react-roving-focus.mjs";
107
- import "../_libs/radix-ui__react-collection.mjs";
108
- import "../_libs/radix-ui__react-direction.mjs";
109
- import "../_libs/@radix-ui/react-use-is-hydrated+[...].mjs";
110
- import "../_libs/radix-ui__react-select.mjs";
111
- import "../_libs/radix-ui__number.mjs";
112
- import "../_libs/radix-ui__react-popper.mjs";
113
- import "../_libs/floating-ui__react-dom.mjs";
114
- import "../_libs/floating-ui__dom.mjs";
115
- import "../_libs/floating-ui__core.mjs";
116
- import "../_libs/floating-ui__utils.mjs";
117
- import "../_libs/radix-ui__react-arrow.mjs";
118
- import "../_libs/radix-ui__react-use-size.mjs";
119
- import "../_libs/radix-ui__react-use-previous.mjs";
120
- import "../_libs/@radix-ui/react-visually-hidden+[...].mjs";
121
- import "../_libs/radix-ui__react-tooltip.mjs";
122
- import "../_libs/radix-ui__react-collapsible.mjs";
123
- import "../_libs/radix-ui__react-scroll-area.mjs";
124
- function Separator({
125
- className,
126
- orientation = "horizontal",
127
- decorative = true,
128
- ...props
129
- }) {
130
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
131
- Root,
132
- {
133
- "data-slot": "separator",
134
- decorative,
135
- orientation,
136
- className: cn(
137
- "bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
138
- className
139
- ),
140
- ...props
141
- }
142
- );
143
- }
144
- const THINKING_TAG_REGEX = /<think>([\s\S]*?)<\/think>/gi;
145
- const THINKING_TAG_REGEX_SINGLE = /<think>([\s\S]*?)<\/think>/i;
146
- function extractThinkingFromContent(text) {
147
- const match = THINKING_TAG_REGEX_SINGLE.exec(text);
148
- if (!match || match[1] === void 0) {
149
- return { thinking: null, remainingText: text };
150
- }
151
- const thinking = match[1].trim();
152
- const remainingText = text.replace(THINKING_TAG_REGEX, "").trim();
153
- return { thinking, remainingText };
154
- }
155
- function assertNever(_value) {
156
- return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {});
157
- }
158
- function SystemReminderBlock({ text }) {
159
- const [open, setOpen] = reactExports.useState(false);
160
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(Collapsible, { open, onOpenChange: setOpen, children: [
161
- /* @__PURE__ */ jsxRuntimeExports.jsxs(CollapsibleTrigger, { className: "flex items-center gap-1.5 py-0.5 cursor-pointer hover:opacity-80 transition-opacity group", children: [
162
- open ? /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDown, { className: "size-3 text-muted-foreground" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "size-3 text-muted-foreground" }),
163
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-muted-foreground text-xs italic select-none opacity-60", children: "[system-reminder]" })
164
- ] }),
165
- /* @__PURE__ */ jsxRuntimeExports.jsx(CollapsibleContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pl-4 pt-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AnswerMarkdown, { text }) }) })
166
- ] });
167
- }
168
- const TextBlock = reactExports.memo(function TextBlock2({ text }) {
169
- if (text.includes("<system-reminder>")) {
170
- return /* @__PURE__ */ jsxRuntimeExports.jsx(SystemReminderBlock, { text });
171
- }
172
- const { thinking, remainingText } = extractThinkingFromContent(text);
173
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
174
- thinking !== null && /* @__PURE__ */ jsxRuntimeExports.jsx(ThinkingBlock, { thinking }),
175
- remainingText.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(AnswerMarkdown, { text: remainingText }),
176
- thinking === null && remainingText.length === 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground italic", children: "Empty text block" })
177
- ] });
178
- });
179
- const ThinkingBlock = reactExports.memo(function ThinkingBlock2({
180
- thinking
181
- }) {
182
- const [open, setOpen] = reactExports.useState(false);
183
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Collapsible, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "border-l-2 border-purple-500/40 my-1", children: [
184
- /* @__PURE__ */ jsxRuntimeExports.jsxs(CollapsibleTrigger, { className: "flex items-center gap-1.5 px-3 py-1 w-full text-left cursor-pointer hover:bg-purple-500/5 transition-colors rounded-r-sm group", children: [
185
- /* @__PURE__ */ jsxRuntimeExports.jsx(Brain, { className: "size-3.5 text-purple-400 shrink-0" }),
186
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-medium text-purple-400", children: "Thinking" }),
187
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
188
- Badge,
189
- {
190
- variant: "ghost",
191
- className: "text-[10px] text-muted-foreground px-1.5 py-0 h-4 font-mono",
192
- children: [
193
- thinking.length.toLocaleString(),
194
- " chars"
195
- ]
196
- }
197
- ),
198
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "flex-1" }),
199
- open ? /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDown, { className: "size-3 text-muted-foreground" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "size-3 text-muted-foreground" })
200
- ] }),
201
- /* @__PURE__ */ jsxRuntimeExports.jsx(CollapsibleContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-3 pb-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollArea, { className: "max-h-[60vh]", children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: "text-xs text-muted-foreground whitespace-pre-wrap font-mono leading-relaxed", children: thinking }) }) }) })
202
- ] }) });
203
- });
204
- const ToolUseBlock = reactExports.memo(function ToolUseBlock2({
205
- name,
206
- input,
207
- toolIndex,
208
- toolFocus
209
- }) {
210
- const [open, setOpen] = reactExports.useState(false);
211
- const triggerRef = reactExports.useRef(null);
212
- const shouldFocus = toolFocus?.focusedToolIndex === toolIndex;
213
- reactExports.useEffect(() => {
214
- if (!shouldFocus || toolFocus === void 0 || toolFocus.toolFocusNonce <= 0) return void 0;
215
- setOpen(true);
216
- const timer = window.setTimeout(() => {
217
- const trigger = triggerRef.current;
218
- if (trigger === null) return;
219
- trigger.scrollIntoView({ block: "center", behavior: "smooth" });
220
- trigger.focus({ preventScroll: true });
221
- }, 0);
222
- return () => window.clearTimeout(timer);
223
- }, [shouldFocus, toolFocus, toolFocus?.toolFocusNonce]);
224
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Collapsible, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "border-l-2 border-sky-400/25 my-1", "data-response-tool-index": toolIndex, children: [
225
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
226
- CollapsibleTrigger,
227
- {
228
- ref: triggerRef,
229
- className: "flex items-center gap-1.5 px-3 py-1 w-full text-left cursor-pointer hover:bg-sky-400/[0.04] transition-colors rounded-r-sm group focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
230
- children: [
231
- /* @__PURE__ */ jsxRuntimeExports.jsx(Terminal, { className: "size-3.5 text-sky-400/70 shrink-0" }),
232
- /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { variant: "outline", className: "text-[10px] font-mono px-1.5 py-0 h-4", children: name }),
233
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "flex-1" }),
234
- open ? /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDown, { className: "size-3 text-muted-foreground" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "size-3 text-muted-foreground" })
235
- ]
236
- }
237
- ),
238
- /* @__PURE__ */ jsxRuntimeExports.jsx(CollapsibleContent, { children: open && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-3 pb-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollArea, { className: "max-h-[60vh]", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
239
- reactExports.Suspense,
240
- {
241
- fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-muted-foreground", children: "Loading JSON..." }),
242
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(LazyJsonViewer, { data: safeJsonValue(input), defaultExpandDepth: 0 })
243
- }
244
- ) }) }) })
245
- ] }) });
246
- });
247
- const ResponseContentBlockRenderer = reactExports.memo(function ResponseContentBlockRenderer2({
248
- block,
249
- toolIndex,
250
- toolFocus
251
- }) {
252
- switch (block.type) {
253
- case "text":
254
- return /* @__PURE__ */ jsxRuntimeExports.jsx(TextBlock, { text: block.text });
255
- case "thinking":
256
- case "think":
257
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ThinkingBlock, { thinking: block.thinking });
258
- case "tool_use":
259
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
260
- ToolUseBlock,
261
- {
262
- name: block.name,
263
- input: block.input,
264
- toolIndex: toolIndex ?? 0,
265
- toolFocus
266
- }
267
- );
268
- default:
269
- return assertNever();
270
- }
271
- });
272
- const StructuredResponseViewAnthropic = reactExports.memo(function StructuredResponseViewAnthropic2({
273
- response,
274
- toolFocus
275
- }) {
276
- let toolIndex = 0;
277
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-3", children: [
278
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [
279
- /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { variant: "secondary", className: "text-[10px] px-1.5 py-0 h-5 font-mono", children: response.model }),
280
- response.stop_reason !== null && /* @__PURE__ */ jsxRuntimeExports.jsxs(
281
- Badge,
282
- {
283
- variant: "outline",
284
- className: "text-[10px] px-1.5 py-0 h-5 font-mono flex items-center gap-1",
285
- children: [
286
- /* @__PURE__ */ jsxRuntimeExports.jsx(CircleStop, { className: "size-2.5" }),
287
- response.stop_reason
288
- ]
289
- }
290
- ),
291
- /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center gap-1 text-muted-foreground text-xs", children: [
292
- /* @__PURE__ */ jsxRuntimeExports.jsx(Zap, { className: "size-3" }),
293
- /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-mono tabular-nums", children: [
294
- formatTokens(response.usage.input_tokens ?? 0),
295
- " in /",
296
- " ",
297
- formatTokens(response.usage.output_tokens ?? 0),
298
- " out"
299
- ] }),
300
- response.usage.cache_creation_input_tokens !== void 0 && response.usage.cache_creation_input_tokens !== null && response.usage.cache_creation_input_tokens > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-mono tabular-nums text-emerald-400", children: [
301
- "KV Cache +",
302
- formatTokens(response.usage.cache_creation_input_tokens)
303
- ] }),
304
- response.usage.cache_read_input_tokens !== void 0 && response.usage.cache_read_input_tokens !== null && response.usage.cache_read_input_tokens > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-mono tabular-nums text-purple-400", children: [
305
- "KV Cache ~",
306
- formatTokens(response.usage.cache_read_input_tokens)
307
- ] })
308
- ] })
309
- ] }),
310
- /* @__PURE__ */ jsxRuntimeExports.jsx(Separator, { className: "opacity-50" }),
311
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
312
- response.content.map((block, i) => {
313
- const currentToolIndex = block.type === "tool_use" ? toolIndex : void 0;
314
- if (block.type === "tool_use") toolIndex += 1;
315
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
316
- ResponseContentBlockRenderer,
317
- {
318
- block,
319
- toolIndex: currentToolIndex,
320
- toolFocus
321
- },
322
- i
323
- );
324
- }),
325
- response.content.length === 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground italic", children: "Empty response content" })
326
- ] })
327
- ] });
328
- });
329
- function parseToolArguments(raw) {
330
- if (raw === void 0 || raw === "") return {};
331
- try {
332
- return JSON.parse(raw);
333
- } catch {
334
- return null;
335
- }
336
- }
337
- function useToolFocus({
338
- toolIndex,
339
- toolFocus,
340
- setOpen
341
- }) {
342
- const triggerRef = reactExports.useRef(null);
343
- const shouldFocus = toolFocus?.focusedToolIndex === toolIndex;
344
- reactExports.useEffect(() => {
345
- if (!shouldFocus || toolFocus === void 0 || toolFocus.toolFocusNonce <= 0) return void 0;
346
- setOpen(true);
347
- const timer = window.setTimeout(() => {
348
- const trigger = triggerRef.current;
349
- if (trigger === null) return;
350
- trigger.scrollIntoView({ block: "center", behavior: "smooth" });
351
- trigger.focus({ preventScroll: true });
352
- }, 0);
353
- return () => window.clearTimeout(timer);
354
- }, [setOpen, shouldFocus, toolFocus, toolFocus?.toolFocusNonce]);
355
- return triggerRef;
356
- }
357
- function OpenAIFunctionCallBlock({
358
- name,
359
- argumentsText,
360
- toolIndex,
361
- toolFocus
362
- }) {
363
- const blockRef = reactExports.useRef(null);
364
- const shouldFocus = toolFocus?.focusedToolIndex === toolIndex;
365
- reactExports.useEffect(() => {
366
- if (!shouldFocus || toolFocus === void 0 || toolFocus.toolFocusNonce <= 0) return void 0;
367
- const timer = window.setTimeout(() => {
368
- const block = blockRef.current;
369
- if (block === null) return;
370
- block.scrollIntoView({ block: "center", behavior: "smooth" });
371
- block.focus({ preventScroll: true });
372
- }, 0);
373
- return () => window.clearTimeout(timer);
374
- }, [shouldFocus, toolFocus, toolFocus?.toolFocusNonce]);
375
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
376
- "div",
377
- {
378
- ref: blockRef,
379
- tabIndex: -1,
380
- className: "border border-sky-400/20 rounded-md p-3 bg-muted/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
381
- "data-response-tool-index": toolIndex,
382
- children: [
383
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-sky-400/80 font-mono mb-1", children: "function_call" }),
384
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "font-mono text-xs", children: [
385
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-foreground/80", children: name }),
386
- /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-muted-foreground", children: [
387
- "(",
388
- argumentsText,
389
- ")"
390
- ] })
391
- ] })
392
- ]
393
- }
394
- );
395
- }
396
- function OpenAIToolCallBlock({
397
- call,
398
- toolIndex,
399
- toolFocus
400
- }) {
401
- const [open, setOpen] = reactExports.useState(false);
402
- const name = call.function.name ?? "(unnamed tool)";
403
- const parsed = open ? parseToolArguments(call.function.arguments) : {};
404
- const triggerRef = useToolFocus({ toolIndex, toolFocus, setOpen });
405
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Collapsible, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "border-l-2 border-sky-400/25 my-1", "data-response-tool-index": toolIndex, children: [
406
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
407
- CollapsibleTrigger,
408
- {
409
- ref: triggerRef,
410
- className: "flex items-center gap-1.5 px-3 py-1 w-full text-left cursor-pointer hover:bg-sky-400/[0.04] transition-colors rounded-r-sm group focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
411
- children: [
412
- /* @__PURE__ */ jsxRuntimeExports.jsx(Terminal, { className: "size-3.5 text-sky-400/70 shrink-0" }),
413
- /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { variant: "outline", className: "text-[10px] font-mono px-1.5 py-0 h-4", children: name }),
414
- call.id !== void 0 && call.id !== "" && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-[10px] font-mono text-muted-foreground/60 truncate", children: call.id }),
415
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "flex-1" }),
416
- open ? /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDown, { className: "size-3 text-muted-foreground" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "size-3 text-muted-foreground" })
417
- ]
418
- }
419
- ),
420
- /* @__PURE__ */ jsxRuntimeExports.jsx(CollapsibleContent, { children: open && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-3 pb-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollArea, { className: "max-h-[60vh]", children: parsed === null ? (
421
- // JSON.parse failed — show the raw string so the user can
422
- // still see what the model tried to call.
423
- /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: "font-mono text-xs whitespace-pre-wrap break-words text-rose-300/90", children: call.function.arguments })
424
- ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
425
- reactExports.Suspense,
426
- {
427
- fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-muted-foreground", children: "Loading JSON..." }),
428
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(LazyJsonViewer, { data: safeJsonValue(parsed), defaultExpandDepth: 0 })
429
- }
430
- ) }) }) })
431
- ] }) });
432
- }
433
- function extractResponsesOutputText(response) {
434
- if (response.output_text !== void 0 && response.output_text.length > 0) {
435
- return response.output_text;
436
- }
437
- const parts = [];
438
- for (const outputItem of response.output ?? []) {
439
- if (safeGetOwnProperty(outputItem, "type") !== "message") continue;
440
- const content = safeGetOwnProperty(outputItem, "content");
441
- if (!Array.isArray(content)) continue;
442
- for (const contentPart of content) {
443
- const type = safeGetOwnProperty(contentPart, "type");
444
- const text = safeGetOwnProperty(contentPart, "text");
445
- if ((type === "output_text" || type === "text") && typeof text === "string") {
446
- parts.push(text);
447
- }
448
- }
449
- }
450
- return parts.join("\n");
451
- }
452
- function extractResponsesFunctionCalls(response) {
453
- const calls = [];
454
- for (const outputItem of response.output ?? []) {
455
- if (safeGetOwnProperty(outputItem, "type") !== "function_call") continue;
456
- const name = safeGetOwnProperty(outputItem, "name");
457
- if (typeof name !== "string" || name.length === 0) continue;
458
- const id = safeGetOwnProperty(outputItem, "id");
459
- const callId = safeGetOwnProperty(outputItem, "call_id");
460
- const args = safeGetOwnProperty(outputItem, "arguments");
461
- const status = safeGetOwnProperty(outputItem, "status");
462
- calls.push({
463
- id: typeof id === "string" && id.length > 0 ? id : null,
464
- callId: typeof callId === "string" && callId.length > 0 ? callId : null,
465
- name,
466
- argumentsText: typeof args === "string" ? args : "",
467
- status: typeof status === "string" && status.length > 0 ? status : null
468
- });
469
- }
470
- return calls;
471
- }
472
- function ResponsesFunctionCallBlock({
473
- call,
474
- toolIndex,
475
- toolFocus
476
- }) {
477
- const [open, setOpen] = reactExports.useState(false);
478
- const parsed = open ? parseToolArguments(call.argumentsText) : {};
479
- const identity = call.callId ?? call.id;
480
- const triggerRef = useToolFocus({ toolIndex, toolFocus, setOpen });
481
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Collapsible, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "border-l-2 border-sky-400/25 my-1", "data-response-tool-index": toolIndex, children: [
482
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
483
- CollapsibleTrigger,
484
- {
485
- ref: triggerRef,
486
- className: "flex items-center gap-1.5 px-3 py-1 w-full text-left cursor-pointer hover:bg-sky-400/[0.04] transition-colors rounded-r-sm group focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
487
- children: [
488
- /* @__PURE__ */ jsxRuntimeExports.jsx(Terminal, { className: "size-3.5 text-sky-400/70 shrink-0" }),
489
- /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { variant: "outline", className: "text-[10px] font-mono px-1.5 py-0 h-4", children: call.name }),
490
- identity !== null && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-[10px] font-mono text-muted-foreground/60 truncate", children: identity }),
491
- call.status !== null && /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { variant: "secondary", className: "text-[10px] px-1.5 py-0 h-4 font-mono", children: call.status }),
492
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "flex-1" }),
493
- open ? /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDown, { className: "size-3 text-muted-foreground" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "size-3 text-muted-foreground" })
494
- ]
495
- }
496
- ),
497
- /* @__PURE__ */ jsxRuntimeExports.jsx(CollapsibleContent, { children: open && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-3 pb-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollArea, { className: "max-h-[60vh]", children: parsed === null ? /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: "font-mono text-xs whitespace-pre-wrap break-words text-rose-300/90", children: call.argumentsText }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
498
- reactExports.Suspense,
499
- {
500
- fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-muted-foreground", children: "Loading JSON..." }),
501
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(LazyJsonViewer, { data: safeJsonValue(parsed), defaultExpandDepth: 0 })
502
- }
503
- ) }) }) })
504
- ] }) });
505
- }
506
- const OpenAIResponseView = reactExports.memo(function OpenAIResponseView2({
507
- response,
508
- toolFocus
509
- }) {
510
- const choice = response.choices[0];
511
- const message = choice?.message;
512
- const toolCalls = message?.tool_calls ?? [];
513
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-3", children: [
514
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [
515
- /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { variant: "secondary", className: "text-[10px] px-1.5 py-0 h-5 font-mono", children: response.model }),
516
- choice?.finish_reason !== null && choice?.finish_reason !== void 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs(
517
- Badge,
518
- {
519
- variant: "outline",
520
- className: "text-[10px] px-1.5 py-0 h-5 font-mono flex items-center gap-1",
521
- children: [
522
- /* @__PURE__ */ jsxRuntimeExports.jsx(CircleStop, { className: "size-2.5" }),
523
- choice.finish_reason
524
- ]
525
- }
526
- ),
527
- /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center gap-1 text-muted-foreground text-xs", children: [
528
- /* @__PURE__ */ jsxRuntimeExports.jsx(Zap, { className: "size-3" }),
529
- /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-mono tabular-nums", children: [
530
- formatTokens(response.usage.prompt_tokens ?? 0),
531
- " in /",
532
- " ",
533
- formatTokens(response.usage.completion_tokens ?? 0),
534
- " out"
535
- ] })
536
- ] })
537
- ] }),
538
- /* @__PURE__ */ jsxRuntimeExports.jsx(Separator, { className: "opacity-50" }),
539
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
540
- message?.reasoning_content !== null && message?.reasoning_content !== void 0 && message.reasoning_content.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(ThinkingBlock, { thinking: message.reasoning_content }),
541
- message?.content !== null && message?.content !== void 0 && message.content.length > 0 && (() => {
542
- const hasReasoningField = message.reasoning_content !== null && message.reasoning_content !== void 0 && message.reasoning_content.length > 0;
543
- const { thinking, remainingText } = extractThinkingFromContent(message.content);
544
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
545
- thinking !== null && !hasReasoningField && /* @__PURE__ */ jsxRuntimeExports.jsx(ThinkingBlock, { thinking }),
546
- remainingText.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(AnswerMarkdown, { text: remainingText })
547
- ] });
548
- })(),
549
- toolCalls.map((call, i) => (
550
- // biome-ignore lint/suspicious/noArrayIndexKey: tool_calls is the positionally stable list from the response
551
- /* @__PURE__ */ jsxRuntimeExports.jsx(
552
- OpenAIToolCallBlock,
553
- {
554
- call,
555
- toolIndex: i,
556
- toolFocus
557
- },
558
- call.id ?? `tc-${i}`
559
- )
560
- )),
561
- message?.function_call !== null && message?.function_call !== void 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
562
- OpenAIFunctionCallBlock,
563
- {
564
- name: message.function_call.name,
565
- argumentsText: message.function_call.arguments,
566
- toolIndex: toolCalls.length,
567
- toolFocus
568
- }
569
- ),
570
- (message?.content === null || message?.content === void 0 || message.content.length === 0) && (message?.reasoning_content === null || message?.reasoning_content === void 0 || message.reasoning_content.length === 0) && (message?.function_call === null || message?.function_call === void 0) && toolCalls.length === 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground italic", children: "Empty response content" })
571
- ] })
572
- ] });
573
- });
574
- const OpenAIResponsesResponseView = reactExports.memo(function OpenAIResponsesResponseView2({
575
- response,
576
- toolFocus
577
- }) {
578
- const text = extractResponsesOutputText(response);
579
- const calls = extractResponsesFunctionCalls(response);
580
- const status = response.status ?? null;
581
- const inputTokens = response.usage?.input_tokens ?? 0;
582
- const outputTokens = response.usage?.output_tokens ?? 0;
583
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-3", children: [
584
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [
585
- response.model !== void 0 && response.model.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { variant: "secondary", className: "text-[10px] px-1.5 py-0 h-5 font-mono", children: response.model }),
586
- status !== null && /* @__PURE__ */ jsxRuntimeExports.jsxs(
587
- Badge,
588
- {
589
- variant: "outline",
590
- className: "text-[10px] px-1.5 py-0 h-5 font-mono flex items-center gap-1",
591
- children: [
592
- /* @__PURE__ */ jsxRuntimeExports.jsx(CircleStop, { className: "size-2.5" }),
593
- status
594
- ]
595
- }
596
- ),
597
- /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center gap-1 text-muted-foreground text-xs", children: [
598
- /* @__PURE__ */ jsxRuntimeExports.jsx(Zap, { className: "size-3" }),
599
- /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-mono tabular-nums", children: [
600
- formatTokens(inputTokens),
601
- " in / ",
602
- formatTokens(outputTokens),
603
- " out"
604
- ] })
605
- ] })
606
- ] }),
607
- /* @__PURE__ */ jsxRuntimeExports.jsx(Separator, { className: "opacity-50" }),
608
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
609
- text.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(AnswerMarkdown, { text }),
610
- calls.map((call, i) => (
611
- // biome-ignore lint/suspicious/noArrayIndexKey: response output order is stable
612
- /* @__PURE__ */ jsxRuntimeExports.jsx(
613
- ResponsesFunctionCallBlock,
614
- {
615
- call,
616
- toolIndex: i,
617
- toolFocus
618
- },
619
- call.callId ?? call.id ?? `call-${i}`
620
- )
621
- )),
622
- text.length === 0 && calls.length === 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground italic", children: "Empty response content" })
623
- ] })
624
- ] });
625
- });
626
- function isRecord(value) {
627
- return typeof value === "object" && value !== null && !Array.isArray(value);
628
- }
629
- function isOpenAIResponse(response) {
630
- return isRecord(response) && response.object === "chat.completion";
631
- }
632
- function isOpenAIResponsesResponse(response) {
633
- return isRecord(response) && response.object === "response";
634
- }
635
- function isAnthropicResponse(response) {
636
- return isRecord(response) && response.type === "message" && Array.isArray(response.content);
637
- }
638
- function formatViewFor(apiFormat, response, toolFocus) {
639
- if (apiFormat === "openai" && isOpenAIResponse(response)) {
640
- return /* @__PURE__ */ jsxRuntimeExports.jsx(OpenAIResponseView, { response, toolFocus });
641
- }
642
- if (apiFormat === "openai" && isOpenAIResponsesResponse(response)) {
643
- return /* @__PURE__ */ jsxRuntimeExports.jsx(OpenAIResponsesResponseView, { response, toolFocus });
644
- }
645
- if (apiFormat === "anthropic" && isAnthropicResponse(response)) {
646
- return /* @__PURE__ */ jsxRuntimeExports.jsx(StructuredResponseViewAnthropic, { response, toolFocus });
647
- }
648
- return null;
649
- }
650
- function getStatusClasses(category) {
651
- switch (category) {
652
- case "success":
653
- return "text-emerald-400";
654
- case "client_error":
655
- return "text-amber-400";
656
- case "server_error":
657
- return "text-red-400";
658
- case "pending":
659
- return "text-muted-foreground";
660
- }
661
- }
662
- function StatusIndicator({ status }) {
663
- const category = getStatusCategory(status);
664
- const classes = getStatusClasses(category);
665
- if (status === null) {
666
- return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-muted-foreground italic", children: "pending" });
667
- }
668
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: cn("flex items-center gap-1 text-xs font-mono font-semibold", classes), children: [
669
- category === "server_error" && /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleAlert, { className: "size-3" }),
670
- status
671
- ] });
672
- }
673
- function ErrorResponseView({ text }) {
674
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md border border-red-500/30 bg-red-500/5 p-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: "text-xs text-red-300 whitespace-pre-wrap font-mono leading-relaxed overflow-auto max-h-[60vh]", children: text }) });
675
- }
676
- function MarkdownFallbackView({ text }) {
677
- return /* @__PURE__ */ jsxRuntimeExports.jsx(AnswerMarkdown, { text });
678
- }
679
- const ResponseView = reactExports.memo(function ResponseView2({
680
- responseText,
681
- responseStatus,
682
- streaming,
683
- inputTokens,
684
- outputTokens,
685
- cacheCreationInputTokens,
686
- cacheReadInputTokens,
687
- apiFormat,
688
- error,
689
- focusedToolIndex = null,
690
- toolFocusNonce = 0
691
- }) {
692
- const resolvedFormat = apiFormat ?? "unknown";
693
- const parsed = reactExports.useMemo(
694
- () => getLogFormatAdapter(resolvedFormat).analyzeResponse(responseText).parsed,
695
- [resolvedFormat, responseText]
696
- );
697
- if (responseText === null && error === void 0) {
698
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 py-3", children: [
699
- /* @__PURE__ */ jsxRuntimeExports.jsx(StatusIndicator, { status: responseStatus }),
700
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-muted-foreground italic", children: "No response" })
701
- ] });
702
- }
703
- const isHttpError = responseStatus !== null && responseStatus >= 400;
704
- if (isHttpError) {
705
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
706
- /* @__PURE__ */ jsxRuntimeExports.jsx(StatusIndicator, { status: responseStatus }),
707
- /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorResponseView, { text: responseText ?? "" }),
708
- error !== void 0 && error !== null && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "rounded border border-destructive/50 bg-destructive/10 p-3 text-xs", children: [
709
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-semibold text-destructive mb-1", children: "SSE Error" }),
710
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-muted-foreground font-mono", children: error })
711
- ] })
712
- ] });
713
- }
714
- if (error !== void 0 && error !== null) {
715
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
716
- /* @__PURE__ */ jsxRuntimeExports.jsx(StatusIndicator, { status: responseStatus }),
717
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "rounded border border-destructive/50 bg-destructive/10 p-3 text-xs", children: [
718
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-semibold text-destructive mb-1", children: "SSE Error" }),
719
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-muted-foreground font-mono", children: error })
720
- ] }),
721
- responseText !== null && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorResponseView, { text: responseText }) })
722
- ] });
723
- }
724
- if (parsed !== null) {
725
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
726
- /* @__PURE__ */ jsxRuntimeExports.jsx(StatusIndicator, { status: responseStatus }),
727
- formatViewFor(resolvedFormat, parsed, { focusedToolIndex, toolFocusNonce })
728
- ] });
729
- }
730
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
731
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
732
- /* @__PURE__ */ jsxRuntimeExports.jsx(StatusIndicator, { status: responseStatus }),
733
- streaming && (inputTokens !== null || outputTokens !== null) && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center gap-1 text-muted-foreground text-xs", children: [
734
- /* @__PURE__ */ jsxRuntimeExports.jsx(Zap, { className: "size-3" }),
735
- /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-mono tabular-nums", children: [
736
- inputTokens !== null ? formatTokens(inputTokens) : "—",
737
- " in /",
738
- " ",
739
- outputTokens !== null ? formatTokens(outputTokens) : "—",
740
- " out"
741
- ] }),
742
- cacheCreationInputTokens !== null && cacheCreationInputTokens !== void 0 && cacheCreationInputTokens > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-mono tabular-nums text-emerald-400", children: [
743
- "KV Cache +",
744
- formatTokens(cacheCreationInputTokens)
745
- ] }),
746
- cacheReadInputTokens !== null && cacheReadInputTokens !== void 0 && cacheReadInputTokens > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-mono tabular-nums text-purple-400", children: [
747
- "KV Cache ~",
748
- formatTokens(cacheReadInputTokens)
749
- ] })
750
- ] })
751
- ] }),
752
- /* @__PURE__ */ jsxRuntimeExports.jsx(MarkdownFallbackView, { text: responseText ?? "" })
753
- ] });
754
- });
755
- export {
756
- ResponseView
757
- };