@foresthubai/workflow-core 0.3.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.
Files changed (339) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +14 -0
  3. package/README.md +63 -0
  4. package/dist/api/index.d.ts +7 -0
  5. package/dist/api/index.d.ts.map +1 -0
  6. package/dist/api/index.js +2 -0
  7. package/dist/api/index.js.map +1 -0
  8. package/dist/api/workflow.d.ts +607 -0
  9. package/dist/api/workflow.d.ts.map +1 -0
  10. package/dist/api/workflow.js +6 -0
  11. package/dist/api/workflow.js.map +1 -0
  12. package/dist/channel/Channel.d.ts +10 -0
  13. package/dist/channel/Channel.d.ts.map +1 -0
  14. package/dist/channel/Channel.js +2 -0
  15. package/dist/channel/Channel.js.map +1 -0
  16. package/dist/channel/ChannelDefinition.d.ts +27 -0
  17. package/dist/channel/ChannelDefinition.d.ts.map +1 -0
  18. package/dist/channel/ChannelDefinition.js +50 -0
  19. package/dist/channel/ChannelDefinition.js.map +1 -0
  20. package/dist/channel/index.d.ts +7 -0
  21. package/dist/channel/index.d.ts.map +1 -0
  22. package/dist/channel/index.js +4 -0
  23. package/dist/channel/index.js.map +1 -0
  24. package/dist/channel/serialization.d.ts +17 -0
  25. package/dist/channel/serialization.d.ts.map +1 -0
  26. package/dist/channel/serialization.js +63 -0
  27. package/dist/channel/serialization.js.map +1 -0
  28. package/dist/deploy/index.d.ts +2 -0
  29. package/dist/deploy/index.d.ts.map +1 -0
  30. package/dist/deploy/index.js +2 -0
  31. package/dist/deploy/index.js.map +1 -0
  32. package/dist/deploy/requirements.d.ts +17 -0
  33. package/dist/deploy/requirements.d.ts.map +1 -0
  34. package/dist/deploy/requirements.js +41 -0
  35. package/dist/deploy/requirements.js.map +1 -0
  36. package/dist/diagnostics/__fixtures__/diagnosticFixtures.d.ts +28 -0
  37. package/dist/diagnostics/__fixtures__/diagnosticFixtures.d.ts.map +1 -0
  38. package/dist/diagnostics/__fixtures__/diagnosticFixtures.js +125 -0
  39. package/dist/diagnostics/__fixtures__/diagnosticFixtures.js.map +1 -0
  40. package/dist/diagnostics/diagnostics.d.ts +128 -0
  41. package/dist/diagnostics/diagnostics.d.ts.map +1 -0
  42. package/dist/diagnostics/diagnostics.js +783 -0
  43. package/dist/diagnostics/diagnostics.js.map +1 -0
  44. package/dist/diagnostics/index.d.ts +3 -0
  45. package/dist/diagnostics/index.d.ts.map +1 -0
  46. package/dist/diagnostics/index.js +2 -0
  47. package/dist/diagnostics/index.js.map +1 -0
  48. package/dist/edge/Edge.d.ts +22 -0
  49. package/dist/edge/Edge.d.ts.map +1 -0
  50. package/dist/edge/Edge.js +2 -0
  51. package/dist/edge/Edge.js.map +1 -0
  52. package/dist/edge/EdgeDefinition.d.ts +10 -0
  53. package/dist/edge/EdgeDefinition.d.ts.map +1 -0
  54. package/dist/edge/EdgeDefinition.js +36 -0
  55. package/dist/edge/EdgeDefinition.js.map +1 -0
  56. package/dist/edge/EdgeType.d.ts +6 -0
  57. package/dist/edge/EdgeType.d.ts.map +1 -0
  58. package/dist/edge/EdgeType.js +7 -0
  59. package/dist/edge/EdgeType.js.map +1 -0
  60. package/dist/edge/index.d.ts +6 -0
  61. package/dist/edge/index.d.ts.map +1 -0
  62. package/dist/edge/index.js +6 -0
  63. package/dist/edge/index.js.map +1 -0
  64. package/dist/edge/serialization.d.ts +18 -0
  65. package/dist/edge/serialization.d.ts.map +1 -0
  66. package/dist/edge/serialization.js +76 -0
  67. package/dist/edge/serialization.js.map +1 -0
  68. package/dist/expression/index.d.ts +5 -0
  69. package/dist/expression/index.d.ts.map +1 -0
  70. package/dist/expression/index.js +3 -0
  71. package/dist/expression/index.js.map +1 -0
  72. package/dist/expression/parser.d.ts +14 -0
  73. package/dist/expression/parser.d.ts.map +1 -0
  74. package/dist/expression/parser.js +309 -0
  75. package/dist/expression/parser.js.map +1 -0
  76. package/dist/expression/types.d.ts +11 -0
  77. package/dist/expression/types.d.ts.map +1 -0
  78. package/dist/expression/types.js +20 -0
  79. package/dist/expression/types.js.map +1 -0
  80. package/dist/function/FunctionDeclaration.d.ts +43 -0
  81. package/dist/function/FunctionDeclaration.d.ts.map +1 -0
  82. package/dist/function/FunctionDeclaration.js +17 -0
  83. package/dist/function/FunctionDeclaration.js.map +1 -0
  84. package/dist/function/index.d.ts +4 -0
  85. package/dist/function/index.d.ts.map +1 -0
  86. package/dist/function/index.js +3 -0
  87. package/dist/function/index.js.map +1 -0
  88. package/dist/function/serialization.d.ts +20 -0
  89. package/dist/function/serialization.d.ts.map +1 -0
  90. package/dist/function/serialization.js +26 -0
  91. package/dist/function/serialization.js.map +1 -0
  92. package/dist/id/index.d.ts +7 -0
  93. package/dist/id/index.d.ts.map +1 -0
  94. package/dist/id/index.js +9 -0
  95. package/dist/id/index.js.map +1 -0
  96. package/dist/index.d.ts +11 -0
  97. package/dist/index.d.ts.map +1 -0
  98. package/dist/index.js +14 -0
  99. package/dist/index.js.map +1 -0
  100. package/dist/memory/Memory.d.ts +12 -0
  101. package/dist/memory/Memory.d.ts.map +1 -0
  102. package/dist/memory/Memory.js +2 -0
  103. package/dist/memory/Memory.js.map +1 -0
  104. package/dist/memory/MemoryDefinition.d.ts +16 -0
  105. package/dist/memory/MemoryDefinition.d.ts.map +1 -0
  106. package/dist/memory/MemoryDefinition.js +2 -0
  107. package/dist/memory/MemoryDefinition.js.map +1 -0
  108. package/dist/memory/MemoryFileDefinition.d.ts +8 -0
  109. package/dist/memory/MemoryFileDefinition.d.ts.map +1 -0
  110. package/dist/memory/MemoryFileDefinition.js +36 -0
  111. package/dist/memory/MemoryFileDefinition.js.map +1 -0
  112. package/dist/memory/MemoryRegistry.d.ts +17 -0
  113. package/dist/memory/MemoryRegistry.d.ts.map +1 -0
  114. package/dist/memory/MemoryRegistry.js +29 -0
  115. package/dist/memory/MemoryRegistry.js.map +1 -0
  116. package/dist/memory/VectorDatabaseDefinition.d.ts +7 -0
  117. package/dist/memory/VectorDatabaseDefinition.d.ts.map +1 -0
  118. package/dist/memory/VectorDatabaseDefinition.js +20 -0
  119. package/dist/memory/VectorDatabaseDefinition.js.map +1 -0
  120. package/dist/memory/index.d.ts +9 -0
  121. package/dist/memory/index.d.ts.map +1 -0
  122. package/dist/memory/index.js +6 -0
  123. package/dist/memory/index.js.map +1 -0
  124. package/dist/memory/serialization.d.ts +11 -0
  125. package/dist/memory/serialization.d.ts.map +1 -0
  126. package/dist/memory/serialization.js +44 -0
  127. package/dist/memory/serialization.js.map +1 -0
  128. package/dist/migration/index.d.ts +5 -0
  129. package/dist/migration/index.d.ts.map +1 -0
  130. package/dist/migration/index.js +4 -0
  131. package/dist/migration/index.js.map +1 -0
  132. package/dist/migration/migrate.d.ts +11 -0
  133. package/dist/migration/migrate.d.ts.map +1 -0
  134. package/dist/migration/migrate.js +52 -0
  135. package/dist/migration/migrate.js.map +1 -0
  136. package/dist/migration/migrations.d.ts +22 -0
  137. package/dist/migration/migrations.d.ts.map +1 -0
  138. package/dist/migration/migrations.js +10 -0
  139. package/dist/migration/migrations.js.map +1 -0
  140. package/dist/migration/version.d.ts +9 -0
  141. package/dist/migration/version.d.ts.map +1 -0
  142. package/dist/migration/version.js +9 -0
  143. package/dist/migration/version.js.map +1 -0
  144. package/dist/model/LLMModelDefinition.d.ts +7 -0
  145. package/dist/model/LLMModelDefinition.d.ts.map +1 -0
  146. package/dist/model/LLMModelDefinition.js +11 -0
  147. package/dist/model/LLMModelDefinition.js.map +1 -0
  148. package/dist/model/Model.d.ts +21 -0
  149. package/dist/model/Model.d.ts.map +1 -0
  150. package/dist/model/Model.js +15 -0
  151. package/dist/model/Model.js.map +1 -0
  152. package/dist/model/ModelDefinition.d.ts +15 -0
  153. package/dist/model/ModelDefinition.d.ts.map +1 -0
  154. package/dist/model/ModelDefinition.js +2 -0
  155. package/dist/model/ModelDefinition.js.map +1 -0
  156. package/dist/model/ModelRegistry.d.ts +17 -0
  157. package/dist/model/ModelRegistry.d.ts.map +1 -0
  158. package/dist/model/ModelRegistry.js +27 -0
  159. package/dist/model/ModelRegistry.js.map +1 -0
  160. package/dist/model/index.d.ts +8 -0
  161. package/dist/model/index.d.ts.map +1 -0
  162. package/dist/model/index.js +5 -0
  163. package/dist/model/index.js.map +1 -0
  164. package/dist/model/serialization.d.ts +8 -0
  165. package/dist/model/serialization.d.ts.map +1 -0
  166. package/dist/model/serialization.js +25 -0
  167. package/dist/model/serialization.js.map +1 -0
  168. package/dist/node/AgentNode.d.ts +21 -0
  169. package/dist/node/AgentNode.d.ts.map +1 -0
  170. package/dist/node/AgentNode.js +60 -0
  171. package/dist/node/AgentNode.js.map +1 -0
  172. package/dist/node/DataNode.d.ts +14 -0
  173. package/dist/node/DataNode.d.ts.map +1 -0
  174. package/dist/node/DataNode.js +26 -0
  175. package/dist/node/DataNode.js.map +1 -0
  176. package/dist/node/FunctionNode.d.ts +24 -0
  177. package/dist/node/FunctionNode.d.ts.map +1 -0
  178. package/dist/node/FunctionNode.js +44 -0
  179. package/dist/node/FunctionNode.js.map +1 -0
  180. package/dist/node/InputNode.d.ts +46 -0
  181. package/dist/node/InputNode.d.ts.map +1 -0
  182. package/dist/node/InputNode.js +133 -0
  183. package/dist/node/InputNode.js.map +1 -0
  184. package/dist/node/LogicNode.d.ts +13 -0
  185. package/dist/node/LogicNode.d.ts.map +1 -0
  186. package/dist/node/LogicNode.js +19 -0
  187. package/dist/node/LogicNode.js.map +1 -0
  188. package/dist/node/MqttNode.d.ts +27 -0
  189. package/dist/node/MqttNode.d.ts.map +1 -0
  190. package/dist/node/MqttNode.js +96 -0
  191. package/dist/node/MqttNode.js.map +1 -0
  192. package/dist/node/Node.d.ts +49 -0
  193. package/dist/node/Node.d.ts.map +1 -0
  194. package/dist/node/Node.js +9 -0
  195. package/dist/node/Node.js.map +1 -0
  196. package/dist/node/NodeDefinition.d.ts +30 -0
  197. package/dist/node/NodeDefinition.d.ts.map +1 -0
  198. package/dist/node/NodeDefinition.js +2 -0
  199. package/dist/node/NodeDefinition.js.map +1 -0
  200. package/dist/node/NodeRegistry.d.ts +19 -0
  201. package/dist/node/NodeRegistry.d.ts.map +1 -0
  202. package/dist/node/NodeRegistry.js +65 -0
  203. package/dist/node/NodeRegistry.js.map +1 -0
  204. package/dist/node/OutputNode.d.ts +23 -0
  205. package/dist/node/OutputNode.d.ts.map +1 -0
  206. package/dist/node/OutputNode.js +62 -0
  207. package/dist/node/OutputNode.js.map +1 -0
  208. package/dist/node/ToolNode.d.ts +12 -0
  209. package/dist/node/ToolNode.d.ts.map +1 -0
  210. package/dist/node/ToolNode.js +18 -0
  211. package/dist/node/ToolNode.js.map +1 -0
  212. package/dist/node/TriggerNode.d.ts +67 -0
  213. package/dist/node/TriggerNode.d.ts.map +1 -0
  214. package/dist/node/TriggerNode.js +172 -0
  215. package/dist/node/TriggerNode.js.map +1 -0
  216. package/dist/node/constants.d.ts +16 -0
  217. package/dist/node/constants.d.ts.map +1 -0
  218. package/dist/node/constants.js +18 -0
  219. package/dist/node/constants.js.map +1 -0
  220. package/dist/node/index.d.ts +12 -0
  221. package/dist/node/index.d.ts.map +1 -0
  222. package/dist/node/index.js +9 -0
  223. package/dist/node/index.js.map +1 -0
  224. package/dist/node/methods.d.ts +73 -0
  225. package/dist/node/methods.d.ts.map +1 -0
  226. package/dist/node/methods.js +261 -0
  227. package/dist/node/methods.js.map +1 -0
  228. package/dist/node/serialization.d.ts +25 -0
  229. package/dist/node/serialization.d.ts.map +1 -0
  230. package/dist/node/serialization.js +525 -0
  231. package/dist/node/serialization.js.map +1 -0
  232. package/dist/parameter/OutputParameter.d.ts +69 -0
  233. package/dist/parameter/OutputParameter.d.ts.map +1 -0
  234. package/dist/parameter/OutputParameter.js +6 -0
  235. package/dist/parameter/OutputParameter.js.map +1 -0
  236. package/dist/parameter/Parameter.d.ts +152 -0
  237. package/dist/parameter/Parameter.d.ts.map +1 -0
  238. package/dist/parameter/Parameter.js +86 -0
  239. package/dist/parameter/Parameter.js.map +1 -0
  240. package/dist/parameter/index.d.ts +5 -0
  241. package/dist/parameter/index.d.ts.map +1 -0
  242. package/dist/parameter/index.js +3 -0
  243. package/dist/parameter/index.js.map +1 -0
  244. package/dist/variable/Variable.d.ts +25 -0
  245. package/dist/variable/Variable.d.ts.map +1 -0
  246. package/dist/variable/Variable.js +2 -0
  247. package/dist/variable/Variable.js.map +1 -0
  248. package/dist/variable/index.d.ts +3 -0
  249. package/dist/variable/index.d.ts.map +1 -0
  250. package/dist/variable/index.js +5 -0
  251. package/dist/variable/index.js.map +1 -0
  252. package/dist/variable/operations.d.ts +37 -0
  253. package/dist/variable/operations.d.ts.map +1 -0
  254. package/dist/variable/operations.js +88 -0
  255. package/dist/variable/operations.js.map +1 -0
  256. package/dist/workflow/Workflow.d.ts +38 -0
  257. package/dist/workflow/Workflow.d.ts.map +1 -0
  258. package/dist/workflow/Workflow.js +8 -0
  259. package/dist/workflow/Workflow.js.map +1 -0
  260. package/dist/workflow/index.d.ts +4 -0
  261. package/dist/workflow/index.d.ts.map +1 -0
  262. package/dist/workflow/index.js +3 -0
  263. package/dist/workflow/index.js.map +1 -0
  264. package/dist/workflow/serialization.d.ts +43 -0
  265. package/dist/workflow/serialization.d.ts.map +1 -0
  266. package/dist/workflow/serialization.js +215 -0
  267. package/dist/workflow/serialization.js.map +1 -0
  268. package/package.json +105 -0
  269. package/src/api/index.ts +11 -0
  270. package/src/api/workflow.ts +607 -0
  271. package/src/channel/Channel.ts +11 -0
  272. package/src/channel/ChannelDefinition.ts +76 -0
  273. package/src/channel/index.ts +6 -0
  274. package/src/channel/serialization.ts +68 -0
  275. package/src/deploy/index.ts +1 -0
  276. package/src/deploy/requirements.test.ts +61 -0
  277. package/src/deploy/requirements.ts +41 -0
  278. package/src/diagnostics/__fixtures__/diagnosticFixtures.ts +158 -0
  279. package/src/diagnostics/diagnostics.test.ts +878 -0
  280. package/src/diagnostics/diagnostics.ts +936 -0
  281. package/src/diagnostics/index.ts +11 -0
  282. package/src/edge/Edge.ts +23 -0
  283. package/src/edge/EdgeDefinition.ts +45 -0
  284. package/src/edge/EdgeType.ts +19 -0
  285. package/src/edge/index.ts +8 -0
  286. package/src/edge/serialization.ts +83 -0
  287. package/src/expression/index.ts +4 -0
  288. package/src/expression/parser.ts +362 -0
  289. package/src/expression/types.ts +30 -0
  290. package/src/function/FunctionDeclaration.ts +54 -0
  291. package/src/function/index.ts +3 -0
  292. package/src/function/serialization.ts +40 -0
  293. package/src/globals.d.ts +9 -0
  294. package/src/id/index.ts +8 -0
  295. package/src/index.ts +22 -0
  296. package/src/memory/Memory.ts +15 -0
  297. package/src/memory/MemoryDefinition.ts +16 -0
  298. package/src/memory/MemoryFileDefinition.ts +37 -0
  299. package/src/memory/MemoryRegistry.ts +35 -0
  300. package/src/memory/VectorDatabaseDefinition.ts +21 -0
  301. package/src/memory/index.ts +8 -0
  302. package/src/memory/serialization.ts +47 -0
  303. package/src/migration/index.ts +4 -0
  304. package/src/migration/migrate.test.ts +44 -0
  305. package/src/migration/migrate.ts +58 -0
  306. package/src/migration/migrations.ts +24 -0
  307. package/src/migration/version.ts +9 -0
  308. package/src/model/LLMModelDefinition.ts +12 -0
  309. package/src/model/Model.ts +39 -0
  310. package/src/model/ModelDefinition.ts +15 -0
  311. package/src/model/ModelRegistry.ts +33 -0
  312. package/src/model/index.ts +7 -0
  313. package/src/model/serialization.ts +30 -0
  314. package/src/node/AgentNode.ts +82 -0
  315. package/src/node/DataNode.ts +41 -0
  316. package/src/node/FunctionNode.ts +76 -0
  317. package/src/node/InputNode.ts +185 -0
  318. package/src/node/LogicNode.ts +33 -0
  319. package/src/node/MqttNode.ts +127 -0
  320. package/src/node/Node.ts +61 -0
  321. package/src/node/NodeDefinition.ts +37 -0
  322. package/src/node/NodeRegistry.ts +85 -0
  323. package/src/node/OutputNode.ts +87 -0
  324. package/src/node/ToolNode.ts +32 -0
  325. package/src/node/TriggerNode.ts +272 -0
  326. package/src/node/constants.ts +16 -0
  327. package/src/node/index.ts +26 -0
  328. package/src/node/methods.ts +278 -0
  329. package/src/node/serialization.ts +544 -0
  330. package/src/parameter/OutputParameter.ts +68 -0
  331. package/src/parameter/Parameter.ts +243 -0
  332. package/src/parameter/index.ts +33 -0
  333. package/src/variable/Variable.ts +10 -0
  334. package/src/variable/index.ts +16 -0
  335. package/src/variable/operations.ts +106 -0
  336. package/src/workflow/Workflow.ts +41 -0
  337. package/src/workflow/index.ts +3 -0
  338. package/src/workflow/serialization.test.ts +240 -0
  339. package/src/workflow/serialization.ts +242 -0
