@undefineds.co/xpod 0.4.13 → 0.4.15

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 (331) hide show
  1. package/config/cloud.json +0 -3
  2. package/config/components-ignore.json +11 -7
  3. package/config/local.json +0 -3
  4. package/config/xpod.base.json +0 -24
  5. package/dist/api/ai-config/AiConfigStore.d.ts +2 -2
  6. package/dist/api/ai-config/AiConfigStore.js +4 -1
  7. package/dist/api/ai-gateway/auth/CallerPodAccess.d.ts +2 -5
  8. package/dist/api/ai-gateway/auth/CallerPodAccess.js +3 -42
  9. package/dist/api/ai-gateway/auth/GatewayApiKeyAuthenticator.d.ts +2 -1
  10. package/dist/api/ai-gateway/auth/GatewayApiKeyAuthenticator.js +1 -1
  11. package/dist/api/ai-gateway/auth/PodGatewayAccessKeyRepository.d.ts +3 -8
  12. package/dist/api/ai-gateway/auth/PodGatewayAccessKeyRepository.js +9 -32
  13. package/dist/api/ai-gateway/connect/index.d.ts +3 -3
  14. package/dist/api/ai-gateway/connect/index.js +9 -38
  15. package/dist/api/ai-gateway/errors.js +2 -1
  16. package/dist/api/ai-gateway/models/PodModelSelectionRepository.d.ts +3 -3
  17. package/dist/api/ai-gateway/models/PodModelSelectionRepository.js +7 -11
  18. package/dist/api/ai-gateway/pod/HostedPodRoute.d.ts +27 -0
  19. package/dist/api/ai-gateway/pod/HostedPodRoute.js +47 -0
  20. package/dist/api/ai-gateway/pod/OwnerPodAccess.d.ts +79 -0
  21. package/dist/api/ai-gateway/pod/OwnerPodAccess.js +192 -0
  22. package/dist/api/ai-gateway/pod/PodInterfaceKeyStore.d.ts +52 -0
  23. package/dist/api/ai-gateway/pod/PodInterfaceKeyStore.js +61 -0
  24. package/dist/api/ai-gateway/providers/ProviderRegistry.js +1 -1
  25. package/dist/api/ai-gateway/quota/ProviderQuotaAdapter.d.ts +3 -3
  26. package/dist/api/ai-gateway/quota/ProviderQuotaAdapter.js +7 -32
  27. package/dist/api/ai-gateway/service-access/AiConnectionsServiceAccess.d.ts +1 -1
  28. package/dist/api/ai-gateway/service-access/AiConnectionsServiceAccess.js +1 -1
  29. package/dist/api/auth/ClientCredentialsAuthenticator.js +5 -28
  30. package/dist/api/auth/TokenEndpointRoute.d.ts +18 -0
  31. package/dist/api/auth/TokenEndpointRoute.js +36 -0
  32. package/dist/api/chatkit/pod-store.d.ts +4 -4
  33. package/dist/api/chatkit/pod-store.js +24 -95
  34. package/dist/api/container/common.js +36 -23
  35. package/dist/api/container/index.js +1 -0
  36. package/dist/api/container/local.js +88 -37
  37. package/dist/api/container/routes.js +41 -7
  38. package/dist/api/container/types.d.ts +4 -2
  39. package/dist/api/handlers/AdminHandler.d.ts +17 -1
  40. package/dist/api/handlers/AdminHandler.js +40 -3
  41. package/dist/api/handlers/AiGatewayManagementHandler.d.ts +6 -0
  42. package/dist/api/handlers/AiGatewayManagementHandler.js +17 -4
  43. package/dist/api/handlers/EdgeNodeSignalHandler.js +10 -2
  44. package/dist/api/handlers/NetworkSettingsHandler.d.ts +44 -5
  45. package/dist/api/handlers/NetworkSettingsHandler.js +46 -11
  46. package/dist/api/handlers/PodSettingsHandler.d.ts +3 -3
  47. package/dist/api/handlers/PodSettingsHandler.js +3 -3
  48. package/dist/api/handlers/ProvisionHandler.d.ts +35 -1
  49. package/dist/api/handlers/ProvisionHandler.js +53 -2
  50. package/dist/api/handlers/ReachabilityHandler.d.ts +6 -0
  51. package/dist/api/handlers/ReachabilityHandler.js +25 -6
  52. package/dist/api/network/NetworkEnvironmentConfigurationStore.d.ts +6 -1
  53. package/dist/api/network/NetworkEnvironmentConfigurationStore.js +72 -16
  54. package/dist/api/runtime.d.ts +18 -0
  55. package/dist/api/runtime.js +28 -2
  56. package/dist/api/service/AiClientConfigurationService.d.ts +1 -1
  57. package/dist/api/service/AiClientConfigurationService.js +1 -1
  58. package/dist/cli/commands/start.d.ts +26 -1
  59. package/dist/cli/commands/start.js +69 -5
  60. package/dist/components/components.jsonld +1 -1
  61. package/dist/components/context.jsonld +35 -42
  62. package/dist/edge/EdgeNodeAgent.d.ts +16 -0
  63. package/dist/edge/EdgeNodeAgent.js +56 -1
  64. package/dist/edge/EdgeNodeAgent.jsonld +8 -0
  65. package/dist/edge/EdgeNodeAgentInitializer.d.ts +2 -0
  66. package/dist/edge/EdgeNodeAgentInitializer.js +1 -0
  67. package/dist/edge/EdgeNodeAgentInitializer.jsonld +19 -0
  68. package/dist/edge/EdgeNodeDnsCoordinator.d.ts +11 -1
  69. package/dist/edge/EdgeNodeDnsCoordinator.js +12 -2
  70. package/dist/edge/EdgeNodeHealthProbeService.d.ts +15 -0
  71. package/dist/edge/EdgeNodeHealthProbeService.js +44 -12
  72. package/dist/edge/EdgeNodeHealthProbeService.jsonld +77 -0
  73. package/dist/edge/ProbeTargetGuard.d.ts +35 -0
  74. package/dist/edge/ProbeTargetGuard.js +142 -0
  75. package/dist/edge/reachability/NodeAccessResolver.d.ts +16 -0
  76. package/dist/edge/reachability/NodeAccessResolver.js +30 -0
  77. package/dist/edge/reachability/ReachabilitySessionService.js +4 -1
  78. package/dist/edge/reachability/RouteSetBuilder.d.ts +18 -1
  79. package/dist/edge/reachability/RouteSetBuilder.js +47 -0
  80. package/dist/edge/reachability/RouteSetBuilder.jsonld +29 -0
  81. package/dist/edge/reachability/types.d.ts +8 -2
  82. package/dist/http/SubgraphSparqlHttpHandler.d.ts +1 -25
  83. package/dist/http/SubgraphSparqlHttpHandler.js +0 -100
  84. package/dist/http/SubgraphSparqlHttpHandler.jsonld +0 -8
  85. package/dist/identity/drizzle/PodInterfaceKeyRepository.d.ts +33 -0
  86. package/dist/identity/drizzle/PodInterfaceKeyRepository.js +78 -0
  87. package/dist/identity/drizzle/db.d.ts +7 -0
  88. package/dist/identity/drizzle/db.js +30 -0
  89. package/dist/identity/drizzle/schema.pg.d.ts +9 -0
  90. package/dist/identity/drizzle/schema.pg.js +16 -1
  91. package/dist/identity/drizzle/schema.sqlite.d.ts +106 -0
  92. package/dist/identity/drizzle/schema.sqlite.js +16 -1
  93. package/dist/index.d.ts +3 -2
  94. package/dist/index.js +9 -5
  95. package/dist/main.js +7 -0
  96. package/dist/runtime/GatewayAdminProxyAuth.d.ts +1 -16
  97. package/dist/runtime/GatewayAdminProxyAuth.js +2 -71
  98. package/dist/runtime/Proxy.d.ts +32 -1
  99. package/dist/runtime/Proxy.js +125 -31
  100. package/dist/runtime/bootstrap.d.ts +21 -0
  101. package/dist/runtime/bootstrap.js +45 -1
  102. package/dist/runtime/css-process.d.ts +1 -0
  103. package/dist/runtime/css-process.js +1 -0
  104. package/dist/runtime/host/node/NodeRuntimeHost.js +6 -1
  105. package/dist/runtime/host/types.d.ts +6 -0
  106. package/dist/runtime/index.d.ts +1 -1
  107. package/dist/runtime/index.js +4 -1
  108. package/dist/runtime/js-runtime.js +10 -3
  109. package/dist/runtime/lifecycle.js +6 -4
  110. package/dist/runtime/port-finder.d.ts +26 -0
  111. package/dist/runtime/port-finder.js +64 -0
  112. package/dist/runtime/runner/node/NodeGatewayRuntimeRunner.js +1 -0
  113. package/dist/runtime/runner/types.d.ts +5 -0
  114. package/dist/runtime/runtime-types.d.ts +1 -0
  115. package/dist/test-utils/local-managed-client-p2p-e2e-smoke.js +1 -1
  116. package/dist/tunnel/AutoTunnelProvider.d.ts +56 -0
  117. package/dist/tunnel/AutoTunnelProvider.js +181 -0
  118. package/dist/tunnel/LocalTunnelProvider.d.ts +15 -0
  119. package/dist/tunnel/LocalTunnelProvider.js +87 -18
  120. package/dist/tunnel/LocalTunnelProvider.jsonld +27 -0
  121. package/dist/tunnel/NgrokTunnelProvider.d.ts +4 -0
  122. package/dist/tunnel/NgrokTunnelProvider.js +117 -43
  123. package/dist/tunnel/NgrokTunnelProvider.jsonld +4 -0
  124. package/dist/tunnel/SakuraFrpTunnelProvider.d.ts +65 -3
  125. package/dist/tunnel/SakuraFrpTunnelProvider.js +268 -25
  126. package/dist/tunnel/TunnelLifecycle.d.ts +14 -0
  127. package/dist/tunnel/TunnelLifecycle.js +34 -0
  128. package/dist/tunnel/TunnelProfiles.d.ts +33 -3
  129. package/dist/tunnel/TunnelProfiles.js +105 -78
  130. package/dist/tunnel/TunnelProvider.d.ts +15 -2
  131. package/dist/tunnel/TunnelProvider.jsonld +8 -0
  132. package/dist/tunnel/TunnelProviderCatalog.d.ts +62 -0
  133. package/dist/tunnel/TunnelProviderCatalog.js +130 -0
  134. package/dist/tunnel/index.d.ts +1 -0
  135. package/dist/tunnel/index.js +3 -1
  136. package/node_modules/@undefineds.co/ai-connections/dist/AiApiKeyPool.d.ts +1 -1
  137. package/node_modules/@undefineds.co/ai-connections/dist/AiApiKeyPool.js +1 -1
  138. package/node_modules/@undefineds.co/ai-connections/dist/AiAuthorizationActions.d.ts +1 -1
  139. package/node_modules/@undefineds.co/ai-connections/dist/AiClientConfigurationSection.d.ts +1 -1
  140. package/node_modules/@undefineds.co/ai-connections/dist/AiClientConfigurationSection.js +1 -1
  141. package/node_modules/@undefineds.co/ai-connections/dist/AiConnectDialog.d.ts +1 -1
  142. package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsPanel.d.ts +1 -1
  143. package/node_modules/@undefineds.co/ai-connections/dist/AiCredentialPoolSection.d.ts +1 -1
  144. package/node_modules/@undefineds.co/ai-connections/dist/AiCredentialRow.d.ts +1 -1
  145. package/node_modules/@undefineds.co/ai-connections/dist/AiCustomProviderDialog.d.ts +1 -1
  146. package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayKeyRow.d.ts +1 -1
  147. package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayKeysSection.d.ts +1 -1
  148. package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayModelsSection.d.ts +1 -1
  149. package/node_modules/@undefineds.co/ai-connections/dist/AiOfferingDetails.d.ts +1 -1
  150. package/node_modules/@undefineds.co/ai-connections/dist/AiProviderCard.d.ts +1 -1
  151. package/node_modules/@undefineds.co/ai-connections/dist/AiQuotaCard.d.ts +1 -1
  152. package/node_modules/@undefineds.co/ai-connections/dist/AiSortableCredentialList.d.ts +1 -1
  153. package/node_modules/@undefineds.co/ai-connections/dist/authorization-methods.d.ts +1 -1
  154. package/node_modules/@undefineds.co/ai-connections/dist/collection-runtime.d.ts +1 -1
  155. package/node_modules/@undefineds.co/ai-connections/dist/collection-runtime.js +3 -3
  156. package/node_modules/@undefineds.co/ai-connections/dist/collections.d.ts +1 -1
  157. package/node_modules/@undefineds.co/ai-connections/dist/collections.js +3 -3
  158. package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/ai-connections-client.d.ts +1 -1
  159. package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/ai-connections-client.js +1 -1
  160. package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client-config/index.cjs +8 -8
  161. package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/index.d.ts +1 -1
  162. package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/index.js +1 -1
  163. package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/provider-catalog.cjs +3 -3
  164. package/node_modules/@undefineds.co/ai-connections/dist/controller.d.ts +1 -1
  165. package/node_modules/@undefineds.co/ai-connections/dist/controller.js +1 -1
  166. package/node_modules/@undefineds.co/ai-connections/dist/credential-labels.d.ts +1 -1
  167. package/node_modules/@undefineds.co/ai-connections/dist/display-wording.d.ts +1 -1
  168. package/node_modules/@undefineds.co/ai-connections/dist/error-wording.d.ts +1 -1
  169. package/node_modules/@undefineds.co/ai-connections/dist/error-wording.js +8 -3
  170. package/node_modules/@undefineds.co/ai-connections/dist/gateway-endpoints.js +1 -1
  171. package/node_modules/@undefineds.co/ai-connections/dist/offering-endpoints.d.ts +1 -1
  172. package/node_modules/@undefineds.co/ai-connections/dist/offering-label.d.ts +1 -1
  173. package/node_modules/@undefineds.co/ai-connections/dist/provider-visuals.d.ts +1 -1
  174. package/node_modules/@undefineds.co/ai-connections/dist/service-access.js +1 -1
  175. package/node_modules/@undefineds.co/ai-connections/dist/useAiConnectDialog.d.ts +1 -1
  176. package/node_modules/@undefineds.co/ai-connections/package.json +31 -1
  177. package/node_modules/@undefineds.co/solid-sdk/dist/access-route.cjs +230 -0
  178. package/node_modules/@undefineds.co/solid-sdk/dist/access-route.d.ts +76 -0
  179. package/node_modules/@undefineds.co/solid-sdk/dist/access-route.js +115 -0
  180. package/node_modules/@undefineds.co/solid-sdk/dist/index.cjs +89 -0
  181. package/node_modules/@undefineds.co/solid-sdk/dist/index.d.ts +1 -0
  182. package/node_modules/@undefineds.co/solid-sdk/dist/index.js +1 -0
  183. package/node_modules/@undefineds.co/solid-sdk/package.json +6 -1
  184. package/package.json +5 -6
  185. package/static/app/assets/inrupt-smoke.js +23 -23
  186. package/static/app/assets/main.css +1 -1
  187. package/static/auth-callback/assets/{AiConfigContext-DlFyEWy9.js → AiConfigContext-Bx0HCAW5.js} +1 -1
  188. package/static/auth-callback/assets/{AiConfigPage-CkYk-SFW.js → AiConfigPage-ChQImMbm.js} +1 -1
  189. package/static/auth-callback/assets/{DocumentProcessingPanel-CqIr3JqN.js → DocumentProcessingPanel-D830H4SH.js} +1 -1
  190. package/static/auth-callback/assets/{IndexLifecyclePanel-C1GKV3Vx.js → IndexLifecyclePanel-CnlkjMF8.js} +1 -1
  191. package/static/auth-callback/assets/{IndexSubjectPanel-ro9lC6XW.js → IndexSubjectPanel-CdEfg_CO.js} +1 -1
  192. package/static/auth-callback/assets/{ModelAssignmentsPanel-DxNdyKRJ.js → ModelAssignmentsPanel-D-8A8dZx.js} +1 -1
  193. package/static/auth-callback/assets/{ModelsPage-BVtWSPBU.js → ModelsPage-Cim7cubp.js} +3 -3
  194. package/static/auth-callback/assets/NetworkPage-CfK3x-pb.js +2 -0
  195. package/static/auth-callback/assets/{PaneListHeader-ByKw8ada.js → PaneListHeader-Bf_kEd4U.js} +1 -1
  196. package/static/auth-callback/assets/{SearchIndexingPanel-CulBKcYT.js → SearchIndexingPanel-4kD4RBEQ.js} +1 -1
  197. package/static/auth-callback/assets/{StatusSubjectPanel-VOcfrt8o.js → StatusSubjectPanel-Bw9AiTSf.js} +1 -1
  198. package/static/auth-callback/assets/{StatusWorkspace-Jsz6hAdE.js → StatusWorkspace-C-301H-0.js} +1 -1
  199. package/static/auth-callback/assets/{SystemSettingsPage-BFNvGAle.js → SystemSettingsPage-BbWn-eG6.js} +1 -1
  200. package/static/auth-callback/assets/{SystemSettingsSubjectPanel-DFRdrSfK.js → SystemSettingsSubjectPanel-DA4wvNSm.js} +1 -1
  201. package/static/auth-callback/assets/{XpodAiConnectionsPodStore-C6KpvHVg.js → XpodAiConnectionsPodStore-CohdyLoX.js} +1 -1
  202. package/static/auth-callback/assets/{activity-DnTlb9iM.js → activity-CCsb9Oam.js} +1 -1
  203. package/static/auth-callback/assets/ai-connections-DexTPyfC.js +1 -0
  204. package/static/auth-callback/assets/{auth-callback-D2UkK5Xj.js → auth-callback-Ds-c62W3.js} +5 -5
  205. package/static/auth-callback/assets/auth-callback-rk080mvG.css +1 -0
  206. package/static/auth-callback/assets/{badge-D7IJuuTM.js → badge-CQm5OyzR.js} +1 -1
  207. package/static/auth-callback/assets/{collection-runtime-wT1n4GS2.js → collection-runtime-DlAuU5TW.js} +1 -1
  208. package/static/auth-callback/assets/{dialog-DickLu5z.js → dialog-CnGzg5Ff.js} +1 -1
  209. package/static/auth-callback/assets/{download-kn8WnRu3.js → download-DwMONJvm.js} +1 -1
  210. package/static/auth-callback/assets/{external-link-B6B8jfSn.js → external-link-Bu5AGqCO.js} +1 -1
  211. package/static/auth-callback/assets/{index-DHF97YLP.js → index-B0T-1YO8.js} +1 -1
  212. package/static/auth-callback/assets/{index-Dz83EEHD.js → index-C8QZf_4W.js} +1 -1
  213. package/static/auth-callback/assets/index-DwIlrIDG.js +4 -0
  214. package/static/auth-callback/assets/{index-browser-CSghinyi.js → index-browser-lRsMcP_7.js} +1 -1
  215. package/static/auth-callback/assets/{key-round-ChkOx3E1.js → key-round-BDMtU57P.js} +1 -1
  216. package/static/auth-callback/assets/{rotate-ccw-B3hE-nyd.js → rotate-ccw-CoKIGCsQ.js} +1 -1
  217. package/static/auth-callback/assets/{skeleton-kEqR7tpI.js → skeleton-CPoSWHDr.js} +1 -1
  218. package/static/auth-callback/assets/{waypoints-D6Jo-SZa.js → waypoints-BeYHxqHv.js} +1 -1
  219. package/static/auth-callback/assets/{workspace-layout-BHwT_cHd.js → workspace-layout-xA5YxiK3.js} +1 -1
  220. package/static/auth-callback/auth-callback.html +2 -2
  221. package/static/dashboard/assets/{AiConfigContext-BfC3v-x2.js → AiConfigContext-rWx4TyiH.js} +1 -1
  222. package/static/dashboard/assets/{AiConfigPage-QNS3u7Ff.js → AiConfigPage-StVJpDFT.js} +1 -1
  223. package/static/dashboard/assets/{DocumentProcessingPanel-Dr4XLeT4.js → DocumentProcessingPanel-DJ5yul2O.js} +1 -1
  224. package/static/dashboard/assets/{IndexLifecyclePanel-KtM_gpeO.js → IndexLifecyclePanel-CpjtgezK.js} +1 -1
  225. package/static/dashboard/assets/{IndexSubjectPanel-DLaiKdLc.js → IndexSubjectPanel-BVKcot1_.js} +1 -1
  226. package/static/dashboard/assets/{ModelAssignmentsPanel-Bk7TvQRq.js → ModelAssignmentsPanel-BxVgWZPc.js} +1 -1
  227. package/static/dashboard/assets/{ModelsPage-Cci3vlos.js → ModelsPage-CECBwmeO.js} +3 -3
  228. package/static/dashboard/assets/NetworkPage-zQgFscEW.js +2 -0
  229. package/static/dashboard/assets/{PaneListHeader-qHME_s08.js → PaneListHeader-DIPe8pS6.js} +1 -1
  230. package/static/dashboard/assets/{SearchIndexingPanel-HZPKj8H9.js → SearchIndexingPanel-lalFJ3c8.js} +1 -1
  231. package/static/dashboard/assets/{StatusSubjectPanel-ij7IpI8d.js → StatusSubjectPanel-CpY_KU-G.js} +1 -1
  232. package/static/dashboard/assets/{StatusWorkspace-Cp02JcaN.js → StatusWorkspace-BwWCii3A.js} +1 -1
  233. package/static/dashboard/assets/{SystemSettingsPage-BSeuvb8X.js → SystemSettingsPage-BKZxX-_n.js} +1 -1
  234. package/static/dashboard/assets/{SystemSettingsSubjectPanel-CP4_luGS.js → SystemSettingsSubjectPanel-BZrqb2C5.js} +1 -1
  235. package/static/dashboard/assets/{XpodAiConnectionsPodStore-urO6zaHL.js → XpodAiConnectionsPodStore-Bbpx9dTN.js} +1 -1
  236. package/static/dashboard/assets/{activity-DxjgQNvr.js → activity-BJ15TLVP.js} +1 -1
  237. package/static/dashboard/assets/ai-connections-GG6qkTJt.js +1 -0
  238. package/static/dashboard/assets/{badge-53qCrRbl.js → badge-BBX5FlaB.js} +1 -1
  239. package/static/dashboard/assets/{collection-runtime-BPAmHG46.js → collection-runtime-UBbHBzdf.js} +1 -1
  240. package/static/dashboard/assets/{dashboard-BcT2ByXw.js → dashboard-7Y6BHyV9.js} +62 -62
  241. package/static/dashboard/assets/dashboard-rk080mvG.css +1 -0
  242. package/static/dashboard/assets/{dialog-B28YtNhS.js → dialog-QrOJ-hB0.js} +1 -1
  243. package/static/dashboard/assets/{download-DkLNceJ4.js → download-DK9x-VOP.js} +1 -1
  244. package/static/dashboard/assets/{external-link-D3TXnlo3.js → external-link-Cnkn87mJ.js} +1 -1
  245. package/static/dashboard/assets/index-B1z84it5.js +4 -0
  246. package/static/dashboard/assets/{index-CIiBu9mr.js → index-DzjauX3N.js} +1 -1
  247. package/static/dashboard/assets/{index-CFIenkeK.js → index-cIa8_efI.js} +1 -1
  248. package/static/dashboard/assets/{key-round-B5ccp6nx.js → key-round-BoS6UqKz.js} +1 -1
  249. package/static/dashboard/assets/{rotate-ccw-DUpfkNnk.js → rotate-ccw-BeWV76i0.js} +1 -1
  250. package/static/dashboard/assets/{skeleton-BRe19fO0.js → skeleton-CypcJL07.js} +1 -1
  251. package/static/dashboard/assets/{waypoints-BKDMxEvu.js → waypoints-zHOOqfhi.js} +1 -1
  252. package/static/dashboard/assets/{workspace-layout-ZTF7C16h.js → workspace-layout-DZ9JuxnM.js} +1 -1
  253. package/static/dashboard/dashboard.html +2 -2
  254. package/static/settings/assets/{AiConfigContext-DsyWgu2i.js → AiConfigContext-D3b1l_Kw.js} +1 -1
  255. package/static/settings/assets/{AiConfigPage-CSCBckKo.js → AiConfigPage-DYKw-atP.js} +1 -1
  256. package/static/settings/assets/{DocumentProcessingPanel-w9yQDbBe.js → DocumentProcessingPanel-DguRfsIV.js} +1 -1
  257. package/static/settings/assets/{IndexLifecyclePanel-CUUXI8mP.js → IndexLifecyclePanel-B85qJJA4.js} +1 -1
  258. package/static/settings/assets/{IndexSubjectPanel-BypAU5TJ.js → IndexSubjectPanel-CsN7IxaV.js} +1 -1
  259. package/static/settings/assets/{ModelAssignmentsPanel-BetgXw1G.js → ModelAssignmentsPanel-DEp9byI6.js} +1 -1
  260. package/static/settings/assets/{ModelsPage-DZpTlTZ3.js → ModelsPage-CzTnPs_G.js} +3 -3
  261. package/static/settings/assets/NetworkPage-BDVnmUU0.js +2 -0
  262. package/static/settings/assets/{PaneListHeader-BGOqGec4.js → PaneListHeader-Cpe39N76.js} +1 -1
  263. package/static/settings/assets/{SearchIndexingPanel-DYAbpZ_9.js → SearchIndexingPanel-DA9w8lLL.js} +1 -1
  264. package/static/settings/assets/{StatusSubjectPanel-CFgzeQ8Q.js → StatusSubjectPanel-BU0Aq0CS.js} +1 -1
  265. package/static/settings/assets/{StatusWorkspace-4Z6g4Jvv.js → StatusWorkspace-D1AC1i5N.js} +1 -1
  266. package/static/settings/assets/{SystemSettingsPage-C1tlrgvI.js → SystemSettingsPage-ChKvOioO.js} +1 -1
  267. package/static/settings/assets/{SystemSettingsSubjectPanel-CcURI-1L.js → SystemSettingsSubjectPanel-DyTpOnD2.js} +1 -1
  268. package/static/settings/assets/{XpodAiConnectionsPodStore-owBQc5nY.js → XpodAiConnectionsPodStore-VU5Bsz1a.js} +1 -1
  269. package/static/settings/assets/{activity-CtBc9cNy.js → activity-DGpLfsQB.js} +1 -1
  270. package/static/settings/assets/ai-connections-DexTPyfC.js +1 -0
  271. package/static/settings/assets/{badge--r-FDIhU.js → badge-_hCrrWRP.js} +1 -1
  272. package/static/settings/assets/{collection-runtime-CnhPmwAM.js → collection-runtime-E40TZ8Cl.js} +1 -1
  273. package/static/settings/assets/{dialog-B7ZRsjN7.js → dialog-DTr2JkHn.js} +1 -1
  274. package/static/settings/assets/{download-DgQ1F8QR.js → download-B_D21DDX.js} +1 -1
  275. package/static/settings/assets/{external-link-Bz7NckNO.js → external-link-BATYaM13.js} +1 -1
  276. package/static/settings/assets/index-BAlAVi-J.js +4 -0
  277. package/static/settings/assets/{index-CkGda_Pg.js → index-Ckh4h9jj.js} +1 -1
  278. package/static/settings/assets/{index-Vv-8Vslg.js → index-DOiwLF4B.js} +1 -1
  279. package/static/settings/assets/{index-browser-Dq7omlpY.js → index-browser-DFFWN3Kr.js} +1 -1
  280. package/static/settings/assets/{key-round-CvuhloKV.js → key-round-ZTVU_1O1.js} +1 -1
  281. package/static/settings/assets/{rotate-ccw-DgFKDaz7.js → rotate-ccw-DDdw8PTU.js} +1 -1
  282. package/static/settings/assets/{settings-BvqY7K96.js → settings-CyLnISOv.js} +62 -62
  283. package/static/settings/assets/settings-rk080mvG.css +1 -0
  284. package/static/settings/assets/{skeleton-D3OeFDF6.js → skeleton-DEzA3hc2.js} +1 -1
  285. package/static/settings/assets/{waypoints-C4WbspTb.js → waypoints-BSdfNvEb.js} +1 -1
  286. package/static/settings/assets/{workspace-layout-B9H1Tqrk.js → workspace-layout-BOQnl_3d.js} +1 -1
  287. package/static/settings/settings.html +2 -2
  288. package/dist/api/ai-gateway/pod/HostedPodDataAccess.d.ts +0 -31
  289. package/dist/api/ai-gateway/pod/HostedPodDataAccess.js +0 -330
  290. package/dist/http/InternalPodDataHttpHandler.d.ts +0 -57
  291. package/dist/http/InternalPodDataHttpHandler.js +0 -551
  292. package/dist/http/InternalPodDataHttpHandler.jsonld +0 -243
  293. package/node_modules/@undefineds.co/ai-connections-core/package.json +0 -61
  294. package/static/auth-callback/assets/NetworkPage-cEvxRMAl.js +0 -2
  295. package/static/auth-callback/assets/ai-connections-C6yaE6WQ.js +0 -1
  296. package/static/auth-callback/assets/auth-callback-Cx9D_1qj.css +0 -1
  297. package/static/auth-callback/assets/index-Cu0EguPo.js +0 -4
  298. package/static/dashboard/assets/NetworkPage-Ot4G2dX5.js +0 -2
  299. package/static/dashboard/assets/ai-connections-CXp5gd1J.js +0 -1
  300. package/static/dashboard/assets/dashboard-Cx9D_1qj.css +0 -1
  301. package/static/dashboard/assets/index-Gp3cLolR.js +0 -4
  302. package/static/settings/assets/NetworkPage-BVkasFGM.js +0 -2
  303. package/static/settings/assets/ai-connections-C6yaE6WQ.js +0 -1
  304. package/static/settings/assets/index-BdXwm8nh.js +0 -4
  305. package/static/settings/assets/settings-Cx9D_1qj.css +0 -1
  306. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client/normalize.d.ts +0 -0
  307. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client/normalize.js +0 -0
  308. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client/request.d.ts +0 -0
  309. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client/request.js +0 -0
  310. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client/types.d.ts +0 -0
  311. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client/types.js +0 -0
  312. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client-config/base-adapter.d.ts +0 -0
  313. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client-config/base-adapter.js +0 -0
  314. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client-config/codex.d.ts +0 -0
  315. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client-config/codex.js +0 -0
  316. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client-config/index.d.ts +0 -0
  317. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client-config/index.js +0 -0
  318. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client-config/json-env-adapter.d.ts +0 -0
  319. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client-config/json-env-adapter.js +0 -0
  320. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client-config/pi.d.ts +0 -0
  321. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client-config/pi.js +0 -0
  322. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client-config/transaction.d.ts +0 -0
  323. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client-config/transaction.js +0 -0
  324. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client-config/types.d.ts +0 -0
  325. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/client-config/types.js +0 -0
  326. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/credential-storage.d.ts +0 -0
  327. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/credential-storage.js +0 -0
  328. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/endpoint-urls.d.ts +0 -0
  329. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/endpoint-urls.js +0 -0
  330. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/provider-catalog.d.ts +0 -0
  331. /package/node_modules/@undefineds.co/{ai-connections-core/dist → ai-connections/dist/contract}/provider-catalog.js +0 -0
