@undefineds.co/xpod 0.4.11 → 0.4.13
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/config/components-ignore.json +5 -1
- package/config/notifications.json +68 -0
- package/config/xpod.base.json +9 -11
- package/dist/acceptance/QleverSemanticConformance.js +7 -0
- package/dist/ai/service/AiCredentialSecret.d.ts +30 -0
- package/dist/ai/service/AiCredentialSecret.js +120 -0
- package/dist/ai/service/CredentialReaderImpl.d.ts +18 -0
- package/dist/ai/service/CredentialReaderImpl.js +81 -5
- package/dist/ai/service/CredentialReaderImpl.jsonld +42 -2
- package/dist/ai/service/EmbeddingModelPolicy.d.ts +79 -0
- package/dist/ai/service/EmbeddingModelPolicy.js +134 -0
- package/dist/ai/service/EmbeddingProviderError.js +6 -0
- package/dist/ai/service/EmbeddingServiceImpl.d.ts +13 -1
- package/dist/ai/service/EmbeddingServiceImpl.js +18 -5
- package/dist/ai/service/EmbeddingServiceImpl.jsonld +35 -0
- package/dist/ai/service/index.d.ts +2 -0
- package/dist/ai/service/index.js +2 -0
- package/dist/api/ai-gateway/connect/index.d.ts +20 -2
- package/dist/api/ai-gateway/connect/index.js +162 -16
- package/dist/api/ai-gateway/credentials/AiCredentialSecretDecoder.d.ts +12 -0
- package/dist/api/ai-gateway/credentials/AiCredentialSecretDecoder.js +30 -0
- package/dist/api/ai-gateway/errors.d.ts +1 -1
- package/dist/api/ai-gateway/models/GatewayEmbeddingModelCatalog.d.ts +11 -0
- package/dist/api/ai-gateway/models/GatewayEmbeddingModelCatalog.js +31 -0
- package/dist/api/ai-gateway/models/PodModelSelectionRepository.js +7 -3
- package/dist/api/ai-gateway/models/ProviderCustomModelsService.d.ts +18 -0
- package/dist/api/ai-gateway/models/ProviderCustomModelsService.js +23 -0
- package/dist/api/ai-gateway/models/ProviderModelDiscoveryAdapters.d.ts +3 -1
- package/dist/api/ai-gateway/models/ProviderModelDiscoveryAdapters.js +2 -45
- package/dist/api/ai-gateway/models/ProviderModelSelectionService.d.ts +10 -0
- package/dist/api/ai-gateway/models/ProviderModelSelectionService.js +57 -20
- package/dist/api/ai-gateway/models/ProviderModelType.d.ts +28 -0
- package/dist/api/ai-gateway/models/ProviderModelType.js +34 -0
- package/dist/api/ai-gateway/models/ProviderModelsAdapter.d.ts +10 -0
- package/dist/api/ai-gateway/models/ProviderModelsAdapter.js +3 -4
- package/dist/api/ai-gateway/models/index.d.ts +1 -0
- package/dist/api/ai-gateway/models/index.js +3 -1
- package/dist/api/ai-gateway/providers/CustomRuntimeAdapter.d.ts +7 -0
- package/dist/api/ai-gateway/providers/CustomRuntimeAdapter.js +9 -2
- package/dist/api/ai-gateway/providers/ModelsDevCatalog.d.ts +7 -1
- package/dist/api/ai-gateway/providers/ModelsDevCatalog.js +4 -10
- package/dist/api/ai-gateway/providers/OfferingAuthorization.d.ts +6 -1
- package/dist/api/ai-gateway/providers/OfferingAuthorization.js +0 -3
- package/dist/api/ai-gateway/providers/ProviderRegistry.d.ts +107 -0
- package/dist/api/ai-gateway/providers/ProviderRegistry.js +246 -23
- package/dist/api/ai-gateway/providers/ProviderRuntimeRegistry.d.ts +5 -0
- package/dist/api/ai-gateway/providers/ProviderRuntimeRegistry.js +5 -1
- package/dist/api/ai-gateway/quota/SubscriptionQuotaAdapters.d.ts +12 -4
- package/dist/api/ai-gateway/quota/SubscriptionQuotaAdapters.js +11 -11
- package/dist/api/ai-gateway/routing/ModelRouter.d.ts +14 -0
- package/dist/api/ai-gateway/routing/ModelRouter.js +43 -4
- package/dist/api/ai-gateway/service-access/AiConnectionsServiceAccess.d.ts +9 -1
- package/dist/api/ai-gateway/service-access/AiConnectionsServiceAccess.js +3 -27
- package/dist/api/chatkit/pod-store.d.ts +31 -0
- package/dist/api/chatkit/pod-store.js +132 -8
- package/dist/api/container/common.js +24 -4
- package/dist/api/container/routes.js +17 -2
- package/dist/api/container/types.d.ts +3 -1
- package/dist/api/handlers/AdminHandler.d.ts +13 -0
- package/dist/api/handlers/AdminHandler.js +47 -18
- package/dist/api/handlers/AiConfigHandler.d.ts +6 -0
- package/dist/api/handlers/AiConfigHandler.js +28 -0
- package/dist/api/handlers/AiGatewayManagementHandler.js +36 -0
- package/dist/api/runs/RdfRunContextRetriever.d.ts +14 -0
- package/dist/api/runs/RdfRunContextRetriever.js +41 -5
- package/dist/api/runtime.js +2 -1
- package/dist/api/service/AiClientConfigurationService.d.ts +1 -1
- package/dist/api/service/AiClientConfigurationService.js +1 -1
- package/dist/cli/commands/secret.d.ts +1 -0
- package/dist/cli/commands/secret.js +25 -7
- package/dist/components/components.jsonld +3 -1
- package/dist/components/context.jsonld +53 -1
- package/dist/http/SubgraphSparqlHttpHandler.d.ts +59 -2
- package/dist/http/SubgraphSparqlHttpHandler.js +145 -13
- package/dist/http/SubgraphSparqlHttpHandler.jsonld +37 -0
- package/dist/identity/drizzle/EdgeNodeRepository.d.ts +0 -12
- package/dist/identity/drizzle/EdgeNodeRepository.js +5 -13
- package/dist/index.d.ts +2 -1
- package/dist/index.js +7 -3
- package/dist/logging/log-file.d.ts +17 -0
- package/dist/logging/log-file.js +69 -0
- package/dist/main.js +2 -1
- package/dist/notifications/NotificationChannelSweeper.d.ts +50 -0
- package/dist/notifications/NotificationChannelSweeper.js +131 -0
- package/dist/notifications/NotificationChannelSweeper.jsonld +136 -0
- package/dist/notifications/ReclaimingWebSocket2023Storer.d.ts +25 -0
- package/dist/notifications/ReclaimingWebSocket2023Storer.js +56 -0
- package/dist/notifications/ReclaimingWebSocket2023Storer.jsonld +77 -0
- package/dist/notifications/index.d.ts +2 -0
- package/dist/notifications/index.js +2 -0
- package/dist/runtime/Proxy.d.ts +37 -0
- package/dist/runtime/Proxy.js +88 -16
- package/dist/runtime/bootstrap.js +2 -1
- package/dist/runtime/upgrade/BunNativeUpgradeRelay.d.ts +116 -0
- package/dist/runtime/upgrade/BunNativeUpgradeRelay.js +423 -0
- package/dist/runtime/upgrade/UpgradeHandshake.d.ts +63 -0
- package/dist/runtime/upgrade/UpgradeHandshake.js +199 -0
- package/dist/runtime/upgrade/WebSocketFrames.d.ts +67 -0
- package/dist/runtime/upgrade/WebSocketFrames.js +224 -0
- package/dist/storage/rdf/PostgresRdfEngine.js +10 -4
- package/dist/storage/rdf/RdfAccessScope.js +15 -1
- package/dist/storage/rdf/RdfEngineRdfJsSource.js +10 -2
- package/node_modules/@undefineds.co/ai-connections/dist/AiApiKeyPool.d.ts +1 -1
- package/node_modules/@undefineds.co/ai-connections/dist/AiApiKeyPool.js +9 -2
- package/node_modules/@undefineds.co/ai-connections/dist/AiAuthorizationActions.d.ts +12 -3
- package/node_modules/@undefineds.co/ai-connections/dist/AiAuthorizationActions.js +27 -10
- package/node_modules/@undefineds.co/ai-connections/dist/AiClientConfigurationSection.d.ts +7 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiClientConfigurationSection.js +15 -13
- package/node_modules/@undefineds.co/ai-connections/dist/AiConnectDialog.d.ts +1 -1
- package/node_modules/@undefineds.co/ai-connections/dist/AiConnectDialog.js +1 -1
- package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsList.js +10 -6
- package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsMain.d.ts +15 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsMain.js +29 -3
- package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsMainHeader.js +18 -3
- package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsPanel.d.ts +17 -2
- package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsPanel.js +94 -22
- package/node_modules/@undefineds.co/ai-connections/dist/AiCopyButton.d.ts +35 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiCopyButton.js +45 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiCredentialPoolSection.d.ts +1 -1
- package/node_modules/@undefineds.co/ai-connections/dist/AiCredentialPoolSection.js +71 -11
- package/node_modules/@undefineds.co/ai-connections/dist/AiCredentialRow.d.ts +1 -1
- package/node_modules/@undefineds.co/ai-connections/dist/AiCredentialRow.js +9 -7
- package/node_modules/@undefineds.co/ai-connections/dist/AiCustomProviderDialog.d.ts +1 -1
- package/node_modules/@undefineds.co/ai-connections/dist/AiEndpointList.d.ts +23 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiEndpointList.js +24 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayKeyRow.d.ts +1 -1
- package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayKeysSection.d.ts +14 -5
- package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayKeysSection.js +35 -38
- package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayModelsSection.d.ts +21 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayModelsSection.js +51 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiInfoTooltip.d.ts +15 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiInfoTooltip.js +16 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiModelCatalog.d.ts +175 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiModelCatalog.js +133 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiOfferingDetails.d.ts +1 -1
- package/node_modules/@undefineds.co/ai-connections/dist/AiOfferingDetails.js +2 -2
- package/node_modules/@undefineds.co/ai-connections/dist/AiProviderCard.d.ts +1 -1
- package/node_modules/@undefineds.co/ai-connections/dist/AiProviderCard.js +13 -64
- package/node_modules/@undefineds.co/ai-connections/dist/AiProviderHeader.d.ts +21 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiProviderHeader.js +12 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiQuotaCard.d.ts +1 -1
- package/node_modules/@undefineds.co/ai-connections/dist/AiRowAction.d.ts +15 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiRowAction.js +12 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiSortableCredentialList.d.ts +1 -1
- package/node_modules/@undefineds.co/ai-connections/dist/AiSortableCredentialList.js +2 -1
- package/node_modules/@undefineds.co/ai-connections/dist/authorization-methods.d.ts +39 -6
- package/node_modules/@undefineds.co/ai-connections/dist/authorization-methods.js +57 -11
- package/node_modules/@undefineds.co/ai-connections/dist/collection-runtime.d.ts +46 -0
- package/node_modules/@undefineds.co/ai-connections/dist/collection-runtime.js +231 -0
- package/node_modules/@undefineds.co/ai-connections/dist/collections.d.ts +119 -0
- package/node_modules/@undefineds.co/ai-connections/dist/collections.js +173 -0
- package/node_modules/@undefineds.co/ai-connections/dist/controller.d.ts +71 -5
- package/node_modules/@undefineds.co/ai-connections/dist/controller.js +288 -18
- package/node_modules/@undefineds.co/ai-connections/dist/credential-labels.d.ts +6 -1
- package/node_modules/@undefineds.co/ai-connections/dist/credential-labels.js +8 -3
- package/node_modules/@undefineds.co/ai-connections/dist/display-wording.d.ts +20 -0
- package/node_modules/@undefineds.co/ai-connections/dist/display-wording.js +73 -0
- package/node_modules/@undefineds.co/ai-connections/dist/error-wording.d.ts +24 -0
- package/node_modules/@undefineds.co/ai-connections/dist/error-wording.js +253 -0
- package/node_modules/@undefineds.co/ai-connections/dist/gateway-endpoints.d.ts +14 -0
- package/node_modules/@undefineds.co/ai-connections/dist/gateway-endpoints.js +20 -0
- package/node_modules/@undefineds.co/ai-connections/dist/index.d.ts +8 -1
- package/node_modules/@undefineds.co/ai-connections/dist/index.js +8 -1
- package/node_modules/@undefineds.co/ai-connections/dist/manifest.js +1 -1
- package/node_modules/@undefineds.co/ai-connections/dist/offering-endpoints.d.ts +15 -1
- package/node_modules/@undefineds.co/ai-connections/dist/offering-endpoints.js +17 -0
- package/node_modules/@undefineds.co/ai-connections/dist/offering-label.d.ts +1 -1
- package/node_modules/@undefineds.co/ai-connections/dist/provider-visuals.d.ts +6 -1
- package/node_modules/@undefineds.co/ai-connections/dist/provider-visuals.js +5 -0
- package/node_modules/@undefineds.co/ai-connections/dist/service-access.js +2 -27
- package/node_modules/@undefineds.co/ai-connections/dist/useAiConnectDialog.d.ts +1 -1
- package/node_modules/@undefineds.co/ai-connections/package.json +2 -24
- package/node_modules/@undefineds.co/{ai-connections → ai-connections-core}/dist/ai-connections-client.d.ts +12 -3
- package/node_modules/@undefineds.co/ai-connections-core/dist/ai-connections-client.js +21 -0
- package/node_modules/@undefineds.co/{ai-connections → ai-connections-core}/dist/client/normalize.d.ts +17 -7
- package/node_modules/@undefineds.co/{ai-connections → ai-connections-core}/dist/client/normalize.js +48 -216
- package/node_modules/@undefineds.co/{ai-connections → ai-connections-core}/dist/client/request.js +3 -3
- package/node_modules/@undefineds.co/{ai-connections → ai-connections-core}/dist/client/types.d.ts +31 -2
- package/node_modules/@undefineds.co/{ai-connections → ai-connections-core}/dist/client-config/base-adapter.d.ts +1 -3
- package/node_modules/@undefineds.co/{ai-connections → ai-connections-core}/dist/client-config/base-adapter.js +3 -7
- package/node_modules/@undefineds.co/{ai-connections → ai-connections-core}/dist/client-config/index.cjs +9 -7
- package/node_modules/@undefineds.co/ai-connections-core/dist/credential-storage.d.ts +59 -0
- package/node_modules/@undefineds.co/ai-connections-core/dist/credential-storage.js +131 -0
- package/node_modules/@undefineds.co/ai-connections-core/dist/endpoint-urls.d.ts +15 -0
- package/node_modules/@undefineds.co/ai-connections-core/dist/endpoint-urls.js +20 -0
- package/node_modules/@undefineds.co/ai-connections-core/dist/index.d.ts +9 -0
- package/node_modules/@undefineds.co/ai-connections-core/dist/index.js +9 -0
- package/node_modules/@undefineds.co/{ai-connections → ai-connections-core}/dist/provider-catalog.cjs +68 -24
- package/node_modules/@undefineds.co/ai-connections-core/dist/provider-catalog.d.ts +84 -0
- package/node_modules/@undefineds.co/{ai-connections → ai-connections-core}/dist/provider-catalog.js +121 -22
- package/node_modules/@undefineds.co/ai-connections-core/package.json +61 -0
- package/node_modules/@undefineds.co/extension-sdk/dist/manifest.d.ts +1 -1
- package/node_modules/@undefineds.co/extension-sdk/dist/manifest.js +2 -0
- package/node_modules/@undefineds.co/extension-sdk/dist/web.d.ts +150 -0
- package/node_modules/@undefineds.co/extension-sdk/package.json +2 -1
- package/node_modules/@undefineds.co/models/README.md +1 -1
- package/node_modules/@undefineds.co/models/dist/ai-config/index.d.ts +3 -3
- package/node_modules/@undefineds.co/models/dist/ai-gateway.schema.d.ts +5 -0
- package/node_modules/@undefineds.co/models/dist/ai-gateway.schema.js +9 -0
- package/node_modules/@undefineds.co/models/dist/ai-runtime.repository.d.ts +1 -1
- package/node_modules/@undefineds.co/models/dist/approval.repository.d.ts +2 -2
- package/node_modules/@undefineds.co/models/dist/audit.presentation.d.ts +2 -2
- package/node_modules/@undefineds.co/models/dist/capture.repository.d.ts +1 -1
- package/node_modules/@undefineds.co/models/dist/chat-project.repository.d.ts +1 -1
- package/node_modules/@undefineds.co/models/dist/chat.repository.d.ts +2 -2
- package/node_modules/@undefineds.co/models/dist/control-request.repository.d.ts +2 -2
- package/node_modules/@undefineds.co/models/dist/conversation-share.repository.d.ts +1 -1
- package/node_modules/@undefineds.co/models/dist/credential.schema.d.ts +12 -0
- package/node_modules/@undefineds.co/models/dist/credential.schema.js +15 -1
- package/node_modules/@undefineds.co/models/dist/discovery/index.d.ts +2 -2
- package/node_modules/@undefineds.co/models/dist/discovery/providers.json +248 -7
- package/node_modules/@undefineds.co/models/dist/discovery/types.d.ts +31 -0
- package/node_modules/@undefineds.co/models/dist/extension/index.d.ts +1 -1
- package/node_modules/@undefineds.co/models/dist/favorite/index.d.ts +2 -2
- package/node_modules/@undefineds.co/models/dist/fixtures/contracts-chat-contact.d.ts +5 -5
- package/node_modules/@undefineds.co/models/dist/import/index.d.ts +1 -1
- package/node_modules/@undefineds.co/models/dist/index.d.ts +73 -73
- package/node_modules/@undefineds.co/models/dist/index.js +1 -1
- package/node_modules/@undefineds.co/models/dist/input-request.repository.d.ts +2 -2
- package/node_modules/@undefineds.co/models/dist/knowledge/index.d.ts +1 -1
- package/node_modules/@undefineds.co/models/dist/message.repository.d.ts +1 -1
- package/node_modules/@undefineds.co/models/dist/namespaces.js +5 -0
- package/node_modules/@undefineds.co/models/dist/pod-storage-descriptor.d.ts +4815 -26
- package/node_modules/@undefineds.co/models/dist/pod-storage-descriptor.js +482 -132
- package/node_modules/@undefineds.co/models/dist/schema.d.ts +4 -0
- package/node_modules/@undefineds.co/models/dist/session/index.d.ts +1 -1
- package/node_modules/@undefineds.co/models/dist/settings/index.d.ts +1 -1
- package/node_modules/@undefineds.co/models/dist/sidecar/persistence-mapping.d.ts +5 -5
- package/node_modules/@undefineds.co/models/dist/thread.repository.d.ts +2 -2
- package/node_modules/@undefineds.co/models/dist/types/message-block.d.ts +1 -1
- package/node_modules/@undefineds.co/models/dist/vocab/_namespaces.d.ts +1 -1
- package/node_modules/@undefineds.co/models/dist/vocab/index.d.ts +10 -10
- package/node_modules/@undefineds.co/models/dist/vocab/sidecar.vocab.d.ts +1 -0
- package/node_modules/@undefineds.co/models/dist/vocab/sidecar.vocab.js +1 -0
- package/node_modules/@undefineds.co/models/package.json +4 -2
- package/node_modules/@undefineds.co/pod-collections/README.md +71 -0
- package/node_modules/@undefineds.co/pod-collections/dist/diff.d.ts +85 -0
- package/node_modules/@undefineds.co/pod-collections/dist/diff.js +166 -0
- package/node_modules/@undefineds.co/pod-collections/dist/feed.d.ts +17 -0
- package/node_modules/@undefineds.co/pod-collections/dist/feed.js +27 -0
- package/node_modules/@undefineds.co/pod-collections/dist/index.cjs +1042 -0
- package/node_modules/@undefineds.co/pod-collections/dist/index.d.ts +37 -0
- package/node_modules/@undefineds.co/pod-collections/dist/index.js +89 -0
- package/node_modules/@undefineds.co/pod-collections/dist/layout.d.ts +75 -0
- package/node_modules/@undefineds.co/pod-collections/dist/layout.js +173 -0
- package/node_modules/@undefineds.co/pod-collections/dist/mapping.d.ts +78 -0
- package/node_modules/@undefineds.co/pod-collections/dist/mapping.js +287 -0
- package/node_modules/@undefineds.co/pod-collections/dist/mutations.d.ts +83 -0
- package/node_modules/@undefineds.co/pod-collections/dist/mutations.js +273 -0
- package/node_modules/@undefineds.co/pod-collections/dist/react.d.ts +21 -0
- package/node_modules/@undefineds.co/pod-collections/dist/react.js +22 -0
- package/node_modules/@undefineds.co/pod-collections/dist/read.d.ts +65 -0
- package/node_modules/@undefineds.co/pod-collections/dist/read.js +31 -0
- package/node_modules/@undefineds.co/pod-collections/dist/sync.d.ts +66 -0
- package/node_modules/@undefineds.co/pod-collections/dist/sync.js +260 -0
- package/node_modules/@undefineds.co/pod-collections/dist/types.d.ts +155 -0
- package/node_modules/@undefineds.co/pod-collections/dist/types.js +9 -0
- package/node_modules/@undefineds.co/pod-collections/package.json +42 -0
- package/node_modules/@undefineds.co/shared-ui/dist/index.d.ts +4 -2
- package/node_modules/@undefineds.co/shared-ui/dist/index.js +4 -2
- package/node_modules/@undefineds.co/shared-ui/dist/login/LoginModal.d.ts +4 -1
- package/node_modules/@undefineds.co/shared-ui/dist/login/LoginModal.js +12 -6
- package/node_modules/@undefineds.co/shared-ui/dist/login/LoginView.d.ts +1 -1
- package/node_modules/@undefineds.co/shared-ui/dist/login/host-types.d.ts +7 -1
- package/node_modules/@undefineds.co/shared-ui/dist/login/login-branding.d.ts +6 -0
- package/node_modules/@undefineds.co/shared-ui/dist/login/login-branding.js +18 -0
- package/node_modules/@undefineds.co/shared-ui/dist/user-facing-errors.d.ts +14 -2
- package/node_modules/@undefineds.co/shared-ui/dist/user-facing-errors.js +26 -17
- package/node_modules/@undefineds.co/solid-sdk/dist/login-store.d.ts +3 -3
- package/node_modules/@undefineds.co/solid-sdk/dist/login-store.js +3 -3
- package/package.json +17 -7
- package/static/app/assets/main.css +1 -1
- package/static/auth-callback/assets/AiConfigContext-DlFyEWy9.js +1 -0
- package/static/auth-callback/assets/AiConfigPage-CkYk-SFW.js +1 -0
- package/static/auth-callback/assets/DocumentProcessingPanel-CqIr3JqN.js +1 -0
- package/static/auth-callback/assets/IndexLifecyclePanel-C1GKV3Vx.js +1 -0
- package/static/auth-callback/assets/{IndexSubjectPanel-BbUqop4b.js → IndexSubjectPanel-ro9lC6XW.js} +1 -1
- package/static/auth-callback/assets/ModelAssignmentsPanel-DxNdyKRJ.js +1 -0
- package/static/auth-callback/assets/ModelsPage-BVtWSPBU.js +11 -0
- package/static/auth-callback/assets/{NetworkPage-Vp2PrMxs.js → NetworkPage-cEvxRMAl.js} +2 -2
- package/static/auth-callback/assets/{PaneListHeader-DY7baSFl.js → PaneListHeader-ByKw8ada.js} +1 -1
- package/static/auth-callback/assets/SearchIndexingPanel-CulBKcYT.js +1 -0
- package/static/auth-callback/assets/{StatusSubjectPanel-ArIS-TxT.js → StatusSubjectPanel-VOcfrt8o.js} +1 -1
- package/static/{settings/assets/StatusWorkspace-CoMFRXoV.js → auth-callback/assets/StatusWorkspace-Jsz6hAdE.js} +1 -1
- package/static/auth-callback/assets/{SystemSettingsPage-BDvT1NUz.js → SystemSettingsPage-BFNvGAle.js} +1 -1
- package/static/{dashboard/assets/SystemSettingsSubjectPanel-WaE8mTQi.js → auth-callback/assets/SystemSettingsSubjectPanel-DFRdrSfK.js} +5 -5
- package/static/auth-callback/assets/XpodAiConnectionsPodStore-C6KpvHVg.js +3 -0
- package/static/auth-callback/assets/{activity-D1Dsfa_0.js → activity-DnTlb9iM.js} +1 -1
- package/static/auth-callback/assets/ai-connections-C6yaE6WQ.js +1 -0
- package/static/auth-callback/assets/auth-callback-Cx9D_1qj.css +1 -0
- package/static/auth-callback/assets/{auth-callback-Cmf4hXVZ.js → auth-callback-D2UkK5Xj.js} +6 -6
- package/static/auth-callback/assets/{badge-CZsHq3Ih.js → badge-D7IJuuTM.js} +1 -1
- package/static/auth-callback/assets/collection-runtime-wT1n4GS2.js +1 -0
- package/static/auth-callback/assets/dialog-DickLu5z.js +1 -0
- package/static/auth-callback/assets/{download-DU9ntlHw.js → download-kn8WnRu3.js} +1 -1
- package/static/auth-callback/assets/{external-link-BfzaaZDx.js → external-link-B6B8jfSn.js} +1 -1
- package/static/auth-callback/assets/index-Cu0EguPo.js +4 -0
- package/static/auth-callback/assets/index-DHF97YLP.js +41 -0
- package/static/auth-callback/assets/index-Dz83EEHD.js +1 -0
- package/static/auth-callback/assets/{index-browser-BNFqqC74.js → index-browser-CSghinyi.js} +1 -1
- package/static/auth-callback/assets/{key-round-BwP3DBWo.js → key-round-ChkOx3E1.js} +1 -1
- package/static/auth-callback/assets/layout-DB3pMyTl.js +1 -0
- package/static/auth-callback/assets/pod-collections-host-KnnGFZHL.js +8 -0
- package/static/auth-callback/assets/{rotate-ccw-VMwnmyab.js → rotate-ccw-B3hE-nyd.js} +1 -1
- package/static/auth-callback/assets/{skeleton-CoD55rBT.js → skeleton-kEqR7tpI.js} +1 -1
- package/static/auth-callback/assets/{waypoints-DRo_1Ca7.js → waypoints-D6Jo-SZa.js} +1 -1
- package/static/auth-callback/assets/{workspace-layout--mcXl3My.js → workspace-layout-BHwT_cHd.js} +1 -1
- package/static/auth-callback/auth-callback.html +2 -2
- package/static/dashboard/assets/AiConfigContext-BfC3v-x2.js +1 -0
- package/static/dashboard/assets/AiConfigPage-QNS3u7Ff.js +1 -0
- package/static/dashboard/assets/DocumentProcessingPanel-Dr4XLeT4.js +1 -0
- package/static/dashboard/assets/IndexLifecyclePanel-KtM_gpeO.js +1 -0
- package/static/dashboard/assets/{IndexSubjectPanel-B2cXwl8X.js → IndexSubjectPanel-DLaiKdLc.js} +1 -1
- package/static/dashboard/assets/ModelAssignmentsPanel-Bk7TvQRq.js +1 -0
- package/static/dashboard/assets/ModelsPage-Cci3vlos.js +11 -0
- package/static/dashboard/assets/{NetworkPage-DV2V0qWO.js → NetworkPage-Ot4G2dX5.js} +2 -2
- package/static/dashboard/assets/{PaneListHeader-D0c1yCFH.js → PaneListHeader-qHME_s08.js} +1 -1
- package/static/dashboard/assets/SearchIndexingPanel-HZPKj8H9.js +1 -0
- package/static/dashboard/assets/{StatusSubjectPanel-oPSECj7i.js → StatusSubjectPanel-ij7IpI8d.js} +1 -1
- package/static/dashboard/assets/{StatusWorkspace-PdovQPKa.js → StatusWorkspace-Cp02JcaN.js} +1 -1
- package/static/dashboard/assets/{SystemSettingsPage-CtNDklkx.js → SystemSettingsPage-BSeuvb8X.js} +1 -1
- package/static/{settings/assets/SystemSettingsSubjectPanel-DExjDo_v.js → dashboard/assets/SystemSettingsSubjectPanel-CP4_luGS.js} +5 -5
- package/static/dashboard/assets/XpodAiConnectionsPodStore-urO6zaHL.js +18 -0
- package/static/dashboard/assets/{activity-B9ylSoyr.js → activity-DxjgQNvr.js} +1 -1
- package/static/dashboard/assets/ai-connections-CXp5gd1J.js +1 -0
- package/static/dashboard/assets/{badge-BNbFbpIb.js → badge-53qCrRbl.js} +1 -1
- package/static/dashboard/assets/collection-runtime-BPAmHG46.js +1 -0
- package/static/dashboard/assets/{dashboard-CD-FFVRD.js → dashboard-BcT2ByXw.js} +4 -4
- package/static/dashboard/assets/dashboard-Cx9D_1qj.css +1 -0
- package/static/dashboard/assets/dialog-B28YtNhS.js +1 -0
- package/static/dashboard/assets/{download-nOP38LtW.js → download-DkLNceJ4.js} +1 -1
- package/static/dashboard/assets/{external-link-Bh2ewN9E.js → external-link-D3TXnlo3.js} +1 -1
- package/static/dashboard/assets/index-CFIenkeK.js +41 -0
- package/static/dashboard/assets/index-CIiBu9mr.js +1 -0
- package/static/dashboard/assets/index-Gp3cLolR.js +4 -0
- package/static/dashboard/assets/{key-round-bGmguBLv.js → key-round-B5ccp6nx.js} +1 -1
- package/static/dashboard/assets/layout-DB3pMyTl.js +1 -0
- package/static/dashboard/assets/pod-collections-host-KnnGFZHL.js +8 -0
- package/static/dashboard/assets/{rotate-ccw-D2x__ODW.js → rotate-ccw-DUpfkNnk.js} +1 -1
- package/static/dashboard/assets/{skeleton-VOqft8WS.js → skeleton-BRe19fO0.js} +1 -1
- package/static/dashboard/assets/{waypoints-fgRqm4oH.js → waypoints-BKDMxEvu.js} +1 -1
- package/static/dashboard/assets/{workspace-layout-DV4dgeHX.js → workspace-layout-ZTF7C16h.js} +1 -1
- package/static/dashboard/dashboard.html +2 -2
- package/static/settings/assets/AiConfigContext-DsyWgu2i.js +1 -0
- package/static/settings/assets/AiConfigPage-CSCBckKo.js +1 -0
- package/static/settings/assets/DocumentProcessingPanel-w9yQDbBe.js +1 -0
- package/static/settings/assets/IndexLifecyclePanel-CUUXI8mP.js +1 -0
- package/static/settings/assets/{IndexSubjectPanel-BgbI9c-a.js → IndexSubjectPanel-BypAU5TJ.js} +1 -1
- package/static/settings/assets/ModelAssignmentsPanel-BetgXw1G.js +1 -0
- package/static/settings/assets/ModelsPage-DZpTlTZ3.js +11 -0
- package/static/settings/assets/{NetworkPage-C8OA9Mtp.js → NetworkPage-BVkasFGM.js} +2 -2
- package/static/settings/assets/{PaneListHeader-COvlPJWj.js → PaneListHeader-BGOqGec4.js} +1 -1
- package/static/settings/assets/SearchIndexingPanel-DYAbpZ_9.js +1 -0
- package/static/settings/assets/{StatusSubjectPanel-BuLml7qn.js → StatusSubjectPanel-CFgzeQ8Q.js} +1 -1
- package/static/settings/assets/StatusWorkspace-4Z6g4Jvv.js +1 -0
- package/static/settings/assets/{SystemSettingsPage-DlzmaWV-.js → SystemSettingsPage-C1tlrgvI.js} +1 -1
- package/static/{auth-callback/assets/SystemSettingsSubjectPanel-CDqRuC4t.js → settings/assets/SystemSettingsSubjectPanel-CcURI-1L.js} +5 -5
- package/static/settings/assets/XpodAiConnectionsPodStore-owBQc5nY.js +3 -0
- package/static/settings/assets/{activity-TLerXgMs.js → activity-CtBc9cNy.js} +1 -1
- package/static/settings/assets/ai-connections-C6yaE6WQ.js +1 -0
- package/static/settings/assets/{badge-Bcs8iWrH.js → badge--r-FDIhU.js} +1 -1
- package/static/settings/assets/collection-runtime-CnhPmwAM.js +1 -0
- package/static/settings/assets/dialog-B7ZRsjN7.js +1 -0
- package/static/settings/assets/{download-Ct3QmHPt.js → download-DgQ1F8QR.js} +1 -1
- package/static/settings/assets/{external-link-C8KiHbss.js → external-link-Bz7NckNO.js} +1 -1
- package/static/settings/assets/index-BdXwm8nh.js +4 -0
- package/static/settings/assets/index-CkGda_Pg.js +41 -0
- package/static/settings/assets/index-Vv-8Vslg.js +1 -0
- package/static/settings/assets/{index-browser-CazX1pc2.js → index-browser-Dq7omlpY.js} +1 -1
- package/static/settings/assets/{key-round-B19YD1GA.js → key-round-CvuhloKV.js} +1 -1
- package/static/settings/assets/layout-DB3pMyTl.js +1 -0
- package/static/settings/assets/pod-collections-host-KnnGFZHL.js +8 -0
- package/static/settings/assets/{rotate-ccw-AQm2kMgU.js → rotate-ccw-DgFKDaz7.js} +1 -1
- package/static/settings/assets/{settings-C-VBtt9r.js → settings-BvqY7K96.js} +5 -5
- package/static/settings/assets/settings-Cx9D_1qj.css +1 -0
- package/static/settings/assets/{skeleton-DyZ1OBYf.js → skeleton-D3OeFDF6.js} +1 -1
- package/static/settings/assets/{waypoints-CC3wq-SU.js → waypoints-C4WbspTb.js} +1 -1
- package/static/settings/assets/{workspace-layout-BxXNKgf9.js → workspace-layout-B9H1Tqrk.js} +1 -1
- package/static/settings/settings.html +2 -2
- package/node_modules/@undefineds.co/ai-connections/dist/ai-connections-client.js +0 -13
- package/node_modules/@undefineds.co/ai-connections/dist/provider-catalog.d.ts +0 -9
- package/static/auth-callback/assets/AiConfigContext-DqWRSm7n.js +0 -1
- package/static/auth-callback/assets/AiConfigPage-C5YYyvzl.js +0 -1
- package/static/auth-callback/assets/DocumentProcessingPanel-DZCiacBz.js +0 -1
- package/static/auth-callback/assets/IndexLifecyclePanel-CCLeOljB.js +0 -1
- package/static/auth-callback/assets/ModelAssignmentsPanel-jUUTDKuh.js +0 -1
- package/static/auth-callback/assets/ModelsPage-B08zdtff.js +0 -10
- package/static/auth-callback/assets/SearchIndexingPanel-D4YRg1-8.js +0 -1
- package/static/auth-callback/assets/StatusWorkspace-Cp5LQ9Yx.js +0 -1
- package/static/auth-callback/assets/ai-connections-CHNTKemd.js +0 -1
- package/static/auth-callback/assets/auth-callback-DWMMiFjh.css +0 -1
- package/static/auth-callback/assets/index-DSNnLUbU.js +0 -4
- package/static/auth-callback/assets/index-FHhHoKgp.js +0 -41
- package/static/dashboard/assets/AiConfigContext-BpPDKSzI.js +0 -1
- package/static/dashboard/assets/AiConfigPage-wsqEZDIX.js +0 -1
- package/static/dashboard/assets/DocumentProcessingPanel-CDSy3juc.js +0 -1
- package/static/dashboard/assets/IndexLifecyclePanel-CVd6vQCX.js +0 -1
- package/static/dashboard/assets/ModelAssignmentsPanel-BeBZhnQd.js +0 -1
- package/static/dashboard/assets/ModelsPage-B6McSCJw.js +0 -25
- package/static/dashboard/assets/SearchIndexingPanel-CGs0OZ12.js +0 -1
- package/static/dashboard/assets/ai-connections-CHNTKemd.js +0 -1
- package/static/dashboard/assets/dashboard-DWMMiFjh.css +0 -1
- package/static/dashboard/assets/index-PgS-Bt7X.js +0 -41
- package/static/dashboard/assets/index-QN2QgEwr.js +0 -4
- package/static/settings/assets/AiConfigContext-zKQYdfai.js +0 -1
- package/static/settings/assets/AiConfigPage-Bs1EE3Ei.js +0 -1
- package/static/settings/assets/DocumentProcessingPanel-CSFfdOXS.js +0 -1
- package/static/settings/assets/IndexLifecyclePanel-BR9Su49B.js +0 -1
- package/static/settings/assets/ModelAssignmentsPanel-C0BE7nbk.js +0 -1
- package/static/settings/assets/ModelsPage-CU-YQ8_7.js +0 -10
- package/static/settings/assets/SearchIndexingPanel-Bdd46mIV.js +0 -1
- package/static/settings/assets/ai-connections-CHNTKemd.js +0 -1
- package/static/settings/assets/index-1Q2cRjZd.js +0 -41
- package/static/settings/assets/index-DBO_Vq0P.js +0 -4
- package/static/settings/assets/settings-DWMMiFjh.css +0 -1
- /package/node_modules/@undefineds.co/{ai-connections → ai-connections-core}/dist/client/request.d.ts +0 -0
- /package/node_modules/@undefineds.co/{ai-connections → ai-connections-core}/dist/client/types.js +0 -0
- /package/node_modules/@undefineds.co/{ai-connections → ai-connections-core}/dist/client-config/codex.d.ts +0 -0
- /package/node_modules/@undefineds.co/{ai-connections → ai-connections-core}/dist/client-config/codex.js +0 -0
- /package/node_modules/@undefineds.co/{ai-connections → ai-connections-core}/dist/client-config/index.d.ts +0 -0
- /package/node_modules/@undefineds.co/{ai-connections → ai-connections-core}/dist/client-config/index.js +0 -0
- /package/node_modules/@undefineds.co/{ai-connections → ai-connections-core}/dist/client-config/json-env-adapter.d.ts +0 -0
- /package/node_modules/@undefineds.co/{ai-connections → ai-connections-core}/dist/client-config/json-env-adapter.js +0 -0
- /package/node_modules/@undefineds.co/{ai-connections → ai-connections-core}/dist/client-config/pi.d.ts +0 -0
- /package/node_modules/@undefineds.co/{ai-connections → ai-connections-core}/dist/client-config/pi.js +0 -0
- /package/node_modules/@undefineds.co/{ai-connections → ai-connections-core}/dist/client-config/transaction.d.ts +0 -0
- /package/node_modules/@undefineds.co/{ai-connections → ai-connections-core}/dist/client-config/transaction.js +0 -0
- /package/node_modules/@undefineds.co/{ai-connections → ai-connections-core}/dist/client-config/types.d.ts +0 -0
- /package/node_modules/@undefineds.co/{ai-connections → ai-connections-core}/dist/client-config/types.js +0 -0
|
@@ -1,24 +1,42 @@
|
|
|
1
|
-
import type { WebExtensionHost } from '@undefineds.co/extension-sdk/web';
|
|
2
|
-
import { type AiConnectionsClient, type
|
|
1
|
+
import type { SolidLiveUpdateState, WebExtensionHost } from '@undefineds.co/extension-sdk/web';
|
|
2
|
+
import { type AiConnectionsClient, type AiConnectionsProvider, type AiProviderConnectionSummary, type AiProviderSummary } from '@undefineds.co/ai-connections-core/client';
|
|
3
3
|
import type { AiClientConfigurationBridge } from './AiClientConfigurationSection';
|
|
4
|
+
import { type CredentialRow } from './collections';
|
|
5
|
+
import type { PodCollection } from '@undefineds.co/pod-collections';
|
|
4
6
|
export interface AiProviderDefinition {
|
|
5
7
|
id: AiConnectionsProvider;
|
|
6
8
|
name: string;
|
|
7
|
-
browserMode: AiConnectionsMode;
|
|
8
|
-
browserLabel: string;
|
|
9
9
|
description: string;
|
|
10
10
|
homeUrl: string;
|
|
11
11
|
apiKeyUrl?: string;
|
|
12
12
|
apiKeyPlaceholder?: string;
|
|
13
13
|
defaultBaseUrl?: string;
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Provider pages explain themselves through the header's ⓘ tooltip, so each
|
|
17
|
+
* description is one line of the same shape — where the models come from and how
|
|
18
|
+
* this deployment can be authorized — instead of a restatement of the name.
|
|
19
|
+
*
|
|
20
|
+
* Connect actions are deliberately absent here: which ways in exist is offering
|
|
21
|
+
* data (`authorizationMethods`), derived by the server per offering, and a
|
|
22
|
+
* provider-level label is exactly how a page could offer a 「登录」 no offering
|
|
23
|
+
* declares.
|
|
24
|
+
*/
|
|
15
25
|
export declare const PROVIDERS: AiProviderDefinition[];
|
|
16
26
|
export type ProviderProductState = 'loading' | 'unconfigured' | 'configured' | 'connected' | 'attention';
|
|
17
27
|
export declare const AI_CONNECTIONS_PINNED_SECTIONS: readonly [{
|
|
18
28
|
readonly id: "keys";
|
|
19
|
-
readonly label: "
|
|
29
|
+
readonly label: "Xpod";
|
|
20
30
|
readonly title: "API KEYS";
|
|
21
31
|
}];
|
|
32
|
+
/**
|
|
33
|
+
* Coalescing window for Pod change signals.
|
|
34
|
+
*
|
|
35
|
+
* A notification only says "this document changed", so a burst of writes must
|
|
36
|
+
* cost one re-read, not one per write; the first signal arms a fixed window and
|
|
37
|
+
* everything arriving inside it is absorbed.
|
|
38
|
+
*/
|
|
39
|
+
export declare const TABLE_CHANGE_COALESCE_MS = 75;
|
|
22
40
|
export type AiConnectionsPinnedSection = typeof AI_CONNECTIONS_PINNED_SECTIONS[number]['id'];
|
|
23
41
|
export type AiConnectionsWorkspaceSection = AiConnectionsPinnedSection | 'provider';
|
|
24
42
|
export interface AiConnectionsController {
|
|
@@ -32,12 +50,47 @@ export interface AiConnectionsController {
|
|
|
32
50
|
readonly providerStates: Partial<Record<AiConnectionsProvider, ProviderProductState>>;
|
|
33
51
|
readonly providerSummaries: Partial<Record<AiConnectionsProvider, AiProviderSummary>>;
|
|
34
52
|
readonly providerLoadError?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Whether the Pod table documents this page renders are pushing changes.
|
|
55
|
+
*
|
|
56
|
+
* `unavailable` also covers a host that offers no live-update capability at
|
|
57
|
+
* all; either way the page keeps working from explicit reads.
|
|
58
|
+
*/
|
|
59
|
+
readonly liveUpdates: SolidLiveUpdateState;
|
|
60
|
+
/**
|
|
61
|
+
* The live credentials table (`settings/credentials.ttl`), when the host
|
|
62
|
+
* exposes `podCollections` and the lazily loaded collection layer has landed.
|
|
63
|
+
* The page renders its rows; the controller's own live-revision refresh does
|
|
64
|
+
* not watch that document while this is present.
|
|
65
|
+
*/
|
|
66
|
+
readonly credentialsCollection?: PodCollection<CredentialRow>;
|
|
67
|
+
/**
|
|
68
|
+
* The collection's rows as its own change feed reports them, or `undefined`
|
|
69
|
+
* while the layer is still loading, when the host offers no collection, or
|
|
70
|
+
* after a failed first read. This is what the credentials list renders (and
|
|
71
|
+
* what makes every credential write optimistic).
|
|
72
|
+
*/
|
|
73
|
+
readonly credentialRows?: readonly CredentialRow[];
|
|
74
|
+
/**
|
|
75
|
+
* Advances once per coalesced burst of changes to those documents. Pages
|
|
76
|
+
* re-read through the loaders they already have when it changes.
|
|
77
|
+
*/
|
|
78
|
+
readonly liveRevision: number;
|
|
35
79
|
selectSection(section: AiConnectionsPinnedSection): void;
|
|
36
80
|
selectProvider(provider: AiConnectionsProvider, credentialId?: string): void;
|
|
37
81
|
selectFirstUnconfiguredProvider(): void;
|
|
38
82
|
setSearchQuery(value: string): void;
|
|
39
83
|
setProviderState(provider: AiConnectionsProvider, state: ProviderProductState): void;
|
|
40
84
|
loadProviders(): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* Watches the table documents the open page renders: the credentials table
|
|
87
|
+
* plus the open provider's document.
|
|
88
|
+
*
|
|
89
|
+
* Re-entrant and idempotent, so React StrictMode's setup/cleanup/setup cycle
|
|
90
|
+
* stays harmless; releasing the last hold leaves no channel and no socket
|
|
91
|
+
* behind for this page.
|
|
92
|
+
*/
|
|
93
|
+
watchPageTables(): () => void;
|
|
41
94
|
cancelProviderLoads(): void;
|
|
42
95
|
subscribe(listener: () => void): () => void;
|
|
43
96
|
}
|
|
@@ -48,5 +101,18 @@ export declare function useSelectedCredentialId(controller: AiConnectionsControl
|
|
|
48
101
|
export declare function useProviderSearch(controller: AiConnectionsController): string;
|
|
49
102
|
export declare function useProviderStates(controller: AiConnectionsController): Partial<Record<AiConnectionsProvider, ProviderProductState>>;
|
|
50
103
|
export declare function useProviderSummaries(controller: AiConnectionsController): Partial<Record<AiConnectionsProvider, AiProviderConnectionSummary>>;
|
|
104
|
+
/**
|
|
105
|
+
* Providers this deployment offers, as reported by the server.
|
|
106
|
+
*
|
|
107
|
+
* Cloud answers with the operator-designated providers only (no self-hosted
|
|
108
|
+
* `custom`, no local daemon), so the settings surface cannot offer a provider the
|
|
109
|
+
* deployment does not provide. Before the first successful load this is
|
|
110
|
+
* `undefined`, which keeps every provider visible (Local behavior).
|
|
111
|
+
*/
|
|
112
|
+
export declare function useAvailableProviders(controller: AiConnectionsController): AiConnectionsProvider[] | undefined;
|
|
51
113
|
export declare function useProviderProducts(controller: AiConnectionsController): Partial<Record<AiConnectionsProvider, AiProviderSummary>>;
|
|
52
114
|
export declare function useProviderLoadError(controller: AiConnectionsController): string | undefined;
|
|
115
|
+
/** Whether live Pod updates are on, for a status affordance that stays small. */
|
|
116
|
+
export declare function useLiveUpdates(controller: AiConnectionsController): SolidLiveUpdateState;
|
|
117
|
+
/** Advances once per coalesced burst of Pod changes; drives page re-reads. */
|
|
118
|
+
export declare function useLiveRevision(controller: AiConnectionsController): number;
|
|
@@ -1,18 +1,38 @@
|
|
|
1
1
|
import { useSyncExternalStore } from 'react';
|
|
2
|
-
import { AI_CONNECTIONS_PROVIDERS, AiConnectionsRequestError, createAiConnectionsClient,
|
|
2
|
+
import { AI_CONNECTIONS_PROVIDERS, AiConnectionsRequestError, createAiConnectionsClient, } from '@undefineds.co/ai-connections-core/client';
|
|
3
|
+
import { aiConnectionsErrorMessage } from './error-wording.js';
|
|
4
|
+
import { credentialCollectionRuntime, } from './collections.js';
|
|
5
|
+
/**
|
|
6
|
+
* Provider pages explain themselves through the header's ⓘ tooltip, so each
|
|
7
|
+
* description is one line of the same shape — where the models come from and how
|
|
8
|
+
* this deployment can be authorized — instead of a restatement of the name.
|
|
9
|
+
*
|
|
10
|
+
* Connect actions are deliberately absent here: which ways in exist is offering
|
|
11
|
+
* data (`authorizationMethods`), derived by the server per offering, and a
|
|
12
|
+
* provider-level label is exactly how a page could offer a 「登录」 no offering
|
|
13
|
+
* declares.
|
|
14
|
+
*/
|
|
3
15
|
export const PROVIDERS = [
|
|
4
|
-
{ id: 'openai', name: 'OpenAI',
|
|
5
|
-
{ id: 'anthropic', name: 'Anthropic',
|
|
6
|
-
{ id: 'kimi', name: 'Kimi',
|
|
7
|
-
{ id: 'bailian', name: '百炼',
|
|
8
|
-
{ id: 'deepseek', name: 'DeepSeek',
|
|
9
|
-
{ id: 'zhipu', name: '智谱 AI',
|
|
10
|
-
{ id: 'ollama', name: 'Ollama',
|
|
11
|
-
{ id: 'custom', name: 'Custom',
|
|
16
|
+
{ id: 'openai', name: 'OpenAI', description: 'OpenAI 官方 GPT 与推理模型,支持 API Key 与订阅导入。', homeUrl: 'https://openai.com', apiKeyUrl: 'https://platform.openai.com/api-keys', apiKeyPlaceholder: 'sk-...', defaultBaseUrl: 'https://api.openai.com/v1' },
|
|
17
|
+
{ id: 'anthropic', name: 'Anthropic', description: 'Anthropic 官方 Claude 模型,支持 API Key 与订阅导入。', homeUrl: 'https://www.anthropic.com', apiKeyUrl: 'https://console.anthropic.com/settings/keys', apiKeyPlaceholder: 'sk-ant-...', defaultBaseUrl: 'https://api.anthropic.com' },
|
|
18
|
+
{ id: 'kimi', name: 'Kimi', description: '月之暗面 Kimi 模型,支持账号订阅、编码套餐与开放平台。', homeUrl: 'https://www.moonshot.cn', apiKeyUrl: 'https://platform.moonshot.cn/console/api-keys', apiKeyPlaceholder: 'sk-...', defaultBaseUrl: 'https://api.moonshot.cn/v1' },
|
|
19
|
+
{ id: 'bailian', name: '百炼', description: '阿里云百炼的通义千问等模型,提供按量与多种套餐。', homeUrl: 'https://www.aliyun.com/product/bailian', apiKeyUrl: 'https://bailian.console.aliyun.com/#/api-key', apiKeyPlaceholder: 'sk-...', defaultBaseUrl: 'https://dashscope.aliyuncs.com/compatible-mode/v1' },
|
|
20
|
+
{ id: 'deepseek', name: 'DeepSeek', description: 'DeepSeek 官方模型,API Key 接入,接口兼容 OpenAI。', homeUrl: 'https://www.deepseek.com', apiKeyUrl: 'https://platform.deepseek.com/api_keys', apiKeyPlaceholder: 'sk-...', defaultBaseUrl: 'https://api.deepseek.com/v1' },
|
|
21
|
+
{ id: 'zhipu', name: '智谱 AI', description: '智谱 GLM 系列模型,支持 API Key 与 GLM 编码套餐。', homeUrl: 'https://open.bigmodel.cn', apiKeyUrl: 'https://open.bigmodel.cn/usercenter/apikeys', apiKeyPlaceholder: 'id.secret-...', defaultBaseUrl: 'https://open.bigmodel.cn/api/paas/v4' },
|
|
22
|
+
{ id: 'ollama', name: 'Ollama', description: '运行在本机的 Ollama 模型,无需 API Key,仅本机可达。', homeUrl: 'https://ollama.com', defaultBaseUrl: 'http://localhost:11434/v1' },
|
|
23
|
+
{ id: 'custom', name: 'Custom', description: '任意 OpenAI 或 Anthropic 兼容服务,自填地址与 API Key。', homeUrl: 'https://undefineds.co', apiKeyPlaceholder: 'sk-...', defaultBaseUrl: 'https://example.com/v1' },
|
|
12
24
|
];
|
|
13
25
|
export const AI_CONNECTIONS_PINNED_SECTIONS = [
|
|
14
|
-
{ id: 'keys', label: '
|
|
26
|
+
{ id: 'keys', label: 'Xpod', title: 'API KEYS' },
|
|
15
27
|
];
|
|
28
|
+
/**
|
|
29
|
+
* Coalescing window for Pod change signals.
|
|
30
|
+
*
|
|
31
|
+
* A notification only says "this document changed", so a burst of writes must
|
|
32
|
+
* cost one re-read, not one per write; the first signal arms a fixed window and
|
|
33
|
+
* everything arriving inside it is absorbed.
|
|
34
|
+
*/
|
|
35
|
+
export const TABLE_CHANGE_COALESCE_MS = 75;
|
|
16
36
|
if (PROVIDERS.map((provider) => provider.id).join(',') !== AI_CONNECTIONS_PROVIDERS.join(',')) {
|
|
17
37
|
throw new Error('AI Connection provider UI is out of sync with the client catalog');
|
|
18
38
|
}
|
|
@@ -24,6 +44,28 @@ export function createAiConnectionsController(host) {
|
|
|
24
44
|
const readyPod = pod?.status === 'ready' ? pod : undefined;
|
|
25
45
|
const authenticated = sessionSnapshot.status === 'authenticated'
|
|
26
46
|
&& readyPod !== undefined;
|
|
47
|
+
/**
|
|
48
|
+
* The live credentials table, when the host offers one.
|
|
49
|
+
*
|
|
50
|
+
* Declaring it here (and not in a page) is what keeps one table to one
|
|
51
|
+
* collection: the page reads the same instance the client writes through.
|
|
52
|
+
*
|
|
53
|
+
* It is declared *asynchronously* and lands in `credentials` (+ `credentialRows`
|
|
54
|
+
* and `credentialMutations`): the collection layer is loaded on demand through
|
|
55
|
+
* `collections.credentialCollectionRuntime()` - the table declaration, the row
|
|
56
|
+
* read and the credential writes all live in that chunk - so the applet renders
|
|
57
|
+
* from the store first and upgrades to live rows when the collection's first
|
|
58
|
+
* read is back. When the host offers no `podCollections` capability at all the
|
|
59
|
+
* collection never lands and the controller behaves exactly as before
|
|
60
|
+
* (`docs/pod-collections.md` §8.9).
|
|
61
|
+
*/
|
|
62
|
+
let credentials;
|
|
63
|
+
let credentialRows;
|
|
64
|
+
let credentialMutations;
|
|
65
|
+
const liveCredentials = {
|
|
66
|
+
collection: () => credentials,
|
|
67
|
+
mutations: () => credentialMutations,
|
|
68
|
+
};
|
|
27
69
|
let providerLoadGeneration = 0;
|
|
28
70
|
let providerLoadPromise;
|
|
29
71
|
let providerLoadOperation;
|
|
@@ -81,7 +123,7 @@ export function createAiConnectionsController(host) {
|
|
|
81
123
|
webId: sessionSnapshot.webId,
|
|
82
124
|
podBaseUrl: readyPod.current.podUrl,
|
|
83
125
|
authenticatedFetch: host.solid.session.fetch,
|
|
84
|
-
}), host.capabilities.aiClientCredentials), host.capabilities.aiConnectionsPodStore, beginProviderLoad)
|
|
126
|
+
}), host.capabilities.aiClientCredentials), host.capabilities.aiConnectionsPodStore, liveCredentials, beginProviderLoad)
|
|
85
127
|
: null;
|
|
86
128
|
let selectedSection = 'keys';
|
|
87
129
|
let selectedProvider = 'openai';
|
|
@@ -92,10 +134,164 @@ export function createAiConnectionsController(host) {
|
|
|
92
134
|
let providerLoadError;
|
|
93
135
|
const listeners = new Set();
|
|
94
136
|
const notify = () => listeners.forEach((listener) => listener());
|
|
137
|
+
const notifications = host.capabilities.solidNotifications;
|
|
138
|
+
const podStore = host.capabilities.aiConnectionsPodStore;
|
|
139
|
+
/** Release function per watched topic document; one entry per document. */
|
|
140
|
+
const tableSubscriptions = new Map();
|
|
141
|
+
let pageTableHolds = 0;
|
|
142
|
+
let liveUpdates = currentLiveUpdates();
|
|
143
|
+
let liveRevision = 0;
|
|
144
|
+
let coalesceTimer;
|
|
145
|
+
function scheduleLiveRefresh() {
|
|
146
|
+
if (coalesceTimer !== undefined)
|
|
147
|
+
return;
|
|
148
|
+
coalesceTimer = setTimeout(() => {
|
|
149
|
+
coalesceTimer = undefined;
|
|
150
|
+
liveRevision += 1;
|
|
151
|
+
notify();
|
|
152
|
+
}, TABLE_CHANGE_COALESCE_MS);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* The documents the open page renders *and* this controller refreshes; a table
|
|
156
|
+
* is one document, never a row.
|
|
157
|
+
*
|
|
158
|
+
* One table has exactly one refresh path. The credentials table is owned by
|
|
159
|
+
* the collection when the host exposes one - the collection subscribes to the
|
|
160
|
+
* same notification primitive with the same document - so it is left out here;
|
|
161
|
+
* without a collection it stays on this path, exactly as before. The open
|
|
162
|
+
* provider's document is always this path's (P4 moves it).
|
|
163
|
+
*/
|
|
164
|
+
function pageTableDocuments() {
|
|
165
|
+
if (!podStore)
|
|
166
|
+
return [];
|
|
167
|
+
const documents = new Set();
|
|
168
|
+
const credentialsDocument = credentials ? undefined : podStore.credentialsTableDocument?.();
|
|
169
|
+
if (credentialsDocument)
|
|
170
|
+
documents.add(credentialsDocument);
|
|
171
|
+
if (selectedSection === 'provider') {
|
|
172
|
+
const provider = podStore.providerTableDocument?.(selectedProvider, selectedCredentialId);
|
|
173
|
+
if (provider)
|
|
174
|
+
documents.add(provider);
|
|
175
|
+
}
|
|
176
|
+
return [...documents];
|
|
177
|
+
}
|
|
178
|
+
function releaseTableSubscriptions() {
|
|
179
|
+
for (const [document, release] of tableSubscriptions) {
|
|
180
|
+
tableSubscriptions.delete(document);
|
|
181
|
+
release();
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
function syncTableSubscriptions() {
|
|
185
|
+
if (!notifications || pageTableHolds === 0)
|
|
186
|
+
return;
|
|
187
|
+
const wanted = new Set(pageTableDocuments());
|
|
188
|
+
for (const [document, release] of tableSubscriptions) {
|
|
189
|
+
if (wanted.has(document))
|
|
190
|
+
continue;
|
|
191
|
+
tableSubscriptions.delete(document);
|
|
192
|
+
release();
|
|
193
|
+
}
|
|
194
|
+
for (const document of wanted) {
|
|
195
|
+
if (tableSubscriptions.has(document))
|
|
196
|
+
continue;
|
|
197
|
+
tableSubscriptions.set(document, notifications.watch(document, scheduleLiveRefresh));
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* The availability signal the page shows.
|
|
202
|
+
*
|
|
203
|
+
* With a live collection the page's truth is the *collection's* sync state,
|
|
204
|
+
* not the transport's global state: `live` only when the table's own feed is
|
|
205
|
+
* established and the transport is actually pushing. Without one, this is the
|
|
206
|
+
* transport's state, exactly as before.
|
|
207
|
+
*/
|
|
208
|
+
function currentLiveUpdates() {
|
|
209
|
+
const transport = notifications ? notifications.getState() : 'unavailable';
|
|
210
|
+
if (!credentials || !host.capabilities.podCollections)
|
|
211
|
+
return transport;
|
|
212
|
+
const sync = host.capabilities.podCollections.syncState(credentials.collection);
|
|
213
|
+
if (sync === 'unavailable' || sync === 'degraded' || transport === 'unavailable') {
|
|
214
|
+
return 'unavailable';
|
|
215
|
+
}
|
|
216
|
+
return sync === 'live' && transport === 'live' ? 'live' : 'idle';
|
|
217
|
+
}
|
|
218
|
+
notifications?.subscribeState(() => {
|
|
219
|
+
const next = currentLiveUpdates();
|
|
220
|
+
if (next === liveUpdates)
|
|
221
|
+
return;
|
|
222
|
+
liveUpdates = next;
|
|
223
|
+
notify();
|
|
224
|
+
});
|
|
225
|
+
host.capabilities.podCollections?.subscribeSyncState(() => {
|
|
226
|
+
const next = currentLiveUpdates();
|
|
227
|
+
if (next === liveUpdates)
|
|
228
|
+
return;
|
|
229
|
+
liveUpdates = next;
|
|
230
|
+
notify();
|
|
231
|
+
});
|
|
232
|
+
/**
|
|
233
|
+
* The page's live rows: re-read from the collection when it changes, and
|
|
234
|
+
* `undefined` until its first read lands (or forever, when there is no
|
|
235
|
+
* collection). One snapshot object per change keeps `useSyncExternalStore`
|
|
236
|
+
* stable between reads.
|
|
237
|
+
*/
|
|
238
|
+
function publishCredentialRows() {
|
|
239
|
+
const collection = credentials?.collection;
|
|
240
|
+
const next = collection?.isReady()
|
|
241
|
+
? collection.toArray
|
|
242
|
+
: undefined;
|
|
243
|
+
if (next === credentialRows)
|
|
244
|
+
return;
|
|
245
|
+
credentialRows = next;
|
|
246
|
+
notify();
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Adopt the host's credentials collection once the lazy layer has it.
|
|
250
|
+
*
|
|
251
|
+
* Three things change at once, and they have to change together: the rows the
|
|
252
|
+
* page renders (from the collection's own change feed and status), the
|
|
253
|
+
* credential mutations (the client dispatches to them from now on), and the
|
|
254
|
+
* fallback table watch - the credentials document leaves the controller's
|
|
255
|
+
* `liveRevision` path because the collection now owns that table, which has to
|
|
256
|
+
* happen by releasing the subscription the controller opened before the
|
|
257
|
+
* collection arrived.
|
|
258
|
+
*/
|
|
259
|
+
function adoptCredentials(loaded, mutations) {
|
|
260
|
+
credentials = loaded;
|
|
261
|
+
credentialMutations = mutations;
|
|
262
|
+
const collection = loaded.collection;
|
|
263
|
+
// The collection is owned by the host capability and lives as long as the
|
|
264
|
+
// session; these two subscriptions live with it rather than with the page.
|
|
265
|
+
collection.subscribeChanges(() => publishCredentialRows());
|
|
266
|
+
collection.on('status:change', () => publishCredentialRows());
|
|
267
|
+
publishCredentialRows();
|
|
268
|
+
syncTableSubscriptions();
|
|
269
|
+
notify();
|
|
270
|
+
}
|
|
271
|
+
// A host that offers no collection never fetches the layer: the capability is
|
|
272
|
+
// checked before the dynamic import, not inside it.
|
|
273
|
+
if (authenticated && sessionSnapshot.webId && host.capabilities.podCollections) {
|
|
274
|
+
void credentialCollectionRuntime()
|
|
275
|
+
.then(async (runtime) => {
|
|
276
|
+
const loaded = await runtime.openCredentialCollection(host);
|
|
277
|
+
if (!loaded || !podStore)
|
|
278
|
+
return;
|
|
279
|
+
adoptCredentials(loaded, runtime.collectionCredentialMutations(loaded, podStore));
|
|
280
|
+
})
|
|
281
|
+
// No collection layer (chunk unavailable, layout underivable, table
|
|
282
|
+
// undefined): the page keeps the store's own reads, as before.
|
|
283
|
+
.catch(() => undefined);
|
|
284
|
+
}
|
|
95
285
|
const controller = {
|
|
96
286
|
client,
|
|
97
287
|
openExternal: host.navigation.openExternal,
|
|
98
288
|
clientConfigurationBridge: host.capabilities.aiClientConfiguration,
|
|
289
|
+
get credentialsCollection() {
|
|
290
|
+
return credentials?.collection;
|
|
291
|
+
},
|
|
292
|
+
get credentialRows() {
|
|
293
|
+
return credentialRows;
|
|
294
|
+
},
|
|
99
295
|
get selectedSection() {
|
|
100
296
|
return selectedSection;
|
|
101
297
|
},
|
|
@@ -117,10 +313,32 @@ export function createAiConnectionsController(host) {
|
|
|
117
313
|
get providerLoadError() {
|
|
118
314
|
return providerLoadError;
|
|
119
315
|
},
|
|
316
|
+
get liveUpdates() {
|
|
317
|
+
return liveUpdates;
|
|
318
|
+
},
|
|
319
|
+
get liveRevision() {
|
|
320
|
+
return liveRevision;
|
|
321
|
+
},
|
|
322
|
+
watchPageTables() {
|
|
323
|
+
pageTableHolds += 1;
|
|
324
|
+
syncTableSubscriptions();
|
|
325
|
+
let released = false;
|
|
326
|
+
return () => {
|
|
327
|
+
if (released)
|
|
328
|
+
return;
|
|
329
|
+
released = true;
|
|
330
|
+
pageTableHolds -= 1;
|
|
331
|
+
if (pageTableHolds > 0)
|
|
332
|
+
return;
|
|
333
|
+
pageTableHolds = 0;
|
|
334
|
+
releaseTableSubscriptions();
|
|
335
|
+
};
|
|
336
|
+
},
|
|
120
337
|
selectSection(section) {
|
|
121
338
|
if (selectedSection === section)
|
|
122
339
|
return;
|
|
123
340
|
selectedSection = section;
|
|
341
|
+
syncTableSubscriptions();
|
|
124
342
|
notify();
|
|
125
343
|
},
|
|
126
344
|
selectProvider(provider, credentialId) {
|
|
@@ -132,6 +350,7 @@ export function createAiConnectionsController(host) {
|
|
|
132
350
|
selectedSection = 'provider';
|
|
133
351
|
selectedProvider = provider;
|
|
134
352
|
selectedCredentialId = nextCredentialId;
|
|
353
|
+
syncTableSubscriptions();
|
|
135
354
|
notify();
|
|
136
355
|
},
|
|
137
356
|
selectFirstUnconfiguredProvider() {
|
|
@@ -255,7 +474,7 @@ function withAccountClientCredentials(client, credentials) {
|
|
|
255
474
|
},
|
|
256
475
|
};
|
|
257
476
|
}
|
|
258
|
-
function createInteractiveAiConnectionsClient(operationsClient, podStore, beginProviderLoad) {
|
|
477
|
+
function createInteractiveAiConnectionsClient(operationsClient, podStore, live, beginProviderLoad) {
|
|
259
478
|
const listProviders = async () => {
|
|
260
479
|
const guard = beginProviderLoad();
|
|
261
480
|
try {
|
|
@@ -327,7 +546,7 @@ function createInteractiveAiConnectionsClient(operationsClient, podStore, beginP
|
|
|
327
546
|
}
|
|
328
547
|
return { credential, secret, didRefresh };
|
|
329
548
|
};
|
|
330
|
-
|
|
549
|
+
const storeClient = {
|
|
331
550
|
...operationsClient,
|
|
332
551
|
listProviders,
|
|
333
552
|
listModels: podStore.listModels
|
|
@@ -556,6 +775,35 @@ function createInteractiveAiConnectionsClient(operationsClient, podStore, beginP
|
|
|
556
775
|
? async (provider, modelIds, credentialId) => podStore.saveModelSelection(provider, modelIds, credentialId)
|
|
557
776
|
: operationsClient.saveModelSelection,
|
|
558
777
|
};
|
|
778
|
+
/**
|
|
779
|
+
* With a live credentials collection, credential writes go through it: the
|
|
780
|
+
* page sees them immediately, they roll back on rejection, and the document's
|
|
781
|
+
* own echo reconciles instead of overwriting.
|
|
782
|
+
*
|
|
783
|
+
* The collection may not be there yet (the layer loads lazily) and may never
|
|
784
|
+
* be (a host without the capability), so this dispatches per call: until the
|
|
785
|
+
* table lands, every write is the store's own, exactly as before.
|
|
786
|
+
*
|
|
787
|
+
* Reads of credentials stay in `listProviders` for now (it also carries
|
|
788
|
+
* providers and models); the page renders the credential lists from the
|
|
789
|
+
* collection's rows, and the store's summary of the same row is only the
|
|
790
|
+
* enrichment for attributes the descriptor cannot project.
|
|
791
|
+
*/
|
|
792
|
+
const credentialStore = {
|
|
793
|
+
createApiKeyCredential: (provider, input) => live.mutations()?.createApiKeyCredential(provider, input)
|
|
794
|
+
?? storeClient.createApiKeyCredential(provider, input),
|
|
795
|
+
// Two local-connection flows are account/Gateway operations, not Pod rows.
|
|
796
|
+
createLocalCredential: (provider, input) => (input.authorizationMethodId === 'local-session-import'
|
|
797
|
+
|| (!input.authorizationMethodId && input.offeringId === 'official-subscription')
|
|
798
|
+
? storeClient.createLocalCredential(provider, input)
|
|
799
|
+
: live.mutations()?.createLocalCredential(provider, input)
|
|
800
|
+
?? storeClient.createLocalCredential(provider, input)),
|
|
801
|
+
updateProviderCredential: (provider, credentialId, input) => live.mutations()?.updateProviderCredential(provider, credentialId, input)
|
|
802
|
+
?? storeClient.updateProviderCredential(provider, credentialId, input),
|
|
803
|
+
deleteProviderCredential: (provider, credentialId) => live.mutations()?.deleteProviderCredential(provider, credentialId)
|
|
804
|
+
?? storeClient.deleteProviderCredential(provider, credentialId),
|
|
805
|
+
};
|
|
806
|
+
return { ...storeClient, ...credentialStore };
|
|
559
807
|
}
|
|
560
808
|
export function useSelectedSection(controller) {
|
|
561
809
|
return useSyncExternalStore(controller.subscribe, () => controller.selectedSection ?? 'provider', () => controller.selectedSection ?? 'provider');
|
|
@@ -575,12 +823,33 @@ export function useProviderStates(controller) {
|
|
|
575
823
|
export function useProviderSummaries(controller) {
|
|
576
824
|
return useSyncExternalStore(controller.subscribe, () => legacySummariesFor(controller.providerSummaries), () => legacySummariesFor(controller.providerSummaries));
|
|
577
825
|
}
|
|
826
|
+
/**
|
|
827
|
+
* Providers this deployment offers, as reported by the server.
|
|
828
|
+
*
|
|
829
|
+
* Cloud answers with the operator-designated providers only (no self-hosted
|
|
830
|
+
* `custom`, no local daemon), so the settings surface cannot offer a provider the
|
|
831
|
+
* deployment does not provide. Before the first successful load this is
|
|
832
|
+
* `undefined`, which keeps every provider visible (Local behavior).
|
|
833
|
+
*/
|
|
834
|
+
export function useAvailableProviders(controller) {
|
|
835
|
+
const summaries = useProviderSummaries(controller);
|
|
836
|
+
const ids = Object.keys(summaries);
|
|
837
|
+
return ids.length > 0 ? ids : undefined;
|
|
838
|
+
}
|
|
578
839
|
export function useProviderProducts(controller) {
|
|
579
840
|
return useSyncExternalStore(controller.subscribe, () => controller.providerSummaries, () => controller.providerSummaries);
|
|
580
841
|
}
|
|
581
842
|
export function useProviderLoadError(controller) {
|
|
582
843
|
return useSyncExternalStore(controller.subscribe, () => controller.providerLoadError, () => controller.providerLoadError);
|
|
583
844
|
}
|
|
845
|
+
/** Whether live Pod updates are on, for a status affordance that stays small. */
|
|
846
|
+
export function useLiveUpdates(controller) {
|
|
847
|
+
return useSyncExternalStore(controller.subscribe, () => controller.liveUpdates, () => controller.liveUpdates);
|
|
848
|
+
}
|
|
849
|
+
/** Advances once per coalesced burst of Pod changes; drives page re-reads. */
|
|
850
|
+
export function useLiveRevision(controller) {
|
|
851
|
+
return useSyncExternalStore(controller.subscribe, () => controller.liveRevision, () => controller.liveRevision);
|
|
852
|
+
}
|
|
584
853
|
function productStateFromProvider(product) {
|
|
585
854
|
if (!product || product.status === 'unconfigured' || product.status === 'unavailable') {
|
|
586
855
|
return 'unconfigured';
|
|
@@ -660,14 +929,15 @@ function mergeAuthorizationMethodsIntoProviders(providers, methods) {
|
|
|
660
929
|
const capability = methodsByOffering.get(`${provider.id}:${offering.id}`);
|
|
661
930
|
if (!capability)
|
|
662
931
|
return offering;
|
|
932
|
+
// The server's list is authoritative, an empty one included: it omits a
|
|
933
|
+
// connect entry this build has not implemented, and that omission has to
|
|
934
|
+
// survive the merge rather than fall back to deriving one from `authModes`.
|
|
663
935
|
const authorizationMethods = capability.authorizationMethods;
|
|
664
936
|
return {
|
|
665
937
|
...offering,
|
|
666
938
|
...(capability.endpoints ? { endpoints: capability.endpoints } : {}),
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
authModes: mergeAuthModes(offering.authModes, authorizationMethods.map((method) => method.authMode)),
|
|
670
|
-
} : {}),
|
|
939
|
+
authorizationMethods,
|
|
940
|
+
authModes: mergeAuthModes(offering.authModes, authorizationMethods.map((method) => method.authMode)),
|
|
671
941
|
};
|
|
672
942
|
}),
|
|
673
943
|
}));
|
|
@@ -745,7 +1015,7 @@ function isDefined(value) {
|
|
|
745
1015
|
return value !== undefined;
|
|
746
1016
|
}
|
|
747
1017
|
function errorMessage(error) {
|
|
748
|
-
return
|
|
1018
|
+
return aiConnectionsErrorMessage(error);
|
|
749
1019
|
}
|
|
750
1020
|
/** The wrapper carries the OIDC client id; parsing it needs no stored secret. */
|
|
751
1021
|
function clientIdFromApiKey(apiKey) {
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import type { AiProviderCredentialSummary } from '
|
|
1
|
+
import type { AiProviderCredentialSummary } from '@undefineds.co/ai-connections-core/client';
|
|
2
2
|
/** Highest priority first: a new credential joins the end of the pool. */
|
|
3
3
|
export declare function nextCredentialPriority(credentials: AiProviderCredentialSummary[]): number;
|
|
4
4
|
export declare function credentialDisplayLabel(credential: AiProviderCredentialSummary): string;
|
|
5
5
|
/** Account names are shown inside a pool; only the domain stays readable. */
|
|
6
6
|
export declare function maskAccountLabel(value: string): string;
|
|
7
7
|
export declare function healthLabel(health: AiProviderCredentialSummary['health']): string;
|
|
8
|
+
/**
|
|
9
|
+
* Tone of one credential row: the tint the row carries and the colour of its
|
|
10
|
+
* health dot. The row's border and dividers belong to the list container now, so
|
|
11
|
+
* the tone is a background rather than a box.
|
|
12
|
+
*/
|
|
8
13
|
export declare function healthTone(health: AiProviderCredentialSummary['health']): {
|
|
9
14
|
row: string;
|
|
10
15
|
dot: string;
|
|
@@ -36,12 +36,17 @@ export function healthLabel(health) {
|
|
|
36
36
|
return '已过期';
|
|
37
37
|
return '错误';
|
|
38
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Tone of one credential row: the tint the row carries and the colour of its
|
|
41
|
+
* health dot. The row's border and dividers belong to the list container now, so
|
|
42
|
+
* the tone is a background rather than a box.
|
|
43
|
+
*/
|
|
39
44
|
export function healthTone(health) {
|
|
40
45
|
if (health === 'healthy') {
|
|
41
|
-
return { row: '
|
|
46
|
+
return { row: 'bg-emerald-500/5', dot: 'bg-emerald-500' };
|
|
42
47
|
}
|
|
43
48
|
if (health === 'unknown') {
|
|
44
|
-
return { row: '
|
|
49
|
+
return { row: 'bg-background', dot: 'bg-muted-foreground/50' };
|
|
45
50
|
}
|
|
46
|
-
return { row: '
|
|
51
|
+
return { row: 'bg-destructive/5', dot: 'bg-destructive' };
|
|
47
52
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { AiConnectionsProvider, AiProviderAuthorizationMethod } from '@undefineds.co/ai-connections-core/client';
|
|
2
|
+
/**
|
|
3
|
+
* Wording for one connect entry.
|
|
4
|
+
*
|
|
5
|
+
* A payload that declares its own wording keeps it: the entry's own name is the
|
|
6
|
+
* more specific statement, and it is how a provider the user configured names
|
|
7
|
+
* its entry, and how one offering renames a shared action for its context. The
|
|
8
|
+
* table only fills the gap the shared core deliberately leaves - it names the
|
|
9
|
+
* action by `id` and no longer writes the button.
|
|
10
|
+
*/
|
|
11
|
+
export declare function authorizationMethodLabel(method: AiProviderAuthorizationMethod): string | undefined;
|
|
12
|
+
/** Fills in the wording of every entry that has one. */
|
|
13
|
+
export declare function withAuthorizationMethodLabels(methods: readonly AiProviderAuthorizationMethod[]): AiProviderAuthorizationMethod[];
|
|
14
|
+
/**
|
|
15
|
+
* The name this applet shows for a provider. English for the providers whose
|
|
16
|
+
* product name is English, Chinese where the product is known by its Chinese
|
|
17
|
+
* name - a display decision, so it lives with the display layer instead of
|
|
18
|
+
* travelling in every payload.
|
|
19
|
+
*/
|
|
20
|
+
export declare function providerDisplayName(provider: AiConnectionsProvider): string;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The wording this applet shows, in one place.
|
|
3
|
+
*
|
|
4
|
+
* The shared core carries what a provider *is* and how to talk to it - ids,
|
|
5
|
+
* auth modes, connect modes, endpoints - and deliberately carries no user-facing
|
|
6
|
+
* wording. A connect entry's wording is a property of the entry's id, so it
|
|
7
|
+
* belongs here, where it is rendered, rather than in the catalog, in the
|
|
8
|
+
* payload the server sends, and in this applet's own fallback derivation, which
|
|
9
|
+
* is where the same button used to be named three different ways.
|
|
10
|
+
*
|
|
11
|
+
* An id this table does not know keeps whatever wording its payload declared:
|
|
12
|
+
* a provider the user configured themselves can still name its own entry, and an
|
|
13
|
+
* entry that names nothing stays unrendered, which is how "the offering did not
|
|
14
|
+
* ask for this button" has always been expressed.
|
|
15
|
+
*
|
|
16
|
+
* The table lists only the ids the shared core stopped naming - the four connect
|
|
17
|
+
* actions plus the browser authorization-code entry. A declared wording always
|
|
18
|
+
* wins (see `authorizationMethodLabel`); this is the fallback that keeps a
|
|
19
|
+
* payload naming nothing renderable under the action's own name.
|
|
20
|
+
*/
|
|
21
|
+
const AUTHORIZATION_METHOD_LABEL_BY_ID = {
|
|
22
|
+
'api-key': '添加 API Key',
|
|
23
|
+
'browser-login': '浏览器登录',
|
|
24
|
+
'browser-oauth': '浏览器登录',
|
|
25
|
+
'device-code': '设备码登录',
|
|
26
|
+
'local-session-import': '已有登录态',
|
|
27
|
+
'local-service': '本地服务',
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Wording for one connect entry.
|
|
31
|
+
*
|
|
32
|
+
* A payload that declares its own wording keeps it: the entry's own name is the
|
|
33
|
+
* more specific statement, and it is how a provider the user configured names
|
|
34
|
+
* its entry, and how one offering renames a shared action for its context. The
|
|
35
|
+
* table only fills the gap the shared core deliberately leaves - it names the
|
|
36
|
+
* action by `id` and no longer writes the button.
|
|
37
|
+
*/
|
|
38
|
+
export function authorizationMethodLabel(method) {
|
|
39
|
+
return method.label ?? AUTHORIZATION_METHOD_LABEL_BY_ID[method.id];
|
|
40
|
+
}
|
|
41
|
+
/** Fills in the wording of every entry that has one. */
|
|
42
|
+
export function withAuthorizationMethodLabels(methods) {
|
|
43
|
+
return methods.map((method) => {
|
|
44
|
+
const label = authorizationMethodLabel(method);
|
|
45
|
+
return label === method.label ? method : { ...method, label };
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The name this applet shows for a provider. English for the providers whose
|
|
50
|
+
* product name is English, Chinese where the product is known by its Chinese
|
|
51
|
+
* name - a display decision, so it lives with the display layer instead of
|
|
52
|
+
* travelling in every payload.
|
|
53
|
+
*/
|
|
54
|
+
export function providerDisplayName(provider) {
|
|
55
|
+
switch (provider) {
|
|
56
|
+
case 'openai':
|
|
57
|
+
return 'OpenAI';
|
|
58
|
+
case 'anthropic':
|
|
59
|
+
return 'Anthropic';
|
|
60
|
+
case 'kimi':
|
|
61
|
+
return 'Kimi';
|
|
62
|
+
case 'bailian':
|
|
63
|
+
return '百炼';
|
|
64
|
+
case 'deepseek':
|
|
65
|
+
return 'DeepSeek';
|
|
66
|
+
case 'zhipu':
|
|
67
|
+
return '智谱 AI';
|
|
68
|
+
case 'ollama':
|
|
69
|
+
return 'Ollama';
|
|
70
|
+
case 'custom':
|
|
71
|
+
return 'Custom';
|
|
72
|
+
}
|
|
73
|
+
}
|