refactor: split model agent manager responsibilities#112
Merged
Conversation
Introduce PluginScopedStorageCoordinator to resolve storage paths relative to the active plugin directory rather than hardcoding .nexus, which enables reliable SQLite WASM resolution and JSONL sync across devices. JSONLWriter now supports multiple read roots so data synced from other devices is discovered alongside local writes. Adds a "Refresh synced data" maintenance command for mobile users whose vault finishes syncing after plugin init. Settings save now merges with existing data to avoid clobbering unrecognized keys. Conversation reconciliation replays JSONL files missing from SQLite on startup and after each sync cycle. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…te sync - Serialize data.json writes with shared pluginDataLock to prevent saveSettings/saveState race condition - Short-circuit prepareStoragePlan() when migration is already verified, eliminating redundant file I/O on every startup - Add conversation_deleted event type so deleted conversations persist in JSONL and don't resurrect on reconciliation/sync - Update README and CLAUDE.md with multi-device sync documentation Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
prepareStoragePlan() added I/O before sqliteCache.initialize(), widening the race window where EmbeddingManager could query an uninitialized database. Now awaits waitForReady() and bails gracefully if the adapter failed to initialize. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Midway65
added a commit
to Midway65/nexus
that referenced
this pull request
Apr 7, 2026
…pse#106, ProfSynapse#107, ProfSynapse#112–ProfSynapse#115) Merges upstream/main (35bed84) into my-custom-branch. Fork additions preserved: - HybridStorageAdapter: pruneOrphanedConversationFiles() re-added (fork: temporary cleanup) - SQLiteMaintenanceService: fixVec0TableDimensions() added (fork: vec0 768→384 fix) - SQLiteCacheManager: calls fixVec0TableDimensions() after migrations - JSONLWriter: readEventsStreaming() kept; size-check in readEvents() for >50MB files; stat() call made optional-chain safe for test environments - MessageBubble: action bar import, field, appendActionBar/cleanupActionBar methods, call sites in createElement/updateWithNewMessage/rebuildElement/cleanup; ToolBubbleFactory call uses 3-param signature (action bar owns copy) Upstream changes taken entirely: - ProviderHttpClient: dropped our require() fix; took upstream desktopRequire version - ConversationRepository: dropped JSONL file-delete; took upstream tombstone approach - ModelAgentManager: 5-service split (PRs ProfSynapse#112) - SQLiteCacheManager: 6-file split (PR ProfSynapse#113); facade kept; new services accepted - MessageBubble: 527-line refactor with 4 helper classes (PR ProfSynapse#115) - PluginScopedStorage: new PluginScopedStorageCoordinator + PluginStoragePathResolver - 9 new test files accepted from upstream .gitignore: added !docs/review/ exception (pattern consistent with other doc dirs) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary\n- split ModelAgentManager into focused collaborators for conversation settings, workspace context, defaults, prompt assembly, and compaction state\n- keep ModelAgentManager as the stateful facade and preserve its public API\n- add characterization coverage for restore/save, workspace binding, message options, and delegated default resolution\n\n## Verification\n- npm test\n- npx jest tests/unit/ModelAgentManager.test.ts tests/unit/ModelAgentManagerContextGating.test.ts tests/unit/ModelAgentManagerCompactionPersistence.test.ts --runInBand\n- focused eslint on the changed files\n\n## Notes\n- Full repo tests pass in this branch.\n- npm run build still fails during the repo-wide eslint phase due to pre-existing issues outside this refactor in src/database/storage/SQLiteCacheManager.ts and a console warning in src/core/PluginLifecycleManager.ts.