@foresthubai/workflow-core 0.3.0 → 0.4.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 +202 -202
- package/NOTICE +14 -14
- package/README.md +63 -63
- package/dist/api/workflow.d.ts +2 -2
- package/dist/api/workflow.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/api/index.ts +11 -11
- package/src/api/workflow.ts +607 -607
- package/src/channel/Channel.ts +11 -11
- package/src/channel/ChannelDefinition.ts +76 -76
- package/src/channel/index.ts +6 -6
- package/src/channel/serialization.ts +68 -68
- package/src/deploy/index.ts +1 -1
- package/src/deploy/requirements.test.ts +61 -61
- package/src/deploy/requirements.ts +41 -41
- package/src/diagnostics/__fixtures__/diagnosticFixtures.ts +158 -158
- package/src/diagnostics/diagnostics.test.ts +878 -878
- package/src/diagnostics/diagnostics.ts +936 -936
- package/src/diagnostics/index.ts +11 -11
- package/src/edge/Edge.ts +23 -23
- package/src/edge/EdgeDefinition.ts +45 -45
- package/src/edge/EdgeType.ts +19 -19
- package/src/edge/index.ts +8 -8
- package/src/edge/serialization.ts +83 -83
- package/src/expression/index.ts +4 -4
- package/src/expression/parser.ts +362 -362
- package/src/expression/types.ts +30 -30
- package/src/function/FunctionDeclaration.ts +54 -54
- package/src/function/index.ts +3 -3
- package/src/function/serialization.ts +40 -40
- package/src/globals.d.ts +9 -9
- package/src/id/index.ts +8 -8
- package/src/index.ts +22 -22
- package/src/memory/Memory.ts +15 -15
- package/src/memory/MemoryDefinition.ts +16 -16
- package/src/memory/MemoryFileDefinition.ts +37 -37
- package/src/memory/MemoryRegistry.ts +35 -35
- package/src/memory/VectorDatabaseDefinition.ts +21 -21
- package/src/memory/index.ts +8 -8
- package/src/memory/serialization.ts +47 -47
- package/src/migration/index.ts +4 -4
- package/src/migration/migrate.test.ts +44 -44
- package/src/migration/migrate.ts +58 -58
- package/src/migration/migrations.ts +24 -24
- package/src/migration/version.ts +9 -9
- package/src/model/LLMModelDefinition.ts +12 -12
- package/src/model/Model.ts +39 -39
- package/src/model/ModelDefinition.ts +15 -15
- package/src/model/ModelRegistry.ts +33 -33
- package/src/model/index.ts +7 -7
- package/src/model/serialization.ts +30 -30
- package/src/node/AgentNode.ts +82 -82
- package/src/node/DataNode.ts +41 -41
- package/src/node/FunctionNode.ts +76 -76
- package/src/node/InputNode.ts +185 -185
- package/src/node/LogicNode.ts +33 -33
- package/src/node/MqttNode.ts +127 -127
- package/src/node/Node.ts +61 -61
- package/src/node/NodeDefinition.ts +37 -37
- package/src/node/NodeRegistry.ts +85 -85
- package/src/node/OutputNode.ts +87 -87
- package/src/node/ToolNode.ts +32 -32
- package/src/node/TriggerNode.ts +272 -272
- package/src/node/constants.ts +16 -16
- package/src/node/index.ts +26 -26
- package/src/node/methods.ts +278 -278
- package/src/node/serialization.ts +544 -544
- package/src/parameter/OutputParameter.ts +68 -68
- package/src/parameter/Parameter.ts +243 -243
- package/src/parameter/index.ts +33 -33
- package/src/variable/Variable.ts +10 -10
- package/src/variable/index.ts +16 -16
- package/src/variable/operations.ts +106 -106
- package/src/workflow/Workflow.ts +41 -41
- package/src/workflow/index.ts +3 -3
- package/src/workflow/serialization.test.ts +240 -240
- package/src/workflow/serialization.ts +242 -242
package/src/node/OutputNode.ts
CHANGED
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
import { NodeBase } from "./Node";
|
|
2
|
-
import type { Expression } from "../api";
|
|
3
|
-
import { NodeCategory, NodeTag } from "./constants";
|
|
4
|
-
import { NodeDefinition } from "./NodeDefinition";
|
|
5
|
-
|
|
6
|
-
export interface WritePinNode extends NodeBase {
|
|
7
|
-
type: "WritePin";
|
|
8
|
-
arguments: {
|
|
9
|
-
pinReference: string | undefined;
|
|
10
|
-
signalType: "digital" | "analog";
|
|
11
|
-
value: Expression;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface SerialWriteNode extends NodeBase {
|
|
16
|
-
type: "SerialWrite";
|
|
17
|
-
arguments: {
|
|
18
|
-
portReference: string | undefined;
|
|
19
|
-
value: Expression; // Expression for the value to write
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export type OutputNodeType = "WritePin" | "SerialWrite";
|
|
24
|
-
export type OutputNode = WritePinNode | SerialWriteNode;
|
|
25
|
-
|
|
26
|
-
// Node Definitions
|
|
27
|
-
|
|
28
|
-
export const WritePinNodeDefinition: NodeDefinition = {
|
|
29
|
-
type: "WritePin",
|
|
30
|
-
label: "Write Pin",
|
|
31
|
-
category: NodeCategory.Output,
|
|
32
|
-
tags: [NodeTag.Pin],
|
|
33
|
-
description: "Write data to a pin",
|
|
34
|
-
parameters: [
|
|
35
|
-
{
|
|
36
|
-
id: "pinReference",
|
|
37
|
-
label: "Pin",
|
|
38
|
-
description: "IO pin to write to",
|
|
39
|
-
type: "channelSelect",
|
|
40
|
-
channelType: (args) => ((args as WritePinNode["arguments"]).signalType === "digital" ? ["GPIOOUT"] : ["PWM", "DAC"]),
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
id: "signalType",
|
|
44
|
-
label: "Signal Type",
|
|
45
|
-
description: "Type of signal",
|
|
46
|
-
type: "selection",
|
|
47
|
-
default: "digital",
|
|
48
|
-
options: [
|
|
49
|
-
{ value: "digital", label: "Digital" },
|
|
50
|
-
{ value: "analog", label: "Analog" },
|
|
51
|
-
],
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
id: "value",
|
|
55
|
-
label: "Value",
|
|
56
|
-
description: "What value to write to the pin",
|
|
57
|
-
type: "expression",
|
|
58
|
-
expressionType: (args) => ((args as WritePinNode["arguments"]).signalType === "digital" ? "bool" : "int"),
|
|
59
|
-
default: { expression: "", references: [], dataType: "bool" },
|
|
60
|
-
},
|
|
61
|
-
],
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
export const SerialWriteNodeDefinition: NodeDefinition = {
|
|
65
|
-
type: "SerialWrite",
|
|
66
|
-
label: "Serial Write",
|
|
67
|
-
category: NodeCategory.Output,
|
|
68
|
-
tags: [NodeTag.Serial],
|
|
69
|
-
description: "Write string to serial port",
|
|
70
|
-
parameters: [
|
|
71
|
-
{
|
|
72
|
-
id: "portReference",
|
|
73
|
-
label: "Port",
|
|
74
|
-
description: "Serial port to write to",
|
|
75
|
-
type: "channelSelect",
|
|
76
|
-
channelType: ["UART"],
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
id: "value",
|
|
80
|
-
label: "Value",
|
|
81
|
-
description: "Expression for the value to write",
|
|
82
|
-
type: "expression",
|
|
83
|
-
expressionType: "string",
|
|
84
|
-
default: { expression: "", references: [], dataType: "string" },
|
|
85
|
-
},
|
|
86
|
-
],
|
|
87
|
-
};
|
|
1
|
+
import { NodeBase } from "./Node";
|
|
2
|
+
import type { Expression } from "../api";
|
|
3
|
+
import { NodeCategory, NodeTag } from "./constants";
|
|
4
|
+
import { NodeDefinition } from "./NodeDefinition";
|
|
5
|
+
|
|
6
|
+
export interface WritePinNode extends NodeBase {
|
|
7
|
+
type: "WritePin";
|
|
8
|
+
arguments: {
|
|
9
|
+
pinReference: string | undefined;
|
|
10
|
+
signalType: "digital" | "analog";
|
|
11
|
+
value: Expression;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface SerialWriteNode extends NodeBase {
|
|
16
|
+
type: "SerialWrite";
|
|
17
|
+
arguments: {
|
|
18
|
+
portReference: string | undefined;
|
|
19
|
+
value: Expression; // Expression for the value to write
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type OutputNodeType = "WritePin" | "SerialWrite";
|
|
24
|
+
export type OutputNode = WritePinNode | SerialWriteNode;
|
|
25
|
+
|
|
26
|
+
// Node Definitions
|
|
27
|
+
|
|
28
|
+
export const WritePinNodeDefinition: NodeDefinition = {
|
|
29
|
+
type: "WritePin",
|
|
30
|
+
label: "Write Pin",
|
|
31
|
+
category: NodeCategory.Output,
|
|
32
|
+
tags: [NodeTag.Pin],
|
|
33
|
+
description: "Write data to a pin",
|
|
34
|
+
parameters: [
|
|
35
|
+
{
|
|
36
|
+
id: "pinReference",
|
|
37
|
+
label: "Pin",
|
|
38
|
+
description: "IO pin to write to",
|
|
39
|
+
type: "channelSelect",
|
|
40
|
+
channelType: (args) => ((args as WritePinNode["arguments"]).signalType === "digital" ? ["GPIOOUT"] : ["PWM", "DAC"]),
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: "signalType",
|
|
44
|
+
label: "Signal Type",
|
|
45
|
+
description: "Type of signal",
|
|
46
|
+
type: "selection",
|
|
47
|
+
default: "digital",
|
|
48
|
+
options: [
|
|
49
|
+
{ value: "digital", label: "Digital" },
|
|
50
|
+
{ value: "analog", label: "Analog" },
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
id: "value",
|
|
55
|
+
label: "Value",
|
|
56
|
+
description: "What value to write to the pin",
|
|
57
|
+
type: "expression",
|
|
58
|
+
expressionType: (args) => ((args as WritePinNode["arguments"]).signalType === "digital" ? "bool" : "int"),
|
|
59
|
+
default: { expression: "", references: [], dataType: "bool" },
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const SerialWriteNodeDefinition: NodeDefinition = {
|
|
65
|
+
type: "SerialWrite",
|
|
66
|
+
label: "Serial Write",
|
|
67
|
+
category: NodeCategory.Output,
|
|
68
|
+
tags: [NodeTag.Serial],
|
|
69
|
+
description: "Write string to serial port",
|
|
70
|
+
parameters: [
|
|
71
|
+
{
|
|
72
|
+
id: "portReference",
|
|
73
|
+
label: "Port",
|
|
74
|
+
description: "Serial port to write to",
|
|
75
|
+
type: "channelSelect",
|
|
76
|
+
channelType: ["UART"],
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
id: "value",
|
|
80
|
+
label: "Value",
|
|
81
|
+
description: "Expression for the value to write",
|
|
82
|
+
type: "expression",
|
|
83
|
+
expressionType: "string",
|
|
84
|
+
default: { expression: "", references: [], dataType: "string" },
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
};
|
package/src/node/ToolNode.ts
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { NodeBase } from "./Node";
|
|
2
|
-
import { NodeCategory } from "./constants";
|
|
3
|
-
import { NodeDefinition } from "./NodeDefinition";
|
|
4
|
-
|
|
5
|
-
// Web Search Tool - provides web search capability to agents
|
|
6
|
-
export interface WebSearchToolNode extends NodeBase {
|
|
7
|
-
type: "WebSearchTool";
|
|
8
|
-
arguments: {
|
|
9
|
-
maxResults?: number;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export type ToolNodeType = "WebSearchTool";
|
|
14
|
-
export type ToolNode = WebSearchToolNode;
|
|
15
|
-
|
|
16
|
-
// Node Definitions
|
|
17
|
-
|
|
18
|
-
export const WebSearchToolNodeDefinition: NodeDefinition = {
|
|
19
|
-
type: "WebSearchTool",
|
|
20
|
-
label: "Web Search",
|
|
21
|
-
category: NodeCategory.Tool,
|
|
22
|
-
description: "Provides web search capability to connected agents",
|
|
23
|
-
parameters: [
|
|
24
|
-
{
|
|
25
|
-
id: "maxResults",
|
|
26
|
-
label: "Max Results",
|
|
27
|
-
description: "Maximum number of search results to return per call (capped at 20)",
|
|
28
|
-
type: "int",
|
|
29
|
-
optional: true,
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
};
|
|
1
|
+
import { NodeBase } from "./Node";
|
|
2
|
+
import { NodeCategory } from "./constants";
|
|
3
|
+
import { NodeDefinition } from "./NodeDefinition";
|
|
4
|
+
|
|
5
|
+
// Web Search Tool - provides web search capability to agents
|
|
6
|
+
export interface WebSearchToolNode extends NodeBase {
|
|
7
|
+
type: "WebSearchTool";
|
|
8
|
+
arguments: {
|
|
9
|
+
maxResults?: number;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type ToolNodeType = "WebSearchTool";
|
|
14
|
+
export type ToolNode = WebSearchToolNode;
|
|
15
|
+
|
|
16
|
+
// Node Definitions
|
|
17
|
+
|
|
18
|
+
export const WebSearchToolNodeDefinition: NodeDefinition = {
|
|
19
|
+
type: "WebSearchTool",
|
|
20
|
+
label: "Web Search",
|
|
21
|
+
category: NodeCategory.Tool,
|
|
22
|
+
description: "Provides web search capability to connected agents",
|
|
23
|
+
parameters: [
|
|
24
|
+
{
|
|
25
|
+
id: "maxResults",
|
|
26
|
+
label: "Max Results",
|
|
27
|
+
description: "Maximum number of search results to return per call (capped at 20)",
|
|
28
|
+
type: "int",
|
|
29
|
+
optional: true,
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
};
|