@tonyclaw/agent-inspector 3.0.44 → 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 (347) 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 +22707 -17099
  4. package/.output/server/_libs/extend.mjs +4 -8
  5. package/.output/server/_libs/jszip.mjs +9 -35
  6. package/.output/server/_libs/modelcontextprotocol__core.mjs +25 -25
  7. package/.output/server/_libs/modelcontextprotocol__server.mjs +2 -2
  8. package/.output/server/_libs/react-dom.mjs +2 -3
  9. package/.output/server/_libs/react.mjs +1 -27
  10. package/.output/server/_libs/tanstack__react-router.mjs +1 -329
  11. package/.output/server/_libs/tanstack__router-core.mjs +42 -100
  12. package/.output/server/_libs/use-sync-external-store.mjs +1 -64
  13. package/.output/server/_libs/ws.mjs +1 -1
  14. package/.output/server/_libs/zod.mjs +6 -6
  15. package/.output/server/_ssr/index.mjs +5 -4
  16. package/.output/server/_ssr/publicBasePathContext-IH2ilOfu.mjs +176 -0
  17. package/.output/server/_ssr/{router-DWcUFPR3.mjs → router-D18yUq36.mjs} +7877 -5597
  18. package/.output/server/_ssr/start-COQu_AgD.mjs +57 -0
  19. package/.output/server/_tanstack-start-manifest_v-DnbdNeun.mjs +4 -0
  20. package/.output/server/index.mjs +5 -145
  21. package/.output/{public/assets/CompareDrawer-DQHjxFO6.js → ui/assets/CompareDrawer-DAUuIJ6G.js} +1 -1
  22. package/.output/{public/assets/InspectorPet-D1A4505B.js → ui/assets/InspectorPet-BRBVjOWI.js} +1 -1
  23. package/.output/ui/assets/ProxyViewerContainer-D7Sq0ctc.js +59 -0
  24. package/.output/{public/assets/ReplayDialog-C5vmbecv.js → ui/assets/ReplayDialog-nDLsjOhs.js} +1 -1
  25. package/.output/{public/assets/RequestAnatomy-CPGNB8lk.js → ui/assets/RequestAnatomy-zd4BDgL0.js} +1 -1
  26. package/.output/ui/assets/ResponseView-AdIXGcSn.js +2 -0
  27. package/.output/ui/assets/StreamingChunkSequence-CesTz8He.js +1 -0
  28. package/.output/{public/assets/_sessionId-CDhRgzf6.js → ui/assets/_sessionId-BAfzrhSU.js} +1 -1
  29. package/.output/{public/assets/_sessionId-mw3aA8Bp.js → ui/assets/_sessionId-QnBomgPD.js} +1 -1
  30. package/.output/ui/assets/favicon-DYEkHSNl.svg +21 -0
  31. package/.output/{public/assets/index-B2eoeT-Z.js → ui/assets/index-BcsdxBAd.js} +1 -1
  32. package/.output/ui/assets/index-BvXp42al.css +1 -0
  33. package/.output/{public/assets/index-CX7_rf7o.js → ui/assets/index-D0rtCN9V.js} +1 -1
  34. package/.output/ui/assets/index-DHpwr08Z.js +73 -0
  35. package/.output/{public/assets/index-BfRhTvOd.js → ui/assets/index-dNuk2dsU.js} +1 -1
  36. package/.output/ui/assets/json-viewer-BvFHglMb.js +1 -0
  37. package/.output/{public/assets/jszip.min-C9rCFoU3.js → ui/assets/jszip.min-B5Z7gNZB.js} +1 -1
  38. package/.output/ui/index.html +229 -0
  39. package/.output/ui/runtime-config.js +2 -0
  40. package/.output/workers/logFinalizer.worker.js +983 -414
  41. package/.output/workers/sessionWorkerEntry.js +983 -414
  42. package/README.md +363 -35
  43. package/docs/instance-control.openapi.yaml +361 -0
  44. package/package.json +28 -5
  45. package/scripts/generate-theme-scales.mjs +3 -3
  46. package/src/{router.tsx → backend/router.tsx} +3 -15
  47. package/src/backend/routes/$.ts +26 -0
  48. package/src/backend/routes/__root.ts +4 -0
  49. package/src/backend/routes/api/-instances.ts +109 -0
  50. package/src/{routes → backend/routes}/api/alerts.summary.ts +3 -3
  51. package/src/{routes → backend/routes}/api/alerts.ts +4 -4
  52. package/src/{routes → backend/routes}/api/config.paths.ts +1 -1
  53. package/src/{routes → backend/routes}/api/config.ts +11 -2
  54. package/src/{routes → backend/routes}/api/ecosystem.packages.$packageId.help.ts +1 -1
  55. package/src/{routes → backend/routes}/api/ecosystem.packages.$packageId.install.ts +1 -1
  56. package/src/{routes → backend/routes}/api/ecosystem.packages.$packageId.runner-presets.ts +1 -1
  57. package/src/{routes → backend/routes}/api/ecosystem.packages.$packageId.upgrade.ts +1 -1
  58. package/src/{routes → backend/routes}/api/ecosystem.packages.ts +5 -1
  59. package/src/{routes → backend/routes}/api/ecosystem.recipes.$recipeId.run.ts +1 -1
  60. package/src/{routes → backend/routes}/api/ecosystem.tasks.$taskId.ts +1 -1
  61. package/src/{routes → backend/routes}/api/ecosystem.tasks.ts +1 -1
  62. package/src/{routes → backend/routes}/api/groups.$groupId.evidence.ts +2 -2
  63. package/src/{routes → backend/routes}/api/groups.$groupId.sessions.ts +2 -2
  64. package/src/{routes → backend/routes}/api/groups.$groupId.ts +2 -2
  65. package/src/{routes → backend/routes}/api/groups.ts +2 -2
  66. package/src/{routes → backend/routes}/api/health.ts +3 -3
  67. package/src/backend/routes/api/instances.$name.connection.ts +12 -0
  68. package/src/backend/routes/api/instances.$name.restart.ts +23 -0
  69. package/src/backend/routes/api/instances.$name.start.ts +18 -0
  70. package/src/backend/routes/api/instances.$name.stop.ts +23 -0
  71. package/src/backend/routes/api/instances.$name.ts +12 -0
  72. package/src/backend/routes/api/instances.ts +16 -0
  73. package/src/{routes → backend/routes}/api/knowledge.candidates.$candidateId.promote.ts +2 -2
  74. package/src/{routes → backend/routes}/api/knowledge.candidates.$candidateId.ts +2 -2
  75. package/src/{routes → backend/routes}/api/knowledge.candidates.ts +1 -1
  76. package/src/{routes → backend/routes}/api/knowledge.project-context.ts +2 -2
  77. package/src/{routes → backend/routes}/api/knowledge.search.ts +2 -2
  78. package/src/{routes → backend/routes}/api/knowledge.sessions.$sessionId.candidates.ts +3 -3
  79. package/src/{routes → backend/routes}/api/logs.$id.body.ts +6 -6
  80. package/src/{routes → backend/routes}/api/logs.$id.chunks.ts +5 -4
  81. package/src/{routes → backend/routes}/api/logs.$id.replay.ts +12 -11
  82. package/src/{routes → backend/routes}/api/logs.$id.ts +4 -3
  83. package/src/{routes → backend/routes}/api/logs.import.ts +3 -3
  84. package/src/{routes → backend/routes}/api/logs.stream.ts +11 -7
  85. package/src/{routes → backend/routes}/api/logs.ts +17 -9
  86. package/src/{routes → backend/routes}/api/mcp.ts +1 -1
  87. package/src/{routes → backend/routes}/api/models.ts +1 -1
  88. package/src/{routes → backend/routes}/api/pi-agent.ts +2 -2
  89. package/src/{routes → backend/routes}/api/providers.$providerId.model-metadata.ts +5 -5
  90. package/src/{routes → backend/routes}/api/providers.$providerId.test.log.ts +7 -7
  91. package/src/{routes → backend/routes}/api/providers.$providerId.ts +4 -4
  92. package/src/{routes → backend/routes}/api/providers.export.ts +1 -1
  93. package/src/{routes → backend/routes}/api/providers.import.ts +3 -3
  94. package/src/{routes → backend/routes}/api/providers.scan.ts +2 -2
  95. package/src/{routes → backend/routes}/api/providers.ts +9 -4
  96. package/src/{routes → backend/routes}/api/runs.$runId.evidence.ts +2 -2
  97. package/src/{routes → backend/routes}/api/runs.$runId.ts +2 -2
  98. package/src/{routes → backend/routes}/api/runs.ts +4 -4
  99. package/src/backend/routes/api/runtime.ts +46 -0
  100. package/src/{routes → backend/routes}/api/sessions.ts +3 -3
  101. package/src/{routes → backend/routes}/proxy/$.ts +1 -1
  102. package/src/{routes → backend/routes}/readyz.ts +1 -1
  103. package/src/backend/start.ts +10 -0
  104. package/src/cli/alias.ts +431 -0
  105. package/src/cli/doctor.ts +32 -9
  106. package/src/cli/instance.ts +1050 -0
  107. package/src/cli/instanceArgs.ts +285 -0
  108. package/src/cli/instanceControl.ts +181 -0
  109. package/src/cli/instanceModel.ts +267 -0
  110. package/src/cli/instanceRegistry.ts +731 -0
  111. package/src/cli/networkHints.ts +27 -14
  112. package/src/cli/onboard.ts +190 -35
  113. package/src/cli/onboardTarget.ts +228 -0
  114. package/src/cli/templates/codex-skill-onboard.ts +109 -31
  115. package/src/cli/templates/skill-onboard.ts +140 -70
  116. package/src/cli.ts +338 -77
  117. package/src/components/ProxyViewer.tsx +20 -10
  118. package/src/components/ProxyViewerContainer.tsx +12 -11
  119. package/src/components/pi-agent/PiAgentPanel.tsx +2 -2
  120. package/src/components/providers/ProviderCard.tsx +1 -1
  121. package/src/components/providers/ProviderTestResultsView.tsx +1 -1
  122. package/src/components/providers/SettingsDialog.tsx +160 -140
  123. package/src/components/proxy-viewer/ApplicationBar.tsx +2 -1
  124. package/src/components/proxy-viewer/LogEntry.tsx +1 -1
  125. package/src/components/proxy-viewer/log-formats/index.ts +1 -1
  126. package/src/contracts/index.ts +5 -0
  127. package/src/contracts/log.ts +33 -3
  128. package/src/knowledge/types.ts +3 -2
  129. package/src/lib/alertContract.ts +2 -2
  130. package/src/lib/apiClient.ts +30 -7
  131. package/src/lib/apiFormat.ts +29 -0
  132. package/src/lib/basePath.ts +31 -7
  133. package/src/lib/browserRuntimeContract.ts +124 -0
  134. package/src/lib/browserRuntimeResolver.ts +244 -0
  135. package/src/{proxy → lib}/claudeCodeStrip.ts +6 -7
  136. package/src/lib/codingAgentEndpoints.ts +54 -0
  137. package/src/lib/instanceContract.ts +236 -0
  138. package/src/lib/managedInstance.ts +104 -0
  139. package/src/lib/piAgentContract.ts +3 -2
  140. package/src/lib/publicBasePathContext.ts +137 -0
  141. package/src/lib/resourceLimits.ts +2 -0
  142. package/src/lib/runContract.ts +3 -3
  143. package/src/lib/sessionInfoContract.ts +3 -2
  144. package/src/mcp/instanceHandlers.ts +150 -0
  145. package/src/mcp/loopback.ts +16 -5
  146. package/src/mcp/mode.ts +25 -0
  147. package/src/mcp/server.ts +274 -39
  148. package/src/mcp/toolHandlers.ts +2 -2
  149. package/src/proxy/config.ts +25 -30
  150. package/src/proxy/dataDir.ts +43 -7
  151. package/src/proxy/ecosystemTasks.ts +161 -70
  152. package/src/proxy/formats/registry.ts +6 -21
  153. package/src/proxy/handler.ts +129 -29
  154. package/src/proxy/identityProxy.ts +1049 -50
  155. package/src/proxy/jsonlRecovery.ts +554 -0
  156. package/src/proxy/logFinalizer.ts +25 -10
  157. package/src/proxy/logImporter.ts +2 -1
  158. package/src/proxy/logIndex.ts +191 -95
  159. package/src/proxy/logger.ts +77 -14
  160. package/src/proxy/platformCommands.ts +41 -0
  161. package/src/proxy/privateDataPath.ts +310 -88
  162. package/src/proxy/rawStreamCapture.ts +194 -13
  163. package/src/proxy/runtimeAdmission.ts +5 -2
  164. package/src/proxy/runtimeHealth.ts +14 -1
  165. package/src/proxy/runtimeShutdown.ts +84 -2
  166. package/src/proxy/schemas.ts +7 -1
  167. package/src/proxy/sessionArchive.ts +78 -14
  168. package/src/proxy/sessionInfo.ts +5 -4
  169. package/src/proxy/sqliteLogIndex.ts +65 -2
  170. package/src/proxy/store.ts +141 -34
  171. package/src/proxy/uiAssetServer.ts +106 -0
  172. package/src/proxy/upstream.ts +29 -2
  173. package/src/ui/bootstrap.ts +167 -0
  174. package/src/ui/index.html +38 -0
  175. package/src/ui/logsStreamClient.ts +20 -0
  176. package/src/ui/main.tsx +13 -0
  177. package/src/ui/public/runtime-config.js +2 -0
  178. package/src/ui/router.tsx +13 -0
  179. package/src/ui/routes/__root.tsx +69 -0
  180. package/src/{routes → ui/routes}/index.tsx +2 -3
  181. package/src/{routes → ui/routes}/session/$sessionId.tsx +5 -11
  182. package/src/ui/runtimeDiscovery.ts +50 -0
  183. package/styles/globals.css +1 -0
  184. package/.output/public/assets/ProxyViewerContainer-BhpIgfBi.js +0 -126
  185. package/.output/public/assets/ResponseView-DUfrajCm.js +0 -2
  186. package/.output/public/assets/StreamingChunkSequence-nbeCQqOz.js +0 -1
  187. package/.output/public/assets/index-BWjeqxbk.css +0 -1
  188. package/.output/public/assets/index-C6qZwYlR.js +0 -70
  189. package/.output/public/assets/json-viewer-BLmF1sOZ.js +0 -1
  190. package/.output/server/_libs/@radix-ui/react-accessible-icon+[...].mjs +0 -1
  191. package/.output/server/_libs/@radix-ui/react-dismissable-layer+[...].mjs +0 -344
  192. package/.output/server/_libs/@radix-ui/react-navigation-menu+[...].mjs +0 -2
  193. package/.output/server/_libs/@radix-ui/react-one-time-password-field+[...].mjs +0 -2
  194. package/.output/server/_libs/@radix-ui/react-password-toggle-field+[...].mjs +0 -2
  195. package/.output/server/_libs/@radix-ui/react-use-callback-ref+[...].mjs +0 -11
  196. package/.output/server/_libs/@radix-ui/react-use-controllable-state+[...].mjs +0 -69
  197. package/.output/server/_libs/@radix-ui/react-use-effect-event+[...].mjs +0 -1
  198. package/.output/server/_libs/@radix-ui/react-use-is-hydrated+[...].mjs +0 -28
  199. package/.output/server/_libs/@radix-ui/react-use-layout-effect+[...].mjs +0 -6
  200. package/.output/server/_libs/@radix-ui/react-visually-hidden+[...].mjs +0 -34
  201. package/.output/server/_libs/aria-hidden.mjs +0 -122
  202. package/.output/server/_libs/bail.mjs +0 -8
  203. package/.output/server/_libs/character-entities.mjs +0 -2130
  204. package/.output/server/_libs/class-variance-authority.mjs +0 -44
  205. package/.output/server/_libs/clsx.mjs +0 -16
  206. package/.output/server/_libs/comma-separated-tokens.mjs +0 -10
  207. package/.output/server/_libs/decode-named-character-reference+[...].mjs +0 -8
  208. package/.output/server/_libs/dequal.mjs +0 -27
  209. package/.output/server/_libs/detect-node-es.mjs +0 -1
  210. package/.output/server/_libs/devlop.mjs +0 -8
  211. package/.output/server/_libs/diff.mjs +0 -320
  212. package/.output/server/_libs/estree-util-is-identifier-name.mjs +0 -11
  213. package/.output/server/_libs/floating-ui__core.mjs +0 -725
  214. package/.output/server/_libs/floating-ui__dom.mjs +0 -622
  215. package/.output/server/_libs/floating-ui__react-dom.mjs +0 -292
  216. package/.output/server/_libs/floating-ui__utils.mjs +0 -320
  217. package/.output/server/_libs/get-nonce.mjs +0 -9
  218. package/.output/server/_libs/hast-util-to-jsx-runtime.mjs +0 -388
  219. package/.output/server/_libs/hast-util-whitespace.mjs +0 -10
  220. package/.output/server/_libs/html-url-attributes.mjs +0 -26
  221. package/.output/server/_libs/inline-style-parser.mjs +0 -142
  222. package/.output/server/_libs/is-plain-obj.mjs +0 -10
  223. package/.output/server/_libs/lucide-react.mjs +0 -1027
  224. package/.output/server/_libs/mdast-util-from-markdown.mjs +0 -717
  225. package/.output/server/_libs/mdast-util-to-hast.mjs +0 -710
  226. package/.output/server/_libs/mdast-util-to-string.mjs +0 -38
  227. package/.output/server/_libs/micromark-core-commonmark.mjs +0 -2259
  228. package/.output/server/_libs/micromark-factory-destination.mjs +0 -94
  229. package/.output/server/_libs/micromark-factory-label.mjs +0 -63
  230. package/.output/server/_libs/micromark-factory-space.mjs +0 -24
  231. package/.output/server/_libs/micromark-factory-title.mjs +0 -65
  232. package/.output/server/_libs/micromark-factory-whitespace.mjs +0 -22
  233. package/.output/server/_libs/micromark-util-character.mjs +0 -44
  234. package/.output/server/_libs/micromark-util-chunked.mjs +0 -36
  235. package/.output/server/_libs/micromark-util-classify-character+[...].mjs +0 -12
  236. package/.output/server/_libs/micromark-util-combine-extensions+[...].mjs +0 -41
  237. package/.output/server/_libs/micromark-util-decode-numeric-character-reference+[...].mjs +0 -19
  238. package/.output/server/_libs/micromark-util-decode-string.mjs +0 -21
  239. package/.output/server/_libs/micromark-util-encode.mjs +0 -1
  240. package/.output/server/_libs/micromark-util-html-tag-name.mjs +0 -69
  241. package/.output/server/_libs/micromark-util-normalize-identifier+[...].mjs +0 -6
  242. package/.output/server/_libs/micromark-util-resolve-all.mjs +0 -15
  243. package/.output/server/_libs/micromark-util-sanitize-uri.mjs +0 -41
  244. package/.output/server/_libs/micromark-util-subtokenize.mjs +0 -346
  245. package/.output/server/_libs/micromark.mjs +0 -906
  246. package/.output/server/_libs/property-information.mjs +0 -1209
  247. package/.output/server/_libs/radix-ui.mjs +0 -1
  248. package/.output/server/_libs/radix-ui__number.mjs +0 -6
  249. package/.output/server/_libs/radix-ui__primitive.mjs +0 -11
  250. package/.output/server/_libs/radix-ui__react-accordion.mjs +0 -1
  251. package/.output/server/_libs/radix-ui__react-alert-dialog.mjs +0 -1
  252. package/.output/server/_libs/radix-ui__react-arrow.mjs +0 -23
  253. package/.output/server/_libs/radix-ui__react-aspect-ratio.mjs +0 -1
  254. package/.output/server/_libs/radix-ui__react-avatar.mjs +0 -1
  255. package/.output/server/_libs/radix-ui__react-checkbox.mjs +0 -1
  256. package/.output/server/_libs/radix-ui__react-collapsible.mjs +0 -144
  257. package/.output/server/_libs/radix-ui__react-collection.mjs +0 -69
  258. package/.output/server/_libs/radix-ui__react-compose-refs.mjs +0 -38
  259. package/.output/server/_libs/radix-ui__react-context-menu.mjs +0 -1
  260. package/.output/server/_libs/radix-ui__react-context.mjs +0 -64
  261. package/.output/server/_libs/radix-ui__react-dialog.mjs +0 -280
  262. package/.output/server/_libs/radix-ui__react-direction.mjs +0 -9
  263. package/.output/server/_libs/radix-ui__react-dropdown-menu.mjs +0 -1
  264. package/.output/server/_libs/radix-ui__react-focus-guards.mjs +0 -39
  265. package/.output/server/_libs/radix-ui__react-focus-scope.mjs +0 -210
  266. package/.output/server/_libs/radix-ui__react-form.mjs +0 -1
  267. package/.output/server/_libs/radix-ui__react-hover-card.mjs +0 -1
  268. package/.output/server/_libs/radix-ui__react-id.mjs +0 -14
  269. package/.output/server/_libs/radix-ui__react-label.mjs +0 -1
  270. package/.output/server/_libs/radix-ui__react-menu.mjs +0 -1
  271. package/.output/server/_libs/radix-ui__react-menubar.mjs +0 -1
  272. package/.output/server/_libs/radix-ui__react-popover.mjs +0 -1
  273. package/.output/server/_libs/radix-ui__react-popper.mjs +0 -340
  274. package/.output/server/_libs/radix-ui__react-portal.mjs +0 -16
  275. package/.output/server/_libs/radix-ui__react-presence.mjs +0 -173
  276. package/.output/server/_libs/radix-ui__react-primitive.mjs +0 -42
  277. package/.output/server/_libs/radix-ui__react-progress.mjs +0 -1
  278. package/.output/server/_libs/radix-ui__react-radio-group.mjs +0 -1
  279. package/.output/server/_libs/radix-ui__react-roving-focus.mjs +0 -235
  280. package/.output/server/_libs/radix-ui__react-scroll-area.mjs +0 -731
  281. package/.output/server/_libs/radix-ui__react-select.mjs +0 -1207
  282. package/.output/server/_libs/radix-ui__react-separator.mjs +0 -28
  283. package/.output/server/_libs/radix-ui__react-slider.mjs +0 -1
  284. package/.output/server/_libs/radix-ui__react-slot.mjs +0 -132
  285. package/.output/server/_libs/radix-ui__react-switch.mjs +0 -1
  286. package/.output/server/_libs/radix-ui__react-tabs.mjs +0 -194
  287. package/.output/server/_libs/radix-ui__react-toast.mjs +0 -2
  288. package/.output/server/_libs/radix-ui__react-toggle-group.mjs +0 -1
  289. package/.output/server/_libs/radix-ui__react-toggle.mjs +0 -1
  290. package/.output/server/_libs/radix-ui__react-toolbar.mjs +0 -1
  291. package/.output/server/_libs/radix-ui__react-tooltip.mjs +0 -498
  292. package/.output/server/_libs/radix-ui__react-use-previous.mjs +0 -14
  293. package/.output/server/_libs/radix-ui__react-use-size.mjs +0 -39
  294. package/.output/server/_libs/react-markdown.mjs +0 -235
  295. package/.output/server/_libs/react-remove-scroll-bar.mjs +0 -82
  296. package/.output/server/_libs/react-remove-scroll.mjs +0 -328
  297. package/.output/server/_libs/react-style-singleton.mjs +0 -69
  298. package/.output/server/_libs/remark-parse.mjs +0 -19
  299. package/.output/server/_libs/remark-rehype.mjs +0 -21
  300. package/.output/server/_libs/space-separated-tokens.mjs +0 -6
  301. package/.output/server/_libs/style-to-js.mjs +0 -72
  302. package/.output/server/_libs/style-to-object.mjs +0 -38
  303. package/.output/server/_libs/swr.mjs +0 -947
  304. package/.output/server/_libs/tailwind-merge.mjs +0 -3255
  305. package/.output/server/_libs/tanstack__react-virtual.mjs +0 -130
  306. package/.output/server/_libs/tanstack__virtual-core.mjs +0 -1319
  307. package/.output/server/_libs/three.mjs +0 -26016
  308. package/.output/server/_libs/trim-lines.mjs +0 -41
  309. package/.output/server/_libs/trough.mjs +0 -85
  310. package/.output/server/_libs/tslib.mjs +0 -1
  311. package/.output/server/_libs/ungap__structured-clone.mjs +0 -212
  312. package/.output/server/_libs/unified.mjs +0 -661
  313. package/.output/server/_libs/unist-util-is.mjs +0 -100
  314. package/.output/server/_libs/unist-util-position.mjs +0 -27
  315. package/.output/server/_libs/unist-util-stringify-position.mjs +0 -27
  316. package/.output/server/_libs/unist-util-visit-parents.mjs +0 -82
  317. package/.output/server/_libs/unist-util-visit.mjs +0 -24
  318. package/.output/server/_libs/use-callback-ref.mjs +0 -66
  319. package/.output/server/_libs/use-sidecar.mjs +0 -106
  320. package/.output/server/_libs/vfile-message.mjs +0 -138
  321. package/.output/server/_libs/vfile.mjs +0 -467
  322. package/.output/server/_sessionId-E_Dmopc-.mjs +0 -144
  323. package/.output/server/_sessionId-U54BAqdp.mjs +0 -82
  324. package/.output/server/_ssr/CompareDrawer-CksatPed.mjs +0 -1058
  325. package/.output/server/_ssr/InspectorPet-DNc4GQ7z.mjs +0 -936
  326. package/.output/server/_ssr/ProxyViewerContainer-B02Ey0p_.mjs +0 -17607
  327. package/.output/server/_ssr/ReplayDialog-DdMvHJF1.mjs +0 -723
  328. package/.output/server/_ssr/RequestAnatomy--vh2Z8__.mjs +0 -835
  329. package/.output/server/_ssr/ResponseView-Dhxc-cKC.mjs +0 -755
  330. package/.output/server/_ssr/StreamingChunkSequence-BG0EQmaD.mjs +0 -272
  331. package/.output/server/_ssr/index-D0At9nfd.mjs +0 -82
  332. package/.output/server/_ssr/index-lcfulIXa.mjs +0 -133
  333. package/.output/server/_ssr/json-viewer-My1J1_5R.mjs +0 -481
  334. package/.output/server/_ssr/start-HYkvq4Ni.mjs +0 -4
  335. package/.output/server/_tanstack-start-manifest_v-B2chR8ef.mjs +0 -4
  336. package/.output/server/node_modules/tslib/modules/index.js +0 -70
  337. package/.output/server/node_modules/tslib/modules/package.json +0 -3
  338. package/.output/server/node_modules/tslib/package.json +0 -47
  339. package/.output/server/node_modules/tslib/tslib.js +0 -484
  340. package/.output/server/package.json +0 -9
  341. package/src/routes/__root.tsx +0 -170
  342. /package/.output/{public → ui}/assets/agent-inspector-58K1_MsC.ico +0 -0
  343. /package/.output/{public → ui}/assets/alibaba-TTwafVwX.svg +0 -0
  344. /package/.output/{public → ui}/assets/minimax-BPMzvuL-.jpeg +0 -0
  345. /package/.output/{public → ui}/assets/qwen-mMn3f5ul.webp +0 -0
  346. /package/.output/{public → ui}/assets/zhipuai-BPNAnxo-.svg +0 -0
  347. /package/src/{routes → backend/routes}/livez.ts +0 -0
