openteam 0.1.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.
package/README.md ADDED
@@ -0,0 +1,127 @@
1
+ # OpenTeam
2
+
3
+ 面向 OpenCode 的 Agent 团队协作插件,负责多 Agent 协作、会话编排和多实例管理。
4
+
5
+ ## 定位
6
+
7
+ - OpenTeam 只负责团队协作能力:`msg` / `command`、CLI 编排、监控与状态管理。
8
+ - 本仓库不再包含 memory 实现;如需记忆能力,请使用独立插件 `openmemory`。
9
+
10
+ ## 核心能力
11
+
12
+ - Leader-成员协作模型,支持异步消息通信。
13
+ - 同一 agent 支持多实例(不同 `cwd` 下并行运行)。
14
+ - `monitor` 一键分屏监控(tmux/zellij,2x2 布局)。
15
+ - `dashboard` 实时仪表盘查看团队状态。
16
+
17
+ ## 安装
18
+
19
+ ```bash
20
+ npm install -g openteam
21
+ ```
22
+
23
+ ## 快速开始
24
+
25
+ ### 1) 配置 OpenCode 插件
26
+
27
+ 在 `~/.opencode/opencode.json` 中添加:
28
+
29
+ ```json
30
+ {
31
+ "plugin": ["openteam"]
32
+ }
33
+ ```
34
+
35
+ ### 2) 创建团队配置
36
+
37
+ 创建 `~/.opencode/agents/<team>/team.json`:
38
+
39
+ ```json
40
+ {
41
+ "name": "myteam",
42
+ "leader": "pm",
43
+ "host": "127.0.0.1",
44
+ "port": 0,
45
+ "agents": ["pm", "architect", "developer", "qa"]
46
+ }
47
+ ```
48
+
49
+ - `leader` 必须包含在 `agents` 中。
50
+ - `port: 0` 表示自动在 `4096-4200` 之间分配可用端口。
51
+
52
+ ### 3) 创建 Agent 提示词
53
+
54
+ 在 `~/.opencode/agents/<team>/` 下创建对应角色文件(如 `pm.md`、`developer.md`)。
55
+
56
+ ### 4) 启动团队
57
+
58
+ ```bash
59
+ openteam start myteam
60
+ ```
61
+
62
+ ## CLI 命令
63
+
64
+ | 命令 | 说明 |
65
+ |------|------|
66
+ | `openteam start [team]` | 启动团队 serve;前台模式会直接进入 leader 会话 |
67
+ | `openteam start [team] -d` | 后台启动 |
68
+ | `openteam start [team] --dir <directory>` | 指定项目目录 |
69
+ | `openteam attach [team] [agent]` | 附加到 agent 会话(默认 leader) |
70
+ | `openteam attach [team] [agent] --watch` | 监视模式,自动跟随会话变化 |
71
+ | `openteam attach [team] [agent] --cwd <directory>` | 仅在 `--watch` 下筛选实例 |
72
+ | `openteam monitor [team]` | 打开分屏监控(自动检测 zellij/tmux) |
73
+ | `openteam monitor [team] --zellij/--tmux` | 强制使用指定复用器 |
74
+ | `openteam list` / `openteam ls` | 列出所有已配置团队及运行状态 |
75
+ | `openteam status <team>` | 查看运行状态与会话有效性 |
76
+ | `openteam stop <team>` | 停止团队并清理运行时映射 |
77
+ | `openteam dashboard <team>` | 启动实时状态仪表盘 |
78
+
79
+ ## 团队工具
80
+
81
+ | 工具 | 权限 | 说明 |
82
+ |------|------|------|
83
+ | `msg` | 全员可用(仅 leader 可广播) | 异步消息;目标离线会自动唤醒并建会话 |
84
+ | `command` | 仅 leader | `status` / `free` / `redirect` |
85
+
86
+ ### `command` 行为说明
87
+
88
+ - `status`: 查看成员实例状态。
89
+ - `free`: 让成员实例下线;若该成员有多个实例,必须指定 `cwd` 或 `alias`。
90
+ - `redirect`: 清空目标成员当前实例后,在新目录创建实例。
91
+
92
+ ## 运行时文件
93
+
94
+ 运行时数据位于 `~/.opencode/agents/<team>/`:
95
+
96
+ ```text
97
+ team.json
98
+ .runtime.json
99
+ .active-sessions.json
100
+ <agent>.md
101
+ ```
102
+
103
+ - `.runtime.json`: `host`、`port`、`pid`、`projectDir`、`started`,监控时会写入 `monitor` 信息。
104
+ - `.active-sessions.json`: `agent -> [{ sessionId, cwd, alias? }]` 多实例映射(兼容旧格式字符串)。
105
+
106
+ ## 注意事项
107
+
108
+ - 插件仅在 `OPENTEAM_TEAM` 环境变量存在时启用,建议始终通过 `openteam start` 启动。
109
+ - `attach --watch` 会持续轮询并保持等待,按 `Ctrl+C` 退出。
110
+ - `monitor` 使用 2x2 分组,不足 4 个 pane 会用最后一个 agent 补齐。
111
+ - `stop` 会清空 `.active-sessions.json`(会话映射重置)。
112
+
113
+ ## 调试与日志
114
+
115
+ ```bash
116
+ # 启用日志
117
+ OPENTEAM_LOG=1 openteam start myteam
118
+
119
+ # 设置日志级别 (debug/info/warn/error)
120
+ OPENTEAM_LOG=1 OPENTEAM_LOG_LEVEL=debug openteam start myteam
121
+ ```
122
+
123
+ - 日志文件:`~/.openteam/openteam.log`
124
+
125
+ ## 许可证
126
+
127
+ MIT