@undefineds.co/xpod 0.4.12 → 0.4.14

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 (272) hide show
  1. package/config/components-ignore.json +11 -7
  2. package/dist/acceptance/QleverSemanticConformance.js +7 -0
  3. package/dist/api/ai-gateway/providers/OfferingAuthorization.d.ts +6 -1
  4. package/dist/api/ai-gateway/providers/OfferingAuthorization.js +0 -3
  5. package/dist/api/ai-gateway/providers/ProviderRegistry.js +1 -1
  6. package/dist/api/container/index.js +1 -0
  7. package/dist/api/container/local.js +30 -12
  8. package/dist/api/container/routes.js +2 -0
  9. package/dist/api/container/types.d.ts +2 -0
  10. package/dist/api/handlers/AdminHandler.d.ts +17 -1
  11. package/dist/api/handlers/AdminHandler.js +40 -3
  12. package/dist/api/handlers/EdgeNodeSignalHandler.js +10 -2
  13. package/dist/api/handlers/NetworkSettingsHandler.d.ts +37 -5
  14. package/dist/api/handlers/NetworkSettingsHandler.js +39 -11
  15. package/dist/api/handlers/ProvisionHandler.d.ts +6 -1
  16. package/dist/api/handlers/ProvisionHandler.js +7 -2
  17. package/dist/api/handlers/ReachabilityHandler.d.ts +6 -0
  18. package/dist/api/handlers/ReachabilityHandler.js +22 -5
  19. package/dist/api/network/NetworkEnvironmentConfigurationStore.d.ts +6 -1
  20. package/dist/api/network/NetworkEnvironmentConfigurationStore.js +72 -16
  21. package/dist/api/runtime.d.ts +9 -0
  22. package/dist/api/runtime.js +15 -2
  23. package/dist/cli/commands/start.d.ts +19 -1
  24. package/dist/cli/commands/start.js +71 -5
  25. package/dist/components/context.jsonld +30 -0
  26. package/dist/edge/EdgeNodeAgent.d.ts +6 -0
  27. package/dist/edge/EdgeNodeAgent.js +1 -1
  28. package/dist/edge/EdgeNodeAgentInitializer.d.ts +2 -0
  29. package/dist/edge/EdgeNodeAgentInitializer.js +1 -0
  30. package/dist/edge/EdgeNodeAgentInitializer.jsonld +19 -0
  31. package/dist/edge/EdgeNodeDnsCoordinator.d.ts +11 -1
  32. package/dist/edge/EdgeNodeDnsCoordinator.js +12 -2
  33. package/dist/edge/EdgeNodeHealthProbeService.d.ts +15 -0
  34. package/dist/edge/EdgeNodeHealthProbeService.js +44 -12
  35. package/dist/edge/EdgeNodeHealthProbeService.jsonld +77 -0
  36. package/dist/edge/ProbeTargetGuard.d.ts +35 -0
  37. package/dist/edge/ProbeTargetGuard.js +142 -0
  38. package/dist/edge/reachability/NodeAccessResolver.d.ts +16 -0
  39. package/dist/edge/reachability/NodeAccessResolver.js +30 -0
  40. package/dist/index.d.ts +3 -1
  41. package/dist/index.js +9 -3
  42. package/dist/main.js +7 -0
  43. package/dist/runtime/Proxy.d.ts +22 -0
  44. package/dist/runtime/Proxy.js +34 -7
  45. package/dist/runtime/bootstrap.d.ts +11 -0
  46. package/dist/runtime/bootstrap.js +21 -1
  47. package/dist/runtime/css-process.d.ts +1 -0
  48. package/dist/runtime/css-process.js +1 -0
  49. package/dist/runtime/host/node/NodeRuntimeHost.js +4 -1
  50. package/dist/runtime/host/types.d.ts +6 -0
  51. package/dist/runtime/index.d.ts +1 -1
  52. package/dist/runtime/index.js +5 -1
  53. package/dist/runtime/lifecycle.js +1 -0
  54. package/dist/runtime/port-finder.d.ts +30 -0
  55. package/dist/runtime/port-finder.js +83 -0
  56. package/dist/runtime/runner/node/NodeGatewayRuntimeRunner.js +1 -0
  57. package/dist/runtime/runner/types.d.ts +5 -0
  58. package/dist/runtime/runtime-types.d.ts +1 -0
  59. package/dist/storage/rdf/PostgresRdfEngine.js +10 -4
  60. package/dist/storage/rdf/RdfAccessScope.js +15 -1
  61. package/dist/storage/rdf/RdfEngineRdfJsSource.js +10 -2
  62. package/dist/test-utils/local-managed-client-p2p-e2e-smoke.js +1 -1
  63. package/dist/tunnel/LocalTunnelProvider.d.ts +15 -0
  64. package/dist/tunnel/LocalTunnelProvider.js +87 -18
  65. package/dist/tunnel/LocalTunnelProvider.jsonld +27 -0
  66. package/dist/tunnel/NgrokTunnelProvider.d.ts +4 -0
  67. package/dist/tunnel/NgrokTunnelProvider.js +117 -43
  68. package/dist/tunnel/NgrokTunnelProvider.jsonld +4 -0
  69. package/dist/tunnel/SakuraFrpTunnelProvider.d.ts +65 -3
  70. package/dist/tunnel/SakuraFrpTunnelProvider.js +268 -25
  71. package/dist/tunnel/TunnelLifecycle.d.ts +14 -0
  72. package/dist/tunnel/TunnelLifecycle.js +34 -0
  73. package/dist/tunnel/TunnelProfiles.d.ts +33 -3
  74. package/dist/tunnel/TunnelProfiles.js +105 -78
  75. package/dist/tunnel/TunnelProvider.d.ts +15 -2
  76. package/dist/tunnel/TunnelProvider.jsonld +8 -0
  77. package/dist/tunnel/TunnelProviderCatalog.d.ts +62 -0
  78. package/dist/tunnel/TunnelProviderCatalog.js +130 -0
  79. package/node_modules/@undefineds.co/ai-connections/dist/AiApiKeyPool.d.ts +1 -1
  80. package/node_modules/@undefineds.co/ai-connections/dist/AiApiKeyPool.js +1 -1
  81. package/node_modules/@undefineds.co/ai-connections/dist/AiAuthorizationActions.d.ts +1 -1
  82. package/node_modules/@undefineds.co/ai-connections/dist/AiClientConfigurationSection.d.ts +1 -1
  83. package/node_modules/@undefineds.co/ai-connections/dist/AiClientConfigurationSection.js +3 -3
  84. package/node_modules/@undefineds.co/ai-connections/dist/AiConnectDialog.d.ts +1 -1
  85. package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsPanel.d.ts +1 -1
  86. package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsPanel.js +2 -2
  87. package/node_modules/@undefineds.co/ai-connections/dist/AiCredentialPoolSection.d.ts +1 -1
  88. package/node_modules/@undefineds.co/ai-connections/dist/AiCredentialRow.d.ts +1 -1
  89. package/node_modules/@undefineds.co/ai-connections/dist/AiCustomProviderDialog.d.ts +1 -1
  90. package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayKeyRow.d.ts +1 -1
  91. package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayKeysSection.d.ts +1 -1
  92. package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayModelsSection.d.ts +1 -1
  93. package/node_modules/@undefineds.co/ai-connections/dist/AiOfferingDetails.d.ts +1 -1
  94. package/node_modules/@undefineds.co/ai-connections/dist/AiProviderCard.d.ts +1 -1
  95. package/node_modules/@undefineds.co/ai-connections/dist/AiQuotaCard.d.ts +1 -1
  96. package/node_modules/@undefineds.co/ai-connections/dist/AiSortableCredentialList.d.ts +1 -1
  97. package/node_modules/@undefineds.co/ai-connections/dist/authorization-methods.d.ts +13 -11
  98. package/node_modules/@undefineds.co/ai-connections/dist/authorization-methods.js +16 -13
  99. package/node_modules/@undefineds.co/ai-connections/dist/collection-runtime.d.ts +1 -1
  100. package/node_modules/@undefineds.co/ai-connections/dist/collection-runtime.js +3 -3
  101. package/node_modules/@undefineds.co/ai-connections/dist/collections.d.ts +1 -1
  102. package/node_modules/@undefineds.co/ai-connections/dist/collections.js +3 -3
  103. package/node_modules/@undefineds.co/ai-connections/dist/{ai-connections-client.d.ts → contract/ai-connections-client.d.ts} +4 -2
  104. package/node_modules/@undefineds.co/ai-connections/dist/{ai-connections-client.js → contract/ai-connections-client.js} +4 -2
  105. package/node_modules/@undefineds.co/ai-connections/dist/{client → contract/client}/normalize.d.ts +17 -7
  106. package/node_modules/@undefineds.co/ai-connections/dist/{client → contract/client}/normalize.js +18 -213
  107. package/node_modules/@undefineds.co/ai-connections/dist/{client → contract/client}/request.js +3 -3
  108. package/node_modules/@undefineds.co/ai-connections/dist/{client → contract/client}/types.d.ts +11 -2
  109. package/node_modules/@undefineds.co/ai-connections/dist/{client-config → contract/client-config}/index.cjs +8 -8
  110. package/node_modules/@undefineds.co/ai-connections/dist/contract/index.d.ts +9 -0
  111. package/node_modules/@undefineds.co/ai-connections/dist/contract/index.js +9 -0
  112. package/node_modules/@undefineds.co/ai-connections/dist/{provider-catalog.cjs → contract/provider-catalog.cjs} +5 -28
  113. package/node_modules/@undefineds.co/ai-connections/dist/{provider-catalog.d.ts → contract/provider-catalog.d.ts} +9 -8
  114. package/node_modules/@undefineds.co/ai-connections/dist/{provider-catalog.js → contract/provider-catalog.js} +11 -31
  115. package/node_modules/@undefineds.co/ai-connections/dist/controller.d.ts +1 -1
  116. package/node_modules/@undefineds.co/ai-connections/dist/controller.js +3 -2
  117. package/node_modules/@undefineds.co/ai-connections/dist/credential-labels.d.ts +1 -1
  118. package/node_modules/@undefineds.co/ai-connections/dist/display-wording.d.ts +20 -0
  119. package/node_modules/@undefineds.co/ai-connections/dist/display-wording.js +73 -0
  120. package/node_modules/@undefineds.co/ai-connections/dist/error-wording.d.ts +24 -0
  121. package/node_modules/@undefineds.co/ai-connections/dist/error-wording.js +253 -0
  122. package/node_modules/@undefineds.co/ai-connections/dist/gateway-endpoints.js +1 -1
  123. package/node_modules/@undefineds.co/ai-connections/dist/index.d.ts +2 -3
  124. package/node_modules/@undefineds.co/ai-connections/dist/index.js +2 -3
  125. package/node_modules/@undefineds.co/ai-connections/dist/offering-endpoints.d.ts +1 -1
  126. package/node_modules/@undefineds.co/ai-connections/dist/offering-label.d.ts +1 -1
  127. package/node_modules/@undefineds.co/ai-connections/dist/provider-visuals.d.ts +1 -1
  128. package/node_modules/@undefineds.co/ai-connections/dist/service-access.js +1 -1
  129. package/node_modules/@undefineds.co/ai-connections/dist/useAiConnectDialog.d.ts +1 -1
  130. package/node_modules/@undefineds.co/ai-connections/package.json +25 -18
  131. package/node_modules/@undefineds.co/shared-ui/dist/index.d.ts +4 -2
  132. package/node_modules/@undefineds.co/shared-ui/dist/index.js +4 -2
  133. package/node_modules/@undefineds.co/shared-ui/dist/login/LoginModal.d.ts +4 -1
  134. package/node_modules/@undefineds.co/shared-ui/dist/login/LoginModal.js +12 -6
  135. package/node_modules/@undefineds.co/shared-ui/dist/login/LoginView.d.ts +1 -1
  136. package/node_modules/@undefineds.co/shared-ui/dist/login/host-types.d.ts +7 -1
  137. package/node_modules/@undefineds.co/shared-ui/dist/login/login-branding.d.ts +6 -0
  138. package/node_modules/@undefineds.co/shared-ui/dist/login/login-branding.js +18 -0
  139. package/node_modules/@undefineds.co/shared-ui/dist/user-facing-errors.d.ts +14 -2
  140. package/node_modules/@undefineds.co/shared-ui/dist/user-facing-errors.js +26 -17
  141. package/node_modules/@undefineds.co/solid-sdk/dist/login-store.d.ts +3 -3
  142. package/node_modules/@undefineds.co/solid-sdk/dist/login-store.js +3 -3
  143. package/package.json +4 -3
  144. package/static/auth-callback/assets/{AiConfigContext-DnQs1ZpW.js → AiConfigContext-DCXpjzpj.js} +1 -1
  145. package/static/auth-callback/assets/{AiConfigPage-DOtvlxH0.js → AiConfigPage-fe-xMIXa.js} +1 -1
  146. package/static/auth-callback/assets/{DocumentProcessingPanel-BS2voQgL.js → DocumentProcessingPanel-BGnkfMuU.js} +1 -1
  147. package/static/auth-callback/assets/{IndexLifecyclePanel-Cvt0cJtN.js → IndexLifecyclePanel-42Jups0j.js} +1 -1
  148. package/static/auth-callback/assets/{IndexSubjectPanel-Dhf01GqF.js → IndexSubjectPanel-CYyLOlQU.js} +1 -1
  149. package/static/auth-callback/assets/{ModelAssignmentsPanel-BJutWaAF.js → ModelAssignmentsPanel-BOvUH4yr.js} +1 -1
  150. package/static/auth-callback/assets/{ModelsPage-BRS0sje3.js → ModelsPage-DwyITxt7.js} +6 -6
  151. package/static/auth-callback/assets/NetworkPage-CG9RelJA.js +2 -0
  152. package/static/auth-callback/assets/{PaneListHeader-QQeJGTp4.js → PaneListHeader-yvd5ohs6.js} +1 -1
  153. package/static/auth-callback/assets/{SearchIndexingPanel-MyNUSEwT.js → SearchIndexingPanel-2_a6ezzj.js} +1 -1
  154. package/static/auth-callback/assets/{StatusSubjectPanel-DQkEVsFs.js → StatusSubjectPanel-8qtVxnzC.js} +1 -1
  155. package/static/auth-callback/assets/{StatusWorkspace-Dkv63Uwk.js → StatusWorkspace-CBdRahCF.js} +1 -1
  156. package/static/auth-callback/assets/{SystemSettingsPage-TIsUfX5d.js → SystemSettingsPage-BZJ6vWkg.js} +1 -1
  157. package/static/auth-callback/assets/{SystemSettingsSubjectPanel-BJWEt2-7.js → SystemSettingsSubjectPanel-xm08UhXP.js} +1 -1
  158. package/static/auth-callback/assets/XpodAiConnectionsPodStore-V6vgGfuw.js +3 -0
  159. package/static/auth-callback/assets/{activity-5hNeNKnL.js → activity-CeM7xly8.js} +1 -1
  160. package/static/auth-callback/assets/ai-connections-C6yaE6WQ.js +1 -0
  161. package/static/auth-callback/assets/{auth-callback-CAFZ3R0B.js → auth-callback-DTG8cSj7.js} +3 -3
  162. package/static/auth-callback/assets/{badge-CAIPI0CB.js → badge-qJo2Zr4d.js} +1 -1
  163. package/static/auth-callback/assets/{collection-runtime-D9s7h9YA.js → collection-runtime-Bztsz31a.js} +1 -1
  164. package/static/auth-callback/assets/{dialog-BjA109aX.js → dialog-D-h6x5x0.js} +1 -1
  165. package/static/auth-callback/assets/{download-B3Up5W2G.js → download-C2ir4lmR.js} +1 -1
  166. package/static/auth-callback/assets/{external-link-BTXgSPzB.js → external-link-THLDL4On.js} +1 -1
  167. package/static/auth-callback/assets/{index-CirW4CJf.js → index-BRpv4yO3.js} +1 -1
  168. package/static/auth-callback/assets/{index-BppXlxcp.js → index-BlVZb9A7.js} +1 -1
  169. package/static/auth-callback/assets/index-D983R1FV.js +4 -0
  170. package/static/auth-callback/assets/{index-browser-DtU38ni3.js → index-browser-3FvR0aaf.js} +1 -1
  171. package/static/auth-callback/assets/{key-round-CQCOrZ7x.js → key-round-C9U5j1Ly.js} +1 -1
  172. package/static/auth-callback/assets/{rotate-ccw-C1zM2KtS.js → rotate-ccw-DP45cD4o.js} +1 -1
  173. package/static/auth-callback/assets/{skeleton-Cqp7_M9-.js → skeleton-Dn4EiSCS.js} +1 -1
  174. package/static/auth-callback/assets/{waypoints-Bj6gAUSQ.js → waypoints-uqFQ3uEG.js} +1 -1
  175. package/static/auth-callback/assets/{workspace-layout-DK8mDzrY.js → workspace-layout-DLYK0Wwu.js} +1 -1
  176. package/static/auth-callback/auth-callback.html +1 -1
  177. package/static/dashboard/assets/{AiConfigContext-BsE7MqX8.js → AiConfigContext-DJcMECNw.js} +1 -1
  178. package/static/dashboard/assets/{AiConfigPage-DvM-lRXa.js → AiConfigPage-BvE7dOTy.js} +1 -1
  179. package/static/dashboard/assets/{DocumentProcessingPanel-BPfdlfuf.js → DocumentProcessingPanel-D9780krf.js} +1 -1
  180. package/static/dashboard/assets/{IndexLifecyclePanel--m0AGxvh.js → IndexLifecyclePanel-SjsUcnbM.js} +1 -1
  181. package/static/dashboard/assets/{IndexSubjectPanel-Bb7m1k3d.js → IndexSubjectPanel-C-ym2Tqi.js} +1 -1
  182. package/static/dashboard/assets/{ModelAssignmentsPanel-BLi_zbMa.js → ModelAssignmentsPanel-BRjZ-arB.js} +1 -1
  183. package/static/dashboard/assets/{ModelsPage-CxdpgnfR.js → ModelsPage-BtTU6du3.js} +6 -6
  184. package/static/dashboard/assets/NetworkPage-CV9qpkDg.js +2 -0
  185. package/static/dashboard/assets/{PaneListHeader-BBCMei0r.js → PaneListHeader-KyPTTBsv.js} +1 -1
  186. package/static/dashboard/assets/{SearchIndexingPanel-Ck4Y-xjR.js → SearchIndexingPanel-DolHGawg.js} +1 -1
  187. package/static/dashboard/assets/{StatusSubjectPanel-D1KWfAXE.js → StatusSubjectPanel-_YZvKiYi.js} +1 -1
  188. package/static/dashboard/assets/{StatusWorkspace-JbA5gzXx.js → StatusWorkspace-Dlbh_G40.js} +1 -1
  189. package/static/dashboard/assets/{SystemSettingsPage-BbwQWsSR.js → SystemSettingsPage-Be7QSIoz.js} +1 -1
  190. package/static/dashboard/assets/{SystemSettingsSubjectPanel-N117nMt5.js → SystemSettingsSubjectPanel-DBp0gja7.js} +1 -1
  191. package/static/dashboard/assets/{XpodAiConnectionsPodStore-CdDOb4SV.js → XpodAiConnectionsPodStore-ClpSjzpP.js} +7 -7
  192. package/static/dashboard/assets/{activity-DX1I96o_.js → activity-lsNbTXJu.js} +1 -1
  193. package/static/dashboard/assets/ai-connections-CXp5gd1J.js +1 -0
  194. package/static/dashboard/assets/{badge-k2vhtDqH.js → badge-CVatKjaG.js} +1 -1
  195. package/static/dashboard/assets/{collection-runtime-BFQ8teQJ.js → collection-runtime-Ec4UnY28.js} +1 -1
  196. package/static/dashboard/assets/{dashboard-DWZ-fmCT.js → dashboard-BEzsRsvF.js} +2 -2
  197. package/static/dashboard/assets/{dialog-1CCw-iHT.js → dialog-BuyelQ4V.js} +1 -1
  198. package/static/dashboard/assets/{download-C6-SNY1q.js → download-B4Nf678F.js} +1 -1
  199. package/static/dashboard/assets/{external-link-BgPcZ_j2.js → external-link-PYv9CvKL.js} +1 -1
  200. package/static/dashboard/assets/index-C9XPE-mI.js +4 -0
  201. package/static/dashboard/assets/{index-D7A8U6Pt.js → index-Cx69bTNh.js} +1 -1
  202. package/static/dashboard/assets/{index-6LcIUIYO.js → index-awr7ulur.js} +1 -1
  203. package/static/dashboard/assets/{key-round-BOd7Jo0Q.js → key-round-VsY80U1Z.js} +1 -1
  204. package/static/dashboard/assets/{rotate-ccw-CCgJqsvx.js → rotate-ccw-Cz1K4vE9.js} +1 -1
  205. package/static/dashboard/assets/{skeleton-Bc7abAn5.js → skeleton-BhNv_8tO.js} +1 -1
  206. package/static/dashboard/assets/{waypoints-s-opmJxx.js → waypoints-DYS9XFYV.js} +1 -1
  207. package/static/dashboard/assets/{workspace-layout-DqIQeTBV.js → workspace-layout-OZJAFx5V.js} +1 -1
  208. package/static/dashboard/dashboard.html +1 -1
  209. package/static/settings/assets/{AiConfigContext-BB9KZySa.js → AiConfigContext-B8JS3MXF.js} +1 -1
  210. package/static/settings/assets/{AiConfigPage-DGSXUkLs.js → AiConfigPage-C3Zl8LUl.js} +1 -1
  211. package/static/settings/assets/{DocumentProcessingPanel-Da2Re6Rg.js → DocumentProcessingPanel-DpDZAQvf.js} +1 -1
  212. package/static/settings/assets/{IndexLifecyclePanel-BSZuIzgr.js → IndexLifecyclePanel-Ec1XF88t.js} +1 -1
  213. package/static/settings/assets/{IndexSubjectPanel-CFd0ay-r.js → IndexSubjectPanel-BulT9BmO.js} +1 -1
  214. package/static/settings/assets/{ModelAssignmentsPanel-CSAryvWJ.js → ModelAssignmentsPanel-BcGSmYjb.js} +1 -1
  215. package/static/settings/assets/{ModelsPage-BQwCwLHU.js → ModelsPage-CvTCKy1T.js} +6 -6
  216. package/static/settings/assets/NetworkPage-DQF5u9Bn.js +2 -0
  217. package/static/settings/assets/{PaneListHeader-Bjh3hRdQ.js → PaneListHeader-D40hqcVl.js} +1 -1
  218. package/static/settings/assets/{SearchIndexingPanel-MjKL5QLU.js → SearchIndexingPanel-iCUPOx_0.js} +1 -1
  219. package/static/settings/assets/{StatusSubjectPanel-Bvl6K4mx.js → StatusSubjectPanel-E--ZHSql.js} +1 -1
  220. package/static/settings/assets/{StatusWorkspace-B0NzrP--.js → StatusWorkspace-YjDAx1II.js} +1 -1
  221. package/static/settings/assets/{SystemSettingsPage-D2z6Z4FE.js → SystemSettingsPage-CDdV3mC9.js} +1 -1
  222. package/static/settings/assets/{SystemSettingsSubjectPanel-4sxma4X4.js → SystemSettingsSubjectPanel-Br8WazDq.js} +1 -1
  223. package/static/settings/assets/XpodAiConnectionsPodStore-CLr38P_Z.js +3 -0
  224. package/static/settings/assets/{activity-CgJJGpjx.js → activity-C5DAHHTE.js} +1 -1
  225. package/static/settings/assets/ai-connections-C6yaE6WQ.js +1 -0
  226. package/static/settings/assets/{badge-C4NypVyT.js → badge-D8eIyxKt.js} +1 -1
  227. package/static/settings/assets/{collection-runtime-CTLCDxAi.js → collection-runtime-DLc9zil8.js} +1 -1
  228. package/static/settings/assets/{dialog-Csq0vWUi.js → dialog-CyuR7Va4.js} +1 -1
  229. package/static/settings/assets/{download-DaLJJ-Wp.js → download-c0oxZrCz.js} +1 -1
  230. package/static/settings/assets/{external-link--w_iW5Au.js → external-link-D3Z34fP_.js} +1 -1
  231. package/static/settings/assets/{index-BukHiu4y.js → index-CKGbRFlc.js} +1 -1
  232. package/static/settings/assets/index-CSr3-2Cj.js +4 -0
  233. package/static/settings/assets/{index-COmVnZi2.js → index-ComidxAm.js} +1 -1
  234. package/static/settings/assets/{index-browser-BGpvHwD0.js → index-browser-CAscEbae.js} +1 -1
  235. package/static/settings/assets/{key-round-Bk4YRjBu.js → key-round-DyjLmXuB.js} +1 -1
  236. package/static/settings/assets/{rotate-ccw-TCabbqsr.js → rotate-ccw-679HF_ec.js} +1 -1
  237. package/static/settings/assets/{settings-CJWpdbNC.js → settings-DKknqu4C.js} +3 -3
  238. package/static/settings/assets/{skeleton-JDHYVe7t.js → skeleton-CkopNkPB.js} +1 -1
  239. package/static/settings/assets/{waypoints-DDvEl-MU.js → waypoints-CrqfAftE.js} +1 -1
  240. package/static/settings/assets/{workspace-layout-DV5QU30U.js → workspace-layout-UN6c4qTG.js} +1 -1
  241. package/static/settings/settings.html +1 -1
  242. package/static/auth-callback/assets/NetworkPage-B3qBfANA.js +0 -2
  243. package/static/auth-callback/assets/XpodAiConnectionsPodStore-BJiXm-PF.js +0 -3
  244. package/static/auth-callback/assets/ai-connections-CryuHGKW.js +0 -1
  245. package/static/auth-callback/assets/index-DlLYWOhw.js +0 -4
  246. package/static/dashboard/assets/NetworkPage-BAIPw-D_.js +0 -2
  247. package/static/dashboard/assets/ai-connections-DwCRqOQa.js +0 -1
  248. package/static/dashboard/assets/index-UD6QOE7H.js +0 -4
  249. package/static/settings/assets/NetworkPage-BKymvsQc.js +0 -2
  250. package/static/settings/assets/XpodAiConnectionsPodStore-BkNQ8fZx.js +0 -3
  251. package/static/settings/assets/ai-connections-CryuHGKW.js +0 -1
  252. package/static/settings/assets/index-B0mQa59b.js +0 -4
  253. /package/node_modules/@undefineds.co/ai-connections/dist/{client → contract/client}/request.d.ts +0 -0
  254. /package/node_modules/@undefineds.co/ai-connections/dist/{client → contract/client}/types.js +0 -0
  255. /package/node_modules/@undefineds.co/ai-connections/dist/{client-config → contract/client-config}/base-adapter.d.ts +0 -0
  256. /package/node_modules/@undefineds.co/ai-connections/dist/{client-config → contract/client-config}/base-adapter.js +0 -0
  257. /package/node_modules/@undefineds.co/ai-connections/dist/{client-config → contract/client-config}/codex.d.ts +0 -0
  258. /package/node_modules/@undefineds.co/ai-connections/dist/{client-config → contract/client-config}/codex.js +0 -0
  259. /package/node_modules/@undefineds.co/ai-connections/dist/{client-config → contract/client-config}/index.d.ts +0 -0
  260. /package/node_modules/@undefineds.co/ai-connections/dist/{client-config → contract/client-config}/index.js +0 -0
  261. /package/node_modules/@undefineds.co/ai-connections/dist/{client-config → contract/client-config}/json-env-adapter.d.ts +0 -0
  262. /package/node_modules/@undefineds.co/ai-connections/dist/{client-config → contract/client-config}/json-env-adapter.js +0 -0
  263. /package/node_modules/@undefineds.co/ai-connections/dist/{client-config → contract/client-config}/pi.d.ts +0 -0
  264. /package/node_modules/@undefineds.co/ai-connections/dist/{client-config → contract/client-config}/pi.js +0 -0
  265. /package/node_modules/@undefineds.co/ai-connections/dist/{client-config → contract/client-config}/transaction.d.ts +0 -0
  266. /package/node_modules/@undefineds.co/ai-connections/dist/{client-config → contract/client-config}/transaction.js +0 -0
  267. /package/node_modules/@undefineds.co/ai-connections/dist/{client-config → contract/client-config}/types.d.ts +0 -0
  268. /package/node_modules/@undefineds.co/ai-connections/dist/{client-config → contract/client-config}/types.js +0 -0
  269. /package/node_modules/@undefineds.co/ai-connections/dist/{credential-storage.d.ts → contract/credential-storage.d.ts} +0 -0
  270. /package/node_modules/@undefineds.co/ai-connections/dist/{credential-storage.js → contract/credential-storage.js} +0 -0
  271. /package/node_modules/@undefineds.co/ai-connections/dist/{endpoint-urls.d.ts → contract/endpoint-urls.d.ts} +0 -0
  272. /package/node_modules/@undefineds.co/ai-connections/dist/{endpoint-urls.js → contract/endpoint-urls.js} +0 -0
