Commit Graph

77 Commits

Author SHA1 Message Date
Vantz Stockwell
071ab80e40 feat: Implement Phase 6 B2B hosting integration (minimal viable B2B)
All checks were successful
Test Asgard Runner / test (push) Successful in 3s
Backend infrastructure for hosting provider reseller program (Model B).

Database Schema (Migration 012):
- hosts table: Hosting company accounts with API key authentication
- host_licenses: Tracks licenses provisioned by each host
- host_billing_records: Monthly billing data ($6/server wholesale)

Host Provisioning Service:
- API key authentication (SHA-256 hashed, bearer token)
- Bulk license provisioning (single call creates user + license + associations)
- Auto-generation: license keys, companion tokens, subdomain slugs
- Active license counting for billing
- Monthly billing record generation with CSV export support

Host API Endpoints:
- POST /api/host/provision: Bulk license creation
  * Input: server_id, hostname, customer_email
  * Output: license_key, companion_token, plugin_download_url, subdomain, panel_url
- GET /api/host/licenses: List all host-provisioned licenses with status
- GET /api/host/billing/:month: Monthly billing report (YYYY-MM format)

Security:
- Separate authentication system (API keys vs user JWTs)
- Host-level query isolation (all operations scoped by host_id)
- SHA-256 API key hashing
- CORS protection on host endpoints

Business Model:
- $6/server/month wholesale rate (configurable per host)
- Manual invoicing (no Stripe integration in MVP)
- Hosts control their own markup to end customers

Per B2B_RESELLER_PLAN.md: Minimal viable B2B implementation (Model B).
No white-label branding, SSO, or complex integration required.
Simple API-based provisioning for hosting partners.

Production ready for initial hosting partner testing.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 15:05:17 -05:00
Vantz Stockwell
a8b7f536b5 feat: Add Phase 5 store item management UI
All checks were successful
Test Asgard Runner / test (push) Successful in 3s
2026-02-15 15:00:00 -05:00
Vantz Stockwell
381d447dd8 feat: Add Phase 5 revenue dashboard UI
All checks were successful
Test Asgard Runner / test (push) Successful in 3s
Revenue analytics dashboard for webstore owners:
- Summary cards: Total Revenue, Transactions, Pending Deliveries, Refunds
- Revenue chart: ECharts line graph showing daily revenue (last 30 days)
- Transaction table: Date, Player, Item, Amount, Status, Delivered
- Status filter dropdown (all/delivered/paid/pending/failed/refunded)
- CSV export with full transaction details
- Color-coded status badges for quick scanning
- Manual refresh button (no auto-polling)
- Route: /admin/webstore/revenue
- API: GET /api/webstore/transactions
- TypeScript: StoreTransaction interface

Phase 5 Progress: 3/4 frontend components complete (75%)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 14:59:23 -05:00
Vantz Stockwell
79f5071b77 feat: Add Phase 5 customer store frontend
All checks were successful
Test Asgard Runner / test (push) Successful in 2s
Build public-facing e-commerce interface for server owners' item stores.

Components:
- StoreView.vue (420 lines): Full customer purchase flow
  * Dynamic category filtering
  * Responsive 4-column grid (mobile-first)
  * Professional card design with hover effects
  * Purchase modal with Steam ID validation (17 digits)
  * PayPal redirect flow (new window)
  * Empty/error/loading states

Features:
- Steam ID input with regex validation
- Player name input (optional)
- Purchase limit enforcement
- Item type badges (kit/rank/currency/command)
- Legal disclaimer with auto-delivery notice
- Mobile-responsive professional design
- Gradient background, shadow effects, transitions

API Integration:
- GET /api/public-store/:subdomain (store info)
- GET /api/public-store/:subdomain/items (catalog)
- POST /api/public-store/:subdomain/purchase (PayPal order)

Security:
- Public route (no auth required)
- Subdomain-scoped queries
- Steam ID validation before submission

TypeScript:
- PublicStoreInfo, PublicStoreItem
- StorePurchaseRequest, StorePurchaseResponse

