refactor(frame-manager): extract WhatsApp sync into lifecycle hooks#6
Merged
jonathanpeterwu merged 6 commits intomainfrom Jan 26, 2026
Merged
Conversation
- Create new frame-lifecycle-hooks.ts module for extensible frame events - Remove WhatsApp-specific code from FrameManager (was 20 lines of tight coupling) - FrameManager now calls frameLifecycleHooks.triggerClose() instead - WhatsApp sync registers itself as a hook via registerWhatsAppSyncHook() - Benefits: - FrameManager no longer knows about WhatsApp - Other integrations can subscribe to frame events - Better testability and separation of concerns - Fire-and-forget hooks don't block frame operations https://claude.ai/code/session_014ojs76858uGzWb6Hrbs4VG
- Merge duplicate ErrorCode enums into src/core/errors/index.ts - Add new error codes: AUTH_*, FS_*, GIT_*, NET_* categories - Add getUserFriendlyMessage() for user-facing error messages - Move ErrorHandler class with retry/circuit breaker to errors module - Move validation utilities (validateInput, validateEmail, validatePath) - error-handler.ts now re-exports from errors for backwards compatibility Benefits: - Single source of truth for all error codes - Consistent error handling across CLI and core - No more conflicting StackMemoryError class definitions - Better organization with categorized error codes https://claude.ai/code/session_014ojs76858uGzWb6Hrbs4VG
…efactoredFrameManager - Add frameLifecycleHooks integration to RefactoredFrameManager.closeFrame() - Add missing methods for feature parity with legacy FrameManager: - setQueryMode() - change query mode for frame retrieval - getRecentFrames() - get recent frames with metadata - addContext() - add context metadata to current frame - deleteFrame() - delete frame completely (for handoffs) - extractTagsFromFrame() - extract tags for categorization - calculateFrameImportance() - calculate frame importance - Add setQueryMode() and removeFrame() to FrameStack This brings RefactoredFrameManager to feature parity with legacy FrameManager, enabling eventual removal of the legacy implementation. https://claude.ai/code/session_014ojs76858uGzWb6Hrbs4VG
…xports - Update all direct imports from frame-manager.ts to use index.js - Update type-only imports to use frame-types.ts - Fix type exports to use `export type` for pure type definitions (required because esbuild strips type-only modules at runtime) - Update tests to use new import paths: - FrameManager now refers to RefactoredFrameManager - LegacyFrameManager available for backwards compatibility tests All code now imports FrameManager from index.js, which provides the RefactoredFrameManager as the primary implementation. https://claude.ai/code/session_014ojs76858uGzWb6Hrbs4VG
- Delete frame-manager.ts (1,391 lines) - legacy implementation - Update all imports to use index.js centralized exports - Fix updateParentFrame to properly update parent_frame_id and depth - Add validation for non-existent parent frames - Support parent_frame_id and depth updates in FrameDatabase - Rewrite cycle detection tests to use unified FrameManager https://claude.ai/code/session_014ojs76858uGzWb6Hrbs4VG
jonathanpeterwu
added a commit
that referenced
this pull request
Jan 28, 2026
* refactor(frame-manager): extract WhatsApp sync into lifecycle hooks - Create new frame-lifecycle-hooks.ts module for extensible frame events - Remove WhatsApp-specific code from FrameManager (was 20 lines of tight coupling) - FrameManager now calls frameLifecycleHooks.triggerClose() instead - WhatsApp sync registers itself as a hook via registerWhatsAppSyncHook() - Benefits: - FrameManager no longer knows about WhatsApp - Other integrations can subscribe to frame events - Better testability and separation of concerns - Fire-and-forget hooks don't block frame operations https://claude.ai/code/session_014ojs76858uGzWb6Hrbs4VG * refactor(errors): consolidate error codes and handler into single module - Merge duplicate ErrorCode enums into src/core/errors/index.ts - Add new error codes: AUTH_*, FS_*, GIT_*, NET_* categories - Add getUserFriendlyMessage() for user-facing error messages - Move ErrorHandler class with retry/circuit breaker to errors module - Move validation utilities (validateInput, validateEmail, validatePath) - error-handler.ts now re-exports from errors for backwards compatibility Benefits: - Single source of truth for all error codes - Consistent error handling across CLI and core - No more conflicting StackMemoryError class definitions - Better organization with categorized error codes https://claude.ai/code/session_014ojs76858uGzWb6Hrbs4VG * chore: update package-lock.json https://claude.ai/code/session_014ojs76858uGzWb6Hrbs4VG * refactor(frame-manager): add lifecycle hooks and missing methods to RefactoredFrameManager - Add frameLifecycleHooks integration to RefactoredFrameManager.closeFrame() - Add missing methods for feature parity with legacy FrameManager: - setQueryMode() - change query mode for frame retrieval - getRecentFrames() - get recent frames with metadata - addContext() - add context metadata to current frame - deleteFrame() - delete frame completely (for handoffs) - extractTagsFromFrame() - extract tags for categorization - calculateFrameImportance() - calculate frame importance - Add setQueryMode() and removeFrame() to FrameStack This brings RefactoredFrameManager to feature parity with legacy FrameManager, enabling eventual removal of the legacy implementation. https://claude.ai/code/session_014ojs76858uGzWb6Hrbs4VG * refactor(context): migrate all imports to use index.js and fix type exports - Update all direct imports from frame-manager.ts to use index.js - Update type-only imports to use frame-types.ts - Fix type exports to use `export type` for pure type definitions (required because esbuild strips type-only modules at runtime) - Update tests to use new import paths: - FrameManager now refers to RefactoredFrameManager - LegacyFrameManager available for backwards compatibility tests All code now imports FrameManager from index.js, which provides the RefactoredFrameManager as the primary implementation. https://claude.ai/code/session_014ojs76858uGzWb6Hrbs4VG * refactor(context): remove legacy FrameManager and consolidate imports - Delete frame-manager.ts (1,391 lines) - legacy implementation - Update all imports to use index.js centralized exports - Fix updateParentFrame to properly update parent_frame_id and depth - Add validation for non-existent parent frames - Support parent_frame_id and depth updates in FrameDatabase - Rewrite cycle detection tests to use unified FrameManager https://claude.ai/code/session_014ojs76858uGzWb6Hrbs4VG --------- Co-authored-by: Claude <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.
https://claude.ai/code/session_014ojs76858uGzWb6Hrbs4VG