Skip to content

feat: add composable addon system with vpatch/patch, catalog, and registry - #324

Merged
H2Sxxa merged 18 commits into
mainfrom
feat/addon-system
Nov 28, 2026
Merged

H2Sxxa merged 18 commits into
mainfrom
feat/addon-system

Conversation

@H2Sxxa

@H2Sxxa H2Sxxa commented Nov 27, 2026

Copy link
Copy Markdown
Member

Summary

Introduce Elemental's composable Addon system across core, driver, addon, launcher, elemental-kit, and launchpad:

  • elemental-core::url (058f87d): Move Origin, OriginPolicy, OriginEndpoints, OriginError, and URL helpers from elemental-driver into elemental-core behind the http feature, and add OriginPolicyMap for global + scoped mirror layering.
  • elemental-driver Patch Engine & LiteLoader Retirement (b528dc0):
    • Add MetadataPatch, PatchMode (Virtual / Physical), topological before/after ordering with cycle detection, per-step PatchTrace / MetadataPatchStepDiff, baseline-first InstanceProbe::collect, and VersionJsonLaunchBuilder::with_metadata.
    • Remove LITELOADER_DRIVER and crates/driver/src/drivers/liteloader/.
  • elemental-addon Crate (08df741):
    • Add the Addon trait, monotonic two-level patch scoping (PatchModeSupport + AddonPatchMode), .elemental/addons.json persistence, reorder_instance_addons, trace_instance_patches, catalog support (AddonRelease / AddonCatalogQuery), and built-in LiteLoaderAddon, CustomPatchAddon, and JvmAgentAddon.
  • elemental-launcher / elemental-kit / launchpad Integration (4d88c7f):
    • Add AddonRegistry (supporting both built-in and third-party addons with data-only degradation and explicit failure for missing runtime hooks), AddonSpec, Launcher::install_addons, reorder_addons, set_addon_patch_mode, set_instance_patch_mode, trace_instance_patches, per-addon DriverOrigins support, and integration tests (crates/launcher/tests/addon_system.rs).

Breaking Changes

  • LITELOADER_DRIVER, elemental_driver::drivers::liteloader, driver-liteloader, and DriverOrigins::liteloader were removed; use DriverSpec::vanilla / DriverSpec::forge + AddonSpec::new("liteloader") with addon-liteloader and DriverOrigins::liteloader_addon() / for_addon().
  • elemental_launcher::Instance now includes pub addons: Vec<InstalledAddon>.
  • InstalledAddon now includes pub effective_patch_mode: PatchMode.
  • AddonSpec now includes pub patch_mode: AddonPatchMode.
  • Launcher::set_instance_patch_mode now returns Result<PatchTrace> instead of Result<()>.

Verification

  • cargo fmt --all -- --check — passed
  • cargo test -p elemental-core url — 5 passed
  • cargo test -p elemental-driver — 7 passed
  • cargo test -p elemental-addon — compiled and doc-tested (0 tests)
  • cargo test -p elemental-launcher --test addon_system --test driver_registry --test inspect_instances — 13 passed
  • cargo test -p elemental-launcher origin — 2 passed
  • cargo check --workspace — all 7 workspace crates passed

Move Origin, OriginPolicy, OriginEndpoints, OriginError, and URL helpers into elemental_core::url behind the http feature, and add OriginPolicyMap for global + scoped mirror layering.
Add MetadataPatch, PatchMode (Virtual/Physical), topological before/after ordering, per-step PatchTrace diffs, baseline-first InstanceProbe detection, and VersionJsonLaunchBuilder::with_metadata. Re-export elemental_core::url and remove LiteLoader driver.

BREAKING CHANGE: LITELOADER_DRIVER, elemental_driver::drivers::liteloader, and Error::LiteLoader* variants were removed; LiteLoader now lives in elemental-addon.
…and built-in addons

