feat(FN-3545): add agent permission policy model and persistence

Introduces a multi-agent permission policy model in `@fusion/core` (types, store persistence, API exposure) with corresponding dashboard UI wiring in the agent onboarding modal and task detail modal, plus a distributed task ID overlap retry mechanism for cluster creation, an inline fast mode toggle

Fusion-Task-Id: FN-3545
This commit is contained in:
Fusion
2026-05-07 11:57:24 -07:00
committed by gsxdsm
parent cc02def488
commit c177a526fc
9 changed files with 415 additions and 4 deletions

View File

@@ -21,6 +21,7 @@ Every first-class editable agent field has a defined create/edit/import/template
| `reportsTo` | ✓ | ✓ | ✓ (from manifest) | Parent agent ID |
| `runtimeConfig` | ✓ | ✓ | ✗ | Heartbeat/budget config |
| `permissions` | ✓ | ✓ | ✗ | Capability flags |
| `permissionPolicy` | ✓ | ✓ | ✗ | Runtime action-gating policy for permanent agents (default/fallback: `unrestricted`) |
| `instructionsPath` | ✓ | ✓ | ✗ | File-backed instructions path |
| `instructionsText` | ✓ | ✓ | ✓ (from manifest `instructionBody`) | Inline instructions |
| `soul` | ✓ | ✓ | ✗ | Personality/identity description |
@@ -40,6 +41,36 @@ Every first-class editable agent field has a defined create/edit/import/template
| `memory` | `memory` | — |
| `skills` | `metadata.skills` | — |
## Permission Policy Presets (Permanent Agents)
`permissionPolicy` is a first-class persisted policy contract for **runtime action gating**, separate from role/capability authorization and separate from dashboard persona presets.
Built-in preset catalog:
- `unrestricted` (default) — all v1 runtime action categories are `allow`
- `approval-required` — all v1 runtime action categories are `require-approval`
- `locked-down` — all v1 runtime action categories are `block`
V1 runtime action categories:
- `git-write`
- `file-write-delete`
- `shell-command`
- `network-api`
- `task-agent-management`
Default and legacy fallback behavior:
- New **non-ephemeral/permanent** agents persist a normalized `permissionPolicy` using preset `unrestricted` when not explicitly provided.
- Legacy permanent-agent rows missing `permissionPolicy` resolve to the same effective `unrestricted` policy at read time (no eager migration required).
- Ephemeral/runtime task-worker agents are intentionally left unchanged and are not backfilled with a default `permissionPolicy`.
Separation of concerns:
- `permissions` capability flags (plus role defaults) determine what an agent is conceptually authorized to do (for example, `tasks:assign`, `agents:create`).
- `permissionPolicy` determines how sensitive runtime actions are gated (`allow`, `block`, `require-approval`) once the capability path is in play.
- Dashboard persona presets (`packages/dashboard/app/components/agent-presets/`) are UI templates for identity/behavior and are **not** the source of truth for permission-policy enforcement.
### System-Managed Fields (Not User-Editable)
These fields are managed by the engine and cannot be directly edited: