Automations workspace phase 1: sidebar groups, detail view, recompile-to-edit, named runs

Promotes Automations to a top-level sidebar group (below Bookmarks) with
user-defined AgentGroup folders (migration 025, FK SET NULL on delete).
The /automations page becomes master-detail: overview (composer + grouped
list + named global runs) and per-task detail (original prompt, group
assignment, run-now/pause/delete, per-task run timeline with true/false/
error pills). Editing recompiles through /api/agent/compile and confirms
the proposal before a versioned PATCH applies spec+prompt — the model
never writes. Tasks store prompt+groupId; projections add runCount/
errorCount; runs carry taskName. The engine is untouched: groups/prompt
are metadata, the validated spec remains the only thing it executes.
Chaining, refinements and dry-run stay phase 2.

Verified: full DB integration suite under -race, db-converge + migration
atomicity, web lint/SSR/build, and a rewritten browser regression covering
the sidebar folder, detail prompt, per-task runs, recompile-to-edit and
named global runs.
This commit is contained in:
Andrew S Erwin
2026-11-25 14:16:45 -06:00
parent e32eed93ea
commit 060a8115ec
10 changed files with 719 additions and 192 deletions
+13 -4
View File
@@ -512,12 +512,21 @@ through netguard + outbound budgets.
| Method | Path | Body / Returns |
|---|---|---|
| POST | `/api/agent/compile` | `{text}` → `{name,spec,summary}` proposal; 422 with the model's reason when it refuses; 503 when AI is unconfigured; rate-limited per client |
| GET | `/api/agent/tasks` | `[{id,name,spec,summary,enabled,status,fireCount,lastCheckedAt,lastFiredAt,version,createdAt}]` |
| POST | `/api/agent/tasks` | `{name,spec}` → 201; spec fully re-validated; 403 at the plan's stored-task cap |
| PATCH | `/api/agent/tasks/{id}` | `{version,name?,enabled?,spec?}` → 200; 409 stale version; re-enabling resets a `done` task to `active` |
| GET | `/api/agent/tasks` | `[{id,name,spec,summary,prompt,groupId,runCount,errorCount,enabled,status,fireCount,lastCheckedAt,lastFiredAt,version,createdAt}]` |
| POST | `/api/agent/tasks` | `{name,spec,prompt?,groupId?}` → 201; spec fully re-validated; 403 at the plan's stored-task cap |
| PATCH | `/api/agent/tasks/{id}` | `{version,name?,enabled?,spec?,prompt?,groupId?}` → 200; 409 stale version; re-enabling resets a `done` task to `active`; `groupId:null` ungroups. Editing a prompt is UI-orchestrated: recompile via `/compile`, then PATCH the validated `spec` + `prompt` together |
| DELETE | `/api/agent/tasks/{id}` | `{ok:true}` |
| POST | `/api/agent/tasks/{id}/run` | Immediate evaluation → `{outcome}` ∈ checked/fired/failed/skipped |
| GET | `/api/agent/runs?taskId=` | Last 50 runs `[{id,taskId,outcome,detail,createdAt}]` |
| GET | `/api/agent/runs?taskId=` | Last 50 runs `[{id,taskId,taskName,outcome,detail,createdAt}]` (named for the global timeline) |
| GET | `/api/agent/groups` | `[{id,name,position,version,createdAt}]` — user-defined folders (migration 025) |
| POST | `/api/agent/groups` | `{name}` → 201 (≤80 chars) |
| PATCH | `/api/agent/groups/{id}` | `{version,name}` → 200; 409 stale |
| DELETE | `/api/agent/groups/{id}` | `{ok:true}`; ungroups its tasks (FK SET NULL), never deletes automations |
Workspace (phase 1): Automations is a top-level sidebar group with these
folders; `/automations?task=<id>` is the detail view (original prompt,
per-task run timeline, run-now/pause, recompile-to-edit). Groups and prompt
are metadata — the engine still executes only the validated `spec`.
### AI configuration (per user)