mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-12 20:29:10 +02:00
* feat: implement Squad feature MVP
- Add migration 084_squad: squad, squad_member, squad_activity_log tables
- Extend issue.assignee_type to support 'squad'
- Add sqlc queries for squad CRUD, member management, activity logs
- Add Go handler with full Squad API (CRUD, members, activity log)
- Register routes: /api/squads/*, /api/issues/{id}/squad-activity, /api/squad-activity
- Add Squad trigger logic:
- Assign Squad immediately triggers leader
- Every external comment on squad-assigned issue triggers leader
- Anti-loop: squad members' comments don't trigger leader
- Dedup: skip if leader already has pending task
- Add squad activity log API (方案 B) for leader no-op recording
- Add frontend TypeScript types (Squad, SquadMember, SquadActivityLog)
- Add protocol events: squad:created, squad:updated, squad:deleted
Co-authored-by: multica-agent <github@multica.ai>
* fix: address PR review blocking issues
1. validateAssigneePair now accepts 'squad' assignee_type
2. All squad endpoints validate workspace ownership via GetSquadInWorkspace
3. CreateSquadActivityLog restricted to squad leader agent only
4. AddSquadMember validates member exists in workspace
5. UpdateSquad auto-adds new leader to squad members
6. DeleteSquad transfers assigned issues to leader before deletion
7. IssueAssigneeType includes 'squad' in frontend types
Co-authored-by: multica-agent <github@multica.ai>
* feat: soft-delete squads via archive instead of hard delete
- Add migration 085: archived_at + archived_by columns on squad table
- ListSquads now excludes archived squads (ListAllSquads for admin)
- DeleteSquad → ArchiveSquad (sets archived_at, preserves all records)
- Transfer squad-assigned issues to leader before archiving
- SquadResponse includes archived_at/archived_by fields
- Frontend Squad type updated with nullable archived fields
Co-authored-by: multica-agent <github@multica.ai>
* feat: re-add Squads frontend entry (sidebar nav + pages)
Re-applies the frontend squad entry that was lost during a merge:
- Sidebar nav: Squads item with Users icon
- Paths: squads() and squadDetail() in workspace paths
- Routes: /squads and /squads/[id] pages
- Views: SquadsPage (list) and SquadDetailPage
- i18n: en 'Squads' / zh '小队'
- Reserved slug: 'squads'
Co-authored-by: multica-agent <github@multica.ai>
* fix: fix SquadsPage rendering - use PageHeader children pattern
PageHeader takes children, not title/actions props. The incorrect
usage caused a React rendering error. Now matches the pattern used
by autopilots and agents pages.
Co-authored-by: multica-agent <github@multica.ai>
* fix(squads): add API client methods and package export for squads pages
* feat: complete Squad frontend - create dialog, member management, API methods
- Add CreateSquadModal with name/description/leader selection
- Register 'create-squad' in modal registry
- Wire 'New Squad' button to open the modal
- Add full API client methods: createSquad, updateSquad, deleteSquad,
addSquadMember, removeSquadMember
- Rewrite SquadDetailPage with:
- Member list showing resolved names
- Add/remove member UI
- Archive squad button
- Back navigation to squads list
Co-authored-by: multica-agent <github@multica.ai>
* feat: improve Squad UI - match create agent dialog style
- CreateSquadModal: proper Dialog with Header/Description/Footer,
agent picker with avatars, textarea for description
- SquadDetailPage: centered max-w-2xl layout, ActorAvatar for members,
Crown badge for leader, textarea for member description,
improved spacing and visual hierarchy
- Renamed 'role' field label to 'Description' in add member form
(describes the member's responsibilities in the squad)
Co-authored-by: multica-agent <github@multica.ai>
* feat(squad): add avatar, instructions; drop unique-name constraint
- 086: add squad.avatar_url
- 087: drop unique constraint on squad.name (squads with the same
name are legitimate across teams; uniqueness was an accidental
product constraint)
- 088: add squad.instructions (text, default '')
- UpdateSquad now COALESCEs avatar_url + instructions
- handler exposes Instructions in SquadResponse and accepts it in
UpdateSquad
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* feat(squad): assignable + mention target; trigger leader on assign
- assignee picker and @mention suggestion list squads alongside
agents and members; renders squad avatar/icon
- creating or updating an issue with assignee_type=squad enqueues
a task for the squad's current leader (mirrors agent-assignee
parking-lot rule: skip backlog only)
- workspace queries/hooks expose squads where needed for the
pickers
- locales updated for new picker copy
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* feat(squad): agent-style detail page with members + instructions tabs
- restructure squad detail page to mirror the agent detail page:
320px inspector (creator, leader, created/updated) + tabbed
pane (Members | Instructions) with dirty-guard AlertDialog
- inline name + avatar editing on the inspector
- inline description editor (modal textarea)
- members tab: leader + member picker with role descriptions,
swap leader, edit member roles, remove
- instructions tab: ContentEditor + Save (mirrors agent pattern)
- squads list shows the squad avatar/icon
- core types + api.updateSquad accept avatar_url + instructions
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* feat(squad): inject leader briefing on claim (protocol + roster + instructions)
When a squad's leader agent claims a task on a squad-assigned issue,
append a system-level briefing to the agent's Instructions composed of:
1. Squad Operating Protocol — hard-coded rules: leader is a
coordinator, dispatch via @mention, stop after dispatching,
resume on re-trigger, do not work outside the roster.
2. Squad Roster — leader self-row plus one row per non-archived
member with a literal mention markdown string ([@Name](mention://
agent|member/<UUID>)) the leader can paste verbatim. Round-trips
through util.ParseMentions, enforced by a contract test.
3. Squad Instructions — the user-defined squad.instructions block,
omitted entirely when empty so we do not leave a dangling heading.
Non-leader members claiming the same issue receive no briefing.
Tests cover: full squad with mixed agent/human members, lone leader,
archived agents skipped, empty user instructions, mention round-trip,
and the leader/non-leader claim-handler gate.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix(squad): tell leader not to restate issue context in dispatch comment
After observing leaders padding their delegation comments with full
re-summaries of the issue body and prior discussion, make the
Operating Protocol explicit:
- assignees on Multica already have the full issue (title,
description, all comments, attachments) and workspace context;
- delegation comments should add only what cannot be inferred
(who is picked, why, extra constraints), aim for two or three
sentences;
- restating context is now an explicit hard rule violation.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* feat(squad): unify leader evaluation into activity_log, add CLI command
- Squad member comments now trigger leader (only leader self-excluded)
- Replace squad_activity_log with activity_log (action: squad_leader_evaluated)
- Add CLI: multica squad activity <issue-id> <outcome> --reason
- Add API: POST /api/issues/{id}/squad-evaluated
- Update squad operating protocol to require evaluation recording
- Remove squad_activity_log table from schema and generated code
* feat(cli): add squad list, get, member list commands
* fix(squad): address review findings (P1+P2)
P1 fixes:
- Add 'squads' to reserved_slugs.json (source of truth)
- Add 'create-squad' to ModalType union
- Remove unused leaderOpen/selectedLeader in create-squad modal
- Replace literal JSX strings with i18n selectors (en + zh-Hans)
P2 fixes:
- Add 'squad' to mention regex (MentionRe)
- Fix human member lookup in squad briefing (use GetUser directly)
- Add squads routes to desktop app
- Add squad:created/updated/deleted to WSEventType + invalidation
- Reject archived squads as issue assignees
* fix(squad): restore zh-Hans key, publish activity event, invalidate issues on archive
- Restore create_project.title in zh-Hans modals.json (dropped by prior edit)
- Publish activity:created WS event after squad leader evaluation
- Invalidate issue queries on squad:deleted (archive transfers assignees)
- Add creator info to squad list cards
* fix(squad): realtime sync, rerun support, leader validation
- Use workspaceKeys.squads prefix for detail/member queries (realtime invalidation)
- Publish squad:updated after add/remove/role-change member mutations
- Support rerun for squad-assigned issues (targets leader agent)
- Reject assignment to squads whose leader is archived
---------
Co-authored-by: multica-agent <github@multica.ai>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
124 lines
4.3 KiB
Go
124 lines
4.3 KiB
Go
package protocol
|
|
|
|
// Event types for WebSocket communication between server, web clients, and daemon.
|
|
const (
|
|
// Issue events
|
|
EventIssueCreated = "issue:created"
|
|
EventIssueUpdated = "issue:updated"
|
|
EventIssueDeleted = "issue:deleted"
|
|
|
|
// Comment events
|
|
EventCommentCreated = "comment:created"
|
|
EventCommentUpdated = "comment:updated"
|
|
EventCommentDeleted = "comment:deleted"
|
|
EventCommentResolved = "comment:resolved"
|
|
EventCommentUnresolved = "comment:unresolved"
|
|
EventReactionAdded = "reaction:added"
|
|
EventReactionRemoved = "reaction:removed"
|
|
EventIssueReactionAdded = "issue_reaction:added"
|
|
EventIssueReactionRemoved = "issue_reaction:removed"
|
|
|
|
// Agent events
|
|
EventAgentStatus = "agent:status"
|
|
EventAgentCreated = "agent:created"
|
|
EventAgentArchived = "agent:archived"
|
|
EventAgentRestored = "agent:restored"
|
|
|
|
// Task events (server <-> daemon).
|
|
// Each event maps to a status transition on agent_task_queue. Front-end
|
|
// subscribes by `task:` prefix and invalidates the workspace task
|
|
// snapshot, so the granularity here is "what does the user want to see
|
|
// change" — not "every internal status flip".
|
|
EventTaskQueued = "task:queued" // ∅ → queued (enqueue / retry create)
|
|
EventTaskDispatch = "task:dispatch" // queued → dispatched (daemon claim)
|
|
EventTaskProgress = "task:progress"
|
|
EventTaskCompleted = "task:completed" // running → completed
|
|
EventTaskFailed = "task:failed" // running → failed
|
|
EventTaskMessage = "task:message"
|
|
EventTaskCancelled = "task:cancelled" // * → cancelled
|
|
|
|
// Inbox events
|
|
EventInboxNew = "inbox:new"
|
|
EventInboxRead = "inbox:read"
|
|
EventInboxArchived = "inbox:archived"
|
|
EventInboxBatchRead = "inbox:batch-read"
|
|
EventInboxBatchArchived = "inbox:batch-archived"
|
|
|
|
// Workspace events
|
|
EventWorkspaceUpdated = "workspace:updated"
|
|
EventWorkspaceDeleted = "workspace:deleted"
|
|
|
|
// Member events
|
|
EventMemberAdded = "member:added"
|
|
EventMemberUpdated = "member:updated"
|
|
EventMemberRemoved = "member:removed"
|
|
|
|
// Subscriber events
|
|
EventSubscriberAdded = "subscriber:added"
|
|
EventSubscriberRemoved = "subscriber:removed"
|
|
|
|
// Activity events
|
|
EventActivityCreated = "activity:created"
|
|
|
|
// Skill events
|
|
EventSkillCreated = "skill:created"
|
|
EventSkillUpdated = "skill:updated"
|
|
EventSkillDeleted = "skill:deleted"
|
|
|
|
// Chat events
|
|
EventChatMessage = "chat:message"
|
|
EventChatDone = "chat:done"
|
|
EventChatSessionRead = "chat:session_read"
|
|
EventChatSessionDeleted = "chat:session_deleted"
|
|
EventChatSessionUpdated = "chat:session_updated"
|
|
|
|
// Project events
|
|
EventProjectCreated = "project:created"
|
|
EventProjectUpdated = "project:updated"
|
|
EventProjectDeleted = "project:deleted"
|
|
EventProjectResourceCreated = "project_resource:created"
|
|
EventProjectResourceDeleted = "project_resource:deleted"
|
|
|
|
// Label events
|
|
EventLabelCreated = "label:created"
|
|
EventLabelUpdated = "label:updated"
|
|
EventLabelDeleted = "label:deleted"
|
|
EventIssueLabelsChanged = "issue_labels:changed"
|
|
|
|
// Pin events
|
|
EventPinCreated = "pin:created"
|
|
EventPinDeleted = "pin:deleted"
|
|
EventPinReordered = "pin:reordered"
|
|
|
|
// Invitation events
|
|
EventInvitationCreated = "invitation:created"
|
|
EventInvitationAccepted = "invitation:accepted"
|
|
EventInvitationDeclined = "invitation:declined"
|
|
EventInvitationRevoked = "invitation:revoked"
|
|
|
|
// Autopilot events
|
|
EventAutopilotCreated = "autopilot:created"
|
|
EventAutopilotUpdated = "autopilot:updated"
|
|
EventAutopilotDeleted = "autopilot:deleted"
|
|
EventAutopilotRunStart = "autopilot:run_start"
|
|
EventAutopilotRunDone = "autopilot:run_done"
|
|
|
|
// Squad events
|
|
EventSquadCreated = "squad:created"
|
|
EventSquadUpdated = "squad:updated"
|
|
EventSquadDeleted = "squad:deleted"
|
|
|
|
// Daemon events
|
|
EventDaemonHeartbeat = "daemon:heartbeat"
|
|
EventDaemonHeartbeatAck = "daemon:heartbeat_ack"
|
|
EventDaemonRegister = "daemon:register"
|
|
EventDaemonTaskAvailable = "daemon:task_available"
|
|
|
|
// GitHub integration events
|
|
EventGitHubInstallationCreated = "github_installation:created"
|
|
EventGitHubInstallationDeleted = "github_installation:deleted"
|
|
EventPullRequestLinked = "pull_request:linked"
|
|
EventPullRequestUpdated = "pull_request:updated"
|
|
EventPullRequestUnlinked = "pull_request:unlinked"
|
|
)
|