package/README.md CHANGED
@@ -28,7 +28,7 @@ Optional MCP-first companion package:
28
28
 
29
29
  ```bash
30
30
  npm install -g @tonyclaw/agent-inspector-mcp
31
- agent-inspector-mcp doctor
31
+ agent-inspector-mcp doctor --url http://localhost:9527/inspector/api/mcp
32
32
  ```
33
33
 
34
34
  Agent Inspector requires Node.js 22 or newer. Node.js 24 LTS is recommended for production use.
@@ -55,10 +55,11 @@ and defaults to a 64 MiB hard limit and a 120 second body deadline; override the
55
55
  integer byte/millisecond values in `AGENT_INSPECTOR_MAX_REQUEST_BYTES` and
56
56
  `AGENT_INSPECTOR_REQUEST_TIMEOUT_MS` when a trusted workload requires different bounds.
57
57
 
58
- `@tonyclaw/agent-inspector` runs the local UI, proxy, REST API, storage, and built-in
59
- `/api/mcp` endpoint. `@tonyclaw/agent-inspector-mcp` is the enhancement package for
60
- stdio-first MCP clients and setup automation; it bridges to the local Inspector endpoint without
61
- moving your captured evidence out of the machine.
58
+ `@tonyclaw/agent-inspector` runs the proxy, REST/SSE API, storage, and built-in `/api/mcp`
59
+ endpoint. Its default composed mode also serves the independently built UI; `--backend-only`
60
+ leaves every Coding Agent endpoint running without UI files. `@tonyclaw/agent-inspector-mcp` is the
61
+ enhancement package for stdio-first MCP clients and setup automation; it bridges to the local
62
+ Inspector endpoint without moving your captured evidence out of the machine.
62
63
 