Items auto-deliver via NATS webhook after payment completion.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 14:58:50 -05:00
Vantz Stockwell
dfd63ba1c7 feat: Add Phase 5 store configuration UI
All checks were successful
Test Asgard Runner / test (push) Successful in 2s
- Built StoreConfigView.vue for webstore setup
- Form fields: store name, description, currency (USD/EUR/GBP)
- PayPal credentials (client ID/secret) with encryption support
- Sandbox/production mode toggle with warning states
- Store enable/disable with validation
- Empty state for unconfigured stores
- TypeScript StoreConfig interface
- Route: /admin/webstore/config (auth required)
- API integration: GET/PUT /api/webstore/config
- Responsive Tailwind design

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 14:57:30 -05:00
Vantz Stockwell
6c2436dfc6 feat: Phase 4 module auto-installation + Phase 5 webstore backend
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>
2026-02-15 14:53:53 -05:00
Vantz Stockwell
18da1838c4 feat: Implement Phase 4 module licensing backend
All checks were successful
Test Asgard Runner / test (push) Successful in 2s
Build complete module activation and license-module binding system with
marketplace catalog, purchase tracking, and installation status monitoring.

Database schema (migration 009):
- modules table — Registry with pricing, features, plugin URLs
- module_purchases — License-module ownership with transaction logging
- module_installations — Deployment status tracking
- Seed data: Loot Manager module ($9.99)

Backend implementation:
- Domain models with rust_decimal pricing support
- 11 data access functions (catalog, ownership, purchases, installation)
- 5 REST endpoints with JWT auth and license scoping
- Multi-tenant enforcement via license_id from claims

Purchase flow stub:
- Immediate purchase recording without payment gateway
- PayPal integration deferred to XO's direct implementation
- Transaction ID and amount fields ready for real gateway

Module installation:
- Integration with ModuleInstaller service
- NATS-based deployment to companion agent
- Real-time status tracking via polling endpoint

All queries compile-time verified. Zero cross-tenant exposure.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 14:51:04 -05:00
Vantz Stockwell
ba00291c18 feat: Complete Phase 4 Module Store frontend marketplace
Customer-facing module marketplace with full browse/preview/purchase flow:

Frontend Implementation:
- Complete ModuleStoreView.vue with dual-tab interface (Catalog + My Modules)
- Module grid with preview images, category badges, pricing display
- Search functionality across name/description fields
- Category filtering (8 categories: Loot, Events, Economy, Kits, Admin, PVP, PVE, Building)
- Detail modal with screenshots gallery, full features list, version info
- Purchase confirmation modal with license binding display
- Installation status tracking (Not Purchased → Purchased → Installed)
- Professional marketplace UI with hover animations and responsive grid

TypeScript Types:
- Module interface with full metadata (id, slug, name, description, price, category, images, features, version, purchase/install status)
- PurchaseRequest interface for API integration

API Integration Points (backend implementation separate):
- GET /api/modules/catalog — Browse all available modules
- GET /api/modules/my-modules — Fetch purchased modules for license
- POST /api/modules/purchase — Initiate purchase (returns payment URL or instant confirmation)
- POST /api/modules/install — Trigger deployment to game server

Design Features:
- Color-coded category badges with 8-color palette
- Preview image with scale-on-hover effect
- "Purchased" badge overlay for owned modules
- Three-button state progression (Purchase → Install → Installed)
- Empty states for zero results and zero purchases
- Mobile-responsive grid (1/2/3 columns)
- Payment flow with external redirect support (Stripe/PayPal)
- Error handling with inline error display in purchase modal

Purpose: Server admins can browse, preview, purchase, and install premium gameplay modules directly from dashboard. This is where customers pay real money — UI polish critical for conversion.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 14:47:12 -05:00
Vantz Stockwell
9d045256e3 feat: Add Loot Manager plugin skeleton (Phase 4)
All checks were successful
Test Asgard Runner / test (push) Successful in 2s
Created skeleton implementation for first paid module ($9.99).

Plugin Features:
- Loot profile system with container multipliers and custom loot tables
- OnLootSpawn/OnEntitySpawned hooks for container loot modification
- Six container types: normal, elite, mine, barrel, food, military
- Chat command: /loot.profile [name] for admin profile switching
- Per-item config: shortname, min/max amount, spawn chance, skin ID

