From 02f42b2a5b151e908f107eeef885e6e20ef1322c Mon Sep 17 00:00:00 2001 From: cvsloane Date: Tue, 17 Feb 2026 11:02:06 -0500 Subject: [PATCH 01/16] chore: update project status --- project_status.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/project_status.md b/project_status.md index a9b0007b..a3a748e5 100644 --- a/project_status.md +++ b/project_status.md @@ -1,7 +1,7 @@ # Project Status - agent-command > **Auto-generated by [project-status agent](https://github.com/cvsloane/open-agents)** -> Last updated: 2026-02-16T16:02:03.813Z +> Last updated: 2026-02-17T16:02:06.423Z ## Purpose @@ -46,11 +46,11 @@ This file provides context for AI assistants (Claude Code, Cursor, etc.) about r | Hash | Message | Date | Author | |------|---------|------|--------| -| `677fadf` | fix(agentd): keep deps Go 1.22 compatible | 2026-02-16 | cvsloane | -| `eaefe89` | fix(agentd): pin prometheus client to Go 1.22 | 2026-02-16 | cvsloane | -| `956de1b` | feat(metrics): add /metrics and reliability inventory | 2026-02-16 | cvsloane | -| `38bddd7` | chore: update project status | 2026-02-15 | cvsloane | +| `b0a3818` | Ops metrics: /metrics + reconnect + rate-limit counters | 2026-02-16 | Chris Sloane | | `877c499` | Merge pull request #49 from cvsloane/chore/tasks-note-followups | 2026-02-14 | Chris Sloane | +| `c26c10c` | chore: update task note with follow-up improvements | 2026-02-14 | cvsloane | +| `d4169e2` | Merge pull request #48 from cvsloane/fix/mobile-terminal-axis-lock | 2026-02-14 | Chris Sloane | +| `80f39d8` | fix: smooth mobile terminal gesture axis lock | 2026-02-14 | cvsloane | --- @@ -83,5 +83,5 @@ This file provides context for AI assistants (Claude Code, Cursor, etc.) about r ## Branch Info -- **Current Branch**: `feat/ops-metrics` -- **Last Commit**: 2026-02-16T10:58:07-05:00 +- **Current Branch**: `build/agentd-origin-main-20260216` +- **Last Commit**: 2026-02-16T11:08:23-05:00 From 58e86193c02762e4bc741fee5f93277be3161e2f Mon Sep 17 00:00:00 2001 From: cvsloane Date: Wed, 18 Feb 2026 11:02:02 -0500 Subject: [PATCH 02/16] chore: update project status --- project_status.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/project_status.md b/project_status.md index a3a748e5..b59a4b3a 100644 --- a/project_status.md +++ b/project_status.md @@ -1,7 +1,7 @@ # Project Status - agent-command > **Auto-generated by [project-status agent](https://github.com/cvsloane/open-agents)** -> Last updated: 2026-02-17T16:02:06.423Z +> Last updated: 2026-02-18T16:02:02.736Z ## Purpose @@ -46,11 +46,11 @@ This file provides context for AI assistants (Claude Code, Cursor, etc.) about r | Hash | Message | Date | Author | |------|---------|------|--------| +| `02f42b2` | chore: update project status | 2026-02-17 | cvsloane | | `b0a3818` | Ops metrics: /metrics + reconnect + rate-limit counters | 2026-02-16 | Chris Sloane | | `877c499` | Merge pull request #49 from cvsloane/chore/tasks-note-followups | 2026-02-14 | Chris Sloane | | `c26c10c` | chore: update task note with follow-up improvements | 2026-02-14 | cvsloane | | `d4169e2` | Merge pull request #48 from cvsloane/fix/mobile-terminal-axis-lock | 2026-02-14 | Chris Sloane | -| `80f39d8` | fix: smooth mobile terminal gesture axis lock | 2026-02-14 | cvsloane | --- @@ -84,4 +84,4 @@ This file provides context for AI assistants (Claude Code, Cursor, etc.) about r ## Branch Info - **Current Branch**: `build/agentd-origin-main-20260216` -- **Last Commit**: 2026-02-16T11:08:23-05:00 +- **Last Commit**: 2026-02-17T11:02:06-05:00 From 17ab5e19caab893ec5aeef0cf743b839de209b98 Mon Sep 17 00:00:00 2001 From: cvsloane Date: Thu, 19 Feb 2026 11:02:03 -0500 Subject: [PATCH 03/16] chore: update project status --- project_status.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/project_status.md b/project_status.md index b59a4b3a..af137eb8 100644 --- a/project_status.md +++ b/project_status.md @@ -1,7 +1,7 @@ # Project Status - agent-command > **Auto-generated by [project-status agent](https://github.com/cvsloane/open-agents)** -> Last updated: 2026-02-18T16:02:02.736Z +> Last updated: 2026-02-19T16:02:03.261Z ## Purpose @@ -46,11 +46,11 @@ This file provides context for AI assistants (Claude Code, Cursor, etc.) about r | Hash | Message | Date | Author | |------|---------|------|--------| +| `58e8619` | chore: update project status | 2026-02-18 | cvsloane | | `02f42b2` | chore: update project status | 2026-02-17 | cvsloane | | `b0a3818` | Ops metrics: /metrics + reconnect + rate-limit counters | 2026-02-16 | Chris Sloane | | `877c499` | Merge pull request #49 from cvsloane/chore/tasks-note-followups | 2026-02-14 | Chris Sloane | | `c26c10c` | chore: update task note with follow-up improvements | 2026-02-14 | cvsloane | -| `d4169e2` | Merge pull request #48 from cvsloane/fix/mobile-terminal-axis-lock | 2026-02-14 | Chris Sloane | --- @@ -84,4 +84,4 @@ This file provides context for AI assistants (Claude Code, Cursor, etc.) about r ## Branch Info - **Current Branch**: `build/agentd-origin-main-20260216` -- **Last Commit**: 2026-02-17T11:02:06-05:00 +- **Last Commit**: 2026-02-18T11:02:02-05:00 From 6e45991a428e636d0b0591dd0f4ae7748cc79ead Mon Sep 17 00:00:00 2001 From: cvsloane Date: Fri, 20 Feb 2026 11:02:03 -0500 Subject: [PATCH 04/16] chore: update project status --- project_status.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/project_status.md b/project_status.md index af137eb8..03eb4dbe 100644 --- a/project_status.md +++ b/project_status.md @@ -1,7 +1,7 @@ # Project Status - agent-command > **Auto-generated by [project-status agent](https://github.com/cvsloane/open-agents)** -> Last updated: 2026-02-19T16:02:03.261Z +> Last updated: 2026-02-20T16:02:03.270Z ## Purpose @@ -46,11 +46,11 @@ This file provides context for AI assistants (Claude Code, Cursor, etc.) about r | Hash | Message | Date | Author | |------|---------|------|--------| +| `17ab5e1` | chore: update project status | 2026-02-19 | cvsloane | | `58e8619` | chore: update project status | 2026-02-18 | cvsloane | | `02f42b2` | chore: update project status | 2026-02-17 | cvsloane | | `b0a3818` | Ops metrics: /metrics + reconnect + rate-limit counters | 2026-02-16 | Chris Sloane | | `877c499` | Merge pull request #49 from cvsloane/chore/tasks-note-followups | 2026-02-14 | Chris Sloane | -| `c26c10c` | chore: update task note with follow-up improvements | 2026-02-14 | cvsloane | --- @@ -84,4 +84,4 @@ This file provides context for AI assistants (Claude Code, Cursor, etc.) about r ## Branch Info - **Current Branch**: `build/agentd-origin-main-20260216` -- **Last Commit**: 2026-02-18T11:02:02-05:00 +- **Last Commit**: 2026-02-19T11:02:03-05:00 From ef05fa6da112992db1105926b0dd9ad6b3ba84f7 Mon Sep 17 00:00:00 2001 From: cvsloane Date: Sat, 21 Feb 2026 11:02:03 -0500 Subject: [PATCH 05/16] chore: update project status --- project_status.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/project_status.md b/project_status.md index 03eb4dbe..9c5f1146 100644 --- a/project_status.md +++ b/project_status.md @@ -1,7 +1,7 @@ # Project Status - agent-command > **Auto-generated by [project-status agent](https://github.com/cvsloane/open-agents)** -> Last updated: 2026-02-20T16:02:03.270Z +> Last updated: 2026-02-21T16:02:03.185Z ## Purpose @@ -46,11 +46,11 @@ This file provides context for AI assistants (Claude Code, Cursor, etc.) about r | Hash | Message | Date | Author | |------|---------|------|--------| +| `6e45991` | chore: update project status | 2026-02-20 | cvsloane | | `17ab5e1` | chore: update project status | 2026-02-19 | cvsloane | | `58e8619` | chore: update project status | 2026-02-18 | cvsloane | | `02f42b2` | chore: update project status | 2026-02-17 | cvsloane | | `b0a3818` | Ops metrics: /metrics + reconnect + rate-limit counters | 2026-02-16 | Chris Sloane | -| `877c499` | Merge pull request #49 from cvsloane/chore/tasks-note-followups | 2026-02-14 | Chris Sloane | --- @@ -62,8 +62,6 @@ This file provides context for AI assistants (Claude Code, Cursor, etc.) about r - `agents/agentd/internal/metrics/metrics.go` - `agents/agentd/internal/providers/claude.go` - `agents/agentd/internal/ws/client.go` -- `apps/dashboard/src/app/(dashboard)/sessions/[id]/page.tsx` -- `apps/dashboard/src/components/orchestrator/OrchestratorButton.tsx` - `apps/dashboard/src/components/TerminalView.tsx` - `docs/agentd.md` - `docs/operations.md` @@ -77,6 +75,8 @@ This file provides context for AI assistants (Claude Code, Cursor, etc.) about r - `services/control-plane/src/index.ts` - `services/control-plane/src/metrics.ts` - `services/control-plane/src/routes/metrics.ts` +- `services/control-plane/src/services/clawdbot.ts` +- `tasks/2026-02-14-mobile-ux-orchestrator-refactor.md` --- @@ -84,4 +84,4 @@ This file provides context for AI assistants (Claude Code, Cursor, etc.) about r ## Branch Info - **Current Branch**: `build/agentd-origin-main-20260216` -- **Last Commit**: 2026-02-19T11:02:03-05:00 +- **Last Commit**: 2026-02-20T11:02:03-05:00 From 25579639e3e0d9c62149e7a6f764d06ff6770821 Mon Sep 17 00:00:00 2001 From: cvsloane Date: Sun, 22 Feb 2026 05:27:48 -0500 Subject: [PATCH 06/16] chore: update project status --- project_status.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/project_status.md b/project_status.md index 9c5f1146..9278846f 100644 --- a/project_status.md +++ b/project_status.md @@ -1,7 +1,7 @@ # Project Status - agent-command > **Auto-generated by [project-status agent](https://github.com/cvsloane/open-agents)** -> Last updated: 2026-02-21T16:02:03.185Z +> Last updated: 2026-02-22T10:27:48.625Z ## Purpose @@ -46,11 +46,11 @@ This file provides context for AI assistants (Claude Code, Cursor, etc.) about r | Hash | Message | Date | Author | |------|---------|------|--------| +| `ef05fa6` | chore: update project status | 2026-02-21 | cvsloane | | `6e45991` | chore: update project status | 2026-02-20 | cvsloane | | `17ab5e1` | chore: update project status | 2026-02-19 | cvsloane | | `58e8619` | chore: update project status | 2026-02-18 | cvsloane | | `02f42b2` | chore: update project status | 2026-02-17 | cvsloane | -| `b0a3818` | Ops metrics: /metrics + reconnect + rate-limit counters | 2026-02-16 | Chris Sloane | --- @@ -84,4 +84,4 @@ This file provides context for AI assistants (Claude Code, Cursor, etc.) about r ## Branch Info - **Current Branch**: `build/agentd-origin-main-20260216` -- **Last Commit**: 2026-02-20T11:02:03-05:00 +- **Last Commit**: 2026-02-21T11:02:03-05:00 From 007a14d148bd88d3a8191fc078e0f241fafd77a6 Mon Sep 17 00:00:00 2001 From: cvsloane Date: Sun, 22 Feb 2026 11:02:03 -0500 Subject: [PATCH 07/16] chore: update project status --- project_status.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/project_status.md b/project_status.md index 9278846f..48a2a438 100644 --- a/project_status.md +++ b/project_status.md @@ -1,7 +1,7 @@ # Project Status - agent-command > **Auto-generated by [project-status agent](https://github.com/cvsloane/open-agents)** -> Last updated: 2026-02-22T10:27:48.625Z +> Last updated: 2026-02-22T16:02:03.284Z ## Purpose @@ -46,11 +46,11 @@ This file provides context for AI assistants (Claude Code, Cursor, etc.) about r | Hash | Message | Date | Author | |------|---------|------|--------| +| `2557963` | chore: update project status | 2026-02-22 | cvsloane | | `ef05fa6` | chore: update project status | 2026-02-21 | cvsloane | | `6e45991` | chore: update project status | 2026-02-20 | cvsloane | | `17ab5e1` | chore: update project status | 2026-02-19 | cvsloane | | `58e8619` | chore: update project status | 2026-02-18 | cvsloane | -| `02f42b2` | chore: update project status | 2026-02-17 | cvsloane | --- @@ -62,7 +62,6 @@ This file provides context for AI assistants (Claude Code, Cursor, etc.) about r - `agents/agentd/internal/metrics/metrics.go` - `agents/agentd/internal/providers/claude.go` - `agents/agentd/internal/ws/client.go` -- `apps/dashboard/src/components/TerminalView.tsx` - `docs/agentd.md` - `docs/operations.md` - `docs/README.md` @@ -84,4 +83,4 @@ This file provides context for AI assistants (Claude Code, Cursor, etc.) about r ## Branch Info - **Current Branch**: `build/agentd-origin-main-20260216` -- **Last Commit**: 2026-02-21T11:02:03-05:00 +- **Last Commit**: 2026-02-22T05:27:48-05:00 From 045e898f771db1da7eaeeb7aea7379d1d4eec279 Mon Sep 17 00:00:00 2001 From: cvsloane Date: Mon, 23 Feb 2026 05:29:51 -0500 Subject: [PATCH 08/16] chore: update project status --- project_status.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/project_status.md b/project_status.md index 48a2a438..203d9c39 100644 --- a/project_status.md +++ b/project_status.md @@ -1,7 +1,7 @@ # Project Status - agent-command > **Auto-generated by [project-status agent](https://github.com/cvsloane/open-agents)** -> Last updated: 2026-02-22T16:02:03.284Z +> Last updated: 2026-02-23T10:29:51.072Z ## Purpose @@ -46,11 +46,11 @@ This file provides context for AI assistants (Claude Code, Cursor, etc.) about r | Hash | Message | Date | Author | |------|---------|------|--------| +| `007a14d` | chore: update project status | 2026-02-22 | cvsloane | | `2557963` | chore: update project status | 2026-02-22 | cvsloane | | `ef05fa6` | chore: update project status | 2026-02-21 | cvsloane | | `6e45991` | chore: update project status | 2026-02-20 | cvsloane | | `17ab5e1` | chore: update project status | 2026-02-19 | cvsloane | -| `58e8619` | chore: update project status | 2026-02-18 | cvsloane | --- @@ -83,4 +83,4 @@ This file provides context for AI assistants (Claude Code, Cursor, etc.) about r ## Branch Info - **Current Branch**: `build/agentd-origin-main-20260216` -- **Last Commit**: 2026-02-22T05:27:48-05:00 +- **Last Commit**: 2026-02-22T11:02:03-05:00 From 0f8463b6fb56fdfafcef2ed6eb52ffc314c78322 Mon Sep 17 00:00:00 2001 From: cvsloane Date: Mon, 23 Feb 2026 11:02:03 -0500 Subject: [PATCH 09/16] chore: update project status --- project_status.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/project_status.md b/project_status.md index 203d9c39..32d85280 100644 --- a/project_status.md +++ b/project_status.md @@ -1,7 +1,7 @@ # Project Status - agent-command > **Auto-generated by [project-status agent](https://github.com/cvsloane/open-agents)** -> Last updated: 2026-02-23T10:29:51.072Z +> Last updated: 2026-02-23T16:02:03.353Z ## Purpose @@ -46,11 +46,11 @@ This file provides context for AI assistants (Claude Code, Cursor, etc.) about r | Hash | Message | Date | Author | |------|---------|------|--------| +| `045e898` | chore: update project status | 2026-02-23 | cvsloane | | `007a14d` | chore: update project status | 2026-02-22 | cvsloane | | `2557963` | chore: update project status | 2026-02-22 | cvsloane | | `ef05fa6` | chore: update project status | 2026-02-21 | cvsloane | | `6e45991` | chore: update project status | 2026-02-20 | cvsloane | -| `17ab5e1` | chore: update project status | 2026-02-19 | cvsloane | --- @@ -75,7 +75,6 @@ This file provides context for AI assistants (Claude Code, Cursor, etc.) about r - `services/control-plane/src/metrics.ts` - `services/control-plane/src/routes/metrics.ts` - `services/control-plane/src/services/clawdbot.ts` -- `tasks/2026-02-14-mobile-ux-orchestrator-refactor.md` --- @@ -83,4 +82,4 @@ This file provides context for AI assistants (Claude Code, Cursor, etc.) about r ## Branch Info - **Current Branch**: `build/agentd-origin-main-20260216` -- **Last Commit**: 2026-02-22T11:02:03-05:00 +- **Last Commit**: 2026-02-23T05:29:51-05:00 From a70412ae1fba1b9e489c48935d1c27160f5a54a8 Mon Sep 17 00:00:00 2001 From: cvsloane Date: Tue, 24 Feb 2026 11:02:04 -0500 Subject: [PATCH 10/16] chore: update project status --- project_status.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/project_status.md b/project_status.md index 32d85280..1833df69 100644 --- a/project_status.md +++ b/project_status.md @@ -1,7 +1,7 @@ # Project Status - agent-command > **Auto-generated by [project-status agent](https://github.com/cvsloane/open-agents)** -> Last updated: 2026-02-23T16:02:03.353Z +> Last updated: 2026-02-24T16:02:04.315Z ## Purpose @@ -46,11 +46,11 @@ This file provides context for AI assistants (Claude Code, Cursor, etc.) about r | Hash | Message | Date | Author | |------|---------|------|--------| +| `0f8463b` | chore: update project status | 2026-02-23 | cvsloane | | `045e898` | chore: update project status | 2026-02-23 | cvsloane | | `007a14d` | chore: update project status | 2026-02-22 | cvsloane | | `2557963` | chore: update project status | 2026-02-22 | cvsloane | | `ef05fa6` | chore: update project status | 2026-02-21 | cvsloane | -| `6e45991` | chore: update project status | 2026-02-20 | cvsloane | --- @@ -82,4 +82,4 @@ This file provides context for AI assistants (Claude Code, Cursor, etc.) about r ## Branch Info - **Current Branch**: `build/agentd-origin-main-20260216` -- **Last Commit**: 2026-02-23T05:29:51-05:00 +- **Last Commit**: 2026-02-23T11:02:03-05:00 From 2f2bb1611f2f0d862f8304270d11d7d2c6630ade Mon Sep 17 00:00:00 2001 From: cvsloane Date: Fri, 27 Mar 2026 19:38:29 -0400 Subject: [PATCH 11/16] Add universal memory and safer automation runtime --- README.md | 9 + agents/agentd/cmd/agentd/main.go | 22 +- .../src/app/(dashboard)/automation/page.tsx | 1259 ++++++++++++ .../src/app/(dashboard)/memory/page.tsx | 389 ++++ .../src/components/layout/SidebarNav.tsx | 12 + apps/dashboard/src/lib/api.ts | 172 ++ docs/README.md | 1 + docs/api.md | 22 +- docs/automation-memory.md | 93 + docs/data-model.md | 31 +- docs/orchestrator.md | 7 + docs/websockets.md | 6 + migrations/027_memory_automation.sql | 243 +++ migrations/028_runtime_memory_refinements.sql | 108 + packages/ac-schema/src/automation.ts | 212 ++ packages/ac-schema/src/host.ts | 1 + packages/ac-schema/src/index.ts | 9 + packages/ac-schema/src/memory.ts | 70 + packages/ac-schema/src/message.ts | 55 + packages/ac-schema/src/repo.ts | 22 + packages/ac-schema/src/session.ts | 11 + services/control-plane/src/config.ts | 1 + .../control-plane/src/db/automationMemory.ts | 1790 +++++++++++++++++ services/control-plane/src/db/index.ts | 188 +- services/control-plane/src/index.ts | 15 + services/control-plane/src/metrics.ts | 43 + .../control-plane/src/routes/automation.ts | 150 ++ .../src/routes/governanceApprovals.ts | 50 + services/control-plane/src/routes/memory.ts | 36 + services/control-plane/src/routes/repos.ts | 25 + services/control-plane/src/routes/sessions.ts | 133 +- .../control-plane/src/routes/workItems.ts | 85 + .../control-plane/src/services/automation.ts | 1298 ++++++++++++ .../control-plane/src/services/embeddings.ts | 34 + services/control-plane/src/services/pubsub.ts | 155 +- .../src/services/sessionMemory.ts | 126 ++ .../src/services/sessionSpawn.ts | 208 ++ ...2026-03-27-universal-memory-autonomy-v2.md | 87 + tasks/lessons.md | 4 + 39 files changed, 7065 insertions(+), 117 deletions(-) create mode 100644 apps/dashboard/src/app/(dashboard)/automation/page.tsx create mode 100644 apps/dashboard/src/app/(dashboard)/memory/page.tsx create mode 100644 docs/automation-memory.md create mode 100644 migrations/027_memory_automation.sql create mode 100644 migrations/028_runtime_memory_refinements.sql create mode 100644 packages/ac-schema/src/automation.ts create mode 100644 packages/ac-schema/src/memory.ts create mode 100644 packages/ac-schema/src/repo.ts create mode 100644 services/control-plane/src/db/automationMemory.ts create mode 100644 services/control-plane/src/routes/automation.ts create mode 100644 services/control-plane/src/routes/governanceApprovals.ts create mode 100644 services/control-plane/src/routes/memory.ts create mode 100644 services/control-plane/src/routes/repos.ts create mode 100644 services/control-plane/src/routes/workItems.ts create mode 100644 services/control-plane/src/services/automation.ts create mode 100644 services/control-plane/src/services/embeddings.ts create mode 100644 services/control-plane/src/services/sessionMemory.ts create mode 100644 services/control-plane/src/services/sessionSpawn.ts create mode 100644 tasks/2026-03-27-universal-memory-autonomy-v2.md diff --git a/README.md b/README.md index 93b3c37f..afcfdc91 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,8 @@ pnpm db:migrate - **tmux-native sessions** — discover and manage real tmux panes across hosts - **Interactive console** — live streaming with full terminal control and read-only viewers - **Orchestrator + approvals** — attention queue for input, approvals, and errors +- **Autonomous agents** — scheduled or manual orchestrators and workers with runtime reuse, preflight, and governance +- **Scoped memory** — repo and global memory for every session, with procedural knowledge and trajectory-backed learning - **Session generator** — spawn multi-session templates with groups and links - **Visualizer** — immersive full-screen activity view - **Search + analytics** — global search and usage tracking @@ -72,6 +74,7 @@ pnpm db:migrate | [Sessions](docs/sessions.md) | Session lifecycle and actions | | [Console Streaming](docs/console.md) | Interactive tmux in the browser | | [Orchestrator](docs/orchestrator.md) | Attention queue and summaries | +| [Automation and Memory](docs/automation-memory.md) | Autonomous runs, work queue, and scoped memory | | [Approvals](docs/approvals.md) | Permission requests and decisions | | [Coolify Deployment](docs/deployment-coolify.md) | Production setup on Coolify + Cloudflare | | [API Reference](docs/api.md) | REST + WS endpoints | @@ -91,6 +94,12 @@ Public site: - `GET /v1/sessions`, `POST /v1/sessions/:id/commands` - `GET /v1/approvals`, `POST /v1/approvals/:id/decide` - `GET /v1/hosts`, `POST /v1/hosts` +- `GET /v1/repos`, `GET /v1/memory/search`, `POST /v1/memory` +- `GET /v1/automation-agents`, `POST /v1/automation-agents/:id/wake` +- `GET /v1/automation-agents/:id/preflight` +- `GET /v1/automation-runs`, `GET /v1/automation-runs/:id/events`, `GET /v1/automation-wakeups` +- `GET /v1/governance-approvals`, `POST /v1/governance-approvals/:id/decide` +- `GET /v1/work-items`, `POST /v1/work-items` - `POST /v1/notifications/test` ## Security diff --git a/agents/agentd/cmd/agentd/main.go b/agents/agentd/cmd/agentd/main.go index d4b171d2..7d15e941 100644 --- a/agents/agentd/cmd/agentd/main.go +++ b/agents/agentd/cmd/agentd/main.go @@ -1649,12 +1649,23 @@ func applyParsedUsageEntries(fields map[string]any, rawJSON map[string]any) { } func (a *Agent) sendHello() error { + providers := map[string]bool{ + "claude_code": commandAvailable("claude"), + "codex": commandAvailable("codex"), + "gemini_cli": commandAvailable("gemini"), + "opencode": commandAvailable("opencode"), + "cursor": commandAvailable("cursor"), + "aider": commandAvailable("aider"), + "continue": commandAvailable("continue"), + "shell": true, + } + payload := map[string]any{ "host": map[string]any{ "id": a.cfg.Host.ID, "name": a.cfg.Host.Name, "agent_version": "0.1.0", - "capabilities": map[string]bool{ + "capabilities": map[string]any{ "tmux": true, "spawn": a.cfg.Security.AllowSpawn, "kill": a.cfg.Security.AllowKill, @@ -1662,6 +1673,7 @@ func (a *Agent) sendHello() error { "terminal": true, "claude_hooks": true, "codex_exec_json": true, + "providers": providers, }, }, "resume": map[string]any{ @@ -1672,6 +1684,14 @@ func (a *Agent) sendHello() error { return a.wsClient.Send("agent.hello", payload) } +func commandAvailable(name string) bool { + if strings.TrimSpace(name) == "" { + return false + } + _, err := exec.LookPath(name) + return err == nil +} + func (a *Agent) handleMessage(msgType string, payload json.RawMessage) { switch msgType { case "commands.dispatch": diff --git a/apps/dashboard/src/app/(dashboard)/automation/page.tsx b/apps/dashboard/src/app/(dashboard)/automation/page.tsx new file mode 100644 index 00000000..329b35ae --- /dev/null +++ b/apps/dashboard/src/app/(dashboard)/automation/page.tsx @@ -0,0 +1,1259 @@ +'use client'; + +import Link from 'next/link'; +import { useCallback, useMemo, useState } from 'react'; +import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'; +import type { + BadgeProps, +} from '@/components/ui/badge'; +import type { + AutomationAgent, + AutomationRun, + AutomationRunEvent, + AutomationWakeup, + GovernanceApproval, + Host, + Repo, + ServerToUIMessage, + WorkItem, +} from '@agent-command/schema'; +import { + AlertTriangle, + Bot, + FolderGit2, + Pause, + Play, + RefreshCw, + ShieldAlert, + Workflow, +} from 'lucide-react'; +import { Badge } from '@/components/ui/badge'; +import { Button } from '@/components/ui/button'; +import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; +import { Input } from '@/components/ui/input'; +import { Label } from '@/components/ui/label'; +import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; +import { Textarea } from '@/components/ui/textarea'; +import { useWebSocket } from '@/hooks/useWebSocket'; +import { + createAutomationAgent, + createWorkItem, + decideGovernanceApproval, + getAutomationAgents, + getAutomationRunEvents, + getAutomationRuns, + getAutomationWakeups, + getGovernanceApprovals, + getHosts, + getRepos, + getWorkItems, + updateAutomationAgent, + updateWorkItem, + wakeAutomationAgent, +} from '@/lib/api'; +import { formatRelativeTime, getProviderDisplayName } from '@/lib/utils'; + +const providerOptions = [ + 'claude_code', + 'codex', + 'gemini_cli', + 'opencode', + 'cursor', + 'aider', + 'continue', + 'shell', +] as const; + +const EMPTY_REPOS: Repo[] = []; +const EMPTY_AGENTS: AutomationAgent[] = []; +const EMPTY_RUNS: AutomationRun[] = []; +const EMPTY_WAKEUPS: AutomationWakeup[] = []; +const EMPTY_APPROVALS: GovernanceApproval[] = []; +const EMPTY_WORK_ITEMS: WorkItem[] = []; +const EMPTY_HOSTS: Host[] = []; + +const selectClassName = + 'flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring'; + +function getBadgeVariant(status: string): BadgeProps['variant'] { + switch (status) { + case 'active': + case 'running': + case 'succeeded': + case 'approved': + case 'done': + case 'completed': + return 'running'; + case 'paused': + case 'cancelled': + case 'coalesced': + return 'secondary'; + case 'queued': + case 'starting': + case 'in_progress': + return 'default'; + case 'blocked': + case 'pending': + case 'skipped': + return 'waiting'; + case 'failed': + case 'denied': + return 'destructive'; + default: + return 'outline'; + } +} + +function centsFromDollars(value: string): number | undefined { + const trimmed = value.trim(); + if (!trimmed) return undefined; + const parsed = Number(trimmed); + if (!Number.isFinite(parsed) || parsed <= 0) return undefined; + return Math.round(parsed * 100); +} + +function parsePositiveInt(value: string, fallback: number): number { + const parsed = Number.parseInt(value, 10); + return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback; +} + +function repoLabel(repo: Repo): string { + return repo.display_name || repo.last_repo_root || repo.canonical_key; +} + +function describeBudget(policy: Record | null | undefined): string { + if (!policy) return 'No budget limits'; + const daily = typeof policy.daily_limit_cents === 'number' + ? policy.daily_limit_cents / 100 + : null; + const monthly = typeof policy.monthly_limit_cents === 'number' + ? policy.monthly_limit_cents / 100 + : null; + const warnPercent = typeof policy.warn_percent === 'number' + ? `${policy.warn_percent}% warn` + : null; + if (!daily && !monthly) return warnPercent || 'No budget limits'; + return [ + daily ? `$${daily.toFixed(2)}/day` : null, + monthly ? `$${monthly.toFixed(2)}/month` : null, + warnPercent, + ] + .filter(Boolean) + .join(' · '); +} + +function describeSchedule(policy: Record | null | undefined): string { + if (!policy) return 'Manual only'; + const intervalMinutes = typeof policy.interval_minutes === 'number' + ? policy.interval_minutes + : typeof policy.interval_minutes === 'string' + ? Number(policy.interval_minutes) + : 0; + if (!Number.isFinite(intervalMinutes) || intervalMinutes <= 0) { + return 'Manual only'; + } + return `Every ${intervalMinutes}m`; +} + +function describeApproval(approval: GovernanceApproval): string { + const reason = approval.request_payload?.reason; + if (typeof reason === 'string' && reason.trim()) { + return reason.trim(); + } + return JSON.stringify(approval.request_payload); +} + +function describeWorkItemStatus(item: WorkItem): string { + if (item.checkout_run_id) { + return `${item.status} · checked out`; + } + return item.status; +} + +function describeWakeContext(wakeup: AutomationWakeup): string { + const objective = wakeup.context_json?.objective; + if (typeof objective === 'string' && objective.trim()) { + return objective.trim(); + } + return 'Uses agent schedule or queue objective'; +} + +function describeRunSummary(run: AutomationRun): string { + return run.result_summary?.trim() || run.objective; +} + +function describeConcurrency(policy: Record | null | undefined): string { + const value = typeof policy?.concurrency_policy === 'string' + ? policy.concurrency_policy + : 'coalesce_if_active'; + switch (value) { + case 'always_enqueue': + return 'Queue behind active runs'; + case 'skip_if_active': + return 'Skip when already active'; + default: + return 'Coalesce into active run'; + } +} + +function describeRuntime(agent: AutomationAgent): string { + const runtime = agent.runtime_state; + if (!runtime) return 'No runtime bound'; + if (runtime.active_session_id) { + return `${runtime.runtime_status} · session attached`; + } + return runtime.runtime_status; +} + +function eventBadgeVariant(level: AutomationRunEvent['level']): BadgeProps['variant'] { + if (level === 'error') return 'destructive'; + if (level === 'warn') return 'waiting'; + return 'outline'; +} + +export const dynamic = 'force-dynamic'; + +export default function AutomationPage() { + const queryClient = useQueryClient(); + const [agentForm, setAgentForm] = useState({ + name: '', + role: 'orchestrator', + provider: 'codex', + defaultCwd: '', + fixedHostId: '', + intervalMinutes: '', + scheduledObjective: '', + concurrencyPolicy: 'coalesce_if_active', + maxParallelRuns: '1', + dailyBudgetUsd: '', + monthlyBudgetUsd: '', + warnPercent: '80', + }); + const [wakeForm, setWakeForm] = useState({ + agentId: '', + repoId: '', + objective: '', + idempotencyKey: '', + }); + const [workForm, setWorkForm] = useState({ + repoId: '', + title: '', + objective: '', + priority: '0', + assignedAutomationAgentId: '', + dedupeKey: '', + }); + const [selectedRunId, setSelectedRunId] = useState(null); + + const { data: agentsData, isLoading: agentsLoading, error: agentsError, refetch: refetchAgents } = useQuery({ + queryKey: ['automation', 'agents'], + queryFn: getAutomationAgents, + refetchInterval: 15000, + }); + const { data: runsData, refetch: refetchRuns } = useQuery({ + queryKey: ['automation', 'runs'], + queryFn: () => getAutomationRuns({ limit: 30 }), + refetchInterval: 15000, + }); + const { data: runEventsData, refetch: refetchRunEvents } = useQuery({ + queryKey: ['automation', 'run-events', selectedRunId], + queryFn: () => getAutomationRunEvents(selectedRunId!), + enabled: Boolean(selectedRunId), + refetchInterval: selectedRunId ? 15000 : false, + }); + const { data: wakeupsData, refetch: refetchWakeups } = useQuery({ + queryKey: ['automation', 'wakeups'], + queryFn: () => getAutomationWakeups({ limit: 30 }), + refetchInterval: 15000, + }); + const { data: approvalsData, refetch: refetchApprovals } = useQuery({ + queryKey: ['automation', 'governance-approvals'], + queryFn: () => getGovernanceApprovals({ status: 'pending' }), + refetchInterval: 15000, + }); + const { data: workItemsData, refetch: refetchWorkItems } = useQuery({ + queryKey: ['automation', 'work-items'], + queryFn: () => getWorkItems({ limit: 50 }), + refetchInterval: 15000, + }); + const { data: reposData } = useQuery({ + queryKey: ['repos', 'automation'], + queryFn: () => getRepos({ limit: 100 }), + }); + const { data: hostsData } = useQuery({ + queryKey: ['hosts', 'automation'], + queryFn: getHosts, + }); + + const agents = agentsData?.agents ?? EMPTY_AGENTS; + const runs = runsData?.runs ?? EMPTY_RUNS; + const wakeups = wakeupsData?.wakeups ?? EMPTY_WAKEUPS; + const approvals = approvalsData?.approvals ?? EMPTY_APPROVALS; + const workItems = workItemsData?.work_items ?? EMPTY_WORK_ITEMS; + const repos = reposData?.repos ?? EMPTY_REPOS; + const hosts = hostsData?.hosts ?? EMPTY_HOSTS; + const runEvents = runEventsData?.events ?? []; + + const repoMap = useMemo(() => new Map(repos.map((repo) => [repo.id, repo])), [repos]); + const hostMap = useMemo(() => new Map(hosts.map((host) => [host.id, host])), [hosts]); + const agentMap = useMemo(() => new Map(agents.map((agent) => [agent.id, agent])), [agents]); + + const refetchAll = useCallback(() => { + void refetchAgents(); + void refetchRuns(); + void refetchRunEvents(); + void refetchWakeups(); + void refetchApprovals(); + void refetchWorkItems(); + }, [refetchAgents, refetchRuns, refetchRunEvents, refetchWakeups, refetchApprovals, refetchWorkItems]); + + const handleAutomationMessage = useCallback( + (message: ServerToUIMessage) => { + if (message.type === 'automation.run.updated') { + void queryClient.invalidateQueries({ queryKey: ['automation', 'runs'] }); + return; + } + if (message.type === 'automation.run.event') { + void queryClient.invalidateQueries({ queryKey: ['automation', 'run-events'] }); + return; + } + if (message.type === 'automation.runtime_state.updated') { + void queryClient.invalidateQueries({ queryKey: ['automation', 'agents'] }); + return; + } + if (message.type === 'automation.wakeup.updated') { + void queryClient.invalidateQueries({ queryKey: ['automation', 'wakeups'] }); + return; + } + if (message.type === 'governance_approval.updated') { + void queryClient.invalidateQueries({ queryKey: ['automation', 'governance-approvals'] }); + return; + } + if (message.type === 'work_item.updated') { + void queryClient.invalidateQueries({ queryKey: ['automation', 'work-items'] }); + } + }, + [queryClient] + ); + + useWebSocket( + [ + { type: 'automation_runs' }, + ...(selectedRunId ? [{ type: 'automation_run_events' as const, filter: { automation_run_id: selectedRunId } }] : []), + { type: 'automation_wakeups' }, + { type: 'governance_approvals', filter: { status: 'pending' } }, + { type: 'work_items' }, + ], + handleAutomationMessage + ); + + const createAgentMutation = useMutation({ + mutationFn: async () => { + const wakePolicyJson: Record = {}; + const intervalMinutes = parsePositiveInt(agentForm.intervalMinutes, 0); + if (intervalMinutes > 0) { + wakePolicyJson.interval_minutes = intervalMinutes; + } + if (agentForm.scheduledObjective.trim()) { + wakePolicyJson.objective = agentForm.scheduledObjective.trim(); + } + wakePolicyJson.concurrency_policy = agentForm.concurrencyPolicy; + + const budgetPolicyJson: Record = {}; + const dailyBudget = centsFromDollars(agentForm.dailyBudgetUsd); + const monthlyBudget = centsFromDollars(agentForm.monthlyBudgetUsd); + if (dailyBudget) { + budgetPolicyJson.daily_limit_cents = dailyBudget; + } + if (monthlyBudget) { + budgetPolicyJson.monthly_limit_cents = monthlyBudget; + } + budgetPolicyJson.warn_percent = parsePositiveInt(agentForm.warnPercent, 80); + + return createAutomationAgent({ + name: agentForm.name.trim(), + role: agentForm.role as 'orchestrator' | 'worker', + provider: agentForm.provider as AutomationAgent['provider'], + default_cwd: agentForm.defaultCwd.trim() || undefined, + fixed_host_id: agentForm.fixedHostId || undefined, + max_parallel_runs: parsePositiveInt(agentForm.maxParallelRuns, 1), + wake_policy_json: Object.keys(wakePolicyJson).length > 0 ? wakePolicyJson : undefined, + budget_policy_json: Object.keys(budgetPolicyJson).length > 0 ? budgetPolicyJson : undefined, + }); + }, + onSuccess: () => { + setAgentForm({ + name: '', + role: 'orchestrator', + provider: 'codex', + defaultCwd: '', + fixedHostId: '', + intervalMinutes: '', + scheduledObjective: '', + concurrencyPolicy: 'coalesce_if_active', + maxParallelRuns: '1', + dailyBudgetUsd: '', + monthlyBudgetUsd: '', + warnPercent: '80', + }); + void queryClient.invalidateQueries({ queryKey: ['automation', 'agents'] }); + }, + }); + + const wakeAgentMutation = useMutation({ + mutationFn: async (input: { agentId: string; repoId?: string; objective?: string; idempotencyKey?: string }) => + wakeAutomationAgent(input.agentId, { + source: 'manual', + repo_id: input.repoId || undefined, + idempotency_key: input.idempotencyKey || undefined, + context_json: input.objective?.trim() ? { objective: input.objective.trim() } : undefined, + }), + onSuccess: () => { + setWakeForm({ agentId: '', repoId: '', objective: '', idempotencyKey: '' }); + void queryClient.invalidateQueries({ queryKey: ['automation', 'wakeups'] }); + void queryClient.invalidateQueries({ queryKey: ['automation', 'runs'] }); + }, + }); + + const toggleAgentMutation = useMutation({ + mutationFn: async (agent: AutomationAgent) => + updateAutomationAgent(agent.id, { + status: agent.status === 'active' ? 'paused' : 'active', + }), + onSuccess: () => { + void queryClient.invalidateQueries({ queryKey: ['automation', 'agents'] }); + }, + }); + + const decideApprovalMutation = useMutation({ + mutationFn: async (input: { approvalId: string; decision: 'approved' | 'denied' }) => + decideGovernanceApproval(input.approvalId, { decision: input.decision }), + onSuccess: () => { + void queryClient.invalidateQueries({ queryKey: ['automation', 'governance-approvals'] }); + }, + }); + + const createWorkItemMutation = useMutation({ + mutationFn: async () => + createWorkItem({ + repo_id: workForm.repoId || undefined, + title: workForm.title.trim(), + objective: workForm.objective.trim(), + priority: Number.parseInt(workForm.priority, 10) || 0, + assigned_automation_agent_id: workForm.assignedAutomationAgentId || undefined, + dedupe_key: workForm.dedupeKey.trim() || undefined, + }), + onSuccess: () => { + setWorkForm({ + repoId: '', + title: '', + objective: '', + priority: '0', + assignedAutomationAgentId: '', + dedupeKey: '', + }); + void queryClient.invalidateQueries({ queryKey: ['automation', 'work-items'] }); + }, + }); + + const updateWorkItemMutation = useMutation({ + mutationFn: async (input: { workItemId: string; status: WorkItem['status'] }) => + updateWorkItem(input.workItemId, { status: input.status }), + onSuccess: () => { + void queryClient.invalidateQueries({ queryKey: ['automation', 'work-items'] }); + }, + }); + + const activeRunsCount = runs.filter((run) => ['starting', 'running'].includes(run.status)).length; + const queuedWakeupsCount = wakeups.filter((wakeup) => ['queued', 'running', 'blocked'].includes(wakeup.status)).length; + const activeAgentsCount = agents.filter((agent) => agent.status === 'active').length; + const queuedWorkCount = workItems.filter((item) => ['queued', 'in_progress', 'blocked'].includes(item.status)).length; + + if (agentsLoading && agents.length === 0) { + return ( +
+
+
+ ); + } + + if (agentsError) { + const message = agentsError instanceof Error ? agentsError.message : 'Unknown error'; + return ( +
+

Failed to load automation data

+

{message}

+ +
+ ); + } + + return ( +
+
+
+
+ +

Automation

+
+

+ Orchestrator agents, wake queue, governance approvals, and worker work items. +

+
+ +
+ +
+ + +

Active Agents

+

{activeAgentsCount}

+
+
+ + +

Active Runs

+

{activeRunsCount}

+
+
+ + +

Wake Queue

+

{queuedWakeupsCount}

+
+
+ + +

Open Work

+

{queuedWorkCount}

+
+
+
+ +
+ + + Create Automation Agent + Keep the form narrow: runtime, schedule, and budget only. + + +
+
+ + setAgentForm((current) => ({ ...current, name: event.target.value }))} + placeholder="Repo orchestrator" + /> +
+
+ + +
+
+ + +
+
+ + +
+
+ + setAgentForm((current) => ({ ...current, defaultCwd: event.target.value }))} + placeholder="/home/cvsloane/dev/agent-command" + /> +
+
+ + setAgentForm((current) => ({ ...current, intervalMinutes: event.target.value }))} + placeholder="60" + /> +
+
+ + setAgentForm((current) => ({ ...current, maxParallelRuns: event.target.value }))} + /> +
+
+ + +
+
+ + setAgentForm((current) => ({ ...current, dailyBudgetUsd: event.target.value }))} + placeholder="10.00" + /> +
+
+ + setAgentForm((current) => ({ ...current, monthlyBudgetUsd: event.target.value }))} + placeholder="200.00" + /> +
+
+ + setAgentForm((current) => ({ ...current, warnPercent: event.target.value }))} + placeholder="80" + /> +
+
+
+ +