cowork-flow 0.0.4 → 0.0.7
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 +44 -1
- package/package.json +8 -5
- package/src/lib/copy-template.js +9 -9
- package/src/lib/package-info.js +8 -2
- package/template/.agent/skills/agent-team-execution/SKILL.md +26 -0
- package/template/{.superpowers → .agent/skills}/brainstorming/scripts/start-server.sh +0 -0
- package/template/{.superpowers → .agent/skills}/brainstorming/scripts/stop-server.sh +0 -0
- package/template/.agent/skills/start/SKILL.md +1 -0
- package/template/.cowork-flow/.version +1 -1
- package/template/.cowork-flow/agent-team/adapters.yaml +15 -0
- package/template/.cowork-flow/agent-team/agents.yaml +142 -0
- package/template/.cowork-flow/agent-team/policy.yaml +23 -0
- package/template/.cowork-flow/config.yaml +9 -0
- package/template/.cowork-flow/run +10 -93
- package/template/.cowork-flow/run.cmd +12 -115
- package/template/.cowork-flow/scripts/agent_team.py +584 -0
- package/template/.cowork-flow/scripts/change.py +68 -15
- package/template/.cowork-flow/scripts/common/agent_team.py +467 -0
- package/template/.cowork-flow/scripts/common/archive_utils.py +72 -0
- package/template/.cowork-flow/scripts/common/config.py +18 -0
- package/template/.cowork-flow/scripts/common/git_context.py +17 -0
- package/template/.cowork-flow/scripts/common/task_utils.py +5 -18
- package/template/.cowork-flow/scripts/run.py +92 -0
- package/template/.cowork-flow/scripts/task.py +1 -1
- package/template/.cowork-flow/workflow.md +65 -158
- package/template/.superpowers/executing-plans/SKILL.md +2 -0
- package/template/AGENTS.md +3 -2
- /package/template/{.superpowers → .agent/skills}/brainstorming/SKILL.md +0 -0
- /package/template/{.superpowers → .agent/skills}/brainstorming/scripts/frame-template.html +0 -0
- /package/template/{.superpowers → .agent/skills}/brainstorming/scripts/helper.js +0 -0
- /package/template/{.superpowers → .agent/skills}/brainstorming/scripts/server.cjs +0 -0
- /package/template/{.superpowers → .agent/skills}/brainstorming/spec-document-reviewer-prompt.md +0 -0
- /package/template/{.superpowers → .agent/skills}/brainstorming/visual-companion.md +0 -0
- /package/template/{.superpowers → .agent/skills}/requesting-code-review/SKILL.md +0 -0
- /package/template/{.superpowers → .agent/skills}/requesting-code-review/code-reviewer.md +0 -0
- /package/template/{.superpowers → .agent/skills}/subagent-driven-development/SKILL.md +0 -0
- /package/template/{.superpowers → .agent/skills}/subagent-driven-development/code-quality-reviewer-prompt.md +0 -0
- /package/template/{.superpowers → .agent/skills}/subagent-driven-development/implementer-prompt.md +0 -0
- /package/template/{.superpowers → .agent/skills}/subagent-driven-development/spec-reviewer-prompt.md +0 -0
- /package/template/{.superpowers → .agent/skills}/writing-plans/SKILL.md +0 -0
- /package/template/{.superpowers → .agent/skills}/writing-plans/plan-document-reviewer-prompt.md +0 -0
package/README.md
CHANGED
|
@@ -28,6 +28,7 @@ cowork-flow 是一个用于新项目初始化协作流程的模板仓库。它
|
|
|
28
28
|
└── .cowork-flow/
|
|
29
29
|
├── config.yaml
|
|
30
30
|
├── workflow.md
|
|
31
|
+
├── agent-team/
|
|
31
32
|
├── scripts/
|
|
32
33
|
├── spec/
|
|
33
34
|
├── changes/
|
|
@@ -56,6 +57,9 @@ cowork-flow 是一个用于新项目初始化协作流程的模板仓库。它
|
|
|
56
57
|
`template/.cowork-flow/plans/`
|
|
57
58
|
保存可执行步骤、验证方式和执行状态。
|
|
58
59
|
|
|
60
|
+
`template/.cowork-flow/agent-team/`
|
|
61
|
+
保存 agent team 的项目级 registry、适配器和策略。默认适配器是 `codex`,由主 agent 调度 Codex 子 agent;没有子 agent 能力时可退回 `manual` 提示词模式。
|
|
62
|
+
|
|
59
63
|
## 快速开始
|
|
60
64
|
|
|
61
65
|
使用 CLI 把模板内容安装到目标项目根目录:
|
|
@@ -172,6 +176,19 @@ cowork-flow sync . --dry-run
|
|
|
172
176
|
./.cowork-flow/run task start <task-dir>
|
|
173
177
|
```
|
|
174
178
|
|
|
179
|
+
执行 plan 时准备 agent team:
|
|
180
|
+
|
|
181
|
+
默认 `agent_team.enabled: false`。运行 `agent-team prepare/status/next/record-result/record-review/retry/complete` 前,先在 `.cowork-flow/config.yaml` 中设置 `agent_team.enabled: true`。
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
./.cowork-flow/run agent-team init
|
|
185
|
+
./.cowork-flow/run agent-team prepare <task-dir> --plan <plan-file>
|
|
186
|
+
./.cowork-flow/run agent-team next <task-dir>
|
|
187
|
+
./.cowork-flow/run agent-team complete <task-dir>
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
`agent-team` 命令会生成任务目录内的 dispatch plan、assignments、状态、审阅和 metrics 工件。默认 `codex` 适配器采用主 agent 调度型:脚本生成 Codex-ready 分派文件,主 agent 负责调用子 agent、协调并回写结果。
|
|
191
|
+
|
|
175
192
|
记录 session:
|
|
176
193
|
|
|
177
194
|
```bash
|
|
@@ -202,4 +219,30 @@ cowork-flow sync . --dry-run
|
|
|
202
219
|
|
|
203
220
|
## 发布流程
|
|
204
221
|
|
|
205
|
-
CI
|
|
222
|
+
发布前先确认本地或 CI 具备 npm 发布凭据,例如已执行 `npm login`,或在 CI 中配置了 `NPM_TOKEN`。
|
|
223
|
+
|
|
224
|
+
推荐使用 release 脚本发布:
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
npm run release
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
默认会升级 patch 版本,执行顺序是:
|
|
231
|
+
|
|
232
|
+
1. `npm run test:all`
|
|
233
|
+
2. `npm version patch --no-git-tag-version`
|
|
234
|
+
3. 将 `package.json` 中的新版本同步写入 `template/.cowork-flow/.version`
|
|
235
|
+
4. `git add package.json package-lock.json template/.cowork-flow/.version`
|
|
236
|
+
5. `git commit -m "chore(release): <version>"`
|
|
237
|
+
6. `git tag v<version>`
|
|
238
|
+
7. `npm publish`
|
|
239
|
+
|
|
240
|
+
需要发布其他版本类型时,把 npm 支持的版本类型传给脚本:
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
npm run release -- minor
|
|
244
|
+
npm run release -- major
|
|
245
|
+
npm run release -- prerelease
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
脚本会在任一步骤失败时停止后续发布动作。CI 仍会运行 Node CLI 测试、npm pack 内容检查和现有 Python 模板测试;GitHub Actions 的 `Publish npm Package` workflow 仍需要在仓库 secrets 中配置 `NPM_TOKEN`。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cowork-flow",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "CLI for installing and maintaining cowork-flow collaboration templates.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -10,13 +10,16 @@
|
|
|
10
10
|
"bin",
|
|
11
11
|
"src",
|
|
12
12
|
"template",
|
|
13
|
-
"README.md"
|
|
13
|
+
"README.md",
|
|
14
|
+
"!template/**/__pycache__/**",
|
|
15
|
+
"!template/**/*.pyc"
|
|
14
16
|
],
|
|
15
17
|
"scripts": {
|
|
16
18
|
"test": "node --test",
|
|
17
|
-
"test:template": "
|
|
18
|
-
"pack:check": "
|
|
19
|
-
"test:all": "npm test && npm run test:template && npm run pack:check"
|
|
19
|
+
"test:template": "node scripts/run-template-tests.js",
|
|
20
|
+
"pack:check": "node scripts/pack-check.js",
|
|
21
|
+
"test:all": "npm test && npm run test:template && npm run pack:check",
|
|
22
|
+
"release": "sh scripts/release.sh"
|
|
20
23
|
},
|
|
21
24
|
"engines": {
|
|
22
25
|
"node": ">=20"
|
package/src/lib/copy-template.js
CHANGED
|
@@ -90,9 +90,7 @@ export async function buildSuperpowersPlan(targetDir, options = {}) {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
const PROTECTED_SYNC_FILES = new Set([
|
|
93
|
-
'
|
|
94
|
-
'.cowork-flow/config.yaml',
|
|
95
|
-
'.cowork-flow/workflow.md'
|
|
93
|
+
'.cowork-flow/config.yaml'
|
|
96
94
|
]);
|
|
97
95
|
|
|
98
96
|
const PROTECTED_SYNC_PREFIXES = [
|
|
@@ -105,7 +103,7 @@ const PROTECTED_SYNC_PREFIXES = [
|
|
|
105
103
|
|
|
106
104
|
const SAFE_SYNC_PREFIXES = [
|
|
107
105
|
'.agent/skills/',
|
|
108
|
-
'.cowork-flow/
|
|
106
|
+
'.cowork-flow/'
|
|
109
107
|
];
|
|
110
108
|
|
|
111
109
|
const SAFE_SYNC_FILES = new Set([
|
|
@@ -119,14 +117,16 @@ const COWORK_FLOW_START = '<!-- COWORK-FLOW:START -->';
|
|
|
119
117
|
const COWORK_FLOW_END = '<!-- COWORK-FLOW:END -->';
|
|
120
118
|
|
|
121
119
|
function isProtectedSyncFile(relativePath) {
|
|
122
|
-
|
|
123
|
-
|
|
120
|
+
const templatePath = toTemplatePath(relativePath);
|
|
121
|
+
return PROTECTED_SYNC_FILES.has(templatePath)
|
|
122
|
+
|| PROTECTED_SYNC_PREFIXES.some((prefix) => templatePath.startsWith(prefix));
|
|
124
123
|
}
|
|
125
124
|
|
|
126
125
|
function isSafeSyncFile(relativePath) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
||
|
|
126
|
+
const templatePath = toTemplatePath(relativePath);
|
|
127
|
+
return SAFE_SYNC_FILES.has(templatePath)
|
|
128
|
+
|| SAFE_SYNC_PREFIXES.some((prefix) => templatePath.startsWith(prefix))
|
|
129
|
+
|| templatePath.endsWith('/.gitkeep');
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
function replaceManagedBlock(targetContent, templateContent) {
|
package/src/lib/package-info.js
CHANGED
|
@@ -31,9 +31,14 @@ export function compareVersions(left, right) {
|
|
|
31
31
|
return 0;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
export function npmCommandOptions(platform = process.platform) {
|
|
35
|
+
return platform === 'win32' ? { shell: true } : {};
|
|
36
|
+
}
|
|
37
|
+
|
|
34
38
|
export async function fetchLatestVersion(packageName = 'cowork-flow') {
|
|
35
39
|
const result = await execFileAsync('npm', ['view', packageName, 'version'], {
|
|
36
|
-
encoding: 'utf8'
|
|
40
|
+
encoding: 'utf8',
|
|
41
|
+
...npmCommandOptions()
|
|
37
42
|
});
|
|
38
43
|
return result.stdout.trim();
|
|
39
44
|
}
|
|
@@ -41,7 +46,8 @@ export async function fetchLatestVersion(packageName = 'cowork-flow') {
|
|
|
41
46
|
export async function runGlobalInstall(packageSpec = 'cowork-flow@latest') {
|
|
42
47
|
return new Promise((resolvePromise, rejectPromise) => {
|
|
43
48
|
const child = spawn('npm', ['install', '-g', packageSpec], {
|
|
44
|
-
stdio: 'inherit'
|
|
49
|
+
stdio: 'inherit',
|
|
50
|
+
...npmCommandOptions()
|
|
45
51
|
});
|
|
46
52
|
child.on('error', rejectPromise);
|
|
47
53
|
child.on('close', (code) => resolvePromise(code ?? 1));
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agent-team-execution
|
|
3
|
+
description: Use when executing an approved implementation plan with independent tasks, multiple agents, or an explicit request to use agent team execution
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Agent Team Execution
|
|
7
|
+
|
|
8
|
+
Use this skill after a task is active and an approved `.cowork-flow/plans/*.md` file is in task context.
|
|
9
|
+
|
|
10
|
+
## Process
|
|
11
|
+
|
|
12
|
+
1. Run `./.cowork-flow/run agent-team prepare <task-dir> --plan <plan-file>`.
|
|
13
|
+
2. Review `agent-team/dispatch-plan.yaml` for unsafe parallelism, file conflicts, missing context, or weak agent matches.
|
|
14
|
+
3. Run `./.cowork-flow/run agent-team next <task-dir>` to get ready assignments.
|
|
15
|
+
4. In Codex, dispatch the ready assignments to the recommended agent types. Tell each worker it is not alone in the codebase, must respect the write boundary, must not revert others' edits, and must list changed files.
|
|
16
|
+
5. While workers run, coordinate: answer questions, unblock context gaps, and integrate non-conflicting results.
|
|
17
|
+
6. Record outputs with `record-result` and reviews with `record-review`.
|
|
18
|
+
7. Use `retry` only after adding missing context, changing agent choice, or splitting an oversized assignment.
|
|
19
|
+
8. Run `complete` before claiming the agent team work is done.
|
|
20
|
+
|
|
21
|
+
## Rules
|
|
22
|
+
|
|
23
|
+
- The script suggests; the main agent decides.
|
|
24
|
+
- Do not parallelize assignments with overlapping write files.
|
|
25
|
+
- Do not skip spec review or quality review.
|
|
26
|
+
- Do not rely on chat history for state; write results through `agent-team` commands.
|
|
File without changes
|
|
File without changes
|
|
@@ -336,6 +336,7 @@ Implement the task described in `prd.md`.
|
|
|
336
336
|
- Follow all specs injected into implement context
|
|
337
337
|
- Keep changes scoped to requirements
|
|
338
338
|
- Run the project verification commands from `AGENTS.md` or `.cowork-flow/config.yaml` before finishing
|
|
339
|
+
- If executing an approved plan with independent work, use `agent-team-execution`: run `agent-team prepare`, review the dispatch plan, use `agent-team next` for ready assignments, and finish with `agent-team complete`.
|
|
339
340
|
|
|
340
341
|
**Step 9: Check Quality** `[AI]`
|
|
341
342
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.7
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Agent Team Adapters
|
|
2
|
+
|
|
3
|
+
default: codex
|
|
4
|
+
fallback: manual
|
|
5
|
+
|
|
6
|
+
adapters:
|
|
7
|
+
codex:
|
|
8
|
+
mode: coordinator-dispatched
|
|
9
|
+
description: 主 agent 使用 Codex 子 agent 工具执行脚本生成的 assignments。
|
|
10
|
+
output_file: adapters/codex.json
|
|
11
|
+
|
|
12
|
+
manual:
|
|
13
|
+
mode: prompt-only
|
|
14
|
+
description: 生成可复制的 assignment prompt,由人或其他宿主执行并回写结果。
|
|
15
|
+
output_file: adapters/manual.json
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# Agent Team Registry
|
|
2
|
+
# Project teams may customize this file after initialization.
|
|
3
|
+
|
|
4
|
+
default_adapter: codex
|
|
5
|
+
|
|
6
|
+
agents:
|
|
7
|
+
implementer:
|
|
8
|
+
agent_type: worker
|
|
9
|
+
capabilities:
|
|
10
|
+
- implementation
|
|
11
|
+
- test-writing
|
|
12
|
+
preferred_task_types:
|
|
13
|
+
- code
|
|
14
|
+
- test
|
|
15
|
+
file_patterns:
|
|
16
|
+
- "src/**"
|
|
17
|
+
- "template/**"
|
|
18
|
+
- "tests/**"
|
|
19
|
+
- "test/**"
|
|
20
|
+
risk_limits:
|
|
21
|
+
max_parallel_write_conflicts: 0
|
|
22
|
+
prompt: |
|
|
23
|
+
Implement the smallest change that satisfies the approved plan and tests.
|
|
24
|
+
Write or update focused regression tests first, keep edits scoped, and report exact verification commands.
|
|
25
|
+
|
|
26
|
+
tester:
|
|
27
|
+
agent_type: worker
|
|
28
|
+
capabilities:
|
|
29
|
+
- test-writing
|
|
30
|
+
- verification
|
|
31
|
+
preferred_task_types:
|
|
32
|
+
- test
|
|
33
|
+
- verification
|
|
34
|
+
file_patterns:
|
|
35
|
+
- "tests/**"
|
|
36
|
+
- "test/**"
|
|
37
|
+
- "src/**"
|
|
38
|
+
- "template/**"
|
|
39
|
+
risk_limits:
|
|
40
|
+
max_parallel_write_conflicts: 0
|
|
41
|
+
prompt: |
|
|
42
|
+
Design tests that fail for the broken behavior and pass for the intended behavior.
|
|
43
|
+
Prefer clear behavior assertions over implementation details, and include the command that proves the result.
|
|
44
|
+
|
|
45
|
+
debugger:
|
|
46
|
+
agent_type: worker
|
|
47
|
+
capabilities:
|
|
48
|
+
- debugging
|
|
49
|
+
- implementation
|
|
50
|
+
- verification
|
|
51
|
+
preferred_task_types:
|
|
52
|
+
- bugfix
|
|
53
|
+
- code
|
|
54
|
+
file_patterns:
|
|
55
|
+
- "src/**"
|
|
56
|
+
- "template/**"
|
|
57
|
+
- "tests/**"
|
|
58
|
+
- "test/**"
|
|
59
|
+
risk_limits:
|
|
60
|
+
max_parallel_write_conflicts: 0
|
|
61
|
+
prompt: |
|
|
62
|
+
Find the root cause before changing code. Reproduce the failure, compare with nearby working patterns,
|
|
63
|
+
then make the smallest fix and verify the original symptom.
|
|
64
|
+
|
|
65
|
+
spec-reviewer:
|
|
66
|
+
agent_type: default
|
|
67
|
+
capabilities:
|
|
68
|
+
- spec-review
|
|
69
|
+
- acceptance-check
|
|
70
|
+
preferred_task_types:
|
|
71
|
+
- review
|
|
72
|
+
- documentation
|
|
73
|
+
file_patterns:
|
|
74
|
+
- ".cowork-flow/changes/**"
|
|
75
|
+
- ".cowork-flow/plans/**"
|
|
76
|
+
- "README.md"
|
|
77
|
+
- "template/**"
|
|
78
|
+
risk_limits:
|
|
79
|
+
max_parallel_write_conflicts: 0
|
|
80
|
+
prompt: |
|
|
81
|
+
Review the proposal, spec, plan, and task PRD for contradictions, missing acceptance criteria,
|
|
82
|
+
unclear scope, and behavior that is not covered by verification.
|
|
83
|
+
|
|
84
|
+
quality-reviewer:
|
|
85
|
+
agent_type: default
|
|
86
|
+
capabilities:
|
|
87
|
+
- code-quality-review
|
|
88
|
+
- test-review
|
|
89
|
+
- verification
|
|
90
|
+
preferred_task_types:
|
|
91
|
+
- review
|
|
92
|
+
- verification
|
|
93
|
+
file_patterns:
|
|
94
|
+
- "src/**"
|
|
95
|
+
- "template/**"
|
|
96
|
+
- "tests/**"
|
|
97
|
+
- "test/**"
|
|
98
|
+
risk_limits:
|
|
99
|
+
max_parallel_write_conflicts: 0
|
|
100
|
+
prompt: |
|
|
101
|
+
Review the diff for correctness, maintainability, focused scope, and meaningful tests.
|
|
102
|
+
Check that verification evidence matches the behavior being claimed.
|
|
103
|
+
|
|
104
|
+
docs-agent:
|
|
105
|
+
agent_type: worker
|
|
106
|
+
capabilities:
|
|
107
|
+
- documentation
|
|
108
|
+
- workflow-writing
|
|
109
|
+
preferred_task_types:
|
|
110
|
+
- docs
|
|
111
|
+
- documentation
|
|
112
|
+
file_patterns:
|
|
113
|
+
- "README.md"
|
|
114
|
+
- "AGENTS.md"
|
|
115
|
+
- ".cowork-flow/**/*.md"
|
|
116
|
+
- ".agent/skills/**"
|
|
117
|
+
risk_limits:
|
|
118
|
+
max_parallel_write_conflicts: 0
|
|
119
|
+
prompt: |
|
|
120
|
+
Write concise project documentation that reflects actual commands, files, and workflow behavior.
|
|
121
|
+
Avoid aspirational text that is not backed by the implementation.
|
|
122
|
+
|
|
123
|
+
release-reviewer:
|
|
124
|
+
agent_type: default
|
|
125
|
+
capabilities:
|
|
126
|
+
- release-review
|
|
127
|
+
- acceptance-check
|
|
128
|
+
- verification
|
|
129
|
+
preferred_task_types:
|
|
130
|
+
- release
|
|
131
|
+
- review
|
|
132
|
+
file_patterns:
|
|
133
|
+
- "package.json"
|
|
134
|
+
- "package-lock.json"
|
|
135
|
+
- "scripts/**"
|
|
136
|
+
- "README.md"
|
|
137
|
+
- ".cowork-flow/changes/**"
|
|
138
|
+
risk_limits:
|
|
139
|
+
max_parallel_write_conflicts: 0
|
|
140
|
+
prompt: |
|
|
141
|
+
Review release-facing changes for versioning, packaging, documentation, and command safety.
|
|
142
|
+
Confirm that generated artifacts and publish steps are intentional.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Agent Team Policy
|
|
2
|
+
|
|
3
|
+
parallel:
|
|
4
|
+
allow_parallel_batches: true
|
|
5
|
+
disallow_file_write_conflicts: true
|
|
6
|
+
require_coordinator_review: true
|
|
7
|
+
|
|
8
|
+
reviews:
|
|
9
|
+
require_spec_review: true
|
|
10
|
+
require_quality_review: true
|
|
11
|
+
chain:
|
|
12
|
+
- implementer
|
|
13
|
+
- spec-reviewer
|
|
14
|
+
- quality-reviewer
|
|
15
|
+
|
|
16
|
+
retry:
|
|
17
|
+
max_attempts: 3
|
|
18
|
+
retry_on:
|
|
19
|
+
- needs_context
|
|
20
|
+
- failed_verification
|
|
21
|
+
- review_rejected
|
|
22
|
+
- adapter_failed
|
|
23
|
+
escalation: needs-coordinator-decision
|
|
@@ -14,6 +14,15 @@ session_commit_message: "chore: record journal"
|
|
|
14
14
|
# Maximum lines per journal file before rotating to a new one
|
|
15
15
|
max_journal_lines: 2000
|
|
16
16
|
|
|
17
|
+
#-------------------------------------------------------------------------------
|
|
18
|
+
# Agent Team Runtime
|
|
19
|
+
#-------------------------------------------------------------------------------
|
|
20
|
+
|
|
21
|
+
# Disabled by default. Set to true before using agent-team runtime commands such
|
|
22
|
+
# as prepare/status/next/record-result/record-review/retry/complete.
|
|
23
|
+
agent_team:
|
|
24
|
+
enabled: false
|
|
25
|
+
|
|
17
26
|
#-------------------------------------------------------------------------------
|
|
18
27
|
# Task Lifecycle Hooks
|
|
19
28
|
#-------------------------------------------------------------------------------
|
|
@@ -3,29 +3,8 @@ set -u
|
|
|
3
3
|
|
|
4
4
|
MIN_PYTHON_LABEL="Python 3.8+"
|
|
5
5
|
VERSION_CHECK='import sys; raise SystemExit(0 if sys.version_info >= (3, 8) else 1)'
|
|
6
|
-
|
|
7
6
|
WORKFLOW_DIR=$(CDPATH= cd "$(dirname "$0")" && pwd) || exit 1
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
print_usage() {
|
|
11
|
-
cat <<'EOF'
|
|
12
|
-
用法:
|
|
13
|
-
./.cowork-flow/run <command> [args...]
|
|
14
|
-
./.cowork-flow/run python [python-args...]
|
|
15
|
-
|
|
16
|
-
常用 command:
|
|
17
|
-
resume
|
|
18
|
-
task
|
|
19
|
-
change
|
|
20
|
-
get-context
|
|
21
|
-
get-developer
|
|
22
|
-
init-developer
|
|
23
|
-
add-session
|
|
24
|
-
|
|
25
|
-
解释器选择顺序:
|
|
26
|
-
COWORK_FLOW_PYTHON -> PYTHON -> python3 -> python -> py -3
|
|
27
|
-
EOF
|
|
28
|
-
}
|
|
7
|
+
RUNNER_SCRIPT="$WORKFLOW_DIR/scripts/run.py"
|
|
29
8
|
|
|
30
9
|
candidate_is_valid() {
|
|
31
10
|
candidate_cmd=$1
|
|
@@ -50,8 +29,8 @@ select_explicit_python() {
|
|
|
50
29
|
return 0
|
|
51
30
|
fi
|
|
52
31
|
|
|
53
|
-
echo "
|
|
54
|
-
echo "
|
|
32
|
+
echo "Error: $env_name does not point to a usable ${MIN_PYTHON_LABEL} interpreter: $env_value" >&2
|
|
33
|
+
echo "Set $env_name to an executable Python 3.8+ interpreter path." >&2
|
|
55
34
|
exit 127
|
|
56
35
|
}
|
|
57
36
|
|
|
@@ -85,78 +64,16 @@ select_python() {
|
|
|
85
64
|
return 0
|
|
86
65
|
fi
|
|
87
66
|
|
|
88
|
-
echo "
|
|
89
|
-
echo "
|
|
90
|
-
echo "
|
|
67
|
+
echo "Error: ${MIN_PYTHON_LABEL} is required, but no usable interpreter was found." >&2
|
|
68
|
+
echo "Tried: COWORK_FLOW_PYTHON, PYTHON, python3, python, py -3." >&2
|
|
69
|
+
echo "Set COWORK_FLOW_PYTHON=/path/to/python3 and retry." >&2
|
|
91
70
|
exit 127
|
|
92
71
|
}
|
|
93
72
|
|
|
94
|
-
|
|
95
|
-
select_python
|
|
96
|
-
|
|
97
|
-
if [ -n "$SELECTED_PYTHON_ARG" ]; then
|
|
98
|
-
exec "$SELECTED_PYTHON" "$SELECTED_PYTHON_ARG" "$@"
|
|
99
|
-
fi
|
|
100
|
-
|
|
101
|
-
exec "$SELECTED_PYTHON" "$@"
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
run_script() {
|
|
105
|
-
script_path=$1
|
|
106
|
-
shift
|
|
107
|
-
|
|
108
|
-
if [ ! -f "$script_path" ]; then
|
|
109
|
-
echo "错误:找不到脚本:$script_path" >&2
|
|
110
|
-
exit 2
|
|
111
|
-
fi
|
|
112
|
-
|
|
113
|
-
exec_python "$script_path" "$@"
|
|
114
|
-
}
|
|
73
|
+
select_python
|
|
115
74
|
|
|
116
|
-
if [ "
|
|
117
|
-
|
|
118
|
-
exit 2
|
|
75
|
+
if [ -n "$SELECTED_PYTHON_ARG" ]; then
|
|
76
|
+
exec "$SELECTED_PYTHON" "$SELECTED_PYTHON_ARG" "$RUNNER_SCRIPT" "$@"
|
|
119
77
|
fi
|
|
120
78
|
|
|
121
|
-
|
|
122
|
-
shift
|
|
123
|
-
|
|
124
|
-
case "$command_name" in
|
|
125
|
-
-h|--help|help)
|
|
126
|
-
print_usage
|
|
127
|
-
exit 0
|
|
128
|
-
;;
|
|
129
|
-
python)
|
|
130
|
-
exec_python "$@"
|
|
131
|
-
;;
|
|
132
|
-
resume)
|
|
133
|
-
run_script "$SCRIPTS_DIR/resume.py" "$@"
|
|
134
|
-
;;
|
|
135
|
-
task)
|
|
136
|
-
run_script "$SCRIPTS_DIR/task.py" "$@"
|
|
137
|
-
;;
|
|
138
|
-
change)
|
|
139
|
-
run_script "$SCRIPTS_DIR/change.py" "$@"
|
|
140
|
-
;;
|
|
141
|
-
get-context|get_context)
|
|
142
|
-
run_script "$SCRIPTS_DIR/get_context.py" "$@"
|
|
143
|
-
;;
|
|
144
|
-
get-developer|get_developer)
|
|
145
|
-
run_script "$SCRIPTS_DIR/get_developer.py" "$@"
|
|
146
|
-
;;
|
|
147
|
-
init-developer|init_developer)
|
|
148
|
-
run_script "$SCRIPTS_DIR/init_developer.py" "$@"
|
|
149
|
-
;;
|
|
150
|
-
add-session|add_session)
|
|
151
|
-
run_script "$SCRIPTS_DIR/add_session.py" "$@"
|
|
152
|
-
;;
|
|
153
|
-
*)
|
|
154
|
-
if [ -f "$SCRIPTS_DIR/$command_name.py" ]; then
|
|
155
|
-
run_script "$SCRIPTS_DIR/$command_name.py" "$@"
|
|
156
|
-
fi
|
|
157
|
-
|
|
158
|
-
echo "错误:未知 cowork-flow 命令:$command_name" >&2
|
|
159
|
-
print_usage >&2
|
|
160
|
-
exit 2
|
|
161
|
-
;;
|
|
162
|
-
esac
|
|
79
|
+
exec "$SELECTED_PYTHON" "$RUNNER_SCRIPT" "$@"
|