@tonyclaw/agent-inspector 4.0.1 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (373) hide show
  1. package/.output/backend/nitro.json +1 -1
  2. package/.output/cli.js +192 -109
  3. package/.output/server/_ssr/index.mjs +1 -1
  4. package/.output/server/_ssr/{router-CTHqmroT.mjs → router-BBY_zWRK.mjs} +91 -3
  5. package/.output/server/index.mjs +1 -1
  6. package/.output/ui/assets/{CompareDrawer-L3n4J-Or.js → CompareDrawer-rtNElN-B.js} +1 -1
  7. package/.output/ui/assets/{InspectorPet-D5o_3OZS.js → InspectorPet-QaAiuF3d.js} +1 -1
  8. package/.output/ui/assets/{ProxyViewerContainer-Ocagx75S.js → ProxyViewerContainer-6twNZHwl.js} +4 -4
  9. package/.output/ui/assets/{ReplayDialog-Bk7x1h-y.js → ReplayDialog-B7KlziO2.js} +1 -1
  10. package/.output/ui/assets/{RequestAnatomy-U4lzL7Sc.js → RequestAnatomy-2XVFBrW4.js} +1 -1
  11. package/.output/ui/assets/{ResponseView-LOWfvBLK.js → ResponseView-BULgzLVB.js} +1 -1
  12. package/.output/ui/assets/{StreamingChunkSequence-DPfsrrXQ.js → StreamingChunkSequence-DSkvkbns.js} +1 -1
  13. package/.output/ui/assets/{_sessionId-OdX2Jvt1.js → _sessionId-D2dmJi3G.js} +1 -1
  14. package/.output/ui/assets/{_sessionId-0MlWS-CO.js → _sessionId-DcS0s1Mr.js} +1 -1
  15. package/.output/ui/assets/{index-Du4qNOOt.js → index-B0TN1KKO.js} +2 -2
  16. package/.output/ui/assets/{index-gvFj_9K6.js → index-Bva1zHEs.js} +1 -1
  17. package/.output/ui/assets/{index-Ea-c8hPg.js → index-BzBExOxu.js} +1 -1
  18. package/.output/ui/assets/{index-zVVS53Hd.js → index-k6sRQz55.js} +1 -1
  19. package/.output/ui/assets/{json-viewer-C1WAMzg3.js → json-viewer-CWM4tY-j.js} +1 -1
  20. package/.output/ui/assets/{jszip.min-B8AKu2zm.js → jszip.min-BkWvRFlo.js} +1 -1
  21. package/.output/ui/index.html +1 -1
  22. package/package.json +5 -10
  23. package/src/assets/IDE/claudecode-color.svg +0 -1
  24. package/src/assets/IDE/codex-color.svg +0 -1
  25. package/src/assets/IDE/opencode.svg +0 -1
  26. package/src/assets/IDE/xiaomimimo.svg +0 -1
  27. package/src/assets/favicon.svg +0 -21
  28. package/src/assets/logos/alibaba.svg +0 -1
  29. package/src/assets/logos/anthropic.svg +0 -1
  30. package/src/assets/logos/claude-code.svg +0 -4
  31. package/src/assets/logos/deepseek.svg +0 -1
  32. package/src/assets/logos/minimax.jpeg +0 -0
  33. package/src/assets/logos/openai.svg +0 -1
  34. package/src/assets/logos/opencode.svg +0 -4
  35. package/src/assets/logos/qwen.webp +0 -0
  36. package/src/assets/logos/zhipuai.svg +0 -219
  37. package/src/backend/router.tsx +0 -36
  38. package/src/backend/routes/$.ts +0 -26
  39. package/src/backend/routes/__root.ts +0 -4
  40. package/src/backend/routes/api/-instances.ts +0 -7
  41. package/src/backend/routes/api/alerts.summary.ts +0 -28
  42. package/src/backend/routes/api/alerts.ts +0 -70
  43. package/src/backend/routes/api/config.paths.ts +0 -14
  44. package/src/backend/routes/api/config.ts +0 -73
  45. package/src/backend/routes/api/ecosystem.packages.$packageId.help.ts +0 -11
  46. package/src/backend/routes/api/ecosystem.packages.$packageId.install.ts +0 -11
  47. package/src/backend/routes/api/ecosystem.packages.$packageId.runner-presets.ts +0 -11
  48. package/src/backend/routes/api/ecosystem.packages.$packageId.upgrade.ts +0 -11
  49. package/src/backend/routes/api/ecosystem.packages.ts +0 -21
  50. package/src/backend/routes/api/ecosystem.recipes.$recipeId.run.ts +0 -11
  51. package/src/backend/routes/api/ecosystem.tasks.$taskId.ts +0 -16
  52. package/src/backend/routes/api/ecosystem.tasks.ts +0 -12
  53. package/src/backend/routes/api/groups.$groupId.evidence.ts +0 -55
  54. package/src/backend/routes/api/groups.$groupId.sessions.ts +0 -50
  55. package/src/backend/routes/api/groups.$groupId.ts +0 -93
  56. package/src/backend/routes/api/groups.ts +0 -79
  57. package/src/backend/routes/api/health.ts +0 -22
  58. package/src/backend/routes/api/instances.$name.connection.ts +0 -12
  59. package/src/backend/routes/api/instances.$name.restart.ts +0 -23
  60. package/src/backend/routes/api/instances.$name.start.ts +0 -18
  61. package/src/backend/routes/api/instances.$name.stop.ts +0 -23
  62. package/src/backend/routes/api/instances.$name.ts +0 -12
  63. package/src/backend/routes/api/instances.ts +0 -16
  64. package/src/backend/routes/api/knowledge.candidates.$candidateId.promote.ts +0 -32
  65. package/src/backend/routes/api/knowledge.candidates.$candidateId.ts +0 -50
  66. package/src/backend/routes/api/knowledge.candidates.ts +0 -10
  67. package/src/backend/routes/api/knowledge.project-context.ts +0 -29
  68. package/src/backend/routes/api/knowledge.search.ts +0 -62
  69. package/src/backend/routes/api/knowledge.sessions.$sessionId.candidates.ts +0 -26
  70. package/src/backend/routes/api/logs.$id.body.ts +0 -58
  71. package/src/backend/routes/api/logs.$id.chunks.ts +0 -37
  72. package/src/backend/routes/api/logs.$id.replay.ts +0 -297
  73. package/src/backend/routes/api/logs.$id.ts +0 -23
  74. package/src/backend/routes/api/logs.import.ts +0 -39
  75. package/src/backend/routes/api/logs.stream.ts +0 -174
  76. package/src/backend/routes/api/logs.ts +0 -214
  77. package/src/backend/routes/api/mcp.ts +0 -25
  78. package/src/backend/routes/api/models.ts +0 -10
  79. package/src/backend/routes/api/pi-agent.ts +0 -29
  80. package/src/backend/routes/api/providers.$providerId.model-metadata.ts +0 -173
  81. package/src/backend/routes/api/providers.$providerId.test.log.ts +0 -342
  82. package/src/backend/routes/api/providers.$providerId.ts +0 -111
  83. package/src/backend/routes/api/providers.export.ts +0 -44
  84. package/src/backend/routes/api/providers.import.ts +0 -81
  85. package/src/backend/routes/api/providers.scan.ts +0 -28
  86. package/src/backend/routes/api/providers.ts +0 -102
  87. package/src/backend/routes/api/runs.$runId.evidence.ts +0 -55
  88. package/src/backend/routes/api/runs.$runId.ts +0 -50
  89. package/src/backend/routes/api/runs.ts +0 -62
  90. package/src/backend/routes/api/runtime.ts +0 -46
  91. package/src/backend/routes/api/sessions.ts +0 -51
  92. package/src/backend/routes/api/storage.ts +0 -56
  93. package/src/backend/routes/livez.ts +0 -13
  94. package/src/backend/routes/metrics.ts +0 -14
  95. package/src/backend/routes/proxy/$.ts +0 -15
  96. package/src/backend/routes/readyz.ts +0 -18
  97. package/src/backend/start.ts +0 -10
  98. package/src/cli/alias.ts +0 -431
  99. package/src/cli/detect-tools.ts +0 -123
  100. package/src/cli/doctor.ts +0 -836
  101. package/src/cli/instance.ts +0 -1071
  102. package/src/cli/instanceApi.ts +0 -213
  103. package/src/cli/instanceArgs.ts +0 -301
  104. package/src/cli/instanceControl.ts +0 -191
  105. package/src/cli/instanceModel.ts +0 -276
  106. package/src/cli/instanceRegistry.ts +0 -731
  107. package/src/cli/networkHints.ts +0 -170
  108. package/src/cli/onboard.ts +0 -1668
  109. package/src/cli/onboardTarget.ts +0 -228
  110. package/src/cli/rustBackendPackage.ts +0 -458
  111. package/src/cli/startupOutput.ts +0 -16
  112. package/src/cli/templates/codex-skill-onboard.ts +0 -320
  113. package/src/cli/templates/command-onboard.ts +0 -25
  114. package/src/cli/templates/skill-onboard.ts +0 -625
  115. package/src/cli.ts +0 -1433
  116. package/src/components/OnboardingBanner.tsx +0 -115
  117. package/src/components/ProxyViewer.tsx +0 -2259
  118. package/src/components/ProxyViewerContainer.tsx +0 -1076
  119. package/src/components/alerts/AlertsDialog.tsx +0 -615
  120. package/src/components/clients/ClientLogo.tsx +0 -175
  121. package/src/components/ecosystem/AgentLabDialog.tsx +0 -947
  122. package/src/components/errors/SafeErrorBoundary.tsx +0 -201
  123. package/src/components/groups/GroupsDialog.tsx +0 -1304
  124. package/src/components/inspector-pet/InspectorPet.tsx +0 -398
  125. package/src/components/inspector-pet/InspectorPetCrab3D.tsx +0 -455
  126. package/src/components/inspector-pet/inspectorPetLogic.ts +0 -272
  127. package/src/components/pi-agent/PiAgentPanel.tsx +0 -446
  128. package/src/components/pi-agent/piAgentChatLogic.ts +0 -273
  129. package/src/components/providers/ImportWizardDialog.tsx +0 -281
  130. package/src/components/providers/ProviderCard.tsx +0 -347
  131. package/src/components/providers/ProviderForm.tsx +0 -1183
  132. package/src/components/providers/ProviderLogo.tsx +0 -122
  133. package/src/components/providers/ProviderTestResultsView.tsx +0 -734
  134. package/src/components/providers/ProvidersPanel.tsx +0 -714
  135. package/src/components/providers/SettingsDialog.tsx +0 -1042
  136. package/src/components/providers/providerFormCapabilities.ts +0 -36
  137. package/src/components/proxy-viewer/AgentTraceSummary.tsx +0 -902
  138. package/src/components/proxy-viewer/AnswerMarkdown.tsx +0 -51
  139. package/src/components/proxy-viewer/ApplicationBar.tsx +0 -123
  140. package/src/components/proxy-viewer/CompareDrawer.tsx +0 -984
  141. package/src/components/proxy-viewer/ConversationGroup.tsx +0 -208
  142. package/src/components/proxy-viewer/ConversationGroupList.tsx +0 -652
  143. package/src/components/proxy-viewer/ConversationHeader.tsx +0 -429
  144. package/src/components/proxy-viewer/LiveConnectionStatus.tsx +0 -186
  145. package/src/components/proxy-viewer/LogEntry.tsx +0 -1419
  146. package/src/components/proxy-viewer/LogEntryHeader.tsx +0 -596
  147. package/src/components/proxy-viewer/ProviderLogoStack.tsx +0 -57
  148. package/src/components/proxy-viewer/RawExportWarning.tsx +0 -77
  149. package/src/components/proxy-viewer/ReplayDialog.tsx +0 -636
  150. package/src/components/proxy-viewer/RequestToolsPanel.tsx +0 -299
  151. package/src/components/proxy-viewer/ResponseView.tsx +0 -202
  152. package/src/components/proxy-viewer/SessionLoadProgressBar.tsx +0 -61
  153. package/src/components/proxy-viewer/StreamingChunkSequence.tsx +0 -265
  154. package/src/components/proxy-viewer/ThreadConnector.tsx +0 -165
  155. package/src/components/proxy-viewer/ToolTraceEvents.tsx +0 -64
  156. package/src/components/proxy-viewer/TurnGroup.tsx +0 -383
  157. package/src/components/proxy-viewer/TurnGroupList.tsx +0 -156
  158. package/src/components/proxy-viewer/accessibility.ts +0 -8
  159. package/src/components/proxy-viewer/anatomy/RequestAnatomy.tsx +0 -887
  160. package/src/components/proxy-viewer/anatomy/SegmentBar.tsx +0 -222
  161. package/src/components/proxy-viewer/anatomy/contextIntelligence.ts +0 -737
  162. package/src/components/proxy-viewer/anatomy/sessionContextSummary.ts +0 -268
  163. package/src/components/proxy-viewer/anatomy/tokenEstimate.ts +0 -53
  164. package/src/components/proxy-viewer/anatomy/types.ts +0 -41
  165. package/src/components/proxy-viewer/anatomy/useAnatomyJump.ts +0 -114
  166. package/src/components/proxy-viewer/bodyHydration.ts +0 -123
  167. package/src/components/proxy-viewer/cacheTrend.ts +0 -50
  168. package/src/components/proxy-viewer/diff/DiffView.tsx +0 -321
  169. package/src/components/proxy-viewer/diff/computeDiff.ts +0 -178
  170. package/src/components/proxy-viewer/diff/index.ts +0 -3
  171. package/src/components/proxy-viewer/formats/anthropic/ContentBlocks.tsx +0 -194
  172. package/src/components/proxy-viewer/formats/anthropic/ResponseView.tsx +0 -81
  173. package/src/components/proxy-viewer/formats/anthropic/thinkingExtract.ts +0 -21
  174. package/src/components/proxy-viewer/formats/index.tsx +0 -47
  175. package/src/components/proxy-viewer/formats/openai/ResponseView.tsx +0 -442
  176. package/src/components/proxy-viewer/index.ts +0 -9
  177. package/src/components/proxy-viewer/lazy.ts +0 -41
  178. package/src/components/proxy-viewer/liveConnectionState.ts +0 -158
  179. package/src/components/proxy-viewer/log-formats/anthropic.ts +0 -191
  180. package/src/components/proxy-viewer/log-formats/index.ts +0 -23
  181. package/src/components/proxy-viewer/log-formats/openai.ts +0 -256
  182. package/src/components/proxy-viewer/log-formats/types.ts +0 -40
  183. package/src/components/proxy-viewer/log-formats/unknown.ts +0 -18
  184. package/src/components/proxy-viewer/logEntryVisibility.ts +0 -73
  185. package/src/components/proxy-viewer/logFocus.ts +0 -54
  186. package/src/components/proxy-viewer/proxyViewerContainerLogic.ts +0 -124
  187. package/src/components/proxy-viewer/proxyViewerLogic.ts +0 -488
  188. package/src/components/proxy-viewer/replayComparison.ts +0 -131
  189. package/src/components/proxy-viewer/requestDiff.ts +0 -277
  190. package/src/components/proxy-viewer/requestTools.ts +0 -220
  191. package/src/components/proxy-viewer/useCopyFeedback.ts +0 -38
  192. package/src/components/proxy-viewer/useKeyboardNavigation.ts +0 -232
  193. package/src/components/proxy-viewer/viewerState.ts +0 -176
  194. package/src/components/ui/badge.tsx +0 -47
  195. package/src/components/ui/button.tsx +0 -47
  196. package/src/components/ui/collapsible.tsx +0 -21
  197. package/src/components/ui/confirm-dialog.tsx +0 -51
  198. package/src/components/ui/crab-logo.tsx +0 -45
  199. package/src/components/ui/crab-variants.tsx +0 -467
  200. package/src/components/ui/dialog.tsx +0 -130
  201. package/src/components/ui/icon-trigger.ts +0 -2
  202. package/src/components/ui/json-viewer-bulk.ts +0 -132
  203. package/src/components/ui/json-viewer.tsx +0 -508
  204. package/src/components/ui/scroll-area.tsx +0 -54
  205. package/src/components/ui/select.tsx +0 -178
  206. package/src/components/ui/separator.tsx +0 -28
  207. package/src/components/ui/tabs.tsx +0 -88
  208. package/src/components/ui/tooltip.tsx +0 -51
  209. package/src/components/ui/transient-toast.tsx +0 -105
  210. package/src/contracts/anthropic.ts +0 -230
  211. package/src/contracts/index.ts +0 -59
  212. package/src/contracts/json.ts +0 -37
  213. package/src/contracts/log.ts +0 -139
  214. package/src/contracts/openai.ts +0 -267
  215. package/src/index.css +0 -11
  216. package/src/knowledge/candidateStore.ts +0 -94
  217. package/src/knowledge/distiller.ts +0 -98
  218. package/src/knowledge/openclawClient.ts +0 -161
  219. package/src/knowledge/openclawGatewayClient.ts +0 -249
  220. package/src/knowledge/openclawMarkdown.ts +0 -146
  221. package/src/knowledge/redactor.ts +0 -80
  222. package/src/knowledge/types.ts +0 -83
  223. package/src/lib/alertContract.ts +0 -76
  224. package/src/lib/apiClient.ts +0 -166
  225. package/src/lib/apiFormat.ts +0 -29
  226. package/src/lib/backendImplementation.ts +0 -16
  227. package/src/lib/basePath.ts +0 -107
  228. package/src/lib/browserRuntimeContract.ts +0 -124
  229. package/src/lib/browserRuntimeResolver.ts +0 -333
  230. package/src/lib/chunkLoadRecovery.ts +0 -83
  231. package/src/lib/claudeCodeStrip.ts +0 -98
  232. package/src/lib/clipboard.ts +0 -67
  233. package/src/lib/codingAgentEndpoints.ts +0 -54
  234. package/src/lib/ecosystemContract.ts +0 -130
  235. package/src/lib/export-logs.ts +0 -287
  236. package/src/lib/groupContract.ts +0 -166
  237. package/src/lib/instanceContract.ts +0 -239
  238. package/src/lib/jsonFile.ts +0 -46
  239. package/src/lib/logImportContract.ts +0 -12
  240. package/src/lib/managedInstance.ts +0 -112
  241. package/src/lib/mask.ts +0 -4
  242. package/src/lib/objectUtils.ts +0 -22
  243. package/src/lib/piAgentContract.ts +0 -102
  244. package/src/lib/providerContract.ts +0 -125
  245. package/src/lib/providerImportContract.ts +0 -27
  246. package/src/lib/providerModelMetadata.ts +0 -458
  247. package/src/lib/providerTestContract.ts +0 -170
  248. package/src/lib/providerTestPrompt.ts +0 -100
  249. package/src/lib/publicBasePathContext.ts +0 -137
  250. package/src/lib/resourceLimits.ts +0 -345
  251. package/src/lib/runContract.ts +0 -164
  252. package/src/lib/runtimeConfig.ts +0 -43
  253. package/src/lib/safeDiagnostic.ts +0 -38
  254. package/src/lib/safeFetch.ts +0 -508
  255. package/src/lib/serverPort.ts +0 -47
  256. package/src/lib/sessionInfoContract.ts +0 -78
  257. package/src/lib/sessionUrl.ts +0 -46
  258. package/src/lib/ssrfGuard.ts +0 -133
  259. package/src/lib/stopReason.ts +0 -130
  260. package/src/lib/themeMode.ts +0 -41
  261. package/src/lib/timeDisplay.ts +0 -22
  262. package/src/lib/toolTrace.ts +0 -290
  263. package/src/lib/uiScale.ts +0 -117
  264. package/src/lib/unknown.ts +0 -27
  265. package/src/lib/upstreamUrl.ts +0 -150
  266. package/src/lib/useAlerts.ts +0 -82
  267. package/src/lib/useGroupEvidence.ts +0 -37
  268. package/src/lib/useGroups.ts +0 -32
  269. package/src/lib/useOnboarding.ts +0 -93
  270. package/src/lib/useProviders.ts +0 -30
  271. package/src/lib/useStripConfig.ts +0 -154
  272. package/src/lib/useThemeMode.ts +0 -40
  273. package/src/lib/useUiScale.ts +0 -52
  274. package/src/lib/utils.ts +0 -78
  275. package/src/mcp/currentContext.ts +0 -65
  276. package/src/mcp/instanceHandlers.ts +0 -151
  277. package/src/mcp/loopback.ts +0 -88
  278. package/src/mcp/mode.ts +0 -75
  279. package/src/mcp/previewExtractor.ts +0 -233
  280. package/src/mcp/server.ts +0 -2274
  281. package/src/mcp/toolHandlers.ts +0 -1533
  282. package/src/proxy/alerts.ts +0 -664
  283. package/src/proxy/chunkStorage.ts +0 -123
  284. package/src/proxy/config.ts +0 -218
  285. package/src/proxy/constants.ts +0 -66
  286. package/src/proxy/dataDir.ts +0 -147
  287. package/src/proxy/ecosystemExecutionConfirmation.ts +0 -114
  288. package/src/proxy/ecosystemExecutionRoute.ts +0 -116
  289. package/src/proxy/ecosystemRegistry.ts +0 -296
  290. package/src/proxy/ecosystemTasks.ts +0 -415
  291. package/src/proxy/evidenceAnalysis.ts +0 -526
  292. package/src/proxy/evidenceExporter.ts +0 -235
  293. package/src/proxy/formats/anthropic/anthropicProvider.ts +0 -75
  294. package/src/proxy/formats/anthropic/handler.ts +0 -75
  295. package/src/proxy/formats/anthropic/index.ts +0 -13
  296. package/src/proxy/formats/anthropic/register.ts +0 -4
  297. package/src/proxy/formats/anthropic/schemas.ts +0 -6
  298. package/src/proxy/formats/anthropic/stream.ts +0 -205
  299. package/src/proxy/formats/handler.ts +0 -46
  300. package/src/proxy/formats/index.ts +0 -13
  301. package/src/proxy/formats/jsonSchema.ts +0 -2
  302. package/src/proxy/formats/openai/alibabaProvider.ts +0 -34
  303. package/src/proxy/formats/openai/codexMetadata.ts +0 -61
  304. package/src/proxy/formats/openai/handler.ts +0 -133
  305. package/src/proxy/formats/openai/index.ts +0 -33
  306. package/src/proxy/formats/openai/provider.ts +0 -50
  307. package/src/proxy/formats/openai/register.ts +0 -4
  308. package/src/proxy/formats/openai/schemas.ts +0 -25
  309. package/src/proxy/formats/openai/stream.ts +0 -600
  310. package/src/proxy/formats/openai/zhipuProvider.ts +0 -31
  311. package/src/proxy/formats/providerAdapter.ts +0 -50
  312. package/src/proxy/formats/providerRegistry.ts +0 -51
  313. package/src/proxy/formats/providers/index.ts +0 -3
  314. package/src/proxy/formats/registry.ts +0 -65
  315. package/src/proxy/groupEvidenceExporter.ts +0 -371
  316. package/src/proxy/groupStore.ts +0 -336
  317. package/src/proxy/handler.ts +0 -729
  318. package/src/proxy/identityProxy.ts +0 -1842
  319. package/src/proxy/jsonlRecovery.ts +0 -554
  320. package/src/proxy/logBodyChunks.ts +0 -91
  321. package/src/proxy/logFinalizer.ts +0 -777
  322. package/src/proxy/logFinalizer.worker.ts +0 -24
  323. package/src/proxy/logImportUpload.ts +0 -128
  324. package/src/proxy/logImporter.ts +0 -813
  325. package/src/proxy/logIndex.ts +0 -663
  326. package/src/proxy/logSearch.ts +0 -122
  327. package/src/proxy/logger.ts +0 -537
  328. package/src/proxy/openaiOrphanToolStrip.ts +0 -142
  329. package/src/proxy/platformCommands.ts +0 -258
  330. package/src/proxy/privateDataPath.ts +0 -419
  331. package/src/proxy/providerImporters.ts +0 -578
  332. package/src/proxy/providerScanStore.ts +0 -87
  333. package/src/proxy/providerSecretStore.ts +0 -216
  334. package/src/proxy/providers.ts +0 -998
  335. package/src/proxy/rawStreamCapture.ts +0 -342
  336. package/src/proxy/runFailures.ts +0 -94
  337. package/src/proxy/runStore.ts +0 -214
  338. package/src/proxy/runtimeAdmission.ts +0 -55
  339. package/src/proxy/runtimeHealth.ts +0 -221
  340. package/src/proxy/runtimeMetrics.ts +0 -149
  341. package/src/proxy/runtimeShutdown.ts +0 -157
  342. package/src/proxy/schemas.ts +0 -112
  343. package/src/proxy/sessionArchive.ts +0 -479
  344. package/src/proxy/sessionInfo.ts +0 -266
  345. package/src/proxy/sessionProcess.ts +0 -194
  346. package/src/proxy/sessionRuntime.ts +0 -121
  347. package/src/proxy/sessionSupervisor.ts +0 -305
  348. package/src/proxy/sessionWorkerEntry.ts +0 -26
  349. package/src/proxy/shutdownCoordinator.ts +0 -90
  350. package/src/proxy/socketTracker.ts +0 -639
  351. package/src/proxy/sqliteLogIndex.ts +0 -733
  352. package/src/proxy/storageLifecycle.ts +0 -432
  353. package/src/proxy/store.ts +0 -1773
  354. package/src/proxy/streamTiming.ts +0 -31
  355. package/src/proxy/toolSchemaWarnings.ts +0 -529
  356. package/src/proxy/uiAssetServer.ts +0 -106
  357. package/src/proxy/upstream.ts +0 -127
  358. package/src/services/alerts.ts +0 -12
  359. package/src/services/groups.ts +0 -119
  360. package/src/services/piAgent.ts +0 -421
  361. package/src/services/piAgentRetrieval.ts +0 -1180
  362. package/src/services/result.ts +0 -17
  363. package/src/services/runs.ts +0 -76
  364. package/src/ui/bootstrap.ts +0 -167
  365. package/src/ui/index.html +0 -38
  366. package/src/ui/logsStreamClient.ts +0 -20
  367. package/src/ui/main.tsx +0 -13
  368. package/src/ui/public/runtime-config.js +0 -2
  369. package/src/ui/router.tsx +0 -13
  370. package/src/ui/routes/__root.tsx +0 -69
  371. package/src/ui/routes/index.tsx +0 -35
  372. package/src/ui/routes/session/$sessionId.tsx +0 -50
  373. package/src/ui/runtimeDiscovery.ts +0 -50