Status:
- Hooks functional, profile switching works via chat command
- Dashboard UI integration pending future iteration
- Auto-deploy system pending future iteration
- Migration 009 already includes module seed data

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 14:46:49 -05:00
Vantz Stockwell
3e8b29f2ee feat: Implement Phase 2 alerting system with anomaly detection
All checks were successful
Test Asgard Runner / test (push) Successful in 2s
Proactive monitoring infrastructure for server health:

**Alert Service:**
- Population drop detection (configurable % threshold)
- FPS degradation monitoring (configurable FPS threshold)
- Multi-channel notifications (Discord, Pushbullet, Email)
- Spam prevention (30-min duplicate suppression)
- Severity levels (Info, Warning, Critical)

**Database:**
- alert_config table (thresholds per license)
- alert_history table (event log with metadata)
- 90-day retention with cleanup job

**Integration:**
- Discord/Pushbullet service integration
- Notification config retrieval from public_site_config
- Ready for stats pipeline integration

Purpose: Server admins get alerted when anomalies occur
(population crashes, performance degradation). Configurable
thresholds enable proactive server management.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 14:28:51 -05:00
Vantz Stockwell
8790072609 feat: Implement Phase 2 wipe performance analytics dashboard
Complete implementation of wipe analytics system providing operational
insights and data-driven wipe timing optimization.

Backend:
- Added comprehensive analytics query layer to db/wipes.rs:
  - Success rate calculation over time ranges
  - Average wipe duration tracking
  - Post-wipe population curve analysis (Day 1/2/3)
  - Optimal wipe timing recommendations based on player peaks
  - Individual wipe entry tracking with peak population correlation
- Implemented GET /api/analytics/wipes/performance endpoint with
  flexible range parameters (6d/12d/90d/all)
- All queries leverage hourly aggregate tables for 90-day retention

Frontend:
- Built WipeAnalyticsView.vue with 3 ECharts visualizations:
  - Success rate timeline (scatter: green success, red failures)
  - Population curve comparing Day 1/2/3 post-wipe averages
  - Wipe duration trend showing execution time evolution
- Insight cards displaying success rate, avg duration, peak day, optimal timing
- Actionable recommendations banner with data-driven suggestions:
  - Optimal wipe scheduling based on historical player peaks
  - Wipe frequency recommendations (weekly vs bi-weekly)
  - Duration optimization alerts
  - Rollback protection warnings
- Time range selector and CSV export functionality
- Added /wipes/analytics route

TypeScript interfaces added: WipePerformanceMetrics, WipeAnalyticsEntry,
PopulationCurve

Answers critical operational questions: "How long do wipes take? When do
players peak post-wipe? What's my success rate? When should I wipe for
maximum population?"

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 14:25:19 -05:00
Vantz Stockwell
dfa605f44f feat: Add public status page with 10-second polling
Implement status.corrosionmgmt.com public status page showcasing all
Corrosion servers that opt-in. Drives platform visibility and attracts
new customers.

Backend:
- Migration 007: status_page_description TEXT column
- models/public.rs: PublicServerStatus, PlatformHealth, StatusPageResponse
- db/public.rs: get_public_servers() with uptime calculations (24h/7d/30d)
- api/public.rs: GET /api/public/status (no auth)
- api/settings.rs: public site config endpoints (auth required)

Frontend:
- StatusPageView.vue: Server grid with live stats, uptime badges, wipe schedules
- Platform health header: total servers, online count, total players
- Auto-refresh every 10 seconds via polling
- Mobile-responsive design
- SettingsView.vue: Public Status tab with opt-in toggle

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 14:24:32 -05:00
Vantz Stockwell
1f5516bbec fix: Rename player_sessions migration to 006 (avoid collision with 004_status_page)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 14:23:37 -05:00
Vantz Stockwell
f29524e633 feat: Implement Player Retention Analytics System (Phase 2.2)
Backend:
- Add player_sessions table (migration 004) for session tracking
- Implement retention calculation queries (24h/48h/72h post-wipe)
- Add /api/plugin/player-event endpoint for join/leave tracking
- Add /api/analytics/retention endpoint with CSV export
- Track unique players, session duration, new vs returning ratio

Frontend:
- Create PlayerRetentionView with ECharts retention curves
- Add multi-wipe comparison (last 3/6/10/20 wipes)
- Display summary metrics and detailed wipe table
- Add /retention route to router