@@ -1,4 +1,4 @@
1
- import type { GatewayKeyRecord } from './ai-connections-client';
1
+ import type { GatewayKeyRecord } from './contract/ai-connections-client';
2
2
  import { type AiConnectionsClientId } from './AiClientConfigurationSection';
3
3
  export interface AiGatewayKeyBinding {
4
4
  clientId?: AiConnectionsClientId;
@@ -1,4 +1,4 @@
1
- import type { AiConnectionsClient, AiGatewayModel } from './ai-connections-client';
1
+ import type { AiConnectionsClient, AiGatewayModel } from './contract/ai-connections-client';
2
2
  import { type AiClientConfigurationBridge } from './AiClientConfigurationSection';
3
3
  import { type GatewayModelSelection } from './AiGatewayModelsSection';
4
4
  /**
@@ -1,4 +1,4 @@
1
- import type { AiGatewayModel } from './ai-connections-client';
1
+ import type { AiGatewayModel } from './contract/ai-connections-client';
2
2
  /**
3
3
  * What the gateway list shares with the provider pages.
4
4
  *
@@ -1,4 +1,4 @@
1
- import type { AiProviderAuthorizationMethod, AiProviderOffering } from './ai-connections-client';
1
+ import type { AiProviderAuthorizationMethod, AiProviderOffering } from './contract/ai-connections-client';
2
2
  export declare function AiOfferingDetails({ offering, methods }: {
3
3
  offering: AiProviderOffering;
4
4
  methods?: AiProviderAuthorizationMethod[];
@@ -1,4 +1,4 @@
1
- import type { AiConnectAttempt, AiConnectionsMode, AiGatewayModel, AiProviderCredentialSummary, AiProviderAuthorizationMethod, AiProviderOffering, AiProviderSummary } from './ai-connections-client';
1
+ import type { AiConnectAttempt, AiConnectionsMode, AiGatewayModel, AiProviderCredentialSummary, AiProviderAuthorizationMethod, AiProviderOffering, AiProviderSummary } from './contract/ai-connections-client';
2
2
  import { type AiOfferingActionError, type AiOfferingQuotaState } from './AiCredentialPoolSection';
3
3
  export type { AiProviderDefinition } from './controller';
4
4
  import type { AiProviderDefinition } from './controller';
@@ -1,4 +1,4 @@
1
- import type { AiQuotaSnapshot } from './ai-connections-client';
1
+ import type { AiQuotaSnapshot } from './contract/ai-connections-client';
2
2
  export declare function AiQuotaCard({ providerName, offeringName, quota, busy, disabled, credentialLabel, multiple, compact, paused, error, onRefresh, }: {
3
3
  providerName: string;
4
4
  offeringName: string;
@@ -1,5 +1,5 @@
1
1
  import { type ReactNode } from 'react';
2
- import type { AiProviderCredentialSummary } from './ai-connections-client';
2
+ import type { AiProviderCredentialSummary } from './contract/ai-connections-client';
3
3
  export declare function AiSortableCredentialList({ credentials, disabled, onMove, children }: {
4
4
  credentials: AiProviderCredentialSummary[];
5
5
  disabled: boolean;
@@ -1,16 +1,18 @@
1
- import type { AiConnectAttempt, AiConnectionsMode, AiProviderAuthorizationMethod, AiProviderOffering } from './ai-connections-client';
1
+ import type { AiConnectAttempt, AiConnectionsMode, AiProviderAuthorizationMethod, AiProviderOffering } from './contract/ai-connections-client';
2
2
  /**
3
- * Authorization methods an offering exposes. An offering that declares them
4
- * keeps that list - including an empty one, which is how the server says "this
5
- * offering has no connect entry here" instead of publishing an entry that
6
- * cannot be used. The rest derive one method per entry of `authModes`, which is
7
- * what a payload without the field (a catalog consumer that never asked the
8
- * server) falls back to.
3
+ * Authorization methods an offering exposes, worded for display.
9
4
  *
10
- * The derivation is therefore a fallback for payloads that carry no
11
- * `authorizationMethods` at all, so it must stay a projection of the offering's
12
- * own data: no label is invented for a provider, and the wording mirrors the
13
- * server's own naming for the same `authModes`.
5
+ * An offering that declares them keeps that list - including an empty one, which
6
+ * is how the server says "this offering has no connect entry here" instead of
7
+ * publishing an entry that cannot be used. The rest derive one method per entry
8
+ * of `authModes`, which is what a payload without the field (a catalog consumer
9
+ * that never asked the server) falls back to.
10
+ *
11
+ * Neither branch carries wording of its own: every path that renders a connect
12
+ * entry goes through here, so this is the one place the applet's wording table
13
+ * is applied, and an entry the table does not know keeps whatever the payload
14
+ * declared - or stays unrendered, which is how "the offering did not ask for
15
+ * this button" has always been said.
14
16
  */
15
17
  export declare function authorizationMethodsForOffering(offering: AiProviderOffering): AiProviderAuthorizationMethod[];
16
18
  export declare function connectModeForMethod(method: AiProviderAuthorizationMethod): AiConnectionsMode | undefined;
@@ -1,17 +1,23 @@
1
+ import { withAuthorizationMethodLabels } from './display-wording.js';
1
2
  /**
2
- * Authorization methods an offering exposes. An offering that declares them
3
- * keeps that list - including an empty one, which is how the server says "this
4
- * offering has no connect entry here" instead of publishing an entry that
5
- * cannot be used. The rest derive one method per entry of `authModes`, which is
6
- * what a payload without the field (a catalog consumer that never asked the
7
- * server) falls back to.
3
+ * Authorization methods an offering exposes, worded for display.
8
4
  *
9
- * The derivation is therefore a fallback for payloads that carry no
10
- * `authorizationMethods` at all, so it must stay a projection of the offering's
11
- * own data: no label is invented for a provider, and the wording mirrors the
12
- * server's own naming for the same `authModes`.
5
+ * An offering that declares them keeps that list - including an empty one, which
6
+ * is how the server says "this offering has no connect entry here" instead of
7
+ * publishing an entry that cannot be used. The rest derive one method per entry
8
+ * of `authModes`, which is what a payload without the field (a catalog consumer
9
+ * that never asked the server) falls back to.
10
+ *
11
+ * Neither branch carries wording of its own: every path that renders a connect
12
+ * entry goes through here, so this is the one place the applet's wording table
13
+ * is applied, and an entry the table does not know keeps whatever the payload
14
+ * declared - or stays unrendered, which is how "the offering did not ask for
15
+ * this button" has always been said.
13
16
  */
14
17
  export function authorizationMethodsForOffering(offering) {
18
+ return withAuthorizationMethodLabels(declaredOrDerivedMethods(offering));
19
+ }
20
+ function declaredOrDerivedMethods(offering) {
15
21
  if (Array.isArray(offering.authorizationMethods))
16
22
  return offering.authorizationMethods;
17
23
  const lifecycle = offering.lifecycle === 'unavailable' ? 'unavailable' : 'active';
@@ -21,7 +27,6 @@ export function authorizationMethodsForOffering(offering) {
21
27
  id: 'api-key',
22
28
  authMode: 'apiKey',
23
29
  connectMode: 'browserAssistedApiKey',
24
- label: 'API Key',
25
30
  lifecycle,
26
31
  };
27
32
  }
@@ -30,7 +35,6 @@ export function authorizationMethodsForOffering(offering) {
30
35
  return {
31
36
  id: localService ? 'local-service' : 'local-session-import',
32
37
  authMode: 'local',
33
- label: localService ? '本地服务' : '已有登录态',
34
38
  lifecycle,
35
39
  };
36
40
  }
@@ -38,7 +42,6 @@ export function authorizationMethodsForOffering(offering) {
38
42
  id: 'device-code',
39
43
  authMode: mode,
40
44
  connectMode: 'deviceCodeOAuth',
41
- label: '浏览器登录',
42
45
  lifecycle,
43
46
  };
44
47
  });
