Skip to content

feat(#605): Admin UI — agent management interface#772

Merged
chubes4 merged 4 commits intomainfrom
feature/605-agent-admin-ui
Mar 9, 2026
Merged

feat(#605): Admin UI — agent management interface#772
chubes4 merged 4 commits intomainfrom
feature/605-agent-admin-ui

Conversation

@chubes4
Copy link
Member

@chubes4 chubes4 commented Mar 9, 2026

Summary

Full agent management UI — create, edit, and delete agents from the browser. Adds a Manage tab to the Agent admin page with a WordPress-style list table, detail editing, and RBAC access management.

Commits (4 layers, bottom-up)

1. DB + Abilities

  • Agents::update_agent() — whitelist of mutable fields (name, config, status)
  • Registered create-agent, get-agent, update-agent, delete-agent as WP Abilities (previously only rename + list were registered)
  • updateAgent() with full validation (status enum, non-empty name, missing ID, not found)
  • 9 new tests

2. REST API

  • POST /agents — create
  • GET /agents/{id} — get single with details
  • PUT /agents/{id} — update name, config, status
  • DELETE /agents/{id} — delete (optional file cleanup)
  • GET /agents/{id}/access — list grants (enriched with user display names)
  • POST /agents/{id}/access — grant access (admin/operator/viewer)
  • DELETE /agents/{id}/access/{user_id} — revoke (owner protected)

3. React — List + Create

  • AgentListTab: WP-style list table with status badges, timestamps
  • CreateAgentModal: slug + name form with validation
  • Delete confirmation dialog
  • API layer (api/agents.js) using shared client
  • TanStack Query hooks reusing AGENTS_KEY for cache sync with AgentSwitcher

4. React — Edit + Access

  • AgentEditView: identity card (name, slug read-only, status dropdown), save with dirty-state tracking
  • AccessPanel: list grants, grant new (user ID + role), revoke with owner protection
  • Metadata display (owner, created/updated timestamps, file status)
  • Tab-switching resets edit view

Architecture

Admin UI (React)                    REST API                     Abilities                  DB
┌──────────────┐    ┌──────────────────────────┐    ┌────────────────────┐    ┌──────────────┐
│ AgentListTab │ -> │ GET    /agents            │ -> │ listAgents()       │ -> │ get_all()    │
│ CreateModal  │ -> │ POST   /agents            │ -> │ createAgent()      │ -> │ create_if_…  │
│ AgentEdit    │ -> │ GET    /agents/{id}       │ -> │ getAgent()         │ -> │ get_agent()  │
│ SaveButton   │ -> │ PUT    /agents/{id}       │ -> │ updateAgent()      │ -> │ update_agent │
│ DeleteBtn    │ -> │ DELETE /agents/{id}       │ -> │ deleteAgent()      │ -> │ delete       │
│ AccessPanel  │ -> │ GET/POST/DELETE /…/access │ -> │ (direct DB)        │ -> │ AgentAccess  │
└──────────────┘    └──────────────────────────┘    └────────────────────┘    └──────────────┘

Test results

854 tests, 0 failures (9 new tests for updateAgent ability)

Closes #605

chubes4 added 4 commits March 9, 2026 17:51
Adds update_agent() to the DB repository (name, config, status) and
registers create-agent, get-agent, update-agent, delete-agent as proper
WP Abilities alongside the existing rename-agent and list-agents.

Previously only rename and list were registered; create/get/delete
existed as static methods but weren't accessible via the Abilities API.
The REST layer (next PR) will call these abilities directly.

- DB: Agents::update_agent() with whitelist of mutable fields
- Abilities: updateAgent() with validation (status enum, non-empty name)
- 9 new tests for updateAgent (name, status, config, multi-field,
  edge cases: missing ID, not found, empty name, invalid status, no fields)
Extends the agents REST controller from a single GET /agents (list)
to full CRUD plus access management endpoints, all delegating to
the abilities layer from PR 1.

Endpoints added:
- POST   /agents                          — create agent
- GET    /agents/{id}                     — get single agent with details
- PUT    /agents/{id}                     — update name, config, status
- DELETE /agents/{id}                     — delete agent (optional file cleanup)
- GET    /agents/{id}/access              — list access grants with user info
- POST   /agents/{id}/access              — grant user access (admin/operator/viewer)
- DELETE /agents/{id}/access/{user_id}    — revoke access (owner protected)

Also enriches the list endpoint output with created_at/updated_at,
and extracts shape_list_item() helper for consistent output formatting.
…nfirmation

Adds a "Manage" tab to the Agent admin page with a WordPress-style
agent list table powered by the REST CRUD endpoints from the previous
commit. Users can now create, view, and delete agents from the browser.

New files:
- api/agents.js: CRUD + access REST functions using shared client
- queries/agents.js: TanStack Query hooks (reuses AGENTS_KEY for
  cache invalidation synced with AgentSwitcher)
- components/AgentListTab.jsx: list table with status badges,
  create modal (slug + name), and delete confirmation dialog

Modified:
- AgentApp.jsx: new "Manage" tab (first position in tab order)
- agent-page.css: styles for list table, status badges, empty state, modal
Clicking an agent name in the list opens a detail view where users can
edit the display name, change status, view metadata, and manage access
grants (grant/revoke with role selection). The owner's access is
protected from revocation.

New files:
- AgentEditView.jsx: detail view with identity card (name, slug,
  status, metadata) + save button with dirty-state tracking
- AccessPanel sub-component: list grants with user info, grant
  new access (user ID + role selector), revoke (owner protected)

Modified:
- AgentApp.jsx: tracks editingAgentId state, conditionally renders
  list vs edit view in the Manage tab, resets on tab switch
- agent-page.css: styles for edit view, identity card, access panel,
  role badges, grant form, and responsive layout
@github-actions
Copy link

github-actions bot commented Mar 9, 2026

Homeboy Results — data-machine

Lint

⚡ Scope: changed files only

lint (changed files only)

  • PHPCS: LINT SUMMARY: 1 errors, 4 warnings
  • Fixable: 1 | Files with issues: 2 of 3
  • PHPStan: PHPSTAN SUMMARY: 207 errors at level 5

Test

⚡ Scope: changed files only

test (changed files only)

  • PHPCS: LINT SUMMARY: 69 errors, 103 warnings
  • Fixable: 144 | Files with issues: 23 of 369
Top violations
  WordPress.Arrays.ArrayDeclarationSpacing.ArrayItemNoNewLine    51
  Generic.Formatting.MultipleStatementAlignment.NotSameWarning    47
  WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned    41
  Universal.Operators.DisallowShortTernary.Found              6
  WordPress.DB.PreparedSQL.NotPrepared                        4
- PHPStan: PHPSTAN SUMMARY: 207 errors at level 5 - OK (581 tests, 1706 assertions)

Audit

⚡ Scope: changed files only

audit (changed files only)

  • Actionable audit summary:
  • Alignment score: 0.763
  • Severity counts: info: 611, unknown: 61, warning: 9
  • Drift increased: no
  • Outliers in current run: 61
  • Parsed outlier entries: 61
  • Top actionable findings:
    1. tests/Unit/Abilities/AgentAbilitiesTest.php — missing_method — Missing method: tear_down
    2. inc/Abilities/AgentAbilities.php — duplicate_function — Duplicate function __construct — also in inc/Abilities/AgentMemoryAbilities.php, inc/Abilities/Analytics/BingWebmasterAbilities.php, inc/Abilities/Analytics/GoogleAnalyticsAbilities.php, inc/Abilities/Analytics/GoogleSearchConsoleAbilities.php, inc/Abilities/Analytics/PageSpeedAbilities.php, inc/Abilities/DailyMemoryAbilities.php, inc/Abilities/Fetch/FetchFilesAbility.php, inc/Abilities/Fetch/FetchRssAbility.php, inc/Abilities/Fetch/FetchWordPressApiAbility.php, inc/Abilities/Fetch/FetchWordPressMediaAbility.php, inc/Abilities/Fetch/GetWordPressPostAbility.php, inc/Abilities/Fetch/GitHubAbilities.php, inc/Abilities/Fetch/QueryWordPressPostsAbility.php, inc/Abilities/File/AgentFileAbilities.php, inc/Abilities/HandlerAbilities.php, inc/Abilities/InternalLinkingAbilities.php, inc/Abilities/LogAbilities.php, inc/Abilities/Media/ImageGenerationAbilities.php, inc/Abilities/Media/ImageTemplateAbilities.php, inc/Abilities/SEO/MetaDescriptionAbilities.php, inc/Abilities/SettingsAbilities.php, inc/Abilities/StepTypeAbilities.php, inc/Abilities/WorkspaceAbilities.php
    3. inc/Api/Agents.php — duplicate_function — Duplicate function register — also in inc/Api/Users.php
    4. inc/Abilities/AgentAbilities.php — intra_method_duplicate — Duplicated block in registerAbilities — 8 identical lines at line 167 and line 248
    5. inc/Abilities/AgentAbilities.php — intra_method_duplicate — Duplicated block in renameAgent — 6 identical lines at line 346 and line 360
Tooling versions
  • Homeboy CLI: homeboy 0.74.0
  • Extension: wordpress from https://github.com/Extra-Chill/homeboy-extensions
  • Extension revision: unknown
  • Action: Extra-Chill/homeboy-action@v1

Homeboy Action v1

@chubes4 chubes4 merged commit df136ac into main Mar 9, 2026
3 checks passed
@chubes4 chubes4 deleted the feature/605-agent-admin-ui branch March 9, 2026 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Admin UI — agent management interface

1 participant