Update installer system for update approval functionality

Major milestone: Update installation system now works
- Implemented unified installer interface with factory pattern
- Created APT, DNF, and Docker installers
- Integrated installer into agent command processing loop
- Update approval button now actually installs packages

Documentation updates:
- Updated claude.md with Session 7 implementation log
- Created clean, professional README.md for GitHub
- Added screenshots section with 4 dashboard views
- Preserved detailed development history in backup files

Repository ready for GitHub alpha release with working installer functionality.
This commit is contained in:
Fimeg
2025-10-16 09:06:12 -04:00
parent 552f14f99a
commit a7fad61de2
15 changed files with 1608 additions and 80 deletions

View File

@@ -0,0 +1,80 @@
-- Event sourcing table for all update events
CREATE TABLE IF NOT EXISTS update_events (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
agent_id UUID NOT NULL REFERENCES agents(id) ON DELETE CASCADE,
package_type VARCHAR(50) NOT NULL,
package_name TEXT NOT NULL,
version_from TEXT,
version_to TEXT NOT NULL,
severity VARCHAR(20) NOT NULL CHECK (severity IN ('critical', 'important', 'moderate', 'low')),
repository_source TEXT,
metadata JSONB DEFAULT '{}',
event_type VARCHAR(20) NOT NULL CHECK (event_type IN ('discovered', 'updated', 'failed', 'ignored')),
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
-- Current state table for optimized queries
CREATE TABLE IF NOT EXISTS current_package_state (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
agent_id UUID NOT NULL REFERENCES agents(id) ON DELETE CASCADE,
package_type VARCHAR(50) NOT NULL,
package_name TEXT NOT NULL,
current_version TEXT NOT NULL,
available_version TEXT,
severity VARCHAR(20) NOT NULL CHECK (severity IN ('critical', 'important', 'moderate', 'low')),
repository_source TEXT,
metadata JSONB DEFAULT '{}',
last_discovered_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
last_updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
status VARCHAR(20) NOT NULL DEFAULT 'pending' CHECK (status IN ('pending', 'approved', 'updated', 'failed', 'ignored', 'installing')),
UNIQUE(agent_id, package_type, package_name)
);
-- Version history table for audit trails
CREATE TABLE IF NOT EXISTS update_version_history (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
agent_id UUID NOT NULL REFERENCES agents(id) ON DELETE CASCADE,
package_type VARCHAR(50) NOT NULL,
package_name TEXT NOT NULL,
version_from TEXT NOT NULL,
version_to TEXT NOT NULL,
severity VARCHAR(20) NOT NULL CHECK (severity IN ('critical', 'important', 'moderate', 'low')),
repository_source TEXT,
metadata JSONB DEFAULT '{}',
update_initiated_at TIMESTAMP WITH TIME ZONE,
update_completed_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
update_status VARCHAR(20) NOT NULL CHECK (update_status IN ('success', 'failed', 'rollback')),
failure_reason TEXT
);
-- Batch processing tracking
CREATE TABLE IF NOT EXISTS update_batches (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
agent_id UUID NOT NULL REFERENCES agents(id) ON DELETE CASCADE,
batch_size INTEGER NOT NULL,
processed_count INTEGER DEFAULT 0,
failed_count INTEGER DEFAULT 0,
status VARCHAR(20) NOT NULL DEFAULT 'processing' CHECK (status IN ('processing', 'completed', 'failed', 'cancelled')),
error_details JSONB DEFAULT '{}',
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
completed_at TIMESTAMP WITH TIME ZONE
);
-- Create indexes for performance
CREATE INDEX IF NOT EXISTS idx_agent_events ON update_events(agent_id);
CREATE INDEX IF NOT EXISTS idx_package_events ON update_events(package_name, package_type);
CREATE INDEX IF NOT EXISTS idx_severity_events ON update_events(severity);
CREATE INDEX IF NOT EXISTS idx_created_events ON update_events(created_at);
CREATE INDEX IF NOT EXISTS idx_agent_state ON current_package_state(agent_id);
CREATE INDEX IF NOT EXISTS idx_package_state ON current_package_state(package_name, package_type);
CREATE INDEX IF NOT EXISTS idx_severity_state ON current_package_state(severity);
CREATE INDEX IF NOT EXISTS idx_status_state ON current_package_state(status);
CREATE INDEX IF NOT EXISTS idx_agent_history ON update_version_history(agent_id);
CREATE INDEX IF NOT EXISTS idx_package_history ON update_version_history(package_name, package_type);
CREATE INDEX IF NOT EXISTS idx_completed_history ON update_version_history(update_completed_at);
CREATE INDEX IF NOT EXISTS idx_agent_batches ON update_batches(agent_id);
CREATE INDEX IF NOT EXISTS idx_batch_status ON update_batches(status);
CREATE INDEX IF NOT EXISTS idx_created_batches ON update_batches(created_at);