@@ -1,5 +1,5 @@
1
1
  import type { AiConnectionsPodStore, WebExtensionHost } from '@undefineds.co/extension-sdk/web';
2
- import type { AiConnectionsClient } from './ai-connections-client';
2
+ import type { AiConnectionsClient } from './contract/ai-connections-client';
3
3
  import { type CredentialCollection } from './collections';
4
4
  /**
5
5
  * The half of the credentials table that needs the collection layer at runtime.
@@ -1,9 +1,9 @@
1
1
  import { credentialDescriptor, credentialResource } from '@undefineds.co/models';
2
2
  import { rowKeyOf } from '@undefineds.co/pod-collections';
3
- import { credentialProviderRelation, credentialRowKeyFor, customCredentialProviderRelation, } from './credential-storage.js';
3
+ import { credentialProviderRelation, credentialRowKeyFor, customCredentialProviderRelation, } from './contract/ai-connections-client.js';
4
4
  import { credentialSummaryFromRow } from './collections.js';
5
- import { normalizeProxyUrl } from './client/normalize.js';
6
- import { credentialOfferingMetadata, defaultOfferingFor, offeringBaseUrl, storedOfferingIdFor, } from './provider-catalog.js';
5
+ import { normalizeProxyUrl } from './contract/ai-connections-client.js';
6
+ import { credentialOfferingMetadata, defaultOfferingFor, offeringBaseUrl, storedOfferingIdFor, } from './contract/provider-catalog.js';
7
7
  /**
8
8
  * The half of the credentials table that needs the collection layer at runtime.
9
9
  *
@@ -1,6 +1,6 @@
1
1
  import { credentialDescriptor } from '@undefineds.co/models';
2
2
  import type { PodCollection, RowOf } from '@undefineds.co/pod-collections';
3
- import type { AiConnectionsProvider, AiProviderCredentialSummary, AiProviderSummary } from './ai-connections-client';
3
+ import type { AiConnectionsProvider, AiProviderCredentialSummary, AiProviderSummary } from './contract/ai-connections-client';
4
4
  /**
5
5
  * The credentials table, declared once (`docs/pod-collections.md` §6.4-2).
6
6
  *
@@ -1,8 +1,8 @@
1
1
  import { credentialResource } from '@undefineds.co/models';
2
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';
3
+ import { AI_CONNECTIONS_PROVIDERS } from './contract/ai-connections-client.js';
4
+ import { defaultOfferingFor } from './contract/provider-catalog.js';
5
+ import { providerOfCredentialKey, providerResourceKey } from './contract/ai-connections-client.js';
6
6
  /**
7
7
  * Live rows for the credentials table. Re-renders on sync and on optimistic
8
8
  * writes, because the source is the collection's own change feed.
@@ -1,5 +1,7 @@
1
1
  /**
2
- * Public entry point of the AI connections client
2
+ * Public entry point of the AI Connections client protocol. This package is
3
+ * the shared core: the gateway and the applet both consume it, and the applet
4
+ * (`@undefineds.co/ai-connections`) adds the components, artwork and wording.
3
5
  * (`@undefineds.co/ai-connections/client`).
4
6
  *
5
7
  * The implementation lives in `./client`, split into wire types, payload
@@ -10,7 +12,7 @@
10
12
  */