@@ -4,8 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.GatewayProxy = void 0;
7
+ exports.forwardedFromOutside = forwardedFromOutside;
7
8
  const http_proxy_1 = __importDefault(require("http-proxy"));
8
9
  const http_1 = __importDefault(require("http"));
10
+ const node_net_1 = require("node:net");
9
11
  const global_logger_factory_1 = require("global-logger-factory");
10
12
  const NodeRuntimeHost_1 = require("./host/node/NodeRuntimeHost");
11
13
  const GatewayAdminProxyAuth_1 = require("./GatewayAdminProxyAuth");
@@ -58,6 +60,7 @@ class GatewayProxy {
58
60
  this.baseUrl = options.baseUrl;
59
61
  this.internalAdminAuthSecret = options.internalAdminAuthSecret;
60
62
  this.clientRemoteAddressResolver = options.clientRemoteAddressResolver;
63
+ this.ingressPort = options.ingressPort;
61
64
  this.proxy = http_proxy_1.default.createProxyServer({
62
65
  xfwd: true,
63
66
  });
@@ -87,14 +90,26 @@ class GatewayProxy {
87
90
  outgoing.end(rewritten.body);
88
91
  });
89
92
  });
90
- this.server = http_1.default.createServer(this.handleRequest.bind(this));
93
+ this.server = this.createListener(false);
94
+ if (this.ingressPort !== undefined) {
95
+ this.ingressServer = this.createListener(true);
96
+ }
91
97
  if (options.nativeUpgradeRelay ?? isBunRuntime()) {
92
98
  this.nativeUpgradeRelay = new BunNativeUpgradeRelay_1.BunNativeUpgradeRelay({
93
99
  logger: this.logger,
94
100
  fallback: (req, socket, head, target) => this.relayUpgradeWithHttpProxy(req, socket, head, target),
95
101
  });
96
102
  }
