@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
|
@@ -1,458 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import type { ProviderConfig, ProviderModelMetadata } from "./providerContract";
|
|
3
|
-
import { MAX_PROVIDER_MODEL_NAME_CHARS, MAX_PROVIDER_MODELS } from "./resourceLimits";
|
|
4
|
-
|
|
5
|
-
export const ProviderRegistryModelSchema = z.object({
|
|
6
|
-
id: z.string().min(1).max(MAX_PROVIDER_MODEL_NAME_CHARS),
|
|
7
|
-
aliases: z
|
|
8
|
-
.array(z.string().max(MAX_PROVIDER_MODEL_NAME_CHARS))
|
|
9
|
-
.max(MAX_PROVIDER_MODELS)
|
|
10
|
-
.optional()
|
|
11
|
-
.default([]),
|
|
12
|
-
contextWindow: z.number().int().positive().optional(),
|
|
13
|
-
outputLimit: z.number().int().positive().optional(),
|
|
14
|
-
sourceUrl: z.string().optional(),
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
export const ProviderRegistryProviderSchema = z.object({
|
|
18
|
-
name: z.string().min(1).optional(),
|
|
19
|
-
aliases: z.array(z.string()).max(MAX_PROVIDER_MODELS).optional().default([]),
|
|
20
|
-
baseUrls: z.array(z.string()).max(MAX_PROVIDER_MODELS).optional().default([]),
|
|
21
|
-
models: z.array(ProviderRegistryModelSchema).min(1).max(MAX_PROVIDER_MODELS),
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
export const ProviderModelRegistrySchema = z.object({
|
|
25
|
-
version: z.number().int().positive().optional(),
|
|
26
|
-
updatedAt: z.string().optional(),
|
|
27
|
-
providers: z
|
|
28
|
-
.array(ProviderRegistryProviderSchema)
|
|
29
|
-
.max(MAX_PROVIDER_MODELS)
|
|
30
|
-
.optional()
|
|
31
|
-
.default([]),
|
|
32
|
-
models: z.array(ProviderRegistryModelSchema).max(MAX_PROVIDER_MODELS).optional().default([]),
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
export type ProviderRegistryModel = z.infer<typeof ProviderRegistryModelSchema>;
|
|
36
|
-
export type ProviderModelRegistry = z.infer<typeof ProviderModelRegistrySchema>;
|
|
37
|
-
|
|
38
|
-
export type ProviderContextWindowMatch = {
|
|
39
|
-
providerName: string;
|
|
40
|
-
model: string;
|
|
41
|
-
tokens: number;
|
|
42
|
-
sourceUrl?: string;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export type ProviderModelRegistryApplyResult = {
|
|
46
|
-
modelMetadata: ProviderModelMetadata[];
|
|
47
|
-
imported: number;
|
|
48
|
-
matchedModels: string[];
|
|
49
|
-
missingModels: string[];
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export const BUILTIN_MODEL_METADATA_SOURCE_URL = "agent-inspector://builtin/model-metadata";
|
|
53
|
-
export const HF_DEEPSEEK_V4_PRO_URL = "https://huggingface.co/deepseek-ai/DeepSeek-V4-Pro";
|
|
54
|
-
export const HF_DEEPSEEK_V4_FLASH_URL = "https://huggingface.co/deepseek-ai/DeepSeek-V4-Flash";
|
|
55
|
-
export const HF_MINIMAX_M3_URL = "https://huggingface.co/MiniMaxAI/MiniMax-M3";
|
|
56
|
-
export const HF_MINIMAX_M2_7_URL = "https://huggingface.co/MiniMaxAI/MiniMax-M2.7";
|
|
57
|
-
export const HF_MINIMAX_M2_5_URL = "https://huggingface.co/MiniMaxAI/MiniMax-M2.5";
|
|
58
|
-
export const HF_MINIMAX_M2_1_URL = "https://huggingface.co/MiniMaxAI/MiniMax-M2.1";
|
|
59
|
-
export const ZHIPU_GLM_4_5_URL = "https://docs.bigmodel.cn/cn/guide/models/text/glm-4.5";
|
|
60
|
-
export const ZHIPU_GLM_4_6_URL = "https://docs.bigmodel.cn/cn/guide/models/text/glm-4.6";
|
|
61
|
-
export const ZHIPU_GLM_4_7_URL = "https://docs.bigmodel.cn/cn/guide/models/text/glm-4.7";
|
|
62
|
-
export const ZHIPU_GLM_5_TURBO_URL = "https://docs.bigmodel.cn/cn/guide/models/text/glm-5-turbo";
|
|
63
|
-
export const HF_GLM_5_URL = "https://huggingface.co/zai-org/GLM-5";
|
|
64
|
-
export const HF_GLM_5_1_URL = "https://huggingface.co/zai-org/GLM-5.1";
|
|
65
|
-
export const HF_GLM_5_2_URL = "https://huggingface.co/zai-org/GLM-5.2";
|
|
66
|
-
|
|
67
|
-
export const BUILTIN_PROVIDER_MODEL_REGISTRY: ProviderModelRegistry = {
|
|
68
|
-
version: 1,
|
|
69
|
-
updatedAt: "2026-06-24T00:00:00.000Z",
|
|
70
|
-
providers: [
|
|
71
|
-
{
|
|
72
|
-
name: "DeepSeek",
|
|
73
|
-
aliases: ["deepseek"],
|
|
74
|
-
baseUrls: ["https://api.deepseek.com"],
|
|
75
|
-
models: [
|
|
76
|
-
{
|
|
77
|
-
id: "deepseek-v4-pro",
|
|
78
|
-
aliases: ["DeepSeek-V4-Pro"],
|
|
79
|
-
contextWindow: 1_048_576,
|
|
80
|
-
sourceUrl: HF_DEEPSEEK_V4_PRO_URL,
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
id: "deepseek-v4-flash",
|
|
84
|
-
aliases: ["DeepSeek-V4-Flash"],
|
|
85
|
-
contextWindow: 1_048_576,
|
|
86
|
-
sourceUrl: HF_DEEPSEEK_V4_FLASH_URL,
|
|
87
|
-
},
|
|
88
|
-
],
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
name: "MiniMax",
|
|
92
|
-
aliases: ["minimax"],
|
|
93
|
-
baseUrls: ["https://api.minimaxi.com/anthropic", "https://api.minimaxi.com"],
|
|
94
|
-
models: [
|
|
95
|
-
{
|
|
96
|
-
id: "MiniMax M3",
|
|
97
|
-
aliases: ["MiniMax-M3", "minimax-m3"],
|
|
98
|
-
contextWindow: 1_048_576,
|
|
99
|
-
sourceUrl: HF_MINIMAX_M3_URL,
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
id: "MiniMax M2.7",
|
|
103
|
-
aliases: ["MiniMax-M2.7", "minimax-m2.7"],
|
|
104
|
-
contextWindow: 204_800,
|
|
105
|
-
sourceUrl: HF_MINIMAX_M2_7_URL,
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
id: "MiniMax M2.7-highspeed",
|
|
109
|
-
aliases: ["MiniMax-M2.7-highspeed", "minimax-m2.7-highspeed"],
|
|
110
|
-
contextWindow: 204_800,
|
|
111
|
-
sourceUrl: HF_MINIMAX_M2_7_URL,
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
id: "MiniMax M2.5",
|
|
115
|
-
aliases: ["MiniMax-M2.5", "minimax-m2.5"],
|
|
116
|
-
contextWindow: 196_608,
|
|
117
|
-
sourceUrl: HF_MINIMAX_M2_5_URL,
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
id: "MiniMax M2.5-highspeed",
|
|
121
|
-
aliases: ["MiniMax-M2.5-highspeed", "minimax-m2.5-highspeed"],
|
|
122
|
-
contextWindow: 196_608,
|
|
123
|
-
sourceUrl: HF_MINIMAX_M2_5_URL,
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
id: "MiniMax M2.1",
|
|
127
|
-
aliases: ["MiniMax-M2.1", "minimax-m2.1"],
|
|
128
|
-
contextWindow: 196_608,
|
|
129
|
-
sourceUrl: HF_MINIMAX_M2_1_URL,
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
id: "MiniMax M2.1-highspeed",
|
|
133
|
-
aliases: ["MiniMax-M2.1-highspeed", "minimax-m2.1-highspeed"],
|
|
134
|
-
contextWindow: 196_608,
|
|
135
|
-
sourceUrl: HF_MINIMAX_M2_1_URL,
|
|
136
|
-
},
|
|
137
|
-
],
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
name: "ZhipuAI",
|
|
141
|
-
aliases: ["glm", "zai", "zhipu", "zhipuai", "bigmodel"],
|
|
142
|
-
baseUrls: [
|
|
143
|
-
"https://open.bigmodel.cn/api/paas/v4",
|
|
144
|
-
"https://open.bigmodel.cn/api/coding/paas/v4",
|
|
145
|
-
"https://open.bigmodel.cn/api/anthropic",
|
|
146
|
-
],
|
|
147
|
-
models: [
|
|
148
|
-
{
|
|
149
|
-
id: "glm-4.5",
|
|
150
|
-
aliases: ["GLM-4.5"],
|
|
151
|
-
contextWindow: 131_072,
|
|
152
|
-
outputLimit: 98_304,
|
|
153
|
-
sourceUrl: ZHIPU_GLM_4_5_URL,
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
id: "glm-4.5-air",
|
|
157
|
-
aliases: ["GLM-4.5-Air"],
|
|
158
|
-
contextWindow: 131_072,
|
|
159
|
-
outputLimit: 98_304,
|
|
160
|
-
sourceUrl: ZHIPU_GLM_4_5_URL,
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
id: "glm-4.5-x",
|
|
164
|
-
aliases: ["GLM-4.5-X"],
|
|
165
|
-
contextWindow: 131_072,
|
|
166
|
-
outputLimit: 98_304,
|
|
167
|
-
sourceUrl: ZHIPU_GLM_4_5_URL,
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
id: "glm-4.5-airx",
|
|
171
|
-
aliases: ["GLM-4.5-AirX"],
|
|
172
|
-
contextWindow: 131_072,
|
|
173
|
-
outputLimit: 98_304,
|
|
174
|
-
sourceUrl: ZHIPU_GLM_4_5_URL,
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
id: "glm-4.5-flash",
|
|
178
|
-
aliases: ["GLM-4.5-Flash"],
|
|
179
|
-
contextWindow: 131_072,
|
|
180
|
-
outputLimit: 98_304,
|
|
181
|
-
sourceUrl: ZHIPU_GLM_4_5_URL,
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
id: "glm-4.6",
|
|
185
|
-
aliases: ["GLM-4.6"],
|
|
186
|
-
contextWindow: 202_752,
|
|
187
|
-
outputLimit: 65_536,
|
|
188
|
-
sourceUrl: ZHIPU_GLM_4_6_URL,
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
id: "glm-4.7",
|
|
192
|
-
aliases: ["GLM-4.7"],
|
|
193
|
-
contextWindow: 202_752,
|
|
194
|
-
outputLimit: 131_072,
|
|
195
|
-
sourceUrl: ZHIPU_GLM_4_7_URL,
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
id: "glm-5",
|
|
199
|
-
aliases: ["GLM-5"],
|
|
200
|
-
contextWindow: 202_752,
|
|
201
|
-
sourceUrl: HF_GLM_5_URL,
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
id: "glm-5.1",
|
|
205
|
-
aliases: ["GLM-5.1"],
|
|
206
|
-
contextWindow: 202_752,
|
|
207
|
-
sourceUrl: HF_GLM_5_1_URL,
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
id: "glm-5.2",
|
|
211
|
-
aliases: ["GLM-5.2"],
|
|
212
|
-
contextWindow: 1_048_576,
|
|
213
|
-
sourceUrl: HF_GLM_5_2_URL,
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
id: "glm-5-turbo",
|
|
217
|
-
aliases: ["GLM-5-Turbo"],
|
|
218
|
-
contextWindow: 202_752,
|
|
219
|
-
outputLimit: 131_072,
|
|
220
|
-
sourceUrl: ZHIPU_GLM_5_TURBO_URL,
|
|
221
|
-
},
|
|
222
|
-
],
|
|
223
|
-
},
|
|
224
|
-
],
|
|
225
|
-
models: [],
|
|
226
|
-
};
|
|
227
|
-
|
|
228
|
-
function normalizeModelName(value: string): string {
|
|
229
|
-
return value.trim().toLowerCase().replace(/\s+/g, "-");
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
function normalizeProviderName(value: string): string {
|
|
233
|
-
return value.trim().toLowerCase().replace(/\s+/g, "");
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
function normalizeUrl(value: string | undefined): string | null {
|
|
237
|
-
if (value === undefined) return null;
|
|
238
|
-
const trimmed = value.trim();
|
|
239
|
-
if (trimmed === "") return null;
|
|
240
|
-
try {
|
|
241
|
-
const parsed = new URL(trimmed);
|
|
242
|
-
const path = parsed.pathname.replace(/\/+$/, "");
|
|
243
|
-
return `${parsed.origin}${path}`.toLowerCase();
|
|
244
|
-
} catch {
|
|
245
|
-
return trimmed.replace(/\/+$/, "").toLowerCase();
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
function providerBaseUrls(provider: ProviderConfig): string[] {
|
|
250
|
-
const urls: string[] = [];
|
|
251
|
-
if (provider.anthropicBaseUrl !== undefined && provider.anthropicBaseUrl.trim() !== "") {
|
|
252
|
-
urls.push(provider.anthropicBaseUrl);
|
|
253
|
-
}
|
|
254
|
-
if (provider.openaiBaseUrl !== undefined && provider.openaiBaseUrl.trim() !== "") {
|
|
255
|
-
urls.push(provider.openaiBaseUrl);
|
|
256
|
-
}
|
|
257
|
-
if (
|
|
258
|
-
provider.openaiResponsesBaseUrl !== undefined &&
|
|
259
|
-
provider.openaiResponsesBaseUrl.trim() !== ""
|
|
260
|
-
) {
|
|
261
|
-
urls.push(provider.openaiResponsesBaseUrl);
|
|
262
|
-
}
|
|
263
|
-
if (provider.baseUrl !== undefined && provider.baseUrl.trim() !== "") {
|
|
264
|
-
urls.push(provider.baseUrl);
|
|
265
|
-
}
|
|
266
|
-
return urls;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
function providerModels(provider: ProviderConfig): string[] {
|
|
270
|
-
const models = provider.models.filter((model) => model.trim() !== "");
|
|
271
|
-
if (models.length > 0) return models;
|
|
272
|
-
if (provider.model !== undefined && provider.model.trim() !== "") return [provider.model];
|
|
273
|
-
return [];
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
function registryModelHasUsableMetadata(model: ProviderRegistryModel): boolean {
|
|
277
|
-
return model.contextWindow !== undefined || model.outputLimit !== undefined;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
function registryModelMatches(model: string, registryModel: ProviderRegistryModel): boolean {
|
|
281
|
-
const normalized = normalizeModelName(model);
|
|
282
|
-
if (normalized === normalizeModelName(registryModel.id)) return true;
|
|
283
|
-
return registryModel.aliases.some((alias) => normalized === normalizeModelName(alias));
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
function providerEntryMatches(
|
|
287
|
-
provider: ProviderConfig,
|
|
288
|
-
entry: ProviderModelRegistry["providers"][number],
|
|
289
|
-
): boolean {
|
|
290
|
-
const providerName = normalizeProviderName(provider.name);
|
|
291
|
-
const names = entry.name === undefined ? [...entry.aliases] : [entry.name, ...entry.aliases];
|
|
292
|
-
const nameMatches = names.some((name) => {
|
|
293
|
-
const normalized = normalizeProviderName(name);
|
|
294
|
-
return providerName.includes(normalized) || normalized.includes(providerName);
|
|
295
|
-
});
|
|
296
|
-
if (nameMatches) return true;
|
|
297
|
-
|
|
298
|
-
const normalizedProviderUrls = providerBaseUrls(provider)
|
|
299
|
-
.map((url) => normalizeUrl(url))
|
|
300
|
-
.filter((url): url is string => url !== null);
|
|
301
|
-
const baseUrlMatches = entry.baseUrls.some((url) => {
|
|
302
|
-
const normalized = normalizeUrl(url);
|
|
303
|
-
return normalized !== null && normalizedProviderUrls.includes(normalized);
|
|
304
|
-
});
|
|
305
|
-
if (baseUrlMatches) return true;
|
|
306
|
-
|
|
307
|
-
return providerModels(provider).some((model) =>
|
|
308
|
-
entry.models.some((registryModel) => registryModelMatches(model, registryModel)),
|
|
309
|
-
);
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
function findRegistryModel(
|
|
313
|
-
provider: ProviderConfig,
|
|
314
|
-
model: string,
|
|
315
|
-
registry: ProviderModelRegistry,
|
|
316
|
-
): ProviderRegistryModel | null {
|
|
317
|
-
for (const providerEntry of registry.providers) {
|
|
318
|
-
if (!providerEntryMatches(provider, providerEntry)) continue;
|
|
319
|
-
const matched = providerEntry.models.find((registryModel) =>
|
|
320
|
-
registryModelMatches(model, registryModel),
|
|
321
|
-
);
|
|
322
|
-
if (matched !== undefined && registryModelHasUsableMetadata(matched)) return matched;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
const topLevelMatched = registry.models.find((registryModel) =>
|
|
326
|
-
registryModelMatches(model, registryModel),
|
|
327
|
-
);
|
|
328
|
-
if (topLevelMatched !== undefined && registryModelHasUsableMetadata(topLevelMatched)) {
|
|
329
|
-
return topLevelMatched;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
return null;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
export function findProviderModelMetadata(
|
|
336
|
-
provider: ProviderConfig,
|
|
337
|
-
model: string,
|
|
338
|
-
): ProviderModelMetadata | null {
|
|
339
|
-
const normalized = normalizeModelName(model);
|
|
340
|
-
const metadata = provider.modelMetadata ?? [];
|
|
341
|
-
return metadata.find((entry) => normalizeModelName(entry.model) === normalized) ?? null;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
export function providerHasContextMetadata(provider: ProviderConfig): boolean {
|
|
345
|
-
const models = providerModels(provider);
|
|
346
|
-
if (models.length === 0) return false;
|
|
347
|
-
return models.every((model) => {
|
|
348
|
-
const metadata = findProviderModelMetadata(provider, model);
|
|
349
|
-
return metadata !== null && metadata.contextWindow !== undefined;
|
|
350
|
-
});
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
export function resolveProviderContextWindow(
|
|
354
|
-
model: string | null,
|
|
355
|
-
providers: readonly ProviderConfig[],
|
|
356
|
-
): ProviderContextWindowMatch | null {
|
|
357
|
-
if (model === null) return null;
|
|
358
|
-
for (const provider of providers) {
|
|
359
|
-
const metadata = findProviderModelMetadata(provider, model);
|
|
360
|
-
if (metadata !== null && metadata.contextWindow !== undefined) {
|
|
361
|
-
return {
|
|
362
|
-
providerName: provider.name,
|
|
363
|
-
model: metadata.model,
|
|
364
|
-
tokens: metadata.contextWindow,
|
|
365
|
-
sourceUrl: metadata.sourceUrl,
|
|
366
|
-
};
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
return null;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
export function applyProviderModelRegistry(
|
|
373
|
-
provider: ProviderConfig,
|
|
374
|
-
registry: ProviderModelRegistry,
|
|
375
|
-
sourceUrl: string,
|
|
376
|
-
updatedAt: string,
|
|
377
|
-
mode: "replace" | "fill-missing" = "replace",
|
|
378
|
-
): ProviderModelRegistryApplyResult {
|
|
379
|
-
const existing = new Map<string, ProviderModelMetadata>();
|
|
380
|
-
for (const metadata of provider.modelMetadata ?? []) {
|
|
381
|
-
existing.set(normalizeModelName(metadata.model), metadata);
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
const matchedModels: string[] = [];
|
|
385
|
-
const missingModels: string[] = [];
|
|
386
|
-
|
|
387
|
-
for (const model of providerModels(provider)) {
|
|
388
|
-
const registryModel = findRegistryModel(provider, model, registry);
|
|
389
|
-
if (registryModel === null) {
|
|
390
|
-
missingModels.push(model);
|
|
391
|
-
continue;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
const normalized = normalizeModelName(model);
|
|
395
|
-
const existingMetadata = existing.get(normalized);
|
|
396
|
-
const existingIsManual = existingMetadata?.source === "manual";
|
|
397
|
-
if (
|
|
398
|
-
mode === "fill-missing" &&
|
|
399
|
-
existingIsManual &&
|
|
400
|
-
existingMetadata !== undefined &&
|
|
401
|
-
existingMetadata.contextWindow !== undefined &&
|
|
402
|
-
(existingMetadata.outputLimit !== undefined || registryModel.outputLimit === undefined)
|
|
403
|
-
) {
|
|
404
|
-
continue;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
const keepManualValue = mode === "fill-missing" && existingIsManual;
|
|
408
|
-
existing.set(normalized, {
|
|
409
|
-
model,
|
|
410
|
-
contextWindow: keepManualValue
|
|
411
|
-
? (existingMetadata?.contextWindow ?? registryModel.contextWindow)
|
|
412
|
-
: (registryModel.contextWindow ?? existingMetadata?.contextWindow),
|
|
413
|
-
outputLimit: keepManualValue
|
|
414
|
-
? (existingMetadata?.outputLimit ?? registryModel.outputLimit)
|
|
415
|
-
: (registryModel.outputLimit ?? existingMetadata?.outputLimit),
|
|
416
|
-
source: keepManualValue ? "manual" : "registry",
|
|
417
|
-
sourceUrl: keepManualValue
|
|
418
|
-
? (existingMetadata?.sourceUrl ?? registryModel.sourceUrl ?? sourceUrl)
|
|
419
|
-
: (registryModel.sourceUrl ?? sourceUrl),
|
|
420
|
-
updatedAt,
|
|
421
|
-
});
|
|
422
|
-
matchedModels.push(model);
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
const modelMetadata = [...existing.values()].toSorted((a, b) => a.model.localeCompare(b.model));
|
|
426
|
-
|
|
427
|
-
return {
|
|
428
|
-
modelMetadata,
|
|
429
|
-
imported: matchedModels.length,
|
|
430
|
-
matchedModels,
|
|
431
|
-
missingModels,
|
|
432
|
-
};
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
export function applyBuiltinProviderModelMetadata(
|
|
436
|
-
provider: ProviderConfig,
|
|
437
|
-
updatedAt: string,
|
|
438
|
-
): ProviderModelRegistryApplyResult {
|
|
439
|
-
return applyProviderModelRegistry(
|
|
440
|
-
provider,
|
|
441
|
-
BUILTIN_PROVIDER_MODEL_REGISTRY,
|
|
442
|
-
BUILTIN_MODEL_METADATA_SOURCE_URL,
|
|
443
|
-
updatedAt,
|
|
444
|
-
"fill-missing",
|
|
445
|
-
);
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
export function withBuiltinProviderModelMetadata(
|
|
449
|
-
provider: ProviderConfig,
|
|
450
|
-
updatedAt: string,
|
|
451
|
-
): ProviderConfig {
|
|
452
|
-
const result = applyBuiltinProviderModelMetadata(provider, updatedAt);
|
|
453
|
-
if (result.imported === 0) return provider;
|
|
454
|
-
return {
|
|
455
|
-
...provider,
|
|
456
|
-
modelMetadata: result.modelMetadata,
|
|
457
|
-
};
|
|
458
|
-
}
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { StreamingChunkSchema } from "../contracts";
|
|
3
|
-
|
|
4
|
-
export const ProviderTestErrorTypeSchema = z.enum([
|
|
5
|
-
"timeout",
|
|
6
|
-
"network_unreachable",
|
|
7
|
-
"connection_refused",
|
|
8
|
-
"auth_failed",
|
|
9
|
-
"rate_limited",
|
|
10
|
-
"server_error",
|
|
11
|
-
"invalid_response",
|
|
12
|
-
"unknown",
|
|
13
|
-
]);
|
|
14
|
-
|
|
15
|
-
const ProviderTestErrorSchema = z.object({
|
|
16
|
-
message: z.string(),
|
|
17
|
-
type: ProviderTestErrorTypeSchema,
|
|
18
|
-
details: z.string().optional(),
|
|
19
|
-
hint: z.string().optional(),
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
const ProviderTestContentSchema = z.object({
|
|
23
|
-
type: z.enum(["text", "thinking"]),
|
|
24
|
-
text: z.string().optional(),
|
|
25
|
-
thinking: z.string().optional(),
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
const ProviderTestDebugSchema = z.object({
|
|
29
|
-
requestUrl: z.string().optional(),
|
|
30
|
-
requestMethod: z.string().optional(),
|
|
31
|
-
requestHeaders: z.record(z.string(), z.string()).optional(),
|
|
32
|
-
requestBody: z.string().optional(),
|
|
33
|
-
responseStatus: z.number().optional(),
|
|
34
|
-
responseStatusText: z.string().optional(),
|
|
35
|
-
responseHeaders: z.record(z.string(), z.string()).optional(),
|
|
36
|
-
responseBody: z.string().optional(),
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
const NullableProviderMetricSchema = z.number().nullable().optional();
|
|
40
|
-
|
|
41
|
-
export const ProviderTestResultSchema = z.object({
|
|
42
|
-
success: z.boolean(),
|
|
43
|
-
error: ProviderTestErrorSchema.optional(),
|
|
44
|
-
model: z.string().optional(),
|
|
45
|
-
inputTokens: NullableProviderMetricSchema,
|
|
46
|
-
outputTokens: NullableProviderMetricSchema,
|
|
47
|
-
cacheCreationInputTokens: NullableProviderMetricSchema,
|
|
48
|
-
cacheReadInputTokens: NullableProviderMetricSchema,
|
|
49
|
-
latencyMs: z.number().optional(),
|
|
50
|
-
firstChunkMs: z.number().nullable().optional(),
|
|
51
|
-
totalStreamMs: z.number().nullable().optional(),
|
|
52
|
-
tokensPerSecond: z.number().nullable().optional(),
|
|
53
|
-
content: z.array(ProviderTestContentSchema).optional(),
|
|
54
|
-
rawResponse: z.string().optional(),
|
|
55
|
-
streaming: z.boolean().optional(),
|
|
56
|
-
streamingChunks: z
|
|
57
|
-
.object({
|
|
58
|
-
chunks: z.array(StreamingChunkSchema),
|
|
59
|
-
truncated: z.boolean().default(false),
|
|
60
|
-
})
|
|
61
|
-
.optional(),
|
|
62
|
-
requestHeaders: z.record(z.string(), z.string()).optional(),
|
|
63
|
-
debug: ProviderTestDebugSchema.optional(),
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
export const ProviderTestStateSchema = z.union([
|
|
67
|
-
ProviderTestResultSchema,
|
|
68
|
-
z.object({ notConfigured: z.literal(true) }),
|
|
69
|
-
z.object({ testing: z.literal(true) }),
|
|
70
|
-
]);
|
|
71
|
-
|
|
72
|
-
const ProviderFormatTestResultsSchema = z.object({
|
|
73
|
-
nonStreaming: ProviderTestStateSchema,
|
|
74
|
-
streaming: ProviderTestStateSchema,
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
export type ProviderFormatTestResults = z.infer<typeof ProviderFormatTestResultsSchema>;
|
|
78
|
-
|
|
79
|
-
export function createNotConfiguredProviderFormatTestResults(): ProviderFormatTestResults {
|
|
80
|
-
return {
|
|
81
|
-
nonStreaming: { notConfigured: true },
|
|
82
|
-
streaming: { notConfigured: true },
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const ModelTestResultsSchema = z
|
|
87
|
-
.object({
|
|
88
|
-
anthropic: ProviderFormatTestResultsSchema,
|
|
89
|
-
openai: ProviderFormatTestResultsSchema.optional(),
|
|
90
|
-
openaiChat: ProviderFormatTestResultsSchema.optional(),
|
|
91
|
-
openaiResponses: ProviderFormatTestResultsSchema.optional(),
|
|
92
|
-
})
|
|
93
|
-
.transform((value) => {
|
|
94
|
-
const openaiChat =
|
|
95
|
-
value.openaiChat ?? value.openai ?? createNotConfiguredProviderFormatTestResults();
|
|
96
|
-
return {
|
|
97
|
-
...value,
|
|
98
|
-
openai: value.openai ?? openaiChat,
|
|
99
|
-
openaiChat,
|
|
100
|
-
openaiResponses: value.openaiResponses ?? createNotConfiguredProviderFormatTestResults(),
|
|
101
|
-
};
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
export const ProviderTestResultsSchema = z
|
|
105
|
-
.object({
|
|
106
|
-
anthropic: ProviderFormatTestResultsSchema,
|
|
107
|
-
openai: ProviderFormatTestResultsSchema.optional(),
|
|
108
|
-
openaiChat: ProviderFormatTestResultsSchema.optional(),
|
|
109
|
-
openaiResponses: ProviderFormatTestResultsSchema.optional(),
|
|
110
|
-
models: z.record(z.string(), ModelTestResultsSchema).optional(),
|
|
111
|
-
testedAt: z.string().optional(),
|
|
112
|
-
})
|
|
113
|
-
.transform((value) => {
|
|
114
|
-
const openaiChat =
|
|
115
|
-
value.openaiChat ?? value.openai ?? createNotConfiguredProviderFormatTestResults();
|
|
116
|
-
return {
|
|
117
|
-
...value,
|
|
118
|
-
openai: value.openai ?? openaiChat,
|
|
119
|
-
openaiChat,
|
|
120
|
-
openaiResponses: value.openaiResponses ?? createNotConfiguredProviderFormatTestResults(),
|
|
121
|
-
};
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
export type ProviderTestErrorType = z.infer<typeof ProviderTestErrorTypeSchema>;
|
|
125
|
-
export type ProviderTestDebug = z.infer<typeof ProviderTestDebugSchema>;
|
|
126
|
-
export type ProviderTestResult = z.infer<typeof ProviderTestResultSchema>;
|
|
127
|
-
export type ProviderTestState = z.infer<typeof ProviderTestStateSchema>;
|
|
128
|
-
export type ProviderModelTestResults = z.infer<typeof ModelTestResultsSchema>;
|
|
129
|
-
export type ProviderTestResults = z.infer<typeof ProviderTestResultsSchema>;
|
|
130
|
-
|
|
131
|
-
export function createPendingProviderTestResults(): ProviderTestResults {
|
|
132
|
-
return {
|
|
133
|
-
anthropic: {
|
|
134
|
-
nonStreaming: { testing: true },
|
|
135
|
-
streaming: { testing: true },
|
|
136
|
-
},
|
|
137
|
-
openai: {
|
|
138
|
-
nonStreaming: { testing: true },
|
|
139
|
-
streaming: { testing: true },
|
|
140
|
-
},
|
|
141
|
-
openaiChat: {
|
|
142
|
-
nonStreaming: { testing: true },
|
|
143
|
-
streaming: { testing: true },
|
|
144
|
-
},
|
|
145
|
-
openaiResponses: {
|
|
146
|
-
nonStreaming: { testing: true },
|
|
147
|
-
streaming: { testing: true },
|
|
148
|
-
},
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
export function createFailedProviderTestResults(
|
|
153
|
-
message: string,
|
|
154
|
-
type: ProviderTestErrorType,
|
|
155
|
-
): ProviderTestResults {
|
|
156
|
-
const createFormatResult = () => ({
|
|
157
|
-
nonStreaming: {
|
|
158
|
-
success: false as const,
|
|
159
|
-
error: { message, type },
|
|
160
|
-
},
|
|
161
|
-
streaming: { notConfigured: true as const },
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
return {
|
|
165
|
-
anthropic: createFormatResult(),
|
|
166
|
-
openai: createFormatResult(),
|
|
167
|
-
openaiChat: createFormatResult(),
|
|
168
|
-
openaiResponses: createFormatResult(),
|
|
169
|
-
};
|
|
170
|
-
}
|