Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"php tests/authorization-smoke.php",
"php tests/autonomous-capability-ceiling-smoke.php",
"php tests/agents-access-ability-smoke.php",
"php tests/agents-access-write-ability-smoke.php",
"php tests/agents-conversation-session-abilities-smoke.php",
"php tests/conversation-session-authz-smoke.php",
"php tests/conversation-session-store-contract-smoke.php",
Expand Down
14 changes: 14 additions & 0 deletions docs/auth-consent-context-memory.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,20 @@ raw bearer token

`WP_Agent_Access_Grant` models a role-based grant between a WordPress user and an agent. Roles are ordered from lowest to highest privilege: `viewer`, `operator`, `admin`. `role_meets()` compares a grant with a required role. Concrete stores implement `WP_Agent_Access_Store`.

### Agent access abilities

The access model is exposed as Abilities API abilities (category `agents-api`, `show_in_rest: true`). Authorization uses the agent-role model, not WordPress capabilities: every ability requires the current request principal to hold a grant on the target agent at or above a minimum role, filtered through the `agents_access_permission` hook.

| Ability | Min role | Input | Output | Annotations |
| --- | --- | --- | --- | --- |
| `agents/can-access-agent` | any (requested) | `{ agent, minimum_role?, workspace_id?, client_id? }` | `{ allowed, agent, minimum_role }` | idempotent |
| `agents/list-accessible-agents` | any (requested) | `{ minimum_role?, workspace_id?, client_id? }` | `{ agents: [...] }` | idempotent |
| `agents/grant-agent-access` | `admin` | `{ agent, user_id, role? (default viewer), workspace_id?, metadata? }` | `{ granted, grant }` | idempotent (stores upsert) |
| `agents/revoke-agent-access` | `admin` | `{ agent, user_id, workspace_id? }` | `{ revoked }` | destructive |
| `agents/list-agent-users` | `operator` | `{ agent, workspace_id? }` | `{ users: [grant] }` | idempotent, readonly |

Write abilities return `WP_Error` for an unknown agent, an invalid role or user id, a missing access store, and — for revocation — `agents_access_last_admin` when the revoke would remove the agent's last remaining `admin` grant. A grant export shape is `{ grant_id, agent_id, user_id, role, workspace_id, granted_by_user_id, granted_at, metadata, audience_id }`.

`WP_Agent_Capability_Ceiling` intersects token/client restrictions with a user's WordPress capabilities. `WP_Agent_WordPress_Authorization_Policy` denies unless the ceiling allows the requested capability and `user_can()` allows it for the acting/owner user.

## Caller context headers
Expand Down
Loading