@foresthubai/workflow-core 0.4.3 → 0.4.5
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 +202 -202
- package/NOTICE +14 -14
- package/README.md +63 -63
- package/dist/api/deployment.d.ts +74 -0
- package/dist/api/deployment.d.ts.map +1 -0
- package/dist/api/deployment.js +6 -0
- package/dist/api/deployment.js.map +1 -0
- package/dist/api/engine.d.ts +744 -0
- package/dist/api/engine.d.ts.map +1 -0
- package/dist/api/engine.js +6 -0
- package/dist/api/engine.js.map +1 -0
- package/dist/api/index.d.ts +4 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +2 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/workflow.d.ts +25 -9
- package/dist/api/workflow.d.ts.map +1 -1
- package/dist/channel/Channel.d.ts +1 -1
- package/dist/channel/Channel.d.ts.map +1 -1
- package/dist/channel/Channel.js +3 -1
- package/dist/channel/Channel.js.map +1 -1
- package/dist/channel/ChannelDefinition.d.ts.map +1 -1
- package/dist/channel/ChannelDefinition.js +24 -0
- package/dist/channel/ChannelDefinition.js.map +1 -1
- package/dist/channel/index.d.ts.map +1 -1
- package/dist/channel/index.js +2 -0
- package/dist/channel/index.js.map +1 -1
- package/dist/channel/serialization.d.ts.map +1 -1
- package/dist/channel/serialization.js +8 -0
- package/dist/channel/serialization.js.map +1 -1
- package/dist/deploy/index.d.ts +5 -1
- package/dist/deploy/index.d.ts.map +1 -1
- package/dist/deploy/index.js +4 -1
- package/dist/deploy/index.js.map +1 -1
- package/dist/deploy/inputs.d.ts +26 -0
- package/dist/deploy/inputs.d.ts.map +1 -0
- package/dist/deploy/inputs.js +4 -0
- package/dist/deploy/inputs.js.map +1 -0
- package/dist/deploy/requirements.d.ts +24 -0
- package/dist/deploy/requirements.d.ts.map +1 -1
- package/dist/deploy/requirements.js +63 -0
- package/dist/deploy/requirements.js.map +1 -1
- package/dist/deploy/spec.d.ts +27 -0
- package/dist/deploy/spec.d.ts.map +1 -0
- package/dist/deploy/spec.js +352 -0
- package/dist/deploy/spec.js.map +1 -0
- package/dist/diagnostics/__fixtures__/diagnosticFixtures.d.ts.map +1 -1
- package/dist/diagnostics/__fixtures__/diagnosticFixtures.js +2 -0
- package/dist/diagnostics/__fixtures__/diagnosticFixtures.js.map +1 -1
- package/dist/diagnostics/diagnostics.d.ts.map +1 -1
- package/dist/diagnostics/diagnostics.js +2 -0
- package/dist/diagnostics/diagnostics.js.map +1 -1
- package/dist/diagnostics/index.d.ts.map +1 -1
- package/dist/diagnostics/index.js +2 -0
- package/dist/diagnostics/index.js.map +1 -1
- package/dist/edge/Edge.d.ts.map +1 -1
- package/dist/edge/Edge.js +2 -0
- package/dist/edge/Edge.js.map +1 -1
- package/dist/edge/EdgeDefinition.d.ts.map +1 -1
- package/dist/edge/EdgeDefinition.js +2 -0
- package/dist/edge/EdgeDefinition.js.map +1 -1
- package/dist/edge/EdgeType.d.ts.map +1 -1
- package/dist/edge/EdgeType.js +2 -0
- package/dist/edge/EdgeType.js.map +1 -1
- package/dist/edge/index.d.ts.map +1 -1
- package/dist/edge/index.js +2 -2
- package/dist/edge/index.js.map +1 -1
- package/dist/edge/serialization.d.ts.map +1 -1
- package/dist/edge/serialization.js +2 -0
- package/dist/edge/serialization.js.map +1 -1
- package/dist/expression/index.d.ts.map +1 -1
- package/dist/expression/index.js +2 -0
- package/dist/expression/index.js.map +1 -1
- package/dist/expression/parser.d.ts.map +1 -1
- package/dist/expression/parser.js +2 -0
- package/dist/expression/parser.js.map +1 -1
- package/dist/expression/types.d.ts.map +1 -1
- package/dist/expression/types.js +2 -0
- package/dist/expression/types.js.map +1 -1
- package/dist/function/FunctionDeclaration.d.ts.map +1 -1
- package/dist/function/FunctionDeclaration.js +2 -0
- package/dist/function/FunctionDeclaration.js.map +1 -1
- package/dist/function/index.d.ts.map +1 -1
- package/dist/function/index.js +2 -0
- package/dist/function/index.js.map +1 -1
- package/dist/function/serialization.d.ts.map +1 -1
- package/dist/function/serialization.js +2 -0
- package/dist/function/serialization.js.map +1 -1
- package/dist/id/index.d.ts.map +1 -1
- package/dist/id/index.js +2 -0
- package/dist/id/index.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/memory/Memory.d.ts.map +1 -1
- package/dist/memory/Memory.js +2 -0
- package/dist/memory/Memory.js.map +1 -1
- package/dist/memory/MemoryDefinition.d.ts.map +1 -1
- package/dist/memory/MemoryDefinition.js +2 -0
- package/dist/memory/MemoryDefinition.js.map +1 -1
- package/dist/memory/MemoryFileDefinition.d.ts.map +1 -1
- package/dist/memory/MemoryFileDefinition.js +2 -0
- package/dist/memory/MemoryFileDefinition.js.map +1 -1
- package/dist/memory/MemoryRegistry.d.ts.map +1 -1
- package/dist/memory/MemoryRegistry.js +2 -0
- package/dist/memory/MemoryRegistry.js.map +1 -1
- package/dist/memory/VectorDatabaseDefinition.d.ts.map +1 -1
- package/dist/memory/VectorDatabaseDefinition.js +2 -0
- package/dist/memory/VectorDatabaseDefinition.js.map +1 -1
- package/dist/memory/index.d.ts.map +1 -1
- package/dist/memory/index.js +2 -0
- package/dist/memory/index.js.map +1 -1
- package/dist/memory/serialization.d.ts.map +1 -1
- package/dist/memory/serialization.js +2 -0
- package/dist/memory/serialization.js.map +1 -1
- package/dist/migration/index.d.ts.map +1 -1
- package/dist/migration/index.js +2 -0
- package/dist/migration/index.js.map +1 -1
- package/dist/migration/migrate.d.ts.map +1 -1
- package/dist/migration/migrate.js +2 -0
- package/dist/migration/migrate.js.map +1 -1
- package/dist/migration/migrations.d.ts.map +1 -1
- package/dist/migration/migrations.js +2 -0
- package/dist/migration/migrations.js.map +1 -1
- package/dist/migration/version.d.ts.map +1 -1
- package/dist/migration/version.js +2 -0
- package/dist/migration/version.js.map +1 -1
- package/dist/model/LLMModelDefinition.d.ts.map +1 -1
- package/dist/model/LLMModelDefinition.js +2 -0
- package/dist/model/LLMModelDefinition.js.map +1 -1
- package/dist/model/Model.d.ts.map +1 -1
- package/dist/model/Model.js +2 -13
- package/dist/model/Model.js.map +1 -1
- package/dist/model/ModelDefinition.d.ts.map +1 -1
- package/dist/model/ModelDefinition.js +2 -0
- package/dist/model/ModelDefinition.js.map +1 -1
- package/dist/model/ModelRegistry.d.ts.map +1 -1
- package/dist/model/ModelRegistry.js +2 -0
- package/dist/model/ModelRegistry.js.map +1 -1
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/index.js +2 -0
- package/dist/model/index.js.map +1 -1
- package/dist/model/serialization.d.ts.map +1 -1
- package/dist/model/serialization.js +2 -0
- package/dist/model/serialization.js.map +1 -1
- package/dist/node/AgentNode.d.ts.map +1 -1
- package/dist/node/AgentNode.js +2 -0
- package/dist/node/AgentNode.js.map +1 -1
- package/dist/node/DataNode.d.ts.map +1 -1
- package/dist/node/DataNode.js +2 -0
- package/dist/node/DataNode.js.map +1 -1
- package/dist/node/FunctionNode.d.ts.map +1 -1
- package/dist/node/FunctionNode.js +2 -0
- package/dist/node/FunctionNode.js.map +1 -1
- package/dist/node/InputNode.d.ts.map +1 -1
- package/dist/node/InputNode.js +2 -0
- package/dist/node/InputNode.js.map +1 -1
- package/dist/node/LogicNode.d.ts.map +1 -1
- package/dist/node/LogicNode.js +2 -0
- package/dist/node/LogicNode.js.map +1 -1
- package/dist/node/MqttNode.d.ts.map +1 -1
- package/dist/node/MqttNode.js +2 -0
- package/dist/node/MqttNode.js.map +1 -1
- package/dist/node/Node.d.ts.map +1 -1
- package/dist/node/Node.js +2 -7
- package/dist/node/Node.js.map +1 -1
- package/dist/node/NodeDefinition.d.ts.map +1 -1
- package/dist/node/NodeDefinition.js +2 -0
- package/dist/node/NodeDefinition.js.map +1 -1
- package/dist/node/NodeRegistry.d.ts.map +1 -1
- package/dist/node/NodeRegistry.js +2 -0
- package/dist/node/NodeRegistry.js.map +1 -1
- package/dist/node/OutputNode.d.ts.map +1 -1
- package/dist/node/OutputNode.js +4 -2
- package/dist/node/OutputNode.js.map +1 -1
- package/dist/node/ToolNode.d.ts.map +1 -1
- package/dist/node/ToolNode.js +2 -0
- package/dist/node/ToolNode.js.map +1 -1
- package/dist/node/TriggerNode.d.ts.map +1 -1
- package/dist/node/TriggerNode.js +2 -0
- package/dist/node/TriggerNode.js.map +1 -1
- package/dist/node/constants.d.ts.map +1 -1
- package/dist/node/constants.js +2 -0
- package/dist/node/constants.js.map +1 -1
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +2 -0
- package/dist/node/index.js.map +1 -1
- package/dist/node/methods.d.ts.map +1 -1
- package/dist/node/methods.js +2 -0
- package/dist/node/methods.js.map +1 -1
- package/dist/node/serialization.d.ts.map +1 -1
- package/dist/node/serialization.js +33 -13
- package/dist/node/serialization.js.map +1 -1
- package/dist/parameter/OutputParameter.d.ts.map +1 -1
- package/dist/parameter/OutputParameter.js +2 -0
- package/dist/parameter/OutputParameter.js.map +1 -1
- package/dist/parameter/Parameter.d.ts.map +1 -1
- package/dist/parameter/Parameter.js +2 -0
- package/dist/parameter/Parameter.js.map +1 -1
- package/dist/parameter/index.d.ts.map +1 -1
- package/dist/parameter/index.js +2 -0
- package/dist/parameter/index.js.map +1 -1
- package/dist/variable/Variable.d.ts.map +1 -1
- package/dist/variable/Variable.js +2 -0
- package/dist/variable/Variable.js.map +1 -1
- package/dist/variable/index.d.ts.map +1 -1
- package/dist/variable/index.js +2 -3
- package/dist/variable/index.js.map +1 -1
- package/dist/variable/operations.d.ts.map +1 -1
- package/dist/variable/operations.js +2 -0
- package/dist/variable/operations.js.map +1 -1
- package/dist/workflow/Workflow.d.ts.map +1 -1
- package/dist/workflow/Workflow.js +2 -0
- package/dist/workflow/Workflow.js.map +1 -1
- package/dist/workflow/index.d.ts.map +1 -1
- package/dist/workflow/index.js +2 -0
- package/dist/workflow/index.js.map +1 -1
- package/dist/workflow/serialization.d.ts.map +1 -1
- package/dist/workflow/serialization.js +2 -4
- package/dist/workflow/serialization.js.map +1 -1
- package/package.json +2 -2
- package/src/api/deployment.ts +74 -0
- package/src/api/engine.ts +744 -0
- package/src/api/index.ts +29 -11
- package/src/api/workflow.ts +25 -9
- package/src/channel/Channel.ts +14 -11
- package/src/channel/ChannelDefinition.ts +101 -76
- package/src/channel/index.ts +9 -6
- package/src/channel/serialization.ts +77 -68
- package/src/deploy/index.ts +17 -1
- package/src/deploy/inputs.ts +44 -0
- package/src/deploy/requirements.test.ts +64 -61
- package/src/deploy/requirements.ts +159 -41
- package/src/deploy/spec.test.ts +227 -0
- package/src/deploy/spec.ts +397 -0
- package/src/diagnostics/__fixtures__/diagnosticFixtures.ts +161 -158
- package/src/diagnostics/diagnostics.test.ts +881 -878
- package/src/diagnostics/diagnostics.ts +939 -936
- package/src/diagnostics/index.ts +14 -11
- package/src/edge/Edge.ts +26 -23
- package/src/edge/EdgeDefinition.ts +48 -45
- package/src/edge/EdgeType.ts +22 -19
- package/src/edge/index.ts +11 -8
- package/src/edge/serialization.ts +86 -83
- package/src/expression/index.ts +7 -4
- package/src/expression/parser.ts +365 -362
- package/src/expression/types.ts +33 -30
- package/src/function/FunctionDeclaration.ts +57 -54
- package/src/function/index.ts +6 -3
- package/src/function/serialization.ts +43 -40
- package/src/globals.d.ts +12 -9
- package/src/id/index.ts +11 -8
- package/src/index.ts +25 -22
- package/src/memory/Memory.ts +18 -15
- package/src/memory/MemoryDefinition.ts +19 -16
- package/src/memory/MemoryFileDefinition.ts +40 -37
- package/src/memory/MemoryRegistry.ts +38 -35
- package/src/memory/VectorDatabaseDefinition.ts +24 -21
- package/src/memory/index.ts +11 -8
- package/src/memory/serialization.ts +50 -47
- package/src/migration/index.ts +7 -4
- package/src/migration/migrate.test.ts +47 -44
- package/src/migration/migrate.ts +61 -58
- package/src/migration/migrations.ts +27 -24
- package/src/migration/version.ts +12 -9
- package/src/model/LLMModelDefinition.ts +15 -12
- package/src/model/Model.ts +42 -39
- package/src/model/ModelDefinition.ts +18 -15
- package/src/model/ModelRegistry.ts +36 -33
- package/src/model/index.ts +10 -7
- package/src/model/serialization.ts +33 -30
- package/src/node/AgentNode.ts +85 -82
- package/src/node/DataNode.ts +44 -41
- package/src/node/FunctionNode.ts +79 -76
- package/src/node/InputNode.ts +188 -185
- package/src/node/LogicNode.ts +36 -33
- package/src/node/MqttNode.ts +130 -127
- package/src/node/Node.ts +64 -61
- package/src/node/NodeDefinition.ts +40 -37
- package/src/node/NodeRegistry.ts +88 -85
- package/src/node/OutputNode.ts +90 -87
- package/src/node/ToolNode.ts +35 -32
- package/src/node/TriggerNode.ts +275 -272
- package/src/node/constants.ts +19 -16
- package/src/node/index.ts +29 -26
- package/src/node/methods.ts +281 -278
- package/src/node/serialization.test.ts +51 -0
- package/src/node/serialization.ts +565 -544
- package/src/parameter/OutputParameter.ts +71 -68
- package/src/parameter/Parameter.ts +246 -243
- package/src/parameter/index.ts +36 -33
- package/src/variable/Variable.ts +13 -10
- package/src/variable/index.ts +19 -16
- package/src/variable/operations.ts +109 -106
- package/src/workflow/Workflow.ts +44 -41
- package/src/workflow/index.ts +6 -3
- package/src/workflow/serialization.test.ts +243 -240
- package/src/workflow/serialization.ts +245 -242
|
@@ -1,68 +1,71 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
*
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (c) 2026 ForestHub.
|
|
3
|
+
|
|
4
|
+
import type { Reference } from "../api";
|
|
5
|
+
import { DataType, FromArgs, unwrapFromArgs } from "./Parameter";
|
|
6
|
+
|
|
7
|
+
// ============================================================================
|
|
8
|
+
// RUNTIME VALUES
|
|
9
|
+
// ============================================================================
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Runtime binding stored for a static output. `active=false` means the output
|
|
13
|
+
* is discarded — no variable is produced or assigned. mode/name/target are kept
|
|
14
|
+
* as draft state when inactive so the row can round-trip through an off→on
|
|
15
|
+
* toggle without losing the user's prior choice. The slot's dataType comes from
|
|
16
|
+
* the StaticOutput definition — not carried here.
|
|
17
|
+
*/
|
|
18
|
+
export type OutputBinding = { active: boolean; mode: "emit"; name: string } | { active: boolean; mode: "assign"; target: Reference };
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Runtime entry stored in a list output. Each entry is a user-authored
|
|
22
|
+
* output declaration: either a new variable (emit) with its own uid/name/dataType,
|
|
23
|
+
* or a routing to an existing variable (assign). `name` doubles as the JSON
|
|
24
|
+
* property name in the LLM's structured response and (for emit) the new
|
|
25
|
+
* variable's display name in canvas scope; it must be non-empty and unique
|
|
26
|
+
* within the OutputList parameter (validated by diagnostics).
|
|
27
|
+
*
|
|
28
|
+
* Unlike OutputBinding, the slot's dataType is carried on the declaration
|
|
29
|
+
* itself as a contract — staleness against the target (assign mode) is a
|
|
30
|
+
* diagnostic, not a silent retype. No "discard" mode: removing the entry is
|
|
31
|
+
* how you discard it.
|
|
32
|
+
*/
|
|
33
|
+
export type OutputDeclaration =
|
|
34
|
+
| { mode: "emit"; uid: string; name: string; dataType: DataType }
|
|
35
|
+
| { mode: "assign"; name: string; dataType: DataType; target: Reference };
|
|
36
|
+
|
|
37
|
+
// ============================================================================
|
|
38
|
+
// OUTPUT PARAMETER DEFINITIONS
|
|
39
|
+
// ============================================================================
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* A fixed output produced by every instance of this node type. The `id` is
|
|
43
|
+
* both the field name inside `node.arguments` where the OutputBinding lives
|
|
44
|
+
* and the default emit variable name (overridable via the binding's `name`).
|
|
45
|
+
* The dataType may be static or an args-derived lambda.
|
|
46
|
+
*/
|
|
47
|
+
export interface StaticOutput {
|
|
48
|
+
id: string;
|
|
49
|
+
label: string;
|
|
50
|
+
type: "static";
|
|
51
|
+
dataType: FromArgs<DataType>;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Resolve a StaticOutput's dataType for the current node arguments. */
|
|
55
|
+
export function resolveStaticOutputDataType(output: StaticOutput, args: Record<string, unknown>): DataType {
|
|
56
|
+
return unwrapFromArgs(output.dataType, args);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* A user-managed list of outputs. Entries live in `node.arguments[id]` as
|
|
61
|
+
* `OutputDeclaration[]` — the UI CRUDs the list directly, and each entry
|
|
62
|
+
* contributes one output. Used for Agent's outputDeclarations.
|
|
63
|
+
*/
|
|
64
|
+
export interface OutputList {
|
|
65
|
+
id: string;
|
|
66
|
+
label: string;
|
|
67
|
+
type: "list";
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** Output parameters mirror input parameters: intersected with ParameterBase for id/label/etc. */
|
|
71
|
+
export type OutputParameter = StaticOutput | OutputList;
|