@@ -9,6 +9,18 @@ const resolveAgentWorkspaceDirMock = vi.fn<
99const resolveDefaultAgentIdMock = vi . fn <
1010 typeof import ( "../../agents/agent-scope.js" ) . resolveDefaultAgentId
1111> ( ( ) => "default" ) ;
12+ const manifestRegistry = { diagnostics : [ ] , plugins : [ ] } ;
13+ const metadataSnapshot = {
14+ configFingerprint : "fingerprint" ,
15+ diagnostics : [ ] ,
16+ index : { plugins : [ ] , policyHash : "policy" } ,
17+ manifestRegistry,
18+ plugins : [ ] ,
19+ policyHash : "policy" ,
20+ workspaceDir : "/resolved-workspace" ,
21+ } ;
22+ const loadPluginMetadataSnapshotMock = vi . fn ( ( ) => metadataSnapshot ) ;
23+ const setCurrentPluginMetadataSnapshotMock = vi . fn ( ) ;
1224
1325let resolvePluginRuntimeLoadContext : typeof import ( "./load-context.js" ) . resolvePluginRuntimeLoadContext ;
1426let buildPluginRuntimeLoadOptions : typeof import ( "./load-context.js" ) . buildPluginRuntimeLoadOptions ;
@@ -29,6 +41,14 @@ vi.mock("../../agents/agent-scope.js", () => ({
2941 resolveDefaultAgentId : resolveDefaultAgentIdMock ,
3042} ) ) ;
3143
44+ vi . mock ( "../plugin-metadata-snapshot.js" , ( ) => ( {
45+ loadPluginMetadataSnapshot : loadPluginMetadataSnapshotMock ,
46+ } ) ) ;
47+
48+ vi . mock ( "../current-plugin-metadata-snapshot.js" , ( ) => ( {
49+ setCurrentPluginMetadataSnapshot : setCurrentPluginMetadataSnapshotMock ,
50+ } ) ) ;
51+
3252describe ( "resolvePluginRuntimeLoadContext" , ( ) => {
3353 beforeEach ( async ( ) => {
3454 vi . resetModules ( ) ;
@@ -38,6 +58,8 @@ describe("resolvePluginRuntimeLoadContext", () => {
3858 await import ( "./load-context.js" ) ) ;
3959 loadConfigMock . mockReset ( ) ;
4060 applyPluginAutoEnableMock . mockReset ( ) ;
61+ loadPluginMetadataSnapshotMock . mockClear ( ) ;
62+ setCurrentPluginMetadataSnapshotMock . mockClear ( ) ;
4163 resolveAgentWorkspaceDirMock . mockClear ( ) ;
4264 resolveDefaultAgentIdMock . mockClear ( ) ;
4365
@@ -84,10 +106,23 @@ describe("resolvePluginRuntimeLoadContext", () => {
84106 workspaceDir : "/resolved-workspace" ,
85107 env,
86108 logger : context . logger ,
109+ manifestRegistry,
110+ } ) ;
111+ expect ( loadPluginMetadataSnapshotMock ) . toHaveBeenCalledWith ( {
112+ config : rawConfig ,
113+ env,
114+ workspaceDir : "/resolved-workspace" ,
87115 } ) ;
88116 expect ( applyPluginAutoEnableMock ) . toHaveBeenCalledWith ( {
89117 config : rawConfig ,
90118 env,
119+ manifestRegistry,
120+ } ) ;
121+ expect ( setCurrentPluginMetadataSnapshotMock ) . toHaveBeenCalledWith ( metadataSnapshot , {
122+ config : rawConfig ,
123+ compatibleConfigs : [ resolvedConfig , rawConfig ] ,
124+ env,
125+ workspaceDir : "/resolved-workspace" ,
91126 } ) ;
92127 expect ( resolveDefaultAgentIdMock ) . toHaveBeenCalledWith ( resolvedConfig ) ;
93128 expect ( resolveAgentWorkspaceDirMock ) . toHaveBeenCalledWith ( resolvedConfig , "default" ) ;
@@ -111,6 +146,7 @@ describe("resolvePluginRuntimeLoadContext", () => {
111146 expect ( applyPluginAutoEnableMock ) . toHaveBeenCalledWith ( {
112147 config : runtimeConfig ,
113148 env : process . env ,
149+ manifestRegistry,
114150 } ) ;
115151 } ) ;
116152
@@ -134,6 +170,7 @@ describe("resolvePluginRuntimeLoadContext", () => {
134170 workspaceDir : "/explicit-workspace" ,
135171 env : context . env ,
136172 logger : context . logger ,
173+ manifestRegistry,
137174 cache : false ,
138175 activate : false ,
139176 onlyPluginIds : [ "demo" ] ,
0 commit comments