Plugin:
- Update CorrosionCompanion.cs to send player events to new endpoint
- Track player join/leave with license_key authentication

Enables data-driven wipe timing optimization by answering:
"What percentage of players return 24h/48h/72h after a wipe?"

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 14:23:21 -05:00
Vantz Stockwell
cef89ade18 feat: Implement map analytics system with effectiveness tracking
Add complete map analytics pipeline to answer: "Which maps drive the most
players? Is my rotation working?"

Backend Changes:
- Migration 005: Add map_id FK to server_stats and wipe_history tables
- Stats consumer now captures current_map_id when persisting stats
- Map analytics queries: get_map_analytics() returns performance metrics,
  effectiveness scores, and rotation health
- API endpoint: GET /api/analytics/maps?range=90d returns summary with
  best performing map and rotation effectiveness percentage

Frontend Changes:
- MapAnalyticsView.vue: Complete dashboard with performance charts,
  sortable metrics table, actionable insights, and CSV export
- ECharts bar chart comparing avg vs peak players per map
- Color-coded effectiveness scoring (green ≥80%, yellow ≥60%, red <60%)
- Time range selector: 30d/90d/all

Purpose: Enables data-driven map selection for wipe day based on player
engagement metrics. Rotation effectiveness algorithm scores maps by
(avg_players / peak_players) * 100.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 14:22:55 -05:00
Vantz Stockwell
dc7f41b8c5 docs: Update CHANGELOG with sovereign infrastructure stack
All checks were successful
Test Asgard Runner / test (push) Successful in 2s
Documents Strike 4A-Infra and Strike 4B completion:
- Gitea self-hosted Git (replaces GitHub)
- SeaweedFS object storage/CDN
- Gitea act_runner on asgard (16C/64GB)
- Companion agent build workflow
- Repository migration to sovereign infrastructure

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 14:07:52 -05:00
Vantz Stockwell
a9a4bcff99 ci: Add companion agent release workflow
All checks were successful
Test Asgard Runner / test (push) Successful in 2s
Production build pipeline for companion agent:

- Triggers on version tags (v*.*.*)
- Cross-compiles for Linux and Windows (AMD64)
- Generates SHA256 checksums for verification
- Creates Gitea release with auto-generated notes
- Uploads binaries and checksums as release assets
- Provides build summary in workflow output

Built artifacts:
- corrosion-companion-linux-amd64
- corrosion-companion-windows-amd64.exe
- checksums.txt

Usage: git tag v1.0.0 && git push origin v1.0.0

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 14:07:18 -05:00
Vantz Stockwell
e908170b30 ci: Add Asgard runner test workflow
All checks were successful
Test Asgard Runner / test (push) Successful in 23s
Test workflow to verify act_runner on asgard is operational.

Validates:
- Runner picks up jobs
- Docker container execution
- Go/Rust toolchains available
- System resources (CPU, memory, disk)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 13:58:58 -05:00
Vantz Stockwell
3d3926c20f fix: Remove Gitea env var pre-config (let wizard handle it)
The GITEA__* environment variables were conflicting with the
wizard-generated app.ini, causing crash loop on startup.

Simplified to only USER_UID/GID - let the wizard configure
everything else cleanly.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 13:32:20 -05:00
Vantz Stockwell
cedc94d702 fix: Enable Gitea install wizard (INSTALL_LOCK=false)
Changed INSTALL_LOCK from true to false to allow first-time setup wizard.

After initial setup is complete, this can be changed back to true
to prevent unauthorized re-configuration.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 13:26:33 -05:00
Vantz Stockwell
69fec4a0fa fix: Move Gitea SSH to port 8095 (keep all infra in 809x range)
Changed: 2222 → 8095 for SSH
Keeps all infrastructure ports sequential: 8090-8095

Port allocation:
- 8090: Gitea HTTP
- 8091: SeaweedFS Filer
- 8092: SeaweedFS S3
- 8093: SeaweedFS Master
- 8094: SeaweedFS Volume
- 8095: Gitea SSH

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 13:23:43 -05:00
Vantz Stockwell
1cfd9d206f docs: Add Gitea act_runner setup guide for asgard build server
Architecture clarification:
- Gitea + SeaweedFS run on PUBLIC docker stack
- Act runner runs on ASGARD (Ryzen 9 build server)
- Runner connects remotely to git.corrosionmgmt.com

