@markus-global/cli 0.12.4 → 0.12.5-rc.1

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 (159) hide show
  1. package/dist/background-maintenance.d.ts +25 -0
  2. package/dist/background-maintenance.d.ts.map +1 -1
  3. package/dist/background-maintenance.js +61 -0
  4. package/dist/background-maintenance.js.map +1 -1
  5. package/dist/commands/im-inbound-origin.d.ts +38 -0
  6. package/dist/commands/im-inbound-origin.d.ts.map +1 -0
  7. package/dist/commands/im-inbound-origin.js +48 -0
  8. package/dist/commands/im-inbound-origin.js.map +1 -0
  9. package/dist/commands/start.d.ts.map +1 -1
  10. package/dist/commands/start.js +211 -46
  11. package/dist/commands/start.js.map +1 -1
  12. package/dist/markus.mjs +18520 -9886
  13. package/dist/web-ui/assets/{AsyncState-BTLUPIr1.js → AsyncState-fJJNUOXK.js} +1 -1
  14. package/dist/web-ui/assets/ChatComponents-S7d2CAAU.js +14 -0
  15. package/dist/web-ui/assets/{ContentRenderer-BZXRiKE3.js → ContentRenderer-DWqhC0uq.js} +6 -6
  16. package/dist/web-ui/assets/DeliverableShareModal-B7DwzEnt.js +1 -0
  17. package/dist/web-ui/assets/{Deliverables-3Y3zjT_1.js → Deliverables-CueBYYpx.js} +2 -2
  18. package/dist/web-ui/assets/MarkdownMessage-D8BsJzvD.js +4 -0
  19. package/dist/web-ui/assets/{Search-BI3hk-5j.js → Search-CaYXz3u-.js} +1 -1
  20. package/dist/web-ui/assets/{SendToChat-D_5zHO-k.js → SendToChat-_9sm7UBY.js} +1 -1
  21. package/dist/web-ui/assets/Settings-DTL14pY8.js +8 -0
  22. package/dist/web-ui/assets/{Store-B8ksRjHF.js → Store-DpGqUMS2.js} +1 -1
  23. package/dist/web-ui/assets/Switch-NYQTn8wl.js +1 -0
  24. package/dist/web-ui/assets/Team-DB-JytPl.js +93 -0
  25. package/dist/web-ui/assets/Work-sQq-gy3S.js +142 -0
  26. package/dist/web-ui/assets/{arc-VmvI7TpW.js → arc-JtkmqkSR.js} +1 -1
  27. package/dist/web-ui/assets/{architectureDiagram-3BPJPVTR-CTUtPasm.js → architectureDiagram-3BPJPVTR-B8zM5fky.js} +1 -1
  28. package/dist/web-ui/assets/{blockDiagram-GPEHLZMM-xeYAqtZJ.js → blockDiagram-GPEHLZMM-BQgjaOcE.js} +1 -1
  29. package/dist/web-ui/assets/{c4Diagram-AAUBKEIU-BiFgoGY5.js → c4Diagram-AAUBKEIU-BnZvYRwj.js} +1 -1
  30. package/dist/web-ui/assets/channel-Zno2q8Ba.js +1 -0
  31. package/dist/web-ui/assets/{chunk-2J33WTMH-DueHBqOn.js → chunk-2J33WTMH-KONx1qvt.js} +1 -1
  32. package/dist/web-ui/assets/{chunk-4BX2VUAB-B8zgDfSV.js → chunk-4BX2VUAB-BqkxAkWs.js} +1 -1
  33. package/dist/web-ui/assets/{chunk-55IACEB6-DieD55CP.js → chunk-55IACEB6-DxLiTj85.js} +1 -1
  34. package/dist/web-ui/assets/{chunk-727SXJPM-Do4Z9LQ0.js → chunk-727SXJPM-Dhj-9NIs.js} +1 -1
  35. package/dist/web-ui/assets/{chunk-AQP2D5EJ-qrYsW5ml.js → chunk-AQP2D5EJ-M1vQ4YYc.js} +1 -1
  36. package/dist/web-ui/assets/{chunk-FMBD7UC4-BSz3QT1q.js → chunk-FMBD7UC4-DaXv58SH.js} +1 -1
  37. package/dist/web-ui/assets/{chunk-ND2GUHAM-utDWSydt.js → chunk-ND2GUHAM-Brkz9FCu.js} +1 -1
  38. package/dist/web-ui/assets/{chunk-QZHKN3VN-Cd86CYHV.js → chunk-QZHKN3VN-DIsEGiBf.js} +1 -1
  39. package/dist/web-ui/assets/classDiagram-4FO5ZUOK-hI59DDUw.js +1 -0
  40. package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-hI59DDUw.js +1 -0
  41. package/dist/web-ui/assets/{cose-bilkent-S5V4N54A-Dc6cP9WW.js → cose-bilkent-S5V4N54A-CSjC_YL5.js} +1 -1
  42. package/dist/web-ui/assets/{dagre-BM42HDAG-4b0Wf_6D.js → dagre-BM42HDAG-BevSxaQN.js} +1 -1
  43. package/dist/web-ui/assets/{diagram-2AECGRRQ-zS_j1Kf4.js → diagram-2AECGRRQ-CT3Hj8jy.js} +1 -1
  44. package/dist/web-ui/assets/{diagram-5GNKFQAL-CPo-_Ime.js → diagram-5GNKFQAL-CAebHy6q.js} +1 -1
  45. package/dist/web-ui/assets/{diagram-KO2AKTUF-CjHOA4_j.js → diagram-KO2AKTUF-BvRWS7BX.js} +1 -1
  46. package/dist/web-ui/assets/{diagram-LMA3HP47-CalZRF6K.js → diagram-LMA3HP47-gR9HBKc4.js} +1 -1
  47. package/dist/web-ui/assets/{diagram-OG6HWLK6-DnLAhsLX.js → diagram-OG6HWLK6-B5HGsfNo.js} +1 -1
  48. package/dist/web-ui/assets/{docx-preview-uRVPnxwM.js → docx-preview-pRjmDg6F.js} +1 -1
  49. package/dist/web-ui/assets/{erDiagram-TEJ5UH35-L0nzlMSn.js → erDiagram-TEJ5UH35-mrPW01aQ.js} +1 -1
  50. package/dist/web-ui/assets/{flowDiagram-I6XJVG4X-Bdc3UwtW.js → flowDiagram-I6XJVG4X-BrZ1G-Tt.js} +1 -1
  51. package/dist/web-ui/assets/{ganttDiagram-6RSMTGT7-CFRmj_qc.js → ganttDiagram-6RSMTGT7-Dq_5mate.js} +1 -1
  52. package/dist/web-ui/assets/{gitGraphDiagram-PVQCEYII-B5hZwcoJ.js → gitGraphDiagram-PVQCEYII-Cb3yTWUy.js} +1 -1
  53. package/dist/web-ui/assets/index-9SXWNIl0.css +1 -0
  54. package/dist/web-ui/assets/index-Bco6UnT7.js +867 -0
  55. package/dist/web-ui/assets/{infoDiagram-5YYISTIA-DVT4RgPd.js → infoDiagram-5YYISTIA-CcnNlnvs.js} +1 -1
  56. package/dist/web-ui/assets/{ishikawaDiagram-YF4QCWOH-Bf7pvUY_.js → ishikawaDiagram-YF4QCWOH-BqHTPtO1.js} +1 -1
  57. package/dist/web-ui/assets/{journeyDiagram-JHISSGLW-NVRjJlnd.js → journeyDiagram-JHISSGLW-DKBB9B-C.js} +1 -1
  58. package/dist/web-ui/assets/{kanban-definition-UN3LZRKU-Co7BKMut.js → kanban-definition-UN3LZRKU-BVO5tbNl.js} +1 -1
  59. package/dist/web-ui/assets/{mermaid.core-CCf28Hq6.js → mermaid.core-bMoKRCj4.js} +5 -5
  60. package/dist/web-ui/assets/{mindmap-definition-RKZ34NQL-DepMhVEb.js → mindmap-definition-RKZ34NQL-Bk0lFKmi.js} +1 -1
  61. package/dist/web-ui/assets/{pieDiagram-4H26LBE5-Cq9ANaI0.js → pieDiagram-4H26LBE5-BRPnBLeL.js} +1 -1
  62. package/dist/web-ui/assets/{quadrantDiagram-W4KKPZXB-CUY0BWhQ.js → quadrantDiagram-W4KKPZXB-CAqdqT5W.js} +1 -1
  63. package/dist/web-ui/assets/{requirementDiagram-4Y6WPE33-D9fU5rCm.js → requirementDiagram-4Y6WPE33-Vv5YNzCu.js} +1 -1
  64. package/dist/web-ui/assets/{sankeyDiagram-5OEKKPKP-CMHhuSQF.js → sankeyDiagram-5OEKKPKP-Ciq1EgmQ.js} +1 -1
  65. package/dist/web-ui/assets/{sequenceDiagram-3UESZ5HK-Bjx53SID.js → sequenceDiagram-3UESZ5HK-DVRqp161.js} +1 -1
  66. package/dist/web-ui/assets/{stateDiagram-AJRCARHV-DVvatKnO.js → stateDiagram-AJRCARHV-zbjDSKA3.js} +1 -1
  67. package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-C54VSYn7.js +1 -0
  68. package/dist/web-ui/assets/{timeline-definition-PNZ67QCA-9I80LG9m.js → timeline-definition-PNZ67QCA-D0hr0d1U.js} +1 -1
  69. package/dist/web-ui/assets/{vennDiagram-CIIHVFJN-B82Deutq.js → vennDiagram-CIIHVFJN-CtuZLcPo.js} +1 -1
  70. package/dist/web-ui/assets/{wardley-L42UT6IY-BKXtp57W.js → wardley-L42UT6IY-nP2-eCDJ.js} +1 -1
  71. package/dist/web-ui/assets/{wardleyDiagram-YWT4CUSO-DzqTzfYa.js → wardleyDiagram-YWT4CUSO-Dxc7OveP.js} +1 -1
  72. package/dist/web-ui/assets/{xychartDiagram-2RQKCTM6-TowyDWYu.js → xychartDiagram-2RQKCTM6-Bm2LvPhZ.js} +1 -1
  73. package/dist/web-ui/index.html +2 -2
  74. package/docs/README.md +50 -16
  75. package/docs/api/guides/websocket.md +43 -0
  76. package/docs/api/reference.md +657 -0
  77. package/docs/architecture/a2a-communication.md +303 -0
  78. package/docs/architecture/agent-runtime.md +145 -28
  79. package/docs/architecture/architecture.md +30 -11
  80. package/docs/architecture/cognitive-architecture.md +189 -15
  81. package/docs/architecture/concurrent-processing.md +190 -31
  82. package/docs/architecture/context-assembly.md +264 -0
  83. package/docs/architecture/derived-views.md +463 -0
  84. package/docs/architecture/desktop-auto-update.md +185 -0
  85. package/docs/architecture/facts.md +406 -0
  86. package/docs/architecture/learning-loop.md +11 -0
  87. package/docs/architecture/limits.md +79 -0
  88. package/docs/architecture/mailbox-system.md +786 -668
  89. package/docs/architecture/memory-system.md +1 -1
  90. package/docs/architecture/messaging-gateway.md +7 -0
  91. package/docs/architecture/notification-delivery.md +221 -0
  92. package/docs/architecture/notification-sounds.md +177 -0
  93. package/docs/architecture/prompt-engineering.md +171 -700
  94. package/docs/{design/remote-access-contract.md → architecture/remote-access.md} +4 -0
  95. package/docs/architecture/state-machines.md +288 -5
  96. package/docs/architecture/tool-loop-harness.md +362 -0
  97. package/docs/architecture/tool-system.md +40 -16
  98. package/docs/design/background-callback-in-turn-delivery-2026-11-22.md +95 -0
  99. package/docs/design/c10-0b-pick-identity-leak-2026-11-22.md +233 -0
  100. package/docs/design/c10-a-identity-columns-2026-11-22.md +182 -0
  101. package/docs/design/c10-c-trust-boundary-2026-11-23.md +222 -0
  102. package/docs/design/c10-external-adapters-plan-2026-11-19.md +448 -0
  103. package/docs/design/c8-residual-mechanisms-2026-11-15.md +984 -0
  104. package/docs/design/external-signal-decision-loop-2026-11-25.md +579 -0
  105. package/docs/guides/development.md +1 -1
  106. package/docs/{architecture → guides}/mailbox-audit-checklist.md +7 -0
  107. package/docs/guides/remote-access.md +1 -1
  108. package/docs/{design/agent-stop-intent-audit.md → records/agent-stop-intent-audit-2026-11-08.md} +4 -0
  109. package/docs/records/c10-l5-gate-verification-2026-11-26.md +72 -0
  110. package/docs/records/c10-l5-live-verification-2026-11-25.md +117 -0
  111. package/docs/records/cut6-c4-verification-2026-11-12.md +268 -0
  112. package/docs/records/cut6-mailbox-address-envelope-design-2026-11-12.md +871 -0
  113. package/docs/records/cut7-c7a-red-green-evidence-2026-11-13.md +105 -0
  114. package/docs/records/cut7-c7a-workunit-implementation-2026-11-13.md +116 -0
  115. package/docs/records/cut7-c7b-verification-2026-11-14.md +90 -0
  116. package/docs/records/cut7-live-verification-2026-11-14.md +33 -0
  117. package/docs/records/cut7-wiring-negative-cache-2026-11-14.md +64 -0
  118. package/docs/records/cut7-workunit-execution-plan-2026-11-13.md +206 -0
  119. package/docs/records/cut8-a-entity-keys-design-2026-11-14.md +377 -0
  120. package/docs/records/cut8-b-turn-delta-injection-2026-11-14.md +362 -0
  121. package/docs/records/cut8-c-single-clock-2026-11-14.md +119 -0
  122. package/docs/records/cut8-c-single-clock-design-2026-11-14.md +150 -0
  123. package/docs/records/cut8-d-2026-11-14.md +231 -0
  124. package/docs/records/cut8-live-verification-2026-11-14.md +1018 -0
  125. package/docs/records/cut9-adjacent-identity-paths-2026-11-15.md +200 -0
  126. package/docs/records/cut9-identity-declaration-2026-11-15.md +163 -0
  127. package/docs/records/cut9-inbox-dual-run-diff-2026-11-15.md +117 -0
  128. package/docs/records/cut9-live-verification-2026-11-15.md +222 -0
  129. package/docs/records/cut9-runtime-probe-2026-11-19.md +520 -0
  130. package/docs/{design/deliverable-sharing.md → records/deliverable-sharing-2026-08-12.md} +10 -3
  131. package/docs/records/identity-backlog-disposition-2026-11-22.md +143 -0
  132. package/docs/records/marketplace-orphan-freeze-2026-11-22.md +239 -0
  133. package/docs/{architecture/notify-user-context-truth.md → records/notify-user-context-truth-2026-10-28.md} +6 -0
  134. package/docs/{handoff → records}/remote-access-handoff.md +1 -1
  135. package/package.json +1 -1
  136. package/templates/roles/HANDBOOK.md +1 -1
  137. package/templates/skills/agent-building/SKILL.md +1 -1
  138. package/dist/web-ui/assets/ChatComponents-DTB3H_n2.js +0 -12
  139. package/dist/web-ui/assets/DeliverableShareModal-BwZP39nd.js +0 -1
  140. package/dist/web-ui/assets/MarkdownMessage-DVfFMzM9.js +0 -4
  141. package/dist/web-ui/assets/Settings-DTUjLhJY.js +0 -8
  142. package/dist/web-ui/assets/Switch-RmZHA47D.js +0 -1
  143. package/dist/web-ui/assets/Team-BRgI1zM9.js +0 -85
  144. package/dist/web-ui/assets/Work-nah0UYFz.js +0 -142
  145. package/dist/web-ui/assets/channel-s7K3KXLr.js +0 -1
  146. package/dist/web-ui/assets/classDiagram-4FO5ZUOK-B2mHhFY8.js +0 -1
  147. package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-B2mHhFY8.js +0 -1
  148. package/dist/web-ui/assets/index-CzHSs0Vd.css +0 -1
  149. package/dist/web-ui/assets/index-TPf50ZeO.js +0 -867
  150. package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-92MmE2MZ.js +0 -1
  151. package/docs/api/api.md +0 -353
  152. package/docs/architecture/llm-provider-timeouts.md +0 -60
  153. package/docs/architecture/state-ownership.md +0 -83
  154. /package/docs/architecture/{frontend/team-chat.md → team-chat.md} +0 -0
  155. /package/docs/{analysis → records}/2026-10-29-a2a-cache-hit-rate.md +0 -0
  156. /package/docs/{fixes → records}/2026-11-12-session-expiry-and-mention-thinking.md +0 -0
  157. /package/docs/{handoff → records}/approval-tri-state-handoff.md +0 -0
  158. /package/docs/{design → records}/overview-attention-redesign.md +0 -0
  159. /package/docs/{remote-access/fast-path-plan.md → records/remote-access-fast-path-plan-2026-10-17.md} +0 -0
