@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.
Files changed (298) 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 +74 -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/index.js +2 -0
  15. package/dist/api/index.js.map +1 -1
  16. package/dist/api/workflow.d.ts +25 -9
  17. package/dist/api/workflow.d.ts.map +1 -1
  18. package/dist/channel/Channel.d.ts +1 -1
  19. package/dist/channel/Channel.d.ts.map +1 -1
  20. package/dist/channel/Channel.js +3 -1
  21. package/dist/channel/Channel.js.map +1 -1
  22. package/dist/channel/ChannelDefinition.d.ts.map +1 -1
  23. package/dist/channel/ChannelDefinition.js +24 -0
  24. package/dist/channel/ChannelDefinition.js.map +1 -1
  25. package/dist/channel/index.d.ts.map +1 -1
  26. package/dist/channel/index.js +2 -0
  27. package/dist/channel/index.js.map +1 -1
  28. package/dist/channel/serialization.d.ts.map +1 -1
  29. package/dist/channel/serialization.js +8 -0
  30. package/dist/channel/serialization.js.map +1 -1
  31. package/dist/deploy/index.d.ts +5 -1
  32. package/dist/deploy/index.d.ts.map +1 -1
  33. package/dist/deploy/index.js +4 -1
  34. package/dist/deploy/index.js.map +1 -1
  35. package/dist/deploy/inputs.d.ts +26 -0
  36. package/dist/deploy/inputs.d.ts.map +1 -0
  37. package/dist/deploy/inputs.js +4 -0
  38. package/dist/deploy/inputs.js.map +1 -0
  39. package/dist/deploy/requirements.d.ts +24 -0
  40. package/dist/deploy/requirements.d.ts.map +1 -1
  41. package/dist/deploy/requirements.js +63 -0
  42. package/dist/deploy/requirements.js.map +1 -1
  43. package/dist/deploy/spec.d.ts +27 -0
  44. package/dist/deploy/spec.d.ts.map +1 -0
  45. package/dist/deploy/spec.js +352 -0
  46. package/dist/deploy/spec.js.map +1 -0
  47. package/dist/diagnostics/__fixtures__/diagnosticFixtures.d.ts.map +1 -1
  48. package/dist/diagnostics/__fixtures__/diagnosticFixtures.js +2 -0
  49. package/dist/diagnostics/__fixtures__/diagnosticFixtures.js.map +1 -1
  50. package/dist/diagnostics/diagnostics.d.ts.map +1 -1
  51. package/dist/diagnostics/diagnostics.js +2 -0
  52. package/dist/diagnostics/diagnostics.js.map +1 -1
  53. package/dist/diagnostics/index.d.ts.map +1 -1
  54. package/dist/diagnostics/index.js +2 -0
  55. package/dist/diagnostics/index.js.map +1 -1
  56. package/dist/edge/Edge.d.ts.map +1 -1
  57. package/dist/edge/Edge.js +2 -0
  58. package/dist/edge/Edge.js.map +1 -1
  59. package/dist/edge/EdgeDefinition.d.ts.map +1 -1
  60. package/dist/edge/EdgeDefinition.js +2 -0
  61. package/dist/edge/EdgeDefinition.js.map +1 -1
  62. package/dist/edge/EdgeType.d.ts.map +1 -1
  63. package/dist/edge/EdgeType.js +2 -0
  64. package/dist/edge/EdgeType.js.map +1 -1
  65. package/dist/edge/index.d.ts.map +1 -1
  66. package/dist/edge/index.js +2 -2
  67. package/dist/edge/index.js.map +1 -1
  68. package/dist/edge/serialization.d.ts.map +1 -1
  69. package/dist/edge/serialization.js +2 -0
  70. package/dist/edge/serialization.js.map +1 -1
  71. package/dist/expression/index.d.ts.map +1 -1
  72. package/dist/expression/index.js +2 -0
  73. package/dist/expression/index.js.map +1 -1
  74. package/dist/expression/parser.d.ts.map +1 -1
  75. package/dist/expression/parser.js +2 -0
  76. package/dist/expression/parser.js.map +1 -1
  77. package/dist/expression/types.d.ts.map +1 -1
  78. package/dist/expression/types.js +2 -0
  79. package/dist/expression/types.js.map +1 -1
  80. package/dist/function/FunctionDeclaration.d.ts.map +1 -1
  81. package/dist/function/FunctionDeclaration.js +2 -0
  82. package/dist/function/FunctionDeclaration.js.map +1 -1
  83. package/dist/function/index.d.ts.map +1 -1
  84. package/dist/function/index.js +2 -0
  85. package/dist/function/index.js.map +1 -1
  86. package/dist/function/serialization.d.ts.map +1 -1
  87. package/dist/function/serialization.js +2 -0
  88. package/dist/function/serialization.js.map +1 -1
  89. package/dist/id/index.d.ts.map +1 -1
  90. package/dist/id/index.js +2 -0
  91. package/dist/id/index.js.map +1 -1
  92. package/dist/index.d.ts.map +1 -1
  93. package/dist/index.js +2 -0
  94. package/dist/index.js.map +1 -1
  95. package/dist/memory/Memory.d.ts.map +1 -1
  96. package/dist/memory/Memory.js +2 -0
  97. package/dist/memory/Memory.js.map +1 -1
  98. package/dist/memory/MemoryDefinition.d.ts.map +1 -1
  99. package/dist/memory/MemoryDefinition.js +2 -0
  100. package/dist/memory/MemoryDefinition.js.map +1 -1
  101. package/dist/memory/MemoryFileDefinition.d.ts.map +1 -1
  102. package/dist/memory/MemoryFileDefinition.js +2 -0
  103. package/dist/memory/MemoryFileDefinition.js.map +1 -1
  104. package/dist/memory/MemoryRegistry.d.ts.map +1 -1
  105. package/dist/memory/MemoryRegistry.js +2 -0
  106. package/dist/memory/MemoryRegistry.js.map +1 -1
  107. package/dist/memory/VectorDatabaseDefinition.d.ts.map +1 -1
  108. package/dist/memory/VectorDatabaseDefinition.js +2 -0
  109. package/dist/memory/VectorDatabaseDefinition.js.map +1 -1
  110. package/dist/memory/index.d.ts.map +1 -1
  111. package/dist/memory/index.js +2 -0
  112. package/dist/memory/index.js.map +1 -1
  113. package/dist/memory/serialization.d.ts.map +1 -1
  114. package/dist/memory/serialization.js +2 -0
  115. package/dist/memory/serialization.js.map +1 -1
  116. package/dist/migration/index.d.ts.map +1 -1
  117. package/dist/migration/index.js +2 -0
  118. package/dist/migration/index.js.map +1 -1
  119. package/dist/migration/migrate.d.ts.map +1 -1
  120. package/dist/migration/migrate.js +2 -0
  121. package/dist/migration/migrate.js.map +1 -1
  122. package/dist/migration/migrations.d.ts.map +1 -1
  123. package/dist/migration/migrations.js +2 -0
  124. package/dist/migration/migrations.js.map +1 -1
  125. package/dist/migration/version.d.ts.map +1 -1
  126. package/dist/migration/version.js +2 -0
  127. package/dist/migration/version.js.map +1 -1
  128. package/dist/model/LLMModelDefinition.d.ts.map +1 -1
  129. package/dist/model/LLMModelDefinition.js +2 -0
  130. package/dist/model/LLMModelDefinition.js.map +1 -1
  131. package/dist/model/Model.d.ts.map +1 -1
  132. package/dist/model/Model.js +2 -13
  133. package/dist/model/Model.js.map +1 -1
  134. package/dist/model/ModelDefinition.d.ts.map +1 -1
  135. package/dist/model/ModelDefinition.js +2 -0
  136. package/dist/model/ModelDefinition.js.map +1 -1
  137. package/dist/model/ModelRegistry.d.ts.map +1 -1
  138. package/dist/model/ModelRegistry.js +2 -0
  139. package/dist/model/ModelRegistry.js.map +1 -1
  140. package/dist/model/index.d.ts.map +1 -1
  141. package/dist/model/index.js +2 -0
  142. package/dist/model/index.js.map +1 -1
  143. package/dist/model/serialization.d.ts.map +1 -1
  144. package/dist/model/serialization.js +2 -0
  145. package/dist/model/serialization.js.map +1 -1
  146. package/dist/node/AgentNode.d.ts.map +1 -1
  147. package/dist/node/AgentNode.js +2 -0
  148. package/dist/node/AgentNode.js.map +1 -1
  149. package/dist/node/DataNode.d.ts.map +1 -1
  150. package/dist/node/DataNode.js +2 -0
  151. package/dist/node/DataNode.js.map +1 -1
  152. package/dist/node/FunctionNode.d.ts.map +1 -1
  153. package/dist/node/FunctionNode.js +2 -0
  154. package/dist/node/FunctionNode.js.map +1 -1
  155. package/dist/node/InputNode.d.ts.map +1 -1
  156. package/dist/node/InputNode.js +2 -0
  157. package/dist/node/InputNode.js.map +1 -1
  158. package/dist/node/LogicNode.d.ts.map +1 -1
  159. package/dist/node/LogicNode.js +2 -0
  160. package/dist/node/LogicNode.js.map +1 -1
  161. package/dist/node/MqttNode.d.ts.map +1 -1
  162. package/dist/node/MqttNode.js +2 -0
  163. package/dist/node/MqttNode.js.map +1 -1
  164. package/dist/node/Node.d.ts.map +1 -1
  165. package/dist/node/Node.js +2 -7
  166. package/dist/node/Node.js.map +1 -1
  167. package/dist/node/NodeDefinition.d.ts.map +1 -1
  168. package/dist/node/NodeDefinition.js +2 -0
  169. package/dist/node/NodeDefinition.js.map +1 -1
  170. package/dist/node/NodeRegistry.d.ts.map +1 -1
  171. package/dist/node/NodeRegistry.js +2 -0
  172. package/dist/node/NodeRegistry.js.map +1 -1
  173. package/dist/node/OutputNode.d.ts.map +1 -1
  174. package/dist/node/OutputNode.js +4 -2
  175. package/dist/node/OutputNode.js.map +1 -1
  176. package/dist/node/ToolNode.d.ts.map +1 -1
  177. package/dist/node/ToolNode.js +2 -0
  178. package/dist/node/ToolNode.js.map +1 -1
  179. package/dist/node/TriggerNode.d.ts.map +1 -1
  180. package/dist/node/TriggerNode.js +2 -0
  181. package/dist/node/TriggerNode.js.map +1 -1
  182. package/dist/node/constants.d.ts.map +1 -1
  183. package/dist/node/constants.js +2 -0
  184. package/dist/node/constants.js.map +1 -1
  185. package/dist/node/index.d.ts.map +1 -1
  186. package/dist/node/index.js +2 -0
  187. package/dist/node/index.js.map +1 -1
  188. package/dist/node/methods.d.ts.map +1 -1
  189. package/dist/node/methods.js +2 -0
  190. package/dist/node/methods.js.map +1 -1
  191. package/dist/node/serialization.d.ts.map +1 -1
  192. package/dist/node/serialization.js +33 -13
  193. package/dist/node/serialization.js.map +1 -1
  194. package/dist/parameter/OutputParameter.d.ts.map +1 -1
  195. package/dist/parameter/OutputParameter.js +2 -0
  196. package/dist/parameter/OutputParameter.js.map +1 -1
  197. package/dist/parameter/Parameter.d.ts.map +1 -1
  198. package/dist/parameter/Parameter.js +2 -0
  199. package/dist/parameter/Parameter.js.map +1 -1
  200. package/dist/parameter/index.d.ts.map +1 -1
  201. package/dist/parameter/index.js +2 -0
  202. package/dist/parameter/index.js.map +1 -1
  203. package/dist/variable/Variable.d.ts.map +1 -1
  204. package/dist/variable/Variable.js +2 -0
  205. package/dist/variable/Variable.js.map +1 -1
  206. package/dist/variable/index.d.ts.map +1 -1
  207. package/dist/variable/index.js +2 -3
  208. package/dist/variable/index.js.map +1 -1
  209. package/dist/variable/operations.d.ts.map +1 -1
  210. package/dist/variable/operations.js +2 -0
  211. package/dist/variable/operations.js.map +1 -1
  212. package/dist/workflow/Workflow.d.ts.map +1 -1
  213. package/dist/workflow/Workflow.js +2 -0
  214. package/dist/workflow/Workflow.js.map +1 -1
  215. package/dist/workflow/index.d.ts.map +1 -1
  216. package/dist/workflow/index.js +2 -0
  217. package/dist/workflow/index.js.map +1 -1
  218. package/dist/workflow/serialization.d.ts.map +1 -1
  219. package/dist/workflow/serialization.js +2 -4
  220. package/dist/workflow/serialization.js.map +1 -1
  221. package/package.json +2 -2
  222. package/src/api/deployment.ts +74 -0
  223. package/src/api/engine.ts +744 -0
  224. package/src/api/index.ts +29 -11
  225. package/src/api/workflow.ts +25 -9
  226. package/src/channel/Channel.ts +14 -11
  227. package/src/channel/ChannelDefinition.ts +101 -76
  228. package/src/channel/index.ts +9 -6
  229. package/src/channel/serialization.ts +77 -68
  230. package/src/deploy/index.ts +17 -1
  231. package/src/deploy/inputs.ts +44 -0
  232. package/src/deploy/requirements.test.ts +64 -61
  233. package/src/deploy/requirements.ts +159 -41
  234. package/src/deploy/spec.test.ts +227 -0
  235. package/src/deploy/spec.ts +397 -0
  236. package/src/diagnostics/__fixtures__/diagnosticFixtures.ts +161 -158
  237. package/src/diagnostics/diagnostics.test.ts +881 -878
  238. package/src/diagnostics/diagnostics.ts +939 -936
  239. package/src/diagnostics/index.ts +14 -11
  240. package/src/edge/Edge.ts +26 -23
  241. package/src/edge/EdgeDefinition.ts +48 -45
  242. package/src/edge/EdgeType.ts +22 -19
  243. package/src/edge/index.ts +11 -8
  244. package/src/edge/serialization.ts +86 -83
  245. package/src/expression/index.ts +7 -4
  246. package/src/expression/parser.ts +365 -362
  247. package/src/expression/types.ts +33 -30
  248. package/src/function/FunctionDeclaration.ts +57 -54
  249. package/src/function/index.ts +6 -3
  250. package/src/function/serialization.ts +43 -40
  251. package/src/globals.d.ts +12 -9
  252. package/src/id/index.ts +11 -8
  253. package/src/index.ts +25 -22
  254. package/src/memory/Memory.ts +18 -15
  255. package/src/memory/MemoryDefinition.ts +19 -16
  256. package/src/memory/MemoryFileDefinition.ts +40 -37
  257. package/src/memory/MemoryRegistry.ts +38 -35
  258. package/src/memory/VectorDatabaseDefinition.ts +24 -21
  259. package/src/memory/index.ts +11 -8
  260. package/src/memory/serialization.ts +50 -47
  261. package/src/migration/index.ts +7 -4
  262. package/src/migration/migrate.test.ts +47 -44
  263. package/src/migration/migrate.ts +61 -58
  264. package/src/migration/migrations.ts +27 -24
  265. package/src/migration/version.ts +12 -9
  266. package/src/model/LLMModelDefinition.ts +15 -12
  267. package/src/model/Model.ts +42 -39
  268. package/src/model/ModelDefinition.ts +18 -15
  269. package/src/model/ModelRegistry.ts +36 -33
  270. package/src/model/index.ts +10 -7
  271. package/src/model/serialization.ts +33 -30
  272. package/src/node/AgentNode.ts +85 -82
  273. package/src/node/DataNode.ts +44 -41
  274. package/src/node/FunctionNode.ts +79 -76
  275. package/src/node/InputNode.ts +188 -185
  276. package/src/node/LogicNode.ts +36 -33
  277. package/src/node/MqttNode.ts +130 -127
  278. package/src/node/Node.ts +64 -61
  279. package/src/node/NodeDefinition.ts +40 -37
  280. package/src/node/NodeRegistry.ts +88 -85
  281. package/src/node/OutputNode.ts +90 -87
  282. package/src/node/ToolNode.ts +35 -32
  283. package/src/node/TriggerNode.ts +275 -272
  284. package/src/node/constants.ts +19 -16
  285. package/src/node/index.ts +29 -26
  286. package/src/node/methods.ts +281 -278
  287. package/src/node/serialization.test.ts +51 -0
  288. package/src/node/serialization.ts +565 -544
  289. package/src/parameter/OutputParameter.ts +71 -68
  290. package/src/parameter/Parameter.ts +246 -243
  291. package/src/parameter/index.ts +36 -33
  292. package/src/variable/Variable.ts +13 -10
  293. package/src/variable/index.ts +19 -16
  294. package/src/variable/operations.ts +109 -106
  295. package/src/workflow/Workflow.ts +44 -41
  296. package/src/workflow/index.ts +6 -3
  297. package/src/workflow/serialization.test.ts +243 -240
  298. package/src/workflow/serialization.ts +245 -242
