openteam 0.1.2 → 0.4.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 (36) hide show
  1. package/README.md +40 -19
  2. package/bin/openteam.js +39 -729
  3. package/examples/dev-team/architect.md +19 -4
  4. package/examples/dev-team/developer.md +16 -6
  5. package/examples/dev-team/pm.md +12 -0
  6. package/examples/dev-team/qa.md +12 -0
  7. package/examples/dev-team/readme.md +4 -4
  8. package/examples/dev-team/skills/incremental-implementation/SKILL.md +139 -0
  9. package/examples/dev-team/skills/self-verification/SKILL.md +164 -0
  10. package/examples/dev-team/skills/technical-feasibility/SKILL.md +136 -0
  11. package/package.json +3 -3
  12. package/src/capabilities/lifecycle.js +307 -0
  13. package/src/capabilities/messaging.js +225 -0
  14. package/src/{team → foundation}/config.js +3 -10
  15. package/src/foundation/constants.js +58 -0
  16. package/src/{utils → foundation}/logger.js +25 -53
  17. package/src/{utils/api.js → foundation/opencode.js} +86 -98
  18. package/src/foundation/state.js +373 -0
  19. package/src/foundation/terminal.js +515 -0
  20. package/src/index.js +6 -6
  21. package/src/interfaces/cli.js +469 -0
  22. package/src/interfaces/daemon/index.js +160 -0
  23. package/src/interfaces/daemon/panes.js +133 -0
  24. package/src/interfaces/daemon/serve.js +95 -0
  25. package/src/{dashboard → interfaces/dashboard}/data.js +47 -37
  26. package/src/interfaces/dashboard/index.js +107 -0
  27. package/src/{dashboard → interfaces/dashboard}/ui.js +30 -7
  28. package/src/interfaces/plugin/hooks.js +16 -0
  29. package/src/interfaces/plugin/tools.js +143 -0
  30. package/src/constants.js +0 -23
  31. package/src/dashboard/index.js +0 -76
  32. package/src/plugin/hooks.js +0 -145
  33. package/src/plugin/tools.js +0 -308
  34. package/src/team/serve.js +0 -290
  35. package/src/utils/agent.js +0 -110
  36. package/src/utils/settings.js +0 -73
package/README.md CHANGED
@@ -6,9 +6,16 @@
6
6
 
7
7
  - Leader-成员协作模型,支持异步消息通信。
8
8
  - 同一 agent 支持多实例(不同 `cwd` 下并行运行)。
9
- - `monitor` 一键分屏监控(tmux/zellij,2x2 布局)。
9
+ - Daemon 统一管理团队生命周期(serve、pane、健康检查)。
10
10
  - `dashboard` 实时仪表盘查看团队状态。
11
11
 
12
+ ## 环境要求
13
+
14
+ | 依赖 | 要求 |
15
+ |------|------|
16
+ | Node.js | 18+ |
17
+ | tmux 或 zellij | 任一 |
18
+
12
19
  ## 安装
13
20
 
