@chenmk/superflow 0.4.0 → 0.5.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/INSTALL.en.md +58 -12
- package/INSTALL.md +62 -33
- package/README.md +181 -54
- package/README.zh-CN.md +158 -51
- package/assets/brand/managed-review-loop.png +0 -0
- package/assets/manifest.json +10 -5
- package/assets/scripts/superflow-coding-ready.mjs +135 -0
- package/assets/scripts/superflow-dependency-update-hook.sh +81 -8
- package/assets/scripts/superflow-document-audit.mjs +240 -0
- package/assets/scripts/superflow-environment-preflight.mjs +398 -0
- package/assets/scripts/superflow-hook-guard.sh +40 -1
- package/assets/scripts/superflow-managed-command-guard.py +309 -0
- package/assets/scripts/superflow-managed-executor-preflight.mjs +421 -0
- package/assets/scripts/superflow-managed-owner-verification.sh +117 -0
- package/assets/scripts/superflow-managed-work-check.mjs +287 -26
- package/assets/scripts/superflow-managed-work-guard.sh +6 -92
- package/assets/skills/superflow-clarify/SKILL.md +14 -0
- package/assets/skills/superflow-design/SKILL.md +38 -13
- package/assets/skills/superflow-docs/SKILL.md +93 -2
- package/assets/skills/superflow-pipeline/SKILL.md +167 -10
- package/assets/skills/superflow-pipeline/references/batch-prompt-template.md +17 -9
- package/assets/skills/superflow-pipeline/references/document-readiness.md +157 -0
- package/assets/skills/superflow-pipeline/references/document-templates.md +9 -5
- package/assets/skills/superflow-pipeline/references/feature-gated-workflow.md +14 -0
- package/assets/skills/superflow-pipeline/references/implementation-prompt-template.md +20 -11
- package/assets/skills/superflow-pipeline/references/managed-work.md +123 -15
- package/assets/skills/superflow-pipeline/references/orchestration.md +2 -2
- package/assets/skills/superflow-pipeline/references/p0-baseline-template.md +3 -2
- package/assets/skills/superflow-pipeline/references/quality-gate.md +7 -5
- package/assets/skills/superflow-pipeline/references/reviewer-checklist.md +7 -0
- package/assets/skills/superflow-pipeline/scripts/superflow-guard.sh +205 -9
- package/assets/skills/superflow-pipeline/scripts/superflow-handoff.sh +7 -4
- package/assets/skills/superflow-requirement-review/SKILL.md +178 -0
- package/assets/skills/superflow-requirement-review/agents/openai.yaml +4 -0
- package/assets/skills-en/superflow-clarify/SKILL.md +17 -0
- package/assets/skills-en/superflow-design/SKILL.md +31 -12
- package/assets/skills-en/superflow-docs/SKILL.md +99 -0
- package/assets/skills-en/superflow-pipeline/SKILL.md +163 -9
- package/assets/skills-en/superflow-pipeline/references/batch-prompt-template.md +4 -0
- package/assets/skills-en/superflow-pipeline/references/document-readiness.md +125 -0
- package/assets/skills-en/superflow-pipeline/references/document-templates.md +10 -0
- package/assets/skills-en/superflow-pipeline/references/feature-gated-workflow.md +7 -0
- package/assets/skills-en/superflow-pipeline/references/implementation-prompt-template.md +7 -0
- package/assets/skills-en/superflow-pipeline/references/managed-work.md +160 -10
- package/assets/skills-en/superflow-pipeline/references/quality-gate.md +12 -0
- package/assets/skills-en/superflow-pipeline/references/reviewer-checklist.md +7 -0
- package/assets/skills-en/superflow-pipeline/scripts/superflow-guard.sh +205 -9
- package/assets/skills-en/superflow-pipeline/scripts/superflow-handoff.sh +7 -4
- package/assets/skills-en/superflow-requirement-review/SKILL.md +99 -0
- package/assets/skills-en/superflow-requirement-review/agents/openai.yaml +4 -0
- package/dist/app/cli.js +64 -9
- package/dist/app/cli.js.map +1 -1
- package/dist/app/commands/change-guard.js +19 -2
- package/dist/app/commands/change-guard.js.map +1 -1
- package/dist/app/commands/check.js +107 -45
- package/dist/app/commands/check.js.map +1 -1
- package/dist/app/commands/docs.js +7 -3
- package/dist/app/commands/docs.js.map +1 -1
- package/dist/app/commands/doctor.js +174 -198
- package/dist/app/commands/doctor.js.map +1 -1
- package/dist/app/commands/eval.js +64 -0
- package/dist/app/commands/eval.js.map +1 -0
- package/dist/app/commands/implement.js +7 -3
- package/dist/app/commands/implement.js.map +1 -1
- package/dist/app/commands/init.js +12 -24
- package/dist/app/commands/init.js.map +1 -1
- package/dist/app/commands/mcp.js +167 -0
- package/dist/app/commands/mcp.js.map +1 -0
- package/dist/app/commands/pipeline.js +652 -18
- package/dist/app/commands/pipeline.js.map +1 -1
- package/dist/app/commands/requirement-review.js +6 -0
- package/dist/app/commands/requirement-review.js.map +1 -0
- package/dist/app/commands/status.js +66 -3
- package/dist/app/commands/status.js.map +1 -1
- package/dist/app/commands/uninstall.js +3 -3
- package/dist/app/commands/uninstall.js.map +1 -1
- package/dist/app/commands/update.js +83 -9
- package/dist/app/commands/update.js.map +1 -1
- package/dist/domains/agent.js +3 -11
- package/dist/domains/agent.js.map +1 -1
- package/dist/domains/config/cli-help.js +54 -12
- package/dist/domains/config/cli-help.js.map +1 -1
- package/dist/domains/config/i18n.js +6 -8
- package/dist/domains/config/i18n.js.map +1 -1
- package/dist/domains/config/manifest.js +0 -3
- package/dist/domains/config/manifest.js.map +1 -1
- package/dist/domains/deps.js +68 -7
- package/dist/domains/deps.js.map +1 -1
- package/dist/domains/managed-work/completion-policy.js +174 -0
- package/dist/domains/managed-work/completion-policy.js.map +1 -0
- package/dist/domains/managed-work/context-manifest.js +208 -0
- package/dist/domains/managed-work/context-manifest.js.map +1 -0
- package/dist/domains/managed-work/contract.js +135 -4
- package/dist/domains/managed-work/contract.js.map +1 -1
- package/dist/domains/managed-work/control-signals.js +34 -0
- package/dist/domains/managed-work/control-signals.js.map +1 -0
- package/dist/domains/managed-work/control.js +628 -0
- package/dist/domains/managed-work/control.js.map +1 -0
- package/dist/domains/managed-work/evaluation.js +497 -0
- package/dist/domains/managed-work/evaluation.js.map +1 -0
- package/dist/domains/managed-work/evidence-path.js +14 -0
- package/dist/domains/managed-work/evidence-path.js.map +1 -0
- package/dist/domains/managed-work/execution-contract.js +167 -0
- package/dist/domains/managed-work/execution-contract.js.map +1 -0
- package/dist/domains/managed-work/executor-policy.js +65 -0
- package/dist/domains/managed-work/executor-policy.js.map +1 -0
- package/dist/domains/managed-work/failure.js +65 -0
- package/dist/domains/managed-work/failure.js.map +1 -0
- package/dist/domains/managed-work/host-review.js +77 -0
- package/dist/domains/managed-work/host-review.js.map +1 -0
- package/dist/domains/managed-work/human-messages.js +31 -0
- package/dist/domains/managed-work/human-messages.js.map +1 -0
- package/dist/domains/managed-work/input.js +29 -3
- package/dist/domains/managed-work/input.js.map +1 -1
- package/dist/domains/managed-work/journal.js +77 -3
- package/dist/domains/managed-work/journal.js.map +1 -1
- package/dist/domains/managed-work/lock.js +67 -1
- package/dist/domains/managed-work/lock.js.map +1 -1
- package/dist/domains/managed-work/notifications.js +0 -15
- package/dist/domains/managed-work/notifications.js.map +1 -1
- package/dist/domains/managed-work/pair-admission.js +108 -0
- package/dist/domains/managed-work/pair-admission.js.map +1 -0
- package/dist/domains/managed-work/prompts.js +257 -22
- package/dist/domains/managed-work/prompts.js.map +1 -1
- package/dist/domains/managed-work/redaction.js +90 -0
- package/dist/domains/managed-work/redaction.js.map +1 -0
- package/dist/domains/managed-work/review-convergence.js +41 -0
- package/dist/domains/managed-work/review-convergence.js.map +1 -0
- package/dist/domains/managed-work/review-facts.js +181 -0
- package/dist/domains/managed-work/review-facts.js.map +1 -0
- package/dist/domains/managed-work/rule-selection.js +84 -0
- package/dist/domains/managed-work/rule-selection.js.map +1 -0
- package/dist/domains/managed-work/runner.js +1967 -175
- package/dist/domains/managed-work/runner.js.map +1 -1
- package/dist/domains/managed-work/schemas.js +72 -2
- package/dist/domains/managed-work/schemas.js.map +1 -1
- package/dist/domains/managed-work/service.js +82 -13
- package/dist/domains/managed-work/service.js.map +1 -1
- package/dist/domains/managed-work/state.js +195 -5
- package/dist/domains/managed-work/state.js.map +1 -1
- package/dist/domains/managed-work/storage.js +66 -24
- package/dist/domains/managed-work/storage.js.map +1 -1
- package/dist/domains/managed-work/types.js +12 -9
- package/dist/domains/managed-work/types.js.map +1 -1
- package/dist/domains/managed-work/verification-categories.js +39 -0
- package/dist/domains/managed-work/verification-categories.js.map +1 -0
- package/dist/domains/managed-work/verification-policy.js +116 -0
- package/dist/domains/managed-work/verification-policy.js.map +1 -0
- package/dist/domains/managed-work/wait.js +21 -3
- package/dist/domains/managed-work/wait.js.map +1 -1
- package/dist/domains/managed-work/workspace-binding.js +133 -0
- package/dist/domains/managed-work/workspace-binding.js.map +1 -0
- package/dist/domains/sdd-readiness.js +44 -0
- package/dist/domains/sdd-readiness.js.map +1 -0
- package/dist/domains/skill/deploy.js +0 -6
- package/dist/domains/skill/deploy.js.map +1 -1
- package/dist/domains/skill/scripts.js +0 -8
- package/dist/domains/skill/scripts.js.map +1 -1
- package/dist/domains/state.js +1 -2
- package/dist/domains/state.js.map +1 -1
- package/dist/mcp/runtime-identity.js +21 -0
- package/dist/mcp/runtime-identity.js.map +1 -0
- package/dist/mcp/server.js +369 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/platform/agent-process.js +499 -38
- package/dist/platform/agent-process.js.map +1 -1
- package/dist/platform/executable.js +28 -0
- package/dist/platform/executable.js.map +1 -0
- package/dist/platform/paths.js +1 -17
- package/dist/platform/paths.js.map +1 -1
- package/dist/platform/process-tree.js +44 -0
- package/dist/platform/process-tree.js.map +1 -0
- package/dist/platform/process.js +1 -1
- package/dist/platform/process.js.map +1 -1
- package/package.json +17 -7
- package/scripts/check-design-principles.mjs +107 -0
- package/scripts/check-managed-work-design.mjs +507 -0
- package/scripts/clean-dist.js +9 -0
- package/scripts/ensure-bin-modes.js +11 -0
- package/scripts/preinstall.js +57 -0
- package/dist/cli/index.js +0 -193
- package/dist/cli/index.js.map +0 -1
- package/dist/commands/archive.js +0 -6
- package/dist/commands/archive.js.map +0 -1
- package/dist/commands/clarify.js +0 -6
- package/dist/commands/clarify.js.map +0 -1
- package/dist/commands/design.js +0 -28
- package/dist/commands/design.js.map +0 -1
- package/dist/commands/docs.js +0 -6
- package/dist/commands/docs.js.map +0 -1
- package/dist/commands/doctor.js +0 -494
- package/dist/commands/doctor.js.map +0 -1
- package/dist/commands/implement.js +0 -6
- package/dist/commands/implement.js.map +0 -1
- package/dist/commands/init.js +0 -520
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/pipeline.js +0 -6
- package/dist/commands/pipeline.js.map +0 -1
- package/dist/commands/scan.js +0 -63
- package/dist/commands/scan.js.map +0 -1
- package/dist/commands/status.js +0 -173
- package/dist/commands/status.js.map +0 -1
- package/dist/commands/uninstall.js +0 -214
- package/dist/commands/uninstall.js.map +0 -1
- package/dist/commands/update.js +0 -193
- package/dist/commands/update.js.map +0 -1
- package/dist/commands/verify.js +0 -6
- package/dist/commands/verify.js.map +0 -1
- package/dist/core/assets.js +0 -27
- package/dist/core/assets.js.map +0 -1
- package/dist/core/cli-help.js +0 -98
- package/dist/core/cli-help.js.map +0 -1
- package/dist/core/context.js +0 -123
- package/dist/core/context.js.map +0 -1
- package/dist/core/dependencies.js +0 -146
- package/dist/core/dependencies.js.map +0 -1
- package/dist/core/detect.js +0 -64
- package/dist/core/detect.js.map +0 -1
- package/dist/core/i18n.js +0 -105
- package/dist/core/i18n.js.map +0 -1
- package/dist/core/integrity.js +0 -46
- package/dist/core/integrity.js.map +0 -1
- package/dist/core/manifest.js +0 -21
- package/dist/core/manifest.js.map +0 -1
- package/dist/core/prompts.js +0 -20
- package/dist/core/prompts.js.map +0 -1
- package/dist/core/registry.js +0 -134
- package/dist/core/registry.js.map +0 -1
- package/dist/core/rules.js +0 -17
- package/dist/core/rules.js.map +0 -1
- package/dist/core/scripts.js +0 -48
- package/dist/core/scripts.js.map +0 -1
- package/dist/core/skill-check.js +0 -32
- package/dist/core/skill-check.js.map +0 -1
- package/dist/core/skills.js +0 -62
- package/dist/core/skills.js.map +0 -1
- package/dist/core/state.js +0 -54
- package/dist/core/state.js.map +0 -1
- package/dist/utils/path.js +0 -11
- package/dist/utils/path.js.map +0 -1
- package/dist/utils/shell.js +0 -29
- package/dist/utils/shell.js.map +0 -1
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
+
import { existsSync } from "fs";
|
|
2
3
|
import { managedRunDir, managedTaskDir } from "./paths.js";
|
|
3
|
-
export function buildExecutorPrompt(contract, state, repairFindings = []) {
|
|
4
|
+
export function buildExecutorPrompt(contract, state, repairFindings = [], handoffPath) {
|
|
4
5
|
if (contract.language === "en") {
|
|
5
|
-
return buildExecutorPromptEnglish(contract, state, repairFindings);
|
|
6
|
+
return buildExecutorPromptEnglish(contract, state, repairFindings, handoffPath);
|
|
6
7
|
}
|
|
7
8
|
const taskDir = managedTaskDir(contract.projectRoot, contract.taskId);
|
|
8
9
|
const runDir = managedRunDir(contract.projectRoot, contract.taskId, state.runId);
|
|
9
10
|
const frozenPrompt = contract.taskPrompt
|
|
10
11
|
? [
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
`${contract.taskPrompt.origin === "generated_standard" ? "冻结标准执行合同" : "冻结任务 Prompt"}:${contract.taskPrompt.snapshotPath}`,
|
|
13
|
+
...(contract.taskPrompt.origin === "generated_standard"
|
|
14
|
+
? []
|
|
15
|
+
: [
|
|
16
|
+
`原始 Prompt 目录:${path.dirname(contract.taskPrompt.originalPath)}`,
|
|
17
|
+
]),
|
|
13
18
|
`Prompt SHA-256:${contract.taskPrompt.sha256}`,
|
|
14
19
|
]
|
|
15
20
|
: [];
|
|
21
|
+
const deliveryChecklist = buildDeliveryChecklist(contract, "zh");
|
|
16
22
|
const repair = repairFindings.length === 0
|
|
17
23
|
? ""
|
|
18
24
|
: [
|
|
@@ -27,6 +33,13 @@ export function buildExecutorPrompt(contract, state, repairFindings = []) {
|
|
|
27
33
|
` - 验收:${finding.acceptanceChecks.join(";")}`,
|
|
28
34
|
].join("\n")),
|
|
29
35
|
].join("\n");
|
|
36
|
+
const rollover = state.executorInvocations > 1 && !state.executorSession.sessionId
|
|
37
|
+
? [
|
|
38
|
+
"- 这是全新的短执行会话,不继承旧聊天。以当前工作区、冻结任务 Prompt、已落盘结果和本轮 finding 为唯一交接事实。",
|
|
39
|
+
"- 先读取项目级 CLAUDE.md、适用的 `.claude/rules` 和冻结 Prompt,再检查当前 diff;不得凭旧会话记忆猜测已完成内容。",
|
|
40
|
+
"- 只有真实工具调用返回错误时,才允许声明工具不可用;不得只总结旧工作、重复合同或因会话轮换而提前返回 blocked。",
|
|
41
|
+
]
|
|
42
|
+
: [];
|
|
30
43
|
return [
|
|
31
44
|
"你是这个托管任务唯一允许修改目标产物的执行者。",
|
|
32
45
|
"请持续完成任务,不要因为配置、依赖、端口、开发数据库或测试失败就降低标准。",
|
|
@@ -38,8 +51,10 @@ export function buildExecutorPrompt(contract, state, repairFindings = []) {
|
|
|
38
51
|
`项目目录:${contract.projectRoot}`,
|
|
39
52
|
`关联可写仓库:${contract.relatedProjectRoots.join("、") || "无"}`,
|
|
40
53
|
`任务合同:${path.join(taskDir, "task-brief.md")}`,
|
|
54
|
+
...(handoffPath ? [`本轮压缩交接包:${handoffPath}`] : []),
|
|
41
55
|
...frozenPrompt,
|
|
42
56
|
`运行证据目录(只读,不要修改):${runDir}`,
|
|
57
|
+
...deliveryChecklist,
|
|
43
58
|
"",
|
|
44
59
|
"## 用户目标",
|
|
45
60
|
"",
|
|
@@ -47,29 +62,71 @@ export function buildExecutorPrompt(contract, state, repairFindings = []) {
|
|
|
47
62
|
"",
|
|
48
63
|
"## 强制边界",
|
|
49
64
|
"",
|
|
65
|
+
...(contract.mandatoryEngineeringRules?.length
|
|
66
|
+
? [
|
|
67
|
+
"### Host 冻结的强制工程规则",
|
|
68
|
+
...contract.mandatoryEngineeringRules.map((rule) => `- ${rule}`),
|
|
69
|
+
"",
|
|
70
|
+
]
|
|
71
|
+
: []),
|
|
72
|
+
"- 开始前读取项目级 CLAUDE.md 与当前文件类型适用的 `.claude/rules`,并遵守项目规范。",
|
|
73
|
+
...(handoffPath
|
|
74
|
+
? [
|
|
75
|
+
"- 开始执行前必须完整读取本轮压缩交接包;旧会话记忆与交接包冲突时,以交接包和当前工作区为准。",
|
|
76
|
+
]
|
|
77
|
+
: []),
|
|
50
78
|
"- 编码前先搜索现有模块、公共方法、组件、测试和依赖,优先复用。",
|
|
79
|
+
"- 若本任务修改 Superflow CLI 自身,开始前必须完整读取项目根目录下 `docs/superflow-cli-design-principles.md` 和 `docs/superflow-cli-evaluation-framework.md`;涉及托管时再读取 `docs/managed-work-design-principles.md` 和 `docs/managed-agent-protocol.md`。交付前逐项核对全局纲领、统一评价记录和专项强制回归清单。",
|
|
51
80
|
...(contract.taskPrompt
|
|
52
81
|
? [
|
|
53
|
-
"
|
|
54
|
-
|
|
82
|
+
`- 开始工作前必须完整读取冻结${contract.taskPrompt.origin === "generated_standard" ? "标准执行合同" : "任务 Prompt"};它是本次执行入口。`,
|
|
83
|
+
...(contract.taskPrompt.origin === "generated_standard"
|
|
84
|
+
? [
|
|
85
|
+
"- 该合同只冻结执行边界;会改变实现方向的业务或架构选择必须返回 Host 澄清。",
|
|
86
|
+
]
|
|
87
|
+
: [
|
|
88
|
+
`- Prompt 内相对路径统一以 ${path.dirname(contract.taskPrompt.originalPath)} 为基准解析。`,
|
|
89
|
+
]),
|
|
55
90
|
"- tasks.md 只用于清单追踪,不得替代冻结任务 Prompt。",
|
|
56
91
|
]
|
|
57
92
|
: []),
|
|
58
93
|
"- 可以在同一业务平台相关仓库内追踪真实 owner,但必须记录涉及仓库。",
|
|
59
|
-
"-
|
|
94
|
+
"- 可以使用已确认的开发环境数据库。禁止删库、清理既有表和无条件批量更新删除。仅当冻结 Prompt 明确授权清理唯一命名、由本任务创建的开发测试表时,才允许在验证结束后删除该表,并必须保留表已不存在的证据。",
|
|
60
95
|
"- 禁止 Git commit、push、发布、部署和生产写入。",
|
|
61
96
|
"- 禁止关闭沙箱、绕过权限、修改测试迎合实现或用默认值掩盖业务缺口。",
|
|
62
97
|
"- 不要修改 `.superflow/tasks` 下的状态、事件、历史 Prompt 和报告,由后台统一维护。",
|
|
98
|
+
"- Runner 支持非 Git 工作区的文件快照。禁止为 diff、预检或交付执行 `git init`,禁止创建、替换 `.git` 或改变启动时冻结的仓库身份。",
|
|
99
|
+
"- 托管资产分四类:runtime 资源和 workspace-temporary 临时文件由你清理;delivery-artifacts 源码、SQL、测试和报告必须保留给 Host 评审;protected-contracts 冻结需求、设计、Prompt、handoff 和任务事实在终态前不得删除。受保护清单中 immutable 文件只读,retain 文件可更新进度/证据但不得移除。",
|
|
100
|
+
"- 禁止使用 pkill、killall、裸 kill、只按端口/进程名清理或未经 owner 校验的 rm -rf;任务进程、容器和运行目录必须调用已认证 owner helper,普通构建缓存只能在仓库内清理。",
|
|
101
|
+
"- 你负责管理自己启动的应用、构建、测试及辅助进程;退出前应清理,确需保留时必须在结果中记录 PID、用途和状态,不能把进程善后转交给只读检查者。",
|
|
63
102
|
"- 任务涉及代码时必须执行与风险匹配的构建、测试和运行验证;只编译或只跑单测不等于完成。",
|
|
103
|
+
...verificationScopeGuidance(contract, repairFindings.length > 0, "zh"),
|
|
64
104
|
"- 遇到确实需要用户决定、凭据或高风险权限时返回 blocked,写清已经尝试的替代方案。",
|
|
105
|
+
"- 缺少真实数据库、真实 token 或生产权限,不得作为延期本地可实现代码、测试、SQL 候选和文档回填的理由。",
|
|
106
|
+
"- 同批部署、原子切读或发布窗口约束的是上线时点,不是源码实现时点;必须提前完成并验证本地代码,禁止只写迁移清单后把实现推迟到发布阶段。",
|
|
107
|
+
"- tasks.md 或冻结 Prompt 仍有本地代码项未完成时,不得声称本地工作已完成或已用尽。",
|
|
108
|
+
"- 一次调用内持续完成全部本地可执行任务,不得只完成一个模块、一个测试或一个 finding 就提前返回评审。先维护内部清单,完成后再统一验证。",
|
|
109
|
+
"- 任务需要真实应用、数据库、缓存、浏览器或其他运行环境时,首轮就必须提供仓库内的单命令验收入口:从干净状态完成前置检查、setup、构建、启动、真实调用、断言和 cleanup;成功链路与一个代表性 setup/验证失败都必须清理本任务创建的资源。入口不得硬编码个人绝对路径,必须支持项目约定或环境变量,并能在清理后重复执行。",
|
|
110
|
+
"- 详细构建、框架、数据库和客户端日志必须持久化为任务证据;交付引用的路径在 cleanup 删除 nonce/运行目录后仍须存在并可由 Host 读取,不能引用交付时已删除的临时日志。",
|
|
111
|
+
"- 单命令验收入口必须为每个临时进程、端口、数据库、缓存和目录建立可验证 owner 身份。cleanup 不得只凭端口、进程名或裸 PID 操作;必须验证任务 nonce/唯一目录、进程启动指纹或等价身份。优先通过可配置路径直接复用 Superflow 已认证 owner helper;只绑定任务参数的 wrapper 不算自定义清理原语,复制/重写身份判断、kill/delete 或绕过 helper 才算。普通业务任务只验证自身 owner 绑定、一个能在主要资源创建后触发统一 cleanup 的代表性失败和最终零残留;存在多个互不相同的业务删除路径时仍须分别证明删除条件。不重复 helper 的非 owner、伪造 state、PID 复用与信号升级认证套件。只有冻结 Prompt 明确要求、修改 helper/托管编排或新增自定义清理原语时,才运行完整框架认证。",
|
|
112
|
+
"- 单命令验收入口声称可移植时,必须在清除工具路径覆盖变量的干净 shell 中真实运行;成功证据不得通过个人绝对路径注入 Node、owner helper 或项目工具。应从稳定 CLI 入口、项目约定或 PATH 解析安装根,并保留显式环境覆盖作为兼容能力。",
|
|
113
|
+
"- 实现和验证必须继承冻结文档中的 API、DB、并发、事务与测试合同;托管执行不得自行改写 design.md/tests.md 的业务方案。口头简单需求若缺少会影响实现方向的业务或架构决策,交回 Host 澄清,不得在 Executor Prompt 中发明第二套设计。",
|
|
114
|
+
"- SDD/OpenSpec 任务必须同步更新 tasks.md 和 test-report.md:只勾选真实完成项,记录真实命令、测试数量、失败、应用启动和 HTTP 结果;禁止复制旧数字或把未执行项写成通过。",
|
|
115
|
+
"- OpenSpec 任务分类只认机器标签 `[local_required]`、`[environment_required]`、`[release_required]`;没有标签一律按 local_required。不得用 Blocker、owner 或自由文本把本地实现降级为外部前置。",
|
|
116
|
+
"- Runner 会从 tasks.md、Git 差异和成功命令生成基础任务证据;仅当某项需要不同证据时补充 taskEvidence,禁止为凑格式重复填充所有任务。",
|
|
117
|
+
"- 返回 ready_for_review 前执行最终完成度扫描:逐项核对冻结 Prompt、tasks.md、本轮全部 finding、Git diff、构建、测试、应用启动、真实 HTTP、测试报告和进程善后。",
|
|
118
|
+
"- 未经冻结 Prompt 或用户明确授权,不得自行把当前任务项改标为未来版本、增量范围或发布 owner 待办。",
|
|
119
|
+
"- 必须执行并核验冻结文档明确要求的真实后端、应用启动、接口、浏览器和跨仓链路;不得用替代实现关闭文档门禁。具体命令、断言和证据位置只从冻结 tests.md/implementation prompt 继承,不由托管 Prompt 补写。",
|
|
120
|
+
"- 只要仍有本地可处理的 blockers 就必须返回 blocked;只有本地可完成工作全部完成时,才允许返回 ready_for_review。权限合同明确禁止且只能在 Git 批准后由 DBA/测试/SRE 完成的真实环境、部署或发布验收,必须逐项写入 releasePrerequisites,不得放入 blockers 阻止源码评审。没有发布前置条件时也必须返回空数组。",
|
|
121
|
+
...rollover,
|
|
65
122
|
repair,
|
|
66
123
|
"",
|
|
67
124
|
"最终必须严格按照 JSON Schema 返回结构化结果。",
|
|
68
125
|
].join("\n");
|
|
69
126
|
}
|
|
70
|
-
export function buildReviewPrompt(contract, state) {
|
|
127
|
+
export function buildReviewPrompt(contract, state, factsPath) {
|
|
71
128
|
if (contract.language === "en") {
|
|
72
|
-
return buildReviewPromptEnglish(contract, state);
|
|
129
|
+
return buildReviewPromptEnglish(contract, state, factsPath);
|
|
73
130
|
}
|
|
74
131
|
const taskDir = managedTaskDir(contract.projectRoot, contract.taskId);
|
|
75
132
|
const runDir = managedRunDir(contract.projectRoot, contract.taskId, state.runId);
|
|
@@ -92,36 +149,62 @@ export function buildReviewPrompt(contract, state) {
|
|
|
92
149
|
...frozenPrompt,
|
|
93
150
|
`执行结果:${state.lastExecutorResult}`,
|
|
94
151
|
`任务报告:${path.join(runDir, "task-report.md")}`,
|
|
152
|
+
...(factsPath ? [`Runner 事实包:${factsPath}`] : []),
|
|
95
153
|
"",
|
|
96
154
|
"## 检查要求",
|
|
97
155
|
"",
|
|
98
156
|
"- 独立检查用户目标、修改范围、代码差异和命令证据。",
|
|
157
|
+
...(factsPath
|
|
158
|
+
? [
|
|
159
|
+
"- 先读取 Runner 事实包减少重复机械检索;它只证明路径、哈希、退出码和计数,不能代替源码语义审查。",
|
|
160
|
+
]
|
|
161
|
+
: []),
|
|
162
|
+
"- 若本任务修改 Superflow CLI 自身,必须先对照全局设计纲领和统一评价框架完成职责分层审查;涉及托管时再对照 `docs/managed-work-design-principles.md` 和 `docs/managed-agent-protocol.md`,明确指出是否改变角色所有权、JSON 协议、状态机、证据继承或调用经济原则。",
|
|
99
163
|
...(contract.taskPrompt
|
|
100
|
-
? [
|
|
164
|
+
? [
|
|
165
|
+
"- 必须以冻结任务 Prompt 及其引用的 SDD 文档作为评审合同。",
|
|
166
|
+
"- 必须真实运行 openspec instructions apply 并留存输出,核对 tasks.md;只认 `[local_required]`、`[environment_required]`、`[release_required]` 三类机器标签,未标注一律是 local_required。",
|
|
167
|
+
"- 对本轮新增勾选逐项反查 Runner 推导证据、可选 taskEvidence、源码 diff、证据路径和验证命令;缺少真实证据必须退回,但不得只因 Executor 未重复填写可推导字段而退回。",
|
|
168
|
+
]
|
|
101
169
|
: []),
|
|
102
170
|
"- 检查是否复用了现有能力,是否出现重复实现。",
|
|
103
171
|
"- 检查正确性、安全、数据、并发、事务、配置和真实运行风险。",
|
|
104
172
|
"- 任务需要启动/API/数据库/日志证据时,缺少任一项必须阻断。",
|
|
173
|
+
"- 按冻结文档逐项核对真实后端、应用启动、接口、浏览器和跨仓测试证据;托管评审不得另行发明测试合同。",
|
|
174
|
+
"- 必须区分三段状态:local_delivery_ready 表示本地源码交付就绪,environment_validation_blocked 表示环境验收未闭环,release_ready 表示结构化发布任务全部签收;任何状态都不自动授权 Git、部署或生产写入。",
|
|
175
|
+
"- 若冻结 Prompt 或权限合同禁止真实数据库写入、部署或发布,不得反向要求执行这些动作才能通过源码评审;应检查候选脚本和本地证据,并把真实环境验收记录为非阻断的发布前置条件。",
|
|
176
|
+
"- 不得要求评审开始前已经进入任何交付终态;源码满足条件时返回 pass,由统一 CompletionPolicy 原子裁决三段状态。",
|
|
105
177
|
"- 纯格式和个人偏好不要阻断,避免浪费整改轮次。",
|
|
178
|
+
"- Runner 会自动合并历次有效命令证据。若当前结果仅因结构化元数据、负向断言退出码或未重复携带历史证据而被机械拒绝,而历史原始证据足以独立确认交付,则直接返回 pass,由 Runner 审计式晋升;不得要求 Executor 重跑环境或重写 JSON。",
|
|
179
|
+
"- 按三级验证模型评审:先把当前 diff/finding 映射到失效的历史证据;普通业务任务执行任务级真实验收,只有冻结 Prompt 明确要求、修改 owner helper/托管编排或新增自定义清理原语时升级框架认证。不得因文档或证据格式变化要求重跑无关真实链路。",
|
|
180
|
+
"- 对需要真实运行环境的任务,必须在首轮全量审查仓库内单命令验收入口:确认可从干净状态重复执行,不依赖命令外手工 setup,不硬编码个人路径,并在成功、一个代表性 setup/验证失败时清理本任务创建的数据库、进程、端口及临时文件。同轮一次性汇总所有入口缺陷,并确认交付引用的详细日志在运行临时目录删除后仍实际存在。只有冻结 Prompt 明确要求、修改 Superflow owner helper/托管编排或新增自定义清理原语时,才要求逐任务重跑 SIGINT/SIGTERM 等完整框架认证;不得为每个业务任务重复。",
|
|
181
|
+
"- 首轮必须检查验收入口的资源所有权,而不只检查最终端口为空:每个 cleanup 动作都要有任务唯一身份和进程实例指纹,不能按端口、进程名或裸 PID 清理。直接复用已认证 owner helper 时,核对 helper 来源/完整性、任务特定 owner 参数、主要资源创建后的代表性失败、各业务删除路径条件和最终零残留即可;只有 helper 被复制修改、自建清理原语或冻结合同明确要求时,才核对非 owner、残留/伪造 state、PID 复用及全部中断路径。",
|
|
182
|
+
"- 本轮必须完成全量审查并一次性汇总全部实质 finding;覆盖所有受影响模块、调用入口、SQL、测试和运行证据,不得发现第一个严重问题后提前结束。",
|
|
183
|
+
"- 同一类问题存在多个位置时,必须在一个 finding 中枚举完整范围或拆成同轮多个 finding,禁止留到下一轮才逐个暴露。",
|
|
106
184
|
"- 每个阻断问题必须给出事实证据、风险、明确修复要求和可执行验收条件。",
|
|
185
|
+
"- 同一问题跨轮未解决时必须复用 finding ID;禁止只给旧问题换编号来伪装评审进度。",
|
|
107
186
|
"- 没有阻断问题时返回 pass;执行范围外且需要用户决定时返回 blocked。",
|
|
187
|
+
"- 你只读核验应用进程、端口、日志与测试证据,不负责替执行者启动、停止或清理应用进程;进程善后缺失应形成 finding 交回执行者,不要在评审调用中代为处理。",
|
|
108
188
|
"",
|
|
109
189
|
"最终必须严格按照 JSON Schema 返回结构化结果。",
|
|
110
190
|
].join("\n");
|
|
111
191
|
}
|
|
112
|
-
function buildExecutorPromptEnglish(contract, state, repairFindings) {
|
|
192
|
+
function buildExecutorPromptEnglish(contract, state, repairFindings, handoffPath) {
|
|
113
193
|
const taskDir = managedTaskDir(contract.projectRoot, contract.taskId);
|
|
114
194
|
const runDir = managedRunDir(contract.projectRoot, contract.taskId, state.runId);
|
|
115
|
-
const originalPromptDir = contract.taskPrompt
|
|
195
|
+
const originalPromptDir = contract.taskPrompt && contract.taskPrompt.origin !== "generated_standard"
|
|
116
196
|
? path.dirname(contract.taskPrompt.originalPath)
|
|
117
197
|
: null;
|
|
118
198
|
const frozenPrompt = contract.taskPrompt
|
|
119
199
|
? [
|
|
120
|
-
|
|
121
|
-
|
|
200
|
+
`${contract.taskPrompt.origin === "generated_standard" ? "Frozen standard execution contract" : "Frozen task prompt"}: ${contract.taskPrompt.snapshotPath}`,
|
|
201
|
+
...(contract.taskPrompt.origin === "generated_standard"
|
|
202
|
+
? []
|
|
203
|
+
: [`Original prompt directory: ${originalPromptDir}`]),
|
|
122
204
|
`Prompt SHA-256: ${contract.taskPrompt.sha256}`,
|
|
123
205
|
]
|
|
124
206
|
: [];
|
|
207
|
+
const deliveryChecklist = buildDeliveryChecklist(contract, "en");
|
|
125
208
|
const repair = repairFindings.length === 0
|
|
126
209
|
? ""
|
|
127
210
|
: [
|
|
@@ -136,6 +219,13 @@ function buildExecutorPromptEnglish(contract, state, repairFindings) {
|
|
|
136
219
|
` - Acceptance checks: ${finding.acceptanceChecks.join("; ")}`,
|
|
137
220
|
].join("\n")),
|
|
138
221
|
].join("\n");
|
|
222
|
+
const rollover = state.executorInvocations > 1 && !state.executorSession.sessionId
|
|
223
|
+
? [
|
|
224
|
+
"- This is a fresh short executor session with no inherited chat. Treat the current workspace, frozen task prompt, persisted results, and current findings as the complete handoff.",
|
|
225
|
+
"- Read the project CLAUDE.md, applicable `.claude/rules`, and frozen prompt before inspecting the current diff. Never guess completed work from an old session.",
|
|
226
|
+
"- Claim that tools are unavailable only after a real tool invocation returns an error. Do not merely summarize prior work, repeat the contract, or return blocked because the session rolled over.",
|
|
227
|
+
]
|
|
228
|
+
: [];
|
|
139
229
|
return [
|
|
140
230
|
"You are the only executor allowed to modify target deliverables for this managed task.",
|
|
141
231
|
"Continue until the task is complete. Do not lower the bar because of configuration, dependencies, ports, development databases, or test failures.",
|
|
@@ -147,8 +237,12 @@ function buildExecutorPromptEnglish(contract, state, repairFindings) {
|
|
|
147
237
|
`Project root: ${contract.projectRoot}`,
|
|
148
238
|
`Additional writable repositories: ${contract.relatedProjectRoots.join(", ") || "none"}`,
|
|
149
239
|
`Task contract: ${path.join(taskDir, "task-brief.md")}`,
|
|
240
|
+
...(handoffPath
|
|
241
|
+
? [`Condensed handoff for this invocation: ${handoffPath}`]
|
|
242
|
+
: []),
|
|
150
243
|
...frozenPrompt,
|
|
151
244
|
`Run evidence directory (read-only; do not modify): ${runDir}`,
|
|
245
|
+
...deliveryChecklist,
|
|
152
246
|
"",
|
|
153
247
|
"## User goal",
|
|
154
248
|
"",
|
|
@@ -156,33 +250,150 @@ function buildExecutorPromptEnglish(contract, state, repairFindings) {
|
|
|
156
250
|
"",
|
|
157
251
|
"## Mandatory boundaries",
|
|
158
252
|
"",
|
|
253
|
+
...(contract.mandatoryEngineeringRules?.length
|
|
254
|
+
? [
|
|
255
|
+
"### Mandatory engineering rules frozen by the host",
|
|
256
|
+
...contract.mandatoryEngineeringRules.map((rule) => `- ${rule}`),
|
|
257
|
+
"",
|
|
258
|
+
]
|
|
259
|
+
: []),
|
|
260
|
+
"- Read the project-level CLAUDE.md and applicable `.claude/rules` before starting, and follow the project conventions.",
|
|
261
|
+
...(handoffPath
|
|
262
|
+
? [
|
|
263
|
+
"- Read the complete condensed handoff before execution. When old session memory conflicts with the handoff or workspace, trust the handoff and current workspace.",
|
|
264
|
+
]
|
|
265
|
+
: []),
|
|
159
266
|
"- Before coding, search existing modules, shared methods, components, tests, and dependencies; prefer reuse.",
|
|
160
|
-
|
|
267
|
+
"- If this task changes Superflow CLI itself, first read `docs/superflow-cli-design-principles.en.md` and `docs/superflow-cli-evaluation-framework.en.md` completely. Managed-work changes also read `docs/managed-work-design-principles.en.md` and `docs/managed-agent-protocol.en.md`. Before delivery, complete the global principles, evaluation record, and specialized mandatory checklist.",
|
|
268
|
+
...(contract.taskPrompt
|
|
161
269
|
? [
|
|
162
|
-
|
|
163
|
-
|
|
270
|
+
`- Read the complete frozen ${contract.taskPrompt.origin === "generated_standard" ? "standard execution contract" : "task prompt"} before starting; it is the execution entry point.`,
|
|
271
|
+
...(originalPromptDir
|
|
272
|
+
? [
|
|
273
|
+
`- Resolve relative paths in the prompt against ${originalPromptDir}.`,
|
|
274
|
+
]
|
|
275
|
+
: [
|
|
276
|
+
"- This contract freezes execution boundaries only; return blocked to Host for an unresolved business or architecture choice that changes implementation direction.",
|
|
277
|
+
]),
|
|
164
278
|
"- tasks.md is only a checklist and must not replace the frozen task prompt.",
|
|
165
279
|
]
|
|
166
280
|
: []),
|
|
167
281
|
"- You may trace the real owner across related repositories in the same platform, but record every repository involved.",
|
|
168
|
-
"- You may use an approved development database. Never drop databases
|
|
282
|
+
"- You may use an approved development database. Never drop databases, clean existing tables, or run unbounded bulk updates/deletes. You may drop only a uniquely named development test table created by this task when the frozen prompt explicitly requires that cleanup, and must preserve evidence that the table no longer exists.",
|
|
169
283
|
"- Never run Git commit/push, publish, deploy, or write to production.",
|
|
170
284
|
"- Never disable the sandbox, bypass permissions, alter tests to fit the implementation, or hide business gaps with defaults.",
|
|
171
285
|
"- Do not modify state, events, historical prompts, or reports under `.superflow/tasks`; the background service owns them.",
|
|
286
|
+
"- Runner supports filesystem snapshots in non-Git workspaces. Never run `git init` for diff, preflight, or delivery; never create, replace, or otherwise change `.git` or the repository identity frozen at start.",
|
|
287
|
+
"- Classify managed assets: the Executor cleans runtime resources and workspace-temporary files; source, SQL, tests, and reports are delivery artifacts retained for Host review; frozen requirements, designs, prompts, handoffs, and task facts are protected contracts that must not be deleted before terminal state. Immutable protected inputs are read-only; retained progress/report files may be updated but not removed.",
|
|
288
|
+
"- Never use pkill, killall, a bare kill, port/name-only cleanup, or an unverified rm -rf. Use the certified owner helper for task-owned processes, containers, and runtime directories; remove ordinary build caches only inside the repository.",
|
|
289
|
+
"- You own every application, build, test, and helper process you start. Clean them up before returning, or record the PID, purpose, and state when one must remain; never hand process cleanup to the read-only reviewer.",
|
|
172
290
|
"- For code tasks, run build, tests, and runtime verification proportionate to risk. Compilation-only or unit-test-only evidence is not completion.",
|
|
291
|
+
...verificationScopeGuidance(contract, repairFindings.length > 0, "en"),
|
|
173
292
|
"- Return blocked only when a user decision, credential, or high-risk permission is genuinely required, and list alternatives already attempted.",
|
|
293
|
+
"- Missing real databases, real tokens, or production permissions does not justify deferring locally implementable code, tests, candidate SQL, or documentation updates.",
|
|
294
|
+
"- Same-batch deployment, atomic cutover, and release-window constraints govern deployment timing, not source implementation timing. Implement and verify local code in advance instead of deferring it behind a migration checklist.",
|
|
295
|
+
"- Do not claim local work is complete or exhausted while tasks.md or the frozen prompt still contains unfinished local code work.",
|
|
296
|
+
"- Continue within one invocation until every locally executable task is complete. Do not return for review after only one module, one test, or one finding; maintain an internal checklist and verify the complete batch.",
|
|
297
|
+
"- When the task needs a real application, database, cache, browser, or other runtime, provide a repository-owned one-command acceptance entry in the first invocation. From a clean state it must perform preflight, setup, build, startup, real invocation, assertions, and cleanup. The success path and one representative setup/verification failure must clean resources owned by the task. Never hard-code personal absolute paths; use project conventions or environment overrides, and prove the entry can run again after cleanup.",
|
|
298
|
+
"- Keep verbose build, framework, database, and client logs in task-owned files. Console output must contain bounded stage summaries and a bounded failure tail only; never stream an unbounded DEBUG log through the Agent tool channel. Reference full log paths as delivery evidence, and keep those paths readable after cleanup removes nonce/runtime directories.",
|
|
299
|
+
"- The one-command entry must establish verifiable ownership for every temporary process, port, database, cache, and directory. Cleanup must never act on a port, process name, or bare PID alone; verify a task nonce/unique directory plus process-start fingerprint or equivalent identity. Reuse the certified Superflow owner helper directly through a configurable path. A wrapper that only binds task arguments is not custom cleanup; copied/rewritten identity, kill/delete behavior, or a helper bypass is custom. A normal business task verifies its own owner binding, one representative failure after major resources exist so unified cleanup runs, and final zero residue; materially distinct business deletion paths still need their own deletion-condition proof. It does not rerun the helper's non-owner, forged-state, PID-reuse, and signal-escalation certification suite. Run full framework certification only when the frozen prompt requires it, this task changes managed orchestration/the helper, or custom cleanup primitives are introduced.",
|
|
300
|
+
"- When a one-command acceptance entry claims portability, run it in a clean shell with tool-path overrides removed. Successful evidence must not inject personal absolute paths for Node, the owner helper, or project tools. Resolve the installation through a stable CLI entry, project convention, or PATH while retaining explicit environment overrides for compatibility.",
|
|
301
|
+
"- Implementation and verification inherit the API, database, concurrency, transaction, and test contracts from the frozen documents. Managed execution never rewrites the business design in design.md or tests.md. If an oral simple request lacks a business or architecture decision that changes implementation direction, return it to the Host instead of inventing a second design in the Executor prompt.",
|
|
302
|
+
"- SDD/OpenSpec work must update tasks.md and test-report.md with only genuinely completed items, exact commands, actual test counts, failures, application startup, and HTTP results. Never copy stale numbers or claim unexecuted checks passed.",
|
|
303
|
+
"- Wrap every expected-failure or fault-injection check in a parent acceptance command that verifies the child returned non-zero and then exits 0. Keep the raw child failure in logs; never put it in the ready_for_review commands array or label it as a negative assertion. Negative assertions are only for absence-inspection commands such as grep, rg, pgrep, lsof, or find.",
|
|
304
|
+
"- OpenSpec classification recognizes only `[local_required]`, `[environment_required]`, and `[release_required]`; untagged work is always local_required. Free-form Blocker or owner prose cannot downgrade local work into an external prerequisite.",
|
|
305
|
+
"- The Runner derives baseline task evidence from tasks.md, Git changes, and successful commands. Add taskEvidence only when a task needs distinct evidence; do not duplicate every task just to satisfy formatting.",
|
|
306
|
+
"- Before ready_for_review, run a final completion sweep across the frozen prompt, tasks.md, every current finding, Git diff, build, tests, application startup, real HTTP invocation, test report, and process cleanup.",
|
|
307
|
+
"- Do not move current task work to a future version, incremental scope, or release-owner backlog unless the frozen prompt or user explicitly authorizes it.",
|
|
308
|
+
"- Execute and verify every real backend, application startup, API, browser, and cross-repository path required by the frozen documents. Never close a document gate with a substitute. Inherit concrete commands, assertions, and evidence locations only from frozen tests.md or the implementation prompt; the managed prompt does not rewrite them.",
|
|
309
|
+
"- Return blocked whenever locally actionable blockers remain. Return ready_for_review after all locally completable work is done. Real-environment, deployment, or release validation explicitly forbidden by the permission contract and only executable after Git approval by DBA, test, or SRE owners must be listed item by item in releasePrerequisites, not placed in blockers. Return an empty releasePrerequisites array when none exist.",
|
|
310
|
+
...rollover,
|
|
174
311
|
repair,
|
|
175
312
|
"",
|
|
176
313
|
"Return the final result strictly according to the JSON Schema.",
|
|
177
314
|
].join("\n");
|
|
178
315
|
}
|
|
179
|
-
function
|
|
316
|
+
function verificationScopeGuidance(contract, repairing, language) {
|
|
317
|
+
const taskLevel = ["engineering", "sdd"].includes(contract.profile);
|
|
318
|
+
if (language === "en") {
|
|
319
|
+
return [
|
|
320
|
+
`- Default verification level for this task: ${taskLevel ? "task-level real acceptance" : "change-scoped verification"}. If a quick/monitor task actually changes code or depends on a real runtime, raise it to task-level real acceptance. The frozen prompt may explicitly raise, but never silently lower, this level.`,
|
|
321
|
+
"- Verification has three levels: change-scoped checks; task-level real acceptance; and framework certification. Task-level real acceptance executes the business and runtime evidence frozen by the document contract, plus task owner binding, one representative failure cleanup, and final zero residue. Generic non-owner/PID-reuse/forged-state/signal disaster tests belong to framework certification, not every business task.",
|
|
322
|
+
"- Reuse valid historical commands from the handoff. Rerun only checks invalidated by the current diff or finding. A production runtime, SQL, configuration, authorization, public contract, or acceptance-entry change invalidates its real chain; documentation, evidence formatting, or an isolated test change does not automatically invalidate unrelated startup/HTTP/database evidence.",
|
|
323
|
+
...(repairing
|
|
324
|
+
? [
|
|
325
|
+
"- In this repair round, map each finding to invalidated evidence before running commands. Do not rerun the entire acceptance suite by habit; run affected checks first and rerun the complete chain only when that chain was invalidated or an acceptance check explicitly requires it.",
|
|
326
|
+
]
|
|
327
|
+
: []),
|
|
328
|
+
];
|
|
329
|
+
}
|
|
330
|
+
return [
|
|
331
|
+
`- 本任务默认验证层级:${taskLevel ? "任务级真实验收" : "受影响验证"}。quick/monitor 若实际修改代码或依赖真实运行环境,必须提高为任务级真实验收。冻结 Prompt 可以明确提高,但不得静默降低该层级。`,
|
|
332
|
+
"- 验证分三级:受影响验证、任务级真实验收、框架认证。任务级真实验收执行文档合同冻结的业务与运行证据,并保留任务 owner 绑定、一个代表性失败清理和最终零残留;非 owner、PID 复用、伪造 state、信号升级等通用灾难测试属于框架认证,不属于每个业务任务。",
|
|
333
|
+
"- 复用交接包中的历史有效命令,只重跑被当前 diff 或 finding 失效的证据。生产运行逻辑、SQL、配置、鉴权、公开合同或验收入口变化会使对应真实链路失效;纯文档、证据格式或隔离测试修改不会自动使无关的启动/HTTP/数据库证据失效。",
|
|
334
|
+
...(repairing
|
|
335
|
+
? [
|
|
336
|
+
"- 本轮整改先把每个 finding 映射到失效证据,再执行命令。禁止习惯性重跑全套验收;先跑受影响检查,仅当真实链路已失效或 acceptanceChecks 明确要求时才重跑完整链路。",
|
|
337
|
+
]
|
|
338
|
+
: []),
|
|
339
|
+
];
|
|
340
|
+
}
|
|
341
|
+
function buildDeliveryChecklist(contract, language) {
|
|
342
|
+
if (contract.source !== "sdd" || !contract.taskPrompt)
|
|
343
|
+
return [];
|
|
344
|
+
const changeDir = findSddChangeDir(contract.taskPrompt.originalPath);
|
|
345
|
+
if (!changeDir)
|
|
346
|
+
return [];
|
|
347
|
+
const tasksFile = path.join(changeDir, "tasks.md");
|
|
348
|
+
const reportFile = path.join(changeDir, "test-report.md");
|
|
349
|
+
const reportStatus = existsSync(reportFile)
|
|
350
|
+
? language === "zh"
|
|
351
|
+
? `- 测试报告已存在,必须用本轮真实结果更新:${reportFile}`
|
|
352
|
+
: `- The test report exists and must be updated with real results from this run: ${reportFile}`
|
|
353
|
+
: language === "zh"
|
|
354
|
+
? `- 当前缺少必交测试报告,返回评审前必须创建并填写:${reportFile}`
|
|
355
|
+
: `- Required test report is missing; create and complete it before review: ${reportFile}`;
|
|
356
|
+
return [
|
|
357
|
+
"",
|
|
358
|
+
language === "zh"
|
|
359
|
+
? "## 本轮交付清单(返回评审前逐项完成)"
|
|
360
|
+
: "## Delivery checklist for this invocation",
|
|
361
|
+
"",
|
|
362
|
+
language === "zh"
|
|
363
|
+
? `- 逐项完成并按真实状态更新任务清单:${tasksFile}`
|
|
364
|
+
: `- Complete every applicable item and update its real state: ${tasksFile}`,
|
|
365
|
+
reportStatus,
|
|
366
|
+
language === "zh"
|
|
367
|
+
? "- 执行风险匹配的真实验证,记录命令、退出码和关键结果。"
|
|
368
|
+
: "- Run risk-appropriate real verification and record commands, exit codes, and key results.",
|
|
369
|
+
language === "zh"
|
|
370
|
+
? "- 检查实际差异和进程善后后,再一次性返回 ready_for_review。"
|
|
371
|
+
: "- Inspect the actual diff and process cleanup, then return ready_for_review once.",
|
|
372
|
+
];
|
|
373
|
+
}
|
|
374
|
+
function findSddChangeDir(promptFile) {
|
|
375
|
+
let current = path.dirname(promptFile);
|
|
376
|
+
for (let depth = 0; depth < 4; depth++) {
|
|
377
|
+
if (existsSync(path.join(current, "tasks.md")))
|
|
378
|
+
return current;
|
|
379
|
+
const parent = path.dirname(current);
|
|
380
|
+
if (parent === current)
|
|
381
|
+
break;
|
|
382
|
+
current = parent;
|
|
383
|
+
}
|
|
384
|
+
return null;
|
|
385
|
+
}
|
|
386
|
+
function buildReviewPromptEnglish(contract, state, factsPath) {
|
|
180
387
|
const taskDir = managedTaskDir(contract.projectRoot, contract.taskId);
|
|
181
388
|
const runDir = managedRunDir(contract.projectRoot, contract.taskId, state.runId);
|
|
182
389
|
const frozenPrompt = contract.taskPrompt
|
|
183
390
|
? [
|
|
184
|
-
|
|
185
|
-
|
|
391
|
+
`${contract.taskPrompt.origin === "generated_standard" ? "Frozen standard execution contract" : "Frozen task prompt"}: ${contract.taskPrompt.snapshotPath}`,
|
|
392
|
+
...(contract.taskPrompt.origin === "generated_standard"
|
|
393
|
+
? []
|
|
394
|
+
: [
|
|
395
|
+
`Original prompt directory: ${path.dirname(contract.taskPrompt.originalPath)}`,
|
|
396
|
+
]),
|
|
186
397
|
`Prompt SHA-256: ${contract.taskPrompt.sha256}`,
|
|
187
398
|
]
|
|
188
399
|
: [];
|
|
@@ -198,19 +409,43 @@ function buildReviewPromptEnglish(contract, state) {
|
|
|
198
409
|
...frozenPrompt,
|
|
199
410
|
`Executor result: ${state.lastExecutorResult}`,
|
|
200
411
|
`Task report: ${path.join(runDir, "task-report.md")}`,
|
|
412
|
+
...(factsPath ? [`Runner facts: ${factsPath}`] : []),
|
|
201
413
|
"",
|
|
202
414
|
"## Review requirements",
|
|
203
415
|
"",
|
|
204
416
|
"- Independently inspect the user goal, change scope, code diff, and command evidence.",
|
|
417
|
+
...(factsPath
|
|
418
|
+
? [
|
|
419
|
+
"- Read Runner facts first to avoid repeated mechanical discovery. They prove paths, hashes, exit codes, and counts only; they never replace semantic source review.",
|
|
420
|
+
]
|
|
421
|
+
: []),
|
|
422
|
+
"- If this task changes Superflow CLI itself, first review responsibility layering against the global design principles and unified evaluation framework. Managed-work changes also review `docs/managed-work-design-principles.en.md` and `docs/managed-agent-protocol.en.md`, explicitly identifying any change to role ownership, JSON protocols, state transitions, evidence inheritance, or call economics.",
|
|
205
423
|
...(contract.taskPrompt
|
|
206
|
-
? [
|
|
424
|
+
? [
|
|
425
|
+
`- Treat the frozen ${contract.taskPrompt.origin === "generated_standard" ? "standard execution contract" : "task prompt"}${contract.taskPrompt.origin === "generated_standard" ? " as the review boundary; it does not invent business design." : " and its referenced SDD documents as the review contract."}`,
|
|
426
|
+
"- Actually run openspec instructions apply and retain its output. Only `[local_required]`, `[environment_required]`, and `[release_required]` are machine categories; every untagged item is local_required.",
|
|
427
|
+
"- Reverse-check every newly checked item against Runner-derived evidence, optional taskEvidence, source diff, evidence paths, and verification commands. Return missing real evidence, but never reject merely because the executor did not duplicate derivable fields.",
|
|
428
|
+
]
|
|
207
429
|
: []),
|
|
208
430
|
"- Check reuse of existing capabilities and reject parallel duplicate implementations.",
|
|
209
431
|
"- Check correctness, security, data, concurrency, transactions, configuration, and real runtime risks.",
|
|
210
432
|
"- If startup, API, database, or log evidence is required, block when any required category is missing.",
|
|
433
|
+
"- Check every real backend, application-startup, API, browser, and cross-repository test required by the frozen documents; managed review never invents a separate test contract.",
|
|
434
|
+
"- Distinguish three delivery stages: local_delivery_ready means local source is ready, environment_validation_blocked means environment validation remains, and release_ready means structured release work is signed off. None of them automatically authorizes Git, deployment, or production writes.",
|
|
435
|
+
"- When the frozen prompt or permission contract forbids real database writes, deployment, or release, do not require those actions to pass source review. Review candidate scripts and local evidence, and record real-environment validation as a non-blocking release prerequisite.",
|
|
436
|
+
"- Do not require any delivery terminal state before review. Return pass when source gates are met; the shared CompletionPolicy atomically decides the three-stage state.",
|
|
211
437
|
"- Do not block on formatting or personal preference; preserve review rounds for material risks.",
|
|
438
|
+
"- The Runner automatically merges valid command evidence across invocations. If the current artifact was mechanically rejected only for structured metadata, a negative-assertion exit code, or omitted duplication of valid historical evidence, and the raw history independently proves delivery, return pass and let the Runner promote it with an audit trail. Do not ask the Executor to rerun the environment or rewrite JSON.",
|
|
439
|
+
"- Review with the three verification levels: first map the current diff/findings to invalidated historical evidence. Normal business work uses task-level real acceptance; raise to framework certification only for an explicit frozen prompt, an owner-helper/managed-orchestration change, or a new custom cleanup primitive. Documentation or evidence-format changes do not rerun unrelated real chains.",
|
|
440
|
+
"- For tasks requiring a real runtime, fully review the repository-owned one-command acceptance entry in the first Host round. Confirm it repeats from a clean state, requires no manual setup outside the command, contains no personal hard-coded paths, and cleans task-owned resources on success and one representative setup/verification failure. Report every entry defect together and confirm cited logs survive runtime cleanup. Require per-task SIGINT/SIGTERM framework certification only when the frozen prompt says so, the task changes the Superflow owner helper/managed orchestration, or it introduces custom cleanup primitives; it must not rerun for every business task.",
|
|
441
|
+
"- In the first Host round, review resource identity rather than merely observing free ports. Every cleanup action needs task-unique identity and a process-instance fingerprint; cleanup by port, process name, or bare PID is forbidden. When the certified owner helper is reused unchanged, verify its source/integrity, task-specific owner arguments, representative failure cleanup, and final zero residue. Require non-owner, forged-state, PID-reuse, and every interruption negative only for modified/copied helpers, custom cleanup, or an explicit frozen contract.",
|
|
442
|
+
"- For validation failures, verify that the test sends the actual malformed or forbidden input and reaches the intended parser or validation branch; a matching status code alone is insufficient. For task-owned resource cleanup, compare every frozen identity field on both producer and consumer records (for example nonce, PID, port, and signature), and require mismatch-refusal evidence.",
|
|
443
|
+
"- Complete a full review sweep and return every material finding in this round across affected modules, entry points, SQL, tests, and runtime evidence. Never stop after discovering the first severe issue.",
|
|
444
|
+
"- When one defect class appears in multiple locations, enumerate the complete scope in one finding or multiple findings in the same round instead of revealing occurrences across later rounds.",
|
|
212
445
|
"- Every blocking finding must include factual evidence, risk, a precise required fix, and executable acceptance checks.",
|
|
446
|
+
"- Reuse the same finding ID while an issue remains unresolved across rounds; do not renumber an unchanged blocker to make review progress appear healthier.",
|
|
213
447
|
"- Return pass when there are no blocking findings; return blocked only for decisions outside execution scope that require the user.",
|
|
448
|
+
"- Read-only inspect application processes, ports, logs, and test evidence. Do not start, stop, or clean up application processes for the executor; report missing cleanup as a finding and return it to the executor.",
|
|
214
449
|
"",
|
|
215
450
|
"Return the final result strictly according to the JSON Schema.",
|
|
216
451
|
].join("\n");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../src/domains/managed-work/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAMxB,OAAO,EAA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,yHAAyH;QACzH,6JAA6J;QAC7J,qIAAqI;QACrI,uNAAuN;QACvN,EAAE;QACF,gEAAgE;KACjE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Redaction at every persisted managed-work boundary.
|
|
3
|
+
*
|
|
4
|
+
* Runner telemetry is untrusted: it can contain a complete shell command even
|
|
5
|
+
* when the structured delivery has already been redacted. Keep this module
|
|
6
|
+
* independent of Runner and Journal so both can call the same implementation
|
|
7
|
+
* before writing any user-readable artifact.
|
|
8
|
+
*/
|
|
9
|
+
export function redactManagedLog(value) {
|
|
10
|
+
const structured = value
|
|
11
|
+
.split(/\r?\n/)
|
|
12
|
+
.map((line) => redactManagedJsonLine(line))
|
|
13
|
+
.join("\n");
|
|
14
|
+
return redactManagedPlainText(structured);
|
|
15
|
+
}
|
|
16
|
+
export function redactManagedValue(value) {
|
|
17
|
+
return redactManagedStructuredValue(value);
|
|
18
|
+
}
|
|
19
|
+
function redactManagedPlainText(value) {
|
|
20
|
+
return value
|
|
21
|
+
.replace(/("type"\s*:\s*"input_json_delta"[^\r\n]*?"partial_json"\s*:\s*")(?:(?:\\.)|[^"\\])*/g, "$1<redacted-tool-input>")
|
|
22
|
+
.replace(/(authorization\s*[:=]\s*bearer\s+)[^\s"']+/gi, "$1<redacted>")
|
|
23
|
+
.replace(/(["']?(?:[a-z0-9]+_)*(?:token|password|secret|cookie|api[_-]?key)["']?\s*[:=]\s*["']?)[^\s"',}]+/gi, "$1<redacted>")
|
|
24
|
+
.replace(/(["']?(?:access|secret)[_-]?key["']?\s*[:=]\s*["']?)[^\s"',}]+/gi, "$1<redacted>")
|
|
25
|
+
.replace(/(\bmysql\b[^\r\n]*?\s(?:-p|--password(?:=|\s+)))\s*(?:'[^']*'|"[^"]*"|[^\s"']+)/g, "$1<redacted>")
|
|
26
|
+
.replace(/(\s-p)\s*(?:'[^']*'|"[^"]*"|[^\s"']+)/g, "$1<redacted>")
|
|
27
|
+
.replace(/(https?:\/\/[^:\s/@]+:)[^@\s/]+@/gi, "$1<redacted>@");
|
|
28
|
+
}
|
|
29
|
+
function redactManagedJsonLine(line) {
|
|
30
|
+
if (!line.trim())
|
|
31
|
+
return line;
|
|
32
|
+
try {
|
|
33
|
+
return JSON.stringify(redactManagedJsonValue(JSON.parse(line)));
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
if (/\\?"type\\?"\s*:\s*\\?"(?:tool_use|tool_result)\\?"/.test(line) ||
|
|
37
|
+
/\\?"tool_use_result\\?"\s*:/.test(line)) {
|
|
38
|
+
return "<redacted-tool-event>";
|
|
39
|
+
}
|
|
40
|
+
return line;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function redactManagedJsonValue(value) {
|
|
44
|
+
if (Array.isArray(value)) {
|
|
45
|
+
return value.map((item) => redactManagedJsonValue(item));
|
|
46
|
+
}
|
|
47
|
+
if (value === null || typeof value !== "object")
|
|
48
|
+
return value;
|
|
49
|
+
const source = value;
|
|
50
|
+
const type = typeof source.type === "string" ? source.type : "";
|
|
51
|
+
const result = {};
|
|
52
|
+
for (const [key, child] of Object.entries(source)) {
|
|
53
|
+
if (key === "tool_use_result") {
|
|
54
|
+
result[key] = "<redacted-tool-result>";
|
|
55
|
+
}
|
|
56
|
+
else if (type === "tool_use" && key === "input") {
|
|
57
|
+
result[key] = "<redacted-tool-input>";
|
|
58
|
+
}
|
|
59
|
+
else if (type === "tool_result" && key === "content") {
|
|
60
|
+
result[key] = "<redacted-tool-result>";
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
result[key] = redactManagedJsonValue(child);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return result;
|
|
67
|
+
}
|
|
68
|
+
function redactManagedStructuredValue(value) {
|
|
69
|
+
if (Array.isArray(value)) {
|
|
70
|
+
return value.map((item) => redactManagedStructuredValue(item));
|
|
71
|
+
}
|
|
72
|
+
if (value === null || typeof value !== "object") {
|
|
73
|
+
return typeof value === "string" ? redactManagedLog(value) : value;
|
|
74
|
+
}
|
|
75
|
+
const source = value;
|
|
76
|
+
const result = {};
|
|
77
|
+
for (const [key, child] of Object.entries(source)) {
|
|
78
|
+
if (isSensitiveManagedKey(key)) {
|
|
79
|
+
result[key] = "<redacted>";
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
result[key] = redactManagedStructuredValue(child);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return result;
|
|
86
|
+
}
|
|
87
|
+
function isSensitiveManagedKey(key) {
|
|
88
|
+
return /^(?:authorization|cookie|password|secret|token|api[_-]?key|access[_-]?key)$/i.test(key);
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=redaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redaction.js","sourceRoot":"","sources":["../../../src/domains/managed-work/redaction.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,MAAM,UAAU,GAAG,KAAK;SACrB,KAAK,CAAC,OAAO,CAAC;SACd,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;SAC1C,IAAI,CAAC,IAAI,CAAC,CAAC;IACd,OAAO,sBAAsB,CAAC,UAAU,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAI,KAAQ;IAC5C,OAAO,4BAA4B,CAAC,KAAK,CAAM,CAAC;AAClD,CAAC;AAED,SAAS,sBAAsB,CAAC,KAAa;IAC3C,OAAO,KAAK;SACT,OAAO,CACN,sFAAsF,EACtF,yBAAyB,CAC1B;SACA,OAAO,CAAC,8CAA8C,EAAE,cAAc,CAAC;SACvE,OAAO,CACN,oGAAoG,EACpG,cAAc,CACf;SACA,OAAO,CACN,kEAAkE,EAClE,cAAc,CACf;SACA,OAAO,CACN,kF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