Phase 3.5: Automation & Agents Plugin
Neues automation Plugin (app/plugins/builtins/automation/): - 7 DB-Modelle: AgentDefinition, AgentVersion, AutomationDefinition, AutomationVersion, AutomationCronJob, AgentRun, AutomationRun - Migration 0001_initial.sql mit allen Tabellen + RLS - PluginManifest erweitert: agent_definitions, automation_templates, cron_jobs, heartbeat_configs, miniapps Contribution-Felder - 21 API-Endpoints: /api/v1/automation (CRUD, execute, dry-run, runs, versions, restore, settings, miniapps) + /api/v1/agents (CRUD, execute, test-run, runs, versions, restore, tools, send-message) Backend Features: - Cron-Scheduler (scheduler.py): ARQ-basiert, liest CronJob-Tabelle, enqueued run_agent/run_automation, croniter fuer next_run_at - Workflow-Timeout-Worker (workflow_timeout.py): prueft abgelaufene WorkflowInstances, setzt cancelled, sendet Notification - Agent Runner (agent_runner.py): LiteLLM + ToolRegistry, proactive/ reactive mode, Rate-Limiting, Budget-Limit, Infinite-Loop-Detection - Automation Execution Engine (execution_engine.py): Condition evaluation (eq/ne/gt/lt/contains/exists), Actions (api_call/ notification/workflow_start), Dry-Run mode - Agent-to-Agent Communication (agent_comm.py): send_agent_message tool, kommunikation plugin integration - Plugin-Beitraege: register/unregister on activate/deactivate, Konfliktloesung mit Plugin-Name als Prefix - Heartbeat-Migration: ai_proactive heartbeat als Cron-Job - Versionshistorie: Auto-Versioning bei Updates, Restore-Endpoint - Settings: GET/PATCH /api/v1/automation/settings - ARQ Worker: 11 functions, 2 cron_jobs (scheduler_tick 30s, check_workflow_timeouts 5min) Frontend: - AutomationDashboard.tsx: Automation Builder UI mit Trigger, Conditions, Actions, Execute, Dry-Run, Run-History, Versions - AgentDashboard.tsx: Agent Builder UI mit Model, Tools, Prompt, Heartbeat, Rate-Limits, Execute, Test-Run, Agent-Chat - AutomationSettings.tsx: Settings + MiniApp-Builder - automation.ts: 24 React Query Hooks - automation.ts types: TypeScript Interfaces - routes/index.tsx: /automation, /agents, /settings/automation Tests: - 22 Frontend-Tests (AutomationDashboard, AgentDashboard, API) — alle bestanden - Backend-Tests: test_automation.py (CRUD, versions, conditions, dry-run, rate-limiting) - TSC: keine neuen Errors (nur pre-existing Dms.tsx) - croniter dependency installiert
This commit is contained in:
@@ -0,0 +1,108 @@
|
||||
/**
|
||||
* TypeScript interfaces for Automation & Agents module.
|
||||
* Matches backend schemas from /api/v1/automation and /api/v1/agents.
|
||||
*/
|
||||
|
||||
export interface AutomationCondition {
|
||||
field: string;
|
||||
operator: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface AutomationAction {
|
||||
type: 'api_call' | 'notification' | 'workflow_start';
|
||||
config: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface AutomationDefinition {
|
||||
id: string;
|
||||
name: string;
|
||||
description?: string;
|
||||
trigger_type: 'event' | 'schedule' | 'manual';
|
||||
trigger_config?: Record<string, unknown>;
|
||||
conditions?: AutomationCondition[];
|
||||
actions?: AutomationAction[];
|
||||
active: boolean;
|
||||
dry_run: boolean;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface AutomationRun {
|
||||
id: string;
|
||||
automation_id: string;
|
||||
status: 'running' | 'completed' | 'failed' | 'cancelled';
|
||||
started_at: string;
|
||||
completed_at?: string;
|
||||
result?: unknown;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export interface AutomationVersion {
|
||||
id: string;
|
||||
automation_id: string;
|
||||
version: number;
|
||||
created_at: string;
|
||||
data: AutomationDefinition;
|
||||
}
|
||||
|
||||
export interface AgentDefinition {
|
||||
id: string;
|
||||
name: string;
|
||||
description?: string;
|
||||
model: string;
|
||||
system_prompt?: string;
|
||||
tools?: string[];
|
||||
heartbeat_interval: number;
|
||||
mode: 'proactive' | 'reactive';
|
||||
max_executions_per_hour: number;
|
||||
max_duration: number;
|
||||
budget_limit: number;
|
||||
active: boolean;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface AgentRun {
|
||||
id: string;
|
||||
agent_id: string;
|
||||
status: 'running' | 'completed' | 'failed' | 'cancelled';
|
||||
started_at: string;
|
||||
completed_at?: string;
|
||||
result?: unknown;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export interface AgentVersion {
|
||||
id: string;
|
||||
agent_id: string;
|
||||
version: number;
|
||||
created_at: string;
|
||||
data: AgentDefinition;
|
||||
}
|
||||
|
||||
export interface AgentTool {
|
||||
name: string;
|
||||
description: string;
|
||||
}
|
||||
|
||||
export interface AutomationSettings {
|
||||
default_llm_model: string;
|
||||
heartbeat_default_interval: number;
|
||||
max_concurrent_agents: number;
|
||||
log_level: 'debug' | 'info' | 'warning' | 'error';
|
||||
}
|
||||
|
||||
export interface MiniAppDef {
|
||||
app_id: string;
|
||||
name: string;
|
||||
icon: string;
|
||||
description: string;
|
||||
plugin_name: string;
|
||||
render_schema: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export type RecentRun = (AutomationRun | AgentRun) & {
|
||||
type: 'automation' | 'agent';
|
||||
name?: string;
|
||||
};
|
||||
Reference in New Issue
Block a user