@@ -17,11 +17,8 @@ import { detectInferenceBackends } from "../commands/onboard-inference.js";
1717import { resolveAgentModelPrimaryValue } from "../config/model-input.js" ;
1818import type { OpenClawConfig } from "../config/types.openclaw.js" ;
1919import type { PluginInstallRecord } from "../config/types.plugins.js" ;
20- import { setCurrentPluginMetadataSnapshot } from "../plugins/current-plugin-metadata-snapshot.js" ;
21- import { resolveInstalledPluginIndexPolicyHash } from "../plugins/installed-plugin-index-policy.js" ;
2220import { withoutPluginInstallRecords } from "../plugins/installed-plugin-index-records.js" ;
2321import { hasRetainedManagedNpmInstallMarker } from "../plugins/managed-npm-retention.js" ;
24- import { resolvePluginControlPlaneFingerprint } from "../plugins/plugin-control-plane-context.js" ;
2522import { resolvePluginMetadataSnapshot } from "../plugins/plugin-metadata-snapshot.js" ;
2623import type { ProviderAuthChoiceMetadata } from "../plugins/provider-auth-choices.js" ;
2724import { createEmptyPluginRegistry } from "../plugins/registry-empty.js" ;
@@ -137,17 +134,12 @@ const suiteTempRootTracker = createSuiteTempRootTracker({
137134 prefix : "setup-inference-test-" ,
138135} ) ;
139136let pluginMetadataSnapshot : SystemAgentPluginMetadataTestSnapshot | undefined ;
140- let preparedPluginMetadataSnapshot : ReturnType < typeof resolvePluginMetadataSnapshot > | undefined ;
141137let inMemoryAuthProfileStores = new Map < string , AuthProfileStore > ( ) ;
142138
143139beforeAll ( async ( ) => {
144140 pluginMetadataSnapshot = installSystemAgentPluginMetadataTestSnapshot (
145141 materializedMainRuntimeConfig ,
146142 ) ;
147- preparedPluginMetadataSnapshot = resolvePluginMetadataSnapshot ( {
148- config : materializedMainRuntimeConfig ,
149- env : process . env ,
150- } ) ;
151143 cliBackendsTesting . setDepsForTest ( {
152144 resolvePluginSetupCliBackend : ( ) => undefined ,
153145 resolvePluginSetupRegistry : ( ) => ( { cliBackends : [ ] } ) as never ,
@@ -302,7 +294,7 @@ function withSuiteFixtures<
302294 if ( ! deps . readCodexCliActiveApiKey ) {
303295 deps . readCodexCliActiveApiKey = ( ) => null ;
304296 }
305- deps . resolvePluginMetadataSnapshot ??= bindPreparedPluginMetadataSnapshot ;
297+ deps . resolvePluginMetadataSnapshot ??= pluginMetadataSnapshot ?. bind ;
306298 if ( ! useRealAuthProfileStore ) {
307299 deps . updateAuthProfileStoreWithLock ??= updateInMemoryAuthProfileStoreWithLock ;
308300 deps . loadPersistedAuthProfileStore ??= loadInMemoryPersistedAuthProfileStore ;
@@ -313,7 +305,7 @@ function withSuiteFixtures<
313305 const readConfigFileSnapshot = deps . readConfigFileSnapshot ;
314306 deps . readConfigFileSnapshot = ( async ( ...args : Parameters < typeof readConfigFileSnapshot > ) => {
315307 const snapshot = await readConfigFileSnapshot ( ...args ) ;
316- bindPreparedPluginMetadataSnapshot ( {
308+ pluginMetadataSnapshot ?. bind ( {
317309 config : snapshot . runtimeConfig ?? snapshot . config ,
318310 env : process . env ,
319311 } ) ;
@@ -440,7 +432,7 @@ async function verifySetupInferenceConfig(
440432 } ,
441433) : ReturnType < typeof verifySetupInferenceConfigImpl > {
442434 const { useRealAuthProfileStore = false , ...verifyParams } = params ;
443- bindPreparedPluginMetadataSnapshot ( { config : verifyParams . config , env : process . env } ) ;
435+ pluginMetadataSnapshot ?. bind ( { config : verifyParams . config , env : process . env } ) ;
444436 return verifySetupInferenceConfigImpl ( {
445437 runtime,
446438 ...verifyParams ,
@@ -535,41 +527,6 @@ function mockCodexRuntimeInstall(installRecord?: PluginInstallRecord) {
535527 } ) ) as never ;
536528}
537529
538- function requirePreparedPluginMetadataSnapshot ( ) {
539- if ( ! preparedPluginMetadataSnapshot ) {
540- throw new Error ( "setup inference plugin metadata fixture was not initialized" ) ;
541- }
542- return preparedPluginMetadataSnapshot ;
543- }
544-
545- function bindPreparedPluginMetadataSnapshot (
546- params : Parameters < typeof resolvePluginMetadataSnapshot > [ 0 ] ,
547- ) {
548- const prepared = requirePreparedPluginMetadataSnapshot ( ) ;
549- const policyHash = resolveInstalledPluginIndexPolicyHash ( params . config ) ;
550- const index =
551- prepared . index . policyHash === policyHash ? prepared . index : { ...prepared . index , policyHash } ;
552- const snapshot = {
553- ...prepared ,
554- index,
555- policyHash,
556- configFingerprint : resolvePluginControlPlaneFingerprint ( {
557- config : params . config ,
558- env : params . env ,
559- index,
560- policyHash,
561- workspaceDir : params . workspaceDir ,
562- } ) ,
563- ...( params . workspaceDir ? { workspaceDir : params . workspaceDir } : { } ) ,
564- } ;
565- setCurrentPluginMetadataSnapshot ( snapshot , {
566- config : params . config ,
567- env : params . env ,
568- workspaceDir : params . workspaceDir ,
569- } ) ;
570- return snapshot ;
571- }
572-
573530function activateCodexSetup ( params : Omit < TestSetupInferenceActivationParams , "kind" > ) {
574531 return activateSetupInference ( {
575532 kind : "codex-cli" ,
0 commit comments