@undefineds.co/xpod 0.4.11 → 0.4.12

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.
Files changed (372) hide show
  1. package/config/components-ignore.json +5 -1
  2. package/config/notifications.json +68 -0
  3. package/config/xpod.base.json +9 -11
  4. package/dist/ai/service/AiCredentialSecret.d.ts +30 -0
  5. package/dist/ai/service/AiCredentialSecret.js +120 -0
  6. package/dist/ai/service/CredentialReaderImpl.d.ts +18 -0
  7. package/dist/ai/service/CredentialReaderImpl.js +81 -5
  8. package/dist/ai/service/CredentialReaderImpl.jsonld +42 -2
  9. package/dist/ai/service/EmbeddingModelPolicy.d.ts +79 -0
  10. package/dist/ai/service/EmbeddingModelPolicy.js +134 -0
  11. package/dist/ai/service/EmbeddingProviderError.js +6 -0
  12. package/dist/ai/service/EmbeddingServiceImpl.d.ts +13 -1
  13. package/dist/ai/service/EmbeddingServiceImpl.js +18 -5
  14. package/dist/ai/service/EmbeddingServiceImpl.jsonld +35 -0
  15. package/dist/ai/service/index.d.ts +2 -0
  16. package/dist/ai/service/index.js +2 -0
  17. package/dist/api/ai-gateway/connect/index.d.ts +20 -2
  18. package/dist/api/ai-gateway/connect/index.js +162 -16
  19. package/dist/api/ai-gateway/credentials/AiCredentialSecretDecoder.d.ts +12 -0
  20. package/dist/api/ai-gateway/credentials/AiCredentialSecretDecoder.js +30 -0
  21. package/dist/api/ai-gateway/errors.d.ts +1 -1
  22. package/dist/api/ai-gateway/models/GatewayEmbeddingModelCatalog.d.ts +11 -0
  23. package/dist/api/ai-gateway/models/GatewayEmbeddingModelCatalog.js +31 -0
  24. package/dist/api/ai-gateway/models/PodModelSelectionRepository.js +7 -3
  25. package/dist/api/ai-gateway/models/ProviderCustomModelsService.d.ts +18 -0
  26. package/dist/api/ai-gateway/models/ProviderCustomModelsService.js +23 -0
  27. package/dist/api/ai-gateway/models/ProviderModelDiscoveryAdapters.d.ts +3 -1
  28. package/dist/api/ai-gateway/models/ProviderModelDiscoveryAdapters.js +2 -45
  29. package/dist/api/ai-gateway/models/ProviderModelSelectionService.d.ts +10 -0
  30. package/dist/api/ai-gateway/models/ProviderModelSelectionService.js +57 -20
  31. package/dist/api/ai-gateway/models/ProviderModelType.d.ts +28 -0
  32. package/dist/api/ai-gateway/models/ProviderModelType.js +34 -0
  33. package/dist/api/ai-gateway/models/ProviderModelsAdapter.d.ts +10 -0
  34. package/dist/api/ai-gateway/models/ProviderModelsAdapter.js +3 -4
  35. package/dist/api/ai-gateway/models/index.d.ts +1 -0
  36. package/dist/api/ai-gateway/models/index.js +3 -1
  37. package/dist/api/ai-gateway/providers/CustomRuntimeAdapter.d.ts +7 -0
  38. package/dist/api/ai-gateway/providers/CustomRuntimeAdapter.js +9 -2
  39. package/dist/api/ai-gateway/providers/ModelsDevCatalog.d.ts +7 -1
  40. package/dist/api/ai-gateway/providers/ModelsDevCatalog.js +4 -10
  41. package/dist/api/ai-gateway/providers/ProviderRegistry.d.ts +107 -0
  42. package/dist/api/ai-gateway/providers/ProviderRegistry.js +244 -21
  43. package/dist/api/ai-gateway/providers/ProviderRuntimeRegistry.d.ts +5 -0
  44. package/dist/api/ai-gateway/providers/ProviderRuntimeRegistry.js +5 -1
  45. package/dist/api/ai-gateway/quota/SubscriptionQuotaAdapters.d.ts +12 -4
  46. package/dist/api/ai-gateway/quota/SubscriptionQuotaAdapters.js +11 -11
  47. package/dist/api/ai-gateway/routing/ModelRouter.d.ts +14 -0
  48. package/dist/api/ai-gateway/routing/ModelRouter.js +43 -4
  49. package/dist/api/ai-gateway/service-access/AiConnectionsServiceAccess.d.ts +9 -1
  50. package/dist/api/ai-gateway/service-access/AiConnectionsServiceAccess.js +3 -27
  51. package/dist/api/chatkit/pod-store.d.ts +31 -0
  52. package/dist/api/chatkit/pod-store.js +132 -8
  53. package/dist/api/container/common.js +24 -4
  54. package/dist/api/container/routes.js +17 -2
  55. package/dist/api/container/types.d.ts +3 -1
  56. package/dist/api/handlers/AdminHandler.d.ts +13 -0
  57. package/dist/api/handlers/AdminHandler.js +47 -18
  58. package/dist/api/handlers/AiConfigHandler.d.ts +6 -0
  59. package/dist/api/handlers/AiConfigHandler.js +28 -0
  60. package/dist/api/handlers/AiGatewayManagementHandler.js +36 -0
  61. package/dist/api/runs/RdfRunContextRetriever.d.ts +14 -0
  62. package/dist/api/runs/RdfRunContextRetriever.js +41 -5
  63. package/dist/api/runtime.js +2 -1
  64. package/dist/cli/commands/secret.d.ts +1 -0
  65. package/dist/cli/commands/secret.js +25 -7
  66. package/dist/components/components.jsonld +3 -1
  67. package/dist/components/context.jsonld +53 -1
  68. package/dist/http/SubgraphSparqlHttpHandler.d.ts +59 -2
  69. package/dist/http/SubgraphSparqlHttpHandler.js +145 -13
  70. package/dist/http/SubgraphSparqlHttpHandler.jsonld +37 -0
  71. package/dist/identity/drizzle/EdgeNodeRepository.d.ts +0 -12
  72. package/dist/identity/drizzle/EdgeNodeRepository.js +5 -13
  73. package/dist/index.d.ts +2 -1
  74. package/dist/index.js +7 -3
  75. package/dist/logging/log-file.d.ts +17 -0
  76. package/dist/logging/log-file.js +69 -0
  77. package/dist/main.js +2 -1
  78. package/dist/notifications/NotificationChannelSweeper.d.ts +50 -0
  79. package/dist/notifications/NotificationChannelSweeper.js +131 -0
  80. package/dist/notifications/NotificationChannelSweeper.jsonld +136 -0
  81. package/dist/notifications/ReclaimingWebSocket2023Storer.d.ts +25 -0
  82. package/dist/notifications/ReclaimingWebSocket2023Storer.js +56 -0
  83. package/dist/notifications/ReclaimingWebSocket2023Storer.jsonld +77 -0
  84. package/dist/notifications/index.d.ts +2 -0
  85. package/dist/notifications/index.js +2 -0
  86. package/dist/runtime/Proxy.d.ts +37 -0
  87. package/dist/runtime/Proxy.js +88 -16
  88. package/dist/runtime/bootstrap.js +2 -1
  89. package/dist/runtime/upgrade/BunNativeUpgradeRelay.d.ts +116 -0
  90. package/dist/runtime/upgrade/BunNativeUpgradeRelay.js +423 -0
  91. package/dist/runtime/upgrade/UpgradeHandshake.d.ts +63 -0
  92. package/dist/runtime/upgrade/UpgradeHandshake.js +199 -0
  93. package/dist/runtime/upgrade/WebSocketFrames.d.ts +67 -0
  94. package/dist/runtime/upgrade/WebSocketFrames.js +224 -0
  95. package/node_modules/@undefineds.co/ai-connections/dist/AiApiKeyPool.js +8 -1
  96. package/node_modules/@undefineds.co/ai-connections/dist/AiAuthorizationActions.d.ts +11 -2
  97. package/node_modules/@undefineds.co/ai-connections/dist/AiAuthorizationActions.js +27 -10
  98. package/node_modules/@undefineds.co/ai-connections/dist/AiClientConfigurationSection.d.ts +7 -0
  99. package/node_modules/@undefineds.co/ai-connections/dist/AiClientConfigurationSection.js +13 -11
  100. package/node_modules/@undefineds.co/ai-connections/dist/AiConnectDialog.js +1 -1
  101. package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsList.js +10 -6
  102. package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsMain.d.ts +15 -0
  103. package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsMain.js +29 -3
  104. package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsMainHeader.js +18 -3
  105. package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsPanel.d.ts +16 -1
  106. package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsPanel.js +92 -20
  107. package/node_modules/@undefineds.co/ai-connections/dist/AiCopyButton.d.ts +35 -0
  108. package/node_modules/@undefineds.co/ai-connections/dist/AiCopyButton.js +45 -0
  109. package/node_modules/@undefineds.co/ai-connections/dist/AiCredentialPoolSection.js +71 -11
  110. package/node_modules/@undefineds.co/ai-connections/dist/AiCredentialRow.js +9 -7
  111. package/node_modules/@undefineds.co/ai-connections/dist/AiEndpointList.d.ts +23 -0
  112. package/node_modules/@undefineds.co/ai-connections/dist/AiEndpointList.js +24 -0
  113. package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayKeysSection.d.ts +13 -4
  114. package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayKeysSection.js +35 -38
  115. package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayModelsSection.d.ts +21 -0
  116. package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayModelsSection.js +51 -0
  117. package/node_modules/@undefineds.co/ai-connections/dist/AiInfoTooltip.d.ts +15 -0
  118. package/node_modules/@undefineds.co/ai-connections/dist/AiInfoTooltip.js +16 -0
  119. package/node_modules/@undefineds.co/ai-connections/dist/AiModelCatalog.d.ts +175 -0
  120. package/node_modules/@undefineds.co/ai-connections/dist/AiModelCatalog.js +133 -0
  121. package/node_modules/@undefineds.co/ai-connections/dist/AiOfferingDetails.js +2 -2
  122. package/node_modules/@undefineds.co/ai-connections/dist/AiProviderCard.js +13 -64
  123. package/node_modules/@undefineds.co/ai-connections/dist/AiProviderHeader.d.ts +21 -0
  124. package/node_modules/@undefineds.co/ai-connections/dist/AiProviderHeader.js +12 -0
  125. package/node_modules/@undefineds.co/ai-connections/dist/AiRowAction.d.ts +15 -0
  126. package/node_modules/@undefineds.co/ai-connections/dist/AiRowAction.js +12 -0
  127. package/node_modules/@undefineds.co/ai-connections/dist/AiSortableCredentialList.js +2 -1
  128. package/node_modules/@undefineds.co/ai-connections/dist/ai-connections-client.d.ts +7 -0
  129. package/node_modules/@undefineds.co/ai-connections/dist/ai-connections-client.js +6 -0
  130. package/node_modules/@undefineds.co/ai-connections/dist/authorization-methods.d.ts +36 -5
  131. package/node_modules/@undefineds.co/ai-connections/dist/authorization-methods.js +52 -9
  132. package/node_modules/@undefineds.co/ai-connections/dist/client/normalize.js +30 -3
  133. package/node_modules/@undefineds.co/ai-connections/dist/client/types.d.ts +21 -1
  134. package/node_modules/@undefineds.co/ai-connections/dist/client-config/base-adapter.d.ts +1 -3
  135. package/node_modules/@undefineds.co/ai-connections/dist/client-config/base-adapter.js +3 -7
  136. package/node_modules/@undefineds.co/ai-connections/dist/client-config/index.cjs +9 -7
  137. package/node_modules/@undefineds.co/ai-connections/dist/collection-runtime.d.ts +46 -0
  138. package/node_modules/@undefineds.co/ai-connections/dist/collection-runtime.js +231 -0
  139. package/node_modules/@undefineds.co/ai-connections/dist/collections.d.ts +119 -0
  140. package/node_modules/@undefineds.co/ai-connections/dist/collections.js +173 -0
  141. package/node_modules/@undefineds.co/ai-connections/dist/controller.d.ts +71 -5
  142. package/node_modules/@undefineds.co/ai-connections/dist/controller.js +285 -16
  143. package/node_modules/@undefineds.co/ai-connections/dist/credential-labels.d.ts +5 -0
  144. package/node_modules/@undefineds.co/ai-connections/dist/credential-labels.js +8 -3
  145. package/node_modules/@undefineds.co/ai-connections/dist/credential-storage.d.ts +59 -0
  146. package/node_modules/@undefineds.co/ai-connections/dist/credential-storage.js +131 -0
  147. package/node_modules/@undefineds.co/ai-connections/dist/endpoint-urls.d.ts +15 -0
  148. package/node_modules/@undefineds.co/ai-connections/dist/endpoint-urls.js +20 -0
  149. package/node_modules/@undefineds.co/ai-connections/dist/gateway-endpoints.d.ts +14 -0
  150. package/node_modules/@undefineds.co/ai-connections/dist/gateway-endpoints.js +20 -0
  151. package/node_modules/@undefineds.co/ai-connections/dist/index.d.ts +8 -0
  152. package/node_modules/@undefineds.co/ai-connections/dist/index.js +8 -0
  153. package/node_modules/@undefineds.co/ai-connections/dist/manifest.js +1 -1
  154. package/node_modules/@undefineds.co/ai-connections/dist/offering-endpoints.d.ts +14 -0
  155. package/node_modules/@undefineds.co/ai-connections/dist/offering-endpoints.js +17 -0
  156. package/node_modules/@undefineds.co/ai-connections/dist/provider-catalog.cjs +68 -1
  157. package/node_modules/@undefineds.co/ai-connections/dist/provider-catalog.d.ts +75 -1
  158. package/node_modules/@undefineds.co/ai-connections/dist/provider-catalog.js +119 -0
  159. package/node_modules/@undefineds.co/ai-connections/dist/provider-visuals.d.ts +5 -0
  160. package/node_modules/@undefineds.co/ai-connections/dist/provider-visuals.js +5 -0
  161. package/node_modules/@undefineds.co/ai-connections/dist/service-access.js +2 -27
  162. package/node_modules/@undefineds.co/ai-connections/package.json +1 -0
  163. package/node_modules/@undefineds.co/extension-sdk/dist/manifest.d.ts +1 -1
  164. package/node_modules/@undefineds.co/extension-sdk/dist/manifest.js +2 -0
  165. package/node_modules/@undefineds.co/extension-sdk/dist/web.d.ts +150 -0
  166. package/node_modules/@undefineds.co/extension-sdk/package.json +2 -1
  167. package/node_modules/@undefineds.co/models/README.md +1 -1
  168. package/node_modules/@undefineds.co/models/dist/ai-config/index.d.ts +3 -3
  169. package/node_modules/@undefineds.co/models/dist/ai-gateway.schema.d.ts +5 -0
  170. package/node_modules/@undefineds.co/models/dist/ai-gateway.schema.js +9 -0
  171. package/node_modules/@undefineds.co/models/dist/ai-runtime.repository.d.ts +1 -1
  172. package/node_modules/@undefineds.co/models/dist/approval.repository.d.ts +2 -2
  173. package/node_modules/@undefineds.co/models/dist/audit.presentation.d.ts +2 -2
  174. package/node_modules/@undefineds.co/models/dist/capture.repository.d.ts +1 -1
  175. package/node_modules/@undefineds.co/models/dist/chat-project.repository.d.ts +1 -1
  176. package/node_modules/@undefineds.co/models/dist/chat.repository.d.ts +2 -2
  177. package/node_modules/@undefineds.co/models/dist/control-request.repository.d.ts +2 -2
  178. package/node_modules/@undefineds.co/models/dist/conversation-share.repository.d.ts +1 -1
  179. package/node_modules/@undefineds.co/models/dist/credential.schema.d.ts +12 -0
  180. package/node_modules/@undefineds.co/models/dist/credential.schema.js +15 -1
  181. package/node_modules/@undefineds.co/models/dist/discovery/index.d.ts +2 -2
  182. package/node_modules/@undefineds.co/models/dist/discovery/providers.json +248 -7
  183. package/node_modules/@undefineds.co/models/dist/discovery/types.d.ts +31 -0
  184. package/node_modules/@undefineds.co/models/dist/extension/index.d.ts +1 -1
  185. package/node_modules/@undefineds.co/models/dist/favorite/index.d.ts +2 -2
  186. package/node_modules/@undefineds.co/models/dist/fixtures/contracts-chat-contact.d.ts +5 -5
  187. package/node_modules/@undefineds.co/models/dist/import/index.d.ts +1 -1
  188. package/node_modules/@undefineds.co/models/dist/index.d.ts +73 -73
  189. package/node_modules/@undefineds.co/models/dist/index.js +1 -1
  190. package/node_modules/@undefineds.co/models/dist/input-request.repository.d.ts +2 -2
  191. package/node_modules/@undefineds.co/models/dist/knowledge/index.d.ts +1 -1
  192. package/node_modules/@undefineds.co/models/dist/message.repository.d.ts +1 -1
  193. package/node_modules/@undefineds.co/models/dist/namespaces.js +5 -0
  194. package/node_modules/@undefineds.co/models/dist/pod-storage-descriptor.d.ts +4815 -26
  195. package/node_modules/@undefineds.co/models/dist/pod-storage-descriptor.js +482 -132
  196. package/node_modules/@undefineds.co/models/dist/schema.d.ts +4 -0
  197. package/node_modules/@undefineds.co/models/dist/session/index.d.ts +1 -1
  198. package/node_modules/@undefineds.co/models/dist/settings/index.d.ts +1 -1
  199. package/node_modules/@undefineds.co/models/dist/sidecar/persistence-mapping.d.ts +5 -5
  200. package/node_modules/@undefineds.co/models/dist/thread.repository.d.ts +2 -2
  201. package/node_modules/@undefineds.co/models/dist/types/message-block.d.ts +1 -1
  202. package/node_modules/@undefineds.co/models/dist/vocab/_namespaces.d.ts +1 -1
  203. package/node_modules/@undefineds.co/models/dist/vocab/index.d.ts +10 -10
  204. package/node_modules/@undefineds.co/models/dist/vocab/sidecar.vocab.d.ts +1 -0
  205. package/node_modules/@undefineds.co/models/dist/vocab/sidecar.vocab.js +1 -0
  206. package/node_modules/@undefineds.co/models/package.json +4 -2
  207. package/node_modules/@undefineds.co/pod-collections/README.md +71 -0
  208. package/node_modules/@undefineds.co/pod-collections/dist/diff.d.ts +85 -0
  209. package/node_modules/@undefineds.co/pod-collections/dist/diff.js +166 -0
  210. package/node_modules/@undefineds.co/pod-collections/dist/feed.d.ts +17 -0
  211. package/node_modules/@undefineds.co/pod-collections/dist/feed.js +27 -0
  212. package/node_modules/@undefineds.co/pod-collections/dist/index.cjs +1042 -0
  213. package/node_modules/@undefineds.co/pod-collections/dist/index.d.ts +37 -0
  214. package/node_modules/@undefineds.co/pod-collections/dist/index.js +89 -0
  215. package/node_modules/@undefineds.co/pod-collections/dist/layout.d.ts +75 -0
  216. package/node_modules/@undefineds.co/pod-collections/dist/layout.js +173 -0
  217. package/node_modules/@undefineds.co/pod-collections/dist/mapping.d.ts +78 -0
  218. package/node_modules/@undefineds.co/pod-collections/dist/mapping.js +287 -0
  219. package/node_modules/@undefineds.co/pod-collections/dist/mutations.d.ts +83 -0
  220. package/node_modules/@undefineds.co/pod-collections/dist/mutations.js +273 -0
  221. package/node_modules/@undefineds.co/pod-collections/dist/react.d.ts +21 -0
  222. package/node_modules/@undefineds.co/pod-collections/dist/react.js +22 -0
  223. package/node_modules/@undefineds.co/pod-collections/dist/read.d.ts +65 -0
  224. package/node_modules/@undefineds.co/pod-collections/dist/read.js +31 -0
  225. package/node_modules/@undefineds.co/pod-collections/dist/sync.d.ts +66 -0
  226. package/node_modules/@undefineds.co/pod-collections/dist/sync.js +260 -0
  227. package/node_modules/@undefineds.co/pod-collections/dist/types.d.ts +155 -0
  228. package/node_modules/@undefineds.co/pod-collections/dist/types.js +9 -0
  229. package/node_modules/@undefineds.co/pod-collections/package.json +42 -0
  230. package/package.json +15 -7
  231. package/static/app/assets/main.css +1 -1
  232. package/static/auth-callback/assets/AiConfigContext-DnQs1ZpW.js +1 -0
  233. package/static/auth-callback/assets/AiConfigPage-DOtvlxH0.js +1 -0
  234. package/static/auth-callback/assets/DocumentProcessingPanel-BS2voQgL.js +1 -0
  235. package/static/auth-callback/assets/IndexLifecyclePanel-Cvt0cJtN.js +1 -0
  236. package/static/auth-callback/assets/{IndexSubjectPanel-BbUqop4b.js → IndexSubjectPanel-Dhf01GqF.js} +1 -1
  237. package/static/auth-callback/assets/ModelAssignmentsPanel-BJutWaAF.js +1 -0
  238. package/static/auth-callback/assets/ModelsPage-BRS0sje3.js +11 -0
  239. package/static/auth-callback/assets/{NetworkPage-Vp2PrMxs.js → NetworkPage-B3qBfANA.js} +2 -2
  240. package/static/auth-callback/assets/{PaneListHeader-DY7baSFl.js → PaneListHeader-QQeJGTp4.js} +1 -1
  241. package/static/auth-callback/assets/SearchIndexingPanel-MyNUSEwT.js +1 -0
  242. package/static/auth-callback/assets/{StatusSubjectPanel-ArIS-TxT.js → StatusSubjectPanel-DQkEVsFs.js} +1 -1
  243. package/static/{settings/assets/StatusWorkspace-CoMFRXoV.js → auth-callback/assets/StatusWorkspace-Dkv63Uwk.js} +1 -1
  244. package/static/auth-callback/assets/{SystemSettingsPage-BDvT1NUz.js → SystemSettingsPage-TIsUfX5d.js} +1 -1
  245. package/static/{dashboard/assets/SystemSettingsSubjectPanel-WaE8mTQi.js → auth-callback/assets/SystemSettingsSubjectPanel-BJWEt2-7.js} +5 -5
  246. package/static/auth-callback/assets/XpodAiConnectionsPodStore-BJiXm-PF.js +3 -0
  247. package/static/auth-callback/assets/{activity-D1Dsfa_0.js → activity-5hNeNKnL.js} +1 -1
  248. package/static/auth-callback/assets/ai-connections-CryuHGKW.js +1 -0
  249. package/static/auth-callback/assets/{auth-callback-Cmf4hXVZ.js → auth-callback-CAFZ3R0B.js} +6 -6
  250. package/static/auth-callback/assets/auth-callback-rk080mvG.css +1 -0
  251. package/static/auth-callback/assets/{badge-CZsHq3Ih.js → badge-CAIPI0CB.js} +1 -1
  252. package/static/auth-callback/assets/collection-runtime-D9s7h9YA.js +1 -0
  253. package/static/auth-callback/assets/dialog-BjA109aX.js +1 -0
  254. package/static/auth-callback/assets/{download-DU9ntlHw.js → download-B3Up5W2G.js} +1 -1
  255. package/static/auth-callback/assets/{external-link-BfzaaZDx.js → external-link-BTXgSPzB.js} +1 -1
  256. package/static/auth-callback/assets/index-BppXlxcp.js +41 -0
  257. package/static/auth-callback/assets/index-CirW4CJf.js +1 -0
  258. package/static/auth-callback/assets/index-DlLYWOhw.js +4 -0
  259. package/static/auth-callback/assets/{index-browser-BNFqqC74.js → index-browser-DtU38ni3.js} +1 -1
  260. package/static/auth-callback/assets/{key-round-BwP3DBWo.js → key-round-CQCOrZ7x.js} +1 -1
  261. package/static/auth-callback/assets/layout-DB3pMyTl.js +1 -0
  262. package/static/auth-callback/assets/pod-collections-host-KnnGFZHL.js +8 -0
  263. package/static/auth-callback/assets/{rotate-ccw-VMwnmyab.js → rotate-ccw-C1zM2KtS.js} +1 -1
  264. package/static/auth-callback/assets/{skeleton-CoD55rBT.js → skeleton-Cqp7_M9-.js} +1 -1
  265. package/static/auth-callback/assets/{waypoints-DRo_1Ca7.js → waypoints-Bj6gAUSQ.js} +1 -1
  266. package/static/auth-callback/assets/{workspace-layout--mcXl3My.js → workspace-layout-DK8mDzrY.js} +1 -1
  267. package/static/auth-callback/auth-callback.html +2 -2
  268. package/static/dashboard/assets/AiConfigContext-BsE7MqX8.js +1 -0
  269. package/static/dashboard/assets/AiConfigPage-DvM-lRXa.js +1 -0
  270. package/static/dashboard/assets/DocumentProcessingPanel-BPfdlfuf.js +1 -0
  271. package/static/dashboard/assets/IndexLifecyclePanel--m0AGxvh.js +1 -0
  272. package/static/dashboard/assets/{IndexSubjectPanel-B2cXwl8X.js → IndexSubjectPanel-Bb7m1k3d.js} +1 -1
  273. package/static/dashboard/assets/ModelAssignmentsPanel-BLi_zbMa.js +1 -0
  274. package/static/dashboard/assets/ModelsPage-CxdpgnfR.js +11 -0
  275. package/static/dashboard/assets/{NetworkPage-DV2V0qWO.js → NetworkPage-BAIPw-D_.js} +2 -2
  276. package/static/dashboard/assets/{PaneListHeader-D0c1yCFH.js → PaneListHeader-BBCMei0r.js} +1 -1
  277. package/static/dashboard/assets/SearchIndexingPanel-Ck4Y-xjR.js +1 -0
  278. package/static/dashboard/assets/{StatusSubjectPanel-oPSECj7i.js → StatusSubjectPanel-D1KWfAXE.js} +1 -1
  279. package/static/dashboard/assets/{StatusWorkspace-PdovQPKa.js → StatusWorkspace-JbA5gzXx.js} +1 -1
  280. package/static/dashboard/assets/{SystemSettingsPage-CtNDklkx.js → SystemSettingsPage-BbwQWsSR.js} +1 -1
  281. package/static/{settings/assets/SystemSettingsSubjectPanel-DExjDo_v.js → dashboard/assets/SystemSettingsSubjectPanel-N117nMt5.js} +5 -5
  282. package/static/dashboard/assets/XpodAiConnectionsPodStore-CdDOb4SV.js +18 -0
  283. package/static/dashboard/assets/{activity-B9ylSoyr.js → activity-DX1I96o_.js} +1 -1
  284. package/static/dashboard/assets/ai-connections-DwCRqOQa.js +1 -0
  285. package/static/dashboard/assets/{badge-BNbFbpIb.js → badge-k2vhtDqH.js} +1 -1
  286. package/static/dashboard/assets/collection-runtime-BFQ8teQJ.js +1 -0
  287. package/static/dashboard/assets/{dashboard-CD-FFVRD.js → dashboard-DWZ-fmCT.js} +4 -4
  288. package/static/dashboard/assets/dashboard-rk080mvG.css +1 -0
  289. package/static/dashboard/assets/dialog-1CCw-iHT.js +1 -0
  290. package/static/dashboard/assets/{download-nOP38LtW.js → download-C6-SNY1q.js} +1 -1
  291. package/static/dashboard/assets/{external-link-Bh2ewN9E.js → external-link-BgPcZ_j2.js} +1 -1
  292. package/static/dashboard/assets/index-6LcIUIYO.js +1 -0
  293. package/static/dashboard/assets/index-D7A8U6Pt.js +41 -0
  294. package/static/dashboard/assets/index-UD6QOE7H.js +4 -0
  295. package/static/dashboard/assets/{key-round-bGmguBLv.js → key-round-BOd7Jo0Q.js} +1 -1
  296. package/static/dashboard/assets/layout-DB3pMyTl.js +1 -0
  297. package/static/dashboard/assets/pod-collections-host-KnnGFZHL.js +8 -0
  298. package/static/dashboard/assets/{rotate-ccw-D2x__ODW.js → rotate-ccw-CCgJqsvx.js} +1 -1
  299. package/static/dashboard/assets/{skeleton-VOqft8WS.js → skeleton-Bc7abAn5.js} +1 -1
  300. package/static/dashboard/assets/{waypoints-fgRqm4oH.js → waypoints-s-opmJxx.js} +1 -1
  301. package/static/dashboard/assets/{workspace-layout-DV4dgeHX.js → workspace-layout-DqIQeTBV.js} +1 -1
  302. package/static/dashboard/dashboard.html +2 -2
  303. package/static/settings/assets/AiConfigContext-BB9KZySa.js +1 -0
  304. package/static/settings/assets/AiConfigPage-DGSXUkLs.js +1 -0
  305. package/static/settings/assets/DocumentProcessingPanel-Da2Re6Rg.js +1 -0
  306. package/static/settings/assets/IndexLifecyclePanel-BSZuIzgr.js +1 -0
  307. package/static/settings/assets/{IndexSubjectPanel-BgbI9c-a.js → IndexSubjectPanel-CFd0ay-r.js} +1 -1
  308. package/static/settings/assets/ModelAssignmentsPanel-CSAryvWJ.js +1 -0
  309. package/static/settings/assets/ModelsPage-BQwCwLHU.js +11 -0
  310. package/static/settings/assets/{NetworkPage-C8OA9Mtp.js → NetworkPage-BKymvsQc.js} +2 -2
  311. package/static/settings/assets/{PaneListHeader-COvlPJWj.js → PaneListHeader-Bjh3hRdQ.js} +1 -1
  312. package/static/settings/assets/SearchIndexingPanel-MjKL5QLU.js +1 -0
  313. package/static/settings/assets/{StatusSubjectPanel-BuLml7qn.js → StatusSubjectPanel-Bvl6K4mx.js} +1 -1
  314. package/static/settings/assets/StatusWorkspace-B0NzrP--.js +1 -0
  315. package/static/settings/assets/{SystemSettingsPage-DlzmaWV-.js → SystemSettingsPage-D2z6Z4FE.js} +1 -1
  316. package/static/{auth-callback/assets/SystemSettingsSubjectPanel-CDqRuC4t.js → settings/assets/SystemSettingsSubjectPanel-4sxma4X4.js} +5 -5
  317. package/static/settings/assets/XpodAiConnectionsPodStore-BkNQ8fZx.js +3 -0
  318. package/static/settings/assets/{activity-TLerXgMs.js → activity-CgJJGpjx.js} +1 -1
  319. package/static/settings/assets/ai-connections-CryuHGKW.js +1 -0
  320. package/static/settings/assets/{badge-Bcs8iWrH.js → badge-C4NypVyT.js} +1 -1
  321. package/static/settings/assets/collection-runtime-CTLCDxAi.js +1 -0
  322. package/static/settings/assets/dialog-Csq0vWUi.js +1 -0
  323. package/static/settings/assets/{download-Ct3QmHPt.js → download-DaLJJ-Wp.js} +1 -1
  324. package/static/settings/assets/{external-link-C8KiHbss.js → external-link--w_iW5Au.js} +1 -1
  325. package/static/settings/assets/index-B0mQa59b.js +4 -0
  326. package/static/settings/assets/index-BukHiu4y.js +1 -0
  327. package/static/settings/assets/index-COmVnZi2.js +41 -0
  328. package/static/settings/assets/{index-browser-CazX1pc2.js → index-browser-BGpvHwD0.js} +1 -1
  329. package/static/settings/assets/{key-round-B19YD1GA.js → key-round-Bk4YRjBu.js} +1 -1
  330. package/static/settings/assets/layout-DB3pMyTl.js +1 -0
  331. package/static/settings/assets/pod-collections-host-KnnGFZHL.js +8 -0
  332. package/static/settings/assets/{rotate-ccw-AQm2kMgU.js → rotate-ccw-TCabbqsr.js} +1 -1
  333. package/static/settings/assets/{settings-C-VBtt9r.js → settings-CJWpdbNC.js} +5 -5
  334. package/static/settings/assets/settings-rk080mvG.css +1 -0
  335. package/static/settings/assets/{skeleton-DyZ1OBYf.js → skeleton-JDHYVe7t.js} +1 -1
  336. package/static/settings/assets/{waypoints-CC3wq-SU.js → waypoints-DDvEl-MU.js} +1 -1
  337. package/static/settings/assets/{workspace-layout-BxXNKgf9.js → workspace-layout-DV5QU30U.js} +1 -1
  338. package/static/settings/settings.html +2 -2
  339. package/static/auth-callback/assets/AiConfigContext-DqWRSm7n.js +0 -1
  340. package/static/auth-callback/assets/AiConfigPage-C5YYyvzl.js +0 -1
  341. package/static/auth-callback/assets/DocumentProcessingPanel-DZCiacBz.js +0 -1
  342. package/static/auth-callback/assets/IndexLifecyclePanel-CCLeOljB.js +0 -1
  343. package/static/auth-callback/assets/ModelAssignmentsPanel-jUUTDKuh.js +0 -1
  344. package/static/auth-callback/assets/ModelsPage-B08zdtff.js +0 -10
  345. package/static/auth-callback/assets/SearchIndexingPanel-D4YRg1-8.js +0 -1
  346. package/static/auth-callback/assets/StatusWorkspace-Cp5LQ9Yx.js +0 -1
  347. package/static/auth-callback/assets/ai-connections-CHNTKemd.js +0 -1
  348. package/static/auth-callback/assets/auth-callback-DWMMiFjh.css +0 -1
  349. package/static/auth-callback/assets/index-DSNnLUbU.js +0 -4
  350. package/static/auth-callback/assets/index-FHhHoKgp.js +0 -41
  351. package/static/dashboard/assets/AiConfigContext-BpPDKSzI.js +0 -1
  352. package/static/dashboard/assets/AiConfigPage-wsqEZDIX.js +0 -1
  353. package/static/dashboard/assets/DocumentProcessingPanel-CDSy3juc.js +0 -1
  354. package/static/dashboard/assets/IndexLifecyclePanel-CVd6vQCX.js +0 -1
  355. package/static/dashboard/assets/ModelAssignmentsPanel-BeBZhnQd.js +0 -1
  356. package/static/dashboard/assets/ModelsPage-B6McSCJw.js +0 -25
  357. package/static/dashboard/assets/SearchIndexingPanel-CGs0OZ12.js +0 -1
  358. package/static/dashboard/assets/ai-connections-CHNTKemd.js +0 -1
  359. package/static/dashboard/assets/dashboard-DWMMiFjh.css +0 -1
  360. package/static/dashboard/assets/index-PgS-Bt7X.js +0 -41
  361. package/static/dashboard/assets/index-QN2QgEwr.js +0 -4
  362. package/static/settings/assets/AiConfigContext-zKQYdfai.js +0 -1
  363. package/static/settings/assets/AiConfigPage-Bs1EE3Ei.js +0 -1
  364. package/static/settings/assets/DocumentProcessingPanel-CSFfdOXS.js +0 -1
  365. package/static/settings/assets/IndexLifecyclePanel-BR9Su49B.js +0 -1
  366. package/static/settings/assets/ModelAssignmentsPanel-C0BE7nbk.js +0 -1
  367. package/static/settings/assets/ModelsPage-CU-YQ8_7.js +0 -10
  368. package/static/settings/assets/SearchIndexingPanel-Bdd46mIV.js +0 -1
  369. package/static/settings/assets/ai-connections-CHNTKemd.js +0 -1
  370. package/static/settings/assets/index-1Q2cRjZd.js +0 -41
  371. package/static/settings/assets/index-DBO_Vq0P.js +0 -4
  372. package/static/settings/assets/settings-DWMMiFjh.css +0 -1