63
64
  On Windows, the npm install step creates a local `agent-inspector.exe` runtime
64
65
  from the user's installed Node.js runtime. The long-running server process
@@ -84,15 +85,20 @@ agent-inspector onboard
84
85
 
85
86
  The onboarding command installs guided setup skills for local agents:
86
87
 
88
+ The generated instructions and automatically merged MCP entries derive the backend Base URL from
89
+ `AGENT_INSPECTOR_PUBLIC_ORIGIN` (or the default local CLI origin) plus
90
+ `AGENT_INSPECTOR_BASE_PATH`. The default is `http://localhost:9527/inspector`. This control/agent
91
+ Base URL is separate from both the optional UI URL and each Provider's upstream Base URL.
92
+
87
93
  - Claude Code: `~/.claude/skills/agent-inspector-onboard/SKILL.md` plus a slash command.
88
94
  - Codex: `~/.codex/skills/agent-inspector-onboard/SKILL.md`, focused on connecting
89
- `http://localhost:9527/api/mcp` through Codex `mcp_servers.agent-inspector`.
95
+ `<agent-base-url>/api/mcp` through Codex `mcp_servers.agent-inspector`.
90
96
  - OpenCode: run `agent-inspector onboard --opencode-only` to merge
91
97
  `mcp.agent-inspector` into `~/.config/opencode/opencode.json` or `opencode.jsonc`, then verify