@@ -1,185 +1,188 @@
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
+ // SPDX-License-Identifier: Apache-2.0
2
+ // Copyright (c) 2026 ForestHub.
3
+
4
+ import { NodeBase } from "./Node";
5
+ import type { Expression } from "../api";
6
+ import { OutputBinding } from "../parameter";
7
+ import { NodeCategory, NodeTag } from "./constants";
8
+ import { NodeDefinition } from "./NodeDefinition";
9
+
10
+ export interface ReadPinNode extends NodeBase {
11
+ type: "ReadPin";
12
+ arguments: {
13
+ pinReference: string | undefined;
14
+ signalType: "digital" | "analog";
15
+ output: OutputBinding;
16
+ toolDescription?: string;
17
+ };
18
+ }
19
+
20
+ export interface SerialReadNode extends NodeBase {
21
+ type: "SerialRead";
22
+ arguments: {
23
+ portReference: string | undefined;
24
+ prompt?: string;
25
+ output: OutputBinding;
26
+ };
27
+ }
28
+
29
+ // Retriever - provides RAG retrieval capability to agents
30
+ export interface RetrieverNode extends NodeBase {
31
+ type: "Retriever";
32
+ arguments: {
33
+ memoryReference: string;
34
+ topK: number | undefined;
35
+ query: Expression;
36
+ output: OutputBinding;
37
+ toolDescription?: string;
38
+ };
39
+ }
40
+
41
+ // WebFetch - fetches a URL and returns extracted text
42
+ export interface WebFetchNode extends NodeBase {
43
+ type: "WebFetch";
44
+ arguments: {
45
+ url: Expression;
46
+ maxChars: number | undefined;
47
+ output: OutputBinding;
48
+ };
49
+ }
50
+
51
+ export type InputNodeType = "ReadPin" | "SerialRead" | "Retriever" | "WebFetch";
52
+ export type InputNode = ReadPinNode | SerialReadNode | RetrieverNode | WebFetchNode;
53
+
54
+ // Node Definitions
55
+
56
+ export const ReadPinNodeDefinition: NodeDefinition = {
57
+ type: "ReadPin",
58
+ label: "Read Pin",
59
+ category: NodeCategory.Input,
60
+ tags: [NodeTag.Pin],
61
+ description: "Read data from a pin",
62
+ outputs: [
63
+ {
64
+ id: "output",
65
+ label: "Pin Value",
66
+ type: "static",
67
+ dataType: (args) => ((args as ReadPinNode["arguments"]).signalType === "digital" ? "bool" : "int"),
68
+ },
69
+ ],
70
+ parameters: [
71
+ {
72
+ id: "pinReference",
73
+ label: "Pin",
74
+ description: "IO pin to read from",
75
+ type: "channelSelect",
76
+ channelType: (args) => ((args as ReadPinNode["arguments"]).signalType === "digital" ? ["GPIOIN"] : ["ADC"]),
77
+ },
78
+ {
79
+ id: "signalType",
80
+ label: "Signal Type",
81
+ description: "Type of signal",
82
+ type: "selection",
83
+ default: "digital",
84
+ options: [
85
+ { value: "digital", label: "Digital" },
86
+ { value: "analog", label: "Analog" },
87
+ ],
88
+ },
89
+ {
90
+ id: "toolDescription",
91
+ label: "Tool Description",
92
+ description: "Description shown to the agent when this node is wired as a tool",
93
+ type: "string",
94
+ multiline: true,
95
+ activationRules: [{ type: "isToolInput" }],
96
+ },
97
+ ],
98
+ };
99
+
100
+ export const RetrieverNodeDefinition: NodeDefinition = {
101
+ type: "Retriever",
102
+ label: "Retriever",
103
+ category: NodeCategory.Input,
104
+ description: "Retrieves relevant documents from a knowledge base",
105
+ outputs: [{ id: "output", label: "Retrieved Documents", type: "static", dataType: "string" }],
106
+ parameters: [
107
+ {
108
+ id: "memoryReference",
109
+ label: "Vector Database",
110
+ description: "The vector database to search",
111
+ type: "memorySelect",
112
+ memoryType: ["VectorDatabase"],
113
+ },
114
+ {
115
+ id: "topK",
116
+ label: "Top K",
117
+ description: "Number of results to retrieve",
118
+ type: "int",
119
+ default: 5,
120
+ },
121
+ {
122
+ id: "query",
123
+ label: "Query",
124
+ description: "Search query expression",
125
+ type: "expression",
126
+ expressionType: "string",
127
+ default: { expression: "", references: [], dataType: "string" },
128
+ },
129
+ {
130
+ id: "toolDescription",
131
+ label: "Tool Description",
132
+ description: "Description shown to the agent when this node is wired as a tool",
133
+ type: "string",
134
+ multiline: true,
135
+ activationRules: [{ type: "isToolInput" }],
136
+ },
137
+ ],
138
+ };
139
+
140
+ export const WebFetchNodeDefinition: NodeDefinition = {
141
+ type: "WebFetch",
142
+ label: "Web Fetch",
143
+ category: NodeCategory.Input,
144
+ description: "Fetches a URL and returns extracted text",
145
+ outputs: [{ id: "output", label: "Fetched Text", type: "static", dataType: "string" }],
146
+ parameters: [
147
+ {
148
+ id: "url",
149
+ label: "URL",
150
+ description: "URL to fetch (http or https)",
151
+ type: "expression",
152
+ expressionType: "string",
153
+ default: { expression: "", references: [], dataType: "string" },
154
+ },
155
+ {
156
+ id: "maxChars",
157
+ label: "Max Characters",
158
+ description: "Maximum characters of extracted text to return",
159
+ type: "int",
160
+ optional: true,
161
+ },
162
+ ],
163
+ };
164
+
165
+ export const SerialReadNodeDefinition: NodeDefinition = {
166
+ type: "SerialRead",
167
+ label: "Serial Read",
168
+ category: NodeCategory.Input,
169
+ tags: [NodeTag.Serial],
170
+ description: "Read string from serial port",
171
+ outputs: [{ id: "output", label: "Serial Data", type: "static", dataType: "string" }],
172
+ parameters: [
173
+ {
174
+ id: "portReference",
175
+ label: "Port",
176
+ description: "Serial port to read from",
177
+ type: "channelSelect",
178
+ channelType: ["UART"],
179
+ },
180
+ {
181
+ id: "prompt",
182
+ label: "Input prompt",
183
+ description: "Prompt for the serial read operation",
184
+ type: "string",
185
+ optional: true,
186
+ },
187
+ ],
188
+ };
@@ -1,33 +1,36 @@
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
+ // SPDX-License-Identifier: Apache-2.0
2
+ // Copyright (c) 2026 ForestHub.
3
+
4
+ import { NodeBase } from "./Node";
5
+ import type { Expression } from "../api";
6
+ import { NodeCategory } from "./constants";
7
+ import { NodeDefinition } from "./NodeDefinition";
8
+
9
+ export interface IfNode extends NodeBase {
10
+ type: "If";
11
+ arguments: {
12
+ condition: Expression;
13
+ };
14
+ }
15
+
16
+ export type LogicNodeType = "If";
17
+ export type LogicNode = IfNode;
18
+
19
+ // Node Definitions
20
+
21
+ export const IfNodeDefinition: NodeDefinition = {
22
+ type: "If",
23
+ label: "If Condition Node",
24
+ category: NodeCategory.Logic,
25
+ description: "Conditional branching based on boolean expression",
26
+ parameters: [
27
+ {
28
+ id: "condition",
29
+ label: "Condition",
30
+ description: "Boolean expression (e.g., ${Input_1.value} > 50)",
31
+ type: "expression",
32
+ expressionType: "bool",
33
+ default: { expression: "", references: [], dataType: "bool" },
34
+ },
35
+ ],
36
+ };