@adamancyzhang/claude-orchestrator 0.3.0 → 0.3.2
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 +203 -201
- package/dist/cli/commands.d.ts +6 -17
- package/dist/cli/commands.js +133 -172
- package/dist/cli/commands.js.map +1 -1
- package/dist/config.d.ts +28 -14
- package/dist/config.js +51 -20
- package/dist/config.js.map +1 -1
- package/dist/executor/runner.d.ts +19 -0
- package/dist/executor/runner.js +59 -0
- package/dist/executor/runner.js.map +1 -0
- package/dist/executor/template.d.ts +12 -0
- package/dist/executor/template.js +42 -0
- package/dist/executor/template.js.map +1 -0
- package/dist/hooks/engine.d.ts +22 -0
- package/dist/hooks/engine.js +50 -0
- package/dist/hooks/engine.js.map +1 -0
- package/dist/index.js +115 -250
- package/dist/index.js.map +1 -1
- package/dist/leader/chain-router.d.ts +22 -0
- package/dist/leader/chain-router.js +163 -0
- package/dist/leader/chain-router.js.map +1 -0
- package/dist/leader/event-bus.d.ts +1 -1
- package/dist/leader/event-bus.js +1 -1
- package/dist/leader/event-bus.js.map +1 -1
- package/dist/leader/index.d.ts +1 -2
- package/dist/leader/index.js +35 -13
- package/dist/leader/index.js.map +1 -1
- package/dist/leader/recovery.d.ts +2 -0
- package/dist/leader/recovery.js +37 -22
- package/dist/leader/recovery.js.map +1 -1
- package/dist/leader/state.d.ts +2 -1
- package/dist/leader/state.js +48 -2
- package/dist/leader/state.js.map +1 -1
- package/dist/leader/tui.d.ts +8 -0
- package/dist/leader/tui.js +74 -9
- package/dist/leader/tui.js.map +1 -1
- package/dist/leader/watcher.d.ts +4 -3
- package/dist/leader/watcher.js +8 -13
- package/dist/leader/watcher.js.map +1 -1
- package/dist/models/schemas.d.ts +307 -87
- package/dist/models/schemas.js +51 -43
- package/dist/models/schemas.js.map +1 -1
- package/dist/modules/message-router.d.ts +1 -3
- package/dist/modules/message-router.js +3 -26
- package/dist/modules/message-router.js.map +1 -1
- package/dist/modules/registry.js +3 -3
- package/dist/modules/registry.js.map +1 -1
- package/dist/modules/task-queue.d.ts +1 -1
- package/dist/modules/task-queue.js +28 -2
- package/dist/modules/task-queue.js.map +1 -1
- package/dist/skills/CLAUDE.md +155 -0
- package/dist/skills/claude-code-developer/SKILL.md +325 -0
- package/dist/skills/claude-orchestrator/SKILL.md +244 -0
- package/dist/skills/task-acceptance/SKILL.md +201 -0
- package/dist/skills/task-execution/SKILL.md +142 -0
- package/dist/skills/task-planning/SKILL.md +188 -0
- package/dist/skills/task-review/SKILL.md +220 -0
- package/dist/skills/task-traceability/SKILL.md +154 -0
- package/dist/skills/task-verification/SKILL.md +194 -0
- package/dist/templates/worker-accept.md +46 -0
- package/dist/templates/worker-build.md +45 -0
- package/dist/templates/worker-decompose.md +67 -0
- package/dist/templates/worker-evaluate.md +41 -0
- package/dist/templates/worker-plan.md +43 -0
- package/dist/templates/worker-review.md +46 -0
- package/dist/templates/worker-verify.md +47 -0
- package/dist/utils/exec.d.ts +5 -0
- package/dist/utils/exec.js +27 -0
- package/dist/utils/exec.js.map +1 -1
- package/dist/utils/logger.d.ts +10 -0
- package/dist/utils/logger.js +22 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/worker/evaluator.d.ts +13 -0
- package/dist/worker/evaluator.js +112 -0
- package/dist/worker/evaluator.js.map +1 -0
- package/dist/worker/watcher.d.ts +13 -4
- package/dist/worker/watcher.js +108 -24
- package/dist/worker/watcher.js.map +1 -1
- package/dist/zk/client.d.ts +0 -5
- package/dist/zk/client.js +0 -27
- package/dist/zk/client.js.map +1 -1
- package/dist/zk/paths.d.ts +8 -10
- package/dist/zk/paths.js +1 -6
- package/dist/zk/paths.js.map +1 -1
- package/dist/zk/watcher.d.ts +0 -2
- package/dist/zk/watcher.js +0 -3
- package/dist/zk/watcher.js.map +1 -1
- package/package.json +2 -2
- package/dist/modules/context-store.d.ts +0 -10
- package/dist/modules/context-store.js +0 -25
- package/dist/modules/context-store.js.map +0 -1
- package/dist/templates/leader.md +0 -10
- package/dist/templates/worker.md +0 -8
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
You are {{name}}, a task decomposition specialist. Your role is {{preset_role}}. Break down the requirement below into a chain of tasks following the Plan → Build → Verify → Review → Accept responsibility chain.
|
|
2
|
+
|
|
3
|
+
## Responsibility Chain
|
|
4
|
+
|
|
5
|
+
1. **Plan** — Define the blueprint. What needs to be done, why, and how.
|
|
6
|
+
2. **Build** — Execute according to the blueprint to produce verifiable results.
|
|
7
|
+
3. **Verify** — Check the Builder's output against the Planner's blueprint.
|
|
8
|
+
4. **Review** — Quality gate. Judge whether the combined output aligns with the Planner's intent and is well-built.
|
|
9
|
+
5. **Accept** — Final acceptance. Validate the deliverable against business requirements and acceptance criteria. Make the Go/No-Go decision.
|
|
10
|
+
|
|
11
|
+
## Requirement
|
|
12
|
+
|
|
13
|
+
{{task_description}}
|
|
14
|
+
|
|
15
|
+
## Instructions
|
|
16
|
+
|
|
17
|
+
1. Analyze the requirement. Identify how many independent delivery chains are needed (usually one, but complex requirements may need multiple).
|
|
18
|
+
2. For each chain, define five link tasks. Plan is optional — omit it (set to null) when the requirement is already clear enough to start building directly. Build, Verify, Review, and Accept are mandatory.
|
|
19
|
+
3. For each task, specify clear completion criteria — what "done" means for that specific link.
|
|
20
|
+
4. Assign a priority to each task: 0 (urgent), 1 (high), 2 (normal), 3 (low).
|
|
21
|
+
|
|
22
|
+
## Output Format
|
|
23
|
+
|
|
24
|
+
Output exactly one JSON object per chain. Write the result to {{result_path}}.
|
|
25
|
+
|
|
26
|
+
```json
|
|
27
|
+
{
|
|
28
|
+
"chain_id": "chain-<seq>",
|
|
29
|
+
"chain_title": "<short summary of the requirement>",
|
|
30
|
+
"tasks": {
|
|
31
|
+
"plan": {
|
|
32
|
+
"title": "<short title>",
|
|
33
|
+
"description": "<detailed description>",
|
|
34
|
+
"criteria": "<completion criteria>",
|
|
35
|
+
"priority": 1
|
|
36
|
+
},
|
|
37
|
+
"build": {
|
|
38
|
+
"title": "<short title>",
|
|
39
|
+
"description": "<detailed description>",
|
|
40
|
+
"criteria": "<completion criteria>",
|
|
41
|
+
"priority": 1
|
|
42
|
+
},
|
|
43
|
+
"verify": {
|
|
44
|
+
"title": "<short title>",
|
|
45
|
+
"description": "<what and how to verify>",
|
|
46
|
+
"criteria": "<completion criteria>",
|
|
47
|
+
"priority": 1
|
|
48
|
+
},
|
|
49
|
+
"review": {
|
|
50
|
+
"title": "<short title>",
|
|
51
|
+
"description": "<what to review, key concerns>",
|
|
52
|
+
"criteria": "<completion criteria>",
|
|
53
|
+
"priority": 1
|
|
54
|
+
},
|
|
55
|
+
"accept": {
|
|
56
|
+
"title": "<short title>",
|
|
57
|
+
"description": "<what to validate for final acceptance>",
|
|
58
|
+
"criteria": "<completion criteria>",
|
|
59
|
+
"priority": 1
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
If plan is not needed, set it to null. Output ONLY the JSON. No explanation.
|
|
66
|
+
|
|
67
|
+
After completing the decomposition, include the full JSON as your completion report so the Leader can mechanically create the tasks.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
You are {{name}}, a self-evaluation specialist. Your role is {{preset_role}}. You just completed a task in the Plan → Build → Verify → Review → Accept responsibility chain. Evaluate your own output and decide the next action.
|
|
2
|
+
|
|
3
|
+
## Your Task
|
|
4
|
+
|
|
5
|
+
- **Link**: {{link}}
|
|
6
|
+
- **Title**: {{task_title}}
|
|
7
|
+
- **Description**: {{task_description}}
|
|
8
|
+
- **Completion Criteria**: {{task_criteria}}
|
|
9
|
+
|
|
10
|
+
## Your Result
|
|
11
|
+
|
|
12
|
+
The result of your work is at {{task_result_path}}. Review it objectively.
|
|
13
|
+
|
|
14
|
+
## Decision Rules
|
|
15
|
+
|
|
16
|
+
1. **Evaluate your output against the completion criteria.**
|
|
17
|
+
- Criteria fully met → `activate_next` (proceed to next link in the chain)
|
|
18
|
+
- Criteria partially met → `feedback` (describe what's missing so you or another worker can fix it)
|
|
19
|
+
- Criteria not met at all → `feedback` with clear explanation of what went wrong
|
|
20
|
+
|
|
21
|
+
2. **Check chain position.**
|
|
22
|
+
- If this was the Accept link and it passes → `close_chain`
|
|
23
|
+
- Otherwise → activate the next link
|
|
24
|
+
|
|
25
|
+
## Output Format
|
|
26
|
+
|
|
27
|
+
Output exactly one JSON decision. Write the result to {{result_path}}.
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"decision": "activate_next" | "feedback" | "close_chain",
|
|
32
|
+
"reason": "<one-line explanation of the evaluation>",
|
|
33
|
+
"feedback": "<only if feedback: specific guidance on what to improve>",
|
|
34
|
+
"nextLink": "<the next link to activate, e.g. build|verify|review|accept>",
|
|
35
|
+
"suggestedWorker": null
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Output ONLY the JSON. No explanation.
|
|
40
|
+
|
|
41
|
+
After evaluating, include the full JSON decision as your completion report so the Leader can mechanically execute the decision.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
You are a Planner in a multi-agent task coordination system. Your link in the responsibility chain is **Plan** — you define the blueprint that Build, Verify, Review, and Accept will follow.
|
|
2
|
+
|
|
3
|
+
## Your Identity
|
|
4
|
+
- Name: {{name}}
|
|
5
|
+
- Preset Role: {{preset_role}}
|
|
6
|
+
- Current Link: Plan
|
|
7
|
+
- Work Directory: {{work_dir}}
|
|
8
|
+
- Time: {{time}}
|
|
9
|
+
|
|
10
|
+
## Your Task
|
|
11
|
+
|
|
12
|
+
**Title**: {{task_title}}
|
|
13
|
+
**Description**: {{task_description}}
|
|
14
|
+
**Completion Criteria**: {{task_criteria}}
|
|
15
|
+
|
|
16
|
+
The full task specification is at: {{task_doc_path}}
|
|
17
|
+
Read it carefully before starting.
|
|
18
|
+
|
|
19
|
+
## Execution Standard: task-acceptance
|
|
20
|
+
|
|
21
|
+
Your deliverable must pass acceptance before the chain can proceed to Build.
|
|
22
|
+
|
|
23
|
+
### Step 1: Analyze
|
|
24
|
+
Analyze the requirement thoroughly: What is the goal, scope, constraints? What does "success" look like?
|
|
25
|
+
|
|
26
|
+
### Step 2: Design
|
|
27
|
+
Produce a clear, actionable blueprint including architecture, interfaces, data flow, and concrete Build steps with completion criteria. The Builder must be able to implement from it without asking "what next?"
|
|
28
|
+
|
|
29
|
+
### Step 3: Self-Check
|
|
30
|
+
Validate: Does each Build step have clear inputs/outputs? Can a Builder start from this alone? Are edge cases covered? Are criteria objectively checkable?
|
|
31
|
+
|
|
32
|
+
### Step 4: Submit for Acceptance
|
|
33
|
+
Write your blueprint to {{result_path}}. Prepare a completion report:
|
|
34
|
+
|
|
35
|
+
Link: plan
|
|
36
|
+
Status: completed
|
|
37
|
+
Blueprint Summary: <one paragraph>
|
|
38
|
+
Build Steps:
|
|
39
|
+
1. <step title> — <description>
|
|
40
|
+
2. ...
|
|
41
|
+
Self-Check: all passed | <items needing attention>
|
|
42
|
+
Open Questions: <none | list>
|
|
43
|
+
Result Path: {{result_path}}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
You are a Reviewer in a multi-agent task coordination system. Your link in the responsibility chain is **Review** — the quality gate. You judge whether the combined output (Plan + Build + Verify) aligns with the Planner's original intent and is ready for sign-off.
|
|
2
|
+
|
|
3
|
+
## Your Identity
|
|
4
|
+
- Name: {{name}}
|
|
5
|
+
- Preset Role: {{preset_role}}
|
|
6
|
+
- Current Link: Review
|
|
7
|
+
- Work Directory: {{work_dir}}
|
|
8
|
+
- Time: {{time}}
|
|
9
|
+
|
|
10
|
+
## Your Task
|
|
11
|
+
|
|
12
|
+
**Title**: {{task_title}}
|
|
13
|
+
**Description**: {{task_description}}
|
|
14
|
+
**Completion Criteria**: {{task_criteria}}
|
|
15
|
+
|
|
16
|
+
The full task specification is at: {{task_doc_path}}
|
|
17
|
+
This includes the entire chain: Plan blueprint, Build output, and Verify report.
|
|
18
|
+
|
|
19
|
+
## Execution Standard: task-traceability
|
|
20
|
+
|
|
21
|
+
Your review must trace through the entire chain: Plan intent → Build implementation → Verify findings → your judgment.
|
|
22
|
+
|
|
23
|
+
### Step 1: Trace
|
|
24
|
+
Read all upstream artifacts. Build a chain-level review checklist: does the final output fulfill the original intent? Are all verification findings addressed? Are gaps or deviations justified?
|
|
25
|
+
|
|
26
|
+
### Step 2: Execute
|
|
27
|
+
For each checklist item, make a judgment: ACCEPT, CONCERN (specify which link should address it), or REJECT (fundamentally fails to meet intent).
|
|
28
|
+
|
|
29
|
+
### Step 3: Map
|
|
30
|
+
Build a review judgment map: Plan Intent → Build Result → Verify Finding → Review Judgment.
|
|
31
|
+
|
|
32
|
+
### Step 4: Evidence
|
|
33
|
+
For CONCERN and REJECT judgments, provide: reference to Plan requirement, reference to Builder/Verifier findings, clear rationale.
|
|
34
|
+
|
|
35
|
+
Write your review map and evidence to {{result_path}}.
|
|
36
|
+
|
|
37
|
+
## Completion Report
|
|
38
|
+
|
|
39
|
+
Link: review
|
|
40
|
+
Status: completed
|
|
41
|
+
Decision: PASS | FEEDBACK | REJECT
|
|
42
|
+
Accepted: <count> | Concerns: <count> | Rejected: <count>
|
|
43
|
+
Concern Details: <list each with recommended action and target link>
|
|
44
|
+
Rejection Details: <list each with rationale>
|
|
45
|
+
Result Path: {{result_path}}
|
|
46
|
+
Next Link Ready: yes (Accept is the final link)
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
You are a Verifier in a multi-agent task coordination system. Your link in the responsibility chain is **Verify** — you check the Builder's output against the Planner's blueprint and report findings.
|
|
2
|
+
|
|
3
|
+
## Your Identity
|
|
4
|
+
- Name: {{name}}
|
|
5
|
+
- Preset Role: {{preset_role}}
|
|
6
|
+
- Current Link: Verify
|
|
7
|
+
- Work Directory: {{work_dir}}
|
|
8
|
+
- Time: {{time}}
|
|
9
|
+
|
|
10
|
+
## Your Task
|
|
11
|
+
|
|
12
|
+
**Title**: {{task_title}}
|
|
13
|
+
**Description**: {{task_description}}
|
|
14
|
+
**Completion Criteria**: {{task_criteria}}
|
|
15
|
+
|
|
16
|
+
The full task specification is at: {{task_doc_path}}
|
|
17
|
+
This includes the Planner's blueprint, the Builder's output, and upstream context.
|
|
18
|
+
|
|
19
|
+
## Execution Standard: task-traceability
|
|
20
|
+
|
|
21
|
+
Every verification point must be traced to a Plan requirement and a Builder output.
|
|
22
|
+
|
|
23
|
+
### Step 1: Trace
|
|
24
|
+
Cross-reference each Plan requirement with each Builder output. Build a verification checklist: what to check and against what criteria.
|
|
25
|
+
|
|
26
|
+
### Step 2: Execute
|
|
27
|
+
For each checklist item: does the Builder output satisfy the requirement? Does it work correctly? Are there gaps (Plan requirements with no Builder output) or extras (Builder output not traceable to any Plan requirement)?
|
|
28
|
+
|
|
29
|
+
### Step 3: Map
|
|
30
|
+
Build a verification map: Plan Requirement → Builder Output → Verified → Status (pass/gap/failure).
|
|
31
|
+
|
|
32
|
+
### Step 4: Evidence
|
|
33
|
+
Provide evidence for each finding: what was checked and how, test results or inspection notes, specific references to Plan and Builder output.
|
|
34
|
+
|
|
35
|
+
Write your verification map and evidence to {{result_path}}.
|
|
36
|
+
|
|
37
|
+
## Completion Report
|
|
38
|
+
|
|
39
|
+
Link: verify
|
|
40
|
+
Status: completed
|
|
41
|
+
Verified: <count> items checked
|
|
42
|
+
Passed: <count> | Gaps: <count> | Failures: <count>
|
|
43
|
+
Gap Details: <list each with Plan reference>
|
|
44
|
+
Failure Details: <list each with evidence>
|
|
45
|
+
Recommendation: pass | needs fixes (<specific fixes>)
|
|
46
|
+
Result Path: {{result_path}}
|
|
47
|
+
Next Link Ready: <yes | no>
|
package/dist/utils/exec.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
export declare function execWithTee(command: string, message: string, logPath: string, cwd?: string): Promise<{
|
|
2
2
|
code: number;
|
|
3
3
|
}>;
|
|
4
|
+
export declare function execAndCapture(command: string, message: string, logPath: string, cwd?: string): Promise<{
|
|
5
|
+
code: number;
|
|
6
|
+
stdout: string;
|
|
7
|
+
stderr: string;
|
|
8
|
+
}>;
|
package/dist/utils/exec.js
CHANGED
|
@@ -5,6 +5,8 @@ export async function execWithTee(command, message, logPath, cwd) {
|
|
|
5
5
|
await fs.promises.mkdir(path.dirname(logPath), { recursive: true });
|
|
6
6
|
const escapedMsg = message.replace(/'/g, "'\\''");
|
|
7
7
|
const shellCmd = `exec ${command} -p '${escapedMsg}' | tee -a '${logPath}'`;
|
|
8
|
+
const msgPreview = message.length > 100 ? message.slice(0, 100) + "..." : message;
|
|
9
|
+
console.log(`\n[Exec] ${command} -p '${msgPreview}' | tee -a '${logPath}'`);
|
|
8
10
|
return new Promise((resolve) => {
|
|
9
11
|
const child = spawn("sh", ["-c", shellCmd], {
|
|
10
12
|
cwd,
|
|
@@ -17,4 +19,29 @@ export async function execWithTee(command, message, logPath, cwd) {
|
|
|
17
19
|
child.on("error", () => resolve({ code: -1 }));
|
|
18
20
|
});
|
|
19
21
|
}
|
|
22
|
+
export async function execAndCapture(command, message, logPath, cwd) {
|
|
23
|
+
await fs.promises.mkdir(path.dirname(logPath), { recursive: true });
|
|
24
|
+
const escapedMsg = message.replace(/'/g, "'\\''");
|
|
25
|
+
const shellCmd = `exec ${command} -p '${escapedMsg}' | tee -a '${logPath}'`;
|
|
26
|
+
return new Promise((resolve) => {
|
|
27
|
+
const child = spawn("sh", ["-c", shellCmd], {
|
|
28
|
+
cwd,
|
|
29
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
30
|
+
env: { ...process.env },
|
|
31
|
+
});
|
|
32
|
+
let stdout = "", stderr = "";
|
|
33
|
+
child.stdout?.on("data", (d) => {
|
|
34
|
+
const s = d.toString();
|
|
35
|
+
stdout += s;
|
|
36
|
+
process.stdout.write(s);
|
|
37
|
+
});
|
|
38
|
+
child.stderr?.on("data", (d) => {
|
|
39
|
+
const s = d.toString();
|
|
40
|
+
stderr += s;
|
|
41
|
+
process.stderr.write(s);
|
|
42
|
+
});
|
|
43
|
+
child.on("exit", (code) => resolve({ code: code ?? -1, stdout, stderr }));
|
|
44
|
+
child.on("error", (err) => resolve({ code: -1, stdout, stderr: err.message }));
|
|
45
|
+
});
|
|
46
|
+
}
|
|
20
47
|
//# sourceMappingURL=exec.js.map
|
package/dist/utils/exec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exec.js","sourceRoot":"","sources":["../../src/utils/exec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,OAAe,EACf,OAAe,EACf,OAAe,EACf,GAAY;IAEZ,MAAM,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAEpE,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAClD,MAAM,QAAQ,GAAG,QAAQ,OAAO,QAAQ,UAAU,eAAe,OAAO,GAAG,CAAC;IAE5E,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE;YAC1C,GAAG;YACH,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC;YACjC,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE;SACxB,CAAC,CAAC;QAEH,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACjE,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,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C,CAAC;IACjF,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class Logger {
|
|
2
|
+
private tag;
|
|
3
|
+
private static debugEnabled;
|
|
4
|
+
static enableDebug(): void;
|
|
5
|
+
static isDebug(): boolean;
|
|
6
|
+
constructor(tag: string);
|
|
7
|
+
info(msg: string): void;
|
|
8
|
+
error(msg: string, err?: unknown): void;
|
|
9
|
+
debug(msg: string): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export class Logger {
|
|
2
|
+
tag;
|
|
3
|
+
static debugEnabled = false;
|
|
4
|
+
static enableDebug() { Logger.debugEnabled = true; }
|
|
5
|
+
static isDebug() { return Logger.debugEnabled; }
|
|
6
|
+
constructor(tag) {
|
|
7
|
+
this.tag = tag;
|
|
8
|
+
}
|
|
9
|
+
info(msg) {
|
|
10
|
+
console.log(`[${this.tag}] ${msg}`);
|
|
11
|
+
}
|
|
12
|
+
error(msg, err) {
|
|
13
|
+
const extra = err instanceof Error ? `: ${err.message}` : err !== undefined ? `: ${err}` : "";
|
|
14
|
+
console.error(`[${this.tag}] ${msg}${extra}`);
|
|
15
|
+
}
|
|
16
|
+
debug(msg) {
|
|
17
|
+
if (Logger.debugEnabled) {
|
|
18
|
+
console.log(`[${this.tag}] [DEBUG] ${msg}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,MAAM;IAMG;IALZ,MAAM,CAAC,YAAY,GAAG,KAAK,CAAC;IAEpC,MAAM,CAAC,WAAW,KAAW,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC;IAC1D,MAAM,CAAC,OAAO,KAAc,OAAO,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;IAEzD,YAAoB,GAAW;QAAX,QAAG,GAAH,GAAG,CAAQ;IAAG,CAAC;IAEnC,IAAI,CAAC,GAAW;QACd,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,GAAW,EAAE,GAAa;QAC9B,MAAM,KAAK,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9F,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,GAAG,KAAK,GAAG,GAAG,KAAK,EAAE,CAAC,CAAC;IAChD,CAAC;IAED,KAAK,CAAC,GAAW;QACf,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;YACxB,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,GAAG,aAAa,GAAG,EAAE,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TemplateEngine } from "../executor/template.js";
|
|
2
|
+
import { ClaudeRunner } from "../executor/runner.js";
|
|
3
|
+
declare const CHAIN_LINKS: string[];
|
|
4
|
+
export declare class SelfEvaluator {
|
|
5
|
+
private templateEngine;
|
|
6
|
+
private runner;
|
|
7
|
+
private instanceName;
|
|
8
|
+
private instanceRole;
|
|
9
|
+
private logger;
|
|
10
|
+
constructor(templateEngine: TemplateEngine, runner: ClaudeRunner, instanceName: string, instanceRole: string);
|
|
11
|
+
evaluate(link: string, msgVars: Record<string, string>, taskResultPath: string, uniqueKey: string): Promise<string>;
|
|
12
|
+
}
|
|
13
|
+
export { CHAIN_LINKS };
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import { Logger } from "../utils/logger.js";
|
|
3
|
+
import { EvalDecisionSchema } from "../models/schemas.js";
|
|
4
|
+
const CHAIN_LINKS = ["plan", "build", "verify", "review", "accept"];
|
|
5
|
+
const MAX_RETRIES = 3;
|
|
6
|
+
const NEXT_LINKS = {
|
|
7
|
+
plan: "build", build: "verify", verify: "review",
|
|
8
|
+
review: "accept", accept: null,
|
|
9
|
+
};
|
|
10
|
+
export class SelfEvaluator {
|
|
11
|
+
templateEngine;
|
|
12
|
+
runner;
|
|
13
|
+
instanceName;
|
|
14
|
+
instanceRole;
|
|
15
|
+
logger = new Logger("SelfEvaluator");
|
|
16
|
+
constructor(templateEngine, runner, instanceName, instanceRole) {
|
|
17
|
+
this.templateEngine = templateEngine;
|
|
18
|
+
this.runner = runner;
|
|
19
|
+
this.instanceName = instanceName;
|
|
20
|
+
this.instanceRole = instanceRole;
|
|
21
|
+
}
|
|
22
|
+
async evaluate(link, msgVars, taskResultPath, uniqueKey) {
|
|
23
|
+
let evalTemplate;
|
|
24
|
+
try {
|
|
25
|
+
evalTemplate = await this.templateEngine.loadFile("worker-evaluate.md");
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
evalTemplate = [
|
|
29
|
+
`You are {{name}}, a Worker with role {{preset_role}}.`,
|
|
30
|
+
`Evaluate your own output for the {{link}} task and decide the next step.`,
|
|
31
|
+
``,
|
|
32
|
+
`## Task`,
|
|
33
|
+
`- **Title**: {{task_title}}`,
|
|
34
|
+
`- **Description**: {{task_description}}`,
|
|
35
|
+
`- **Criteria**: {{task_criteria}}`,
|
|
36
|
+
``,
|
|
37
|
+
`## Your Result`,
|
|
38
|
+
`Read the result from {{task_result_path}}.`,
|
|
39
|
+
``,
|
|
40
|
+
`## Output Format`,
|
|
41
|
+
`Write the evaluation result to {{result_path}}. Output exactly one JSON decision:`,
|
|
42
|
+
`\`\`\`json`,
|
|
43
|
+
`{"decision": "activate_next" | "feedback" | "close_chain", "reason": "...", "nextLink": "build|verify|review|accept"}`,
|
|
44
|
+
`\`\`\``,
|
|
45
|
+
`Output ONLY the JSON.`,
|
|
46
|
+
].join("\n");
|
|
47
|
+
}
|
|
48
|
+
const baseVars = {
|
|
49
|
+
name: this.instanceName,
|
|
50
|
+
preset_role: this.instanceRole,
|
|
51
|
+
link,
|
|
52
|
+
task_result_path: taskResultPath,
|
|
53
|
+
work_dir: "",
|
|
54
|
+
time: new Date().toISOString(),
|
|
55
|
+
...msgVars,
|
|
56
|
+
};
|
|
57
|
+
const formatHint = [
|
|
58
|
+
``,
|
|
59
|
+
`## IMPORTANT: Format Correction`,
|
|
60
|
+
`Your previous output was invalid JSON or did not match the required schema.`,
|
|
61
|
+
`You MUST output ONLY valid JSON with exactly these fields:`,
|
|
62
|
+
`\`\`\`json`,
|
|
63
|
+
`{"decision": "activate_next"|"feedback"|"close_chain", "reason": "<string>", "nextLink": "<string>", "feedback": "<string>"}`,
|
|
64
|
+
`\`\`\``,
|
|
65
|
+
`No markdown fences, no extra text, no trailing commas. Pure JSON only.`,
|
|
66
|
+
].join("\n");
|
|
67
|
+
for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
|
|
68
|
+
const attemptKey = `${uniqueKey}-${attempt}`;
|
|
69
|
+
const evalResultPath = this.runner.evalResultPath(attemptKey);
|
|
70
|
+
const evalLogPath = this.runner.evalLogPath(attemptKey);
|
|
71
|
+
let prompt = this.templateEngine.render(evalTemplate, {
|
|
72
|
+
...baseVars,
|
|
73
|
+
result_path: evalResultPath,
|
|
74
|
+
});
|
|
75
|
+
if (attempt > 0) {
|
|
76
|
+
prompt += formatHint;
|
|
77
|
+
}
|
|
78
|
+
this.logger.info(`Self-evaluation attempt ${attempt + 1}/${MAX_RETRIES}...`);
|
|
79
|
+
await this.runner.run(prompt, evalLogPath);
|
|
80
|
+
try {
|
|
81
|
+
const content = await fs.promises.readFile(evalResultPath, "utf-8");
|
|
82
|
+
if (!content.trim())
|
|
83
|
+
continue;
|
|
84
|
+
const cleaned = content.trim()
|
|
85
|
+
.replace(/```json\s*/g, "")
|
|
86
|
+
.replace(/```\s*/g, "")
|
|
87
|
+
.trim();
|
|
88
|
+
const parsed = JSON.parse(cleaned);
|
|
89
|
+
const validated = EvalDecisionSchema.parse(parsed);
|
|
90
|
+
return JSON.stringify(validated);
|
|
91
|
+
}
|
|
92
|
+
catch (err) {
|
|
93
|
+
this.logger.error(`Attempt ${attempt + 1} invalid`, err);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
this.logger.error(`All ${MAX_RETRIES} evaluation attempts failed, using fallback`);
|
|
97
|
+
const nextLink = NEXT_LINKS[link];
|
|
98
|
+
if (nextLink) {
|
|
99
|
+
return JSON.stringify({
|
|
100
|
+
decision: "activate_next",
|
|
101
|
+
reason: `Auto-advance from ${link} (after ${MAX_RETRIES} eval failures)`,
|
|
102
|
+
nextLink,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
return JSON.stringify({
|
|
106
|
+
decision: "close_chain",
|
|
107
|
+
reason: `Accept link completed (after ${MAX_RETRIES} eval failures)`,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
export { CHAIN_LINKS };
|
|
112
|
+
//# sourceMappingURL=evaluator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluator.js","sourceRoot":"","sources":["../../src/worker/evaluator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAG9B,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AACpE,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB,MAAM,UAAU,GAAkC;IAChD,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM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AAC;gBACnC,MAAM,SAAS,GAAG,kBAAkB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;gBACnD,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;YACnC,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,OAAO,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;YAC3D,CAAC;QACH,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,WAAW,6CAA6C,CAAC,CAAC;QAEnF,MAAM,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,IAAI,CAAC,SAAS,CAAC;gBACpB,QAAQ,EAAE,eAAe;gBACzB,MAAM,EAAE,qBAAqB,IAAI,WAAW,WAAW,iBAAiB;gBACxE,QAAQ;aACT,CAAC,CAAC;QACL,CAAC;QACD,OAAO,IAAI,CAAC,SAAS,CAAC;YACpB,QAAQ,EAAE,aAAa;YACvB,MAAM,EAAE,gCAAgC,WAAW,iBAAiB;SACrE,CAAC,CAAC;IACL,CAAC;CACF;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
package/dist/worker/watcher.d.ts
CHANGED
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
import { ZkClient } from "../zk/client.js";
|
|
2
|
+
import { HookEngine } from "../hooks/engine.js";
|
|
3
|
+
import { TemplateEngine } from "../executor/template.js";
|
|
4
|
+
import { ClaudeRunner } from "../executor/runner.js";
|
|
5
|
+
import { SelfEvaluator } from "./evaluator.js";
|
|
2
6
|
export declare class WorkerWatcher {
|
|
3
7
|
private zk;
|
|
4
8
|
private instanceId;
|
|
5
|
-
private workDir;
|
|
6
|
-
private command;
|
|
7
|
-
private cacheDir;
|
|
8
9
|
private leaderInstanceId;
|
|
10
|
+
private hooks;
|
|
11
|
+
private templateEngine;
|
|
12
|
+
private runner;
|
|
13
|
+
private evaluator;
|
|
9
14
|
private inFlight;
|
|
15
|
+
private instanceName;
|
|
16
|
+
private instanceRole;
|
|
17
|
+
private logger;
|
|
10
18
|
stopped: boolean;
|
|
11
|
-
constructor(zk: ZkClient, instanceId: string,
|
|
19
|
+
constructor(zk: ZkClient, instanceId: string, leaderInstanceId: string, hooks: HookEngine, templateEngine: TemplateEngine, runner: ClaudeRunner, evaluator: SelfEvaluator);
|
|
12
20
|
start(): Promise<void>;
|
|
13
21
|
private watchLoop;
|
|
14
22
|
private processMessage;
|
|
23
|
+
private sendCompletionReport;
|
|
15
24
|
stop(): void;
|
|
16
25
|
}
|