92
98
  with `opencode mcp list`.
93
99
  - MiMo Code: run `agent-inspector onboard --mimo-only` to merge `mcp.agent-inspector` into
94
100
  `~/.config/mimocode/mimocode.jsonc` or `mimocode.json`, then route MiMo through the proxy with
95
- `OPENAI_BASE_URL=http://localhost:9527/proxy`.
101
+ `OPENAI_BASE_URL=<agent-base-url>/proxy/v1`.
96
102
 
97
103
  During npm global install, Agent Inspector also makes a best-effort onboarding skill install for
98
104
  detected local agents. If `~/.claude` exists, it installs the Claude Code skill and slash command.
@@ -116,6 +122,28 @@ edits a real tool config file instead of adding an Agent Inspector generated ski
116
122
  `agent-inspector onboard --status --opencode-only --json` or
117
123
  `agent-inspector onboard --status --mimo-only --json` to inspect those MCP entries.
118
124
 
125
+ For coding agents that must address more than one Inspector, onboarding can target either a
126
+ registered Windows instance or an explicit wrapper URL:
127
+
128
+ ```powershell
129
+ agent-inspector onboard --instance review --force
130
+ agent-inspector onboard --instance review --mcp-name agent-inspector-review --opencode-only --force
131
+ agent-inspector onboard --base-url https://tools.example.test/inspector --mcp-name team-inspector --force
132
+ agent-inspector onboard --control-base-url https://control.example.test/inspector `
133
+ --agent-base-url https://agent.example.test/inspector `
134
+ --ui-url https://ui.example.test/observe --mcp-name team-inspector --force
135
+ agent-inspector onboard --control-base-url https://control.example.test/inspector `
136
+ --agent-base-url https://agent.example.test/inspector --no-ui --force
137
+ ```
138
+
139
+ `--instance` resolves the saved instance URL and defaults the MCP config key to
140
+ `agent-inspector-<instance>`. `--base-url` accepts a credential-free HTTP(S) backend control/agent
141
+ Base URL as a compatibility shortcut; it does not imply that a browser UI exists. Separated
142
+ deployments can set `--control-base-url`, `--agent-base-url`, and either `--ui-url` or `--no-ui`.
143
+ `--instance` is mutually exclusive with every explicit URL option. `--mcp-name` selects the exact MCP
144
+ config key, allowing the generated config to preserve other Inspector entries. Explicit per-client
145
+ MCP URL options still take precedence over the resolved target.
146
+
119
147
  Before uninstalling the npm package, run `agent-inspector onboard --uninstall` to remove matching
120
148
  generated onboarding files. The uninstall command only removes Agent Inspector generated files whose
121
149
  metadata version matches the currently installed npm package. npm v7+ does not run package uninstall
@@ -129,6 +157,111 @@ bun install
129
157
  bun run dev
130
158
  ```
