@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
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { AGENT_INSPECTOR_BASE_PATH_META_NAME } from "../lib/basePath";
|
|
2
|
+
import { THEME_MODE_STORAGE_KEY } from "../lib/themeMode";
|
|
3
|
+
import {
|
|
4
|
+
UI_SCALE_AUTO_LARGE_WIDTH,
|
|
5
|
+
UI_SCALE_AUTO_MAX_DPR,
|
|
6
|
+
UI_SCALE_AUTO_MEDIUM_WIDTH,
|
|
7
|
+
UI_SCALE_MINIMUM_COMPACT_FONT_SIZE,
|
|
8
|
+
UI_SCALE_STORAGE_KEY,
|
|
9
|
+
} from "../lib/uiScale";
|
|
10
|
+
|
|
11
|
+
export const UI_BASE_PATH_BOOTSTRAP_PLACEHOLDER = "__AGENT_INSPECTOR_BASE_PATH_BOOTSTRAP__";
|
|
12
|
+
export const UI_BASE_PATH_META_PLACEHOLDER = "__AGENT_INSPECTOR_BASE_PATH__";
|
|
13
|
+
export const UI_RUNTIME_CSP_BOOTSTRAP_PLACEHOLDER = "__AGENT_INSPECTOR_RUNTIME_CSP_BOOTSTRAP__";
|
|
14
|
+
export const UI_THEME_BOOTSTRAP_PLACEHOLDER = "__AGENT_INSPECTOR_THEME_BOOTSTRAP__";
|
|
15
|
+
export const UI_SCALE_BOOTSTRAP_PLACEHOLDER = "__AGENT_INSPECTOR_UI_SCALE_BOOTSTRAP__";
|
|
16
|
+
|
|
17
|
+
export const basePathBootstrapScript = `
|
|
18
|
+
(function () {
|
|
19
|
+
var placeholder = "__AGENT_INSPECTOR_" + "BASE_PATH__";
|
|
20
|
+
var meta = document.querySelector('meta[name="${AGENT_INSPECTOR_BASE_PATH_META_NAME}"]');
|
|
21
|
+
var base = document.querySelector("base");
|
|
22
|
+
|
|
23
|
+
function normalize(value) {
|
|
24
|
+
var trimmed = typeof value === "string" ? value.trim() : "";
|
|
25
|
+
if (trimmed === "" || trimmed === "/") return "";
|
|
26
|
+
return "/" + trimmed.replace(/^\\/+|\\/+$/g, "");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function inferFromKnownUiRoute() {
|
|
30
|
+
var pathname = window.location.pathname;
|
|
31
|
+
var sessionMarker = "/session/";
|
|
32
|
+
var sessionIndex = pathname.indexOf(sessionMarker);
|
|
33
|
+
if (sessionIndex >= 0) return normalize(pathname.slice(0, sessionIndex));
|
|
34
|
+
return normalize(pathname.replace(/\\/index\\.html$/, ""));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function runtimeBasePath() {
|
|
38
|
+
var runtime = window.__AGENT_INSPECTOR_RUNTIME__;
|
|
39
|
+
if (
|
|
40
|
+
runtime !== null &&
|
|
41
|
+
typeof runtime === "object" &&
|
|
42
|
+
runtime.ui !== null &&
|
|
43
|
+
typeof runtime.ui === "object" &&
|
|
44
|
+
typeof runtime.ui.basePath === "string"
|
|
45
|
+
) {
|
|
46
|
+
return runtime.ui.basePath;
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
var configured = meta === null ? placeholder : meta.getAttribute("content");
|
|
52
|
+
var runtimePath = runtimeBasePath();
|
|
53
|
+
var basePath = configured !== null && configured !== placeholder
|
|
54
|
+
? normalize(configured)
|
|
55
|
+
: runtimePath === null
|
|
56
|
+
? inferFromKnownUiRoute()
|
|
57
|
+
: normalize(runtimePath);
|
|
58
|
+
var baseHref = basePath === "" ? "/" : basePath + "/";
|
|
59
|
+
|
|
60
|
+
if (meta !== null) meta.setAttribute("content", basePath === "" ? "/" : basePath);
|
|
61
|
+
if (base !== null) base.setAttribute("href", baseHref);
|
|
62
|
+
})();
|
|
63
|
+
`;
|
|
64
|
+
|
|
65
|
+
export const runtimeCspBootstrapScript = `
|
|
66
|
+
(function () {
|
|
67
|
+
var runtime = window.__AGENT_INSPECTOR_RUNTIME__;
|
|
68
|
+
var controlBaseUrl = runtime !== null && typeof runtime === "object" &&
|
|
69
|
+
runtime.control !== null && typeof runtime.control === "object" &&
|
|
70
|
+
typeof runtime.control.baseUrl === "string"
|
|
71
|
+
? runtime.control.baseUrl
|
|
72
|
+
: null;
|
|
73
|
+
var controlOrigin = null;
|
|
74
|
+
if (controlBaseUrl !== null) {
|
|
75
|
+
try {
|
|
76
|
+
var parsed = new URL(controlBaseUrl);
|
|
77
|
+
if (parsed.protocol === "http:" || parsed.protocol === "https:") {
|
|
78
|
+
controlOrigin = parsed.origin;
|
|
79
|
+
}
|
|
80
|
+
} catch (error) {}
|
|
81
|
+
}
|
|
82
|
+
var uiOrigin = new URL(document.baseURI).origin;
|
|
83
|
+
var connectSources = controlOrigin === null || controlOrigin === uiOrigin
|
|
84
|
+
? "'self'"
|
|
85
|
+
: "'self' " + controlOrigin;
|
|
86
|
+
var policy = [
|
|
87
|
+
"default-src 'self'",
|
|
88
|
+
"base-uri 'self'",
|
|
89
|
+
"connect-src " + connectSources,
|
|
90
|
+
"font-src 'self' data:",
|
|
91
|
+
"form-action 'self'",
|
|
92
|
+
"img-src 'self' data: blob:",
|
|
93
|
+
"object-src 'none'",
|
|
94
|
+
"script-src 'self' 'unsafe-inline'",
|
|
95
|
+
"style-src 'self' 'unsafe-inline'",
|
|
96
|
+
"worker-src 'self' blob:"
|
|
97
|
+
].join("; ");
|
|
98
|
+
var meta = document.querySelector('meta[http-equiv="Content-Security-Policy"]');
|
|
99
|
+
if (meta === null) {
|
|
100
|
+
meta = document.createElement("meta");
|
|
101
|
+
meta.setAttribute("http-equiv", "Content-Security-Policy");
|
|
102
|
+
document.head.appendChild(meta);
|
|
103
|
+
}
|
|
104
|
+
meta.setAttribute("content", policy);
|
|
105
|
+
})();
|
|
106
|
+
`;
|
|
107
|
+
|
|
108
|
+
export const themeModeBootstrapScript = `
|
|
109
|
+
(function () {
|
|
110
|
+
try {
|
|
111
|
+
var storedThemeMode = window.localStorage.getItem("${THEME_MODE_STORAGE_KEY}");
|
|
112
|
+
var themeMode = storedThemeMode === "light" || storedThemeMode === "eye-care"
|
|
113
|
+
? storedThemeMode
|
|
114
|
+
: "dark";
|
|
115
|
+
document.documentElement.dataset.theme = themeMode;
|
|
116
|
+
} catch (error) {
|
|
117
|
+
document.documentElement.dataset.theme = "dark";
|
|
118
|
+
}
|
|
119
|
+
})();
|
|
120
|
+
`;
|
|
121
|
+
|
|
122
|
+
export const uiScaleBootstrapScript = `
|
|
123
|
+
(function () {
|
|
124
|
+
try {
|
|
125
|
+
var storedUiScale = window.localStorage.getItem("${UI_SCALE_STORAGE_KEY}");
|
|
126
|
+
var uiScalePreference = storedUiScale === "100" || storedUiScale === "125" || storedUiScale === "150"
|
|
127
|
+
? storedUiScale
|
|
128
|
+
: "auto";
|
|
129
|
+
var resolvedUiScale = 1;
|
|
130
|
+
if (uiScalePreference === "125") resolvedUiScale = 1.25;
|
|
131
|
+
if (uiScalePreference === "150") resolvedUiScale = 1.5;
|
|
132
|
+
if (uiScalePreference === "auto") {
|
|
133
|
+
var viewportWidth = Number.isFinite(window.innerWidth) && window.innerWidth > 0
|
|
134
|
+
? window.innerWidth
|
|
135
|
+
: 1280;
|
|
136
|
+
var rawScreenWidth = typeof window.screen === "undefined"
|
|
137
|
+
? viewportWidth
|
|
138
|
+
: window.screen.availWidth;
|
|
139
|
+
var screenWidth = Number.isFinite(rawScreenWidth) && rawScreenWidth > 0
|
|
140
|
+
? rawScreenWidth
|
|
141
|
+
: viewportWidth;
|
|
142
|
+
var rawDevicePixelRatio = window.devicePixelRatio;
|
|
143
|
+
var devicePixelRatio = Number.isFinite(rawDevicePixelRatio) && rawDevicePixelRatio > 0
|
|
144
|
+
? rawDevicePixelRatio
|
|
145
|
+
: 1;
|
|
146
|
+
var availableWidth = Math.min(viewportWidth, screenWidth);
|
|
147
|
+
if (devicePixelRatio <= ${String(UI_SCALE_AUTO_MAX_DPR)} && availableWidth >= ${String(UI_SCALE_AUTO_LARGE_WIDTH)}) {
|
|
148
|
+
resolvedUiScale = 1.25;
|
|
149
|
+
} else if (devicePixelRatio <= ${String(UI_SCALE_AUTO_MAX_DPR)} && availableWidth >= ${String(UI_SCALE_AUTO_MEDIUM_WIDTH)}) {
|
|
150
|
+
resolvedUiScale = 1.125;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
var root = document.documentElement;
|
|
154
|
+
root.dataset.uiScale = uiScalePreference;
|
|
155
|
+
root.dataset.uiScaleResolved = String(Math.round(resolvedUiScale * 100));
|
|
156
|
+
root.style.setProperty("--inspector-ui-scale", String(resolvedUiScale));
|
|
157
|
+
root.style.setProperty("--inspector-root-font-size", String(16 * resolvedUiScale) + "px");
|
|
158
|
+
root.style.setProperty("--inspector-font-9", String(Math.max(${String(UI_SCALE_MINIMUM_COMPACT_FONT_SIZE)}, 9 * resolvedUiScale)) + "px");
|
|
159
|
+
root.style.setProperty("--inspector-font-10", String(Math.max(${String(UI_SCALE_MINIMUM_COMPACT_FONT_SIZE)}, 10 * resolvedUiScale)) + "px");
|
|
160
|
+
root.style.setProperty("--inspector-font-11", String(Math.max(${String(UI_SCALE_MINIMUM_COMPACT_FONT_SIZE)}, 11 * resolvedUiScale)) + "px");
|
|
161
|
+
root.style.setProperty("--inspector-font-13", String(13 * resolvedUiScale) + "px");
|
|
162
|
+
} catch (error) {
|
|
163
|
+
document.documentElement.dataset.uiScale = "auto";
|
|
164
|
+
document.documentElement.dataset.uiScaleResolved = "100";
|
|
165
|
+
}
|
|
166
|
+
})();
|
|
167
|
+
`;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en" data-theme="dark">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<meta name="agent-inspector-base-path" content="__AGENT_INSPECTOR_BASE_PATH__" />
|
|
7
|
+
<base href="/" />
|
|
8
|
+
<script>
|
|
9
|
+
__AGENT_INSPECTOR_BASE_PATH_BOOTSTRAP__
|
|
10
|
+
</script>
|
|
11
|
+
<script vite-ignore src="./runtime-config.js"></script>
|
|
12
|
+
<script>
|
|
13
|
+
try {
|
|
14
|
+
window.__AGENT_INSPECTOR_RUNTIME__ = __AGENT_INSPECTOR_RUNTIME_JSON__;
|
|
15
|
+
} catch (error) {
|
|
16
|
+
window.__AGENT_INSPECTOR_RUNTIME__ = window.__AGENT_INSPECTOR_RUNTIME_CONFIG__ || {};
|
|
17
|
+
}
|
|
18
|
+
</script>
|
|
19
|
+
<script>
|
|
20
|
+
__AGENT_INSPECTOR_RUNTIME_CSP_BOOTSTRAP__
|
|
21
|
+
</script>
|
|
22
|
+
<script>
|
|
23
|
+
__AGENT_INSPECTOR_BASE_PATH_BOOTSTRAP__
|
|
24
|
+
</script>
|
|
25
|
+
<script>
|
|
26
|
+
__AGENT_INSPECTOR_THEME_BOOTSTRAP__
|
|
27
|
+
</script>
|
|
28
|
+
<script>
|
|
29
|
+
__AGENT_INSPECTOR_UI_SCALE_BOOTSTRAP__
|
|
30
|
+
</script>
|
|
31
|
+
<link rel="icon" type="image/svg+xml" href="../assets/favicon.svg" />
|
|
32
|
+
<title>Agent Inspector</title>
|
|
33
|
+
</head>
|
|
34
|
+
<body>
|
|
35
|
+
<div id="root"><p role="status">Connecting to Agent Inspector…</p></div>
|
|
36
|
+
<script type="module" src="./main.tsx"></script>
|
|
37
|
+
</body>
|
|
38
|
+
</html>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildControlRuntimeUrl,
|
|
3
|
+
resolveBrowserRuntimeForDocument,
|
|
4
|
+
} from "../lib/browserRuntimeResolver";
|
|
5
|
+
|
|
6
|
+
export function buildLogsStreamUrl(sessionId: string | undefined): string | null {
|
|
7
|
+
const params = new URLSearchParams({ compact: "1" });
|
|
8
|
+
if (sessionId !== undefined) {
|
|
9
|
+
params.set("sessionId", sessionId);
|
|
10
|
+
}
|
|
11
|
+
const runtime = resolveBrowserRuntimeForDocument();
|
|
12
|
+
if (!runtime.ok) return null;
|
|
13
|
+
return buildControlRuntimeUrl(runtime.runtime, `/api/logs/stream?${params.toString()}`);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function openLogsEventSource(sessionId: string | undefined): EventSource | null {
|
|
17
|
+
const url = buildLogsStreamUrl(sessionId);
|
|
18
|
+
if (url === null) return null;
|
|
19
|
+
return new EventSource(url);
|
|
20
|
+
}
|
package/src/ui/main.tsx
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { RouterProvider } from "@tanstack/react-router";
|
|
2
|
+
import { createRoot } from "react-dom/client";
|
|
3
|
+
import "../index.css";
|
|
4
|
+
import { router } from "./router";
|
|
5
|
+
import { validateBrowserRuntimeForStartup } from "./runtimeDiscovery";
|
|
6
|
+
|
|
7
|
+
const rootElement = document.getElementById("root");
|
|
8
|
+
|
|
9
|
+
if (rootElement !== null) {
|
|
10
|
+
createRoot(rootElement).render(<RouterProvider router={router} />);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
void validateBrowserRuntimeForStartup();
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createRouter } from "@tanstack/react-router";
|
|
2
|
+
import { getConfiguredBasePath } from "../lib/basePath";
|
|
3
|
+
import { routeTree } from "./routeTree.gen";
|
|
4
|
+
|
|
5
|
+
export function createUiRouter(basepath = getConfiguredBasePath()) {
|
|
6
|
+
return createRouter({
|
|
7
|
+
routeTree,
|
|
8
|
+
basepath,
|
|
9
|
+
scrollRestoration: false,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const router = createUiRouter();
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Outlet, createRootRoute } from "@tanstack/react-router";
|
|
2
|
+
import { useEffect, type ReactNode } from "react";
|
|
3
|
+
import { SWRConfig } from "swr";
|
|
4
|
+
import { SafeErrorBoundary, SafeRouteError } from "../../components/errors/SafeErrorBoundary";
|
|
5
|
+
import { withBasePath } from "../../lib/basePath";
|
|
6
|
+
import { installChunkLoadRecovery } from "../../lib/chunkLoadRecovery";
|
|
7
|
+
|
|
8
|
+
export const Route = createRootRoute({
|
|
9
|
+
component: RootComponent,
|
|
10
|
+
errorComponent: RootRouteErrorComponent,
|
|
11
|
+
notFoundComponent: RootNotFoundComponent,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
function UiProviders({ children }: Readonly<{ children: ReactNode }>) {
|
|
15
|
+
return (
|
|
16
|
+
<SWRConfig value={{ revalidateOnFocus: false, revalidateIfStale: false }}>{children}</SWRConfig>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function RootComponent() {
|
|
21
|
+
useEffect(() => installChunkLoadRecovery(), []);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<UiProviders>
|
|
25
|
+
<SafeErrorBoundary
|
|
26
|
+
scope="root-render"
|
|
27
|
+
title="Agent Inspector could not continue"
|
|
28
|
+
description="The application stopped this render safely. Retry or reload Inspector."
|
|
29
|
+
variant="page"
|
|
30
|
+
>
|
|
31
|
+
<Outlet />
|
|
32
|
+
</SafeErrorBoundary>
|
|
33
|
+
</UiProviders>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function RootRouteErrorComponent({ error, reset }: { error: Error; reset: () => void }) {
|
|
38
|
+
return (
|
|
39
|
+
<UiProviders>
|
|
40
|
+
<SafeRouteError error={error} reset={reset} scope="root-route" />
|
|
41
|
+
</UiProviders>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function RootNotFoundComponent() {
|
|
46
|
+
return (
|
|
47
|
+
<UiProviders>
|
|
48
|
+
<main className="min-h-screen bg-background text-foreground">
|
|
49
|
+
<div className="mx-auto flex min-h-screen w-full max-w-3xl flex-col justify-center px-6 py-16">
|
|
50
|
+
<div className="rounded-lg border border-border/70 bg-card/60 p-8 shadow-sm">
|
|
51
|
+
<div className="font-mono text-xs uppercase tracking-wider text-muted-foreground">
|
|
52
|
+
404
|
|
53
|
+
</div>
|
|
54
|
+
<h1 className="mt-3 text-2xl font-semibold">Page not found</h1>
|
|
55
|
+
<p className="mt-3 max-w-xl text-sm leading-6 text-muted-foreground">
|
|
56
|
+
This route is not part of the Agent Inspector UI.
|
|
57
|
+
</p>
|
|
58
|
+
<a
|
|
59
|
+
href={withBasePath("/")}
|
|
60
|
+
className="mt-6 inline-flex h-9 items-center justify-center rounded-md bg-primary px-4 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90"
|
|
61
|
+
>
|
|
62
|
+
Open Agent Inspector
|
|
63
|
+
</a>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
</main>
|
|
67
|
+
</UiProviders>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { createFileRoute } from "@tanstack/react-router";
|
|
2
2
|
import { useEffect, useState, type JSX } from "react";
|
|
3
|
-
import { SafeRouteError } from "
|
|
4
|
-
import { ProxyViewerContainer } from "
|
|
3
|
+
import { SafeRouteError } from "../../components/errors/SafeErrorBoundary";
|
|
4
|
+
import { ProxyViewerContainer } from "../../components/ProxyViewerContainer";
|
|
5
5
|
|
|
6
6
|
export const Route = createFileRoute("/")({
|
|
7
|
-
ssr: false,
|
|
8
7
|
component: ClientOnlyProxyViewerRoute,
|
|
9
8
|
errorComponent: HomeRouteError,
|
|
10
9
|
});
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import { createFileRoute } from "@tanstack/react-router";
|
|
2
2
|
import { useEffect, useState, type JSX } from "react";
|
|
3
|
-
import { SafeRouteError } from "
|
|
4
|
-
import { ProxyViewerContainer } from "
|
|
5
|
-
import { decodeSessionIdFromPath, encodeSessionIdForPath } from "
|
|
3
|
+
import { SafeRouteError } from "../../../components/errors/SafeErrorBoundary";
|
|
4
|
+
import { ProxyViewerContainer } from "../../../components/ProxyViewerContainer";
|
|
5
|
+
import { decodeSessionIdFromPath, encodeSessionIdForPath } from "../../../lib/sessionUrl";
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* Per-session deep link: opens a page that is pre-scoped to a single
|
|
9
|
-
* session id. The path segment is base64url-encoded so JSON session blobs
|
|
10
|
-
* and Unicode project paths survive dev-server URL normalization.
|
|
11
|
-
*/
|
|
12
7
|
export const Route = createFileRoute("/session/$sessionId")({
|
|
13
|
-
ssr: false,
|
|
14
8
|
component: SessionViewerRoute,
|
|
15
9
|
errorComponent: SessionRouteError,
|
|
16
10
|
parseParams: (params) => ({
|
|
@@ -41,9 +35,9 @@ function ClientOnlySessionViewer({ sessionId }: { sessionId: string }): JSX.Elem
|
|
|
41
35
|
return (
|
|
42
36
|
<main className="min-h-screen bg-background text-foreground">
|
|
43
37
|
<div className="mx-auto flex min-h-screen w-full max-w-2xl flex-col justify-center px-6 py-16 text-center">
|
|
44
|
-
<div className="border border-border bg-card
|
|
38
|
+
<div className="rounded-[8px] border border-border bg-card px-4 py-8 shadow-sm">
|
|
45
39
|
<p className="text-sm font-medium text-muted-foreground">Loading session data...</p>
|
|
46
|
-
<p className="mt-3 inline-block max-w-full rounded bg-muted px-3 py-1 font-mono text-xs
|
|
40
|
+
<p className="mt-3 inline-block max-w-full break-all rounded bg-muted px-3 py-1 font-mono text-xs text-muted-foreground">
|
|
47
41
|
{sessionId}
|
|
48
42
|
</p>
|
|
49
43
|
</div>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { fetchWithTimeout } from "../lib/apiClient";
|
|
2
|
+
import {
|
|
3
|
+
acceptBrowserRuntimeDiscovery,
|
|
4
|
+
resolveBrowserRuntimeForDocument,
|
|
5
|
+
type BrowserRuntimeResolution,
|
|
6
|
+
} from "../lib/browserRuntimeResolver";
|
|
7
|
+
|
|
8
|
+
const RUNTIME_DISCOVERY_TIMEOUT_MS = 2_000;
|
|
9
|
+
type RuntimeDiscoveryRequest = () => Promise<Response>;
|
|
10
|
+
|
|
11
|
+
function requestRuntimeDiscovery(): Promise<Response> {
|
|
12
|
+
return fetchWithTimeout("/api/runtime", RUNTIME_DISCOVERY_TIMEOUT_MS, {
|
|
13
|
+
cache: "no-store",
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function discoveryFailure(issue: string): BrowserRuntimeResolution {
|
|
18
|
+
return {
|
|
19
|
+
ok: false,
|
|
20
|
+
source: "discovered",
|
|
21
|
+
code: "invalid",
|
|
22
|
+
issues: [issue],
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Validate the backend discovery document before same-origin fallback values
|
|
28
|
+
* are exposed as verified Coding Agent endpoints. Injected/operator contracts
|
|
29
|
+
* are already schema-validated and need no discovery round trip.
|
|
30
|
+
*/
|
|
31
|
+
export async function validateBrowserRuntimeForStartup(
|
|
32
|
+
request: RuntimeDiscoveryRequest = requestRuntimeDiscovery,
|
|
33
|
+
): Promise<BrowserRuntimeResolution> {
|
|
34
|
+
const fallback = resolveBrowserRuntimeForDocument();
|
|
35
|
+
if (!fallback.ok || fallback.source !== "composed-fallback") return fallback;
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
const response = await request();
|
|
39
|
+
if (!response.ok) {
|
|
40
|
+
return discoveryFailure(
|
|
41
|
+
`Backend runtime discovery returned HTTP ${String(response.status)}.`,
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
const value: unknown = await response.json();
|
|
45
|
+
return acceptBrowserRuntimeDiscovery(fallback.runtime, value);
|
|
46
|
+
} catch (error) {
|
|
47
|
+
const message = error instanceof Error ? error.message : "unknown discovery failure";
|
|
48
|
+
return discoveryFailure(`Backend runtime discovery failed: ${message}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
package/styles/globals.css
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
@import "tw-animate-css";
|
|
3
3
|
@import "./themes.css";
|
|
4
4
|
@plugin "@tailwindcss/typography";
|
|
5
|
+
@source "../src";
|
|
5
6
|
|
|
6
7
|
@custom-variant dark (&:where([data-theme="dark"], [data-theme="dark"] *));
|
|
7
8
|
@custom-variant eye-care (&:where([data-theme="eye-care"], [data-theme="eye-care"] *));
|