@@ -0,0 +1,119 @@
1
+ import { credentialDescriptor } from '@undefineds.co/models';
2
+ import type { PodCollection, RowOf } from '@undefineds.co/pod-collections';
3
+ import type { AiConnectionsProvider, AiProviderCredentialSummary, AiProviderSummary } from './ai-connections-client';
4
+ /**
5
+ * The credentials table, declared once (`docs/pod-collections.md` §6.4-2).
6
+ *
7
+ * This module is the *shape* of the table and everything that can be computed
8
+ * from a row without the collection layer: the row type, the projection of a row
9
+ * into the summary the page renders, and the enrichment carriers. Nothing here
10
+ * imports `@undefineds.co/pod-collections` at runtime - the row type is a type,
11
+ * and the two things that do need the layer (declaring the table, reading and
12
+ * writing its rows) live in `./collection-runtime`, which is reached through the
13
+ * dynamic import below. That is what keeps the engine out of the settings
14
+ * entry's chunk and out of any page that renders without live rows (§9-9).
15
+ *
16
+ * The one read the page does here, `useCredentialRows`, is a `useSyncExternalStore`
17
+ * subscription to a rows source (the controller's live snapshot of the
18
+ * collection). It is deliberately not `@tanstack/react-db`'s `useLiveQuery`: the
19
+ * page needs "all rows of one table, once its first read landed", which the
20
+ * collection's own change feed answers, and loading a hook lazily would force
21
+ * the whole panel to remount when the chunk arrived. The design doc names this
22
+ * exit explicitly (§7.4-4, §8.7-5: engine only, no react hook).
23
+ *
24
+ * ## What the collection can carry, and what it cannot (yet)
25
+ *
26
+ * Rows are the descriptor's projection: `id`, `service`, `provider`, `label`,
27
+ * `accountLabel`, `authMode`, `status`, `keyVersion`, `expiresAt`,
28
+ * `reauthRequired`, … The known schema drift (locked by
29
+ * `packages/pod-collections/test/guards.test.ts`) means `offeringId`,
30
+ * `metadata`, `baseUrl` and `proxyUrl` are **not** projectable, and `secret`
31
+ * fields are not projected however they are written. So
32
+ *
33
+ * - reading carries the undeclared attributes over from the store's own summary
34
+ * of the same row (`credentialCarriers`), and
35
+ * - writing hands them to the store (`AiConnectionsPodStore`), which owns those
36
+ * columns and the secret envelope.
37
+ *
38
+ * Both are migration-window behaviour. models 0.2.57 now declares all four, so
39
+ * their delete condition is formally met, but they stay until the descriptor
40
+ * projection work (P4) retires the carrier path as a whole - removing them one
41
+ * at a time would leave reads and writes disagreeing in between.
42
+ */
43
+ /** A credentials-table row as the collection projects it. */
44
+ export type CredentialRow = RowOf<typeof credentialDescriptor>;
45
+ /** The collection's `syncState` is the page's availability signal. */
46
+ export interface CredentialCollection {
47
+ readonly collection: PodCollection<CredentialRow>;
48
+ }
49
+ /**
50
+ * A live rows source: the controller's snapshot of the credentials collection.
51
+ *
52
+ * `credentialRows` is `undefined` until the collection's first read lands - and
53
+ * stays `undefined` while the collection layer is still loading, when the host
54
+ * offers no `podCollections` capability, or after a failed first read. The page
55
+ * keeps its store-backed rendering in every one of those states.
56
+ */
57
+ export interface CredentialRowsSource {
58
+ subscribe(listener: () => void): () => void;
59
+ readonly credentialRows?: readonly CredentialRow[];
60
+ }
61
+ /**
62
+ * Live rows for the credentials table. Re-renders on sync and on optimistic
63
+ * writes, because the source is the collection's own change feed.
64
+ */
65
+ export declare function useCredentialRows(source: CredentialRowsSource): readonly CredentialRow[] | undefined;
66
+ /** The lazy half of this module's subject: everything that needs the engine. */
67
+ export type CredentialCollectionRuntime = typeof import('./collection-runtime');
68
+ /**
69
+ * The collection layer at the point of use, fetched once.
70
+ *
71
+ * This is the applet's only dynamic import of it: the settings entry and the
72
+ * applet's own chunk contain no part of the engine, and a page that never
73
+ * reaches the credentials list never fetches it.
74
+ */
75
+ export declare function credentialCollectionRuntime(): Promise<CredentialCollectionRuntime>;
76
+ /**
77
+ * The row's resource id in the shape the rest of the applet uses for
78
+ * credentials: `credentials.ttl#<key>`. The collection's key is only the
79
+ * `resourceIdPattern` slot (`#{id}` → `openai-<uuid>`), so the document segment
80
+ * comes from the same models builder the store writes with.
81
+ */
82
+ export declare function credentialIdOfRow(row: CredentialRow): string;
83
+ /**
84
+ * Which provider a row belongs to, from the row's own `provider` relation.
85
+ *
86
+ * Rows have to be attributable without the store's help: a credential another
87
+ * device just wrote reaches this page as a live row, before any summary read
88
+ * has seen it.
89
+ */
90
+ export declare function providerOfCredentialRow(row: CredentialRow): AiConnectionsProvider | undefined;
91
+ /**
92
+ * A row as the page's credential summary.
93
+ *
94
+ * The row wins for everything the descriptor declares; `carrier` - the store's
95
+ * summary of the same credential - supplies the attributes the descriptor cannot
96
+ * project and the secret-derived hint. A row the store has not read yet (an
97
+ * optimistic insert) falls back to the descriptor's own defaults.
98
+ */
99
+ export declare function credentialSummaryFromRow(row: CredentialRow, provider: AiConnectionsProvider, carrier?: AiProviderCredentialSummary): AiProviderCredentialSummary;
100
+ /** The provider's credential list, rebuilt from the live rows of one table document. */
101
+ export declare function credentialSummariesForProvider(provider: AiConnectionsProvider, rows: readonly CredentialRow[], carrier?: readonly AiProviderCredentialSummary[]): AiProviderCredentialSummary[];
102
+ /**
103
+ * The enrichment carrier per provider: the store's own summary of every
104
+ * credential, plus any credential a mutation of this session added and the store
105
+ * has not read back yet.
106
+ *
107
+ * The store's entries win where both know the same credential - it is the
108
+ * independent read - and the session's overlay only fills the gap, so a
109
+ * just-created row keeps its offering and base URL while it is still optimistic.
110
+ */
111
+ export declare function credentialCarriers(storeProducts: Partial<Record<AiConnectionsProvider, AiProviderSummary>>, overlayProducts: Partial<Record<AiConnectionsProvider, AiProviderSummary>>): Partial<Record<AiConnectionsProvider, readonly AiProviderCredentialSummary[]>>;
112
+ /**
113
+ * The provider products the page renders, with every credential list rebuilt
114
+ * from the live rows.
115
+ *
116
+ * `carriers` only enriches: which credentials exist, and every field the
117
+ * descriptor declares, come from the rows.
118
+ */
119
+ export declare function withLiveCredentials(products: Partial<Record<AiConnectionsProvider, AiProviderSummary>>, carriers: Partial<Record<AiConnectionsProvider, readonly AiProviderCredentialSummary[]>>, rows: readonly CredentialRow[] | undefined): Partial<Record<AiConnectionsProvider, AiProviderSummary>>;
@@ -0,0 +1,173 @@
1
+ import { credentialResource } from '@undefineds.co/models';
2
+ import { useSyncExternalStore } from 'react';
3
+ import { AI_CONNECTIONS_PROVIDERS } from './ai-connections-client.js';
4
+ import { defaultOfferingFor } from './provider-catalog.js';
5
+ import { providerOfCredentialKey, providerResourceKey } from './credential-storage.js';
6
+ /**
7
+ * Live rows for the credentials table. Re-renders on sync and on optimistic
8
+ * writes, because the source is the collection's own change feed.
9
+ */
10
+ export function useCredentialRows(source) {
11
+ return useSyncExternalStore(source.subscribe, () => source.credentialRows, () => source.credentialRows);
12
+ }
13
+ let runtime;
14
+ /**
15
+ * The collection layer at the point of use, fetched once.
16
+ *
17
+ * This is the applet's only dynamic import of it: the settings entry and the
18
+ * applet's own chunk contain no part of the engine, and a page that never
19
+ * reaches the credentials list never fetches it.
20
+ */
21
+ export function credentialCollectionRuntime() {
22
+ runtime ?? (runtime = import('./collection-runtime.js'));
23
+ return runtime;
24
+ }
25
+ /**
26
+ * The row's resource id in the shape the rest of the applet uses for
27
+ * credentials: `credentials.ttl#<key>`. The collection's key is only the
28
+ * `resourceIdPattern` slot (`#{id}` → `openai-<uuid>`), so the document segment
29
+ * comes from the same models builder the store writes with.
30
+ */
31
+ export function credentialIdOfRow(row) {
32
+ return credentialResource.buildId({ id: String(row.id) });
33
+ }
34
+ /**
35
+ * Which provider a row belongs to, from the row's own `provider` relation.
36
+ *
37
+ * Rows have to be attributable without the store's help: a credential another
38
+ * device just wrote reaches this page as a live row, before any summary read
39
+ * has seen it.
40
+ */
41
+ export function providerOfCredentialRow(row) {
42
+ // `RowOf` carries an index signature (models types `fields` as
43
+ // `Record<string, PodModelFieldDescriptor>`), so a stale attribute name
44
+ // type-checks and reads back `undefined` at runtime instead of failing the
45
+ // build. `collections.test.ts` pins this read against a row whose id does not
46
+ // embed its provider, which is the only case the fallback below cannot answer.
47
+ const relation = typeof row.provider === 'string' ? row.provider : undefined;
48
+ const key = providerResourceKey(relation);
49
+ if (key) {
50
+ if (key.startsWith('custom-instance-'))
51
+ return 'custom';
52
+ const declared = AI_CONNECTIONS_PROVIDERS.find((provider) => key === provider || key.startsWith(`${provider}-`));
53
+ if (declared)
54
+ return declared;
55
+ }
56
+ // A row without a provider relation still declares one in its own key
57
+ // (`openai-<uuid>`); the store's reader falls back the same way.
58
+ return providerOfCredentialKey(String(row.id));
59
+ }
60
+ function stringValue(value) {
61
+ return typeof value === 'string' && value.trim() ? value : undefined;
62
+ }
63
+ function numberValue(value) {
64
+ if (typeof value === 'number' && Number.isFinite(value))
65
+ return value;
66
+ if (typeof value === 'string' && value.trim()) {
67
+ const parsed = Number(value);
68
+ return Number.isFinite(parsed) ? parsed : undefined;
69
+ }
70
+ return undefined;
71
+ }
72
+ function isoStringValue(value) {
73
+ if (value instanceof Date)
74
+ return value.toISOString();
75
+ return stringValue(value);
76
+ }
77
+ function authModeValue(value) {
78
+ if (value === 'oauth' || value === 'deviceCode' || value === 'apiKey' || value === 'local') {
79
+ return value;
80
+ }
81
+ if (value === 'deviceCodeOAuth')
82
+ return 'deviceCode';
83
+ return undefined;
84
+ }
85
+ /**
86
+ * A row as the page's credential summary.
87
+ *
88
+ * The row wins for everything the descriptor declares; `carrier` - the store's
89
+ * summary of the same credential - supplies the attributes the descriptor cannot
90
+ * project and the secret-derived hint. A row the store has not read yet (an
91
+ * optimistic insert) falls back to the descriptor's own defaults.
92
+ */
93
+ export function credentialSummaryFromRow(row, provider, carrier) {
94
+ const authMode = authModeValue(row.authMode) ?? carrier?.authMode ?? 'apiKey';
95
+ const status = stringValue(row.status);
96
+ // models 0.2.59 types this column as a boolean; a Pod written by an older
97
+ // release can still carry the literal as a string, so keep tolerating both.
98
+ const reauthRequired = row.reauthRequired === true || String(row.reauthRequired) === 'true';
99
+ return {
100
+ id: String(row.id),
101
+ provider,
102
+ offeringId: carrier?.offeringId ?? defaultOfferingFor(provider, authMode),
103
+ authMode,
104
+ label: stringValue(row.accountLabel) ?? stringValue(row.label) ?? carrier?.label,
105
+ enabled: status === undefined ? carrier?.enabled ?? true : status === 'active',
106
+ priority: carrier?.priority ?? 100,
107
+ health: reauthRequired ? 'expired' : carrier?.health ?? 'unknown',
108
+ maskedHint: carrier?.maskedHint,
109
+ baseUrl: carrier?.baseUrl,
110
+ proxyUrl: carrier?.proxyUrl,
111
+ compatibility: carrier?.compatibility,
112
+ expiresAt: isoStringValue(row.expiresAt) ?? carrier?.expiresAt,
113
+ version: numberValue(row.keyVersion) ?? carrier?.version ?? 0,
114
+ };
115
+ }
116
+ /** The provider's credential list, rebuilt from the live rows of one table document. */
117
+ export function credentialSummariesForProvider(provider, rows, carrier = []) {
118
+ const byId = new Map(carrier.map((credential) => [credential.id, credential]));
119
+ const summaries = [];
120
+ for (const row of rows) {
121
+ if (providerOfCredentialRow(row) !== provider)
122
+ continue;
123
+ summaries.push(credentialSummaryFromRow(row, provider, byId.get(String(row.id))));
124
+ }
125
+ return summaries;
126
+ }
127
+ /**
128
+ * The enrichment carrier per provider: the store's own summary of every
129
+ * credential, plus any credential a mutation of this session added and the store
130
+ * has not read back yet.
131
+ *
132
+ * The store's entries win where both know the same credential - it is the
133
+ * independent read - and the session's overlay only fills the gap, so a
134
+ * just-created row keeps its offering and base URL while it is still optimistic.
135
+ */
136
+ export function credentialCarriers(storeProducts, overlayProducts) {
137
+ const carriers = {};
138
+ for (const provider of AI_CONNECTIONS_PROVIDERS) {
139
+ const byId = new Map();
140
+ for (const credential of overlayProducts[provider]?.credentials ?? []) {
141
+ byId.set(credential.id, credential);
142
+ }
143
+ for (const credential of storeProducts[provider]?.credentials ?? []) {
144
+ byId.set(credential.id, credential);
145
+ }
146
+ carriers[provider] = [...byId.values()];
147
+ }
148
+ return carriers;
149
+ }
150
+ /**
151
+ * The provider products the page renders, with every credential list rebuilt
152
+ * from the live rows.
153
+ *
154
+ * `carriers` only enriches: which credentials exist, and every field the
155
+ * descriptor declares, come from the rows.
156
+ */
157
+ export function withLiveCredentials(products, carriers, rows) {
158
+ if (!rows)
159
+ return products;
160
+ const live = {};
161
+ for (const provider of AI_CONNECTIONS_PROVIDERS) {
162
+ const product = products[provider];
163
+ if (!product)
164
+ continue;
165
+ live[provider] = {
166
+ ...product,
167
+ credentials: credentialSummariesForProvider(provider, rows, carriers[provider] ?? []),
168
+ };
169
+ }
170
+ // Providers outside the catalog keep whatever the store reported: the page
171
+ // never renders them from this table.
172
+ return { ...products, ...live };
173
+ }
@@ -1,24 +1,42 @@
1
- import type { WebExtensionHost } from '@undefineds.co/extension-sdk/web';
2
- import { type AiConnectionsClient, type AiConnectionsMode, type AiConnectionsProvider, type AiProviderConnectionSummary, type AiProviderSummary } from './ai-connections-client';
1
+ import type { SolidLiveUpdateState, WebExtensionHost } from '@undefineds.co/extension-sdk/web';
2
+ import { type AiConnectionsClient, type AiConnectionsProvider, type AiProviderConnectionSummary, type AiProviderSummary } from './ai-connections-client';
3
3
  import type { AiClientConfigurationBridge } from './AiClientConfigurationSection';
