Repository Public
1-- Contrat base de données entre l'orchestrateur (émetteur), l'ingestion (transport) et l'agent.2--3-- orchestrateur : insère agent_commands(state='pending') puis NOTIFY mcc_commands, '<agent_id>'4-- ingestion : remet au long-poll (state='delivered'), enregistre l'acquittement (state='acked' ou5-- 'finished' si refus), la sortie (action_events) et le résultat (state='finished'),6-- puis NOTIFY mcc_command_updates, '<command_id>'7-- orchestrateur : seul à modifier la table actions ; expire les commandes non terminées.8-- L'ingestion ne possède aucune clé de signature : elle ne peut ni créer ni modifier une commande valide.910alter table agent_commands11 add column ack_accepted boolean,12 add column ack_reason text,13 add column result_status text check (result_status in ('succeeded','failed','timed_out','cancelled')),14 add column result jsonb,15 add column cancel_requested_at timestamptz,16 add column cancel_sent_at timestamptz;1718create table command_keys ( -- clés PUBLIQUES de signature des commandes (Ed25519)19 key_id text primary key,20 public_key bytea not null check (length(public_key) = 32),21 created_at timestamptz not null default now(),22 retired_at timestamptz23);2425create table service_heartbeats ( -- battement de chaque service backend (état d'administration)26 service text primary key, -- control-api | telemetry-ingest | action-orchestrator27 instance text not null,28 version text not null,29 started_at timestamptz not null,30 beat_at timestamptz not null,31 detail jsonb not null default '{}'32);33