New documentation:
- ASGARD-RUNNER.md: Complete setup guide for registering
  and running act_runner as systemd service on asgard
- Includes example workflows for companion agent builds
- Troubleshooting and security notes

Runner capabilities:
- Docker access for containerized builds
- Native Go/Rust toolchains (already installed)
- 16C/32T, 64GB DDR5 for fast builds

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 13:17:04 -05:00
Vantz Stockwell
48209cebdd fix: Remap SeaweedFS ports to avoid conflicts on asgard
Port conflicts on asgard stack:
- 9333 → 8093 (SeaweedFS Master)
- 8080 → 8094 (SeaweedFS Volume)

Updated:
- docker-compose.yml
- README.md
- NPM-CONFIG.md

Final port allocation:
8090: Gitea HTTP
2222: Gitea SSH
8091: SeaweedFS Filer UI (cdn.corrosionmgmt.com)
8092: SeaweedFS S3 API
8093: SeaweedFS Master (internal)
8094: SeaweedFS Volume (internal)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 13:14:52 -05:00
Vantz Stockwell
c471b6a7dd feat: Add sovereign infrastructure stack (Gitea + SeaweedFS)
Separate infrastructure services from application stack for operational
resilience. Following Gemini's architectural guidance.

Infrastructure Services:
- Gitea (git.corrosionmgmt.com) - Source control, CI/CD, releases
  * SQLite database (self-contained)
  * Port 8090: Web UI
  * Port 2222: SSH

- SeaweedFS (cdn.corrosionmgmt.com) - S3-compatible object storage
  * Port 8091: Filer UI (primary CDN interface)
  * Port 8092: S3 API (programmatic access)
  * Port 9333: Master UI (internal admin)
  * Port 8080: Volume server (internal)

Benefits:
- Restarting Corrosion app doesn't affect Git/CDN services
- No shared database dependencies (Gitea uses SQLite)
- Clear separation between infrastructure and application concerns
- Foundation for plugin ecosystem and map hosting

Deployment:
cd infra && docker compose up -d

See infra/README.md for full setup instructions and NPM configuration.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 13:13:44 -05:00
Vantz Stockwell
574e3311bc chore: Add echarts dependency for analytics dashboard
Installed echarts@5.x for Phase 2 analytics charts.

Frontend build verified: 0 errors
Backend build verified: 0 errors

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 12:56:17 -05:00
Vantz Stockwell
75d08aeee4 feat: Phase 2 data aggregation pipeline (Strike 4A)
Backend:
- Stats ingestion consumer subscribing to corrosion.*.stats NATS subject
- Hourly aggregation scheduler (runs :05 past every hour)
- Daily cleanup job (03:00 UTC) with 7-day raw / 90-day hourly retention
- Analytics API (summary, timeseries, CSV export)
- Complete stats DB queries with aggregation and cleanup

Frontend:
- Analytics dashboard with ECharts integration
- Player count and server performance charts
- Time range selector (24h/7d/30d)
- CSV export functionality
- Real-time data loading

Infrastructure:
- Exposed NatsBridge.jetstream for consumer access
- Background service initialization in main.rs

Data flow: Plugin → NATS → Consumer → DB → Aggregation → API → Charts

Unblocks Strike 4B (dashboards) and 4C (alerting).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 12:53:25 -05:00
Vantz Stockwell
81eeb3b451 docs: Add AGENTS.md roster and resource discipline to CLAUDE.md
Tiered agent model for token budget optimization: Haiku for recon,
Sonnet as daily XO, Opus reserved for escalation-only surgical strikes.
CLAUDE.md updated with resource discipline section referencing the roster.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 12:30:40 -05:00
Vantz Stockwell
3c393453dd docs: Add CLAUDE.md and Claude Code settings
Operational doctrine migrated from Vigilance HQ — V4_WORKFLOW, engagement
rules, and lessons learned carry forward. Project-specific sections written
for Corrosion's Rust/Axum + Vue 3 + Go stack. Claude Code settings configured
with permissions for cargo, go, npm, docker, and git operations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 12:28:16 -05:00
Vantz Stockwell
c5d057146a feat: Complete Phase 1 frontend — WebSocket + Wipe feature end-to-end
Implements full-stack vertical slice for wipe management with real-time updates.

