@markus-global/cli 0.11.2 → 0.11.3-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/dist/commands/start.js +5 -2
  2. package/dist/commands/start.js.map +1 -1
  3. package/dist/markus.mjs +1254 -1121
  4. package/dist/web-ui/assets/{CommentInput-Cgu8208h.js → CommentInput-C-niUbUY.js} +1 -1
  5. package/dist/web-ui/assets/{ContentRenderer-rzRUDj8T.js → ContentRenderer-DxsnJJRX.js} +2 -2
  6. package/dist/web-ui/assets/{DeliverableShareModal-BvfmqTNG.js → DeliverableShareModal-DV3TiZx0.js} +1 -1
  7. package/dist/web-ui/assets/{Deliverables-DKTLnaF8.js → Deliverables-tlLsJnxZ.js} +1 -1
  8. package/dist/web-ui/assets/{Notifications-CWaO9onn.js → Notifications-4KXYRdkr.js} +1 -1
  9. package/dist/web-ui/assets/{Search-D_C5Eyed.js → Search-CPFwZv1U.js} +1 -1
  10. package/dist/web-ui/assets/{Settings-B5Ib6SFf.js → Settings-DIa-_qre.js} +6 -6
  11. package/dist/web-ui/assets/{Store-D__pfqoc.js → Store-JWjwXfTU.js} +1 -1
  12. package/dist/web-ui/assets/Team-COBxn96h.js +84 -0
  13. package/dist/web-ui/assets/{Work-BJ7kXixx.js → Work-BScJUqWL.js} +1 -1
  14. package/dist/web-ui/assets/{arc-BN0GMYN6.js → arc-DPZmpo1U.js} +1 -1
  15. package/dist/web-ui/assets/{architectureDiagram-3BPJPVTR-BP5Nnl2Y.js → architectureDiagram-3BPJPVTR-DlOs02JO.js} +1 -1
  16. package/dist/web-ui/assets/{blockDiagram-GPEHLZMM-nKHUCU_z.js → blockDiagram-GPEHLZMM-C7qsXNUe.js} +1 -1
  17. package/dist/web-ui/assets/{c4Diagram-AAUBKEIU-DoS0wcHh.js → c4Diagram-AAUBKEIU-Drwp-rtM.js} +1 -1
  18. package/dist/web-ui/assets/channel-DCChB-1T.js +1 -0
  19. package/dist/web-ui/assets/{chunk-2J33WTMH-CP54_XNl.js → chunk-2J33WTMH-VgR09Mqk.js} +1 -1
  20. package/dist/web-ui/assets/{chunk-4BX2VUAB-DMvJaJb7.js → chunk-4BX2VUAB-CuwDpBRL.js} +1 -1
  21. package/dist/web-ui/assets/{chunk-55IACEB6-DQnZgoOO.js → chunk-55IACEB6-nC7YWJ_i.js} +1 -1
  22. package/dist/web-ui/assets/{chunk-727SXJPM-B5_3LI53.js → chunk-727SXJPM-Dw6mBsRE.js} +1 -1
  23. package/dist/web-ui/assets/{chunk-AQP2D5EJ-B5Mh5bI_.js → chunk-AQP2D5EJ-CPhNJbHl.js} +1 -1
  24. package/dist/web-ui/assets/{chunk-FMBD7UC4-mjYTpuBm.js → chunk-FMBD7UC4-AyhQakG8.js} +1 -1
  25. package/dist/web-ui/assets/{chunk-ND2GUHAM-BxTrseJg.js → chunk-ND2GUHAM-DgYemv8I.js} +1 -1
  26. package/dist/web-ui/assets/{chunk-QZHKN3VN-C1do5brE.js → chunk-QZHKN3VN-CLdqxrFB.js} +1 -1
  27. package/dist/web-ui/assets/classDiagram-4FO5ZUOK-CrNiYfSI.js +1 -0
  28. package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-CrNiYfSI.js +1 -0
  29. package/dist/web-ui/assets/{cose-bilkent-S5V4N54A-DMn7aSDK.js → cose-bilkent-S5V4N54A-DrOgwDIH.js} +1 -1
  30. package/dist/web-ui/assets/{dagre-BM42HDAG-CE-tTagY.js → dagre-BM42HDAG-DhoJiA83.js} +1 -1
  31. package/dist/web-ui/assets/{diagram-2AECGRRQ-BwyvxbJa.js → diagram-2AECGRRQ-BDILSgqK.js} +1 -1
  32. package/dist/web-ui/assets/{diagram-5GNKFQAL-Nopndxl0.js → diagram-5GNKFQAL-CeXywd1i.js} +1 -1
  33. package/dist/web-ui/assets/{diagram-KO2AKTUF-CGTjHHnD.js → diagram-KO2AKTUF-Bi4RlMT0.js} +1 -1
  34. package/dist/web-ui/assets/{diagram-LMA3HP47-DhC3AqLA.js → diagram-LMA3HP47-Cw1yxk8b.js} +1 -1
  35. package/dist/web-ui/assets/{diagram-OG6HWLK6-BIuzyWJO.js → diagram-OG6HWLK6-Bl857da2.js} +1 -1
  36. package/dist/web-ui/assets/{docx-preview-ClO_djcO.js → docx-preview-CjoUhrMq.js} +1 -1
  37. package/dist/web-ui/assets/{erDiagram-TEJ5UH35-Nmfi9Wv0.js → erDiagram-TEJ5UH35-DEiaMhuV.js} +1 -1
  38. package/dist/web-ui/assets/{flowDiagram-I6XJVG4X-BVAM5QzO.js → flowDiagram-I6XJVG4X-BgKZhO0h.js} +1 -1
  39. package/dist/web-ui/assets/{ganttDiagram-6RSMTGT7-BGdTbY0A.js → ganttDiagram-6RSMTGT7-Dkx-EaS8.js} +1 -1
  40. package/dist/web-ui/assets/{gitGraphDiagram-PVQCEYII-BMfug5mp.js → gitGraphDiagram-PVQCEYII-DXaQwA0y.js} +1 -1
  41. package/dist/web-ui/assets/{index-1X1Ykov8.js → index-C_QhfMcC.js} +72 -72
  42. package/dist/web-ui/assets/index-DEN_qReg.css +1 -0
  43. package/dist/web-ui/assets/{infoDiagram-5YYISTIA-DAqSLNMU.js → infoDiagram-5YYISTIA-Dpx9IOkx.js} +1 -1
  44. package/dist/web-ui/assets/{ishikawaDiagram-YF4QCWOH-Bro4RrlG.js → ishikawaDiagram-YF4QCWOH-BWqWgitQ.js} +1 -1
  45. package/dist/web-ui/assets/{journeyDiagram-JHISSGLW-CdRHOaID.js → journeyDiagram-JHISSGLW-BBwIZ4k9.js} +1 -1
  46. package/dist/web-ui/assets/{kanban-definition-UN3LZRKU-9iLNl-rB.js → kanban-definition-UN3LZRKU-C_MRWV8R.js} +1 -1
  47. package/dist/web-ui/assets/{mermaid.core-BRHCbDDt.js → mermaid.core-BMAh3nnq.js} +5 -5
  48. package/dist/web-ui/assets/{mindmap-definition-RKZ34NQL-BLm-XQ6W.js → mindmap-definition-RKZ34NQL-B6vJQcat.js} +1 -1
  49. package/dist/web-ui/assets/{pieDiagram-4H26LBE5-ith90T5A.js → pieDiagram-4H26LBE5-BxdEttqt.js} +1 -1
  50. package/dist/web-ui/assets/{quadrantDiagram-W4KKPZXB-Cb08oHG7.js → quadrantDiagram-W4KKPZXB-gsNs2VfP.js} +1 -1
  51. package/dist/web-ui/assets/{requirementDiagram-4Y6WPE33-DzMKi4w8.js → requirementDiagram-4Y6WPE33-BSC9KvC2.js} +1 -1
  52. package/dist/web-ui/assets/{sankeyDiagram-5OEKKPKP-C0Wv4A7m.js → sankeyDiagram-5OEKKPKP-DktAZfe_.js} +1 -1
  53. package/dist/web-ui/assets/{sequenceDiagram-3UESZ5HK-C_HL9WB0.js → sequenceDiagram-3UESZ5HK-BIPt8kGU.js} +1 -1
  54. package/dist/web-ui/assets/{stateDiagram-AJRCARHV-BFfTVEYQ.js → stateDiagram-AJRCARHV-DiXmJWB0.js} +1 -1
  55. package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-COOgTXIX.js +1 -0
  56. package/dist/web-ui/assets/{timeline-definition-PNZ67QCA-cyPnAADn.js → timeline-definition-PNZ67QCA-LRi7H35g.js} +1 -1
  57. package/dist/web-ui/assets/{vennDiagram-CIIHVFJN-Cb82-9OZ.js → vennDiagram-CIIHVFJN-DWQ1I022.js} +1 -1
  58. package/dist/web-ui/assets/{wardley-L42UT6IY-BTW1NXXR.js → wardley-L42UT6IY-BUb6dYqN.js} +1 -1
  59. package/dist/web-ui/assets/{wardleyDiagram-YWT4CUSO-C_F_dT6n.js → wardleyDiagram-YWT4CUSO-BYE1B3xT.js} +1 -1
  60. package/dist/web-ui/assets/{xychartDiagram-2RQKCTM6-clcfplhG.js → xychartDiagram-2RQKCTM6-D-pS2-Sa.js} +1 -1
  61. package/dist/web-ui/index.html +2 -2
  62. package/docs/README.md +93 -0
  63. package/docs/api/api.md +353 -0
  64. package/docs/architecture/agent-runtime.md +341 -0
  65. package/docs/architecture/architecture-fragility.md +184 -0
  66. package/docs/architecture/architecture.md +938 -0
  67. package/docs/architecture/cognitive-architecture.md +322 -0
  68. package/docs/architecture/concurrent-processing.md +550 -0
  69. package/docs/architecture/frontend/team-chat.md +312 -0
  70. package/docs/architecture/learning-loop.md +340 -0
  71. package/docs/architecture/llm-provider-timeouts.md +60 -0
  72. package/docs/architecture/mailbox-system.md +1635 -0
  73. package/docs/architecture/memory-system.md +533 -0
  74. package/docs/architecture/prompt-engineering.md +1377 -0
  75. package/docs/architecture/state-machines.md +665 -0
  76. package/docs/architecture/state-ownership.md +83 -0
  77. package/docs/architecture/streaming-and-reattach.md +193 -0
  78. package/docs/architecture/tool-system.md +266 -0
  79. package/docs/design/deliverable-sharing.md +238 -0
  80. package/docs/guides/coding-tools.md +765 -0
  81. package/docs/guides/community.md +104 -0
  82. package/docs/guides/development.md +179 -0
  83. package/docs/guides/guide.md +362 -0
  84. package/docs/guides/release-and-distribution.md +165 -0
  85. package/docs/guides/remote-access.md +286 -0
  86. package/docs/guides/skill-ecosystem.md +129 -0
  87. package/docs/records/agent-platform-friction-2026-10.md +98 -0
  88. package/docs/records/animation-budget-focus-vs-visibility-2026-10-08.md +110 -0
  89. package/docs/records/audit-fixes-2026-09.md +173 -0
  90. package/docs/records/branch-consolidation.md +597 -0
  91. package/docs/records/file-edit-literal-replacement-fix.md +132 -0
  92. package/docs/records/message-stop-cancel-fix-plan.md +209 -0
  93. package/docs/records/platform-hardening-2026-10.md +1365 -0
  94. package/docs/records/session-identity-plan.md +130 -0
  95. package/docs/records/settings-model-routing-first-visit-fix.md +101 -0
  96. package/docs/records/team-chat-stream-transport-vs-turn-2026-10-08.md +152 -0
  97. package/package.json +2 -1
  98. package/templates/roles/HANDBOOK.md +12 -7
  99. package/dist/web-ui/assets/Team-FFbGLcXj.js +0 -84
  100. package/dist/web-ui/assets/channel-C_kHFvaW.js +0 -1
  101. package/dist/web-ui/assets/classDiagram-4FO5ZUOK-UF2PuXCi.js +0 -1
  102. package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-UF2PuXCi.js +0 -1
  103. package/dist/web-ui/assets/index-3PQIqBtv.css +0 -1
  104. package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-DuO1A2q2.js +0 -1