4
+ import { type CredentialRow } from './collections';
5
+ import type { PodCollection } from '@undefineds.co/pod-collections';
4
6
  export interface AiProviderDefinition {
5
7
  id: AiConnectionsProvider;
6
8
  name: string;
7
- browserMode: AiConnectionsMode;
8
- browserLabel: string;
9
9
  description: string;
10
10
  homeUrl: string;
11
11
  apiKeyUrl?: string;
12
12
  apiKeyPlaceholder?: string;
13
13
  defaultBaseUrl?: string;
14
14
  }
15
+ /**
16
+ * Provider pages explain themselves through the header's ⓘ tooltip, so each
17
+ * description is one line of the same shape — where the models come from and how
18
+ * this deployment can be authorized — instead of a restatement of the name.
19
+ *
20
+ * Connect actions are deliberately absent here: which ways in exist is offering
21
+ * data (`authorizationMethods`), derived by the server per offering, and a
22
+ * provider-level label is exactly how a page could offer a 「登录」 no offering
23
+ * declares.
24
+ */
15
25
  export declare const PROVIDERS: AiProviderDefinition[];
16
26
  export type ProviderProductState = 'loading' | 'unconfigured' | 'configured' | 'connected' | 'attention';
17
27
  export declare const AI_CONNECTIONS_PINNED_SECTIONS: readonly [{
18
28
  readonly id: "keys";
19
- readonly label: "API Keys";
29
+ readonly label: "Xpod";
20
30
  readonly title: "API KEYS";
21
31
  }];