14
21
  ```bash
@@ -96,7 +103,7 @@ mkdir -p ~/.opencode/agents/dev-team
96
103
  cp examples/dev-team/team.json ~/.opencode/agents/dev-team/
97
104
 
98
105
  # 复制角色提示词
99
- cp examples/dev-team/{pm,architect,developer,qa}.md ~/.opencode/agents/
106
+ cp examples/dev-team/{pm,architect,developer,qa}.md ~/.opencode/agents/dev-team/
100
107
 
101
108
  # 安装 skills
102
109
  cp -r examples/dev-team/skills/* ~/.opencode/skills/
@@ -109,18 +116,21 @@ openteam start dev-team
109
116
 
110
117
  | 命令 | 说明 |
111
118
  |------|------|
112
- | `openteam start [team]` | 启动团队 serve;前台模式会直接进入 leader 会话 |
119
+ | `openteam start [team]` | 启动团队(创建 tmux/zellij session + daemon) |
113
120
  | `openteam start [team] -d` | 后台启动 |
114
121
  | `openteam start [team] --dir <directory>` | 指定项目目录 |
115
122
  | `openteam attach [team] [agent]` | 附加到 agent 会话(默认 leader) |
116
- | `openteam attach [team] [agent] --watch` | 监视模式,自动跟随会话变化 |
117
- | `openteam attach [team] [agent] --cwd <directory>` | 仅在 `--watch` 下筛选实例 |
118
- | `openteam monitor [team]` | 打开分屏监控(自动检测 zellij/tmux) |
119
- | `openteam monitor [team] --zellij/--tmux` | 强制使用指定复用器 |
123
+ | `openteam attach [team] [agent] --dir <directory>` | 指定项目目录 |
124
+ | `openteam monitor [team]` | `start` 的别名 |
120
125
  | `openteam list` / `openteam ls` | 列出所有已配置团队及运行状态 |
121
126
  | `openteam status <team>` | 查看运行状态与会话有效性 |
122
- | `openteam stop <team>` | 停止团队并清理运行时映射 |
127
+ | `openteam status <team> --dir <directory>` | 指定项目目录 |
128
+ | `openteam stop <team>` | 停止团队(SIGTERM daemon) |
129
+ | `openteam stop <team> --dir <directory>` | 指定项目目录 |
123
130
  | `openteam dashboard <team>` | 启动实时状态仪表盘 |
131
+ | `openteam dashboard <team> --dir <directory>` | 指定项目目录 |
132
+
133
+ 同一团队可在不同项目目录启动多个实例。当存在多个实例时,`attach`、`status`、`stop`、`dashboard` 需要 `--dir` 指定目标实例。
124
134
 
125
135
  ## 团队工具
126
136
 
@@ -137,24 +147,24 @@ openteam start dev-team
137
147
 
138
148
  ## 运行时文件
139
149
 
140
- 运行时数据位于 `~/.opencode/agents/<team>/`:
150
+ 团队配置和运行时数据分为两级:
141
151
 
142
152
  ```text
143
- team.json
144
- .runtime.json
145
- .active-sessions.json
146
- <agent>.md
153
+ ~/.opencode/agents/<team>/
154
+ ├── team.json # 团队配置(团队级)
155
+ ├── <agent>.md # agent 提示词(团队级)
156
+ └── <hash>/ # 项目级状态目录(hash = projectDir 的 SHA-256 前 8 位)
157
+ ├── .runtime.json # daemon/serve/mux 运行状态
158
+ └── .active-sessions.json # agent → [{ sessionId, cwd }] 会话映射
147
159
  ```
148
160
 
149
- - `.runtime.json`: `host`、`port`、`pid`、`projectDir`、`started`,监控时会写入 `monitor` 信息。
150
- - `.active-sessions.json`: `agent -> [{ sessionId, cwd, alias? }]` 多实例映射(兼容旧格式字符串)。
161
+ - `.runtime.json` 包含 `daemon.pid`、`serve.pid/port/host`、`mux.type/session` 等字段。
162
+ - `.active-sessions.json` 持久化 agent 的多实例会话映射。
151
163
 
152
164
  ## 注意事项
153
165
 
154
- - 插件仅在 `OPENTEAM_TEAM` 环境变量存在时启用,建议始终通过 `openteam start` 启动。
155
- - `attach --watch` 会持续轮询并保持等待,按 `Ctrl+C` 退出。
156
- - `monitor` 使用 2x2 分组,不足 4 个 pane 会用最后一个 agent 补齐。
157
- - `stop` 会清空 `.active-sessions.json`(会话映射重置)。
166
+ - 插件仅在 `OPENTEAM_TEAM` 环境变量存在时启用,始终通过 `openteam start` 启动。
167
+ - `stop` daemon 发送 SIGTERM;daemon 负责停止 serve 和清理 runtime,CLI 会在 daemon 退出后兜底销毁 mux session。
158
168
 
159
169
  ## 调试与日志
160
170
 
@@ -168,6 +178,17 @@ OPENTEAM_LOG=1 OPENTEAM_LOG_LEVEL=debug openteam start myteam
168
178
 
169
179
  - 日志文件:`~/.openteam/openteam.log`
170
180
 
181
+ ## 上游依赖说明
182
+
183
+ 代码通过 `@opencode-ai/plugin/tool` 子路径导入,绕过上游根入口在 Node ESM 下的扩展名问题。
184
+
185
+ ## 更多文档
186
+
187
+ - 架构与模块边界:`docs/architecture.md`
188
+ - 开发与验证:`docs/development-guide.md`
189
+ - 示例团队:`examples/dev-team/readme.md`
190
+ - 历史设计记录:`docs/archive/`
191
+
171
192
  ## 许可证
172
193
 
173
194
  MIT