131
159
 
160
+ ### Deployment modes and runtime Base URLs
161
+
162
+ Agent Inspector ships one compatible UI/backend release but can run it in three topologies:
163
+
164
+ | Mode | Start | UI | Coding Agent surfaces |
165
+ | --- | --- | --- | --- |
166
+ | Composed (default) | `agent-inspector` | Served by the protected public ingress | REST, SSE, proxy, health, and MCP use the same public backend Base URL. |
167
+ | Backend-only | `agent-inspector --backend-only --no-open` | Not served; document requests return a bounded headless response | REST, SSE, proxy, health, MCP, capture, and named-instance control remain available. |
168
+ | Standalone UI | Build/host `.output/ui` with SPA fallback | Served by a separate static host | The UI reads operator runtime configuration and calls an explicitly configured backend. |
169
+
170
+ Do not use "Inspector Base URL" to mean every surface implicitly. The browser-safe runtime
171
+ contract keeps three locations explicit:
172
+
173
+ - UI Base Path: router/asset mount for the static UI.
174
+ - Control Base URL: REST, uploads/downloads, mutations, and log SSE.
175
+ - Agent Base URL: model proxy, OpenAI-compatible `/proxy/v1`, and MCP guidance.
176
+
177
+ Composed and backend-only deployments currently publish the same backend Base URL for control and
178
+ agent traffic, but clients must still use the corresponding runtime field. A separately hosted UI
179
+ has its own origin and mount path. `GET <control-base-url>/api/runtime` returns a versioned,
180
+ token-free, `no-store` discovery document with deployment mode and capabilities.
181
+
182
+ The static UI loads `runtime-config.js` before the application bundle. For a separately hosted UI,
183
+ replace `.output/ui/runtime-config.js` with an operator-owned value such as:
184
+
185
+ ```js
186
+ window.__AGENT_INSPECTOR_RUNTIME_CONFIG__ = {
187
+ schemaVersion: 1,
188
+ deploymentMode: "separated",
189
+ ui: { basePath: "/" },
190
+ control: { baseUrl: "http://127.0.0.1:19527/inspector" },
191
+ agent: { baseUrl: "http://127.0.0.1:19527/inspector" },
192
+ capabilities: { rest: true, sse: true, proxy: true, mcp: true },
193
+ };
194
+ ```
195
+
196
+ Replace the example URLs with the exact backend URLs printed by the CLI or returned by
197
+ `agent-inspector instance connect <name> --json`. Base URLs must be credential-free HTTP(S) URLs
198
+ without query or fragment. Never put Provider keys, control tokens, or proxy tokens in
199
+ `runtime-config.js`, bootstrap HTML, query strings, or browser storage.
200
+
201
+ The standalone static host must send a CSP whose `connect-src` contains only `'self'` and the exact
202
+ configured control origin; never use `*`. Composed mode generates a same-origin CSP at the protected
203
+ ingress. If the control Base URL changes, update `runtime-config.js` and CSP together.
204
+
205
+ For a local UI that directly calls another local origin, set a comma-separated exact loopback
206
+ allowlist on the protected backend, for example:
207
+
208
+ ```bash
209
+ AGENT_INSPECTOR_UI_ORIGINS=http://127.0.0.1:4173,http://localhost:4173 agent-inspector --backend-only
210
+ ```
211
+
212
+ `AGENT_INSPECTOR_UI_ORIGINS` accepts only exact `http`/`https` loopback origins: no wildcard,
213
+ credentials, path, query, fragment, or non-loopback hostname. It enables the control API/SSE CORS
214
+ path only; browser CORS access to `/proxy` and `/api/mcp` stays forbidden. A non-loopback remote UI
215
+ must use an authenticated same-origin gateway that protects the public edge and forwards to the
216
+ loopback Inspector backend. Do not use the loopback CORS allowlist as remote authentication.
217
+
218
+ When a reverse proxy changes the browser-visible scheme/host/port, set the exact external origin
219
+ separately from the Base Path:
220
+
221
+ ```bash
222
+ AGENT_INSPECTOR_PUBLIC_ORIGIN=https://tools.example.test \
223
+ AGENT_INSPECTOR_BASE_PATH=/inspector \
224
+ agent-inspector
225
+ ```
226
+
227
+ `AGENT_INSPECTOR_PUBLIC_ORIGIN` is an origin only; it allows no credentials, path, query, or
228
+ fragment. It drives request-local runtime discovery, copied endpoint guidance, and MCP outward URLs;
229
+ the proxy must also be included in `AGENT_INSPECTOR_TRUSTED_HOSTS` when its hostname is not otherwise
230
+ trusted.
231
+
232
+ Independent source workflows:
233
+
234
+ ```bash
235
+ bun run dev # Windows-safe supervisor: backend dev server + UI dev server
236
+ bun run dev:backend # backend route tree only (development listener)
237
+ bun run dev:ui # static UI dev server; same-Base-Path proxy by default
238
+
239
+ bun run build:backend # .output/server
240
+ bun run build:ui # .output/ui
241
+ bun run build # both artifacts plus CLI/workers/MCP and boundary checks
242
+
243
+ bun run start:backend # protected production CLI in backend-only mode
244
+ bun run preview:ui # preview the independently built static UI
245
+ ```
246
+
247
+ For a true separate-origin development UI, inject its runtime surfaces instead of relying on the
248
+ same-Base-Path dev proxy:
249
+
250
+ ```bash
251
+ AGENT_INSPECTOR_UI_BASE_PATH=/observe \
252
+ AGENT_INSPECTOR_UI_CONTROL_BASE_URL=http://127.0.0.1:19527/inspector \
253
+ AGENT_INSPECTOR_UI_AGENT_BASE_URL=http://127.0.0.1:19527/inspector \
254
+ AGENT_INSPECTOR_UI_PORT=4173 bun run dev:ui
255
+ ```
256
+
257
+ The backend must allow that exact local UI origin with `AGENT_INSPECTOR_UI_ORIGINS`. The explicit
258
+ control/agent variables are used only by UI dev/preview; production static hosting continues to use
259
+ the operator-owned `runtime-config.js` so one `.output/ui` artifact remains relocatable.
260
+
261
+ The direct backend development listener is loopback-oriented and is not a replacement for the
262
+ protected production ingress. An arbitrary static host must provide SPA fallback for supported deep
263
+ links such as `/session/<id>`.
264
+
132
265
  Run a local health check when you need to verify the proxy and installed
