refactor: introduce ConnectorRegistry to improve connector ecosystem extensibility and maintainability#4
Open
mtfang wants to merge 1 commit into
Open
refactor: introduce ConnectorRegistry to improve connector ecosystem extensibility and maintainability#4mtfang wants to merge 1 commit into
mtfang wants to merge 1 commit into
Conversation
…registration This is the first major step of the approved connector ecosystem maintainability plan (see session plan.md for the full multi-round effort-5 review with 6 reviewers). - Add ConnectorRegistry, ConnectorFactory, ConnectorBuildContext in alvum-core so connectors self-register instead of being hardcoded. - Migrate all four core connectors (audio, screen, claude-code, codex) to expose register() + *_factory. - Remove the large name-based match in extract::connectors_from_config. CLI dispatch is now a simple registry lookup + BuildContext for the two non-uniform dependencies (LlmProvider for vision, since/before). - Extract resolve_path(~ expansion) and emit_connector_warning helpers to alvum-core::util, deleting exact duplication in session + audio. - Add unit tests for registry + integration test exercising the new path. Behavior for existing connectors, external HTTP extensions, config migration, Observation sources, warnings, and the TCC capture daemon path is 100% preserved. This directly attacks the "edit 6 files to add a new modality" tax and makes future connectors (health, git, calendar, wearable, etc.) much cheaper to land. Follow-up work (subsequent PRs): - Delete vestigial capture_sources() from the Connector trait - Move audio/screen bridging logic into the connector crates - Unify alvum connectors list / doctor with the registry - Documentation (connector-development.md) All changes passed cargo fmt, clippy -D warnings, and relevant tests (core, cli, pipeline idempotency, audio processor modes). Reviewed with /implement --effort 5 (3× general + tests + security + plan alignment).
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
This PR delivers the highest-leverage parts of the Connector Ecosystem Refactor Plan:
ConnectorRegistry+ self-registration for built-in connectors inalvum-corematch namedispatch in the CLI (the main source of the "add a new connector = touch 6 files" problem)ConnectorBuildContextto cleanly handle the two per-run dependencies that aren't uniform across connectors (image_providerfor screen vision,since/beforefor session importers)resolve_path,emit_connector_warning) that immediately delete duplicationAll four core connectors (audio, screen, claude-code, codex) plus the external HTTP extension path continue to work exactly as before.
Motivation
The connector ecosystem had become the highest-friction area for adding new data sources (health, git activity, calendar, browser history, wearables, etc.). The review identified:
extract.rs,capture.rs,config.rs,builtin_components.rs, and the connectors CLIConnectorimplementationcapture_sources()method on the trait that is not used for the real daemon pathThis PR deletes the worst of that coupling.
Review
Developed and reviewed using the
/implement --effort 5skill:LlmProvider)One high-severity correctness issue was caught by a general reviewer (unconditional
with_since/with_beforeclobber when CLI flags were absent) and fixed before merge.Verification
All green. Existing
alvum extractbehavior, warning events, resume/fingerprint logic, and external connector routing are unchanged.Follow-up PRs (tracked in the plan)
capture_sources()from theConnectortrait (it is vestigial for built-ins)alvum connectors list --jsonand the menubar Extensions view derive core connectors from the registry +builtin_componentsdocs/superpowers/specs/connector-development.md+ evergreen "why" commentsFiles
See the diff for the 12 changed files (mostly concentrated in
alvum-coreand the four connector crates + the CLI entry point).This is the foundation that makes the rest of the connector ecosystem work sustainable long-term.