11import { normalizeProviderId } from "../agents/provider-id.js" ;
22import { loadPluginManifestRegistryForInstalledIndex } from "./manifest-registry-installed.js" ;
33import { loadPluginRegistrySnapshotWithMetadata } from "./plugin-registry.js" ;
4- import type { PluginRegistrySnapshot } from "./plugin-registry.js" ;
4+ import type { LoadPluginRegistryParams , PluginRegistrySnapshot } from "./plugin-registry.js" ;
55import { getPluginRegistryState } from "./runtime-state.js" ;
66
77function uniqueProviderRefs ( values : readonly string [ ] ) : string [ ] {
@@ -20,15 +20,12 @@ function uniqueProviderRefs(values: readonly string[]): string[] {
2020}
2121
2222function resolveManifestSyntheticAuthProviderRefState (
23- params : {
24- index ?: PluginRegistrySnapshot ;
25- registryDiagnostics ?: readonly unknown [ ] ;
26- } = { } ,
23+ params : SyntheticAuthProviderRefParams = { } ,
2724) : { refs : string [ ] ; complete : boolean } {
2825 if ( params . index && ( params . registryDiagnostics ?. length ?? 0 ) > 0 ) {
2926 return { refs : [ ] , complete : false } ;
3027 }
31- const result = loadPluginRegistrySnapshotWithMetadata ( { index : params . index } ) ;
28+ const result = loadPluginRegistrySnapshotWithMetadata ( params ) ;
3229 if ( result . source !== "persisted" && result . source !== "provided" ) {
3330 return { refs : [ ] , complete : false } ;
3431 }
@@ -40,16 +37,18 @@ function resolveManifestSyntheticAuthProviderRefState(
4037 } ;
4138}
4239
40+ type SyntheticAuthProviderRefParams = LoadPluginRegistryParams & {
41+ index ?: PluginRegistrySnapshot ;
42+ registryDiagnostics ?: readonly unknown [ ] ;
43+ } ;
44+
4345function resolveManifestExternalAuthProviderRefs (
44- params : {
45- index ?: PluginRegistrySnapshot ;
46- registryDiagnostics ?: readonly unknown [ ] ;
47- } = { } ,
46+ params : SyntheticAuthProviderRefParams = { } ,
4847) : string [ ] {
4948 if ( params . index && ( params . registryDiagnostics ?. length ?? 0 ) > 0 ) {
5049 return [ ] ;
5150 }
52- const result = loadPluginRegistrySnapshotWithMetadata ( { index : params . index } ) ;
51+ const result = loadPluginRegistrySnapshotWithMetadata ( params ) ;
5352 if ( result . source !== "persisted" && result . source !== "provided" ) {
5453 return [ ] ;
5554 }
@@ -62,19 +61,13 @@ function resolveManifestExternalAuthProviderRefs(
6261}
6362
6463export function resolveRuntimeSyntheticAuthProviderRefs (
65- params : {
66- index ?: PluginRegistrySnapshot ;
67- registryDiagnostics ?: readonly unknown [ ] ;
68- } = { } ,
64+ params : SyntheticAuthProviderRefParams = { } ,
6965) : string [ ] {
7066 return resolveRuntimeSyntheticAuthProviderRefState ( params ) . refs ;
7167}
7268
7369export function resolveRuntimeSyntheticAuthProviderRefState (
74- params : {
75- index ?: PluginRegistrySnapshot ;
76- registryDiagnostics ?: readonly unknown [ ] ;
77- } = { } ,
70+ params : SyntheticAuthProviderRefParams = { } ,
7871) : { refs : string [ ] ; complete : boolean } {
7972 const registry = getPluginRegistryState ( ) ?. activeRegistry ;
8073 if ( registry ) {
@@ -99,17 +92,11 @@ export function resolveRuntimeSyntheticAuthProviderRefState(
9992 complete : true ,
10093 } ;
10194 }
102- return resolveManifestSyntheticAuthProviderRefState ( {
103- index : params . index ,
104- registryDiagnostics : params . registryDiagnostics ,
105- } ) ;
95+ return resolveManifestSyntheticAuthProviderRefState ( params ) ;
10696}
10797
10898export function resolveRuntimeExternalAuthProviderRefs (
109- params : {
110- index ?: PluginRegistrySnapshot ;
111- registryDiagnostics ?: readonly unknown [ ] ;
112- } = { } ,
99+ params : SyntheticAuthProviderRefParams = { } ,
113100) : string [ ] {
114101 const registry = getPluginRegistryState ( ) ?. activeRegistry ;
115102 if ( registry ) {
@@ -135,8 +122,5 @@ export function resolveRuntimeExternalAuthProviderRefs(
135122 . map ( ( entry ) => entry . backend . id ) ,
136123 ] ) ;
137124 }
138- return resolveManifestExternalAuthProviderRefs ( {
139- index : params . index ,
140- registryDiagnostics : params . registryDiagnostics ,
141- } ) ;
125+ return resolveManifestExternalAuthProviderRefs ( params ) ;
142126}
0 commit comments