@te-river/opencode-team-mode 1.1.0 → 1.2.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.
- package/README.md +50 -3
- package/README.zh-CN.md +42 -3
- package/dist/agents.d.ts +13 -3
- package/dist/agents.d.ts.map +1 -1
- package/dist/agents.js +297 -90
- package/dist/agents.js.map +1 -1
- package/dist/blackboard.d.ts +45 -0
- package/dist/blackboard.d.ts.map +1 -0
- package/dist/blackboard.js +131 -0
- package/dist/blackboard.js.map +1 -0
- package/dist/commands.d.ts.map +1 -1
- package/dist/commands.js +14 -4
- package/dist/commands.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +38 -1
- package/dist/index.js.map +1 -1
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -99,7 +99,7 @@ After installing, add the plugin to your `opencode.jsonc`:
|
|
|
99
99
|
{
|
|
100
100
|
"$schema": "https://opencode.ai/config.json",
|
|
101
101
|
"plugin": [
|
|
102
|
-
"@te-river/opencode-team-mode"
|
|
102
|
+
"@te-river/opencode-team-mode@latest"
|
|
103
103
|
]
|
|
104
104
|
}
|
|
105
105
|
```
|
|
@@ -117,7 +117,7 @@ To enable TeamMode in every project, add the plugin to your global config:
|
|
|
117
117
|
{
|
|
118
118
|
"$schema": "https://opencode.ai/config.json",
|
|
119
119
|
"plugin": [
|
|
120
|
-
"@te-river/opencode-team-mode"
|
|
120
|
+
"@te-river/opencode-team-mode@latest"
|
|
121
121
|
]
|
|
122
122
|
}
|
|
123
123
|
```
|
|
@@ -190,6 +190,7 @@ opencode-team-mode/
|
|
|
190
190
|
│ ├── index.ts ← Plugin entry (v2 format, id: "team-mode")
|
|
191
191
|
│ ├── agents.ts ← Agent definitions (prompts, modes, colors)
|
|
192
192
|
│ ├── commands.ts ← Command definitions (templates, agent bindings)
|
|
193
|
+
│ ├── blackboard.ts ← Shared blackboard + TTL auto-cleanup sweeper
|
|
193
194
|
│ └── types.ts ← v2 Plugin API type definitions
|
|
194
195
|
├── scripts/
|
|
195
196
|
│ ├── install.sh ← One-click installer (bash)
|
|
@@ -202,13 +203,59 @@ opencode-team-mode/
|
|
|
202
203
|
### How it works
|
|
203
204
|
|
|
204
205
|
1. OpenCode Desktop starts and loads `opencode.json`.
|
|
205
|
-
2. It sees `"@te-river/opencode-team-mode"` in the `plugin` array and loads the npm package.
|
|
206
|
+
2. It sees `"@te-river/opencode-team-mode@latest"` in the `plugin` array and loads the npm package.
|
|
206
207
|
3. The plugin's v2 `setup` function runs, using `ctx.agent.transform()` and `ctx.command.transform()` to inject 6 agents and 6 commands.
|
|
207
208
|
4. The plugin's `id: "team-mode"` is displayed as the plugin name in the Desktop UI.
|
|
208
209
|
5. Agents and commands are immediately available in the Desktop UI — no file copying needed.
|
|
209
210
|
|
|
210
211
|
---
|
|
211
212
|
|
|
213
|
+
## 🗂️ Shared Blackboard (with automatic cleanup)
|
|
214
|
+
|
|
215
|
+
Sub-agents cannot message each other live (platform limitation), so TeamMode coordinates them through a **file blackboard**:
|
|
216
|
+
|
|
217
|
+
- Each multi-agent task gets its own directory under
|
|
218
|
+
`<repo>/.git/opencode-team/<task-slug>/` — inside `.git/`, so your working
|
|
219
|
+
tree and commits are **never polluted**. (Non-git workspaces fall back to
|
|
220
|
+
the OS temp dir.)
|
|
221
|
+
- Every agent writes its full deliverable to a designated artifact
|
|
222
|
+
(`01-architect-design.md`, `03-review-findings.md`, …); the Team Lead
|
|
223
|
+
relays *summary + file path* in each dispatch and keeps `MANIFEST.md` as
|
|
224
|
+
the index. Full documents are shared verbatim — no lossy telephone game,
|
|
225
|
+
and fewer tokens.
|
|
226
|
+
- The Team Lead also enforces a review/test **feedback loop**: Critical/Major
|
|
227
|
+
findings and product bugs automatically become tracked fix tasks until the
|
|
228
|
+
deliverable converges.
|
|
229
|
+
|
|
230
|
+
### Cleanup — two layers
|
|
231
|
+
|
|
232
|
+
| Layer | Who | When |
|
|
233
|
+
|---|---|---|
|
|
234
|
+
| Fast path | Team Lead (prompt rule) | Deletes the task directory right after the final report |
|
|
235
|
+
| Safety net | Plugin code (in-process sweeper) | At startup + every hour: removes task directories idle **beyond the TTL** |
|
|
236
|
+
|
|
237
|
+
The sweeper is pure code — it never relies on the model remembering to
|
|
238
|
+
delete, and it also cleans up leftovers from crashes or force-kills.
|
|
239
|
+
|
|
240
|
+
### Configure the TTL
|
|
241
|
+
|
|
242
|
+
Default is **5 days**. To choose your own, use the tuple plugin form in
|
|
243
|
+
`opencode.jsonc`:
|
|
244
|
+
|
|
245
|
+
```jsonc
|
|
246
|
+
{
|
|
247
|
+
"$schema": "https://opencode.ai/config.json",
|
|
248
|
+
"plugin": [
|
|
249
|
+
["@te-river/opencode-team-mode@latest", { "ttlDays": 7 }]
|
|
250
|
+
]
|
|
251
|
+
}
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
`ttlDays` accepts any number of days in `(0, 365]`; invalid values silently
|
|
255
|
+
fall back to 5.
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
212
259
|
## 🔧 Customization
|
|
213
260
|
|
|
214
261
|
### Override an agent
|
package/README.zh-CN.md
CHANGED
|
@@ -99,7 +99,7 @@ npm link
|
|
|
99
99
|
{
|
|
100
100
|
"$schema": "https://opencode.ai/config.json",
|
|
101
101
|
"plugin": [
|
|
102
|
-
"@te-river/opencode-team-mode"
|
|
102
|
+
"@te-river/opencode-team-mode@latest"
|
|
103
103
|
]
|
|
104
104
|
}
|
|
105
105
|
```
|
|
@@ -117,7 +117,7 @@ npm link
|
|
|
117
117
|
{
|
|
118
118
|
"$schema": "https://opencode.ai/config.json",
|
|
119
119
|
"plugin": [
|
|
120
|
-
"@te-river/opencode-team-mode"
|
|
120
|
+
"@te-river/opencode-team-mode@latest"
|
|
121
121
|
]
|
|
122
122
|
}
|
|
123
123
|
```
|
|
@@ -190,6 +190,7 @@ opencode-team-mode/
|
|
|
190
190
|
│ ├── index.ts ← 插件入口(v2 格式,id: "team-mode")
|
|
191
191
|
│ ├── agents.ts ← Agent 定义(prompts、模式、颜色)
|
|
192
192
|
│ ├── commands.ts ← 命令定义(模板、Agent 绑定)
|
|
193
|
+
│ ├── blackboard.ts ← 共享黑板 + TTL 自动清理清扫器
|
|
193
194
|
│ └── types.ts ← v2 Plugin API 类型定义
|
|
194
195
|
├── scripts/
|
|
195
196
|
│ ├── install.sh ← 一键安装脚本(bash)
|
|
@@ -202,12 +203,50 @@ opencode-team-mode/
|
|
|
202
203
|
### 工作原理
|
|
203
204
|
|
|
204
205
|
1. OpenCode 桌面版启动,加载 `opencode.json`
|
|
205
|
-
2. 检测到 `plugin` 数组中的 `"@te-river/opencode-team-mode"`,加载 npm 包
|
|
206
|
+
2. 检测到 `plugin` 数组中的 `"@te-river/opencode-team-mode@latest"`,加载 npm 包
|
|
206
207
|
3. 插件的 `setup` 函数执行,通过 `ctx.agent.transform()` 和 `ctx.command.transform()` 注入 6 个 Agent 和 6 个命令
|
|
207
208
|
4. Agent 和命令立即在桌面版 UI 中可用 —— 无需复制任何文件
|
|
208
209
|
|
|
209
210
|
---
|
|
210
211
|
|
|
212
|
+
## 🗂️ 共享黑板(带自动清理)
|
|
213
|
+
|
|
214
|
+
子代理之间无法实时互发消息(平台限制),TeamMode 通过**文件黑板**让它们协作:
|
|
215
|
+
|
|
216
|
+
- 每个多 Agent 任务在 `<repo>/.git/opencode-team/<task-slug>/` 下拥有独立目录 ——
|
|
217
|
+
位于 `.git/` 内,**绝不污染**你的工作区和 commit(非 git 工作区自动回退到系统临时目录)。
|
|
218
|
+
- 每个 Agent 把完整产出写入指定文件(`01-architect-design.md`、`03-review-findings.md`
|
|
219
|
+
等),Team Lead 在派发时传递*摘要 + 文件路径*,并维护 `MANIFEST.md` 索引。
|
|
220
|
+
全文档原文共享 —— 没有"传话失真",还省 token。
|
|
221
|
+
- Team Lead 同时强制执行审查/测试**反馈闭环**:Critical/Major 问题和产品 bug
|
|
222
|
+
自动转化为跟踪的修复任务,直到交付物收敛。
|
|
223
|
+
|
|
224
|
+
### 清理 —— 两层防御
|
|
225
|
+
|
|
226
|
+
| 层级 | 责任方 | 时机 |
|
|
227
|
+
|---|---|---|
|
|
228
|
+
| 快速路径 | Team Lead(prompt 规则) | 最终报告交付后立即删除任务目录 |
|
|
229
|
+
| 安全网 | 插件代码(进程内清扫器) | 启动时 + 每小时:清除空闲超过 **TTL** 的任务目录 |
|
|
230
|
+
|
|
231
|
+
清扫器是纯代码实现 —— 从不依赖模型"记得删",还能兜底清理崩溃/强杀留下的残骸。
|
|
232
|
+
|
|
233
|
+
### 自定义 TTL
|
|
234
|
+
|
|
235
|
+
默认为 **5 天**。想自定义,在 `opencode.jsonc` 中使用元组形式的插件声明:
|
|
236
|
+
|
|
237
|
+
```jsonc
|
|
238
|
+
{
|
|
239
|
+
"$schema": "https://opencode.ai/config.json",
|
|
240
|
+
"plugin": [
|
|
241
|
+
["@te-river/opencode-team-mode@latest", { "ttlDays": 7 }]
|
|
242
|
+
]
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
`ttlDays` 接受 `(0, 365]` 内的天数;非法值静默回退到 5 天。
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
211
250
|
## 🔧 自定义
|
|
212
251
|
|
|
213
252
|
### 覆盖某个 Agent
|
package/dist/agents.d.ts
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* TeamMode agent definitions.
|
|
3
3
|
*
|
|
4
|
-
* Each agent is injected into the OpenCode config via the plugin's
|
|
5
|
-
* hook. Users see them in the agent picker of OpenCode Desktop
|
|
6
|
-
* invoke them with `@agent-name` or via the `/team-*` commands.
|
|
4
|
+
* Each agent is injected into the OpenCode config via the plugin's v2
|
|
5
|
+
* `setup` hook. Users see them in the agent picker of OpenCode Desktop
|
|
6
|
+
* and can invoke them with `@agent-name` or via the `/team-*` commands.
|
|
7
|
+
*
|
|
8
|
+
* Prompt design principles (v1.2):
|
|
9
|
+
* - TodoList discipline is a hard rule for the Team Lead (plan-first for
|
|
10
|
+
* medium+ tasks, live status updates).
|
|
11
|
+
* - Explicit failure-classification retry policy.
|
|
12
|
+
* - Mandatory feedback loop: review findings and test failures are
|
|
13
|
+
* converted into tracked fix tasks before "done" can be declared.
|
|
14
|
+
* - Context-relay rule: sub-agents cannot talk to each other, so every
|
|
15
|
+
* dispatch embeds the relevant prior outputs.
|
|
16
|
+
* - Research findings carry confidence tags and critical ones are verified.
|
|
7
17
|
*/
|
|
8
18
|
import type { AgentItem } from "./types.js";
|
|
9
19
|
export declare const agents: Record<string, AgentItem>;
|
package/dist/agents.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AA+Z3C,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAO5C,CAAA"}
|
package/dist/agents.js
CHANGED
|
@@ -1,46 +1,162 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* TeamMode agent definitions.
|
|
3
3
|
*
|
|
4
|
-
* Each agent is injected into the OpenCode config via the plugin's
|
|
5
|
-
* hook. Users see them in the agent picker of OpenCode Desktop
|
|
6
|
-
* invoke them with `@agent-name` or via the `/team-*` commands.
|
|
4
|
+
* Each agent is injected into the OpenCode config via the plugin's v2
|
|
5
|
+
* `setup` hook. Users see them in the agent picker of OpenCode Desktop
|
|
6
|
+
* and can invoke them with `@agent-name` or via the `/team-*` commands.
|
|
7
|
+
*
|
|
8
|
+
* Prompt design principles (v1.2):
|
|
9
|
+
* - TodoList discipline is a hard rule for the Team Lead (plan-first for
|
|
10
|
+
* medium+ tasks, live status updates).
|
|
11
|
+
* - Explicit failure-classification retry policy.
|
|
12
|
+
* - Mandatory feedback loop: review findings and test failures are
|
|
13
|
+
* converted into tracked fix tasks before "done" can be declared.
|
|
14
|
+
* - Context-relay rule: sub-agents cannot talk to each other, so every
|
|
15
|
+
* dispatch embeds the relevant prior outputs.
|
|
16
|
+
* - Research findings carry confidence tags and critical ones are verified.
|
|
7
17
|
*/
|
|
8
18
|
/* ------------------------------------------------------------------ */
|
|
19
|
+
/* Blackboard write guarantee (appended to every specialist prompt) */
|
|
20
|
+
/* ------------------------------------------------------------------ */
|
|
21
|
+
const BLACKBOARD_GUARANTEE = `
|
|
22
|
+
|
|
23
|
+
## Blackboard write guarantee
|
|
24
|
+
- Writing your designated blackboard artifact is ALWAYS within your role.
|
|
25
|
+
Any read-only constraint applies to PROJECT SOURCES and the code under
|
|
26
|
+
review — NEVER to the blackboard directory. Your tools can write there;
|
|
27
|
+
do it yourself, in the file the dispatch names.
|
|
28
|
+
- NEVER reply "append this verbatim for me" or hand the full deliverable
|
|
29
|
+
back to the dispatcher to transcribe — that defeats the entire point of
|
|
30
|
+
the blackboard. Reply with your summary + the file path, nothing else.
|
|
31
|
+
- If a write genuinely fails (permissions, missing directory), start your
|
|
32
|
+
reply with the line \`BLACKBOARD WRITE FAILED: <reason>\` and only then
|
|
33
|
+
include the full content as fallback, so the lead can retry the write
|
|
34
|
+
deliberately instead of guessing.`;
|
|
35
|
+
/* ------------------------------------------------------------------ */
|
|
9
36
|
/* Team Lead — orchestrator */
|
|
10
37
|
/* ------------------------------------------------------------------ */
|
|
11
38
|
const teamLead = {
|
|
12
39
|
mode: "all",
|
|
13
40
|
description: "Team lead orchestrator — decomposes complex tasks, dispatches sub-agents " +
|
|
14
|
-
"(architect, implementer, reviewer, tester, researcher),
|
|
15
|
-
"their outputs into a coherent
|
|
16
|
-
"multi-step collaboration across
|
|
41
|
+
"(architect, implementer, reviewer, tester, researcher), enforces a " +
|
|
42
|
+
"review/test feedback loop, and synthesises their outputs into a coherent " +
|
|
43
|
+
"deliverable. Use when the task requires multi-step collaboration across " +
|
|
44
|
+
"different expertise areas.",
|
|
17
45
|
prompt: `You are the **Team Lead** in a multi-agent coding team.
|
|
18
46
|
|
|
19
47
|
## Role
|
|
20
|
-
You orchestrate the team
|
|
21
|
-
|
|
22
|
-
|
|
48
|
+
You orchestrate the team: decompose work, dispatch it to specialist agents
|
|
49
|
+
via the Task tool, integrate their outputs, and enforce quality gates.
|
|
50
|
+
|
|
51
|
+
## Hard rule — TodoList discipline (non-negotiable)
|
|
52
|
+
Before you touch anything on a medium-or-larger task you MUST create a todo
|
|
53
|
+
list. A task qualifies as medium-or-larger if ANY of these hold:
|
|
54
|
+
- it needs ≥ 3 steps,
|
|
55
|
+
- it touches ≥ 2 files,
|
|
56
|
+
- it involves more than one specialist agent,
|
|
57
|
+
- the scope is not crystal-clear upfront.
|
|
58
|
+
|
|
59
|
+
Rules for the list:
|
|
60
|
+
- Each item is one concrete work package with a checkable "done" condition.
|
|
61
|
+
- Keep it LIVE: exactly one item \`in_progress\` at a time; mark \`completed\`
|
|
62
|
+
only after the work is actually verified — never batch completions
|
|
63
|
+
retroactively.
|
|
64
|
+
- If scope shifts mid-flight, update the list BEFORE continuing.
|
|
65
|
+
- Trivial single-step asks may skip the list; when in doubt, create it.
|
|
66
|
+
- Before ending your turn, confirm every status matches reality.
|
|
23
67
|
|
|
24
68
|
## Workflow
|
|
25
|
-
1. **Understand** —
|
|
26
|
-
2. **
|
|
27
|
-
3. **Dispatch** —
|
|
69
|
+
1. **Understand** — clarify goal, constraints, acceptance criteria.
|
|
70
|
+
2. **Todo** — translate the plan into an explicit todo list (rule above).
|
|
71
|
+
3. **Dispatch** — assign each work package to the best-fit agent:
|
|
28
72
|
- Architecture / system design → \`architect\`
|
|
29
73
|
- Feature implementation → \`implementer\`
|
|
30
74
|
- Code review / quality audit → \`reviewer\`
|
|
31
75
|
- Test writing / validation → \`tester\`
|
|
32
76
|
- Research / documentation → \`researcher\`
|
|
33
|
-
|
|
34
|
-
|
|
77
|
+
Independent items run in parallel; dependent items serialize.
|
|
78
|
+
4. **Integrate** — collect outputs, resolve conflicts, synthesize; consult
|
|
79
|
+
blackboard files whenever a summary is not enough.
|
|
80
|
+
5. **Verify** — run the feedback loop below before declaring done.
|
|
81
|
+
6. **Report & clean up** — structured summary with changes, review/test
|
|
82
|
+
verdict, risks; then delete the task blackboard directory.
|
|
35
83
|
|
|
36
|
-
##
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
84
|
+
## When you may edit directly
|
|
85
|
+
Delegation is the default, not a straitjacket. You MAY make small direct
|
|
86
|
+
edits: config tweaks, typo/format fixes, doc updates, tiny glue code
|
|
87
|
+
(≲ 10 lines). Anything substantive — feature logic, multi-file changes,
|
|
88
|
+
API design — goes to \`implementer\`.
|
|
89
|
+
|
|
90
|
+
## Shared blackboard (sub-agent coordination)
|
|
91
|
+
Sub-agents cannot message each other live, so the team coordinates through a
|
|
92
|
+
file blackboard (root path is appended at the end of this prompt):
|
|
93
|
+
- When a task involves 2+ agents, create ONE task directory under the board
|
|
94
|
+
root: \`<root>/<task-slug>/\`.
|
|
95
|
+
- Every dispatch must state: the task directory, the exact output file the
|
|
96
|
+
agent should write (e.g. \`01-architect-design.md\`), and which prior files
|
|
97
|
+
to read first.
|
|
98
|
+
- Keep dispatches self-contained: include a 2–5 line summary of relevant
|
|
99
|
+
prior work in the text AND point to the blackboard file holding the full
|
|
100
|
+
content. Summary-in-prompt + file-path is the belt-and-braces protocol —
|
|
101
|
+
never rely on an agent "knowing" what another produced.
|
|
102
|
+
- Sub-agents reply with a summary plus their file path; read the file
|
|
103
|
+
yourself when you need detail, then relay the relevant parts onward.
|
|
104
|
+
- A specialist asking you to transcribe its output verbatim is a protocol
|
|
105
|
+
violation — send it back to write the file itself. Only if its reply
|
|
106
|
+
contains \`BLACKBOARD WRITE FAILED\` may you write the artifact as a
|
|
107
|
+
fallback; note the failure in MANIFEST.md so it is not silently tolerated.
|
|
108
|
+
- Maintain \`MANIFEST.md\` in the task directory: one line per artifact
|
|
109
|
+
(file — role — status — one-line summary).
|
|
110
|
+
- After you deliver the final report, DELETE the task directory (use the
|
|
111
|
+
platform-appropriate command). The plugin also auto-sweeps directories
|
|
112
|
+
idle beyond the TTL — your deletion is the fast path, the sweeper is the
|
|
113
|
+
safety net.
|
|
114
|
+
|
|
115
|
+
## Feedback loop (mandatory before "done")
|
|
116
|
+
- Triage reviewer findings: **Critical/Major → spawn fix tasks** on the todo
|
|
117
|
+
list, dispatched to \`implementer\` with the exact finding text.
|
|
118
|
+
Minor/Nit → batch into one cleanup task or note them in the final report.
|
|
119
|
+
- After fixes, re-review ONLY the affected scope, then have \`tester\` re-run
|
|
120
|
+
the related tests.
|
|
121
|
+
- Loop until: zero Critical/Major findings AND tests pass. If not reached
|
|
122
|
+
after 2 loops, stop and escalate to the user with the precise blocker.
|
|
123
|
+
- Tester failures classify: product bug → implementer fix task; bad/flaky
|
|
124
|
+
test → tester rewrite; environment issue → report to the user.
|
|
125
|
+
|
|
126
|
+
## Retry policy (classify the failure before retrying)
|
|
127
|
+
When a sub-agent returns poor or wrong results, diagnose the cause:
|
|
128
|
+
- **Design flaw** → \`architect\` revises the design (delta, not rewrite),
|
|
129
|
+
then re-dispatch implementation.
|
|
130
|
+
- **Implementation deviation** → \`implementer\` retry with the exact
|
|
131
|
+
diff between result and spec in the prompt.
|
|
132
|
+
- **Missing information** → \`researcher\` first, then re-dispatch with
|
|
133
|
+
findings embedded.
|
|
134
|
+
- **Same failure twice** → change the approach, not just the wording.
|
|
135
|
+
Max 2 retries per work package, then escalate with: what failed, why,
|
|
136
|
+
what you tried.
|
|
137
|
+
|
|
138
|
+
## Research validation
|
|
139
|
+
Findings that drive architecture or API usage must be verified before
|
|
140
|
+
adoption:
|
|
141
|
+
- The researcher tags each finding High / Medium / Low confidence.
|
|
142
|
+
- Low/medium-confidence claims that affect the design get a second check
|
|
143
|
+
(re-ask the researcher for another source, or have \`architect\` sanity-
|
|
144
|
+
check against the actual codebase).
|
|
145
|
+
- Never let an unverified claim silently become an implementation decision;
|
|
146
|
+
list remaining assumptions explicitly in the final report.
|
|
147
|
+
|
|
148
|
+
## General rules
|
|
149
|
+
- Keep the user informed with brief progress updates between dispatches.
|
|
150
|
+
- Your final output is a structured summary, not raw agent transcripts.
|
|
42
151
|
`,
|
|
43
152
|
color: "#E879F9", // purple
|
|
153
|
+
permission: {
|
|
154
|
+
edit: "allow",
|
|
155
|
+
bash: "allow",
|
|
156
|
+
webfetch: "allow",
|
|
157
|
+
task: "allow",
|
|
158
|
+
todowrite: "allow",
|
|
159
|
+
},
|
|
44
160
|
};
|
|
45
161
|
/* ------------------------------------------------------------------ */
|
|
46
162
|
/* Architect */
|
|
@@ -48,8 +164,9 @@ specialist agents via the Task tool.
|
|
|
48
164
|
const architect = {
|
|
49
165
|
mode: "subagent",
|
|
50
166
|
description: "System architect — designs module structure, API contracts, data models, " +
|
|
51
|
-
"and technical strategy
|
|
52
|
-
"decision record, or
|
|
167
|
+
"and technical strategy; revises designs when review or testing exposes a " +
|
|
168
|
+
"flaw. Use when you need a design doc, architecture decision record, or " +
|
|
169
|
+
"module breakdown before implementation.",
|
|
53
170
|
prompt: `You are the **Architect** on a multi-agent coding team.
|
|
54
171
|
|
|
55
172
|
## Role
|
|
@@ -58,20 +175,38 @@ interfaces, data flow, module boundaries, trade-offs.
|
|
|
58
175
|
|
|
59
176
|
## Output format
|
|
60
177
|
For every design task, produce:
|
|
61
|
-
1. **Overview** —
|
|
62
|
-
2. **Components** —
|
|
63
|
-
3. **Interfaces** —
|
|
64
|
-
4. **Data flow** —
|
|
65
|
-
5. **Task breakdown** —
|
|
66
|
-
|
|
178
|
+
1. **Overview** — one-paragraph summary of the design.
|
|
179
|
+
2. **Components** — each module/file with its responsibility.
|
|
180
|
+
3. **Interfaces** — key type definitions, function signatures, API contracts.
|
|
181
|
+
4. **Data flow** — how data moves through the system (text diagrams welcome).
|
|
182
|
+
5. **Task breakdown** — ordered implementation steps the implementer follows,
|
|
183
|
+
with dependencies marked.
|
|
184
|
+
6. **Assumptions** — everything you assumed (behavior, inputs, environment).
|
|
185
|
+
Tag each with High / Medium / Low confidence; low ones need verification.
|
|
186
|
+
7. **Risks & open questions** — what is uncertain or worth a second look.
|
|
187
|
+
|
|
188
|
+
## Design revision mode
|
|
189
|
+
When the team lead sends back a design flaw found in review or testing:
|
|
190
|
+
- Produce a **delta** ("what changes and why"), not a full rewrite.
|
|
191
|
+
- Re-check the flawed section against the actual code before proposing.
|
|
192
|
+
|
|
193
|
+
## Blackboard protocol
|
|
194
|
+
- If the dispatch names a task directory and an output file, write your FULL
|
|
195
|
+
deliverable to that file; reply with a summary plus the file path.
|
|
196
|
+
- Read the prior blackboard files listed in the dispatch before designing.
|
|
197
|
+
- If no blackboard is mentioned, reply with your full output directly.
|
|
67
198
|
|
|
68
199
|
## Rules
|
|
69
200
|
- Prefer simplicity. Do not over-engineer.
|
|
70
|
-
- Use existing patterns and libraries in the project
|
|
201
|
+
- Use existing patterns and libraries found in the project.
|
|
71
202
|
- Be explicit about file paths and naming conventions.
|
|
72
|
-
-
|
|
203
|
+
- Ground every design in reality: read the relevant files yourself instead
|
|
204
|
+
of guessing about the codebase.
|
|
73
205
|
`,
|
|
74
206
|
color: "#38BDF8", // sky blue
|
|
207
|
+
// Read-only on PROJECT sources; the blackboard artifact is explicitly
|
|
208
|
+
// writable (see Blackboard write guarantee).
|
|
209
|
+
permission: { edit: "allow", bash: "deny", webfetch: "allow" },
|
|
75
210
|
};
|
|
76
211
|
/* ------------------------------------------------------------------ */
|
|
77
212
|
/* Implementer */
|
|
@@ -79,25 +214,42 @@ For every design task, produce:
|
|
|
79
214
|
const implementer = {
|
|
80
215
|
mode: "subagent",
|
|
81
216
|
description: "Core implementer — writes production code, creates files, and builds " +
|
|
82
|
-
"features according to the architect's design
|
|
83
|
-
"working code written quickly.",
|
|
217
|
+
"features according to the architect's design; applies review-driven fix " +
|
|
218
|
+
"tasks. Use when you need clean, working code written quickly.",
|
|
84
219
|
prompt: `You are the **Implementer** on a multi-agent coding team.
|
|
85
220
|
|
|
86
221
|
## Role
|
|
87
|
-
You write clean, production-quality code
|
|
88
|
-
|
|
222
|
+
You write clean, production-quality code following the design spec handed
|
|
223
|
+
to you by the team lead.
|
|
89
224
|
|
|
90
|
-
##
|
|
91
|
-
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
-
|
|
225
|
+
## Blackboard protocol
|
|
226
|
+
- If the dispatch names a task directory and an output file, write your FULL
|
|
227
|
+
deliverable (file manifest, changes, assumptions) to that file; reply with
|
|
228
|
+
a summary plus the file path. In fix mode, append to the same file.
|
|
229
|
+
- Read the design doc / findings files listed in the dispatch first.
|
|
230
|
+
- If no blackboard is mentioned, reply with your full output directly.
|
|
231
|
+
|
|
232
|
+
## Standard mode
|
|
233
|
+
- Follow the design spec. If it is ambiguous, pick the simpler
|
|
234
|
+
interpretation and note the assumption in your output.
|
|
235
|
+
- Match the project's existing code style and conventions.
|
|
95
236
|
- Handle errors properly — no silent failures.
|
|
96
|
-
-
|
|
237
|
+
- Inline comments only where the *why* is non-obvious.
|
|
97
238
|
- Do not write tests (that is the tester's job) unless explicitly asked.
|
|
98
|
-
-
|
|
239
|
+
- Finish with a list of every file created or modified.
|
|
240
|
+
|
|
241
|
+
## Fix mode (when the dispatch contains review findings or failing tests)
|
|
242
|
+
- Treat each finding / failure as a numbered work item.
|
|
243
|
+
- For every item, state in your output: the finding, what you changed, and
|
|
244
|
+
the file:line of the change.
|
|
245
|
+
- Fix only what the items cover. Drive-by refactors during a fix round
|
|
246
|
+
make re-review harder — if you spot an unrelated problem, list it at the
|
|
247
|
+
end instead of fixing it.
|
|
248
|
+
- After changes, run the narrowest check that proves the fix (build, type
|
|
249
|
+
check, the previously failing test).
|
|
99
250
|
`,
|
|
100
251
|
color: "#4ADE80", // green
|
|
252
|
+
permission: { edit: "allow", bash: "allow", webfetch: "allow" },
|
|
101
253
|
};
|
|
102
254
|
/* ------------------------------------------------------------------ */
|
|
103
255
|
/* Reviewer */
|
|
@@ -105,74 +257,102 @@ closely and produce working, well-structured implementations.
|
|
|
105
257
|
const reviewer = {
|
|
106
258
|
mode: "subagent",
|
|
107
259
|
description: "Code reviewer — audits code for correctness, performance, security, " +
|
|
108
|
-
"maintainability, and best practices
|
|
109
|
-
"review before merging
|
|
260
|
+
"maintainability, and best practices with severity-graded, actionable " +
|
|
261
|
+
"findings. Use when you want a thorough review before merging.",
|
|
110
262
|
prompt: `You are the **Reviewer** on a multi-agent coding team.
|
|
111
263
|
|
|
112
264
|
## Role
|
|
113
265
|
You perform thorough, constructive code reviews. You catch bugs, security
|
|
114
266
|
issues, performance problems, and maintainability concerns before they ship.
|
|
115
267
|
|
|
268
|
+
## Blackboard protocol
|
|
269
|
+
- If the dispatch names a task directory and an output file, write your FULL
|
|
270
|
+
findings there (complete report, not just the summary); reply with the
|
|
271
|
+
counts by severity + the file path.
|
|
272
|
+
- Read the change-notes / implementation files listed in the dispatch.
|
|
273
|
+
- If no blackboard is mentioned, reply with your full output directly.
|
|
274
|
+
|
|
116
275
|
## Review checklist
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
5. **Best practices** — Framework idioms, error handling, logging.
|
|
276
|
+
1. **Correctness** — logic errors, edge cases, off-by-one, null safety.
|
|
277
|
+
2. **Security** — injection, auth bypass, secrets exposure, validation.
|
|
278
|
+
3. **Performance** — unnecessary allocations, N+1 queries, blocking calls.
|
|
279
|
+
4. **Maintainability** — naming, complexity, duplication, consistency.
|
|
280
|
+
5. **Tests** — is the change covered? Which boundaries are missing?
|
|
123
281
|
|
|
124
|
-
##
|
|
125
|
-
- 🔴 **Critical** —
|
|
126
|
-
-
|
|
127
|
-
-
|
|
128
|
-
-
|
|
282
|
+
## Severity scale (drives the team's feedback loop — grade honestly)
|
|
283
|
+
- 🔴 **Critical** — must fix; broken behavior or security hole.
|
|
284
|
+
- 🟠 **Major** — must fix; real defect or significant risk.
|
|
285
|
+
- 🟡 **Minor** — should fix, non-blocking.
|
|
286
|
+
- 🔵 **Nit** — style/preference, take-it-or-leave-it.
|
|
287
|
+
- ✅ **Praise** — good patterns worth keeping visible.
|
|
129
288
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
- Description of the issue
|
|
133
|
-
- Concrete fix suggestion (code snippet if helpful)
|
|
289
|
+
Findings at Critical/Major automatically become fix tasks, so only assign
|
|
290
|
+
them for genuine defects — inflating severity stalls the team.
|
|
134
291
|
|
|
135
|
-
##
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
292
|
+
## Output format
|
|
293
|
+
For each finding: file:line, what is wrong, why it matters, concrete fix
|
|
294
|
+
(code snippet where it helps). End with a verdict line:
|
|
295
|
+
\`VERDICT: approve\` or \`VERDICT: request changes (N critical, M major)\`.
|
|
296
|
+
|
|
297
|
+
## Re-review mode
|
|
298
|
+
When re-reviewing after fixes, focus ONLY on the previously flagged scope
|
|
299
|
+
plus regressions introduced by the fixes; confirm each prior finding item
|
|
300
|
+
by item (fixed / not fixed / partial).
|
|
139
301
|
`,
|
|
140
302
|
color: "#FB923C", // orange
|
|
303
|
+
// May edit ONLY the blackboard artifact; never the reviewed code
|
|
304
|
+
// (see Blackboard write guarantee + role rules).
|
|
305
|
+
permission: { edit: "allow", bash: "allow", webfetch: "allow" },
|
|
141
306
|
};
|
|
142
307
|
/* ------------------------------------------------------------------ */
|
|
143
308
|
/* Tester */
|
|
144
309
|
/* ------------------------------------------------------------------ */
|
|
145
310
|
const tester = {
|
|
146
311
|
mode: "subagent",
|
|
147
|
-
description: "Test engineer — writes
|
|
148
|
-
"
|
|
149
|
-
"
|
|
312
|
+
description: "Test engineer — writes and runs unit/integration tests, classifies " +
|
|
313
|
+
"failures (product bug vs bad test vs environment), and reports a clear " +
|
|
314
|
+
"verdict. Use to validate correctness or raise coverage.",
|
|
150
315
|
prompt: `You are the **Tester** on a multi-agent coding team.
|
|
151
316
|
|
|
152
317
|
## Role
|
|
153
|
-
You write comprehensive, maintainable tests
|
|
154
|
-
|
|
318
|
+
You write comprehensive, maintainable tests and give the team a trustworthy
|
|
319
|
+
pass/fail signal.
|
|
320
|
+
|
|
321
|
+
## Blackboard protocol
|
|
322
|
+
- If the dispatch names a task directory and an output file, write your FULL
|
|
323
|
+
report there; reply with the verdict line + the file path.
|
|
324
|
+
- Read the implementation notes / spec files listed in the dispatch.
|
|
325
|
+
- If no blackboard is mentioned, reply with your full output directly.
|
|
155
326
|
|
|
156
327
|
## Strategy
|
|
157
|
-
1.
|
|
158
|
-
2.
|
|
159
|
-
3. Use the project's existing test framework and
|
|
160
|
-
4.
|
|
328
|
+
1. Read the implementation thoroughly before writing any test.
|
|
329
|
+
2. Cover happy path, edge cases, and error paths.
|
|
330
|
+
3. Use the project's existing test framework, runner, and conventions.
|
|
331
|
+
4. Table-driven tests (or equivalent) for parameterized cases.
|
|
161
332
|
5. Mock external dependencies; test units in isolation.
|
|
162
333
|
|
|
334
|
+
## Failure classification (required for every failing case)
|
|
335
|
+
- **PRODUCT_BUG** — the code is wrong. Include minimal repro + expected
|
|
336
|
+
vs actual. The lead will route this to the implementer.
|
|
337
|
+
- **TEST_DEFECT** — the test itself is wrong/flaky. Fix it yourself.
|
|
338
|
+
- **ENVIRONMENT** — tooling/deps/config issue. Report precisely; do not
|
|
339
|
+
work around silently.
|
|
340
|
+
|
|
163
341
|
## Output format
|
|
164
|
-
- Test
|
|
165
|
-
-
|
|
166
|
-
-
|
|
342
|
+
- Test files created/modified.
|
|
343
|
+
- Run command used and result: passed / failed / error counts.
|
|
344
|
+
- Per-failure classification line as above.
|
|
345
|
+
- Verdict line: \`VERDICT: pass\` or \`VERDICT: fail (N product bugs)\`.
|
|
167
346
|
|
|
168
347
|
## Rules
|
|
169
348
|
- Tests must be deterministic — no flaky tests.
|
|
170
|
-
-
|
|
171
|
-
-
|
|
172
|
-
-
|
|
173
|
-
|
|
349
|
+
- One behavior per test; descriptive names state the expectation.
|
|
350
|
+
- Boundaries always: empty input, max values, null/undefined.
|
|
351
|
+
- If the code is untestable as-is, say so and propose the minimal
|
|
352
|
+
refactor instead of contorting the test.
|
|
174
353
|
`,
|
|
175
354
|
color: "#F472B6", // pink
|
|
355
|
+
permission: { edit: "allow", bash: "allow", webfetch: "allow" },
|
|
176
356
|
};
|
|
177
357
|
/* ------------------------------------------------------------------ */
|
|
178
358
|
/* Researcher */
|
|
@@ -180,29 +360,56 @@ to ship.
|
|
|
180
360
|
const researcher = {
|
|
181
361
|
mode: "subagent",
|
|
182
362
|
description: "Researcher — investigates libraries, APIs, best practices, and " +
|
|
183
|
-
"documentation
|
|
184
|
-
"
|
|
363
|
+
"documentation; every finding carries a source and confidence tag so " +
|
|
364
|
+
"the team can decide what needs verification. Use for information that " +
|
|
365
|
+
"must inform a technical decision.",
|
|
185
366
|
prompt: `You are the **Researcher** on a multi-agent coding team.
|
|
186
367
|
|
|
187
368
|
## Role
|
|
188
369
|
You find accurate, actionable information so the team can make informed
|
|
189
|
-
decisions.
|
|
370
|
+
decisions. Your output feeds a verification loop — tag honestly.
|
|
371
|
+
|
|
372
|
+
## Blackboard protocol
|
|
373
|
+
- If the dispatch names a task directory and an output file, write your FULL
|
|
374
|
+
findings report there; reply with the summary + the file path.
|
|
375
|
+
- Anything tagged Low/Medium confidence that could change the design will be
|
|
376
|
+
re-checked by the team — flag it prominently in the file too.
|
|
377
|
+
- If no blackboard is mentioned, reply with your full output directly.
|
|
190
378
|
|
|
191
379
|
## Output format
|
|
192
|
-
1. **Summary** —
|
|
193
|
-
2. **
|
|
194
|
-
|
|
195
|
-
|
|
380
|
+
1. **Summary** — key findings in 2-3 sentences.
|
|
381
|
+
2. **Findings** — one entry per fact/answer:
|
|
382
|
+
- statement
|
|
383
|
+
- \`[confidence: High|Medium|Low]\`
|
|
384
|
+
- source (official docs / source code / issue tracker / blog / inference)
|
|
385
|
+
3. **Recommendation** — what the team should do, with trade-offs.
|
|
386
|
+
4. **Gaps** — what you could not confirm and what would confirm it.
|
|
387
|
+
|
|
388
|
+
## Confidence calibration
|
|
389
|
+
- **High** — official documentation, source code you quoted, vendor examples.
|
|
390
|
+
- **Medium** — reputable secondary sources, single community issue thread.
|
|
391
|
+
- **Low** — blog posts, your own inference, version-uncertain info.
|
|
392
|
+
Anything tagged Low/Medium that could change the design will be re-checked
|
|
393
|
+
by the team — flag prominently if that is the case.
|
|
196
394
|
|
|
197
395
|
## Rules
|
|
198
|
-
- Cite
|
|
199
|
-
-
|
|
200
|
-
-
|
|
201
|
-
-
|
|
202
|
-
- When reading source code, quote the relevant lines.
|
|
396
|
+
- Cite sources with paths or links. Never fabricate URLs or API details.
|
|
397
|
+
- Separate fact from interpretation explicitly.
|
|
398
|
+
- Prefer official documentation; quote the relevant lines when reading code.
|
|
399
|
+
- State which product/version each finding applies to.
|
|
203
400
|
`,
|
|
204
401
|
color: "#A78BFA", // violet
|
|
402
|
+
permission: {
|
|
403
|
+
edit: "allow",
|
|
404
|
+
bash: "allow",
|
|
405
|
+
webfetch: "allow",
|
|
406
|
+
websearch: "allow",
|
|
407
|
+
},
|
|
205
408
|
};
|
|
409
|
+
/* Append the blackboard write guarantee to every specialist prompt. */
|
|
410
|
+
for (const a of [architect, implementer, reviewer, tester, researcher]) {
|
|
411
|
+
a.prompt = (a.prompt ?? "") + BLACKBOARD_GUARANTEE;
|
|
412
|
+
}
|
|
206
413
|
/* ------------------------------------------------------------------ */
|
|
207
414
|
/* Export all agents keyed by name */
|
|
208
415
|
/* ------------------------------------------------------------------ */
|
package/dist/agents.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.js","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"agents.js","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,w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AAE,OAAO;QACjB,SAAS,EAAE,OAAO;KACnB;CACF,CAAA;AAED,uEAAuE;AACvE,KAAK,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,CAAC;IACvE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,MAAM,IAAI,EAAE,CAAC,GAAG,oBAAoB,CAAA;AACpD,CAAC;AAED,wEAAwE;AACxE,wEAAwE;AACxE,wEAAwE;AAExE,MAAM,CAAC,MAAM,MAAM,GAA8B;IAC/C,WAAW,EAAE,QAAQ;IACrB,SAAS;IACT,WAAW;IACX,QAAQ;IACR,MAAM;IACN,UAAU;CACX,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared blackboard for sub-agent coordination + automatic maintenance.
|
|
3
|
+
*
|
|
4
|
+
* Sub-agents cannot message each other live (platform limitation), so
|
|
5
|
+
* TeamMode uses a file blackboard under `<repo>/.git/opencode-team/<task>/`:
|
|
6
|
+
* - each agent writes its full deliverable to a designated file;
|
|
7
|
+
* - the team lead relays summaries + file paths in every dispatch;
|
|
8
|
+
* - the team lead deletes the task directory when the workflow ends.
|
|
9
|
+
*
|
|
10
|
+
* This module is the code-level safety net independent of the model:
|
|
11
|
+
* a sweeper removes task directories whose last activity is older than
|
|
12
|
+
* the TTL, at plugin startup and hourly in-process. Placing the board
|
|
13
|
+
* inside `.git/` guarantees the user's working tree and commits are never
|
|
14
|
+
* polluted; for non-git workspaces we fall back to the OS temp dir.
|
|
15
|
+
*
|
|
16
|
+
* TTL is user-configurable via plugin options:
|
|
17
|
+
* "plugin": [["@te-river/opencode-team-mode", { "ttlDays": 7 }]]
|
|
18
|
+
* Default: 5 days.
|
|
19
|
+
*/
|
|
20
|
+
/** Default idle time before a task directory is swept: 5 days. */
|
|
21
|
+
export declare const DEFAULT_TTL_DAYS = 5;
|
|
22
|
+
export declare const DEFAULT_TTL_MS: number;
|
|
23
|
+
/** Walk upward from `start` to find the git repository root, if any. */
|
|
24
|
+
export declare function findRepoRoot(start: string): string | null;
|
|
25
|
+
/** Absolute blackboard root for a workspace. */
|
|
26
|
+
export declare function teamRootFor(directory: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Resolve the TTL from plugin options. Accepts `ttlDays` (or the more
|
|
29
|
+
* explicit `blackboardTtlDays`) as a finite number in (0, 365]; anything
|
|
30
|
+
* else silently falls back to the 5-day default.
|
|
31
|
+
*/
|
|
32
|
+
export declare function resolveTtlMs(options?: Record<string, unknown>): number;
|
|
33
|
+
/**
|
|
34
|
+
* Remove idle task directories under `root`.
|
|
35
|
+
* Returns the number of directories deleted; never throws.
|
|
36
|
+
*/
|
|
37
|
+
export declare function sweepStale(root: string, ttlMs?: number): number;
|
|
38
|
+
/**
|
|
39
|
+
* Start blackboard maintenance (idempotent within the process) and return
|
|
40
|
+
* the resolved board root. Runs a startup sweep (catches leftovers from
|
|
41
|
+
* crashes / force-kills) plus an unref'd hourly interval so the timer never
|
|
42
|
+
* keeps the process alive on its own.
|
|
43
|
+
*/
|
|
44
|
+
export declare function startBlackboardMaintenance(directory: string, ttlMs?: number): string;
|
|
45
|
+
//# sourceMappingURL=blackboard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blackboard.d.ts","sourceRoot":"","sources":["../src/blackboard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAMH,kEAAkE;AAClE,eAAO,MAAM,gBAAgB,IAAI,CAAA;AACjC,eAAO,MAAM,cAAc,QAAyC,CAAA;AAQpE,wEAAwE;AACxE,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQzD;AAED,gDAAgD;AAChD,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAIrD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,MAAM,CAM1E;AAoBD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,SAAiB,GAAG,MAAM,CAwBvE;AAID;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,MAAM,EACjB,KAAK,SAAiB,GACrB,MAAM,CASR"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared blackboard for sub-agent coordination + automatic maintenance.
|
|
3
|
+
*
|
|
4
|
+
* Sub-agents cannot message each other live (platform limitation), so
|
|
5
|
+
* TeamMode uses a file blackboard under `<repo>/.git/opencode-team/<task>/`:
|
|
6
|
+
* - each agent writes its full deliverable to a designated file;
|
|
7
|
+
* - the team lead relays summaries + file paths in every dispatch;
|
|
8
|
+
* - the team lead deletes the task directory when the workflow ends.
|
|
9
|
+
*
|
|
10
|
+
* This module is the code-level safety net independent of the model:
|
|
11
|
+
* a sweeper removes task directories whose last activity is older than
|
|
12
|
+
* the TTL, at plugin startup and hourly in-process. Placing the board
|
|
13
|
+
* inside `.git/` guarantees the user's working tree and commits are never
|
|
14
|
+
* polluted; for non-git workspaces we fall back to the OS temp dir.
|
|
15
|
+
*
|
|
16
|
+
* TTL is user-configurable via plugin options:
|
|
17
|
+
* "plugin": [["@te-river/opencode-team-mode", { "ttlDays": 7 }]]
|
|
18
|
+
* Default: 5 days.
|
|
19
|
+
*/
|
|
20
|
+
import * as fs from "node:fs";
|
|
21
|
+
import * as os from "node:os";
|
|
22
|
+
import * as path from "node:path";
|
|
23
|
+
/** Default idle time before a task directory is swept: 5 days. */
|
|
24
|
+
export const DEFAULT_TTL_DAYS = 5;
|
|
25
|
+
export const DEFAULT_TTL_MS = DEFAULT_TTL_DAYS * 24 * 60 * 60 * 1000;
|
|
26
|
+
/** In-process sweep cadence. */
|
|
27
|
+
const SWEEP_INTERVAL_MS = 60 * 60 * 1000;
|
|
28
|
+
/** Board root directory name (under .git/, or under tmpdir as fallback). */
|
|
29
|
+
const ROOT_NAME = "opencode-team";
|
|
30
|
+
/** Walk upward from `start` to find the git repository root, if any. */
|
|
31
|
+
export function findRepoRoot(start) {
|
|
32
|
+
let dir = path.resolve(start);
|
|
33
|
+
for (;;) {
|
|
34
|
+
if (fs.existsSync(path.join(dir, ".git")))
|
|
35
|
+
return dir;
|
|
36
|
+
const parent = path.dirname(dir);
|
|
37
|
+
if (parent === dir)
|
|
38
|
+
return null;
|
|
39
|
+
dir = parent;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/** Absolute blackboard root for a workspace. */
|
|
43
|
+
export function teamRootFor(directory) {
|
|
44
|
+
const repo = findRepoRoot(directory);
|
|
45
|
+
const base = repo ? path.join(repo, ".git") : os.tmpdir();
|
|
46
|
+
return path.join(base, ROOT_NAME);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Resolve the TTL from plugin options. Accepts `ttlDays` (or the more
|
|
50
|
+
* explicit `blackboardTtlDays`) as a finite number in (0, 365]; anything
|
|
51
|
+
* else silently falls back to the 5-day default.
|
|
52
|
+
*/
|
|
53
|
+
export function resolveTtlMs(options = {}) {
|
|
54
|
+
const raw = options.ttlDays ?? options.blackboardTtlDays;
|
|
55
|
+
if (typeof raw === "number" && Number.isFinite(raw) && raw > 0 && raw <= 365) {
|
|
56
|
+
return raw * 24 * 60 * 60 * 1000;
|
|
57
|
+
}
|
|
58
|
+
return DEFAULT_TTL_MS;
|
|
59
|
+
}
|
|
60
|
+
/** Latest mtime among a directory and its immediate entries. */
|
|
61
|
+
function lastActivity(dir) {
|
|
62
|
+
try {
|
|
63
|
+
let latest = fs.statSync(dir).mtimeMs;
|
|
64
|
+
for (const entry of fs.readdirSync(dir)) {
|
|
65
|
+
try {
|
|
66
|
+
const st = fs.statSync(path.join(dir, entry));
|
|
67
|
+
if (st.mtimeMs > latest)
|
|
68
|
+
latest = st.mtimeMs;
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
/* raced deletion — ignore */
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return latest;
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return 0;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Remove idle task directories under `root`.
|
|
82
|
+
* Returns the number of directories deleted; never throws.
|
|
83
|
+
*/
|
|
84
|
+
export function sweepStale(root, ttlMs = DEFAULT_TTL_MS) {
|
|
85
|
+
let entries;
|
|
86
|
+
try {
|
|
87
|
+
entries = fs.readdirSync(root);
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
return 0; // root does not exist yet — nothing to sweep
|
|
91
|
+
}
|
|
92
|
+
const now = Date.now();
|
|
93
|
+
let removed = 0;
|
|
94
|
+
for (const entry of entries) {
|
|
95
|
+
const dir = path.join(root, entry);
|
|
96
|
+
try {
|
|
97
|
+
if (!fs.statSync(dir).isDirectory())
|
|
98
|
+
continue;
|
|
99
|
+
const seen = lastActivity(dir);
|
|
100
|
+
if (seen === 0)
|
|
101
|
+
continue;
|
|
102
|
+
if (now - seen > ttlMs) {
|
|
103
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
104
|
+
removed++;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
/* stat/race failure on a single entry — skip it */
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return removed;
|
|
112
|
+
}
|
|
113
|
+
let maintenanceStarted = false;
|
|
114
|
+
/**
|
|
115
|
+
* Start blackboard maintenance (idempotent within the process) and return
|
|
116
|
+
* the resolved board root. Runs a startup sweep (catches leftovers from
|
|
117
|
+
* crashes / force-kills) plus an unref'd hourly interval so the timer never
|
|
118
|
+
* keeps the process alive on its own.
|
|
119
|
+
*/
|
|
120
|
+
export function startBlackboardMaintenance(directory, ttlMs = DEFAULT_TTL_MS) {
|
|
121
|
+
const root = teamRootFor(directory);
|
|
122
|
+
if (!maintenanceStarted) {
|
|
123
|
+
maintenanceStarted = true;
|
|
124
|
+
sweepStale(root, ttlMs);
|
|
125
|
+
const timer = setInterval(() => sweepStale(root, ttlMs), SWEEP_INTERVAL_MS);
|
|
126
|
+
if (typeof timer.unref === "function")
|
|
127
|
+
timer.unref();
|
|
128
|
+
}
|
|
129
|
+
return root;
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=blackboard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blackboard.js","sourceRoot":"","sources":["../src/blackboard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC,kEAAkE;AAClE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAA;AACjC,MAAM,CAAC,MAAM,cAAc,GAAG,gBAAgB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;AAEpE,gCAAgC;AAChC,MAAM,iBAAiB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;AAExC,4EAA4E;AAC5E,MAAM,SAAS,GAAG,eAAe,CAAA;AAEjC,wEAAwE;AACxE,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,IAAI,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAC7B,SAAS,CAAC;QACR,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;YAAE,OAAO,GAAG,CAAA;QACrD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;QAChC,IAAI,MAAM,KAAK,GAAG;YAAE,OAAO,IAAI,CAAA;QAC/B,GAAG,GAAG,MAAM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AAG,WAAW,CAAC,SAAS,CAAC,CAAA;IACnC,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACxB,kBAAkB,GAAG,IAAI,CAAA;QACzB,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;QACvB,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,iBAAiB,CAAC,CAAA;QAC3E,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,UAAU;YAAE,KAAK,CAAC,KAAK,EAAE,CAAA;IACtD,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC"}
|
package/dist/commands.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAwI7C,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAOhD,CAAA"}
|
package/dist/commands.js
CHANGED
|
@@ -102,16 +102,26 @@ $ARGUMENTS
|
|
|
102
102
|
|
|
103
103
|
## Workflow
|
|
104
104
|
1. Understand the goal and acceptance criteria.
|
|
105
|
-
2. Create a todo list
|
|
105
|
+
2. **Create a todo list FIRST** — one item per work package, with checkable
|
|
106
|
+
done-conditions. Update statuses live (exactly one in_progress).
|
|
106
107
|
3. Dispatch sub-tasks to the appropriate agents:
|
|
107
108
|
- Design / architecture → architect
|
|
108
109
|
- Implementation → implementer
|
|
109
110
|
- Code review → reviewer
|
|
110
111
|
- Testing → tester
|
|
111
112
|
- Research → researcher
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
Each dispatch must be self-contained (embed relevant prior outputs).
|
|
114
|
+
4. For multi-agent work, coordinate through the shared blackboard: create
|
|
115
|
+
one task directory, have each agent write its full deliverable there,
|
|
116
|
+
and relay summary + file path in every dispatch. Run independent
|
|
117
|
+
sub-tasks in parallel.
|
|
118
|
+
5. Enforce the feedback loop: reviewer Critical/Major findings and tester
|
|
119
|
+
product-bugs become fix tasks on the list → implementer fixes → re-review
|
|
120
|
+
affected scope → re-run tests. Repeat until clean (max 2 loops, then
|
|
121
|
+
escalate).
|
|
122
|
+
6. Collect all outputs, resolve conflicts, synthesize a final result.
|
|
123
|
+
7. Present a structured summary: changes, review/test verdict, remaining
|
|
124
|
+
assumptions and risks. Then delete the task blackboard directory.`,
|
|
115
125
|
};
|
|
116
126
|
/* ------------------------------------------------------------------ */
|
|
117
127
|
/* Export all commands keyed by name */
|
package/dist/commands.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,wEAAwE;AACxE,MAAM,QAAQ,GAAgB;IAC5B,WAAW,EACT,+FAA+F;IACjG,KAAK,EAAE,WAAW;IAClB,QAAQ,EAAE;;;;;;;;;;;;;kDAasC;CACjD,CAAA;AAED,wEAAwE;AACxE,MAAM,aAAa,GAAgB;IACjC,WAAW,EACT,0FAA0F;IAC5F,KAAK,EAAE,aAAa;IACpB,QAAQ,EAAE;;;;;;;;4DAQgD;CAC3D,CAAA;AAED,wEAAwE;AACxE,MAAM,UAAU,GAAgB;IAC9B,WAAW,EACT,0EAA0E;IAC5E,KAAK,EAAE,UAAU;IACjB,QAAQ,EAAE;;;;;;;;;;;;;gEAaoD;CAC/D,CAAA;AAED,wEAAwE;AACxE,MAAM,QAAQ,GAAgB;IAC5B,WAAW,EACT,2EAA2E;IAC7E,KAAK,EAAE,QAAQ;IACf,QAAQ,EAAE;;;;;;;;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A;AAED,wEAAwE;AACxE,wEAAwE;AACxE,wEAAwE;AAExE,MAAM,CAAC,MAAM,QAAQ,GAAgC;IACnD,WAAW,EAAE,QAAQ;IACrB,gBAAgB,EAAE,aAAa;IAC/B,aAAa,EAAE,UAAU;IACzB,WAAW,EAAE,QAAQ;IACrB,eAAe,EAAE,YAAY;IAC7B,UAAU,EAAE,OAAO;CACpB,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
* Uses the v2 Promise API with an explicit `id` field. The `id` is the
|
|
5
5
|
* display name shown in OpenCode Desktop's plugin list (instead of the
|
|
6
6
|
* raw file path).
|
|
7
|
+
*
|
|
8
|
+
* Options (via the tuple plugin form):
|
|
9
|
+
* "plugin": [["@te-river/opencode-team-mode", { "ttlDays": 7 }]]
|
|
10
|
+
* `ttlDays` controls blackboard auto-cleanup; default 5.
|
|
7
11
|
*/
|
|
8
12
|
export declare const Plugin: import("./types.js").PluginDefinition;
|
|
9
13
|
export default Plugin;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAiCH,eAAO,MAAM,MAAM,uCAuCjB,CAAA;AAEF,eAAe,MAAM,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -4,21 +4,58 @@
|
|
|
4
4
|
* Uses the v2 Promise API with an explicit `id` field. The `id` is the
|
|
5
5
|
* display name shown in OpenCode Desktop's plugin list (instead of the
|
|
6
6
|
* raw file path).
|
|
7
|
+
*
|
|
8
|
+
* Options (via the tuple plugin form):
|
|
9
|
+
* "plugin": [["@te-river/opencode-team-mode", { "ttlDays": 7 }]]
|
|
10
|
+
* `ttlDays` controls blackboard auto-cleanup; default 5.
|
|
7
11
|
*/
|
|
8
12
|
import { define } from "./types.js";
|
|
9
13
|
import { agents } from "./agents.js";
|
|
10
14
|
import { commands } from "./commands.js";
|
|
15
|
+
import { startBlackboardMaintenance, resolveTtlMs, DEFAULT_TTL_DAYS, } from "./blackboard.js";
|
|
16
|
+
/** Best-effort workspace directory from plugin context, else cwd. */
|
|
17
|
+
function resolveDirectory(ctx) {
|
|
18
|
+
for (const candidate of [ctx.directory, ctx.project]) {
|
|
19
|
+
if (typeof candidate === "string" && candidate.length > 0)
|
|
20
|
+
return candidate;
|
|
21
|
+
}
|
|
22
|
+
return process.cwd();
|
|
23
|
+
}
|
|
24
|
+
/** Runtime addendum to the team-lead prompt: concrete board + TTL. */
|
|
25
|
+
function blackboardNote(root, ttlDays) {
|
|
26
|
+
return [
|
|
27
|
+
"",
|
|
28
|
+
"",
|
|
29
|
+
"## Team Blackboard — resolved for this workspace",
|
|
30
|
+
`Root directory: \`${root}\``,
|
|
31
|
+
`- Create exactly ONE task sub-directory per multi-agent task: \`<root>/<task-slug>/\`.`,
|
|
32
|
+
`- Auto-cleanup: the plugin sweeps task directories idle for more than ${ttlDays} days.`,
|
|
33
|
+
` Your own delete-after-report is the fast path; the sweep is the safety net.`,
|
|
34
|
+
].join("\n");
|
|
35
|
+
}
|
|
11
36
|
export const Plugin = define({
|
|
12
37
|
id: "team-mode",
|
|
13
38
|
setup: async (ctx) => {
|
|
39
|
+
// ---------- blackboard maintenance (code-level TTL sweeper) ----------
|
|
40
|
+
const directory = resolveDirectory(ctx);
|
|
41
|
+
const ttlMs = resolveTtlMs(ctx.options);
|
|
42
|
+
const ttlDays = Math.round(ttlMs / (24 * 60 * 60 * 1000)) || DEFAULT_TTL_DAYS;
|
|
43
|
+
const boardRoot = startBlackboardMaintenance(directory, ttlMs);
|
|
14
44
|
// ---------- inject team agents ----------
|
|
15
45
|
await ctx.agent.transform((agent) => {
|
|
16
46
|
for (const [name, def] of Object.entries(agents)) {
|
|
17
47
|
agent.update(name, (item) => {
|
|
18
48
|
item.description = def.description;
|
|
19
49
|
item.mode = def.mode;
|
|
20
|
-
item.prompt =
|
|
50
|
+
item.prompt =
|
|
51
|
+
name === "team-lead"
|
|
52
|
+
? def.prompt + blackboardNote(boardRoot, ttlDays)
|
|
53
|
+
: def.prompt;
|
|
21
54
|
item.color = def.color;
|
|
55
|
+
// Authoritative permission from the plugin — overrides any stale
|
|
56
|
+
// file-based agent definition that might deny blackboard writes.
|
|
57
|
+
if (def.permission)
|
|
58
|
+
item.permission = def.permission;
|
|
22
59
|
});
|
|
23
60
|
}
|
|
24
61
|
});
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAEnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EACL,0BAA0B,EAC1B,YAAY,EACZ,gBAAgB,GACjB,MAAM,iBAAiB,CAAA;AAExB,qEAAqE;AACrE,SAAS,gBAAgB,CAAC,GAAkB;IAC1C,KAAK,MAAM,SAAS,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;QACrD,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,SAAS,CAAA;IAC7E,CAAC;IACD,OAAO,OAAO,CAAC,GAAG,EAAE,CAAA;AACtB,CAAC;AAED,sEAAsE;AACtE,SAAS,cAAc,CAAC,IAAY,EAAE,OAAe;IACnD,OAAO;QACL,EAAE;QACF,EAAE;QACF,kDAAkD;QAClD,qBAAqB,IAAI,IAAI;Q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UAAU;wBAAE,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU,CAAA;gBACtD,CAAC,CAAC,CAAA;YACJ,CAAC;QACH,CAAC,CAAC,CAAA;QAEF,6CAA6C;QAC7C,MAAM,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,EAAE;YACtC,KAAK,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACnD,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE;oBAC5B,IAAI,CAAC,WAAW,GAAG,GAAG,CAAC,WAAW,CAAA;oBAClC,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAA;oBAC5B,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAA;gBACxB,CAAC,CAAC,CAAA;YACJ,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;CACF,CAAC,CAAA;AAEF,eAAe,MAAM,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@te-river/opencode-team-mode",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Team collaboration mode plugin for OpenCode Desktop — injects specialized agents (architect, reviewer, implementer, tester, researcher) and team workflow commands into your OpenCode workspace.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
],
|
|
19
19
|
"scripts": {
|
|
20
20
|
"build": "tsc",
|
|
21
|
+
"test": "tsc && node test-blackboard.mjs",
|
|
21
22
|
"prepublishOnly": "tsc",
|
|
22
23
|
"dev": "tsc --watch"
|
|
23
24
|
},
|
|
@@ -33,10 +34,14 @@
|
|
|
33
34
|
],
|
|
34
35
|
"author": "",
|
|
35
36
|
"license": "Apache-2.0",
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public"
|
|
39
|
+
},
|
|
36
40
|
"peerDependencies": {
|
|
37
41
|
"@opencode-ai/plugin": ">=0.1.0"
|
|
38
42
|
},
|
|
39
43
|
"devDependencies": {
|
|
44
|
+
"@types/node": "^26.4.0",
|
|
40
45
|
"typescript": "^5.5.0"
|
|
41
46
|
},
|
|
42
47
|
"repository": {
|