@@ -0,0 +1,353 @@
1
+ # Markus API Reference
2
+
3
+ Base URL: `http://localhost:8056`
4
+
5
+ All requests require authentication via one of:
6
+ - **JWT Cookie**: `markus_token` (set automatically on login)
7
+ - **Header**: `Authorization: Bearer <token>`
8
+
9
+ ---
10
+
11
+ ## Authentication
12
+
13
+ | Method | Path | Description |
14
+ |--------|------|-------------|
15
+ | POST | `/api/auth/login` | Login, returns JWT Cookie |
16
+ | POST | `/api/auth/logout` | Logout |
17
+ | GET | `/api/auth/me` | Get current user info |
18
+ | POST | `/api/auth/change-password` | Change password |
19
+
20
+ ---
21
+
22
+ ## Agent Management
23
+
24
+ | Method | Path | Description |
25
+ |--------|------|-------------|
26
+ | GET | `/api/agents` | List all agents |
27
+ | POST | `/api/agents` | Hire a new agent `{ name, role, description }` |
28
+ | GET | `/api/agents/:id` | Get agent details |
29
+ | DELETE | `/api/agents/:id` | Fire agent |
30
+ | POST | `/api/agents/:id/start` | Start agent |
31
+ | POST | `/api/agents/:id/stop` | Stop agent |
32
+ | GET | `/api/agents/:id/mind` | Get agent mind state (attention, focus, mailbox, notebook) |
33
+ | POST | `/api/agents/:id/command` | Dispatch slash command to agent |
34
+
35
+ ### POST `/api/agents/:id/command`
36
+
37
+ Dispatch slash commands to an agent.
38
+
39
+ **Body:**
40
+
41
+ ```json
42
+ {
43
+ "command": "goal",
44
+ "args": "Improve test coverage to 80%",
45
+ "senderId": "user-123",
46
+ "senderName": "Alice"
47
+ }
48
+ ```
49
+
50
+ | Field | Type | Required | Description |
51
+ |-------|------|----------|-------------|
52
+ | `command` | string | Yes | Command name (without leading `/`) |
53
+ | `args` | string | No | Command arguments |
54
+ | `senderId` | string | No | Sender user ID (default: `system`) |
55
+ | `senderName` | string | No | Sender display name (default: `User`) |
56
+
57
+ **Supported commands:**
58
+
59
+ | Command | Behavior |
60
+ |---------|----------|
61
+ | `goal` | Creates a goal from `args` (prompts agent to use `goal_create`) |
62
+ | `status` | Returns agent status summary via chat |
63
+ | `notebook` | Returns notebook snapshot directly (no agent round-trip) |
64
+ | `task` | Creates a task from `args` (prompts agent to use `task_create`) |
65
+
66
+ **Response** (most commands):
67
+
68
+ ```json
69
+ { "status": "dispatched", "command": "goal" }
70
+ ```
71
+
72
+ **Response** (`notebook`):
73
+
74
+ ```json
75
+ {
76
+ "status": "ok",
77
+ "notebook": [
78
+ { "key": "current-focus", "text": "...", "updatedAt": 1710000000000, "managed": "agent" }
79
+ ]
80
+ }
81
+ ```
82
+
83
+ ### Agent MindState
84
+
85
+ Returned by `GET /api/agents/:id/mind`. Includes attention state, mailbox depth, queued/deferred items, recent decisions, and:
86
+
87
+ | Field | Type | Description |
88
+ |-------|------|-------------|
89
+ | `notebook` | `NotebookEntry[]` | Persistent cognitive workspace entries |
90
+
91
+ ```typescript
92
+ interface NotebookEntry {
93
+ key: string;
94
+ text: string;
95
+ updatedAt: number;
96
+ managed: string; // "agent" | "system"
97
+ }
98
+ ```
99
+
100
+ ---
101
+
102
+ ## Messages & Conversations
103
+
104
+ | Method | Path | Description |
105
+ |--------|------|-------------|
106
+ | POST | `/api/agents/:id/message` | Send message to agent (SSE streaming) |
107
+ | GET | `/api/agents/:id/sessions` | List an agent's conversation sessions |
108
+ | GET | `/api/sessions/:id/messages` | Get session message history |
109
+ | GET | `/api/channels/:channel/messages` | Get channel history |
110
+ | POST | `/api/channels/:channel/messages` | Send channel message (supports SSE streaming) |
111
+
112
+ ---
113
+
114
+ ## Tasks
115
+
116
+ | Method | Path | Description |
117
+ |--------|------|-------------|
118
+ | GET | `/api/tasks` | List tasks (supports `?status=`, `?assignedAgentId=` filters) |
119
+ | POST | `/api/tasks` | Create task |
120
+ | GET | `/api/taskboard` | Get Kanban board data |
121
+ | PUT | `/api/tasks/:id` | Update task (status, assignedAgentId, or task fields) |
122
+ | POST | `/api/tasks/:id/approve` | Approve a pending task |
123
+ | POST | `/api/tasks/:id/reject` | Reject a pending task |
124
+ | POST | `/api/tasks/:id/cancel` | Cancel a task (body: `{ cascade?: boolean }`) |
125
+ | POST | `/api/tasks/:id/schedule/pause` | Pause a scheduled task's recurring schedule |
126
+ | POST | `/api/tasks/:id/schedule/resume` | Resume a paused scheduled task |
127
+ | POST | `/api/tasks/:id/schedule/run-now` | Trigger an immediate run of a scheduled task |
128
+ | PUT | `/api/tasks/:id/schedule` | Update schedule configuration `{ every?, cron?, maxRuns?, timezone? }` |
129
+ | GET | `/api/tasks/:id/dependents` | Count tasks blocked by this task |
130
+ | POST | `/api/tasks/:id/comments` | Post a comment on a task. Body: `{ content, mentions?, authorId?, authorType?, replyTo? }`. `replyTo` is a comment ID for structural reply linking. |
131
+ | POST | `/api/requirements/:id/comments` | Post a comment on a requirement. Body: `{ content, mentions?, authorId?, authorType?, replyTo? }`. `replyTo` is a comment ID for structural reply linking. |
132
+
133
+ ---
134
+
135
+ ## Teams
136
+
137
+ | Method | Path | Description |
138
+ |--------|------|-------------|
139
+ | GET | `/api/teams` | List teams |
140
+ | POST | `/api/teams` | Create team |
141
+ | PATCH | `/api/teams/:id` | Update team |
142
+ | DELETE | `/api/teams/:id` | Delete team |
143
+
144
+ ---
145
+
146
+ ## Governance & System Control
147
+
148
+ | Method | Path | Description |
149
+ |--------|------|-------------|
150
+ | GET | `/api/system/status` | Global status (paused/emergency mode) |
151
+ | POST | `/api/system/pause-all` | Pause all agents |
152
+ | POST | `/api/system/resume-all` | Resume all agents |
153
+ | POST | `/api/system/emergency-stop` | Emergency stop |
154
+ | GET | `/api/system/storage` | Disk usage: org breakdown + per-agent buckets (see note) |
155
+ | GET | `/api/system/storage/orphans` | Detect orphaned agent/team directories |
156
+ | DELETE | `/api/system/storage/orphans` | Purge orphaned directories (invalidates the storage cache) |
157
+ | GET | `/api/system/announcements` | Get system announcements |
158
+ | POST | `/api/system/announcements` | Create system announcement |
159
+ | GET | `/api/governance/policy` | View governance policy |
160
+ | PUT | `/api/governance/policy` | Update governance policy |
161
+
162
+ > **Reading `/api/system/storage`.** Each `agents[].subItems` entry is a real
163
+ > top-level directory of that agent's home, named as it exists on disk
164
+ > (`sessions`, `workspace`, `tool-outputs`, …) — labels are never rewritten, so a
165
+ > label cannot drift from what it measured. `agents[].size` is the total of the
166
+ > directory, complete in breadth.
167
+ >
168
+ > `size` and every bucket are **depth-bounded** and therefore a **lower bound**,
169
+ > not an exact figure: `agents[].depthLimited` is `true` when the walk hit its cap
170
+ > and bytes were left uncounted. This is deliberate — an unbounded walk of the
171
+ > live org (106 agents) exceeds 60 s, and the handler runs synchronously, so an
172
+ > uncached call would block the event loop (and therefore chat SSE streams) for
173
+ > seconds. Results are cached for 30 s. See `packages/org-manager/src/storage-usage.ts`
174
+ > for the measurements behind the cap.
175
+
176
+ ---
177
+
178
+ ## Projects
179
+
180
+ | Method | Path | Description |
181
+ |--------|------|-------------|
182
+ | GET | `/api/projects` | List projects |
183
+ | POST | `/api/projects` | Create project |
184
+ | GET | `/api/projects/:id` | Get project |
185
+ | PUT | `/api/projects/:id` | Update project |
186
+ | DELETE | `/api/projects/:id` | Delete project |
187
+
188
+ ---
189
+
190
+ ## Delivery & Review
191
+
192
+ | Method | Path | Description |
193
+ |--------|------|-------------|
194
+ | POST | `/api/tasks/:id/accept` | Accept task delivery |
195
+ | POST | `/api/tasks/:id/revision` | Request revision |
196
+ | POST | `/api/tasks/:id/archive` | Archive task |
197
+
198
+ ---
199
+
200
+ ## Reports & Knowledge
201
+
202
+ | Method | Path | Description |
203
+ |--------|------|-------------|
204
+ | GET | `/api/reports` | List reports |
205
+ | POST | `/api/reports/generate` | Trigger report generation |
206
+ | GET | `/api/reports/:id` | Report details |
207
+ | POST | `/api/reports/:id/plan/approve` | Approve plan |
208
+ | POST | `/api/reports/:id/plan/reject` | Reject plan |
209
+ | GET | `/api/reports/:id/feedback` | Get report feedback |
210
+ | POST | `/api/reports/:id/feedback` | Create report feedback |
211
+ | POST | `/api/knowledge` | Contribute knowledge |
212
+ | GET | `/api/knowledge/search` | Search knowledge base |
213
+
214
+ ---
215
+
216
+ ## Users
217
+
218
+ | Method | Path | Description |
219
+ |--------|------|-------------|
220
+ | GET | `/api/users` | List human users (includes `hasJoined` flag) |
221
+ | POST | `/api/users` | Create human user `{ name, email, role }` — returns invite token |
222
+ | PATCH | `/api/users/:id` | Update user (name, role, email) |
223
+ | POST | `/api/users/:id/reset-password` | Admin password reset |
224
+ | POST | `/api/users/:id/reinvite` | Re-issue an invite token — returns `{ inviteToken }` |
225
+ | DELETE | `/api/users/:id` | Delete user |
226
+
227
+ ### Invite Flow
228
+
229
+ | Method | Path | Description |
230
+ |--------|------|-------------|
231
+ | GET | `/api/auth/invite-info?token=<token>` | Validate invite token — returns user info (name, email) |
232
+ | POST | `/api/auth/setup` | Complete registration `{ token, password }` |
233
+
234
+ ---
235
+
236
+ ## Group Chats
237
+
238
+ | Method | Path | Description |
239
+ |--------|------|-------------|
240
+ | GET | `/api/group-chats` | List group chats for current user |
241
+ | POST | `/api/group-chats` | Create custom group chat `{ name, memberIds: [{id, type}] }` |
242
+ | GET | `/api/group-chats/:id` | Get group chat details (includes members) |
243
+ | PATCH | `/api/group-chats/:id` | Update group chat (name, add/remove members) |
244
+ | DELETE | `/api/group-chats/:id` | Delete group chat |
245
+ | POST | `/api/group-chats/:id/members` | Add member `{ userId, userType, userName }` |
246
+ | DELETE | `/api/group-chats/:id/members/:userId` | Remove member |
247
+
248
+ ---
249
+
250
+ ## Notifications
251
+
252
+ | Method | Path | Description |
253
+ |--------|------|-------------|
254
+ | GET | `/api/notifications` | List notifications for current user (supports `?unread=true&limit=N&offset=N&type=T`) |
255
+ | POST | `/api/notifications/:id/read` | Mark a single notification as read |
256
+ | POST | `/api/notifications/mark-all-read` | Mark all notifications as read |
257
+
258
+ ---
259
+
260
+ ## Roles
261
+
262
+ | Method | Path | Description |
263
+ |--------|------|-------------|
264
+ | GET | `/api/roles` | List available role templates |
265
+ | GET | `/api/roles/:name` | Get role template details |
266
+
267
+ ---
268
+
269
+ ## Settings
270
+
271
+ | Method | Path | Description |
272
+ |--------|------|-------------|
273
+ | GET | `/api/settings/agent` | Get agent runtime settings |
274
+ | POST | `/api/settings/agent` | Update agent runtime settings |
275
+
276
+ ### POST `/api/settings/agent`
277
+
278
+ Persists agent settings to `markus.json`.
279
+
280
+ **Body:**
281
+
282
+ ```json
283
+ {
284
+ "maxToolIterations": 25
285
+ }
286
+ ```
287
+
288
+ | Field | Type | Description |
289
+ |-------|------|-------------|
290
+ | `maxToolIterations` | number | Max tool-call loops per agent turn |
291
+
292
+ ---
293
+
294
+ ## Requirements & Goals
295
+
296
+ Requirements may include an optional `goalConfig` when acting as a persistent goal:
297
+
298
+ ```typescript
299
+ interface GoalConfig {
300
+ loopEnabled: boolean;
301
+ completionCriteria: string;
302
+ maxIterations: number;
303
+ currentIteration: number;
304
+ lastCheckedAt: string;
305
+ autoResume: boolean;
306
+ }
307
+ ```
308
+
309
+ | Field | Description |
310
+ |-------|-------------|
311
+ | `loopEnabled` | Heartbeat injects this requirement as an active goal |
312
+ | `completionCriteria` | Natural-language criteria for goal completion |
313
+ | `maxIterations` | Maximum heartbeat check iterations |
314
+ | `currentIteration` | Current iteration count |
315
+ | `lastCheckedAt` | ISO timestamp of last heartbeat check |
316
+ | `autoResume` | Resume goal loop after agent restart |
317
+
318
+ ---
319
+
320
+ ## Health
321
+
322
+ | Method | Path | Description |
323
+ |--------|------|-------------|
324
+ | GET | `/api/health` | Health check (returns `{ status, version, agents }`) |
325
+
326
+ ---
327
+
328
+ ## WebSocket
329
+
330
+ **Connection**: `ws://localhost:8056`
331
+
332
+ | Event | Direction | Description |
333
+ |-------|-----------|-------------|
334
+ | `agent:update` | Server → Client | Agent status change |
335
+ | `agent:mailbox` | Server → Client | New item in agent mailbox |
336
+ | `agent:decision` | Server → Client | Agent attention decision |
337
+ | `agent:focus` | Server → Client | Agent switches focus |
338
+ | `task:update` | Server → Client | Task status update |
339
+ | `task:create` | Server → Client | New task created |
340
+ | `requirement:created` | Server → Client | New requirement proposed |
341
+ | `chat` | Server → Client | Agent message in channel |
342
+ | `task:comment` | Server → Client | New task comment (includes `replyTo`, `replyToAuthor`, `replyToContent` for reply-linked comments) |
343
+ | `requirement:comment` | Server → Client | New requirement comment (includes `replyTo`, `replyToAuthor`, `replyToContent`) |
344
+ | `chat:message` | Server → Client | Channel/DM/group message (targeted to members; includes `replyToId`, `replyToSender`, `replyToText` for reply-linked messages) |
345
+ | `chat:proactive_message` | Server → Client | Agent activity log or proactive message |
346
+ | `chat:group_created` | Server → Client | Group chat created |
347
+ | `chat:group_updated` | Server → Client | Group chat membership changed |
348
+ | `chat:group_deleted` | Server → Client | Group chat deleted |
349
+ | `notification` | Server → Client (targeted) | User notification (targeted by userId) |
350
+ | `system:announcement` | Server → Client | System announcement broadcast |
351
+ | `system:pause-all` | Server → Client | Global pause event |
352
+ | `system:resume-all` | Server → Client | Global resume event |
353
+ | `system:emergency-stop` | Server → Client | Emergency stop event |