11
13
  export { AI_CONNECTIONS_PROVIDERS } from './client/types';
12
14
  export type { AiConnectAttempt, AiConnectionBeginOptions, AiConnectionsClient, AiConnectionsCredential, AiConnectionsMode, AiConnectionsProvider, AiConnectStatus, AiGatewayModel, AiProviderAuthorizationMethod, AiProviderAuthorizationMethodId, AiProviderAuthorizationMethodsSummary, AiProviderConnectionSummary, AiProviderCredentialSummary, AiProviderOffering, AiProviderSummary, AiProviderSummaryStatus, AiQuotaSnapshot, AiQuotaWindow, CreateApiKeyCredentialInput, CreatedGatewayKey, CustomProviderModel, DiscoveredProviderModel, GatewayKeyRecord, ProviderModelDiscovery, TestProviderCredentialInput, UpdateProviderCredentialInput, } from './client/types';
13
- export { AI_CONNECTIONS_GENERIC_ERROR_MESSAGE, AiConnectionsRequestError, normalizeAiConnectionsErrorMessage, normalizeAiConnectionsThrownError, normalizeProxyUrl, redactProxyUrl, } from './client/normalize';
15
+ export { AiConnectionsRequestError, aiConnectionsErrorCode, normalizeProxyUrl, redactProxyUrl, } from './client/normalize';
14
16
  export { createAiConnectionsClient, resolveAiConnectionsApiBase } from './client/request';
