22import { setCurrentManifestModelIdNormalizationRecords } from "@openclaw/model-catalog-core/provider-model-id-normalization" ;
33import type { OpenClawConfig } from "../config/types.openclaw.js" ;
44import {
5- clearCurrentPluginMetadataSnapshotState ,
5+ currentPluginMetadataConfigIdentityCache ,
66 getCurrentPluginMetadataSnapshotState ,
77 setCurrentPluginMetadataSnapshotState ,
88} from "./current-plugin-metadata-state.js" ;
@@ -11,19 +11,14 @@ import {
1111 resolvePluginControlPlaneFingerprint ,
1212 type ResolvePluginControlPlaneContextParams ,
1313} from "./plugin-control-plane-context.js" ;
14- import { registerPluginMetadataProcessMemoLifecycleClear } from "./plugin-metadata-lifecycle.js" ;
1514import type {
1615 PluginMetadataSnapshot ,
1716 PluginMetadataSnapshotPluginIdScope ,
1817} from "./plugin-metadata-snapshot.types.js" ;
1918import { normalizePluginIdScope , serializePluginIdScope } from "./plugin-scope.js" ;
2019
2120type CurrentPluginMetadataSnapshotState = ReturnType < typeof getCurrentPluginMetadataSnapshotState > ;
22- let currentPluginMetadataConfigIdentityCache = new WeakSet < OpenClawConfig > ( ) ;
23-
24- registerPluginMetadataProcessMemoLifecycleClear ( ( ) => {
25- setCurrentManifestModelIdNormalizationRecords ( undefined ) ;
26- } ) ;
21+ export { clearCurrentPluginMetadataSnapshot } from "./current-plugin-metadata-state.js" ;
2722
2823function resolvePluginMetadataControlPlaneFingerprint (
2924 config ?: OpenClawConfig ,
@@ -35,12 +30,6 @@ function resolvePluginMetadataControlPlaneFingerprint(
3530 } ) ;
3631}
3732
38- export function isReusableCurrentPluginMetadataSnapshot (
39- _snapshot : PluginMetadataSnapshot ,
40- ) : boolean {
41- return true ;
42- }
43-
4433// Single-slot Gateway-owned handoff. Replace or clear it at lifecycle boundaries;
4534// never accumulate historical metadata snapshots here.
4635export function setCurrentPluginMetadataSnapshot (
@@ -52,7 +41,7 @@ export function setCurrentPluginMetadataSnapshot(
5241 workspaceDir ?: string ;
5342 } = { } ,
5443) : void {
55- currentPluginMetadataConfigIdentityCache = new WeakSet ( ) ;
44+ currentPluginMetadataConfigIdentityCache . clear ( ) ;
5645 const compatiblePolicyHashes = snapshot
5746 ? options . compatibleConfigs ?. map ( ( config ) => resolveInstalledPluginIndexPolicyHash ( config ) )
5847 : undefined ;
@@ -117,20 +106,14 @@ export function setCurrentPluginMetadataSnapshot(
117106 }
118107}
119108
120- export function clearCurrentPluginMetadataSnapshot ( ) : void {
121- currentPluginMetadataConfigIdentityCache = new WeakSet ( ) ;
122- setCurrentManifestModelIdNormalizationRecords ( undefined ) ;
123- clearCurrentPluginMetadataSnapshotState ( ) ;
124- }
125-
126109export function captureCurrentPluginMetadataSnapshotState ( ) : CurrentPluginMetadataSnapshotState {
127110 return getCurrentPluginMetadataSnapshotState ( ) ;
128111}
129112
130113export function restoreCurrentPluginMetadataSnapshotState (
131114 state : CurrentPluginMetadataSnapshotState ,
132115) : void {
133- currentPluginMetadataConfigIdentityCache = new WeakSet ( ) ;
116+ currentPluginMetadataConfigIdentityCache . clear ( ) ;
134117 const snapshot = state . snapshot as PluginMetadataSnapshot | undefined ;
135118 const defaultDiscoveryConfigFingerprint = snapshot
136119 ? resolvePluginMetadataControlPlaneFingerprint (
0 commit comments