@nones/agentflow-strategy-workflow 0.0.0-stage → 0.6.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AgentFlow contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,165 @@
1
- # Temporary Holding Version
1
+ # `@nones/agentflow-strategy-workflow`
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The wave-based workflow strategy for AgentFlow. A run plan contains ordered
4
+ waves; agents inside one wave run in parallel, and later waves can be appended
5
+ until the run is sealed.
6
+
7
+ ## Install
8
+
9
+ ```sh
10
+ bun add @nones/agentflow-strategy-workflow
11
+ ```
12
+
13
+ Bun 1.4.5 or newer is required.
14
+
15
+ ## Compile a plan
16
+
17
+ ```ts
18
+ import { workflowStrategy } from "@nones/agentflow-strategy-workflow";
19
+
20
+ const plan = workflowStrategy.compile({
21
+ waves: [
22
+ {
23
+ id: "inspect",
24
+ agents: [
25
+ {
26
+ id: "tests",
27
+ prompt: "List the CLI test files without modifying anything.",
28
+ cwd: process.cwd(),
29
+ },
30
+ {
31
+ id: "contracts",
32
+ prompt: "Summarize the core client methods.",
33
+ cwd: process.cwd(),
34
+ },
35
+ ],
36
+ },
37
+ ],
38
+ artifacts: [{ id: "summary", type: "text", required: false }],
39
+ });
40
+ ```
41
+
42
+ The input is already a `RunPlan`:
43
+
44
+ ```ts
45
+ {
46
+ waves: WaveSpec[];
47
+ profile?: string;
48
+ artifacts?: ArtifactDeclaration[];
49
+ sealed?: boolean;
50
+ }
51
+ ```
52
+
53
+ Compilation validates and deeply clones the plan. Wave IDs must be unique, agent
54
+ IDs must be unique across the whole run, and every wave must contain at least one
55
+ agent. Artifacts follow the same rules as the agent strategy: unique IDs, a
56
+ `json`, `text` or `file` type, boolean `required` and an object `schema` when
57
+ present. An empty unsealed plan is a valid idle queue; a sealed empty plan is
58
+ preserved.
59
+
60
+ ## Use with AgentFlow
61
+
62
+ Through the CLI:
63
+
64
+ ```ts
65
+ const run = await flow.start({
66
+ strategy: "workflow",
67
+ input: plan,
68
+ });
69
+
70
+ const runId = run.id ?? run.runId;
71
+ if (!runId) throw new Error("Missing run ID");
72
+ await flow.waitWave(runId, "inspect");
73
+ await flow.seal(runId);
74
+ ```
75
+
76
+ Programmatically:
77
+
78
+ ```ts
79
+ import type { ServeOptions } from "@nones/agentflow-core";
80
+ import { workflowStrategy } from "@nones/agentflow-strategy-workflow";
81
+
82
+ const strategyOptions = {
83
+ strategies: [workflowStrategy],
84
+ } satisfies Pick<ServeOptions, "strategies">;
85
+ ```
86
+
87
+ The strategy sets `singleAdapter: true`. Core rejects a profile change that
88
+ would resolve to a different adapter within one run, including appended waves.
89
+
90
+ ## Phase/round expansion and templates
91
+
92
+ Planning helpers are data-only: they never run template source, start agents or
93
+ touch run state. A phase/round document expands deterministically into the same
94
+ wave plan the engine already accepts, plus stable step keys, dependencies,
95
+ provenance and a content digest.
96
+
97
+ ```ts
98
+ import {
99
+ expandWorkflow,
100
+ expansionToRunPlan,
101
+ previewWorkflowTemplate,
102
+ } from "@nones/agentflow-strategy-workflow";
103
+
104
+ const expansion = expandWorkflow({
105
+ phases: [
106
+ {
107
+ id: "plan",
108
+ cwd: process.cwd(),
109
+ rounds: [
110
+ {
111
+ id: "scan",
112
+ agents: [{ id: "reviewer", prompt: "Review", model: "m-1" }],
113
+ gates: [
114
+ {
115
+ id: "ok",
116
+ gate: "builtin.all-succeeded",
117
+ dependsOn: ["reviewer"],
118
+ },
119
+ ],
120
+ },
121
+ ],
122
+ },
123
+ ],
124
+ });
125
+ // expansion.waves -> [{ id: "plan/scan", agents: [...] }]
126
+ // expansion.steps -> [{ key: "plan/scan/reviewer", kind: "agent", ... }]
127
+ // expansion.digest -> SHA-256 of the canonical expansion
128
+
129
+ const plan = expansionToRunPlan(expansion, { sealed: true });
130
+ ```
131
+
132
+ Rounds map to waves (`<phase>/<round>`), and each round must contain at least one
133
+ agent step. Scripts, gates and modules attach to that round's wave. Rounds may
134
+ declare `agents` (plain `AgentSpec` fields), `scripts` (`handler` + optional
135
+ `handlerVersion`), `gates` (`gate`) and `modules` (`operation`). Executable
136
+ fields are rejected. `mode: "foreach"` with `foreach: [itemKey, ...]` expands
137
+ one agent template into `<id>@<itemKey>` steps where each item depends on the
138
+ previous one.
139
+
140
+ Step keys (`<phase>/<round>/<step>`) are the logical inspection namespace.
141
+ Engine wave and agent IDs are the same text and keep `/` and `@`, which core
142
+ accepts; only control characters and the 256-character cap are rejected.
143
+ `sha256Digest` ignores a top-level `digest` field, so re-hashing a published
144
+ expansion reproduces `expansion.digest`.
145
+
146
+ Templates are plain JSON data with a `revision`, an optional parameter JSON
147
+ Schema and the phases above. Parameter schemas validate types, bounds,
148
+ `required`, defaults and `additionalProperties: false`. Declared parameters are
149
+ interpolated into phase data with `{{name}}` / `{{name.path}}` placeholders
150
+ (strings, numbers, booleans only; no expressions or callbacks), so the resolved
151
+ arguments change the plan digest and can scope approval. `previewWorkflowTemplate`
152
+ returns phases/models/profile, the `templateDigest`, the `planDigest` and the
153
+ expansion.
154
+
155
+ ## Documentation
156
+
157
+ - [Workflow example](https://github.com/nones-tools/agentflow/blob/main/examples/workflow.ts)
158
+ - [JavaScript workflow example](https://github.com/nones-tools/agentflow/blob/main/examples/workflow.js)
159
+ - [Core contracts](https://github.com/nones-tools/agentflow/blob/main/docs/contracts.md)
160
+ - [Repository README](https://github.com/nones-tools/agentflow/blob/main/README.md)
161
+ - [Issues](https://github.com/nones-tools/agentflow/issues)
162
+
163
+ ## License
164
+
165
+ MIT. See [LICENSE](https://github.com/nones-tools/agentflow/blob/main/LICENSE).
package/package.json CHANGED
@@ -1,6 +1,44 @@
1
1
  {
2
2
  "name": "@nones/agentflow-strategy-workflow",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.6.0",
4
+ "description": "Wave-based AgentFlow workflow strategy",
5
+ "type": "module",
6
+ "main": "./src/index.ts",
7
+ "module": "./src/index.ts",
8
+ "types": "./src/index.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./src/index.ts",
12
+ "import": "./src/index.ts",
13
+ "default": "./src/index.ts"
14
+ },
15
+ "./package.json": "./package.json"
16
+ },
17
+ "files": [
18
+ "src",
19
+ "README.md"
20
+ ],
21
+ "engines": {
22
+ "bun": ">=1.4.5"
23
+ },
24
+ "publishConfig": {
25
+ "access": "public",
26
+ "registry": "https://registry.npmjs.org/"
27
+ },
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "git+https://github.com/nones-tools/agentflow.git",
31
+ "directory": "strategy/workflow"
32
+ },
33
+ "scripts": {
34
+ "build": "bun build ./src/index.ts --target=bun --outdir=.tmp/build --packages external",
35
+ "test": "bun test"
36
+ },
37
+ "dependencies": {
38
+ "@nones/agentflow-core": "0.6.0"
39
+ },
40
+ "bugs": {
41
+ "url": "https://github.com/nones-tools/agentflow/issues"
42
+ },
43
+ "license": "MIT"
44
+ }