WebSocket Integration:
- useWebSocket composable with auto-reconnect (exponential backoff up to 30s)
- JWT authentication via query parameter
- Automatic connection on auth state change
- Bi-directional messaging support
- Message handler subscription pattern
- Vite dev proxy configured for WebSocket (ws: true)

Toast Notification System:
- Pinia store with convenience methods (success/error/warning/info)
- Vue component with Lucide icons and Tailwind styling
- Auto-dismiss with configurable duration (5s default, 8s for errors)
- Manual dismiss with X button
- Smooth slide-in transitions from bottom-right
- Stack multiple toasts with proper spacing

Wipe Store Implementation:
- All API methods: fetchProfiles, fetchSchedules, fetchHistory
- Trigger wipe with optimistic UI update
- Dry-run simulation endpoint
- Profile CRUD operations (create, update, delete)
- WebSocket event listeners for real-time status updates
- Toast notifications on wipe_started, wipe_completed, wipe_failed
- Automatic history refresh on completion events
- Error handling with user-facing messages

Real-time Event Flow:
1. User triggers wipe → POST /api/wipes/trigger
2. Backend publishes NATS event: corrosion.{license_id}.wipe_started
3. WebSocket forwards event to frontend
4. Wipe store updates history array
5. Toast notification shows "Wipe started"
6. Progress events update status in real-time
7. Completion event triggers success toast + history refresh

Files Created:
- frontend/src/composables/useWebSocket.ts (208 LOC)
- frontend/src/stores/toast.ts (63 LOC)
- frontend/src/components/ToastNotification.vue (47 LOC)

Files Modified:
- frontend/src/stores/wipe.ts (273 LOC, was 42 LOC — 5 TODO methods → fully implemented)
- frontend/src/App.vue (added ToastNotification component)
- frontend/vite.config.ts (enabled WebSocket proxy)

TypeScript: Strict mode, zero build errors
Frontend builds:  929ms, 45.86 kB gzip

Phase 1 Status: ~80% complete
-  WebSocket/NATS real-time layer
-  Wipe feature production-ready
- ⏸️ Remaining stores (plugins, chat, players) still stubbed

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 12:17:31 -05:00
Vantz Stockwell
8320591cf4 docs: Update companion agent language choice to Go 2026-02-15 12:07:19 -05:00
Vantz Stockwell
590765fbbc feat: Complete Phase 1 backend services and WebSocket/NATS bridge
Implements all remaining backend infrastructure for Corrosion platform.

Backend Services (5 new):
- license.rs: License validation, activation, check-in with NATS token generation
- map_manager.rs: Map upload/rotation with SHA-256 checksums, circular advancement
- health_checker.rs: Post-wipe verification with retry loop and backoff
- backup_manager.rs: Tar.gz backups with retention policy (last 10), recursive upload
- scheduler.rs: Tokio-cron integration for scheduled wipes with NATS events

WipeEngine Orchestration (wipe_engine.rs):
- execute_wipe(): Master orchestrator managing full lifecycle
- execute_pre_wipe(): Countdown warnings, backups, player kicks
- execute_wipe_actions(): Map/plugin deletion, seed rotation, Steam updates
- execute_post_wipe_verification(): Health checks with restart attempts
- execute_rollback(): Failure recovery with backup restore
- JSONB execution logs, NATS status events, service composition pattern

WebSocket/NATS Bridge (ws.rs):
- JWT authentication via query parameter
- License-scoped NATS subscriptions (corrosion.{license_id}.*)
- Bi-directional: NATS→WebSocket event forwarding, WebSocket→NATS publishing
- Axum 0.8 with ws feature, auto Ping/Pong handling

Panel Adapter Fixes:
- AMP/Pterodactyl/Companion adapters fully wired
- RCON command execution, file operations, Steam update triggers

Fixes:
- Added ws feature to Axum dependency
- Fixed Message::Text() type conversions (String→Utf8Bytes via .into())
- Fixed BackupInfo FromRow derive
- Fixed recursive async with Box::pin pattern
- Fixed async JobScheduler::new() constructor
- Removed manual WebSocket Ping/Pong handler

