feat(actions): agent_actions table + repo

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
root
2026-06-04 21:39:05 +10:00
parent d500b6fa00
commit 135244cb13
3 changed files with 76 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
-- 016_agent_actions.sql — queue + audit trail for Little Blue's infra actions.
-- Risky actions land here as 'pending' for owner approval; every executed action
-- (safe or approved-risky) is recorded with its result. Deliberately separate from
-- pending_changes (entity CRUD) to isolate command execution.
CREATE TABLE agent_actions (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
action_id text NOT NULL, -- whitelist id from config/actions.json
params jsonb NOT NULL DEFAULT '{}'::jsonb,
agent_id uuid REFERENCES agents(id),
tier text NOT NULL CHECK (tier IN ('safe','risky')),
status text NOT NULL DEFAULT 'pending'
CHECK (status IN ('pending','executed','failed','rejected')),
result jsonb,
requested_by jsonb,
resolved_by jsonb,
created_at timestamptz NOT NULL DEFAULT now(),
resolved_at timestamptz
);
CREATE INDEX idx_agent_actions_pending ON agent_actions(status) WHERE status='pending';