97
- this.server.on('upgrade', (req, socket, head) => {
103
+ }
104
+ /**
105
+ * Builds one HTTP listener plus its WebSocket routing.
106
+ *
107
+ * `untrustedIngress` marks the listener that tunnels and the P2P data plane
108
+ * connect to; see `ingressPort`.
109
+ */
110
+ createListener(untrustedIngress) {
111
+ const server = http_1.default.createServer((req, res) => this.handleRequest(req, res, untrustedIngress));
112
+ server.on('upgrade', (req, socket, head) => {
98
113
  this.trackUpgradeSocket(socket);
99
114
  const target = this.resolveUpgradeTarget(req.url ?? '/');
100
115
  if (!target) {
@@ -107,6 +122,7 @@ class GatewayProxy {
107
122
  }
108
123
  this.relayUpgradeWithHttpProxy(req, socket, head, target);
109
124
  });
125
+ return server;
110
126
  }
111
127
  /**
112
128
  * Upgraded sockets outlive the HTTP request that created them; they are
@@ -143,6 +159,10 @@ class GatewayProxy {
143
159
  async start() {
144
160
  await this.runtimeHost.listen(this.server, this.listenEndpoint);
145
161
  this.logger.info(`Listening on ${this.runtimeHost.formatListenEndpoint(this.listenEndpoint)}`);
162
+ if (this.ingressServer) {
163
+ await this.runtimeHost.listen(this.ingressServer, this.ingressListenEndpoint());
164
+ this.logger.info(`Ingress listener on 127.0.0.1:${this.ingressPort} (never local)`);
165
+ }
146
166
  }
147
167
  async stop() {
148
168
  this.nativeUpgradeRelay?.close();
@@ -153,7 +173,10 @@ class GatewayProxy {
153
173
  }
154
174
  this.upgradeSockets.clear();
155
175
  this.proxy.close();
156
- await this.closeServer();
176
+ await this.closeServer(this.server, this.listenEndpoint);
177
+ if (this.ingressServer) {
178
+ await this.closeServer(this.ingressServer, this.ingressListenEndpoint());
179
+ }
157
180
  }
158
181
  /**
159
182
  * Closes the listener with a bounded wait.
@@ -164,8 +187,8 @@ class GatewayProxy {
164
187
  * back once a WebSocket was closed from the server side
165
188
  * (oven-sh/bun#28396), so waiting forever would block gateway restarts.
166
189
  */
167
- async closeServer() {
168
- const closing = this.runtimeHost.close(this.server, this.listenEndpoint);
190
+ async closeServer(server, endpoint) {
191
+ const closing = this.runtimeHost.close(server, endpoint);
169
192
  let timer;
170
193
  const timedOut = await Promise.race([
171
194
  closing.then(() => false),
@@ -182,7 +205,10 @@ class GatewayProxy {
182
205
  void closing.catch(() => undefined);
183
206
  }
184
207
  }
185
- handleRequest(req, res) {
208
+ ingressListenEndpoint() {
209
+ return this.runtimeHost.createListenEndpoint({ port: this.ingressPort, host: '127.0.0.1' });
210
+ }
211
+ handleRequest(req, res, untrustedIngress = false) {
186
212
  const url = req.url ?? '/';
187
213
  // Route matching must ignore the query string: OIDC callbacks and other
188
214
  // product URLs arrive as `/ai-connections?code=...`, and exact-path
@@ -190,12 +216,15 @@ class GatewayProxy {
190
216
  const pathname = url.split('?')[0];
191
217
  const origin = req.headers.origin;
192
218
  const originalRemoteAddress = this.clientRemoteAddressResolver?.(req) ?? req.socket.remoteAddress;
193
- const originalClientLoopback = (0, GatewayAdminProxyAuth_1.isLoopbackRemoteAddress)(originalRemoteAddress);
194
- const internalPodProxyHeaders = this.verifiedInternalPodProxyHeaders(req, originalClientLoopback);
219
+ // A loopback peer address only proves the connection came from this machine: tunnels and
220
+ // the P2P data plane terminate here too. Forwarded-for is what separates them - a local
221
+ // dev proxy forwards this machine's address, while a provider edge appends the address it
222
+ // saw, so a request whose right-most forwarder is not loopback came from outside and is
223
+ // never local, whatever its peer address or headers say.
224
+ const originalClientLoopback = !untrustedIngress
225
+ && !forwardedFromOutside(req)
226
+ && (0, GatewayAdminProxyAuth_1.isLoopbackRemoteAddress)(originalRemoteAddress);
195
227
  (0, GatewayAdminProxyAuth_1.stripGatewayAdminProxyHeaders)(req.headers);
196
- if (internalPodProxyHeaders) {
197
- Object.assign(req.headers, internalPodProxyHeaders);
198
- }
199
228
  // Store public host for routing before any CSS canonical-host rewrites.
200
229
  // External gateways pass the original domain through X-Forwarded-Host;
201
230
  // direct/local requests use Host.
@@ -275,7 +304,7 @@ class GatewayProxy {
275
304
  if (origin) {
276
305
  this.addCorsHeaders(res, origin);
277
306
  }
278
- void this.handleInternalApi(req, res);
307
+ void this.handleInternalApi(req, res, this.hasOperatorAuthority(req, originalClientLoopback));
279
308
  return;
280
309
  }
281
310
  // 2. API Server Routing.
@@ -360,24 +389,6 @@ class GatewayProxy {
360
389
  originalClientLoopback,
361
390
  }));
362
391
  }
363
- verifiedInternalPodProxyHeaders(req, originalClientLoopback) {
364
- if (!originalClientLoopback || req.url !== '/.internal/pod-data') {
365
- return undefined;
366
- }
367
- const verification = (0, GatewayAdminProxyAuth_1.verifyGatewayAdminProxyHeaders)({
368
- headers: req.headers,
369
- secret: this.internalAdminAuthSecret,
370
- method: req.method,
371
- url: req.url,
372
- });
373
- if (!verification.valid || !verification.originalClientLoopback || !verification.intent || !verification.nonce) {
374
- return undefined;
375
- }
376
- return Object.fromEntries(GatewayAdminProxyAuth_1.GATEWAY_ADMIN_PROXY_HEADERS.flatMap((header) => {
377
- const value = req.headers[header];
378
- return value === undefined ? [] : [[header, value]];
379
- }));
380
- }
381
392
  isApiHost(hostHeader) {
382
393
  const host = this.normalizeHost(hostHeader);
383
394
  if (!host) {
@@ -552,11 +563,35 @@ class GatewayProxy {
552
563
  res.setHeader('Access-Control-Allow-Headers', CORS_CONFIG.allowedHeaders.join(', '));
553
564
  res.setHeader('Access-Control-Expose-Headers', CORS_CONFIG.exposedHeaders.join(', '));
554
565
  }
555
- async handleInternalApi(req, res) {
566
+ /**
567
+ * Whether this request carries operator authority.
568
+ *
569
+ * `/service/*` exposes logs and service control, so a caller that only reached the Gateway
570
+ * through a tunnel must not get it - whatever address it presents. A local caller counts, and
571
+ * so does a signed gateway admin proxy header, which is how the same machine proves it is the
572
+ * operator through a local forwarder.
573
+ */
574
+ hasOperatorAuthority(req, originalClientLoopback) {
575
+ if (originalClientLoopback) {
576
+ return true;
577
+ }
578
+ if (!this.internalAdminAuthSecret) {
579
+ return false;
580
+ }
581
+ const verification = (0, GatewayAdminProxyAuth_1.verifyGatewayAdminProxyHeaders)({
582
+ headers: req.headers,
583
+ secret: this.internalAdminAuthSecret,
584
+ method: req.method,
585
+ url: req.url,
586
+ });
587
+ return verification.valid;
588
+ }
589
+ async handleInternalApi(req, res, operatorAuthorized) {
556
590
  try {
557
591
  const reqUrl = req.url ?? '/';
558
592
  const parsed = new URL(reqUrl, 'http://localhost');
559
593
  const pathname = parsed.pathname;
594
+ // Status is the entry probe every client uses, and it carries no secrets.
560
595
  if (pathname === '/service/status') {
561
596
  const status = this.supervisor.getAllStatus();
562
597
  const cssReady = await this.isCssReady();
@@ -566,6 +601,10 @@ class GatewayProxy {
566
601
  return;
567
602
  }
568
603
  if (pathname === '/service/logs') {
604
+ if (!operatorAuthorized) {
605
+ sendOperatorRequired(res);
606
+ return;
607
+ }
569
608
  const level = parsed.searchParams.get('level') ?? undefined;
570
609
  const source = parsed.searchParams.get('source') ?? undefined;
571
610
  const limitValue = parsed.searchParams.get('limit');
@@ -581,6 +620,10 @@ class GatewayProxy {
581
620
  }
582
621
  const restartMatch = /^\/service\/restart\/([^/]+)$/.exec(pathname);
583
622
  if (restartMatch && req.method === 'POST') {
623
+ if (!operatorAuthorized) {
624
+ sendOperatorRequired(res);
625
+ return;
626
+ }
584
627
  const service = decodeURIComponent(restartMatch[1]);
585
628
  if (service === 'gateway') {
586
629
  res.writeHead(409, { 'Content-Type': 'application/json' });
@@ -603,6 +646,10 @@ class GatewayProxy {
603
646
  return;
604
647
  }
605
648
  if (pathname === '/service/stop' && req.method === 'POST') {
649
+ if (!operatorAuthorized) {
650
+ sendOperatorRequired(res);
651
+ return;
652
+ }
606
653
  res.writeHead(200, { 'Content-Type': 'application/json' });
607
654
  res.end(JSON.stringify({ ok: true }));
608
655
  setImmediate(() => {
@@ -655,4 +702,51 @@ exports.GatewayProxy = GatewayProxy;
655
702
  function isBunRuntime() {
656
703
  return typeof globalThis.Bun !== 'undefined';
657
704
  }
705
+ /**
706
+ * Whether the client-address headers say this request travelled through a forwarder outside
707
+ * this machine.
708
+ *
709
+ * This is the fallback behind the structural gate (the Gateway's tunnel entry listener): a
710
+ * tunnel pointed at the Gateway port by mistake still must not inherit local trust. Only
711
+ * headers that carry a client *address* count - `x-forwarded-for`, `x-real-ip` and the
712
+ * `for=` part of `Forwarded`. `x-forwarded-host`/`x-forwarded-proto` do not: a local dev proxy
713
+ * sets them for local browsers too, so treating them as evidence would lock the operator out
714
+ * of their own admin surface.
715
+ *
716
+ * The right-most value is the address the last forwarder saw - the one our own handlers append
717
+ * (`ClusterIngressRouter`, `EdgeNodeProxyHttpHandler`, `PodRoutingHttpHandler`) - so a client
718
+ * cannot look local by sending its own. An unreadable value is treated as remote.
719
+ */
720
+ /** Service control and logs are for the operator, not for whoever reached the entry. */
721
+ function sendOperatorRequired(res) {
722
+ res.writeHead(403, { 'Content-Type': 'application/json' });
723
+ res.end(JSON.stringify({ error: 'Operator access required' }));
724
+ }
725
+ function forwardedFromOutside(req) {
726
+ const evidence = [
727
+ ...splitHeaderList(req.headers['x-forwarded-for']),
728
+ ...splitHeaderList(req.headers['x-real-ip']),
729
+ ...forwardedForParameters(req.headers.forwarded),
730
+ ];
731
+ const last = evidence.at(-1);
732
+ if (last === undefined) {
733
+ return false;
734
+ }
735
+ return (0, node_net_1.isIP)(last) === 0 || !(0, GatewayAdminProxyAuth_1.isLoopbackRemoteAddress)(last);
736
+ }
737
+ function splitHeaderList(raw) {
738
+ const value = Array.isArray(raw) ? raw.join(',') : raw;
739
+ return value?.split(',').map((entry) => entry.trim()).filter(Boolean) ?? [];
740
+ }
741
+ /** The `for=` values of an RFC 7239 `Forwarded` header, in order. */
742
+ function forwardedForParameters(raw) {
743
+ const value = Array.isArray(raw) ? raw.join(',') : raw;
744
+ if (!value) {
745
+ return [];
746
+ }
747
+ return value.split(/[;,]/u)
748
+ .map((part) => /^\s*for\s*=\s*(.+)$/iu.exec(part.trim())?.[1])
749
+ .filter((entry) => Boolean(entry))
750
+ .map((entry) => entry.replace(/^"|"$/gu, '').replace(/^\[|\]$/gu, ''));
751
+ }
658
752
  //# sourceMappingURL=Proxy.js.map
@@ -25,9 +25,30 @@ export interface RuntimeBootstrapState {
25
25
  ports: XpodRuntimePorts;
26
26
  sockets: XpodRuntimeSockets;
27
27
  }
28
+ /**
29
+ * Address that a co-located runtime service must be reached on when it was bound
30
+ * to `bindHost`. Wildcard binds are not connectable on every platform, so they
31
+ * map to their loopback counterpart; any other value (including a hostname such
32
+ * as `localhost`, which may resolve to IPv6 only) is used as-is, because the
33
+ * gateway must connect to the very address the service actually bound.
34
+ */
35
+ export declare function connectHostForBindHost(bindHost?: string): string;
36
+ /** Loopback URL for a runtime service bound to `bindHost`. */
37
+ export declare function localServiceUrl(bindHost: string | undefined, port: number): string;
28
38
  export declare function cssAuthModeConfigImports(authMode: AuthMode): string[];
29
39
  export declare function resolveRuntimeBootstrap(id: string, options: XpodRuntimeOptions, host: RuntimeHost, platform?: RuntimePlatform): Promise<RuntimeBootstrapState>;
30
40
  export declare function buildRuntimeEnv(state: RuntimeBootstrapState, options: XpodRuntimeOptions, envFromFile?: Record<string, string | undefined>): Record<string, string | undefined>;
41
+ /**
42
+ * Local endpoints the edge agent uses when it serves P2P peer traffic.
43
+ *
44
+ * `targetBaseUrl` is where forwarded peer requests are sent: the ingress listener,
45
+ * which the Gateway never treats as local. `lanBaseUrl` stays on the gateway
46
+ * listener because other devices on the LAN must be able to reach it.
47
+ */
48
+ export declare function resolveP2PLocalBaseUrls(state: RuntimeBootstrapState): {
49
+ targetBaseUrl?: string;
50
+ lanBaseUrl?: string;
51
+ };
31
52
  export declare function buildRuntimeShorthand(runtimeEnv: Record<string, string | undefined>, options: XpodRuntimeOptions, state: RuntimeBootstrapState, baseEnv?: Record<string, string | undefined>): Record<string, string | number | boolean>;
32
53
  export declare function createCssRuntimeConfig(state: RuntimeBootstrapState, _open?: boolean, platform?: Pick<RuntimePlatform, 'dirname' | 'ensureDir' | 'joinPath' | 'readTextFile' | 'writeTextFile'>): string;
33
54
  export declare function initRuntimeLogger(level: string, platform?: Pick<RuntimePlatform, 'cwd' | 'joinPath'>): void;
@@ -3,9 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.connectHostForBindHost = connectHostForBindHost;
7
+ exports.localServiceUrl = localServiceUrl;
6
8
  exports.cssAuthModeConfigImports = cssAuthModeConfigImports;
7
9
  exports.resolveRuntimeBootstrap = resolveRuntimeBootstrap;
8
10
  exports.buildRuntimeEnv = buildRuntimeEnv;
11
+ exports.resolveP2PLocalBaseUrls = resolveP2PLocalBaseUrls;
9
12
  exports.buildRuntimeShorthand = buildRuntimeShorthand;
10
13
  exports.createCssRuntimeConfig = createCssRuntimeConfig;
11
14
  exports.initRuntimeLogger = initRuntimeLogger;
@@ -34,6 +37,28 @@ function ensureTrailingSlash(url) {
34
37
  function publicHostForBindHost(bindHost) {
35
38
  return bindHost === '127.0.0.1' || bindHost === '::1' ? 'localhost' : bindHost;
36
39
  }
40
+ /**
41
+ * Address that a co-located runtime service must be reached on when it was bound
42
+ * to `bindHost`. Wildcard binds are not connectable on every platform, so they
43
+ * map to their loopback counterpart; any other value (including a hostname such
44
+ * as `localhost`, which may resolve to IPv6 only) is used as-is, because the
45
+ * gateway must connect to the very address the service actually bound.
46
+ */
47
+ function connectHostForBindHost(bindHost) {
48
+ const host = bindHost ?? '127.0.0.1';
49
+ if (host === '0.0.0.0') {
50
+ return '127.0.0.1';
51
+ }
52
+ if (host === '::' || host === '[::]' || host === '::0') {
53
+ return '::1';
54
+ }
55
+ return host;
56
+ }
57
+ /** Loopback URL for a runtime service bound to `bindHost`. */
58
+ function localServiceUrl(bindHost, port) {
59
+ const host = connectHostForBindHost(bindHost);
60
+ return `http://${host.includes(':') ? `[${host}]` : host}:${port}`;
61
+ }
37
62
  function normalizeWindowsAbsolutePath(filePath) {
38
63
  return filePath.replace(/^[\\/]+(?=[A-Za-z]:[\\/])/, '');
39
64
  }
@@ -204,6 +229,7 @@ function buildRuntimeEnv(state, options, envFromFile = {}) {
204
229
  API_HOST: state.bindHost,
205
230
  API_SOCKET_PATH: state.sockets.api,
206
231
  XPOD_MAIN_PORT: state.ports.gateway !== undefined ? String(state.ports.gateway) : undefined,
232
+ XPOD_GATEWAY_INGRESS_PORT: state.ports.ingress !== undefined ? String(state.ports.ingress) : undefined,
207
233
  XPOD_GATEWAY_ADMIN_PROXY_AUTH_SECRET: state.gatewayAdminProxyAuthSecret,
208
234
  // Auto-provision may write these during API startup. Include them even when
209
235
  // undefined so RuntimeEnvironmentSession can restore/clear them afterwards.
@@ -222,11 +248,28 @@ function buildRuntimeEnv(state, options, envFromFile = {}) {
222
248
  };
223
249
  return (0, AuthMode_1.applyAuthModeEnv)(runtimeEnv, state.cssAuthMode);
224
250
  }
251
+ /**
252
+ * Local endpoints the edge agent uses when it serves P2P peer traffic.
253
+ *
254
+ * `targetBaseUrl` is where forwarded peer requests are sent: the ingress listener,
255
+ * which the Gateway never treats as local. `lanBaseUrl` stays on the gateway
256
+ * listener because other devices on the LAN must be able to reach it.
257
+ */
258
+ function resolveP2PLocalBaseUrls(state) {
259
+ if (state.transport !== 'port' || state.ports.gateway === undefined) {
260
+ return {};
261
+ }
262
+ return {
263
+ targetBaseUrl: state.ports.ingress === undefined ? undefined : `http://127.0.0.1:${state.ports.ingress}/`,
264
+ lanBaseUrl: `http://127.0.0.1:${state.ports.gateway}/`,
265
+ };
266
+ }
225
267
  function buildRuntimeShorthand(runtimeEnv, options, state, baseEnv = NodeRuntimePlatform_1.nodeRuntimePlatform.baseEnv) {
226
268
  const envValue = (key) => runtimeEnv[key] ?? baseEnv[key];
227
269
  const externalOidcIssuer = (0, oidc_issuer_1.resolveExternalOidcIssuer)({
228
270
  SOLID_OIDC_ISSUER: envValue('SOLID_OIDC_ISSUER'),
229
271
  });
272
+ const p2pLocalBaseUrls = resolveP2PLocalBaseUrls(state);
230
273
  return {
231
274
  ...withDefinedEntries([
232
275
  ['baseStorageDomain', envValue('CSS_BASE_STORAGE_DOMAIN')],
@@ -249,7 +292,8 @@ function buildRuntimeShorthand(runtimeEnv, options, state, baseEnv = NodeRuntime
249
292
  ['nodeId', envValue('XPOD_NODE_ID')],
250
293
  ['nodeToken', envValue('XPOD_NODE_TOKEN')],
251
294
  ['p2pEnabled', envValue('XPOD_P2P_ENABLED')],
252
- ['p2pTargetBaseUrl', envValue('XPOD_P2P_TARGET_BASE_URL')],
295
+ ['p2pTargetBaseUrl', envValue('XPOD_P2P_TARGET_BASE_URL') ?? p2pLocalBaseUrls.targetBaseUrl],
296
+ ['p2pLanBaseUrl', envValue('XPOD_P2P_LAN_BASE_URL') ?? p2pLocalBaseUrls.lanBaseUrl],
253
297
  ['p2pLabel', envValue('XPOD_P2P_LABEL')],
254
298
  ['p2pAcceptIntervalMs', envValue('XPOD_P2P_ACCEPT_INTERVAL_MS')],
255
299
  ['p2pConnectTimeoutMs', envValue('XPOD_P2P_CONNECT_TIMEOUT_MS')],
@@ -30,6 +30,7 @@ export declare function buildApiChildEnv(options: {
30
30
  apiPort: number;
31
31
  mainPort: number;
32
32
  cssPort: number;
33
+ ingressPort?: number;
33
34
  baseUrl: string;
34
35
  rdfIndexPath?: string;
35
36
  authMode?: AuthMode | string;
@@ -271,6 +271,7 @@ function buildApiChildEnv(options) {
271
271
  ...(options.externalOidcIssuer ? { oidcIssuer: options.externalOidcIssuer } : {}),
272
272
  API_PORT: options.apiPort.toString(),
273
273
  XPOD_MAIN_PORT: options.mainPort.toString(),
274
+ ...(options.ingressPort !== undefined ? { XPOD_GATEWAY_INGRESS_PORT: options.ingressPort.toString() } : {}),
274
275
  CSS_PORT: options.cssPort.toString(),
275
276
  CSS_BASE_URL: baseUrl,
276
277
  ...(options.gatewayAdminProxyAuthSecret ? { XPOD_GATEWAY_ADMIN_PROXY_AUTH_SECRET: options.gatewayAdminProxyAuthSecret } : {}),
@@ -23,7 +23,12 @@ class NodeRuntimeHost {
23
23
  const gateway = options.gatewayPort ?? await (0, port_finder_1.getFreePort)(options.basePort ?? 5600);
24
24
  const css = options.cssPort ?? await (0, port_finder_1.getFreePort)(gateway + 1);
25
25
  const api = options.apiPort ?? await (0, port_finder_1.getFreePort)(css + 1);
26
- return { gateway, css, api };
26
+ // Tunnels (and the P2P data plane) terminate here, and this listener never treats a
27
+ // caller as local whatever headers it carries - that is the gate. Its port is the one
28
+ // number the user copies into a provider console, so it is predictable rather than
29
+ // random, and it is what the runtime reports as the tunnel origin.
30
+ const ingress = options.ingressPort ?? await (0, port_finder_1.findGatewayIngressPort)(gateway);
31
+ return { gateway, css, api, ingress };
27
32
  }
28
33
  createListenEndpoint(options) {
29
34
  if (options.socketPath) {
@@ -24,12 +24,18 @@ export interface RuntimePortAllocationOptions {
24
24
  gatewayPort?: number;
25
25
  cssPort?: number;
26
26
  apiPort?: number;
27
+ ingressPort?: number;
27
28
  basePort?: number;
28
29
  }
29
30
  export interface RuntimePorts {
30
31
  gateway: number;
31
32
  css: number;
32
33
  api: number;
34
+ /**
35
+ * Loopback-only listener that remote forwarding paths (managed tunnels, P2P
36
+ * data plane) use as their origin, so their requests never count as local.
37
+ */
38
+ ingress: number;
33
39
  }
34
40
  export interface RuntimeHost {
35
41
  readonly name: string;
@@ -10,7 +10,7 @@ export { createOpenAuthContext, registerManagedRuntimeServices, startApiRuntime,
10
10
  export type { RuntimeServices } from './lifecycle';
11
11
  export { GatewayProxy } from './Proxy';
12
12
  export { createGatewayAdminProxyAuthSecret } from './GatewayAdminProxyAuth';
13
- export { getFreePort, getFreePortForWildcard } from './port-finder';
13
+ export { findGatewayIngressPort, getEphemeralLoopbackPort, getFreePort, getFreePortForWildcard, requireFreePortForWildcard } from './port-finder';
14
14
  export { ensureTrailingSlash, INVALID_CONFIGURATION_PREFIX, validateBaseUrl } from './base-url';
15
15
  export type { ValidateBaseUrlOptions } from './base-url';
16
16
  export { applyEnv, loadEnvFile } from './env-utils';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.startXpodRuntime = exports.nodeGatewayRuntimeRunner = exports.NodeGatewayRuntimeRunner = exports.nodeApiRuntimeRunner = exports.NodeApiRuntimeRunner = exports.communitySolidServerCssRunner = exports.CommunitySolidServerCssRunner = exports.registerSocketOriginShims = exports.registerSocketFetchOrigin = exports.nodeRuntimePlatform = exports.NodeRuntimePlatform = exports.nodeRuntimeHost = exports.NodeRuntimeHost = exports.resolveXpodEnvPath = exports.defaultXpodEnvPath = exports.loadEnvFile = exports.applyEnv = exports.validateBaseUrl = exports.INVALID_CONFIGURATION_PREFIX = exports.ensureTrailingSlash = exports.getFreePortForWildcard = exports.getFreePort = exports.createGatewayAdminProxyAuthSecret = exports.GatewayProxy = exports.stopRuntimeServices = exports.startGatewayRuntime = exports.startCssRuntime = exports.startApiRuntime = exports.registerManagedRuntimeServices = exports.createOpenAuthContext = exports.createRuntimeEnvironmentSession = exports.nodeRuntimeDriver = exports.NodeRuntimeDriver = exports.resolveRuntimeBootstrap = exports.initRuntimeLogger = exports.createCssRuntimeConfig = exports.buildRuntimeShorthand = exports.buildRuntimeEnv = exports.ensureBunUndiciCompat = exports.findPackageRoot = exports.PACKAGE_ROOT = void 0;
3
+ exports.startXpodRuntime = exports.nodeGatewayRuntimeRunner = exports.NodeGatewayRuntimeRunner = exports.nodeApiRuntimeRunner = exports.NodeApiRuntimeRunner = exports.communitySolidServerCssRunner = exports.CommunitySolidServerCssRunner = exports.registerSocketOriginShims = exports.registerSocketFetchOrigin = exports.nodeRuntimePlatform = exports.NodeRuntimePlatform = exports.nodeRuntimeHost = exports.NodeRuntimeHost = exports.resolveXpodEnvPath = exports.defaultXpodEnvPath = exports.loadEnvFile = exports.applyEnv = exports.validateBaseUrl = exports.INVALID_CONFIGURATION_PREFIX = exports.ensureTrailingSlash = exports.requireFreePortForWildcard = exports.getFreePortForWildcard = exports.getFreePort = exports.getEphemeralLoopbackPort = exports.findGatewayIngressPort = exports.createGatewayAdminProxyAuthSecret = exports.GatewayProxy = exports.stopRuntimeServices = exports.startGatewayRuntime = exports.startCssRuntime = exports.startApiRuntime = exports.registerManagedRuntimeServices = exports.createOpenAuthContext = exports.createRuntimeEnvironmentSession = exports.nodeRuntimeDriver = exports.NodeRuntimeDriver = exports.resolveRuntimeBootstrap = exports.initRuntimeLogger = exports.createCssRuntimeConfig = exports.buildRuntimeShorthand = exports.buildRuntimeEnv = exports.ensureBunUndiciCompat = exports.findPackageRoot = exports.PACKAGE_ROOT = void 0;
4
4
  require("./configure-drizzle-solid");
5
5
  var package_root_1 = require("./package-root");
6
6
  Object.defineProperty(exports, "PACKAGE_ROOT", { enumerable: true, get: function () { return package_root_1.PACKAGE_ROOT; } });
@@ -30,8 +30,11 @@ Object.defineProperty(exports, "GatewayProxy", { enumerable: true, get: function
30
30
  var GatewayAdminProxyAuth_1 = require("./GatewayAdminProxyAuth");
31
31
  Object.defineProperty(exports, "createGatewayAdminProxyAuthSecret", { enumerable: true, get: function () { return GatewayAdminProxyAuth_1.createGatewayAdminProxyAuthSecret; } });
32
32
  var port_finder_1 = require("./port-finder");
33
+ Object.defineProperty(exports, "findGatewayIngressPort", { enumerable: true, get: function () { return port_finder_1.findGatewayIngressPort; } });
34
+ Object.defineProperty(exports, "getEphemeralLoopbackPort", { enumerable: true, get: function () { return port_finder_1.getEphemeralLoopbackPort; } });
33
35
  Object.defineProperty(exports, "getFreePort", { enumerable: true, get: function () { return port_finder_1.getFreePort; } });
34
36
  Object.defineProperty(exports, "getFreePortForWildcard", { enumerable: true, get: function () { return port_finder_1.getFreePortForWildcard; } });
37
+ Object.defineProperty(exports, "requireFreePortForWildcard", { enumerable: true, get: function () { return port_finder_1.requireFreePortForWildcard; } });
35
38
  var base_url_1 = require("./base-url");
36
39
  Object.defineProperty(exports, "ensureTrailingSlash", { enumerable: true, get: function () { return base_url_1.ensureTrailingSlash; } });
37
40
  Object.defineProperty(exports, "INVALID_CONFIGURATION_PREFIX", { enumerable: true, get: function () { return base_url_1.INVALID_CONFIGURATION_PREFIX; } });
@@ -19,8 +19,15 @@ function findBunExecutable() {
19
19
  return result.status === 0 ? result.stdout.trim() || undefined : undefined;
20
20
  }
21
21
  function jsEntrypointArgs(entrypoint, isBun) {
22
- return !isBun && entrypoint.endsWith('.ts')
23
- ? ['-r', require.resolve('ts-node/register/transpile-only'), entrypoint]
24
- : [entrypoint];
22
+ if (!isBun) {
23
+ return entrypoint.endsWith('.ts')
24
+ ? ['-r', require.resolve('ts-node/register/transpile-only'), entrypoint]
25
+ : [entrypoint];
26
+ }
27
+ // A child service runs on the environment its parent decided for it. Without this, Bun loads
28
+ // whichever .env files happen to sit in the child's cwd, so a checkout's developer env files
29
+ // leak into a runtime that was started standalone (`bun run local` already loads them once, for
30
+ // the parent, on purpose).
31
+ return ['--no-env-file', entrypoint];
25
32
  }
26
33
  //# sourceMappingURL=js-runtime.js.map
@@ -7,6 +7,7 @@ exports.startApiRuntime = startApiRuntime;
7
7
  exports.startGatewayRuntime = startGatewayRuntime;
8
8
  exports.stopRuntimeServices = stopRuntimeServices;
9
9
  const package_root_1 = require("./package-root");
10
+ const bootstrap_1 = require("./bootstrap");
10
11
  const RedisClientLifecycle_1 = require("../storage/redis/RedisClientLifecycle");
11
12
  const DEFAULT_SERVICE_STOP_TIMEOUT_MS = 5_000;
12
13
  async function stopWithTimeout(name, stop, timeoutMs) {
@@ -80,7 +81,7 @@ async function startCssRuntime({ state, host, runtimeShorthand, supervisor, crea
80
81
  }
81
82
  else {
82
83
  await host.waitForPortReady(state.ports.css, '127.0.0.1');
83
- supervisor.addLog('css', 'info', `CSS started (http://127.0.0.1:${state.ports.css})`);
84
+ supervisor.addLog('css', 'info', `CSS started (${(0, bootstrap_1.localServiceUrl)(state.bindHost, state.ports.css)})`);
84
85
  }
85
86
  supervisor.setStatus('css', 'running', { startTime: Date.now() });
86
87
  return cssApp;
@@ -92,7 +93,7 @@ async function startApiRuntime({ state, host, supervisor, authContext, apiRunner
92
93
  authContext: createOpenAuthContext(state.canonicalBaseUrl ?? state.baseUrl, authContext),
93
94
  runtimeHost: host,
94
95
  });
95
- supervisor.addLog('api', 'info', `API started (${state.transport === 'socket' ? `unix://${state.sockets.api}` : `http://127.0.0.1:${state.ports.api}`})`);
96
+ supervisor.addLog('api', 'info', `API started (${state.transport === 'socket' ? `unix://${state.sockets.api}` : (0, bootstrap_1.localServiceUrl)(state.bindHost, state.ports.api)})`);
96
97
  supervisor.setStatus('api', 'running', { startTime: Date.now() });
97
98
  return apiService;
98
99
  }
@@ -108,9 +109,10 @@ async function startGatewayRuntime({ state, host, supervisor, shutdownHandler, g
108
109
  supervisor,
109
110
  internalAdminAuthSecret: state.gatewayAdminProxyAuthSecret,
110
111
  clientRemoteAddressResolver,
112
+ ingressPort: state.ports.ingress,
111
113
  targets: {
112
- css: state.transport === 'socket' ? { socketPath: state.sockets.css } : { url: `http://127.0.0.1:${state.ports.css}` },
113
- api: state.transport === 'socket' ? { socketPath: state.sockets.api } : { url: `http://127.0.0.1:${state.ports.api}` },
114
+ css: state.transport === 'socket' ? { socketPath: state.sockets.css } : { url: (0, bootstrap_1.localServiceUrl)(state.bindHost, state.ports.css) },
115
+ api: state.transport === 'socket' ? { socketPath: state.sockets.api } : { url: (0, bootstrap_1.localServiceUrl)(state.bindHost, state.ports.api) },
114
116
  },
115
117
  });
116
118
  supervisor.addLog('xpod', 'info', `Gateway started (${state.transport === 'socket' ? `unix://${state.sockets.gateway}` : state.baseUrl})`);
@@ -1,7 +1,33 @@
1
+ /**
2
+ * The port a remote tunnel forwards to: the Gateway's tunnel entry.
3
+ *
4
+ * It sits a few ports above the Gateway so it is predictable - the user copies this one number
5
+ * into a provider console and it survives restarts - while staying clear of the block a
6
+ * neighbouring runtime plans for its own services. When the neighbourhood is busy the caller
7
+ * gets an OS-assigned port instead of a stolen one; the runtime reports whichever it got.
8
+ */
9
+ export declare function findGatewayIngressPort(gatewayPort: number): Promise<number>;
1
10
  export declare function getFreePort(basePort: number, host?: string, timeoutMs?: number): Promise<number>;
11
+ /**
12
+ * Loopback port handed out by the OS for a listener that must not collide with ports the
13
+ * embedding process plans for other services.
14
+ *
15
+ * Probing next to the ports this runtime already owns is not safe: a host that allocates
16
+ * `gateway + 10`/`gateway + 11` (the full integration matrix does) has already reserved
17
+ * the neighbour of our own `api` port for another runtime, and binding it steals that
18
+ * runtime's service.
19
+ */
20
+ export declare function getEphemeralLoopbackPort(): Promise<number>;
2
21
  /**
3
22
  * Allocates a port for child services that bind wildcard addresses.
4
23
  * CSS may bind `::` while the API binds `0.0.0.0`, so probing only localhost
5
24
  * can miss an occupied port on the other address family.
6
25
  */
26
+ /**
27
+ * Takes exactly this port or fails.
28
+ *
29
+ * A port that a tunnel console forwards to cannot be substituted: `getFreePortForWildcard`
30
+ * scans upward, which would leave the runtime listening somewhere the tunnel never reaches.
31
+ */
32
+ export declare function requireFreePortForWildcard(port: number, timeoutMs?: number): Promise<number>;
7
33
  export declare function getFreePortForWildcard(basePort: number, timeoutMs?: number): Promise<number>;