multica/apps/web/components/common
LinYushen 09764c5f51
feat(agent): replace hard delete with archive/restore (#346)
* feat(agent): replace hard delete with archive/restore

Replace agent deletion with soft archive pattern. Archived agents
are preserved in the database with all historical references intact
but cannot be assigned, mentioned, or trigger tasks.

Backend:
- Add archived_at/archived_by columns to agent table (migration 031)
- Replace DELETE /api/agents/{id} with POST /api/agents/{id}/archive
- Add POST /api/agents/{id}/restore endpoint
- ListAgents excludes archived by default (?include_archived=true to include)
- Skip archived agents in task triggers (on_assign, on_comment, on_mention)
- Block assignment to archived agents
- Cancel pending tasks on archive
- New events: agent:archived, agent:restored (replacing agent:deleted)

Frontend:
- Agent type includes archived_at/archived_by fields
- Mention autocomplete and assignee picker filter out archived agents
- Agent list shows archived agents with muted styling
- Agent detail shows archive banner with restore button
- Delete button replaced with Archive button and updated confirmation dialog
- API client: archiveAgent/restoreAgent replace deleteAgent

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(agent): self-review fixes for archive feature

- Fix: workspace store now fetches agents with include_archived=true
  so archived agents are actually visible in the frontend (the archived
  UI was dead code before — ListAgents excludes archived by default)
- Fix: add error logging for CancelAgentTasksByAgent in ArchiveAgent
- Fix: add idempotency guards — return 409 Conflict when archiving
  an already-archived agent or restoring a non-archived agent
- Fix: revert unnecessary extra GetAgent query in ReconcileAgentStatus
  (archived agents won't have running tasks after CancelAgentTasksByAgent)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 17:33:52 +08:00
..
actor-avatar.tsx refactor(web): unify all avatar rendering with ActorAvatar 2026-04-01 16:58:43 +08:00
code-block-view.tsx feat(ui): editor UX improvements — lowlight, upload, emoji, comment editing 2026-03-31 18:37:53 +08:00
emoji-picker.tsx feat(reactions): add emoji reactions for comments and issue descriptions 2026-03-30 22:37:59 +08:00
file-upload-button.tsx feat(ui): editor UX improvements — lowlight, upload, emoji, comment editing 2026-03-31 18:37:53 +08:00
mention-extension.ts feat(editor): unify Tiptap editor for editing and readonly display 2026-04-02 16:35:52 +08:00
mention-hover-card.tsx feat(mentions): support @all to mention all workspace members 2026-04-01 20:58:33 +08:00
mention-suggestion.tsx feat(agent): replace hard delete with archive/restore (#346) 2026-04-02 17:33:52 +08:00
mention-view.tsx feat(editor): unify Tiptap editor for editing and readonly display 2026-04-02 16:35:52 +08:00
quick-emoji-picker.tsx feat(ui): editor UX improvements — lowlight, upload, emoji, comment editing 2026-03-31 18:37:53 +08:00
reaction-bar.tsx feat(ui): editor UX improvements — lowlight, upload, emoji, comment editing 2026-03-31 18:37:53 +08:00
readonly-editor.tsx feat(editor): unify Tiptap editor for editing and readonly display 2026-04-02 16:35:52 +08:00
rich-text-editor.css fix(editor): use ProseMirror schema for image upload state 2026-04-02 16:36:59 +08:00
rich-text-editor.tsx fix(editor): prevent link mark from sticking to cursor 2026-04-02 16:59:20 +08:00
title-editor.css feat(editor): add TitleEditor component, replace <input> for issue titles 2026-03-31 15:38:42 +08:00
title-editor.tsx fix(web): delay TitleEditor autofocus to avoid Dialog animation conflict 2026-04-01 14:15:31 +08:00