@tonyclaw/agent-inspector 4.0.1 → 4.0.3
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 +193 -110
- package/.output/server/_ssr/index.mjs +1 -1
- package/.output/server/_ssr/{router-CTHqmroT.mjs → router-ChILzhmz.mjs} +92 -4
- package/.output/server/index.mjs +1 -1
- package/.output/ui/assets/{CompareDrawer-L3n4J-Or.js → CompareDrawer-Co3cUF_I.js} +1 -1
- package/.output/ui/assets/{InspectorPet-D5o_3OZS.js → InspectorPet-jFcrL37X.js} +1 -1
- package/.output/ui/assets/{ProxyViewerContainer-Ocagx75S.js → ProxyViewerContainer-BPzt_VpM.js} +4 -4
- package/.output/ui/assets/{ReplayDialog-Bk7x1h-y.js → ReplayDialog-C6O_zuwI.js} +1 -1
- package/.output/ui/assets/{RequestAnatomy-U4lzL7Sc.js → RequestAnatomy-Ca6NvB7L.js} +1 -1
- package/.output/ui/assets/{ResponseView-LOWfvBLK.js → ResponseView-BzqKcveJ.js} +1 -1
- package/.output/ui/assets/{StreamingChunkSequence-DPfsrrXQ.js → StreamingChunkSequence-9pCZIsS_.js} +1 -1
- package/.output/ui/assets/{_sessionId-0MlWS-CO.js → _sessionId-BMP3KVGR.js} +1 -1
- package/.output/ui/assets/{_sessionId-OdX2Jvt1.js → _sessionId-y4eRoT1H.js} +1 -1
- package/.output/ui/assets/{index-Ea-c8hPg.js → index-CH5w-haG.js} +1 -1
- package/.output/ui/assets/{index-zVVS53Hd.js → index-CmocEhyU.js} +1 -1
- package/.output/ui/assets/{index-Du4qNOOt.js → index-DT8sMJ_n.js} +2 -2
- package/.output/ui/assets/{index-gvFj_9K6.js → index-bfsbIRZa.js} +1 -1
- package/.output/ui/assets/{json-viewer-C1WAMzg3.js → json-viewer-BfFOSDG5.js} +1 -1
- package/.output/ui/assets/{jszip.min-B8AKu2zm.js → jszip.min-BkbVkOsp.js} +1 -1
- package/.output/ui/index.html +1 -1
- package/package.json +5 -10
- 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 -1433
- 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 -258
- 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
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
import { memo, Suspense, useState, useEffect, useMemo, useRef, type JSX } from "react";
|
|
2
|
-
import { ChevronDown, ChevronRight, Loader2 } from "lucide-react";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
import { Badge } from "../ui/badge";
|
|
5
|
-
import { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from "../ui/tooltip";
|
|
6
|
-
import { StreamingChunkSchema, type StreamingChunk } from "../../contracts";
|
|
7
|
-
import { fetchJsonWithTimeout } from "../../lib/apiClient";
|
|
8
|
-
import { LazyJsonViewer } from "./lazy";
|
|
9
|
-
|
|
10
|
-
export type StreamingChunkSequenceProps = {
|
|
11
|
-
logId: number;
|
|
12
|
-
truncated?: boolean;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
type ChunkState =
|
|
16
|
-
| { status: "idle" }
|
|
17
|
-
| { status: "loading" }
|
|
18
|
-
| { status: "success"; chunks: StreamingChunk[] }
|
|
19
|
-
| { status: "error"; message: string };
|
|
20
|
-
|
|
21
|
-
type ChunkGroup = {
|
|
22
|
-
index: number;
|
|
23
|
-
chunks: StreamingChunk[];
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const StreamingChunksResponseSchema = z.object({
|
|
27
|
-
chunks: z.array(StreamingChunkSchema),
|
|
28
|
-
truncated: z.boolean().optional(),
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
const CHUNK_FETCH_TIMEOUT_MS = 10_000;
|
|
32
|
-
const INITIAL_VISIBLE_GROUPS = 80;
|
|
33
|
-
const GROUP_PAGE_SIZE = 80;
|
|
34
|
-
const INITIAL_VISIBLE_CHUNKS_PER_GROUP = 40;
|
|
35
|
-
const CHUNK_PAGE_SIZE = 40;
|
|
36
|
-
|
|
37
|
-
// eslint-disable-next-line @typescript-eslint/no-shadow -- named function gives React DevTools a readable displayName
|
|
38
|
-
export const StreamingChunkSequence = memo(function StreamingChunkSequence({
|
|
39
|
-
logId,
|
|
40
|
-
truncated,
|
|
41
|
-
}: StreamingChunkSequenceProps): JSX.Element {
|
|
42
|
-
const [containerExpanded, setContainerExpanded] = useState(false);
|
|
43
|
-
const [chunkState, setChunkState] = useState<ChunkState>({ status: "idle" });
|
|
44
|
-
const [expandedIndices, setExpandedIndices] = useState<Set<number>>(new Set());
|
|
45
|
-
const [visibleGroupCount, setVisibleGroupCount] = useState(INITIAL_VISIBLE_GROUPS);
|
|
46
|
-
const [visibleChunksByGroup, setVisibleChunksByGroup] = useState<Map<number, number>>(new Map());
|
|
47
|
-
const loadedLogIdRef = useRef<number | null>(null);
|
|
48
|
-
|
|
49
|
-
useEffect(() => {
|
|
50
|
-
setExpandedIndices(new Set());
|
|
51
|
-
setVisibleGroupCount(INITIAL_VISIBLE_GROUPS);
|
|
52
|
-
setVisibleChunksByGroup(new Map());
|
|
53
|
-
setChunkState({ status: "idle" });
|
|
54
|
-
loadedLogIdRef.current = null;
|
|
55
|
-
}, [logId]);
|
|
56
|
-
|
|
57
|
-
useEffect(() => {
|
|
58
|
-
if (!containerExpanded) return;
|
|
59
|
-
if (loadedLogIdRef.current === logId) return;
|
|
60
|
-
|
|
61
|
-
const controller = new AbortController();
|
|
62
|
-
setChunkState({ status: "loading" });
|
|
63
|
-
|
|
64
|
-
void fetchJsonWithTimeout(
|
|
65
|
-
`/api/logs/${logId}/chunks`,
|
|
66
|
-
StreamingChunksResponseSchema,
|
|
67
|
-
CHUNK_FETCH_TIMEOUT_MS,
|
|
68
|
-
{ signal: controller.signal },
|
|
69
|
-
() => "Chunks not found",
|
|
70
|
-
)
|
|
71
|
-
.then((data) => {
|
|
72
|
-
loadedLogIdRef.current = logId;
|
|
73
|
-
setChunkState({ status: "success", chunks: data.chunks });
|
|
74
|
-
})
|
|
75
|
-
.catch((error: unknown) => {
|
|
76
|
-
if (error instanceof DOMException && error.name === "AbortError") return;
|
|
77
|
-
loadedLogIdRef.current = null;
|
|
78
|
-
setChunkState({
|
|
79
|
-
status: "error",
|
|
80
|
-
message: error instanceof Error ? error.message : "Chunk data unavailable",
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
return () => {
|
|
85
|
-
controller.abort();
|
|
86
|
-
};
|
|
87
|
-
}, [containerExpanded, logId]);
|
|
88
|
-
|
|
89
|
-
const groups = useMemo<ChunkGroup[]>(() => {
|
|
90
|
-
if (chunkState.status !== "success") return [];
|
|
91
|
-
|
|
92
|
-
const map = new Map<number, StreamingChunk[]>();
|
|
93
|
-
for (const chunk of chunkState.chunks) {
|
|
94
|
-
const existing = map.get(chunk.index);
|
|
95
|
-
if (existing) {
|
|
96
|
-
existing.push(chunk);
|
|
97
|
-
} else {
|
|
98
|
-
map.set(chunk.index, [chunk]);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return Array.from(map.entries())
|
|
103
|
-
.map(([index, chunks]) => ({ index, chunks }))
|
|
104
|
-
.sort((a, b) => a.index - b.index);
|
|
105
|
-
}, [chunkState]);
|
|
106
|
-
|
|
107
|
-
const visibleGroups = groups.slice(0, visibleGroupCount);
|
|
108
|
-
const hiddenGroupCount = Math.max(groups.length - visibleGroups.length, 0);
|
|
109
|
-
|
|
110
|
-
const toggleIndex = (index: number) => {
|
|
111
|
-
setExpandedIndices((prev) => {
|
|
112
|
-
const next = new Set(prev);
|
|
113
|
-
if (next.has(index)) {
|
|
114
|
-
next.delete(index);
|
|
115
|
-
} else {
|
|
116
|
-
next.add(index);
|
|
117
|
-
}
|
|
118
|
-
return next;
|
|
119
|
-
});
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
const showMoreGroups = () => {
|
|
123
|
-
setVisibleGroupCount((count) => Math.min(count + GROUP_PAGE_SIZE, groups.length));
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
const showMoreChunks = (group: ChunkGroup) => {
|
|
127
|
-
setVisibleChunksByGroup((prev) => {
|
|
128
|
-
const next = new Map(prev);
|
|
129
|
-
const current = next.get(group.index) ?? INITIAL_VISIBLE_CHUNKS_PER_GROUP;
|
|
130
|
-
next.set(group.index, Math.min(current + CHUNK_PAGE_SIZE, group.chunks.length));
|
|
131
|
-
return next;
|
|
132
|
-
});
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
function renderBody(): JSX.Element {
|
|
136
|
-
if (chunkState.status === "idle" || chunkState.status === "loading") {
|
|
137
|
-
return (
|
|
138
|
-
<div className="flex items-center gap-2 py-2 text-xs text-muted-foreground">
|
|
139
|
-
<Loader2 className="size-3 animate-spin" />
|
|
140
|
-
<span>Loading chunks...</span>
|
|
141
|
-
</div>
|
|
142
|
-
);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
if (chunkState.status === "error") {
|
|
146
|
-
return <div className="py-2 text-xs text-muted-foreground italic">{chunkState.message}</div>;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
return (
|
|
150
|
-
<div className="p-2 space-y-1">
|
|
151
|
-
<div className="text-[10px] text-muted-foreground font-mono mb-2">
|
|
152
|
-
{groups.length} index group{groups.length !== 1 ? "s" : ""} available
|
|
153
|
-
</div>
|
|
154
|
-
{visibleGroups.map((group) => {
|
|
155
|
-
const isExpanded = expandedIndices.has(group.index);
|
|
156
|
-
const visibleChunkCount =
|
|
157
|
-
visibleChunksByGroup.get(group.index) ?? INITIAL_VISIBLE_CHUNKS_PER_GROUP;
|
|
158
|
-
const visibleChunks = group.chunks.slice(0, visibleChunkCount);
|
|
159
|
-
const hiddenChunkCount = Math.max(group.chunks.length - visibleChunks.length, 0);
|
|
160
|
-
return (
|
|
161
|
-
<div key={group.index} className="rounded border border-border bg-background">
|
|
162
|
-
<button
|
|
163
|
-
type="button"
|
|
164
|
-
className="flex items-center gap-2 w-full px-2 py-1.5 text-left hover:bg-muted/50 transition-colors cursor-pointer"
|
|
165
|
-
onClick={() => toggleIndex(group.index)}
|
|
166
|
-
>
|
|
167
|
-
{isExpanded ? (
|
|
168
|
-
<ChevronDown className="size-3 text-muted-foreground" />
|
|
169
|
-
) : (
|
|
170
|
-
<ChevronRight className="size-3 text-muted-foreground" />
|
|
171
|
-
)}
|
|
172
|
-
<span className="text-[10px] text-muted-foreground font-mono">
|
|
173
|
-
[{group.index}] {group.chunks[0]?.type ?? ""}
|
|
174
|
-
</span>
|
|
175
|
-
<span className="text-[10px] text-muted-foreground font-mono">
|
|
176
|
-
{group.chunks.length} chunk{group.chunks.length !== 1 ? "s" : ""}
|
|
177
|
-
</span>
|
|
178
|
-
</button>
|
|
179
|
-
{isExpanded && (
|
|
180
|
-
<div className="px-2 pb-2 space-y-1">
|
|
181
|
-
{visibleChunks.map((chunk, chunkOrdinal) => (
|
|
182
|
-
<div
|
|
183
|
-
key={`${chunk.index}:${chunk.timestamp}:${chunk.type}:${chunkOrdinal}`}
|
|
184
|
-
className="rounded border border-border bg-muted/20 p-2"
|
|
185
|
-
>
|
|
186
|
-
<div className="flex items-center gap-2 mb-1">
|
|
187
|
-
<span className="text-[10px] text-muted-foreground font-mono">
|
|
188
|
-
+{chunk.timestamp}ms
|
|
189
|
-
</span>
|
|
190
|
-
<span className="text-[10px] text-muted-foreground font-mono">
|
|
191
|
-
{chunk.type}
|
|
192
|
-
</span>
|
|
193
|
-
</div>
|
|
194
|
-
<Suspense
|
|
195
|
-
fallback={
|
|
196
|
-
<div className="text-xs text-muted-foreground">Loading JSON...</div>
|
|
197
|
-
}
|
|
198
|
-
>
|
|
199
|
-
<LazyJsonViewer data={chunk} defaultExpandDepth={0} showCopy />
|
|
200
|
-
</Suspense>
|
|
201
|
-
</div>
|
|
202
|
-
))}
|
|
203
|
-
{hiddenChunkCount > 0 && (
|
|
204
|
-
<button
|
|
205
|
-
type="button"
|
|
206
|
-
className="mt-1 rounded-md border border-border bg-background px-2 py-1 text-[10px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"
|
|
207
|
-
onClick={() => showMoreChunks(group)}
|
|
208
|
-
>
|
|
209
|
-
Show {Math.min(CHUNK_PAGE_SIZE, hiddenChunkCount)} more chunk
|
|
210
|
-
{Math.min(CHUNK_PAGE_SIZE, hiddenChunkCount) !== 1 ? "s" : ""}
|
|
211
|
-
</button>
|
|
212
|
-
)}
|
|
213
|
-
</div>
|
|
214
|
-
)}
|
|
215
|
-
</div>
|
|
216
|
-
);
|
|
217
|
-
})}
|
|
218
|
-
{hiddenGroupCount > 0 && (
|
|
219
|
-
<button
|
|
220
|
-
type="button"
|
|
221
|
-
className="rounded-md border border-border bg-background px-2 py-1 text-[10px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"
|
|
222
|
-
onClick={showMoreGroups}
|
|
223
|
-
>
|
|
224
|
-
Show {Math.min(GROUP_PAGE_SIZE, hiddenGroupCount)} more SSE group
|
|
225
|
-
{Math.min(GROUP_PAGE_SIZE, hiddenGroupCount) !== 1 ? "s" : ""}
|
|
226
|
-
</button>
|
|
227
|
-
)}
|
|
228
|
-
</div>
|
|
229
|
-
);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
return (
|
|
233
|
-
<div className="space-y-1">
|
|
234
|
-
<TooltipProvider>
|
|
235
|
-
<Tooltip>
|
|
236
|
-
<TooltipTrigger asChild>
|
|
237
|
-
<button
|
|
238
|
-
type="button"
|
|
239
|
-
className="flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer"
|
|
240
|
-
onClick={() => setContainerExpanded((v) => !v)}
|
|
241
|
-
>
|
|
242
|
-
{containerExpanded ? (
|
|
243
|
-
<ChevronDown className="size-3" />
|
|
244
|
-
) : (
|
|
245
|
-
<ChevronRight className="size-3" />
|
|
246
|
-
)}
|
|
247
|
-
<span>Raw SSE Events</span>
|
|
248
|
-
<Badge variant="outline" className="text-[9px] px-1 py-0 h-4 font-mono ml-1">
|
|
249
|
-
{logId}
|
|
250
|
-
{truncated === true ? "+" : ""}
|
|
251
|
-
</Badge>
|
|
252
|
-
</button>
|
|
253
|
-
</TooltipTrigger>
|
|
254
|
-
<TooltipContent>Server-Sent Events streaming chunks from the provider</TooltipContent>
|
|
255
|
-
</Tooltip>
|
|
256
|
-
</TooltipProvider>
|
|
257
|
-
|
|
258
|
-
{containerExpanded === true ? (
|
|
259
|
-
<div className="rounded-md border border-border bg-muted/20 overflow-auto max-h-64">
|
|
260
|
-
{renderBody()}
|
|
261
|
-
</div>
|
|
262
|
-
) : null}
|
|
263
|
-
</div>
|
|
264
|
-
);
|
|
265
|
-
});
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import { type JSX, type KeyboardEvent, type MouseEvent, useMemo } from "react";
|
|
2
|
-
import { isTurnBoundary, type StopReason } from "../../lib/stopReason";
|
|
3
|
-
import { cn } from "../../lib/utils";
|
|
4
|
-
import { getCrabVariant, getInteriorCrabVariant } from "../ui/crab-variants";
|
|
5
|
-
|
|
6
|
-
export type ThreadConnectorProps = {
|
|
7
|
-
stopReason: StopReason;
|
|
8
|
-
isPending: boolean;
|
|
9
|
-
isFirst: boolean;
|
|
10
|
-
/** True when this entry starts a new turn (first overall, or after end_turn/stop). */
|
|
11
|
-
isTurnStart: boolean;
|
|
12
|
-
/** True when this entry is the turn's only request. */
|
|
13
|
-
isOnlyEntry?: boolean;
|
|
14
|
-
/** True when this is the latest request in a turn that has not reached a real boundary. */
|
|
15
|
-
isOpenTurnTail?: boolean;
|
|
16
|
-
/** Seed for crab variant selection (0-11). */
|
|
17
|
-
crabIndex?: number;
|
|
18
|
-
/** When true the crab is clickable (collapse / expand a turn). */
|
|
19
|
-
collapsible?: boolean;
|
|
20
|
-
onToggle?: () => void;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
function boundaryTitle(stopReason: StopReason): string {
|
|
24
|
-
switch (stopReason) {
|
|
25
|
-
case "end_turn":
|
|
26
|
-
return "End of Turn (Anthropic)";
|
|
27
|
-
case "stop":
|
|
28
|
-
return "End of Turn (OpenAI)";
|
|
29
|
-
case "length":
|
|
30
|
-
return "End of Turn (length limit)";
|
|
31
|
-
case "tool_use":
|
|
32
|
-
case null:
|
|
33
|
-
return "End of Turn";
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function crabShellClass(interactive: boolean): string {
|
|
38
|
-
return interactive ? "cursor-pointer transition-transform hover:scale-110" : "";
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export function ThreadConnector({
|
|
42
|
-
stopReason,
|
|
43
|
-
isPending,
|
|
44
|
-
isFirst,
|
|
45
|
-
isTurnStart,
|
|
46
|
-
isOnlyEntry = false,
|
|
47
|
-
isOpenTurnTail = false,
|
|
48
|
-
crabIndex = 0,
|
|
49
|
-
collapsible = false,
|
|
50
|
-
onToggle,
|
|
51
|
-
}: ThreadConnectorProps): JSX.Element {
|
|
52
|
-
const isBoundary = isTurnBoundary(stopReason);
|
|
53
|
-
const isFusedBoundary = isOnlyEntry && isTurnStart && isBoundary;
|
|
54
|
-
const isRunning = isPending && !isBoundary;
|
|
55
|
-
const interactive = collapsible && onToggle !== undefined;
|
|
56
|
-
const Crab = useMemo(() => getCrabVariant(crabIndex), [crabIndex]);
|
|
57
|
-
const FusedCrab = useMemo(() => getInteriorCrabVariant(crabIndex), [crabIndex]);
|
|
58
|
-
|
|
59
|
-
const handleCrabClick = (event: MouseEvent<HTMLSpanElement>): void => {
|
|
60
|
-
if (!interactive || onToggle === undefined) return;
|
|
61
|
-
event.stopPropagation();
|
|
62
|
-
onToggle();
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const handleCrabKeyDown = (event: KeyboardEvent<HTMLSpanElement>): void => {
|
|
66
|
-
if (!interactive || onToggle === undefined) return;
|
|
67
|
-
if (event.key !== "Enter" && event.key !== " ") return;
|
|
68
|
-
event.preventDefault();
|
|
69
|
-
onToggle();
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
return (
|
|
73
|
-
<div className="flex flex-col items-center w-6 shrink-0 pt-0.5 pb-0.5">
|
|
74
|
-
<div className="flex justify-center h-[calc(0.75rem-8px)]">
|
|
75
|
-
{!isFirst && <div className="w-px bg-muted-foreground/18 h-full" />}
|
|
76
|
-
</div>
|
|
77
|
-
|
|
78
|
-
{isFusedBoundary ? (
|
|
79
|
-
<span
|
|
80
|
-
role={interactive ? "button" : undefined}
|
|
81
|
-
tabIndex={interactive ? 0 : undefined}
|
|
82
|
-
title="Single-request turn"
|
|
83
|
-
className={crabShellClass(interactive)}
|
|
84
|
-
onClick={handleCrabClick}
|
|
85
|
-
onKeyDown={handleCrabKeyDown}
|
|
86
|
-
>
|
|
87
|
-
<FusedCrab
|
|
88
|
-
className={cn(
|
|
89
|
-
"size-3.5 text-[#80FF00]",
|
|
90
|
-
"animate-crab-settle",
|
|
91
|
-
"drop-shadow-[0_0_4px_rgba(128,255,0,0.5)]",
|
|
92
|
-
)}
|
|
93
|
-
/>
|
|
94
|
-
</span>
|
|
95
|
-
) : isBoundary ? (
|
|
96
|
-
<span
|
|
97
|
-
role={interactive ? "button" : undefined}
|
|
98
|
-
tabIndex={interactive ? 0 : undefined}
|
|
99
|
-
title={boundaryTitle(stopReason)}
|
|
100
|
-
className={crabShellClass(interactive)}
|
|
101
|
-
onClick={handleCrabClick}
|
|
102
|
-
onKeyDown={handleCrabKeyDown}
|
|
103
|
-
>
|
|
104
|
-
<Crab
|
|
105
|
-
className={cn(
|
|
106
|
-
"size-3.5 text-amber-400",
|
|
107
|
-
"animate-crab-settle",
|
|
108
|
-
"drop-shadow-[0_0_4px_rgba(251,191,36,0.5)]",
|
|
109
|
-
)}
|
|
110
|
-
/>
|
|
111
|
-
</span>
|
|
112
|
-
) : isTurnStart ? (
|
|
113
|
-
<span
|
|
114
|
-
role={interactive ? "button" : undefined}
|
|
115
|
-
tabIndex={interactive ? 0 : undefined}
|
|
116
|
-
title="Start of turn"
|
|
117
|
-
className={crabShellClass(interactive)}
|
|
118
|
-
onClick={handleCrabClick}
|
|
119
|
-
onKeyDown={handleCrabKeyDown}
|
|
120
|
-
>
|
|
121
|
-
<Crab
|
|
122
|
-
className={cn(
|
|
123
|
-
"size-3.5 text-emerald-400",
|
|
124
|
-
"animate-crab-appear",
|
|
125
|
-
"drop-shadow-[0_0_4px_rgba(52,211,153,0.5)]",
|
|
126
|
-
)}
|
|
127
|
-
/>
|
|
128
|
-
</span>
|
|
129
|
-
) : isOpenTurnTail ? (
|
|
130
|
-
<span
|
|
131
|
-
title={isPending ? "Current end of open turn (processing)" : "Current end of open turn"}
|
|
132
|
-
>
|
|
133
|
-
<Crab
|
|
134
|
-
className={cn(
|
|
135
|
-
"size-3.5 text-cyan-300/85",
|
|
136
|
-
isRunning ? "animate-crab-crawl" : "animate-crab-appear",
|
|
137
|
-
"drop-shadow-[0_0_4px_rgba(103,232,249,0.4)]",
|
|
138
|
-
)}
|
|
139
|
-
/>
|
|
140
|
-
</span>
|
|
141
|
-
) : isRunning ? (
|
|
142
|
-
<span title="Processing">
|
|
143
|
-
<Crab className={cn("size-3.5 text-amber-300/80", "animate-crab-crawl")} />
|
|
144
|
-
</span>
|
|
145
|
-
) : (
|
|
146
|
-
<span title="Request in turn">
|
|
147
|
-
<Crab className="size-3.5 text-muted-foreground/40" />
|
|
148
|
-
</span>
|
|
149
|
-
)}
|
|
150
|
-
|
|
151
|
-
<div className="flex-1 flex justify-center min-h-0">
|
|
152
|
-
{!isBoundary && !isOpenTurnTail && (
|
|
153
|
-
<div
|
|
154
|
-
className={cn(
|
|
155
|
-
"w-0.5 h-full",
|
|
156
|
-
isPending
|
|
157
|
-
? "border-dashed bg-transparent border-l border-muted-foreground/14"
|
|
158
|
-
: "bg-muted-foreground/18",
|
|
159
|
-
)}
|
|
160
|
-
/>
|
|
161
|
-
)}
|
|
162
|
-
</div>
|
|
163
|
-
</div>
|
|
164
|
-
);
|
|
165
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { type JSX, type MouseEvent } from "react";
|
|
2
|
-
import { Wrench } from "lucide-react";
|
|
3
|
-
import type { ToolTraceEvent } from "./viewerState";
|
|
4
|
-
import { dispatchLogFocusRequest } from "./logFocus";
|
|
5
|
-
|
|
6
|
-
type ToolTraceEventsProps = {
|
|
7
|
-
events: ToolTraceEvent[];
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const VISIBLE_TOOL_LIMIT = 3;
|
|
11
|
-
|
|
12
|
-
function ToolTraceEventChip({ event }: { event: ToolTraceEvent }): JSX.Element {
|
|
13
|
-
const handleClick = (clickEvent: MouseEvent<HTMLButtonElement>): void => {
|
|
14
|
-
clickEvent.stopPropagation();
|
|
15
|
-
dispatchLogFocusRequest({
|
|
16
|
-
logId: event.logId,
|
|
17
|
-
tab: "response",
|
|
18
|
-
toolCallIndex: event.index,
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<button
|
|
24
|
-
type="button"
|
|
25
|
-
className="inline-flex h-5 min-w-0 max-w-[8.5rem] items-center rounded px-1.5 text-[10px] text-muted-foreground transition-colors hover:bg-background/65 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
26
|
-
onClick={handleClick}
|
|
27
|
-
onKeyDown={(keyEvent) => keyEvent.stopPropagation()}
|
|
28
|
-
aria-label={`Open response tool call ${event.name}`}
|
|
29
|
-
title={event.name}
|
|
30
|
-
>
|
|
31
|
-
<span className="min-w-0 truncate font-mono font-semibold">{event.name}</span>
|
|
32
|
-
</button>
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export function ToolTraceEvents({ events }: ToolTraceEventsProps): JSX.Element | null {
|
|
37
|
-
if (events.length === 0) return null;
|
|
38
|
-
const visibleEvents = events.slice(0, VISIBLE_TOOL_LIMIT);
|
|
39
|
-
const hiddenCount = Math.max(0, events.length - visibleEvents.length);
|
|
40
|
-
return (
|
|
41
|
-
<span
|
|
42
|
-
className="inline-flex h-7 min-w-0 max-w-full items-center gap-1 overflow-hidden rounded-md border border-cyan-300/10 bg-cyan-300/[0.055] px-1 sm:max-w-[26rem]"
|
|
43
|
-
role="group"
|
|
44
|
-
aria-label={`${events.length} response tool ${events.length === 1 ? "call" : "calls"}`}
|
|
45
|
-
onClick={(clickEvent) => clickEvent.stopPropagation()}
|
|
46
|
-
onKeyDown={(keyEvent) => keyEvent.stopPropagation()}
|
|
47
|
-
>
|
|
48
|
-
<span className="inline-flex h-5 shrink-0 items-center gap-1 px-1 font-mono text-[9px] font-semibold uppercase text-cyan-300">
|
|
49
|
-
<Wrench className="size-3" />
|
|
50
|
-
Call {events.length}
|
|
51
|
-
</span>
|
|
52
|
-
<span className="flex min-w-0 flex-1 items-center gap-0.5 overflow-hidden">
|
|
53
|
-
{visibleEvents.map((event) => (
|
|
54
|
-
<ToolTraceEventChip key={event.id} event={event} />
|
|
55
|
-
))}
|
|
56
|
-
{hiddenCount > 0 && (
|
|
57
|
-
<span className="inline-flex h-5 shrink-0 items-center rounded px-1 font-mono text-[10px] font-semibold text-muted-foreground">
|
|
58
|
-
+{hiddenCount}
|
|
59
|
-
</span>
|
|
60
|
-
)}
|
|
61
|
-
</span>
|
|
62
|
-
</span>
|
|
63
|
-
);
|
|
64
|
-
}
|