@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.
- package/.output/{nitro.json → backend/nitro.json} +3 -3
- package/.output/backend-public/assets/index-D4LX-sw-.js +11 -0
- package/.output/cli.js +22707 -17099
- package/.output/server/_libs/extend.mjs +4 -8
- package/.output/server/_libs/jszip.mjs +9 -35
- package/.output/server/_libs/modelcontextprotocol__core.mjs +25 -25
- package/.output/server/_libs/modelcontextprotocol__server.mjs +2 -2
- package/.output/server/_libs/react-dom.mjs +2 -3
- package/.output/server/_libs/react.mjs +1 -27
- package/.output/server/_libs/tanstack__react-router.mjs +1 -329
- package/.output/server/_libs/tanstack__router-core.mjs +42 -100
- package/.output/server/_libs/use-sync-external-store.mjs +1 -64
- package/.output/server/_libs/ws.mjs +1 -1
- package/.output/server/_libs/zod.mjs +6 -6
- package/.output/server/_ssr/index.mjs +5 -4
- package/.output/server/_ssr/publicBasePathContext-IH2ilOfu.mjs +176 -0
- package/.output/server/_ssr/{router-DWcUFPR3.mjs → router-D18yUq36.mjs} +7877 -5597
- package/.output/server/_ssr/start-COQu_AgD.mjs +57 -0
- package/.output/server/_tanstack-start-manifest_v-DnbdNeun.mjs +4 -0
- package/.output/server/index.mjs +5 -145
- package/.output/{public/assets/CompareDrawer-DQHjxFO6.js → ui/assets/CompareDrawer-DAUuIJ6G.js} +1 -1
- package/.output/{public/assets/InspectorPet-D1A4505B.js → ui/assets/InspectorPet-BRBVjOWI.js} +1 -1
- package/.output/ui/assets/ProxyViewerContainer-D7Sq0ctc.js +59 -0
- package/.output/{public/assets/ReplayDialog-C5vmbecv.js → ui/assets/ReplayDialog-nDLsjOhs.js} +1 -1
- package/.output/{public/assets/RequestAnatomy-CPGNB8lk.js → ui/assets/RequestAnatomy-zd4BDgL0.js} +1 -1
- package/.output/ui/assets/ResponseView-AdIXGcSn.js +2 -0
- package/.output/ui/assets/StreamingChunkSequence-CesTz8He.js +1 -0
- package/.output/{public/assets/_sessionId-CDhRgzf6.js → ui/assets/_sessionId-BAfzrhSU.js} +1 -1
- package/.output/{public/assets/_sessionId-mw3aA8Bp.js → ui/assets/_sessionId-QnBomgPD.js} +1 -1
- package/.output/ui/assets/favicon-DYEkHSNl.svg +21 -0
- package/.output/{public/assets/index-B2eoeT-Z.js → ui/assets/index-BcsdxBAd.js} +1 -1
- package/.output/ui/assets/index-BvXp42al.css +1 -0
- package/.output/{public/assets/index-CX7_rf7o.js → ui/assets/index-D0rtCN9V.js} +1 -1
- package/.output/ui/assets/index-DHpwr08Z.js +73 -0
- package/.output/{public/assets/index-BfRhTvOd.js → ui/assets/index-dNuk2dsU.js} +1 -1
- package/.output/ui/assets/json-viewer-BvFHglMb.js +1 -0
- package/.output/{public/assets/jszip.min-C9rCFoU3.js → ui/assets/jszip.min-B5Z7gNZB.js} +1 -1
- package/.output/ui/index.html +229 -0
- package/.output/ui/runtime-config.js +2 -0
- package/.output/workers/logFinalizer.worker.js +983 -414
- package/.output/workers/sessionWorkerEntry.js +983 -414
- package/README.md +363 -35
- package/docs/instance-control.openapi.yaml +361 -0
- package/package.json +28 -5
- package/scripts/generate-theme-scales.mjs +3 -3
- package/src/{router.tsx → backend/router.tsx} +3 -15
- package/src/backend/routes/$.ts +26 -0
- package/src/backend/routes/__root.ts +4 -0
- package/src/backend/routes/api/-instances.ts +109 -0
- package/src/{routes → backend/routes}/api/alerts.summary.ts +3 -3
- package/src/{routes → backend/routes}/api/alerts.ts +4 -4
- package/src/{routes → backend/routes}/api/config.paths.ts +1 -1
- package/src/{routes → backend/routes}/api/config.ts +11 -2
- package/src/{routes → backend/routes}/api/ecosystem.packages.$packageId.help.ts +1 -1
- package/src/{routes → backend/routes}/api/ecosystem.packages.$packageId.install.ts +1 -1
- package/src/{routes → backend/routes}/api/ecosystem.packages.$packageId.runner-presets.ts +1 -1
- package/src/{routes → backend/routes}/api/ecosystem.packages.$packageId.upgrade.ts +1 -1
- package/src/{routes → backend/routes}/api/ecosystem.packages.ts +5 -1
- package/src/{routes → backend/routes}/api/ecosystem.recipes.$recipeId.run.ts +1 -1
- package/src/{routes → backend/routes}/api/ecosystem.tasks.$taskId.ts +1 -1
- package/src/{routes → backend/routes}/api/ecosystem.tasks.ts +1 -1
- package/src/{routes → backend/routes}/api/groups.$groupId.evidence.ts +2 -2
- package/src/{routes → backend/routes}/api/groups.$groupId.sessions.ts +2 -2
- package/src/{routes → backend/routes}/api/groups.$groupId.ts +2 -2
- package/src/{routes → backend/routes}/api/groups.ts +2 -2
- package/src/{routes → backend/routes}/api/health.ts +3 -3
- package/src/backend/routes/api/instances.$name.connection.ts +12 -0
- package/src/backend/routes/api/instances.$name.restart.ts +23 -0
- package/src/backend/routes/api/instances.$name.start.ts +18 -0
- package/src/backend/routes/api/instances.$name.stop.ts +23 -0
- package/src/backend/routes/api/instances.$name.ts +12 -0
- package/src/backend/routes/api/instances.ts +16 -0
- package/src/{routes → backend/routes}/api/knowledge.candidates.$candidateId.promote.ts +2 -2
- package/src/{routes → backend/routes}/api/knowledge.candidates.$candidateId.ts +2 -2
- package/src/{routes → backend/routes}/api/knowledge.candidates.ts +1 -1
- package/src/{routes → backend/routes}/api/knowledge.project-context.ts +2 -2
- package/src/{routes → backend/routes}/api/knowledge.search.ts +2 -2
- package/src/{routes → backend/routes}/api/knowledge.sessions.$sessionId.candidates.ts +3 -3
- package/src/{routes → backend/routes}/api/logs.$id.body.ts +6 -6
- package/src/{routes → backend/routes}/api/logs.$id.chunks.ts +5 -4
- package/src/{routes → backend/routes}/api/logs.$id.replay.ts +12 -11
- package/src/{routes → backend/routes}/api/logs.$id.ts +4 -3
- package/src/{routes → backend/routes}/api/logs.import.ts +3 -3
- package/src/{routes → backend/routes}/api/logs.stream.ts +11 -7
- package/src/{routes → backend/routes}/api/logs.ts +17 -9
- package/src/{routes → backend/routes}/api/mcp.ts +1 -1
- package/src/{routes → backend/routes}/api/models.ts +1 -1
- package/src/{routes → backend/routes}/api/pi-agent.ts +2 -2
- package/src/{routes → backend/routes}/api/providers.$providerId.model-metadata.ts +5 -5
- package/src/{routes → backend/routes}/api/providers.$providerId.test.log.ts +7 -7
- package/src/{routes → backend/routes}/api/providers.$providerId.ts +4 -4
- package/src/{routes → backend/routes}/api/providers.export.ts +1 -1
- package/src/{routes → backend/routes}/api/providers.import.ts +3 -3
- package/src/{routes → backend/routes}/api/providers.scan.ts +2 -2
- package/src/{routes → backend/routes}/api/providers.ts +9 -4
- package/src/{routes → backend/routes}/api/runs.$runId.evidence.ts +2 -2
- package/src/{routes → backend/routes}/api/runs.$runId.ts +2 -2
- package/src/{routes → backend/routes}/api/runs.ts +4 -4
- package/src/backend/routes/api/runtime.ts +46 -0
- package/src/{routes → backend/routes}/api/sessions.ts +3 -3
- package/src/{routes → backend/routes}/proxy/$.ts +1 -1
- package/src/{routes → backend/routes}/readyz.ts +1 -1
- package/src/backend/start.ts +10 -0
- package/src/cli/alias.ts +431 -0
- package/src/cli/doctor.ts +32 -9
- package/src/cli/instance.ts +1050 -0
- package/src/cli/instanceArgs.ts +285 -0
- package/src/cli/instanceControl.ts +181 -0
- package/src/cli/instanceModel.ts +267 -0
- package/src/cli/instanceRegistry.ts +731 -0
- package/src/cli/networkHints.ts +27 -14
- package/src/cli/onboard.ts +190 -35
- package/src/cli/onboardTarget.ts +228 -0
- package/src/cli/templates/codex-skill-onboard.ts +109 -31
- package/src/cli/templates/skill-onboard.ts +140 -70
- package/src/cli.ts +338 -77
- package/src/components/ProxyViewer.tsx +20 -10
- package/src/components/ProxyViewerContainer.tsx +12 -11
- package/src/components/pi-agent/PiAgentPanel.tsx +2 -2
- package/src/components/providers/ProviderCard.tsx +1 -1
- package/src/components/providers/ProviderTestResultsView.tsx +1 -1
- package/src/components/providers/SettingsDialog.tsx +160 -140
- package/src/components/proxy-viewer/ApplicationBar.tsx +2 -1
- package/src/components/proxy-viewer/LogEntry.tsx +1 -1
- package/src/components/proxy-viewer/log-formats/index.ts +1 -1
- package/src/contracts/index.ts +5 -0
- package/src/contracts/log.ts +33 -3
- package/src/knowledge/types.ts +3 -2
- package/src/lib/alertContract.ts +2 -2
- package/src/lib/apiClient.ts +30 -7
- package/src/lib/apiFormat.ts +29 -0
- package/src/lib/basePath.ts +31 -7
- package/src/lib/browserRuntimeContract.ts +124 -0
- package/src/lib/browserRuntimeResolver.ts +244 -0
- package/src/{proxy → lib}/claudeCodeStrip.ts +6 -7
- package/src/lib/codingAgentEndpoints.ts +54 -0
- package/src/lib/instanceContract.ts +236 -0
- package/src/lib/managedInstance.ts +104 -0
- package/src/lib/piAgentContract.ts +3 -2
- package/src/lib/publicBasePathContext.ts +137 -0
- package/src/lib/resourceLimits.ts +2 -0
- package/src/lib/runContract.ts +3 -3
- package/src/lib/sessionInfoContract.ts +3 -2
- package/src/mcp/instanceHandlers.ts +150 -0
- package/src/mcp/loopback.ts +16 -5
- package/src/mcp/mode.ts +25 -0
- package/src/mcp/server.ts +274 -39
- package/src/mcp/toolHandlers.ts +2 -2
- package/src/proxy/config.ts +25 -30
- package/src/proxy/dataDir.ts +43 -7
- package/src/proxy/ecosystemTasks.ts +161 -70
- package/src/proxy/formats/registry.ts +6 -21
- package/src/proxy/handler.ts +129 -29
- package/src/proxy/identityProxy.ts +1049 -50
- package/src/proxy/jsonlRecovery.ts +554 -0
- package/src/proxy/logFinalizer.ts +25 -10
- package/src/proxy/logImporter.ts +2 -1
- package/src/proxy/logIndex.ts +191 -95
- package/src/proxy/logger.ts +77 -14
- package/src/proxy/platformCommands.ts +41 -0
- package/src/proxy/privateDataPath.ts +310 -88
- package/src/proxy/rawStreamCapture.ts +194 -13
- package/src/proxy/runtimeAdmission.ts +5 -2
- package/src/proxy/runtimeHealth.ts +14 -1
- package/src/proxy/runtimeShutdown.ts +84 -2
- package/src/proxy/schemas.ts +7 -1
- package/src/proxy/sessionArchive.ts +78 -14
- package/src/proxy/sessionInfo.ts +5 -4
- package/src/proxy/sqliteLogIndex.ts +65 -2
- package/src/proxy/store.ts +141 -34
- package/src/proxy/uiAssetServer.ts +106 -0
- package/src/proxy/upstream.ts +29 -2
- package/src/ui/bootstrap.ts +167 -0
- package/src/ui/index.html +38 -0
- package/src/ui/logsStreamClient.ts +20 -0
- package/src/ui/main.tsx +13 -0
- package/src/ui/public/runtime-config.js +2 -0
- package/src/ui/router.tsx +13 -0
- package/src/ui/routes/__root.tsx +69 -0
- package/src/{routes → ui/routes}/index.tsx +2 -3
- package/src/{routes → ui/routes}/session/$sessionId.tsx +5 -11
- package/src/ui/runtimeDiscovery.ts +50 -0
- package/styles/globals.css +1 -0
- package/.output/public/assets/ProxyViewerContainer-BhpIgfBi.js +0 -126
- package/.output/public/assets/ResponseView-DUfrajCm.js +0 -2
- package/.output/public/assets/StreamingChunkSequence-nbeCQqOz.js +0 -1
- package/.output/public/assets/index-BWjeqxbk.css +0 -1
- package/.output/public/assets/index-C6qZwYlR.js +0 -70
- package/.output/public/assets/json-viewer-BLmF1sOZ.js +0 -1
- package/.output/server/_libs/@radix-ui/react-accessible-icon+[...].mjs +0 -1
- package/.output/server/_libs/@radix-ui/react-dismissable-layer+[...].mjs +0 -344
- package/.output/server/_libs/@radix-ui/react-navigation-menu+[...].mjs +0 -2
- package/.output/server/_libs/@radix-ui/react-one-time-password-field+[...].mjs +0 -2
- package/.output/server/_libs/@radix-ui/react-password-toggle-field+[...].mjs +0 -2
- package/.output/server/_libs/@radix-ui/react-use-callback-ref+[...].mjs +0 -11
- package/.output/server/_libs/@radix-ui/react-use-controllable-state+[...].mjs +0 -69
- package/.output/server/_libs/@radix-ui/react-use-effect-event+[...].mjs +0 -1
- package/.output/server/_libs/@radix-ui/react-use-is-hydrated+[...].mjs +0 -28
- package/.output/server/_libs/@radix-ui/react-use-layout-effect+[...].mjs +0 -6
- package/.output/server/_libs/@radix-ui/react-visually-hidden+[...].mjs +0 -34
- package/.output/server/_libs/aria-hidden.mjs +0 -122
- package/.output/server/_libs/bail.mjs +0 -8
- package/.output/server/_libs/character-entities.mjs +0 -2130
- package/.output/server/_libs/class-variance-authority.mjs +0 -44
- package/.output/server/_libs/clsx.mjs +0 -16
- package/.output/server/_libs/comma-separated-tokens.mjs +0 -10
- package/.output/server/_libs/decode-named-character-reference+[...].mjs +0 -8
- package/.output/server/_libs/dequal.mjs +0 -27
- package/.output/server/_libs/detect-node-es.mjs +0 -1
- package/.output/server/_libs/devlop.mjs +0 -8
- package/.output/server/_libs/diff.mjs +0 -320
- package/.output/server/_libs/estree-util-is-identifier-name.mjs +0 -11
- package/.output/server/_libs/floating-ui__core.mjs +0 -725
- package/.output/server/_libs/floating-ui__dom.mjs +0 -622
- package/.output/server/_libs/floating-ui__react-dom.mjs +0 -292
- package/.output/server/_libs/floating-ui__utils.mjs +0 -320
- package/.output/server/_libs/get-nonce.mjs +0 -9
- package/.output/server/_libs/hast-util-to-jsx-runtime.mjs +0 -388
- package/.output/server/_libs/hast-util-whitespace.mjs +0 -10
- package/.output/server/_libs/html-url-attributes.mjs +0 -26
- package/.output/server/_libs/inline-style-parser.mjs +0 -142
- package/.output/server/_libs/is-plain-obj.mjs +0 -10
- package/.output/server/_libs/lucide-react.mjs +0 -1027
- package/.output/server/_libs/mdast-util-from-markdown.mjs +0 -717
- package/.output/server/_libs/mdast-util-to-hast.mjs +0 -710
- package/.output/server/_libs/mdast-util-to-string.mjs +0 -38
- package/.output/server/_libs/micromark-core-commonmark.mjs +0 -2259
- package/.output/server/_libs/micromark-factory-destination.mjs +0 -94
- package/.output/server/_libs/micromark-factory-label.mjs +0 -63
- package/.output/server/_libs/micromark-factory-space.mjs +0 -24
- package/.output/server/_libs/micromark-factory-title.mjs +0 -65
- package/.output/server/_libs/micromark-factory-whitespace.mjs +0 -22
- package/.output/server/_libs/micromark-util-character.mjs +0 -44
- package/.output/server/_libs/micromark-util-chunked.mjs +0 -36
- package/.output/server/_libs/micromark-util-classify-character+[...].mjs +0 -12
- package/.output/server/_libs/micromark-util-combine-extensions+[...].mjs +0 -41
- package/.output/server/_libs/micromark-util-decode-numeric-character-reference+[...].mjs +0 -19
- package/.output/server/_libs/micromark-util-decode-string.mjs +0 -21
- package/.output/server/_libs/micromark-util-encode.mjs +0 -1
- package/.output/server/_libs/micromark-util-html-tag-name.mjs +0 -69
- package/.output/server/_libs/micromark-util-normalize-identifier+[...].mjs +0 -6
- package/.output/server/_libs/micromark-util-resolve-all.mjs +0 -15
- package/.output/server/_libs/micromark-util-sanitize-uri.mjs +0 -41
- package/.output/server/_libs/micromark-util-subtokenize.mjs +0 -346
- package/.output/server/_libs/micromark.mjs +0 -906
- package/.output/server/_libs/property-information.mjs +0 -1209
- package/.output/server/_libs/radix-ui.mjs +0 -1
- package/.output/server/_libs/radix-ui__number.mjs +0 -6
- package/.output/server/_libs/radix-ui__primitive.mjs +0 -11
- package/.output/server/_libs/radix-ui__react-accordion.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-alert-dialog.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-arrow.mjs +0 -23
- package/.output/server/_libs/radix-ui__react-aspect-ratio.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-avatar.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-checkbox.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-collapsible.mjs +0 -144
- package/.output/server/_libs/radix-ui__react-collection.mjs +0 -69
- package/.output/server/_libs/radix-ui__react-compose-refs.mjs +0 -38
- package/.output/server/_libs/radix-ui__react-context-menu.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-context.mjs +0 -64
- package/.output/server/_libs/radix-ui__react-dialog.mjs +0 -280
- package/.output/server/_libs/radix-ui__react-direction.mjs +0 -9
- package/.output/server/_libs/radix-ui__react-dropdown-menu.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-focus-guards.mjs +0 -39
- package/.output/server/_libs/radix-ui__react-focus-scope.mjs +0 -210
- package/.output/server/_libs/radix-ui__react-form.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-hover-card.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-id.mjs +0 -14
- package/.output/server/_libs/radix-ui__react-label.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-menu.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-menubar.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-popover.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-popper.mjs +0 -340
- package/.output/server/_libs/radix-ui__react-portal.mjs +0 -16
- package/.output/server/_libs/radix-ui__react-presence.mjs +0 -173
- package/.output/server/_libs/radix-ui__react-primitive.mjs +0 -42
- package/.output/server/_libs/radix-ui__react-progress.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-radio-group.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-roving-focus.mjs +0 -235
- package/.output/server/_libs/radix-ui__react-scroll-area.mjs +0 -731
- package/.output/server/_libs/radix-ui__react-select.mjs +0 -1207
- package/.output/server/_libs/radix-ui__react-separator.mjs +0 -28
- package/.output/server/_libs/radix-ui__react-slider.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-slot.mjs +0 -132
- package/.output/server/_libs/radix-ui__react-switch.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-tabs.mjs +0 -194
- package/.output/server/_libs/radix-ui__react-toast.mjs +0 -2
- package/.output/server/_libs/radix-ui__react-toggle-group.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-toggle.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-toolbar.mjs +0 -1
- package/.output/server/_libs/radix-ui__react-tooltip.mjs +0 -498
- package/.output/server/_libs/radix-ui__react-use-previous.mjs +0 -14
- package/.output/server/_libs/radix-ui__react-use-size.mjs +0 -39
- package/.output/server/_libs/react-markdown.mjs +0 -235
- package/.output/server/_libs/react-remove-scroll-bar.mjs +0 -82
- package/.output/server/_libs/react-remove-scroll.mjs +0 -328
- package/.output/server/_libs/react-style-singleton.mjs +0 -69
- package/.output/server/_libs/remark-parse.mjs +0 -19
- package/.output/server/_libs/remark-rehype.mjs +0 -21
- package/.output/server/_libs/space-separated-tokens.mjs +0 -6
- package/.output/server/_libs/style-to-js.mjs +0 -72
- package/.output/server/_libs/style-to-object.mjs +0 -38
- package/.output/server/_libs/swr.mjs +0 -947
- package/.output/server/_libs/tailwind-merge.mjs +0 -3255
- package/.output/server/_libs/tanstack__react-virtual.mjs +0 -130
- package/.output/server/_libs/tanstack__virtual-core.mjs +0 -1319
- package/.output/server/_libs/three.mjs +0 -26016
- package/.output/server/_libs/trim-lines.mjs +0 -41
- package/.output/server/_libs/trough.mjs +0 -85
- package/.output/server/_libs/tslib.mjs +0 -1
- package/.output/server/_libs/ungap__structured-clone.mjs +0 -212
- package/.output/server/_libs/unified.mjs +0 -661
- package/.output/server/_libs/unist-util-is.mjs +0 -100
- package/.output/server/_libs/unist-util-position.mjs +0 -27
- package/.output/server/_libs/unist-util-stringify-position.mjs +0 -27
- package/.output/server/_libs/unist-util-visit-parents.mjs +0 -82
- package/.output/server/_libs/unist-util-visit.mjs +0 -24
- package/.output/server/_libs/use-callback-ref.mjs +0 -66
- package/.output/server/_libs/use-sidecar.mjs +0 -106
- package/.output/server/_libs/vfile-message.mjs +0 -138
- package/.output/server/_libs/vfile.mjs +0 -467
- package/.output/server/_sessionId-E_Dmopc-.mjs +0 -144
- package/.output/server/_sessionId-U54BAqdp.mjs +0 -82
- package/.output/server/_ssr/CompareDrawer-CksatPed.mjs +0 -1058
- package/.output/server/_ssr/InspectorPet-DNc4GQ7z.mjs +0 -936
- package/.output/server/_ssr/ProxyViewerContainer-B02Ey0p_.mjs +0 -17607
- package/.output/server/_ssr/ReplayDialog-DdMvHJF1.mjs +0 -723
- package/.output/server/_ssr/RequestAnatomy--vh2Z8__.mjs +0 -835
- package/.output/server/_ssr/ResponseView-Dhxc-cKC.mjs +0 -755
- package/.output/server/_ssr/StreamingChunkSequence-BG0EQmaD.mjs +0 -272
- package/.output/server/_ssr/index-D0At9nfd.mjs +0 -82
- package/.output/server/_ssr/index-lcfulIXa.mjs +0 -133
- package/.output/server/_ssr/json-viewer-My1J1_5R.mjs +0 -481
- package/.output/server/_ssr/start-HYkvq4Ni.mjs +0 -4
- package/.output/server/_tanstack-start-manifest_v-B2chR8ef.mjs +0 -4
- package/.output/server/node_modules/tslib/modules/index.js +0 -70
- package/.output/server/node_modules/tslib/modules/package.json +0 -3
- package/.output/server/node_modules/tslib/package.json +0 -47
- package/.output/server/node_modules/tslib/tslib.js +0 -484
- package/.output/server/package.json +0 -9
- package/src/routes/__root.tsx +0 -170
- /package/.output/{public → ui}/assets/agent-inspector-58K1_MsC.ico +0 -0
- /package/.output/{public → ui}/assets/alibaba-TTwafVwX.svg +0 -0
- /package/.output/{public → ui}/assets/minimax-BPMzvuL-.jpeg +0 -0
- /package/.output/{public → ui}/assets/qwen-mMn3f5ul.webp +0 -0
- /package/.output/{public → ui}/assets/zhipuai-BPNAnxo-.svg +0 -0
- /package/src/{routes → backend/routes}/livez.ts +0 -0
package/src/cli.ts
CHANGED
|
@@ -6,11 +6,20 @@ import { fileURLToPath } from "node:url";
|
|
|
6
6
|
import { dirname, join, resolve as resolvePath } from "node:path";
|
|
7
7
|
import { existsSync } from "node:fs";
|
|
8
8
|
import type { Readable, Writable } from "node:stream";
|
|
9
|
+
import packageJson from "../package.json";
|
|
9
10
|
import {
|
|
11
|
+
AGENT_INSPECTOR_BASE_PATH_ENV,
|
|
10
12
|
AGENT_INSPECTOR_INTERNAL_STRIPPED_BASE_PATH_ENV,
|
|
11
13
|
appendBasePathToOrigin,
|
|
12
14
|
getConfiguredBasePath,
|
|
15
|
+
normalizePublicBasePath,
|
|
13
16
|
} from "./lib/basePath.js";
|
|
17
|
+
import {
|
|
18
|
+
AGENT_INSPECTOR_CLI_ENTRY_ENV,
|
|
19
|
+
managedInstanceShutdownMessage,
|
|
20
|
+
readManagedInstanceLaunch,
|
|
21
|
+
type ManagedInstanceLaunch,
|
|
22
|
+
} from "./lib/managedInstance.js";
|
|
14
23
|
import {
|
|
15
24
|
formatAccessHintLines,
|
|
16
25
|
isLoopbackHost,
|
|
@@ -27,8 +36,10 @@ import {
|
|
|
27
36
|
import {
|
|
28
37
|
closeIdentityProxyGracefully,
|
|
29
38
|
forceCloseIdentityProxy,
|
|
39
|
+
parseUiOriginAllowlist,
|
|
30
40
|
startIdentityProxy,
|
|
31
41
|
stopIdentityProxyAdmission,
|
|
42
|
+
type ManagedInstanceControlOptions,
|
|
32
43
|
} from "./proxy/identityProxy.js";
|
|
33
44
|
import { findPidsByPort, killPid, openUrlCommand } from "./proxy/platformCommands.js";
|
|
34
45
|
|
|
@@ -61,19 +72,79 @@ process.title = "Agent Inspector";
|
|
|
61
72
|
*/
|
|
62
73
|
const subcommand = process.argv[2];
|
|
63
74
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
75
|
+
function printGlobalHelp(): void {
|
|
76
|
+
console.log(`agent-inspector ${packageJson.version} - Agent observability and knowledge capture
|
|
77
|
+
|
|
78
|
+
Usage:
|
|
79
|
+
agent-inspector [start] [options]
|
|
80
|
+
agent-inspector instance <start|list|status|connect|stop|restart> ...
|
|
81
|
+
agent-inspector alias <list|add|remove> ...
|
|
82
|
+
agent-inspector onboard [options]
|
|
83
|
+
agent-inspector doctor [options]
|
|
84
|
+
|
|
85
|
+
Global options:
|
|
86
|
+
-h, --help Show this help without starting a runtime
|
|
87
|
+
-v, --version Print the package version
|
|
69
88
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
89
|
+
Start options:
|
|
90
|
+
--backend-only, --headless Start the API, proxy, and MCP runtime without serving the UI
|
|
91
|
+
--with-ui Serve the independently built UI through the protected ingress
|
|
92
|
+
--port, -p <port> Public ingress port (default: 9527)
|
|
93
|
+
--host, -H <host> Bind host (default: 127.0.0.1)
|
|
94
|
+
--background Start a hidden supervisor and return after readiness
|
|
95
|
+
--no-open Do not open the UI after startup
|
|
96
|
+
|
|
97
|
+
Run \`agent-inspector instance --help\`, \`agent-inspector onboard --help\`, or
|
|
98
|
+
\`agent-inspector doctor --help\` for command-specific options.`);
|
|
74
99
|
}
|
|
75
100
|
|
|
76
|
-
|
|
101
|
+
switch (subcommand) {
|
|
102
|
+
case "--help":
|
|
103
|
+
case "-h":
|
|
104
|
+
printGlobalHelp();
|
|
105
|
+
process.exitCode = 0;
|
|
106
|
+
break;
|
|
107
|
+
case "--version":
|
|
108
|
+
case "-v":
|
|
109
|
+
console.log(packageJson.version);
|
|
110
|
+
process.exitCode = 0;
|
|
111
|
+
break;
|
|
112
|
+
case "onboard": {
|
|
113
|
+
const { runOnboard } = await import("./cli/onboard.js");
|
|
114
|
+
const code = await runOnboard(process.argv.slice(3));
|
|
115
|
+
process.exit(code);
|
|
116
|
+
}
|
|
117
|
+
case "doctor": {
|
|
118
|
+
const { runDoctor } = await import("./cli/doctor.js");
|
|
119
|
+
const code = await runDoctor(process.argv.slice(3));
|
|
120
|
+
process.exit(code);
|
|
121
|
+
}
|
|
122
|
+
case "alias": {
|
|
123
|
+
const { runAlias } = await import("./cli/alias.js");
|
|
124
|
+
const code = await runAlias(process.argv.slice(3));
|
|
125
|
+
process.exit(code);
|
|
126
|
+
}
|
|
127
|
+
case "instance": {
|
|
128
|
+
const { runInstance } = await import("./cli/instance.js");
|
|
129
|
+
const code = await runInstance(process.argv.slice(3));
|
|
130
|
+
process.exitCode = code;
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
case undefined:
|
|
134
|
+
await runStart(process.argv.slice(2));
|
|
135
|
+
break;
|
|
136
|
+
case "start":
|
|
137
|
+
await runStart(process.argv.slice(3));
|
|
138
|
+
break;
|
|
139
|
+
default:
|
|
140
|
+
if (subcommand.startsWith("-")) {
|
|
141
|
+
await runStart(process.argv.slice(2));
|
|
142
|
+
} else {
|
|
143
|
+
console.error(`agent-inspector: unknown command ${subcommand}`);
|
|
144
|
+
console.error("Run `agent-inspector --help` for supported commands.");
|
|
145
|
+
process.exitCode = 2;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
77
148
|
|
|
78
149
|
// -----------------------------------------------------------------------------
|
|
79
150
|
// Legacy `start` behavior — start the proxy on the configured port. Extracted
|
|
@@ -249,11 +320,26 @@ function readCaptureMode(raw: unknown): CaptureMode | null {
|
|
|
249
320
|
return typeof value === "string" ? parseCaptureMode(value) : null;
|
|
250
321
|
}
|
|
251
322
|
|
|
252
|
-
function printAccessHints(
|
|
323
|
+
function printAccessHints(
|
|
324
|
+
port: number,
|
|
325
|
+
host: string | undefined,
|
|
326
|
+
basePath: string,
|
|
327
|
+
serveUi: boolean,
|
|
328
|
+
publicOrigin: string | undefined,
|
|
329
|
+
): void {
|
|
253
330
|
const networkUrls = networkUrlsForBindHost(port, host);
|
|
254
|
-
for (const line of formatAccessHintLines(port, networkUrls, host, basePath)) {
|
|
331
|
+
for (const line of formatAccessHintLines(port, networkUrls, host, basePath, serveUi)) {
|
|
255
332
|
console.log(line);
|
|
256
333
|
}
|
|
334
|
+
if (publicOrigin !== undefined) {
|
|
335
|
+
const publicBaseUrl = appendBasePathToOrigin(publicOrigin, "/", basePath);
|
|
336
|
+
if (serveUi) console.log(` Public UI: ${publicBaseUrl}`);
|
|
337
|
+
console.log(` Public control Base: ${publicBaseUrl}`);
|
|
338
|
+
console.log(` Public agent Base: ${publicBaseUrl}`);
|
|
339
|
+
console.log(` Public REST API: ${appendBasePathToOrigin(publicOrigin, "/api", basePath)}`);
|
|
340
|
+
console.log(` Public proxy: ${appendBasePathToOrigin(publicOrigin, "/proxy", basePath)}`);
|
|
341
|
+
console.log(` Public MCP: ${appendBasePathToOrigin(publicOrigin, "/api/mcp", basePath)}`);
|
|
342
|
+
}
|
|
257
343
|
if (!isLoopbackHost(host)) {
|
|
258
344
|
const proxyTokenConfigured = (process.env["AGENT_INSPECTOR_PROXY_TOKEN"] ?? "") !== "";
|
|
259
345
|
const legacyProxyEnabled =
|
|
@@ -285,6 +371,19 @@ function readPositiveIntegerEnv(name: string): number | undefined {
|
|
|
285
371
|
return undefined;
|
|
286
372
|
}
|
|
287
373
|
|
|
374
|
+
function normalizeExplicitPublicOrigin(value: string | undefined): string | null | undefined {
|
|
375
|
+
if (value === undefined || value.trim().length === 0) return undefined;
|
|
376
|
+
try {
|
|
377
|
+
const parsed = new URL(value.trim());
|
|
378
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") return null;
|
|
379
|
+
if (parsed.username.length > 0 || parsed.password.length > 0) return null;
|
|
380
|
+
if (parsed.pathname !== "/" || parsed.search.length > 0 || parsed.hash.length > 0) return null;
|
|
381
|
+
return parsed.origin;
|
|
382
|
+
} catch {
|
|
383
|
+
return null;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
288
387
|
type BackgroundSupervisorOptions = {
|
|
289
388
|
port: number;
|
|
290
389
|
host: string | undefined;
|
|
@@ -293,6 +392,7 @@ type BackgroundSupervisorOptions = {
|
|
|
293
392
|
captureMode: CaptureMode;
|
|
294
393
|
enableIdentityProxy: boolean;
|
|
295
394
|
legacyAliasEnabled: boolean;
|
|
395
|
+
serveUi: boolean;
|
|
296
396
|
};
|
|
297
397
|
|
|
298
398
|
function buildBackgroundSupervisorArgs(options: BackgroundSupervisorOptions): string[] {
|
|
@@ -312,6 +412,9 @@ function buildBackgroundSupervisorArgs(options: BackgroundSupervisorOptions): st
|
|
|
312
412
|
if (options.legacyAliasEnabled) {
|
|
313
413
|
args.push("--legacy-port");
|
|
314
414
|
}
|
|
415
|
+
if (!options.serveUi) {
|
|
416
|
+
args.push("--backend-only");
|
|
417
|
+
}
|
|
315
418
|
return args;
|
|
316
419
|
}
|
|
317
420
|
|
|
@@ -335,16 +438,17 @@ function pickUpstreamPort(publicPort: number, legacyAliasPort: number | null): n
|
|
|
335
438
|
return DEFAULT_UPSTREAM_PORT;
|
|
336
439
|
}
|
|
337
440
|
|
|
338
|
-
/** Try to start
|
|
339
|
-
*
|
|
340
|
-
* restarting a previous instance that didn't shut down cleanly. The
|
|
341
|
-
* TanStack Start server keeps running either way; clients just lose the
|
|
342
|
-
* per-PID attribution until they fall back to direct port `port` access. */
|
|
441
|
+
/** Try to start an identity-proxy ingress. The primary caller treats a
|
|
442
|
+
* `null` result as fatal; only an optional compatibility alias may degrade. */
|
|
343
443
|
async function tryStartIdentityProxy(
|
|
344
444
|
identityPort: number,
|
|
345
445
|
upstreamPort: number,
|
|
346
446
|
listenHost: string,
|
|
347
447
|
upstreamHost: string,
|
|
448
|
+
managedInstance: ManagedInstanceControlOptions | undefined,
|
|
449
|
+
allowedUiOrigins: readonly string[],
|
|
450
|
+
uiDirectory: string | undefined,
|
|
451
|
+
publicOrigin: string | undefined,
|
|
348
452
|
): Promise<import("node:http").Server | null> {
|
|
349
453
|
try {
|
|
350
454
|
const server = await startIdentityProxy({
|
|
@@ -362,22 +466,30 @@ async function tryStartIdentityProxy(
|
|
|
362
466
|
.split(",")
|
|
363
467
|
.map((host) => host.trim())
|
|
364
468
|
.filter((host) => host.length > 0),
|
|
469
|
+
allowedUiOrigins,
|
|
470
|
+
uiDirectory,
|
|
471
|
+
publicOrigin,
|
|
365
472
|
maxRequestBytes: readPositiveIntegerEnv("AGENT_INSPECTOR_MAX_REQUEST_BYTES"),
|
|
366
473
|
requestTimeoutMs: readPositiveIntegerEnv("AGENT_INSPECTOR_REQUEST_TIMEOUT_MS"),
|
|
474
|
+
managedInstance,
|
|
367
475
|
});
|
|
368
476
|
return server;
|
|
369
477
|
} catch (err) {
|
|
370
478
|
const message = err instanceof Error ? err.message : String(err);
|
|
371
|
-
console.warn(
|
|
372
|
-
`[identity-proxy] Could not listen on port ${identityPort}: ${message}. ` +
|
|
373
|
-
`Falling back to OS-scan heuristic on port ${upstreamPort}. ` +
|
|
374
|
-
`Pass --identity-proxy-port <n> to choose another port, or --no-identity-proxy to disable.`,
|
|
375
|
-
);
|
|
479
|
+
console.warn(`[identity-proxy] Could not listen on port ${identityPort}: ${message}.`);
|
|
376
480
|
return null;
|
|
377
481
|
}
|
|
378
482
|
}
|
|
379
483
|
|
|
380
484
|
async function runStart(args: string[]): Promise<void> {
|
|
485
|
+
const managedLaunchResult = readManagedInstanceLaunch(process.env);
|
|
486
|
+
if (managedLaunchResult.kind === "invalid") {
|
|
487
|
+
console.error(managedLaunchResult.message);
|
|
488
|
+
process.exitCode = 1;
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
const managedLaunch: ManagedInstanceLaunch | null =
|
|
492
|
+
managedLaunchResult.kind === "managed" ? managedLaunchResult.launch : null;
|
|
381
493
|
const envPort = process.env["AGENT_INSPECTOR_PORT"] ?? process.env["PORT"];
|
|
382
494
|
const portDefault = envPort !== undefined ? Number(envPort) : DEFAULT_PORT;
|
|
383
495
|
const envHost = process.env["NITRO_HOST"] ?? process.env["HOST"];
|
|
@@ -397,6 +509,7 @@ async function runStart(args: string[]): Promise<void> {
|
|
|
397
509
|
let captureModeWasSpecified = false;
|
|
398
510
|
let enableIdentityProxy = true;
|
|
399
511
|
let legacyAliasEnabled = false;
|
|
512
|
+
let serveUi = process.env["AGENT_INSPECTOR_BACKEND_ONLY"] !== "1";
|
|
400
513
|
|
|
401
514
|
if (envMode !== undefined && envMode !== "") {
|
|
402
515
|
const parsedMode = parseCaptureMode(envMode);
|
|
@@ -417,6 +530,10 @@ async function runStart(args: string[]): Promise<void> {
|
|
|
417
530
|
|
|
418
531
|
for (let i = 0; i < args.length; i++) {
|
|
419
532
|
const arg = args[i] ?? "";
|
|
533
|
+
if (arg.startsWith("--port=")) {
|
|
534
|
+
port = Number(arg.slice(arg.indexOf("=") + 1));
|
|
535
|
+
continue;
|
|
536
|
+
}
|
|
420
537
|
if (arg.startsWith("--host=")) {
|
|
421
538
|
const value = arg.slice(arg.indexOf("=") + 1).trim();
|
|
422
539
|
if (!isValidBindHost(value)) {
|
|
@@ -472,6 +589,14 @@ async function runStart(args: string[]): Promise<void> {
|
|
|
472
589
|
case "--background":
|
|
473
590
|
background = true;
|
|
474
591
|
break;
|
|
592
|
+
case "--backend-only":
|
|
593
|
+
case "--headless":
|
|
594
|
+
serveUi = false;
|
|
595
|
+
open = false;
|
|
596
|
+
break;
|
|
597
|
+
case "--with-ui":
|
|
598
|
+
serveUi = true;
|
|
599
|
+
break;
|
|
475
600
|
case "--config-dir":
|
|
476
601
|
configDir = args[i + 1];
|
|
477
602
|
i++;
|
|
@@ -515,8 +640,19 @@ async function runStart(args: string[]): Promise<void> {
|
|
|
515
640
|
case "--legacy-port":
|
|
516
641
|
legacyAliasEnabled = true;
|
|
517
642
|
break;
|
|
643
|
+
case "--help":
|
|
644
|
+
case "-h":
|
|
645
|
+
printGlobalHelp();
|
|
646
|
+
return;
|
|
647
|
+
case "--version":
|
|
648
|
+
case "-v":
|
|
649
|
+
console.log(packageJson.version);
|
|
650
|
+
return;
|
|
518
651
|
default:
|
|
519
|
-
|
|
652
|
+
console.error(`agent-inspector start: unknown option ${arg}`);
|
|
653
|
+
console.error("Run `agent-inspector --help` for supported options.");
|
|
654
|
+
process.exitCode = 2;
|
|
655
|
+
return;
|
|
520
656
|
}
|
|
521
657
|
}
|
|
522
658
|
|
|
@@ -533,6 +669,40 @@ async function runStart(args: string[]): Promise<void> {
|
|
|
533
669
|
process.exitCode = 1;
|
|
534
670
|
return;
|
|
535
671
|
}
|
|
672
|
+
if (!serveUi) open = false;
|
|
673
|
+
if (!enableIdentityProxy && serveUi) {
|
|
674
|
+
console.error(
|
|
675
|
+
"The decoupled UI is composed only by the protected ingress. Use --backend-only with --no-identity-proxy, or keep the identity proxy enabled.",
|
|
676
|
+
);
|
|
677
|
+
process.exitCode = 1;
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
680
|
+
const uiOriginAllowlist = parseUiOriginAllowlist(process.env["AGENT_INSPECTOR_UI_ORIGINS"]);
|
|
681
|
+
if (uiOriginAllowlist.rejected.length > 0) {
|
|
682
|
+
console.error(
|
|
683
|
+
`Invalid AGENT_INSPECTOR_UI_ORIGINS entries: ${uiOriginAllowlist.rejected.join(", ")}. Only exact loopback http(s) origins are accepted; use a same-origin authenticated gateway for remote UI hosting.`,
|
|
684
|
+
);
|
|
685
|
+
process.exitCode = 1;
|
|
686
|
+
return;
|
|
687
|
+
}
|
|
688
|
+
const publicOrigin = normalizeExplicitPublicOrigin(process.env["AGENT_INSPECTOR_PUBLIC_ORIGIN"]);
|
|
689
|
+
if (publicOrigin === null) {
|
|
690
|
+
console.error(
|
|
691
|
+
"Invalid AGENT_INSPECTOR_PUBLIC_ORIGIN. Use an exact http(s) origin without credentials, path, query, or fragment.",
|
|
692
|
+
);
|
|
693
|
+
process.exitCode = 1;
|
|
694
|
+
return;
|
|
695
|
+
}
|
|
696
|
+
const uiDirectoryCandidate = join(__dirname, "../.output/ui");
|
|
697
|
+
const uiIndexPath = join(uiDirectoryCandidate, "index.html");
|
|
698
|
+
const uiDirectory = serveUi && existsSync(uiIndexPath) ? uiDirectoryCandidate : undefined;
|
|
699
|
+
if (serveUi && uiDirectory === undefined) {
|
|
700
|
+
console.error(
|
|
701
|
+
`Agent Inspector UI artifact is missing at ${uiIndexPath}. Run the composed build or use --backend-only.`,
|
|
702
|
+
);
|
|
703
|
+
process.exitCode = 1;
|
|
704
|
+
return;
|
|
705
|
+
}
|
|
536
706
|
|
|
537
707
|
/**
|
|
538
708
|
* Check if a port is in use and kill the process using it
|
|
@@ -551,15 +721,41 @@ async function runStart(args: string[]): Promise<void> {
|
|
|
551
721
|
// TanStack Start listens on the private upstream port; identity proxies own
|
|
552
722
|
// the public-facing port(s). When the identity proxy is disabled we fall
|
|
553
723
|
// back to TanStack listening on the public port directly.
|
|
554
|
-
const upstreamPort =
|
|
724
|
+
const upstreamPort =
|
|
725
|
+
managedLaunch === null
|
|
726
|
+
? enableIdentityProxy
|
|
727
|
+
? pickUpstreamPort(port, legacyAliasPort)
|
|
728
|
+
: port
|
|
729
|
+
: managedLaunch.upstreamPort;
|
|
730
|
+
if (
|
|
731
|
+
upstreamPort < 1 ||
|
|
732
|
+
upstreamPort > 65_535 ||
|
|
733
|
+
(enableIdentityProxy && upstreamPort === port) ||
|
|
734
|
+
upstreamPort === legacyAliasPort
|
|
735
|
+
) {
|
|
736
|
+
console.error(`Invalid managed upstream port: ${String(upstreamPort)}.`);
|
|
737
|
+
process.exitCode = 1;
|
|
738
|
+
return;
|
|
739
|
+
}
|
|
555
740
|
const upstreamHost = enableIdentityProxy ? DEFAULT_BIND_HOST : host;
|
|
556
741
|
process.env["PORT"] = String(upstreamPort);
|
|
557
742
|
|
|
743
|
+
const configuredBasePath = process.env[AGENT_INSPECTOR_BASE_PATH_ENV];
|
|
744
|
+
if (configuredBasePath !== undefined && normalizePublicBasePath(configuredBasePath) === null) {
|
|
745
|
+
console.error(
|
|
746
|
+
`Invalid ${AGENT_INSPECTOR_BASE_PATH_ENV}. Use / for root or URL-safe path segments such as /inspector or /foo-bar/v1.`,
|
|
747
|
+
);
|
|
748
|
+
process.exitCode = 1;
|
|
749
|
+
return;
|
|
750
|
+
}
|
|
558
751
|
const basePath = getConfiguredBasePath(process.env);
|
|
559
|
-
const
|
|
560
|
-
const
|
|
561
|
-
const
|
|
562
|
-
const
|
|
752
|
+
const bindOrigin = urlForHost(port, host);
|
|
753
|
+
const outwardOrigin = publicOrigin ?? bindOrigin;
|
|
754
|
+
const surfaceBaseUrl = appendBasePathToOrigin(outwardOrigin, "/", basePath);
|
|
755
|
+
const uiUrl = serveUi ? surfaceBaseUrl : null;
|
|
756
|
+
const proxyUrl = appendBasePathToOrigin(outwardOrigin, "/proxy", basePath);
|
|
757
|
+
const openAiProxyUrl = appendBasePathToOrigin(outwardOrigin, "/proxy/v1", basePath);
|
|
758
|
+
const proxyMessagesUrl = appendBasePathToOrigin(outwardOrigin, "/proxy/v1/messages", basePath);
|
|
563
759
|
const legacyUrl =
|
|
564
760
|
legacyAliasPort === null
|
|
565
761
|
? null
|
|
@@ -574,8 +770,10 @@ async function runStart(args: string[]): Promise<void> {
|
|
|
574
770
|
: appendBasePathToOrigin(localUrlForPort(legacyAliasPort), "/api/mcp", basePath);
|
|
575
771
|
|
|
576
772
|
if (!forceRestart && (await isInspectorHealthy(port, host, basePath))) {
|
|
577
|
-
console.log(
|
|
578
|
-
|
|
773
|
+
console.log(
|
|
774
|
+
`agent-inspector ${serveUi ? "is already running" : "backend is already running"} at ${surfaceBaseUrl}`,
|
|
775
|
+
);
|
|
776
|
+
printAccessHints(port, host, basePath, serveUi, publicOrigin);
|
|
579
777
|
if (captureModeWasSpecified) {
|
|
580
778
|
const runningMode = await getRunningCaptureMode(port, host, basePath);
|
|
581
779
|
if (runningMode !== null && runningMode !== captureMode) {
|
|
@@ -584,7 +782,7 @@ async function runStart(args: string[]): Promise<void> {
|
|
|
584
782
|
}
|
|
585
783
|
}
|
|
586
784
|
console.log(`Use --force-restart to restart the existing instance.`);
|
|
587
|
-
if (open && openWasSpecified) {
|
|
785
|
+
if (open && openWasSpecified && uiUrl !== null) {
|
|
588
786
|
openBrowser(uiUrl);
|
|
589
787
|
}
|
|
590
788
|
return;
|
|
@@ -625,11 +823,12 @@ async function runStart(args: string[]): Promise<void> {
|
|
|
625
823
|
captureMode,
|
|
626
824
|
enableIdentityProxy,
|
|
627
825
|
legacyAliasEnabled,
|
|
826
|
+
serveUi,
|
|
628
827
|
});
|
|
629
828
|
const supervisorProcess = spawn(process.execPath, [cliEntry, ...supervisorArgs], {
|
|
630
829
|
stdio: "ignore",
|
|
631
830
|
detached: true,
|
|
632
|
-
env: process.env,
|
|
831
|
+
env: { ...process.env, [AGENT_INSPECTOR_CLI_ENTRY_ENV]: cliEntry },
|
|
633
832
|
windowsHide: true,
|
|
634
833
|
});
|
|
635
834
|
supervisorProcess.once("error", (err) => {
|
|
@@ -638,8 +837,10 @@ async function runStart(args: string[]): Promise<void> {
|
|
|
638
837
|
supervisorProcess.unref();
|
|
639
838
|
|
|
640
839
|
if (await waitForInspectorHealthy(port, 10000, host, basePath)) {
|
|
641
|
-
console.log(
|
|
642
|
-
|
|
840
|
+
console.log(
|
|
841
|
+
`agent-inspector background ${serveUi ? "server" : "backend"} is ready at ${surfaceBaseUrl}`,
|
|
842
|
+
);
|
|
843
|
+
printAccessHints(port, host, basePath, serveUi, publicOrigin);
|
|
643
844
|
if (legacyProxyUrl !== null && legacyMcpUrl !== null) {
|
|
644
845
|
console.log(` Legacy proxy: ${legacyProxyUrl}`);
|
|
645
846
|
console.log(` Legacy MCP: ${legacyMcpUrl}`);
|
|
@@ -648,48 +849,18 @@ async function runStart(args: string[]): Promise<void> {
|
|
|
648
849
|
console.log(`Route AI coding tools through the identity proxy for accurate PID attribution:`);
|
|
649
850
|
console.log(` Claude Code: ANTHROPIC_BASE_URL=${proxyUrl} claude`);
|
|
650
851
|
console.log(` OpenCode: LLM_BASE_URL=${proxyUrl} opencode`);
|
|
651
|
-
console.log(` MiMo Code: OPENAI_BASE_URL=${
|
|
652
|
-
if (open && openWasSpecified) {
|
|
852
|
+
console.log(` MiMo Code: OPENAI_BASE_URL=${openAiProxyUrl} mimo`);
|
|
853
|
+
if (open && openWasSpecified && uiUrl !== null) {
|
|
653
854
|
openBrowser(uiUrl);
|
|
654
855
|
}
|
|
655
856
|
return;
|
|
656
857
|
}
|
|
657
858
|
|
|
658
|
-
console.error(`agent-inspector background server did not become ready at ${
|
|
859
|
+
console.error(`agent-inspector background server did not become ready at ${surfaceBaseUrl}.`);
|
|
659
860
|
process.exitCode = 1;
|
|
660
861
|
return;
|
|
661
862
|
}
|
|
662
863
|
|
|
663
|
-
console.log(`Server running at ${uiUrl}`);
|
|
664
|
-
console.log(` Capture mode: ${captureMode}`);
|
|
665
|
-
console.log(` Proxy: ${proxyUrl}`);
|
|
666
|
-
printAccessHints(port, host, basePath);
|
|
667
|
-
if (legacyUrl !== null && legacyProxyUrl !== null && legacyMcpUrl !== null) {
|
|
668
|
-
console.log(` Legacy UI: ${legacyUrl}`);
|
|
669
|
-
console.log(` Legacy proxy: ${legacyProxyUrl}`);
|
|
670
|
-
console.log(` Legacy MCP: ${legacyMcpUrl}`);
|
|
671
|
-
}
|
|
672
|
-
console.log(``);
|
|
673
|
-
console.log(`Route AI coding tools through the proxy:`);
|
|
674
|
-
console.log(` Claude Code: ANTHROPIC_BASE_URL=${proxyUrl} claude`);
|
|
675
|
-
console.log(` OpenCode: LLM_BASE_URL=${proxyUrl} opencode`);
|
|
676
|
-
console.log(` MiMo Code: OPENAI_BASE_URL=${proxyUrl} mimo`);
|
|
677
|
-
console.log(` Direct HTTP: curl ${proxyMessagesUrl} -d '{"model":"...","messages":[...]}'`);
|
|
678
|
-
console.log(
|
|
679
|
-
` Remote/container tools: use the Network proxy URL above when shown; otherwise restart with --host 0.0.0.0 or a reachable IP.`,
|
|
680
|
-
);
|
|
681
|
-
console.log(``);
|
|
682
|
-
console.log(`Routing environment variables:`);
|
|
683
|
-
console.log(` ROUTES JSON map of model prefix -> upstream URL`);
|
|
684
|
-
console.log(` DEFAULT_UPSTREAM Fallback upstream for unmatched models`);
|
|
685
|
-
console.log(
|
|
686
|
-
` Example: ROUTES='{"claude-":"https://api.anthropic.com","MiniMax":"https://api.minimaxi.com/anthropic"}'`,
|
|
687
|
-
);
|
|
688
|
-
|
|
689
|
-
if (open) {
|
|
690
|
-
openBrowser(uiUrl);
|
|
691
|
-
}
|
|
692
|
-
|
|
693
864
|
// Compute server path
|
|
694
865
|
const outputDir = __dirname;
|
|
695
866
|
const serverPath = join(outputDir, "../.output/server/index.mjs");
|
|
@@ -697,6 +868,10 @@ async function runStart(args: string[]): Promise<void> {
|
|
|
697
868
|
|
|
698
869
|
// Start the server with the branded Windows runtime when postinstall created it.
|
|
699
870
|
const serverEnv = { ...process.env };
|
|
871
|
+
const currentCliEntry = process.env[AGENT_INSPECTOR_CLI_ENTRY_ENV] ?? process.argv[1];
|
|
872
|
+
if (currentCliEntry !== undefined && currentCliEntry.length > 0) {
|
|
873
|
+
serverEnv[AGENT_INSPECTOR_CLI_ENTRY_ENV] = currentCliEntry;
|
|
874
|
+
}
|
|
700
875
|
if (configDir !== undefined) {
|
|
701
876
|
// Normalize MSYS / Git Bash paths to Windows native form.
|
|
702
877
|
// On Windows, `path.join('/c/Users/foo')` becomes `\c\Users\foo`
|
|
@@ -727,12 +902,20 @@ async function runStart(args: string[]): Promise<void> {
|
|
|
727
902
|
serverEnv["AGENT_INSPECTOR_PUBLIC_PORT"] = String(port);
|
|
728
903
|
serverEnv["PROXY_PORT"] = String(port);
|
|
729
904
|
serverEnv["AGENT_INSPECTOR_CAPTURE_MODE"] = captureMode;
|
|
905
|
+
serverEnv["AGENT_INSPECTOR_BACKEND_ONLY"] = serveUi ? "0" : "1";
|
|
730
906
|
const workerDir = join(__dirname, "workers");
|
|
731
907
|
if (existsSync(workerDir)) {
|
|
732
908
|
serverEnv["AGENT_INSPECTOR_WORKER_DIR"] = workerDir;
|
|
733
909
|
}
|
|
734
910
|
const serverProcess = spawn(serverCommand.command, serverCommand.args, {
|
|
735
|
-
stdio:
|
|
911
|
+
stdio:
|
|
912
|
+
managedLaunch === null
|
|
913
|
+
? background
|
|
914
|
+
? ["ignore", "ignore", "ignore"]
|
|
915
|
+
: ["ignore", "pipe", "pipe"]
|
|
916
|
+
: background
|
|
917
|
+
? ["ignore", "ignore", "ignore", "ipc"]
|
|
918
|
+
: ["ignore", "pipe", "pipe", "ipc"],
|
|
736
919
|
detached: background,
|
|
737
920
|
env: serverEnv,
|
|
738
921
|
windowsHide: background,
|
|
@@ -764,7 +947,13 @@ async function runStart(args: string[]): Promise<void> {
|
|
|
764
947
|
const requestSupervisorShutdown = (signal: "SIGINT" | "SIGTERM"): void => {
|
|
765
948
|
if (supervisorShutdownPromise !== null) return;
|
|
766
949
|
for (const proxy of identityProxies) stopIdentityProxyAdmission(proxy.server);
|
|
767
|
-
serverProcess.
|
|
950
|
+
if (managedLaunch !== null && serverProcess.connected) {
|
|
951
|
+
serverProcess.send(managedInstanceShutdownMessage(managedLaunch.controlToken), (error) => {
|
|
952
|
+
if (error !== null && serverProcess.exitCode === null) serverProcess.kill(signal);
|
|
953
|
+
});
|
|
954
|
+
} else {
|
|
955
|
+
serverProcess.kill(signal);
|
|
956
|
+
}
|
|
768
957
|
|
|
769
958
|
const childDeadline =
|
|
770
959
|
readPositiveIntegerEnv("AGENT_INSPECTOR_SHUTDOWN_TIMEOUT_MS") ?? DEFAULT_SHUTDOWN_DEADLINE_MS;
|
|
@@ -795,17 +984,54 @@ async function runStart(args: string[]): Promise<void> {
|
|
|
795
984
|
const currentSupervisorShutdown = (): Promise<void> | null => supervisorShutdownPromise;
|
|
796
985
|
process.on("SIGINT", handleSigint);
|
|
797
986
|
process.on("SIGTERM", handleSigterm);
|
|
987
|
+
const managedInstanceControl: ManagedInstanceControlOptions | undefined =
|
|
988
|
+
managedLaunch === null
|
|
989
|
+
? undefined
|
|
990
|
+
: {
|
|
991
|
+
name: managedLaunch.name,
|
|
992
|
+
instanceId: managedLaunch.instanceId,
|
|
993
|
+
launchId: managedLaunch.launchId,
|
|
994
|
+
controlToken: managedLaunch.controlToken,
|
|
995
|
+
supervisorPid: process.pid,
|
|
996
|
+
startedAt: managedLaunch.startedAt,
|
|
997
|
+
publicPort: port,
|
|
998
|
+
upstreamPort,
|
|
999
|
+
requestShutdown: () => requestSupervisorShutdown("SIGTERM"),
|
|
1000
|
+
};
|
|
798
1001
|
if (enableIdentityProxy) {
|
|
799
|
-
const primaryProxy = await tryStartIdentityProxy(
|
|
800
|
-
|
|
801
|
-
|
|
1002
|
+
const primaryProxy = await tryStartIdentityProxy(
|
|
1003
|
+
port,
|
|
1004
|
+
upstreamPort,
|
|
1005
|
+
host,
|
|
1006
|
+
upstreamHost,
|
|
1007
|
+
managedInstanceControl,
|
|
1008
|
+
uiOriginAllowlist.origins,
|
|
1009
|
+
uiDirectory,
|
|
1010
|
+
publicOrigin,
|
|
1011
|
+
);
|
|
1012
|
+
if (primaryProxy === null) {
|
|
1013
|
+
console.error(
|
|
1014
|
+
`Agent Inspector could not bind its protected public ingress at ${bindOrigin}; stopping the private backend.`,
|
|
1015
|
+
);
|
|
1016
|
+
requestSupervisorShutdown("SIGTERM");
|
|
1017
|
+
const failedStartupShutdown = currentSupervisorShutdown();
|
|
1018
|
+
if (failedStartupShutdown !== null) await failedStartupShutdown;
|
|
1019
|
+
process.off("SIGINT", handleSigint);
|
|
1020
|
+
process.off("SIGTERM", handleSigterm);
|
|
1021
|
+
process.exitCode = 1;
|
|
1022
|
+
return;
|
|
802
1023
|
}
|
|
1024
|
+
identityProxies.push({ label: "primary", port, server: primaryProxy });
|
|
803
1025
|
if (legacyAliasPort !== null) {
|
|
804
1026
|
const legacyProxy = await tryStartIdentityProxy(
|
|
805
1027
|
legacyAliasPort,
|
|
806
1028
|
upstreamPort,
|
|
807
1029
|
host,
|
|
808
1030
|
upstreamHost,
|
|
1031
|
+
managedInstanceControl,
|
|
1032
|
+
uiOriginAllowlist.origins,
|
|
1033
|
+
uiDirectory,
|
|
1034
|
+
publicOrigin,
|
|
809
1035
|
);
|
|
810
1036
|
if (legacyProxy !== null) {
|
|
811
1037
|
identityProxies.push({ label: "legacy", port: legacyAliasPort, server: legacyProxy });
|
|
@@ -819,11 +1045,13 @@ async function runStart(args: string[]): Promise<void> {
|
|
|
819
1045
|
// not started yet so the public port is not yet accepting traffic.
|
|
820
1046
|
const upstreamProbeBasePath = enableIdentityProxy ? "" : basePath;
|
|
821
1047
|
if (await waitForInspectorHealthy(upstreamPort, 5000, host, upstreamProbeBasePath)) {
|
|
822
|
-
console.log(
|
|
1048
|
+
console.log(
|
|
1049
|
+
`agent-inspector background ${serveUi ? "server" : "backend"} is ready at ${surfaceBaseUrl}`,
|
|
1050
|
+
);
|
|
823
1051
|
if (identityProxies.length > 0) {
|
|
824
1052
|
console.log(`Identity proxy ready on port ${port} (PID-attributing proxy).`);
|
|
825
1053
|
}
|
|
826
|
-
printAccessHints(port, host, basePath);
|
|
1054
|
+
printAccessHints(port, host, basePath, serveUi, publicOrigin);
|
|
827
1055
|
if (legacyProxyUrl !== null && legacyMcpUrl !== null) {
|
|
828
1056
|
console.log(` Legacy proxy: ${legacyProxyUrl}`);
|
|
829
1057
|
console.log(` Legacy MCP: ${legacyMcpUrl}`);
|
|
@@ -834,7 +1062,7 @@ async function runStart(args: string[]): Promise<void> {
|
|
|
834
1062
|
`Route AI coding tools through the identity proxy for accurate PID attribution:`,
|
|
835
1063
|
` Claude Code: ANTHROPIC_BASE_URL=${proxyUrl} claude`,
|
|
836
1064
|
` OpenCode: LLM_BASE_URL=${proxyUrl} opencode`,
|
|
837
|
-
` MiMo Code: OPENAI_BASE_URL=${
|
|
1065
|
+
` MiMo Code: OPENAI_BASE_URL=${openAiProxyUrl} mimo`,
|
|
838
1066
|
legacyProxyUrl === null
|
|
839
1067
|
? ` Override the port with --port <n> when needed.`
|
|
840
1068
|
: ` Legacy configs using ${legacyProxyUrl} still work.`,
|
|
@@ -842,14 +1070,25 @@ async function runStart(args: string[]): Promise<void> {
|
|
|
842
1070
|
}
|
|
843
1071
|
return;
|
|
844
1072
|
}
|
|
845
|
-
console.error(`agent-inspector background server did not become ready at ${
|
|
1073
|
+
console.error(`agent-inspector background server did not become ready at ${surfaceBaseUrl}.`);
|
|
1074
|
+
process.exitCode = 1;
|
|
1075
|
+
return;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
if (!(await waitForInspectorHealthy(port, 10_000, host, basePath))) {
|
|
1079
|
+
console.error(`Agent Inspector did not become ready at ${surfaceBaseUrl}; stopping startup.`);
|
|
1080
|
+
requestSupervisorShutdown("SIGTERM");
|
|
1081
|
+
const failedStartupShutdown = currentSupervisorShutdown();
|
|
1082
|
+
if (failedStartupShutdown !== null) await failedStartupShutdown;
|
|
1083
|
+
process.off("SIGINT", handleSigint);
|
|
1084
|
+
process.off("SIGTERM", handleSigterm);
|
|
846
1085
|
process.exitCode = 1;
|
|
847
1086
|
return;
|
|
848
1087
|
}
|
|
849
1088
|
|
|
850
1089
|
if (identityProxies.length > 0) {
|
|
851
1090
|
console.log(``);
|
|
852
|
-
console.log(`Identity proxy ready at ${
|
|
1091
|
+
console.log(`Identity proxy ready at ${bindOrigin} (PID-attributing ingress).`);
|
|
853
1092
|
if (legacyAliasPort !== null) {
|
|
854
1093
|
const legacyReady = identityProxies.some((proxy) => proxy.label === "legacy");
|
|
855
1094
|
if (legacyReady) {
|
|
@@ -861,6 +1100,28 @@ async function runStart(args: string[]): Promise<void> {
|
|
|
861
1100
|
}
|
|
862
1101
|
}
|
|
863
1102
|
|
|
1103
|
+
console.log(
|
|
1104
|
+
`${serveUi ? "UI and backend" : "Backend control and agent runtime"} running at ${surfaceBaseUrl}`,
|
|
1105
|
+
);
|
|
1106
|
+
console.log(` Capture mode: ${captureMode}`);
|
|
1107
|
+
console.log(` Proxy: ${proxyUrl}`);
|
|
1108
|
+
printAccessHints(port, host, basePath, serveUi, publicOrigin);
|
|
1109
|
+
if (legacyUrl !== null && legacyProxyUrl !== null && legacyMcpUrl !== null) {
|
|
1110
|
+
console.log(` Legacy UI: ${legacyUrl}`);
|
|
1111
|
+
console.log(` Legacy proxy: ${legacyProxyUrl}`);
|
|
1112
|
+
console.log(` Legacy MCP: ${legacyMcpUrl}`);
|
|
1113
|
+
}
|
|
1114
|
+
console.log(``);
|
|
1115
|
+
console.log(`Route AI coding tools through the proxy:`);
|
|
1116
|
+
console.log(` Claude Code: ANTHROPIC_BASE_URL=${proxyUrl} claude`);
|
|
1117
|
+
console.log(` OpenCode: LLM_BASE_URL=${proxyUrl} opencode`);
|
|
1118
|
+
console.log(` MiMo Code: OPENAI_BASE_URL=${openAiProxyUrl} mimo`);
|
|
1119
|
+
console.log(` Direct HTTP: curl ${proxyMessagesUrl} -d '{"model":"...","messages":[...]}'`);
|
|
1120
|
+
console.log(
|
|
1121
|
+
` Remote/container tools: use the Network proxy URL above when shown; otherwise restart with --host 0.0.0.0 or a reachable IP.`,
|
|
1122
|
+
);
|
|
1123
|
+
if (open && uiUrl !== null) openBrowser(uiUrl);
|
|
1124
|
+
|
|
864
1125
|
process.exitCode = await serverExit;
|
|
865
1126
|
|
|
866
1127
|
const activeSupervisorShutdown = currentSupervisorShutdown();
|