@adamancyzhang/claude-orchestrator 0.3.2 → 0.4.0
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 +198 -280
- package/dist/cli/commands.d.ts +0 -10
- package/dist/cli/commands.js +1 -184
- package/dist/cli/commands.js.map +1 -1
- package/dist/config.d.ts +22 -0
- package/dist/config.js +23 -0
- package/dist/config.js.map +1 -1
- package/dist/executor/template.js +21 -3
- package/dist/executor/template.js.map +1 -1
- package/dist/index.js +9 -34
- package/dist/index.js.map +1 -1
- package/dist/leader/chain-router.d.ts +5 -1
- package/dist/leader/chain-router.js +90 -2
- package/dist/leader/chain-router.js.map +1 -1
- 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 +7 -0
- package/dist/leader/index.js +5 -2
- package/dist/leader/index.js.map +1 -1
- package/dist/leader/merge-validator.d.ts +24 -0
- package/dist/leader/merge-validator.js +112 -0
- package/dist/leader/merge-validator.js.map +1 -0
- package/dist/leader/state.d.ts +17 -0
- package/dist/leader/state.js +48 -2
- package/dist/leader/state.js.map +1 -1
- package/dist/leader/tui.d.ts +2 -0
- package/dist/leader/tui.js +140 -16
- package/dist/leader/tui.js.map +1 -1
- package/dist/leader/watcher.js +12 -0
- package/dist/leader/watcher.js.map +1 -1
- package/dist/models/schemas.d.ts +15 -0
- package/dist/models/schemas.js +6 -1
- package/dist/models/schemas.js.map +1 -1
- package/dist/orchestrator/run.d.ts +6 -0
- package/dist/orchestrator/run.js +181 -0
- package/dist/orchestrator/run.js.map +1 -0
- package/dist/skills/CLAUDE.md +1 -1
- package/dist/skills/claude-orchestrator/SKILL.md +75 -217
- package/dist/templates/agents/worker-accept.md +48 -0
- package/dist/templates/agents/worker-build.md +38 -0
- package/dist/templates/agents/worker-decompose.md +40 -0
- package/dist/templates/agents/worker-evaluate.md +49 -0
- package/dist/templates/agents/worker-plan.md +36 -0
- package/dist/templates/agents/worker-review.md +42 -0
- package/dist/templates/agents/worker-verify.md +44 -0
- package/dist/templates/claude-memory/personal-claude-accepter.md +17 -0
- package/dist/templates/claude-memory/personal-claude-builder.md +24 -0
- package/dist/templates/claude-memory/personal-claude-planner.md +22 -0
- package/dist/templates/claude-memory/personal-claude-reviewer.md +25 -0
- package/dist/templates/claude-memory/personal-claude-verifier.md +24 -0
- package/dist/templates/claude-memory/team-claude.md +61 -0
- package/dist/utils/logger.d.ts +1 -0
- package/dist/utils/logger.js +3 -0
- package/dist/utils/logger.js.map +1 -1
- package/dist/worker/child-runner.d.ts +12 -0
- package/dist/worker/child-runner.js +99 -0
- package/dist/worker/child-runner.js.map +1 -0
- package/dist/worker/child.d.ts +2 -0
- package/dist/worker/child.js +8 -0
- package/dist/worker/child.js.map +1 -0
- package/dist/worker/commit-checker.d.ts +20 -0
- package/dist/worker/commit-checker.js +87 -0
- package/dist/worker/commit-checker.js.map +1 -0
- package/dist/worker/watcher.d.ts +5 -1
- package/dist/worker/watcher.js +41 -4
- package/dist/worker/watcher.js.map +1 -1
- package/dist/worker/worktree-initializer.d.ts +10 -0
- package/dist/worker/worktree-initializer.js +235 -0
- package/dist/worker/worktree-initializer.js.map +1 -0
- package/package.json +2 -2
- package/dist/templates/worker-accept.md +0 -46
- package/dist/templates/worker-build.md +0 -45
- package/dist/templates/worker-decompose.md +0 -67
- package/dist/templates/worker-evaluate.md +0 -41
- package/dist/templates/worker-plan.md +0 -43
- package/dist/templates/worker-review.md +0 -46
- package/dist/templates/worker-verify.md +0 -47
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
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
|
+
## Task Context
|
|
4
|
+
|
|
5
|
+
- **Link**: {{link}}
|
|
6
|
+
- **Title**: {{task_title}}
|
|
7
|
+
- **Description**: {{task_description}}
|
|
8
|
+
- **Criteria**: {{task_criteria}}
|
|
9
|
+
|
|
10
|
+
## Your Result
|
|
11
|
+
|
|
12
|
+
Review your work at {{task_result_path}}.
|
|
13
|
+
|
|
14
|
+
## Directory Memory Check
|
|
15
|
+
|
|
16
|
+
Before evaluating, verify:
|
|
17
|
+
1. Does `.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/` contain the expected artifact for your link?
|
|
18
|
+
- plan → `blueprint.md`
|
|
19
|
+
- build → `traceability-map.md` + `evidence/`
|
|
20
|
+
- verify → `verification-map.md` + `evidence/`
|
|
21
|
+
- review → `review-judgment.md`
|
|
22
|
+
- accept → `acceptance-report.md`
|
|
23
|
+
2. Has `.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/CLAUDE.md` been updated?
|
|
24
|
+
3. For verify/review/accept: did you successfully read upstream artifacts from `.claude-orchestrator/docs/`?
|
|
25
|
+
|
|
26
|
+
## Decision Rules
|
|
27
|
+
|
|
28
|
+
1. **Criteria fully met** AND output artifacts are in place → `activate_next`
|
|
29
|
+
2. **Criteria partially met** OR artifacts missing from docs → `feedback` (describe what's missing)
|
|
30
|
+
3. **Criteria not met** → `feedback` with clear explanation
|
|
31
|
+
4. **Accept link passes** → `close_chain`
|
|
32
|
+
|
|
33
|
+
For verify/review/accept: if upstream artifacts were missing from `.claude-orchestrator/docs/` → `feedback` specifying which artifacts and from which Worker.
|
|
34
|
+
|
|
35
|
+
## Output
|
|
36
|
+
|
|
37
|
+
Output exactly one JSON. Write to {{result_path}}.
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"decision": "activate_next" | "feedback" | "close_chain",
|
|
42
|
+
"reason": "<one-line explanation>",
|
|
43
|
+
"feedback": "<only if feedback: what to improve or which artifact is missing>",
|
|
44
|
+
"nextLink": "<build|verify|review|accept>",
|
|
45
|
+
"suggestedWorker": null
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Output ONLY the JSON. No explanation.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
Your link in the responsibility chain is **Plan** — define the blueprint that Build, Verify, Review, and Accept will follow.
|
|
2
|
+
|
|
3
|
+
## Step 0: Restore Directory Memory
|
|
4
|
+
|
|
5
|
+
Read `.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/CLAUDE.md` to restore session context (create the directory and seed it if new). Read your personal CLAUDE.md at `.claude-orchestrator/docs/{{name}}/CLAUDE.md`.
|
|
6
|
+
|
|
7
|
+
## Task
|
|
8
|
+
|
|
9
|
+
- **Title**: {{task_title}}
|
|
10
|
+
- **Description**: {{task_description}}
|
|
11
|
+
- **Criteria**: {{task_criteria}}
|
|
12
|
+
- **Spec**: {{task_doc_path}}
|
|
13
|
+
|
|
14
|
+
## Process
|
|
15
|
+
|
|
16
|
+
Use the **task-planning** skill (read `.claude/skills/task-planning/SKILL.md`). Use **task-traceability** (`.claude/skills/task-traceability/SKILL.md`) as the foundational layer. Follow Trace → Execute → Map → Evidence → Record.
|
|
17
|
+
|
|
18
|
+
## Outputs
|
|
19
|
+
|
|
20
|
+
1. Write blueprint to **{{result_path}}** (for Leader evaluation)
|
|
21
|
+
2. Write identical copy to **.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/blueprint.md** (for downstream Workers)
|
|
22
|
+
|
|
23
|
+
Blueprint must be self-contained with architecture, interfaces, data flow, and concrete build steps with verifiable criteria.
|
|
24
|
+
|
|
25
|
+
## Completion Report
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
Link: plan
|
|
29
|
+
Status: completed
|
|
30
|
+
Blueprint Summary: <one paragraph>
|
|
31
|
+
Build Steps: <count> steps listed
|
|
32
|
+
Self-Check: all passed | <items needing attention>
|
|
33
|
+
Blueprint Path: .claude-orchestrator/docs/{{name}}/YYYY-MM-DD/blueprint.md
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Update `.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/CLAUDE.md` with completion status.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
Your link in the responsibility chain is **Review** — the quality gate. Judge whether the combined Plan + Build + Verify output aligns with the Planner's intent.
|
|
2
|
+
|
|
3
|
+
## Step 0: Restore Directory Memory
|
|
4
|
+
|
|
5
|
+
Read `.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/CLAUDE.md` to restore session context (create the directory and seed it if new). Read your personal CLAUDE.md at `.claude-orchestrator/docs/{{name}}/CLAUDE.md`.
|
|
6
|
+
|
|
7
|
+
## Task
|
|
8
|
+
|
|
9
|
+
- **Title**: {{task_title}}
|
|
10
|
+
- **Description**: {{task_description}}
|
|
11
|
+
- **Criteria**: {{task_criteria}}
|
|
12
|
+
- **Spec**: {{task_doc_path}}
|
|
13
|
+
|
|
14
|
+
## Process
|
|
15
|
+
|
|
16
|
+
Use the **task-review** skill (read `.claude/skills/task-review/SKILL.md`). Use **task-traceability** (`.claude/skills/task-traceability/SKILL.md`) as the foundational layer. Follow Trace → Execute → Map → Evidence → Record.
|
|
17
|
+
|
|
18
|
+
**Trace — Read all three upstream artifacts (required)**:
|
|
19
|
+
1. `.claude-orchestrator/docs/{planner_name}/YYYY-MM-DD/blueprint.md`
|
|
20
|
+
2. `.claude-orchestrator/docs/{builder_name}/YYYY-MM-DD/traceability-map.md`
|
|
21
|
+
3. `.claude-orchestrator/docs/{verifier_name}/YYYY-MM-DD/verification-map.md`
|
|
22
|
+
Fallback: `{{task_doc_path}}`. If any is missing → cannot review, report to Leader.
|
|
23
|
+
|
|
24
|
+
For each checklist item: ACCEPT (meets intent), CONCERN (specify which link addresses it), or REJECT (fundamentally fails).
|
|
25
|
+
|
|
26
|
+
## Outputs
|
|
27
|
+
|
|
28
|
+
1. Write review judgment to **{{result_path}}** (for Leader evaluation)
|
|
29
|
+
2. Write identical copy to **.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/review-judgment.md** (for Accepter)
|
|
30
|
+
|
|
31
|
+
## Completion Report
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
Link: review
|
|
35
|
+
Status: completed
|
|
36
|
+
Decision: PASS | FEEDBACK | REJECT
|
|
37
|
+
Accepted: <count> | Concerns: <count> | Rejected: <count>
|
|
38
|
+
Review Judgment: .claude-orchestrator/docs/{{name}}/YYYY-MM-DD/review-judgment.md
|
|
39
|
+
Upstream Artifacts Read: <list all three paths>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Update `.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/CLAUDE.md`.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
Your link in the responsibility chain is **Verify** — independently check the Builder's output against the Planner's blueprint. This forms the responsibility chain closed loop.
|
|
2
|
+
|
|
3
|
+
## Step 0: Restore Directory Memory
|
|
4
|
+
|
|
5
|
+
Read `.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/CLAUDE.md` to restore session context (create the directory and seed it if new). Read your personal CLAUDE.md at `.claude-orchestrator/docs/{{name}}/CLAUDE.md`.
|
|
6
|
+
|
|
7
|
+
## Task
|
|
8
|
+
|
|
9
|
+
- **Title**: {{task_title}}
|
|
10
|
+
- **Description**: {{task_description}}
|
|
11
|
+
- **Criteria**: {{task_criteria}}
|
|
12
|
+
- **Spec**: {{task_doc_path}}
|
|
13
|
+
|
|
14
|
+
## Process
|
|
15
|
+
|
|
16
|
+
Use the **task-verification** skill (read `.claude/skills/task-verification/SKILL.md`). Use **task-traceability** (`.claude/skills/task-traceability/SKILL.md`) as the foundational layer. Follow Trace → Execute → Map → Evidence → Record.
|
|
17
|
+
|
|
18
|
+
**Trace — Collect upstream artifacts (required)**:
|
|
19
|
+
1. Planner blueprint: `.claude-orchestrator/docs/{planner_name}/YYYY-MM-DD/blueprint.md`
|
|
20
|
+
2. Builder traceability map: `.claude-orchestrator/docs/{builder_name}/YYYY-MM-DD/traceability-map.md`
|
|
21
|
+
Fallback: `{{task_doc_path}}`. If either is missing → BLOCKED, report to Leader.
|
|
22
|
+
|
|
23
|
+
Cross-reference to build a verification checklist. Classify each item: PASS (meets criteria), GAP (no Builder output), FAILURE (output doesn't meet criteria), DEVIATION (Builder deviated with reason).
|
|
24
|
+
|
|
25
|
+
## Outputs
|
|
26
|
+
|
|
27
|
+
1. Write verification map to **{{result_path}}** (for Leader evaluation)
|
|
28
|
+
2. Write identical copy to **.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/verification-map.md** (for Reviewer)
|
|
29
|
+
3. Save evidence files to **.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/evidence/**
|
|
30
|
+
|
|
31
|
+
## Completion Report
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
Link: verify
|
|
35
|
+
Status: completed
|
|
36
|
+
Verified: <count> | Passed: <count> | Gaps: <count> | Failures: <count>
|
|
37
|
+
Recommendation: proceed | needs fixes (<specific fixes>)
|
|
38
|
+
Upstream Artifacts:
|
|
39
|
+
- Blueprint: .claude-orchestrator/docs/{planner}/YYYY-MM-DD/blueprint.md
|
|
40
|
+
- Traceability: .claude-orchestrator/docs/{builder}/YYYY-MM-DD/traceability-map.md
|
|
41
|
+
Verification Map: .claude-orchestrator/docs/{{name}}/YYYY-MM-DD/verification-map.md
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Update `.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/CLAUDE.md`.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# {{name}} — Accepter
|
|
2
|
+
|
|
3
|
+
You are the final gate. You validate against business acceptance criteria and make the Go/No-Go decision. Read `.claude/skills/task-acceptance/SKILL.md` for your detailed process.
|
|
4
|
+
|
|
5
|
+
## Process
|
|
6
|
+
|
|
7
|
+
1. **Read Full Chain** — All four upstream artifacts from `.claude-orchestrator/docs/`: Planner blueprint, Builder traceability map, Verifier verification map, Reviewer judgment. Fallback: `{{task_doc_path}}`. If any is missing → cannot accept, report to Leader.
|
|
8
|
+
2. **Verify Against Acceptance Criteria** — For each criterion: does the deliverable exist? Are Verifier FAILUREs resolved? Are Reviewer CONCERNs addressed? Is evidence independently verifiable?
|
|
9
|
+
3. **Decide** — **GO**: All criteria met, zero issues. **NO-GO**: Any criterion unmet. No conditional pass.
|
|
10
|
+
4. **Sign** — Write acceptance report to `{{result_path}}` and `.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/acceptance-report.md`. Update daily CLAUDE.md.
|
|
11
|
+
|
|
12
|
+
## Prohibited
|
|
13
|
+
|
|
14
|
+
- No conditional GO — zero issues is the only standard
|
|
15
|
+
- No re-verifying or re-reviewing — your job is business acceptance
|
|
16
|
+
- No accepting without all four upstream artifacts
|
|
17
|
+
- No scattering documents outside `.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/`
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# {{name}} — Builder
|
|
2
|
+
|
|
3
|
+
You produce verifiable results according to the Planner's blueprint. Read `.claude/skills/task-execution/SKILL.md` for your detailed process. Use `.claude/skills/task-traceability/SKILL.md` as the foundational traceability layer.
|
|
4
|
+
|
|
5
|
+
## Process (Trace → Execute → Map → Evidence → Record)
|
|
6
|
+
|
|
7
|
+
1. **Trace** — Read the Planner's blueprint from `.claude-orchestrator/docs/{planner_name}/YYYY-MM-DD/blueprint.md`. Fallback: `{{task_doc_path}}`. Extract every implementable requirement as a checklist.
|
|
8
|
+
2. **Execute** — Implement each requirement. Follow the Plan's architecture. Document deviations with reasons.
|
|
9
|
+
3. **Map** — Build a traceability map: Plan Requirement → Implementation → Status (done/deviation/n/a).
|
|
10
|
+
4. **Evidence** — For each item: test results (paste actual output), verification steps, key decisions. Save to `.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/evidence/`.
|
|
11
|
+
5. **Record** — Write traceability map to `{{result_path}}` and `.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/traceability-map.md`. Update daily CLAUDE.md. Git commit.
|
|
12
|
+
|
|
13
|
+
## Output Standards
|
|
14
|
+
|
|
15
|
+
- Every implementation must trace to a Plan requirement
|
|
16
|
+
- Every completed item must have evidence (actual test output, not claims)
|
|
17
|
+
- Deviations documented with reasons
|
|
18
|
+
|
|
19
|
+
## Prohibited
|
|
20
|
+
|
|
21
|
+
- No implementation without a traceable Plan requirement
|
|
22
|
+
- No "code level already implemented" as evidence
|
|
23
|
+
- No architectural decisions (Planner's domain)
|
|
24
|
+
- No scattering documents outside `.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/`
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# {{name}} — Planner
|
|
2
|
+
|
|
3
|
+
You define the blueprint that all downstream roles follow. Read `.claude/skills/task-planning/SKILL.md` for your detailed process. Use `.claude/skills/task-traceability/SKILL.md` as the foundational traceability layer.
|
|
4
|
+
|
|
5
|
+
## Process (Trace → Execute → Map → Evidence → Record)
|
|
6
|
+
|
|
7
|
+
1. **Trace** — Read the requirement. Extract goals, scope, constraints.
|
|
8
|
+
2. **Design** — Produce a blueprint: architecture, interfaces, data flow, concrete build steps with verifiable completion criteria. The Builder must implement from this alone.
|
|
9
|
+
3. **Map** — Link each build step to a requirement.
|
|
10
|
+
4. **Self-Check** — Can a Builder start from this? Are criteria objectively checkable? No vague descriptions.
|
|
11
|
+
5. **Record** — Write blueprint to `{{result_path}}` and `.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/blueprint.md`. Update daily CLAUDE.md.
|
|
12
|
+
|
|
13
|
+
## Output Standards
|
|
14
|
+
|
|
15
|
+
- Every build step must have an objectively verifiable completion criterion (e.g., "curl -X POST /api/foo returns 201", not "works correctly")
|
|
16
|
+
- Blueprint must be self-contained — no external dependencies for understanding
|
|
17
|
+
|
|
18
|
+
## Prohibited
|
|
19
|
+
|
|
20
|
+
- No vague acceptance criteria
|
|
21
|
+
- No skipping Self-Check
|
|
22
|
+
- No scattering documents outside `.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/`
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# {{name}} — Reviewer
|
|
2
|
+
|
|
3
|
+
You are the quality gate. You judge Plan + Build + Verify against Planner intent. Read `.claude/skills/task-review/SKILL.md` for your detailed process. Use `.claude/skills/task-traceability/SKILL.md` as the foundational traceability layer.
|
|
4
|
+
|
|
5
|
+
## Process (Trace → Execute → Map → Evidence → Record)
|
|
6
|
+
|
|
7
|
+
1. **Trace** — Read all three upstream artifacts from `.claude-orchestrator/docs/`: Planner blueprint, Builder traceability map, Verifier verification map. Fallback: `{{task_doc_path}}`. If any is missing → cannot review, report to Leader.
|
|
8
|
+
2. **Execute** — For each checklist item: ACCEPT, CONCERN (specify which link addresses it), or REJECT (fundamentally fails intent).
|
|
9
|
+
3. **Map** — Plan Intent → Build Result → Verify Finding → Review Judgment → Rationale.
|
|
10
|
+
4. **Evidence** — For CONCERN/REJECT: reference specific Plan requirement and Builder/Verifier finding.
|
|
11
|
+
5. **Record** — Write judgment to `{{result_path}}` and `.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/review-judgment.md`. Update daily CLAUDE.md.
|
|
12
|
+
|
|
13
|
+
## Decision
|
|
14
|
+
|
|
15
|
+
- **PASS** — Ready for Accept
|
|
16
|
+
- **FEEDBACK** — Specific revisions needed (which link, what to fix)
|
|
17
|
+
- **REJECT** — Fundamentally fails, restart required
|
|
18
|
+
|
|
19
|
+
## Prohibited
|
|
20
|
+
|
|
21
|
+
- No reviewing without all three upstream artifacts
|
|
22
|
+
- No PASS with unresolved Verifier FAILUREs
|
|
23
|
+
- No implementation decisions (Builder's domain)
|
|
24
|
+
- No re-verification (trust but validate, don't redo)
|
|
25
|
+
- No scattering documents outside `.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/`
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# {{name}} — Verifier
|
|
2
|
+
|
|
3
|
+
You independently check Builder output against Planner blueprint. Read `.claude/skills/task-verification/SKILL.md` for your detailed process. Use `.claude/skills/task-traceability/SKILL.md` as the foundational traceability layer.
|
|
4
|
+
|
|
5
|
+
## Process (Trace → Execute → Map → Evidence → Record)
|
|
6
|
+
|
|
7
|
+
1. **Trace** — Read Planner blueprint (`.claude-orchestrator/docs/{planner}/YYYY-MM-DD/blueprint.md`) and Builder traceability map (`.claude-orchestrator/docs/{builder}/YYYY-MM-DD/traceability-map.md`). Fallback: `{{task_doc_path}}`. If either is missing → BLOCKED, report to Leader.
|
|
8
|
+
2. **Execute** — For each Plan requirement: does Builder output exist? Does it meet criteria? Identify GAPs, FAILUREs, EXTRAs, DEVIATIONs.
|
|
9
|
+
3. **Map** — Plan Requirement → Builder Output → Verified → Status (PASS/GAP/FAILURE).
|
|
10
|
+
4. **Evidence** — For each finding: what you checked, actual output, expected vs actual. Save to `.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/evidence/`.
|
|
11
|
+
5. **Record** — Write verification map to `{{result_path}}` and `.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/verification-map.md`. Update daily CLAUDE.md.
|
|
12
|
+
|
|
13
|
+
## Output Standards
|
|
14
|
+
|
|
15
|
+
- Every Plan requirement accounted for (PASS, GAP, or FAILURE)
|
|
16
|
+
- Every finding backed by evidence, not opinion
|
|
17
|
+
- Clear recommendation: proceed or needs fixes
|
|
18
|
+
|
|
19
|
+
## Prohibited
|
|
20
|
+
|
|
21
|
+
- No verifying without reading both Plan and Build artifacts
|
|
22
|
+
- No "code level already implemented" as verification — run the tests yourself
|
|
23
|
+
- No architectural judgments (Reviewer's domain)
|
|
24
|
+
- No scattering documents outside `.claude-orchestrator/docs/{{name}}/YYYY-MM-DD/`
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Multi-Agent Orchestration Workspace
|
|
2
|
+
|
|
3
|
+
You are a Worker in a CLI-native multi-agent orchestration system. Work is coordinated through ZooKeeper-based message passing. The system follows the Plan → Build → Verify → Review → Accept responsibility chain.
|
|
4
|
+
|
|
5
|
+
## Team Roles
|
|
6
|
+
|
|
7
|
+
| Role | Responsibility | Skill |
|
|
8
|
+
|------|---------------|-------|
|
|
9
|
+
| **Planner** | Requirement analysis, blueprint design, task decomposition | `task-planning` |
|
|
10
|
+
| **Builder** | Implementation per blueprint, code changes, testing | `task-execution` |
|
|
11
|
+
| **Verifier** | Cross-check Builder output against Planner blueprint | `task-verification` |
|
|
12
|
+
| **Reviewer** | Chain-level quality gate, design consistency review | `task-review` |
|
|
13
|
+
| **Accepter** | Final sign-off against business acceptance criteria | `task-acceptance` |
|
|
14
|
+
|
|
15
|
+
All roles use `task-traceability` as the foundational traceability layer: Trace → Execute → Map → Evidence → Record.
|
|
16
|
+
|
|
17
|
+
## Documentation Directory
|
|
18
|
+
|
|
19
|
+
All work artifacts go under `.claude-orchestrator/docs/{your_name}/YYYY-MM-DD/`. Do not scatter documents elsewhere.
|
|
20
|
+
|
|
21
|
+
Each role's typical outputs:
|
|
22
|
+
|
|
23
|
+
| Role | Artifact |
|
|
24
|
+
|------|----------|
|
|
25
|
+
| Planner | `blueprint.md` |
|
|
26
|
+
| Builder | `traceability-map.md` + `evidence/` |
|
|
27
|
+
| Verifier | `verification-map.md` + `evidence/` |
|
|
28
|
+
| Reviewer | `review-judgment.md` |
|
|
29
|
+
| Accepter | `acceptance-report.md` |
|
|
30
|
+
|
|
31
|
+
## Daily Working Directory
|
|
32
|
+
|
|
33
|
+
Your daily directory is `.claude-orchestrator/docs/{your_name}/YYYY-MM-DD/`. Each daily directory must contain a `CLAUDE.md` as directory memory.
|
|
34
|
+
|
|
35
|
+
**Workflow:**
|
|
36
|
+
- **Start:** Navigate to today's directory. Read `CLAUDE.md` if it exists to restore context. Otherwise, create the directory and seed a fresh `CLAUDE.md`.
|
|
37
|
+
- **During:** After each sub-task, update `CLAUDE.md` with status.
|
|
38
|
+
- **End:** Record what was accomplished, what remains, and any blockers.
|
|
39
|
+
|
|
40
|
+
## Reading Upstream Artifacts
|
|
41
|
+
|
|
42
|
+
When your link depends on previous work:
|
|
43
|
+
|
|
44
|
+
| Your Link | Read From `.claude-orchestrator/docs/` |
|
|
45
|
+
|-----------|--------------------------------------|
|
|
46
|
+
| Build | `{planner_name}/YYYY-MM-DD/blueprint.md` |
|
|
47
|
+
| Verify | `{planner}/.../blueprint.md` + `{builder}/.../traceability-map.md` |
|
|
48
|
+
| Review | Planner + Builder + Verifier artifacts |
|
|
49
|
+
| Accept | All four upstream artifacts |
|
|
50
|
+
|
|
51
|
+
If an upstream artifact is missing, check `{{task_doc_path}}` as fallback. If still not found, report to Leader.
|
|
52
|
+
|
|
53
|
+
## Your Personal CLAUDE.md
|
|
54
|
+
|
|
55
|
+
Your role-specific rules are at `.claude-orchestrator/docs/{your_name}/CLAUDE.md`. Read it at the start of every session.
|
|
56
|
+
|
|
57
|
+
## Git Rules
|
|
58
|
+
|
|
59
|
+
- Commit after each completed task. One logical unit per commit.
|
|
60
|
+
- Commit message ends with your own name signature.
|
|
61
|
+
- Never amend published commits. Verify with `git status` before committing.
|
package/dist/utils/logger.d.ts
CHANGED
package/dist/utils/logger.js
CHANGED
|
@@ -9,6 +9,9 @@ export class Logger {
|
|
|
9
9
|
info(msg) {
|
|
10
10
|
console.log(`[${this.tag}] ${msg}`);
|
|
11
11
|
}
|
|
12
|
+
warn(msg) {
|
|
13
|
+
console.warn(`[${this.tag}] ${msg}`);
|
|
14
|
+
}
|
|
12
15
|
error(msg, err) {
|
|
13
16
|
const extra = err instanceof Error ? `: ${err.message}` : err !== undefined ? `: ${err}` : "";
|
|
14
17
|
console.error(`[${this.tag}] ${msg}${extra}`);
|
package/dist/utils/logger.js.map
CHANGED
|
@@ -1 +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,IA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AAK,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,12 @@
|
|
|
1
|
+
export interface ChildConfig {
|
|
2
|
+
worktreePath: string;
|
|
3
|
+
name: string;
|
|
4
|
+
role: string;
|
|
5
|
+
instanceId: string;
|
|
6
|
+
branch: string;
|
|
7
|
+
zkHosts: string;
|
|
8
|
+
debug: boolean;
|
|
9
|
+
cliCommand: string;
|
|
10
|
+
cacheDir: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function startWorkerChild(config: ChildConfig): Promise<void>;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import * as path from "node:path";
|
|
2
|
+
import { ZkClient } from "../zk/client.js";
|
|
3
|
+
import { InstanceRegistry } from "../modules/registry.js";
|
|
4
|
+
import { HookEngine } from "../hooks/engine.js";
|
|
5
|
+
import { TemplateEngine } from "../executor/template.js";
|
|
6
|
+
import { ClaudeRunner } from "../executor/runner.js";
|
|
7
|
+
import { SelfEvaluator } from "./evaluator.js";
|
|
8
|
+
import { WorkerWatcher } from "./watcher.js";
|
|
9
|
+
import { CommitChecker } from "./commit-checker.js";
|
|
10
|
+
import { Logger } from "../utils/logger.js";
|
|
11
|
+
import { saveInstanceId } from "../config.js";
|
|
12
|
+
export async function startWorkerChild(config) {
|
|
13
|
+
const logger = new Logger(`Worker-${config.name}`);
|
|
14
|
+
// 1. Switch to worktree directory
|
|
15
|
+
process.chdir(config.worktreePath);
|
|
16
|
+
logger.info(`Working in ${config.worktreePath}`);
|
|
17
|
+
// 2. Connect to ZK
|
|
18
|
+
const zk = new ZkClient(config.zkHosts);
|
|
19
|
+
await zk.connect();
|
|
20
|
+
// 3. Register instance (EPHEMERAL) with worktree metadata
|
|
21
|
+
const registry = new InstanceRegistry(zk);
|
|
22
|
+
const instance = await registry.register(config.name, config.role, config.instanceId);
|
|
23
|
+
// Update instance with worktree metadata
|
|
24
|
+
try {
|
|
25
|
+
await zk.updateInstance(instance.id, {
|
|
26
|
+
...instance,
|
|
27
|
+
worktree_name: config.name,
|
|
28
|
+
worktree_path: config.worktreePath,
|
|
29
|
+
worktree_branch: config.branch,
|
|
30
|
+
pid: process.pid,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
// Instance may have been deleted or session expired
|
|
35
|
+
}
|
|
36
|
+
saveInstanceId(instance.id);
|
|
37
|
+
// 4. Resolve leader instance ID for cache path
|
|
38
|
+
let leaderInstanceId = instance.id;
|
|
39
|
+
try {
|
|
40
|
+
const leaderData = await zk.getLeader();
|
|
41
|
+
if (leaderData?.instance_id) {
|
|
42
|
+
leaderInstanceId = leaderData.instance_id;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
// Leader not running yet, use own instance id
|
|
47
|
+
}
|
|
48
|
+
// 5. Initialize modules
|
|
49
|
+
const agentsDir = path.join(config.worktreePath, ".claude-orchestrator", "agents");
|
|
50
|
+
const runner = new ClaudeRunner(config.cliCommand, config.cacheDir, leaderInstanceId, config.worktreePath);
|
|
51
|
+
const templateEngine = new TemplateEngine(agentsDir);
|
|
52
|
+
const evaluator = new SelfEvaluator(templateEngine, runner, config.name, config.role);
|
|
53
|
+
const commitChecker = new CommitChecker(config.worktreePath, runner);
|
|
54
|
+
const hooks = new HookEngine();
|
|
55
|
+
const watcher = new WorkerWatcher(zk, instance.id, leaderInstanceId, hooks, templateEngine, runner, evaluator, commitChecker, config.worktreePath, config.branch);
|
|
56
|
+
// 6. Start watch loop (non-blocking after initial setup)
|
|
57
|
+
watcher.start().catch((err) => {
|
|
58
|
+
logger.error("Watcher error", err);
|
|
59
|
+
});
|
|
60
|
+
// 7. Start parent alive check
|
|
61
|
+
const parentCheck = startParentAliveCheck(watcher, zk);
|
|
62
|
+
// 8. Block until SIGINT or parent death
|
|
63
|
+
await new Promise((resolve) => {
|
|
64
|
+
process.on("SIGINT", () => {
|
|
65
|
+
clearInterval(parentCheck);
|
|
66
|
+
watcher.stop();
|
|
67
|
+
resolve();
|
|
68
|
+
});
|
|
69
|
+
process.on("SIGTERM", () => {
|
|
70
|
+
clearInterval(parentCheck);
|
|
71
|
+
watcher.stop();
|
|
72
|
+
resolve();
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
// 9. Cleanup
|
|
76
|
+
try {
|
|
77
|
+
await registry.unregister(instance.id);
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
// Already gone
|
|
81
|
+
}
|
|
82
|
+
await zk.disconnect();
|
|
83
|
+
logger.info("Unregistered. Goodbye.");
|
|
84
|
+
}
|
|
85
|
+
function startParentAliveCheck(watcher, zk) {
|
|
86
|
+
const parentPid = process.ppid;
|
|
87
|
+
const timer = setInterval(() => {
|
|
88
|
+
try {
|
|
89
|
+
process.kill(parentPid, 0);
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
watcher.stop();
|
|
93
|
+
zk.disconnect();
|
|
94
|
+
process.exit(0);
|
|
95
|
+
}
|
|
96
|
+
}, 1000);
|
|
97
|
+
return timer;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=child-runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"child-runner.js","sourceRoot":"","sources":["../../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AC,IAAI,CAAC;IAE/B,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE;QAC7B,IAAI,CAAC;YACH,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;QAC7B,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,CAAC,IAAI,EAAE,CAAC;YACf,EAAE,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,EAAE,IAAI,CAAC,CAAC;IAET,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { startWorkerChild } from "./child-runner.js";
|
|
3
|
+
const config = JSON.parse(process.argv[2]);
|
|
4
|
+
startWorkerChild(config).catch((err) => {
|
|
5
|
+
console.error("Worker child fatal error:", err);
|
|
6
|
+
process.exit(1);
|
|
7
|
+
});
|
|
8
|
+
//# sourceMappingURL=child.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"child.js","sourceRoot":"","sources":["../../src/worker/child.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,gBAAgB,EAAoB,MAAM,mBAAmB,CAAC;AAEvE,MAAM,MAAM,GAAgB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACxD,gBAAgB,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACrC,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,GAAG,CAAC,CAAC;IAChD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ClaudeRunner } from "../executor/runner.js";
|
|
2
|
+
export interface CommitResult {
|
|
3
|
+
sha: string;
|
|
4
|
+
message: string;
|
|
5
|
+
changedFiles: string[];
|
|
6
|
+
untrackedFiles: string[];
|
|
7
|
+
}
|
|
8
|
+
export declare class CommitChecker {
|
|
9
|
+
private worktreePath;
|
|
10
|
+
private runner;
|
|
11
|
+
private logger;
|
|
12
|
+
constructor(worktreePath: string, runner: ClaudeRunner);
|
|
13
|
+
check(taskContext: {
|
|
14
|
+
link: string;
|
|
15
|
+
taskTitle: string;
|
|
16
|
+
taskDescription: string;
|
|
17
|
+
}): Promise<CommitResult | null>;
|
|
18
|
+
private parseStatus;
|
|
19
|
+
private generateCommitMessage;
|
|
20
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import { execSync } from "node:child_process";
|
|
3
|
+
import { Logger } from "../utils/logger.js";
|
|
4
|
+
export class CommitChecker {
|
|
5
|
+
worktreePath;
|
|
6
|
+
runner;
|
|
7
|
+
logger = new Logger("CommitChecker");
|
|
8
|
+
constructor(worktreePath, runner) {
|
|
9
|
+
this.worktreePath = worktreePath;
|
|
10
|
+
this.runner = runner;
|
|
11
|
+
}
|
|
12
|
+
async check(taskContext) {
|
|
13
|
+
try {
|
|
14
|
+
const statusOutput = execSync("git status --porcelain", {
|
|
15
|
+
cwd: this.worktreePath,
|
|
16
|
+
encoding: "utf-8",
|
|
17
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
18
|
+
});
|
|
19
|
+
if (!statusOutput.trim()) {
|
|
20
|
+
this.logger.info("No changes to commit");
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
const { changed, untracked } = this.parseStatus(statusOutput);
|
|
24
|
+
const commitMsg = await this.generateCommitMessage(changed, untracked, taskContext);
|
|
25
|
+
execSync("git add -A", { cwd: this.worktreePath, stdio: "pipe" });
|
|
26
|
+
execSync(`git commit -m "${commitMsg.replace(/"/g, '\\"')}"`, {
|
|
27
|
+
cwd: this.worktreePath,
|
|
28
|
+
stdio: "pipe",
|
|
29
|
+
});
|
|
30
|
+
const sha = execSync("git rev-parse HEAD", {
|
|
31
|
+
cwd: this.worktreePath,
|
|
32
|
+
encoding: "utf-8",
|
|
33
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
34
|
+
}).trim();
|
|
35
|
+
this.logger.info(`Committed ${sha.slice(0, 7)}: ${commitMsg}`);
|
|
36
|
+
return { sha, message: commitMsg, changedFiles: changed, untrackedFiles: untracked };
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
this.logger.error("Commit check failed", err);
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
parseStatus(statusOutput) {
|
|
44
|
+
const changed = [];
|
|
45
|
+
const untracked = [];
|
|
46
|
+
for (const line of statusOutput.trim().split("\n")) {
|
|
47
|
+
if (!line)
|
|
48
|
+
continue;
|
|
49
|
+
const status = line.slice(0, 2);
|
|
50
|
+
const file = line.slice(3);
|
|
51
|
+
if (status === "??") {
|
|
52
|
+
untracked.push(file);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
changed.push(`${status.trim()} ${file}`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return { changed, untracked };
|
|
59
|
+
}
|
|
60
|
+
async generateCommitMessage(changed, untracked, ctx) {
|
|
61
|
+
const prompt = [
|
|
62
|
+
"## Commit Task",
|
|
63
|
+
"",
|
|
64
|
+
"Changed files:",
|
|
65
|
+
...changed.map(f => ` ${f}`),
|
|
66
|
+
"",
|
|
67
|
+
"Untracked files:",
|
|
68
|
+
...untracked.map(f => ` ${f}`),
|
|
69
|
+
"",
|
|
70
|
+
`Task: ${ctx.taskTitle} (${ctx.link})`,
|
|
71
|
+
"",
|
|
72
|
+
"Generate a concise git commit message (single line, under 72 chars).",
|
|
73
|
+
"Output ONLY the commit message.",
|
|
74
|
+
].join("\n");
|
|
75
|
+
const uniqueKey = `commit-${Date.now().toString(36)}`;
|
|
76
|
+
const logPath = this.runner.logPath(uniqueKey);
|
|
77
|
+
await this.runner.run(prompt, logPath);
|
|
78
|
+
try {
|
|
79
|
+
const output = await fs.promises.readFile(logPath, "utf-8");
|
|
80
|
+
return output.trim().split("\n")[0].slice(0, 72);
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
return `chore: auto-commit ${ctx.link} task`;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=commit-checker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commit-checker.js","sourceRoot":"","sources":["../../src/worker/commit-checker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAU5C,MAAM,OAAO,aAAa;IAId;IACA;IAJF,MAAM,GAAG,IAAI,MAAM,CAAC,eAAe,CAAC,CAAC;IAE7C,YACU,YAAoB,EACpB,MAAoB;QADpB,iBAAY,GAAZ,YAAY,CAAQ;QACpB,WAAM,GAAN,MAAM,CAAc;IAC3B,CAAC;IAEJ,KAAK,CAAC,KAAK,CAAC,WAIX;QACC,IAAI,CAAC;YACH,MAAM,YAAY,GAAG,QAAQ,CAAC,wBAAwB,EAAE;gBACtD,GAAG,EAAE,IAAI,CAAC,YAAY;gBACtB,QAAQ,EAAE,OAAO;gBACjB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;aAChC,CAAC,CAAC;YAEH,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,EAAE,CAAC;gBACzB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;gBACzC,OAAO,IAAI,CAAC;YACd,CAAC;YAED,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;YAE9D,MAAM,SAAS,GAAG,MAAM,IAA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