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,151 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass
4
+ from pathlib import Path
5
+ from typing import Any, Protocol
6
+
7
+ DEFAULT_REPLY_TEMPLATE = """已收到这个 thread 的反馈。
8
+
9
+ - 评论摘要:{excerpt}
10
+ - 处理状态:已纳入主持跟进;如需进入实验,我会在本话题完成必要讨论后从 host persona 创建关联实验。
11
+ """
12
+
13
+
14
+ class WorkerError(RuntimeError):
15
+ pass
16
+
17
+
18
+ class MapClientProtocol(Protocol):
19
+ def whoami(self) -> dict[str, Any]:
20
+ ...
21
+
22
+ def todos(self) -> dict[str, Any]:
23
+ ...
24
+
25
+ def topic_show(self, topic_id: str) -> dict[str, Any]:
26
+ ...
27
+
28
+ def topic_comment(self, topic_id: str, body: str, parent_id: str | None = None) -> dict[str, Any] | None:
29
+ ...
30
+
31
+ def topic_advance_round(self, topic_id: str) -> dict[str, Any] | None:
32
+ ...
33
+
34
+ def topic_resolve(self, topic_id: str, payload: dict[str, Any]) -> dict[str, Any] | None:
35
+ ...
36
+
37
+ def experiment_create(
38
+ self,
39
+ title: str,
40
+ plan_file: Path,
41
+ *,
42
+ topic_id: str,
43
+ submit_for_review: bool,
44
+ ) -> dict[str, Any] | None:
45
+ ...
46
+
47
+ def experiment_status(self, experiment_id: str) -> dict[str, Any]:
48
+ ...
49
+
50
+ def experiment_submit_review(self, experiment_id: str) -> dict[str, Any] | None:
51
+ ...
52
+
53
+ def experiment_reviews_list(self, experiment_id: str) -> list[dict[str, Any]]:
54
+ ...
55
+
56
+ def plan_revise(
57
+ self,
58
+ experiment_id: str,
59
+ plan_file: Path,
60
+ *,
61
+ note: str | None,
62
+ addressed_item_ids: list[str],
63
+ ) -> dict[str, Any] | None:
64
+ ...
65
+
66
+ def experiment_approve(self, experiment_id: str) -> dict[str, Any] | None:
67
+ ...
68
+
69
+ def experiment_start(self, experiment_id: str) -> dict[str, Any] | None:
70
+ ...
71
+
72
+ def experiment_complete(self, experiment_id: str, *, summary: str, log_file: Path) -> dict[str, Any] | None:
73
+ ...
74
+
75
+ def experiment_acquire_lock(self, experiment_id: str, *, ttl_seconds: int) -> dict[str, Any] | None:
76
+ ...
77
+
78
+ def experiment_release_lock(self, experiment_id: str) -> dict[str, Any] | None:
79
+ ...
80
+
81
+ def experiment_force_release_lock(
82
+ self, experiment_id: str, *, reason: str, actor: str | None = None
83
+ ) -> dict[str, Any] | None:
84
+ ...
85
+
86
+ def experiment_record_skip(
87
+ self, experiment_id: str, *, next_attempt_at: str
88
+ ) -> dict[str, Any] | None:
89
+ ...
90
+
91
+
92
+ @dataclass
93
+ class WorkerConfig:
94
+ interval: float = 30.0
95
+ once: bool = False
96
+ max_cycles: int | None = None
97
+ dry_run: bool = False
98
+ reply_template: str = DEFAULT_REPLY_TEMPLATE
99
+ manage_topic_lifecycle: bool = True
100
+ promote_ready_topics: bool = False
101
+ submit_created_experiment_for_review: bool = False
102
+ min_participant_comments: int = 1
103
+ min_round_summaries: int = 2
104
+ max_lifecycle_actions_per_cycle: int = 1
105
+ auto_experiment_lifecycle: bool = True
106
+ plan_dir: Path | None = None
107
+ agent_runner: str | None = None
108
+ runner_timeout: float = 120.0
109
+ state_file: Path | None = Path(".map/host-bridge-state.json")
110
+
111
+
112
+ @dataclass
113
+ class WorkerStats:
114
+ cycles: int = 0
115
+ replies_created: int = 0
116
+ summaries_created: int = 0
117
+ decisions_recorded: int = 0
118
+ experiments_created: int = 0
119
+ plans_revised: int = 0
120
+ experiments_submitted: int = 0
121
+ experiments_approved: int = 0
122
+ experiments_started: int = 0
123
+ experiments_completed: int = 0
124
+ dry_run_actions: int = 0
125
+ runner_invocations: int = 0
126
+ runner_skips: int = 0
127
+ runner_errors: int = 0
128
+ round_advances: int = 0
129
+ lock_acquired: int = 0
130
+ lock_skipped: int = 0
131
+ lock_force_released: int = 0
132
+
133
+ def add(self, other: WorkerStats) -> None:
134
+ self.cycles += other.cycles
135
+ self.replies_created += other.replies_created
136
+ self.summaries_created += other.summaries_created
137
+ self.decisions_recorded += other.decisions_recorded
138
+ self.experiments_created += other.experiments_created
139
+ self.plans_revised += other.plans_revised
140
+ self.experiments_submitted += other.experiments_submitted
141
+ self.experiments_approved += other.experiments_approved
142
+ self.experiments_started += other.experiments_started
143
+ self.experiments_completed += other.experiments_completed
144
+ self.dry_run_actions += other.dry_run_actions
145
+ self.runner_invocations += other.runner_invocations
146
+ self.runner_skips += other.runner_skips
147
+ self.runner_errors += other.runner_errors
148
+ self.round_advances += other.round_advances
149
+ self.lock_acquired += other.lock_acquired
150
+ self.lock_skipped += other.lock_skipped
151
+ self.lock_force_released += other.lock_force_released