@fluidgrids/workflows 0.0.0-stage → 2026.1027.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 (60) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +187 -2
  3. package/dist/assemble-BJo9TECS.d.cts +569 -0
  4. package/dist/assemble-DMOuaxRI.d.ts +569 -0
  5. package/dist/chunk-265J2FCH.cjs +33 -0
  6. package/dist/chunk-27HASETB.cjs +250 -0
  7. package/dist/chunk-4DPEGDPW.js +74 -0
  8. package/dist/chunk-5LUIDMF4.js +42 -0
  9. package/dist/chunk-AU3YW7FZ.cjs +279 -0
  10. package/dist/chunk-BWSLWF2E.js +722 -0
  11. package/dist/chunk-BYJ7QTLY.cjs +76 -0
  12. package/dist/chunk-G4UEPUGO.cjs +46 -0
  13. package/dist/chunk-GO34UHSY.js +95 -0
  14. package/dist/chunk-IZQNUNSU.cjs +931 -0
  15. package/dist/chunk-KUTMY2IO.cjs +745 -0
  16. package/dist/chunk-LMX35GNQ.js +893 -0
  17. package/dist/chunk-LRM6JXJA.cjs +181 -0
  18. package/dist/chunk-LSKSBVL4.cjs +102 -0
  19. package/dist/chunk-LUXCXFOE.cjs +269 -0
  20. package/dist/chunk-PL73GJR4.js +174 -0
  21. package/dist/chunk-REV7ZOA4.js +170 -0
  22. package/dist/chunk-RRQ5HOBF.cjs +185 -0
  23. package/dist/chunk-S34NJE3A.js +262 -0
  24. package/dist/chunk-SRQRLWOS.js +31 -0
  25. package/dist/chunk-SS4LT2IP.js +268 -0
  26. package/dist/chunk-X4HKU3MX.js +244 -0
  27. package/dist/codegen/index.cjs +18 -0
  28. package/dist/codegen/index.d.cts +15 -0
  29. package/dist/codegen/index.d.ts +15 -0
  30. package/dist/codegen/index.js +5 -0
  31. package/dist/expressions-DhHaqyar.d.cts +62 -0
  32. package/dist/expressions-DhHaqyar.d.ts +62 -0
  33. package/dist/hash-CZkTXPCX.d.cts +15 -0
  34. package/dist/hash-CZkTXPCX.d.ts +15 -0
  35. package/dist/index.cjs +117 -0
  36. package/dist/index.d.cts +27 -0
  37. package/dist/index.d.ts +27 -0
  38. package/dist/index.js +4 -0
  39. package/dist/ir/index.cjs +1244 -0
  40. package/dist/ir/index.d.cts +828 -0
  41. package/dist/ir/index.d.ts +828 -0
  42. package/dist/ir/index.js +1120 -0
  43. package/dist/lower-DcOY8ux0.d.cts +49 -0
  44. package/dist/lower-Dw5grNrI.d.ts +49 -0
  45. package/dist/manifest-Bp9ZJlav.d.ts +60 -0
  46. package/dist/manifest-Duf-gHdO.d.cts +60 -0
  47. package/dist/node-evaluator-2GTUZVPK.cjs +17 -0
  48. package/dist/node-evaluator-RMYEWCXZ.js +8 -0
  49. package/dist/quickjs/index.cjs +92 -0
  50. package/dist/quickjs/index.d.cts +18 -0
  51. package/dist/quickjs/index.d.ts +18 -0
  52. package/dist/quickjs/index.js +90 -0
  53. package/dist/roundtrip/index.cjs +1375 -0
  54. package/dist/roundtrip/index.d.cts +287 -0
  55. package/dist/roundtrip/index.d.ts +287 -0
  56. package/dist/roundtrip/index.js +1328 -0
  57. package/dist/types-Dr2Fn1Ax.d.cts +225 -0
  58. package/dist/types-Dr2Fn1Ax.d.ts +225 -0
  59. package/package.json +117 -4
  60. package/schema/ir-v2.schema.json +655 -0