15
17
  /**
16
18
  * Storage-shape rules for credential rows. They are shared with the Pod adapter
@@ -1,5 +1,7 @@
1
1
  /**
2
- * Public entry point of the AI connections client
2
+ * Public entry point of the AI Connections client protocol. This package is
3
+ * the shared core: the gateway and the applet both consume it, and the applet
4
+ * (`@undefineds.co/ai-connections`) adds the components, artwork and wording.
3
5
  * (`@undefineds.co/ai-connections/client`).
4
6
  *
5
7
  * The implementation lives in `./client`, split into wire types, payload
@@ -9,7 +11,7 @@
9
11
  * parsers under `./client` are internal, and `export *` would publish them.
10
12
  */
11
13
  export { AI_CONNECTIONS_PROVIDERS } from './client/types.js';
12
- export { AI_CONNECTIONS_GENERIC_ERROR_MESSAGE, AiConnectionsRequestError, normalizeAiConnectionsErrorMessage, normalizeAiConnectionsThrownError, normalizeProxyUrl, redactProxyUrl, } from './client/normalize.js';
14
+ export { AiConnectionsRequestError, aiConnectionsErrorCode, normalizeProxyUrl, redactProxyUrl, } from './client/normalize.js';
13
15
  export { createAiConnectionsClient, resolveAiConnectionsApiBase } from './client/request.js';