133
266
  configuration:
134
267
 
@@ -144,15 +277,20 @@ only checked when you ask for them explicitly:
144
277
  agent-inspector doctor --chrome-extension
145
278
  ```
146
279
 
147
- Then point an AI coding tool at the proxy:
280
+ Then point an AI coding tool at the agent Base URL reported by the CLI or connection descriptor:
148
281
 
149
282
  ```bash
150
283
  ANTHROPIC_BASE_URL=http://localhost:9527/inspector/proxy <tool>
151
284
  ```
152
285
 
153
- The web UI runs at http://localhost:9527/inspector by default. The public proxy endpoint is
154
- `http://localhost:9527/inspector/proxy`; internally Agent Inspector may run the app on a private
155
- helper port, but AI tools should use the public URL printed by the CLI.
286
+ In default composed mode, the web UI runs at `http://localhost:9527/inspector`. The public proxy
287
+ endpoint is `http://localhost:9527/inspector/proxy`; internally Agent Inspector may run the app on a
288
+ private helper port, but AI tools should use the public URL printed by the CLI.
289
+
290
+ When the dashboard has no captured requests, its copyable Claude, OpenCode, OpenAI, OpenAI `/v1`,
291
+ and MCP examples are derived from the resolved browser runtime contract. They therefore use the
292
+ configured agent surface even when the UI origin, backend origin, or Base Path differs from the
293
+ default.
156
294
 
157
295
  ### Base path
158
296
 
@@ -162,13 +300,19 @@ Agent Inspector defaults to the `/inspector` public base path:
162
300
  agent-inspector
163
301
  ```
164
302
 
165
- This generates prefixed public URLs for the UI, assets, REST API, MCP, sessions, and model proxy:
303
+ In composed mode this additionally generates these browser document/asset URLs:
166
304
 
167
305
  - Web UI: `http://localhost:9527/inspector`
168
306
  - Assets: `http://localhost:9527/inspector/assets/...`
307
+ - Sessions: `http://localhost:9527/inspector/session/...`
308
+
309
+ Both composed and backend-only modes keep these backend endpoints at the derived control/agent
310
+ Base URL:
311
+
169
312
  - REST API: `http://localhost:9527/inspector/api/...`
313
+ - Runtime discovery: `http://localhost:9527/inspector/api/runtime`
314
+ - Health: `http://localhost:9527/inspector/api/health`
170
315
  - MCP: `http://localhost:9527/inspector/api/mcp`
171
- - Sessions: `http://localhost:9527/inspector/session/...`
172
316
  - Proxy: `http://localhost:9527/inspector/proxy`
173
317
 
174
318
  AI tools should use the prefixed proxy URL:
@@ -183,26 +327,144 @@ To run at the domain root instead, explicitly set the base path to `/`:
183
327
  AGENT_INSPECTOR_BASE_PATH=/ agent-inspector
184
328
  ```
185
329
 
186
- Reverse proxies should preserve the `/inspector` prefix when forwarding public requests to Agent
187
- Inspector.
330
+ ### Runtime Base Path aliases
188
331
 
189
- The legacy `http://localhost:9527` port is closed by default. If you need a temporary alias for
190
- older AI tool or MCP configs, start with `agent-inspector --legacy-port`.
332
+ An already-running Inspector can expose an additional path without starting a second runtime or
333
+ sharing its data directory with another process. For example, after starting the canonical UI at
334
+ the domain root, add `/inspector` on the same origin and port:
191
335
 
192
- ## v3.0 Port Migration
336
+ ```bash
337
+ AGENT_INSPECTOR_BASE_PATH=/ agent-inspector --background --no-open
338
+ agent-inspector alias add /inspector
339
+ ```
193
340
 
194
- Agent Inspector v3.0 changes the default public port from `9527` to `9527`. The packaged CLI now
195
- opens only `9527` by default. Existing AI coding tool and MCP configs that still point at `9527`
196
- should be moved to `9527`, or you can temporarily start with `agent-inspector --legacy-port`.
341
+ The canonical and alias URLs share the same Providers, logs, sessions, MCP server, workers, and live
342
+ SSE state. Manage the current runtime's aliases with:
197
343
 
198
- Use these default endpoints for new configs:
344
+ ```bash
345
+ agent-inspector alias list
346
+ agent-inspector alias remove /inspector
347
+ ```
199
348
 
