multi-agent-platform 0.1.0__py3-none-any.whl

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 (144) hide show
  1. cli/__init__.py +0 -0
  2. cli/action_item_escalation.py +177 -0
  3. cli/agent_client.py +554 -0
  4. cli/bridge_state.py +43 -0
  5. cli/commands/__init__.py +13 -0
  6. cli/commands/action.py +142 -0
  7. cli/commands/agent.py +117 -0
  8. cli/commands/audit.py +68 -0
  9. cli/commands/docs.py +179 -0
  10. cli/commands/experiment.py +755 -0
  11. cli/commands/feedback.py +106 -0
  12. cli/commands/notification.py +213 -0
  13. cli/commands/persona.py +63 -0
  14. cli/commands/project.py +87 -0
  15. cli/commands/runtime.py +105 -0
  16. cli/commands/topic.py +361 -0
  17. cli/e2e_collab.py +602 -0
  18. cli/git_checkpoint.py +68 -0
  19. cli/host_worker_types.py +151 -0
  20. cli/main.py +1553 -0
  21. cli/map_command_client.py +497 -0
  22. cli/participant_worker.py +255 -0
  23. cli/reviewer_worker.py +263 -0
  24. cli/runtime/__init__.py +5 -0
  25. cli/runtime/run_lock.py +497 -0
  26. cli/runtime_chat.py +317 -0
  27. cli/session_wake_log.py +235 -0
  28. cli/simple_waker.py +950 -0
  29. cli/table_render.py +113 -0
  30. cli/wake_backend.py +236 -0
  31. cli/worker_cycle_log.py +36 -0
  32. map_client/__init__.py +37 -0
  33. map_client/bootstrap.py +193 -0
  34. map_client/client.py +1045 -0
  35. map_client/config.py +21 -0
  36. map_client/errors.py +283 -0
  37. map_client/exceptions.py +130 -0
  38. map_client/plan_evidence.py +159 -0
  39. map_client/project_config.py +153 -0
  40. map_client/result_template.py +167 -0
  41. map_client/testing.py +27 -0
  42. map_mcp/__init__.py +4 -0
  43. map_mcp/_utils.py +28 -0
  44. map_mcp/auth.py +34 -0
  45. map_mcp/config.py +50 -0
  46. map_mcp/context.py +39 -0
  47. map_mcp/main.py +75 -0
  48. map_mcp/server.py +573 -0
  49. map_mcp/session.py +79 -0
  50. map_sdk/__init__.py +29 -0
  51. map_sdk/evidence.py +68 -0
  52. map_types/__init__.py +203 -0
  53. map_types/enums.py +199 -0
  54. map_types/schemas.py +1351 -0
  55. multi_agent_platform-0.1.0.dist-info/METADATA +298 -0
  56. multi_agent_platform-0.1.0.dist-info/RECORD +144 -0
  57. multi_agent_platform-0.1.0.dist-info/WHEEL +5 -0
  58. multi_agent_platform-0.1.0.dist-info/entry_points.txt +6 -0
  59. multi_agent_platform-0.1.0.dist-info/licenses/LICENSE +21 -0
  60. multi_agent_platform-0.1.0.dist-info/top_level.txt +6 -0
  61. server/__init__.py +0 -0
  62. server/__version__.py +14 -0
  63. server/api/__init__.py +0 -0
  64. server/api/action_items.py +138 -0
  65. server/api/agents.py +412 -0
  66. server/api/audit.py +54 -0
  67. server/api/background_tasks.py +18 -0
  68. server/api/common.py +117 -0
  69. server/api/deps.py +30 -0
  70. server/api/experiments.py +858 -0
  71. server/api/feedback.py +75 -0
  72. server/api/notifications.py +22 -0
  73. server/api/projects.py +209 -0
  74. server/api/router.py +25 -0
  75. server/api/status.py +33 -0
  76. server/api/topics.py +302 -0
  77. server/api/webhooks.py +74 -0
  78. server/auth/__init__.py +8 -0
  79. server/auth/experiment_access.py +66 -0
  80. server/config.py +38 -0
  81. server/db/__init__.py +3 -0
  82. server/db/base.py +5 -0
  83. server/db/deadlock_retry.py +146 -0
  84. server/db/session.py +41 -0
  85. server/domain/__init__.py +3 -0
  86. server/domain/encrypted_types.py +63 -0
  87. server/domain/models.py +713 -0
  88. server/domain/schemas.py +3 -0
  89. server/domain/state_machine.py +79 -0
  90. server/domain/topic_ack_constants.py +9 -0
  91. server/main.py +148 -0
  92. server/scripts/__init__.py +0 -0
  93. server/scripts/migrate_notification_unique.py +231 -0
  94. server/scripts/purge_audit_pollution.py +116 -0
  95. server/services/__init__.py +0 -0
  96. server/services/_lookups.py +26 -0
  97. server/services/acceptance_service.py +90 -0
  98. server/services/action_item_migration_service.py +190 -0
  99. server/services/action_item_service.py +200 -0
  100. server/services/agent_work_service.py +405 -0
  101. server/services/archive_lint_service.py +156 -0
  102. server/services/audit_service.py +457 -0
  103. server/services/auth.py +66 -0
  104. server/services/comment_service.py +173 -0
  105. server/services/errors.py +65 -0
  106. server/services/escalation_resolver.py +248 -0
  107. server/services/evidence_service.py +88 -0
  108. server/services/experiment_capabilities_service.py +277 -0
  109. server/services/inbound_event_service.py +111 -0
  110. server/services/lock_service.py +273 -0
  111. server/services/log_service.py +202 -0
  112. server/services/mention_service.py +730 -0
  113. server/services/notification_service.py +939 -0
  114. server/services/notification_stream.py +138 -0
  115. server/services/permissions.py +147 -0
  116. server/services/persona_activity_service.py +108 -0
  117. server/services/phase_owner_resolver.py +95 -0
  118. server/services/phase_service.py +381 -0
  119. server/services/plan_marker_service.py +235 -0
  120. server/services/plan_service.py +186 -0
  121. server/services/platform_feedback_service.py +114 -0
  122. server/services/project_service.py +534 -0
  123. server/services/project_status_service.py +132 -0
  124. server/services/review_service.py +707 -0
  125. server/services/secret_encryption.py +97 -0
  126. server/services/similarity_service.py +119 -0
  127. server/services/sse_event_schemas.py +17 -0
  128. server/services/status_service.py +68 -0
  129. server/services/template_service.py +134 -0
  130. server/services/text_utils.py +19 -0
  131. server/services/thread_activity.py +180 -0
  132. server/services/todo_persona_filter.py +73 -0
  133. server/services/todo_service.py +604 -0
  134. server/services/topic_ack_service.py +312 -0
  135. server/services/topic_action_item_ops.py +538 -0
  136. server/services/topic_comment_kind.py +14 -0
  137. server/services/topic_comment_service.py +237 -0
  138. server/services/topic_helpers.py +32 -0
  139. server/services/topic_lifecycle_service.py +478 -0
  140. server/services/topic_progress_service.py +40 -0
  141. server/services/topic_resolve_service.py +234 -0
  142. server/services/topic_service.py +102 -0
  143. server/services/topic_work_item_service.py +570 -0
  144. server/services/webhook_service.py +273 -0