14
16
  /**
15
17
  * Storage-shape rules for credential rows. They are shared with the Pod adapter
@@ -8,7 +8,6 @@ import type { AiConnectAttempt, AiConnectionsCredential, AiConnectionsProvider,
8
8
  * within this module family. The published surface is the explicit list in
9
9
  * `ai-connections-client.ts`, not this file.
10
10
  */
11
- export declare const AI_CONNECTIONS_GENERIC_ERROR_MESSAGE = "AI Connection request failed. Please try again.";
12
11
  /**
13
12
  * Validate and normalize a user supplied upstream proxy URL. Proxy credentials
14
13
  * are intentionally rejected because proxy auth is not stored in the Pod
@@ -16,16 +15,27 @@ export declare const AI_CONNECTIONS_GENERIC_ERROR_MESSAGE = "AI Connection reque
16
15
  */
17
16
  export declare function normalizeProxyUrl(value: string | undefined | null): string | undefined;
18
17
  export declare function redactProxyUrl(value: string | undefined | null): string | undefined;
18
+ /**
19
+ * A failed AI Connection request.
20
+ *
21
+ * It carries the facts a caller needs to decide what to say - the wire code, the
22
+ * upstream status, the payload itself - and a diagnostic message that names the
23
+ * code. The sentence a user reads is the applet's (`error-wording.ts`): a shared
24
+ * client must not pick the wording for whoever happens to render it.
25
+ */
19
26
  export declare class AiConnectionsRequestError extends Error {
20
27
  readonly code?: string;
28
+ readonly status: number;
21
29
  readonly providerStatus?: number;
22
- constructor(message: string, payload: unknown);
30
+ readonly payload: unknown;
31
+ readonly provider?: string;
32
+ readonly authMode?: string;
33
+ constructor(payload: unknown, status: number, context?: {
34
+ provider?: string;
35
+ authMode?: string;
36
+ });
23
37
  }
24
- export declare function normalizeAiConnectionsThrownError(error: unknown): string;
25
- export declare function normalizeAiConnectionsErrorMessage(payload: unknown, status: number, context?: {
26
- provider?: AiConnectionsProvider;
27
- authMode?: 'apiKey' | 'deviceCodeOAuth' | 'local';
28
- }): string;
38
+ export declare function aiConnectionsErrorCode(payload: unknown): string | undefined;
29
39
  export declare function readJson(response: Response): Promise<unknown>;
30
40
  export declare function assertProvider(provider: string): asserts provider is AiConnectionsProvider;
31
41
  export declare function parseGatewayKeyRecord(value: unknown): GatewayKeyRecord | undefined;
@@ -8,7 +8,6 @@ import { AI_CONNECTIONS_PROVIDERS } from './types.js';
8
8
  * within this module family. The published surface is the explicit list in
9
9
  * `ai-connections-client.ts`, not this file.
10
10
  */
