Skip to content

Commit 87bf249

Browse files
authored
feat(phase2): Singleton State Management (PR #598, 4 commits) (#637)
* feat(phase2): add PluginSingletonState interface and singleton state variable (PR #598) - Add PluginSingletonState interface: defines all 18 properties returned by the singleton factory (8 heavy resources + 8 session Maps with their types) - Add module-level _singletonState: null until first register() call - Add _initPluginState(api) factory skeleton: returns PluginSingletonState This commit only adds the interface and skeleton. The factory body is empty (returns null!) and will be filled in subsequent commits. * feat(phase2): replace register() init block with singleton factory call (PR #598) - Replace the old init block (config, store, embedder, tierManager, retriever, scopeManager, migrator, smartExtractor, extractionRateLimiter) with: - if (!_singletonState) guard that calls _initPluginState() - destructuring of all 18 properties from _singletonState - The factory _initPluginState() body is still empty (returns null!) — filled in the next commit - Helpers section is unchanged but will reference undefined values until the factory body is added in the next commit (expected state) * feat(phase2): fill _initPluginState() factory body with all resources and Maps (PR #598) * feat(phase2): remove old duplicate session Map declarations from helpers (PR #598) The helpers section had 8 Map declarations that are now created once in _singletonState and accessed via destructuring. Remove them to prevent duplicate declarations that would cause TypeScript errors. Maps removed from helpers: - reflectionErrorStateBySession - reflectionDerivedBySession - reflectionByAgentCache - recallHistory - turnCounter - autoCaptureSeenTextCount - autoCapturePendingIngressTexts - autoCaptureRecentTexts * fix(phase2): add missing migrator to singleton destructuring migrator was returned by _initPluginState() but missing from the singleton destructuring, causing ReferenceError at createMemoryCLI() call site (index.ts:2286). This was the root cause of CI failures in PR #598.
1 parent 9f8deff commit 87bf249

File tree

1 file changed

+219
-157
lines changed

1 file changed

+219
-157
lines changed

0 commit comments

Comments
 (0)