mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-22 17:49:48 +02:00
* feat(issues): per-issue metadata KV (MUL-2017)
Adds a small JSONB KV map to every issue for agent pipeline state (attempts,
PR number, pipeline status, ...). Keys match a narrow regex, values are
primitives (string / number / bool), capped at 50 keys per issue and 8KB
per blob. Defense-in-depth via two CHECK constraints (object shape + size).
All mutations are single-key atomic (jsonb_set / `- key`). `UpdateIssue`
intentionally does NOT touch metadata: a whole-blob overwrite would race
with concurrent agent writes.
GET /api/issues/:id/metadata
PUT /api/issues/:id/metadata/:key body: { "value": <primitive> }
DELETE /api/issues/:id/metadata/:key
Containment filter on list: GET /api/issues?metadata=<json-object> uses
PG `@>` against a `jsonb_path_ops` GIN index. Mirrored across ListIssues,
CountIssues, ListOpenIssues, and the hand-rolled ListGroupedIssues SQL so
CLI/API and UI grouped views stay consistent.
CLI: multica issue metadata {list,get,set,delete}
multica issue list --metadata key=value (repeatable, AND)
set has --type to override the default value-sniffing
Co-authored-by: multica-agent <github@multica.ai>
* fix(issues): metadata test bugs + wire realtime + read-only display (MUL-2017)
- Fix two failing handler tests blocking backend CI:
- reset decode target after delete so map merge does not mask removal
- url.PathEscape the key segment so spaces no longer panic NewRequest
- Wire issue_metadata:changed end to end so the detail / list / my-issues
caches stay in sync with set/delete events (other tabs, CLI writes).
- Add a read-only Metadata strip to the issue detail sidebar; hidden when
the issue has no keys so it stays quiet in the common case.
Co-authored-by: multica-agent <github@multica.ai>
* feat(runtime): teach agents to read/write issue metadata (MUL-2017)
Add an `## Issue Metadata` section to the runtime brief plus a
`metadata list` step on entry and a `metadata set`/`delete` step on
exit. Section only emits when the task carries an issue id (comment- or
assignment-triggered); chat / quick-create / run-only autopilot stay
clean so they don't fire failing CLI calls.
Co-authored-by: multica-agent <github@multica.ai>
* fix(issues): bump metadata migration to 105 and drop attempts as example (MUL-2017)
main is now at 104_drop_runtime_timezone; the migrator picks
LatestVersion() by sorted filename, so a slot before the tail would
let DBs that have already run 099–104 think they're up-to-date while
the issue.metadata column is missing — runtime would then fail with
column does not exist. Renumbering to 105 puts the migration at the
tail and forces it to run.
Also drop attempts as a positive example across docs/code comments and
test fixtures — the runtime instruction prompt already lists it under
"What NOT to pin" (runtime bookkeeping). Replace with pr_number, which
is in the recommended-keys set, so docs/tests speak the same language
as the prompt.
Co-authored-by: multica-agent <github@multica.ai>
---------
Co-authored-by: multica-agent <github@multica.ai>
125 lines
4.4 KiB
Go
125 lines
4.4 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"
|
|
EventIssueMetadataChanged = "issue_metadata:changed"
|
|
|
|
// 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"
|
|
)
|