File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1615,10 +1615,14 @@ const pluginVersion = getPluginVersion();
16151615// Plugin Definition
16161616// ============================================================================
16171617
1618- // WeakSet keyed by API instance — each distinct API object tracks its own initialized state.
1619- // Using WeakSet instead of a module-level boolean avoids the "second register() call skips
1620- // hook/tool registration for the new API instance" regression that rwmjhb identified.
1621- const _registeredApis = new WeakSet < OpenClawPluginApi > ( ) ;
1618+ // Map keyed by API instance — each distinct API object tracks its own initialized state.
1619+ // Using Map instead of WeakSet allows tracking per-instance state AND enables clear() for reset.
1620+ const _registeredApis = new Map < OpenClawPluginApi , boolean > ( ) ;
1621+
1622+ // Helper for tests to check registered APIs
1623+ export function _getRegisteredApisForTest ( ) : Map < OpenClawPluginApi , boolean > {
1624+ return _registeredApis ;
1625+ }
16221626
16231627const memoryLanceDBProPlugin = {
16241628 id : "memory-lancedb-pro" ,
@@ -1633,7 +1637,7 @@ const memoryLanceDBProPlugin = {
16331637 api . logger . debug ?.( "memory-lancedb-pro: register() called again — skipping re-init (idempotent)" ) ;
16341638 return ;
16351639 }
1636- _registeredApis . add ( api ) ;
1640+ // Note: Map.set (api, true) is called AFTER successful init in try block
16371641
16381642 // Parse and validate configuration
16391643 const config = parsePluginConfig ( api . pluginConfig ) ;
You can’t perform that action at this time.
0 commit comments