@nones/agentflow-strategy-agent 0.1.0 → 0.6.1

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,11 +1,92 @@
1
- # Agent strategy
1
+ # `@nones/agentflow-strategy-agent`
2
2
 
3
- `agent(spec)` validates and deep-clones a serializable `AgentSpec`. It accepts
4
- `id`, `prompt`, `cwd`, `profile`, `model`, `settings`, `strategy`, and
5
- `strategyInput`. Unknown fields, invalid IDs, non-empty string violations,
6
- non-JSON settings, circular values, and non-finite numbers are rejected.
3
+ The single-agent strategy for AgentFlow, plus the `agent()` builder for
4
+ validated, serializable agent specifications.
7
5
 
8
- `agentStrategy.compile({ agent, artifacts? })` returns a one-wave `RunPlan`
9
- containing the normalized agent. Artifacts use the contract shape and are
10
- validated for unique IDs, `json`/`text`/`file` types, boolean `required`, and
11
- object `schema` values.
6
+ ## Install
7
+
8
+ ```sh
9
+ bun add @nones/agentflow-strategy-agent
10
+ ```
11
+
12
+ Bun 1.4.5 or newer is required.
13
+
14
+ ## Build an agent
15
+
16
+ ```ts
17
+ import { agent } from "@nones/agentflow-strategy-agent";
18
+
19
+ const reviewer = agent({
20
+ id: "reviewer",
21
+ prompt: "Review the current diff and report concrete issues.",
22
+ cwd: process.cwd(),
23
+ model: "provider/model", // optional; profile.model is used otherwise
24
+ });
25
+ ```
26
+
27
+ Accepted fields are `id`, `prompt`, `cwd`, `profile`, `model`, `settings`,
28
+ `strategy` and `strategyInput`. Unknown fields, invalid IDs, empty required
29
+ strings, non-JSON settings, circular values and non-finite numbers are rejected.
30
+ The returned `AgentSpec` is a fresh object; nested settings and strategy input
31
+ are JSON-cloned.
32
+
33
+ ## Compile a run plan
34
+
35
+ ```ts
36
+ import { agent, agentStrategy } from "@nones/agentflow-strategy-agent";
37
+
38
+ const plan = agentStrategy.compile({
39
+ agent: agent({
40
+ id: "reviewer",
41
+ prompt: "Review the current diff and write a JSON report.",
42
+ cwd: process.cwd(),
43
+ }),
44
+ artifacts: [{ id: "report", type: "json", required: true }],
45
+ });
46
+ ```
47
+
48
+ Input is `{ agent, artifacts? }`. Output is a one-wave `RunPlan` with wave ID
49
+ `wave-1`. Artifact declarations must have unique IDs, a `json`, `text` or `file`
50
+ type, boolean `required` and an object `schema` when present.
51
+
52
+ ## Use with AgentFlow
53
+
54
+ Start it through the CLI:
55
+
56
+ ```ts
57
+ const run = await flow.start({
58
+ strategy: "agent",
59
+ input: {
60
+ agent: {
61
+ id: "reviewer",
62
+ prompt: "Review the current diff.",
63
+ cwd: process.cwd(),
64
+ },
65
+ },
66
+ });
67
+ ```
68
+
69
+ Or register the strategy when composing a server programmatically:
70
+
71
+ ```ts
72
+ import type { ServeOptions } from "@nones/agentflow-core";
73
+ import { agentStrategy } from "@nones/agentflow-strategy-agent";
74
+
75
+ const strategyOptions = {
76
+ strategies: [agentStrategy],
77
+ } satisfies Pick<ServeOptions, "strategies">;
78
+ ```
79
+
80
+ The strategy sets `singleAdapter: true`, so one run cannot mix provider
81
+ adapters.
82
+
83
+ ## Documentation
84
+
85
+ - [Single-agent example](https://github.com/nones-tools/agentflow/blob/main/examples/agent.ts)
86
+ - [Core contracts](https://github.com/nones-tools/agentflow/blob/main/docs/contracts.md)
87
+ - [Repository README](https://github.com/nones-tools/agentflow/blob/main/README.md)
88
+ - [Issues](https://github.com/nones-tools/agentflow/issues)
89
+
90
+ ## License
91
+
92
+ MIT. See [LICENSE](https://github.com/nones-tools/agentflow/blob/main/LICENSE).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nones/agentflow-strategy-agent",
3
- "version": "0.1.0",
3
+ "version": "0.6.1",
4
4
  "description": "Single-agent AgentFlow strategy and agent builder",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -35,6 +35,10 @@
35
35
  "test": "bun test"
36
36
  },
37
37
  "dependencies": {
38
- "@nones/agentflow-core": "^0.1.0"
39
- }
38
+ "@nones/agentflow-core": "0.6.1"
39
+ },
40
+ "bugs": {
41
+ "url": "https://github.com/nones-tools/agentflow/issues"
42
+ },
43
+ "license": "MIT"
40
44
  }
package/src/internal.ts CHANGED
@@ -8,6 +8,7 @@ const AGENT_FIELDS = [
8
8
  "cwd",
9
9
  "profile",
10
10
  "model",
11
+ "preset",
11
12
  "settings",
12
13
  "strategy",
13
14
  "strategyInput",
@@ -149,6 +150,10 @@ export function normalizeAgent(value: unknown, path: string): AgentSpec {
149
150
  if (model !== undefined) {
150
151
  spec.model = model;
151
152
  }
153
+ const preset = expectOptionalString(record.preset, `${path}.preset`);
154
+ if (preset !== undefined) {
155
+ spec.preset = preset;
156
+ }
152
157
 
153
158
  if (record.settings !== undefined) {
154
159
  const settings = expectRecord(record.settings, `${path}.settings`);