@undefineds.co/xpod 0.4.3-rc.159 → 0.4.5
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/config/cloud.json +1 -1
- package/config/main.json +36 -2
- package/dist/api/ai-gateway/auth/GatewayApiKeyAuthenticator.d.ts +3 -0
- package/dist/api/ai-gateway/auth/GatewayApiKeyAuthenticator.js +1 -1
- package/dist/api/ai-gateway/auth/PodGatewayAccessKeyRepository.d.ts +2 -1
- package/dist/api/ai-gateway/auth/PodGatewayAccessKeyRepository.js +101 -32
- package/dist/api/ai-gateway/connect/DeviceCodeProtocol.d.ts +80 -0
- package/dist/api/ai-gateway/connect/DeviceCodeProtocol.js +3 -0
- package/dist/api/ai-gateway/connect/FileSessionImportAdapter.d.ts +38 -0
- package/dist/api/ai-gateway/connect/FileSessionImportAdapter.js +63 -0
- package/dist/api/ai-gateway/connect/LoopbackAuthorizationCallbackReceiver.d.ts +24 -0
- package/dist/api/ai-gateway/connect/LoopbackAuthorizationCallbackReceiver.js +136 -0
- package/dist/api/ai-gateway/connect/OAuthConnectAdapter.d.ts +2 -0
- package/dist/api/ai-gateway/connect/OAuthConnectAdapter.js +2 -1
- package/dist/api/ai-gateway/connect/OAuthIntegrationRegistry.d.ts +17 -13
- package/dist/api/ai-gateway/connect/OAuthIntegrationRegistry.js +52 -19
- package/dist/api/ai-gateway/connect/OpenAiSubscriptionSessionImportAdapter.d.ts +4 -28
- package/dist/api/ai-gateway/connect/OpenAiSubscriptionSessionImportAdapter.js +7 -58
- package/dist/api/ai-gateway/connect/ProviderAuthorizationProfiles.d.ts +4 -0
- package/dist/api/ai-gateway/connect/ProviderAuthorizationProfiles.js +116 -0
- package/dist/api/ai-gateway/connect/SessionImportProfiles.d.ts +10 -0
- package/dist/api/ai-gateway/connect/SessionImportProfiles.js +112 -0
- package/dist/api/ai-gateway/connect/index.d.ts +125 -23
- package/dist/api/ai-gateway/connect/index.js +1277 -260
- package/dist/api/ai-gateway/models/PodModelSelectionRepository.d.ts +4 -1
- package/dist/api/ai-gateway/models/PodModelSelectionRepository.js +154 -19
- package/dist/api/ai-gateway/providers/DeepSeekRuntimeAdapter.js +10 -6
- package/dist/api/ai-gateway/providers/ModelsDevCatalog.d.ts +7 -0
- package/dist/api/ai-gateway/providers/ModelsDevCatalog.js +25 -1
- package/dist/api/ai-gateway/providers/OfferingAuthorization.d.ts +24 -0
- package/dist/api/ai-gateway/providers/OfferingAuthorization.js +37 -0
- package/dist/api/ai-gateway/providers/OpenAiRuntimeAdapter.d.ts +1 -1
- package/dist/api/ai-gateway/providers/OpenAiRuntimeAdapter.js +5 -3
- package/dist/api/ai-gateway/providers/ProviderRegistry.d.ts +6 -3
- package/dist/api/ai-gateway/providers/ProviderRegistry.js +55 -16
- package/dist/api/ai-gateway/providers/ProviderRuntimeAdapter.d.ts +2 -0
- package/dist/api/ai-gateway/providers/ProviderRuntimeAdapter.js +37 -4
- package/dist/api/ai-gateway/providers/ProviderRuntimeRegistry.js +7 -0
- package/dist/api/ai-gateway/quota/SubscriptionQuotaAdapters.js +2 -1
- package/dist/api/ai-gateway/routing/ModelRouter.js +3 -1
- package/dist/api/container/common.js +30 -40
- package/dist/api/container/index.js +6 -2
- package/dist/api/container/routes.js +5 -22
- package/dist/api/handlers/AiClientConfigurationHandler.js +39 -1
- package/dist/api/handlers/AiGatewayManagementHandler.d.ts +3 -0
- package/dist/api/handlers/AiGatewayManagementHandler.js +173 -58
- package/dist/api/service/AiClientConfigurationService.d.ts +4 -15
- package/dist/api/service/AiClientConfigurationService.js +17 -64
- package/dist/cli/commands/start.js +2 -0
- package/dist/components/components.jsonld +1 -0
- package/dist/components/context.jsonld +80 -0
- package/dist/http/InternalPodDataHttpHandler.d.ts +3 -0
- package/dist/http/InternalPodDataHttpHandler.js +13 -2
- package/dist/http/InternalPodDataHttpHandler.jsonld +12 -0
- package/dist/identity/oidc/RememberedClientPromptFactory.d.ts +1 -1
- package/dist/identity/oidc/RememberedClientPromptFactory.js +5 -2
- package/dist/identity/oidc/RememberedConsentHandler.js +1 -1
- package/dist/identity/oidc/ScopedPickWebIdHandler.d.ts +1 -0
- package/dist/identity/oidc/ScopedPickWebIdHandler.js +26 -0
- package/dist/identity/oidc/ScopedPickWebIdHandler.jsonld +4 -0
- package/dist/identity/oidc/SessionBoundIdentityProviderFactory.d.ts +10 -0
- package/dist/identity/oidc/SessionBoundIdentityProviderFactory.js +21 -0
- package/dist/identity/oidc/SessionBoundIdentityProviderFactory.jsonld +172 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +4 -2
- package/dist/runtime/component-parameter-keys.js +18 -2
- package/dist/storage/accessors/MixDataAccessor.js +6 -2
- package/dist/storage/rdf/PostgresRdfEngine.js +10 -2
- package/dist/storage/rdf/RdfContentTypes.js +4 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiClientConfigurationSection.d.ts +3 -0
- package/node_modules/@undefineds.co/ai-connections/dist/AiClientConfigurationSection.js +13 -16
- package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsList.js +1 -3
- package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsMain.d.ts +2 -1
- package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsMain.js +2 -2
- package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsPanel.d.ts +4 -1
- package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsPanel.js +127 -57
- package/node_modules/@undefineds.co/ai-connections/dist/AiCredentialPoolSection.d.ts +6 -4
- package/node_modules/@undefineds.co/ai-connections/dist/AiCredentialPoolSection.js +436 -83
- package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayKeysSection.d.ts +3 -2
- package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayKeysSection.js +212 -76
- package/node_modules/@undefineds.co/ai-connections/dist/AiProviderCard.d.ts +6 -4
- package/node_modules/@undefineds.co/ai-connections/dist/AiProviderCard.js +58 -41
- package/node_modules/@undefineds.co/ai-connections/dist/AiQuotaCard.d.ts +4 -1
- package/node_modules/@undefineds.co/ai-connections/dist/AiQuotaCard.js +63 -4
- package/node_modules/@undefineds.co/ai-connections/dist/ai-connections-client.d.ts +46 -6
- package/node_modules/@undefineds.co/ai-connections/dist/ai-connections-client.js +143 -14
- package/node_modules/@undefineds.co/ai-connections/dist/client-config/base-adapter.d.ts +19 -3
- package/node_modules/@undefineds.co/ai-connections/dist/client-config/base-adapter.js +45 -7
- package/node_modules/@undefineds.co/ai-connections/dist/client-config/codex.d.ts +7 -1
- package/node_modules/@undefineds.co/ai-connections/dist/client-config/codex.js +305 -40
- package/node_modules/@undefineds.co/ai-connections/dist/client-config/index.cjs +383 -50
- package/node_modules/@undefineds.co/ai-connections/dist/client-config/json-env-adapter.js +3 -2
- package/node_modules/@undefineds.co/ai-connections/dist/client-config/pi.js +12 -3
- package/node_modules/@undefineds.co/ai-connections/dist/client-config/transaction.d.ts +2 -0
- package/node_modules/@undefineds.co/ai-connections/dist/client-config/transaction.js +39 -4
- package/node_modules/@undefineds.co/ai-connections/dist/client-config/types.d.ts +8 -1
- package/node_modules/@undefineds.co/ai-connections/dist/client-visuals.d.ts +2 -0
- package/node_modules/@undefineds.co/ai-connections/dist/client-visuals.js +14 -0
- package/node_modules/@undefineds.co/ai-connections/dist/controller.d.ts +2 -2
- package/node_modules/@undefineds.co/ai-connections/dist/controller.js +216 -57
- package/node_modules/@undefineds.co/ai-connections/dist/index.d.ts +3 -1
- package/node_modules/@undefineds.co/ai-connections/dist/index.js +16 -2
- package/node_modules/@undefineds.co/ai-connections/dist/provider-visuals.js +6 -1
- package/node_modules/@undefineds.co/drizzle-solid/dist/core/execution/ldp-executor.js +27 -6
- package/node_modules/@undefineds.co/drizzle-solid/dist/core/pod-database.js +1 -1
- package/node_modules/@undefineds.co/drizzle-solid/dist/core/query-builders/select-query-builder.js +2 -2
- package/node_modules/@undefineds.co/drizzle-solid/dist/core/sparql/builder/update-builder.js +12 -1
- package/node_modules/@undefineds.co/drizzle-solid/dist/core/triple/builder.js +1 -1
- package/node_modules/@undefineds.co/drizzle-solid/dist/core/triple/handlers/array.js +8 -0
- package/node_modules/@undefineds.co/drizzle-solid/dist/core/triple/handlers/default.js +9 -1
- package/node_modules/@undefineds.co/drizzle-solid/dist/core/triple/handlers/inline.js +3 -3
- package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/execution/ldp-executor.js +27 -6
- package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/pod-database.js +1 -1
- package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/query-builders/select-query-builder.js +2 -2
- package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/sparql/builder/update-builder.js +12 -1
- package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/triple/builder.js +1 -1
- package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/triple/handlers/array.js +8 -0
- package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/triple/handlers/default.js +9 -1
- package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/triple/handlers/inline.js +3 -3
- package/node_modules/@undefineds.co/extension-sdk/dist/web.d.ts +31 -0
- package/package.json +2 -2
- package/static/app/assets/{index-BikOyGPu.js → index-BCZVzMpj.js} +44 -44
- package/static/app/assets/inrupt-smoke.js +2 -2
- package/static/app/assets/main.css +1 -1
- package/static/app/assets/main.js +10 -10
- package/static/auth-callback/assets/{AiConfigContext-DrCH6ckh.js → AiConfigContext-DVkh8Kg2.js} +1 -1
- package/static/auth-callback/assets/{AiConfigPage-DVrlSSdA.js → AiConfigPage-HWVWpe-P.js} +1 -1
- package/static/auth-callback/assets/{DocumentProcessingPanel-_Md-v2R2.js → DocumentProcessingPanel-DDq-mH17.js} +1 -1
- package/static/auth-callback/assets/{IndexLifecyclePanel-BbWwe23H.js → IndexLifecyclePanel-Cx4cjrdP.js} +1 -1
- package/static/auth-callback/assets/{IndexSubjectPanel-upH9MjU-.js → IndexSubjectPanel-DzSw8M9j.js} +1 -1
- package/static/auth-callback/assets/{ModelAssignmentsPanel-CVGH4t4g.js → ModelAssignmentsPanel-BsRxGc2p.js} +1 -1
- package/static/auth-callback/assets/ModelsPage-DEe1lo6Q.js +10 -0
- package/static/auth-callback/assets/{NetworkPage-Dcbrb1fd.js → NetworkPage-DBiEh1Oz.js} +1 -1
- package/static/auth-callback/assets/{PaneListHeader-DrY-1wBq.js → PaneListHeader-lEEgjyN9.js} +1 -1
- package/static/auth-callback/assets/{SearchIndexingPanel-Dw25y53v.js → SearchIndexingPanel-CZCUUGt6.js} +1 -1
- package/static/auth-callback/assets/{StatusSubjectPanel-BHlz9rNF.js → StatusSubjectPanel-21qdueMr.js} +1 -1
- package/static/auth-callback/assets/{StatusWorkspace-BH7exQP5.js → StatusWorkspace-R8RKsqVz.js} +1 -1
- package/static/auth-callback/assets/{SystemSettingsPage-BYLKnM9f.js → SystemSettingsPage-BQ4e-4Wy.js} +1 -1
- package/static/auth-callback/assets/{SystemSettingsSubjectPanel-DT34LKku.js → SystemSettingsSubjectPanel-BopXD7SE.js} +1 -1
- package/static/auth-callback/assets/{activity-DdULRcSI.js → activity-DSfmTGfY.js} +1 -1
- package/static/auth-callback/assets/ai-connections-C03UWyPh.js +1 -0
- package/static/auth-callback/assets/{auth-callback-D7l2P25I.js → auth-callback-DleaitAS.js} +91 -91
- package/static/auth-callback/assets/auth-callback-vPSC2d2F.css +1 -0
- package/static/auth-callback/assets/{badge-j4zjFnmg.js → badge-B0aLu1sl.js} +1 -1
- package/static/auth-callback/assets/{download-DGXoks01.js → download-D_bFwdYJ.js} +1 -1
- package/static/auth-callback/assets/{external-link-CvbgXXaI.js → external-link-DRfjTaQu.js} +1 -1
- package/static/auth-callback/assets/{index-LRWvKJ2i.js → index-CG23cLYQ.js} +1 -1
- package/static/auth-callback/assets/{index-BOK3j1dz.js → index-CyV9ejwx.js} +1 -1
- package/static/auth-callback/assets/{index-browser-C1Qpe0g4.js → index-browser-D70paxIg.js} +1 -1
- package/static/auth-callback/assets/{key-round-CmgS5UdQ.js → key-round-BjV_mVYH.js} +1 -1
- package/static/auth-callback/assets/{rotate-ccw-c4CSG6Rq.js → rotate-ccw-CKoOAfse.js} +1 -1
- package/static/auth-callback/assets/{skeleton-ZPMTiRSM.js → skeleton-BZNjZaHx.js} +1 -1
- package/static/auth-callback/assets/{waypoints-xjyBflU5.js → waypoints-DoaJVzZv.js} +1 -1
- package/static/auth-callback/assets/{workspace-layout-B9nj6F5J.js → workspace-layout-CaP46_ZR.js} +1 -1
- package/static/auth-callback/auth-callback.html +2 -2
- package/static/dashboard/assets/{AiConfigContext-BWOOSYNr.js → AiConfigContext-BSrR27yD.js} +1 -1
- package/static/dashboard/assets/{AiConfigPage-CG2kQ9Wy.js → AiConfigPage-D65Z2LET.js} +1 -1
- package/static/dashboard/assets/{DocumentProcessingPanel-B4VXajfj.js → DocumentProcessingPanel-DyTe7Nei.js} +1 -1
- package/static/dashboard/assets/{IndexLifecyclePanel-CWCy0CC8.js → IndexLifecyclePanel-fK8ZGlrL.js} +1 -1
- package/static/dashboard/assets/{IndexSubjectPanel-CSgyQnG_.js → IndexSubjectPanel-CZPGor7v.js} +1 -1
- package/static/dashboard/assets/{ModelAssignmentsPanel-CdGIGidT.js → ModelAssignmentsPanel-CfYn5LMQ.js} +1 -1
- package/static/dashboard/assets/ModelsPage-djlJsghe.js +25 -0
- package/static/dashboard/assets/{NetworkPage-COia9NCH.js → NetworkPage-Coj6GnPl.js} +1 -1
- package/static/dashboard/assets/{PaneListHeader-SZWyr602.js → PaneListHeader-CUuFNSsZ.js} +1 -1
- package/static/dashboard/assets/{SearchIndexingPanel-D6PZtG6k.js → SearchIndexingPanel-CyJLioXS.js} +1 -1
- package/static/dashboard/assets/{StatusSubjectPanel-CxRD4kv0.js → StatusSubjectPanel-Cv26GSVC.js} +1 -1
- package/static/dashboard/assets/{StatusWorkspace-D3PfmY9-.js → StatusWorkspace-CDjFrsmB.js} +1 -1
- package/static/dashboard/assets/{SystemSettingsPage-COg1MmMj.js → SystemSettingsPage-BuNOyNoa.js} +1 -1
- package/static/dashboard/assets/{SystemSettingsSubjectPanel-BSVVB9Ol.js → SystemSettingsSubjectPanel-B2dasdez.js} +1 -1
- package/static/dashboard/assets/{activity-BJJx5cN-.js → activity-D1d2j_4Z.js} +1 -1
- package/static/dashboard/assets/ai-connections-C03UWyPh.js +1 -0
- package/static/dashboard/assets/{badge-elmrFSCj.js → badge-BeAAv6sp.js} +1 -1
- package/static/dashboard/assets/{dashboard-IvQrNmru.js → dashboard-BnGrUGv8.js} +68 -68
- package/static/dashboard/assets/dashboard-vPSC2d2F.css +1 -0
- package/static/dashboard/assets/{download-C3FH2KzG.js → download-DfFGiZRn.js} +1 -1
- package/static/dashboard/assets/{external-link-Bx7F0uKb.js → external-link-IsjU_LC9.js} +1 -1
- package/static/dashboard/assets/{index-liRoRIP1.js → index-BWQTucPe.js} +1 -1
- package/static/dashboard/assets/{index-M4-kWiGz.js → index-Dj75OjnW.js} +1 -1
- package/static/dashboard/assets/{key-round-CXg0bKAj.js → key-round-BJ_9wmQ_.js} +1 -1
- package/static/dashboard/assets/{rotate-ccw-yxJKOBrX.js → rotate-ccw-D3JGiFbR.js} +1 -1
- package/static/dashboard/assets/{skeleton-x9jNGrQT.js → skeleton-CC4nc-z-.js} +1 -1
- package/static/dashboard/assets/{waypoints-CTKeRsGp.js → waypoints-h7sqFqiG.js} +1 -1
- package/static/dashboard/assets/{workspace-layout--YkgkS38.js → workspace-layout-ZAPTOHhs.js} +1 -1
- package/static/dashboard/dashboard.html +2 -2
- package/static/settings/assets/{AiConfigContext-CelxXFcQ.js → AiConfigContext-lGkWpvKP.js} +1 -1
- package/static/settings/assets/{AiConfigPage-BaP-EovM.js → AiConfigPage-BbZWIBZq.js} +1 -1
- package/static/settings/assets/{DocumentProcessingPanel-DzLZluFv.js → DocumentProcessingPanel-DvYdjT-V.js} +1 -1
- package/static/settings/assets/{IndexLifecyclePanel-Bzj1-_oI.js → IndexLifecyclePanel-W5OGQZj7.js} +1 -1
- package/static/settings/assets/{IndexSubjectPanel-B263QLUh.js → IndexSubjectPanel-g_Aa5soq.js} +1 -1
- package/static/settings/assets/{ModelAssignmentsPanel-BAdT4UR0.js → ModelAssignmentsPanel-COlMBKXj.js} +1 -1
- package/static/settings/assets/ModelsPage-mApKi-aw.js +10 -0
- package/static/settings/assets/{NetworkPage-BK6a7l4g.js → NetworkPage-BDT05JUq.js} +1 -1
- package/static/settings/assets/{PaneListHeader-BAS2ICPq.js → PaneListHeader-CByhNpMG.js} +1 -1
- package/static/settings/assets/{SearchIndexingPanel-Cb_p-NgW.js → SearchIndexingPanel-BFAyzXls.js} +1 -1
- package/static/settings/assets/{StatusSubjectPanel-CcjqUua6.js → StatusSubjectPanel-Bz_XZ3VU.js} +1 -1
- package/static/settings/assets/{StatusWorkspace-7Ibty3_k.js → StatusWorkspace-CeVypHcW.js} +1 -1
- package/static/settings/assets/{SystemSettingsPage-DPSz4dg4.js → SystemSettingsPage-Dh7cQIfx.js} +1 -1
- package/static/settings/assets/{SystemSettingsSubjectPanel-Cb4HkKT5.js → SystemSettingsSubjectPanel-CSnpciO0.js} +1 -1
- package/static/settings/assets/{activity-Qhsr5Pxu.js → activity-DXz3EfFN.js} +1 -1
- package/static/settings/assets/ai-connections-C03UWyPh.js +1 -0
- package/static/settings/assets/{badge-B1vf2qCl.js → badge-1ZA144i4.js} +1 -1
- package/static/settings/assets/{download-CYNt0aZ-.js → download-CUHimlYa.js} +1 -1
- package/static/settings/assets/{external-link-ClKb39NT.js → external-link-BYHSVj2Z.js} +1 -1
- package/static/settings/assets/{index-y8ew3MLM.js → index-DKPDMdW5.js} +1 -1
- package/static/settings/assets/{index-browser-DJhvgpNI.js → index-browser-BaEFz0e0.js} +1 -1
- package/static/settings/assets/{index-BgiIDSch.js → index-viSgSvbO.js} +1 -1
- package/static/settings/assets/{key-round-5d-DrJz-.js → key-round-COByPOg8.js} +1 -1
- package/static/settings/assets/{rotate-ccw-CHZY7kS5.js → rotate-ccw-BC2EN6cE.js} +1 -1
- package/static/settings/assets/{settings-D5VRWyx6.js → settings-DLH9XUoT.js} +86 -86
- package/static/settings/assets/settings-vPSC2d2F.css +1 -0
- package/static/settings/assets/{skeleton-FNabNxNE.js → skeleton-B0-FOhKL.js} +1 -1
- package/static/settings/assets/{waypoints-BnL_8ljo.js → waypoints-DGMsvqWo.js} +1 -1
- package/static/settings/assets/{workspace-layout-D5q3F59S.js → workspace-layout-B0SVrJIu.js} +1 -1
- package/static/settings/settings.html +2 -2
- package/static/auth-callback/assets/ModelsPage-BpkVFKbf.js +0 -10
- package/static/auth-callback/assets/ai-connections-Bm52UO7Y.js +0 -1
- package/static/auth-callback/assets/auth-callback-01yz-UDU.css +0 -1
- package/static/dashboard/assets/ModelsPage-Chd5UK0D.js +0 -25
- package/static/dashboard/assets/ai-connections-Bm52UO7Y.js +0 -1
- package/static/dashboard/assets/dashboard-01yz-UDU.css +0 -1
- package/static/settings/assets/ModelsPage-C0NFa1zq.js +0 -10
- package/static/settings/assets/ai-connections-Bm52UO7Y.js +0 -1
- package/static/settings/assets/settings-01yz-UDU.css +0 -1
|
@@ -4,6 +4,7 @@ exports.OAuthConnectCredentialStore = void 0;
|
|
|
4
4
|
class OAuthConnectCredentialStore {
|
|
5
5
|
constructor(options) {
|
|
6
6
|
this.provider = options.provider.toLowerCase();
|
|
7
|
+
this.offeringId = options.offeringId;
|
|
7
8
|
this.credentialRepository = options.credentialRepository;
|
|
8
9
|
this.vault = options.vault;
|
|
9
10
|
}
|
|
@@ -26,7 +27,7 @@ class OAuthConnectCredentialStore {
|
|
|
26
27
|
metadata: {
|
|
27
28
|
...(input.current.metadata ?? {}),
|
|
28
29
|
...input.metadata,
|
|
29
|
-
offeringId:
|
|
30
|
+
offeringId: this.offeringId,
|
|
30
31
|
enabled: true,
|
|
31
32
|
health: 'healthy',
|
|
32
33
|
},
|
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
integrationId: typeof XPOD_KIMI_OAUTH_INTEGRATION_ID;
|
|
4
|
-
issuedBy: 'xpod';
|
|
5
|
-
clientId: string;
|
|
6
|
-
}
|
|
1
|
+
import type { AuthorizationCodeOAuthIntegration, AuthorizationCodeProtocolDescriptor, DeviceCodeOAuthIntegration, DeviceCodeProtocolDescriptor, OAuthConnectMode, OAuthIntegration } from './DeviceCodeProtocol';
|
|
2
|
+
export type { AuthorizationCodeOAuthIntegration, AuthorizationCodeProtocolDescriptor, DeviceCodeOAuthIntegration, DeviceCodeProtocolDescriptor, OAuthConnectMode, OAuthIntegration, } from './DeviceCodeProtocol';
|
|
7
3
|
export interface OAuthIntegrationRegistryConfig {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
integrations?: Array<{
|
|
5
|
+
provider: string;
|
|
6
|
+
offeringId: string;
|
|
7
|
+
mode?: OAuthConnectMode;
|
|
8
|
+
integrationId: string;
|
|
9
|
+
issuedBy: string;
|
|
11
10
|
clientId?: string;
|
|
12
|
-
|
|
11
|
+
protocol: DeviceCodeProtocolDescriptor | AuthorizationCodeProtocolDescriptor;
|
|
12
|
+
accountLabel?: string;
|
|
13
|
+
accountId?: string;
|
|
14
|
+
}>;
|
|
13
15
|
}
|
|
14
|
-
export declare const XPOD_KIMI_OAUTH_INTEGRATION_ID = "xpod-kimi-oauth";
|
|
15
16
|
export declare class OAuthIntegrationRegistry {
|
|
16
17
|
private readonly integrations;
|
|
17
18
|
static fromServerConfig(config: OAuthIntegrationRegistryConfig): OAuthIntegrationRegistry;
|
|
18
19
|
register(integration: OAuthIntegration): void;
|
|
19
|
-
require(provider: string):
|
|
20
|
+
require(provider: string, offeringId?: string, mode?: 'deviceCodeOAuth'): DeviceCodeOAuthIntegration;
|
|
21
|
+
require(provider: string, offeringId: string | undefined, mode: 'authorizationCodeOAuth'): AuthorizationCodeOAuthIntegration;
|
|
22
|
+
private onlyIntegration;
|
|
20
23
|
}
|
|
21
|
-
|
|
24
|
+
type OAuthIntegrationConfigRecord = NonNullable<OAuthIntegrationRegistryConfig['integrations']>[number];
|
|
25
|
+
export declare function requireTrustedOAuthIntegration(value: OAuthIntegrationConfigRecord | OAuthIntegration): OAuthIntegration;
|
|
@@ -1,44 +1,70 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OAuthIntegrationRegistry =
|
|
4
|
-
exports.
|
|
5
|
-
exports.XPOD_KIMI_OAUTH_INTEGRATION_ID = 'xpod-kimi-oauth';
|
|
3
|
+
exports.OAuthIntegrationRegistry = void 0;
|
|
4
|
+
exports.requireTrustedOAuthIntegration = requireTrustedOAuthIntegration;
|
|
6
5
|
class OAuthIntegrationRegistry {
|
|
7
6
|
constructor() {
|
|
8
7
|
this.integrations = new Map();
|
|
9
8
|
}
|
|
10
9
|
static fromServerConfig(config) {
|
|
11
10
|
const registry = new OAuthIntegrationRegistry();
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
clientId: kimiClientId,
|
|
19
|
-
});
|
|
11
|
+
for (const integration of config.integrations ?? []) {
|
|
12
|
+
registry.register(requireTrustedOAuthIntegration(integration));
|
|
13
|
+
}
|
|
14
|
+
if (registry.integrations.size === 0) {
|
|
15
|
+
throw new Error('auth_not_available');
|
|
16
|
+
}
|
|
20
17
|
return registry;
|
|
21
18
|
}
|
|
22
19
|
register(integration) {
|
|
23
|
-
this.integrations.set(integration.provider, integration);
|
|
20
|
+
this.integrations.set(integrationKey(integration.provider, integration.offeringId, integration.mode), integration);
|
|
24
21
|
}
|
|
25
|
-
require(provider) {
|
|
26
|
-
const integration =
|
|
22
|
+
require(provider, offeringId, mode = 'deviceCodeOAuth') {
|
|
23
|
+
const integration = offeringId
|
|
24
|
+
? this.integrations.get(integrationKey(provider, offeringId, mode))
|
|
25
|
+
: this.onlyIntegration(provider, mode);
|
|
27
26
|
if (!integration) {
|
|
28
27
|
throw new Error('auth_not_available');
|
|
29
28
|
}
|
|
30
29
|
return integration;
|
|
31
30
|
}
|
|
31
|
+
onlyIntegration(provider, mode) {
|
|
32
|
+
const candidates = [...this.integrations.values()].filter((integration) => integration.provider === provider.trim().toLowerCase() && integration.mode === mode);
|
|
33
|
+
return candidates.length === 1 ? candidates[0] : undefined;
|
|
34
|
+
}
|
|
32
35
|
}
|
|
33
36
|
exports.OAuthIntegrationRegistry = OAuthIntegrationRegistry;
|
|
34
|
-
function
|
|
35
|
-
const clientId = normalizeClientId(value
|
|
37
|
+
function requireTrustedOAuthIntegration(value) {
|
|
38
|
+
const clientId = normalizeClientId(value.clientId);
|
|
39
|
+
const mode = value.mode ?? 'deviceCodeOAuth';
|
|
36
40
|
if (!clientId
|
|
37
|
-
|| value
|
|
38
|
-
|| value
|
|
41
|
+
|| !normalizeClientId(value.issuedBy)
|
|
42
|
+
|| !value.provider.trim()
|
|
43
|
+
|| !value.offeringId.trim()
|
|
44
|
+
|| !value.integrationId.trim()
|
|
45
|
+
|| !isTrustedProtocolForMode(value.protocol, mode)) {
|
|
39
46
|
throw new Error('auth_not_available');
|
|
40
47
|
}
|
|
41
|
-
return
|
|
48
|
+
return {
|
|
49
|
+
provider: value.provider.trim().toLowerCase(),
|
|
50
|
+
offeringId: value.offeringId.trim(),
|
|
51
|
+
mode,
|
|
52
|
+
integrationId: value.integrationId.trim(),
|
|
53
|
+
issuedBy: normalizeClientId(value.issuedBy),
|
|
54
|
+
clientId,
|
|
55
|
+
protocol: value.protocol,
|
|
56
|
+
accountLabel: normalizeOptionalString(value.accountLabel),
|
|
57
|
+
accountId: normalizeOptionalString(value.accountId),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function isTrustedProtocolForMode(protocol, mode) {
|
|
61
|
+
if (mode === 'deviceCodeOAuth') {
|
|
62
|
+
return 'begin' in protocol && 'poll' in protocol;
|
|
63
|
+
}
|
|
64
|
+
return 'authorization' in protocol
|
|
65
|
+
&& 'token' in protocol
|
|
66
|
+
&& protocol.authorization.redirectUris.length > 0
|
|
67
|
+
&& protocol.token.codec === 'authorizationCodeForm';
|
|
42
68
|
}
|
|
43
69
|
function normalizeClientId(value) {
|
|
44
70
|
if (typeof value !== 'string') {
|
|
@@ -47,4 +73,11 @@ function normalizeClientId(value) {
|
|
|
47
73
|
const trimmed = value.trim();
|
|
48
74
|
return trimmed.length > 0 ? trimmed : undefined;
|
|
49
75
|
}
|
|
76
|
+
function normalizeOptionalString(value) {
|
|
77
|
+
const normalized = normalizeClientId(value);
|
|
78
|
+
return normalized;
|
|
79
|
+
}
|
|
80
|
+
function integrationKey(provider, offeringId, mode) {
|
|
81
|
+
return `${provider.trim().toLowerCase()}:${offeringId.trim().toLowerCase()}:${mode}`;
|
|
82
|
+
}
|
|
50
83
|
//# sourceMappingURL=OAuthIntegrationRegistry.js.map
|
|
@@ -1,31 +1,7 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
readFile?: (filePath: string, encoding: BufferEncoding) => Promise<string>;
|
|
1
|
+
import { FileSessionImportAdapter, type FileSessionImportAdapterOptions, type LocalSessionImportAdapter, type LocalSessionImportInput, type LocalSessionImportResult } from './FileSessionImportAdapter';
|
|
2
|
+
export type { LocalSessionImportAdapter, LocalSessionImportInput, LocalSessionImportResult, };
|
|
3
|
+
export interface OpenAiSubscriptionSessionImportAdapterOptions extends Omit<FileSessionImportAdapterOptions, 'profile'> {
|
|
5
4
|
}
|
|
6
|
-
export
|
|
7
|
-
secret: ProviderSecret;
|
|
8
|
-
/**
|
|
9
|
-
* How the imported credential authenticates upstream. The import itself is
|
|
10
|
-
* local, but an imported subscription session is still an OAuth credential.
|
|
11
|
-
*/
|
|
12
|
-
credentialAuthMode?: 'deviceCodeOAuth' | 'local';
|
|
13
|
-
accountLabel?: string;
|
|
14
|
-
metadata?: Record<string, unknown>;
|
|
15
|
-
}
|
|
16
|
-
export interface LocalSessionImportInput {
|
|
17
|
-
deployment: 'local' | 'cloud';
|
|
18
|
-
}
|
|
19
|
-
export interface LocalSessionImportAdapter {
|
|
20
|
-
provider: string;
|
|
21
|
-
offeringId: string;
|
|
22
|
-
importSession(input: LocalSessionImportInput): Promise<LocalSessionImportResult>;
|
|
23
|
-
}
|
|
24
|
-
export declare class OpenAiSubscriptionSessionImportAdapter implements LocalSessionImportAdapter {
|
|
25
|
-
readonly provider = "openai";
|
|
26
|
-
readonly offeringId = "official-subscription";
|
|
27
|
-
private readonly authPath;
|
|
28
|
-
private readonly readFile;
|
|
5
|
+
export declare class OpenAiSubscriptionSessionImportAdapter extends FileSessionImportAdapter implements LocalSessionImportAdapter {
|
|
29
6
|
constructor(options?: OpenAiSubscriptionSessionImportAdapterOptions);
|
|
30
|
-
importSession(input: LocalSessionImportInput): Promise<LocalSessionImportResult>;
|
|
31
7
|
}
|
|
@@ -1,66 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.OpenAiSubscriptionSessionImportAdapter = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
class OpenAiSubscriptionSessionImportAdapter {
|
|
4
|
+
const FileSessionImportAdapter_1 = require("./FileSessionImportAdapter");
|
|
5
|
+
const SessionImportProfiles_1 = require("./SessionImportProfiles");
|
|
6
|
+
class OpenAiSubscriptionSessionImportAdapter extends FileSessionImportAdapter_1.FileSessionImportAdapter {
|
|
11
7
|
constructor(options = {}) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
async importSession(input) {
|
|
18
|
-
if (input.deployment !== 'local') {
|
|
19
|
-
throw new Error('openai_subscription_session_unavailable_in_cloud');
|
|
20
|
-
}
|
|
21
|
-
const payload = parseAuthJson(await this.readFile(this.authPath, 'utf8'));
|
|
22
|
-
const tokens = objectValue(payload.tokens);
|
|
23
|
-
const accessToken = stringValue(tokens?.access_token);
|
|
24
|
-
const refreshToken = stringValue(tokens?.refresh_token);
|
|
25
|
-
const idToken = stringValue(tokens?.id_token);
|
|
26
|
-
const accountId = stringValue(tokens?.account_id);
|
|
27
|
-
if (!accessToken || !refreshToken) {
|
|
28
|
-
throw new Error('openai_subscription_session_missing_tokens');
|
|
29
|
-
}
|
|
30
|
-
return {
|
|
31
|
-
secret: {
|
|
32
|
-
type: 'deviceCodeOAuth',
|
|
33
|
-
authMode: stringValue(payload.auth_mode),
|
|
34
|
-
accessToken,
|
|
35
|
-
refreshToken,
|
|
36
|
-
...(idToken ? { idToken } : {}),
|
|
37
|
-
...(accountId ? { accountId } : {}),
|
|
38
|
-
},
|
|
39
|
-
credentialAuthMode: 'deviceCodeOAuth',
|
|
40
|
-
accountLabel: accountId ? `OpenAI Subscription ${accountId}` : 'OpenAI Subscription',
|
|
41
|
-
metadata: {
|
|
42
|
-
source: 'local-codex-auth-json',
|
|
43
|
-
sessionPath: '~/.codex/auth.json',
|
|
44
|
-
...(stringValue(payload.auth_mode) ? { authMode: stringValue(payload.auth_mode) } : {}),
|
|
45
|
-
...(accountId ? { accountId } : {}),
|
|
46
|
-
},
|
|
47
|
-
};
|
|
8
|
+
super({
|
|
9
|
+
...options,
|
|
10
|
+
profile: SessionImportProfiles_1.OPENAI_CODEX_SESSION_IMPORT_PROFILE,
|
|
11
|
+
});
|
|
48
12
|
}
|
|
49
13
|
}
|
|
50
14
|
exports.OpenAiSubscriptionSessionImportAdapter = OpenAiSubscriptionSessionImportAdapter;
|
|
51
|
-
function parseAuthJson(raw) {
|
|
52
|
-
const parsed = JSON.parse(raw);
|
|
53
|
-
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
54
|
-
throw new Error('openai_subscription_session_invalid_auth_json');
|
|
55
|
-
}
|
|
56
|
-
return parsed;
|
|
57
|
-
}
|
|
58
|
-
function objectValue(value) {
|
|
59
|
-
return value && typeof value === 'object' && !Array.isArray(value)
|
|
60
|
-
? value
|
|
61
|
-
: undefined;
|
|
62
|
-
}
|
|
63
|
-
function stringValue(value) {
|
|
64
|
-
return typeof value === 'string' && value.trim() ? value.trim() : undefined;
|
|
65
|
-
}
|
|
66
15
|
//# sourceMappingURL=OpenAiSubscriptionSessionImportAdapter.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DeviceCodeOAuthIntegration, AuthorizationCodeOAuthIntegration } from './DeviceCodeProtocol';
|
|
2
|
+
export declare function createProviderOAuthIntegrations(): DeviceCodeOAuthIntegration[];
|
|
3
|
+
/** Browser authorization shares the public client identity and token lifecycle. */
|
|
4
|
+
export declare function createBrowserOAuthIntegrations(): AuthorizationCodeOAuthIntegration[];
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createProviderOAuthIntegrations = createProviderOAuthIntegrations;
|
|
4
|
+
exports.createBrowserOAuthIntegrations = createBrowserOAuthIntegrations;
|
|
5
|
+
const OfferingAuthorization_1 = require("../providers/OfferingAuthorization");
|
|
6
|
+
// Public first-party client profiles, not Xpod-owned registrations. These values
|
|
7
|
+
// are trusted application configuration; management requests never supply them.
|
|
8
|
+
// Wire formats and source revisions are recorded in docs/ai-authorization-mechanisms.md.
|
|
9
|
+
const CLIENT_PROFILES = {
|
|
10
|
+
'openai-codex-public': {
|
|
11
|
+
issuedBy: 'openai/codex',
|
|
12
|
+
clientId: 'app_EMoamEEZ73f0CkXaXp7hrann',
|
|
13
|
+
accountLabel: 'OpenAI Subscription',
|
|
14
|
+
protocol: {
|
|
15
|
+
id: 'device-code-json-authorization-code-pkce',
|
|
16
|
+
verificationUriOrigins: ['https://auth.openai.com'],
|
|
17
|
+
begin: {
|
|
18
|
+
endpoint: 'https://auth.openai.com/api/accounts/deviceauth/usercode',
|
|
19
|
+
codec: 'deviceCodeJson',
|
|
20
|
+
expiresAtField: 'expires_at',
|
|
21
|
+
defaultExpiresInSeconds: 900,
|
|
22
|
+
defaultIntervalSeconds: 5,
|
|
23
|
+
},
|
|
24
|
+
poll: {
|
|
25
|
+
endpoint: 'https://auth.openai.com/api/accounts/deviceauth/token',
|
|
26
|
+
codec: 'deviceCodeJson',
|
|
27
|
+
pendingHttpStatuses: [403, 404],
|
|
28
|
+
},
|
|
29
|
+
tokenExchange: {
|
|
30
|
+
endpoint: 'https://auth.openai.com/oauth/token',
|
|
31
|
+
codec: 'authorizationCodeForm',
|
|
32
|
+
redirectUri: 'https://auth.openai.com/deviceauth/callback',
|
|
33
|
+
},
|
|
34
|
+
refresh: {
|
|
35
|
+
endpoint: 'https://auth.openai.com/oauth/token',
|
|
36
|
+
codec: 'refreshTokenForm',
|
|
37
|
+
},
|
|
38
|
+
defaultVerificationUri: 'https://auth.openai.com/codex/device',
|
|
39
|
+
accountIdClaim: ['https://api.openai.com/auth', 'chatgpt_account_id'],
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
'kimi-code-public': {
|
|
43
|
+
issuedBy: 'MoonshotAI/kimi-cli',
|
|
44
|
+
clientId: '17e5f671-d194-4dfb-9706-5516cb48c098',
|
|
45
|
+
accountLabel: 'Kimi Subscription',
|
|
46
|
+
protocol: {
|
|
47
|
+
id: 'oauth-device-code-form',
|
|
48
|
+
verificationUriOrigins: ['https://www.kimi.com'],
|
|
49
|
+
begin: {
|
|
50
|
+
endpoint: 'https://auth.kimi.com/api/oauth/device_authorization',
|
|
51
|
+
codec: 'oauthDeviceCode',
|
|
52
|
+
headers: { 'X-Msh-Platform': 'xpod' },
|
|
53
|
+
},
|
|
54
|
+
poll: {
|
|
55
|
+
endpoint: 'https://auth.kimi.com/api/oauth/token',
|
|
56
|
+
headers: { 'X-Msh-Platform': 'xpod' },
|
|
57
|
+
codec: 'oauthDeviceCode',
|
|
58
|
+
},
|
|
59
|
+
refresh: {
|
|
60
|
+
endpoint: 'https://auth.kimi.com/api/oauth/token',
|
|
61
|
+
headers: { 'X-Msh-Platform': 'xpod' },
|
|
62
|
+
codec: 'refreshTokenForm',
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
function createProviderOAuthIntegrations() {
|
|
68
|
+
return OfferingAuthorization_1.SUBSCRIPTION_AUTHORIZATION_BINDINGS.map((binding) => {
|
|
69
|
+
const profile = CLIENT_PROFILES[binding.integrationId];
|
|
70
|
+
if (!profile)
|
|
71
|
+
throw new Error(`OAuth client profile is not registered: ${binding.integrationId}`);
|
|
72
|
+
return {
|
|
73
|
+
...binding,
|
|
74
|
+
...structuredClone(profile),
|
|
75
|
+
mode: 'deviceCodeOAuth',
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
const BROWSER_PROTOCOLS = {
|
|
80
|
+
'openai-codex-browser-public': {
|
|
81
|
+
id: 'authorization-code-pkce-loopback',
|
|
82
|
+
authorization: {
|
|
83
|
+
endpoint: 'https://auth.openai.com/oauth/authorize',
|
|
84
|
+
redirectUris: ['http://localhost:1455/auth/callback', 'http://localhost:1457/auth/callback'],
|
|
85
|
+
scopes: ['openid', 'profile', 'email', 'offline_access'],
|
|
86
|
+
extraParams: { id_token_add_organizations: 'true', codex_cli_simplified_flow: 'true', originator: 'xpod' },
|
|
87
|
+
},
|
|
88
|
+
token: { endpoint: 'https://auth.openai.com/oauth/token', codec: 'authorizationCodeForm' },
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
/** Browser authorization shares the public client identity and token lifecycle. */
|
|
92
|
+
function createBrowserOAuthIntegrations() {
|
|
93
|
+
return OfferingAuthorization_1.SUBSCRIPTION_AUTHORIZATION_BINDINGS.flatMap((binding) => {
|
|
94
|
+
if (!('browserIntegrationId' in binding))
|
|
95
|
+
return [];
|
|
96
|
+
const profile = CLIENT_PROFILES[binding.integrationId];
|
|
97
|
+
const protocol = BROWSER_PROTOCOLS[binding.browserIntegrationId];
|
|
98
|
+
if (!profile || !protocol)
|
|
99
|
+
throw new Error(`OAuth browser profile is not registered: ${binding.browserIntegrationId}`);
|
|
100
|
+
return [{
|
|
101
|
+
provider: binding.provider,
|
|
102
|
+
offeringId: binding.offeringId,
|
|
103
|
+
integrationId: binding.browserIntegrationId,
|
|
104
|
+
issuedBy: profile.issuedBy,
|
|
105
|
+
clientId: profile.clientId,
|
|
106
|
+
accountLabel: profile.accountLabel,
|
|
107
|
+
mode: 'authorizationCodeOAuth',
|
|
108
|
+
protocol: {
|
|
109
|
+
...structuredClone(protocol),
|
|
110
|
+
refresh: structuredClone(profile.protocol.refresh),
|
|
111
|
+
accountIdClaim: structuredClone(profile.protocol.accountIdClaim),
|
|
112
|
+
},
|
|
113
|
+
}];
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=ProviderAuthorizationProfiles.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { LocalSessionImportResult } from './FileSessionImportAdapter';
|
|
2
|
+
export interface SessionImportProfile {
|
|
3
|
+
id: string;
|
|
4
|
+
provider: string;
|
|
5
|
+
offeringId: string;
|
|
6
|
+
resolvePath(homeDir: string): string;
|
|
7
|
+
importSession(payload: Record<string, unknown>): LocalSessionImportResult;
|
|
8
|
+
}
|
|
9
|
+
export declare const OPENAI_CODEX_SESSION_IMPORT_PROFILE: SessionImportProfile;
|
|
10
|
+
export declare const KIMI_CODE_SESSION_IMPORT_PROFILE: SessionImportProfile;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.KIMI_CODE_SESSION_IMPORT_PROFILE = exports.OPENAI_CODEX_SESSION_IMPORT_PROFILE = void 0;
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
exports.OPENAI_CODEX_SESSION_IMPORT_PROFILE = {
|
|
9
|
+
id: 'openai-codex-auth-json',
|
|
10
|
+
provider: 'openai',
|
|
11
|
+
offeringId: 'official-subscription',
|
|
12
|
+
resolvePath: (homeDir) => node_path_1.default.join(homeDir, '.codex', 'auth.json'),
|
|
13
|
+
importSession: importOpenAiCodexSession,
|
|
14
|
+
};
|
|
15
|
+
exports.KIMI_CODE_SESSION_IMPORT_PROFILE = {
|
|
16
|
+
id: 'kimi-code-credentials-json',
|
|
17
|
+
provider: 'kimi',
|
|
18
|
+
offeringId: 'subscription-key',
|
|
19
|
+
resolvePath: (homeDir) => node_path_1.default.join(homeDir, '.kimi', 'credentials', 'kimi-code.json'),
|
|
20
|
+
importSession: importKimiCodeSession,
|
|
21
|
+
};
|
|
22
|
+
function importOpenAiCodexSession(payload) {
|
|
23
|
+
const tokens = objectValue(payload.tokens);
|
|
24
|
+
const accessToken = stringValue(tokens?.access_token);
|
|
25
|
+
const refreshToken = stringValue(tokens?.refresh_token);
|
|
26
|
+
const idToken = stringValue(tokens?.id_token);
|
|
27
|
+
const accountId = stringValue(tokens?.account_id);
|
|
28
|
+
const authMode = stringValue(payload.auth_mode);
|
|
29
|
+
if (!accessToken || !refreshToken) {
|
|
30
|
+
throw new Error('local_session_missing_tokens');
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
secret: withoutUndefined({
|
|
34
|
+
type: 'deviceCodeOAuth',
|
|
35
|
+
authMode,
|
|
36
|
+
accessToken,
|
|
37
|
+
refreshToken,
|
|
38
|
+
idToken,
|
|
39
|
+
accountId,
|
|
40
|
+
}),
|
|
41
|
+
credentialAuthMode: 'deviceCodeOAuth',
|
|
42
|
+
accountLabel: accountId ? `OpenAI Subscription ${accountId}` : 'OpenAI Subscription',
|
|
43
|
+
metadata: withoutUndefined({
|
|
44
|
+
source: 'local-codex-auth-json',
|
|
45
|
+
sessionPath: '~/.codex/auth.json',
|
|
46
|
+
authMode,
|
|
47
|
+
accountId,
|
|
48
|
+
}),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function importKimiCodeSession(payload) {
|
|
52
|
+
const accessToken = stringValue(payload.access_token);
|
|
53
|
+
const refreshToken = stringValue(payload.refresh_token);
|
|
54
|
+
const expiresAt = unixSecondsIsoValue(payload.expires_at);
|
|
55
|
+
const scope = stringValue(payload.scope);
|
|
56
|
+
const tokenType = stringValue(payload.token_type);
|
|
57
|
+
const expiresIn = numberValue(payload.expires_in);
|
|
58
|
+
if (!accessToken || !refreshToken) {
|
|
59
|
+
throw new Error('local_session_missing_tokens');
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
secret: withoutUndefined({
|
|
63
|
+
type: 'deviceCodeOAuth',
|
|
64
|
+
accessToken,
|
|
65
|
+
refreshToken,
|
|
66
|
+
expiresAt,
|
|
67
|
+
scope,
|
|
68
|
+
tokenType,
|
|
69
|
+
expiresIn,
|
|
70
|
+
}),
|
|
71
|
+
credentialAuthMode: 'deviceCodeOAuth',
|
|
72
|
+
accountLabel: 'Kimi Subscription',
|
|
73
|
+
metadata: {
|
|
74
|
+
source: 'local-kimi-code-credentials-json',
|
|
75
|
+
sessionPath: '~/.kimi/credentials/kimi-code.json',
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function objectValue(value) {
|
|
80
|
+
return value && typeof value === 'object' && !Array.isArray(value)
|
|
81
|
+
? value
|
|
82
|
+
: undefined;
|
|
83
|
+
}
|
|
84
|
+
function stringValue(value) {
|
|
85
|
+
return typeof value === 'string' && value.trim() ? value.trim() : undefined;
|
|
86
|
+
}
|
|
87
|
+
function numberValue(value) {
|
|
88
|
+
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
89
|
+
return value;
|
|
90
|
+
}
|
|
91
|
+
if (typeof value === 'string' && value.trim()) {
|
|
92
|
+
const parsed = Number(value);
|
|
93
|
+
return Number.isFinite(parsed) ? parsed : undefined;
|
|
94
|
+
}
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
function unixSecondsIsoValue(value) {
|
|
98
|
+
const seconds = numberValue(value);
|
|
99
|
+
if (seconds === undefined || seconds <= 0) {
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
const milliseconds = seconds * 1000;
|
|
103
|
+
if (!Number.isFinite(milliseconds)) {
|
|
104
|
+
return undefined;
|
|
105
|
+
}
|
|
106
|
+
const date = new Date(milliseconds);
|
|
107
|
+
return Number.isNaN(date.getTime()) ? undefined : date.toISOString();
|
|
108
|
+
}
|
|
109
|
+
function withoutUndefined(input) {
|
|
110
|
+
return Object.fromEntries(Object.entries(input).filter(([, value]) => value !== undefined));
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=SessionImportProfiles.js.map
|