返回 CodeWhale
docs-fleet.ts
根目录 / web / lib / i18n / dictionaries / en / docs-fleet.ts
1 import type { DocsFleetDict } from "../types";
2
3 /**
4 * English reference dictionary for `app/[locale]/docs/fleet/page.tsx`
5 * ("Run a workflow"). Checked against `WorkflowCommand` and `LaneArgs` in
6 * crates/cli/src/lib.rs, the Lane runtime backends in
7 * crates/lane/src/runtime.rs, `FleetCommand` in crates/tui/src/lib.rs, and
8 * docs/FLEET_WORKFLOW_TUTORIAL.md / docs/WORKFLOW_AUTHORING.md.
9 */
10 export const docsFleet: DocsFleetDict = {
11 metaTitle: "Run a workflow · Codewhale Docs",
12 metaDescription:
13 "Save roles and models in a Fleet, write a repeatable Workflow, run it as a Lane you can watch and stop, and run batches of tasks with durable workers.",
14 bodyClassName: "text-ink-soft leading-relaxed",
15 title: "Run a workflow",
16 lede:
17 "In Work, ask Codewhale to plan a larger task and delegate independent steps to agents. Write a Workflow when you want to repeat an ordered plan with phases, parallel branches and a record of each run.",
18 sections: [
19 {
20 id: "fleet",
21 title: "Save roles in a Fleet",
22 blocks: [
23 {
24 p: "Fleet keeps reusable roles and model choices. Connect a model first, then create a role profile inside a session:",
25 },
26 { code: "/fleet setup\n/fleet\n/fleet saved", lang: "Codewhale" },
27 {
28 p: "`/fleet setup` saves one role profile at a time. Choose its model or inherit the session route, then choose this project or your personal profiles. Review the exact file before saving. `/fleet` shows the selected team; `/fleet saved` switches among named teams that already exist. Ask for a task and use `/fleet workers` to watch its session agents.",
29 },
30 {
31 p: "A Fleet only chooses who does the work. What a worker may read, write, or run still comes from your workspace trust, [approval setting](/docs/modes), and sandbox.",
32 },
33 ],
34 },
35 {
36 id: "write",
37 title: "Write a workflow",
38 blocks: [
39 {
40 p: "A saved Workflow describes a process the agents can repeat. Create a `workflows/` folder and save this declarative example as `workflows/docs_readiness.workflow.js`. It reviews two areas in parallel, then combines the findings. Replace `src` and `docs` with directories that exist in your project:",
41 },
42 {
43 code: `export default workflow({
44 "id": "docs-readiness",
45 "goal": "Review the docs and code for gaps, then summarize the next edit",
46 "nodes": [
47 {
48 "branch": {
49 "id": "parallel-review",
50 "parallel": true,
51 "children": [
52 { "agent": { "id": "code-review", "prompt": "Inspect src/ for undocumented behavior.",
53 "agent_type": "review", "mode": "read_only", "file_scope": ["src"] } },
54 { "agent": { "id": "docs-review", "prompt": "Inspect docs/ for stale or missing steps.",
55 "agent_type": "review", "mode": "read_only", "file_scope": ["docs"] } }
56 ]
57 }
58 },
59 {
60 "reduce": {
61 "id": "summary",
62 "inputs": ["code-review", "docs-review"],
63 "prompt": "Combine the findings into the safest next edit."
64 }
65 }
66 ]
67 });`,
68 lang: "workflows/docs_readiness.workflow.js",
69 },
70 {
71 p: "This declarative form supports `agent`, `branch`, `sequence`, and `reduce`. It compiles to a validated plan and rejects constructs such as `import`, `fetch`, `eval`, and `async`. Advanced imperative JavaScript can use asynchronous `task()` and `parallel()` in a sandbox, still without direct filesystem, shell or network access. Workers perform those actions under the active policy.",
72 },
73 {
74 note: "Workflow caps how many agents are live at once, and admitted work waits for a slot. There is no default cumulative child limit or structural depth limit. Set positive `[workflow] max_children` or `max_depth` values to limit them. Runtime agent admission and delegation limits apply separately.",
75 },
76 ],
77 },
78 {
79 id: "run",
80 title: "Run it",
81 blocks: [
82 {
83 code: `codewhale workflow run docs-readiness --runtime inline`,
84 lang: "Terminal",
85 },
86 {
87 p: "This command finds `workflows/docs_readiness.workflow.js`, validates it and starts a model-backed run, so connect your provider first. `--runtime inline` waits in this terminal. The default backend requires `tmux` installed on the host and runs in a detached session. Add `--verify` to the launch command for the configured verifier gates after a successful finish. `--fleet <name>` selects an existing named Fleet.",
88 },
89 {
90 p: "To keep the work off your checkout, add `--worktree-repo . --branch <name>`: the run gets its own git worktree and branch.",
91 },
92 {
93 p: "Inside a session, `/workflow <objective>` drafts a proposal without executing it. To review this saved file, use `/workflow run workflows/docs_readiness.workflow.js`. Wait for the review, then run `/workflow confirm` to start the reviewed draft. `/workflow status` reads run state, `/workflow cancel <run-id>` cancels, and `/workflows` opens the session run dashboard.",
94 },
95 ],
96 },
97 {
98 id: "watch",
99 title: "Watch and stop a run",
100 blocks: [
101 { p: "Each run is a Lane. Lanes are saved to disk, so you can check on them from any terminal:" },
102 {
103 code: `codewhale lane list
104 codewhale lane status <lane-id>
105 codewhale lane logs <lane-id>
106 codewhale lane attach <lane-id>
107 codewhale lane interrupt <lane-id>`,
108 lang: "Terminal",
109 },
110 {
111 p: "`lane list`, `lane status`, and `lane interrupt` accept `--json`. Inside a session, use `/lane list`, `/lane status <lane-id>`, or `/lane interrupt <lane-id>`. Logs and tmux attachment use the shell commands above. Slash reads show the last recorded state; CLI list/status reconcile backend exits. Slash interrupt first returns a queued receipt, then its final result.",
112 },
113 ],
114 },
115 {
116 id: "batch",
117 title: "Run a batch of tasks",
118 blocks: [
119 {
120 p: "When you have a list of separate tasks rather than one plan, write them as a task file and run them as a Fleet run. Each task names its goal, its role, and the paths it may write. [The tutorial](/docs/workflow-tutorial) has a complete `tasks.json`.",
121 },
122 {
123 code: `codewhale fleet init
124 codewhale fleet run tasks.json --check
125 codewhale fleet run tasks.json --max-workers 4
126 codewhale fleet status
127 codewhale fleet logs <worker-id>
128 codewhale fleet resume <run-id>
129 codewhale fleet stop --all`,
130 lang: "Terminal",
131 },
132 {
133 p: "`fleet run --check` validates without creating a run; omit `--check` to start the foreground manager. Use another terminal for status and controls while it runs. After an interruption, `fleet resume <run-id>` reconciles stale leases and reports their state; it does not restart the manager or launch queued work. To explicitly retry a worker, inspect it and use `codewhale fleet restart <worker-id>`, which runs the manager for that run. `/fleet workers` and `/subagents` show current-session agents, not these durable runs.",
134 },
135 ],
136 },
137 ],
138 next: [
139 { href: "/docs/workflow-tutorial", label: "Read the full Fleet tutorial", note: "Validate a complete task file and inspect recovery behavior before starting workers." },
140 {
141 href: "/docs/subagents",
142 label: "Run agents in parallel",
143 note: "Hand independent pieces of one task to sub-agents without writing a workflow.",
144 },
145 {
146 href: "/docs/review",
147 label: "Review what changed",
148 note: "Check the diff a run produced and get a review before you push.",
149 },
150 {
151 href: "/docs/vocabulary",
152 label: "Product terms",
153 note: "Fleet, Workflow, Lane, and Runtime, each in one sentence.",
154 },
155 ],
156 sourceNote:
157 "Source documents: docs/FLEET.md, docs/FLEET_WORKFLOW_TUTORIAL.md, docs/WORKFLOW_AUTHORING.md · Update docs-map.ts when changing.",
158 };
159
159 lines TYPESCRIPT