@@ -0,0 +1,152 @@
1
+ import type { Expression } from "../api";
2
+ import type { ChannelType } from "../channel";
3
+ import type { MemoryType } from "../memory";
4
+ import type { ModelType, ModelCapability } from "../model";
5
+ import type { Schemas } from "../api";
6
+ export type DataType = Schemas["DataType"];
7
+ /**
8
+ * A field that is either a static value of T, or a function that derives T
9
+ * from the owning node's current arguments. Scope is strictly args-only —
10
+ * no access to variables, IO labels, or other canvas state. For wider
11
+ * context, use a purpose-named accessor (e.g. resolveExpressionType).
12
+ */
13
+ export type FromArgs<T> = T | ((args: Record<string, unknown>) => T);
14
+ /** Unwrap a FromArgs value against the current node arguments. */
15
+ export declare function unwrapFromArgs<T>(value: FromArgs<T>, args: Record<string, unknown>): T;
16
+ export interface ParameterBase {
17
+ id: string;
18
+ label: string;
19
+ description: string;
20
+ optional?: boolean;
21
+ /** Parameter is only active (visible, validated, serialized) when all rules are met. */
22
+ activationRules?: ActivationRule[];
23
+ }
24
+ export interface BasicParam {
25
+ type: "int" | "float" | "time";
26
+ default?: number | string;
27
+ }
28
+ export interface StringParam {
29
+ type: "string";
30
+ multiline?: boolean;
31
+ default?: string;
32
+ }
33
+ export interface BoolParam {
34
+ type: "bool";
35
+ default: boolean;
36
+ }
37
+ export interface WeekdaysParam {
38
+ type: "weekdays";
39
+ default: string[];
40
+ }
41
+ export interface SelectionParam {
42
+ type: "selection";
43
+ options: Array<{
44
+ value: string;
45
+ label: string;
46
+ }>;
47
+ default?: string;
48
+ }
49
+ export interface ExpressionParam {
50
+ type: "expression";
51
+ /** Type can be dynamic (static value or args-only lambda). */
52
+ expressionType: FromArgs<DataType>;
53
+ /**
54
+ * Escape hatch for the variableSelect case: when set, points to the id of a sibling
55
+ * variableSelect parameter. If that parameter holds a live Reference, the expressionType
56
+ * is taken from the referenced variable. Falls back to `expressionType` otherwise.
57
+ */
58
+ fromReference?: string;
59
+ /**
60
+ * Required: An expression always has a value object never an unset state.
61
+ */
62
+ default: Expression;
63
+ }
64
+ export interface VariableSelectParam {
65
+ type: "variableSelect";
66
+ default?: never;
67
+ }
68
+ export interface ModelSelectParam {
69
+ type: "modelSelect";
70
+ /** Model types this slot accepts (e.g. ["LLMModel"]). Static list or args-derived lambda. */
71
+ modelType: FromArgs<ModelType[]>;
72
+ /** Optional capability filter (e.g. ["chat"]) applied to catalog and declared models alike. */
73
+ capabilities?: FromArgs<ModelCapability[]>;
74
+ default?: never;
75
+ }
76
+ export interface ChannelSelectParam {
77
+ type: "channelSelect";
78
+ /** Channel types this slot accepts. Static list or args-derived lambda. */
79
+ channelType: FromArgs<ChannelType[]>;
80
+ default?: never;
81
+ }
82
+ export interface MemorySelectParam {
83
+ type: "memorySelect";
84
+ /** Memory types this slot accepts (e.g. ["VectorDatabase"]). Static list or args-derived lambda. */
85
+ memoryType: FromArgs<MemoryType[]>;
86
+ default?: never;
87
+ }
88
+ /**
89
+ * List parameter that binds an agent node to project-declared memory files,
90
+ * each with an access mode (`r` = read-only, `rw` = read + write). The editor
91
+ * holds the array directly; the API schema (`MemoryRef[]`) round-trips 1:1.
92
+ *
93
+ * `default` is required: a list param is always a
94
+ * concrete array, never unset — declare `default: []` for "starts empty".
95
+ */
96
+ export interface MemoryRefsParam {
97
+ type: "memory-refs";
98
+ default: Schemas["MemoryRef"][];
99
+ }
100
+ /** Union of all reference-select parameter variants, used for type guards. */
101
+ export type ReferenceSelectParam = VariableSelectParam | ChannelSelectParam | MemorySelectParam | ModelSelectParam;
102
+ export declare function isReferenceSelectParam(param: Parameter): param is ParameterBase & ReferenceSelectParam;
103
+ export type Parameter = (ParameterBase & BasicParam) | (ParameterBase & VariableSelectParam) | (ParameterBase & StringParam) | (ParameterBase & BoolParam) | (ParameterBase & WeekdaysParam) | (ParameterBase & SelectionParam) | (ParameterBase & MemorySelectParam) | (ParameterBase & ModelSelectParam) | (ParameterBase & ExpressionParam) | (ParameterBase & ChannelSelectParam) | (ParameterBase & MemoryRefsParam);
104
+ /** Typed union of rules that control whether a parameter is active (visible, validated, serialized). */
105
+ export type ActivationRule = {
106
+ type: "parameterIn";
107
+ parameterId: string;
108
+ values: unknown[];
109
+ } | {
110
+ type: "isControlFlow";
111
+ } | {
112
+ type: "isToolInput";
113
+ };
114
+ /**
115
+ * Evaluate whether a parameter is active (visible, validated, serialized) given current context.
116
+ * All rules must be satisfied (AND logic). Undefined or empty array = always active.
117
+ */
118
+ export declare function isParameterActive(param: Parameter, parameterValues: Record<string, unknown>, isToolInput: boolean): boolean;
119
+ /**
120
+ * Whether a scalar argument value counts as "unset" for api purposes:
121
+ * `undefined`, `null`, or `""`. Deliberately NOT `false`/`0` (valid values) nor
122
+ * `[]` — an empty list is a real value, since list params are always
123
+ * materialized to a concrete array. Shared by required-param diagnostics and
124
+ * {@link pruneArguments} so "unset" has exactly one definition.
125
+ */
126
+ export declare function isEmpty(value: unknown): boolean;
127
+ /**
128
+ * Prune arguments that must not appear in the api, at the domain→api boundary.
129
+ * Mutates `args` in place. Two reasons an arg is dropped:
130
+ * 1. inactive — its parameter's activation rules aren't met for this context.
131
+ * 2. the parameter {@link isEmpty}.
132
+ */
133
+ export declare function pruneArguments(args: Record<string, unknown>, parameters: readonly Parameter[], isToolInput?: boolean): void;
134
+ /**
135
+ * Resolve an ExpressionParam's expected dataType. Handles the `fromReference` escape hatch
136
+ * (type taken from a live variableSelect sibling parameter) and falls back to the
137
+ * declared FromArgs<DataType>.
138
+ */
139
+ export declare function resolveExpressionType(param: ExpressionParam, args: Record<string, unknown>, variables: Record<string, {
140
+ dataType: DataType;
141
+ }>): DataType;
142
+ /** Resolve a capability filter (ModelSelectParam) for the current node arguments. */
143
+ export declare function resolveCapabilities(param: {
144
+ capabilities?: FromArgs<ModelCapability[]>;
145
+ }, args: Record<string, unknown>): ModelCapability[] | undefined;
146
+ /** Resolve the allowed channel types for a ChannelSelectParam. */
147
+ export declare function resolveChannelTypes(param: ChannelSelectParam, args: Record<string, unknown>): ChannelType[];
148
+ /** Resolve the allowed memory types for a MemorySelectParam. */
149
+ export declare function resolveMemoryTypes(param: MemorySelectParam, args: Record<string, unknown>): MemoryType[];
150
+ /** Resolve the allowed model types for a ModelSelectParam. */
151
+ export declare function resolveModelTypes(param: ModelSelectParam, args: Record<string, unknown>): ModelType[];
152
+ //# sourceMappingURL=Parameter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Parameter.d.ts","sourceRoot":"","sources":["../../src/parameter/Parameter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAa,MAAM,QAAQ,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEtC,MAAM,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;AAErE,kEAAkE;AAClE,wBAAgB,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,CAEtF;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E,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,WAAW,EAAE,CAE3G;AAED,gEAAgE;AAChE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,UAAU,EAAE,CAExG;AAED,8DAA8D;AAC9D,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAAE,CAErG"}
@@ -0,0 +1,86 @@
1
+ import { refToLookupKey } from "../variable";
2
+ /** Unwrap a FromArgs value against the current node arguments. */
3
+ export function unwrapFromArgs(value, args) {
4
+ return typeof value === "function" ? value(args) : value;
5
+ }
6
+ export function isReferenceSelectParam(param) {
7
+ return param.type === "variableSelect" || param.type === "channelSelect" || param.type === "memorySelect" || param.type === "modelSelect";
8
+ }
9
+ /**
10
+ * Evaluate whether a parameter is active (visible, validated, serialized) given current context.
11
+ * All rules must be satisfied (AND logic). Undefined or empty array = always active.
12
+ */
13
+ export function isParameterActive(param, parameterValues, isToolInput) {
14
+ if (!param.activationRules?.length)
15
+ return true;
16
+ return param.activationRules.every((cond) => {
17
+ switch (cond.type) {
18
+ case "isControlFlow":
19
+ return !isToolInput;
20
+ case "isToolInput":
21
+ return isToolInput;
22
+ case "parameterIn":
23
+ return cond.values.includes(parameterValues[cond.parameterId]);
24
+ }
25
+ });
26
+ }
27
+ /**
28
+ * Whether a scalar argument value counts as "unset" for api purposes:
29
+ * `undefined`, `null`, or `""`. Deliberately NOT `false`/`0` (valid values) nor
30
+ * `[]` — an empty list is a real value, since list params are always
31
+ * materialized to a concrete array. Shared by required-param diagnostics and
32
+ * {@link pruneArguments} so "unset" has exactly one definition.
33
+ */
34
+ export function isEmpty(value) {
35
+ return value === undefined || value === null || value === "";
36
+ }
37
+ /**
38
+ * Prune arguments that must not appear in the api, at the domain→api boundary.
39
+ * Mutates `args` in place. Two reasons an arg is dropped:
40
+ * 1. inactive — its parameter's activation rules aren't met for this context.
41
+ * 2. the parameter {@link isEmpty}.
42
+ */
43
+ export function pruneArguments(args, parameters, isToolInput = false) {
44
+ for (const param of parameters) {
45
+ const inactive = !!param.activationRules?.length && !isParameterActive(param, args, isToolInput);
46
+ if (inactive || isEmpty(args[param.id])) {
47
+ delete args[param.id];
48
+ }
49
+ }
50
+ }
51
+ // ============================================================================
52
+ // Parameter resolvers
53
+ // ============================================================================
54
+ /**
55
+ * Resolve an ExpressionParam's expected dataType. Handles the `fromReference` escape hatch
56
+ * (type taken from a live variableSelect sibling parameter) and falls back to the
57
+ * declared FromArgs<DataType>.
58
+ */
59
+ export function resolveExpressionType(param, args, variables) {
60
+ if (param.fromReference) {
61
+ const ref = args[param.fromReference];
62
+ if (ref?.varId) {
63
+ const v = variables[refToLookupKey(ref)];
64
+ if (v)
65
+ return v.dataType;
66
+ }
67
+ }
68
+ return unwrapFromArgs(param.expressionType, args);
69
+ }
70
+ /** Resolve a capability filter (ModelSelectParam) for the current node arguments. */
71
+ export function resolveCapabilities(param, args) {
72
+ return param.capabilities === undefined ? undefined : unwrapFromArgs(param.capabilities, args);
73
+ }
74
+ /** Resolve the allowed channel types for a ChannelSelectParam. */
75
+ export function resolveChannelTypes(param, args) {
76
+ return unwrapFromArgs(param.channelType, args);
77
+ }
78
+ /** Resolve the allowed memory types for a MemorySelectParam. */
79
+ export function resolveMemoryTypes(param, args) {
80
+ return unwrapFromArgs(param.memoryType, args);
81
+ }
82
+ /** Resolve the allowed model types for a ModelSelectParam. */
83
+ export function resolveModelTypes(param, args) {
84
+ return unwrapFromArgs(param.modelType, args);
85
+ }
86
+ //# sourceMappingURL=Parameter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Parameter.js","sourceRoot":"","sources":["../../src/parameter/Parameter.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAa7C,kEAAkE;AA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c,CAAC,KAAK,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;AAChD,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,iBAAiB,CAAC,KAAuB,EAAE,IAA6B;IACtF,OAAO,cAAc,CAAC,KAAK,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,5 @@
1
+ export type { DataType, FromArgs, ParameterBase, BasicParam, StringParam, BoolParam, WeekdaysParam, SelectionParam, ExpressionParam, VariableSelectParam, ModelSelectParam, ChannelSelectParam, MemorySelectParam, MemoryRefsParam, ReferenceSelectParam, Parameter, ActivationRule, } from "./Parameter";
2
+ export { unwrapFromArgs, isReferenceSelectParam, isParameterActive, isEmpty, pruneArguments, resolveExpressionType, resolveCapabilities, resolveChannelTypes, resolveMemoryTypes, resolveModelTypes, } from "./Parameter";
3
+ export type { OutputBinding, OutputDeclaration, StaticOutput, OutputList, OutputParameter } from "./OutputParameter";
4
+ export { resolveStaticOutputDataType } from "./OutputParameter";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/parameter/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,UAAU,EACV,WAAW,EACX,SAAS,EACT,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACpB,SAAS,EACT,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,iBAAiB,EACjB,OAAO,EACP,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACrH,OAAO,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { unwrapFromArgs, isReferenceSelectParam, isParameterActive, isEmpty, pruneArguments, resolveExpressionType, resolveCapabilities, resolveChannelTypes, resolveMemoryTypes, resolveModelTypes, } from "./Parameter";
2
+ export { resolveStaticOutputDataType } from "./OutputParameter";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/parameter/index.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,iBAAiB,EACjB,OAAO,EACP,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,25 @@
1
+ import type { Schemas } from "../api";
2
+ import type { DataType } from "../api";
3
+ export type ApiVariable = Schemas["Variable"];
4
+ export type NodeOutputVariable = {
5
+ kind: "node";
6
+ nodeId: string;
7
+ outputId: string;
8
+ name: string;
9
+ dataType: DataType;
10
+ };
11
+ export type DeclaredVariable = {
12
+ kind: "declared";
13
+ uid: string;
14
+ name: string;
15
+ dataType: DataType;
16
+ initialValue?: unknown;
17
+ };
18
+ export type FunctionArgVariable = {
19
+ kind: "fnarg";
20
+ uid: string;
21
+ name: string;
22
+ dataType: DataType;
23
+ };
24
+ export type Variable = NodeOutputVariable | DeclaredVariable | FunctionArgVariable;
25
+ //# sourceMappingURL=Variable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Variable.d.ts","sourceRoot":"","sources":["../../src/variable/Variable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAEvC,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAE9C,MAAM,MAAM,kBAAkB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,QAAQ,CAAA;CAAE,CAAC;AACtH,MAAM,MAAM,gBAAgB,GAAG;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,QAAQ,CAAC;IAAC,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAC3H,MAAM,MAAM,mBAAmB,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,QAAQ,CAAA;CAAE,CAAC;AAEnG,MAAM,MAAM,QAAQ,GAAG,kBAAkB,GAAG,gBAAgB,GAAG,mBAAmB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Variable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Variable.js","sourceRoot":"","sources":["../../src/variable/Variable.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export type { ApiVariable, NodeOutputVariable, DeclaredVariable, FunctionArgVariable, Variable } from "./Variable";
2
+ export { varKey, declaredVarKey, fnargKey, nodeOutputVarKey, refToLookupKey, ensureUid, ensureUids, paramKey, computeAvailableVariables, } from "./operations";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/variable/index.ts"],"names":[],"mappings":"AAIA,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACnH,OAAO,EACL,MAAM,EACN,cAAc,EACd,QAAQ,EACR,gBAAgB,EAChB,cAAc,EACd,SAAS,EACT,UAAU,EACV,QAAQ,EACR,yBAAyB,GAC1B,MAAM,cAAc,CAAC"}
@@ -0,0 +1,5 @@
1
+ // Public surface of the variable module. The discriminated-union types live in
2
+ // ./Variable; the key/lookup/uid helpers and availability computation live in
3
+ // ./operations. This file is a barrel only. Mirrors channel/memory/model.
4
+ export { varKey, declaredVarKey, fnargKey, nodeOutputVarKey, refToLookupKey, ensureUid, ensureUids, paramKey, computeAvailableVariables, } from "./operations";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/variable/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,8EAA8E;AAC9E,0EAA0E;AAG1E,OAAO,EACL,MAAM,EACN,cAAc,EACd,QAAQ,EACR,gBAAgB,EAChB,cAAc,EACd,SAAS,EACT,UAAU,EACV,QAAQ,EACR,yBAAyB,GAC1B,MAAM,cAAc,CAAC"}
@@ -0,0 +1,37 @@
1
+ import type { NodeOutput } from "../node";
2
+ import type { Reference } from "../api";
3
+ import type { ApiVariable } from "./Variable";
4
+ import { type Edge } from "../edge";
5
+ import type { Variable } from "./Variable";
6
+ /** Compute the canonical map key for any CanvasVariable (or AvailableVariable). */
7
+ export declare function varKey(v: Variable): string;
8
+ /** Key for a declared variable: `declared:<uid>` */
9
+ export declare function declaredVarKey(uid: string): string;
10
+ /** Key for a function argument variable: `fnarg:<uid>` */
11
+ export declare function fnargKey(uid: string): string;
12
+ /** Key for a node output variable: `<nodeId>:<outputId>` */
13
+ export declare function nodeOutputVarKey(nodeId: string, outputId: string): string;
14
+ /** Convert a Reference to the canonical lookup key used in the variables record. */
15
+ export declare function refToLookupKey(ref: Reference): string;
16
+ /** Create a Variable from a NodeOutput by assigning a uid. If it already has a uid, return as-is. */
17
+ export declare function ensureUid(v: NodeOutput | ApiVariable): ApiVariable;
18
+ /** Ensure every NodeOutput/Variable in an array has a uid. */
19
+ export declare function ensureUids(vars: (NodeOutput | ApiVariable)[]): ApiVariable[];
20
+ /** Get the binding key for a Variable — always its uid. */
21
+ export declare function paramKey(p: ApiVariable): string;
22
+ /**
23
+ * Pure function that computes available variables for a canvas from its own
24
+ * variables record + edges. Function canvases are self-contained: only their
25
+ * own declared variables, node outputs, and function arguments are visible;
26
+ * main-canvas state is never merged in.
27
+ *
28
+ * Only `type`/`target` are read, but the param takes the shared structural
29
+ * {@link Edge} so there's one edge shape across core — workflow-builder
30
+ * still passes its React Flow `Edge[]` without an adapter, and core stays free
31
+ * of `@xyflow/react`.
32
+ */
33
+ export declare function computeAvailableVariables(variables: Record<string, Variable>, canvasEdges: readonly Edge[]): {
34
+ list: Variable[];
35
+ lookup: Record<string, Variable>;
36
+ };
37
+ //# sourceMappingURL=operations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../src/variable/operations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAA6B,KAAK,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAM3C,mFAAmF;AACnF,wBAAgB,MAAM,CAAC,CAAC,EAAE,QAAQ,GAAG,MAAM,CAS1C;AAED,oDAAoD;AACpD,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,0DAA0D;AAC1D,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED,4DAA4D;AAC5D,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEzE;AAMD,oFAAoF;AACpF,wBAAgB,cAAc,CAAC,GAAG,EAAE,SAAS,GAAG,MAAM,CASrD;AAMD,qGAAqG;AACrG,wBAAgB,SAAS,CAAC,CAAC,EAAE,UAAU,GAAG,WAAW,GAAG,WAAW,CAGlE;AAED,8DAA8D;AAC9D,wBAAgB,UAAU,CAAC,IAAI,EAAE,CAAC,UAAU,GAAG,WAAW,CAAC,EAAE,GAAG,WAAW,EAAE,CAE5E;AAED,2DAA2D;AAC3D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,WAAW,GAAG,MAAM,CAE/C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EACnC,WAAW,EAAE,SAAS,IAAI,EAAE,GAC3B;IAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;CAAE,CAiBxD"}
@@ -0,0 +1,88 @@
1
+ import { isToolFlow } from "../edge";
2
+ import { generateId } from "../id";
3
+ // ============================================================================
4
+ // Key Helpers
5
+ // ============================================================================
6
+ /** Compute the canonical map key for any CanvasVariable (or AvailableVariable). */
7
+ export function varKey(v) {
8
+ switch (v.kind) {
9
+ case "node":
10
+ return `${v.nodeId}:${v.outputId}`;
11
+ case "declared":
12
+ return `declared:${v.uid}`;
13
+ case "fnarg":
14
+ return `fnarg:${v.uid}`;
15
+ }
16
+ }
17
+ /** Key for a declared variable: `declared:<uid>` */
18
+ export function declaredVarKey(uid) {
19
+ return `declared:${uid}`;
20
+ }
21
+ /** Key for a function argument variable: `fnarg:<uid>` */
22
+ export function fnargKey(uid) {
23
+ return `fnarg:${uid}`;
24
+ }
25
+ /** Key for a node output variable: `<nodeId>:<outputId>` */
26
+ export function nodeOutputVarKey(nodeId, outputId) {
27
+ return `${nodeId}:${outputId}`;
28
+ }
29
+ // ============================================================================
30
+ // Reference → Lookup Key
31
+ // ============================================================================
32
+ /** Convert a Reference to the canonical lookup key used in the variables record. */
33
+ export function refToLookupKey(ref) {
34
+ switch (ref.srcId) {
35
+ case "declared":
36
+ return declaredVarKey(ref.varId);
37
+ case "fnarg":
38
+ return fnargKey(ref.varId);
39
+ default:
40
+ return nodeOutputVarKey(ref.srcId, ref.varId);
41
+ }
42
+ }
43
+ // ============================================================================
44
+ // Variable UID Helpers for dynamic variable definitions (e.g. Agent output definitions)
45
+ // ============================================================================
46
+ /** Create a Variable from a NodeOutput by assigning a uid. If it already has a uid, return as-is. */
47
+ export function ensureUid(v) {
48
+ if ("uid" in v && v.uid)
49
+ return v;
50
+ return { uid: generateId(), name: v.name, dataType: v.dataType };
51
+ }
52
+ /** Ensure every NodeOutput/Variable in an array has a uid. */
53
+ export function ensureUids(vars) {
54
+ return vars.map(ensureUid);
55
+ }
56
+ /** Get the binding key for a Variable — always its uid. */
57
+ export function paramKey(p) {
58
+ return p.uid;
59
+ }
60
+ /**
61
+ * Pure function that computes available variables for a canvas from its own
62
+ * variables record + edges. Function canvases are self-contained: only their
63
+ * own declared variables, node outputs, and function arguments are visible;
64
+ * main-canvas state is never merged in.
65
+ *
66
+ * Only `type`/`target` are read, but the param takes the shared structural
67
+ * {@link Edge} so there's one edge shape across core — workflow-builder
68
+ * still passes its React Flow `Edge[]` without an adapter, and core stays free
69
+ * of `@xyflow/react`.
70
+ */
71
+ export function computeAvailableVariables(variables, canvasEdges) {
72
+ const list = [];
73
+ const lookup = {};
74
+ // Node outputs routed to a tool port are scoped to the agent — exclude them.
75
+ const toolNodeIds = new Set();
76
+ for (const edge of canvasEdges) {
77
+ if (isToolFlow(edge.type))
78
+ toolNodeIds.add(edge.target);
79
+ }
80
+ for (const [key, variable] of Object.entries(variables)) {
81
+ if (variable.kind === "node" && toolNodeIds.has(variable.nodeId))
82
+ continue;
83
+ list.push(variable);
84
+ lookup[key] = variable;
85
+ }
86
+ return { list, lookup };
87
+ }
88
+ //# sourceMappingURL=operations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations.js","sourceRoot":"","sources":["../../src/variable/operations.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAA4B,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGnC,+EAA+E;AAC/E,cAAc;AACd,+EAA+E;AAE/E,mFAAmF;AACnF,MAAM,UAAU,MAAM,CAAC,CAAW;IAChC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;QACf,KAAK,MAAM;YACT,OAAO,GAAG,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;QACrC,KAAK,UAAU;YACb,OAAO,YAAY,CAAC,CAAC,GAAG,EAAE,CAAC;QAC7B,KAAK,OAAO;YACV,OAAO,SAAS,CAAC,CAAC,GAAG,EAAE,CAAC;IAC5B,CAAC;AACH,CAAC;AAED,oDAAoD;AACpD,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,OAAO,YAAY,GAAG,EAAE,CAAC;AAC3B,CAAC;AAED,0DAA0D;AAC1D,MAAM,UAAU,QAAQ,CAAC,GAAW;IAClC,OAAO,SAAS,GAAG,EAAE,CAAC;AACxB,CAAC;AAED,4DAA4D;AAC5D,MAAM,UAAU,gBAAgB,CAAC,MAAc,EAAE,QAAgB;IAC/D,OAAO,GAAG,MAAM,IAAI,QAAQ,EAAE,CAAC;AACjC,CAAC;AAED,+EAA+E;AAC/E,yBAAyB;AACzB,+EAA+E;AAE/E,oFAAoF;AACpF,MAAM,UAAU,cAAc,CAAC,GAAc;IAC3C,QAAQ,GAAG,CAAC,KAAK,EAAE,CAAC;QAClB,KAAK,UAAU;YACb,OAAO,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACnC,KAAK,OAAO;YACV,OAAO,QAAQ,CAAC,GAAG,CAAC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CAAC,MAAM,CAAC;YAAE,SAAS;QAC3E,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACpB,MAAM,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;IACzB,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,38 @@
1
+ import type { Channel } from "../channel";
2
+ import type { Memory } from "../memory";
3
+ import type { Model } from "../model";
4
+ import type { Node } from "../node";
5
+ import type { FunctionDeclaration } from "../function";
6
+ import type { Edge } from "../edge";
7
+ import type { Variable } from "../variable";
8
+ import type { Schemas } from "../api";
9
+ export type ApiWorkflow = Schemas["Workflow"];
10
+ /**
11
+ * The id of the project's main canvas. All other canvas ids identify function
12
+ * definitions. Lives here next to {@link Workflow} (which keys canvases
13
+ * by this value) so the headless validator can reason about canvas scope
14
+ * without depending on a UI store.
15
+ */
16
+ export declare const MAIN_CANVAS_ID: "main";
17
+ /**
18
+ * In-memory domain state for a workflow, which the headless validator consumes.
19
+ * NOT a persistence format, NOT the format the editor uses internally (Zustand stores).
20
+ * This format is used as intermediary when importing/exporting to api format and to run validation
21
+ */
22
+ export interface Workflow {
23
+ canvases: Record<string, Canvas>;
24
+ functions: Record<string, FunctionDeclaration>;
25
+ channels: Record<string, Channel>;
26
+ memory: Record<string, Memory>;
27
+ models: Record<string, Model>;
28
+ }
29
+ /**
30
+ * One canvas's worth of in-memory domain state — the body of either the main canvas
31
+ * or a function.
32
+ */
33
+ export interface Canvas {
34
+ nodes: Node[];
35
+ edges: Edge[];
36
+ variables: Record<string, Variable>;
37
+ }
38
+ //# sourceMappingURL=Workflow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Workflow.d.ts","sourceRoot":"","sources":["../../src/workflow/Workflow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEtC,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAE9C;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAG,MAAe,CAAC;AAE9C;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAC/C,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;CAC/B;AAED;;;GAGG;AACH,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;CACrC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The id of the project's main canvas. All other canvas ids identify function
3
+ * definitions. Lives here next to {@link Workflow} (which keys canvases
4
+ * by this value) so the headless validator can reason about canvas scope
5
+ * without depending on a UI store.
6
+ */
7
+ export const MAIN_CANVAS_ID = "main";
8
+ //# sourceMappingURL=Workflow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Workflow.js","sourceRoot":"","sources":["../../src/workflow/Workflow.ts"],"names":[],"mappings":"AAWA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,MAAe,CAAC"}
@@ -0,0 +1,4 @@
1
+ export type { ApiWorkflow, Workflow, Canvas } from "./Workflow";
2
+ export { MAIN_CANVAS_ID } from "./Workflow";
3
+ export { serialize, deserialize, computeVariablesFromNodes } from "./serialization";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/workflow/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { MAIN_CANVAS_ID } from "./Workflow";
2
+ export { serialize, deserialize, computeVariablesFromNodes } from "./serialization";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/workflow/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,43 @@
1
+ import type { Schemas } from "../api";
2
+ import type { NodeData } from "../node";
3
+ import type { Variable, NodeOutputVariable } from "../variable";
4
+ import { type Workflow } from "./Workflow";
5
+ /**
6
+ * Serialize domain → api Workflow. Multi-canvas
7
+ * mapping: the `main` canvas's nodes/edges/declaredVariables land at the
8
+ * root of `Workflow`; every other canvas becomes a `Function` entry in
9
+ * `Workflow.functions[]`, carrying its own functionInfo + outputAssignments.
10
+ */
11
+ export declare function serialize(state: Workflow): Schemas["Workflow"];
12
+ /**
13
+ * Deserialize api → domain Workflow. Variable
14
+ * records are reconstructed per canvas (declared from the api; fnarg
15
+ * from `functionInfo.arguments`; node-output via {@link computeVariablesFromNodes})
16
+ * since the api intentionally carries only `declaredVariables` to avoid
17
+ * redundancy.
18
+ *
19
+ * Each node is a flat {@link Node} (domain `NodeData` + `position`);
20
+ * its `type` is the domain node type (e.g. "Agent"). Workflow-builder projects
21
+ * that into a React Flow display type during store hydration — editor-only.
22
+ */
23
+ export declare function deserialize(workflow: Schemas["Workflow"]): Workflow;
24
+ /**
25
+ * Derive node-output variables (`{kind: "node", nodeId, outputId, ...}`)
26
+ * from an array of node instances. Calls {@link getNodeOutput} to inspect
27
+ * each node's declared outputs.
28
+ *
29
+ * Ported from workflow-builder's canvasStore to take NodeData[] directly
30
+ * (NodeData carries id at the top level — no React Flow wrapper needed).
31
+ */
32
+ export declare function computeVariablesFromNodes(nodes: NodeData[]): Record<string, NodeOutputVariable>;
33
+ /**
34
+ * Merge the three variable sources into a single per-canvas record:
35
+ * declared (from api)
36
+ * + fnarg (derived from the function's `arguments` — empty for the main canvas)
37
+ * + nodeOutput (derived from nodes via {@link computeVariablesFromNodes})
38
+ *
39
+ * Disjoint key namespaces (`declared:`, `fnarg:`, `<nodeId>:<outputId>`) so
40
+ * merge order is irrelevant.
41
+ */
42
+ export declare function buildCanvasVariables(nodes: NodeData[], fnArgs: readonly Schemas["Variable"][], declaredVariables: readonly Schemas["Variable"][]): Record<string, Variable>;
43
+ //# sourceMappingURL=serialization.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serialization.d.ts","sourceRoot":"","sources":["../../src/workflow/serialization.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAYxC,OAAO,KAAK,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEhE,OAAO,EAAkB,KAAK,QAAQ,EAAe,MAAM,YAAY,CAAC;AAKxE;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAwC9D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,QAAQ,CAqEnE;AAMD;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAc/F;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,QAAQ,EAAE,EACjB,MAAM,EAAE,SAAS,OAAO,CAAC,UAAU,CAAC,EAAE,EACtC,iBAAiB,EAAE,SAAS,OAAO,CAAC,UAAU,CAAC,EAAE,GAChD,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAoB1B"}