fe: proposal preview, per-agent edit, diff-vs-previous, accept-to-roster #1215

Closed
opened 2026-05-15 17:03:20 +00:00 by architect · 1 comment
Collaborator

Context

Part of the Agents Roster AI Assistant feature. The sidebar (#1213) ships the chat and renders raw JSON. This ticket replaces that debug view with the real structured preview, makes every field editable in place, shows a diff against the previous proposal on refinements, and wires the Accept handlers that write the chosen agents into the roster.

Scope

Per-agent card

For each ProposedAgent in the envelope, render a card with editable fields:

  • Name (text input)
  • Role / purpose (text input)
  • System prompt (textarea, monospace)
  • Model tier (select: haiku / sonnet / opus) with the model's model_tier_reason shown beneath
  • Skills (multi-select, options drawn from the catalog snapshot)
  • Tool permissions (allow/deny toggles per tool, with per-grant rationale shown inline; sensitive tools flagged visually)
  • MCP servers (chips; ones with setup_required: true show a "setup needed" badge linking to docs)
  • Rationale (read-only, one line)

Editing a card mutates a local draft copy — the original proposal stays intact in case the operator wants to refine again.

Fleet-level summary

Render ProposalEnvelope.summary above the cards as a short narrative of how the agents work together.

Selection

  • Checkbox per card — default checked
  • "Select all / none" toggle
  • Accept button is disabled when nothing is selected

Diff vs previous proposal

  • When parent_proposal_id is set, fetch the previous envelope from local session state and compute a card-by-card diff
  • Visual treatment:
    • New agent — green border + "new" badge
    • Removed agent — show as a ghost card at the bottom with strike-through + "removed" badge
    • Changed agent — yellow border, with field-level highlighting on changed values
  • A "show changes only" filter collapses unchanged cards

Accept handler

  • For each selected (and edited) agent, write to the existing roster store via the same write path the manual editor uses
  • On success: close the assistant session, dismiss the sidebar, scroll the roster list to surface the newly created agents
  • On partial failure: keep successful writes, surface the failures with a retry per-agent

Catalog drift guard

  • Compare envelope.catalog_hash to current catalog (cheap refetch on accept)
  • If drifted, show a non-blocking warning: "your catalog changed since this proposal was generated — review skill/MCP picks before accepting"

Deliverables

  • Per-agent editable card component
  • Fleet summary header
  • Selection state + select-all/none
  • Diff-vs-previous renderer with new/removed/changed states + filter
  • Accept handler using existing roster write path; partial-failure UX
  • Catalog-drift warning
  • Component tests for: edit doesn't mutate original, diff highlights changed fields, accept writes only selected agents, partial-failure surfaces retries
  • E2E test of the full path: describe → propose → edit one agent → accept → see in roster

Notes for implementer

Reuse the existing manual-agent-editor field components wherever possible. Two divergent editors for the same data shape will rot fast — make the assistant preview a wrapper around the same primitives.


Depends on: #1210 (types), #1213 (sidebar host)
Depended on by: nothing — leaf on the FE side

## Context Part of the **Agents Roster AI Assistant** feature. The sidebar (#1213) ships the chat and renders raw JSON. This ticket replaces that debug view with the real structured preview, makes every field editable in place, shows a diff against the previous proposal on refinements, and wires the **Accept** handlers that write the chosen agents into the roster. ## Scope ### Per-agent card For each `ProposedAgent` in the envelope, render a card with editable fields: - **Name** (text input) - **Role / purpose** (text input) - **System prompt** (textarea, monospace) - **Model tier** (select: haiku / sonnet / opus) with the model's `model_tier_reason` shown beneath - **Skills** (multi-select, options drawn from the catalog snapshot) - **Tool permissions** (allow/deny toggles per tool, with per-grant rationale shown inline; sensitive tools flagged visually) - **MCP servers** (chips; ones with `setup_required: true` show a "setup needed" badge linking to docs) - **Rationale** (read-only, one line) Editing a card mutates a local draft copy — the original proposal stays intact in case the operator wants to refine again. ### Fleet-level summary Render `ProposalEnvelope.summary` above the cards as a short narrative of how the agents work together. ### Selection - Checkbox per card — default checked - "Select all / none" toggle - Accept button is disabled when nothing is selected ### Diff vs previous proposal - When `parent_proposal_id` is set, fetch the previous envelope from local session state and compute a card-by-card diff - Visual treatment: - **New** agent — green border + "new" badge - **Removed** agent — show as a ghost card at the bottom with strike-through + "removed" badge - **Changed** agent — yellow border, with field-level highlighting on changed values - A "show changes only" filter collapses unchanged cards ### Accept handler - For each selected (and edited) agent, write to the existing roster store via the same write path the manual editor uses - On success: close the assistant session, dismiss the sidebar, scroll the roster list to surface the newly created agents - On partial failure: keep successful writes, surface the failures with a retry per-agent ### Catalog drift guard - Compare `envelope.catalog_hash` to current catalog (cheap refetch on accept) - If drifted, show a non-blocking warning: "your catalog changed since this proposal was generated — review skill/MCP picks before accepting" ## Deliverables - [ ] Per-agent editable card component - [ ] Fleet summary header - [ ] Selection state + select-all/none - [ ] Diff-vs-previous renderer with new/removed/changed states + filter - [ ] Accept handler using existing roster write path; partial-failure UX - [ ] Catalog-drift warning - [ ] Component tests for: edit doesn't mutate original, diff highlights changed fields, accept writes only selected agents, partial-failure surfaces retries - [ ] E2E test of the full path: describe → propose → edit one agent → accept → see in roster ## Notes for implementer Reuse the existing manual-agent-editor field components wherever possible. Two divergent editors for the same data shape will rot fast — make the assistant preview a wrapper around the same primitives. --- **Depends on**: #1210 (types), #1213 (sidebar host) **Depended on by**: nothing — leaf on the FE side
Author
Collaborator

🤖 Auto-assigned to code-lead (heuristic: area:dashboard + body 3349 bytes (> 2 KB) — code-lead (heavy)). Reply /unassign to reroute.

🤖 Auto-assigned to **code-lead** (heuristic: area:dashboard + body 3349 bytes (> 2 KB) — code-lead (heavy)). Reply `/unassign` to reroute.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/agent-hooks#1215
No description provided.