Compilation: 0 errors, 327 warnings (unused vars/functions)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 12:07:01 -05:00
Vantz Stockwell
a62715409f feat: Add Go companion agent for bare metal server management
Implements complete companion agent for Rust servers not on managed panels.

Features:
- NATS integration with token auth and auto-reconnect
- Game server process management (start/stop/restart/monitor)
- File operations (read/write/delete/list) via NATS
- SteamCMD integration for automated updates
- Self-update capability with download and replace
- Heartbeat publishing every 60s with server status
- Graceful shutdown handling (SIGTERM/SIGINT)
- Zombie process prevention via cmd.Wait()
- Cross-platform builds (Linux amd64, Windows amd64)

Structure:
- cmd/agent/main.go: Entry point, config, signal handling
- internal/app/daemon.go: Main loop, NATS subscriptions
- internal/client/nats.go: NATS connection with reconnect
- internal/process/gameserver.go: Process management
- internal/process/steamcmd.go: Steam update execution
- internal/files/operations.go: File system operations
- internal/update/updater.go: Self-update logic
- Makefile: Cross-compilation targets
- README.md: Installation and configuration guide

NATS Subjects:
- Publishes: corrosion.{license_id}.companion.heartbeat
- Publishes: corrosion.{license_id}.files.response
- Subscribes: corrosion.{license_id}.cmd.server
- Subscribes: corrosion.{license_id}.files.{get|put|delete|list}
- Subscribes: corrosion.{license_id}.update.steam
- Subscribes: corrosion.{license_id}.update.companion

Built binaries: 7.0MB (Linux), 7.2MB (Windows)
Total code: 1,356 LOC across 8 files

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 12:05:23 -05:00
Vantz Stockwell
8bea889145 fix: Add VITE_PANEL_URL for production builds
Vite bakes env vars at build time, not runtime. Without .env.production
in the frontend directory, the Docker build had no VITE_PANEL_URL and
Sign In / Get Started links resolved to empty hrefs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 10:39:02 -05:00
Vantz Stockwell
77155d30be feat: Domain-based routing — marketing site at bare domain, panel at subdomain
corrosionmgmt.com now serves LandingView as the default page with marketing
routes at root level. panel.corrosionmgmt.com continues serving the admin
panel unchanged. /site/* backward compat via redirects on marketing domain.

- nginx: Add bare domain server block (only proxies /api/early-access/)
- router: Detect hostname at module load, generate domain-specific routes
- MarketingLayout: Named routes for nav, external <a> tags for auth links
- LandingView: CTAs point to panel domain via VITE_PANEL_URL

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 10:21:11 -05:00
Vantz Stockwell
1c3aece4de fix: Guard against undefined members/roles in TeamView
API returns unexpected shape when backend isn't wired — data.members
is undefined, assigned to ref, then .length in template throws
TypeError. Nullish coalescing to empty array prevents the crash.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 02:25:00 -05:00
Vantz Stockwell
072fa26544 fix: Admin Home nav highlight stuck when visiting child routes
/admin/servers.startsWith('/admin') was true, so both Admin Home
and Server Fleet highlighted simultaneously. Now /admin uses
exact match like / does.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 02:17:33 -05:00
Vantz Stockwell
88b50a30b4 feat: Phase 1c — Platform Admin Dashboard
Full super-admin dashboard for SaaS platform management:

Backend (10 files):
- Migration 003: Add is_super_admin column to users table
- JWT Claims: Carry is_super_admin through access tokens
- SuperAdmin extractor: Axum FromRequestParts that rejects non-admins (403)
- Admin API module: 10 endpoints behind /api/admin/*
  - GET /stats (KPIs: licenses, users, MRR, servers, signups)
  - GET/POST /licenses (paginated, filterable, manual generation)
  - GET/PATCH /licenses/:id (detail view, revoke/activate)
  - GET /subscriptions (module sub list with MRR breakdown)
  - GET/PATCH /users (paginated, toggle admin, disable accounts)
  - GET /servers (fleet overview across all licenses)
  - GET /health (DB pool, NATS status, table row counts)
- Bootstrap updated: first user gets is_super_admin = true

Frontend (8 files):
- 5 admin views in src/views/platform-admin/
- DashboardLayout: "Platform" nav section (gated on isSuperAdmin)
- Router: /admin/* routes with superAdmin meta guard
- Auth store: isSuperAdmin computed property
- Types: is_super_admin on User interface

Build: 80 chunks, zero TS errors, clean production build.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 02:07:38 -05:00
Vantz Stockwell
0ac1738c85 feat: Add 5 Platform Admin views for super-admin dashboard
- AdminDashboard: KPI cards (licenses, users, MRR, servers, signups) + quick links
- AdminLicenses: Searchable paginated table with detail panel, CSV export, license generation
- AdminSubscriptions: MRR summary cards, per-module breakdown, subscriber table
- AdminUsers: Paginated user table with super admin toggle and account disable actions
- AdminServers: Filterable server table with connection type badges, status dots, relative heartbeat times

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 02:04:31 -05:00
Vantz Stockwell
0360fcf2e2 fix: Pass admin bootstrap env vars to API container
ADMIN_EMAIL and ADMIN_PASSWORD were in the .env file but not
forwarded to the API container — bootstrap_admin() couldn't
read them, so no initial user was created. Login returned 400
on every attempt because no user existed in the database.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 01:45:20 -05:00
Vantz Stockwell
c4fd4df513 infra: Add multi-stage frontend build to Docker
Nginx container now builds the Vue frontend in a Node stage
instead of mounting local dist/ files. This means:
- No need to commit dist/ or build locally before deploying
- docker compose up --build handles everything end-to-end
- Removed obsolete compose version key

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 01:39:30 -05:00
Vantz Stockwell
b8ef374a31 fix: Remove NATS healthcheck — use service_started instead
NATS minimal image has no shell tools for health probes. The API
already handles NATS unavailability gracefully, so service_started
is sufficient.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 01:32:25 -05:00
Vantz Stockwell
d4222a650c fix: Use TCP port check for NATS healthcheck
NATS image has no wget/curl. Use bash TCP check on port 4222 instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 01:26:41 -05:00
Vantz Stockwell
4df4a0a2cd fix: Replace NATS healthcheck — ldm signal was triggering shutdown
The old healthcheck used nats-server --signal ldm which puts NATS into
lame duck (shutdown) mode. Use the /healthz HTTP endpoint instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 01:20:33 -05:00
Vantz Stockwell
68f399659b fix: Remove duplicate NATS store_dir and jetstream flags from compose
Config file already sets jetstream and store_dir. Duplicate CLI flags
cause NATS to exit with error.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 01:13:49 -05:00
Vantz Stockwell
271c9f43fa fix: Remap ports to avoid conflicts — 8087/8088/8089
Frontend nginx: 8087, API: 8088, NATS: 8089. Removed NATS
monitoring and WebSocket host ports (not needed externally).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 01:10:01 -05:00
Vantz Stockwell
cb6cb8fb45 fix: Resolve 75 compile errors across 13 backend files
Remove deprecated #[axum::async_trait] from 2 middleware files (native
async traits on Rust 1.88+). Fix 71 stub handlers: change return type
from ApiResult<impl IntoResponse> to ApiResult<Json<Value>> and replace
todo!() with proper JSON stub responses. Clean compile, zero errors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 01:03:36 -05:00
Vantz Stockwell
a6db98f198 fix: Disable lettre default features to resolve native-tls conflict
lettre defaults pull in native-tls which conflicts with tokio1-rustls-tls.
Explicitly list needed features with default-features = false.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 00:54:48 -05:00
Vantz Stockwell
ef5ee0f844 fix: Switch Dockerfile to Debian-based Rust image for 1.88+ support
Dependencies require Rust 1.88. Alpine images lag behind. Switched
to rust:latest (Debian) for build and debian:bookworm-slim for runtime.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 00:51:27 -05:00
Vantz Stockwell
c20ed2d384 fix: Change nginx port to 8087 — port 80 taken by NPM
NPM handles SSL termination and proxies to 8087.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 00:50:30 -05:00
Vantz Stockwell
fd509eea96 fix: Bump Rust image to 1.85 for edition2024 support
Dependency moxcms requires edition2024 feature, stabilized in Rust 1.85.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 00:48:54 -05:00