@justsilver/opencode-team 0.2.2-beta.2 → 0.2.2-beta.4
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/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,21 @@
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.2.2-beta.4] - 2026-11-18
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- 并发保存不同 Agent 的模型覆盖不再互相覆盖:策略保存与旧版迁移的读改写按进程内队列串行执行。
|
|
15
|
+
|
|
16
|
+
## [0.2.2-beta.3] - 2026-11-18
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- 角色提示词改以 `plugin/opencode-team/prompts/*.md` 为唯一来源:Frontmatter 的 `description`
|
|
21
|
+
作为 Agent 描述、正文作为 System Prompt,构建阶段生成 `prompts.generated.ts`;
|
|
22
|
+
`npm run check:prompts`(CI 与 `prepack`)阻止生成物与 Markdown 漂移。提示词内容、
|
|
23
|
+
Agent 职责、权限与模型策略未变。
|
|
24
|
+
|
|
10
25
|
## [0.2.2-beta.2] - 2026-11-18
|
|
11
26
|
|
|
12
27
|
### Fixed
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justsilver/opencode-team",
|
|
3
|
-
"version": "0.2.2-beta.
|
|
3
|
+
"version": "0.2.2-beta.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Zero-config multi-agent team for OpenCode V2: Orchestrator, QA, Reviewer, and per-agent subagent model/variant policy",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,8 +32,11 @@
|
|
|
32
32
|
"scripts": {
|
|
33
33
|
"test": "node --test",
|
|
34
34
|
"typecheck": "tsc --noEmit",
|
|
35
|
+
"build:prompts": "node scripts/build-prompts.mjs gen",
|
|
36
|
+
"check:prompts": "node scripts/build-prompts.mjs check",
|
|
35
37
|
"build:tui": "node scripts/build-tui.mjs",
|
|
36
|
-
"
|
|
38
|
+
"bundle:check": "esbuild plugin/opencode-team/index.ts --bundle --platform=node --format=esm --outfile=dist/team-server.js && esbuild plugin/opencode-team/tui.ts --bundle --platform=node --format=esm --jsx=automatic --jsx-import-source=@opentui/solid --external:@opencode/plugin/tui --external:@opentui/core --external:@opentui/solid --external:solid-js --outfile=dist/team-tui.js",
|
|
39
|
+
"prepack": "node scripts/build-prompts.mjs check && node scripts/build-tui.mjs"
|
|
37
40
|
},
|
|
38
41
|
"peerDependencies": {
|
|
39
42
|
"@opentui/core": ">=0.8.4 <0.9.0",
|
|
@@ -54,6 +57,7 @@
|
|
|
54
57
|
"@opentui/core": "^0.8.4",
|
|
55
58
|
"@opentui/solid": "^0.8.4",
|
|
56
59
|
"babel-preset-solid": "^1.9.16",
|
|
60
|
+
"esbuild": "^0.28.2",
|
|
57
61
|
"solid-js": "^1.9.17",
|
|
58
62
|
"typescript": "^5.9.3"
|
|
59
63
|
}
|
|
@@ -158,6 +158,18 @@ async function writePolicy(storage: TeamPolicyContext["storage"], agents: Record
|
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
+
// 宿主 storage 只有 get/set,没有 compare-and-swap;并发保存必须串行,否则后写覆盖先写。
|
|
162
|
+
let pendingPolicyMutation: Promise<unknown> = Promise.resolve()
|
|
163
|
+
|
|
164
|
+
function mutatePolicy<T>(operation: () => Promise<T>): Promise<T> {
|
|
165
|
+
const result = pendingPolicyMutation.then(operation, operation)
|
|
166
|
+
pendingPolicyMutation = result.then(
|
|
167
|
+
() => undefined,
|
|
168
|
+
() => undefined,
|
|
169
|
+
)
|
|
170
|
+
return result
|
|
171
|
+
}
|
|
172
|
+
|
|
161
173
|
async function readMarker(storage: TeamPolicyContext["storage"]): Promise<MigrationMarker | undefined> {
|
|
162
174
|
const raw = await storage.get(MIGRATION_KEY)
|
|
163
175
|
if (raw === undefined) return undefined
|
|
@@ -356,32 +368,31 @@ async function runMigration(
|
|
|
356
368
|
return { status: "failed", errors: [`The legacy model "${legacyModel}" is invalid.`] }
|
|
357
369
|
}
|
|
358
370
|
|
|
359
|
-
let agents: Record<string, string>
|
|
360
371
|
try {
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
372
|
+
return await mutatePolicy(async () => {
|
|
373
|
+
const agents = await readPolicy(ctx.storage)
|
|
374
|
+
|
|
375
|
+
const imported =
|
|
376
|
+
legacyModel === null
|
|
377
|
+
? []
|
|
378
|
+
: (await listSubagentIDs(ctx, fallbackAgents)).filter((agent) => agents[agent] === undefined)
|
|
379
|
+
if (legacyModel !== null) {
|
|
380
|
+
for (const agentID of imported) agents[agentID] = legacyModel
|
|
381
|
+
}
|
|
371
382
|
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
383
|
+
const marker: MigrationMarker = {
|
|
384
|
+
from: "opencode-subagent-model",
|
|
385
|
+
status: legacyModel === null ? "empty" : "applied",
|
|
386
|
+
model: legacyModel,
|
|
387
|
+
agents: imported,
|
|
388
|
+
}
|
|
389
|
+
if (imported.length > 0) await writePolicy(ctx.storage, agents)
|
|
390
|
+
await writeMarker(ctx.storage, marker)
|
|
391
|
+
return marker
|
|
392
|
+
})
|
|
381
393
|
} catch (error) {
|
|
382
394
|
return { status: "failed", errors: [message(error)] }
|
|
383
395
|
}
|
|
384
|
-
return marker
|
|
385
396
|
}
|
|
386
397
|
|
|
387
398
|
/**
|
|
@@ -521,19 +532,16 @@ async function setAgentModel(
|
|
|
521
532
|
|
|
522
533
|
let agents: Record<string, string>
|
|
523
534
|
try {
|
|
524
|
-
agents = await
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
try {
|
|
536
|
-
await writePolicy(ctx.storage, agents)
|
|
535
|
+
agents = await mutatePolicy(async () => {
|
|
536
|
+
const next = await readPolicy(ctx.storage)
|
|
537
|
+
if (model === null) {
|
|
538
|
+
delete next[agentID]
|
|
539
|
+
} else {
|
|
540
|
+
next[agentID] = formatModelRef(ref!)
|
|
541
|
+
}
|
|
542
|
+
await writePolicy(ctx.storage, next)
|
|
543
|
+
return next
|
|
544
|
+
})
|
|
537
545
|
} catch (error) {
|
|
538
546
|
return { ok: false, supported: true, agentsSupported, errors: [message(error)] }
|
|
539
547
|
}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
// 由 scripts/build-prompts.mjs 从 prompts/*.md 生成,请勿手改;修改内容请改 Markdown 后运行 npm run build:prompts。
|
|
2
|
+
|
|
3
|
+
export interface GeneratedTeamPrompt {
|
|
4
|
+
readonly description: string
|
|
5
|
+
readonly system: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const ORCHESTRATOR_PROMPT: GeneratedTeamPrompt = {
|
|
9
|
+
description: "Primary team lead responsible for end-to-end delivery. Dynamically delegates or executes tasks, coordinates parallel work and Git operations, reconciles agent findings, and owns final decisions and verification.",
|
|
10
|
+
system: `# Orchestrator — 主编排代理
|
|
6
11
|
|
|
7
12
|
你是软件工程团队的主编排代理(Orchestrator),负责从需求理解到最终交付的完整任务生命周期。
|
|
8
13
|
|
|
@@ -46,9 +51,12 @@ export const ORCHESTRATOR_PROMPT = `# Orchestrator — 主编排代理
|
|
|
46
51
|
- 根据项目条件完成必要的构建、测试或其他验证。
|
|
47
52
|
- 区分工作已执行、目标已达成和结果已验证,不将代理报告完成等同于任务通过验收。
|
|
48
53
|
- 明确已验证结果、未验证内容、剩余风险及需要用户决策的问题。
|
|
49
|
-
-
|
|
54
|
+
- 交付说明简洁,突出实际变更与验证结论。`,
|
|
55
|
+
}
|
|
50
56
|
|
|
51
|
-
export const QA_PROMPT =
|
|
57
|
+
export const QA_PROMPT: GeneratedTeamPrompt = {
|
|
58
|
+
description: "Independent quality assurance agent. Designs and executes acceptance and regression tests against requirements and contracts, investigates failures, and independently verifies fixes. Production code changes require explicit authorization.",
|
|
59
|
+
system: `# QA — 独立质量保证代理
|
|
52
60
|
|
|
53
61
|
你是独立质量保证代理(QA),负责从需求和可观察行为出发验证软件的正确性与可靠性。
|
|
54
62
|
|
|
@@ -84,9 +92,12 @@ export const QA_PROMPT = `# QA — 独立质量保证代理
|
|
|
84
92
|
|
|
85
93
|
- 明确验收结论、实际执行结果、发现的缺陷和未覆盖风险。
|
|
86
94
|
- 问题报告应包含足够的证据与复现信息。
|
|
87
|
-
-
|
|
95
|
+
- 区分已确认缺陷、合理推断和待验证问题,不输出无依据的结论。`,
|
|
96
|
+
}
|
|
88
97
|
|
|
89
|
-
export const REVIEWER_PROMPT =
|
|
98
|
+
export const REVIEWER_PROMPT: GeneratedTeamPrompt = {
|
|
99
|
+
description: "Independent code reviewer. Primarily reviews source code for correctness, architecture, and risks, using targeted verification when needed. Reports evidence-based findings without replacing QA acceptance testing. Production code changes require explicit authorization.",
|
|
100
|
+
system: `# Reviewer — 独立代码审查代理
|
|
90
101
|
|
|
91
102
|
你是独立代码审查代理(Reviewer),负责从正确性、可靠性和工程质量角度评估实现。
|
|
92
103
|
|
|
@@ -135,4 +146,6 @@ export const REVIEWER_PROMPT = `# Reviewer — 独立代码审查代理
|
|
|
135
146
|
|
|
136
147
|
区分已确认问题与待验证风险;没有充分证据时不得断言存在缺陷。
|
|
137
148
|
|
|
138
|
-
|
|
149
|
+
没有发现实质性问题时直接说明,不输出凑数建议,也不将未发现问题等同于实现已被全面验证。`,
|
|
150
|
+
}
|
|
151
|
+
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ORCHESTRATOR_PROMPT, QA_PROMPT, REVIEWER_PROMPT } from "./prompts.ts"
|
|
1
|
+
import { ORCHESTRATOR_PROMPT, QA_PROMPT, REVIEWER_PROMPT } from "./prompts.generated.ts"
|
|
2
2
|
|
|
3
3
|
export { TEAM_SUBAGENT_IDS } from "./team-ids.ts"
|
|
4
4
|
|
|
@@ -27,28 +27,25 @@ export const TEAM_AGENTS: readonly TeamAgentDefinition[] = [
|
|
|
27
27
|
{
|
|
28
28
|
id: "orchestrator",
|
|
29
29
|
name: "Orchestrator",
|
|
30
|
-
description:
|
|
31
|
-
"Primary team lead responsible for end-to-end delivery. Dynamically delegates or executes tasks, coordinates parallel work and Git operations, reconciles agent findings, and owns final decisions and verification.",
|
|
30
|
+
description: ORCHESTRATOR_PROMPT.description,
|
|
32
31
|
mode: "primary",
|
|
33
|
-
system: ORCHESTRATOR_PROMPT,
|
|
32
|
+
system: ORCHESTRATOR_PROMPT.system,
|
|
34
33
|
permissions: [],
|
|
35
34
|
},
|
|
36
35
|
{
|
|
37
36
|
id: "qa",
|
|
38
37
|
name: "QA",
|
|
39
|
-
description:
|
|
40
|
-
"Independent quality assurance agent. Designs and executes acceptance and regression tests against requirements and contracts, investigates failures, and independently verifies fixes. Production code changes require explicit authorization.",
|
|
38
|
+
description: QA_PROMPT.description,
|
|
41
39
|
mode: "subagent",
|
|
42
|
-
system: QA_PROMPT,
|
|
40
|
+
system: QA_PROMPT.system,
|
|
43
41
|
permissions: LEAF_SUBAGENT_PERMISSIONS,
|
|
44
42
|
},
|
|
45
43
|
{
|
|
46
44
|
id: "reviewer",
|
|
47
45
|
name: "Reviewer",
|
|
48
|
-
description:
|
|
49
|
-
"Independent code reviewer. Primarily reviews source code for correctness, architecture, and risks, using targeted verification when needed. Reports evidence-based findings without replacing QA acceptance testing. Production code changes require explicit authorization.",
|
|
46
|
+
description: REVIEWER_PROMPT.description,
|
|
50
47
|
mode: "subagent",
|
|
51
|
-
system: REVIEWER_PROMPT,
|
|
48
|
+
system: REVIEWER_PROMPT.system,
|
|
52
49
|
permissions: LEAF_SUBAGENT_PERMISSIONS,
|
|
53
50
|
},
|
|
54
51
|
]
|