@@ -1,83 +0,0 @@
1
- import { z } from "zod";
2
- import { LogIdSchema } from "../contracts";
3
-
4
- export const KnowledgeCandidateTypeSchema = z.enum([
5
- "episode",
6
- "procedure",
7
- "preference",
8
- "project-fact",
9
- ]);
10
-
11
- export type KnowledgeCandidateType = z.infer<typeof KnowledgeCandidateTypeSchema>;
12
-
13
- export const KnowledgeCandidateStatusSchema = z.enum(["draft", "promoted", "failed"]);
14
-
15
- export type KnowledgeCandidateStatus = z.infer<typeof KnowledgeCandidateStatusSchema>;
16
-
17
- export const KnowledgeEvidenceSchema = z.object({
18
- source: z.literal("agent-inspector"),
19
- sessionId: z.string(),
20
- logIds: z.array(LogIdSchema),
21
- project: z.string().nullable(),
22
- models: z.array(z.string()),
23
- });
24
-
25
- export const RedactionMetadataSchema = z.object({
26
- redacted: z.boolean(),
27
- patterns: z.array(z.string()),
28
- });
29
-
30
- export type RedactionMetadata = z.infer<typeof RedactionMetadataSchema>;
31
-
32
- export const KnowledgeCandidateSchema = z.object({
33
- id: z.string(),
34
- type: KnowledgeCandidateTypeSchema,
35
- title: z.string(),
36
- content: z.string(),
37
- tags: z.array(z.string()),
38
- source: z.literal("agent-inspector"),
39
- sessionId: z.string(),
40
- logIds: z.array(LogIdSchema),
41
- evidence: KnowledgeEvidenceSchema,
42
- status: KnowledgeCandidateStatusSchema,
43
- createdAt: z.string(),
44
- updatedAt: z.string(),
45
- openClawMemoryId: z.string().nullable(),
46
- error: z.string().nullable(),
47
- redaction: RedactionMetadataSchema,
48
- });
49
-
50
- export type KnowledgeCandidate = z.infer<typeof KnowledgeCandidateSchema>;
51
-
52
- export const OpenClawMemoryPayloadSchema = z.object({
53
- idempotencyKey: z.string(),
54
- type: KnowledgeCandidateTypeSchema,
55
- title: z.string(),
56
- content: z.string(),
57
- tags: z.array(z.string()),
58
- source: z.literal("agent-inspector"),
59
- project: z.string().nullable(),
60
- evidence: KnowledgeEvidenceSchema,
61
- });
62
-
63
- export type OpenClawMemoryPayload = z.infer<typeof OpenClawMemoryPayloadSchema>;
64
-
65
- export const KnowledgeSearchResultSchema = z.object({
66
- id: z.string(),
67
- type: KnowledgeCandidateTypeSchema.or(z.string()),
68
- title: z.string(),
69
- content: z.string(),
70
- score: z.number().nullable(),
71
- source: z.string().nullable(),
72
- project: z.string().nullable(),
73
- evidence: z.unknown().optional(),
74
- });
75
-
76
- export type KnowledgeSearchResult = z.infer<typeof KnowledgeSearchResultSchema>;
77
-
78
- export const KnowledgeSearchResponseSchema = z.object({
79
- results: z.array(KnowledgeSearchResultSchema),
80
- warning: z.string().nullable(),
81
- });
82
-
83
- export type KnowledgeSearchResponse = z.infer<typeof KnowledgeSearchResponseSchema>;
@@ -1,76 +0,0 @@
1
- import { z } from "zod";
2
- import { JsonValueSchema, LogIdSchema } from "../contracts";
3
-
4
- export const AlertSeveritySchema = z.enum(["critical", "warning", "notice"]);
5
- export const AlertStatusSchema = z.enum(["open"]);
6
- export const AlertSourceSchema = z.enum(["proxy", "tool-schema", "run", "group"]);
7
- export const AlertCategorySchema = z.enum([
8
- "request-failure",
9
- "request-timeout",
10
- "slow-response",
11
- "tool-schema",
12
- "run-failure",
13
- "group-failure",
14
- "group-incomplete",
15
- ]);
16
- export const AlertEvidenceKindSchema = z.enum(["log", "session", "run", "group"]);
17
- export const AlertApiFormatSchema = z.enum(["anthropic", "openai", "unknown"]);
18
-
19
- export const AlertEvidenceLinkSchema = z.object({
20
- kind: AlertEvidenceKindSchema,
21
- id: z.string(),
22
- label: z.string(),
23
- href: z.string().nullable(),
24
- });
25
-
26
- export const AlertSchema = z.object({
27
- id: z.string(),
28
- fingerprint: z.string(),
29
- severity: AlertSeveritySchema,
30
- category: AlertCategorySchema,
31
- source: AlertSourceSchema,
32
- status: AlertStatusSchema,
33
- title: z.string(),
34
- message: z.string(),
35
- count: z.number().int().positive(),
36
- firstSeenAt: z.string(),
37
- lastSeenAt: z.string(),
38
- logIds: z.array(LogIdSchema),
39
- sessionIds: z.array(z.string()),
40
- runIds: z.array(z.string()),
41
- groupIds: z.array(z.string()),
42
- provider: z.string().nullable(),
43
- model: z.string().nullable(),
44
- apiFormat: AlertApiFormatSchema.nullable(),
45
- evidence: z.array(AlertEvidenceLinkSchema),
46
- metadata: z.record(z.string(), JsonValueSchema),
47
- });
48
-
49
- export const AlertCategoryCountSchema = z.object({
50
- category: AlertCategorySchema,
51
- count: z.number().int().nonnegative(),
52
- });
53
-
54
- export const AlertSummarySchema = z.object({
55
- total: z.number().int().nonnegative(),
56
- open: z.number().int().nonnegative(),
57
- critical: z.number().int().nonnegative(),
58
- warning: z.number().int().nonnegative(),
59
- notice: z.number().int().nonnegative(),
60
- byCategory: z.array(AlertCategoryCountSchema),
61
- });
62
-
63
- export const AlertListResponseSchema = z.object({
64
- alerts: z.array(AlertSchema),
65
- total: z.number().int().nonnegative(),
66
- limit: z.number().int().positive(),
67
- summary: AlertSummarySchema,
68
- });
69
-
70
- export type AlertSeverity = z.infer<typeof AlertSeveritySchema>;
71
- export type AlertSource = z.infer<typeof AlertSourceSchema>;
72
- export type AlertCategory = z.infer<typeof AlertCategorySchema>;
73
- export type AlertEvidenceLink = z.infer<typeof AlertEvidenceLinkSchema>;
74
- export type Alert = z.infer<typeof AlertSchema>;
75
- export type AlertSummary = z.infer<typeof AlertSummarySchema>;
76
- export type AlertListResponse = z.infer<typeof AlertListResponseSchema>;
@@ -1,166 +0,0 @@
1
- /* eslint-disable functional/no-throw-statements */
2
- import { z } from "zod";
3
- import { buildControlRuntimeUrl, resolveBrowserRuntimeForDocument } from "./browserRuntimeResolver";
4
-
5
- const ApiErrorSchema = z.object({
6
- error: z.string(),
7
- });
8
-
9
- const MUTATION_METHODS = new Set(["POST", "PUT", "PATCH", "DELETE"]);
10
-
11
- function withInspectorControlSurface(input: RequestInfo | URL): RequestInfo | URL {
12
- if (typeof input !== "string") return input;
13
- if (!input.startsWith("/")) return input;
14
- if (input.startsWith("//")) {
15
- throw new TypeError("Protocol-relative API URLs are not allowed.");
16
- }
17
-
18
- const runtime = resolveBrowserRuntimeForDocument();
19
- if (!runtime.ok) {
20
- throw new Error(`Browser runtime is unavailable: ${runtime.issues.join("; ")}`);
21
- }
22
- const url = buildControlRuntimeUrl(runtime.runtime, input);
23
- if (url === null) {
24
- throw new TypeError(`Invalid logical control path: ${input}`);
25
- }
26
- return url;
27
- }
28
-
29
- export function withBrowserMutationProof(init?: RequestInit): RequestInit | undefined {
30
- const method = init?.method?.toUpperCase();
31
- if (method === undefined || !MUTATION_METHODS.has(method)) return init;
32
- const headers = new Headers(init?.headers);
33
- if (!headers.has("x-agent-inspector-csrf")) {
34
- headers.set("x-agent-inspector-csrf", "1");
35
- }
36
- return { ...init, headers };
37
- }
38
-
39
- /**
40
- * Parse and validate a JSON response at the browser/server trust boundary.
41
- *
42
- * Keeping this in one place makes response validation consistent without
43
- * coupling callers to a specific API or domain type.
44
- */
45
- export async function parseJsonResponse<T>(response: Response, schema: z.ZodType<T>): Promise<T> {
46
- const data: unknown = await response.json();
47
- return schema.parse(data);
48
- }
49
-
50
- /**
51
- * Read the conventional `{ error: string }` API response when available.
52
- * Malformed or non-JSON error bodies deliberately fall back to caller-owned
53
- * text so each screen retains its existing user-facing message.
54
- */
55
- export async function readApiError(response: Response, fallback: string): Promise<string> {
56
- try {
57
- const data: unknown = await response.json();
58
- const result = ApiErrorSchema.safeParse(data);
59
- return result.success ? result.data.error : fallback;
60
- } catch {
61
- return fallback;
62
- }
63
- }
64
-
65
- /**
66
- * Fetch through the browser runtime's control surface while retaining the
67
- * mutation proof required by the protected ingress.
68
- */
69
- export async function fetchControl(
70
- input: RequestInfo | URL,
71
- init?: RequestInit,
72
- ): Promise<Response> {
73
- return await fetch(withInspectorControlSurface(input), withBrowserMutationProof(init));
74
- }
75
-
76
- /**
77
- * Fetch a JSON resource and validate its successful response.
78
- */
79
- export async function fetchJson<T>(
80
- input: RequestInfo | URL,
81
- schema: z.ZodType<T>,
82
- init?: RequestInit,
83
- errorFallback?: (response: Response) => string,
84
- ): Promise<T> {
85
- const response = await fetchControl(input, init);
86
- if (!response.ok) {
87
- const fallback = errorFallback?.(response) ?? `Request failed with status ${response.status}`;
88
- throw new Error(await readApiError(response, fallback));
89
- }
90
- return parseJsonResponse(response, schema);
91
- }
92
-
93
- function formatTimeout(timeoutMs: number): string {
94
- if (timeoutMs < 1000) return `${String(timeoutMs)}ms`;
95
- return `${String(Math.round(timeoutMs / 1000))}s`;
96
- }
97
-
98
- export class ApiTimeoutError extends Error {
99
- constructor(timeoutMs: number) {
100
- super(`Request timed out after ${formatTimeout(timeoutMs)}`);
101
- this.name = "ApiTimeoutError";
102
- }
103
- }
104
-
105
- /**
106
- * Fetch any resource with a browser-side timeout while preserving a caller
107
- * supplied abort signal. The timeout is reported as `ApiTimeoutError`; caller
108
- * cancellations keep the native abort shape so UI code can distinguish them.
109
- */
110
- export async function fetchWithTimeout(
111
- input: RequestInfo | URL,
112
- timeoutMs: number,
113
- init?: RequestInit,
114
- ): Promise<Response> {
115
- const controller = new AbortController();
116
- let timedOut = false;
117
- const timeout = setTimeout(() => {
118
- timedOut = true;
119
- controller.abort();
120
- }, timeoutMs);
121
-
122
- const callerSignal = init?.signal ?? undefined;
123
- const abortFromCaller = (): void => controller.abort();
124
- if (callerSignal !== undefined) {
125
- if (callerSignal.aborted) {
126
- controller.abort();
127
- } else {
128
- callerSignal.addEventListener("abort", abortFromCaller, { once: true });
129
- }
130
- }
131
-
132
- try {
133
- return await fetchControl(input, {
134
- ...init,
135
- signal: controller.signal,
136
- });
137
- } catch (error) {
138
- if (timedOut && error instanceof DOMException && error.name === "AbortError") {
139
- throw new ApiTimeoutError(timeoutMs);
140
- }
141
- throw error;
142
- } finally {
143
- clearTimeout(timeout);
144
- callerSignal?.removeEventListener("abort", abortFromCaller);
145
- }
146
- }
147
-
148
- /**
149
- * Fetch a JSON resource with a browser-side timeout. This prevents UI loading
150
- * states from waiting forever when a tab keeps a stale connection across a
151
- * local server force-restart.
152
- */
153
- export async function fetchJsonWithTimeout<T>(
154
- input: RequestInfo | URL,
155
- schema: z.ZodType<T>,
156
- timeoutMs: number,
157
- init?: RequestInit,
158
- errorFallback?: (response: Response) => string,
159
- ): Promise<T> {
160
- const response = await fetchWithTimeout(input, timeoutMs, init);
161
- if (!response.ok) {
162
- const fallback = errorFallback?.(response) ?? `Request failed with status ${response.status}`;
163
- throw new Error(await readApiError(response, fallback));
164
- }
165
- return parseJsonResponse(response, schema);
166
- }
@@ -1,29 +0,0 @@
1
- import type { ApiFormat } from "../contracts/log";
2
-
3
- type KnownApiFormat = Exclude<ApiFormat, "unknown">;
4
-
5
- /**
6
- * Request paths whose protocol is part of the public Agent Inspector contract.
7
- *
8
- * Keep this module browser-safe: both the proxy registry and the UI's log
9
- * presentation use the same path classifier without importing proxy startup
10
- * registrations or provider implementations.
11
- */
12
- export const API_FORMAT_PATH_ENTRIES: ReadonlyArray<
13
- readonly [path: string, format: KnownApiFormat]
14
- > = [
15
- ["/v1/messages", "anthropic"],
16
- ["/v1/chat/completions", "openai"],
17
- ["/chat/completions", "openai"],
18
- ["/v1/responses", "openai"],
19
- ["/responses", "openai"],
20
- ];
21
-
22
- /** Resolve an API format from its authoritative request path. */
23
- export function apiFormatForPath(path: string): ApiFormat {
24
- const requestPath = path.split("?")[0] ?? "";
25
- for (const [knownPath, format] of API_FORMAT_PATH_ENTRIES) {
26
- if (requestPath === knownPath) return format;
27
- }
28
- return "unknown";
29
- }
@@ -1,16 +0,0 @@
1
- import { z } from "zod";
2
-
3
- export const AGENT_INSPECTOR_BACKEND_ENV = "AGENT_INSPECTOR_BACKEND";
4
- export const AGENT_INSPECTOR_BACKEND_HEADER = "x-agent-inspector-backend";
5
-
6
- export const BackendImplementationSchema = z.enum(["typescript", "rust"]);
7
-
8
- export type BackendImplementation = z.infer<typeof BackendImplementationSchema>;
9
-
10
- export function parseBackendImplementation(
11
- value: string | undefined,
12
- ): BackendImplementation | null {
13
- if (value === undefined) return "typescript";
14
- const parsed = BackendImplementationSchema.safeParse(value.trim().toLowerCase());
15
- return parsed.success ? parsed.data : null;
16
- }
@@ -1,107 +0,0 @@
1
- /// <reference types="vite/client" />
2
-
3
- export const AGENT_INSPECTOR_BASE_PATH_ENV = "AGENT_INSPECTOR_BASE_PATH";
4
- export const AGENT_INSPECTOR_INTERNAL_STRIPPED_BASE_PATH_ENV =
5
- "AGENT_INSPECTOR_INTERNAL_STRIPPED_BASE_PATH";
6
- export const AGENT_INSPECTOR_BASE_PATH_META_NAME = "agent-inspector-base-path";
7
- export const AGENT_INSPECTOR_PUBLIC_BASE_PATH_HEADER = "x-agent-inspector-public-base-path";
8
- export const AGENT_INSPECTOR_PUBLIC_PORT_HEADER = "x-agent-inspector-public-port";
9
- export const AGENT_INSPECTOR_PUBLIC_ORIGIN_HEADER = "x-agent-inspector-public-origin";
10
- export const DEFAULT_AGENT_INSPECTOR_BASE_PATH = "/inspector";
11
-
12
- type BasePathEnv = Readonly<Record<string, string | undefined>>;
13
-
14
- function trimSlashes(value: string): string {
15
- return value.replace(/^\/+/u, "").replace(/\/+$/u, "");
16
- }
17
-
18
- const SAFE_PUBLIC_BASE_PATH_PATTERN = /^\/[A-Za-z0-9._~-]+(?:\/[A-Za-z0-9._~-]+)*$/u;
19
-
20
- /**
21
- * Normalize a public mount path only when every segment is safe to reuse in
22
- * URLs, HTML attributes, JavaScript bootstrap data, and ingress routing.
23
- * Root is represented internally as the empty string.
24
- */
25
- export function normalizePublicBasePath(value: string | undefined): string | null {
26
- const trimmed = value?.trim() ?? "";
27
- if (trimmed.length === 0 || trimmed === "/") return "";
28
- if (!trimmed.startsWith("/") || trimmed.startsWith("//")) return null;
29
-
30
- const normalized = normalizeBasePath(trimmed);
31
- if (!SAFE_PUBLIC_BASE_PATH_PATTERN.test(normalized)) return null;
32
- if (normalized.split("/").some((segment) => segment === "." || segment === "..")) return null;
33
- return normalized;
34
- }
35
-
36
- export function normalizeBasePath(value: string | undefined): string {
37
- const trimmed = value?.trim();
38
- if (trimmed === undefined || trimmed.length === 0 || trimmed === "/") return "";
39
- const path = trimSlashes(trimmed);
40
- if (path.length === 0) return "";
41
- return `/${path}`;
42
- }
43
-
44
- function readDocumentBasePath(): string | undefined {
45
- if (typeof document === "undefined") return undefined;
46
- return (
47
- document
48
- .querySelector(`meta[name="${AGENT_INSPECTOR_BASE_PATH_META_NAME}"]`)
49
- ?.getAttribute("content") ?? undefined
50
- );
51
- }
52
-
53
- function readProcessBasePath(): string | undefined {
54
- if (typeof process === "undefined") return undefined;
55
- return process.env[AGENT_INSPECTOR_BASE_PATH_ENV];
56
- }
57
-
58
- export function getConfiguredBasePath(env?: BasePathEnv): string {
59
- const configured =
60
- env !== undefined
61
- ? (env[AGENT_INSPECTOR_BASE_PATH_ENV] ?? DEFAULT_AGENT_INSPECTOR_BASE_PATH)
62
- : (readProcessBasePath() ??
63
- readDocumentBasePath() ??
64
- import.meta.env?.BASE_URL ??
65
- DEFAULT_AGENT_INSPECTOR_BASE_PATH);
66
- const normalized = normalizePublicBasePath(configured);
67
- if (normalized !== null) return normalized;
68
- return normalizePublicBasePath(DEFAULT_AGENT_INSPECTOR_BASE_PATH) ?? "";
69
- }
70
-
71
- export function getRouterBasePath(env?: BasePathEnv): string {
72
- if (env?.[AGENT_INSPECTOR_INTERNAL_STRIPPED_BASE_PATH_ENV] === "1") return "";
73
- return getConfiguredBasePath(env);
74
- }
75
-
76
- export function basePathForVite(basePath: string): string {
77
- const normalized = normalizeBasePath(basePath);
78
- return normalized.length === 0 ? "/" : `${normalized}/`;
79
- }
80
-
81
- export function withBasePath(path: string, basePath = getConfiguredBasePath()): string {
82
- const normalized = normalizeBasePath(basePath);
83
- if (/^[a-z][a-z0-9+.-]*:/iu.test(path)) return path;
84
- if (normalized.length === 0) return path;
85
- if (path.length === 0 || path === "/") return normalized;
86
- if (path.startsWith(`${normalized}/`) || path === normalized) return path;
87
- return path.startsWith("/") ? `${normalized}${path}` : `${normalized}/${path}`;
88
- }
89
-
90
- export function stripBasePath(pathname: string, basePath = getConfiguredBasePath()): string {
91
- const normalized = normalizeBasePath(basePath);
92
- if (normalized.length === 0) return pathname;
93
- if (pathname === normalized) return "/";
94
- if (pathname.startsWith(`${normalized}/`)) return pathname.slice(normalized.length);
95
- return pathname;
96
- }
97
-
98
- export function appendBasePathToOrigin(origin: string, path: string, basePath: string): string {
99
- const normalized = normalizeBasePath(basePath);
100
- if (normalized.length === 0 && path === "/") return origin;
101
- return `${origin}${withBasePath(path, normalized)}`;
102
- }
103
-
104
- export function stripBasePathFromRequestPath(rawPath: string, basePath: string): string {
105
- const url = new URL(rawPath, "http://localhost");
106
- return `${stripBasePath(url.pathname, basePath)}${url.search}`;
107
- }
@@ -1,124 +0,0 @@
1
- import { z } from "zod";
2
- import { normalizePublicBasePath } from "./basePath";
3
-
4
- export const BROWSER_RUNTIME_SCHEMA_VERSION = 1;
5
- export const BROWSER_RUNTIME_JSON_PLACEHOLDER = "__AGENT_INSPECTOR_RUNTIME_JSON__";
6
-
7
- function parseAbsoluteUrl(value: string): URL | null {
8
- try {
9
- return new URL(value);
10
- } catch {
11
- return null;
12
- }
13
- }
14
-
15
- function hasUnsafePathSegment(pathname: string): boolean {
16
- return pathname
17
- .split("/")
18
- .some((segment) => segment === "." || segment === ".." || /%(?:2e|2f|5c)/iu.test(segment));
19
- }
20
-
21
- function hasControlCharacter(value: string): boolean {
22
- return [...value].some((character) => {
23
- const code = character.charCodeAt(0);
24
- return code < 32 || code === 127;
25
- });
26
- }
27
-
28
- export function normalizeBrowserRuntimeBasePath(value: string): string | null {
29
- const trimmed = value.trim();
30
- if (trimmed.length === 0) return null;
31
- const normalized = normalizePublicBasePath(trimmed);
32
- if (normalized === null) return null;
33
- return normalized.length === 0 ? "/" : normalized;
34
- }
35
-
36
- export function normalizeBrowserRuntimeBaseUrl(value: string): string | null {
37
- if (
38
- value.trim() !== value ||
39
- value.includes("\\") ||
40
- hasControlCharacter(value) ||
41
- hasUnsafePathSegment(value)
42
- ) {
43
- return null;
44
- }
45
-
46
- const parsed = parseAbsoluteUrl(value);
47
- if (parsed === null) return null;
48
-
49
- switch (parsed.protocol) {
50
- case "http:":
51
- case "https:":
52
- break;
53
- default:
54
- return null;
55
- }
56
-
57
- if (
58
- parsed.username.length > 0 ||
59
- parsed.password.length > 0 ||
60
- parsed.search.length > 0 ||
61
- parsed.hash.length > 0 ||
62
- hasUnsafePathSegment(parsed.pathname)
63
- ) {
64
- return null;
65
- }
66
-
67
- const basePath = normalizeBrowserRuntimeBasePath(parsed.pathname);
68
- if (basePath === null) return null;
69
- return basePath === "/" ? parsed.origin : `${parsed.origin}${basePath}`;
70
- }
71
-
72
- export const BrowserRuntimeBasePathSchema = z
73
- .string()
74
- .min(1)
75
- .max(2_048)
76
- .refine(
77
- (value) => normalizeBrowserRuntimeBasePath(value) !== null,
78
- "UI Base Path must be an absolute path without query, hash, backslash, or traversal",
79
- )
80
- .transform((value) => normalizeBrowserRuntimeBasePath(value) ?? value);
81
-
82
- export const BrowserRuntimeBaseUrlSchema = z
83
- .string()
84
- .min(1)
85
- .max(2_048)
86
- .refine(
87
- (value) => normalizeBrowserRuntimeBaseUrl(value) !== null,
88
- "Runtime Base URL must be an HTTP(S) URL without credentials, query, hash, or traversal",
89
- )
90
- .transform((value) => normalizeBrowserRuntimeBaseUrl(value) ?? value);
91
-
92
- export const BrowserRuntimeCapabilitiesSchema = z
93
- .object({
94
- rest: z.boolean(),
95
- sse: z.boolean(),
96
- proxy: z.boolean(),
97
- mcp: z.boolean(),
98
- })
99
- .strict();
100
-
101
- export const BrowserRuntimeDeploymentSchema = z
102
- .object({
103
- schemaVersion: z.literal(BROWSER_RUNTIME_SCHEMA_VERSION),
104
- deploymentMode: z.enum(["composed", "backend-only", "separated"]),
105
- ui: z
106
- .object({
107
- basePath: BrowserRuntimeBasePathSchema,
108
- })
109
- .strict(),
110
- control: z
111
- .object({
112
- baseUrl: BrowserRuntimeBaseUrlSchema,
113
- })
114
- .strict(),
115
- agent: z
116
- .object({
117
- baseUrl: BrowserRuntimeBaseUrlSchema,
118
- })
119
- .strict(),
120
- capabilities: BrowserRuntimeCapabilitiesSchema,
121
- })
122
- .strict();
123
-
124
- export type BrowserRuntimeDeployment = z.infer<typeof BrowserRuntimeDeploymentSchema>;