Commit 652a1ce
committed
feat(engine): add interpolatable field support for dynamic type resolution
Introduces a new interpolation pattern that allows block input fields to accept
both their strict types (enums, booleans, integers) and string variables that
get resolved at execution time. This enables dynamic workflow behavior while
maintaining type safety through two-phase validation:
1. Load time: Accept Union[StrictType, str], validate interpolation syntax
2. Execution time: Resolve variables, validate against strict type
Key additions:
- New interpolation.py module (588 lines) with reusable validators and resolvers
- Interpolatable enum, boolean, and numeric field support
- Updated executors (Shell, CreateFile, HttpCall, LLMCall, State) with interpolation
- LLMProvider enum type for better type safety
- Comprehensive validation with clear error messages
This change enables workflows to use variables in strictly-typed fields:
provider: "{{inputs.llm_provider}}" # Resolves to LLMProvider enum
timeout: "{{blocks.config.outputs.timeout}}" # Resolves to int
verify_ssl: "{{inputs.ssl_enabled}}" # Resolves to bool1 parent 810d266 commit 652a1ce
8 files changed
Lines changed: 1216 additions & 222 deletions
File tree
- src/workflows_mcp/engine
- tests
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
20 | 24 | | |
21 | 25 | | |
22 | 26 | | |
| |||
36 | 40 | | |
37 | 41 | | |
38 | 42 | | |
39 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
40 | 46 | | |
41 | 47 | | |
42 | 48 | | |
| |||
46 | 52 | | |
47 | 53 | | |
48 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
49 | 60 | | |
50 | 61 | | |
51 | 62 | | |
| |||
361 | 372 | | |
362 | 373 | | |
363 | 374 | | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
364 | 378 | | |
365 | 379 | | |
366 | 380 | | |
| |||
408 | 422 | | |
409 | 423 | | |
410 | 424 | | |
411 | | - | |
| 425 | + | |
412 | 426 | | |
413 | 427 | | |
414 | 428 | | |
415 | 429 | | |
416 | | - | |
417 | | - | |
418 | | - | |
| 430 | + | |
419 | 431 | | |
420 | 432 | | |
421 | 433 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
25 | 29 | | |
26 | 30 | | |
27 | 31 | | |
| |||
38 | 42 | | |
39 | 43 | | |
40 | 44 | | |
41 | | - | |
42 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
43 | 60 | | |
44 | 61 | | |
45 | 62 | | |
| |||
101 | 118 | | |
102 | 119 | | |
103 | 120 | | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
104 | 125 | | |
105 | 126 | | |
106 | 127 | | |
| |||
112 | 133 | | |
113 | 134 | | |
114 | 135 | | |
115 | | - | |
| 136 | + | |
116 | 137 | | |
117 | 138 | | |
118 | 139 | | |
| |||
136 | 157 | | |
137 | 158 | | |
138 | 159 | | |
139 | | - | |
| 160 | + | |
140 | 161 | | |
141 | 162 | | |
142 | 163 | | |
| |||
161 | 182 | | |
162 | 183 | | |
163 | 184 | | |
164 | | - | |
| 185 | + | |
165 | 186 | | |
166 | | - | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
167 | 196 | | |
168 | 197 | | |
169 | 198 | | |
| |||
222 | 251 | | |
223 | 252 | | |
224 | 253 | | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
225 | 257 | | |
226 | 258 | | |
227 | 259 | | |
| |||
233 | 265 | | |
234 | 266 | | |
235 | 267 | | |
236 | | - | |
| 268 | + | |
237 | 269 | | |
238 | 270 | | |
239 | 271 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
37 | 43 | | |
38 | 44 | | |
39 | 45 | | |
| |||
71 | 77 | | |
72 | 78 | | |
73 | 79 | | |
74 | | - | |
| 80 | + | |
75 | 81 | | |
76 | | - | |
77 | | - | |
78 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
79 | 100 | | |
80 | | - | |
81 | | - | |
82 | 101 | | |
83 | 102 | | |
84 | 103 | | |
| |||
163 | 182 | | |
164 | 183 | | |
165 | 184 | | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
166 | 192 | | |
167 | 193 | | |
168 | 194 | | |
| |||
174 | 200 | | |
175 | 201 | | |
176 | 202 | | |
177 | | - | |
178 | | - | |
179 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
180 | 206 | | |
181 | 207 | | |
182 | 208 | | |
| |||
188 | 214 | | |
189 | 215 | | |
190 | 216 | | |
191 | | - | |
192 | | - | |
193 | | - | |
| 217 | + | |
194 | 218 | | |
195 | 219 | | |
196 | 220 | | |
| |||
0 commit comments