Introduce the Addon trait, PatchModeSupport/AddonPatchMode monotonic scoping, .elemental/addons.json state management, reorder/trace helpers, catalog query types, and built-in LiteLoaderAddon, CustomPatchAddon, and JvmAgentAddon.
…and existing-instance install

Add AddonRegistry, AddonSpec, Launcher::install_addons, reorder_addons, set_addon_patch_mode, set_instance_patch_mode, trace_instance_patches, per-addon DriverOrigins support, and integration tests; expose addon features in elemental-kit and remove driver-liteloader from launchpad.

BREAKING CHANGE: Instance gained pub addons: Vec<InstalledAddon>; driver-liteloader and DriverOrigins::liteloader were replaced by addon-liteloader and DriverOrigins::liteloader_addon / for_addon; Launcher::set_instance_patch_mode now returns Result<PatchTrace>.
@codacy-production

codacy-production Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 889 complexity · 26 duplication

Metric Results
Complexity 889
Duplication 26

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@H2Sxxa H2Sxxa linked an issue Nov 27, 2026 that may be closed by this pull request
…ilderExt

- Split crates/core/src/http into config, client, request, and tests submodules
- Add SwappableClient::request, get, scoped headers (with_header/with_headers), RequestBuilderExt, and HttpRequestError
- Remove elemental_driver::http::HttpClient and migrate driver and addon sources
- Add Launcher::register_addon_with for constructor-time dependency injection of shared SwappableClient
…l Addon registration

- Implement Addon for Arc<T> and accept impl Addon + 'static in Launcher::register_addon and builders
- Remove Launcher::register_addon_with
- Convert with_http_client on LiteLoaderSource, VanillaSource, LoaderMetaSource, InstallerMavenSource, and RiftSource to fluent mut self -> Self
- Add LiteLoaderAddon::with_http_client
…via VersionJsonInstanceResource

- Replace manual .elemental/base-version.json path joining in patch storage with VersionJsonInstanceResource::Elemental
- Replace manual .elemental/addons.json path joining in addon state storage with VersionJsonInstanceResource::Elemental
- Update load_addon_state and save_addon_state to take &InstanceStorage and update launcher callers
…d expose AddonRegistry::addon

- Drop required game_version from AddonRelease and make AddonCatalogQuery filters optional
- Simplify LiteLoaderAddon::available_versions to filter source releases directly
- Replace AddonRegistry catalog forwarding methods with AddonRegistry::addon(id) -> Result<Arc<dyn Addon>>
… support launch-scoped addons

- Implement version-selectable AuthlibInjectorAddon in elemental-addon with OriginPolicy mirror support, SwappableClient, SHA-256 cache verification, and optional embedded fallback
- Add LaunchOptions::addon(AddonSpec) supporting full unified ephemeral launch-scoped addons (prepare, in-memory MetadataPatch overlay, augment_launch) without disk writes
- Store game_version on PreparedInstance and replace Launcher::install_authlib_injector / implicit inject_authlib_injector with explicit AuthlibInjectorAddon registration
- Replaced compile error for missing TLS backend with a macro call to `elemental_core::require_tls_backend!()`.
- Removed dead code and unnecessary feature flags from `origin.rs`.
- Streamlined imports and organized driver-related code in `registration.rs`, enhancing readability and maintainability.
- Added comprehensive documentation on using addons, including architecture overview, built-in addons, installation methods, patch modes, and custom addon authoring in `addons.md`.
- Introduced `ActionScope` struct to encapsulate scoped operations for instance preparation and addon installation.
- Refactored methods to utilize `ActionScope` for preparing instances, installing addons, and launching commands.
- Updated tests to align with the new scoped operation model, ensuring proper handling of addon patch modes and session management.
- Modified documentation to reflect the new usage patterns for instance preparation and addon management.
@H2Sxxa
H2Sxxa merged commit 736ec5b into main Nov 28, 2026
2 checks passed
@H2Sxxa
H2Sxxa deleted the feat/addon-system branch November 28, 2026 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: addons system

1 participant