11
- export const AI_CONNECTIONS_GENERIC_ERROR_MESSAGE = 'AI Connection request failed. Please try again.';
12
11
  /**
13
12
  * Validate and normalize a user supplied upstream proxy URL. Proxy credentials
14
13
  * are intentionally rejected because proxy auth is not stored in the Pod
@@ -49,109 +48,29 @@ export function redactProxyUrl(value) {
49
48
  parsed.hash = '';
50
49
  return parsed.href.replace(/\/$/u, '');
51
50
  }
51
+ /**
52
+ * A failed AI Connection request.
53
+ *
54
+ * It carries the facts a caller needs to decide what to say - the wire code, the
55
+ * upstream status, the payload itself - and a diagnostic message that names the
56
+ * code. The sentence a user reads is the applet's (`error-wording.ts`): a shared
57
+ * client must not pick the wording for whoever happens to render it.
58
+ */
52
59
  export class AiConnectionsRequestError extends Error {
53
- constructor(message, payload) {
54
- super(message);
60
+ constructor(payload, status, context = {}) {
61
+ const code = aiConnectionsErrorCode(payload);
62
+ super(code ? `AI Connection request failed: ${code}` : `AI Connection request failed (HTTP ${status})`);
55
63
  this.name = 'AiConnectionsRequestError';
56
- this.code = errorCodeFromPayload(payload);
64
+ this.code = code;
65
+ this.status = status;
57
66
  this.providerStatus = isRecord(payload) && typeof payload.providerStatus === 'number'
58
67
  ? payload.providerStatus : undefined;
68
+ this.payload = payload;
69
+ this.provider = context.provider;
70
+ this.authMode = context.authMode;
59
71
  }
60
72
  }
61
- export function normalizeAiConnectionsThrownError(error) {
62
- if (error instanceof Error) {
63
- return normalizeAiConnectionsErrorText(error.message);
64
- }
65
- return normalizeAiConnectionsErrorText(String(error));
66
- }
67
- export function normalizeAiConnectionsErrorMessage(payload, status, context = {}) {
68
- const code = errorCodeFromPayload(payload);
69
- if (code === 'provider_models_response_error') {
70
- const message = isRecord(payload) && typeof payload.message === 'string'
71
- ? sanitizeProviderResponseMessage(payload.message)
72
- : undefined;
73
- if (message)
74
- return message;
75
- return '模型列表获取失败。请检查密钥、服务地址或网络后重试。';
76
- }
77
- if (code === 'provider_models_fetch_failed') {
78
- const providerStatus = isRecord(payload) && typeof payload.providerStatus === 'number'
79
- ? payload.providerStatus
80
- : undefined;
81
- const providerMessage = isRecord(payload) && typeof payload.providerMessage === 'string'
82
- ? payload.providerMessage.trim()
83
- : undefined;
84
- return withProviderMessage(modelDiscoveryErrorMessage(providerStatus, context.authMode), providerMessage);
85
- }
86
- const coded = code ? messageForSafeErrorCode(code, context.provider) : undefined;
87
- if (coded)
88
- return coded;
89
- const text = isRecord(payload) && typeof payload.error === 'string'
90
- ? payload.error
91
- : undefined;
92
- if (text) {
93
- const exact = messageForSafeErrorCode(text, context.provider);
94
- if (exact)
95
- return exact;
96
- if (text === 'AI Connection service identity is unavailable') {
97
- return text;
98
- }
99
- if (text === 'Provider credential not found for current identity') {
100
- return '当前身份没有可用的额度凭证。';
101
- }
102
- if (text === 'Provider quota adapter not found' || text === 'Provider quota lookup failed') {
103
- return '该接入方式不支持查询官方额度。';
104
- }
105
- }
106
- if (status === 401)
107
- return 'Please sign in again to continue.';
108
- if (status === 403)
109
- return 'AI Connection permission was denied.';
110
- if (status === 404 && context.provider) {
111
- return `${providerLabel(context.provider)} connection is not configured.`;
112
- }
113
- if (status === 429)
114
- return 'AI Connection is rate limited. Please try again later.';
115
- if (status === 503)
116
- return 'AI Connection service is unavailable.';
117
- return AI_CONNECTIONS_GENERIC_ERROR_MESSAGE;
118
- }
119
- const LOCAL_SESSION_REFRESH_FAILED_MESSAGE = '订阅登录态自动刷新失败,请稍后重试。';
120
- const LOCAL_SESSION_REAUTH_REQUIRED_MESSAGE = '订阅登录态已失效,请在原客户端重新登录后重读,或使用设备码登录。';
121
- const OAUTH_MODEL_AUTH_FAILED_MESSAGE = '订阅登录态不可用,请重读登录态或重新登录后再同步模型。';
122
- const MODEL_DISCOVERY_SAFE_MESSAGES = new Set([
123
- OAUTH_MODEL_AUTH_FAILED_MESSAGE,
124
- LOCAL_SESSION_REFRESH_FAILED_MESSAGE,
125
- LOCAL_SESSION_REAUTH_REQUIRED_MESSAGE,
126
- '密钥不可用。请检查密钥是否填写正确,或换一个密钥后重试。',
127
- '模型服务地址不正确。请检查服务地址后重试。',
128
- '请求太频繁。请稍等一会儿再试。',
129
- '模型服务暂时没有响应。请稍后重试。',
130
- '模型列表获取失败。请检查密钥、服务地址或网络后重试。',
131
- ]);
132
- function normalizeAiConnectionsErrorText(message) {
133
- if (message.startsWith('provider_models_response_error:')) {
134
- return sanitizeProviderResponseMessage(message.slice('provider_models_response_error:'.length))
135
- ?? '模型列表获取失败。请检查密钥、服务地址或网络后重试。';
136
- }
137
- const exact = messageForSafeErrorCode(message);
138
- if (exact)
139
- return exact;
140
- const prefix = message.split(':', 1)[0]?.trim();
141
- const prefixed = prefix ? messageForSafeErrorCode(prefix) : undefined;
142
- if (prefixed)
143
- return prefixed;
144
- if (message === 'AI Connection service identity is unavailable')
145
- return message;
146
- if (MODEL_DISCOVERY_SAFE_MESSAGES.has(message))
147
- return message;
148
- if (isModelDiscoveryMessageWithProviderDetail(message))
149
- return message;
150
- if (message.startsWith('invalid_'))
151
- return 'AI Connection returned an invalid response.';
152
- return AI_CONNECTIONS_GENERIC_ERROR_MESSAGE;
153
- }
154
- function errorCodeFromPayload(payload) {
73
+ export function aiConnectionsErrorCode(payload) {
155
74
  if (!isRecord(payload))
156
75
  return undefined;
157
76
  if (typeof payload.code === 'string')
@@ -163,107 +82,6 @@ function errorCodeFromPayload(payload) {
163
82
  }
164
83
  return undefined;
165
84
  }
166
- function messageForSafeErrorCode(code, provider) {
167
- switch (code.trim().toLowerCase().replace(/-/g, '_')) {
168
- case 'not_configured':
169
- case 'notconfigured':
170
- return provider
171
- ? `${providerLabel(provider)} connection is not configured.`
172
- : 'AI provider connection is not configured.';
173
- case 'unsupported':
174
- return provider
175
- ? `${providerLabel(provider)} does not support this operation.`
176
- : 'This AI Connection operation is not supported.';
177
- case 'service_identity_unavailable':
178
- return 'AI Connection service identity is unavailable';
179
- case 'unauthorized':
180
- return 'Please sign in again to continue.';
181
- case 'forbidden':
182
- case 'permission_denied':
183
- return 'AI Connection permission was denied.';
184
- case 'rate_limited':
185
- return 'AI Connection is rate limited. Please try again later.';
186
- case 'service_unavailable':
187
- return 'AI Connection service is unavailable.';
188
- case 'unsafe_provider_base_url':
189
- return '该服务地址指向 Xpod 不允许访问的网络,请改用公网 HTTPS 地址。';
190
- case 'invalid_proxy_url':
191
- return '代理地址必须是无账号密码的 HTTP 或 HTTPS 地址。';
192
- case 'oauth_refresh_failed':
193
- case 'oauth_refresh_unavailable':
194
- case 'local_session_refresh_failed':
195
- return LOCAL_SESSION_REFRESH_FAILED_MESSAGE;
196
- case 'oauth_session_reauth_required':
197
- case 'oauth_refresh_token_required':
198
- case 'local_session_reauth_required':
199
- case 'local_session_missing_refresh_token':
200
- return LOCAL_SESSION_REAUTH_REQUIRED_MESSAGE;
201
- case 'models_persistence_failed':
202
- return '模型已获取,但保存到 Pod 失败。请重试同步模型。';
203
- case 'quota_credential_not_found':
204
- return '当前身份没有可用的额度凭证。';
205
- case 'credential_secret_unavailable':
206
- return '当前凭证密钥不可用,请重新保存后再查询额度。';
207
- case 'gateway_api_key_plaintext_unavailable':
208
- return 'Pod 中未找到此 API Key 的原文,无法复制配置。请创建新的 Key,更新客户端后再删除旧 Key。';
209
- case 'quota_adapter_not_found':
210
- return '该接入方式不支持查询官方额度。';
211
- default:
212
- return undefined;
213
- }
214
- }
215
- function modelDiscoveryErrorMessage(providerStatus, authMode) {
216
- if (providerStatus === 401 || providerStatus === 403) {
217
- if (authMode === 'deviceCodeOAuth')
218
- return OAUTH_MODEL_AUTH_FAILED_MESSAGE;
219
- return '密钥不可用。请检查密钥是否填写正确,或换一个密钥后重试。';
220
- }
221
- if (providerStatus === 404) {
222
- return '模型服务地址不正确。请检查服务地址后重试。';
223
- }
224
- if (providerStatus === 429) {
225
- return '请求太频繁。请稍等一会儿再试。';
226
- }
227
- if (providerStatus !== undefined && providerStatus >= 500) {
228
- return '模型服务暂时没有响应。请稍后重试。';
229
- }
230
- return '模型列表获取失败。请检查密钥、服务地址或网络后重试。';
231
- }
232
- function withProviderMessage(message, providerMessage) {
233
- const sanitized = providerMessage ? sanitizeProviderResponseMessage(providerMessage) : undefined;
234
- if (!sanitized)
235
- return message;
236
- return `${message} 上游返回:${sanitized}`;
237
- }
238
- function isModelDiscoveryMessageWithProviderDetail(message) {
239
- const marker = ' 上游返回:';
240
- const index = message.indexOf(marker);
241
- if (index <= 0)
242
- return false;
243
- return MODEL_DISCOVERY_SAFE_MESSAGES.has(message.slice(0, index));
244
- }
245
- function sanitizeProviderResponseMessage(value) {
246
- const sanitized = value
247
- .replace(/[\u0000-\u001f\u007f]/gu, ' ')
248
- .replace(/\bBearer\s+[^\s,;]+/giu, 'Bearer [REDACTED]')
249
- .replace(/(?:sk|id)[._-][A-Za-z0-9._-]{8,}/gu, '[REDACTED]')
250
- .replace(/https?:\/\/[^\s]+/giu, '[URL]')
251
- .trim()
252
- .slice(0, 240);
253
- return sanitized || undefined;
254
- }
255
- function providerLabel(provider) {
256
- switch (provider) {
257
- case 'openai': return 'OpenAI';
258
- case 'anthropic': return 'Anthropic';
259
- case 'kimi': return 'Kimi';
260
- case 'bailian': return 'Bailian';
261
- case 'deepseek': return 'DeepSeek';
262
- case 'zhipu': return 'Zhipu';
263
- case 'ollama': return 'Ollama';
264
- case 'custom': return 'Custom';
265
- }
266
- }
267
85
  export async function readJson(response) {
268
86
  const text = await response.text();
269
87
  if (!text)
@@ -535,7 +353,7 @@ function parseAuthorizationMethod(value) {
535
353
  id: value.id,
536
354
  authMode,
537
355
  connectMode,
538
- label: stringValue(value.label) ?? authorizationMethodFallbackLabel(value.id, authMode),
356
+ label: stringValue(value.label),
539
357
  lifecycle,
540
358
  reason: stringValue(value.reason),
541
359
  });
@@ -543,19 +361,6 @@ function parseAuthorizationMethod(value) {
543
361
  function authorizationMethodLifecycleValue(value) {
544
362
  return value === 'active' || value === 'unavailable' ? value : undefined;
545
363
  }
546
- function authorizationMethodFallbackLabel(id, authMode) {
547
- if (id === 'device-code')
548
- return '设备码登录';
549
- if (id === 'local-session-import')
550
- return '已有登录态';
551
- if (id === 'local-service')
552
- return '本地服务';
553
- if (id === 'api-key' || authMode === 'apiKey')
554
- return 'API Key';
555
- if (authMode === 'local')
556
- return '本地服务';
557
- return '浏览器登录';
558
- }
559
364
  function offeringLifecycleValue(value) {
560
365
  return value === 'active' || value === 'legacy' || value === 'unavailable'
561
366
  ? value
@@ -1,4 +1,4 @@
1
- import { AiConnectionsRequestError, assertProvider, compactObject, isDefined, isRecord, normalizeAiConnectionsErrorMessage, parseAuthorizationMethodsSummary, parseConnectAttempt, parseCredential, parseCustomModelList, parseGatewayKeyRecord, parseGatewayModel, parseModelDiscovery, parseProviderCredentialSummary, parseProviderSummaries, readJson, sanitizePublicObject, } from './normalize.js';
1
+ import { AiConnectionsRequestError, assertProvider, compactObject, isDefined, isRecord, parseAuthorizationMethodsSummary, parseConnectAttempt, parseCredential, parseCustomModelList, parseGatewayKeyRecord, parseGatewayModel, parseModelDiscovery, parseProviderCredentialSummary, parseProviderSummaries, readJson, sanitizePublicObject, } from './normalize.js';
2
2
  /**
3
3
  * The HTTP client itself: one factory over the Pod base URL and an authenticated
4
4
  * fetch, with every response normalised by `normalize.ts`.
@@ -25,7 +25,7 @@ export function createAiConnectionsClient({ webId, podBaseUrl, authenticatedFetc
25
25
  });
26
26
  const payload = await readJson(response);
27
27
  if (!response.ok) {
28
- throw new AiConnectionsRequestError(normalizeAiConnectionsErrorMessage(payload, response.status, context), payload);
28
+ throw new AiConnectionsRequestError(payload, response.status, context);
29
29
  }
30
30
  return payload;
31
31
  };
@@ -64,7 +64,7 @@ export function createAiConnectionsClient({ webId, podBaseUrl, authenticatedFetc
64
64
  return [];
65
65
  const payload = await readJson(response);
66
66
  if (!response.ok) {
67
- throw new Error(normalizeAiConnectionsErrorMessage(payload, response.status));
67
+ throw new AiConnectionsRequestError(payload, response.status);
68
68
  }
69
69
  return isRecord(payload) && Array.isArray(payload.data)
70
70
  ? payload.data.map(parseAuthorizationMethodsSummary).filter(isDefined)
@@ -137,12 +137,21 @@ export interface ProviderModelDiscovery {
137
137
  }
138
138
  export type AiProviderAuthorizationMethodId = 'device-code' | 'local-session-import' | 'api-key' | 'local-service'
139
139
  /** Opens the provider console to sign in and mint the key the entry then stores. */
140
- | 'browser-login' | string;
140
+ | 'browser-login'
141
+ /** Starts an authorization-code browser sign-in and waits for the local callback. */
142
+ | 'browser-oauth' | string;
141
143
  export interface AiProviderAuthorizationMethod {
142
144
  id: AiProviderAuthorizationMethodId;
143
145
  authMode: 'oauth' | 'deviceCode' | 'local' | 'apiKey';
144
146
  connectMode?: AiConnectionsMode;
145
- label: string;
147
+ /**
148
+ * The wording the entry is shown under. Optional on purpose: the shared core
149
+ * names the action by `id` and the applet supplies the wording, so a payload
150
+ * carrying none is still a complete contract. A provider the user configured
151
+ * may declare its own wording here, which is what keeps a custom entry from
152
+ * rendering under a built-in name.
153
+ */
154
+ label?: string;
146
155
  lifecycle: 'active' | 'unavailable';
147
156
  reason?: string;
148
157
  }