@unstable-dev/unmeshed-mcp 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -0
- package/dist/auth.d.ts +6 -0
- package/dist/auth.js +11 -0
- package/dist/client.d.ts +46 -0
- package/dist/client.js +97 -0
- package/dist/config.d.ts +10 -0
- package/dist/config.js +31 -0
- package/dist/get-docs.d.ts +8 -0
- package/dist/get-docs.js +64 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +35 -0
- package/dist/server.d.ts +4 -0
- package/dist/server.js +203 -0
- package/knowledge/README.md +16 -0
- package/knowledge/SKILL.md +359 -0
- package/knowledge/assets/patterns.md +637 -0
- package/knowledge/execution/debugging-guide.md +18 -0
- package/knowledge/execution/process-run.schema.md +24 -0
- package/knowledge/execution/step-run.schema.md +21 -0
- package/knowledge/process-definition.schema.md +36 -0
- package/knowledge/references/integrations.md +914 -0
- package/knowledge/references/steps-knowledge.md +834 -0
- package/knowledge/step-definition.schema.md +140 -0
- package/knowledge/step-output-paths.md +45 -0
- package/knowledge/steps/DECISION_ENGINE.md +248 -0
- package/knowledge/steps/DEPENDSON.md +296 -0
- package/knowledge/steps/EXIT.md +220 -0
- package/knowledge/steps/FAIL.md +198 -0
- package/knowledge/steps/FLOW_GATEWAY.md +405 -0
- package/knowledge/steps/FOREACH.md +250 -0
- package/knowledge/steps/HTTP.md +183 -0
- package/knowledge/steps/JAVASCRIPT.md +192 -0
- package/knowledge/steps/JQ.md +189 -0
- package/knowledge/steps/LIST.md +279 -0
- package/knowledge/steps/NOOP.md +165 -0
- package/knowledge/steps/PARALLEL.md +366 -0
- package/knowledge/steps/PYTHON.md +206 -0
- package/knowledge/steps/SEND_RESPONSE.md +301 -0
- package/knowledge/steps/SQLITE.md +301 -0
- package/knowledge/steps/SUB_PROCESS.md +296 -0
- package/knowledge/steps/SWITCH.md +369 -0
- package/knowledge/steps/UPDATE_STEP.md +257 -0
- package/knowledge/steps/WAIT.md +218 -0
- package/knowledge/steps/WHILE.md +328 -0
- package/knowledge/steps/WORKER.md +233 -0
- package/knowledge/system-prompt.md +274 -0
- package/package.json +39 -0
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
# While Step Schema
|
|
2
|
+
|
|
3
|
+
`WHILE` is a container step that executes exactly one child step repeatedly while
|
|
4
|
+
a JavaScript condition returns `true`. When the condition returns `false`, the
|
|
5
|
+
loop exits.
|
|
6
|
+
|
|
7
|
+
Use WHILE when the same operation needs to repeat until a runtime condition is
|
|
8
|
+
met, such as polling, paginating, transforming repeated inputs, or calling a
|
|
9
|
+
subprocess until work is complete.
|
|
10
|
+
|
|
11
|
+
## Definition Input Schema
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"script": "// (steps, context) will be provided as default inputs \n(steps, context) => {\n return whileloop.iteration < 3;\n}"
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Required:
|
|
20
|
+
- `script`: JavaScript function receiving `(steps, context)`.
|
|
21
|
+
- Script must return boolean `true` or `false`.
|
|
22
|
+
- `true` means execute the child step.
|
|
23
|
+
- `false` means exit the loop.
|
|
24
|
+
|
|
25
|
+
Injected keyword:
|
|
26
|
+
- `whileloop.iteration`: zero-based counter for the current loop execution.
|
|
27
|
+
|
|
28
|
+
The WHILE step must have exactly one child from the WHILE step's point of view.
|
|
29
|
+
If an iteration needs multiple steps, wrap them in a child `LIST`. If an
|
|
30
|
+
iteration should call another workflow, use a child `SUB_PROCESS`.
|
|
31
|
+
|
|
32
|
+
## Runtime Output Schema
|
|
33
|
+
|
|
34
|
+
The WHILE container output records the final condition result and final
|
|
35
|
+
iteration count.
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"result": false,
|
|
40
|
+
"iteration": 3,
|
|
41
|
+
"logs": []
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The WHILE step execution list contains prior condition evaluations:
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
[
|
|
49
|
+
{
|
|
50
|
+
"output": {
|
|
51
|
+
"result": true,
|
|
52
|
+
"iteration": 0,
|
|
53
|
+
"logs": []
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"output": {
|
|
58
|
+
"result": true,
|
|
59
|
+
"iteration": 1,
|
|
60
|
+
"logs": []
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"output": {
|
|
65
|
+
"result": true,
|
|
66
|
+
"iteration": 2,
|
|
67
|
+
"logs": []
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Child steps inside WHILE expose only the latest iteration on their top-level
|
|
74
|
+
`output`. Earlier iteration outputs are stored in the child step's
|
|
75
|
+
`executionList`.
|
|
76
|
+
|
|
77
|
+
## Output Access Paths
|
|
78
|
+
|
|
79
|
+
Use:
|
|
80
|
+
- `steps.<while_ref>.output.result` for the final loop condition result.
|
|
81
|
+
- `steps.<while_ref>.output.iteration` for the final iteration count.
|
|
82
|
+
- `steps.<while_ref>.executionList` for condition outputs from prior loop checks.
|
|
83
|
+
- `steps.<child_ref>.output` for the latest child iteration output.
|
|
84
|
+
- `steps.<child_ref>.executionList` for earlier child iteration outputs.
|
|
85
|
+
- `steps.<http_child_ref>.output.response` for the latest native HTTP child response.
|
|
86
|
+
|
|
87
|
+
Do not use:
|
|
88
|
+
- `steps.<while_ref>.output.response`
|
|
89
|
+
- `steps.<while_ref>.output.<child_ref>`
|
|
90
|
+
- `steps.<while_ref>.children.<child_ref>.output`
|
|
91
|
+
- `steps["<child_ref>[0]"].output` for WHILE iteration output; that indexed syntax is for FOREACH, not WHILE.
|
|
92
|
+
|
|
93
|
+
## Generation Rules
|
|
94
|
+
|
|
95
|
+
- Use uppercase step type: `"WHILE"`.
|
|
96
|
+
- Put JavaScript code in `input.script`.
|
|
97
|
+
- The script must accept `(steps, context)`.
|
|
98
|
+
- The script must return boolean `true` or `false`.
|
|
99
|
+
- Use `whileloop.iteration` for the zero-based loop counter.
|
|
100
|
+
- Include a clear false/exit condition to avoid endless loops.
|
|
101
|
+
- WHILE should have exactly one child step.
|
|
102
|
+
- Use a child `LIST` if one iteration needs multiple sequential steps.
|
|
103
|
+
- Use a child `SUB_PROCESS` if the repeated operation is another workflow.
|
|
104
|
+
- Nested WHILE loops are supported, but avoid unnecessary depth.
|
|
105
|
+
- Use output/state carefully to carry data between iterations.
|
|
106
|
+
- Prefer Unmeshed State Management when loop state must be process-level or durable.
|
|
107
|
+
|
|
108
|
+
## State And Iteration Output Rules
|
|
109
|
+
|
|
110
|
+
Inside loop child scripting steps:
|
|
111
|
+
- `steps.__self` refers to the currently running step.
|
|
112
|
+
- The previous iteration output is available to the step on the next run.
|
|
113
|
+
- A script can carry state by reading its previous output and returning updated output.
|
|
114
|
+
|
|
115
|
+
Example state update inside a JavaScript child step:
|
|
116
|
+
|
|
117
|
+
```javascript
|
|
118
|
+
(steps, context) => {
|
|
119
|
+
let currentSum = steps.__self?.output?.result?.sum || 0;
|
|
120
|
+
currentSum += 10;
|
|
121
|
+
return { sum: currentSum };
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
To collect every iteration output after WHILE, add a JavaScript step after the
|
|
126
|
+
loop and combine `executionList` plus the top-level final output:
|
|
127
|
+
|
|
128
|
+
```javascript
|
|
129
|
+
(steps, context) => {
|
|
130
|
+
const results = [];
|
|
131
|
+
const execs = steps.http_1.executionList ?? [];
|
|
132
|
+
for (const e of execs.slice(0, -1)) {
|
|
133
|
+
if (e.output) {
|
|
134
|
+
results.push(e.output);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
const finalOutput = steps.http_1.output;
|
|
138
|
+
if (finalOutput) {
|
|
139
|
+
results.push(finalOutput);
|
|
140
|
+
}
|
|
141
|
+
return { while_iterations_output: results };
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Debugging Rules
|
|
146
|
+
|
|
147
|
+
When debugging a WHILE:
|
|
148
|
+
- Inspect the WHILE step's `input.script`.
|
|
149
|
+
- Inspect `output.result` and `output.iteration`.
|
|
150
|
+
- Confirm the script eventually returns `false`.
|
|
151
|
+
- Inspect `input.__whileLoop` on the executed WHILE step when available.
|
|
152
|
+
- Inspect child step `executionList` for previous iteration outputs.
|
|
153
|
+
- Remember that the child top-level `output` is only the latest iteration output.
|
|
154
|
+
- If the process appears stuck, check whether the loop condition can ever become false.
|
|
155
|
+
- If multiple operations are needed per iteration, verify the child is a `LIST`.
|
|
156
|
+
|
|
157
|
+
Common failures:
|
|
158
|
+
- Endless loop because the condition never returns `false`.
|
|
159
|
+
- Script returns a non-boolean value.
|
|
160
|
+
- Missing or invalid use of `whileloop.iteration`.
|
|
161
|
+
- Multiple direct children under WHILE instead of one child `LIST`.
|
|
162
|
+
- Using FOREACH indexed output syntax for WHILE iteration outputs.
|
|
163
|
+
- Assuming child top-level output contains all iteration outputs.
|
|
164
|
+
- Forgetting that the latest run output may be top-level while prior outputs live in `executionList`.
|
|
165
|
+
|
|
166
|
+
## Minimal Process Definition Example
|
|
167
|
+
|
|
168
|
+
```json
|
|
169
|
+
{
|
|
170
|
+
"orgId": 1,
|
|
171
|
+
"namespace": "default",
|
|
172
|
+
"name": "while_test_gulam",
|
|
173
|
+
"version": 1,
|
|
174
|
+
"type": "API_ORCHESTRATION",
|
|
175
|
+
"description": null,
|
|
176
|
+
"configuration": null,
|
|
177
|
+
"steps": [
|
|
178
|
+
{
|
|
179
|
+
"orgId": 1,
|
|
180
|
+
"namespace": "default",
|
|
181
|
+
"name": "while",
|
|
182
|
+
"type": "WHILE",
|
|
183
|
+
"ref": "while_1",
|
|
184
|
+
"optional": false,
|
|
185
|
+
"createdBy": "system",
|
|
186
|
+
"updatedBy": "system",
|
|
187
|
+
"description": null,
|
|
188
|
+
"label": null,
|
|
189
|
+
"created": 1700000000000,
|
|
190
|
+
"updated": 1700000000000,
|
|
191
|
+
"configuration": {
|
|
192
|
+
"errorPolicyName": null,
|
|
193
|
+
"useCache": false,
|
|
194
|
+
"cacheKey": null,
|
|
195
|
+
"cacheTimeoutSeconds": 0,
|
|
196
|
+
"stream": false,
|
|
197
|
+
"streamAllStatuses": false,
|
|
198
|
+
"preExecutionScript": null,
|
|
199
|
+
"constructInputFromScript": false,
|
|
200
|
+
"scriptLanguage": null,
|
|
201
|
+
"jqTransformer": null,
|
|
202
|
+
"rateLimitMaxRequests": 0,
|
|
203
|
+
"rateLimitWindowSeconds": 0
|
|
204
|
+
},
|
|
205
|
+
"children": [
|
|
206
|
+
{
|
|
207
|
+
"orgId": 1,
|
|
208
|
+
"namespace": "default",
|
|
209
|
+
"name": "http",
|
|
210
|
+
"type": "HTTP",
|
|
211
|
+
"ref": "http_1",
|
|
212
|
+
"optional": false,
|
|
213
|
+
"createdBy": "system",
|
|
214
|
+
"updatedBy": "system",
|
|
215
|
+
"description": null,
|
|
216
|
+
"label": null,
|
|
217
|
+
"created": 1700000000000,
|
|
218
|
+
"updated": 1700000000000,
|
|
219
|
+
"configuration": {
|
|
220
|
+
"errorPolicyName": null,
|
|
221
|
+
"useCache": false,
|
|
222
|
+
"cacheKey": null,
|
|
223
|
+
"cacheTimeoutSeconds": 0,
|
|
224
|
+
"stream": false,
|
|
225
|
+
"streamAllStatuses": false,
|
|
226
|
+
"preExecutionScript": null,
|
|
227
|
+
"constructInputFromScript": false,
|
|
228
|
+
"scriptLanguage": null,
|
|
229
|
+
"jqTransformer": null,
|
|
230
|
+
"rateLimitMaxRequests": 0,
|
|
231
|
+
"rateLimitWindowSeconds": 0
|
|
232
|
+
},
|
|
233
|
+
"children": [],
|
|
234
|
+
"input": {
|
|
235
|
+
"method": "GET",
|
|
236
|
+
"url": "http://localhost:8080/api/test/get",
|
|
237
|
+
"headers": {
|
|
238
|
+
"Content-Type": "application/json",
|
|
239
|
+
"Accept": "application/json",
|
|
240
|
+
"Authorization": "Bearer {{secrets.test_token}}"
|
|
241
|
+
},
|
|
242
|
+
"params": {
|
|
243
|
+
"sampleKey": "sampleValue"
|
|
244
|
+
},
|
|
245
|
+
"repeatUntilEnabled": null,
|
|
246
|
+
"repeatUntilCondition": {
|
|
247
|
+
"script": "(steps, context) => {\n return steps.__self.output.response.counter === 100;\n}"
|
|
248
|
+
},
|
|
249
|
+
"repeatIntervalSeconds": null,
|
|
250
|
+
"maxRepeatCount": null,
|
|
251
|
+
"includeFullResponseString": false,
|
|
252
|
+
"noEncode": false,
|
|
253
|
+
"extraLongTimeouts": false
|
|
254
|
+
},
|
|
255
|
+
"output": null
|
|
256
|
+
}
|
|
257
|
+
],
|
|
258
|
+
"input": {
|
|
259
|
+
"script": "// (steps, context) will be provided as default inputs \n(steps, context) => {\n return whileloop.iteration < 3;\n}"
|
|
260
|
+
},
|
|
261
|
+
"output": null
|
|
262
|
+
}
|
|
263
|
+
],
|
|
264
|
+
"defaultInput": null,
|
|
265
|
+
"defaultOutput": null,
|
|
266
|
+
"outputMapping": null,
|
|
267
|
+
"signature": null,
|
|
268
|
+
"metadata": null,
|
|
269
|
+
"tags": null,
|
|
270
|
+
"dependencies": null,
|
|
271
|
+
"dependents": null
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
## Minimal Executed Step Example
|
|
276
|
+
|
|
277
|
+
```json
|
|
278
|
+
{
|
|
279
|
+
"id": 592668723,
|
|
280
|
+
"processId": 592668721,
|
|
281
|
+
"ref": "while_1",
|
|
282
|
+
"namespace": "default",
|
|
283
|
+
"name": "while",
|
|
284
|
+
"type": "WHILE",
|
|
285
|
+
"status": "COMPLETED",
|
|
286
|
+
"input": {
|
|
287
|
+
"script": "// (steps, context) will be provided as default inputs \n(steps, context) => {\n return whileloop.iteration < 3;\n}",
|
|
288
|
+
"__whileLoop": {
|
|
289
|
+
"ticketId": "while_1",
|
|
290
|
+
"iteration": 3,
|
|
291
|
+
"loopComplete": true,
|
|
292
|
+
"executedTickets": []
|
|
293
|
+
},
|
|
294
|
+
"__currentExecutionStartTime": 1778186238199
|
|
295
|
+
},
|
|
296
|
+
"output": {
|
|
297
|
+
"result": false,
|
|
298
|
+
"iteration": 3,
|
|
299
|
+
"logs": []
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
Child HTTP latest output example:
|
|
305
|
+
|
|
306
|
+
```json
|
|
307
|
+
{
|
|
308
|
+
"ref": "http_1",
|
|
309
|
+
"parentRef": "while_1",
|
|
310
|
+
"type": "HTTP",
|
|
311
|
+
"input": {
|
|
312
|
+
"__iteration": 2,
|
|
313
|
+
"__tickets": [
|
|
314
|
+
"while_1:592668723:0",
|
|
315
|
+
"while_1:592668723:1",
|
|
316
|
+
"while_1:592668723:2"
|
|
317
|
+
]
|
|
318
|
+
},
|
|
319
|
+
"output": {
|
|
320
|
+
"response": {
|
|
321
|
+
"counter": 6492,
|
|
322
|
+
"randomId": "5efb3a97-5207-4446-a10c-711823d0ed7e"
|
|
323
|
+
},
|
|
324
|
+
"statusCode": 200
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
```
|
|
328
|
+
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
# Worker Step Schema
|
|
2
|
+
|
|
3
|
+
`WORKER` delegates execution to an external worker node instead of running code
|
|
4
|
+
inside the Unmeshed Engine. Use it when work must run outside Unmeshed, such as
|
|
5
|
+
when organization policy prevents Unmeshed from accessing data directly, when
|
|
6
|
+
business logic already exists in an external service, or when built-in steps do
|
|
7
|
+
not provide the required capability.
|
|
8
|
+
|
|
9
|
+
Worker nodes are external clients that connect to Unmeshed, poll for work, run
|
|
10
|
+
worker methods, and return results. Unmeshed still schedules, tracks, retries,
|
|
11
|
+
reschedules, and times out worker steps according to process needs and error
|
|
12
|
+
policies.
|
|
13
|
+
|
|
14
|
+
## Definition Input Schema
|
|
15
|
+
|
|
16
|
+
Worker input is the object passed to the worker method. If the worker method has
|
|
17
|
+
an input parameter, all fields under the step `input` are used to build that
|
|
18
|
+
object.
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"myString": "myValue"
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Minimal observed worker step:
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"type": "WORKER",
|
|
31
|
+
"name": "worker",
|
|
32
|
+
"namespace": "default",
|
|
33
|
+
"ref": "worker_1",
|
|
34
|
+
"optional": false,
|
|
35
|
+
"createdBy": "system",
|
|
36
|
+
"updatedBy": "system",
|
|
37
|
+
"created": 1700000000000,
|
|
38
|
+
"updated": 1700000000000,
|
|
39
|
+
"children": [],
|
|
40
|
+
"input": {},
|
|
41
|
+
"configuration": {
|
|
42
|
+
"rateLimitMaxRequests": null,
|
|
43
|
+
"rateLimitWindowSeconds": null
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Important:
|
|
49
|
+
- Some worker SDK languages may fail if extra input fields are included.
|
|
50
|
+
- Match the worker method input shape exactly when known.
|
|
51
|
+
- If the worker method accepts no parameter, use `input: {}`.
|
|
52
|
+
|
|
53
|
+
## Runtime Output Schema
|
|
54
|
+
|
|
55
|
+
If the worker method returns an object, its fields are exposed directly under
|
|
56
|
+
the step `output`.
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"myInteger": 1
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Observed manual/completion-style output:
|
|
65
|
+
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
"__completionReason": "No reason provided",
|
|
69
|
+
"__actedBy": "gulam@unmeshed.com"
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Worker output is not automatically wrapped in `result`.
|
|
74
|
+
|
|
75
|
+
## Output Access Paths
|
|
76
|
+
|
|
77
|
+
Use:
|
|
78
|
+
- `steps.<ref>.output.<field>` for fields returned by the worker method.
|
|
79
|
+
- `steps.<ref>.output.__completionReason` for observed completion reason metadata.
|
|
80
|
+
- `steps.<ref>.output.__actedBy` for observed actor metadata.
|
|
81
|
+
- `stepRecords[].workerId` when debugging which worker handled the step.
|
|
82
|
+
- `stepRecords[].executionList` when debugging polling/rescheduling behavior.
|
|
83
|
+
|
|
84
|
+
Do not use:
|
|
85
|
+
- `steps.<ref>.output.result` unless the worker itself explicitly returned a field named `result`.
|
|
86
|
+
- `steps.<ref>.output.response`
|
|
87
|
+
- `steps.<ref>.output.logs` unless the worker itself explicitly returned a field named `logs`.
|
|
88
|
+
|
|
89
|
+
## Generation Rules
|
|
90
|
+
|
|
91
|
+
- Use uppercase step type: `"WORKER"`.
|
|
92
|
+
- Use `children: []`; WORKER is not a container.
|
|
93
|
+
- Put only the worker method input fields in `input`.
|
|
94
|
+
- Avoid adding extra input fields unless the worker method accepts them.
|
|
95
|
+
- Worker methods can receive up to one input parameter.
|
|
96
|
+
- Worker methods can optionally return a result object.
|
|
97
|
+
- Returned object fields become direct output fields.
|
|
98
|
+
- Use error policies/timeouts when work must complete within a threshold.
|
|
99
|
+
- Do not generate worker implementation code inside the process definition; the worker runs externally.
|
|
100
|
+
- Do not assume a worker is available unless the user confirms the worker service is connected.
|
|
101
|
+
|
|
102
|
+
## Scheduling And Rescheduling
|
|
103
|
+
|
|
104
|
+
Unlike regular built-in steps, worker nodes may return an incomplete result. If
|
|
105
|
+
timeout thresholds have not been met, Unmeshed can reschedule the worker step so
|
|
106
|
+
a client can execute it later.
|
|
107
|
+
|
|
108
|
+
Debugging clues:
|
|
109
|
+
- `executionList[].scheduled` shows when work was scheduled.
|
|
110
|
+
- `executionList[].polled` shows when a worker/client picked it up.
|
|
111
|
+
- `executionList[].executor` may identify the executor, or be `null`.
|
|
112
|
+
- `runs` may be `0` if work was completed/updated without a normal worker run.
|
|
113
|
+
- `workerId` may be `null` when no specific worker id is recorded.
|
|
114
|
+
|
|
115
|
+
## Debugging Rules
|
|
116
|
+
|
|
117
|
+
When debugging a WORKER:
|
|
118
|
+
- Inspect the step `input` and compare it to the worker method's expected input shape.
|
|
119
|
+
- Inspect direct fields under `output`.
|
|
120
|
+
- Check `workerId`, `executionList`, `scheduled`, `polled`, `start`, and `updated`.
|
|
121
|
+
- If the step did not run, check whether a worker node is connected and polling.
|
|
122
|
+
- If the step timed out, inspect error policy/time thresholds.
|
|
123
|
+
- If the worker failed due to deserialization, look for extra or missing input fields.
|
|
124
|
+
- If output seems missing, confirm whether the worker method returned an object.
|
|
125
|
+
|
|
126
|
+
Common failures:
|
|
127
|
+
- Extra input fields cause SDK/object mapping failures.
|
|
128
|
+
- Worker service is not connected or not polling.
|
|
129
|
+
- Worker method name/configuration does not match the registered worker capability.
|
|
130
|
+
- Looking for output at `output.result` instead of direct output fields.
|
|
131
|
+
- Timeout/error policy fails the step while a worker is still running.
|
|
132
|
+
- Worker returns incomplete output and the step is rescheduled.
|
|
133
|
+
|
|
134
|
+
## Minimal Process Definition Example
|
|
135
|
+
|
|
136
|
+
```json
|
|
137
|
+
{
|
|
138
|
+
"orgId": 1,
|
|
139
|
+
"namespace": "default",
|
|
140
|
+
"name": "kebab-case-name",
|
|
141
|
+
"version": 1,
|
|
142
|
+
"type": "API_ORCHESTRATION",
|
|
143
|
+
"description": "Delegate work to an external worker.",
|
|
144
|
+
"configuration": null,
|
|
145
|
+
"steps": [
|
|
146
|
+
{
|
|
147
|
+
"type": "WORKER",
|
|
148
|
+
"name": "worker",
|
|
149
|
+
"namespace": "default",
|
|
150
|
+
"ref": "worker_1",
|
|
151
|
+
"optional": false,
|
|
152
|
+
"createdBy": "system",
|
|
153
|
+
"updatedBy": "system",
|
|
154
|
+
"created": 1700000000000,
|
|
155
|
+
"updated": 1700000000000,
|
|
156
|
+
"children": [],
|
|
157
|
+
"input": {},
|
|
158
|
+
"configuration": {
|
|
159
|
+
"rateLimitMaxRequests": null,
|
|
160
|
+
"rateLimitWindowSeconds": null
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
],
|
|
164
|
+
"defaultInput": null,
|
|
165
|
+
"defaultOutput": null,
|
|
166
|
+
"outputMapping": null,
|
|
167
|
+
"signature": null,
|
|
168
|
+
"metadata": null,
|
|
169
|
+
"tags": null,
|
|
170
|
+
"dependencies": null,
|
|
171
|
+
"dependents": null
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Minimal Executed Step Example
|
|
176
|
+
|
|
177
|
+
```json
|
|
178
|
+
{
|
|
179
|
+
"id": 28800043,
|
|
180
|
+
"processId": 28800041,
|
|
181
|
+
"ref": "worker_1",
|
|
182
|
+
"namespace": "default",
|
|
183
|
+
"name": "worker",
|
|
184
|
+
"type": "WORKER",
|
|
185
|
+
"status": "COMPLETED",
|
|
186
|
+
"input": {},
|
|
187
|
+
"output": {
|
|
188
|
+
"__completionReason": "No reason provided",
|
|
189
|
+
"__actedBy": "gulam@unmeshed.com"
|
|
190
|
+
},
|
|
191
|
+
"workerId": null,
|
|
192
|
+
"start": 0,
|
|
193
|
+
"schedule": 1778185168004,
|
|
194
|
+
"updated": 1778185197573,
|
|
195
|
+
"optional": false,
|
|
196
|
+
"executionList": [
|
|
197
|
+
{
|
|
198
|
+
"id": 0,
|
|
199
|
+
"scheduled": 1778185168004,
|
|
200
|
+
"polled": 1778185197572,
|
|
201
|
+
"start": 1778185197572,
|
|
202
|
+
"updated": 1778185197573,
|
|
203
|
+
"executor": null,
|
|
204
|
+
"ref": "worker_1",
|
|
205
|
+
"runs": 0,
|
|
206
|
+
"output": {}
|
|
207
|
+
}
|
|
208
|
+
]
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Example Worker Input And Output
|
|
213
|
+
|
|
214
|
+
If the worker method input object has one field named `myString`, the step input
|
|
215
|
+
should be:
|
|
216
|
+
|
|
217
|
+
```json
|
|
218
|
+
{
|
|
219
|
+
"myString": "myValue"
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
If the worker method returns an object with one field named `myInteger`, later
|
|
224
|
+
steps should read:
|
|
225
|
+
|
|
226
|
+
```javascript
|
|
227
|
+
(steps, context) => {
|
|
228
|
+
return {
|
|
229
|
+
valueFromWorker: steps.worker_1.output.myInteger
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|