@@ -0,0 +1,298 @@
1
+ Metadata-Version: 2.4
2
+ Name: multi-agent-platform
3
+ Version: 0.1.0
4
+ Summary: Multi-Agent experiment collaboration platform
5
+ License-Expression: MIT
6
+ Project-URL: Homepage, https://github.com/quantaeye/multi-agent-platform
7
+ Project-URL: Documentation, https://github.com/quantaeye/multi-agent-platform/tree/main/docs
8
+ Project-URL: Repository, https://github.com/quantaeye/multi-agent-platform
9
+ Project-URL: Issues, https://github.com/quantaeye/multi-agent-platform/issues
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
15
+ Classifier: Operating System :: OS Independent
16
+ Requires-Python: >=3.11
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: fastapi<0.116,>=0.115.0
20
+ Requires-Dist: uvicorn[standard]<0.41,>=0.32.0
21
+ Requires-Dist: sqlalchemy<2.1,>=2.0.36
22
+ Requires-Dist: alembic<2.0,>=1.14.0
23
+ Requires-Dist: pydantic<2.12,>=2.10.0
24
+ Requires-Dist: pydantic-settings<2.9,>=2.6.0
25
+ Requires-Dist: bcrypt<6.0,>=4.2.0
26
+ Requires-Dist: python-multipart<0.1,>=0.0.17
27
+ Requires-Dist: typer<0.17,>=0.15.0
28
+ Requires-Dist: httpx<0.29,>=0.28.0
29
+ Requires-Dist: pyyaml<7.0,>=6.0
30
+ Requires-Dist: cryptography<50.0,>=44.0.0
31
+ Provides-Extra: dev
32
+ Requires-Dist: pytest<9.0,>=8.3.0; extra == "dev"
33
+ Requires-Dist: pytest-asyncio<1.0,>=0.24.0; extra == "dev"
34
+ Requires-Dist: pytest-cov<7.0,>=5.0.0; extra == "dev"
35
+ Requires-Dist: httpx<0.29,>=0.28.0; extra == "dev"
36
+ Requires-Dist: mcp<2.0,>=1.26.0; extra == "dev"
37
+ Requires-Dist: ruff<1.0,>=0.8.0; extra == "dev"
38
+ Requires-Dist: pydantic-to-typescript<3.0,>=2.0.0; extra == "dev"
39
+ Provides-Extra: mcp
40
+ Requires-Dist: mcp<2.0,>=1.26.0; extra == "mcp"
41
+ Provides-Extra: codex-runtime
42
+ Provides-Extra: claude-runtime
43
+ Requires-Dist: claude-agent-sdk<1.0,>=0.2; extra == "claude-runtime"
44
+ Dynamic: license-file
45
+
46
+ # Multi-Agent Platform (MAP)
47
+
48
+ 多 Agent 实验协作平台:以话题为中心,管理实验计划、评审讨论、执行日志与项目状态。
49
+
50
+ **新用户?** 一键启动:`./scripts/quickstart.sh`,或阅读 [Quick Start 指南](docs/QUICKSTART.md)。
51
+
52
+ ## 文档
53
+
54
+ - [Quick Start 指南(新用户必读)](docs/QUICKSTART.md)
55
+ - [产品需求文档(PRD)](docs/prd/archive/v0.1.md)
56
+ - [产品需求文档 v0.2(角色与项目边界)](docs/prd/archive/v0.2.md)
57
+ - [产品需求文档 v0.3(话题独立、UI 写闭环、待办与通知)](docs/prd/archive/v0.3.md)
58
+ - [产品需求文档 v0.4(站内收件箱、@提及、计划 diff、话题置顶)](docs/prd/archive/v0.4.md)
59
+ - [产品需求文档 v0.5(主持待办 pending_topic_replies、topic-host Skill)](docs/prd/archive/v0.5.md)
60
+ - [产品需求文档 v0.6(列表归档、独立列表页、通知 SSE)](docs/prd/archive/v0.6.md)
61
+ - [产品需求文档 v0.9 草案(waker Phase 2 通知降噪)](docs/prd/v0.9.md)
62
+ - [Webhook 话题主持接线指南](docs/WEBHOOK-TOPIC-HOST.md)
63
+ - [Agent Runtime 集成(simple-waker,默认)](docs/MAP-SIMPLE-WAKER.md)
64
+ - [架构设计](docs/ARCHITECTURE.md)
65
+ - [Python SDK 指南](docs/SDK.md)
66
+ - [MCP Server 指南(stdio)](docs/MCP.md)
67
+
68
+ ## 状态
69
+
70
+ **M1 已完成**:数据模型、Alembic 迁移、Projects/Experiments CRUD REST API。
71
+ **M2 已完成**:Plans 修订、Reviews、Comments、实验阶段与不合理项状态机。
72
+ **M3 已完成**:实验日志、Start/Complete、全局 Status API、CLI(`map` 命令)。
73
+ **M4 已完成**:React + Vite Web UI(看板、项目、实验话题页)。
74
+ **M5 已完成**:Python SDK(`map_client`)、SDK 文档、CLI 基于 SDK 重构、Docker 部署。
75
+ **M6 已完成**:MCP stdio + HTTP 服务(`map-mcp`),供 IDE Agent 调用。
76
+ **M7 已完成**:项目角色边界(`project_key`、Agent 项目绑定、权限门控、Status MD v1)。
77
+ **M8 已完成**:项目 Current Status MD 版本化(修订 API、历史查询、CLI/MCP)。
78
+
79
+ **v0.3 已完成(M11–M14)**:
80
+
81
+ - **M11**:话题(Topic)独立实体 + 评论树 + 实验↔话题可选关联 + Alembic 迁移 + CLI/SDK/MCP 适配。
82
+ - **M12**:Web UI 写操作闭环——发布话题/实验、修订计划、提交评审、追加日志、撤回/取消/编辑、通用讨论;新增话题详情页。
83
+ - **M13**:Agent 待办视图(`GET /agents/me/todos`)+ 实验列表筛选/分页/搜索(`q`/`creator`/`page` + `X-Total-Count` header)。
84
+ - **M14**:Webhook 出站通知(HMAC 签名 + 投递记录 + Admin CRUD)+ 审计日志(关键写操作打点 + 对象/全局查询)。
85
+
86
+ 详见 [PRD v0.3](docs/prd/archive/v0.3.md)。
87
+
88
+ **v0.4 已完成(M15–M18)**:
89
+
90
+ - **M15**:站内通知收件箱(`notifications` 表 + 统一事件扇出 + API/Web/CLI/SDK/MCP)。
91
+ - **M16**:评论 `@提及` → 待办 `mentions` 分区 + 定向通知。
92
+ - **M17**:实验页计划版本 diff 只读视图(`PlanDiffView`)。
93
+ - **M18**:话题置顶(`topics.pinned` + 列表优先排序)。
94
+
95
+ 详见 [PRD v0.4](docs/prd/archive/v0.4.md)。
96
+
97
+ **v0.5 已完成(M19–M21)**:
98
+
99
+ - **M19**:`GET /agents/me/todos` 新增 `pending_topic_replies`(话题主持 thread 级待回复)。
100
+ - **M20**:topic-host Skill(`.cursor/skills/topic-host/SKILL.md`)。
101
+ - **M21**:Webhook 主持接线文档([WEBHOOK-TOPIC-HOST.md](docs/WEBHOOK-TOPIC-HOST.md))。
102
+
103
+ 详见 [PRD v0.5](docs/prd/archive/v0.5.md)。
104
+
105
+ **v0.6 已完成(M22–M24)**:
106
+
107
+ - **M22**:话题/实验 `archived_at` 归档(默认列表排除、`include_archived`、活跃实验 per-topic 约束更新)。
108
+ - **M23**:Web 独立列表页(`/projects/:id/topics`、`/experiments`)+ `client.ts` vitest。
109
+ - **M24**:站内通知 **SSE**(`GET /agents/me/notifications/stream`)+ Web 实时 invalidate。
110
+
111
+ 详见 [PRD v0.6](docs/prd/archive/v0.6.md)。项目叙事参考 [docs/status-md-v6.md](docs/status-md-v6.md)。
112
+
113
+ **v0.8 MVP 已完成**:
114
+
115
+ - 话题结论(Decision)与行动项(Action Items):`POST /topics/{id}/resolve`、项目级 `decisions` / `action-items` 查询、`todos.action_items`。
116
+ - CLI:`map topic resolve --id <topic-id> --file decision.md|decision.yaml`、`map project decisions`、`map action list --mine`。
117
+ - Web:话题详情页展示/修订结论,项目页展示最近结论,待办页展示分配给当前 Agent 的行动项。
118
+
119
+ **Agent 身份(本仓库)**:统一使用 **`.map/` persona + `map` CLI**(见 [AGENTS.md](AGENTS.md));Cursor MCP 接入计划停用。
120
+
121
+ ### 连接已有 MAP 服务(本仓库协作)
122
+
123
+ MAP API 运行后,在本仓库根目录执行一次 bootstrap(生成 `.map/config.yaml` 与 persona token,详见 [AGENTS.md](AGENTS.md)):
124
+
125
+ ```bash
126
+ export MAP_ADMIN_TOKEN=<admin-token> # 或 ~/.map/admin.yaml
127
+ map bootstrap \
128
+ --key multi-agent-platform \
129
+ --name "Multi Agents Platform" \
130
+ --api-url http://localhost:8001
131
+
132
+ map --persona host persona whoami
133
+ map --persona host todos
134
+ ```
135
+
136
+ 与 `docker compose up` 并列:先起服务,再 bootstrap,再用 `--persona` 协作。
137
+
138
+ ## 快速开始
139
+
140
+ ```bash
141
+ # 安装依赖(含开发工具)
142
+ pip install -e ".[dev]"
143
+
144
+ # 运行数据库迁移
145
+ alembic upgrade head
146
+
147
+ # 启动 API 服务
148
+ map-server
149
+ # 或: uvicorn server.main:app --reload
150
+
151
+ # 注册首个 Admin(仅当系统中尚无 Agent 时可匿名调用)
152
+ curl -X POST "http://localhost:8000/api/v1/agents?name=ops-admin&role=admin"
153
+
154
+ # 后续 Agent 须由 Admin 注册
155
+ curl -H "Authorization: Bearer <admin-token>" \
156
+ -X POST "http://localhost:8000/api/v1/agents?name=agent-alpha&role=agent&project_key=<project-key>"
157
+
158
+ # 创建项目
159
+ curl -H "Authorization: Bearer <token>" \
160
+ -H "Content-Type: application/json" \
161
+ -d '{"name":"demo","workspace_path":"/tmp/demo"}' \
162
+ http://localhost:8000/api/v1/projects
163
+
164
+ # 运行测试
165
+ pytest
166
+
167
+ # CLI 用法(需设置 MAP_TOKEN 或 ~/.map/config.yaml)
168
+ export MAP_TOKEN=<your-token>
169
+ map project list
170
+ map status
171
+ map experiment start --id <exp-id>
172
+ map experiment status --id <exp-id> # 含 acceptance_status
173
+ map experiment pre-complete --id <exp-id> --metadata evidence.yaml
174
+ map experiment complete --id <exp-id> --summary "提交结果" --file log.md --metadata evidence.yaml # running -> result_review
175
+ map experiment accept-result --id <exp-id> --summary "通过" --file review.md
176
+ map experiment reject-result --id <exp-id> --summary "驳回" --file review.md
177
+ map topic resolve --id <topic-id> --file decision.md
178
+ map topic archive --id <topic-id> # v0.7 P3:归档(薄包装 PATCH)
179
+ map topic archive --id <topic-id> --undo # 反归档(--unarchive 同义)
180
+ map experiment archive --id <exp-id> # 归档实验
181
+ map topic comment --id <topic-id> --file comment.md
182
+ map topic mark-seen --id <topic-id> # 清 contextual unread,不清 reply/ack/mention
183
+ map project decisions
184
+ map action list --mine
185
+ map notification list --unread-only
186
+ map notification read --id <notification-id>
187
+ map notification read-all
188
+ map --persona participant mention list
189
+ map --persona participant mention dismiss --id <mention-id>
190
+ map --persona participant mention dismiss-all
191
+
192
+ # Web UI(React + Vite)
193
+ cd web && npm install && npm run dev # http://localhost:5173
194
+ # 开发模式通过 Vite 代理访问 API;先在设置页填入 API Token
195
+ ```
196
+
197
+ 实验计划可在验收列表项行首标记类型,例如
198
+ `- [acceptance_type: unit_test] pytest 覆盖解析`。允许值为
199
+ `migration`、`smoke`、`unit_test`、`integration`、`manual`;未知类型会在
200
+ `experiment status` 解析时报错,不会降级为 manual。详情响应中的
201
+ `acceptance_status` 会给 host / reviewer / participant 展示每条验收的稳定
202
+ `id`、类型、证据状态与评审结论;`todos.experiment_review_informational`
203
+ 只是跨 persona 可见性提示,不是待办 obligation。
204
+
205
+ ## 多项目协作(Skill + `.map/`,推荐)
206
+
207
+ 不依赖 Cursor MCP。每个代码仓库:
208
+
209
+ ```bash
210
+ export MAP_ADMIN_TOKEN=<admin-token> # 或 ~/.map/admin.yaml
211
+ map bootstrap --key my-app --name "My App" --api-url http://localhost:8001
212
+ map --persona host status # 查看 open_topics
213
+ ```
214
+
215
+ **实验须由 host persona 创建**,否则生命周期操作可能 403。详见 [AGENTS.md](./AGENTS.md) 与 [.cursor/skills/map-project-collab/SKILL.md](./.cursor/skills/map-project-collab/SKILL.md)。
216
+
217
+ ## Agent Runtime Waker(推荐)
218
+
219
+ **默认路径为 `map-simple-waker`**:轮询 `topic-progress`、`map todos` 与 wakeable 通知,统一 remind 后 resume 长会话;Agent 自行读 Skill 并用 `map` CLI 写回 MAP(不在 waker 内嵌业务逻辑)。
220
+
221
+ ```bash
222
+ # 三 persona 各起一个 waker(默认 simple-waker,active interval=30s)
223
+ ./scripts/start-all-wakers.sh
224
+
225
+ # 一键推进话题:持续运行三 persona waker,直到 open topic 为 0 后自动退出
226
+ ./scripts/start-all-wakers.sh --drain-topics
227
+
228
+ # 单 persona
229
+ ./scripts/start-simple-waker.sh --persona host
230
+ ./scripts/start-simple-waker.sh --persona participant
231
+ ./scripts/start-simple-waker.sh --persona reviewer
232
+
233
+ # 干跑一轮
234
+ ./scripts/start-simple-waker.sh --persona host --once --dry-run
235
+ ```
236
+
237
+ 状态文件:`.map/simple-waker-state-<persona>.json`(session + remind 时间戳,勿提交 Git)。详见 [docs/MAP-SIMPLE-WAKER.md](docs/MAP-SIMPLE-WAKER.md)。
238
+
239
+ `--drain-topics` 只负责启动/监控:脚本每轮检查 `map topic list --status open`,所有话题 resolved/closed 后停止 waker;具体评论、Round Summary、resolve/close 仍由被唤醒的 Agent 按 Skill 通过 `map` CLI 完成。
240
+
241
+ Legacy bridge / 旧 console entry 分类见 [docs/LEGACY-ENTRY-MATRIX.md](docs/LEGACY-ENTRY-MATRIX.md);CI 校验:`./scripts/check-deprecated.sh`。
242
+
243
+ simple-waker 在每次 remind 后会写一条聚合 `inbound_event` 审计行(fingerprint=`simple-remind:{persona}:{ts}`),并在 remind 前推进 `action_item` 升级时间线(WAKE → `action mark-wake-sent`,STALE → `action mark-stale`)。
244
+
245
+ **@mention 收敛**:在话题/实验内发过评论后,对应 `mentions` 会自动从 todos 消失;只读不回时可 `map mention dismiss`。
246
+
247
+ ## Host Worker(旧 bridge,维护模式)
248
+
249
+ `map-host-bridge` / `map-host-worker` 为早期轮询 bridge(进程内 `PersonaAgentClient`),已由 **waker** 取代。`main-bac` 分支保留 bridge 实现供对照;日常开发请在 `agent-runtime` 分支使用 waker。
250
+
251
+ ```bash
252
+ # 旧路径(不推荐新接入)
253
+ map-host-bridge --persona host --interval 30
254
+ ```
255
+
256
+ ## Docker(API + Web)
257
+
258
+ 默认 `docker-compose.yml` 暴露 API `:8000`、Web `:3000`、MCP `:8080`。本仓包含 `docker-compose.override.yml`,用于本机端口冲突场景,会把 API 改为 `:8001`、MCP 改为 `:18081`;因此本仓 `.map/` bootstrap 示例使用 `http://localhost:8001`。
259
+
260
+ ```bash
261
+ docker compose up --build
262
+ # 默认端口: API :8000 Web :3000 MCP :8080/mcp
263
+ # 使用本仓 override 时: API :8001 Web :3000 MCP :18081/mcp
264
+ ```
265
+
266
+ ## Python SDK
267
+
268
+ ```bash
269
+ python -c "from map_client import MAPClient; print(MAPClient.from_env().get_me())"
270
+ # 详见 docs/SDK.md
271
+ ```
272
+
273
+ ## MCP(IDE Agent)
274
+
275
+ ```bash
276
+ pip install -e ".[mcp]"
277
+ export MAP_TOKEN=<your-token>
278
+
279
+ # stdio — Cursor 本地子进程(默认)
280
+ map-mcp
281
+
282
+ # HTTP — Docker 或本机独立服务
283
+ map-mcp --transport streamable-http --host 0.0.0.0 --port 8080
284
+ # 详见 docs/MCP.md
285
+ ```
286
+
287
+ ## 核心流程(简述)
288
+
289
+ 1. Agent 创建实验话题并提交计划
290
+ 2. 其他 Agent 评审:列出合理项 / 不合理项
291
+ 3. 通过评论树讨论争议,修订计划或反驳,直至无 open 不合理项
292
+ 4. 批准后执行实验并写入结果日志,进入结果待审批
293
+ 5. reviewer/admin 审批结果;通过后完成,驳回则回到执行中返工
294
+ 6. 看板展示项目与实验的 Current Status
295
+
296
+ ## 后续
297
+
298
+ v0.3–v0.6 与 v0.7 P3(CLI archive)已落地;当前主线为 **agent-runtime**(simple-waker 默认 + PersonaAgentClient;legacy runtime-waker 启动路径已退役,模块保留为 re-export 兼容层)。待推进项见 [docs/status-md-v10.md](docs/status-md-v10.md) 与 [架构文档](docs/ARCHITECTURE.md)。
@@ -0,0 +1,144 @@
1
+ cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ cli/action_item_escalation.py,sha256=awcvoWx5UJVGG6B6WPMcFeB0DR9QZwnmB1yWzAby9QE,6986
3
+ cli/agent_client.py,sha256=8fO5cY63-kzruI5DJCjy_l0E2LHadwIAjHSCbQgMv9o,20830
4
+ cli/bridge_state.py,sha256=HlXsry7Ml0ZduUue-NLPzOBTbTLrj4h7ifODdZPDcmE,1561
5
+ cli/e2e_collab.py,sha256=c6DCnu5DcPbM66yrqMYl76qdAyUgF7-K_lYl3xPlqu4,22159
6
+ cli/git_checkpoint.py,sha256=C_tcVdA61mCCpsu7kpTbgGWb6l_qpYZyGHpKy5J327o,2189
7
+ cli/host_worker_types.py,sha256=YyH97fvXCjdA6TeNaPzIBfMpSX7qYgmZASl-981Mq5A,4715
8
+ cli/main.py,sha256=WukvNBmQkAg1r3A6jojIOm0GN2E9hoJ0dtNC_JgN4so,60706
9
+ cli/map_command_client.py,sha256=IAulH-HqEHILP003T9jDyVZO6U2DVINwygQ8r2YpiNU,17739
10
+ cli/participant_worker.py,sha256=idOB7_wkNy9d8qQuM9oWhs9i-w_FjU7tYZ5VDUPXJ3E,9031
11
+ cli/reviewer_worker.py,sha256=kjDh0J8cfXToeRE-KaH7aocwCuzhychljTvBAxxqF6E,9332
12
+ cli/runtime_chat.py,sha256=Z0P2dw1vtGNELbyMerOYEwnf4PuICWlMIRTNMYM4NVE,9477
13
+ cli/session_wake_log.py,sha256=41OlX2sF2_OOIAU2xpjC_2pnhSMMHk47tgfXyflGqDs,7683
14
+ cli/simple_waker.py,sha256=vp1G43gL2JlzvAjWF10nFkpEbOaYAkxwuE4q_tGM37k,39111
15
+ cli/table_render.py,sha256=g02AedTyd6dllojOpjw-mOZA94NP1hohqFLg0tBJWYc,3300
16
+ cli/wake_backend.py,sha256=t2joFzUDFmcASlY4cBdH_HNbH6APZLUpH_rA1HlptKg,8906
17
+ cli/worker_cycle_log.py,sha256=t6P0TsyZDjDDCZsWxaOu8VTD0mX9O4kfbmI_xAFAEY4,1371
18
+ cli/commands/__init__.py,sha256=Cg-42Nc7uyhnnR35L77XEpcCcMie7qF118shGtgdZhE,643
19
+ cli/commands/action.py,sha256=ma8gWLd_vc9zXh85fwWdc0mgQPtlQCGymBvFj4z5VCM,4760
20
+ cli/commands/agent.py,sha256=9_XgSxTpASJcZBncBd3_3CPLw5FQH8GE3Xhj2ue_l4c,3718
21
+ cli/commands/audit.py,sha256=U3yzMInhBUv0qQEFJnICok97DpBqcp-z7TnweELvjQw,2174
22
+ cli/commands/docs.py,sha256=fVtTVvU3YfTfQQE5EMvOoTeICOBvKF5IMtivucLkFqo,6292
23
+ cli/commands/experiment.py,sha256=omg7e_fLGbggbu5kOet8tLbgM7Et1YQpp9id0pRfR4k,29198
24
+ cli/commands/feedback.py,sha256=Nb7ALBUXHZuwHEHvYZdNWoQ01LkyyM3Yu0LVJ7ELeLQ,3864
25
+ cli/commands/notification.py,sha256=tTiKJV-8X7ooJgU4L6f2H1AP7G_9lvJ0UVpcgGZbSCc,7596
26
+ cli/commands/persona.py,sha256=6JVxzyGrG7xnUFLKB9k63hFEAA6BGZN2J8pmxsdncKg,2088
27
+ cli/commands/project.py,sha256=OkloGDZ1XChZUe9HODlalr0CxY-kC3ReDwdFEKJpN3A,3069
28
+ cli/commands/runtime.py,sha256=nANz2-J1ah7yx6x022wxHx4LDFQWhMWGo_lw17uSJ0A,3259
29
+ cli/commands/topic.py,sha256=Rja6hhezdsnD9NqHNAeX2rNdmTkctzFl7wKS0CMGwvw,12360
30
+ cli/runtime/__init__.py,sha256=ft4i4ujuQIGEm4I4KgClINju6CUAEV4TQ9S9MAEa55k,227
31
+ cli/runtime/run_lock.py,sha256=1qdClbls7JRItE_GS2bOi8yKZ7Bi5m_Ew5FgcXK7gT8,19426
32
+ map_client/__init__.py,sha256=t6hAgzF5AJs90FPoZ96NeAo1NZ2nT8_bFI4NURYuoHU,894
33
+ map_client/bootstrap.py,sha256=HHWdniSHBrhY_wn2HBFaoI7bhNfOHEUV05l0idq8JiY,5936
34
+ map_client/client.py,sha256=b6lpzKJwL3uqPt72CIh6WLYKExmwFZpEXY_g8eqBXAU,39277
35
+ map_client/config.py,sha256=bI1g-gVV83yLysL5me6kfJsKd9Tbz23m9AHuVP5VotE,721
36
+ map_client/errors.py,sha256=SHyvUajJvUsItoUsdQ7_QTWeGCtK9wNilDCHSwGon1c,12292
37
+ map_client/exceptions.py,sha256=fS1gg-pOCyM6aFQs4JgrK31MMGYW2b53LqIlKKkpMrg,4180
38
+ map_client/plan_evidence.py,sha256=bWO957XnoTYqddGV35u5nN9W2X2b5ZZtVoLSvcrlejU,5485
39
+ map_client/project_config.py,sha256=4uGHEHcDl6_3LAol6WcPf3qH7-CEmSkBqDC5cjtGgog,4904
40
+ map_client/result_template.py,sha256=wwS1w3GtAVCh6Atcg1-j8rLb1HfxV-X1CgBb_G_v1OE,6205
41
+ map_client/testing.py,sha256=cUqKKYlNrTtNZDVi8A5XKZmTNSx9bC94iKQwAB_sLjk,823
42
+ map_mcp/__init__.py,sha256=q8AYY_m7gly2j_jK7bHdNMSYKxqI9nLPPBHQq3WMscQ,134
43
+ map_mcp/_utils.py,sha256=BLZMYBAIR2hw9SyMZ5WgLAerRnQXglqnikmPLLpH97w,719
44
+ map_mcp/auth.py,sha256=DFzeyrHQaJnhv3w3sZ9Hmaz3IGINyCyy0aWQs-aQT_I,1104
45
+ map_mcp/config.py,sha256=UYX1ObANzbrWuzx8u6YOyOJZCqF06r2i-cCgPG_tm9E,1631
46
+ map_mcp/context.py,sha256=uJjGiwxTBGupPd0FCEfmgMRx0ZjsPgWMKXdFJM_peRM,1241
47
+ map_mcp/main.py,sha256=vEmTdQnI_-CnxckJBEA-d4TOb2Qhg-iUNd1G5_3oeyk,2373
48
+ map_mcp/server.py,sha256=V2UJA0_TpGKAK9YuftxwRWdr6LHTPbpNHA93zYcboAw,24445
49
+ map_mcp/session.py,sha256=SVFOI6QQQLCaRLUDTgnLiEDNA0ayp49e_nZ6j-TqWVU,2533
50
+ map_sdk/__init__.py,sha256=8Y3ImiGdot9a-C0OBWy3hhRcqQxu0SHXILA6JcODmIY,725
51
+ map_sdk/evidence.py,sha256=WKKuNv0ibgaXhZo6YR0xluX9mMfCipVhB-WrEsbNvI8,2275
52
+ map_types/__init__.py,sha256=gSjphFpwkh9hPwH62xJh_aJ2aEJLgfy3zon55Lzj_Ec,4863
53
+ map_types/enums.py,sha256=tjCoCubrEnigtB9Sq82aAfr2IV3ul9ur5EXT5bw7JXU,5597
54
+ map_types/schemas.py,sha256=9RvrnTDtsdHhuby8CxJcFpz5fIhOkTe-PWbswDKInMw,43635
55
+ multi_agent_platform-0.1.0.dist-info/licenses/LICENSE,sha256=NlnHgym0Fli5xdwECjuLrouKpN0rKw-cZDU_mfiZ4rQ,1090
56
+ server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
57
+ server/__version__.py,sha256=GZceK_TUWNdMt8kyM8VPVAQLNoXh2FUTnldIRiq_ep0,575
58
+ server/config.py,sha256=0nz9Bz_KIMAyxnBeAQPjjNsthhzLangH1kIMztv5Zq4,1525
59
+ server/main.py,sha256=Ua8NX0Lf8PuqIoN7bq-gePN1fu6CW7IaDIUCLXmJhsM,5210
60
+ server/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
61
+ server/api/action_items.py,sha256=_Cqr_ZWjWolMSPSygkICHVE-zoDXFvw_WPH8X1D_gvc,5187
62
+ server/api/agents.py,sha256=-3d3-C5SFPwhU2y39xdfkbbwqIBuuec06DMAF86eicc,14818
63
+ server/api/audit.py,sha256=BN9mlsNClgamPBcOVL63FibgAt-5SQ0yEOJyOwtzb3Q,1910
64
+ server/api/background_tasks.py,sha256=ZPJV1nRbsDgZsY1gLwZQmhLaK12ftfSLb8gGWIp7s1g,460
65
+ server/api/common.py,sha256=vqZ78rjOnHld2MKV0PDShDBzByBSwsvYuc_Ihe6tCrs,2944
66
+ server/api/deps.py,sha256=9xZLbvJEQOO1dnHQpowTSsC3muCVvm_R73AB8hTe-I4,1166
67
+ server/api/experiments.py,sha256=Vde5i4uBgQ2OvQsep_vwYVjMJozohcNJMmudQIOow9k,31858
68
+ server/api/feedback.py,sha256=6uxZYhnSyylpC6K95f8zSHSFJw5JJtpVZXOVILSmWEw,2580
69
+ server/api/notifications.py,sha256=b1668evVQUYJbqdWx2GX22WE3AaGoKBNIYUlKd9Hz3w,782
70
+ server/api/projects.py,sha256=iSkseh9yU3A1r8AK-WggLWgTM4YTFhEtg3_LLgGcmgA,6834
71
+ server/api/router.py,sha256=tqhCuqQkZ4frTwd9NlKwsTCzH06BNRA6D0h5ybClcYg,773
72
+ server/api/status.py,sha256=Q0vj6pxKknJBB8fRrP_KMwG-RJ-C_w8wzao0gZk_huY,1149
73
+ server/api/topics.py,sha256=IMNH1DhEIct2uh2US1Rs8zEMeqXmwoQ9N7tKfXjd9_U,10919
74
+ server/api/webhooks.py,sha256=MmHdsuAW4Jtu7da2B4-x2nkwsYAh_-6xbFjpDVBGzgE,2517
75
+ server/auth/__init__.py,sha256=0s8vhHj8hZn_KyCcnTc9NGOUphYg1VttdHzVEztn2ek,238
76
+ server/auth/experiment_access.py,sha256=U54qsFgMEOKFQxHUhjzfNNW5kufnRv-by_h-DN2GyUM,2323
77
+ server/db/__init__.py,sha256=sWXDCgnwA_tKW2xX_Gdb29OrX0jiZDr66_ymKIcTfAU,127
78
+ server/db/base.py,sha256=mH7f2d_jiyxJSSx9Gk53QBXRa3LiKBsBjkFgvmtH1WA,83
79
+ server/db/deadlock_retry.py,sha256=D9KKx14II3QEmn49PQoWJC9VnEkwYRO2xEy2TvsS4K0,4813
80
+ server/db/session.py,sha256=wCzk3F_gZfK4E8580jyZF6aLpjzJjogtceKddrWZeWI,1372
81
+ server/domain/__init__.py,sha256=zge57nHAfU6SiVECtOVsxHBYIOZa64YwJGlhAyUg8qo,170
82
+ server/domain/encrypted_types.py,sha256=28gy_01LpJP9_6VCgsiVaAu-cGANvx2fgvkS7ui1lQw,2173
83
+ server/domain/models.py,sha256=XSdsrCQraEQPBdRRXOJMPpnmApehbR39QFAnFocdksw,37049
84
+ server/domain/schemas.py,sha256=VQZ15fCB_d30UpDf9GDJgz19JWfFsGGdJQSs_foJ1gk,121
85
+ server/domain/state_machine.py,sha256=qH43WInFA0qme_0j-AVy1VzZsaai_RaS5MTfoluq_c0,3170
86
+ server/domain/topic_ack_constants.py,sha256=FVuS2L3ph7rGPCyiS1TAldqmE3CYPAye36vr3UgGEMI,264
87
+ server/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
88
+ server/scripts/migrate_notification_unique.py,sha256=-tiKf-0E0R496fjsbVSMsoJcMuLPBwgWxHUCn8_QeHQ,8117
89
+ server/scripts/purge_audit_pollution.py,sha256=YyM2kVPG6907Cxc9arWs9CDMEWsOe7ERV0u7c4wlsOM,3928
90
+ server/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
91
+ server/services/_lookups.py,sha256=CWG5zxbvHbJWEHY9PcjaS8QFZKG283i7tflhRT0vPyA,1063
92
+ server/services/acceptance_service.py,sha256=CgKZq1NoAOx9jcwuhhJXzI2-9XCTQ_TrezCH_lpq4Pw,3271
93
+ server/services/action_item_migration_service.py,sha256=00E2zrogiTno3YSYFGvnLYFQ-1wMm0rGNnPAcF7GqE0,6271
94
+ server/services/action_item_service.py,sha256=yVoLBgR-rqEkf08fehWqhz2rkNdqWzsHr99JSNlYEUA,7333
95
+ server/services/agent_work_service.py,sha256=PW3-jfGmjv8o5vVjmwV8aTXY376rhLaSpl_wu6jRW8M,14415
96
+ server/services/archive_lint_service.py,sha256=XjFjSnQ0qKmXFLccN3raAjNvuhyfYLZAkfj4z6pMwUs,5617
97
+ server/services/audit_service.py,sha256=x0HwZUMx5EayfwwFp04MadJzurU5Smk9-IhgfdBAZOo,16637
98
+ server/services/auth.py,sha256=9ZMAmZOB0rYilfL_m9-MOldYUP-11eGoCVgQwBR_-ig,1783
99
+ server/services/comment_service.py,sha256=xtY-dEN6UkbY7TgvBzKLLof-oZiTFyWnCHlfTW2D02M,6065
100
+ server/services/errors.py,sha256=byoddRRxkY6vlYxXAEFpI8PjpxgJy035q8rh1l-YR1I,2115
101
+ server/services/escalation_resolver.py,sha256=y3p1FHJBurBrX3stBFnUGqK-5-d3KsAUIVRCjJhXQDU,9012
102
+ server/services/evidence_service.py,sha256=rDa00CiDMHIYHuY4QNZ7TJDxmUrkmn31HpxpI6V4uBk,2806
103
+ server/services/experiment_capabilities_service.py,sha256=unIH03pOSZN-DLMqmDlMNIUGsW7rbnTjQ1Q5EqeH9rg,9935
104
+ server/services/inbound_event_service.py,sha256=WwkVwePHtaMiRyIce_iYJfML3p1UGhoy9vx6oA1H7wk,4312
105
+ server/services/lock_service.py,sha256=eDae_iqPBswo7BtJznWETW5m8Fqp78E-46dmWmZdm4g,9686
106
+ server/services/log_service.py,sha256=KPxGccAhd8DKVmSqfkXxYVejf4W1sM7gRmi9CfPbDmk,6736
107
+ server/services/mention_service.py,sha256=Hw45C0d04DjmHliSoUvuiPuyr0ajumI2EoNw24BCjww,22597
108
+ server/services/notification_service.py,sha256=N2VluohfvUYBlV-wZ89r899aNYQQMnQBZCCLpee4X-c,33731
109
+ server/services/notification_stream.py,sha256=n_DztewmkPi53TUsfVrJZH8RGSCDTSAptd2_vqee5vk,4903
110
+ server/services/permissions.py,sha256=X-3Iaigdf-kp_G8gGJXuKjnMz2hYHuKm8g61jsrfRDM,5278
111
+ server/services/persona_activity_service.py,sha256=qNFlOgXVU-RngFL8giRco7HEwpiSyJvw7TSISTJW97c,3752
112
+ server/services/phase_owner_resolver.py,sha256=sBv46x9uWLT9MuWl8DeZuVT8k8XTInP0iBQxc1euhiw,3956
113
+ server/services/phase_service.py,sha256=P_BCRXy-99cNnDWUe3PxOQ-Q7W8-YIE5jUW2wWLP3gY,14694
114
+ server/services/plan_marker_service.py,sha256=VZGuPl8nKXQALaGGUTxEGjy79wRptYMkPH8fV1vB_MM,7680
115
+ server/services/plan_service.py,sha256=gkQTcLggEWJxgtJFSbPOL9E6hk70eDIMcygLUCNGJ4U,6522
116
+ server/services/platform_feedback_service.py,sha256=Qe1ALn8z4lPX_dCYb5rRsWqWGflwXTAGCoz2aO9FrMo,3785
117
+ server/services/project_service.py,sha256=wlRFsKc4L5B4IEr7rN5oAMVkHQxYHwiP4BZRy4eswd8,19667
118
+ server/services/project_status_service.py,sha256=fMty9G7WhVLOVCxo62LEwg8fVX8E4FCQ8V3TBOhPBNM,3983
119
+ server/services/review_service.py,sha256=-YiNwORylRC5hhktMIlB4UsAdAsmowbfOjFFzgZ-LN4,26047
120
+ server/services/secret_encryption.py,sha256=ZAzbdOWDy9KCesLIE9XKApoIEmMNWuvplDhknNMKZN8,3478
121
+ server/services/similarity_service.py,sha256=a1QKfXqDpe-hL0vayNoLAjWaxqz6bDNczVQfuuz1DZg,3773
122
+ server/services/sse_event_schemas.py,sha256=gb-uQ9z3GCB6qVg0cTyXyLZsadxq7yciIEujkEQdqpc,505
123
+ server/services/status_service.py,sha256=j15ycKc0ipeUKGUhV-h-J3Za_rNrTZsjkP8-5djWPL0,2496
124
+ server/services/template_service.py,sha256=m-6SESsfH4O6PmL10V1mJtDpPW9MPN8A5tT-QEEqc1o,4825
125
+ server/services/text_utils.py,sha256=n64B0VQhvzp8roSIrQ3gksA9e-xiocVhZhO3NuKl_Kw,725
126
+ server/services/thread_activity.py,sha256=pU5Ike5S1i0nkn8c6nPoQGmm-W43n_p6zkNpp8AbsPc,5719
127
+ server/services/todo_persona_filter.py,sha256=piBuGYwhMxq_O5Nbi9-wso6gXcGLHTN6usIwYx8tjN0,2471
128
+ server/services/todo_service.py,sha256=2xkU39ztqlnUVO193yoajRjYbaOg8jtARW-ua9qCM_k,22548
129
+ server/services/topic_ack_service.py,sha256=0cpktnTORRVD9Vk1N_IOcOXhvVnxZVJ89JDOuysTfrg,9426
130
+ server/services/topic_action_item_ops.py,sha256=9oYigRk7cMZ530ut_eNmAOl3G1w-SlSDt_96Tdnm1mE,20916
131
+ server/services/topic_comment_kind.py,sha256=aKKOHNcJL_lmjNdl65ZdpmuD7b3_tCO86XLvUm_Pz2o,484
132
+ server/services/topic_comment_service.py,sha256=h5Em1p0d2tl3UTOWRsllm8ex42sd82k9_bsmrtNNi-0,8222
133
+ server/services/topic_helpers.py,sha256=wLRPulCUuF6_fMVpO9GXA2YLfk7bWtEtpzy2TI57zy0,952
134
+ server/services/topic_lifecycle_service.py,sha256=Vmb83fFdCKGuZUSEatdwBCTTcbKuKMproypE6PuWl2g,16650
135
+ server/services/topic_progress_service.py,sha256=VpZ6bro66gGN2gm4ib5EnCQ5l7LxnwzAbZXYWBK_ZwU,1341
136
+ server/services/topic_resolve_service.py,sha256=ANDtlhWcO-TTCOfKHXobP08x47vO3vH8rdUvVAql7c0,9509
137
+ server/services/topic_service.py,sha256=7EbunTy5lzo1eqMZxkiF9TUHEDXvtDAUs6-ZvwAGlPI,3216
138
+ server/services/topic_work_item_service.py,sha256=C0pMLDt_Yov97C6mJoalQAFzj9ugZLMCWIL0SYpxuCM,19561
139
+ server/services/webhook_service.py,sha256=362dkpa2lh6-8Udbc1fPwCkt8afqDBFNraFCkfEsnb0,8866
140
+ multi_agent_platform-0.1.0.dist-info/METADATA,sha256=U3lrAM2QJAVvEZrSTW2P4gFFvciAtaWo4gj1SZszm1w,14100
141
+ multi_agent_platform-0.1.0.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
142
+ multi_agent_platform-0.1.0.dist-info/entry_points.txt,sha256=D8aLoPwykRa6TmK2QRswQpFpgbOfKeVhVooR-jqtP9A,194
143
+ multi_agent_platform-0.1.0.dist-info/top_level.txt,sha256=WuC3PW_cYtX_QG9pSErtIvxkw1i8XSHoATW1YD2EbIA,48
144
+ multi_agent_platform-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (83.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,6 @@
1
+ [console_scripts]
2
+ map = cli.main:main
3
+ map-mcp = map_mcp.main:cli
4
+ map-participant-bridge = cli.participant_worker:main
5
+ map-reviewer-bridge = cli.reviewer_worker:main
6
+ map-server = server.main:run
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 multi-agent-platform contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,6 @@
1
+ cli
2
+ map_client
3
+ map_mcp
4
+ map_sdk
5
+ map_types
6
+ server
server/__init__.py ADDED
File without changes
server/__version__.py ADDED
@@ -0,0 +1,14 @@
1
+ """Single source of truth for the server package version.
2
+
3
+ eng experiment (55634575) PR7: this module exists so ``server.main``,
4
+ the SDK, and CLI all read the same string. ``pyproject.toml`` is the
5
+ release-of-record (it's what ``uv build`` ships), but Python imports
6
+ can't easily read TOML, so we mirror the version here and pin the
7
+ invariant with a unit test (``test_eng_version_single_source``).
8
+
9
+ Release workflow: bump this string + the ``[project] version = ...``
10
+ line in ``pyproject.toml`` in the same commit. The test fails if the
11
+ two drift.
12
+ """
13
+
14
+ __version__ = "0.1.0"
server/api/__init__.py ADDED
File without changes
@@ -0,0 +1,138 @@
1
+ """Action-item lifecycle endpoints (experiment A1).
2
+
3
+ Only the explicit close paths (``complete`` / ``cancel``) live here; ``list``
4
+ stays under ``/projects/{id}/action-items`` in projects.py for backward
5
+ compatibility with the existing ``map action list`` CLI.
6
+
7
+ Experiment B (plan §3 / I4): also exposes ``mark-wake-sent`` and ``mark-stale``
8
+ so the runtime-waker CLI process can advance the three-stage escalation
9
+ timeline without a direct DB session. Both endpoints delegate to the public
10
+ ``topic_service.mark_wake_sent_action_item`` / ``mark_stale_action_item``
11
+ wrappers which run the access check + commit + read-back.
12
+ """
13
+
14
+ import uuid
15
+
16
+ from fastapi import APIRouter, Depends, status
17
+ from map_types.schemas import ActionItemCancel, TopicActionItemRead
18
+ from sqlalchemy.orm import Session
19
+
20
+ from server.api.deps import get_current_agent
21
+ from server.db.session import get_db
22
+ from server.domain.models import Agent
23
+ from server.services import topic_service
24
+
25
+ action_items_router = APIRouter(tags=["action_items"])
26
+
27
+
28
+ @action_items_router.post(
29
+ "/action-items/{action_item_id}/complete",
30
+ response_model=TopicActionItemRead,
31
+ status_code=status.HTTP_200_OK,
32
+ )
33
+ def complete_action_item(
34
+ action_item_id: uuid.UUID,
35
+ db: Session = Depends(get_db),
36
+ agent: Agent = Depends(get_current_agent),
37
+ ) -> TopicActionItemRead:
38
+ """Move an open action item to ``done``.
39
+
40
+ Returns 404 if the item doesn't exist, 403 if the caller is neither the
41
+ owner nor admin, 409 if the item is already ``done`` or ``cancelled``.
42
+ """
43
+ return topic_service.complete_action_item(db, action_item_id, agent)
44
+
45
+
46
+ @action_items_router.post(
47
+ "/action-items/{action_item_id}/deliver",
48
+ response_model=TopicActionItemRead,
49
+ status_code=status.HTTP_200_OK,
50
+ )
51
+ def deliver_action_item(
52
+ action_item_id: uuid.UUID,
53
+ db: Session = Depends(get_db),
54
+ agent: Agent = Depends(get_current_agent),
55
+ ) -> TopicActionItemRead:
56
+ """Deliver (complete) an open action item when its source topic is closed/archived."""
57
+ return topic_service.deliver_action_item(db, action_item_id, agent)
58
+
59
+
60
+ @action_items_router.post(
61
+ "/action-items/{action_item_id}/cancel",
62
+ response_model=TopicActionItemRead,
63
+ status_code=status.HTTP_200_OK,
64
+ )
65
+ def cancel_action_item(
66
+ action_item_id: uuid.UUID,
67
+ payload: ActionItemCancel,
68
+ db: Session = Depends(get_db),
69
+ agent: Agent = Depends(get_current_agent),
70
+ ) -> TopicActionItemRead:
71
+ """Move an open action item to ``cancelled`` and persist cancel_reason.
72
+
73
+ Reason length is validated per-category by ``ActionItemCancel`` so the
74
+ CLI layer can't bypass the API gate (A1 acceptance A1-3 / A1-4).
75
+ """
76
+ return topic_service.cancel_action_item(db, action_item_id, agent, payload)
77
+
78
+
79
+ @action_items_router.post(
80
+ "/action-items/{action_item_id}/link",
81
+ response_model=TopicActionItemRead,
82
+ status_code=status.HTTP_200_OK,
83
+ )
84
+ def link_action_item(
85
+ action_item_id: uuid.UUID,
86
+ experiment_id: uuid.UUID,
87
+ db: Session = Depends(get_db),
88
+ agent: Agent = Depends(get_current_agent),
89
+ ) -> TopicActionItemRead:
90
+ """Attach an experiment to an open action item (``linked_experiment_id``).
91
+
92
+ Used to enable the ``experiment.completed → action_item.done`` cascade
93
+ when the action item was created without an explicit link. Owner or admin
94
+ only; cross-project links are rejected with 409.
95
+ """
96
+ return topic_service.link_action_item(db, action_item_id, experiment_id, agent)
97
+
98
+
99
+ @action_items_router.post(
100
+ "/action-items/{action_item_id}/mark-wake-sent",
101
+ response_model=TopicActionItemRead,
102
+ status_code=status.HTTP_200_OK,
103
+ )
104
+ def mark_wake_sent_endpoint(
105
+ action_item_id: uuid.UUID,
106
+ db: Session = Depends(get_db),
107
+ agent: Agent = Depends(get_current_agent),
108
+ ) -> TopicActionItemRead:
109
+ """Bump ``wake_count`` + stamp ``last_woken_at`` + audit row.
110
+
111
+ Called by the runtime-waker CLI process when ``should_wake_action_item``
112
+ returns ``'wake'`` (experiment B, plan §3 / I4). Owner or admin only —
113
+ mirrors the access model used by ``complete`` / ``cancel`` so a waker
114
+ driven by a non-owner admin agent can still escalate a forgotten item.
115
+ """
116
+ return topic_service.mark_wake_sent_action_item(db, action_item_id, agent)
117
+
118
+
119
+ @action_items_router.post(
120
+ "/action-items/{action_item_id}/mark-stale",
121
+ response_model=TopicActionItemRead,
122
+ status_code=status.HTTP_200_OK,
123
+ )
124
+ def mark_stale_endpoint(
125
+ action_item_id: uuid.UUID,
126
+ db: Session = Depends(get_db),
127
+ agent: Agent = Depends(get_current_agent),
128
+ ) -> TopicActionItemRead:
129
+ """Stamp ``stale_at`` + write the ``action_item.stale`` audit row.
130
+
131
+ Called by the runtime-waker CLI process when ``should_wake_action_item``
132
+ returns ``'stale'`` (plan §3 / I4 — the 4th unanswered wake). Admin-only
133
+ by design: a stale transition is a system-level escalation that should
134
+ not be triggerable by the assignee themselves. ``admin_notified=True``
135
+ and ``creator_audit_only=True`` are passed by default per plan §3 §6
136
+ (3c admin 优先 + 6 creator 不 wake); I6 will wire actual admin delivery.
137
+ """
138
+ return topic_service.mark_stale_action_item(db, action_item_id, agent)