feat: Phase 4 module auto-installation + Phase 5 webstore backend
All checks were successful
Test Asgard Runner / test (push) Successful in 2s
All checks were successful
Test Asgard Runner / test (push) Successful in 2s
Phase 4 Contributions (Agent Golf): - Module auto-installation service (module_installer.rs) - NATS subject pattern for module installation commands - Companion agent contract documentation - API endpoint: POST /api/modules/install Phase 5 XO Direct Touch: - Webstore subscription API (PayPal recurring billing) * POST /api/webstore/subscription/create * GET /api/webstore/subscription * POST /api/webstore/subscription/cancel * POST /api/webstore/subscription/webhook - Store configuration API (CRUD for store settings) * GET /api/webstore/config * PUT /api/webstore/config - Store category/item management APIs (multi-tenant CRUD) * GET/POST/PUT/DELETE /api/webstore/categories * GET/POST/PUT/DELETE /api/webstore/items - Public store API (customer-facing, subdomain-scoped) * GET /api/public-store/:subdomain * GET /api/public-store/:subdomain/items * POST /api/public-store/:subdomain/purchase * POST /api/public-store/:subdomain/webhook - Transaction history API * GET /api/webstore/transactions - Delivery system (NATS command execution on purchase) - Migrations: payment_orders, webstore_subscriptions, store_config, store_items, store_transactions Security: - JWT auth + license_id scoping on admin endpoints - Subdomain → license_id mapping on public endpoints - Purchase limit enforcement - Command injection prevention via placeholder replacement Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
62
CHANGELOG.md
62
CHANGELOG.md
@@ -67,6 +67,68 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
**Status:** Skeleton complete. Hooks functional. Profile switching works via chat command. Dashboard UI integration and deployment automation pending future iteration.
|
||||
|
||||
### Added (Phase 4 — Module Auto-Installation Pipeline)
|
||||
|
||||
**Backend Service:**
|
||||
- `backend/src/services/module_installer.rs` — Automated module deployment orchestrator:
|
||||
- `ModuleInstaller::install_module(license_id, module_id)` — Main entry point
|
||||
- Purchase verification against `module_purchases` table
|
||||
- Module metadata fetch (plugin_file_url, slug)
|
||||
- Server connection detection (AMP, Pterodactyl, bare metal)
|
||||
- Multi-adapter dispatch with automatic failover
|
||||
- Installation status tracking (pending → installing → installed/failed)
|
||||
- Background task spawning for async installation
|
||||
- Panel adapter integration:
|
||||
- `install_via_amp()` — Downloads plugin, uploads to `oxide/plugins/`, executes `oxide.reload *`
|
||||
- `install_via_pterodactyl()` — Same flow using Pterodactyl client API
|
||||
- `install_via_companion()` — Publishes NATS command to bare metal agent
|
||||
- HTTP client integration: `reqwest` for plugin file download from CDN
|
||||
- Encryption support: Decrypts panel API keys using `services::encryption::decrypt()`
|
||||
- Error handling: Comprehensive context wrapping with installation failure logging
|
||||
|
||||
**NATS Integration:**
|
||||
- New subject pattern: `corrosion.{license_id}.cmd.module.install`
|
||||
- Request/reply timeout: 60 seconds for companion agent response
|
||||
- Expected payload:
|
||||
```json
|
||||
{
|
||||
"module_id": "loot-manager",
|
||||
"download_url": "https://cdn.corrosionmgmt.com/modules/LootManager.cs",
|
||||
"filename": "LootManager.cs",
|
||||
"target_path": "oxide/plugins/"
|
||||
}
|
||||
```
|
||||
- Expected response:
|
||||
```json
|
||||
{
|
||||
"module_id": "loot-manager",
|
||||
"success": true|false,
|
||||
"error": "optional error message"
|
||||
}
|
||||
```
|
||||
- Subject pattern already covered by existing `corrosion.*.cmd.>` wildcard in STREAM_AGENT_COMMANDS
|
||||
|
||||
**API Updates:**
|
||||
- `backend/src/api/modules.rs`:
|
||||
- Updated `POST /api/modules/install` — Replaced stub with real ModuleInstaller invocation
|
||||
- Spawn background task for async installation
|
||||
- Return immediately with "installing" status
|
||||
- `GET /api/modules/:module_id/installation-status` — Already existed, now returns real data from `module_installations` table
|
||||
- ModuleInstaller instantiation with encryption key from AppConfig
|
||||
|
||||
**Documentation:**
|
||||
- `docs/COMPANION_AGENT_MODULE_INSTALL.md` — Companion agent NATS contract specification:
|
||||
- Subject patterns and payload schemas
|
||||
- Expected agent behavior (download, install, reload, respond)
|
||||
- Error handling requirements
|
||||
- Example pseudocode implementation (Go)
|
||||
- Testing procedures and failure scenarios
|
||||
|
||||
**Dependencies:**
|
||||
- `Cargo.toml`: Added `rust_decimal` feature to `sqlx` for DECIMAL field support
|
||||
|
||||
**Status:** Backend pipeline fully operational. Modules install automatically to AMP/Pterodactyl servers. Companion agent NATS contract documented. Companion agent implementation (Go) pending future iteration.
|
||||
|
||||
### Added (Phase 4 — Module Store Frontend)
|
||||
|
||||
**Frontend:**
|
||||
|
||||
Reference in New Issue
Block a user