feat(#605): Admin UI — agent management interface#772
Merged
Conversation
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
Homeboy Results —
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)create-agent,get-agent,update-agent,delete-agentas WP Abilities (previously only rename + list were registered)updateAgent()with full validation (status enum, non-empty name, missing ID, not found)2. REST API
POST /agents— createGET /agents/{id}— get single with detailsPUT /agents/{id}— update name, config, statusDELETE /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
api/agents.js) using shared clientAGENTS_KEYfor cache sync with AgentSwitcher4. React — Edit + Access
Architecture
Test results
854 tests, 0 failures (9 new tests for updateAgent ability)
Closes #605