@foresthubai/workflow-core 0.4.2 → 0.4.4

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.
Files changed (120) hide show
  1. package/LICENSE +202 -202
  2. package/NOTICE +14 -14
  3. package/README.md +63 -63
  4. package/dist/api/deployment.d.ts +67 -0
  5. package/dist/api/deployment.d.ts.map +1 -0
  6. package/dist/api/deployment.js +6 -0
  7. package/dist/api/deployment.js.map +1 -0
  8. package/dist/api/engine.d.ts +744 -0
  9. package/dist/api/engine.d.ts.map +1 -0
  10. package/dist/api/engine.js +6 -0
  11. package/dist/api/engine.js.map +1 -0
  12. package/dist/api/index.d.ts +4 -0
  13. package/dist/api/index.d.ts.map +1 -1
  14. package/dist/api/workflow.d.ts +17 -1
  15. package/dist/api/workflow.d.ts.map +1 -1
  16. package/dist/channel/Channel.d.ts +1 -1
  17. package/dist/channel/Channel.d.ts.map +1 -1
  18. package/dist/channel/Channel.js +1 -1
  19. package/dist/channel/Channel.js.map +1 -1
  20. package/dist/channel/ChannelDefinition.d.ts.map +1 -1
  21. package/dist/channel/ChannelDefinition.js +22 -0
  22. package/dist/channel/ChannelDefinition.js.map +1 -1
  23. package/dist/channel/serialization.d.ts.map +1 -1
  24. package/dist/channel/serialization.js +6 -0
  25. package/dist/channel/serialization.js.map +1 -1
  26. package/dist/deploy/index.d.ts +5 -1
  27. package/dist/deploy/index.d.ts.map +1 -1
  28. package/dist/deploy/index.js +2 -1
  29. package/dist/deploy/index.js.map +1 -1
  30. package/dist/deploy/inputs.d.ts +26 -0
  31. package/dist/deploy/inputs.d.ts.map +1 -0
  32. package/dist/deploy/inputs.js +12 -0
  33. package/dist/deploy/inputs.js.map +1 -0
  34. package/dist/deploy/requirements.d.ts +24 -0
  35. package/dist/deploy/requirements.d.ts.map +1 -1
  36. package/dist/deploy/requirements.js +61 -0
  37. package/dist/deploy/requirements.js.map +1 -1
  38. package/dist/deploy/spec.d.ts +32 -0
  39. package/dist/deploy/spec.d.ts.map +1 -0
  40. package/dist/deploy/spec.js +343 -0
  41. package/dist/deploy/spec.js.map +1 -0
  42. package/dist/node/OutputNode.js +2 -2
  43. package/dist/node/OutputNode.js.map +1 -1
  44. package/package.json +2 -2
  45. package/src/api/deployment.ts +67 -0
  46. package/src/api/engine.ts +744 -0
  47. package/src/api/index.ts +26 -11
  48. package/src/api/workflow.ts +17 -1
  49. package/src/channel/Channel.ts +11 -11
  50. package/src/channel/ChannelDefinition.ts +98 -76
  51. package/src/channel/index.ts +6 -6
  52. package/src/channel/serialization.ts +74 -68
  53. package/src/deploy/index.ts +14 -1
  54. package/src/deploy/inputs.ts +41 -0
  55. package/src/deploy/requirements.test.ts +61 -61
  56. package/src/deploy/requirements.ts +156 -41
  57. package/src/deploy/spec.test.ts +226 -0
  58. package/src/deploy/spec.ts +379 -0
  59. package/src/diagnostics/__fixtures__/diagnosticFixtures.ts +158 -158
  60. package/src/diagnostics/diagnostics.test.ts +878 -878
  61. package/src/diagnostics/diagnostics.ts +936 -936
  62. package/src/diagnostics/index.ts +11 -11
  63. package/src/edge/Edge.ts +23 -23
  64. package/src/edge/EdgeDefinition.ts +45 -45
  65. package/src/edge/EdgeType.ts +19 -19
  66. package/src/edge/index.ts +8 -8
  67. package/src/edge/serialization.ts +83 -83
  68. package/src/expression/index.ts +4 -4
  69. package/src/expression/parser.ts +362 -362
  70. package/src/expression/types.ts +30 -30
  71. package/src/function/FunctionDeclaration.ts +54 -54
  72. package/src/function/index.ts +3 -3
  73. package/src/function/serialization.ts +40 -40
  74. package/src/globals.d.ts +9 -9
  75. package/src/id/index.ts +8 -8
  76. package/src/index.ts +22 -22
  77. package/src/memory/Memory.ts +15 -15
  78. package/src/memory/MemoryDefinition.ts +16 -16
  79. package/src/memory/MemoryFileDefinition.ts +37 -37
  80. package/src/memory/MemoryRegistry.ts +35 -35
  81. package/src/memory/VectorDatabaseDefinition.ts +21 -21
  82. package/src/memory/index.ts +8 -8
  83. package/src/memory/serialization.ts +47 -47
  84. package/src/migration/index.ts +4 -4
  85. package/src/migration/migrate.test.ts +44 -44
  86. package/src/migration/migrate.ts +58 -58
  87. package/src/migration/migrations.ts +24 -24
  88. package/src/migration/version.ts +9 -9
  89. package/src/model/LLMModelDefinition.ts +12 -12
  90. package/src/model/Model.ts +39 -39
  91. package/src/model/ModelDefinition.ts +15 -15
  92. package/src/model/ModelRegistry.ts +33 -33
  93. package/src/model/index.ts +7 -7
  94. package/src/model/serialization.ts +30 -30
  95. package/src/node/AgentNode.ts +82 -82
  96. package/src/node/DataNode.ts +41 -41
  97. package/src/node/FunctionNode.ts +76 -76
  98. package/src/node/InputNode.ts +185 -185
  99. package/src/node/LogicNode.ts +33 -33
  100. package/src/node/MqttNode.ts +127 -127
  101. package/src/node/Node.ts +61 -61
  102. package/src/node/NodeDefinition.ts +37 -37
  103. package/src/node/NodeRegistry.ts +85 -85
  104. package/src/node/OutputNode.ts +87 -87
  105. package/src/node/ToolNode.ts +32 -32
  106. package/src/node/TriggerNode.ts +272 -272
  107. package/src/node/constants.ts +16 -16
  108. package/src/node/index.ts +26 -26
  109. package/src/node/methods.ts +278 -278
  110. package/src/node/serialization.ts +544 -544
  111. package/src/parameter/OutputParameter.ts +68 -68
  112. package/src/parameter/Parameter.ts +243 -243
  113. package/src/parameter/index.ts +33 -33
  114. package/src/variable/Variable.ts +10 -10
  115. package/src/variable/index.ts +16 -16
  116. package/src/variable/operations.ts +106 -106
  117. package/src/workflow/Workflow.ts +41 -41
  118. package/src/workflow/index.ts +3 -3
  119. package/src/workflow/serialization.test.ts +240 -240
  120. package/src/workflow/serialization.ts +242 -242