@@ -1 +0,0 @@
1
- import{s as r,b as e,a,S as s}from"./chunk-AQP2D5EJ-qrYsW5ml.js";import{_ as i}from"./mermaid.core-CCf28Hq6.js";import"./transform-BqqRT-Iy.js";import"./chunk-55IACEB6-DieD55CP.js";import"./chunk-2J33WTMH-DueHBqOn.js";import"./index-TPf50ZeO.js";var u={parser:a,get db(){return new s(2)},renderer:e,styles:r,init:i(t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute},"init")};export{u as diagram};
package/docs/api/api.md DELETED
@@ -1,353 +0,0 @@
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 |
@@ -1,60 +0,0 @@
1
- # LLM Provider Timeout Governance
2
-
3
- > **Status: risk inventory / target design (2026-09).** Rows resolved since are marked **RESOLVED**
4
- > in place rather than deleted, so the reasoning stays available.
5
-
6
- > Last updated: 2026-09. Distilled from the provider timeout audits (set A + set B).
7
- > This is the **current-state design reference** for how each LLM provider adapter
8
- > handles timeouts / hangs / retries — what is bounded, what is not, and the agreed
9
- > target design. Do not add per-file line references here (they drift); describe
10
- > behavior, not line numbers.
11
-
12
- ## 1. Governing matrix (current state)
13
-
14
- | Provider adapter | Non-stream timeout | Stream idle timeout | Hard cap | External abort | Retry | Notes |
15
- |------------------|--------------------|---------------------|----------|----------------|-------|-------|
16
- | **openai** | ✅ configurable | ✅ idle (per-chunk reset) + hard | ✅ | ✅ shared AbortController | — | Reference implementation; fails loudly |
17
- | **markus-provider** | ✅ | ✅ idle (per-chunk reset) + hard | ✅ | ✅ external abort | ✅ budget shared across retries (not reset) | Aligned baseline with openai |
18
- | **anthropic** | ✅ configurable (default 90 s) | ✅ idle (per-chunk reset) + hard | ✅ | ✅ | — | ~~Most severe gap (set A)~~ **RESOLVED** |
19
- | **google** | ✅ (60 s) | ✅ idle (per-chunk reset) + hard | ✅ | ✅ (stream) | — | ~~Needs hardening (set A)~~ **RESOLVED** |
20
- | **dashscope** | ✅ via OpenAIProvider (chat) | ✅ via OpenAIProvider | ✅ | ✅ | — | ~~Needs timeout coverage (set A)~~ **RESOLVED** (chat inherits openai; media paths self-timed) |
21
- | **ollama** | ✅ (120 s) | ✅ idle (per-chunk reset) + hard | ✅ | ✅ (stream) | — | ~~Needs timeout coverage (set A)~~ **RESOLVED** |
22
- | **openai-codex** | — | — | ✅ single 180 s | — | — | Single coarse root timer |
23
- | **proxy-fetch** | ❌ **no built-in timeout** | — | — | relies on caller-passed signal | — | Caller must pass `signal`, else unbounded |
24
- | **minimax** | ✅ | ✅ | — | — | — | **Video polling can hang ~30 min, not externally cancellable; silent `max_tokens` downgrade + empty-array fallbacks** |
25
-
26
- ## 2. Known risk inventory (priority order)
27
-
28
- 1. **RESOLVED** — **anthropic non-streaming chat: no timeout at all** — a hung model call blocks the
29
- turn indefinitely. Must get an idle timeout + hard cap (openai semantics).
30
- *(Now: `chatTimeoutMs` default 90 s + idle/hard stream caps.)*
31
- 2. **minimax video polling: ~30 min without external cancel** — plus silent degradation
32
- (downgraded `max_tokens`, empty-array response accepted as success). Needs a real poll
33
- timeout + fail-loud on degradation.
34
- 3. **proxy-fetch: no own timeout** — unbounded unless the caller threads a signal.
35
- Should default to a sane timeout and still honor an external signal.
36
- 4. **RESOLVED** — **google / dashscope / ollama**: partial coverage — streaming idle semantics and hard
37
- caps not consistently implemented. *(Now: google/ollama implement idle + hard caps; dashscope inherits openai.)*
38
- 5. **Streaming errors thrown as bare `AbortError`** in several adapters — callers cannot
39
- distinguish user-cancel from provider failure; wrap with intent.
40
- 6. **Timer leaks** where timers are not cleared on completion paths.
41
- 7. **Hardcoded durations** in several adapters — should be configurable (openai-style).
42
-
43
- ## 3. Target design (agreed direction)
44
-
45
- - **Idle semantics**: per-chunk timer reset on every received chunk (stream stays alive
46
- while tokens flow), plus a **hard cap** as the outer bound.
47
- - **Configurable durations** with sane defaults; no hardcoded magic numbers.
48
- - **External abort**: all adapters accept a caller-provided `AbortController`/signal and
49
- cooperate with it (used by streaming cancel — see streaming-and-reattach.md §4.2).
50
- - **Fail-loud**: timeouts and degradations surface as structured errors, never as silent
51
- success (see mailbox-system.md §27.3 fail-loud chain).
52
- - **Single-timer consolidation**: one timer mechanism per adapter (roadmap item from the
53
- frontend resilience audit §5.5).
54
- - **Reference baseline**: `openai` and `markus-provider` are the alignment targets.
55
-
56
- ## 4. Rule of thumb for new adapters
57
-
58
- Every new provider adapter MUST implement: non-stream timeout, stream idle timeout,
59
- hard cap, external abort, and fail-loud error wrapping — before being merged. A provider
60
- call that can hang without bound is a scheduling-chain violation (mailbox-system.md §27).
@@ -1,83 +0,0 @@
1
- # State Ownership Contract
2
-
3
- > **Status: living contract.** This describes how the code must behave today — update it in the same
4
- > change that moves an owner.
5
-
6
- > Why this document exists: pushing state down from "agent-level singleton" to "per-worker workspace"
7
- > is the right direction, but it **legitimately changes** an implicit premise found all over the repo
8
- > ("reading `currentSessionId` gives you this request's session").
9
- > Changes of this kind don't throw errors, they compile, and all the old tests stay green — they only
10
- > show up in production as "the agent has amnesia".
11
- > So "who owns which state, who may read it, and in which context it may be read" has to be written down
12
- > as a contract and enforced by machine.
13
-
14
- **Applies to**: any change that touches session identity / history / concurrency / workspace state.
15
-
16
- ---
17
-
18
- ## 1. The three execution contexts (first, figure out where you are)
19
-
20
- | Context | When it occurs | `sessionWorkspaceStore.getStore()` | Default workspace |
21
- |---|---|---|---|
22
- | **HTTP thread** | `api-server` handling a request, SSE callbacks, route validation | `undefined` | `rootWorkspace` |
23
- | **worker workspace** | an attention worker pool processing a mailbox item | that worker's workspace | that worker's workspace |
24
- | **background timers / bare callbacks** | backstop timeouts, `setTimeout`, external events | `undefined` | `rootWorkspace` |
25
-
26
- > The test: `private workspace() { return sessionWorkspaceStore.getStore() ?? this.rootWorkspace; }`
27
- > Under concurrent mode (3 workers by default), **the HTTP thread and a worker do not see the same thing**.
28
-
29
- ---
30
-
31
- ## 2. State ownership matrix (writer / reader / context)
32
-
33
- | State | Ownership | Who writes | Who reads | Implicit reads allowed? |
34
- |---|---|---|---|---|
35
- | `currentSessionId` (in-memory session `sess_*`) | **per-worker** | the worker handling that item (restore / startNewSession / handle*) | the turn logic inside that same worker | ❌ **forbidden** to read across threads |
36
- | `dbSessionMap` (`cs_*` → `sess_*` binding) | agent-level (shared across workers) | **written only in the worker handling that message** | anyone (looked up by DB id) | ✅ allowed (this is the only cross-thread-safe session bridge) |
37
- | `MemoryStore.sessions` (the history itself) | agent-level singleton | `appendMessage` (inside a worker) | `getRecentMessages` / `getSession` | ✅ allowed (but an unknown id must warn — never silently return empty) |
38
- | `chatSessionRepo` (`cs_*` persistence layer) | storage (out of process) | api-server (persist) | api-server / restore | ✅ allowed |
39
- | `activeScenario` / `currentTaskId` / `turnModelOverride` / `currentInteractingUserId` | **per-worker** | same worker | same worker | ❌ forbidden to read across threads |
40
- | `workerWorkspaces` / `workerStates` / `inFlightProcessing` | attention controller | attention itself | attention / targeted cancellation (**must carry workerId explicitly**) | ⚠️ only for targeted APIs that take a workerId |
41
- | `session.summary` / fragments / slots | MemoryStore (singleton) | compactor | context assembly | ✅ allowed |
42
-
43
- **In one sentence**: **per-worker things can never be obtained by "reading a global pointer"; they must be passed explicitly.**
44
- The only session bridge that may be shared across threads is `dbSessionMap` (`cs_*` ↔ `sess_*`).
45
-
46
- ---
47
-
48
- ## 3. Hard rules
49
-
50
- 1. **DB ids and in-memory ids are never mixed**. `cs_*` is the request identity, `sess_*` is the internal cache key;
51
- never use a `cs_*` directly as a `MemoryStore` key (that causes split-brain: one conversation splits into two stores).
52
- 2. **Passing session identity across threads must be explicit**. For the HTTP thread to hand a session to a worker,
53
- it may only go through the mailbox item's `extra.sessionHint` (normalized from the legacy `extra.sessionId` /
54
- `extra.sessionRestore`), never through any shared pointer.
55
- 3. **Session context is applied only in the workspace that handles that item**. "Eager restore" in the HTTP thread
56
- is forbidden (it only writes `rootWorkspace`, which the worker never sees).
57
- 4. **Failures must be visible**. Distinguish `found | missing | notLoaded`: the latter two must at minimum `log.warn`
58
- with `dbSessionId / memorySessionId / agentId`. "Not found → return empty / create new / swallow the exception" is forbidden.
59
- 5. **The binding may be written in exactly one place**: in the workspace that actually handles that message.
60
- 6. **Targeted operations must carry a workerId** (cancellation, status queries, hot updates); inferring it from ALS is not allowed.
61
-
62
- ---
63
-
64
- ## 4. Enforcement mechanisms already in place
65
-
66
- | Mechanism | Location | What it protects |
67
- |---|---|---|
68
- | Streaming path carries the DB session id explicitly | `agent.ts` `sendMessageStream` → `extra.sessionHint` | rule R2 |
69
- | Session resolution order "DB-bound in-memory session > workspace pointer > create new" | `resolveTurnSession` (single resolution point, called from `processMailboxItemCore`) | rule R1 |
70
- | restore / binding executed in the workspace handling that item | `processMailboxItemCore` | rules R3/R5 |
71
- | Lazy loading for history reads + warning on unknown id | `memory/store.ts` `getRecentMessages` | rule R4 |
72
- | Invariant test suite | `packages/core/test/conversation-session-invariants.test.ts` | all of the above |
73
- | Architecture gate | `scripts/architecture-guard.mjs` (must pass in CI) | bans `console.*`, bans empty `catch` |
74
-
75
- ---
76
-
77
- ## 5. Checklist for adding/changing state
78
-
79
- 1. Does this state belong to **agent level** or is it **per-worker**? (per-worker ⇒ it must be passed explicitly)
80
- 2. Who writes it, who reads it, in which context? (fill it into the matrix in section 2 — **a blank cell is a risk**)
81
- 3. What happens when it can't be read? Does it silently degrade? (it must be observable)
82
- 4. Add an **invariant test** (not an assertion over an implementation snapshot), and do mutation validation (revert the fix → the case must go red).
83
- 5. Does it affect the `worker=1` serial-equivalence contract? (equivalence must hold)