200
- - Web UI: `http://localhost:9527/inspector`
201
- - Proxy: `http://localhost:9527/inspector/proxy`
202
- - OpenAI-compatible `/v1` proxy: `http://localhost:9527/inspector/proxy/v1`
203
- - MCP: `http://localhost:9527/inspector/api/mcp`
349
+ Use `--port <port>` and `--host <host>` when the running local Inspector does not use
350
+ `localhost:9527`. Runtime aliases are intentionally temporary and are cleared when the Inspector
351
+ supervisor restarts; configure `AGENT_INSPECTOR_BASE_PATH` when a path must remain canonical across
352
+ restarts.
353
+
354
+ ### Windows named instances
355
+
356
+ Use a named instance when the second URL must have its own Providers, runtime configuration, logs,
357
+ sessions, workers, and data directory. Named instances run as hidden background supervisors on
358
+ Windows; the command waits for readiness before returning. The existing `agent-inspector` and
359
+ `agent-inspector start` commands remain the unmanaged default-instance startup path and do not
360
+ create an instance record.
361
+
362
+ ```powershell
363
+ agent-inspector instance start <name> [--port <port>] [--base-path <path>] [--host <host>] [--mode simple|full] [--data-dir <absolute-path>] [--backend-only|--with-ui] [--open] [--json]
364
+ agent-inspector instance list [--json]
365
+ agent-inspector instance status <name> [--json]
366
+ agent-inspector instance connect <name> [--json]
367
+ agent-inspector instance stop <name> [--json]
368
+ agent-inspector instance restart <name> [--port <port>] [--base-path <path>] [--host <host>] [--mode simple|full] [--data-dir <absolute-path>] [--backend-only|--with-ui] [--open] [--json]
369
+ ```
370
+
371
+ Names use lowercase letters, digits, dots, hyphens, and underscores; `default` is reserved for the
372
+ existing unmanaged runtime. A first start without `--port` allocates an available public/private
373
+ port pair. The pair and the other launch options are saved, so later `start` calls reuse the same
374
+ configuration. Use `restart` with overrides to change a saved value. `--backend-only` persists a
375
+ headless instance; `--with-ui` restores composed UI serving. `--open` is valid only when UI serving
376
+ is enabled. `--json` produces token-free output suitable for PowerShell:
377
+
378
+ ```powershell
379
+ agent-inspector instance start review --base-path /inspector --json
380
+ $review = agent-inspector instance status review --json | ConvertFrom-Json
381
+ $connection = agent-inspector instance connect review --json | ConvertFrom-Json
382
+ $env:OPENAI_BASE_URL = $connection.environment.OPENAI_BASE_URL
383
+ $review
384
+ ```
385
+
386
+ `connect` (also accepted as `connection`) returns a token-free connection descriptor with explicit
387
+ `surfaces.ui`, `surfaces.control`, and `surfaces.agent` locations. Use
388
+ `surfaces.control.baseUrl` for REST/SSE and `surfaces.agent.baseUrl` for proxy/MCP setup;
389
+ `surfaces.ui.baseUrl` is `null` when `surfaces.ui.enabled` is false. The descriptor also includes
390
+ protocol-ready environment variables, MCP settings, and a Codex Responses provider. The top-level
391
+ `uiEnabled`, `baseUrl`, and `endpoints` fields remain for compatibility, but new integrations should
392
+ use `surfaces`. In `--json` mode, success writes exactly one JSON document to stdout;
393
+ errors write exactly one `{ "schemaVersion": 1, "error": ... }` document to stderr with empty
394
+ stdout. Exit code `0` means success, `1` means an operational/lifecycle failure or a reported
395
+ conflict, and `2` means invalid command syntax or arguments. A `status`/`connect` conflict remains a
396
+ token-free state document on stdout while returning `1`. This makes the commands safe for coding
397
+ agents and PowerShell without scraping human text.
398
+
399
+ On Windows, instance records default below `%LOCALAPPDATA%\agent-inspector\instances`, and isolated
400
+ runtime data defaults to `%LOCALAPPDATA%\agent-inspector\instances\<name>\data`. A per-user fallback
401
+ is used when `LOCALAPPDATA` is unavailable. Set `AGENT_INSPECTOR_INSTANCES_DIR` before every lifecycle
402
+ command, or set it persistently for the user, to move the registry root. `--data-dir` moves one
403
+ instance's runtime data. Agent Inspector rejects a data directory already registered to another
404
+ name rather than allowing Provider or capture state to be shared accidentally.
405
+
406
+ ```powershell
407
+ [Environment]::SetEnvironmentVariable(
408
+ "AGENT_INSPECTOR_INSTANCES_DIR",
409
+ "$env:LOCALAPPDATA\agent-inspector-work",
410
+ "User"
411
+ )
412
+ ```
413
+
414
+ Runtime aliases and named instances solve different problems:
415
+
416
+ | Feature | Process and storage | Paths | Persistence |
417
+ | --- | --- | --- | --- |
418
+ | `agent-inspector alias add /path` | Same runtime, Providers, and logs | Adds a path on the same port | Cleared on supervisor restart |
419
+ | `agent-inspector instance start <name>` | Separate supervisor, Providers, and logs | Own saved port and Base Path | Saved until explicitly changed |
420
+
421
+ #### External wrapper: root plus `/inspector`
422
+
423
+ An external Windows reverse proxy can give two isolated backends one public origin. Start each
424
+ backend on a distinct public ingress port; the lifecycle manager also reserves a different private
425
+ runtime port for each supervisor:
426
+
427
+ ```powershell
428
+ agent-inspector instance start root-site --port 19527 --base-path /
429
+ agent-inspector instance start review-site --port 19537 --base-path /inspector
430
+ ```
431
+
432
+ Configure the wrapper to send `/inspector` and `/inspector/*` to `127.0.0.1:19537` **without
433
+ stripping the `/inspector` prefix**, and send the remaining root traffic to `127.0.0.1:19527`. Point
434
+ the wrapper only at each instance's public ingress port, never its private helper port. Add the
435
+ wrapper hostname to `AGENT_INSPECTOR_TRUSTED_HOSTS` when it differs from the local host.
436
+
437
+ The wrapper is a routing layer only: the two instance data directories and Provider configurations
438
+ remain independent. It also becomes the immediate TCP client seen by Inspector, so original coding
439
+ tool PID attribution can be replaced by the wrapper process's PID. Connect a coding tool directly
440
+ to the appropriate instance ingress when exact client-process attribution is required.
441
+
442
+ A wrapper that forwards to loopback must authenticate and authorize its own remote callers:
443
+ Inspector sees the wrapper as a local peer. Direct non-loopback calls to `/api/instances` always
444
+ require `Authorization: Bearer <AGENT_INSPECTOR_CONTROL_TOKEN>`, even when general remote UI control
445
+ is allowed. Keep that control token separate from `AGENT_INSPECTOR_PROXY_TOKEN`, which protects
446
+ remote model-proxy traffic.
204
447
 
205
- If you intentionally need the old compatibility port, start with `agent-inspector --legacy-port`.
448
+ Reverse proxies should preserve the configured prefix when forwarding public requests to Agent
449
+ Inspector (`/inspector` by default).
450
+
451
+ Treat the exact public backend URL printed by the CLI or connection descriptor as
452
+ `<agent-base-url>` for Coding Agent endpoints. In composed mode it is also the UI URL; in
453
+ backend-only or standalone-UI mode it is not. Client endpoints are derived from the agent surface:
454
+
455
+ - Proxy: `<agent-base-url>/proxy`
456
+ - OpenAI-compatible `/v1` proxy: `<agent-base-url>/proxy/v1`
457
+ - MCP: `<agent-base-url>/api/mcp`
458
+ - Health: `<control-base-url>/api/health`
459
+
460
+ For example, keep startup and onboarding aligned when using a custom prefix:
461
+
462
+ ```bash
463
+ AGENT_INSPECTOR_BASE_PATH=/team/inspector agent-inspector
464
+ AGENT_INSPECTOR_BASE_PATH=/team/inspector agent-inspector onboard --force
465
+ AGENT_INSPECTOR_BASE_PATH=/team/inspector agent-inspector onboard --opencode-only --force
466
+ AGENT_INSPECTOR_BASE_PATH=/team/inspector agent-inspector onboard --mimo-only --force
467
+ ```
206
468
 
207
469
  For Codex-style OpenAI Responses clients, configure the proxy as an OpenAI-compatible `/v1` base:
208
470
 
@@ -214,11 +476,18 @@ base_url = "http://127.0.0.1:9527/inspector/proxy/v1"
214
476
  wire_api = "responses"
