@undefineds.co/xpod 0.4.29 → 0.4.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/ApiServer.js +4 -0
- package/dist/api/ai-gateway/AiGatewayService.d.ts +55 -0
- package/dist/api/ai-gateway/AiGatewayService.js +145 -6
- package/dist/api/ai-gateway/auth/AiConnectionsInvocationKeyIssuer.js +5 -3
- package/dist/api/ai-gateway/auth/GatewayApiKeyAuthenticator.d.ts +16 -49
- package/dist/api/ai-gateway/auth/GatewayApiKeyAuthenticator.js +6 -71
- package/dist/api/ai-gateway/auth/InvocationTokenAuthenticator.js +1 -0
- package/dist/api/ai-gateway/auth/InvocationTokenCodec.d.ts +4 -0
- package/dist/api/ai-gateway/auth/InvocationTokenCodec.js +8 -1
- package/dist/api/ai-gateway/connect/FileSessionImportAdapter.d.ts +3 -0
- package/dist/api/ai-gateway/connect/FileSessionImportAdapter.js +23 -3
- package/dist/api/ai-gateway/connect/SessionImportProfiles.d.ts +9 -1
- package/dist/api/ai-gateway/connect/SessionImportProfiles.js +4 -3
- package/dist/api/ai-gateway/connect/index.d.ts +40 -0
- package/dist/api/ai-gateway/connect/index.js +194 -4
- package/dist/api/ai-gateway/models/PodModelSelectionRepository.js +1 -1
- package/dist/api/ai-gateway/pod/OwnerPodAccess.js +5 -0
- package/dist/api/ai-gateway/pod/PodBaseUrlResolver.d.ts +11 -2
- package/dist/api/ai-gateway/pod/PodBaseUrlResolver.js +72 -10
- package/dist/api/ai-gateway/quota/ProviderQuotaAdapter.js +1 -1
- package/dist/api/ai-gateway/routing/ModelRouter.d.ts +7 -0
- package/dist/api/ai-gateway/routing/ModelRouter.js +13 -10
- package/dist/api/ai-gateway/service-access/AiConnectionsServiceAccess.d.ts +1 -5
- package/dist/api/ai-gateway/service-access/AiConnectionsServiceAccess.js +8 -63
- package/dist/api/auth/AuthContext.d.ts +4 -0
- package/dist/api/auth/ClientCredentialsAuthenticator.js +11 -5
- package/dist/api/auth/SolidSessionFactory.d.ts +50 -4
- package/dist/api/auth/SolidSessionFactory.js +114 -4
- package/dist/api/chatkit/pod-store.d.ts +8 -1
- package/dist/api/chatkit/pod-store.js +54 -3
- package/dist/api/container/common.js +34 -60
- package/dist/api/container/index.js +0 -3
- package/dist/api/container/routes.js +1 -8
- package/dist/api/container/types.d.ts +2 -9
- package/dist/api/container/types.js +0 -5
- package/dist/api/handlers/AiGatewayManagementHandler.d.ts +4 -12
- package/dist/api/handlers/AiGatewayManagementHandler.js +18 -258
- package/dist/api/middleware/AuthMiddleware.js +29 -1
- package/dist/api/runs/PiAgentRuntimeDriver.js +6 -1
- package/dist/cli/index.js +2 -1
- package/dist/identity/oidc/PodOwnershipResolver.js +16 -6
- package/dist/runtime/ingress-port.d.ts +9 -2
- package/dist/runtime/ingress-port.js +7 -2
- package/dist/runtime/local-secret-file.d.ts +1 -1
- package/dist/runtime/runner/node/CommunitySolidServerCssRunner.d.ts +3 -1
- package/dist/runtime/runner/node/CommunitySolidServerCssRunner.js +31 -1
- package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsPanel.d.ts +3 -1
- package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsPanel.js +96 -67
- package/node_modules/@undefineds.co/ai-connections/dist/AiCredentialPoolSection.d.ts +2 -1
- package/node_modules/@undefineds.co/ai-connections/dist/AiCredentialPoolSection.js +2 -2
- package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayKeyRow.d.ts +1 -2
- package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayKeyRow.js +2 -2
- package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayKeysSection.js +81 -23
- package/node_modules/@undefineds.co/ai-connections/dist/AiOfferingDetails.d.ts +2 -1
- package/node_modules/@undefineds.co/ai-connections/dist/AiOfferingDetails.js +2 -2
- package/node_modules/@undefineds.co/ai-connections/dist/AiProviderCard.d.ts +2 -1
- package/node_modules/@undefineds.co/ai-connections/dist/AiProviderCard.js +2 -2
- package/node_modules/@undefineds.co/ai-connections/dist/AiProviderHeader.js +1 -1
- package/node_modules/@undefineds.co/ai-connections/dist/contract/client/fingerprint.d.ts +1 -0
- package/node_modules/@undefineds.co/ai-connections/dist/contract/client/fingerprint.js +7 -0
- package/node_modules/@undefineds.co/ai-connections/dist/contract/client/normalize.d.ts +1 -2
- package/node_modules/@undefineds.co/ai-connections/dist/contract/client/normalize.js +0 -33
- package/node_modules/@undefineds.co/ai-connections/dist/contract/client/request.d.ts +1 -1
- package/node_modules/@undefineds.co/ai-connections/dist/contract/client/request.js +68 -22
- package/node_modules/@undefineds.co/ai-connections/dist/contract/client/types.d.ts +37 -10
- package/node_modules/@undefineds.co/ai-connections/dist/controller.js +5 -54
- package/node_modules/@undefineds.co/ai-connections/dist/error-wording.js +7 -2
- package/node_modules/@undefineds.co/ai-connections/dist/service-access-resources.cjs +405 -0
- package/node_modules/@undefineds.co/ai-connections/dist/service-access-resources.d.ts +14 -0
- package/node_modules/@undefineds.co/ai-connections/dist/service-access-resources.js +36 -0
- package/node_modules/@undefineds.co/ai-connections/dist/service-access.js +5 -26
- package/node_modules/@undefineds.co/ai-connections/package.json +10 -2
- package/node_modules/@undefineds.co/extension-sdk/dist/solid-permissions.js +131 -13
- package/node_modules/@undefineds.co/extension-sdk/dist/web.d.ts +7 -1
- package/node_modules/@undefineds.co/extension-sdk/package.json +1 -1
- package/node_modules/@undefineds.co/pod-collections/dist/index.cjs +38 -5
- package/node_modules/@undefineds.co/pod-collections/dist/mapping.d.ts +8 -0
- package/node_modules/@undefineds.co/pod-collections/dist/mapping.js +34 -0
- package/node_modules/@undefineds.co/pod-collections/dist/mutations.d.ts +2 -1
- package/node_modules/@undefineds.co/pod-collections/dist/mutations.js +6 -4
- package/node_modules/@undefineds.co/pod-collections/dist/sync.js +4 -3
- package/node_modules/@undefineds.co/pod-collections/package.json +1 -1
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/IdpChrome.d.ts +1 -1
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/IdpChrome.js +2 -2
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/IdpViews.js +2 -2
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/PodSignInFrame.d.ts +3 -3
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/PodSignInFrame.js +5 -5
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/parts.d.ts +5 -5
- package/node_modules/@undefineds.co/shared-ui/dist/pod-sign-in/parts.js +5 -5
- package/node_modules/@undefineds.co/shared-ui/dist/theme.css +32 -5
- package/node_modules/@undefineds.co/shared-ui/package.json +1 -1
- package/package.json +2 -2
- package/static/app/assets/main.css +1 -1
- package/static/app/assets/main.js +18 -18
- package/static/dashboard/assets/{AccountAuthBoundary-Dv52SZc6.js → AccountAuthBoundary-CuqXFEW4.js} +1 -1
- package/static/dashboard/assets/{DesktopOidcCallback-DaT_Rumf.js → DesktopOidcCallback-7i-yOvPW.js} +1 -1
- package/static/dashboard/assets/DevicePages-D1m_BNtX.js +2 -0
- package/static/dashboard/assets/ModelsPage-0qWGa5Y6.js +12 -0
- package/static/dashboard/assets/{PaneListHeader-DtvnRmFq.js → PaneListHeader-uWdPgJ0E.js} +1 -1
- package/static/dashboard/assets/{PodDeletionAuthorizationPanel-BJk_8rJq.js → PodDeletionAuthorizationPanel-C22bhZeD.js} +3 -3
- package/static/dashboard/assets/{PodPage-C4gzEspV.js → PodPage-Dyo3yCb-.js} +1 -1
- package/static/dashboard/assets/{SystemSettingsPage-HaNrP1H1.js → SystemSettingsPage-CeX-oG_a.js} +1 -1
- package/static/dashboard/assets/{TasksPage-BdO5K2L7.js → TasksPage-B0EoyRYT.js} +1 -1
- package/static/dashboard/assets/{WebDesktopEntry-Cj9_ZfJU.js → WebDesktopEntry-DT44RrTa.js} +1 -1
- package/static/dashboard/assets/XpodAiConnectionsPodStore-EXCqZPmb.js +3 -0
- package/static/dashboard/assets/XpodShellApp-BEzi4f1j.css +1 -0
- package/static/dashboard/assets/XpodShellApp-DAFsxamX.js +4 -0
- package/static/dashboard/assets/{account-session-DlcKNG7k.js → account-session-rRAOF7nF.js} +1 -1
- package/static/dashboard/assets/{button-wslF55uZ.js → button-WVnQUNG-.js} +1 -1
- package/static/dashboard/assets/{collection-runtime-uxxgEu13.js → collection-runtime-BAJQ8Qub.js} +1 -1
- package/static/dashboard/assets/{createLucideIcon-BJQl82Qk.js → createLucideIcon-BWelSi3L.js} +1 -1
- package/static/dashboard/assets/dashboard-hSOBxPcP.css +1 -0
- package/static/dashboard/assets/{dashboard-Or0gnkou.js → dashboard-vmne1ZE0.js} +2 -2
- package/static/dashboard/assets/{index-BqFeOML9.js → index-HDQQ8asz.js} +1 -1
- package/static/dashboard/assets/{index-DgKn1twH.js → index-gtv-MAHl.js} +1 -1
- package/static/dashboard/assets/{label-CS6Sx6Zb.js → label-tKuCTJm2.js} +1 -1
- package/static/dashboard/assets/{list-UyhlCFKk.js → list-CKq3KHke.js} +1 -1
- package/static/dashboard/assets/{nav-item-style-CW1Nnorq.js → nav-item-style-B2gI7c52.js} +1 -1
- package/static/dashboard/assets/pod-collections-host-BqOAkacM.js +8 -0
- package/static/dashboard/assets/{safe-continuation-ClWAhcma.js → safe-continuation-BsKjDpAA.js} +1 -1
- package/static/dashboard/assets/{section-header-CEIEcco-.js → section-header-DM0JU-wk.js} +1 -1
- package/static/dashboard/assets/{setting-row-CaYv3dfF.js → setting-row-XiH7UjWy.js} +1 -1
- package/static/dashboard/assets/{xpod-remembered-login-BUF9fin1.js → xpod-remembered-login-nv1g1sfC.js} +4 -4
- package/static/dashboard/dashboard.html +2 -2
- package/static/settings/assets/{AccountAuthBoundary-Chqd38oU.js → AccountAuthBoundary-DAUR0omy.js} +1 -1
- package/static/settings/assets/{DesktopOidcCallback-VUrOSM_q.js → DesktopOidcCallback-BNZAZMWY.js} +1 -1
- package/static/settings/assets/DevicePages-BO9SrXRp.js +2 -0
- package/static/settings/assets/ModelsPage-DREEXdf3.js +12 -0
- package/static/settings/assets/{PaneListHeader-B5RkRqr4.js → PaneListHeader-CeUH0JjQ.js} +1 -1
- package/static/settings/assets/{PodDeletionAuthorizationPanel-DPM-5Izt.js → PodDeletionAuthorizationPanel-Ch4--l4b.js} +3 -3
- package/static/settings/assets/{PodPage-CxND6wwc.js → PodPage-CqJBj3GJ.js} +1 -1
- package/static/settings/assets/{SystemSettingsPage-C8EdMkW7.js → SystemSettingsPage-2LSjpqUa.js} +1 -1
- package/static/settings/assets/{TasksPage-DuqptEm8.js → TasksPage-DA5IRxlP.js} +1 -1
- package/static/settings/assets/{WebDesktopEntry-BRcyktkv.js → WebDesktopEntry-BVelF1q0.js} +1 -1
- package/static/settings/assets/XpodAiConnectionsPodStore-O5-2qBsx.js +3 -0
- package/static/settings/assets/XpodShellApp-BEzi4f1j.css +1 -0
- package/static/settings/assets/XpodShellApp-D1b3kqD0.js +4 -0
- package/static/settings/assets/XpodThemeProvider-hSOBxPcP.css +1 -0
- package/static/settings/assets/{XpodThemeProvider-DK3pIdRG.js → XpodThemeProvider-rUdAw66p.js} +2 -2
- package/static/settings/assets/{account-session-DJOZ03xr.js → account-session-BD1q8D_o.js} +1 -1
- package/static/settings/assets/auth-callback-PWS7okI8.js +1 -0
- package/static/settings/assets/{button-D3yW-2o1.js → button-ZJYFB218.js} +1 -1
- package/static/settings/assets/{collection-runtime-DfGo25mh.js → collection-runtime-C2FHCCXJ.js} +1 -1
- package/static/settings/assets/{createLucideIcon-CacwLsmB.js → createLucideIcon-B2wXvYTD.js} +1 -1
- package/static/settings/assets/{index-r5KRYsKC.js → index-JFAkaKZH.js} +1 -1
- package/static/settings/assets/{label-MJjUmvzG.js → label-BLrTAmGy.js} +1 -1
- package/static/settings/assets/{list-Ce-5k1MX.js → list-Cm96vvJO.js} +1 -1
- package/static/settings/assets/{nav-item-style-ZUbL8KOZ.js → nav-item-style-C2upI7sr.js} +1 -1
- package/static/settings/assets/pod-collections-host-BqOAkacM.js +8 -0
- package/static/settings/assets/{safe-continuation-vlBZFSlU.js → safe-continuation-CYaRj3rj.js} +1 -1
- package/static/settings/assets/{section-header-DGJdEvQw.js → section-header-BviL5H8E.js} +1 -1
- package/static/settings/assets/{setting-row-C7tuFiho.js → setting-row-BYikj0YO.js} +1 -1
- package/static/settings/assets/{settings-CyQPih1O.js → settings-CpoDG_Qr.js} +1 -1
- package/static/settings/assets/{xpod-remembered-login-D-TzzT5K.js → xpod-remembered-login-BJ4QUSXy.js} +4 -4
- package/static/settings/auth-callback.html +3 -3
- package/static/settings/settings.html +3 -3
- package/dist/api/ai-gateway/auth/GatewayApiKey.d.ts +0 -28
- package/dist/api/ai-gateway/auth/GatewayApiKey.js +0 -162
- package/dist/api/ai-gateway/auth/GatewayKeyLocatorCodec.d.ts +0 -26
- package/dist/api/ai-gateway/auth/GatewayKeyLocatorCodec.js +0 -97
- package/dist/api/ai-gateway/auth/PodGatewayAccessKeyRepository.d.ts +0 -67
- package/dist/api/ai-gateway/auth/PodGatewayAccessKeyRepository.js +0 -340
- package/dist/runtime/gateway-locator-secret.d.ts +0 -5
- package/dist/runtime/gateway-locator-secret.js +0 -30
- package/static/dashboard/assets/DevicePages-HjclpIVm.js +0 -2
- package/static/dashboard/assets/ModelsPage-Be2TPd-x.js +0 -11
- package/static/dashboard/assets/XpodAiConnectionsPodStore-B7gmXBmC.js +0 -3
- package/static/dashboard/assets/XpodShellApp-Bwom2xL3.css +0 -1
- package/static/dashboard/assets/XpodShellApp-D_KY4nCW.js +0 -4
- package/static/dashboard/assets/dashboard-CbJ-JkrI.css +0 -1
- package/static/dashboard/assets/pod-collections-host-DjK2xf-b.js +0 -8
- package/static/settings/assets/DevicePages-C6qwvWwu.js +0 -2
- package/static/settings/assets/ModelsPage-Ry_dObRQ.js +0 -11
- package/static/settings/assets/XpodAiConnectionsPodStore-CyA_BJVC.js +0 -3
- package/static/settings/assets/XpodShellApp-Bwom2xL3.css +0 -1
- package/static/settings/assets/XpodShellApp-CsivHJl0.js +0 -4
- package/static/settings/assets/XpodThemeProvider-CbJ-JkrI.css +0 -1
- package/static/settings/assets/auth-callback-GIBYEz_7.js +0 -1
- package/static/settings/assets/pod-collections-host-DjK2xf-b.js +0 -8
|
@@ -11,7 +11,6 @@ const MatrixEventJournal_1 = require("../matrix/MatrixEventJournal");
|
|
|
11
11
|
const awilix_1 = require("awilix");
|
|
12
12
|
const node_crypto_1 = require("node:crypto");
|
|
13
13
|
const global_logger_factory_1 = require("global-logger-factory");
|
|
14
|
-
const gateway_locator_secret_1 = require("../../runtime/gateway-locator-secret");
|
|
15
14
|
const db_1 = require("../../identity/drizzle/db");
|
|
16
15
|
const EdgeNodeRepository_1 = require("../../identity/drizzle/EdgeNodeRepository");
|
|
17
16
|
const UsageRepository_1 = require("../../storage/quota/UsageRepository");
|
|
@@ -28,8 +27,7 @@ const InvocationTokenAuthenticator_1 = require("../ai-gateway/auth/InvocationTok
|
|
|
28
27
|
const AiConnectionsInvocationKeyIssuer_1 = require("../ai-gateway/auth/AiConnectionsInvocationKeyIssuer");
|
|
29
28
|
const InvocationTokenCodec_1 = require("../ai-gateway/auth/InvocationTokenCodec");
|
|
30
29
|
const GatewayApiKeyAuthenticator_1 = require("../ai-gateway/auth/GatewayApiKeyAuthenticator");
|
|
31
|
-
const
|
|
32
|
-
const PodGatewayAccessKeyRepository_1 = require("../ai-gateway/auth/PodGatewayAccessKeyRepository");
|
|
30
|
+
const PodBaseUrlResolver_1 = require("../ai-gateway/pod/PodBaseUrlResolver");
|
|
33
31
|
const OwnerPodAccess_1 = require("../ai-gateway/pod/OwnerPodAccess");
|
|
34
32
|
const HostedPodRoute_1 = require("../ai-gateway/pod/HostedPodRoute");
|
|
35
33
|
const TaskCredentialDatabase_1 = require("../tasks/TaskCredentialDatabase");
|
|
@@ -75,6 +73,7 @@ const tasks_1 = require("../tasks");
|
|
|
75
73
|
const service_1 = require("../../ai/service");
|
|
76
74
|
const rdf_1 = require("./rdf");
|
|
77
75
|
const EdgeNodeCertificateCapabilityBridge_1 = require("../../edge/EdgeNodeCertificateCapabilityBridge");
|
|
76
|
+
const logger = (0, global_logger_factory_1.getLoggerFor)('ApiContainer');
|
|
78
77
|
function resolveCssServiceBaseUrl() {
|
|
79
78
|
return `http://127.0.0.1:${process.env.CSS_PORT ?? '3000'}/`;
|
|
80
79
|
}
|
|
@@ -117,43 +116,15 @@ function resolveAiConnectionsRuntimeBaseUrl(config) {
|
|
|
117
116
|
function resolveAiConnectionsAudience(config) {
|
|
118
117
|
return new URL(resolveAiConnectionsBaseUrl(config)).origin;
|
|
119
118
|
}
|
|
120
|
-
function resolveGatewayLocatorSecret(config) {
|
|
121
|
-
if (config.gatewayLocatorSecret?.trim()) {
|
|
122
|
-
return config.gatewayLocatorSecret;
|
|
123
|
-
}
|
|
124
|
-
return (0, gateway_locator_secret_1.resolvePersistentGatewayLocatorSecret)({
|
|
125
|
-
databaseUrl: config.databaseUrl,
|
|
126
|
-
edition: config.edition,
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
119
|
function podBaseUrlResolver(cradle, selection = 'first') {
|
|
130
|
-
return
|
|
131
|
-
const pods = selection === 'unique'
|
|
132
|
-
? await cradle.podLookupRepo?.findAllByWebId(webId) ?? []
|
|
133
|
-
: [await cradle.podLookupRepo?.findByWebId(webId)];
|
|
134
|
-
const roots = pods.flatMap(pod => {
|
|
135
|
-
const root = pod?.storageUrl ?? pod?.baseUrl;
|
|
136
|
-
return root ? [root] : [];
|
|
137
|
-
});
|
|
138
|
-
if (selection === 'first')
|
|
139
|
-
return roots[0];
|
|
140
|
-
const normalized = new Set(roots.map(root => {
|
|
141
|
-
const url = new URL(root);
|
|
142
|
-
if (!['http:', 'https:'].includes(url.protocol) || url.username || url.password || url.search || url.hash) {
|
|
143
|
-
throw new Error('Invalid Pod storage binding');
|
|
144
|
-
}
|
|
145
|
-
return url.href.replace(/\/+$/u, '');
|
|
146
|
-
}));
|
|
147
|
-
if (normalized.size > 1)
|
|
148
|
-
throw new Error('Authoritative Pod storage binding ambiguous');
|
|
149
|
-
return normalized.values().next().value;
|
|
150
|
-
};
|
|
120
|
+
return (0, PodBaseUrlResolver_1.createOwnerPodBaseUrlResolver)(cradle.podLookupRepo, selection);
|
|
151
121
|
}
|
|
152
122
|
/**
|
|
153
123
|
* 注册共享服务到容器
|
|
154
124
|
*/
|
|
155
125
|
function registerCommonServices(container) {
|
|
156
126
|
container.register({
|
|
127
|
+
aiConnectionsPodBaseUrlResolver: (0, awilix_1.asFunction)((cradle) => podBaseUrlResolver(cradle, 'unique')).singleton(),
|
|
157
128
|
// 数据库
|
|
158
129
|
db: (0, awilix_1.asFunction)(({ config }) => {
|
|
159
130
|
return (0, db_1.getIdentityDatabase)(config.databaseUrl);
|
|
@@ -247,20 +218,6 @@ function registerCommonServices(container) {
|
|
|
247
218
|
},
|
|
248
219
|
});
|
|
249
220
|
}).singleton(),
|
|
250
|
-
gatewayAccessKeyRepository: (0, awilix_1.asFunction)((cradle) => {
|
|
251
|
-
const { config, ownerPodAccess } = cradle;
|
|
252
|
-
return new PodGatewayAccessKeyRepository_1.PodGatewayAccessKeyRepository({
|
|
253
|
-
locatorCodec: new GatewayKeyLocatorCodec_1.AesGatewayKeyLocatorCodec({
|
|
254
|
-
active: {
|
|
255
|
-
kid: config.gatewayLocatorKeyId ?? 'active',
|
|
256
|
-
secret: resolveGatewayLocatorSecret(config),
|
|
257
|
-
},
|
|
258
|
-
previous: config.gatewayPreviousLocatorSecrets,
|
|
259
|
-
}),
|
|
260
|
-
podAccess: ownerPodAccess,
|
|
261
|
-
podBaseUrlResolver: podBaseUrlResolver(cradle),
|
|
262
|
-
});
|
|
263
|
-
}).singleton(),
|
|
264
221
|
aiConnectionInvocationKeyIssuer: (0, awilix_1.asFunction)((cradle) => {
|
|
265
222
|
const { config } = cradle;
|
|
266
223
|
return new AiConnectionsInvocationKeyIssuer_1.AiConnectionsInvocationKeyIssuer({
|
|
@@ -281,7 +238,7 @@ function registerCommonServices(container) {
|
|
|
281
238
|
const { config } = cradle;
|
|
282
239
|
const credentialRepository = new connect_1.PodConnectedCredentialRepository({
|
|
283
240
|
podAccess: cradle.ownerPodAccess,
|
|
284
|
-
podBaseUrlResolver:
|
|
241
|
+
podBaseUrlResolver: cradle.aiConnectionsPodBaseUrlResolver,
|
|
285
242
|
});
|
|
286
243
|
const vault = credentialVaultForConfig(config);
|
|
287
244
|
// AI Gateway Connect has no on/off switch: installing ai-connections
|
|
@@ -370,16 +327,31 @@ function registerCommonServices(container) {
|
|
|
370
327
|
})).singleton(),
|
|
371
328
|
gatewayCredentialStore: (0, awilix_1.asFunction)((cradle) => {
|
|
372
329
|
const { ownerPodAccess } = cradle;
|
|
373
|
-
|
|
330
|
+
const store = new connect_1.PodConnectedCredentialRepository({
|
|
374
331
|
podAccess: ownerPodAccess,
|
|
375
|
-
podBaseUrlResolver:
|
|
332
|
+
podBaseUrlResolver: cradle.aiConnectionsPodBaseUrlResolver,
|
|
333
|
+
});
|
|
334
|
+
// Use-time OAuth renewal belongs to the shared credential lifecycle: inference only asks the
|
|
335
|
+
// store for a usable session. Delegated lazily to the composed Connect service so the
|
|
336
|
+
// container keeps no construction-time cycle, and the hook stays absent for stores that
|
|
337
|
+
// cannot renew.
|
|
338
|
+
return Object.assign(store, {
|
|
339
|
+
renewCredential: (input) => cradle.providerConnectService.renewCredential({
|
|
340
|
+
webId: input.webId,
|
|
341
|
+
deployment: input.deployment,
|
|
342
|
+
provider: input.provider,
|
|
343
|
+
credentialId: input.credentialId,
|
|
344
|
+
observedVersion: input.observedVersion,
|
|
345
|
+
reason: input.reason,
|
|
346
|
+
auth: input.auth,
|
|
347
|
+
}),
|
|
376
348
|
});
|
|
377
349
|
}).singleton(),
|
|
378
350
|
podModelSelectionRepository: (0, awilix_1.asFunction)((cradle) => {
|
|
379
351
|
const { ownerPodAccess } = cradle;
|
|
380
352
|
return new PodModelSelectionRepository_1.PodModelSelectionRepository({
|
|
381
353
|
podAccess: ownerPodAccess,
|
|
382
|
-
podBaseUrlResolver:
|
|
354
|
+
podBaseUrlResolver: cradle.aiConnectionsPodBaseUrlResolver,
|
|
383
355
|
});
|
|
384
356
|
}).singleton(),
|
|
385
357
|
providerModelSelectionService: (0, awilix_1.asFunction)((cradle) => {
|
|
@@ -387,7 +359,7 @@ function registerCommonServices(container) {
|
|
|
387
359
|
return new ProviderModelSelectionService_1.ProviderModelSelectionService({
|
|
388
360
|
credentialRepository: new connect_1.PodConnectedCredentialRepository({
|
|
389
361
|
podAccess: ownerPodAccess,
|
|
390
|
-
podBaseUrlResolver:
|
|
362
|
+
podBaseUrlResolver: cradle.aiConnectionsPodBaseUrlResolver,
|
|
391
363
|
}),
|
|
392
364
|
selectionRepository: podModelSelectionRepository,
|
|
393
365
|
providerRegistry: gatewayProviderRegistry,
|
|
@@ -466,11 +438,11 @@ function registerCommonServices(container) {
|
|
|
466
438
|
return new quota_1.ProviderQuotaService({
|
|
467
439
|
repository: new quota_1.PodQuotaSnapshotRepository({
|
|
468
440
|
podAccess,
|
|
469
|
-
podBaseUrlResolver:
|
|
441
|
+
podBaseUrlResolver: cradle.aiConnectionsPodBaseUrlResolver,
|
|
470
442
|
}),
|
|
471
443
|
credentialRepository: new connect_1.PodConnectedCredentialRepository({
|
|
472
444
|
podAccess,
|
|
473
|
-
podBaseUrlResolver:
|
|
445
|
+
podBaseUrlResolver: cradle.aiConnectionsPodBaseUrlResolver,
|
|
474
446
|
}),
|
|
475
447
|
vault: credentialVaultForConfig(config),
|
|
476
448
|
providerRegistry: cradle.gatewayProviderRegistry,
|
|
@@ -498,7 +470,7 @@ function registerCommonServices(container) {
|
|
|
498
470
|
return new models_1.ProviderModelsService({
|
|
499
471
|
credentialRepository: new connect_1.PodConnectedCredentialRepository({
|
|
500
472
|
podAccess,
|
|
501
|
-
podBaseUrlResolver:
|
|
473
|
+
podBaseUrlResolver: cradle.aiConnectionsPodBaseUrlResolver,
|
|
502
474
|
}),
|
|
503
475
|
vault: credentialVaultForConfig(config),
|
|
504
476
|
providerRegistry: registry,
|
|
@@ -563,13 +535,13 @@ function registerCommonServices(container) {
|
|
|
563
535
|
return new models_1.ProviderCustomModelsService({
|
|
564
536
|
credentialRepository: new connect_1.PodConnectedCredentialRepository({
|
|
565
537
|
podAccess: cradle.ownerPodAccess,
|
|
566
|
-
podBaseUrlResolver:
|
|
538
|
+
podBaseUrlResolver: cradle.aiConnectionsPodBaseUrlResolver,
|
|
567
539
|
}),
|
|
568
540
|
embeddingModelPolicy: cradle.embeddingModelPolicy,
|
|
569
541
|
registry: cradle.gatewayProviderRegistry,
|
|
570
542
|
});
|
|
571
543
|
}).singleton(),
|
|
572
|
-
authenticator: (0, awilix_1.asFunction)(({ nodeRepo, serviceTokenRepo, invocationTokenCodec,
|
|
544
|
+
authenticator: (0, awilix_1.asFunction)(({ nodeRepo, serviceTokenRepo, invocationTokenCodec, solidSessions, config, }) => {
|
|
573
545
|
const solidAuthenticator = new SolidTokenAuthenticator_1.SolidTokenAuthenticator({
|
|
574
546
|
resolveAccountId: async (webId) => webId,
|
|
575
547
|
publicBaseUrl: config.solidBaseUrl,
|
|
@@ -593,8 +565,10 @@ function registerCommonServices(container) {
|
|
|
593
565
|
audience: resolveAiConnectionsAudience(config),
|
|
594
566
|
})
|
|
595
567
|
: undefined;
|
|
568
|
+
// Verifies the AI-Connections invocation tokens that carry `models:read` / `inference:write`
|
|
569
|
+
// for the model gateway. It no longer accepts `xpod_gw_v1.*` Gateway API Keys: those are
|
|
570
|
+
// gone, so such a bearer now falls through to the client-credentials authenticator.
|
|
596
571
|
const gatewayApiKeyAuthenticator = new GatewayApiKeyAuthenticator_1.GatewayApiKeyAuthenticator({
|
|
597
|
-
repository: gatewayAccessKeyRepository,
|
|
598
572
|
deployment: config.edition,
|
|
599
573
|
invocationTokenCodec,
|
|
600
574
|
invocationTokenAudience: resolveAiConnectionsAudience(config),
|
|
@@ -604,7 +578,7 @@ function registerCommonServices(container) {
|
|
|
604
578
|
// inference tokens, so route-scoped authentication must run before the
|
|
605
579
|
// generic client-credentials authenticator claims the bearer.
|
|
606
580
|
// Order: Solid DPoP → Service Token → Node Token →
|
|
607
|
-
// Client Configuration Invocation →
|
|
581
|
+
// Client Configuration Invocation → Inference Invocation → Client Credentials.
|
|
608
582
|
// Agent execution is scoped by ChatKit thread/workspace and Run state, not standalone Agent JWTs.
|
|
609
583
|
authenticators: [
|
|
610
584
|
solidAuthenticator,
|
|
@@ -630,7 +604,7 @@ function registerCommonServices(container) {
|
|
|
630
604
|
const { config, ownerPodAccess, serverGroupReconcilerService } = cradle;
|
|
631
605
|
return new chatkit_1.PodChatKitStore({
|
|
632
606
|
podAccess: ownerPodAccess,
|
|
633
|
-
podBaseUrlResolver:
|
|
607
|
+
podBaseUrlResolver: cradle.aiConnectionsPodBaseUrlResolver,
|
|
634
608
|
serverGroupReconcilerService,
|
|
635
609
|
deployment: config.edition,
|
|
636
610
|
credentialSecretDecoder: (0, AiCredentialSecretDecoder_1.createAiCredentialSecretDecoder)({
|
|
@@ -189,9 +189,6 @@ function loadConfigFromEnv() {
|
|
|
189
189
|
aiConnectionInvocationSecret: process.env.XPOD_AI_CONNECTION_INVOCATION_SECRET,
|
|
190
190
|
aiConnectionInvocationKeyId: process.env.XPOD_AI_CONNECTION_INVOCATION_KEY_ID,
|
|
191
191
|
aiConnectionPreviousInvocationSecrets: parsePreviousInvocationSecrets(process.env.XPOD_AI_CONNECTION_PREVIOUS_INVOCATION_SECRETS),
|
|
192
|
-
gatewayLocatorSecret: process.env.XPOD_GATEWAY_LOCATOR_SECRET,
|
|
193
|
-
gatewayLocatorKeyId: process.env.XPOD_GATEWAY_LOCATOR_KEY_ID,
|
|
194
|
-
gatewayPreviousLocatorSecrets: parsePreviousInvocationSecrets(process.env.XPOD_GATEWAY_PREVIOUS_LOCATOR_SECRETS),
|
|
195
192
|
aiGatewaySessionAffinitySecret: process.env.XPOD_AI_GATEWAY_SESSION_AFFINITY_SECRET,
|
|
196
193
|
gatewayAdminProxyAuthSecret: process.env.XPOD_GATEWAY_ADMIN_PROXY_AUTH_SECRET,
|
|
197
194
|
...(deploymentRootKeys ? secretCellVaultFactories(() => deploymentRootKeys) : {}),
|
|
@@ -150,7 +150,6 @@ function registerSharedRoutes(container, server) {
|
|
|
150
150
|
const rdfSearchIndexingService = container.resolve('rdfSearchIndexingService', { allowUnregistered: true });
|
|
151
151
|
const ownerPodAccess = container.resolve('ownerPodAccess');
|
|
152
152
|
const aiConnectionInvocationKeyIssuer = container.resolve('aiConnectionInvocationKeyIssuer');
|
|
153
|
-
const gatewayAccessKeyRepository = container.resolve('gatewayAccessKeyRepository', { allowUnregistered: true });
|
|
154
153
|
const providerConnectService = container.resolve('providerConnectService');
|
|
155
154
|
const providerQuotaService = container.resolve('providerQuotaService', { allowUnregistered: true });
|
|
156
155
|
const providerModelsService = container.resolve('providerModelsService', { allowUnregistered: true });
|
|
@@ -219,18 +218,12 @@ function registerSharedRoutes(container, server) {
|
|
|
219
218
|
});
|
|
220
219
|
(0, AiGatewayManagementHandler_1.registerAiGatewayManagementRoutes)(server, {
|
|
221
220
|
deployment: config.edition,
|
|
221
|
+
podBaseUrlResolver: container.resolve('aiConnectionsPodBaseUrlResolver'),
|
|
222
222
|
connectService: providerConnectService,
|
|
223
223
|
quotaService: providerQuotaService,
|
|
224
224
|
modelsService: providerModelsService,
|
|
225
225
|
providerModelSelectionService,
|
|
226
226
|
customModelsService: providerCustomModelsService,
|
|
227
|
-
gatewayAccessKeyRepository,
|
|
228
|
-
invalidateClientCredential: (clientId) => container.resolve('solidSessions').invalidateClientCredential(clientId),
|
|
229
|
-
validateClientCredential: (apiKey) => container.resolve('authenticator').authenticate({
|
|
230
|
-
headers: { authorization: `Bearer ${apiKey}` },
|
|
231
|
-
method: 'POST',
|
|
232
|
-
url: '/api/ai/gateway/keys',
|
|
233
|
-
}),
|
|
234
227
|
aiClientConfiguration: aiClientConfigurationService?.capability(),
|
|
235
228
|
aiConnectionInvocationKeyIssuer,
|
|
236
229
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PodBaseUrlResolver } from '../ai-gateway/pod/PodBaseUrlResolver';
|
|
1
2
|
/**
|
|
2
3
|
* API Container 依赖类型定义
|
|
3
4
|
*
|
|
@@ -56,7 +57,6 @@ import type { SessionAffinityStore } from '../ai-gateway/routing/SessionAffinity
|
|
|
56
57
|
import type { AiConnectionsInvocationKeyIssuer } from '../ai-gateway/auth/AiConnectionsInvocationKeyIssuer';
|
|
57
58
|
import type { InvocationTokenCodec } from '../ai-gateway/auth/InvocationTokenCodec';
|
|
58
59
|
import type { OwnerPodAccess } from '../ai-gateway/pod/OwnerPodAccess';
|
|
59
|
-
import type { GatewayAccessKeyRepository } from '../ai-gateway/auth/GatewayApiKeyAuthenticator';
|
|
60
60
|
import type { PodModelSelectionRepository } from '../ai-gateway/models/PodModelSelectionRepository';
|
|
61
61
|
import type { ProviderModelSelectionService } from '../ai-gateway/models/ProviderModelSelectionService';
|
|
62
62
|
import type { AiClientConfigurationService } from '../service/AiClientConfigurationService';
|
|
@@ -125,13 +125,6 @@ export interface ApiContainerConfig {
|
|
|
125
125
|
kid: string;
|
|
126
126
|
secret: string;
|
|
127
127
|
}>;
|
|
128
|
-
/** Durable Gateway API Key locator signing config. */
|
|
129
|
-
gatewayLocatorSecret?: string;
|
|
130
|
-
gatewayLocatorKeyId?: string;
|
|
131
|
-
gatewayPreviousLocatorSecrets?: Array<{
|
|
132
|
-
kid: string;
|
|
133
|
-
secret: string;
|
|
134
|
-
}>;
|
|
135
128
|
aiGatewaySessionAffinitySecret?: string;
|
|
136
129
|
/** Runtime-generated secret used only between GatewayProxy and the internal API server for admin ingress evidence. */
|
|
137
130
|
gatewayAdminProxyAuthSecret?: string;
|
|
@@ -240,8 +233,8 @@ export interface ApiContainerCradle {
|
|
|
240
233
|
*/
|
|
241
234
|
legacyPodKeyMigration?: () => Promise<PodInterfaceKeyMigrationResult>;
|
|
242
235
|
invocationTokenCodec?: InvocationTokenCodec;
|
|
243
|
-
gatewayAccessKeyRepository?: GatewayAccessKeyRepository;
|
|
244
236
|
aiConnectionInvocationKeyIssuer?: AiConnectionsInvocationKeyIssuer;
|
|
237
|
+
aiConnectionsPodBaseUrlResolver: PodBaseUrlResolver;
|
|
245
238
|
aiClientConfigurationService?: AiClientConfigurationService;
|
|
246
239
|
providerConnectService: ProviderConnectService;
|
|
247
240
|
providerQuotaService?: ProviderQuotaService;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
+
import { type PodBaseUrlResolver } from '../ai-gateway/pod/PodBaseUrlResolver';
|
|
1
2
|
import type { ApiServer } from '../ApiServer';
|
|
2
|
-
import type {
|
|
3
|
-
import type { GatewayDeployment } from '../ai-gateway/auth/GatewayApiKey';
|
|
4
|
-
import { type GatewayAccessKeyRepository } from '../ai-gateway/auth/GatewayApiKeyAuthenticator';
|
|
3
|
+
import type { GatewayDeployment } from '../ai-gateway/auth/InvocationTokenCodec';
|
|
5
4
|
import type { ProviderConnectService } from '../ai-gateway/connect';
|
|
6
5
|
import type { ProviderModelSelectionService } from '../ai-gateway/models/ProviderModelSelectionService';
|
|
7
6
|
import type { ProviderQuotaService } from '../ai-gateway/quota';
|
|
@@ -10,6 +9,8 @@ import type { AiConnectionsInvocationKeyIssuer } from '../ai-gateway/auth/AiConn
|
|
|
10
9
|
import { type AiClientConfigurationCapabilityDescriptor } from '../service/AiClientConfigurationService';
|
|
11
10
|
export interface AiGatewayManagementHandlerOptions {
|
|
12
11
|
deployment: GatewayDeployment;
|
|
12
|
+
/** The storage adapter verifies ownership and an optional current-Pod selection. */
|
|
13
|
+
podBaseUrlResolver?: PodBaseUrlResolver;
|
|
13
14
|
connectService?: ProviderConnectService;
|
|
14
15
|
quotaService?: ProviderQuotaService;
|
|
15
16
|
modelsService?: ProviderModelsService;
|
|
@@ -22,15 +23,6 @@ export interface AiGatewayManagementHandlerOptions {
|
|
|
22
23
|
webId: string;
|
|
23
24
|
}>;
|
|
24
25
|
};
|
|
25
|
-
gatewayAccessKeyRepository?: GatewayAccessKeyRepository;
|
|
26
|
-
/** Reuses the configured CSS authenticator; never trusts the claimed registration owner. */
|
|
27
|
-
validateClientCredential?: (apiKey: string) => Promise<AuthResult>;
|
|
28
|
-
/**
|
|
29
|
-
* Forget sessions cached for a client whose registration is gone. Revocation happens at the
|
|
30
|
-
* issuer, so deleting the record is the moment this process learns the credential must stop
|
|
31
|
-
* being accepted - without it a revoked API Key keeps working until its token expires.
|
|
32
|
-
*/
|
|
33
|
-
invalidateClientCredential?: (clientId: string) => void;
|
|
34
26
|
aiClientConfiguration?: AiClientConfigurationCapabilityDescriptor;
|
|
35
27
|
aiConnectionInvocationKeyIssuer?: Pick<AiConnectionsInvocationKeyIssuer, 'issue' | 'issueClientConfiguration'>;
|
|
36
28
|
jsonBodyLimitBytes?: number;
|