@fractal-solutions/qflow 2.0.0-canary.4 → 2.0.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/CHANGELOG.md CHANGED
@@ -1,107 +1,119 @@
1
- # Changelog
2
-
3
- ## 2.0.0-canary.4
4
-
5
- Six production gaps closed. Every item below is additive; no existing import
6
- changes. See [MIGRATION.md](MIGRATION.md) and the
7
- [tutorial index](documentation/tutorials/README.md) for step-by-step guides with
8
- option and error-code tables.
9
-
10
- ### Added
11
- - **Durable human approval** (`./approval`): `WaitForApprovalNode` and `resolveApprovalId()`; `DurableFlow` returns `status: 'suspended'` and checkpointer `approve()` / `reject()` record decisions for resumable runs. Events: `approval:requested`, `approval:resolved`, `approval:pending`; error `QFLOW_APPROVAL_PENDING`.
12
- - **Durable scheduling** (`./schedule`): `ScheduleNode` with `at` / `delayMs` / `cron`, a dependency-free `nextCronTime()`, `listScheduledRuns()` / `setRunDueAt()` and `status: 'scheduled'`. Events: `schedule:waiting`, `schedule:pending`; error `QFLOW_SCHEDULE_PENDING`.
13
- - **Deterministic LLM replay**: `LLMNode` cache support (`cache`, `cacheKey`, `cacheTtlMs`), checkpointer-backed `cacheGet` / `cacheSet` / `clearCache`, and the `llm:cache_hit` event.
14
- - **Budget guardrails** (`./budget`): `BudgetTracker`, `BudgetNode` and `BudgetExceededError` (`QFLOW_BUDGET_EXCEEDED`), with `budget:check` / `budget:exceeded` events and `continue` / `exceeded` routing.
15
- - **Unified memory** (`./memory`): `MemoryStore`, `InMemoryMemoryStore`, `SQLiteMemoryStore` and `MemoryStoreNode` with add/search/get/delete/list/clear operations and `memory:add` / `memory:search` events.
16
- - **Flow versioning**: `DurableFlow` `version`, `onVersionMismatch` (`abort` / `migrate` / `ignore`) and `migrate` callback; `FlowVersionMismatchError` (`QFLOW_FLOW_VERSION_MISMATCH`) plus `flow:version_migrated`, `flow:version_mismatch` and `flow:node_remapped` events.
17
- - **Side-effect worker leases**: `workerId` / `leaseMs` on checkpointer, flow and replay-safe nodes; atomic `INSERT OR IGNORE` reservations, `failSideEffect()` and `SideEffectClaimedError` (`QFLOW_SIDE_EFFECT_CLAIMED`).
18
- - New subpath exports: `./approval`, `./schedule`, `./budget`, `./memory`; durable helpers and errors are re-exported from `/durable`, and all new nodes from `/nodes`.
19
- - Tutorial index plus five new tutorials: approval, scheduling, LLM replay, budget guardrails and multi-tenant memory.
20
-
21
- ### Changed
22
- - `runDurable()` now returns `status` (`completed`, `suspended`, `scheduled`) in addition to `{runId, result, shared, steps, resumed}`; ordinary failures still throw.
23
- - `SQLiteCheckpointer` constructor accepts `{workerId, leaseMs}` and migrates older databases by adding the new columns.
24
- - `DurableFlow` re-enters a waiting node on resume and reads recorded approval/schedule state from `shared` and SQLite.
25
- - `ReplaySafeNode` and `withReplaySafeSideEffect()` accept `workerId` / `leaseMs`.
26
- - Version bumped to `2.0.0-canary.4`.
27
-
28
- ### Fixed
29
- - An expired or competing side-effect reservation can no longer be reset by another worker's upsert.
30
- - Stale resume cursors fall back to the saved node class name instead of silently starting over.
31
- - `MIGRATION.md` expanded into a guided reference; README now maps every production gap to 1-2-3 steps and links to the tutorials.
32
-
33
- ### Tests
34
- - 18 new tests across `tests/durable_gaps.test.js` and `tests/node_gaps.test.js`; full suite: 92 passing tests across 18 files.
35
-
36
- ## 2.0.0-canary.3
37
-
38
- ### Added
39
- - Provider-neutral `LLMNode` (`./llm`): adapter registry for OpenAI-compatible providers, Anthropic, Ollama and Gemini, capability negotiation, streaming, tool calls, retries/fallbacks, token/cost accounting and `llm:*` events.
40
- - `ToolSpec` / `ToolRegistry` (`./tool-spec`): one portable definition for agent tools, MCP tools, LLM schemas and generated docs, with namespaces, capability/permission grants, dry-run, timeouts and idempotency caching.
41
- - Replay-safe side effects (`./side-effects`): `ReplaySafeNode`, `withReplaySafeSideEffect()` and `SideEffectUncertainError`; SQLite `qflow_side_effects` reservations on `DurableFlow`.
42
- - Opt-in `operationId` support on `HttpRequestNode`, `GitNode`, `WebHookNode` and `DatabaseNode` so completed effects replay instead of re-running.
43
- - Dataflow nodes in `./graph`: `MapNode`, `ReduceNode`, `JoinNode`, `BranchNode`, `CycleNode` and `describeGraph()`; `./contracts` adds `StateContract` / `defineState()` validation.
44
- - Agent-native nodes (`./agent`): `PlanNode`, `CriticNode`, `ReflectNode`, `FinishNode`, `HumanApprovalNode`, plus `AgentEngine.asFlow()` and `strategyGraph()`.
45
- - Evaluation nodes (`./eval`): `AssertNode`, `ScoreNode`, `CompareNode`, `ReplayNode`, `compareTraces()`, `deepDiff()` and `createEvalSuite()`.
46
- - Bun-native nodes (`./bun`): `BunSpawnNode`, `SQLiteQueryNode`, `FileWatchNode`, `StreamTransformNode`, `StreamMapNode`, `StreamFilterNode` and `StreamReduceNode`.
47
- - New subpath exports: `./llm`, `./tool-spec`, `./contracts`, `./side-effects`, `./eval`, `./bun`; new node families are also re-exported from `./nodes` / `./agent`.
48
- - Tests for every new family; the suite now has 74 passing tests.
49
- - Four offline end-to-end examples in `examples/v2/` (with `bun run examples:v2`) showing replay-safe checkout, one tool spec across agent/MCP/docs, dataflow trace replay, and Bun-native ingest.
50
-
51
- ### Changed
52
- - `AgentEngine` accepts `toolRegistry`, `grantedCapabilities` and `grantedPermissions`, and shares one `initialize()` path with `asFlow()`.
53
- - `QFlowMCPServer` can be constructed with `{ toolRegistry }` and call tools through the registry execute path.
54
- - `ReplayNode` compares status/events/spans by default; saved checkpoints are treated as input metadata, not replay output.
55
- - Version bumped to `2.0.0-canary.3`.
56
-
57
- ### Fixed
58
- - `StateContract` no longer shadows its own `validate()` method when a custom validator is supplied.
59
- - `ToolRegistry.allowed()` accepts capability/permission arrays as well as sets.
60
- - `DurableFlow` retries from the start node when a run failed before its first checkpoint, and persists object-valued node actions as JSON.
61
- - `AgentFlowFinishNode` now returns the flow's final output instead of an empty string.
62
-
63
- ## 2.0.0-canary.2
64
-
65
- ### Added
66
- - Site trace viewer at `#trace`: paste, upload, filter, inspect, and download flow/durable-run traces.
67
- - `./trace` export: `normalizeTrace()`, `buildTraceSpans()`, `serializeTrace()` and `writeTraceFile()`.
68
- - `SQLiteCheckpointer.exportRunTrace()` / `createRunTrace()` for viewer-friendly durable traces.
69
- - `./optional` export exposing the optional dependency map and `loadOptional()`.
70
- - `./logger` export, matching the documented per-node logging API.
71
-
72
- ### Changed
73
- - Heavy integration packages are now `optionalDependencies` and load only when their node action runs.
74
- - Missing optional packages throw `QFLOW_OPTIONAL_DEPENDENCY_MISSING` with an exact `bun add --optional ...` command.
75
- - README examples and 2.0 export documentation were updated; Bun-only installation is now explicit.
76
-
77
- ### Fixed
78
- - `Flow.run()` test example asserted the wrong return value.
79
- - Per-node logging with `type: 'none'` now actually disables output.
80
- - Logger module uses ESM imports instead of `require()`.
81
-
82
- ## 2.0.0-canary.1
83
-
84
- ### Added
85
- - MCP bridge: `QFlowMCPServer`, `MCPClientNode`, `qflow-mcp` stdio binary, and the `./mcp` export.
86
- - Unified agent engine with declarative `default`, `raor`, `ooda`, `lpavrl`, and `pema` strategies plus the `./agent` export.
87
- - First-class flow events: nodes receive an observer, flows support `onAny()`, nested events are forwarded.
88
- - Streaming LLM support: `streamChatCompletions()`, `StreamingLLMNode`, `AgentStreamingLLMNode`, and `llm:*` events under `./streaming`.
89
- - Bun-native durable execution: `SQLiteCheckpointer`, `DurableFlow`, resume-after-failure, run/checkpoint history, and `AbortSignal` cancellation under `./durable`.
90
- - Testing utilities under `./testing`: `MockNode`, `MockLLMNode`, `recordFlow()` and deterministic trace snapshots.
91
- - Graph semantics: `FanOutNode` / `FanInNode` under `./graph`, plus `maxSteps`, `timeout` and `onError` flow options.
92
- - Migration guide for 2.0.
93
-
94
- ### Changed
95
- - Async lifecycle methods accept an optional observer as their final argument.
96
- - `AgentEngine` forwards the flow observer to its LLM node, so streamed agent output reaches the outer flow.
97
- - Bumped version to `2.0.0-canary.1`.
98
- - Replaced the stale LGPL-2.1 `LICENSE` with MIT.
99
-
100
- ### Fixed
101
- - Missing `SummarizeNode` imports and custom-tool validation in the agent engine.
102
- - Circular imports caused by five nodes importing `nodes/index.js`.
103
- - Tool registry imports and consumer config resolution used by the MCP bridge.
104
-
105
- ## 1.0.84
106
-
107
- Previous 1.x release.
1
+ # Changelog
2
+
3
+ ## 2.0.0
4
+
5
+ Stable promotion of `2.0.0-canary.4`. No source changes from the final canary;
6
+ the same package is now published as `latest`.
7
+
8
+ ### Changed
9
+ - Version bumped to `2.0.0`; the npm `latest` dist-tag now points here.
10
+ - README and MIGRATION.md describe the stable install path. The `canary` dist-tag still points to `2.0.0-canary.4`.
11
+ - MCP client/server metadata now reports `2.0.0`.
12
+
13
+ See [2.0.0-canary.4](#200-canary4) below for the full feature list.
14
+
15
+ ## 2.0.0-canary.4
16
+
17
+ Six production gaps closed. Every item below is additive; no existing import
18
+ changes. See [MIGRATION.md](MIGRATION.md) and the
19
+ [tutorial index](documentation/tutorials/README.md) for step-by-step guides with
20
+ option and error-code tables.
21
+
22
+ ### Added
23
+ - **Durable human approval** (`./approval`): `WaitForApprovalNode` and `resolveApprovalId()`; `DurableFlow` returns `status: 'suspended'` and checkpointer `approve()` / `reject()` record decisions for resumable runs. Events: `approval:requested`, `approval:resolved`, `approval:pending`; error `QFLOW_APPROVAL_PENDING`.
24
+ - **Durable scheduling** (`./schedule`): `ScheduleNode` with `at` / `delayMs` / `cron`, a dependency-free `nextCronTime()`, `listScheduledRuns()` / `setRunDueAt()` and `status: 'scheduled'`. Events: `schedule:waiting`, `schedule:pending`; error `QFLOW_SCHEDULE_PENDING`.
25
+ - **Deterministic LLM replay**: `LLMNode` cache support (`cache`, `cacheKey`, `cacheTtlMs`), checkpointer-backed `cacheGet` / `cacheSet` / `clearCache`, and the `llm:cache_hit` event.
26
+ - **Budget guardrails** (`./budget`): `BudgetTracker`, `BudgetNode` and `BudgetExceededError` (`QFLOW_BUDGET_EXCEEDED`), with `budget:check` / `budget:exceeded` events and `continue` / `exceeded` routing.
27
+ - **Unified memory** (`./memory`): `MemoryStore`, `InMemoryMemoryStore`, `SQLiteMemoryStore` and `MemoryStoreNode` with add/search/get/delete/list/clear operations and `memory:add` / `memory:search` events.
28
+ - **Flow versioning**: `DurableFlow` `version`, `onVersionMismatch` (`abort` / `migrate` / `ignore`) and `migrate` callback; `FlowVersionMismatchError` (`QFLOW_FLOW_VERSION_MISMATCH`) plus `flow:version_migrated`, `flow:version_mismatch` and `flow:node_remapped` events.
29
+ - **Side-effect worker leases**: `workerId` / `leaseMs` on checkpointer, flow and replay-safe nodes; atomic `INSERT OR IGNORE` reservations, `failSideEffect()` and `SideEffectClaimedError` (`QFLOW_SIDE_EFFECT_CLAIMED`).
30
+ - New subpath exports: `./approval`, `./schedule`, `./budget`, `./memory`; durable helpers and errors are re-exported from `/durable`, and all new nodes from `/nodes`.
31
+ - Tutorial index plus five new tutorials: approval, scheduling, LLM replay, budget guardrails and multi-tenant memory.
32
+
33
+ ### Changed
34
+ - `runDurable()` now returns `status` (`completed`, `suspended`, `scheduled`) in addition to `{runId, result, shared, steps, resumed}`; ordinary failures still throw.
35
+ - `SQLiteCheckpointer` constructor accepts `{workerId, leaseMs}` and migrates older databases by adding the new columns.
36
+ - `DurableFlow` re-enters a waiting node on resume and reads recorded approval/schedule state from `shared` and SQLite.
37
+ - `ReplaySafeNode` and `withReplaySafeSideEffect()` accept `workerId` / `leaseMs`.
38
+ - Version bumped to `2.0.0-canary.4`.
39
+
40
+ ### Fixed
41
+ - An expired or competing side-effect reservation can no longer be reset by another worker's upsert.
42
+ - Stale resume cursors fall back to the saved node class name instead of silently starting over.
43
+ - `MIGRATION.md` expanded into a guided reference; README now maps every production gap to 1-2-3 steps and links to the tutorials.
44
+
45
+ ### Tests
46
+ - 18 new tests across `tests/durable_gaps.test.js` and `tests/node_gaps.test.js`; full suite: 92 passing tests across 18 files.
47
+
48
+ ## 2.0.0-canary.3
49
+
50
+ ### Added
51
+ - Provider-neutral `LLMNode` (`./llm`): adapter registry for OpenAI-compatible providers, Anthropic, Ollama and Gemini, capability negotiation, streaming, tool calls, retries/fallbacks, token/cost accounting and `llm:*` events.
52
+ - `ToolSpec` / `ToolRegistry` (`./tool-spec`): one portable definition for agent tools, MCP tools, LLM schemas and generated docs, with namespaces, capability/permission grants, dry-run, timeouts and idempotency caching.
53
+ - Replay-safe side effects (`./side-effects`): `ReplaySafeNode`, `withReplaySafeSideEffect()` and `SideEffectUncertainError`; SQLite `qflow_side_effects` reservations on `DurableFlow`.
54
+ - Opt-in `operationId` support on `HttpRequestNode`, `GitNode`, `WebHookNode` and `DatabaseNode` so completed effects replay instead of re-running.
55
+ - Dataflow nodes in `./graph`: `MapNode`, `ReduceNode`, `JoinNode`, `BranchNode`, `CycleNode` and `describeGraph()`; `./contracts` adds `StateContract` / `defineState()` validation.
56
+ - Agent-native nodes (`./agent`): `PlanNode`, `CriticNode`, `ReflectNode`, `FinishNode`, `HumanApprovalNode`, plus `AgentEngine.asFlow()` and `strategyGraph()`.
57
+ - Evaluation nodes (`./eval`): `AssertNode`, `ScoreNode`, `CompareNode`, `ReplayNode`, `compareTraces()`, `deepDiff()` and `createEvalSuite()`.
58
+ - Bun-native nodes (`./bun`): `BunSpawnNode`, `SQLiteQueryNode`, `FileWatchNode`, `StreamTransformNode`, `StreamMapNode`, `StreamFilterNode` and `StreamReduceNode`.
59
+ - New subpath exports: `./llm`, `./tool-spec`, `./contracts`, `./side-effects`, `./eval`, `./bun`; new node families are also re-exported from `./nodes` / `./agent`.
60
+ - Tests for every new family; the suite now has 74 passing tests.
61
+ - Four offline end-to-end examples in `examples/v2/` (with `bun run examples:v2`) showing replay-safe checkout, one tool spec across agent/MCP/docs, dataflow trace replay, and Bun-native ingest.
62
+
63
+ ### Changed
64
+ - `AgentEngine` accepts `toolRegistry`, `grantedCapabilities` and `grantedPermissions`, and shares one `initialize()` path with `asFlow()`.
65
+ - `QFlowMCPServer` can be constructed with `{ toolRegistry }` and call tools through the registry execute path.
66
+ - `ReplayNode` compares status/events/spans by default; saved checkpoints are treated as input metadata, not replay output.
67
+ - Version bumped to `2.0.0-canary.3`.
68
+
69
+ ### Fixed
70
+ - `StateContract` no longer shadows its own `validate()` method when a custom validator is supplied.
71
+ - `ToolRegistry.allowed()` accepts capability/permission arrays as well as sets.
72
+ - `DurableFlow` retries from the start node when a run failed before its first checkpoint, and persists object-valued node actions as JSON.
73
+ - `AgentFlowFinishNode` now returns the flow's final output instead of an empty string.
74
+
75
+ ## 2.0.0-canary.2
76
+
77
+ ### Added
78
+ - Site trace viewer at `#trace`: paste, upload, filter, inspect, and download flow/durable-run traces.
79
+ - `./trace` export: `normalizeTrace()`, `buildTraceSpans()`, `serializeTrace()` and `writeTraceFile()`.
80
+ - `SQLiteCheckpointer.exportRunTrace()` / `createRunTrace()` for viewer-friendly durable traces.
81
+ - `./optional` export exposing the optional dependency map and `loadOptional()`.
82
+ - `./logger` export, matching the documented per-node logging API.
83
+
84
+ ### Changed
85
+ - Heavy integration packages are now `optionalDependencies` and load only when their node action runs.
86
+ - Missing optional packages throw `QFLOW_OPTIONAL_DEPENDENCY_MISSING` with an exact `bun add --optional ...` command.
87
+ - README examples and 2.0 export documentation were updated; Bun-only installation is now explicit.
88
+
89
+ ### Fixed
90
+ - `Flow.run()` test example asserted the wrong return value.
91
+ - Per-node logging with `type: 'none'` now actually disables output.
92
+ - Logger module uses ESM imports instead of `require()`.
93
+
94
+ ## 2.0.0-canary.1
95
+
96
+ ### Added
97
+ - MCP bridge: `QFlowMCPServer`, `MCPClientNode`, `qflow-mcp` stdio binary, and the `./mcp` export.
98
+ - Unified agent engine with declarative `default`, `raor`, `ooda`, `lpavrl`, and `pema` strategies plus the `./agent` export.
99
+ - First-class flow events: nodes receive an observer, flows support `onAny()`, nested events are forwarded.
100
+ - Streaming LLM support: `streamChatCompletions()`, `StreamingLLMNode`, `AgentStreamingLLMNode`, and `llm:*` events under `./streaming`.
101
+ - Bun-native durable execution: `SQLiteCheckpointer`, `DurableFlow`, resume-after-failure, run/checkpoint history, and `AbortSignal` cancellation under `./durable`.
102
+ - Testing utilities under `./testing`: `MockNode`, `MockLLMNode`, `recordFlow()` and deterministic trace snapshots.
103
+ - Graph semantics: `FanOutNode` / `FanInNode` under `./graph`, plus `maxSteps`, `timeout` and `onError` flow options.
104
+ - Migration guide for 2.0.
105
+
106
+ ### Changed
107
+ - Async lifecycle methods accept an optional observer as their final argument.
108
+ - `AgentEngine` forwards the flow observer to its LLM node, so streamed agent output reaches the outer flow.
109
+ - Bumped version to `2.0.0-canary.1`.
110
+ - Replaced the stale LGPL-2.1 `LICENSE` with MIT.
111
+
112
+ ### Fixed
113
+ - Missing `SummarizeNode` imports and custom-tool validation in the agent engine.
114
+ - Circular imports caused by five nodes importing `nodes/index.js`.
115
+ - Tool registry imports and consumer config resolution used by the MCP bridge.
116
+
117
+ ## 1.0.84
118
+
119
+ Previous 1.x release.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025-2026 Fractal Solutions
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.
1
+ MIT License
2
+
3
+ Copyright (c) 2025-2026 Fractal Solutions
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.