215
477
  ```
216
478
 
479
+ Use `/proxy` as the base for Anthropic clients (which append `/v1/messages`) and generic
480
+ `LLM_BASE_URL` clients. Use `/proxy/v1` as the OpenAI-compatible base for clients that append
481
+ `/chat/completions` or `/responses`; Codex Responses belongs in this second category. The resulting
482
+ full paths are `/proxy/v1/messages`, `/proxy/v1/chat/completions`, and `/proxy/v1/responses`.
483
+
217
484
  ## Documentation Map
218
485
 
219
486
  - [Installation](docs/Installation.md): install and runtime notes.
220
487
  - [Usage](docs/Usage.md): daily capture, browsing, replay, and export workflows.
221
488
  - [MCP Server](docs/MCP-Server.md): MCP setup plus tools, resources, prompts, and evidence usage for coding agents.
489
+ - [Instance Control OpenAPI](docs/instance-control.openapi.yaml): versioned named-instance REST
490
+ contract for coding agents and external controllers.
222
491
  - [Troubleshooting](docs/TROUBLESHOOTING.md): port, provider, MCP, Replay, Jenkins, and GitCode fixes.
223
492
  - [Jenkins + GitCode WebHook](docs/JENKINS_GITCODE_WEBHOOK_TUNNEL.md): team CI and tunnel setup.
224
493
  - [Local Release Helper](docs/LOCAL_RELEASE.md): local maintainer release helper.
@@ -295,20 +564,55 @@ OpenAI Responses each get separate non-streaming and streaming probes. Test evid
295
564
  a provider-specific Session so the UI can show which exact path, payload shape, status code, and
296
565
  upstream URL failed.
297
566
 
567
+ ## Named Instance Control For Coding Agents
568
+
569
+ Every backend control Base URL exposes a versioned, token-free Windows named-instance control
570
+ contract.
571
+ The six endpoints are:
572
+
573
+ | Method | Endpoint | Purpose |
574
+ | --- | --- | --- |
575
+ | `GET` | `/api/instances` | List registered instances and their live state. |
576
+ | `GET` | `/api/instances/{name}` | Read one instance. |
577
+ | `GET` | `/api/instances/{name}/connection` | Read coding-agent URLs, environment, MCP, and Codex settings. |
578
+ | `POST` | `/api/instances/{name}/start` | Create, start, or idempotently reuse an instance. |
579
+ | `POST` | `/api/instances/{name}/stop` | Gracefully stop a sibling instance. |
580
+ | `POST` | `/api/instances/{name}/restart` | Restart with saved or validated replacement settings. |
581
+
582
+ `start` and `restart` accept a strict optional JSON object containing `port`, `basePath`, `host`,
583
+ `captureMode`, `uiEnabled`, and `dataDir`; `stop` accepts only `{}`. Responses use `schemaVersion: 1`,
584
+ never include lifecycle or Provider credentials, and send `Cache-Control: no-store`. Errors use the
585
+ stable shape `{ "schemaVersion": 1, "error": { "code", "message", "retryable" } }` with `400`,
586
+ `404`, `409`, `423`, or `503` according to the failure class. See the checked-in
587
+ [OpenAPI 3.1 contract](docs/instance-control.openapi.yaml) for the complete schemas.
588
+
589
+ Connection responses separate the optional browser surface from backend traffic:
590
+ `surfaces.ui` has `{ enabled, baseUrl }`, while `surfaces.control.baseUrl` and
591
+ `surfaces.agent.baseUrl` remain available for backend-only instances. Legacy top-level `baseUrl` and
592
+ `endpoints` are retained for existing clients.
593
+
594
+ Browser mutations require same-origin proof plus `x-agent-inspector-csrf: 1`. Direct non-loopback
595
+ control calls require `Authorization: Bearer <AGENT_INSPECTOR_CONTROL_TOKEN>`. A managed instance
596
+ cannot stop or restart itself through the REST/MCP transport it is currently serving; use the
597
+ external CLI or a different controller/anchor instance. A failed restart reports whether the old
598
+ launch was restored (`restart_failed_rolled_back`) or the instance remained degraded
599
+ (`restart_failed_degraded`).
600
+
298
601
  ## MCP Evidence Workflows
299
602
 
300
- Agent Inspector exposes MCP at:
603
+ Agent Inspector exposes MCP from the backend agent Base URL at `<agent-base-url>/api/mcp`, whether
604
+ or not a Web UI is served. With the default public backend Base URL, that is:
301
605
 
302
606
  ```text
303
- http://localhost:9527/api/mcp
607
+ http://localhost:9527/inspector/api/mcp
304
608
  ```
305
609
 
306
610
  Coding agents can connect to this MCP surface directly over Streamable HTTP, or through the
307
611
  companion stdio bridge:
308
612
 
309
613
  ```bash
310
- agent-inspector-mcp stdio
311
- agent-inspector-mcp config codex
614
+ agent-inspector-mcp stdio --url http://localhost:9527/inspector/api/mcp
615
+ agent-inspector-mcp config codex --url http://localhost:9527/inspector/api/mcp
312
616
  ```
313
617
 
314
618
  The companion package is useful for MCP clients that expect a local command. Direct HTTP remains the
@@ -318,13 +622,10 @@ The MCP HTTP surface is also documented as OpenAPI YAML in
318
622
  [`docs/mcp-openapi.yaml`](docs/mcp-openapi.yaml).
319
623
 
320
624
  Use only one transport for the same Inspector instance. If the MCP client supports Streamable HTTP,
321
- configure `http://localhost:9527/api/mcp` directly. If it only supports stdio, configure
625
+ configure `<agent-base-url>/api/mcp` directly. If it only supports stdio, configure
322
626
  `agent-inspector-mcp stdio`; that command is only a bridge to `/api/mcp`, not a second Inspector
323
627
  server.
324
628
 
325
- Legacy MCP configs that still use `http://localhost:9527/api/mcp` require starting the CLI with
326
- `agent-inspector --legacy-port`; new configs should use `http://localhost:9527/api/mcp`.
327
-
328
629
  Coding agents can use the MCP surface in three ways:
329
630
 
330
631
  - Tools: perform actions such as listing logs, reading bounded log details, testing providers,
@@ -333,6 +634,33 @@ Coding agents can use the MCP surface in three ways:
333
634
  paths without invoking a tool call.
334
635
  - Prompts: start common analysis/reporting tasks from reusable templates.
335
636
 
637
+ The current catalog contains 51 tools, 25 resources, and 5 prompts. Named-instance control adds six
638
+ tools—`inspector_list_instances`, `inspector_get_instance`,
639
+ `inspector_get_instance_connection`, `inspector_start_instance`, `inspector_stop_instance`, and
640
+ `inspector_restart_instance`—plus these resources:
641
+
642
+ | Resource URI | Purpose |
643
+ | --- | --- |
644
+ | `inspector://instances` | Token-free list of named instances. |
645
+ | `inspector://instances/{name}` | One named instance and its live state. |
646
+ | `inspector://instances/{name}/connection` | Protocol-correct connection descriptor for a coding agent. |
647
+
648
+ The three discovery tools and resources remain available in read-only mode. Instance start/stop/
649
+ restart require both `AGENT_INSPECTOR_MCP_WRITES=1` and
650
+ `AGENT_INSPECTOR_MCP_INSTANCE_WRITES=1`; their tool descriptions require explicit user approval.
651
+ They cannot stop or restart the instance serving the active MCP connection.
652
+
653
+ For an authenticated remote MCP endpoint, keep the token outside config and pass only its variable
654
+ name to the companion:
655
+
656
+ ```bash
657
+ agent-inspector-mcp doctor --url https://tools.example.test/inspector/api/mcp --token-env INSPECTOR_CONTROL_TOKEN --json
658
+ agent-inspector-mcp stdio --url https://tools.example.test/inspector/api/mcp --token-env INSPECTOR_CONTROL_TOKEN
659
+ ```
660
+
661
+ The companion reads the raw value from `INSPECTOR_CONTROL_TOKEN`, sends it as a Bearer credential,
662
+ and never prints it. `doctor` verifies health, MCP initialization, and `tools/list` before returning.
663
+
336
664
  The evaluation-oriented run flow is:
337
665
 
338
666
  1. Call `inspector_create_run` before a task starts to declare a stable `runId`, optional