@undefineds.co/xpod 0.3.57 → 0.3.61
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/README.md +3 -0
- package/config/cli.json +88 -0
- package/config/cloud.json +32 -1
- package/config/components-ignore.json +3 -0
- package/config/extensions.local.initializer.json +44 -0
- package/config/resolver.json +86 -0
- package/config/xpod.base.json +4 -0
- package/dist/agents/AgentExecutorFactory.d.ts +3 -3
- package/dist/agents/AgentExecutorFactory.js +28 -15
- package/dist/agents/AgentExecutorFactory.js.map +1 -1
- package/dist/agents/BaseAgentExecutor.d.ts +2 -1
- package/dist/agents/BaseAgentExecutor.js +1 -0
- package/dist/agents/BaseAgentExecutor.js.map +1 -1
- package/dist/agents/ClaudeExecutor.d.ts +3 -1
- package/dist/agents/ClaudeExecutor.js +18 -12
- package/dist/agents/ClaudeExecutor.js.map +1 -1
- package/dist/agents/config/resolve.js +0 -21
- package/dist/agents/config/resolve.js.map +1 -1
- package/dist/agents/config/types.d.ts +2 -7
- package/dist/agents/config/types.js +2 -1
- package/dist/agents/config/types.js.map +1 -1
- package/dist/agents/types.d.ts +18 -0
- package/dist/agents/types.js.map +1 -1
- package/dist/ai/schema/types.d.ts +2 -1
- package/dist/ai/schema/types.js +1 -0
- package/dist/ai/schema/types.js.map +1 -1
- package/dist/ai/service/CredentialReader.d.ts +3 -1
- package/dist/ai/service/CredentialReader.js.map +1 -1
- package/dist/ai/service/CredentialReaderImpl.d.ts +3 -1
- package/dist/ai/service/CredentialReaderImpl.js +24 -2
- package/dist/ai/service/CredentialReaderImpl.js.map +1 -1
- package/dist/ai/service/EmbeddingServiceImpl.js +13 -2
- package/dist/ai/service/EmbeddingServiceImpl.js.map +1 -1
- package/dist/ai/service/ProviderRegistry.d.ts +4 -0
- package/dist/ai/service/ProviderRegistry.js.map +1 -1
- package/dist/ai/service/ProviderRegistry.jsonld +4 -0
- package/dist/ai/service/ProviderRegistryImpl.d.ts +4 -1
- package/dist/ai/service/ProviderRegistryImpl.js +26 -4
- package/dist/ai/service/ProviderRegistryImpl.js.map +1 -1
- package/dist/ai/service/ProviderRegistryImpl.jsonld +12 -0
- package/dist/ai/service/defaultEmbeddingProfile.d.ts +5 -0
- package/dist/ai/service/defaultEmbeddingProfile.js +31 -0
- package/dist/ai/service/defaultEmbeddingProfile.js.map +1 -0
- package/dist/ai/service/index.d.ts +1 -0
- package/dist/ai/service/index.js +1 -0
- package/dist/ai/service/index.js.map +1 -1
- package/dist/ai/service/types.d.ts +1 -0
- package/dist/ai/service/types.js.map +1 -1
- package/dist/api/ApiServer.js +17 -2
- package/dist/api/ApiServer.js.map +1 -1
- package/dist/api/ai-gateway/AiGatewayService.d.ts +106 -0
- package/dist/api/ai-gateway/AiGatewayService.js +527 -0
- package/dist/api/ai-gateway/AiGatewayService.js.map +1 -0
- package/dist/api/ai-gateway/auth/AiConnectionInvocationKeyIssuer.d.ts +38 -0
- package/dist/api/ai-gateway/auth/AiConnectionInvocationKeyIssuer.js +128 -0
- package/dist/api/ai-gateway/auth/AiConnectionInvocationKeyIssuer.js.map +1 -0
- package/dist/api/ai-gateway/auth/ClientCredentialsInternalPodAccessTokenProvider.d.ts +25 -0
- package/dist/api/ai-gateway/auth/ClientCredentialsInternalPodAccessTokenProvider.js +91 -0
- package/dist/api/ai-gateway/auth/ClientCredentialsInternalPodAccessTokenProvider.js.map +1 -0
- package/dist/api/ai-gateway/auth/GatewayApiKey.d.ts +28 -0
- package/dist/api/ai-gateway/auth/GatewayApiKey.js +162 -0
- package/dist/api/ai-gateway/auth/GatewayApiKey.js.map +1 -0
- package/dist/api/ai-gateway/auth/GatewayApiKeyAuthenticator.d.ts +56 -0
- package/dist/api/ai-gateway/auth/GatewayApiKeyAuthenticator.js +143 -0
- package/dist/api/ai-gateway/auth/GatewayApiKeyAuthenticator.js.map +1 -0
- package/dist/api/ai-gateway/auth/GatewayKeyLocatorCodec.d.ts +26 -0
- package/dist/api/ai-gateway/auth/GatewayKeyLocatorCodec.js +97 -0
- package/dist/api/ai-gateway/auth/GatewayKeyLocatorCodec.js.map +1 -0
- package/dist/api/ai-gateway/auth/GatewayPrincipal.d.ts +20 -0
- package/dist/api/ai-gateway/auth/GatewayPrincipal.js +37 -0
- package/dist/api/ai-gateway/auth/GatewayPrincipal.js.map +1 -0
- package/dist/api/ai-gateway/auth/InvocationTokenCodec.d.ts +41 -0
- package/dist/api/ai-gateway/auth/InvocationTokenCodec.js +221 -0
- package/dist/api/ai-gateway/auth/InvocationTokenCodec.js.map +1 -0
- package/dist/api/ai-gateway/auth/PodGatewayAccessKeyRepository.d.ts +54 -0
- package/dist/api/ai-gateway/auth/PodGatewayAccessKeyRepository.js +152 -0
- package/dist/api/ai-gateway/auth/PodGatewayAccessKeyRepository.js.map +1 -0
- package/dist/api/ai-gateway/connect/index.d.ts +367 -0
- package/dist/api/ai-gateway/connect/index.js +1061 -0
- package/dist/api/ai-gateway/connect/index.js.map +1 -0
- package/dist/api/ai-gateway/credentials/CloudKmsWrapper.d.ts +40 -0
- package/dist/api/ai-gateway/credentials/CloudKmsWrapper.js +59 -0
- package/dist/api/ai-gateway/credentials/CloudKmsWrapper.js.map +1 -0
- package/dist/api/ai-gateway/credentials/CredentialVault.d.ts +14 -0
- package/dist/api/ai-gateway/credentials/CredentialVault.js +11 -0
- package/dist/api/ai-gateway/credentials/CredentialVault.js.map +1 -0
- package/dist/api/ai-gateway/credentials/KeyWrapper.d.ts +27 -0
- package/dist/api/ai-gateway/credentials/KeyWrapper.js +3 -0
- package/dist/api/ai-gateway/credentials/KeyWrapper.js.map +1 -0
- package/dist/api/ai-gateway/credentials/LocalKeychainWrapper.d.ts +27 -0
- package/dist/api/ai-gateway/credentials/LocalKeychainWrapper.js +145 -0
- package/dist/api/ai-gateway/credentials/LocalKeychainWrapper.js.map +1 -0
- package/dist/api/ai-gateway/credentials/SecretCellCredentialVault.d.ts +13 -0
- package/dist/api/ai-gateway/credentials/SecretCellCredentialVault.js +133 -0
- package/dist/api/ai-gateway/credentials/SecretCellCredentialVault.js.map +1 -0
- package/dist/api/ai-gateway/credentials/SecretCellKeyWrapper.d.ts +23 -0
- package/dist/api/ai-gateway/credentials/SecretCellKeyWrapper.js +62 -0
- package/dist/api/ai-gateway/credentials/SecretCellKeyWrapper.js.map +1 -0
- package/dist/api/ai-gateway/credentials/WebCryptoCredentialVault.d.ts +23 -0
- package/dist/api/ai-gateway/credentials/WebCryptoCredentialVault.js +173 -0
- package/dist/api/ai-gateway/credentials/WebCryptoCredentialVault.js.map +1 -0
- package/dist/api/ai-gateway/errors.d.ts +21 -0
- package/dist/api/ai-gateway/errors.js +50 -0
- package/dist/api/ai-gateway/errors.js.map +1 -0
- package/dist/api/ai-gateway/protocol/ChatCompletionsFrontend.d.ts +6 -0
- package/dist/api/ai-gateway/protocol/ChatCompletionsFrontend.js +111 -0
- package/dist/api/ai-gateway/protocol/ChatCompletionsFrontend.js.map +1 -0
- package/dist/api/ai-gateway/protocol/MessagesFrontend.d.ts +6 -0
- package/dist/api/ai-gateway/protocol/MessagesFrontend.js +99 -0
- package/dist/api/ai-gateway/protocol/MessagesFrontend.js.map +1 -0
- package/dist/api/ai-gateway/protocol/ResponsesFrontend.d.ts +6 -0
- package/dist/api/ai-gateway/protocol/ResponsesFrontend.js +232 -0
- package/dist/api/ai-gateway/protocol/ResponsesFrontend.js.map +1 -0
- package/dist/api/ai-gateway/protocol/index.d.ts +3 -0
- package/dist/api/ai-gateway/protocol/index.js +10 -0
- package/dist/api/ai-gateway/protocol/index.js.map +1 -0
- package/dist/api/ai-gateway/providers/AnthropicRuntimeAdapter.d.ts +7 -0
- package/dist/api/ai-gateway/providers/AnthropicRuntimeAdapter.js +37 -0
- package/dist/api/ai-gateway/providers/AnthropicRuntimeAdapter.js.map +1 -0
- package/dist/api/ai-gateway/providers/BailianRuntimeAdapter.d.ts +9 -0
- package/dist/api/ai-gateway/providers/BailianRuntimeAdapter.js +127 -0
- package/dist/api/ai-gateway/providers/BailianRuntimeAdapter.js.map +1 -0
- package/dist/api/ai-gateway/providers/DeepSeekRuntimeAdapter.d.ts +8 -0
- package/dist/api/ai-gateway/providers/DeepSeekRuntimeAdapter.js +47 -0
- package/dist/api/ai-gateway/providers/DeepSeekRuntimeAdapter.js.map +1 -0
- package/dist/api/ai-gateway/providers/KimiRuntimeAdapter.d.ts +8 -0
- package/dist/api/ai-gateway/providers/KimiRuntimeAdapter.js +57 -0
- package/dist/api/ai-gateway/providers/KimiRuntimeAdapter.js.map +1 -0
- package/dist/api/ai-gateway/providers/OpenAiCompatibleRuntimeAdapter.d.ts +1 -0
- package/dist/api/ai-gateway/providers/OpenAiCompatibleRuntimeAdapter.js +6 -0
- package/dist/api/ai-gateway/providers/OpenAiCompatibleRuntimeAdapter.js.map +1 -0
- package/dist/api/ai-gateway/providers/OpenAiRuntimeAdapter.d.ts +13 -0
- package/dist/api/ai-gateway/providers/OpenAiRuntimeAdapter.js +34 -0
- package/dist/api/ai-gateway/providers/OpenAiRuntimeAdapter.js.map +1 -0
- package/dist/api/ai-gateway/providers/ProviderRegistry.d.ts +68 -0
- package/dist/api/ai-gateway/providers/ProviderRegistry.js +288 -0
- package/dist/api/ai-gateway/providers/ProviderRegistry.js.map +1 -0
- package/dist/api/ai-gateway/providers/ProviderRuntimeAdapter.d.ts +88 -0
- package/dist/api/ai-gateway/providers/ProviderRuntimeAdapter.js +645 -0
- package/dist/api/ai-gateway/providers/ProviderRuntimeAdapter.js.map +1 -0
- package/dist/api/ai-gateway/providers/ProviderRuntimeRegistry.d.ts +13 -0
- package/dist/api/ai-gateway/providers/ProviderRuntimeRegistry.js +48 -0
- package/dist/api/ai-gateway/providers/ProviderRuntimeRegistry.js.map +1 -0
- package/dist/api/ai-gateway/providers/index.d.ts +9 -0
- package/dist/api/ai-gateway/providers/index.js +26 -0
- package/dist/api/ai-gateway/providers/index.js.map +1 -0
- package/dist/api/ai-gateway/quota/AnthropicQuotaAdapter.d.ts +5 -0
- package/dist/api/ai-gateway/quota/AnthropicQuotaAdapter.js +21 -0
- package/dist/api/ai-gateway/quota/AnthropicQuotaAdapter.js.map +1 -0
- package/dist/api/ai-gateway/quota/BailianQuotaAdapter.d.ts +5 -0
- package/dist/api/ai-gateway/quota/BailianQuotaAdapter.js +21 -0
- package/dist/api/ai-gateway/quota/BailianQuotaAdapter.js.map +1 -0
- package/dist/api/ai-gateway/quota/DeepSeekQuotaAdapter.d.ts +10 -0
- package/dist/api/ai-gateway/quota/DeepSeekQuotaAdapter.js +83 -0
- package/dist/api/ai-gateway/quota/DeepSeekQuotaAdapter.js.map +1 -0
- package/dist/api/ai-gateway/quota/KimiQuotaAdapter.d.ts +10 -0
- package/dist/api/ai-gateway/quota/KimiQuotaAdapter.js +70 -0
- package/dist/api/ai-gateway/quota/KimiQuotaAdapter.js.map +1 -0
- package/dist/api/ai-gateway/quota/OpenAiQuotaAdapter.d.ts +5 -0
- package/dist/api/ai-gateway/quota/OpenAiQuotaAdapter.js +21 -0
- package/dist/api/ai-gateway/quota/OpenAiQuotaAdapter.js.map +1 -0
- package/dist/api/ai-gateway/quota/ProviderQuotaAdapter.d.ts +214 -0
- package/dist/api/ai-gateway/quota/ProviderQuotaAdapter.js +511 -0
- package/dist/api/ai-gateway/quota/ProviderQuotaAdapter.js.map +1 -0
- package/dist/api/ai-gateway/quota/index.d.ts +6 -0
- package/dist/api/ai-gateway/quota/index.js +23 -0
- package/dist/api/ai-gateway/quota/index.js.map +1 -0
- package/dist/api/ai-gateway/routing/InMemorySessionAffinityStore.d.ts +26 -0
- package/dist/api/ai-gateway/routing/InMemorySessionAffinityStore.js +67 -0
- package/dist/api/ai-gateway/routing/InMemorySessionAffinityStore.js.map +1 -0
- package/dist/api/ai-gateway/routing/ModelRouter.d.ts +84 -0
- package/dist/api/ai-gateway/routing/ModelRouter.js +274 -0
- package/dist/api/ai-gateway/routing/ModelRouter.js.map +1 -0
- package/dist/api/ai-gateway/routing/RedisSessionAffinityStore.d.ts +39 -0
- package/dist/api/ai-gateway/routing/RedisSessionAffinityStore.js +122 -0
- package/dist/api/ai-gateway/routing/RedisSessionAffinityStore.js.map +1 -0
- package/dist/api/ai-gateway/routing/SessionAffinityStore.d.ts +49 -0
- package/dist/api/ai-gateway/routing/SessionAffinityStore.js +66 -0
- package/dist/api/ai-gateway/routing/SessionAffinityStore.js.map +1 -0
- package/dist/api/ai-gateway/service-access/AiConnectionServiceAccess.d.ts +25 -0
- package/dist/api/ai-gateway/service-access/AiConnectionServiceAccess.js +50 -0
- package/dist/api/ai-gateway/service-access/AiConnectionServiceAccess.js.map +1 -0
- package/dist/api/ai-gateway/types.d.ts +112 -0
- package/dist/api/ai-gateway/types.js +305 -0
- package/dist/api/ai-gateway/types.js.map +1 -0
- package/dist/api/auth/AuthContext.d.ts +18 -3
- package/dist/api/auth/AuthContext.js +13 -2
- package/dist/api/auth/AuthContext.js.map +1 -1
- package/dist/api/auth/Authenticator.d.ts +3 -0
- package/dist/api/auth/Authenticator.js.map +1 -1
- package/dist/api/auth/ClientCredentialsAuthenticator.d.ts +2 -6
- package/dist/api/auth/ClientCredentialsAuthenticator.js +12 -30
- package/dist/api/auth/ClientCredentialsAuthenticator.js.map +1 -1
- package/dist/api/auth/SolidTokenAuthenticator.d.ts +2 -0
- package/dist/api/auth/SolidTokenAuthenticator.js +88 -2
- package/dist/api/auth/SolidTokenAuthenticator.js.map +1 -1
- package/dist/api/auth/TokenIdentity.d.ts +6 -0
- package/dist/api/auth/TokenIdentity.js +31 -0
- package/dist/api/auth/TokenIdentity.js.map +1 -0
- package/dist/api/chatkit/ai-provider.d.ts +9 -23
- package/dist/api/chatkit/ai-provider.js +30 -153
- package/dist/api/chatkit/ai-provider.js.map +1 -1
- package/dist/api/chatkit/default-agent.d.ts +24 -15
- package/dist/api/chatkit/default-agent.js +24 -83
- package/dist/api/chatkit/default-agent.js.map +1 -1
- package/dist/api/chatkit/index.d.ts +2 -1
- package/dist/api/chatkit/index.js +3 -1
- package/dist/api/chatkit/index.js.map +1 -1
- package/dist/api/chatkit/pod-store.d.ts +13 -1
- package/dist/api/chatkit/pod-store.js +127 -7
- package/dist/api/chatkit/pod-store.js.map +1 -1
- package/dist/api/chatkit/runtime/AcpAgentRuntime.d.ts +0 -1
- package/dist/api/chatkit/runtime/AcpAgentRuntime.js +14 -51
- package/dist/api/chatkit/runtime/AcpAgentRuntime.js.map +1 -1
- package/dist/api/chatkit/runtime/AcpRunner.js +2 -1
- package/dist/api/chatkit/runtime/AcpRunner.js.map +1 -1
- package/dist/api/chatkit/runtime/CodexRuntimeProjector.d.ts +15 -1
- package/dist/api/chatkit/runtime/CodexRuntimeProjector.js +52 -34
- package/dist/api/chatkit/runtime/CodexRuntimeProjector.js.map +1 -1
- package/dist/api/chatkit/service.d.ts +8 -1
- package/dist/api/chatkit/service.js +46 -5
- package/dist/api/chatkit/service.js.map +1 -1
- package/dist/api/chatkit/store.d.ts +23 -1
- package/dist/api/chatkit/store.js +56 -0
- package/dist/api/chatkit/store.js.map +1 -1
- package/dist/api/chatkit/types.d.ts +1 -0
- package/dist/api/chatkit/types.js.map +1 -1
- package/dist/api/container/common.js +286 -13
- package/dist/api/container/common.js.map +1 -1
- package/dist/api/container/index.js +126 -6
- package/dist/api/container/index.js.map +1 -1
- package/dist/api/container/local.js +50 -6
- package/dist/api/container/local.js.map +1 -1
- package/dist/api/container/rdf.d.ts +15 -0
- package/dist/api/container/rdf.js +90 -0
- package/dist/api/container/rdf.js.map +1 -0
- package/dist/api/container/routes.js +151 -11
- package/dist/api/container/routes.js.map +1 -1
- package/dist/api/container/types.d.ts +96 -0
- package/dist/api/container/types.js.map +1 -1
- package/dist/api/handlers/AdminHandler.d.ts +25 -2
- package/dist/api/handlers/AdminHandler.js +60 -10
- package/dist/api/handlers/AdminHandler.js.map +1 -1
- package/dist/api/handlers/AiClientConfigurationHandler.d.ts +7 -0
- package/dist/api/handlers/AiClientConfigurationHandler.js +202 -0
- package/dist/api/handlers/AiClientConfigurationHandler.js.map +1 -0
- package/dist/api/handlers/AiGatewayHandler.d.ts +23 -0
- package/dist/api/handlers/AiGatewayHandler.js +231 -0
- package/dist/api/handlers/AiGatewayHandler.js.map +1 -0
- package/dist/api/handlers/AiGatewayManagementHandler.d.ts +24 -0
- package/dist/api/handlers/AiGatewayManagementHandler.js +503 -0
- package/dist/api/handlers/AiGatewayManagementHandler.js.map +1 -0
- package/dist/api/handlers/ChatHandler.d.ts +11 -12
- package/dist/api/handlers/ChatHandler.js +12 -219
- package/dist/api/handlers/ChatHandler.js.map +1 -1
- package/dist/api/handlers/DashboardHandler.js +22 -116
- package/dist/api/handlers/DashboardHandler.js.map +1 -1
- package/dist/api/handlers/NetworkSettingsHandler.d.ts +97 -0
- package/dist/api/handlers/NetworkSettingsHandler.js +511 -0
- package/dist/api/handlers/NetworkSettingsHandler.js.map +1 -0
- package/dist/api/handlers/PodSettingsHandler.d.ts +79 -0
- package/dist/api/handlers/PodSettingsHandler.js +162 -0
- package/dist/api/handlers/PodSettingsHandler.js.map +1 -0
- package/dist/api/handlers/ProvisionHandler.d.ts +3 -1
- package/dist/api/handlers/ProvisionHandler.js +22 -87
- package/dist/api/handlers/ProvisionHandler.js.map +1 -1
- package/dist/api/handlers/RdfStatsHandler.d.ts +6 -0
- package/dist/api/handlers/RdfStatsHandler.js +85 -0
- package/dist/api/handlers/RdfStatsHandler.js.map +1 -0
- package/dist/api/handlers/SettingsHandler.d.ts +5 -0
- package/dist/api/handlers/SettingsHandler.js +13 -0
- package/dist/api/handlers/SettingsHandler.js.map +1 -0
- package/dist/api/handlers/StaticSpaHandler.d.ts +8 -0
- package/dist/api/handlers/StaticSpaHandler.js +102 -0
- package/dist/api/handlers/StaticSpaHandler.js.map +1 -0
- package/dist/api/handlers/index.d.ts +1 -0
- package/dist/api/handlers/index.js +1 -0
- package/dist/api/handlers/index.js.map +1 -1
- package/dist/api/http/readBoundedJsonBody.d.ts +14 -0
- package/dist/api/http/readBoundedJsonBody.js +58 -0
- package/dist/api/http/readBoundedJsonBody.js.map +1 -0
- package/dist/api/middleware/AuthMiddleware.d.ts +1 -0
- package/dist/api/middleware/AuthMiddleware.js +33 -4
- package/dist/api/middleware/AuthMiddleware.js.map +1 -1
- package/dist/api/runs/AgentRuntimeTypes.d.ts +18 -3
- package/dist/api/runs/AgentRuntimeTypes.js +61 -0
- package/dist/api/runs/AgentRuntimeTypes.js.map +1 -1
- package/dist/api/runs/InngestRunExecutionBackend.d.ts +28 -3
- package/dist/api/runs/InngestRunExecutionBackend.js +26 -3
- package/dist/api/runs/InngestRunExecutionBackend.js.map +1 -1
- package/dist/api/runs/ManagedRunWorker.d.ts +4 -1
- package/dist/api/runs/ManagedRunWorker.js +39 -8
- package/dist/api/runs/ManagedRunWorker.js.map +1 -1
- package/dist/api/runs/PiAgentRuntimeDriver.d.ts +5 -1
- package/dist/api/runs/PiAgentRuntimeDriver.js +94 -57
- package/dist/api/runs/PiAgentRuntimeDriver.js.map +1 -1
- package/dist/api/runs/RdfRunContextRetriever.d.ts +46 -0
- package/dist/api/runs/RdfRunContextRetriever.js +277 -0
- package/dist/api/runs/RdfRunContextRetriever.js.map +1 -0
- package/dist/api/runs/RunExecutionBackend.d.ts +38 -0
- package/dist/api/runs/RunExecutionBackend.js.map +1 -1
- package/dist/api/runs/RunStateCenter.d.ts +18 -3
- package/dist/api/runs/RunStateCenter.js +85 -24
- package/dist/api/runs/RunStateCenter.js.map +1 -1
- package/dist/api/runtime.js +163 -3
- package/dist/api/runtime.js.map +1 -1
- package/dist/api/service/AiClientConfigurationService.d.ts +97 -0
- package/dist/api/service/AiClientConfigurationService.js +379 -0
- package/dist/api/service/AiClientConfigurationService.js.map +1 -0
- package/dist/api/service/RdfBenchmarkReportCatalog.d.ts +86 -0
- package/dist/api/service/RdfBenchmarkReportCatalog.js +349 -0
- package/dist/api/service/RdfBenchmarkReportCatalog.js.map +1 -0
- package/dist/api/service/RdfBenchmarkReportGate.d.ts +78 -0
- package/dist/api/service/RdfBenchmarkReportGate.js +197 -0
- package/dist/api/service/RdfBenchmarkReportGate.js.map +1 -0
- package/dist/api/service/RdfSearchIndexingService.d.ts +113 -0
- package/dist/api/service/RdfSearchIndexingService.js +272 -0
- package/dist/api/service/RdfSearchIndexingService.js.map +1 -0
- package/dist/api/service/RdfSearchIndexingSolidFsSyncer.d.ts +27 -0
- package/dist/api/service/RdfSearchIndexingSolidFsSyncer.js +90 -0
- package/dist/api/service/RdfSearchIndexingSolidFsSyncer.js.map +1 -0
- package/dist/api/service/RdfStorageStatsService.d.ts +31 -0
- package/dist/api/service/RdfStorageStatsService.js +97 -0
- package/dist/api/service/RdfStorageStatsService.js.map +1 -0
- package/dist/api/service/VectorStoreService.d.ts +2 -0
- package/dist/api/service/VectorStoreService.js +70 -2
- package/dist/api/service/VectorStoreService.js.map +1 -1
- package/dist/api/service/VercelChatService.d.ts +27 -38
- package/dist/api/service/VercelChatService.js +153 -505
- package/dist/api/service/VercelChatService.js.map +1 -1
- package/dist/api/service/provider-http-transport.d.ts +21 -0
- package/dist/api/service/provider-http-transport.js +108 -2
- package/dist/api/service/provider-http-transport.js.map +1 -1
- package/dist/api/service/provider-registry.d.ts +5 -7
- package/dist/api/service/provider-registry.js +81 -64
- package/dist/api/service/provider-registry.js.map +1 -1
- package/dist/api/tasks/InngestTaskScheduler.d.ts +44 -4
- package/dist/api/tasks/TaskMaterializer.d.ts +10 -1
- package/dist/api/tasks/TaskMaterializer.js +39 -4
- package/dist/api/tasks/TaskMaterializer.js.map +1 -1
- package/dist/api/tasks/TaskService.d.ts +5 -1
- package/dist/api/tasks/TaskService.js +3 -0
- package/dist/api/tasks/TaskService.js.map +1 -1
- package/dist/cli/commands/obj.d.ts +9 -0
- package/dist/cli/commands/obj.js +74 -3
- package/dist/cli/commands/obj.js.map +1 -1
- package/dist/cli/commands/rdf.d.ts +9 -0
- package/dist/cli/commands/rdf.js +66 -1
- package/dist/cli/commands/rdf.js.map +1 -1
- package/dist/cli/commands/start.js +3 -0
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/lib/solid-auth.d.ts +3 -3
- package/dist/cli/lib/solid-auth.js +4 -4
- package/dist/cli/lib/solid-auth.js.map +1 -1
- package/dist/components/components.jsonld +16 -0
- package/dist/components/context.jsonld +815 -28
- package/dist/document/Chunker.jsonld +110 -0
- package/dist/document/{DocumentParser.d.ts → DocumentReader.d.ts} +23 -11
- package/dist/document/{DocumentParser.js → DocumentReader.js} +2 -2
- package/dist/document/DocumentReader.js.map +1 -0
- package/dist/document/DocumentReader.jsonld +82 -0
- package/dist/document/HeadingChunker.jsonld +41 -0
- package/dist/document/{JinaDocumentParser.d.ts → JinaReader.d.ts} +7 -7
- package/dist/document/{JinaDocumentParser.js → JinaReader.js} +12 -12
- package/dist/document/JinaReader.js.map +1 -0
- package/dist/document/JinaReader.jsonld +133 -0
- package/dist/document/L0SourceSummary.d.ts +103 -0
- package/dist/document/L0SourceSummary.js +157 -0
- package/dist/document/L0SourceSummary.js.map +1 -0
- package/dist/document/L0SourceSummary.jsonld +326 -0
- package/dist/document/PaddleOcrReader.d.ts +40 -0
- package/dist/document/PaddleOcrReader.js +53 -0
- package/dist/document/PaddleOcrReader.js.map +1 -0
- package/dist/document/PaddleOcrReader.jsonld +234 -0
- package/dist/document/ReaderAiConfig.d.ts +50 -0
- package/dist/document/ReaderAiConfig.js +109 -0
- package/dist/document/ReaderAiConfig.js.map +1 -0
- package/dist/document/ReaderAiConfig.jsonld +185 -0
- package/dist/document/ReaderPolicy.d.ts +89 -0
- package/dist/document/ReaderPolicy.js +158 -0
- package/dist/document/ReaderPolicy.js.map +1 -0
- package/dist/document/ReaderPolicy.jsonld +218 -0
- package/dist/document/index.d.ts +6 -2
- package/dist/document/index.js +6 -2
- package/dist/document/index.js.map +1 -1
- package/dist/edge/DdnsManager.d.ts +1 -1
- package/dist/edge/DdnsManager.js.map +1 -1
- package/dist/edge/EdgeNodeAgent.d.ts +4 -0
- package/dist/edge/EdgeNodeAgent.js +6 -0
- package/dist/edge/EdgeNodeAgent.js.map +1 -1
- package/dist/edge/EdgeNodeAgent.jsonld +8 -0
- package/dist/edge/EdgeNodeAgentInitializer.d.ts +16 -0
- package/dist/edge/EdgeNodeAgentInitializer.js +51 -0
- package/dist/edge/EdgeNodeAgentInitializer.js.map +1 -1
- package/dist/edge/EdgeNodeAgentInitializer.jsonld +250 -0
- package/dist/edge/EdgeNodeCertificateCapabilityBridge.d.ts +34 -0
- package/dist/edge/EdgeNodeCertificateCapabilityBridge.js +111 -0
- package/dist/edge/EdgeNodeCertificateCapabilityBridge.js.map +1 -0
- package/dist/edge/acme/AcmeCertificateManager.d.ts +14 -1
- package/dist/edge/acme/AcmeCertificateManager.js +67 -7
- package/dist/edge/acme/AcmeCertificateManager.js.map +1 -1
- package/dist/edge/acme/AcmeCertificateManager.jsonld +22 -2
- package/dist/edge/acme/ClusterCertificateManager.d.ts +12 -0
- package/dist/edge/acme/ClusterCertificateManager.js +38 -0
- package/dist/edge/acme/ClusterCertificateManager.js.map +1 -1
- package/dist/extensions/ExtensionRuntime.d.ts +17 -0
- package/dist/extensions/ExtensionRuntime.js +171 -0
- package/dist/extensions/ExtensionRuntime.js.map +1 -0
- package/dist/extensions/PodCredentialResolver.d.ts +23 -0
- package/dist/extensions/PodCredentialResolver.js +139 -0
- package/dist/extensions/PodCredentialResolver.js.map +1 -0
- package/dist/extensions/index.d.ts +3 -0
- package/dist/extensions/index.js +20 -0
- package/dist/extensions/index.js.map +1 -0
- package/dist/extensions/types.d.ts +73 -0
- package/dist/extensions/types.js +3 -0
- package/dist/extensions/types.js.map +1 -0
- package/dist/http/SubgraphSparqlHttpHandler.d.ts +20 -1
- package/dist/http/SubgraphSparqlHttpHandler.js +324 -43
- package/dist/http/SubgraphSparqlHttpHandler.js.map +1 -1
- package/dist/http/SubgraphSparqlHttpHandler.jsonld +87 -0
- package/dist/identity/drizzle/EdgeNodeRepository.js +3 -2
- package/dist/identity/drizzle/EdgeNodeRepository.js.map +1 -1
- package/dist/identity/drizzle/schema.pg.js +1 -1
- package/dist/identity/drizzle/schema.pg.js.map +1 -1
- package/dist/identity/drizzle/schema.sqlite.js +1 -1
- package/dist/identity/drizzle/schema.sqlite.js.map +1 -1
- package/dist/identity/oidc/ScopedPickWebIdHandler.js +5 -5
- package/dist/identity/oidc/ScopedPickWebIdHandler.js.map +1 -1
- package/dist/index.d.ts +12 -2
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/dist/main.js +3 -0
- package/dist/main.js.map +1 -1
- package/dist/provision/LocalProvisionState.d.ts +28 -0
- package/dist/provision/LocalProvisionState.js +124 -0
- package/dist/provision/LocalProvisionState.js.map +1 -0
- package/dist/provision/ProvisionCodeCodec.d.ts +7 -3
- package/dist/provision/ProvisionCodeCodec.js +10 -3
- package/dist/provision/ProvisionCodeCodec.js.map +1 -1
- package/dist/provision/ProvisionPodCreator.d.ts +15 -1
- package/dist/provision/ProvisionPodCreator.js +68 -1
- package/dist/provision/ProvisionPodCreator.js.map +1 -1
- package/dist/provision/ProvisionPodCreator.jsonld +31 -0
- package/dist/provision/ServiceAccessTokenCodec.d.ts +45 -0
- package/dist/provision/ServiceAccessTokenCodec.js +86 -0
- package/dist/provision/ServiceAccessTokenCodec.js.map +1 -0
- package/dist/runtime/GatewayAdminProxyAuth.d.ts +29 -0
- package/dist/runtime/GatewayAdminProxyAuth.js +108 -0
- package/dist/runtime/GatewayAdminProxyAuth.js.map +1 -0
- package/dist/runtime/Proxy.d.ts +10 -0
- package/dist/runtime/Proxy.js +64 -6
- package/dist/runtime/Proxy.js.map +1 -1
- package/dist/runtime/XpodRuntime.js +1 -0
- package/dist/runtime/XpodRuntime.js.map +1 -1
- package/dist/runtime/bootstrap.d.ts +1 -0
- package/dist/runtime/bootstrap.js +29 -0
- package/dist/runtime/bootstrap.js.map +1 -1
- package/dist/runtime/css-process.d.ts +1 -0
- package/dist/runtime/css-process.js +1 -0
- package/dist/runtime/css-process.js.map +1 -1
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.js +3 -1
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/lifecycle.d.ts +3 -1
- package/dist/runtime/lifecycle.js +3 -1
- package/dist/runtime/lifecycle.js.map +1 -1
- package/dist/runtime/runner/node/NodeGatewayRuntimeRunner.js +2 -0
- package/dist/runtime/runner/node/NodeGatewayRuntimeRunner.js.map +1 -1
- package/dist/runtime/runner/types.d.ts +3 -0
- package/dist/runtime/runner/types.js.map +1 -1
- package/dist/runtime/runtime-types.d.ts +2 -0
- package/dist/runtime/runtime-types.js.map +1 -1
- package/dist/runtime/safe-env.d.ts +15 -0
- package/dist/runtime/safe-env.js +109 -0
- package/dist/runtime/safe-env.js.map +1 -0
- package/dist/security/index.d.ts +1 -0
- package/dist/security/index.js +18 -0
- package/dist/security/index.js.map +1 -0
- package/dist/security/secret-cell/DeploymentRootKeyProvider.d.ts +17 -0
- package/dist/security/secret-cell/DeploymentRootKeyProvider.js +61 -0
- package/dist/security/secret-cell/DeploymentRootKeyProvider.js.map +1 -0
- package/dist/security/secret-cell/DeploymentRootKeyProvider.jsonld +124 -0
- package/dist/security/secret-cell/SecretCellVault.d.ts +55 -0
- package/dist/security/secret-cell/SecretCellVault.js +242 -0
- package/dist/security/secret-cell/SecretCellVault.js.map +1 -0
- package/dist/security/secret-cell/SecretCellVault.jsonld +207 -0
- package/dist/security/secret-cell/index.d.ts +2 -0
- package/dist/security/secret-cell/index.js +11 -0
- package/dist/security/secret-cell/index.js.map +1 -0
- package/dist/solidfs/CompositeSolidFsSyncer.d.ts +18 -0
- package/dist/solidfs/CompositeSolidFsSyncer.js +32 -0
- package/dist/solidfs/CompositeSolidFsSyncer.js.map +1 -0
- package/dist/solidfs/LocalSolidFS.js +25 -1
- package/dist/solidfs/LocalSolidFS.js.map +1 -1
- package/dist/solidfs/RdfIndexSolidFsSyncer.d.ts +41 -2
- package/dist/solidfs/RdfIndexSolidFsSyncer.js +331 -21
- package/dist/solidfs/RdfIndexSolidFsSyncer.js.map +1 -1
- package/dist/solidfs/SolidFsMetaNotes.d.ts +25 -0
- package/dist/solidfs/SolidFsMetaNotes.js +103 -0
- package/dist/solidfs/SolidFsMetaNotes.js.map +1 -0
- package/dist/solidfs/SolidFsSyncJournal.d.ts +2 -2
- package/dist/solidfs/SolidFsSyncJournal.js +9 -4
- package/dist/solidfs/SolidFsSyncJournal.js.map +1 -1
- package/dist/solidfs/SolidFsSyncJournal.jsonld +119 -0
- package/dist/solidfs/WorkspacePrompt.d.ts +13 -0
- package/dist/solidfs/WorkspacePrompt.js +42 -0
- package/dist/solidfs/WorkspacePrompt.js.map +1 -0
- package/dist/solidfs/index.d.ts +3 -0
- package/dist/solidfs/index.js +3 -0
- package/dist/solidfs/index.js.map +1 -1
- package/dist/solidfs/types.d.ts +12 -2
- package/dist/solidfs/types.js.map +1 -1
- package/dist/storage/accessors/MixDataAccessor.d.ts +36 -4
- package/dist/storage/accessors/MixDataAccessor.js +222 -23
- package/dist/storage/accessors/MixDataAccessor.js.map +1 -1
- package/dist/storage/accessors/MixDataAccessor.jsonld +89 -0
- package/dist/storage/accessors/SolidRdfDataAccessor.d.ts +6 -1
- package/dist/storage/accessors/SolidRdfDataAccessor.js +35 -0
- package/dist/storage/accessors/SolidRdfDataAccessor.js.map +1 -1
- package/dist/storage/accessors/SolidRdfDataAccessor.jsonld +20 -0
- package/dist/storage/database/PostgresPoolManager.d.ts +1 -0
- package/dist/storage/database/PostgresPoolManager.js +2 -2
- package/dist/storage/database/PostgresPoolManager.js.map +1 -1
- package/dist/storage/locking/UrlAwareRedisLocker.d.ts +2 -0
- package/dist/storage/locking/UrlAwareRedisLocker.js +65 -0
- package/dist/storage/locking/UrlAwareRedisLocker.js.map +1 -1
- package/dist/storage/locking/UrlAwareRedisLocker.jsonld +19 -0
- package/dist/storage/rdf/PostgresRdfEngine.d.ts +286 -9
- package/dist/storage/rdf/PostgresRdfEngine.js +10773 -2084
- package/dist/storage/rdf/PostgresRdfEngine.js.map +1 -1
- package/dist/storage/rdf/PostgresRdfEngine.jsonld +1693 -89
- package/dist/storage/rdf/PostgresRdfSqlExecutor.d.ts +24 -0
- package/dist/storage/rdf/PostgresRdfSqlExecutor.js +131 -0
- package/dist/storage/rdf/PostgresRdfSqlExecutor.js.map +1 -0
- package/dist/storage/rdf/PostgresRdfTextIndex.d.ts +54 -0
- package/dist/storage/rdf/PostgresRdfTextIndex.js +1255 -0
- package/dist/storage/rdf/PostgresRdfTextIndex.js.map +1 -0
- package/dist/storage/rdf/PostgresRdfTextIndex.jsonld +487 -0
- package/dist/storage/rdf/PostgresRdfVectorIndex.d.ts +46 -0
- package/dist/storage/rdf/PostgresRdfVectorIndex.js +1165 -0
- package/dist/storage/rdf/PostgresRdfVectorIndex.js.map +1 -0
- package/dist/storage/rdf/PostgresRdfVectorIndex.jsonld +423 -0
- package/dist/storage/rdf/Rdf3xIndex.d.ts +14 -1
- package/dist/storage/rdf/Rdf3xIndex.js +286 -2
- package/dist/storage/rdf/Rdf3xIndex.js.map +1 -1
- package/dist/storage/rdf/Rdf3xIndex.jsonld +36 -0
- package/dist/storage/rdf/Rdf3xSchema.d.ts +5 -1
- package/dist/storage/rdf/Rdf3xSchema.js +17 -3
- package/dist/storage/rdf/Rdf3xSchema.js.map +1 -1
- package/dist/storage/rdf/RdfAccessScope.d.ts +22 -0
- package/dist/storage/rdf/RdfAccessScope.js +345 -0
- package/dist/storage/rdf/RdfAccessScope.js.map +1 -0
- package/dist/storage/rdf/RdfAccessScope.jsonld +45 -0
- package/dist/storage/rdf/RdfFusionRankPlan.d.ts +2 -0
- package/dist/storage/rdf/RdfFusionRankPlan.js +186 -0
- package/dist/storage/rdf/RdfFusionRankPlan.js.map +1 -0
- package/dist/storage/rdf/RdfJoinShape.d.ts +8 -0
- package/dist/storage/rdf/RdfJoinShape.js +31 -0
- package/dist/storage/rdf/RdfJoinShape.js.map +1 -0
- package/dist/storage/rdf/RdfQuadIndex.d.ts +5 -2
- package/dist/storage/rdf/RdfQuadIndex.js +94 -6
- package/dist/storage/rdf/RdfQuadIndex.js.map +1 -1
- package/dist/storage/rdf/RdfQuadIndex.jsonld +12 -0
- package/dist/storage/rdf/RdfQueryExecutor.d.ts +3 -4
- package/dist/storage/rdf/RdfQueryExecutor.js +235 -8
- package/dist/storage/rdf/RdfQueryExecutor.js.map +1 -1
- package/dist/storage/rdf/RdfSearchSourceFilter.d.ts +10 -0
- package/dist/storage/rdf/RdfSearchSourceFilter.js +83 -0
- package/dist/storage/rdf/RdfSearchSourceFilter.js.map +1 -0
- package/dist/storage/rdf/RdfSparqlAdapter.d.ts +27 -1
- package/dist/storage/rdf/RdfSparqlAdapter.js +265 -3
- package/dist/storage/rdf/RdfSparqlAdapter.js.map +1 -1
- package/dist/storage/rdf/RdfSparqlAdapter.jsonld +8 -0
- package/dist/storage/rdf/RdfTermDictionary.d.ts +7 -1
- package/dist/storage/rdf/RdfTermDictionary.js +139 -0
- package/dist/storage/rdf/RdfTermDictionary.js.map +1 -1
- package/dist/storage/rdf/RdfTermDictionary.jsonld +4 -0
- package/dist/storage/rdf/RdfTextIndex.d.ts +45 -2
- package/dist/storage/rdf/RdfTextIndex.js +810 -114
- package/dist/storage/rdf/RdfTextIndex.js.map +1 -1
- package/dist/storage/rdf/RdfTextIndex.jsonld +193 -0
- package/dist/storage/rdf/RdfTextProjection.d.ts +10 -0
- package/dist/storage/rdf/RdfTextProjection.js +258 -0
- package/dist/storage/rdf/RdfTextProjection.js.map +1 -0
- package/dist/storage/rdf/RdfVectorIndex.d.ts +30 -2
- package/dist/storage/rdf/RdfVectorIndex.js +461 -38
- package/dist/storage/rdf/RdfVectorIndex.js.map +1 -1
- package/dist/storage/rdf/RdfVectorIndex.jsonld +163 -0
- package/dist/storage/rdf/SolidRdfEngine.d.ts +12 -9
- package/dist/storage/rdf/SolidRdfEngine.js +48 -22
- package/dist/storage/rdf/SolidRdfEngine.js.map +1 -1
- package/dist/storage/rdf/SolidRdfEngine.jsonld +33 -43
- package/dist/storage/rdf/SolidRdfSparqlEngine.d.ts +19 -8
- package/dist/storage/rdf/SolidRdfSparqlEngine.js +674 -44
- package/dist/storage/rdf/SolidRdfSparqlEngine.js.map +1 -1
- package/dist/storage/rdf/SolidRdfSparqlEngine.jsonld +51 -0
- package/dist/storage/rdf/index.d.ts +9 -5
- package/dist/storage/rdf/index.js +42 -1
- package/dist/storage/rdf/index.js.map +1 -1
- package/dist/storage/rdf/models-benchmark.d.ts +264 -2
- package/dist/storage/rdf/models-benchmark.js +4207 -155
- package/dist/storage/rdf/models-benchmark.js.map +1 -1
- package/dist/storage/rdf/types.d.ts +833 -4
- package/dist/storage/rdf/types.js.map +1 -1
- package/dist/storage/rdf/types.jsonld +348 -0
- package/dist/storage/sparql/CompatibilitySparqlEngine.d.ts +14 -13
- package/dist/storage/sparql/CompatibilitySparqlEngine.js +24 -24
- package/dist/storage/sparql/CompatibilitySparqlEngine.js.map +1 -1
- package/dist/storage/sparql/CompatibilitySparqlEngineImpl.d.ts +14 -13
- package/dist/storage/sparql/CompatibilitySparqlEngineImpl.js +30 -18
- package/dist/storage/sparql/CompatibilitySparqlEngineImpl.js.map +1 -1
- package/dist/storage/sparql/SubgraphQueryEngine.d.ts +21 -12
- package/dist/storage/sparql/SubgraphQueryEngine.js +12 -12
- package/dist/storage/sparql/SubgraphQueryEngine.js.map +1 -1
- package/dist/terminal/sandbox/MacOSSandbox.js +2 -1
- package/dist/terminal/sandbox/MacOSSandbox.js.map +1 -1
- package/dist/terminal/sandbox/index.js +2 -1
- package/dist/terminal/sandbox/index.js.map +1 -1
- package/dist/test-utils/no-auth-xpod.js +3 -0
- package/dist/test-utils/no-auth-xpod.js.map +1 -1
- package/dist/tunnel/LocalTunnelProvider.d.ts +3 -0
- package/dist/tunnel/LocalTunnelProvider.js +17 -1
- package/dist/tunnel/LocalTunnelProvider.js.map +1 -1
- package/dist/tunnel/LocalTunnelProvider.jsonld +23 -0
- package/dist/tunnel/SakuraFrpTunnelProvider.d.ts +3 -0
- package/dist/tunnel/SakuraFrpTunnelProvider.js +18 -2
- package/dist/tunnel/SakuraFrpTunnelProvider.js.map +1 -1
- package/dist/tunnel/TunnelProfiles.d.ts +22 -0
- package/dist/tunnel/TunnelProfiles.js +208 -0
- package/dist/tunnel/TunnelProfiles.js.map +1 -0
- package/dist/tunnel/index.d.ts +2 -0
- package/dist/tunnel/index.js +4 -1
- package/dist/tunnel/index.js.map +1 -1
- package/dist/util/identifiers/ClusterIdentifierStrategy.d.ts +3 -0
- package/dist/util/identifiers/ClusterIdentifierStrategy.js +18 -2
- package/dist/util/identifiers/ClusterIdentifierStrategy.js.map +1 -1
- package/dist/util/identifiers/ClusterIdentifierStrategy.jsonld +5 -1
- package/node_modules/@undefineds.co/ai-connection/dist/AiClientConfigurationSection.d.ts +55 -0
- package/node_modules/@undefineds.co/ai-connection/dist/AiClientConfigurationSection.js +167 -0
- package/node_modules/@undefineds.co/ai-connection/dist/AiConnectionHeader.d.ts +3 -0
- package/node_modules/@undefineds.co/ai-connection/dist/AiConnectionHeader.js +8 -0
- package/node_modules/@undefineds.co/ai-connection/dist/AiConnectionList.d.ts +4 -0
- package/node_modules/@undefineds.co/ai-connection/dist/AiConnectionList.js +36 -0
- package/node_modules/@undefineds.co/ai-connection/dist/AiConnectionMain.d.ts +4 -0
- package/node_modules/@undefineds.co/ai-connection/dist/AiConnectionMain.js +37 -0
- package/node_modules/@undefineds.co/ai-connection/dist/AiConnectionMainHeader.d.ts +3 -0
- package/node_modules/@undefineds.co/ai-connection/dist/AiConnectionMainHeader.js +7 -0
- package/node_modules/@undefineds.co/ai-connection/dist/AiConnectionPanel.d.ts +14 -0
- package/node_modules/@undefineds.co/ai-connection/dist/AiConnectionPanel.js +333 -0
- package/node_modules/@undefineds.co/ai-connection/dist/AiProviderCard.d.ts +22 -0
- package/node_modules/@undefineds.co/ai-connection/dist/AiProviderCard.js +43 -0
- package/node_modules/@undefineds.co/ai-connection/dist/AiQuotaCard.d.ts +8 -0
- package/node_modules/@undefineds.co/ai-connection/dist/AiQuotaCard.js +6 -0
- package/node_modules/@undefineds.co/ai-connection/dist/ai-connection-client.d.ts +120 -0
- package/node_modules/@undefineds.co/ai-connection/dist/ai-connection-client.js +414 -0
- package/node_modules/@undefineds.co/ai-connection/dist/client-config/base-adapter.d.ts +32 -0
- package/node_modules/@undefineds.co/ai-connection/dist/client-config/base-adapter.js +212 -0
- package/node_modules/@undefineds.co/ai-connection/dist/client-config/codex.d.ts +14 -0
- package/node_modules/@undefineds.co/ai-connection/dist/client-config/codex.js +90 -0
- package/node_modules/@undefineds.co/ai-connection/dist/client-config/index.cjs +668 -0
- package/node_modules/@undefineds.co/ai-connection/dist/client-config/index.d.ts +6 -0
- package/node_modules/@undefineds.co/ai-connection/dist/client-config/index.js +6 -0
- package/node_modules/@undefineds.co/ai-connection/dist/client-config/json-env-adapter.d.ts +21 -0
- package/node_modules/@undefineds.co/ai-connection/dist/client-config/json-env-adapter.js +82 -0
- package/node_modules/@undefineds.co/ai-connection/dist/client-config/pi.d.ts +13 -0
- package/node_modules/@undefineds.co/ai-connection/dist/client-config/pi.js +83 -0
- package/node_modules/@undefineds.co/ai-connection/dist/client-config/transaction.d.ts +17 -0
- package/node_modules/@undefineds.co/ai-connection/dist/client-config/transaction.js +153 -0
- package/node_modules/@undefineds.co/ai-connection/dist/client-config/types.d.ts +40 -0
- package/node_modules/@undefineds.co/ai-connection/dist/client-config/types.js +1 -0
- package/node_modules/@undefineds.co/ai-connection/dist/controller.d.ts +42 -0
- package/node_modules/@undefineds.co/ai-connection/dist/controller.js +289 -0
- package/node_modules/@undefineds.co/ai-connection/dist/index.d.ts +16 -0
- package/node_modules/@undefineds.co/ai-connection/dist/index.js +41 -0
- package/node_modules/@undefineds.co/ai-connection/dist/manifest.d.ts +1 -0
- package/node_modules/@undefineds.co/ai-connection/dist/manifest.js +18 -0
- package/node_modules/@undefineds.co/ai-connection/dist/service-access.d.ts +3 -0
- package/node_modules/@undefineds.co/ai-connection/dist/service-access.js +133 -0
- package/node_modules/@undefineds.co/ai-connection/package.json +50 -0
- package/node_modules/@undefineds.co/extension-sdk/README.md +299 -0
- package/node_modules/@undefineds.co/extension-sdk/dist/index.d.ts +5 -0
- package/node_modules/@undefineds.co/extension-sdk/dist/index.js +5 -0
- package/node_modules/@undefineds.co/extension-sdk/dist/layout.d.ts +16 -0
- package/node_modules/@undefineds.co/extension-sdk/dist/layout.js +36 -0
- package/node_modules/@undefineds.co/extension-sdk/dist/manifest.d.ts +27 -0
- package/node_modules/@undefineds.co/extension-sdk/dist/manifest.js +79 -0
- package/node_modules/@undefineds.co/extension-sdk/dist/react/app-layout.d.ts +7 -0
- package/node_modules/@undefineds.co/extension-sdk/dist/react/app-layout.js +8 -0
- package/node_modules/@undefineds.co/extension-sdk/dist/react/auth-boundary.d.ts +27 -0
- package/node_modules/@undefineds.co/extension-sdk/dist/react/auth-boundary.js +49 -0
- package/node_modules/@undefineds.co/extension-sdk/dist/react/layout-context.d.ts +11 -0
- package/node_modules/@undefineds.co/extension-sdk/dist/react/layout-context.js +9 -0
- package/node_modules/@undefineds.co/extension-sdk/dist/react/workspace-layout.d.ts +38 -0
- package/node_modules/@undefineds.co/extension-sdk/dist/react/workspace-layout.js +132 -0
- package/node_modules/@undefineds.co/extension-sdk/dist/react.d.ts +12 -0
- package/node_modules/@undefineds.co/extension-sdk/dist/react.js +19 -0
- package/node_modules/@undefineds.co/extension-sdk/dist/testing.d.ts +7 -0
- package/node_modules/@undefineds.co/extension-sdk/dist/testing.js +27 -0
- package/node_modules/@undefineds.co/extension-sdk/dist/web.d.ts +225 -0
- package/node_modules/@undefineds.co/extension-sdk/dist/web.js +142 -0
- package/node_modules/@undefineds.co/extension-sdk/package.json +49 -0
- package/node_modules/@undefineds.co/shared-ui/dist/badge.d.ts +8 -0
- package/node_modules/@undefineds.co/shared-ui/dist/badge.js +17 -0
- package/node_modules/@undefineds.co/shared-ui/dist/button.d.ts +10 -0
- package/node_modules/@undefineds.co/shared-ui/dist/button.js +30 -0
- package/node_modules/@undefineds.co/shared-ui/dist/card.d.ts +7 -0
- package/node_modules/@undefineds.co/shared-ui/dist/card.js +15 -0
- package/node_modules/@undefineds.co/shared-ui/dist/index.d.ts +6 -0
- package/node_modules/@undefineds.co/shared-ui/dist/index.js +6 -0
- package/node_modules/@undefineds.co/shared-ui/dist/input.d.ts +4 -0
- package/node_modules/@undefineds.co/shared-ui/dist/input.js +5 -0
- package/node_modules/@undefineds.co/shared-ui/dist/theme.css +121 -0
- package/node_modules/@undefineds.co/shared-ui/dist/utils.d.ts +2 -0
- package/node_modules/@undefineds.co/shared-ui/dist/utils.js +5 -0
- package/node_modules/@undefineds.co/shared-ui/dist/workspace.d.ts +23 -0
- package/node_modules/@undefineds.co/shared-ui/dist/workspace.js +38 -0
- package/node_modules/@undefineds.co/shared-ui/package.json +39 -0
- package/node_modules/@undefineds.co/solid-sdk/dist/index.d.ts +3 -0
- package/node_modules/@undefineds.co/solid-sdk/dist/index.js +3 -0
- package/node_modules/@undefineds.co/solid-sdk/dist/pod-runtime.d.ts +45 -0
- package/node_modules/@undefineds.co/solid-sdk/dist/pod-runtime.js +147 -0
- package/node_modules/@undefineds.co/solid-sdk/dist/react.d.ts +15 -0
- package/node_modules/@undefineds.co/solid-sdk/dist/react.js +15 -0
- package/node_modules/@undefineds.co/solid-sdk/dist/session.d.ts +42 -0
- package/node_modules/@undefineds.co/solid-sdk/dist/session.js +127 -0
- package/node_modules/@undefineds.co/solid-sdk/package.json +45 -0
- package/package.json +32 -12
- package/static/app/assets/index-BoYHJ6si.js +230 -0
- package/static/app/assets/inrupt-smoke.js +2 -2
- package/static/app/assets/main.css +1 -1
- package/static/app/assets/main.js +9 -9
- package/static/dashboard/assets/NetworkPage-Brt79fuQ.js +2 -0
- package/static/dashboard/assets/PaneListHeader-57nvMwH6.js +1 -0
- package/static/dashboard/assets/PodPage-CM6do1vB.js +2 -0
- package/static/dashboard/assets/ServicesPage-BUNxGJRz.js +1 -0
- package/static/dashboard/assets/card-B9Zjf_2p.js +1 -0
- package/static/dashboard/assets/dashboard-8C6o666W.js +305 -0
- package/static/dashboard/assets/dashboard-CSdewNeA.css +1 -0
- package/static/dashboard/assets/database-DPh9wDY9.js +1 -0
- package/static/dashboard/assets/external-link-VbMQvVMz.js +1 -0
- package/static/dashboard/assets/index-RfiFckzb.js +51 -0
- package/static/dashboard/assets/refresh-cw-BxVxNxNr.js +1 -0
- package/static/dashboard/assets/services-status-context-DKmJ7ISr.js +1 -0
- package/static/dashboard/dashboard.html +2 -2
- package/static/settings/assets/ModelsPage-D_IH7AH3.js +1 -0
- package/static/settings/assets/PaneListHeader-Bgaze006.js +1 -0
- package/static/settings/assets/PodPage-Cy1VNObw.js +2 -0
- package/static/settings/assets/ServicesPage-BsFaxVWC.js +1 -0
- package/static/settings/assets/SettingsPage-UafNWE_p.js +48 -0
- package/static/settings/assets/card-B_bXSIn-.js +1 -0
- package/static/settings/assets/services-status-context-DiX-AbrP.js +1 -0
- package/static/settings/assets/settings-B30oMfZq.js +305 -0
- package/static/settings/assets/settings-CSdewNeA.css +1 -0
- package/static/settings/assets/workspace-layout-Dv1Yn9Ci.js +1 -0
- package/static/settings/auth.html +21 -0
- package/static/settings/reachability.html +221 -0
- package/static/settings/reachability.svg +7 -0
- package/static/settings/reachability.webmanifest +18 -0
- package/static/settings/settings.html +13 -0
- package/static/settings/signal-pod.html +293 -0
- package/static/settings/vite.svg +1 -0
- package/dist/api/service/ai-gateway-transport.d.ts +0 -25
- package/dist/api/service/ai-gateway-transport.js +0 -136
- package/dist/api/service/ai-gateway-transport.js.map +0 -1
- package/dist/api/service/chat-protocol-adapters.d.ts +0 -5
- package/dist/api/service/chat-protocol-adapters.js +0 -146
- package/dist/api/service/chat-protocol-adapters.js.map +0 -1
- package/dist/api/service/chat-routing.d.ts +0 -8
- package/dist/api/service/chat-routing.js +0 -16
- package/dist/api/service/chat-routing.js.map +0 -1
- package/dist/api/service/platform-ai-config.d.ts +0 -10
- package/dist/api/service/platform-ai-config.js +0 -76
- package/dist/api/service/platform-ai-config.js.map +0 -1
- package/dist/document/DocumentParser.js.map +0 -1
- package/dist/document/JinaDocumentParser.js.map +0 -1
- package/static/app/assets/index-C1yksyT4.js +0 -171
- package/static/dashboard/assets/dashboard-BssaVKTn.css +0 -1
- package/static/dashboard/assets/dashboard-Ckuadl3C.js +0 -54
|
@@ -0,0 +1,1061 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProviderConnectService = exports.DeepSeekConnectAdapter = exports.KimiDeviceCodeConnectAdapter = exports.BrowserAssistedApiKeyConnectAdapter = exports.InMemoryConnectAttemptStore = exports.PodConnectedCredentialRepository = void 0;
|
|
4
|
+
const node_crypto_1 = require("node:crypto");
|
|
5
|
+
const drizzle_solid_1 = require("@undefineds.co/drizzle-solid");
|
|
6
|
+
const models_1 = require("@undefineds.co/models");
|
|
7
|
+
const ProviderRegistry_1 = require("../providers/ProviderRegistry");
|
|
8
|
+
class PodConnectedCredentialRepository {
|
|
9
|
+
constructor(options = {}) {
|
|
10
|
+
this.internalPodAccess = options.internalPodAccess;
|
|
11
|
+
this.providerIds = options.providerIds
|
|
12
|
+
?? ProviderRegistry_1.DEFAULT_PROVIDER_DESCRIPTORS.map((provider) => provider.id);
|
|
13
|
+
this.dbFactory = options.dbFactory ?? createDefaultConnectedCredentialDb;
|
|
14
|
+
this.credentialTemplate = (0, drizzle_solid_1.alias)(models_1.credentialResource, 'credentialTemplate');
|
|
15
|
+
this.aiProviderTemplate = (0, drizzle_solid_1.alias)(models_1.aiProviderResource, 'aiProviderTemplate');
|
|
16
|
+
}
|
|
17
|
+
async getCredential(input) {
|
|
18
|
+
const { db, credential } = await this.dbForOwner(input.webId, input.auth);
|
|
19
|
+
const id = models_1.aiRuntimeRepository.credentialId(input);
|
|
20
|
+
const row = await db.findById(credential, id);
|
|
21
|
+
const record = row ? recordFromCredentialRow(row) : undefined;
|
|
22
|
+
if (!record) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
return record;
|
|
26
|
+
}
|
|
27
|
+
async getActiveCredential(input) {
|
|
28
|
+
const record = await this.getCredential(input);
|
|
29
|
+
return record?.status === 'active' && !record.reauthRequired ? record : undefined;
|
|
30
|
+
}
|
|
31
|
+
async listCredentials(input) {
|
|
32
|
+
const { db, credential } = await this.dbForOwner(input.webId, input.auth);
|
|
33
|
+
const rows = (await Promise.all(this.providerIds.map(async (provider) => {
|
|
34
|
+
try {
|
|
35
|
+
return await db.findById(credential, models_1.aiRuntimeRepository.credentialId({ deployment: input.deployment, provider }));
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
if (isPodResourceNotFound(error)) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
throw error;
|
|
42
|
+
}
|
|
43
|
+
}))).filter((row) => row !== null);
|
|
44
|
+
return rows
|
|
45
|
+
.map(recordFromCredentialRow)
|
|
46
|
+
.filter((record) => record.webId === input.webId)
|
|
47
|
+
.filter((record) => record.deployment === input.deployment)
|
|
48
|
+
.filter((record) => record.status === 'active')
|
|
49
|
+
.map((record) => ({
|
|
50
|
+
id: record.id,
|
|
51
|
+
credentialIri: record.credentialIri,
|
|
52
|
+
provider: record.provider,
|
|
53
|
+
authMode: record.authMode,
|
|
54
|
+
enabled: !record.reauthRequired,
|
|
55
|
+
models: modelsFromMetadata(record.metadata),
|
|
56
|
+
defaultModel: defaultModelFromMetadata(record.metadata),
|
|
57
|
+
priority: priorityFromMetadata(record.metadata),
|
|
58
|
+
health: record.reauthRequired ? 'reauthRequired' : 'healthy',
|
|
59
|
+
quota: { status: 'available' },
|
|
60
|
+
encryptedSecret: record.encryptedSecret,
|
|
61
|
+
version: record.version,
|
|
62
|
+
runtimeCredential: runtimeCredentialFromMetadata(record.metadata),
|
|
63
|
+
metadata: record.metadata,
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
66
|
+
async upsertConnectedCredential(record, context) {
|
|
67
|
+
const { db, credential } = await this.dbForOwner(record.webId, context?.auth);
|
|
68
|
+
const existing = await db.findById(credential, record.id);
|
|
69
|
+
const existingVersion = existing ? versionFromRow(existing) : 0;
|
|
70
|
+
if (record.expectedVersion !== undefined && record.expectedVersion !== existingVersion) {
|
|
71
|
+
throw new Error('credential_version_conflict');
|
|
72
|
+
}
|
|
73
|
+
const nextVersion = existingVersion + 1;
|
|
74
|
+
const row = credentialRowFromRecord({
|
|
75
|
+
...record,
|
|
76
|
+
version: nextVersion,
|
|
77
|
+
});
|
|
78
|
+
if (existing) {
|
|
79
|
+
const updated = await db.updateById(credential, record.id, row);
|
|
80
|
+
return recordFromCredentialRow(updated ?? row);
|
|
81
|
+
}
|
|
82
|
+
await db.insert(credential).values(row).execute();
|
|
83
|
+
return recordFromCredentialRow(row);
|
|
84
|
+
}
|
|
85
|
+
async rewrapCredential(input) {
|
|
86
|
+
const { db, credential } = await this.dbForOwner(input.webId, input.auth);
|
|
87
|
+
const existing = await db.findById(credential, input.credentialId);
|
|
88
|
+
if (!existing) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
const current = recordFromCredentialRow(existing);
|
|
92
|
+
if (current.webId !== input.webId || current.deployment !== input.deployment) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
const currentVersion = versionFromRow(existing);
|
|
96
|
+
if (input.expectedVersion === undefined || currentVersion !== input.expectedVersion) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
const updated = await db.update(credential)
|
|
100
|
+
.set({
|
|
101
|
+
encryptedSecret: JSON.stringify(input.encryptedSecret),
|
|
102
|
+
wrappedDataKey: input.encryptedSecret.wrappedDek,
|
|
103
|
+
encryptionAlgorithm: input.encryptedSecret.algorithm,
|
|
104
|
+
keyVersion: String(currentVersion + 1),
|
|
105
|
+
})
|
|
106
|
+
.where((0, drizzle_solid_1.and)((0, drizzle_solid_1.eq)(credential.id, input.credentialId), (0, drizzle_solid_1.eq)(credential.keyVersion, String(input.expectedVersion))))
|
|
107
|
+
.returning()
|
|
108
|
+
.execute();
|
|
109
|
+
return updated.length === 1;
|
|
110
|
+
}
|
|
111
|
+
async markReauthRequired(input) {
|
|
112
|
+
const { db, credential } = await this.dbForOwner(input.webId, input.auth);
|
|
113
|
+
const id = models_1.aiRuntimeRepository.credentialId(input);
|
|
114
|
+
const existing = await db.findById(credential, id);
|
|
115
|
+
if (!existing) {
|
|
116
|
+
return undefined;
|
|
117
|
+
}
|
|
118
|
+
const existingVersion = versionFromRow(existing);
|
|
119
|
+
if (input.expectedVersion !== undefined && input.expectedVersion !== existingVersion) {
|
|
120
|
+
throw new Error('credential_version_conflict');
|
|
121
|
+
}
|
|
122
|
+
const updated = await db.updateById(credential, id, {
|
|
123
|
+
reauthRequired: true,
|
|
124
|
+
status: 'active',
|
|
125
|
+
keyVersion: String(existingVersion + 1),
|
|
126
|
+
});
|
|
127
|
+
return updated ? recordFromCredentialRow(updated) : undefined;
|
|
128
|
+
}
|
|
129
|
+
async disconnect(input) {
|
|
130
|
+
const { db, credential } = await this.dbForOwner(input.webId, input.auth);
|
|
131
|
+
const id = models_1.aiRuntimeRepository.credentialId(input);
|
|
132
|
+
const existing = await db.findById(credential, id);
|
|
133
|
+
if (!existing) {
|
|
134
|
+
return undefined;
|
|
135
|
+
}
|
|
136
|
+
const updated = await db.updateById(credential, id, {
|
|
137
|
+
status: 'revoked',
|
|
138
|
+
keyVersion: String(versionFromRow(existing) + 1),
|
|
139
|
+
});
|
|
140
|
+
return updated ? recordFromCredentialRow(updated) : undefined;
|
|
141
|
+
}
|
|
142
|
+
async dbForOwner(owner, auth) {
|
|
143
|
+
const trustedFetch = await this.resolveTrustedFetch(owner);
|
|
144
|
+
const credential = (0, drizzle_solid_1.alias)(this.credentialTemplate, 'credential');
|
|
145
|
+
const aiProvider = (0, drizzle_solid_1.alias)(this.aiProviderTemplate, 'aiProvider');
|
|
146
|
+
const db = await this.dbFactory({ owner, auth, fetch: trustedFetch, credential, aiProvider });
|
|
147
|
+
await db.init?.(credential, aiProvider);
|
|
148
|
+
return { db, credential };
|
|
149
|
+
}
|
|
150
|
+
async resolveTrustedFetch(owner) {
|
|
151
|
+
const trustedFetch = await this.internalPodAccess?.getTrustedFetch(owner);
|
|
152
|
+
if (!trustedFetch) {
|
|
153
|
+
throw new Error('AI Connection service identity is not configured');
|
|
154
|
+
}
|
|
155
|
+
return async (input, init) => {
|
|
156
|
+
const response = await trustedFetch(input, init);
|
|
157
|
+
if (response.status === 403) {
|
|
158
|
+
throw new Error('service_access_missing');
|
|
159
|
+
}
|
|
160
|
+
return response;
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
exports.PodConnectedCredentialRepository = PodConnectedCredentialRepository;
|
|
165
|
+
class InMemoryConnectAttemptStore {
|
|
166
|
+
constructor() {
|
|
167
|
+
this.attempts = new Map();
|
|
168
|
+
this.maxAttempts = 1_000;
|
|
169
|
+
}
|
|
170
|
+
async create(attempt) {
|
|
171
|
+
this.pruneExpired(new Date());
|
|
172
|
+
this.attempts.set(attempt.id, cloneAttempt(attempt));
|
|
173
|
+
this.pruneBounded();
|
|
174
|
+
return cloneAttempt(attempt);
|
|
175
|
+
}
|
|
176
|
+
async get(id, now) {
|
|
177
|
+
this.pruneExpired(now ?? new Date(), id);
|
|
178
|
+
const attempt = this.attempts.get(id);
|
|
179
|
+
if (attempt && now && attempt.expiresAt.getTime() <= now.getTime()) {
|
|
180
|
+
this.attempts.delete(id);
|
|
181
|
+
}
|
|
182
|
+
return attempt ? cloneAttempt(attempt) : undefined;
|
|
183
|
+
}
|
|
184
|
+
async consume(id, now) {
|
|
185
|
+
this.pruneExpired(now, id);
|
|
186
|
+
const attempt = this.attempts.get(id);
|
|
187
|
+
if (!attempt) {
|
|
188
|
+
throw new Error('Connect attempt not found');
|
|
189
|
+
}
|
|
190
|
+
if (attempt.consumedAt) {
|
|
191
|
+
throw new Error('Connect attempt already consumed');
|
|
192
|
+
}
|
|
193
|
+
if (attempt.expiresAt.getTime() <= now.getTime()) {
|
|
194
|
+
this.attempts.delete(id);
|
|
195
|
+
throw new Error('Connect attempt expired');
|
|
196
|
+
}
|
|
197
|
+
attempt.consumedAt = new Date(now);
|
|
198
|
+
return cloneAttempt(attempt);
|
|
199
|
+
}
|
|
200
|
+
async claimPoll(id, now) {
|
|
201
|
+
this.pruneExpired(now, id);
|
|
202
|
+
const attempt = this.attempts.get(id);
|
|
203
|
+
if (!attempt) {
|
|
204
|
+
throw new Error('Connect attempt not found');
|
|
205
|
+
}
|
|
206
|
+
if (attempt.consumedAt) {
|
|
207
|
+
throw new Error('Connect attempt already consumed');
|
|
208
|
+
}
|
|
209
|
+
if (attempt.expiresAt.getTime() <= now.getTime()) {
|
|
210
|
+
this.attempts.delete(id);
|
|
211
|
+
throw new Error('Connect attempt expired');
|
|
212
|
+
}
|
|
213
|
+
if (attempt.nextPollAt && attempt.nextPollAt.getTime() > now.getTime()) {
|
|
214
|
+
return { attempt: cloneAttempt(attempt), claimed: false };
|
|
215
|
+
}
|
|
216
|
+
if (attempt.pollClaimedAt) {
|
|
217
|
+
return { attempt: cloneAttempt(attempt), claimed: false };
|
|
218
|
+
}
|
|
219
|
+
attempt.pollClaimedAt = new Date(now);
|
|
220
|
+
return { attempt: cloneAttempt(attempt), claimed: true };
|
|
221
|
+
}
|
|
222
|
+
async updatePollSchedule(id, patch) {
|
|
223
|
+
const attempt = this.attempts.get(id);
|
|
224
|
+
if (!attempt || attempt.consumedAt) {
|
|
225
|
+
return undefined;
|
|
226
|
+
}
|
|
227
|
+
attempt.intervalSeconds = patch.intervalSeconds;
|
|
228
|
+
attempt.currentPollIntervalSeconds = patch.intervalSeconds;
|
|
229
|
+
attempt.nextPollAt = new Date(patch.nextPollAt);
|
|
230
|
+
attempt.lastPollStatus = patch.lastPollStatus;
|
|
231
|
+
attempt.pollClaimedAt = undefined;
|
|
232
|
+
return cloneAttempt(attempt);
|
|
233
|
+
}
|
|
234
|
+
async releasePollClaim(id) {
|
|
235
|
+
const attempt = this.attempts.get(id);
|
|
236
|
+
if (attempt) {
|
|
237
|
+
attempt.pollClaimedAt = undefined;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
pruneExpired(now, exceptId) {
|
|
241
|
+
for (const [id, attempt] of this.attempts) {
|
|
242
|
+
if (id !== exceptId && attempt.expiresAt.getTime() <= now.getTime()) {
|
|
243
|
+
this.attempts.delete(id);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
pruneBounded() {
|
|
248
|
+
while (this.attempts.size > this.maxAttempts) {
|
|
249
|
+
const oldest = this.attempts.keys().next().value;
|
|
250
|
+
if (typeof oldest !== 'string') {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
this.attempts.delete(oldest);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
exports.InMemoryConnectAttemptStore = InMemoryConnectAttemptStore;
|
|
258
|
+
class BrowserAssistedApiKeyConnectAdapter {
|
|
259
|
+
constructor(options) {
|
|
260
|
+
this.provider = normalizeProvider(options.provider);
|
|
261
|
+
this.consoleUrl = options.consoleUrl;
|
|
262
|
+
this.attempts = options.attempts;
|
|
263
|
+
this.credentialRepository = options.credentialRepository;
|
|
264
|
+
this.vault = options.vault;
|
|
265
|
+
this.deployment = options.deployment;
|
|
266
|
+
this.now = options.now ?? (() => new Date());
|
|
267
|
+
this.randomBytes = options.randomBytes ?? node_crypto_1.randomBytes;
|
|
268
|
+
this.signingSecret = options.signingSecret;
|
|
269
|
+
}
|
|
270
|
+
async begin(input) {
|
|
271
|
+
this.assertInput(input, 'browserAssistedApiKey');
|
|
272
|
+
const now = this.now();
|
|
273
|
+
const expiresAt = new Date(now.getTime() + 5 * 60 * 1000);
|
|
274
|
+
const attempt = await this.createAttempt(input, expiresAt);
|
|
275
|
+
const url = new URL(this.consoleUrl);
|
|
276
|
+
url.searchParams.set('xpod_connect_attempt', attempt.id);
|
|
277
|
+
url.searchParams.set('xpod_provider', this.provider);
|
|
278
|
+
return {
|
|
279
|
+
mode: 'browserAssistedApiKey',
|
|
280
|
+
status: 'pending',
|
|
281
|
+
provider: this.provider,
|
|
282
|
+
deployment: this.deployment,
|
|
283
|
+
attemptId: attempt.id,
|
|
284
|
+
state: attempt.state,
|
|
285
|
+
signature: attempt.signature,
|
|
286
|
+
expiresAt: expiresAt.toISOString(),
|
|
287
|
+
authorizationUrl: url.toString(),
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
async completeApiKey(input) {
|
|
291
|
+
if (!input.apiKey.trim()) {
|
|
292
|
+
throw new Error('API key is required');
|
|
293
|
+
}
|
|
294
|
+
const attempt = await this.loadConsumableAttempt(input, 'browserAssistedApiKey');
|
|
295
|
+
const consumed = await this.attempts.consume(input.attemptId, this.now());
|
|
296
|
+
const credentialIri = models_1.aiRuntimeRepository.credentialIri(input.webId, {
|
|
297
|
+
deployment: input.deployment,
|
|
298
|
+
provider: this.provider,
|
|
299
|
+
});
|
|
300
|
+
const encryptedSecret = await this.vault.seal(principal(input.webId), credentialIri, this.provider, { type: 'apiKey', apiKey: input.apiKey });
|
|
301
|
+
const record = await this.credentialRepository.upsertConnectedCredential({
|
|
302
|
+
id: models_1.aiRuntimeRepository.credentialId({ deployment: input.deployment, provider: this.provider }),
|
|
303
|
+
credentialIri,
|
|
304
|
+
webId: input.webId,
|
|
305
|
+
provider: this.provider,
|
|
306
|
+
deployment: input.deployment,
|
|
307
|
+
authMode: 'apiKey',
|
|
308
|
+
encryptedSecret,
|
|
309
|
+
status: 'active',
|
|
310
|
+
accountLabel: input.accountLabel,
|
|
311
|
+
expectedVersion: consumed.expectedCredentialVersion,
|
|
312
|
+
}, { auth: input.auth });
|
|
313
|
+
return {
|
|
314
|
+
mode: 'browserAssistedApiKey',
|
|
315
|
+
status: 'completed',
|
|
316
|
+
provider: this.provider,
|
|
317
|
+
deployment: input.deployment,
|
|
318
|
+
attemptId: attempt.id,
|
|
319
|
+
credentialId: record.id,
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
async status(input) {
|
|
323
|
+
const attempt = await this.loadAttemptForStatus(input, 'browserAssistedApiKey');
|
|
324
|
+
return {
|
|
325
|
+
mode: attempt.mode,
|
|
326
|
+
status: this.statusForAttempt(attempt),
|
|
327
|
+
provider: this.provider,
|
|
328
|
+
deployment: input.deployment,
|
|
329
|
+
attemptId: attempt.id,
|
|
330
|
+
expiresAt: attempt.expiresAt.toISOString(),
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
async disconnect(input) {
|
|
334
|
+
return this.credentialRepository.disconnect({
|
|
335
|
+
webId: input.webId,
|
|
336
|
+
provider: this.provider,
|
|
337
|
+
deployment: input.deployment,
|
|
338
|
+
auth: input.auth,
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
async createAttempt(input, expiresAt, extra = {}) {
|
|
342
|
+
const attemptWithoutSignature = {
|
|
343
|
+
id: token(this.randomBytes),
|
|
344
|
+
provider: this.provider,
|
|
345
|
+
deployment: input.deployment,
|
|
346
|
+
webId: input.webId,
|
|
347
|
+
mode: input.requestedMode,
|
|
348
|
+
state: token(this.randomBytes),
|
|
349
|
+
expiresAt,
|
|
350
|
+
expectedCredentialVersion: input.expectedCredentialVersion,
|
|
351
|
+
...extra,
|
|
352
|
+
};
|
|
353
|
+
const signature = signAttempt(attemptWithoutSignature, this.signingSecret);
|
|
354
|
+
return this.attempts.create({ ...attemptWithoutSignature, signature });
|
|
355
|
+
}
|
|
356
|
+
async loadAttemptForStatus(input, mode) {
|
|
357
|
+
const attempt = await this.attempts.get(input.attemptId, this.now());
|
|
358
|
+
if (!attempt) {
|
|
359
|
+
throw new Error('Connect attempt not found');
|
|
360
|
+
}
|
|
361
|
+
if (attempt.webId !== input.webId) {
|
|
362
|
+
throw new Error('Connect attempt is bound to a different WebID');
|
|
363
|
+
}
|
|
364
|
+
if (attempt.deployment !== input.deployment) {
|
|
365
|
+
throw new Error('Connect attempt is bound to a different deployment');
|
|
366
|
+
}
|
|
367
|
+
if (attempt.provider !== normalizeProvider(input.provider)) {
|
|
368
|
+
throw new Error('Connect attempt is bound to a different provider');
|
|
369
|
+
}
|
|
370
|
+
if (attempt.mode !== mode) {
|
|
371
|
+
throw new Error('Connect attempt mode mismatch');
|
|
372
|
+
}
|
|
373
|
+
if (attempt.state !== input.state) {
|
|
374
|
+
throw new Error('Invalid Connect attempt state');
|
|
375
|
+
}
|
|
376
|
+
if (!signatureMatches(input.signature, signAttempt(attempt, this.signingSecret))) {
|
|
377
|
+
throw new Error('Invalid Connect attempt signature');
|
|
378
|
+
}
|
|
379
|
+
return attempt;
|
|
380
|
+
}
|
|
381
|
+
async loadConsumableAttempt(input, mode) {
|
|
382
|
+
const attempt = await this.loadAttemptForStatus(input, mode);
|
|
383
|
+
if (attempt.expiresAt.getTime() <= this.now().getTime()) {
|
|
384
|
+
throw new Error('Connect attempt expired');
|
|
385
|
+
}
|
|
386
|
+
if (attempt.consumedAt) {
|
|
387
|
+
throw new Error('Connect attempt already consumed');
|
|
388
|
+
}
|
|
389
|
+
return attempt;
|
|
390
|
+
}
|
|
391
|
+
statusForAttempt(attempt) {
|
|
392
|
+
if (attempt.expiresAt.getTime() <= this.now().getTime()) {
|
|
393
|
+
return 'expired';
|
|
394
|
+
}
|
|
395
|
+
return attempt.consumedAt ? 'completed' : 'pending';
|
|
396
|
+
}
|
|
397
|
+
assertInput(input, mode) {
|
|
398
|
+
if (normalizeProvider(input.provider) !== this.provider) {
|
|
399
|
+
throw new Error('Connect provider mismatch');
|
|
400
|
+
}
|
|
401
|
+
if (input.deployment !== this.deployment) {
|
|
402
|
+
throw new Error('Connect deployment mismatch');
|
|
403
|
+
}
|
|
404
|
+
if (input.requestedMode !== mode) {
|
|
405
|
+
throw new Error('Unsupported Connect mode');
|
|
406
|
+
}
|
|
407
|
+
if (!input.webId) {
|
|
408
|
+
throw new Error('Connect WebID is required');
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
exports.BrowserAssistedApiKeyConnectAdapter = BrowserAssistedApiKeyConnectAdapter;
|
|
413
|
+
class KimiDeviceCodeConnectAdapter extends BrowserAssistedApiKeyConnectAdapter {
|
|
414
|
+
constructor(options) {
|
|
415
|
+
super({
|
|
416
|
+
...options,
|
|
417
|
+
provider: 'kimi',
|
|
418
|
+
consoleUrl: 'https://kimi.moonshot.cn/device',
|
|
419
|
+
});
|
|
420
|
+
this.fetchImpl = options.fetch ?? fetch;
|
|
421
|
+
this.clientId = options.clientId;
|
|
422
|
+
this.deviceAuthorizationEndpoint = options.deviceAuthorizationEndpoint ?? 'https://auth.kimi.com/api/oauth/device_authorization';
|
|
423
|
+
this.tokenEndpoint = options.tokenEndpoint ?? 'https://auth.kimi.com/api/oauth/token';
|
|
424
|
+
assertKimiEndpoint(this.deviceAuthorizationEndpoint, '/api/oauth/device_authorization');
|
|
425
|
+
assertKimiEndpoint(this.tokenEndpoint, '/api/oauth/token');
|
|
426
|
+
}
|
|
427
|
+
async begin(input) {
|
|
428
|
+
this.assertInput(input, 'deviceCodeOAuth');
|
|
429
|
+
const now = this.now();
|
|
430
|
+
const verifier = token(this.randomBytes);
|
|
431
|
+
const challenge = codeChallenge(verifier);
|
|
432
|
+
const response = await this.fetchImpl(this.deviceAuthorizationEndpoint, {
|
|
433
|
+
method: 'POST',
|
|
434
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
435
|
+
body: new URLSearchParams({
|
|
436
|
+
client_id: this.clientId,
|
|
437
|
+
code_challenge: challenge,
|
|
438
|
+
code_challenge_method: 'S256',
|
|
439
|
+
}),
|
|
440
|
+
});
|
|
441
|
+
const body = await safeJson(response);
|
|
442
|
+
if (!response.ok) {
|
|
443
|
+
throw new Error(`Kimi device authorization failed: ${safeProviderError(body)}`);
|
|
444
|
+
}
|
|
445
|
+
requireStringField(body, 'device_code');
|
|
446
|
+
requireStringField(body, 'user_code');
|
|
447
|
+
requireStringField(body, 'verification_uri_complete');
|
|
448
|
+
const expiresIn = numberFrom(body.expires_in, 300);
|
|
449
|
+
const attempt = await this.createAttempt(input, new Date(now.getTime() + expiresIn * 1000), {
|
|
450
|
+
mode: 'deviceCodeOAuth',
|
|
451
|
+
codeVerifier: verifier,
|
|
452
|
+
deviceCode: stringFrom(body.device_code),
|
|
453
|
+
intervalSeconds: numberFrom(body.interval, 5),
|
|
454
|
+
currentPollIntervalSeconds: numberFrom(body.interval, 5),
|
|
455
|
+
nextPollAt: new Date(now.getTime() + numberFrom(body.interval, 5) * 1000),
|
|
456
|
+
});
|
|
457
|
+
return {
|
|
458
|
+
mode: 'deviceCodeOAuth',
|
|
459
|
+
status: 'pending',
|
|
460
|
+
provider: 'kimi',
|
|
461
|
+
deployment: input.deployment,
|
|
462
|
+
attemptId: attempt.id,
|
|
463
|
+
state: attempt.state,
|
|
464
|
+
signature: attempt.signature,
|
|
465
|
+
expiresAt: attempt.expiresAt.toISOString(),
|
|
466
|
+
pkceChallenge: challenge,
|
|
467
|
+
deviceCode: attempt.deviceCode,
|
|
468
|
+
userCode: stringFrom(body.user_code),
|
|
469
|
+
verificationUri: stringFrom(body.verification_uri),
|
|
470
|
+
verificationUriComplete: stringFrom(body.verification_uri_complete),
|
|
471
|
+
intervalSeconds: attempt.intervalSeconds,
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
async pollDevice(input) {
|
|
475
|
+
const attempt = await this.loadConsumableAttempt(input, 'deviceCodeOAuth');
|
|
476
|
+
const now = this.nowForConsume();
|
|
477
|
+
const claim = await this.attempts.claimPoll(input.attemptId, now);
|
|
478
|
+
if (!claim.claimed) {
|
|
479
|
+
return pendingResult(input, claim.attempt.lastPollStatus === 'slow_down' ? 'slow_down' : 'authorization_pending', claim.attempt.currentPollIntervalSeconds ?? claim.attempt.intervalSeconds);
|
|
480
|
+
}
|
|
481
|
+
try {
|
|
482
|
+
const response = await this.fetchImpl(this.tokenEndpoint, {
|
|
483
|
+
method: 'POST',
|
|
484
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
485
|
+
body: new URLSearchParams({
|
|
486
|
+
grant_type: 'urn:ietf:params:oauth:grant-type:device_code',
|
|
487
|
+
device_code: attempt.deviceCode ?? '',
|
|
488
|
+
client_id: this.clientId,
|
|
489
|
+
code_verifier: attempt.codeVerifier ?? '',
|
|
490
|
+
}),
|
|
491
|
+
});
|
|
492
|
+
const body = await safeJson(response);
|
|
493
|
+
if (!response.ok) {
|
|
494
|
+
if (body.error === 'authorization_pending' || body.error === 'slow_down') {
|
|
495
|
+
const status = body.error;
|
|
496
|
+
const intervalSeconds = status === 'slow_down'
|
|
497
|
+
? (attempt.currentPollIntervalSeconds ?? attempt.intervalSeconds ?? 5) + 5
|
|
498
|
+
: (attempt.currentPollIntervalSeconds ?? attempt.intervalSeconds ?? 5);
|
|
499
|
+
await this.attempts.updatePollSchedule(input.attemptId, {
|
|
500
|
+
intervalSeconds,
|
|
501
|
+
nextPollAt: new Date(now.getTime() + intervalSeconds * 1000),
|
|
502
|
+
lastPollStatus: status,
|
|
503
|
+
});
|
|
504
|
+
return pendingResult(input, status, intervalSeconds);
|
|
505
|
+
}
|
|
506
|
+
if (body.error === 'expired_token') {
|
|
507
|
+
await this.attempts.consume(input.attemptId, this.nowForConsume());
|
|
508
|
+
return pendingResult(input, 'expired');
|
|
509
|
+
}
|
|
510
|
+
throw new Error(`Kimi device token failed: ${safeProviderError(body)}`);
|
|
511
|
+
}
|
|
512
|
+
await this.attempts.consume(input.attemptId, this.nowForConsume());
|
|
513
|
+
requireStringField(body, 'access_token');
|
|
514
|
+
requireStringField(body, 'refresh_token');
|
|
515
|
+
const record = await this.storeOAuthCredential(input, body, attempt.expectedCredentialVersion);
|
|
516
|
+
return {
|
|
517
|
+
mode: 'deviceCodeOAuth',
|
|
518
|
+
status: 'completed',
|
|
519
|
+
provider: 'kimi',
|
|
520
|
+
deployment: input.deployment,
|
|
521
|
+
attemptId: input.attemptId,
|
|
522
|
+
credentialId: record.id,
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
catch (error) {
|
|
526
|
+
await this.attempts.releasePollClaim(input.attemptId);
|
|
527
|
+
throw error;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
async status(input) {
|
|
531
|
+
const attempt = await this.loadAttemptForStatus(input, 'deviceCodeOAuth');
|
|
532
|
+
return {
|
|
533
|
+
mode: 'deviceCodeOAuth',
|
|
534
|
+
status: this.statusForAttempt(attempt),
|
|
535
|
+
provider: 'kimi',
|
|
536
|
+
deployment: input.deployment,
|
|
537
|
+
attemptId: attempt.id,
|
|
538
|
+
expiresAt: attempt.expiresAt.toISOString(),
|
|
539
|
+
deviceCode: attempt.deviceCode,
|
|
540
|
+
intervalSeconds: attempt.currentPollIntervalSeconds ?? attempt.intervalSeconds,
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
async refresh(input, current, secret) {
|
|
544
|
+
const refreshToken = stringFrom(secret.refreshToken);
|
|
545
|
+
if (!refreshToken) {
|
|
546
|
+
return this.credentialRepository.markReauthRequired({
|
|
547
|
+
webId: input.webId,
|
|
548
|
+
provider: 'kimi',
|
|
549
|
+
deployment: input.deployment,
|
|
550
|
+
reason: 'missing_refresh_token',
|
|
551
|
+
expectedVersion: current.version,
|
|
552
|
+
auth: input.auth,
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
const response = await this.fetchImpl(this.tokenEndpoint, {
|
|
556
|
+
method: 'POST',
|
|
557
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
558
|
+
body: new URLSearchParams({
|
|
559
|
+
grant_type: 'refresh_token',
|
|
560
|
+
refresh_token: refreshToken,
|
|
561
|
+
client_id: this.clientId,
|
|
562
|
+
}),
|
|
563
|
+
});
|
|
564
|
+
const body = await safeJson(response);
|
|
565
|
+
if (!response.ok) {
|
|
566
|
+
return this.credentialRepository.markReauthRequired({
|
|
567
|
+
webId: input.webId,
|
|
568
|
+
provider: 'kimi',
|
|
569
|
+
deployment: input.deployment,
|
|
570
|
+
reason: safeProviderError(body),
|
|
571
|
+
expectedVersion: current.version,
|
|
572
|
+
auth: input.auth,
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
requireStringField(body, 'access_token');
|
|
576
|
+
requireStringField(body, 'refresh_token');
|
|
577
|
+
return this.storeOAuthCredential(input, body, current.version);
|
|
578
|
+
}
|
|
579
|
+
async disconnect(input) {
|
|
580
|
+
return this.credentialRepository.disconnect({
|
|
581
|
+
webId: input.webId,
|
|
582
|
+
provider: 'kimi',
|
|
583
|
+
deployment: input.deployment,
|
|
584
|
+
auth: input.auth,
|
|
585
|
+
});
|
|
586
|
+
}
|
|
587
|
+
nowForConsume() {
|
|
588
|
+
return this.now();
|
|
589
|
+
}
|
|
590
|
+
async storeOAuthCredential(input, body, expectedVersion) {
|
|
591
|
+
const credentialIri = models_1.aiRuntimeRepository.credentialIri(input.webId, {
|
|
592
|
+
deployment: input.deployment,
|
|
593
|
+
provider: 'kimi',
|
|
594
|
+
});
|
|
595
|
+
const expiresAt = expiresAtFrom(body.expires_in, this.now());
|
|
596
|
+
const secret = {
|
|
597
|
+
type: 'deviceCodeOAuth',
|
|
598
|
+
accessToken: stringFrom(body.access_token),
|
|
599
|
+
refreshToken: stringFrom(body.refresh_token),
|
|
600
|
+
expiresAt: expiresAt?.toISOString(),
|
|
601
|
+
scope: stringFrom(body.scope),
|
|
602
|
+
idToken: stringFrom(body.id_token),
|
|
603
|
+
};
|
|
604
|
+
const encryptedSecret = await this.vault.seal(principal(input.webId), credentialIri, 'kimi', secret);
|
|
605
|
+
return this.credentialRepository.upsertConnectedCredential({
|
|
606
|
+
id: models_1.aiRuntimeRepository.credentialId({ deployment: input.deployment, provider: 'kimi' }),
|
|
607
|
+
credentialIri,
|
|
608
|
+
webId: input.webId,
|
|
609
|
+
provider: 'kimi',
|
|
610
|
+
deployment: input.deployment,
|
|
611
|
+
authMode: 'deviceCodeOAuth',
|
|
612
|
+
encryptedSecret,
|
|
613
|
+
status: 'active',
|
|
614
|
+
expiresAt,
|
|
615
|
+
expectedVersion,
|
|
616
|
+
metadata: {
|
|
617
|
+
authoritativeSubject: decodeJwtSubject(stringFrom(body.id_token)),
|
|
618
|
+
},
|
|
619
|
+
}, { auth: input.auth });
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
exports.KimiDeviceCodeConnectAdapter = KimiDeviceCodeConnectAdapter;
|
|
623
|
+
class DeepSeekConnectAdapter {
|
|
624
|
+
constructor() {
|
|
625
|
+
this.provider = 'deepseek';
|
|
626
|
+
}
|
|
627
|
+
async begin(input) {
|
|
628
|
+
if (normalizeProvider(input.provider) !== this.provider) {
|
|
629
|
+
throw new Error('Connect provider mismatch');
|
|
630
|
+
}
|
|
631
|
+
return {
|
|
632
|
+
mode: 'connectUnsupported',
|
|
633
|
+
status: 'unsupported',
|
|
634
|
+
provider: 'deepseek',
|
|
635
|
+
deployment: input.deployment,
|
|
636
|
+
apiKeyManagementSupported: true,
|
|
637
|
+
message: 'DeepSeek does not expose a supported third-party browser Connect flow; use authenticated API key management.',
|
|
638
|
+
};
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
exports.DeepSeekConnectAdapter = DeepSeekConnectAdapter;
|
|
642
|
+
class ProviderConnectService {
|
|
643
|
+
constructor(options) {
|
|
644
|
+
this.adapters = new Map();
|
|
645
|
+
this.registry = options.registry;
|
|
646
|
+
this.credentialRepository = options.credentialRepository;
|
|
647
|
+
this.vault = options.vault;
|
|
648
|
+
for (const adapter of options.adapters) {
|
|
649
|
+
this.adapters.set(normalizeProvider(adapter.provider), adapter);
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
begin(input) {
|
|
653
|
+
const descriptor = this.registry.requireProvider(input.provider);
|
|
654
|
+
if (descriptor.connect?.mode !== input.requestedMode) {
|
|
655
|
+
throw new Error('Requested Connect mode does not match provider capability');
|
|
656
|
+
}
|
|
657
|
+
if (descriptor.connect?.configured === false) {
|
|
658
|
+
return Promise.resolve({
|
|
659
|
+
mode: descriptor.connect.mode,
|
|
660
|
+
status: 'unsupported',
|
|
661
|
+
provider: normalizeProvider(input.provider),
|
|
662
|
+
deployment: input.deployment,
|
|
663
|
+
apiKeyManagementSupported: descriptor.connect.apiKeyManagementSupported,
|
|
664
|
+
message: descriptor.connect.notes?.join(' '),
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
return this.requireAdapter(input.provider).begin(input);
|
|
668
|
+
}
|
|
669
|
+
async listProviders(input) {
|
|
670
|
+
return Promise.all(this.registry.listProviders().map(async (descriptor) => {
|
|
671
|
+
const credential = this.credentialRepository?.getCredential
|
|
672
|
+
? await this.credentialRepository.getCredential({
|
|
673
|
+
...input,
|
|
674
|
+
provider: descriptor.id,
|
|
675
|
+
})
|
|
676
|
+
: await this.credentialRepository?.getActiveCredential({
|
|
677
|
+
...input,
|
|
678
|
+
provider: descriptor.id,
|
|
679
|
+
});
|
|
680
|
+
const active = credential?.status === 'active';
|
|
681
|
+
const reauthRequired = active && credential.reauthRequired === true;
|
|
682
|
+
const modes = Array.from(new Set([
|
|
683
|
+
...descriptor.authModes.filter((mode) => mode !== 'connectUnsupported'),
|
|
684
|
+
...(descriptor.connect?.apiKeyManagementSupported ? ['apiKey'] : []),
|
|
685
|
+
]));
|
|
686
|
+
return {
|
|
687
|
+
provider: descriptor.id,
|
|
688
|
+
status: reauthRequired
|
|
689
|
+
? 'reauthRequired'
|
|
690
|
+
: active
|
|
691
|
+
? 'connected'
|
|
692
|
+
: 'disconnected',
|
|
693
|
+
authMode: active ? credential.authMode : undefined,
|
|
694
|
+
accountLabel: active ? credential.accountLabel : undefined,
|
|
695
|
+
expiresAt: active ? credential.expiresAt?.toISOString() : undefined,
|
|
696
|
+
reauthRequired: reauthRequired || undefined,
|
|
697
|
+
credentialIri: active ? credential.credentialIri : undefined,
|
|
698
|
+
version: active ? credential.version : undefined,
|
|
699
|
+
connect: {
|
|
700
|
+
modes,
|
|
701
|
+
configured: descriptor.connect?.configured !== false,
|
|
702
|
+
message: descriptor.connect?.notes?.join(' ') || undefined,
|
|
703
|
+
},
|
|
704
|
+
};
|
|
705
|
+
}));
|
|
706
|
+
}
|
|
707
|
+
completeApiKey(input) {
|
|
708
|
+
const adapter = this.requireAdapter(input.provider);
|
|
709
|
+
if (!adapter.completeApiKey) {
|
|
710
|
+
throw new Error('Provider does not support API key Connect completion');
|
|
711
|
+
}
|
|
712
|
+
return adapter.completeApiKey(input);
|
|
713
|
+
}
|
|
714
|
+
pollDevice(input) {
|
|
715
|
+
const adapter = this.requireAdapter(input.provider);
|
|
716
|
+
if (!adapter.pollDevice) {
|
|
717
|
+
throw new Error('Provider does not support device-code polling');
|
|
718
|
+
}
|
|
719
|
+
return adapter.pollDevice(input);
|
|
720
|
+
}
|
|
721
|
+
status(input) {
|
|
722
|
+
const adapter = this.requireAdapter(input.provider);
|
|
723
|
+
if (!adapter.status) {
|
|
724
|
+
throw new Error('Provider does not support Connect status');
|
|
725
|
+
}
|
|
726
|
+
return adapter.status(input);
|
|
727
|
+
}
|
|
728
|
+
refresh(input) {
|
|
729
|
+
return this.refreshWithRetry(input, 2);
|
|
730
|
+
}
|
|
731
|
+
async refreshWithRetry(input, remainingAttempts) {
|
|
732
|
+
const adapter = this.requireAdapter(input.provider);
|
|
733
|
+
if (!adapter.refresh) {
|
|
734
|
+
throw new Error('Provider does not support refresh');
|
|
735
|
+
}
|
|
736
|
+
if (!this.credentialRepository || !this.vault) {
|
|
737
|
+
throw new Error('CredentialVault and PodCredentialRepository are required for provider refresh');
|
|
738
|
+
}
|
|
739
|
+
const current = await this.credentialRepository.getActiveCredential(input);
|
|
740
|
+
if (!current) {
|
|
741
|
+
throw new Error('Active provider credential not found');
|
|
742
|
+
}
|
|
743
|
+
const secret = await this.vault.open({ webId: input.webId }, current.credentialIri, normalizeProvider(input.provider), current.encryptedSecret);
|
|
744
|
+
try {
|
|
745
|
+
return await adapter.refresh(input, current, secret);
|
|
746
|
+
}
|
|
747
|
+
catch (error) {
|
|
748
|
+
if (remainingAttempts > 0 && isVersionConflict(error)) {
|
|
749
|
+
const latest = await this.credentialRepository.getActiveCredential(input);
|
|
750
|
+
if (latest && latest.version !== current.version && !latest.reauthRequired) {
|
|
751
|
+
return latest;
|
|
752
|
+
}
|
|
753
|
+
return this.refreshWithRetry(input, remainingAttempts - 1);
|
|
754
|
+
}
|
|
755
|
+
throw error;
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
disconnect(input) {
|
|
759
|
+
const adapter = this.requireAdapter(input.provider);
|
|
760
|
+
if (!adapter.disconnect) {
|
|
761
|
+
throw new Error('Provider does not support disconnect');
|
|
762
|
+
}
|
|
763
|
+
return adapter.disconnect(input);
|
|
764
|
+
}
|
|
765
|
+
requireAdapter(provider) {
|
|
766
|
+
const adapter = this.adapters.get(normalizeProvider(provider));
|
|
767
|
+
if (!adapter) {
|
|
768
|
+
throw new Error(`No Connect adapter registered for ${provider}`);
|
|
769
|
+
}
|
|
770
|
+
return adapter;
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
exports.ProviderConnectService = ProviderConnectService;
|
|
774
|
+
function token(randomBytes) {
|
|
775
|
+
return randomBytes(32).toString('base64url');
|
|
776
|
+
}
|
|
777
|
+
function createDefaultConnectedCredentialDb(input) {
|
|
778
|
+
const credential = input.credential ?? models_1.credentialResource;
|
|
779
|
+
const aiProvider = input.aiProvider ?? models_1.aiProviderResource;
|
|
780
|
+
return Promise.resolve((0, drizzle_solid_1.drizzle)({
|
|
781
|
+
fetch: input.fetch,
|
|
782
|
+
info: { webId: input.owner, isLoggedIn: true },
|
|
783
|
+
}, {
|
|
784
|
+
schema: {
|
|
785
|
+
credential,
|
|
786
|
+
aiProvider,
|
|
787
|
+
},
|
|
788
|
+
}));
|
|
789
|
+
}
|
|
790
|
+
function credentialRowFromRecord(record) {
|
|
791
|
+
return {
|
|
792
|
+
id: record.id,
|
|
793
|
+
provider: models_1.aiProviderResource.buildId({ id: normalizeProvider(record.provider) }),
|
|
794
|
+
service: 'ai',
|
|
795
|
+
authMode: record.authMode,
|
|
796
|
+
status: record.status,
|
|
797
|
+
encryptedSecret: JSON.stringify(record.encryptedSecret),
|
|
798
|
+
wrappedDataKey: record.encryptedSecret.wrappedDek,
|
|
799
|
+
encryptionAlgorithm: record.encryptedSecret.algorithm,
|
|
800
|
+
keyVersion: String(record.version ?? 1),
|
|
801
|
+
scopes: record.scopes ?? [],
|
|
802
|
+
expiresAt: record.expiresAt,
|
|
803
|
+
accountLabel: record.accountLabel,
|
|
804
|
+
label: record.accountLabel,
|
|
805
|
+
reauthRequired: record.reauthRequired ?? false,
|
|
806
|
+
lastRefreshAt: new Date(),
|
|
807
|
+
};
|
|
808
|
+
}
|
|
809
|
+
function recordFromCredentialRow(row) {
|
|
810
|
+
const encrypted = parseEncryptedSecret(row.encryptedSecret);
|
|
811
|
+
const id = stringFrom(row.id);
|
|
812
|
+
const provider = providerFromRelation(stringFrom(row.provider))
|
|
813
|
+
|| providerFromCredentialId(id);
|
|
814
|
+
const deployment = deploymentFromCredentialId(id);
|
|
815
|
+
const webId = encrypted.webId;
|
|
816
|
+
return {
|
|
817
|
+
id,
|
|
818
|
+
credentialIri: encrypted.credentialIri,
|
|
819
|
+
webId,
|
|
820
|
+
provider,
|
|
821
|
+
deployment,
|
|
822
|
+
authMode: stringFrom(row.authMode) === 'deviceCodeOAuth' ? 'deviceCodeOAuth' : 'apiKey',
|
|
823
|
+
encryptedSecret: encrypted,
|
|
824
|
+
status: stringFrom(row.status) === 'revoked' ? 'revoked' : 'active',
|
|
825
|
+
accountLabel: stringFrom(row.accountLabel) || stringFrom(row.label) || undefined,
|
|
826
|
+
expiresAt: dateFrom(row.expiresAt),
|
|
827
|
+
scopes: Array.isArray(row.scopes) ? row.scopes.map(String) : undefined,
|
|
828
|
+
version: versionFromRow(row),
|
|
829
|
+
reauthRequired: row.reauthRequired === true || row.reauthRequired === 'true',
|
|
830
|
+
metadata: metadataFromRow(row),
|
|
831
|
+
};
|
|
832
|
+
}
|
|
833
|
+
function providerFromRelation(value) {
|
|
834
|
+
if (!value) {
|
|
835
|
+
return undefined;
|
|
836
|
+
}
|
|
837
|
+
const withoutFragment = value.split('#', 1)[0] ?? value;
|
|
838
|
+
const fileName = withoutFragment.split('/').filter(Boolean).at(-1) ?? withoutFragment;
|
|
839
|
+
const provider = fileName.replace(/\.ttl$/u, '');
|
|
840
|
+
return provider ? normalizeProvider(provider) : undefined;
|
|
841
|
+
}
|
|
842
|
+
function isPodResourceNotFound(error) {
|
|
843
|
+
if (!(error instanceof Error)) {
|
|
844
|
+
return false;
|
|
845
|
+
}
|
|
846
|
+
return /\b404\b|not found/i.test(error.message);
|
|
847
|
+
}
|
|
848
|
+
function metadataFromRow(row) {
|
|
849
|
+
const value = row.metadata;
|
|
850
|
+
if (!value) {
|
|
851
|
+
return undefined;
|
|
852
|
+
}
|
|
853
|
+
if (typeof value === 'object' && !Array.isArray(value)) {
|
|
854
|
+
return value;
|
|
855
|
+
}
|
|
856
|
+
if (typeof value === 'string') {
|
|
857
|
+
try {
|
|
858
|
+
const parsed = JSON.parse(value);
|
|
859
|
+
return parsed && typeof parsed === 'object' && !Array.isArray(parsed)
|
|
860
|
+
? parsed
|
|
861
|
+
: undefined;
|
|
862
|
+
}
|
|
863
|
+
catch {
|
|
864
|
+
return undefined;
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
return undefined;
|
|
868
|
+
}
|
|
869
|
+
function modelsFromMetadata(metadata) {
|
|
870
|
+
const value = metadata?.models;
|
|
871
|
+
return Array.isArray(value) ? value.filter((item) => typeof item === 'string') : undefined;
|
|
872
|
+
}
|
|
873
|
+
function defaultModelFromMetadata(metadata) {
|
|
874
|
+
const value = metadata?.defaultModel;
|
|
875
|
+
return typeof value === 'string' ? value : undefined;
|
|
876
|
+
}
|
|
877
|
+
function priorityFromMetadata(metadata) {
|
|
878
|
+
const value = metadata?.priority;
|
|
879
|
+
return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
|
|
880
|
+
}
|
|
881
|
+
function runtimeCredentialFromMetadata(metadata) {
|
|
882
|
+
const value = metadata?.runtimeCredential;
|
|
883
|
+
return value && typeof value === 'object' && !Array.isArray(value)
|
|
884
|
+
? value
|
|
885
|
+
: undefined;
|
|
886
|
+
}
|
|
887
|
+
function parseEncryptedSecret(value) {
|
|
888
|
+
if (typeof value !== 'string' || !value.trim()) {
|
|
889
|
+
throw new Error('Credential row is missing encrypted secret payload');
|
|
890
|
+
}
|
|
891
|
+
const parsed = JSON.parse(value);
|
|
892
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
893
|
+
throw new Error('Credential row encrypted secret payload is invalid');
|
|
894
|
+
}
|
|
895
|
+
return parsed;
|
|
896
|
+
}
|
|
897
|
+
function versionFromRow(row) {
|
|
898
|
+
const value = row.keyVersion;
|
|
899
|
+
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
900
|
+
return value;
|
|
901
|
+
}
|
|
902
|
+
if (typeof value === 'string' && value.trim()) {
|
|
903
|
+
const parsed = Number(value);
|
|
904
|
+
return Number.isFinite(parsed) ? parsed : 0;
|
|
905
|
+
}
|
|
906
|
+
return 0;
|
|
907
|
+
}
|
|
908
|
+
function providerFromCredentialId(id) {
|
|
909
|
+
const match = /\/([^/#]+)\.ttl#/u.exec(id);
|
|
910
|
+
return match?.[1] ?? '';
|
|
911
|
+
}
|
|
912
|
+
function deploymentFromCredentialId(id) {
|
|
913
|
+
return id.includes('#cloud-') ? 'cloud' : 'local';
|
|
914
|
+
}
|
|
915
|
+
function dateFrom(value) {
|
|
916
|
+
if (value instanceof Date) {
|
|
917
|
+
return value;
|
|
918
|
+
}
|
|
919
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
920
|
+
const parsed = new Date(value);
|
|
921
|
+
return Number.isNaN(parsed.getTime()) ? undefined : parsed;
|
|
922
|
+
}
|
|
923
|
+
return undefined;
|
|
924
|
+
}
|
|
925
|
+
function signAttempt(attempt, secret) {
|
|
926
|
+
return (0, node_crypto_1.createHmac)('sha256', secret)
|
|
927
|
+
.update(JSON.stringify({
|
|
928
|
+
id: attempt.id,
|
|
929
|
+
provider: attempt.provider,
|
|
930
|
+
deployment: attempt.deployment,
|
|
931
|
+
webId: attempt.webId,
|
|
932
|
+
mode: attempt.mode,
|
|
933
|
+
state: attempt.state,
|
|
934
|
+
expiresAt: attempt.expiresAt.toISOString(),
|
|
935
|
+
}))
|
|
936
|
+
.digest('base64url');
|
|
937
|
+
}
|
|
938
|
+
function signatureMatches(actual, expected) {
|
|
939
|
+
const actualBuffer = Buffer.from(actual, 'utf8');
|
|
940
|
+
const expectedBuffer = Buffer.from(expected, 'utf8');
|
|
941
|
+
return actualBuffer.length === expectedBuffer.length && (0, node_crypto_1.timingSafeEqual)(actualBuffer, expectedBuffer);
|
|
942
|
+
}
|
|
943
|
+
function codeChallenge(verifier) {
|
|
944
|
+
return (0, node_crypto_1.createHash)('sha256').update(verifier).digest('base64url');
|
|
945
|
+
}
|
|
946
|
+
function principal(webId) {
|
|
947
|
+
return { webId };
|
|
948
|
+
}
|
|
949
|
+
function cloneAttempt(attempt) {
|
|
950
|
+
return {
|
|
951
|
+
...attempt,
|
|
952
|
+
expiresAt: new Date(attempt.expiresAt),
|
|
953
|
+
consumedAt: attempt.consumedAt ? new Date(attempt.consumedAt) : undefined,
|
|
954
|
+
nextPollAt: attempt.nextPollAt ? new Date(attempt.nextPollAt) : undefined,
|
|
955
|
+
pollClaimedAt: attempt.pollClaimedAt ? new Date(attempt.pollClaimedAt) : undefined,
|
|
956
|
+
};
|
|
957
|
+
}
|
|
958
|
+
function normalizeProvider(provider) {
|
|
959
|
+
return provider.trim().toLowerCase();
|
|
960
|
+
}
|
|
961
|
+
async function safeJson(response) {
|
|
962
|
+
const text = await response.text();
|
|
963
|
+
if (!text) {
|
|
964
|
+
if (response.ok) {
|
|
965
|
+
throw new Error('Provider returned an empty JSON response');
|
|
966
|
+
}
|
|
967
|
+
return {};
|
|
968
|
+
}
|
|
969
|
+
try {
|
|
970
|
+
const parsed = JSON.parse(text);
|
|
971
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
972
|
+
if (response.ok) {
|
|
973
|
+
throw new Error('Provider returned a non-object JSON response');
|
|
974
|
+
}
|
|
975
|
+
return {};
|
|
976
|
+
}
|
|
977
|
+
return parsed;
|
|
978
|
+
}
|
|
979
|
+
catch {
|
|
980
|
+
if (response.ok) {
|
|
981
|
+
throw new Error('Provider returned invalid JSON');
|
|
982
|
+
}
|
|
983
|
+
return {};
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
function stringFrom(value) {
|
|
987
|
+
return typeof value === 'string' ? value : '';
|
|
988
|
+
}
|
|
989
|
+
function numberFrom(value, fallback) {
|
|
990
|
+
return typeof value === 'number' && Number.isFinite(value) ? value : fallback;
|
|
991
|
+
}
|
|
992
|
+
function expiresAtFrom(expiresIn, now) {
|
|
993
|
+
if (typeof expiresIn !== 'number' || !Number.isFinite(expiresIn)) {
|
|
994
|
+
return undefined;
|
|
995
|
+
}
|
|
996
|
+
return new Date(now.getTime() + expiresIn * 1000);
|
|
997
|
+
}
|
|
998
|
+
function safeProviderError(body) {
|
|
999
|
+
const code = stringFrom(body.error);
|
|
1000
|
+
if (SAFE_PROVIDER_ERROR_CODES.has(code)) {
|
|
1001
|
+
return code;
|
|
1002
|
+
}
|
|
1003
|
+
if (!code) {
|
|
1004
|
+
return 'provider_error';
|
|
1005
|
+
}
|
|
1006
|
+
if (code.endsWith('_error')) {
|
|
1007
|
+
return 'provider_error';
|
|
1008
|
+
}
|
|
1009
|
+
return 'provider_error';
|
|
1010
|
+
}
|
|
1011
|
+
const SAFE_PROVIDER_ERROR_CODES = new Set([
|
|
1012
|
+
'authorization_pending',
|
|
1013
|
+
'slow_down',
|
|
1014
|
+
'expired_token',
|
|
1015
|
+
'access_denied',
|
|
1016
|
+
'invalid_grant',
|
|
1017
|
+
'invalid_client',
|
|
1018
|
+
]);
|
|
1019
|
+
function pendingResult(input, status, intervalSeconds) {
|
|
1020
|
+
return {
|
|
1021
|
+
mode: 'deviceCodeOAuth',
|
|
1022
|
+
status,
|
|
1023
|
+
provider: 'kimi',
|
|
1024
|
+
deployment: input.deployment,
|
|
1025
|
+
attemptId: input.attemptId,
|
|
1026
|
+
intervalSeconds,
|
|
1027
|
+
};
|
|
1028
|
+
}
|
|
1029
|
+
function assertKimiEndpoint(endpoint, pathname) {
|
|
1030
|
+
const url = new URL(endpoint);
|
|
1031
|
+
if (url.origin !== 'https://auth.kimi.com'
|
|
1032
|
+
|| url.pathname !== pathname
|
|
1033
|
+
|| url.search
|
|
1034
|
+
|| url.hash
|
|
1035
|
+
|| url.username
|
|
1036
|
+
|| url.password) {
|
|
1037
|
+
throw new Error('Kimi Connect endpoint is not allowlisted');
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
function requireStringField(body, field) {
|
|
1041
|
+
if (typeof body[field] !== 'string' || !body[field].trim()) {
|
|
1042
|
+
throw new Error(`Provider response missing required field: ${field}`);
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
function isVersionConflict(error) {
|
|
1046
|
+
return error instanceof Error && /version_conflict|credential_version_conflict/u.test(error.message);
|
|
1047
|
+
}
|
|
1048
|
+
function decodeJwtSubject(idToken) {
|
|
1049
|
+
const payload = idToken.split('.')[1];
|
|
1050
|
+
if (!payload) {
|
|
1051
|
+
return undefined;
|
|
1052
|
+
}
|
|
1053
|
+
try {
|
|
1054
|
+
const decoded = JSON.parse(Buffer.from(payload, 'base64url').toString('utf8'));
|
|
1055
|
+
return typeof decoded.sub === 'string' ? decoded.sub : undefined;
|
|
1056
|
+
}
|
|
1057
|
+
catch {
|
|
1058
|
+
return undefined;
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
//# sourceMappingURL=index.js.map
|