返回 CodeWhale
operate_parallel_scout.workflow.js
根目录 / .codewhale / workflows / operate_parallel_scout.workflow.js
1 /**
2 * Operate starter — parallel scout with partial-failure synthesis.
3 *
4 * Dogfood source: docs/examples/dogfood-automatic/wf_a3_partial_failure_synthesis.workflow.js
5 * Run: /workflow run .codewhale/workflows/operate_parallel_scout.workflow.js
6 */
7 export default async function () {
8 phase("Parallel scouts");
9 const slots = await parallel([
10 () =>
11 task({
12 description: "Return the string READY_A. Read-only.",
13 label: "scout-a",
14 type: "explore",
15 }),
16 () => { throw new Error("Demonstration: scout B could not produce a result"); },
17 () =>
18 task({
19 description: "Return the string READY_C. Read-only.",
20 label: "scout-c",
21 type: "explore",
22 }),
23 ]);
24
25 phase("Synthesize");
26 const surviving = (slots || []).filter((s) => s != null);
27 const summary = await task({
28 label: "synthesizer",
29 // Read-only synthesizer: "general" is write-capable and, without declared
30 // write scope, would claim the workspace root (same as operate_read_audit).
31 type: "review",
32 description: [
33 "Build one operator-facing summary from the surviving scout results.",
34 "Explicitly note which parallel slot failed or returned null.",
35 `slot_count=${(slots || []).length} surviving=${surviving.length}`,
36 "dropped_slots:",
37 JSON.stringify(slots.errors || []),
38 "slots_json:",
39 JSON.stringify(slots),
40 ].join("\n"),
41 });
42
43 return {
44 scenario: "WF-A3",
45 slots,
46 surviving_count: surviving.length,
47 summary,
48 };
49 }
50
50 lines JAVASCRIPT