32
+ /**
33
+ * Coalescing window for Pod change signals.
34
+ *
35
+ * A notification only says "this document changed", so a burst of writes must
36
+ * cost one re-read, not one per write; the first signal arms a fixed window and
37
+ * everything arriving inside it is absorbed.
38
+ */
39
+ export declare const TABLE_CHANGE_COALESCE_MS = 75;
22
40
  export type AiConnectionsPinnedSection = typeof AI_CONNECTIONS_PINNED_SECTIONS[number]['id'];
23
41
  export type AiConnectionsWorkspaceSection = AiConnectionsPinnedSection | 'provider';
24
42
  export interface AiConnectionsController {
@@ -32,12 +50,47 @@ export interface AiConnectionsController {
32
50
  readonly providerStates: Partial<Record<AiConnectionsProvider, ProviderProductState>>;
33
51
  readonly providerSummaries: Partial<Record<AiConnectionsProvider, AiProviderSummary>>;
34
52
  readonly providerLoadError?: string;
53
+ /**
54
+ * Whether the Pod table documents this page renders are pushing changes.
55
+ *
56
+ * `unavailable` also covers a host that offers no live-update capability at
57
+ * all; either way the page keeps working from explicit reads.
58
+ */
59
+ readonly liveUpdates: SolidLiveUpdateState;
60
+ /**
61
+ * The live credentials table (`settings/credentials.ttl`), when the host
62
+ * exposes `podCollections` and the lazily loaded collection layer has landed.
63
+ * The page renders its rows; the controller's own live-revision refresh does
64
+ * not watch that document while this is present.
65
+ */
66
+ readonly credentialsCollection?: PodCollection<CredentialRow>;
67
+ /**
68
+ * The collection's rows as its own change feed reports them, or `undefined`
69
+ * while the layer is still loading, when the host offers no collection, or
70
+ * after a failed first read. This is what the credentials list renders (and
71
+ * what makes every credential write optimistic).
72
+ */
73
+ readonly credentialRows?: readonly CredentialRow[];
74
+ /**
75
+ * Advances once per coalesced burst of changes to those documents. Pages
76
+ * re-read through the loaders they already have when it changes.
77
+ */
78
+ readonly liveRevision: number;
35
79
  selectSection(section: AiConnectionsPinnedSection): void;
36
80
  selectProvider(provider: AiConnectionsProvider, credentialId?: string): void;
37
81
  selectFirstUnconfiguredProvider(): void;
38
82
  setSearchQuery(value: string): void;
39
83
  setProviderState(provider: AiConnectionsProvider, state: ProviderProductState): void;
40
84
  loadProviders(): Promise<void>;
85
+ /**
86
+ * Watches the table documents the open page renders: the credentials table
87
+ * plus the open provider's document.
88
+ *
89
+ * Re-entrant and idempotent, so React StrictMode's setup/cleanup/setup cycle
90
+ * stays harmless; releasing the last hold leaves no channel and no socket
91
+ * behind for this page.
92
+ */
93
+ watchPageTables(): () => void;
41
94
  cancelProviderLoads(): void;
42
95
  subscribe(listener: () => void): () => void;
43
96
  }
@@ -48,5 +101,18 @@ export declare function useSelectedCredentialId(controller: AiConnectionsControl
48
101
  export declare function useProviderSearch(controller: AiConnectionsController): string;
49
102
  export declare function useProviderStates(controller: AiConnectionsController): Partial<Record<AiConnectionsProvider, ProviderProductState>>;
50
103
  export declare function useProviderSummaries(controller: AiConnectionsController): Partial<Record<AiConnectionsProvider, AiProviderConnectionSummary>>;
104
+ /**
105
+ * Providers this deployment offers, as reported by the server.
106
+ *
107
+ * Cloud answers with the operator-designated providers only (no self-hosted
108
+ * `custom`, no local daemon), so the settings surface cannot offer a provider the
109
+ * deployment does not provide. Before the first successful load this is
110
+ * `undefined`, which keeps every provider visible (Local behavior).
111
+ */
112
+ export declare function useAvailableProviders(controller: AiConnectionsController): AiConnectionsProvider[] | undefined;
51
113
  export declare function useProviderProducts(controller: AiConnectionsController): Partial<Record<AiConnectionsProvider, AiProviderSummary>>;
52
114
  export declare function useProviderLoadError(controller: AiConnectionsController): string | undefined;
115
+ /** Whether live Pod updates are on, for a status affordance that stays small. */
116
+ export declare function useLiveUpdates(controller: AiConnectionsController): SolidLiveUpdateState;
117
+ /** Advances once per coalesced burst of Pod changes; drives page re-reads. */
118
+ export declare function useLiveRevision(controller: AiConnectionsController): number;