@@ -1,185 +1,185 @@
1
- import { NodeBase } from "./Node";
2
- import type { Expression } from "../api";
3
- import { OutputBinding } from "../parameter";
4
- import { NodeCategory, NodeTag } from "./constants";
5
- import { NodeDefinition } from "./NodeDefinition";
6
-
7
- export interface ReadPinNode extends NodeBase {
8
- type: "ReadPin";
9
- arguments: {
10
- pinReference: string | undefined;
11
- signalType: "digital" | "analog";
12
- output: OutputBinding;
13
- toolDescription?: string;
14
- };
15
- }
16
-
17
- export interface SerialReadNode extends NodeBase {
18
- type: "SerialRead";
19
- arguments: {
20
- portReference: string | undefined;
21
- prompt?: string;
22
- output: OutputBinding;
23
- };
24
- }
25
-
26
- // Retriever - provides RAG retrieval capability to agents
27
- export interface RetrieverNode extends NodeBase {
28
- type: "Retriever";
29
- arguments: {
30
- memoryReference: string;
31
- topK: number | undefined;
32
- query: Expression;
33
- output: OutputBinding;
34
- toolDescription?: string;
35
- };
36
- }
37
-
38
- // WebFetch - fetches a URL and returns extracted text
39
- export interface WebFetchNode extends NodeBase {
40
- type: "WebFetch";
41
- arguments: {
42
- url: Expression;
43
- maxChars: number | undefined;
44
- output: OutputBinding;
45
- };
46
- }
47
-
48
- export type InputNodeType = "ReadPin" | "SerialRead" | "Retriever" | "WebFetch";
49
- export type InputNode = ReadPinNode | SerialReadNode | RetrieverNode | WebFetchNode;
50
-
51
- // Node Definitions
52
-
53
- export const ReadPinNodeDefinition: NodeDefinition = {
54
- type: "ReadPin",
55
- label: "Read Pin",
56
- category: NodeCategory.Input,
57
- tags: [NodeTag.Pin],
58
- description: "Read data from a pin",
59
- outputs: [
60
- {
61
- id: "output",
62
- label: "Pin Value",
63
- type: "static",
64
- dataType: (args) => ((args as ReadPinNode["arguments"]).signalType === "digital" ? "bool" : "int"),
65
- },
66
- ],
67
- parameters: [
68
- {
69
- id: "pinReference",
70
- label: "Pin",
71
- description: "IO pin to read from",
72
- type: "channelSelect",
73
- channelType: (args) => ((args as ReadPinNode["arguments"]).signalType === "digital" ? ["GPIOIN"] : ["ADC"]),
74
- },
75
- {
76
- id: "signalType",
77
- label: "Signal Type",
78
- description: "Type of signal",
79
- type: "selection",
80
- default: "digital",
81
- options: [
82
- { value: "digital", label: "Digital" },
83
- { value: "analog", label: "Analog" },
84
- ],
85
- },
86
- {
87
- id: "toolDescription",
88
- label: "Tool Description",
89
- description: "Description shown to the agent when this node is wired as a tool",
90
- type: "string",
91
- multiline: true,
92
- activationRules: [{ type: "isToolInput" }],
93
- },
94
- ],
95
- };
96
-
97
- export const RetrieverNodeDefinition: NodeDefinition = {
98
- type: "Retriever",
99
- label: "Retriever",
100
- category: NodeCategory.Input,
101
- description: "Retrieves relevant documents from a knowledge base",
102
- outputs: [{ id: "output", label: "Retrieved Documents", type: "static", dataType: "string" }],
103
- parameters: [
104
- {
105
- id: "memoryReference",
106
- label: "Vector Database",
107
- description: "The vector database to search",
108
- type: "memorySelect",
109
- memoryType: ["VectorDatabase"],
110
- },
111
- {
112
- id: "topK",
113
- label: "Top K",
114
- description: "Number of results to retrieve",
115
- type: "int",
116
- default: 5,
117
- },
118
- {
119
- id: "query",
120
- label: "Query",
121
- description: "Search query expression",
122
- type: "expression",
123
- expressionType: "string",
124
- default: { expression: "", references: [], dataType: "string" },
125
- },
126
- {
127
- id: "toolDescription",
128
- label: "Tool Description",
129
- description: "Description shown to the agent when this node is wired as a tool",
130
- type: "string",
131
- multiline: true,
132
- activationRules: [{ type: "isToolInput" }],
133
- },
134
- ],
135
- };
136
-
137
- export const WebFetchNodeDefinition: NodeDefinition = {
138
- type: "WebFetch",
139
- label: "Web Fetch",
140
- category: NodeCategory.Input,
141
- description: "Fetches a URL and returns extracted text",
142
- outputs: [{ id: "output", label: "Fetched Text", type: "static", dataType: "string" }],
143
- parameters: [
144
- {
145
- id: "url",
146
- label: "URL",
147
- description: "URL to fetch (http or https)",
148
- type: "expression",
149
- expressionType: "string",
150
- default: { expression: "", references: [], dataType: "string" },
151
- },
152
- {
153
- id: "maxChars",
154
- label: "Max Characters",
155
- description: "Maximum characters of extracted text to return",
156
- type: "int",
157
- optional: true,
158
- },
159
- ],
160
- };
161
-
162
- export const SerialReadNodeDefinition: NodeDefinition = {
163
- type: "SerialRead",
164
- label: "Serial Read",
165
- category: NodeCategory.Input,
166
- tags: [NodeTag.Serial],
167
- description: "Read string from serial port",
168
- outputs: [{ id: "output", label: "Serial Data", type: "static", dataType: "string" }],
169
- parameters: [
170
- {
171
- id: "portReference",
172
- label: "Port",
173
- description: "Serial port to read from",
174
- type: "channelSelect",
175
- channelType: ["UART"],
176
- },
177
- {
178
- id: "prompt",
179
- label: "Input prompt",
180
- description: "Prompt for the serial read operation",
181
- type: "string",
182
- optional: true,
183
- },
184
- ],
185
- };
1
+ import { NodeBase } from "./Node";
2
+ import type { Expression } from "../api";
3
+ import { OutputBinding } from "../parameter";
4
+ import { NodeCategory, NodeTag } from "./constants";
5
+ import { NodeDefinition } from "./NodeDefinition";
6
+
7
+ export interface ReadPinNode extends NodeBase {
8
+ type: "ReadPin";
9
+ arguments: {
10
+ pinReference: string | undefined;
11
+ signalType: "digital" | "analog";
12
+ output: OutputBinding;
13
+ toolDescription?: string;
14
+ };
15
+ }
16
+
17
+ export interface SerialReadNode extends NodeBase {
18
+ type: "SerialRead";
19
+ arguments: {
20
+ portReference: string | undefined;
21
+ prompt?: string;
22
+ output: OutputBinding;
23
+ };
24
+ }
25
+
26
+ // Retriever - provides RAG retrieval capability to agents
27
+ export interface RetrieverNode extends NodeBase {
28
+ type: "Retriever";
29
+ arguments: {
30
+ memoryReference: string;
31
+ topK: number | undefined;
32
+ query: Expression;
33
+ output: OutputBinding;
34
+ toolDescription?: string;
35
+ };
36
+ }
37
+
38
+ // WebFetch - fetches a URL and returns extracted text
39
+ export interface WebFetchNode extends NodeBase {
40
+ type: "WebFetch";
41
+ arguments: {
42
+ url: Expression;
43
+ maxChars: number | undefined;
44
+ output: OutputBinding;
45
+ };
46
+ }
47
+
48
+ export type InputNodeType = "ReadPin" | "SerialRead" | "Retriever" | "WebFetch";
49
+ export type InputNode = ReadPinNode | SerialReadNode | RetrieverNode | WebFetchNode;
50
+
51
+ // Node Definitions
52
+
53
+ export const ReadPinNodeDefinition: NodeDefinition = {
54
+ type: "ReadPin",
55
+ label: "Read Pin",
56
+ category: NodeCategory.Input,
57
+ tags: [NodeTag.Pin],
58
+ description: "Read data from a pin",
59
+ outputs: [
60
+ {
61
+ id: "output",
62
+ label: "Pin Value",
63
+ type: "static",
64
+ dataType: (args) => ((args as ReadPinNode["arguments"]).signalType === "digital" ? "bool" : "int"),
65
+ },
66
+ ],
67
+ parameters: [
68
+ {
69
+ id: "pinReference",
70
+ label: "Pin",
71
+ description: "IO pin to read from",
72
+ type: "channelSelect",
73
+ channelType: (args) => ((args as ReadPinNode["arguments"]).signalType === "digital" ? ["GPIOIN"] : ["ADC"]),
74
+ },
75
+ {
76
+ id: "signalType",
77
+ label: "Signal Type",
78
+ description: "Type of signal",
79
+ type: "selection",
80
+ default: "digital",
81
+ options: [
82
+ { value: "digital", label: "Digital" },
83
+ { value: "analog", label: "Analog" },
84
+ ],
85
+ },
86
+ {
87
+ id: "toolDescription",
88
+ label: "Tool Description",
89
+ description: "Description shown to the agent when this node is wired as a tool",
90
+ type: "string",
91
+ multiline: true,
92
+ activationRules: [{ type: "isToolInput" }],
93
+ },
94
+ ],
95
+ };
96
+
97
+ export const RetrieverNodeDefinition: NodeDefinition = {
98
+ type: "Retriever",
99
+ label: "Retriever",
100
+ category: NodeCategory.Input,
101
+ description: "Retrieves relevant documents from a knowledge base",
102
+ outputs: [{ id: "output", label: "Retrieved Documents", type: "static", dataType: "string" }],
103
+ parameters: [
104
+ {
105
+ id: "memoryReference",
106
+ label: "Vector Database",
107
+ description: "The vector database to search",
108
+ type: "memorySelect",
109
+ memoryType: ["VectorDatabase"],
110
+ },
111
+ {
112
+ id: "topK",
113
+ label: "Top K",
114
+ description: "Number of results to retrieve",
115
+ type: "int",
116
+ default: 5,
117
+ },
118
+ {
119
+ id: "query",
120
+ label: "Query",
121
+ description: "Search query expression",
122
+ type: "expression",
123
+ expressionType: "string",
124
+ default: { expression: "", references: [], dataType: "string" },
125
+ },
126
+ {
127
+ id: "toolDescription",
128
+ label: "Tool Description",
129
+ description: "Description shown to the agent when this node is wired as a tool",
130
+ type: "string",
131
+ multiline: true,
132
+ activationRules: [{ type: "isToolInput" }],
133
+ },
134
+ ],
135
+ };
136
+
137
+ export const WebFetchNodeDefinition: NodeDefinition = {
138
+ type: "WebFetch",
139
+ label: "Web Fetch",
140
+ category: NodeCategory.Input,
141
+ description: "Fetches a URL and returns extracted text",
142
+ outputs: [{ id: "output", label: "Fetched Text", type: "static", dataType: "string" }],
143
+ parameters: [
144
+ {
145
+ id: "url",
146
+ label: "URL",
147
+ description: "URL to fetch (http or https)",
148
+ type: "expression",
149
+ expressionType: "string",
150
+ default: { expression: "", references: [], dataType: "string" },
151
+ },
152
+ {
153
+ id: "maxChars",
154
+ label: "Max Characters",
155
+ description: "Maximum characters of extracted text to return",
156
+ type: "int",
157
+ optional: true,
158
+ },
159
+ ],
160
+ };
161
+
162
+ export const SerialReadNodeDefinition: NodeDefinition = {
163
+ type: "SerialRead",
164
+ label: "Serial Read",
165
+ category: NodeCategory.Input,
166
+ tags: [NodeTag.Serial],
167
+ description: "Read string from serial port",
168
+ outputs: [{ id: "output", label: "Serial Data", type: "static", dataType: "string" }],
169
+ parameters: [
170
+ {
171
+ id: "portReference",
172
+ label: "Port",
173
+ description: "Serial port to read from",
174
+ type: "channelSelect",
175
+ channelType: ["UART"],
176
+ },
177
+ {
178
+ id: "prompt",
179
+ label: "Input prompt",
180
+ description: "Prompt for the serial read operation",
181
+ type: "string",
182
+ optional: true,
183
+ },
184
+ ],
185
+ };
@@ -1,33 +1,33 @@
1
- import { NodeBase } from "./Node";
2
- import type { Expression } from "../api";
3
- import { NodeCategory } from "./constants";
4
- import { NodeDefinition } from "./NodeDefinition";
5
-
6
- export interface IfNode extends NodeBase {
7
- type: "If";
8
- arguments: {
9
- condition: Expression;
10
- };
11
- }
12
-
13
- export type LogicNodeType = "If";
14
- export type LogicNode = IfNode;
15
-
16
- // Node Definitions
17
-
18
- export const IfNodeDefinition: NodeDefinition = {
19
- type: "If",
20
- label: "If Condition Node",
21
- category: NodeCategory.Logic,
22
- description: "Conditional branching based on boolean expression",
23
- parameters: [
24
- {
25
- id: "condition",
26
- label: "Condition",
27
- description: "Boolean expression (e.g., ${Input_1.value} > 50)",
28
- type: "expression",
29
- expressionType: "bool",
30
- default: { expression: "", references: [], dataType: "bool" },
31
- },
32
- ],
33
- };
1
+ import { NodeBase } from "./Node";
2
+ import type { Expression } from "../api";
3
+ import { NodeCategory } from "./constants";
4
+ import { NodeDefinition } from "./NodeDefinition";
5
+
6
+ export interface IfNode extends NodeBase {
7
+ type: "If";
8
+ arguments: {
9
+ condition: Expression;
10
+ };
11
+ }
12
+
13
+ export type LogicNodeType = "If";
14
+ export type LogicNode = IfNode;
15
+
16
+ // Node Definitions
17
+
18
+ export const IfNodeDefinition: NodeDefinition = {
19
+ type: "If",
20
+ label: "If Condition Node",
21
+ category: NodeCategory.Logic,
22
+ description: "Conditional branching based on boolean expression",
23
+ parameters: [
24
+ {
25
+ id: "condition",
26
+ label: "Condition",
27
+ description: "Boolean expression (e.g., ${Input_1.value} > 50)",
28
+ type: "expression",
29
+ expressionType: "bool",
30
+ default: { expression: "", references: [], dataType: "bool" },
31
+ },
32
+ ],
33
+ };