@@ -0,0 +1,828 @@
1
+ import { W as WorkflowDefinition, b as WorkflowInterface, a as JsonObject, P as Position } from '../types-Dr2Fn1Ax.js';
2
+ export { C as CodeBundleActivityExport, c as CodeBundleWorkflowExport, d as ConnectionRef, E as ErrorType, e as ExecutionSettings, J as Json, L as LegacyCredentialRef, N as NodeArgs, f as NodeErrorConfig, g as NodeTimeout, R as RetryConfig, h as RunOnSetting, i as WorkflowAuthoring, j as WorkflowCode, k as WorkflowConfig, l as WorkflowEdge, m as WorkflowNode } from '../types-Dr2Fn1Ax.js';
3
+ export { S as SourceFile, b as buildIdOf, h as hashedProjection, i as irHash, s as sourceHash } from '../hash-CZkTXPCX.js';
4
+ import { N as NodeManifest } from '../manifest-Bp9ZJlav.js';
5
+ export { M as ManifestField, a as ManifestHandles, b as ManifestOperation, f as fieldSchema, c as fieldsSchema, d as findManifest, i as isTriggerOperation, o as operationsOf } from '../manifest-Bp9ZJlav.js';
6
+ export { P as PathSegment, R as RefRoot, T as TemplatePart, V as ValueRefModel, f as formatRefExpression, a as formatRefTemplate, p as parseRefExpression, b as parseTemplate } from '../expressions-DhHaqyar.js';
7
+
8
+ /**
9
+ * JSON Schema (draft 2020-12) of the workflow IR, schema version 2.
10
+ *
11
+ * The schema is deliberately open where stored version-1 definitions vary
12
+ * (builder UI fields, legacy mirrors, `config` on internal nodes): every
13
+ * definition the service accepts today must validate unchanged. It is closed
14
+ * where version 2 adds structure (`interface`, `code`, `authoring`, the two new
15
+ * node types). `schema/ir-v2.schema.json` is generated from this object by
16
+ * `bun run generate`; a test keeps the two equal.
17
+ */
18
+ declare const IR_V2_SCHEMA_ID = "https://docs.fluidgrids.ai/schemas/workflow-ir-v2.schema.json";
19
+ declare const IR_V2_SCHEMA: {
20
+ readonly $schema: "https://json-schema.org/draft/2020-12/schema";
21
+ readonly $id: "https://docs.fluidgrids.ai/schemas/workflow-ir-v2.schema.json";
22
+ readonly title: "FluidGrids workflow definition (IR schema version 2)";
23
+ readonly description: "The canonical workflow definition (definitionJson). Version 2 is a strict superset of version 1: a document without schemaVersion is version 1 and validates here unchanged.";
24
+ readonly type: "object";
25
+ readonly required: readonly ["data"];
26
+ readonly properties: {
27
+ readonly schemaVersion: {
28
+ readonly enum: readonly [1, 2];
29
+ readonly description: "Absent means 1.";
30
+ };
31
+ readonly key: {
32
+ readonly type: "string";
33
+ };
34
+ readonly name: {
35
+ readonly type: "string";
36
+ };
37
+ readonly description: {
38
+ readonly type: readonly ["string", "null"];
39
+ };
40
+ readonly interface: {
41
+ readonly $ref: "#/$defs/interface";
42
+ };
43
+ readonly code: {
44
+ readonly $ref: "#/$defs/code";
45
+ };
46
+ readonly authoring: {
47
+ readonly $ref: "#/$defs/authoring";
48
+ };
49
+ readonly data: {
50
+ readonly type: "object";
51
+ readonly required: readonly ["nodes", "edges"];
52
+ readonly properties: {
53
+ readonly nodes: {
54
+ readonly type: "array";
55
+ readonly items: {
56
+ readonly $ref: "#/$defs/node";
57
+ };
58
+ };
59
+ readonly edges: {
60
+ readonly type: "array";
61
+ readonly items: {
62
+ readonly $ref: "#/$defs/edge";
63
+ };
64
+ };
65
+ readonly stickyNotes: {
66
+ readonly type: "array";
67
+ readonly items: {
68
+ readonly type: "object";
69
+ };
70
+ };
71
+ };
72
+ };
73
+ readonly config: {
74
+ readonly $ref: "#/$defs/config";
75
+ };
76
+ readonly pinnedData: {
77
+ readonly type: "object";
78
+ };
79
+ readonly meta: {
80
+ readonly type: "object";
81
+ readonly properties: {
82
+ readonly layout: {
83
+ readonly type: "object";
84
+ readonly description: "Positions and sizes keyed by node id, preserved verbatim by every code tool.";
85
+ };
86
+ };
87
+ };
88
+ readonly tags: {
89
+ readonly type: "array";
90
+ };
91
+ };
92
+ readonly $defs: {
93
+ readonly position: {
94
+ readonly type: "object";
95
+ readonly required: readonly ["x", "y"];
96
+ readonly properties: {
97
+ readonly x: {
98
+ readonly type: "number";
99
+ };
100
+ readonly y: {
101
+ readonly type: "number";
102
+ };
103
+ };
104
+ };
105
+ readonly connectionRef: {
106
+ readonly type: "object";
107
+ readonly required: readonly ["connectionId", "adapter"];
108
+ readonly properties: {
109
+ readonly connectionId: {
110
+ readonly type: "string";
111
+ };
112
+ readonly adapter: {
113
+ readonly type: "string";
114
+ };
115
+ };
116
+ };
117
+ readonly retryConfig: {
118
+ readonly type: "object";
119
+ readonly properties: {
120
+ readonly maxRetries: {
121
+ readonly type: "number";
122
+ readonly minimum: 0;
123
+ };
124
+ readonly retryDelay: {
125
+ readonly type: "number";
126
+ readonly minimum: 0;
127
+ };
128
+ readonly backoffMultiplier: {
129
+ readonly type: "number";
130
+ };
131
+ readonly maxDelay: {
132
+ readonly type: "number";
133
+ readonly minimum: 0;
134
+ };
135
+ readonly retryOnErrorTypes: {
136
+ readonly type: "array";
137
+ readonly items: {
138
+ readonly type: "string";
139
+ };
140
+ };
141
+ readonly nonRetryableErrorTypes: {
142
+ readonly type: "array";
143
+ readonly items: {
144
+ readonly type: "string";
145
+ };
146
+ };
147
+ };
148
+ };
149
+ readonly errorConfig: {
150
+ readonly type: "object";
151
+ readonly properties: {
152
+ readonly onError: {
153
+ readonly type: "string";
154
+ };
155
+ readonly errorBranchId: {
156
+ readonly type: "string";
157
+ };
158
+ readonly retryConfig: {
159
+ readonly $ref: "#/$defs/retryConfig";
160
+ };
161
+ readonly timeout: {
162
+ readonly type: "object";
163
+ readonly properties: {
164
+ readonly duration: {
165
+ readonly type: "number";
166
+ readonly minimum: 0;
167
+ };
168
+ readonly onTimeout: {
169
+ readonly type: "string";
170
+ };
171
+ readonly timeoutBranchId: {
172
+ readonly type: "string";
173
+ };
174
+ };
175
+ };
176
+ };
177
+ };
178
+ readonly executionSettings: {
179
+ readonly type: "object";
180
+ readonly properties: {
181
+ readonly alwaysOutputData: {
182
+ readonly type: "boolean";
183
+ };
184
+ readonly executeOnce: {
185
+ readonly type: "boolean";
186
+ };
187
+ readonly runOn: {
188
+ readonly type: "object";
189
+ };
190
+ };
191
+ };
192
+ readonly node: {
193
+ readonly type: "object";
194
+ readonly required: readonly ["id", "type"];
195
+ readonly properties: {
196
+ readonly id: {
197
+ readonly type: "string";
198
+ readonly minLength: 1;
199
+ };
200
+ readonly type: {
201
+ readonly type: "string";
202
+ readonly minLength: 1;
203
+ };
204
+ readonly label: {
205
+ readonly type: "string";
206
+ };
207
+ readonly position: {
208
+ readonly $ref: "#/$defs/position";
209
+ };
210
+ readonly operation_name: {
211
+ readonly type: "string";
212
+ };
213
+ readonly version: {
214
+ readonly type: "string";
215
+ };
216
+ readonly args: {
217
+ readonly type: "object";
218
+ readonly properties: {
219
+ readonly state: {
220
+ readonly type: "object";
221
+ };
222
+ readonly context: {
223
+ readonly type: "object";
224
+ };
225
+ readonly connections: {
226
+ readonly type: "array";
227
+ readonly items: {
228
+ readonly $ref: "#/$defs/connectionRef";
229
+ };
230
+ };
231
+ readonly credentials: {
232
+ readonly type: "array";
233
+ readonly items: {
234
+ readonly type: "object";
235
+ };
236
+ };
237
+ };
238
+ };
239
+ readonly errorConfig: {
240
+ readonly $ref: "#/$defs/errorConfig";
241
+ };
242
+ readonly executionSettings: {
243
+ readonly $ref: "#/$defs/executionSettings";
244
+ };
245
+ readonly disabled: {
246
+ readonly type: "boolean";
247
+ };
248
+ readonly data: {
249
+ readonly type: "object";
250
+ };
251
+ readonly config: {
252
+ readonly type: "object";
253
+ };
254
+ };
255
+ readonly allOf: readonly [{
256
+ readonly if: {
257
+ readonly properties: {
258
+ readonly type: {
259
+ readonly const: "internal:code-workflow";
260
+ };
261
+ };
262
+ readonly required: readonly ["type"];
263
+ };
264
+ readonly then: {
265
+ readonly required: readonly ["args"];
266
+ readonly properties: {
267
+ readonly args: {
268
+ readonly required: readonly ["state"];
269
+ readonly properties: {
270
+ readonly state: {
271
+ readonly type: "object";
272
+ readonly required: readonly ["workflowFn"];
273
+ readonly properties: {
274
+ readonly workflowFn: {
275
+ readonly type: "string";
276
+ readonly minLength: 1;
277
+ };
278
+ readonly inputMapping: {};
279
+ readonly taskQueue: {
280
+ readonly type: "string";
281
+ readonly minLength: 1;
282
+ };
283
+ readonly waitForCompletion: {
284
+ readonly type: "boolean";
285
+ };
286
+ readonly timeout: {
287
+ readonly type: "number";
288
+ readonly minimum: 0;
289
+ };
290
+ readonly failOnError: {
291
+ readonly type: "boolean";
292
+ };
293
+ readonly parentClosePolicy: {
294
+ readonly enum: readonly ["TERMINATE", "ABANDON", "REQUEST_CANCEL"];
295
+ };
296
+ };
297
+ };
298
+ };
299
+ };
300
+ };
301
+ };
302
+ }, {
303
+ readonly if: {
304
+ readonly properties: {
305
+ readonly type: {
306
+ readonly const: "internal:wait-for-signal";
307
+ };
308
+ };
309
+ readonly required: readonly ["type"];
310
+ };
311
+ readonly then: {
312
+ readonly required: readonly ["args"];
313
+ readonly properties: {
314
+ readonly args: {
315
+ readonly required: readonly ["state"];
316
+ readonly properties: {
317
+ readonly state: {
318
+ readonly type: "object";
319
+ readonly required: readonly ["signalName"];
320
+ readonly properties: {
321
+ readonly signalName: {
322
+ readonly type: "string";
323
+ readonly minLength: 1;
324
+ };
325
+ readonly limitWait: {
326
+ readonly type: "object";
327
+ readonly required: readonly ["amount", "unit"];
328
+ readonly properties: {
329
+ readonly amount: {
330
+ readonly type: "number";
331
+ readonly exclusiveMinimum: 0;
332
+ };
333
+ readonly unit: {
334
+ readonly type: "string";
335
+ };
336
+ };
337
+ };
338
+ readonly payloadSchema: {
339
+ readonly type: "object";
340
+ };
341
+ };
342
+ };
343
+ };
344
+ };
345
+ };
346
+ };
347
+ }];
348
+ };
349
+ readonly edge: {
350
+ readonly type: "object";
351
+ readonly required: readonly ["source", "target"];
352
+ readonly properties: {
353
+ readonly id: {
354
+ readonly type: "string";
355
+ };
356
+ readonly source: {
357
+ readonly type: "string";
358
+ readonly minLength: 1;
359
+ };
360
+ readonly target: {
361
+ readonly type: "string";
362
+ readonly minLength: 1;
363
+ };
364
+ readonly sourceHandle: {
365
+ readonly type: readonly ["string", "null"];
366
+ };
367
+ readonly targetHandle: {
368
+ readonly type: readonly ["string", "null"];
369
+ };
370
+ readonly type: {
371
+ readonly type: "string";
372
+ };
373
+ readonly label: {};
374
+ readonly data: {
375
+ readonly type: "object";
376
+ };
377
+ readonly mapping: {
378
+ readonly type: "object";
379
+ };
380
+ };
381
+ };
382
+ readonly config: {
383
+ readonly type: "object";
384
+ readonly properties: {
385
+ readonly maxParallelism: {
386
+ readonly type: "number";
387
+ readonly minimum: 1;
388
+ };
389
+ readonly timeout: {
390
+ readonly type: "number";
391
+ readonly minimum: 0;
392
+ readonly description: "Run timeout in seconds.";
393
+ };
394
+ readonly executionTimeout: {
395
+ readonly type: readonly ["number", "string"];
396
+ readonly description: "Seconds or a duration string.";
397
+ };
398
+ readonly workflowTaskTimeout: {
399
+ readonly type: readonly ["number", "string"];
400
+ readonly description: "Seconds or a duration string.";
401
+ };
402
+ readonly versioningBehavior: {
403
+ readonly enum: readonly ["PINNED", "AUTO_UPGRADE"];
404
+ };
405
+ };
406
+ };
407
+ readonly interface: {
408
+ readonly type: "object";
409
+ readonly additionalProperties: false;
410
+ readonly properties: {
411
+ readonly input: {
412
+ readonly type: "object";
413
+ };
414
+ readonly output: {
415
+ readonly type: "object";
416
+ };
417
+ readonly signals: {
418
+ readonly type: "object";
419
+ readonly additionalProperties: {
420
+ readonly type: "object";
421
+ readonly additionalProperties: false;
422
+ readonly properties: {
423
+ readonly payload: {
424
+ readonly type: "object";
425
+ };
426
+ readonly description: {
427
+ readonly type: "string";
428
+ };
429
+ };
430
+ };
431
+ };
432
+ readonly queries: {
433
+ readonly type: "object";
434
+ readonly additionalProperties: {
435
+ readonly type: "object";
436
+ readonly additionalProperties: false;
437
+ readonly properties: {
438
+ readonly args: {
439
+ readonly type: "object";
440
+ };
441
+ readonly result: {
442
+ readonly type: "object";
443
+ };
444
+ readonly description: {
445
+ readonly type: "string";
446
+ };
447
+ };
448
+ };
449
+ };
450
+ readonly updates: {
451
+ readonly type: "object";
452
+ readonly additionalProperties: {
453
+ readonly type: "object";
454
+ readonly additionalProperties: false;
455
+ readonly properties: {
456
+ readonly args: {
457
+ readonly type: "object";
458
+ };
459
+ readonly result: {
460
+ readonly type: "object";
461
+ };
462
+ readonly description: {
463
+ readonly type: "string";
464
+ };
465
+ };
466
+ };
467
+ };
468
+ readonly open: {
469
+ readonly type: "object";
470
+ readonly additionalProperties: false;
471
+ readonly properties: {
472
+ readonly signals: {
473
+ readonly type: "boolean";
474
+ };
475
+ readonly queries: {
476
+ readonly type: "boolean";
477
+ };
478
+ readonly updates: {
479
+ readonly type: "boolean";
480
+ };
481
+ };
482
+ };
483
+ };
484
+ };
485
+ readonly code: {
486
+ readonly type: "object";
487
+ readonly additionalProperties: false;
488
+ readonly required: readonly ["language", "buildId"];
489
+ readonly properties: {
490
+ readonly language: {
491
+ readonly enum: readonly ["typescript", "python"];
492
+ };
493
+ readonly sdk: {
494
+ readonly type: "string";
495
+ };
496
+ readonly buildId: {
497
+ readonly type: "string";
498
+ readonly pattern: "^sha256:[0-9a-f]{64}$";
499
+ };
500
+ readonly bundleRef: {
501
+ readonly type: "string";
502
+ };
503
+ readonly sourceRef: {
504
+ readonly type: "string";
505
+ };
506
+ readonly entry: {
507
+ readonly type: "string";
508
+ };
509
+ readonly exports: {
510
+ readonly type: "object";
511
+ readonly additionalProperties: false;
512
+ readonly properties: {
513
+ readonly workflows: {
514
+ readonly type: "object";
515
+ readonly additionalProperties: {
516
+ readonly type: "object";
517
+ readonly properties: {
518
+ readonly interface: {
519
+ readonly $ref: "#/$defs/interface";
520
+ };
521
+ readonly taskQueue: {
522
+ readonly type: "string";
523
+ };
524
+ };
525
+ };
526
+ };
527
+ readonly activities: {
528
+ readonly type: "object";
529
+ readonly additionalProperties: {
530
+ readonly type: "object";
531
+ readonly properties: {
532
+ readonly taskQueue: {
533
+ readonly type: "string";
534
+ };
535
+ readonly input: {
536
+ readonly type: "object";
537
+ };
538
+ readonly output: {
539
+ readonly type: "object";
540
+ };
541
+ };
542
+ };
543
+ };
544
+ };
545
+ };
546
+ readonly determinism: {
547
+ readonly enum: readonly ["isolate", "worker"];
548
+ };
549
+ };
550
+ };
551
+ readonly authoring: {
552
+ readonly type: "object";
553
+ readonly additionalProperties: false;
554
+ readonly properties: {
555
+ readonly mode: {
556
+ readonly enum: readonly ["canvas", "code", "hybrid"];
557
+ };
558
+ readonly generator: {
559
+ readonly enum: readonly ["builder", "sdk-ts", "sdk-py", "ai", "import", "lift"];
560
+ };
561
+ readonly generatorVersion: {
562
+ readonly type: "string";
563
+ };
564
+ readonly sourceHash: {
565
+ readonly type: "string";
566
+ readonly pattern: "^sha256:[0-9a-f]{64}$";
567
+ };
568
+ readonly liftedFrom: {
569
+ readonly type: "object";
570
+ readonly additionalProperties: false;
571
+ readonly properties: {
572
+ readonly workflowKey: {
573
+ readonly type: "string";
574
+ };
575
+ readonly version: {
576
+ readonly type: "string";
577
+ };
578
+ readonly fidelity: {
579
+ readonly enum: readonly ["lossless", "lossy"];
580
+ };
581
+ };
582
+ };
583
+ };
584
+ };
585
+ };
586
+ };
587
+
588
+ /**
589
+ * Rewrite legacy mirrors into canonical positions (spec 01 §2). See the module
590
+ * comment for the exact rules. Anything that is not a definition object is
591
+ * returned unchanged.
592
+ */
593
+ declare function normalizeDefinition(definition: WorkflowDefinition): WorkflowDefinition;
594
+ declare function normalizeDefinition(definition: unknown): unknown;
595
+
596
+ interface ExecutorNodeView {
597
+ id: unknown;
598
+ type: unknown;
599
+ /** `selectedOperationName`: root, `data.operation_name`, `data.operation`. */
600
+ operation: string;
601
+ /** The root/`data.operation_name` pair the trigger detection reads on its own. */
602
+ legacyOperation: string;
603
+ version: unknown;
604
+ parameters: unknown;
605
+ connections: unknown;
606
+ credentials: unknown;
607
+ errorConfig: unknown;
608
+ executeOnce: boolean;
609
+ runOn: unknown;
610
+ disabled: boolean;
611
+ nodeDataNodeType: unknown;
612
+ argsContextNodeType: unknown;
613
+ }
614
+ /** The executor-visible values of one node. */
615
+ declare function executorNodeView(node: unknown): ExecutorNodeView;
616
+ /** The executor view of every node of a definition, in node order. */
617
+ declare function executorView(definition: unknown): ExecutorNodeView[];
618
+
619
+ /** One finding. `code` is stable; `message` is English. */
620
+ interface ValidationIssue {
621
+ code: string;
622
+ message: string;
623
+ nodeId?: string;
624
+ path?: string;
625
+ }
626
+ interface ValidationResult {
627
+ valid: boolean;
628
+ errors: ValidationIssue[];
629
+ warnings: ValidationIssue[];
630
+ /** Every task queue the definition names, for the caller's existence check. */
631
+ taskQueues: string[];
632
+ }
633
+ interface ValidateOptions {
634
+ /** Spec 01 §9 rule 7: no legacy mirrors, no `${…}` templates, slug node ids. */
635
+ strict?: boolean;
636
+ /** Accept a definition with no nodes (the builder saves a blank draft first). */
637
+ allowEmpty?: boolean;
638
+ /** Rule 5: true when the workspace has this task queue. `managed` always exists. */
639
+ isTaskQueueKnown?: (name: string) => boolean;
640
+ /** Clock for schedule evaluation (rule 8). */
641
+ now?: Date;
642
+ }
643
+ /** True for a value that is a valid JSON Schema 2020-12 document. */
644
+ declare function isValidJsonSchema(schema: unknown): boolean;
645
+ /** Validate a workflow definition. */
646
+ declare function validate(definition: unknown, options?: ValidateOptions): ValidationResult;
647
+
648
+ /**
649
+ * Canonical JSON (RFC 8785, JSON Canonicalization Scheme).
650
+ *
651
+ * Object keys are sorted by UTF-16 code units, numbers use the ECMAScript
652
+ * shortest round-trip form, strings use the ECMAScript escaping, and there is
653
+ * no insignificant whitespace. The Python SDK implements the same scheme, so a
654
+ * graph lowered by either SDK hashes to the same `irHash`.
655
+ */
656
+ declare class CanonicalJsonError extends Error {
657
+ constructor(message: string);
658
+ }
659
+ /**
660
+ * Serialise a JSON value canonically. Keys whose value is `undefined` are
661
+ * omitted (as `JSON.stringify` does); anything JSON cannot represent throws.
662
+ */
663
+ declare function canonicalJson(value: unknown): string;
664
+ /**
665
+ * Pretty-print a JSON value with keys in canonical order and two-space
666
+ * indentation, ending with a newline. Used for fixtures and files written for
667
+ * people to read; hashing always uses {@link canonicalJson}.
668
+ */
669
+ declare function stableStringify(value: unknown): string;
670
+
671
+ /**
672
+ * SHA-256 (FIPS 180-4) over UTF-8 text, in plain TypeScript.
673
+ *
674
+ * The IR helpers run in the service, the CLI and the browser builder, so they
675
+ * cannot depend on `node:crypto`, and Web Crypto is asynchronous. Hashing a
676
+ * definition is small and infrequent, so a synchronous implementation is the
677
+ * simpler contract. The test suite checks it against `node:crypto`.
678
+ */
679
+ /** Hex SHA-256 digest of the UTF-8 encoding of `text`. */
680
+ declare function sha256Hex(text: string): string;
681
+ /** `sha256:<hex>`, the digest form stored in IR fields (`irHash`, `buildId`, `sourceHash`). */
682
+ declare function sha256Tagged(text: string): string;
683
+
684
+ declare const WORKFLOW_DOCUMENT_FORMAT = "fluidgrids.workflow";
685
+ /** True when the definition uses anything schema version 2 added. */
686
+ declare function isV2Definition(definition: unknown): boolean;
687
+ /** The envelope `schemaVersion` for a definition. */
688
+ declare function envelopeSchemaVersion(definition: unknown): 1 | 2;
689
+ /** The definition as an export carries it: verbatim for version 1, normalised for version 2. */
690
+ declare function exportDefinition(definition: unknown): unknown;
691
+ /** A node the import must find installed. */
692
+ interface WorkflowNodeReference {
693
+ nodeType: string;
694
+ nodeVersion: string | null;
695
+ [key: string]: unknown;
696
+ }
697
+ /** Fields of the export envelope, in the order the service writes them. */
698
+ interface WorkflowExportDocument {
699
+ format: typeof WORKFLOW_DOCUMENT_FORMAT;
700
+ schemaVersion: 1 | 2;
701
+ exportedAt: string | Date;
702
+ workflowKey: string;
703
+ version: string;
704
+ name: string;
705
+ description: string | null;
706
+ definitionJson: unknown;
707
+ context: unknown;
708
+ tags: string[];
709
+ tagsV2: unknown;
710
+ icon: string | null;
711
+ category: string | null;
712
+ nodeReferences: WorkflowNodeReference[];
713
+ }
714
+ /** What the service knows about the version being exported. */
715
+ type WorkflowExportInput = Omit<WorkflowExportDocument, 'format' | 'schemaVersion'>;
716
+ /**
717
+ * Build the envelope with the service's field order. `definitionJson` must
718
+ * already be masked (`maskDefinitionSecrets`); it is passed through
719
+ * {@link exportDefinition}.
720
+ */
721
+ declare function buildExportDocument(input: WorkflowExportInput): WorkflowExportDocument;
722
+ /**
723
+ * The text committed to Git for one version, identical to
724
+ * `git-sync-rules.ts` `serializeWorkflowDocument`: `exportedAt` pinned to the
725
+ * version's creation time so pushing the same version twice gives the same bytes.
726
+ */
727
+ declare function serializeWorkflowDocument(document: WorkflowExportDocument, versionCreatedAt: Date): string;
728
+ /** A parsed envelope or bare definition. */
729
+ interface ParsedWorkflowDocument {
730
+ definitionJson: Record<string, unknown>;
731
+ workflowKey: string | null;
732
+ version: string | null;
733
+ schemaVersion: 1 | 2 | null;
734
+ }
735
+ /**
736
+ * Read an export envelope (`schemaVersion` 1 or 2) or a bare definition, as
737
+ * Git restore does today. Import uses the same reader so both accept the same
738
+ * inputs. Returns null when the value is not a usable document.
739
+ */
740
+ declare function readWorkflowDocument(value: unknown): ParsedWorkflowDocument | null;
741
+ /** {@link readWorkflowDocument} over JSON text; null when the text is not usable JSON. */
742
+ declare function parseWorkflowDocument(text: string): ParsedWorkflowDocument | null;
743
+
744
+ interface DefinitionChange {
745
+ kind: 'added' | 'removed' | 'changed' | 'reordered';
746
+ path: string;
747
+ before?: unknown;
748
+ after?: unknown;
749
+ }
750
+ /** Every difference between two definitions. Empty means equal `irHash`. */
751
+ declare function diffDefinitions(before: unknown, after: unknown): DefinitionChange[];
752
+
753
+ /**
754
+ * Parse `workflowInputs` (one field per line, `name` or `name:type`), as the
755
+ * trigger manifest documents it. Unknown types leave the field untyped.
756
+ */
757
+ declare function workflowInputsSchema(workflowInputs: string): JsonObject;
758
+ /** The declared interface, or the one derived from the graph. */
759
+ declare function deriveInterface(definition: unknown, options?: {
760
+ manifests?: readonly NodeManifest[];
761
+ }): WorkflowInterface;
762
+
763
+ /**
764
+ * Automatic layout for nodes that carry no position.
765
+ *
766
+ * The algorithm is the one the AI draft generator uses
767
+ * (`wspace-workflow-svc/src/modules/ai/generation/draft.ts` `layoutNodes`), so
768
+ * a graph built in code lands on the canvas the same way a generated draft
769
+ * does: a left-to-right layered layout where each node sits one column after
770
+ * its deepest predecessor, nodes in a column are stacked and centred around
771
+ * y = 0, and unreachable nodes go in the first free column.
772
+ */
773
+
774
+ declare const LAYOUT_COLUMN_WIDTH = 300;
775
+ declare const LAYOUT_ROW_HEIGHT = 170;
776
+ /** Compute a position for every node id, in the order the nodes are given. */
777
+ declare function autoLayout(nodeIds: readonly string[], edges: ReadonlyArray<{
778
+ source: string;
779
+ target: string;
780
+ }>): Map<string, Position>;
781
+
782
+ /**
783
+ * Durations as the IR and the SDK accept them (spec 02 §5): a number in a
784
+ * caller-chosen unit, a short string (`'500ms'`, `'30s'`, `'2m'`, `'3h'`,
785
+ * `'1d'`, `'1w'`), or ISO 8601 (`'PT2H'`, `'P3D'`, `'P1DT2H30M'`).
786
+ */
787
+ /**
788
+ * Milliseconds for a duration, or undefined when the value is not one. A bare
789
+ * number is read in `numberUnit` (seconds for run-level config, milliseconds
790
+ * for node timeouts).
791
+ */
792
+ declare function durationMs(value: unknown, numberUnit: 'ms' | 's'): number | undefined;
793
+
794
+ interface ScheduleCheck {
795
+ ok: boolean;
796
+ /** Why the spec is unusable, when it is. */
797
+ problem?: string;
798
+ /** The next fire times (at most ten), ISO 8601, when computable. */
799
+ nextFireTimes: string[];
800
+ }
801
+ /** Check a schedule trigger's `spec`. `timezone` is the trigger's own timezone field, used when the spec has none. */
802
+ declare function checkScheduleSpec(spec: unknown, options?: {
803
+ now?: Date;
804
+ timezone?: unknown;
805
+ }): ScheduleCheck;
806
+
807
+ /**
808
+ * Node type knowledge shared by normalisation, validation and lifting.
809
+ *
810
+ * The executor-side list mirrors `fluidgrids-workers/src/executor/internal-node-type.ts`
811
+ * (`INTERNAL_NODE_MAPPINGS`): exactly these types run through the internal
812
+ * node executor, which merges parameters from four locations. Every other type
813
+ * (triggers included) takes the external path, which reads `args.state` alone.
814
+ */
815
+ /** Node types added by IR version 2 (spec 01 §3). */
816
+ declare const CODE_WORKFLOW_NODE_TYPE = "internal:code-workflow";
817
+ declare const WAIT_FOR_SIGNAL_NODE_TYPE = "internal:wait-for-signal";
818
+ /** Internal trigger node types seeded by wspace-workflow-svc (`triggers/manifests`). */
819
+ declare const INTERNAL_TRIGGER_TYPES: ReadonlySet<string>;
820
+ /**
821
+ * True when the node goes through the internal node executor and therefore
822
+ * sees the merged `data < config < data.args.state < args.state` parameters.
823
+ * The two version-2 node types are internal by design and are treated the
824
+ * same way.
825
+ */
826
+ declare function usesMergedParameters(type: string): boolean;
827
+
828
+ export { CODE_WORKFLOW_NODE_TYPE, CanonicalJsonError, type DefinitionChange, type ExecutorNodeView, INTERNAL_TRIGGER_TYPES, IR_V2_SCHEMA, IR_V2_SCHEMA_ID, JsonObject, LAYOUT_COLUMN_WIDTH, LAYOUT_ROW_HEIGHT, NodeManifest, type ParsedWorkflowDocument, Position, type ScheduleCheck, type ValidateOptions, type ValidationIssue, type ValidationResult, WAIT_FOR_SIGNAL_NODE_TYPE, WORKFLOW_DOCUMENT_FORMAT, WorkflowDefinition, type WorkflowExportDocument, type WorkflowExportInput, WorkflowInterface, type WorkflowNodeReference, autoLayout, buildExportDocument, canonicalJson, checkScheduleSpec, deriveInterface, diffDefinitions, durationMs, envelopeSchemaVersion, executorNodeView, executorView, exportDefinition, isV2Definition, isValidJsonSchema, normalizeDefinition, parseWorkflowDocument, readWorkflowDocument, serializeWorkflowDocument, sha256Hex, sha256Tagged, stableStringify, usesMergedParameters, validate, workflowInputsSchema };