agent-relay 2.3.4 → 2.3.6
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 +1 -1
- package/dist/src/cli/index.js +124 -7
- package/dist/src/cli/index.js.map +1 -1
- package/package.json +23 -26
- package/packages/acp-bridge/package.json +2 -2
- package/packages/bridge/package.json +7 -7
- package/packages/config/package.json +2 -2
- package/packages/continuity/package.json +2 -2
- package/packages/daemon/package.json +12 -12
- package/packages/hooks/package.json +4 -4
- package/packages/mcp/package.json +5 -5
- package/packages/memory/package.json +2 -2
- package/packages/policy/package.json +2 -2
- package/packages/protocol/package.json +1 -1
- package/packages/resiliency/package.json +1 -1
- package/packages/sdk/dist/index.d.ts +1 -29
- package/packages/sdk/dist/index.d.ts.map +1 -1
- package/packages/sdk/dist/index.js +1 -38
- package/packages/sdk/dist/index.js.map +1 -1
- package/packages/sdk/package.json +4 -25
- package/packages/sdk/src/index.ts +1 -69
- package/packages/sdk-py/README.md +56 -0
- package/packages/sdk-py/pyproject.toml +23 -0
- package/packages/sdk-py/src/agent_relay/__init__.py +27 -0
- package/packages/sdk-py/src/agent_relay/builder.py +367 -0
- package/packages/sdk-py/src/agent_relay/types.py +92 -0
- package/packages/sdk-py/tests/__init__.py +0 -0
- package/packages/sdk-py/tests/test_builder.py +101 -0
- package/packages/sdk-ts/dist/index.d.ts +1 -0
- package/packages/sdk-ts/dist/index.d.ts.map +1 -1
- package/packages/sdk-ts/dist/index.js +1 -0
- package/packages/sdk-ts/dist/index.js.map +1 -1
- package/packages/sdk-ts/dist/workflows/barrier.d.ts +72 -0
- package/packages/sdk-ts/dist/workflows/barrier.d.ts.map +1 -0
- package/packages/sdk-ts/dist/workflows/barrier.js +162 -0
- package/packages/sdk-ts/dist/workflows/barrier.js.map +1 -0
- package/packages/sdk-ts/dist/workflows/builder.d.ts +101 -0
- package/packages/sdk-ts/dist/workflows/builder.d.ts.map +1 -0
- package/packages/sdk-ts/dist/workflows/builder.js +179 -0
- package/packages/sdk-ts/dist/workflows/builder.js.map +1 -0
- package/packages/sdk-ts/dist/workflows/cli.d.ts +10 -0
- package/packages/sdk-ts/dist/workflows/cli.d.ts.map +1 -0
- package/packages/sdk-ts/dist/workflows/cli.js +82 -0
- package/packages/sdk-ts/dist/workflows/cli.js.map +1 -0
- package/packages/sdk-ts/dist/workflows/coordinator.d.ts +68 -0
- package/packages/sdk-ts/dist/workflows/coordinator.d.ts.map +1 -0
- package/packages/sdk-ts/dist/workflows/coordinator.js +353 -0
- package/packages/sdk-ts/dist/workflows/coordinator.js.map +1 -0
- package/packages/sdk-ts/dist/workflows/index.d.ts +10 -0
- package/packages/sdk-ts/dist/workflows/index.d.ts.map +1 -0
- package/packages/sdk-ts/dist/workflows/index.js +10 -0
- package/packages/sdk-ts/dist/workflows/index.js.map +1 -0
- package/packages/sdk-ts/dist/workflows/memory-db.d.ts +17 -0
- package/packages/sdk-ts/dist/workflows/memory-db.d.ts.map +1 -0
- package/packages/sdk-ts/dist/workflows/memory-db.js +33 -0
- package/packages/sdk-ts/dist/workflows/memory-db.js.map +1 -0
- package/packages/sdk-ts/dist/workflows/run.d.ts +31 -0
- package/packages/sdk-ts/dist/workflows/run.d.ts.map +1 -0
- package/packages/sdk-ts/dist/workflows/run.js +24 -0
- package/packages/sdk-ts/dist/workflows/run.js.map +1 -0
- package/packages/sdk-ts/dist/workflows/runner.d.ts +119 -0
- package/packages/sdk-ts/dist/workflows/runner.d.ts.map +1 -0
- package/packages/sdk-ts/dist/workflows/runner.js +650 -0
- package/packages/sdk-ts/dist/workflows/runner.js.map +1 -0
- package/packages/sdk-ts/dist/workflows/state.d.ts +77 -0
- package/packages/sdk-ts/dist/workflows/state.d.ts.map +1 -0
- package/packages/sdk-ts/dist/workflows/state.js +140 -0
- package/packages/sdk-ts/dist/workflows/state.js.map +1 -0
- package/packages/sdk-ts/dist/workflows/templates.d.ts +47 -0
- package/packages/sdk-ts/dist/workflows/templates.d.ts.map +1 -0
- package/packages/sdk-ts/dist/workflows/templates.js +395 -0
- package/packages/sdk-ts/dist/workflows/templates.js.map +1 -0
- package/packages/sdk-ts/dist/workflows/types.d.ts +126 -0
- package/packages/sdk-ts/dist/workflows/types.d.ts.map +1 -0
- package/packages/sdk-ts/dist/workflows/types.js +8 -0
- package/packages/sdk-ts/dist/workflows/types.js.map +1 -0
- package/packages/sdk-ts/package.json +8 -2
- package/packages/sdk-ts/src/__tests__/error-scenarios.test.ts +682 -0
- package/packages/sdk-ts/src/__tests__/swarm-coordinator.test.ts +416 -0
- package/packages/sdk-ts/src/__tests__/workflow-runner.test.ts +333 -0
- package/packages/sdk-ts/src/index.ts +1 -0
- package/packages/sdk-ts/src/workflows/README.md +450 -0
- package/packages/sdk-ts/src/workflows/barrier.ts +254 -0
- package/packages/sdk-ts/src/workflows/builder.ts +241 -0
- package/packages/sdk-ts/src/workflows/builtin-templates/bug-fix.yaml +75 -0
- package/packages/sdk-ts/src/workflows/builtin-templates/code-review.yaml +82 -0
- package/packages/sdk-ts/src/workflows/builtin-templates/documentation.yaml +70 -0
- package/packages/sdk-ts/src/workflows/builtin-templates/feature-dev.yaml +76 -0
- package/packages/sdk-ts/src/workflows/builtin-templates/refactor.yaml +82 -0
- package/packages/sdk-ts/src/workflows/builtin-templates/security-audit.yaml +84 -0
- package/packages/sdk-ts/src/workflows/cli.ts +93 -0
- package/packages/sdk-ts/src/workflows/coordinator.ts +520 -0
- package/packages/sdk-ts/src/workflows/index.ts +9 -0
- package/packages/sdk-ts/src/workflows/memory-db.ts +39 -0
- package/packages/sdk-ts/src/workflows/run.ts +47 -0
- package/packages/sdk-ts/src/workflows/runner.ts +873 -0
- package/packages/sdk-ts/src/workflows/schema.json +321 -0
- package/packages/sdk-ts/src/workflows/state.ts +279 -0
- package/packages/sdk-ts/src/workflows/templates.ts +544 -0
- package/packages/sdk-ts/src/workflows/types.ts +178 -0
- package/packages/sdk-ts/tsconfig.json +6 -1
- package/packages/spawner/package.json +1 -1
- package/packages/state/package.json +1 -1
- package/packages/storage/package.json +2 -2
- package/packages/telemetry/package.json +1 -1
- package/packages/trajectory/package.json +2 -2
- package/packages/user-directory/package.json +2 -2
- package/packages/utils/package.json +3 -3
- package/packages/wrapper/package.json +5 -6
- package/packages/api-types/.trajectories/active/traj_xbsvuzogscey.json +0 -15
- package/packages/api-types/.trajectories/index.json +0 -12
- package/packages/api-types/dist/index.d.ts +0 -21
- package/packages/api-types/dist/index.d.ts.map +0 -1
- package/packages/api-types/dist/index.js +0 -22
- package/packages/api-types/dist/index.js.map +0 -1
- package/packages/api-types/dist/schemas/agent.d.ts +0 -259
- package/packages/api-types/dist/schemas/agent.d.ts.map +0 -1
- package/packages/api-types/dist/schemas/agent.js +0 -102
- package/packages/api-types/dist/schemas/agent.js.map +0 -1
- package/packages/api-types/dist/schemas/api.d.ts +0 -290
- package/packages/api-types/dist/schemas/api.d.ts.map +0 -1
- package/packages/api-types/dist/schemas/api.js +0 -162
- package/packages/api-types/dist/schemas/api.js.map +0 -1
- package/packages/api-types/dist/schemas/decision.d.ts +0 -230
- package/packages/api-types/dist/schemas/decision.d.ts.map +0 -1
- package/packages/api-types/dist/schemas/decision.js +0 -104
- package/packages/api-types/dist/schemas/decision.js.map +0 -1
- package/packages/api-types/dist/schemas/fleet.d.ts +0 -615
- package/packages/api-types/dist/schemas/fleet.d.ts.map +0 -1
- package/packages/api-types/dist/schemas/fleet.js +0 -71
- package/packages/api-types/dist/schemas/fleet.js.map +0 -1
- package/packages/api-types/dist/schemas/history.d.ts +0 -180
- package/packages/api-types/dist/schemas/history.d.ts.map +0 -1
- package/packages/api-types/dist/schemas/history.js +0 -72
- package/packages/api-types/dist/schemas/history.js.map +0 -1
- package/packages/api-types/dist/schemas/index.d.ts +0 -14
- package/packages/api-types/dist/schemas/index.d.ts.map +0 -1
- package/packages/api-types/dist/schemas/index.js +0 -22
- package/packages/api-types/dist/schemas/index.js.map +0 -1
- package/packages/api-types/dist/schemas/message.d.ts +0 -456
- package/packages/api-types/dist/schemas/message.d.ts.map +0 -1
- package/packages/api-types/dist/schemas/message.js +0 -88
- package/packages/api-types/dist/schemas/message.js.map +0 -1
- package/packages/api-types/dist/schemas/session.d.ts +0 -60
- package/packages/api-types/dist/schemas/session.d.ts.map +0 -1
- package/packages/api-types/dist/schemas/session.js +0 -36
- package/packages/api-types/dist/schemas/session.js.map +0 -1
- package/packages/api-types/dist/schemas/task.d.ts +0 -111
- package/packages/api-types/dist/schemas/task.d.ts.map +0 -1
- package/packages/api-types/dist/schemas/task.js +0 -64
- package/packages/api-types/dist/schemas/task.js.map +0 -1
- package/packages/api-types/package.json +0 -61
- package/packages/api-types/scripts/generate-openapi.ts +0 -106
- package/packages/api-types/src/index.ts +0 -22
- package/packages/api-types/src/schemas/agent.test.ts +0 -164
- package/packages/api-types/src/schemas/agent.ts +0 -110
- package/packages/api-types/src/schemas/api.test.ts +0 -372
- package/packages/api-types/src/schemas/api.ts +0 -194
- package/packages/api-types/src/schemas/decision.test.ts +0 -324
- package/packages/api-types/src/schemas/decision.ts +0 -136
- package/packages/api-types/src/schemas/fleet.test.ts +0 -212
- package/packages/api-types/src/schemas/fleet.ts +0 -83
- package/packages/api-types/src/schemas/history.test.ts +0 -242
- package/packages/api-types/src/schemas/history.ts +0 -84
- package/packages/api-types/src/schemas/index.ts +0 -148
- package/packages/api-types/src/schemas/message.test.ts +0 -192
- package/packages/api-types/src/schemas/message.ts +0 -98
- package/packages/api-types/src/schemas/session.test.ts +0 -104
- package/packages/api-types/src/schemas/session.ts +0 -40
- package/packages/api-types/src/schemas/task.test.ts +0 -192
- package/packages/api-types/src/schemas/task.ts +0 -78
- package/packages/api-types/tsconfig.json +0 -19
- package/packages/api-types/vitest.config.ts +0 -9
- package/packages/benchmark/README.md +0 -200
- package/packages/benchmark/datasets/coding-tasks.yaml +0 -127
- package/packages/benchmark/datasets/coordination-tasks.yaml +0 -122
- package/packages/benchmark/datasets/quick-test.yaml +0 -20
- package/packages/benchmark/dist/benchmark.d.ts +0 -47
- package/packages/benchmark/dist/benchmark.d.ts.map +0 -1
- package/packages/benchmark/dist/benchmark.js +0 -224
- package/packages/benchmark/dist/benchmark.js.map +0 -1
- package/packages/benchmark/dist/cli.d.ts +0 -8
- package/packages/benchmark/dist/cli.d.ts.map +0 -1
- package/packages/benchmark/dist/cli.js +0 -185
- package/packages/benchmark/dist/cli.js.map +0 -1
- package/packages/benchmark/dist/harbor.d.ts +0 -53
- package/packages/benchmark/dist/harbor.d.ts.map +0 -1
- package/packages/benchmark/dist/harbor.js +0 -127
- package/packages/benchmark/dist/harbor.js.map +0 -1
- package/packages/benchmark/dist/index.d.ts +0 -48
- package/packages/benchmark/dist/index.d.ts.map +0 -1
- package/packages/benchmark/dist/index.js +0 -50
- package/packages/benchmark/dist/index.js.map +0 -1
- package/packages/benchmark/dist/runners/base.d.ts +0 -63
- package/packages/benchmark/dist/runners/base.d.ts.map +0 -1
- package/packages/benchmark/dist/runners/base.js +0 -156
- package/packages/benchmark/dist/runners/base.js.map +0 -1
- package/packages/benchmark/dist/runners/index.d.ts +0 -10
- package/packages/benchmark/dist/runners/index.d.ts.map +0 -1
- package/packages/benchmark/dist/runners/index.js +0 -10
- package/packages/benchmark/dist/runners/index.js.map +0 -1
- package/packages/benchmark/dist/runners/single.d.ts +0 -19
- package/packages/benchmark/dist/runners/single.d.ts.map +0 -1
- package/packages/benchmark/dist/runners/single.js +0 -111
- package/packages/benchmark/dist/runners/single.js.map +0 -1
- package/packages/benchmark/dist/runners/subagent.d.ts +0 -32
- package/packages/benchmark/dist/runners/subagent.d.ts.map +0 -1
- package/packages/benchmark/dist/runners/subagent.js +0 -212
- package/packages/benchmark/dist/runners/subagent.js.map +0 -1
- package/packages/benchmark/dist/runners/swarm.d.ts +0 -36
- package/packages/benchmark/dist/runners/swarm.d.ts.map +0 -1
- package/packages/benchmark/dist/runners/swarm.js +0 -273
- package/packages/benchmark/dist/runners/swarm.js.map +0 -1
- package/packages/benchmark/dist/types.d.ts +0 -178
- package/packages/benchmark/dist/types.d.ts.map +0 -1
- package/packages/benchmark/dist/types.js +0 -16
- package/packages/benchmark/dist/types.js.map +0 -1
- package/packages/benchmark/package.json +0 -80
- package/packages/benchmark/src/benchmark.ts +0 -298
- package/packages/benchmark/src/cli.ts +0 -240
- package/packages/benchmark/src/harbor.ts +0 -170
- package/packages/benchmark/src/index.ts +0 -73
- package/packages/benchmark/src/runners/base.ts +0 -205
- package/packages/benchmark/src/runners/index.ts +0 -10
- package/packages/benchmark/src/runners/single.ts +0 -121
- package/packages/benchmark/src/runners/subagent.ts +0 -240
- package/packages/benchmark/src/runners/swarm.ts +0 -326
- package/packages/benchmark/src/types.ts +0 -205
- package/packages/benchmark/tsconfig.json +0 -20
- package/packages/cli-tester/README.md +0 -277
- package/packages/cli-tester/dist/index.d.ts +0 -21
- package/packages/cli-tester/dist/index.d.ts.map +0 -1
- package/packages/cli-tester/dist/index.js +0 -21
- package/packages/cli-tester/dist/index.js.map +0 -1
- package/packages/cli-tester/dist/utils/credential-check.d.ts +0 -56
- package/packages/cli-tester/dist/utils/credential-check.d.ts.map +0 -1
- package/packages/cli-tester/dist/utils/credential-check.js +0 -230
- package/packages/cli-tester/dist/utils/credential-check.js.map +0 -1
- package/packages/cli-tester/dist/utils/socket-client.d.ts +0 -76
- package/packages/cli-tester/dist/utils/socket-client.d.ts.map +0 -1
- package/packages/cli-tester/dist/utils/socket-client.js +0 -153
- package/packages/cli-tester/dist/utils/socket-client.js.map +0 -1
- package/packages/cli-tester/docker/Dockerfile +0 -61
- package/packages/cli-tester/docker/docker-compose.yml +0 -71
- package/packages/cli-tester/docker/entrypoint.sh +0 -58
- package/packages/cli-tester/package.json +0 -32
- package/packages/cli-tester/scripts/clear-auth.sh +0 -101
- package/packages/cli-tester/scripts/inject-message.sh +0 -42
- package/packages/cli-tester/scripts/start.sh +0 -71
- package/packages/cli-tester/scripts/test-cli.sh +0 -56
- package/packages/cli-tester/scripts/test-full-spawn.sh +0 -238
- package/packages/cli-tester/scripts/test-registration.sh +0 -182
- package/packages/cli-tester/scripts/test-setup-flow.sh +0 -202
- package/packages/cli-tester/scripts/test-spawn.sh +0 -140
- package/packages/cli-tester/scripts/test-with-daemon.sh +0 -247
- package/packages/cli-tester/scripts/verify-auth.sh +0 -112
- package/packages/cli-tester/src/index.ts +0 -40
- package/packages/cli-tester/src/utils/credential-check.ts +0 -284
- package/packages/cli-tester/src/utils/socket-client.ts +0 -211
- package/packages/cli-tester/tests/credential-check.test.ts +0 -56
- package/packages/cli-tester/tsconfig.json +0 -11
- package/packages/sdk/dist/browser-client.d.ts +0 -212
- package/packages/sdk/dist/browser-client.d.ts.map +0 -1
- package/packages/sdk/dist/browser-client.js +0 -750
- package/packages/sdk/dist/browser-client.js.map +0 -1
- package/packages/sdk/dist/browser-framing.d.ts +0 -46
- package/packages/sdk/dist/browser-framing.d.ts.map +0 -1
- package/packages/sdk/dist/browser-framing.js +0 -122
- package/packages/sdk/dist/browser-framing.js.map +0 -1
- package/packages/sdk/dist/standalone.d.ts +0 -89
- package/packages/sdk/dist/standalone.d.ts.map +0 -1
- package/packages/sdk/dist/standalone.js +0 -131
- package/packages/sdk/dist/standalone.js.map +0 -1
- package/packages/sdk/dist/transports/index.d.ts +0 -92
- package/packages/sdk/dist/transports/index.d.ts.map +0 -1
- package/packages/sdk/dist/transports/index.js +0 -129
- package/packages/sdk/dist/transports/index.js.map +0 -1
- package/packages/sdk/dist/transports/socket-transport.d.ts +0 -30
- package/packages/sdk/dist/transports/socket-transport.d.ts.map +0 -1
- package/packages/sdk/dist/transports/socket-transport.js +0 -94
- package/packages/sdk/dist/transports/socket-transport.js.map +0 -1
- package/packages/sdk/dist/transports/types.d.ts +0 -69
- package/packages/sdk/dist/transports/types.d.ts.map +0 -1
- package/packages/sdk/dist/transports/types.js +0 -10
- package/packages/sdk/dist/transports/types.js.map +0 -1
- package/packages/sdk/dist/transports/websocket-transport.d.ts +0 -55
- package/packages/sdk/dist/transports/websocket-transport.d.ts.map +0 -1
- package/packages/sdk/dist/transports/websocket-transport.js +0 -180
- package/packages/sdk/dist/transports/websocket-transport.js.map +0 -1
- package/packages/sdk/src/browser-client.ts +0 -985
- package/packages/sdk/src/browser-framing.test.ts +0 -115
- package/packages/sdk/src/browser-framing.ts +0 -150
- package/packages/sdk/src/standalone.ts +0 -183
- package/packages/sdk/src/transports/index.ts +0 -197
- package/packages/sdk/src/transports/socket-transport.ts +0 -115
- package/packages/sdk/src/transports/types.ts +0 -77
- package/packages/sdk/src/transports/websocket-transport.ts +0 -245
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { stringify as stringifyYaml } from 'yaml';
|
|
2
|
+
|
|
3
|
+
import type { AgentRelayOptions } from '../relay.js';
|
|
4
|
+
import type {
|
|
5
|
+
AgentCli,
|
|
6
|
+
AgentDefinition,
|
|
7
|
+
ErrorHandlingConfig,
|
|
8
|
+
RelayYamlConfig,
|
|
9
|
+
SwarmPattern,
|
|
10
|
+
VerificationCheck,
|
|
11
|
+
WorkflowDefinition,
|
|
12
|
+
WorkflowRunRow,
|
|
13
|
+
WorkflowStep,
|
|
14
|
+
} from './types.js';
|
|
15
|
+
import { WorkflowRunner, type WorkflowEventListener, type VariableContext } from './runner.js';
|
|
16
|
+
|
|
17
|
+
// ── Option types for the builder API ────────────────────────────────────────
|
|
18
|
+
|
|
19
|
+
export interface AgentOptions {
|
|
20
|
+
cli: AgentCli;
|
|
21
|
+
role?: string;
|
|
22
|
+
task?: string;
|
|
23
|
+
channels?: string[];
|
|
24
|
+
model?: string;
|
|
25
|
+
maxTokens?: number;
|
|
26
|
+
timeoutMs?: number;
|
|
27
|
+
retries?: number;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface StepOptions {
|
|
31
|
+
agent: string;
|
|
32
|
+
task: string;
|
|
33
|
+
dependsOn?: string[];
|
|
34
|
+
verification?: VerificationCheck;
|
|
35
|
+
timeoutMs?: number;
|
|
36
|
+
retries?: number;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface ErrorOptions {
|
|
40
|
+
maxRetries?: number;
|
|
41
|
+
retryDelayMs?: number;
|
|
42
|
+
notifyChannel?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface WorkflowRunOptions {
|
|
46
|
+
/** Run a specific workflow by name (default: first). */
|
|
47
|
+
workflow?: string;
|
|
48
|
+
/** Template variable substitutions. */
|
|
49
|
+
vars?: VariableContext;
|
|
50
|
+
/** Working directory (default: process.cwd()). */
|
|
51
|
+
cwd?: string;
|
|
52
|
+
/** AgentRelay options (all optional). */
|
|
53
|
+
relay?: AgentRelayOptions;
|
|
54
|
+
/** Progress callback. */
|
|
55
|
+
onEvent?: WorkflowEventListener;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// ── WorkflowBuilder ─────────────────────────────────────────────────────────
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Fluent builder for constructing workflow configurations programmatically.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* import { workflow } from "@agent-relay/broker-sdk/workflows";
|
|
66
|
+
*
|
|
67
|
+
* const result = await workflow("my-workflow")
|
|
68
|
+
* .pattern("dag")
|
|
69
|
+
* .agent("worker", { cli: "claude", role: "Backend engineer" })
|
|
70
|
+
* .step("build", { agent: "worker", task: "Build the project" })
|
|
71
|
+
* .step("test", { agent: "worker", task: "Run tests", dependsOn: ["build"] })
|
|
72
|
+
* .run();
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export class WorkflowBuilder {
|
|
76
|
+
private _name: string;
|
|
77
|
+
private _description?: string;
|
|
78
|
+
private _pattern: SwarmPattern = 'dag';
|
|
79
|
+
private _maxConcurrency?: number;
|
|
80
|
+
private _timeoutMs?: number;
|
|
81
|
+
private _channel?: string;
|
|
82
|
+
private _agents: AgentDefinition[] = [];
|
|
83
|
+
private _steps: WorkflowStep[] = [];
|
|
84
|
+
private _errorHandling?: ErrorHandlingConfig;
|
|
85
|
+
|
|
86
|
+
constructor(name: string) {
|
|
87
|
+
this._name = name;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** Set workflow description. */
|
|
91
|
+
description(desc: string): this {
|
|
92
|
+
this._description = desc;
|
|
93
|
+
return this;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Set swarm pattern (default: "dag"). */
|
|
97
|
+
pattern(p: SwarmPattern): this {
|
|
98
|
+
this._pattern = p;
|
|
99
|
+
return this;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** Set maximum concurrent agents. */
|
|
103
|
+
maxConcurrency(n: number): this {
|
|
104
|
+
this._maxConcurrency = n;
|
|
105
|
+
return this;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** Set global timeout in milliseconds. */
|
|
109
|
+
timeout(ms: number): this {
|
|
110
|
+
this._timeoutMs = ms;
|
|
111
|
+
return this;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** Set the relay channel for agent communication. */
|
|
115
|
+
channel(ch: string): this {
|
|
116
|
+
this._channel = ch;
|
|
117
|
+
return this;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** Add an agent definition. */
|
|
121
|
+
agent(name: string, options: AgentOptions): this {
|
|
122
|
+
const def: AgentDefinition = {
|
|
123
|
+
name,
|
|
124
|
+
cli: options.cli,
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
if (options.role !== undefined) def.role = options.role;
|
|
128
|
+
if (options.task !== undefined) def.task = options.task;
|
|
129
|
+
if (options.channels !== undefined) def.channels = options.channels;
|
|
130
|
+
|
|
131
|
+
if (options.model !== undefined || options.maxTokens !== undefined ||
|
|
132
|
+
options.timeoutMs !== undefined || options.retries !== undefined) {
|
|
133
|
+
def.constraints = {};
|
|
134
|
+
if (options.model !== undefined) def.constraints.model = options.model;
|
|
135
|
+
if (options.maxTokens !== undefined) def.constraints.maxTokens = options.maxTokens;
|
|
136
|
+
if (options.timeoutMs !== undefined) def.constraints.timeoutMs = options.timeoutMs;
|
|
137
|
+
if (options.retries !== undefined) def.constraints.retries = options.retries;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
this._agents.push(def);
|
|
141
|
+
return this;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** Add a workflow step. */
|
|
145
|
+
step(name: string, options: StepOptions): this {
|
|
146
|
+
const step: WorkflowStep = {
|
|
147
|
+
name,
|
|
148
|
+
agent: options.agent,
|
|
149
|
+
task: options.task,
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
if (options.dependsOn !== undefined) step.dependsOn = options.dependsOn;
|
|
153
|
+
if (options.verification !== undefined) step.verification = options.verification;
|
|
154
|
+
if (options.timeoutMs !== undefined) step.timeoutMs = options.timeoutMs;
|
|
155
|
+
if (options.retries !== undefined) step.retries = options.retries;
|
|
156
|
+
|
|
157
|
+
this._steps.push(step);
|
|
158
|
+
return this;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/** Set error handling strategy. */
|
|
162
|
+
onError(strategy: 'fail-fast' | 'continue' | 'retry', options?: ErrorOptions): this {
|
|
163
|
+
this._errorHandling = { strategy };
|
|
164
|
+
if (options?.maxRetries !== undefined) this._errorHandling.maxRetries = options.maxRetries;
|
|
165
|
+
if (options?.retryDelayMs !== undefined) this._errorHandling.retryDelayMs = options.retryDelayMs;
|
|
166
|
+
if (options?.notifyChannel !== undefined) this._errorHandling.notifyChannel = options.notifyChannel;
|
|
167
|
+
return this;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** Build and return the RelayYamlConfig object. */
|
|
171
|
+
toConfig(): RelayYamlConfig {
|
|
172
|
+
if (this._agents.length === 0) {
|
|
173
|
+
throw new Error('Workflow must have at least one agent');
|
|
174
|
+
}
|
|
175
|
+
if (this._steps.length === 0) {
|
|
176
|
+
throw new Error('Workflow must have at least one step');
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const wfDef: WorkflowDefinition = {
|
|
180
|
+
name: `${this._name}-workflow`,
|
|
181
|
+
steps: [...this._steps],
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
const config: RelayYamlConfig = {
|
|
185
|
+
version: '1.0',
|
|
186
|
+
name: this._name,
|
|
187
|
+
swarm: {
|
|
188
|
+
pattern: this._pattern,
|
|
189
|
+
},
|
|
190
|
+
agents: [...this._agents],
|
|
191
|
+
workflows: [wfDef],
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
if (this._description !== undefined) config.description = this._description;
|
|
195
|
+
if (this._maxConcurrency !== undefined) config.swarm.maxConcurrency = this._maxConcurrency;
|
|
196
|
+
if (this._timeoutMs !== undefined) config.swarm.timeoutMs = this._timeoutMs;
|
|
197
|
+
if (this._channel !== undefined) config.swarm.channel = this._channel;
|
|
198
|
+
if (this._errorHandling !== undefined) config.errorHandling = this._errorHandling;
|
|
199
|
+
|
|
200
|
+
return config;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/** Serialize the config to a YAML string. */
|
|
204
|
+
toYaml(): string {
|
|
205
|
+
return stringifyYaml(this.toConfig());
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/** Build the config and execute it with the WorkflowRunner. */
|
|
209
|
+
async run(options: WorkflowRunOptions = {}): Promise<WorkflowRunRow> {
|
|
210
|
+
const config = this.toConfig();
|
|
211
|
+
|
|
212
|
+
const runner = new WorkflowRunner({
|
|
213
|
+
cwd: options.cwd,
|
|
214
|
+
relay: options.relay,
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
if (options.onEvent) {
|
|
218
|
+
runner.on(options.onEvent);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return runner.execute(config, options.workflow, options.vars);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// ── Entry point ─────────────────────────────────────────────────────────────
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Create a new workflow builder.
|
|
229
|
+
*
|
|
230
|
+
* @example
|
|
231
|
+
* ```typescript
|
|
232
|
+
* const result = await workflow("my-task")
|
|
233
|
+
* .pattern("fan-out")
|
|
234
|
+
* .agent("worker", { cli: "claude" })
|
|
235
|
+
* .step("do-work", { agent: "worker", task: "Build the feature" })
|
|
236
|
+
* .run();
|
|
237
|
+
* ```
|
|
238
|
+
*/
|
|
239
|
+
export function workflow(name: string): WorkflowBuilder {
|
|
240
|
+
return new WorkflowBuilder(name);
|
|
241
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
version: "1.0"
|
|
2
|
+
name: bug-fix
|
|
3
|
+
description: "Fast bug investigation and remediation workflow with validation gates."
|
|
4
|
+
swarm:
|
|
5
|
+
pattern: hub-spoke
|
|
6
|
+
maxConcurrency: 2
|
|
7
|
+
timeoutMs: 2700000
|
|
8
|
+
channel: swarm-bug-fix
|
|
9
|
+
agents:
|
|
10
|
+
- name: lead
|
|
11
|
+
cli: claude
|
|
12
|
+
role: "Coordinates debugging and release decisions"
|
|
13
|
+
- name: investigator
|
|
14
|
+
cli: codex
|
|
15
|
+
role: "Reproduces and scopes the defect"
|
|
16
|
+
- name: fixer
|
|
17
|
+
cli: codex
|
|
18
|
+
role: "Implements and tests the fix"
|
|
19
|
+
- name: verifier
|
|
20
|
+
cli: claude
|
|
21
|
+
role: "Validates risk, regressions, and completion"
|
|
22
|
+
workflows:
|
|
23
|
+
- name: bug-remediation
|
|
24
|
+
description: "Investigate root cause, patch safely, and verify no regressions."
|
|
25
|
+
onError: retry
|
|
26
|
+
steps:
|
|
27
|
+
- name: investigate
|
|
28
|
+
agent: investigator
|
|
29
|
+
task: |
|
|
30
|
+
Reproduce the issue, identify root cause, and provide a fix strategy:
|
|
31
|
+
{{task}}
|
|
32
|
+
verification:
|
|
33
|
+
type: output_contains
|
|
34
|
+
value: ROOT_CAUSE_IDENTIFIED
|
|
35
|
+
- name: patch
|
|
36
|
+
agent: fixer
|
|
37
|
+
dependsOn: [investigate]
|
|
38
|
+
task: |
|
|
39
|
+
Implement the fix based on the investigation report:
|
|
40
|
+
{{steps.investigate.output}}
|
|
41
|
+
retries: 2
|
|
42
|
+
verification:
|
|
43
|
+
type: output_contains
|
|
44
|
+
value: PATCH_APPLIED
|
|
45
|
+
- name: regression-check
|
|
46
|
+
agent: verifier
|
|
47
|
+
dependsOn: [patch]
|
|
48
|
+
task: |
|
|
49
|
+
Validate the patch for correctness and regression risk:
|
|
50
|
+
{{steps.patch.output}}
|
|
51
|
+
verification:
|
|
52
|
+
type: output_contains
|
|
53
|
+
value: VERIFICATION_COMPLETE
|
|
54
|
+
- name: closeout
|
|
55
|
+
agent: lead
|
|
56
|
+
dependsOn: [regression-check]
|
|
57
|
+
task: |
|
|
58
|
+
Prepare final incident summary, residual risk, and deployment notes.
|
|
59
|
+
verification:
|
|
60
|
+
type: output_contains
|
|
61
|
+
value: DONE
|
|
62
|
+
coordination:
|
|
63
|
+
barriers:
|
|
64
|
+
- name: fix-ready
|
|
65
|
+
waitFor: [investigate, patch, regression-check]
|
|
66
|
+
timeoutMs: 600000
|
|
67
|
+
state:
|
|
68
|
+
backend: memory
|
|
69
|
+
ttlMs: 43200000
|
|
70
|
+
namespace: bug-fix
|
|
71
|
+
errorHandling:
|
|
72
|
+
strategy: retry
|
|
73
|
+
maxRetries: 3
|
|
74
|
+
retryDelayMs: 3000
|
|
75
|
+
notifyChannel: swarm-bug-fix
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
version: "1.0"
|
|
2
|
+
name: code-review
|
|
3
|
+
description: "Parallel multi-reviewer code assessment with consolidated findings."
|
|
4
|
+
swarm:
|
|
5
|
+
pattern: fan-out
|
|
6
|
+
maxConcurrency: 4
|
|
7
|
+
timeoutMs: 2400000
|
|
8
|
+
channel: swarm-code-review
|
|
9
|
+
agents:
|
|
10
|
+
- name: lead
|
|
11
|
+
cli: claude
|
|
12
|
+
role: "Aggregates review output and final recommendations"
|
|
13
|
+
- name: reviewer-architecture
|
|
14
|
+
cli: codex
|
|
15
|
+
role: "Assesses architecture and maintainability"
|
|
16
|
+
- name: reviewer-correctness
|
|
17
|
+
cli: claude
|
|
18
|
+
role: "Assesses correctness and testing"
|
|
19
|
+
- name: reviewer-security
|
|
20
|
+
cli: gemini
|
|
21
|
+
role: "Assesses security posture and abuse resistance"
|
|
22
|
+
workflows:
|
|
23
|
+
- name: parallel-review
|
|
24
|
+
description: "Run focused reviews in parallel and synthesize final guidance."
|
|
25
|
+
onError: fail
|
|
26
|
+
steps:
|
|
27
|
+
- name: prepare-context
|
|
28
|
+
agent: lead
|
|
29
|
+
task: |
|
|
30
|
+
Summarize change intent, impacted modules, and review priorities:
|
|
31
|
+
{{task}}
|
|
32
|
+
verification:
|
|
33
|
+
type: output_contains
|
|
34
|
+
value: REVIEW_CONTEXT_READY
|
|
35
|
+
- name: architecture-pass
|
|
36
|
+
agent: reviewer-architecture
|
|
37
|
+
dependsOn: [prepare-context]
|
|
38
|
+
task: |
|
|
39
|
+
Review architecture, coupling, and long-term maintainability:
|
|
40
|
+
{{steps.prepare-context.output}}
|
|
41
|
+
verification:
|
|
42
|
+
type: output_contains
|
|
43
|
+
value: ARCH_REVIEW_COMPLETE
|
|
44
|
+
- name: correctness-pass
|
|
45
|
+
agent: reviewer-correctness
|
|
46
|
+
dependsOn: [prepare-context]
|
|
47
|
+
task: |
|
|
48
|
+
Review behavior, tests, and likely regression paths:
|
|
49
|
+
{{steps.prepare-context.output}}
|
|
50
|
+
verification:
|
|
51
|
+
type: output_contains
|
|
52
|
+
value: CORRECTNESS_REVIEW_COMPLETE
|
|
53
|
+
- name: security-pass
|
|
54
|
+
agent: reviewer-security
|
|
55
|
+
dependsOn: [prepare-context]
|
|
56
|
+
task: |
|
|
57
|
+
Review attack surface, secret handling, and input validation:
|
|
58
|
+
{{steps.prepare-context.output}}
|
|
59
|
+
verification:
|
|
60
|
+
type: output_contains
|
|
61
|
+
value: SECURITY_REVIEW_COMPLETE
|
|
62
|
+
- name: consolidate
|
|
63
|
+
agent: lead
|
|
64
|
+
dependsOn: [architecture-pass, correctness-pass, security-pass]
|
|
65
|
+
task: |
|
|
66
|
+
Produce merged findings, severity levels, and final recommendation.
|
|
67
|
+
verification:
|
|
68
|
+
type: output_contains
|
|
69
|
+
value: DONE
|
|
70
|
+
coordination:
|
|
71
|
+
barriers:
|
|
72
|
+
- name: reviews-complete
|
|
73
|
+
waitFor: [architecture-pass, correctness-pass, security-pass]
|
|
74
|
+
timeoutMs: 900000
|
|
75
|
+
consensusStrategy: majority
|
|
76
|
+
state:
|
|
77
|
+
backend: memory
|
|
78
|
+
ttlMs: 21600000
|
|
79
|
+
namespace: code-review
|
|
80
|
+
errorHandling:
|
|
81
|
+
strategy: fail-fast
|
|
82
|
+
notifyChannel: swarm-code-review
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
version: "1.0"
|
|
2
|
+
name: documentation
|
|
3
|
+
description: "Documentation production workflow from research through publication summary."
|
|
4
|
+
swarm:
|
|
5
|
+
pattern: handoff
|
|
6
|
+
maxConcurrency: 1
|
|
7
|
+
timeoutMs: 3000000
|
|
8
|
+
channel: swarm-documentation
|
|
9
|
+
agents:
|
|
10
|
+
- name: lead
|
|
11
|
+
cli: claude
|
|
12
|
+
role: "Owns final editorial sign-off"
|
|
13
|
+
- name: researcher
|
|
14
|
+
cli: codex
|
|
15
|
+
role: "Collects technical context and source details"
|
|
16
|
+
- name: writer
|
|
17
|
+
cli: codex
|
|
18
|
+
role: "Drafts user-facing documentation"
|
|
19
|
+
- name: editor
|
|
20
|
+
cli: claude
|
|
21
|
+
role: "Edits for accuracy, clarity, and structure"
|
|
22
|
+
workflows:
|
|
23
|
+
- name: docs-production
|
|
24
|
+
description: "Gather context, draft docs, edit, and publish summary."
|
|
25
|
+
onError: skip
|
|
26
|
+
steps:
|
|
27
|
+
- name: gather-context
|
|
28
|
+
agent: researcher
|
|
29
|
+
task: |
|
|
30
|
+
Collect source context and required updates:
|
|
31
|
+
{{task}}
|
|
32
|
+
verification:
|
|
33
|
+
type: output_contains
|
|
34
|
+
value: CONTEXT_COMPLETE
|
|
35
|
+
- name: draft
|
|
36
|
+
agent: writer
|
|
37
|
+
dependsOn: [gather-context]
|
|
38
|
+
task: |
|
|
39
|
+
Draft documentation updates based on gathered context.
|
|
40
|
+
verification:
|
|
41
|
+
type: output_contains
|
|
42
|
+
value: DRAFT_COMPLETE
|
|
43
|
+
- name: edit
|
|
44
|
+
agent: editor
|
|
45
|
+
dependsOn: [draft]
|
|
46
|
+
task: |
|
|
47
|
+
Edit the draft for technical accuracy and readability.
|
|
48
|
+
verification:
|
|
49
|
+
type: output_contains
|
|
50
|
+
value: EDIT_COMPLETE
|
|
51
|
+
- name: publish-summary
|
|
52
|
+
agent: lead
|
|
53
|
+
dependsOn: [edit]
|
|
54
|
+
task: |
|
|
55
|
+
Publish a final summary of documentation changes and open items.
|
|
56
|
+
verification:
|
|
57
|
+
type: output_contains
|
|
58
|
+
value: DONE
|
|
59
|
+
coordination:
|
|
60
|
+
barriers:
|
|
61
|
+
- name: docs-ready
|
|
62
|
+
waitFor: [gather-context, draft, edit]
|
|
63
|
+
timeoutMs: 600000
|
|
64
|
+
state:
|
|
65
|
+
backend: memory
|
|
66
|
+
ttlMs: 259200000
|
|
67
|
+
namespace: documentation
|
|
68
|
+
errorHandling:
|
|
69
|
+
strategy: continue
|
|
70
|
+
notifyChannel: swarm-documentation
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
version: "1.0"
|
|
2
|
+
name: feature-dev
|
|
3
|
+
description: "Full feature development lifecycle with planning, implementation, review, and release."
|
|
4
|
+
swarm:
|
|
5
|
+
pattern: hub-spoke
|
|
6
|
+
maxConcurrency: 2
|
|
7
|
+
timeoutMs: 3600000
|
|
8
|
+
channel: swarm-feature-dev
|
|
9
|
+
agents:
|
|
10
|
+
- name: lead
|
|
11
|
+
cli: claude
|
|
12
|
+
role: "Lead engineer coordinating delivery"
|
|
13
|
+
- name: planner
|
|
14
|
+
cli: codex
|
|
15
|
+
role: "Plans implementation and acceptance criteria"
|
|
16
|
+
- name: developer
|
|
17
|
+
cli: codex
|
|
18
|
+
role: "Implements planned changes"
|
|
19
|
+
- name: reviewer
|
|
20
|
+
cli: claude
|
|
21
|
+
role: "Reviews code quality and release risk"
|
|
22
|
+
workflows:
|
|
23
|
+
- name: feature-delivery
|
|
24
|
+
description: "Plan, implement, review, and finalize a feature request."
|
|
25
|
+
onError: retry
|
|
26
|
+
steps:
|
|
27
|
+
- name: plan
|
|
28
|
+
agent: planner
|
|
29
|
+
task: |
|
|
30
|
+
Analyze the feature request and produce a concrete implementation plan:
|
|
31
|
+
{{task}}
|
|
32
|
+
retries: 1
|
|
33
|
+
verification:
|
|
34
|
+
type: output_contains
|
|
35
|
+
value: PLAN_COMPLETE
|
|
36
|
+
- name: implement
|
|
37
|
+
agent: developer
|
|
38
|
+
dependsOn: [plan]
|
|
39
|
+
task: |
|
|
40
|
+
Implement the approved plan:
|
|
41
|
+
{{steps.plan.output}}
|
|
42
|
+
retries: 1
|
|
43
|
+
verification:
|
|
44
|
+
type: output_contains
|
|
45
|
+
value: IMPLEMENTATION_COMPLETE
|
|
46
|
+
- name: review
|
|
47
|
+
agent: reviewer
|
|
48
|
+
dependsOn: [implement]
|
|
49
|
+
task: |
|
|
50
|
+
Review implementation quality, correctness, and test coverage:
|
|
51
|
+
{{steps.implement.output}}
|
|
52
|
+
verification:
|
|
53
|
+
type: output_contains
|
|
54
|
+
value: REVIEW_COMPLETE
|
|
55
|
+
- name: finalize
|
|
56
|
+
agent: lead
|
|
57
|
+
dependsOn: [review]
|
|
58
|
+
task: |
|
|
59
|
+
Summarize decisions and ship readiness for the feature.
|
|
60
|
+
verification:
|
|
61
|
+
type: output_contains
|
|
62
|
+
value: DONE
|
|
63
|
+
coordination:
|
|
64
|
+
barriers:
|
|
65
|
+
- name: delivery-ready
|
|
66
|
+
waitFor: [plan, implement, review]
|
|
67
|
+
timeoutMs: 900000
|
|
68
|
+
state:
|
|
69
|
+
backend: memory
|
|
70
|
+
ttlMs: 86400000
|
|
71
|
+
namespace: feature-dev
|
|
72
|
+
errorHandling:
|
|
73
|
+
strategy: retry
|
|
74
|
+
maxRetries: 2
|
|
75
|
+
retryDelayMs: 5000
|
|
76
|
+
notifyChannel: swarm-feature-dev
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
version: "1.0"
|
|
2
|
+
name: refactor
|
|
3
|
+
description: "Hierarchical refactor workflow for safe structural improvement."
|
|
4
|
+
swarm:
|
|
5
|
+
pattern: hierarchical
|
|
6
|
+
maxConcurrency: 2
|
|
7
|
+
timeoutMs: 4500000
|
|
8
|
+
channel: swarm-refactor
|
|
9
|
+
agents:
|
|
10
|
+
- name: lead
|
|
11
|
+
cli: claude
|
|
12
|
+
role: "Owns scope, sequencing, and acceptance"
|
|
13
|
+
- name: architect
|
|
14
|
+
cli: codex
|
|
15
|
+
role: "Designs target architecture and migration plan"
|
|
16
|
+
- name: refactorer
|
|
17
|
+
cli: codex
|
|
18
|
+
role: "Executes scoped refactor changes"
|
|
19
|
+
- name: tester
|
|
20
|
+
cli: claude
|
|
21
|
+
role: "Validates behavior parity and risk"
|
|
22
|
+
workflows:
|
|
23
|
+
- name: refactor-execution
|
|
24
|
+
description: "Analyze current system, design approach, refactor, and validate."
|
|
25
|
+
onError: retry
|
|
26
|
+
steps:
|
|
27
|
+
- name: analyze
|
|
28
|
+
agent: architect
|
|
29
|
+
task: |
|
|
30
|
+
Analyze current design and identify refactor opportunities:
|
|
31
|
+
{{task}}
|
|
32
|
+
verification:
|
|
33
|
+
type: output_contains
|
|
34
|
+
value: ANALYSIS_COMPLETE
|
|
35
|
+
- name: design
|
|
36
|
+
agent: architect
|
|
37
|
+
dependsOn: [analyze]
|
|
38
|
+
task: |
|
|
39
|
+
Provide incremental refactor plan with rollback notes:
|
|
40
|
+
{{steps.analyze.output}}
|
|
41
|
+
verification:
|
|
42
|
+
type: output_contains
|
|
43
|
+
value: PLAN_COMPLETE
|
|
44
|
+
- name: refactor-code
|
|
45
|
+
agent: refactorer
|
|
46
|
+
dependsOn: [design]
|
|
47
|
+
task: |
|
|
48
|
+
Execute the refactor plan while preserving behavior.
|
|
49
|
+
retries: 2
|
|
50
|
+
verification:
|
|
51
|
+
type: output_contains
|
|
52
|
+
value: REFACTOR_COMPLETE
|
|
53
|
+
- name: validate
|
|
54
|
+
agent: tester
|
|
55
|
+
dependsOn: [refactor-code]
|
|
56
|
+
task: |
|
|
57
|
+
Validate no regressions and ensure tests/quality checks pass.
|
|
58
|
+
verification:
|
|
59
|
+
type: output_contains
|
|
60
|
+
value: VALIDATION_COMPLETE
|
|
61
|
+
- name: handoff
|
|
62
|
+
agent: lead
|
|
63
|
+
dependsOn: [validate]
|
|
64
|
+
task: |
|
|
65
|
+
Produce final refactor summary and open follow-up items.
|
|
66
|
+
verification:
|
|
67
|
+
type: output_contains
|
|
68
|
+
value: DONE
|
|
69
|
+
coordination:
|
|
70
|
+
barriers:
|
|
71
|
+
- name: refactor-ready
|
|
72
|
+
waitFor: [analyze, design, refactor-code, validate]
|
|
73
|
+
timeoutMs: 900000
|
|
74
|
+
state:
|
|
75
|
+
backend: memory
|
|
76
|
+
ttlMs: 604800000
|
|
77
|
+
namespace: refactor
|
|
78
|
+
errorHandling:
|
|
79
|
+
strategy: retry
|
|
80
|
+
maxRetries: 2
|
|
81
|
+
retryDelayMs: 5000
|
|
82
|
+
notifyChannel: swarm-refactor
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
version: "1.0"
|
|
2
|
+
name: security-audit
|
|
3
|
+
description: "Structured security assessment pipeline from scan through verification."
|
|
4
|
+
swarm:
|
|
5
|
+
pattern: pipeline
|
|
6
|
+
maxConcurrency: 1
|
|
7
|
+
timeoutMs: 5400000
|
|
8
|
+
channel: swarm-security-audit
|
|
9
|
+
agents:
|
|
10
|
+
- name: lead
|
|
11
|
+
cli: claude
|
|
12
|
+
role: "Owns final risk sign-off and recommendations"
|
|
13
|
+
- name: scanner
|
|
14
|
+
cli: codex
|
|
15
|
+
role: "Performs static and dependency security scanning"
|
|
16
|
+
- name: analyst
|
|
17
|
+
cli: claude
|
|
18
|
+
role: "Prioritizes findings and recommends mitigations"
|
|
19
|
+
- name: remediator
|
|
20
|
+
cli: codex
|
|
21
|
+
role: "Implements approved remediations"
|
|
22
|
+
- name: verifier
|
|
23
|
+
cli: gemini
|
|
24
|
+
role: "Verifies fixes and residual exposure"
|
|
25
|
+
workflows:
|
|
26
|
+
- name: audit-pipeline
|
|
27
|
+
description: "Scan, triage, remediate, verify, and report security posture."
|
|
28
|
+
onError: fail
|
|
29
|
+
steps:
|
|
30
|
+
- name: scan
|
|
31
|
+
agent: scanner
|
|
32
|
+
task: |
|
|
33
|
+
Execute security scan and summarize high-confidence findings:
|
|
34
|
+
{{task}}
|
|
35
|
+
verification:
|
|
36
|
+
type: output_contains
|
|
37
|
+
value: SCAN_COMPLETE
|
|
38
|
+
- name: triage
|
|
39
|
+
agent: analyst
|
|
40
|
+
dependsOn: [scan]
|
|
41
|
+
task: |
|
|
42
|
+
Prioritize findings by severity and exploitability:
|
|
43
|
+
{{steps.scan.output}}
|
|
44
|
+
verification:
|
|
45
|
+
type: output_contains
|
|
46
|
+
value: TRIAGE_COMPLETE
|
|
47
|
+
- name: remediate
|
|
48
|
+
agent: remediator
|
|
49
|
+
dependsOn: [triage]
|
|
50
|
+
task: |
|
|
51
|
+
Implement mitigations for approved findings:
|
|
52
|
+
{{steps.triage.output}}
|
|
53
|
+
retries: 1
|
|
54
|
+
verification:
|
|
55
|
+
type: output_contains
|
|
56
|
+
value: REMEDIATION_COMPLETE
|
|
57
|
+
- name: verify
|
|
58
|
+
agent: verifier
|
|
59
|
+
dependsOn: [remediate]
|
|
60
|
+
task: |
|
|
61
|
+
Re-test security posture and confirm mitigations hold.
|
|
62
|
+
verification:
|
|
63
|
+
type: output_contains
|
|
64
|
+
value: VERIFICATION_COMPLETE
|
|
65
|
+
- name: report
|
|
66
|
+
agent: lead
|
|
67
|
+
dependsOn: [verify]
|
|
68
|
+
task: |
|
|
69
|
+
Produce final audit report with residual risk and next actions.
|
|
70
|
+
verification:
|
|
71
|
+
type: output_contains
|
|
72
|
+
value: DONE
|
|
73
|
+
coordination:
|
|
74
|
+
barriers:
|
|
75
|
+
- name: audit-complete
|
|
76
|
+
waitFor: [scan, triage, remediate, verify]
|
|
77
|
+
timeoutMs: 1200000
|
|
78
|
+
state:
|
|
79
|
+
backend: memory
|
|
80
|
+
ttlMs: 86400000
|
|
81
|
+
namespace: security-audit
|
|
82
|
+
errorHandling:
|
|
83
|
+
strategy: fail-fast
|
|
84
|
+
notifyChannel: swarm-security-audit
|