@tonyclaw/agent-inspector 3.1.32 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.output/backend/nitro.json +1 -1
- package/.output/cli.js +241 -120
- package/.output/server/_ssr/index.mjs +1 -1
- package/.output/server/_ssr/{router-oXUk3MBR.mjs → router-BBY_zWRK.mjs} +91 -3
- package/.output/server/index.mjs +1 -1
- package/.output/ui/assets/{CompareDrawer-BtfPSpkV.js → CompareDrawer-rtNElN-B.js} +1 -1
- package/.output/ui/assets/{InspectorPet-D9DPPQ3n.js → InspectorPet-QaAiuF3d.js} +1 -1
- package/.output/ui/assets/{ProxyViewerContainer-Buu8vkCK.js → ProxyViewerContainer-6twNZHwl.js} +4 -4
- package/.output/ui/assets/{ReplayDialog-BER-QzpD.js → ReplayDialog-B7KlziO2.js} +1 -1
- package/.output/ui/assets/{RequestAnatomy-C8Zwxrr7.js → RequestAnatomy-2XVFBrW4.js} +1 -1
- package/.output/ui/assets/{ResponseView-DDpKdYk6.js → ResponseView-BULgzLVB.js} +1 -1
- package/.output/ui/assets/{StreamingChunkSequence-sMPGG7Sw.js → StreamingChunkSequence-DSkvkbns.js} +1 -1
- package/.output/ui/assets/{_sessionId-e4IheHnP.js → _sessionId-D2dmJi3G.js} +1 -1
- package/.output/ui/assets/{_sessionId-C5Uv72Fx.js → _sessionId-DcS0s1Mr.js} +1 -1
- package/.output/ui/assets/{index-B__qT0Yd.js → index-B0TN1KKO.js} +2 -2
- package/.output/ui/assets/{index-Be3bTCzi.js → index-Bva1zHEs.js} +1 -1
- package/.output/ui/assets/{index-C9q__p8J.js → index-BzBExOxu.js} +1 -1
- package/.output/ui/assets/{index-CtB0deSZ.js → index-k6sRQz55.js} +1 -1
- package/.output/ui/assets/{json-viewer-Db0AFp-7.js → json-viewer-CWM4tY-j.js} +1 -1
- package/.output/ui/assets/{jszip.min-DkY0Ym_q.js → jszip.min-BkWvRFlo.js} +1 -1
- package/.output/ui/index.html +1 -1
- package/package.json +8 -13
- package/src/assets/IDE/claudecode-color.svg +0 -1
- package/src/assets/IDE/codex-color.svg +0 -1
- package/src/assets/IDE/opencode.svg +0 -1
- package/src/assets/IDE/xiaomimimo.svg +0 -1
- package/src/assets/favicon.svg +0 -21
- package/src/assets/logos/alibaba.svg +0 -1
- package/src/assets/logos/anthropic.svg +0 -1
- package/src/assets/logos/claude-code.svg +0 -4
- package/src/assets/logos/deepseek.svg +0 -1
- package/src/assets/logos/minimax.jpeg +0 -0
- package/src/assets/logos/openai.svg +0 -1
- package/src/assets/logos/opencode.svg +0 -4
- package/src/assets/logos/qwen.webp +0 -0
- package/src/assets/logos/zhipuai.svg +0 -219
- package/src/backend/router.tsx +0 -36
- package/src/backend/routes/$.ts +0 -26
- package/src/backend/routes/__root.ts +0 -4
- package/src/backend/routes/api/-instances.ts +0 -7
- package/src/backend/routes/api/alerts.summary.ts +0 -28
- package/src/backend/routes/api/alerts.ts +0 -70
- package/src/backend/routes/api/config.paths.ts +0 -14
- package/src/backend/routes/api/config.ts +0 -73
- package/src/backend/routes/api/ecosystem.packages.$packageId.help.ts +0 -11
- package/src/backend/routes/api/ecosystem.packages.$packageId.install.ts +0 -11
- package/src/backend/routes/api/ecosystem.packages.$packageId.runner-presets.ts +0 -11
- package/src/backend/routes/api/ecosystem.packages.$packageId.upgrade.ts +0 -11
- package/src/backend/routes/api/ecosystem.packages.ts +0 -21
- package/src/backend/routes/api/ecosystem.recipes.$recipeId.run.ts +0 -11
- package/src/backend/routes/api/ecosystem.tasks.$taskId.ts +0 -16
- package/src/backend/routes/api/ecosystem.tasks.ts +0 -12
- package/src/backend/routes/api/groups.$groupId.evidence.ts +0 -55
- package/src/backend/routes/api/groups.$groupId.sessions.ts +0 -50
- package/src/backend/routes/api/groups.$groupId.ts +0 -93
- package/src/backend/routes/api/groups.ts +0 -79
- package/src/backend/routes/api/health.ts +0 -22
- package/src/backend/routes/api/instances.$name.connection.ts +0 -12
- package/src/backend/routes/api/instances.$name.restart.ts +0 -23
- package/src/backend/routes/api/instances.$name.start.ts +0 -18
- package/src/backend/routes/api/instances.$name.stop.ts +0 -23
- package/src/backend/routes/api/instances.$name.ts +0 -12
- package/src/backend/routes/api/instances.ts +0 -16
- package/src/backend/routes/api/knowledge.candidates.$candidateId.promote.ts +0 -32
- package/src/backend/routes/api/knowledge.candidates.$candidateId.ts +0 -50
- package/src/backend/routes/api/knowledge.candidates.ts +0 -10
- package/src/backend/routes/api/knowledge.project-context.ts +0 -29
- package/src/backend/routes/api/knowledge.search.ts +0 -62
- package/src/backend/routes/api/knowledge.sessions.$sessionId.candidates.ts +0 -26
- package/src/backend/routes/api/logs.$id.body.ts +0 -58
- package/src/backend/routes/api/logs.$id.chunks.ts +0 -37
- package/src/backend/routes/api/logs.$id.replay.ts +0 -297
- package/src/backend/routes/api/logs.$id.ts +0 -23
- package/src/backend/routes/api/logs.import.ts +0 -39
- package/src/backend/routes/api/logs.stream.ts +0 -174
- package/src/backend/routes/api/logs.ts +0 -214
- package/src/backend/routes/api/mcp.ts +0 -25
- package/src/backend/routes/api/models.ts +0 -10
- package/src/backend/routes/api/pi-agent.ts +0 -29
- package/src/backend/routes/api/providers.$providerId.model-metadata.ts +0 -173
- package/src/backend/routes/api/providers.$providerId.test.log.ts +0 -342
- package/src/backend/routes/api/providers.$providerId.ts +0 -111
- package/src/backend/routes/api/providers.export.ts +0 -44
- package/src/backend/routes/api/providers.import.ts +0 -81
- package/src/backend/routes/api/providers.scan.ts +0 -28
- package/src/backend/routes/api/providers.ts +0 -102
- package/src/backend/routes/api/runs.$runId.evidence.ts +0 -55
- package/src/backend/routes/api/runs.$runId.ts +0 -50
- package/src/backend/routes/api/runs.ts +0 -62
- package/src/backend/routes/api/runtime.ts +0 -46
- package/src/backend/routes/api/sessions.ts +0 -51
- package/src/backend/routes/api/storage.ts +0 -56
- package/src/backend/routes/livez.ts +0 -13
- package/src/backend/routes/metrics.ts +0 -14
- package/src/backend/routes/proxy/$.ts +0 -15
- package/src/backend/routes/readyz.ts +0 -18
- package/src/backend/start.ts +0 -10
- package/src/cli/alias.ts +0 -431
- package/src/cli/detect-tools.ts +0 -123
- package/src/cli/doctor.ts +0 -836
- package/src/cli/instance.ts +0 -1071
- package/src/cli/instanceApi.ts +0 -213
- package/src/cli/instanceArgs.ts +0 -301
- package/src/cli/instanceControl.ts +0 -191
- package/src/cli/instanceModel.ts +0 -276
- package/src/cli/instanceRegistry.ts +0 -731
- package/src/cli/networkHints.ts +0 -170
- package/src/cli/onboard.ts +0 -1668
- package/src/cli/onboardTarget.ts +0 -228
- package/src/cli/rustBackendPackage.ts +0 -458
- package/src/cli/startupOutput.ts +0 -16
- package/src/cli/templates/codex-skill-onboard.ts +0 -320
- package/src/cli/templates/command-onboard.ts +0 -25
- package/src/cli/templates/skill-onboard.ts +0 -625
- package/src/cli.ts +0 -1397
- package/src/components/OnboardingBanner.tsx +0 -115
- package/src/components/ProxyViewer.tsx +0 -2259
- package/src/components/ProxyViewerContainer.tsx +0 -1076
- package/src/components/alerts/AlertsDialog.tsx +0 -615
- package/src/components/clients/ClientLogo.tsx +0 -175
- package/src/components/ecosystem/AgentLabDialog.tsx +0 -947
- package/src/components/errors/SafeErrorBoundary.tsx +0 -201
- package/src/components/groups/GroupsDialog.tsx +0 -1304
- package/src/components/inspector-pet/InspectorPet.tsx +0 -398
- package/src/components/inspector-pet/InspectorPetCrab3D.tsx +0 -455
- package/src/components/inspector-pet/inspectorPetLogic.ts +0 -272
- package/src/components/pi-agent/PiAgentPanel.tsx +0 -446
- package/src/components/pi-agent/piAgentChatLogic.ts +0 -273
- package/src/components/providers/ImportWizardDialog.tsx +0 -281
- package/src/components/providers/ProviderCard.tsx +0 -347
- package/src/components/providers/ProviderForm.tsx +0 -1183
- package/src/components/providers/ProviderLogo.tsx +0 -122
- package/src/components/providers/ProviderTestResultsView.tsx +0 -734
- package/src/components/providers/ProvidersPanel.tsx +0 -714
- package/src/components/providers/SettingsDialog.tsx +0 -1042
- package/src/components/providers/providerFormCapabilities.ts +0 -36
- package/src/components/proxy-viewer/AgentTraceSummary.tsx +0 -902
- package/src/components/proxy-viewer/AnswerMarkdown.tsx +0 -51
- package/src/components/proxy-viewer/ApplicationBar.tsx +0 -123
- package/src/components/proxy-viewer/CompareDrawer.tsx +0 -984
- package/src/components/proxy-viewer/ConversationGroup.tsx +0 -208
- package/src/components/proxy-viewer/ConversationGroupList.tsx +0 -652
- package/src/components/proxy-viewer/ConversationHeader.tsx +0 -429
- package/src/components/proxy-viewer/LiveConnectionStatus.tsx +0 -186
- package/src/components/proxy-viewer/LogEntry.tsx +0 -1419
- package/src/components/proxy-viewer/LogEntryHeader.tsx +0 -596
- package/src/components/proxy-viewer/ProviderLogoStack.tsx +0 -57
- package/src/components/proxy-viewer/RawExportWarning.tsx +0 -77
- package/src/components/proxy-viewer/ReplayDialog.tsx +0 -636
- package/src/components/proxy-viewer/RequestToolsPanel.tsx +0 -299
- package/src/components/proxy-viewer/ResponseView.tsx +0 -202
- package/src/components/proxy-viewer/SessionLoadProgressBar.tsx +0 -61
- package/src/components/proxy-viewer/StreamingChunkSequence.tsx +0 -265
- package/src/components/proxy-viewer/ThreadConnector.tsx +0 -165
- package/src/components/proxy-viewer/ToolTraceEvents.tsx +0 -64
- package/src/components/proxy-viewer/TurnGroup.tsx +0 -383
- package/src/components/proxy-viewer/TurnGroupList.tsx +0 -156
- package/src/components/proxy-viewer/accessibility.ts +0 -8
- package/src/components/proxy-viewer/anatomy/RequestAnatomy.tsx +0 -887
- package/src/components/proxy-viewer/anatomy/SegmentBar.tsx +0 -222
- package/src/components/proxy-viewer/anatomy/contextIntelligence.ts +0 -737
- package/src/components/proxy-viewer/anatomy/sessionContextSummary.ts +0 -268
- package/src/components/proxy-viewer/anatomy/tokenEstimate.ts +0 -53
- package/src/components/proxy-viewer/anatomy/types.ts +0 -41
- package/src/components/proxy-viewer/anatomy/useAnatomyJump.ts +0 -114
- package/src/components/proxy-viewer/bodyHydration.ts +0 -123
- package/src/components/proxy-viewer/cacheTrend.ts +0 -50
- package/src/components/proxy-viewer/diff/DiffView.tsx +0 -321
- package/src/components/proxy-viewer/diff/computeDiff.ts +0 -178
- package/src/components/proxy-viewer/diff/index.ts +0 -3
- package/src/components/proxy-viewer/formats/anthropic/ContentBlocks.tsx +0 -194
- package/src/components/proxy-viewer/formats/anthropic/ResponseView.tsx +0 -81
- package/src/components/proxy-viewer/formats/anthropic/thinkingExtract.ts +0 -21
- package/src/components/proxy-viewer/formats/index.tsx +0 -47
- package/src/components/proxy-viewer/formats/openai/ResponseView.tsx +0 -442
- package/src/components/proxy-viewer/index.ts +0 -9
- package/src/components/proxy-viewer/lazy.ts +0 -41
- package/src/components/proxy-viewer/liveConnectionState.ts +0 -158
- package/src/components/proxy-viewer/log-formats/anthropic.ts +0 -191
- package/src/components/proxy-viewer/log-formats/index.ts +0 -23
- package/src/components/proxy-viewer/log-formats/openai.ts +0 -256
- package/src/components/proxy-viewer/log-formats/types.ts +0 -40
- package/src/components/proxy-viewer/log-formats/unknown.ts +0 -18
- package/src/components/proxy-viewer/logEntryVisibility.ts +0 -73
- package/src/components/proxy-viewer/logFocus.ts +0 -54
- package/src/components/proxy-viewer/proxyViewerContainerLogic.ts +0 -124
- package/src/components/proxy-viewer/proxyViewerLogic.ts +0 -488
- package/src/components/proxy-viewer/replayComparison.ts +0 -131
- package/src/components/proxy-viewer/requestDiff.ts +0 -277
- package/src/components/proxy-viewer/requestTools.ts +0 -220
- package/src/components/proxy-viewer/useCopyFeedback.ts +0 -38
- package/src/components/proxy-viewer/useKeyboardNavigation.ts +0 -232
- package/src/components/proxy-viewer/viewerState.ts +0 -176
- package/src/components/ui/badge.tsx +0 -47
- package/src/components/ui/button.tsx +0 -47
- package/src/components/ui/collapsible.tsx +0 -21
- package/src/components/ui/confirm-dialog.tsx +0 -51
- package/src/components/ui/crab-logo.tsx +0 -45
- package/src/components/ui/crab-variants.tsx +0 -467
- package/src/components/ui/dialog.tsx +0 -130
- package/src/components/ui/icon-trigger.ts +0 -2
- package/src/components/ui/json-viewer-bulk.ts +0 -132
- package/src/components/ui/json-viewer.tsx +0 -508
- package/src/components/ui/scroll-area.tsx +0 -54
- package/src/components/ui/select.tsx +0 -178
- package/src/components/ui/separator.tsx +0 -28
- package/src/components/ui/tabs.tsx +0 -88
- package/src/components/ui/tooltip.tsx +0 -51
- package/src/components/ui/transient-toast.tsx +0 -105
- package/src/contracts/anthropic.ts +0 -230
- package/src/contracts/index.ts +0 -59
- package/src/contracts/json.ts +0 -37
- package/src/contracts/log.ts +0 -139
- package/src/contracts/openai.ts +0 -267
- package/src/index.css +0 -11
- package/src/knowledge/candidateStore.ts +0 -94
- package/src/knowledge/distiller.ts +0 -98
- package/src/knowledge/openclawClient.ts +0 -161
- package/src/knowledge/openclawGatewayClient.ts +0 -249
- package/src/knowledge/openclawMarkdown.ts +0 -146
- package/src/knowledge/redactor.ts +0 -80
- package/src/knowledge/types.ts +0 -83
- package/src/lib/alertContract.ts +0 -76
- package/src/lib/apiClient.ts +0 -166
- package/src/lib/apiFormat.ts +0 -29
- package/src/lib/backendImplementation.ts +0 -16
- package/src/lib/basePath.ts +0 -107
- package/src/lib/browserRuntimeContract.ts +0 -124
- package/src/lib/browserRuntimeResolver.ts +0 -333
- package/src/lib/chunkLoadRecovery.ts +0 -83
- package/src/lib/claudeCodeStrip.ts +0 -98
- package/src/lib/clipboard.ts +0 -67
- package/src/lib/codingAgentEndpoints.ts +0 -54
- package/src/lib/ecosystemContract.ts +0 -130
- package/src/lib/export-logs.ts +0 -287
- package/src/lib/groupContract.ts +0 -166
- package/src/lib/instanceContract.ts +0 -239
- package/src/lib/jsonFile.ts +0 -46
- package/src/lib/logImportContract.ts +0 -12
- package/src/lib/managedInstance.ts +0 -112
- package/src/lib/mask.ts +0 -4
- package/src/lib/objectUtils.ts +0 -22
- package/src/lib/piAgentContract.ts +0 -102
- package/src/lib/providerContract.ts +0 -125
- package/src/lib/providerImportContract.ts +0 -27
- package/src/lib/providerModelMetadata.ts +0 -458
- package/src/lib/providerTestContract.ts +0 -170
- package/src/lib/providerTestPrompt.ts +0 -100
- package/src/lib/publicBasePathContext.ts +0 -137
- package/src/lib/resourceLimits.ts +0 -345
- package/src/lib/runContract.ts +0 -164
- package/src/lib/runtimeConfig.ts +0 -43
- package/src/lib/safeDiagnostic.ts +0 -38
- package/src/lib/safeFetch.ts +0 -508
- package/src/lib/serverPort.ts +0 -47
- package/src/lib/sessionInfoContract.ts +0 -78
- package/src/lib/sessionUrl.ts +0 -46
- package/src/lib/ssrfGuard.ts +0 -133
- package/src/lib/stopReason.ts +0 -130
- package/src/lib/themeMode.ts +0 -41
- package/src/lib/timeDisplay.ts +0 -22
- package/src/lib/toolTrace.ts +0 -290
- package/src/lib/uiScale.ts +0 -117
- package/src/lib/unknown.ts +0 -27
- package/src/lib/upstreamUrl.ts +0 -150
- package/src/lib/useAlerts.ts +0 -82
- package/src/lib/useGroupEvidence.ts +0 -37
- package/src/lib/useGroups.ts +0 -32
- package/src/lib/useOnboarding.ts +0 -93
- package/src/lib/useProviders.ts +0 -30
- package/src/lib/useStripConfig.ts +0 -154
- package/src/lib/useThemeMode.ts +0 -40
- package/src/lib/useUiScale.ts +0 -52
- package/src/lib/utils.ts +0 -78
- package/src/mcp/currentContext.ts +0 -65
- package/src/mcp/instanceHandlers.ts +0 -151
- package/src/mcp/loopback.ts +0 -88
- package/src/mcp/mode.ts +0 -75
- package/src/mcp/previewExtractor.ts +0 -233
- package/src/mcp/server.ts +0 -2274
- package/src/mcp/toolHandlers.ts +0 -1533
- package/src/proxy/alerts.ts +0 -664
- package/src/proxy/chunkStorage.ts +0 -123
- package/src/proxy/config.ts +0 -218
- package/src/proxy/constants.ts +0 -66
- package/src/proxy/dataDir.ts +0 -147
- package/src/proxy/ecosystemExecutionConfirmation.ts +0 -114
- package/src/proxy/ecosystemExecutionRoute.ts +0 -116
- package/src/proxy/ecosystemRegistry.ts +0 -296
- package/src/proxy/ecosystemTasks.ts +0 -415
- package/src/proxy/evidenceAnalysis.ts +0 -526
- package/src/proxy/evidenceExporter.ts +0 -235
- package/src/proxy/formats/anthropic/anthropicProvider.ts +0 -75
- package/src/proxy/formats/anthropic/handler.ts +0 -75
- package/src/proxy/formats/anthropic/index.ts +0 -13
- package/src/proxy/formats/anthropic/register.ts +0 -4
- package/src/proxy/formats/anthropic/schemas.ts +0 -6
- package/src/proxy/formats/anthropic/stream.ts +0 -205
- package/src/proxy/formats/handler.ts +0 -46
- package/src/proxy/formats/index.ts +0 -13
- package/src/proxy/formats/jsonSchema.ts +0 -2
- package/src/proxy/formats/openai/alibabaProvider.ts +0 -34
- package/src/proxy/formats/openai/codexMetadata.ts +0 -61
- package/src/proxy/formats/openai/handler.ts +0 -133
- package/src/proxy/formats/openai/index.ts +0 -33
- package/src/proxy/formats/openai/provider.ts +0 -50
- package/src/proxy/formats/openai/register.ts +0 -4
- package/src/proxy/formats/openai/schemas.ts +0 -25
- package/src/proxy/formats/openai/stream.ts +0 -600
- package/src/proxy/formats/openai/zhipuProvider.ts +0 -31
- package/src/proxy/formats/providerAdapter.ts +0 -50
- package/src/proxy/formats/providerRegistry.ts +0 -51
- package/src/proxy/formats/providers/index.ts +0 -3
- package/src/proxy/formats/registry.ts +0 -65
- package/src/proxy/groupEvidenceExporter.ts +0 -371
- package/src/proxy/groupStore.ts +0 -336
- package/src/proxy/handler.ts +0 -729
- package/src/proxy/identityProxy.ts +0 -1842
- package/src/proxy/jsonlRecovery.ts +0 -554
- package/src/proxy/logBodyChunks.ts +0 -91
- package/src/proxy/logFinalizer.ts +0 -777
- package/src/proxy/logFinalizer.worker.ts +0 -24
- package/src/proxy/logImportUpload.ts +0 -128
- package/src/proxy/logImporter.ts +0 -813
- package/src/proxy/logIndex.ts +0 -663
- package/src/proxy/logSearch.ts +0 -122
- package/src/proxy/logger.ts +0 -537
- package/src/proxy/openaiOrphanToolStrip.ts +0 -142
- package/src/proxy/platformCommands.ts +0 -253
- package/src/proxy/privateDataPath.ts +0 -419
- package/src/proxy/providerImporters.ts +0 -578
- package/src/proxy/providerScanStore.ts +0 -87
- package/src/proxy/providerSecretStore.ts +0 -216
- package/src/proxy/providers.ts +0 -998
- package/src/proxy/rawStreamCapture.ts +0 -342
- package/src/proxy/runFailures.ts +0 -94
- package/src/proxy/runStore.ts +0 -214
- package/src/proxy/runtimeAdmission.ts +0 -55
- package/src/proxy/runtimeHealth.ts +0 -221
- package/src/proxy/runtimeMetrics.ts +0 -149
- package/src/proxy/runtimeShutdown.ts +0 -157
- package/src/proxy/schemas.ts +0 -112
- package/src/proxy/sessionArchive.ts +0 -479
- package/src/proxy/sessionInfo.ts +0 -266
- package/src/proxy/sessionProcess.ts +0 -194
- package/src/proxy/sessionRuntime.ts +0 -121
- package/src/proxy/sessionSupervisor.ts +0 -305
- package/src/proxy/sessionWorkerEntry.ts +0 -26
- package/src/proxy/shutdownCoordinator.ts +0 -90
- package/src/proxy/socketTracker.ts +0 -639
- package/src/proxy/sqliteLogIndex.ts +0 -733
- package/src/proxy/storageLifecycle.ts +0 -432
- package/src/proxy/store.ts +0 -1773
- package/src/proxy/streamTiming.ts +0 -31
- package/src/proxy/toolSchemaWarnings.ts +0 -529
- package/src/proxy/uiAssetServer.ts +0 -106
- package/src/proxy/upstream.ts +0 -127
- package/src/services/alerts.ts +0 -12
- package/src/services/groups.ts +0 -119
- package/src/services/piAgent.ts +0 -421
- package/src/services/piAgentRetrieval.ts +0 -1180
- package/src/services/result.ts +0 -17
- package/src/services/runs.ts +0 -76
- package/src/ui/bootstrap.ts +0 -167
- package/src/ui/index.html +0 -38
- package/src/ui/logsStreamClient.ts +0 -20
- package/src/ui/main.tsx +0 -13
- package/src/ui/public/runtime-config.js +0 -2
- package/src/ui/router.tsx +0 -13
- package/src/ui/routes/__root.tsx +0 -69
- package/src/ui/routes/index.tsx +0 -35
- package/src/ui/routes/session/$sessionId.tsx +0 -50
- package/src/ui/runtimeDiscovery.ts +0 -50
package/src/services/result.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export type ServiceErrorCode = "not-found" | "not-exported";
|
|
2
|
-
|
|
3
|
-
export type ServiceResult<T> =
|
|
4
|
-
| { ok: true; value: T }
|
|
5
|
-
| { ok: false; code: ServiceErrorCode; status: number; message: string };
|
|
6
|
-
|
|
7
|
-
export function serviceOk<T>(value: T): ServiceResult<T> {
|
|
8
|
-
return { ok: true, value };
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function serviceError(
|
|
12
|
-
code: ServiceErrorCode,
|
|
13
|
-
status: number,
|
|
14
|
-
message: string,
|
|
15
|
-
): ServiceResult<never> {
|
|
16
|
-
return { ok: false, code, status, message };
|
|
17
|
-
}
|
package/src/services/runs.ts
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type CreateInspectorRunInput,
|
|
3
|
-
type EvidenceExportOptions,
|
|
4
|
-
type EvidenceExportResult,
|
|
5
|
-
type InspectorRun,
|
|
6
|
-
type InspectorRunEvidence,
|
|
7
|
-
type RecentFailuresResponse,
|
|
8
|
-
type UpdateInspectorRunInput,
|
|
9
|
-
} from "../lib/runContract";
|
|
10
|
-
import { exportRunEvidence, readEvidenceMarkdown } from "../proxy/evidenceExporter";
|
|
11
|
-
import { RECENT_FAILURES_DEFAULT_LIMIT, listRecentFailures } from "../proxy/runFailures";
|
|
12
|
-
import { createRun, getRun, listRuns, updateRun } from "../proxy/runStore";
|
|
13
|
-
import { serviceError, serviceOk, type ServiceResult } from "./result";
|
|
14
|
-
|
|
15
|
-
export type InspectorRunsList = {
|
|
16
|
-
runs: InspectorRun[];
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export type RunEvidenceRead = {
|
|
20
|
-
run: InspectorRun;
|
|
21
|
-
evidence: InspectorRunEvidence;
|
|
22
|
-
markdown: string;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export function listInspectorRuns(): InspectorRunsList {
|
|
26
|
-
return { runs: listRuns() };
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function createInspectorRun(input: CreateInspectorRunInput): InspectorRun {
|
|
30
|
-
return createRun(input);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function getInspectorRun(runId: string): ServiceResult<InspectorRun> {
|
|
34
|
-
const run = getRun(runId);
|
|
35
|
-
if (run === null) return serviceError("not-found", 404, "Run not found");
|
|
36
|
-
return serviceOk(run);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export function updateInspectorRun(
|
|
40
|
-
runId: string,
|
|
41
|
-
input: UpdateInspectorRunInput,
|
|
42
|
-
): ServiceResult<InspectorRun> {
|
|
43
|
-
const run = updateRun(runId, input);
|
|
44
|
-
if (run === null) return serviceError("not-found", 404, "Run not found");
|
|
45
|
-
return serviceOk(run);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export function listInspectorRecentFailures(
|
|
49
|
-
limit: number = RECENT_FAILURES_DEFAULT_LIMIT,
|
|
50
|
-
): RecentFailuresResponse {
|
|
51
|
-
return listRecentFailures(limit);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export { RECENT_FAILURES_DEFAULT_LIMIT };
|
|
55
|
-
|
|
56
|
-
export async function exportInspectorRunEvidence(
|
|
57
|
-
runId: string,
|
|
58
|
-
options: EvidenceExportOptions,
|
|
59
|
-
baseUrl: string,
|
|
60
|
-
): Promise<ServiceResult<EvidenceExportResult>> {
|
|
61
|
-
const run = getRun(runId);
|
|
62
|
-
if (run === null) return serviceError("not-found", 404, "Run not found");
|
|
63
|
-
return serviceOk(await exportRunEvidence(run, options, baseUrl));
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export function readInspectorRunEvidence(runId: string): ServiceResult<RunEvidenceRead> {
|
|
67
|
-
const run = getRun(runId);
|
|
68
|
-
if (run === null) return serviceError("not-found", 404, "Run not found");
|
|
69
|
-
|
|
70
|
-
const markdown = readEvidenceMarkdown(run);
|
|
71
|
-
if (run.evidence === null || markdown === null) {
|
|
72
|
-
return serviceError("not-exported", 404, "Evidence has not been exported for this run");
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return serviceOk({ run, evidence: run.evidence, markdown });
|
|
76
|
-
}
|
package/src/ui/bootstrap.ts
DELETED
|
@@ -1,167 +0,0 @@
|
|
|
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
|
-
`;
|
package/src/ui/index.html
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
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>
|
|
@@ -1,20 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
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();
|
package/src/ui/router.tsx
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
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();
|
package/src/ui/routes/__root.tsx
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
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
|
-
}
|
package/src/ui/routes/index.tsx
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { createFileRoute } from "@tanstack/react-router";
|
|
2
|
-
import { useEffect, useState, type JSX } from "react";
|
|
3
|
-
import { SafeRouteError } from "../../components/errors/SafeErrorBoundary";
|
|
4
|
-
import { ProxyViewerContainer } from "../../components/ProxyViewerContainer";
|
|
5
|
-
|
|
6
|
-
export const Route = createFileRoute("/")({
|
|
7
|
-
component: ClientOnlyProxyViewerRoute,
|
|
8
|
-
errorComponent: HomeRouteError,
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
function HomeRouteError({ error, reset }: { error: Error; reset: () => void }): JSX.Element {
|
|
12
|
-
return <SafeRouteError error={error} reset={reset} scope="home-route" />;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function ClientOnlyProxyViewerRoute(): JSX.Element {
|
|
16
|
-
const [mounted, setMounted] = useState(false);
|
|
17
|
-
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
setMounted(true);
|
|
20
|
-
}, []);
|
|
21
|
-
|
|
22
|
-
if (!mounted) {
|
|
23
|
-
return (
|
|
24
|
-
<main className="min-h-screen bg-background text-foreground">
|
|
25
|
-
<div className="mx-auto flex min-h-screen w-full max-w-2xl flex-col justify-center px-6 py-16 text-center">
|
|
26
|
-
<div className="rounded-[8px] border border-border bg-card px-4 py-8 shadow-sm">
|
|
27
|
-
<p className="text-sm font-medium text-muted-foreground">Loading Inspector...</p>
|
|
28
|
-
</div>
|
|
29
|
-
</div>
|
|
30
|
-
</main>
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return <ProxyViewerContainer />;
|
|
35
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { createFileRoute } from "@tanstack/react-router";
|
|
2
|
-
import { useEffect, useState, type JSX } from "react";
|
|
3
|
-
import { SafeRouteError } from "../../../components/errors/SafeErrorBoundary";
|
|
4
|
-
import { ProxyViewerContainer } from "../../../components/ProxyViewerContainer";
|
|
5
|
-
import { decodeSessionIdFromPath, encodeSessionIdForPath } from "../../../lib/sessionUrl";
|
|
6
|
-
|
|
7
|
-
export const Route = createFileRoute("/session/$sessionId")({
|
|
8
|
-
component: SessionViewerRoute,
|
|
9
|
-
errorComponent: SessionRouteError,
|
|
10
|
-
parseParams: (params) => ({
|
|
11
|
-
sessionId: decodeSessionIdFromPath(params.sessionId),
|
|
12
|
-
}),
|
|
13
|
-
stringifyParams: (params) => ({
|
|
14
|
-
sessionId: encodeSessionIdForPath(params.sessionId),
|
|
15
|
-
}),
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
function SessionRouteError({ error, reset }: { error: Error; reset: () => void }): JSX.Element {
|
|
19
|
-
return <SafeRouteError error={error} reset={reset} scope="session-route" />;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function SessionViewerRoute(): JSX.Element {
|
|
23
|
-
const { sessionId } = Route.useParams();
|
|
24
|
-
return <ClientOnlySessionViewer sessionId={sessionId} />;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function ClientOnlySessionViewer({ sessionId }: { sessionId: string }): JSX.Element {
|
|
28
|
-
const [mounted, setMounted] = useState(false);
|
|
29
|
-
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
setMounted(true);
|
|
32
|
-
}, []);
|
|
33
|
-
|
|
34
|
-
if (!mounted) {
|
|
35
|
-
return (
|
|
36
|
-
<main className="min-h-screen bg-background text-foreground">
|
|
37
|
-
<div className="mx-auto flex min-h-screen w-full max-w-2xl flex-col justify-center px-6 py-16 text-center">
|
|
38
|
-
<div className="rounded-[8px] border border-border bg-card px-4 py-8 shadow-sm">
|
|
39
|
-
<p className="text-sm font-medium text-muted-foreground">Loading session data...</p>
|
|
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">
|
|
41
|
-
{sessionId}
|
|
42
|
-
</p>
|
|
43
|
-
</div>
|
|
44
|
-
</div>
|
|
45
|
-
</main>
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return <ProxyViewerContainer key={sessionId} initialSessionId={sessionId} />;
|
|
50
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
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
|
-
}
|