@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,273 +0,0 @@
|
|
|
1
|
-
import { safeGetOwnProperty } from "../../lib/objectUtils";
|
|
2
|
-
|
|
3
|
-
export type PiAgentChatRole = "user" | "assistant";
|
|
4
|
-
|
|
5
|
-
export type PiAgentHistoryMessage = {
|
|
6
|
-
role: PiAgentChatRole;
|
|
7
|
-
content: string;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export type PiAgentEvidenceView = {
|
|
11
|
-
source: string;
|
|
12
|
-
id: string;
|
|
13
|
-
logId: number | null;
|
|
14
|
-
sessionId: string | null;
|
|
15
|
-
timestamp: string | null;
|
|
16
|
-
model: string | null;
|
|
17
|
-
providerName: string | null;
|
|
18
|
-
path: string | null;
|
|
19
|
-
status: string | number | null;
|
|
20
|
-
elapsedMs: number | null;
|
|
21
|
-
inputTokens: number | null;
|
|
22
|
-
outputTokens: number | null;
|
|
23
|
-
totalTokens: number | null;
|
|
24
|
-
score: number | null;
|
|
25
|
-
matchedFields: string[];
|
|
26
|
-
excerpt: string;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export type PiAgentMetricView = {
|
|
30
|
-
key: string;
|
|
31
|
-
label: string;
|
|
32
|
-
value: string;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export type PiAgentResponseView = {
|
|
36
|
-
answer: string;
|
|
37
|
-
providerId: string;
|
|
38
|
-
providerName: string;
|
|
39
|
-
model: string;
|
|
40
|
-
protocol: string;
|
|
41
|
-
logCount: number;
|
|
42
|
-
evidence: PiAgentEvidenceView[];
|
|
43
|
-
summaryMetrics: PiAgentMetricView[];
|
|
44
|
-
queryMetrics: PiAgentMetricView[];
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export function getPiAgentResultLogIds(response: PiAgentResponseView): number[] {
|
|
48
|
-
return [
|
|
49
|
-
...new Set(
|
|
50
|
-
response.evidence
|
|
51
|
-
.map((evidence) => evidence.logId)
|
|
52
|
-
.filter((logId): logId is number => logId !== null),
|
|
53
|
-
),
|
|
54
|
-
];
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export type PiAgentConversationMessage = PiAgentHistoryMessage & {
|
|
58
|
-
id: string;
|
|
59
|
-
response: PiAgentResponseView | null;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
export type PiAgentConversationState = {
|
|
63
|
-
messages: PiAgentConversationMessage[];
|
|
64
|
-
question: string;
|
|
65
|
-
error: string | null;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export type PiAgentStarter = {
|
|
69
|
-
id: "reliability" | "performance" | "tokens" | "providers" | "tools";
|
|
70
|
-
label: string;
|
|
71
|
-
question: string;
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export const PI_AGENT_STARTERS: readonly PiAgentStarter[] = [
|
|
75
|
-
{
|
|
76
|
-
id: "reliability",
|
|
77
|
-
label: "Reliability",
|
|
78
|
-
question: "Which requests failed, stalled, or look most likely to hang, and why?",
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
id: "performance",
|
|
82
|
-
label: "Performance",
|
|
83
|
-
question: "Summarize latency and identify the slowest requests with supporting evidence.",
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
id: "tokens",
|
|
87
|
-
label: "Token usage",
|
|
88
|
-
question: "Where are tokens being spent, and which requests have unusually high usage?",
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
id: "providers",
|
|
92
|
-
label: "Providers",
|
|
93
|
-
question: "Compare Provider and model reliability, latency, and token usage in this scope.",
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
id: "tools",
|
|
97
|
-
label: "Tool activity",
|
|
98
|
-
question: "Which tools were used most, and where did tool calls fail or produce warnings?",
|
|
99
|
-
},
|
|
100
|
-
];
|
|
101
|
-
|
|
102
|
-
const MAX_HISTORY_MESSAGES = 10;
|
|
103
|
-
const MAX_HISTORY_CONTENT_CHARS = 4_000;
|
|
104
|
-
const MAX_METRICS = 12;
|
|
105
|
-
|
|
106
|
-
export function createEmptyPiAgentConversation(): PiAgentConversationState {
|
|
107
|
-
return { messages: [], question: "", error: null };
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export function buildPiAgentHistory(
|
|
111
|
-
messages: readonly PiAgentConversationMessage[],
|
|
112
|
-
): PiAgentHistoryMessage[] {
|
|
113
|
-
return messages
|
|
114
|
-
.filter((message) => message.content.trim().length > 0)
|
|
115
|
-
.slice(-MAX_HISTORY_MESSAGES)
|
|
116
|
-
.map((message) => ({
|
|
117
|
-
role: message.role,
|
|
118
|
-
content: message.content.trim().slice(0, MAX_HISTORY_CONTENT_CHARS),
|
|
119
|
-
}));
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
function readString(value: unknown, ...keys: string[]): string | null {
|
|
123
|
-
for (const key of keys) {
|
|
124
|
-
const candidate = safeGetOwnProperty(value, key);
|
|
125
|
-
if (typeof candidate === "string" && candidate.trim().length > 0) return candidate;
|
|
126
|
-
}
|
|
127
|
-
return null;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
function readNumber(value: unknown, ...keys: string[]): number | null {
|
|
131
|
-
for (const key of keys) {
|
|
132
|
-
const candidate = safeGetOwnProperty(value, key);
|
|
133
|
-
if (typeof candidate === "number" && Number.isFinite(candidate)) return candidate;
|
|
134
|
-
}
|
|
135
|
-
return null;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
function readStringArray(value: unknown, key: string): string[] {
|
|
139
|
-
const candidate = safeGetOwnProperty(value, key);
|
|
140
|
-
if (!Array.isArray(candidate)) return [];
|
|
141
|
-
return candidate.filter((item): item is string => typeof item === "string").slice(0, 8);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function evidenceView(value: unknown): PiAgentEvidenceView | null {
|
|
145
|
-
const source = readString(value, "source") ?? "log";
|
|
146
|
-
const id = readString(value, "id") ?? "";
|
|
147
|
-
const logId = readNumber(value, "logId", "id");
|
|
148
|
-
if (id === "" && logId === null) return null;
|
|
149
|
-
if (logId !== null && (!Number.isInteger(logId) || logId < 0)) return null;
|
|
150
|
-
const inputTokens = readNumber(value, "inputTokens");
|
|
151
|
-
const outputTokens = readNumber(value, "outputTokens");
|
|
152
|
-
const explicitTotal = readNumber(value, "totalTokens", "tokenCount");
|
|
153
|
-
const statusNumber = readNumber(value, "responseStatus", "status");
|
|
154
|
-
const statusString = readString(value, "responseStatus", "status");
|
|
155
|
-
|
|
156
|
-
return {
|
|
157
|
-
source,
|
|
158
|
-
id: id !== "" ? id : String(logId),
|
|
159
|
-
logId,
|
|
160
|
-
sessionId: readString(value, "sessionId"),
|
|
161
|
-
timestamp: readString(value, "timestamp"),
|
|
162
|
-
model: readString(value, "model"),
|
|
163
|
-
providerName: readString(value, "providerName", "provider"),
|
|
164
|
-
path: readString(value, "path"),
|
|
165
|
-
status: statusNumber ?? statusString,
|
|
166
|
-
elapsedMs: readNumber(value, "elapsedMs", "latencyMs"),
|
|
167
|
-
inputTokens,
|
|
168
|
-
outputTokens,
|
|
169
|
-
totalTokens:
|
|
170
|
-
explicitTotal ??
|
|
171
|
-
(inputTokens === null && outputTokens === null
|
|
172
|
-
? null
|
|
173
|
-
: (inputTokens ?? 0) + (outputTokens ?? 0)),
|
|
174
|
-
score: readNumber(value, "score", "relevanceScore"),
|
|
175
|
-
matchedFields: readStringArray(value, "matchedFields"),
|
|
176
|
-
excerpt: readString(value, "excerpt", "snippet") ?? "No excerpt available.",
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
function humanizeMetricKey(key: string): string {
|
|
181
|
-
const spaced = key
|
|
182
|
-
.replace(/([a-z0-9])([A-Z])/g, "$1 $2")
|
|
183
|
-
.replace(/[_-]+/g, " ")
|
|
184
|
-
.trim();
|
|
185
|
-
return spaced.length === 0 ? "Metric" : `${spaced[0]?.toUpperCase() ?? ""}${spaced.slice(1)}`;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
function metricValue(value: unknown): string | null {
|
|
189
|
-
if (typeof value === "number" && Number.isFinite(value)) return value.toLocaleString();
|
|
190
|
-
if (typeof value === "string" && value.trim().length > 0) return value;
|
|
191
|
-
if (typeof value === "boolean") return value ? "Yes" : "No";
|
|
192
|
-
if (Array.isArray(value)) {
|
|
193
|
-
const items = value
|
|
194
|
-
.filter(
|
|
195
|
-
(item): item is string | number =>
|
|
196
|
-
typeof item === "string" || (typeof item === "number" && Number.isFinite(item)),
|
|
197
|
-
)
|
|
198
|
-
.slice(0, 6);
|
|
199
|
-
return items.length > 0 ? items.join(", ") : null;
|
|
200
|
-
}
|
|
201
|
-
return null;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
function objectMetricEntries(value: object): [string, unknown][] {
|
|
205
|
-
return Object.getOwnPropertyNames(value).map((key) => [key, safeGetOwnProperty(value, key)]);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
export function metricViews(value: unknown): PiAgentMetricView[] {
|
|
209
|
-
if (value === null || typeof value !== "object" || Array.isArray(value)) return [];
|
|
210
|
-
const entries: PiAgentMetricView[] = [];
|
|
211
|
-
|
|
212
|
-
for (const [key, rawValue] of objectMetricEntries(value)) {
|
|
213
|
-
const directValue = metricValue(rawValue);
|
|
214
|
-
if (directValue !== null) {
|
|
215
|
-
entries.push({ key, label: humanizeMetricKey(key), value: directValue });
|
|
216
|
-
if (entries.length >= MAX_METRICS) break;
|
|
217
|
-
continue;
|
|
218
|
-
}
|
|
219
|
-
if (rawValue === null || typeof rawValue !== "object" || Array.isArray(rawValue)) continue;
|
|
220
|
-
for (const [nestedKey, nestedValue] of objectMetricEntries(rawValue)) {
|
|
221
|
-
const formatted = metricValue(nestedValue);
|
|
222
|
-
if (formatted === null) continue;
|
|
223
|
-
const metricKey = `${key}.${nestedKey}`;
|
|
224
|
-
entries.push({
|
|
225
|
-
key: metricKey,
|
|
226
|
-
label: `${humanizeMetricKey(key)} ${humanizeMetricKey(nestedKey).toLowerCase()}`,
|
|
227
|
-
value: formatted,
|
|
228
|
-
});
|
|
229
|
-
if (entries.length >= MAX_METRICS) break;
|
|
230
|
-
}
|
|
231
|
-
if (entries.length >= MAX_METRICS) break;
|
|
232
|
-
}
|
|
233
|
-
return entries;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
export function normalizePiAgentResponse(value: unknown): PiAgentResponseView | null {
|
|
237
|
-
const answer = readString(value, "answer");
|
|
238
|
-
const providerId = readString(value, "providerId");
|
|
239
|
-
const providerName = readString(value, "providerName");
|
|
240
|
-
const model = readString(value, "model");
|
|
241
|
-
const protocol = readString(value, "protocol");
|
|
242
|
-
const logCount = readNumber(value, "logCount");
|
|
243
|
-
if (
|
|
244
|
-
answer === null ||
|
|
245
|
-
providerId === null ||
|
|
246
|
-
providerName === null ||
|
|
247
|
-
model === null ||
|
|
248
|
-
protocol === null ||
|
|
249
|
-
logCount === null
|
|
250
|
-
) {
|
|
251
|
-
return null;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
const rawEvidence = safeGetOwnProperty(value, "evidence");
|
|
255
|
-
const evidence = Array.isArray(rawEvidence)
|
|
256
|
-
? rawEvidence
|
|
257
|
-
.map(evidenceView)
|
|
258
|
-
.filter((item): item is PiAgentEvidenceView => item !== null)
|
|
259
|
-
.slice(0, 12)
|
|
260
|
-
: [];
|
|
261
|
-
|
|
262
|
-
return {
|
|
263
|
-
answer,
|
|
264
|
-
providerId,
|
|
265
|
-
providerName,
|
|
266
|
-
model,
|
|
267
|
-
protocol,
|
|
268
|
-
logCount,
|
|
269
|
-
evidence,
|
|
270
|
-
summaryMetrics: metricViews(safeGetOwnProperty(value, "summary")),
|
|
271
|
-
queryMetrics: metricViews(safeGetOwnProperty(value, "queryStats")),
|
|
272
|
-
};
|
|
273
|
-
}
|
|
@@ -1,281 +0,0 @@
|
|
|
1
|
-
import { type JSX, useState, useCallback, useEffect, useRef } from "react";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import { Dialog, DialogContent, DialogHeader, DialogTitle } from "../ui/dialog";
|
|
4
|
-
import { Button } from "../ui/button";
|
|
5
|
-
import { fetchJsonWithTimeout } from "../../lib/apiClient";
|
|
6
|
-
import {
|
|
7
|
-
ProviderScanResponseSchema,
|
|
8
|
-
type ScannedProviderDto,
|
|
9
|
-
} from "../../lib/providerImportContract";
|
|
10
|
-
import { ClientLogo } from "../clients/ClientLogo";
|
|
11
|
-
|
|
12
|
-
import { Loader2, Download, AlertCircle } from "lucide-react";
|
|
13
|
-
|
|
14
|
-
const ImportResponseSchema = z.object({
|
|
15
|
-
success: z.boolean().optional(),
|
|
16
|
-
imported: z.number().optional(),
|
|
17
|
-
message: z.string().optional(),
|
|
18
|
-
errors: z.array(z.string()).optional(),
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
const PROVIDER_IMPORT_TIMEOUT_MS = 20_000;
|
|
22
|
-
|
|
23
|
-
type ImportWizardDialogProps = {
|
|
24
|
-
open: boolean;
|
|
25
|
-
onOpenChange: (open: boolean) => void;
|
|
26
|
-
onImportComplete: () => void;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export function ImportWizardDialog({
|
|
30
|
-
open,
|
|
31
|
-
onOpenChange,
|
|
32
|
-
onImportComplete,
|
|
33
|
-
}: ImportWizardDialogProps): JSX.Element {
|
|
34
|
-
const [scanning, setScanning] = useState(false);
|
|
35
|
-
const [scanError, setScanError] = useState<string | null>(null);
|
|
36
|
-
const [scanId, setScanId] = useState<string | null>(null);
|
|
37
|
-
const [providers, setProviders] = useState<ScannedProviderDto[]>([]);
|
|
38
|
-
const [warnings, setWarnings] = useState<string[]>([]);
|
|
39
|
-
const [selected, setSelected] = useState<Set<number>>(new Set());
|
|
40
|
-
const [importing, setImporting] = useState(false);
|
|
41
|
-
const [importResult, setImportResult] = useState<string | null>(null);
|
|
42
|
-
const [importError, setImportError] = useState<string | null>(null);
|
|
43
|
-
const scanRequestIdRef = useRef(0);
|
|
44
|
-
const importRequestIdRef = useRef(0);
|
|
45
|
-
|
|
46
|
-
const scan = useCallback(() => {
|
|
47
|
-
const requestId = scanRequestIdRef.current + 1;
|
|
48
|
-
scanRequestIdRef.current = requestId;
|
|
49
|
-
setScanning(true);
|
|
50
|
-
setScanError(null);
|
|
51
|
-
setWarnings([]);
|
|
52
|
-
setScanId(null);
|
|
53
|
-
setProviders([]);
|
|
54
|
-
setSelected(new Set());
|
|
55
|
-
setImportResult(null);
|
|
56
|
-
setImportError(null);
|
|
57
|
-
|
|
58
|
-
void fetchJsonWithTimeout(
|
|
59
|
-
"/api/providers/scan",
|
|
60
|
-
ProviderScanResponseSchema,
|
|
61
|
-
PROVIDER_IMPORT_TIMEOUT_MS,
|
|
62
|
-
{ method: "POST" },
|
|
63
|
-
(response) => `Scan failed (${String(response.status)})`,
|
|
64
|
-
)
|
|
65
|
-
.then((data) => {
|
|
66
|
-
if (scanRequestIdRef.current !== requestId) return;
|
|
67
|
-
setScanId(data.scanId);
|
|
68
|
-
setProviders(data.providers);
|
|
69
|
-
setWarnings(data.warnings ?? []);
|
|
70
|
-
const indices = new Set<number>();
|
|
71
|
-
data.providers.forEach((provider, index) => {
|
|
72
|
-
if (!provider.alreadyExists) indices.add(index);
|
|
73
|
-
});
|
|
74
|
-
setSelected(indices);
|
|
75
|
-
})
|
|
76
|
-
.catch((err: unknown) => {
|
|
77
|
-
if (scanRequestIdRef.current !== requestId) return;
|
|
78
|
-
setScanError(err instanceof Error ? err.message : String(err));
|
|
79
|
-
})
|
|
80
|
-
.finally(() => {
|
|
81
|
-
if (scanRequestIdRef.current !== requestId) return;
|
|
82
|
-
setScanning(false);
|
|
83
|
-
});
|
|
84
|
-
}, []);
|
|
85
|
-
|
|
86
|
-
// Auto-scan when dialog opens
|
|
87
|
-
useEffect(() => {
|
|
88
|
-
if (open) {
|
|
89
|
-
scan();
|
|
90
|
-
}
|
|
91
|
-
}, [open, scan]);
|
|
92
|
-
|
|
93
|
-
useEffect(() => {
|
|
94
|
-
if (open) return;
|
|
95
|
-
scanRequestIdRef.current += 1;
|
|
96
|
-
importRequestIdRef.current += 1;
|
|
97
|
-
setScanning(false);
|
|
98
|
-
setImporting(false);
|
|
99
|
-
}, [open]);
|
|
100
|
-
|
|
101
|
-
const toggleProvider = useCallback((index: number) => {
|
|
102
|
-
setSelected((prev) => {
|
|
103
|
-
const next = new Set(prev);
|
|
104
|
-
if (next.has(index)) {
|
|
105
|
-
next.delete(index);
|
|
106
|
-
} else {
|
|
107
|
-
next.add(index);
|
|
108
|
-
}
|
|
109
|
-
return next;
|
|
110
|
-
});
|
|
111
|
-
}, []);
|
|
112
|
-
|
|
113
|
-
const importSelected = useCallback(() => {
|
|
114
|
-
const toImport = providers.filter((_, i) => selected.has(i));
|
|
115
|
-
if (toImport.length === 0 || scanId === null) return;
|
|
116
|
-
|
|
117
|
-
const requestId = importRequestIdRef.current + 1;
|
|
118
|
-
importRequestIdRef.current = requestId;
|
|
119
|
-
setImporting(true);
|
|
120
|
-
setImportError(null);
|
|
121
|
-
setImportResult(null);
|
|
122
|
-
|
|
123
|
-
void fetchJsonWithTimeout(
|
|
124
|
-
"/api/providers/import",
|
|
125
|
-
ImportResponseSchema,
|
|
126
|
-
PROVIDER_IMPORT_TIMEOUT_MS,
|
|
127
|
-
{
|
|
128
|
-
method: "POST",
|
|
129
|
-
headers: { "Content-Type": "application/json" },
|
|
130
|
-
body: JSON.stringify({
|
|
131
|
-
scanId,
|
|
132
|
-
selectionIds: toImport.map((provider) => provider.selectionId),
|
|
133
|
-
}),
|
|
134
|
-
},
|
|
135
|
-
(response) => `Import failed (${String(response.status)})`,
|
|
136
|
-
)
|
|
137
|
-
.then((result) => {
|
|
138
|
-
if (importRequestIdRef.current !== requestId) return;
|
|
139
|
-
// Mark imported providers as already existing so they can't be re-selected
|
|
140
|
-
setProviders((prev) =>
|
|
141
|
-
prev.map((p, i) => (selected.has(i) ? { ...p, alreadyExists: true } : p)),
|
|
142
|
-
);
|
|
143
|
-
setSelected(new Set());
|
|
144
|
-
|
|
145
|
-
if (
|
|
146
|
-
result.errors !== undefined &&
|
|
147
|
-
result.errors.length > 0 &&
|
|
148
|
-
result.message !== undefined
|
|
149
|
-
) {
|
|
150
|
-
setImportResult(result.message);
|
|
151
|
-
} else {
|
|
152
|
-
setImportResult(`Imported ${result.imported ?? toImport.length} provider(s)`);
|
|
153
|
-
}
|
|
154
|
-
onImportComplete();
|
|
155
|
-
})
|
|
156
|
-
.catch((err: unknown) => {
|
|
157
|
-
if (importRequestIdRef.current !== requestId) return;
|
|
158
|
-
setImportError(err instanceof Error ? err.message : String(err));
|
|
159
|
-
})
|
|
160
|
-
.finally(() => {
|
|
161
|
-
if (importRequestIdRef.current !== requestId) return;
|
|
162
|
-
setImporting(false);
|
|
163
|
-
});
|
|
164
|
-
}, [providers, scanId, selected, onImportComplete]);
|
|
165
|
-
|
|
166
|
-
const hasSelectable = providers.some((p) => !p.alreadyExists);
|
|
167
|
-
|
|
168
|
-
return (
|
|
169
|
-
<Dialog open={open} onOpenChange={onOpenChange}>
|
|
170
|
-
<DialogContent className="max-w-xl max-h-[80vh] overflow-hidden flex flex-col">
|
|
171
|
-
<DialogHeader>
|
|
172
|
-
<DialogTitle>Import from External Tools</DialogTitle>
|
|
173
|
-
<p className="text-xs text-muted-foreground">
|
|
174
|
-
Detect provider configurations from Claude Code, OpenCode, and MiMo Code.
|
|
175
|
-
</p>
|
|
176
|
-
</DialogHeader>
|
|
177
|
-
|
|
178
|
-
<div className="flex-1 overflow-y-auto space-y-3">
|
|
179
|
-
{scanning && (
|
|
180
|
-
<div className="flex items-center justify-center py-8 gap-2 text-muted-foreground">
|
|
181
|
-
<Loader2 className="size-4 animate-spin" />
|
|
182
|
-
<span className="text-sm">Scanning for external providers...</span>
|
|
183
|
-
</div>
|
|
184
|
-
)}
|
|
185
|
-
|
|
186
|
-
{scanError !== null && (
|
|
187
|
-
<div className="flex items-center gap-2 text-destructive text-sm py-4">
|
|
188
|
-
<AlertCircle className="size-4" />
|
|
189
|
-
{scanError}
|
|
190
|
-
</div>
|
|
191
|
-
)}
|
|
192
|
-
|
|
193
|
-
{!scanning && scanError === null && providers.length === 0 && (
|
|
194
|
-
<p className="text-sm text-muted-foreground py-8 text-center">
|
|
195
|
-
No external provider configurations found.
|
|
196
|
-
<br />
|
|
197
|
-
<span className="text-xs">
|
|
198
|
-
Supported tools: Claude Code (~/.claude/settings.json), OpenCode
|
|
199
|
-
(~/.config/opencode/opencode.json), MiMo Code (~/.config/mimocode/mimocode.jsonc)
|
|
200
|
-
</span>
|
|
201
|
-
</p>
|
|
202
|
-
)}
|
|
203
|
-
|
|
204
|
-
{!scanning &&
|
|
205
|
-
providers.map((p, i) => (
|
|
206
|
-
<label
|
|
207
|
-
key={p.selectionId}
|
|
208
|
-
className={`flex items-start gap-3 p-3 border rounded-md ${p.alreadyExists ? "" : "cursor-pointer hover:bg-muted/50"}`}
|
|
209
|
-
>
|
|
210
|
-
{!p.alreadyExists && (
|
|
211
|
-
<input
|
|
212
|
-
type="checkbox"
|
|
213
|
-
checked={selected.has(i)}
|
|
214
|
-
disabled={importing}
|
|
215
|
-
onChange={() => toggleProvider(i)}
|
|
216
|
-
className="mt-0.5 size-4"
|
|
217
|
-
/>
|
|
218
|
-
)}
|
|
219
|
-
<div className="flex-1 min-w-0">
|
|
220
|
-
<div className="flex items-center justify-between">
|
|
221
|
-
<ClientLogo client={p.sourceTool} className="size-7 rounded-[8px]" />
|
|
222
|
-
{p.alreadyExists && (
|
|
223
|
-
<span className="text-[10px] text-muted-foreground">Already added</span>
|
|
224
|
-
)}
|
|
225
|
-
</div>
|
|
226
|
-
<div className="mt-1 text-xs leading-snug text-muted-foreground">
|
|
227
|
-
{p.models.slice(0, 4).join(", ")}
|
|
228
|
-
{p.models.length > 4 ? ` +${p.models.length - 4} more` : ""}
|
|
229
|
-
</div>
|
|
230
|
-
<div className="text-xs text-muted-foreground mt-0.5 truncate">
|
|
231
|
-
{p.format === "anthropic"
|
|
232
|
-
? p.anthropicBaseUrl
|
|
233
|
-
: p.openaiResponsesBaseUrl !== ""
|
|
234
|
-
? p.openaiResponsesBaseUrl
|
|
235
|
-
: p.openaiBaseUrl}
|
|
236
|
-
</div>
|
|
237
|
-
<div className="text-xs text-muted-foreground mt-0.5 font-mono">
|
|
238
|
-
{p.apiKeyHint}
|
|
239
|
-
</div>
|
|
240
|
-
</div>
|
|
241
|
-
</label>
|
|
242
|
-
))}
|
|
243
|
-
|
|
244
|
-
{warnings.length > 0 && (
|
|
245
|
-
<div className="text-xs text-muted-foreground space-y-1 border-t pt-2">
|
|
246
|
-
{warnings.map((w, i) => (
|
|
247
|
-
<div key={i} className="flex items-center gap-1">
|
|
248
|
-
<AlertCircle className="size-3" />
|
|
249
|
-
{w}
|
|
250
|
-
</div>
|
|
251
|
-
))}
|
|
252
|
-
</div>
|
|
253
|
-
)}
|
|
254
|
-
|
|
255
|
-
{importResult !== null && (
|
|
256
|
-
<div className="border-t pt-2 text-sm text-status-success">{importResult}</div>
|
|
257
|
-
)}
|
|
258
|
-
|
|
259
|
-
{importError !== null && (
|
|
260
|
-
<div className="text-sm text-destructive border-t pt-2">{importError}</div>
|
|
261
|
-
)}
|
|
262
|
-
</div>
|
|
263
|
-
|
|
264
|
-
<div className="flex items-center justify-between pt-3 border-t">
|
|
265
|
-
<Button variant="outline" size="sm" onClick={scan} disabled={scanning}>
|
|
266
|
-
<Loader2 className={`size-3 mr-1 ${scanning ? "animate-spin" : ""}`} />
|
|
267
|
-
Rescan
|
|
268
|
-
</Button>
|
|
269
|
-
<Button
|
|
270
|
-
size="sm"
|
|
271
|
-
onClick={importSelected}
|
|
272
|
-
disabled={!hasSelectable || selected.size === 0 || importing}
|
|
273
|
-
>
|
|
274
|
-
<Download className="size-3 mr-1" />
|
|
275
|
-
{importing ? "Importing..." : `Import Selected (${selected.size})`}
|
|
276
|
-
</Button>
|
|
277
|
-
</div>
|
|
278
|
-
</DialogContent>
|
|
279
|
-
</Dialog>
|
|
280
|
-
);
|
|
281
|
-
}
|