@wave-av/workflow-sdk 1.0.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.
@@ -0,0 +1,615 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * WAVE Workflow SDK Types
5
+ *
6
+ * Type definitions for workflow definitions, executions, and events.
7
+ */
8
+
9
+ /**
10
+ * Agent configuration within a workflow phase
11
+ */
12
+ interface WorkflowAgent {
13
+ type: string;
14
+ config?: Record<string, unknown>;
15
+ timeout_seconds?: number;
16
+ retry_policy?: RetryPolicy;
17
+ }
18
+ /**
19
+ * Retry policy configuration
20
+ */
21
+ interface RetryPolicy {
22
+ max_attempts: number;
23
+ backoff_type: 'fixed' | 'exponential';
24
+ initial_delay_ms: number;
25
+ max_delay_ms?: number;
26
+ }
27
+ /**
28
+ * Workflow phase definition
29
+ */
30
+ interface WorkflowPhase {
31
+ name: string;
32
+ description?: string;
33
+ order: number;
34
+ agents: WorkflowAgent[];
35
+ condition?: PhaseCondition;
36
+ on_failure?: 'fail' | 'skip' | 'retry';
37
+ }
38
+ /**
39
+ * Conditional phase execution
40
+ */
41
+ interface PhaseCondition {
42
+ type: 'expression' | 'previous_phase_status';
43
+ expression?: string;
44
+ required_status?: 'completed' | 'skipped';
45
+ }
46
+ /**
47
+ * Workflow configuration
48
+ */
49
+ interface WorkflowConfig {
50
+ timeout_seconds?: number;
51
+ max_retries?: number;
52
+ checkpoint_enabled?: boolean;
53
+ parallel_phases?: boolean;
54
+ fail_fast?: boolean;
55
+ notification_channels?: string[];
56
+ }
57
+ /**
58
+ * Complete workflow definition
59
+ */
60
+ interface WorkflowDefinition {
61
+ id: string;
62
+ name: string;
63
+ slug: string;
64
+ description?: string;
65
+ organization_id: string;
66
+ created_by: string;
67
+ category: string;
68
+ version: string;
69
+ status: 'draft' | 'active' | 'deprecated' | 'archived';
70
+ phases: WorkflowPhase[];
71
+ config: WorkflowConfig;
72
+ tags?: string[];
73
+ created_at: string;
74
+ updated_at: string;
75
+ }
76
+ /**
77
+ * Execution status
78
+ */
79
+ type ExecutionStatus = 'pending' | 'running' | 'paused' | 'completed' | 'failed' | 'cancelled' | 'timeout';
80
+ /**
81
+ * Phase execution status
82
+ */
83
+ interface PhaseExecutionStatus {
84
+ name: string;
85
+ order: number;
86
+ status: ExecutionStatus;
87
+ started_at?: string;
88
+ completed_at?: string;
89
+ error?: string;
90
+ output?: Record<string, unknown>;
91
+ }
92
+ /**
93
+ * Workflow execution record
94
+ */
95
+ interface WorkflowExecution {
96
+ id: string;
97
+ workflow_id: string;
98
+ organization_id: string;
99
+ triggered_by: string;
100
+ trigger_type: 'manual' | 'scheduled' | 'webhook' | 'api' | 'event';
101
+ status: ExecutionStatus;
102
+ input_params?: Record<string, unknown>;
103
+ output?: Record<string, unknown>;
104
+ current_phase?: string;
105
+ phase_statuses: PhaseExecutionStatus[];
106
+ checkpoint_id?: string;
107
+ error?: string;
108
+ started_at?: string;
109
+ completed_at?: string;
110
+ created_at: string;
111
+ updated_at: string;
112
+ }
113
+ /**
114
+ * Execution log entry
115
+ */
116
+ interface ExecutionLog {
117
+ id: string;
118
+ execution_id: string;
119
+ timestamp: string;
120
+ level: 'debug' | 'info' | 'warn' | 'error' | 'fatal';
121
+ source: string;
122
+ message: string;
123
+ metadata?: Record<string, unknown>;
124
+ }
125
+ /**
126
+ * Base workflow event
127
+ */
128
+ interface WorkflowEvent<T = unknown> {
129
+ type: string;
130
+ timestamp: string;
131
+ workflow_id: string;
132
+ execution_id?: string;
133
+ organization_id: string;
134
+ data: T;
135
+ }
136
+ /**
137
+ * Execution started event
138
+ */
139
+ interface ExecutionStartedEvent extends WorkflowEvent<{
140
+ trigger_type: string;
141
+ input_params?: Record<string, unknown>;
142
+ }> {
143
+ type: 'execution.started';
144
+ execution_id: string;
145
+ }
146
+ /**
147
+ * Execution completed event
148
+ */
149
+ interface ExecutionCompletedEvent extends WorkflowEvent<{
150
+ duration_ms: number;
151
+ output?: Record<string, unknown>;
152
+ }> {
153
+ type: 'execution.completed';
154
+ execution_id: string;
155
+ }
156
+ /**
157
+ * Execution failed event
158
+ */
159
+ interface ExecutionFailedEvent extends WorkflowEvent<{
160
+ error: string;
161
+ failed_phase?: string;
162
+ duration_ms: number;
163
+ }> {
164
+ type: 'execution.failed';
165
+ execution_id: string;
166
+ }
167
+ /**
168
+ * Phase started event
169
+ */
170
+ interface PhaseStartedEvent extends WorkflowEvent<{
171
+ phase_name: string;
172
+ phase_order: number;
173
+ }> {
174
+ type: 'phase.started';
175
+ execution_id: string;
176
+ }
177
+ /**
178
+ * Phase completed event
179
+ */
180
+ interface PhaseCompletedEvent extends WorkflowEvent<{
181
+ phase_name: string;
182
+ phase_order: number;
183
+ duration_ms: number;
184
+ output?: Record<string, unknown>;
185
+ }> {
186
+ type: 'phase.completed';
187
+ execution_id: string;
188
+ }
189
+ /**
190
+ * Union of all workflow events
191
+ */
192
+ type AnyWorkflowEvent = ExecutionStartedEvent | ExecutionCompletedEvent | ExecutionFailedEvent | PhaseStartedEvent | PhaseCompletedEvent;
193
+ /**
194
+ * Execute workflow request
195
+ */
196
+ interface ExecuteWorkflowRequest {
197
+ input_params?: Record<string, unknown>;
198
+ trigger_type?: 'manual' | 'api';
199
+ idempotency_key?: string;
200
+ checkpoint_id?: string;
201
+ }
202
+ /**
203
+ * Execute workflow response
204
+ */
205
+ interface ExecuteWorkflowResponse {
206
+ execution: WorkflowExecution;
207
+ }
208
+ /**
209
+ * List executions request
210
+ */
211
+ interface ListExecutionsRequest {
212
+ workflow_id?: string;
213
+ status?: ExecutionStatus;
214
+ limit?: number;
215
+ offset?: number;
216
+ order_by?: 'created_at' | 'started_at' | 'completed_at';
217
+ order?: 'asc' | 'desc';
218
+ }
219
+ /**
220
+ * List executions response
221
+ */
222
+ interface ListExecutionsResponse {
223
+ executions: WorkflowExecution[];
224
+ total: number;
225
+ has_more: boolean;
226
+ }
227
+ declare const WorkflowAgentSchema: z.ZodObject<{
228
+ type: z.ZodString;
229
+ config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
230
+ timeout_seconds: z.ZodOptional<z.ZodNumber>;
231
+ retry_policy: z.ZodOptional<z.ZodObject<{
232
+ max_attempts: z.ZodNumber;
233
+ backoff_type: z.ZodEnum<["fixed", "exponential"]>;
234
+ initial_delay_ms: z.ZodNumber;
235
+ max_delay_ms: z.ZodOptional<z.ZodNumber>;
236
+ }, "strip", z.ZodTypeAny, {
237
+ max_attempts: number;
238
+ backoff_type: "fixed" | "exponential";
239
+ initial_delay_ms: number;
240
+ max_delay_ms?: number | undefined;
241
+ }, {
242
+ max_attempts: number;
243
+ backoff_type: "fixed" | "exponential";
244
+ initial_delay_ms: number;
245
+ max_delay_ms?: number | undefined;
246
+ }>>;
247
+ }, "strip", z.ZodTypeAny, {
248
+ type: string;
249
+ config?: Record<string, unknown> | undefined;
250
+ timeout_seconds?: number | undefined;
251
+ retry_policy?: {
252
+ max_attempts: number;
253
+ backoff_type: "fixed" | "exponential";
254
+ initial_delay_ms: number;
255
+ max_delay_ms?: number | undefined;
256
+ } | undefined;
257
+ }, {
258
+ type: string;
259
+ config?: Record<string, unknown> | undefined;
260
+ timeout_seconds?: number | undefined;
261
+ retry_policy?: {
262
+ max_attempts: number;
263
+ backoff_type: "fixed" | "exponential";
264
+ initial_delay_ms: number;
265
+ max_delay_ms?: number | undefined;
266
+ } | undefined;
267
+ }>;
268
+ declare const WorkflowPhaseSchema: z.ZodObject<{
269
+ name: z.ZodString;
270
+ description: z.ZodOptional<z.ZodString>;
271
+ order: z.ZodNumber;
272
+ agents: z.ZodArray<z.ZodObject<{
273
+ type: z.ZodString;
274
+ config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
275
+ timeout_seconds: z.ZodOptional<z.ZodNumber>;
276
+ retry_policy: z.ZodOptional<z.ZodObject<{
277
+ max_attempts: z.ZodNumber;
278
+ backoff_type: z.ZodEnum<["fixed", "exponential"]>;
279
+ initial_delay_ms: z.ZodNumber;
280
+ max_delay_ms: z.ZodOptional<z.ZodNumber>;
281
+ }, "strip", z.ZodTypeAny, {
282
+ max_attempts: number;
283
+ backoff_type: "fixed" | "exponential";
284
+ initial_delay_ms: number;
285
+ max_delay_ms?: number | undefined;
286
+ }, {
287
+ max_attempts: number;
288
+ backoff_type: "fixed" | "exponential";
289
+ initial_delay_ms: number;
290
+ max_delay_ms?: number | undefined;
291
+ }>>;
292
+ }, "strip", z.ZodTypeAny, {
293
+ type: string;
294
+ config?: Record<string, unknown> | undefined;
295
+ timeout_seconds?: number | undefined;
296
+ retry_policy?: {
297
+ max_attempts: number;
298
+ backoff_type: "fixed" | "exponential";
299
+ initial_delay_ms: number;
300
+ max_delay_ms?: number | undefined;
301
+ } | undefined;
302
+ }, {
303
+ type: string;
304
+ config?: Record<string, unknown> | undefined;
305
+ timeout_seconds?: number | undefined;
306
+ retry_policy?: {
307
+ max_attempts: number;
308
+ backoff_type: "fixed" | "exponential";
309
+ initial_delay_ms: number;
310
+ max_delay_ms?: number | undefined;
311
+ } | undefined;
312
+ }>, "many">;
313
+ condition: z.ZodOptional<z.ZodObject<{
314
+ type: z.ZodEnum<["expression", "previous_phase_status"]>;
315
+ expression: z.ZodOptional<z.ZodString>;
316
+ required_status: z.ZodOptional<z.ZodEnum<["completed", "skipped"]>>;
317
+ }, "strip", z.ZodTypeAny, {
318
+ type: "expression" | "previous_phase_status";
319
+ expression?: string | undefined;
320
+ required_status?: "completed" | "skipped" | undefined;
321
+ }, {
322
+ type: "expression" | "previous_phase_status";
323
+ expression?: string | undefined;
324
+ required_status?: "completed" | "skipped" | undefined;
325
+ }>>;
326
+ on_failure: z.ZodOptional<z.ZodEnum<["fail", "skip", "retry"]>>;
327
+ }, "strip", z.ZodTypeAny, {
328
+ order: number;
329
+ name: string;
330
+ agents: {
331
+ type: string;
332
+ config?: Record<string, unknown> | undefined;
333
+ timeout_seconds?: number | undefined;
334
+ retry_policy?: {
335
+ max_attempts: number;
336
+ backoff_type: "fixed" | "exponential";
337
+ initial_delay_ms: number;
338
+ max_delay_ms?: number | undefined;
339
+ } | undefined;
340
+ }[];
341
+ description?: string | undefined;
342
+ condition?: {
343
+ type: "expression" | "previous_phase_status";
344
+ expression?: string | undefined;
345
+ required_status?: "completed" | "skipped" | undefined;
346
+ } | undefined;
347
+ on_failure?: "fail" | "skip" | "retry" | undefined;
348
+ }, {
349
+ order: number;
350
+ name: string;
351
+ agents: {
352
+ type: string;
353
+ config?: Record<string, unknown> | undefined;
354
+ timeout_seconds?: number | undefined;
355
+ retry_policy?: {
356
+ max_attempts: number;
357
+ backoff_type: "fixed" | "exponential";
358
+ initial_delay_ms: number;
359
+ max_delay_ms?: number | undefined;
360
+ } | undefined;
361
+ }[];
362
+ description?: string | undefined;
363
+ condition?: {
364
+ type: "expression" | "previous_phase_status";
365
+ expression?: string | undefined;
366
+ required_status?: "completed" | "skipped" | undefined;
367
+ } | undefined;
368
+ on_failure?: "fail" | "skip" | "retry" | undefined;
369
+ }>;
370
+ declare const WorkflowConfigSchema: z.ZodObject<{
371
+ timeout_seconds: z.ZodOptional<z.ZodNumber>;
372
+ max_retries: z.ZodOptional<z.ZodNumber>;
373
+ checkpoint_enabled: z.ZodOptional<z.ZodBoolean>;
374
+ parallel_phases: z.ZodOptional<z.ZodBoolean>;
375
+ fail_fast: z.ZodOptional<z.ZodBoolean>;
376
+ notification_channels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
377
+ }, "strip", z.ZodTypeAny, {
378
+ timeout_seconds?: number | undefined;
379
+ max_retries?: number | undefined;
380
+ checkpoint_enabled?: boolean | undefined;
381
+ parallel_phases?: boolean | undefined;
382
+ fail_fast?: boolean | undefined;
383
+ notification_channels?: string[] | undefined;
384
+ }, {
385
+ timeout_seconds?: number | undefined;
386
+ max_retries?: number | undefined;
387
+ checkpoint_enabled?: boolean | undefined;
388
+ parallel_phases?: boolean | undefined;
389
+ fail_fast?: boolean | undefined;
390
+ notification_channels?: string[] | undefined;
391
+ }>;
392
+ declare const WorkflowDefinitionSchema: z.ZodObject<{
393
+ name: z.ZodString;
394
+ slug: z.ZodString;
395
+ description: z.ZodOptional<z.ZodString>;
396
+ category: z.ZodString;
397
+ version: z.ZodString;
398
+ phases: z.ZodArray<z.ZodObject<{
399
+ name: z.ZodString;
400
+ description: z.ZodOptional<z.ZodString>;
401
+ order: z.ZodNumber;
402
+ agents: z.ZodArray<z.ZodObject<{
403
+ type: z.ZodString;
404
+ config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
405
+ timeout_seconds: z.ZodOptional<z.ZodNumber>;
406
+ retry_policy: z.ZodOptional<z.ZodObject<{
407
+ max_attempts: z.ZodNumber;
408
+ backoff_type: z.ZodEnum<["fixed", "exponential"]>;
409
+ initial_delay_ms: z.ZodNumber;
410
+ max_delay_ms: z.ZodOptional<z.ZodNumber>;
411
+ }, "strip", z.ZodTypeAny, {
412
+ max_attempts: number;
413
+ backoff_type: "fixed" | "exponential";
414
+ initial_delay_ms: number;
415
+ max_delay_ms?: number | undefined;
416
+ }, {
417
+ max_attempts: number;
418
+ backoff_type: "fixed" | "exponential";
419
+ initial_delay_ms: number;
420
+ max_delay_ms?: number | undefined;
421
+ }>>;
422
+ }, "strip", z.ZodTypeAny, {
423
+ type: string;
424
+ config?: Record<string, unknown> | undefined;
425
+ timeout_seconds?: number | undefined;
426
+ retry_policy?: {
427
+ max_attempts: number;
428
+ backoff_type: "fixed" | "exponential";
429
+ initial_delay_ms: number;
430
+ max_delay_ms?: number | undefined;
431
+ } | undefined;
432
+ }, {
433
+ type: string;
434
+ config?: Record<string, unknown> | undefined;
435
+ timeout_seconds?: number | undefined;
436
+ retry_policy?: {
437
+ max_attempts: number;
438
+ backoff_type: "fixed" | "exponential";
439
+ initial_delay_ms: number;
440
+ max_delay_ms?: number | undefined;
441
+ } | undefined;
442
+ }>, "many">;
443
+ condition: z.ZodOptional<z.ZodObject<{
444
+ type: z.ZodEnum<["expression", "previous_phase_status"]>;
445
+ expression: z.ZodOptional<z.ZodString>;
446
+ required_status: z.ZodOptional<z.ZodEnum<["completed", "skipped"]>>;
447
+ }, "strip", z.ZodTypeAny, {
448
+ type: "expression" | "previous_phase_status";
449
+ expression?: string | undefined;
450
+ required_status?: "completed" | "skipped" | undefined;
451
+ }, {
452
+ type: "expression" | "previous_phase_status";
453
+ expression?: string | undefined;
454
+ required_status?: "completed" | "skipped" | undefined;
455
+ }>>;
456
+ on_failure: z.ZodOptional<z.ZodEnum<["fail", "skip", "retry"]>>;
457
+ }, "strip", z.ZodTypeAny, {
458
+ order: number;
459
+ name: string;
460
+ agents: {
461
+ type: string;
462
+ config?: Record<string, unknown> | undefined;
463
+ timeout_seconds?: number | undefined;
464
+ retry_policy?: {
465
+ max_attempts: number;
466
+ backoff_type: "fixed" | "exponential";
467
+ initial_delay_ms: number;
468
+ max_delay_ms?: number | undefined;
469
+ } | undefined;
470
+ }[];
471
+ description?: string | undefined;
472
+ condition?: {
473
+ type: "expression" | "previous_phase_status";
474
+ expression?: string | undefined;
475
+ required_status?: "completed" | "skipped" | undefined;
476
+ } | undefined;
477
+ on_failure?: "fail" | "skip" | "retry" | undefined;
478
+ }, {
479
+ order: number;
480
+ name: string;
481
+ agents: {
482
+ type: string;
483
+ config?: Record<string, unknown> | undefined;
484
+ timeout_seconds?: number | undefined;
485
+ retry_policy?: {
486
+ max_attempts: number;
487
+ backoff_type: "fixed" | "exponential";
488
+ initial_delay_ms: number;
489
+ max_delay_ms?: number | undefined;
490
+ } | undefined;
491
+ }[];
492
+ description?: string | undefined;
493
+ condition?: {
494
+ type: "expression" | "previous_phase_status";
495
+ expression?: string | undefined;
496
+ required_status?: "completed" | "skipped" | undefined;
497
+ } | undefined;
498
+ on_failure?: "fail" | "skip" | "retry" | undefined;
499
+ }>, "many">;
500
+ config: z.ZodOptional<z.ZodObject<{
501
+ timeout_seconds: z.ZodOptional<z.ZodNumber>;
502
+ max_retries: z.ZodOptional<z.ZodNumber>;
503
+ checkpoint_enabled: z.ZodOptional<z.ZodBoolean>;
504
+ parallel_phases: z.ZodOptional<z.ZodBoolean>;
505
+ fail_fast: z.ZodOptional<z.ZodBoolean>;
506
+ notification_channels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
507
+ }, "strip", z.ZodTypeAny, {
508
+ timeout_seconds?: number | undefined;
509
+ max_retries?: number | undefined;
510
+ checkpoint_enabled?: boolean | undefined;
511
+ parallel_phases?: boolean | undefined;
512
+ fail_fast?: boolean | undefined;
513
+ notification_channels?: string[] | undefined;
514
+ }, {
515
+ timeout_seconds?: number | undefined;
516
+ max_retries?: number | undefined;
517
+ checkpoint_enabled?: boolean | undefined;
518
+ parallel_phases?: boolean | undefined;
519
+ fail_fast?: boolean | undefined;
520
+ notification_channels?: string[] | undefined;
521
+ }>>;
522
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
523
+ }, "strip", z.ZodTypeAny, {
524
+ category: string;
525
+ name: string;
526
+ slug: string;
527
+ version: string;
528
+ phases: {
529
+ order: number;
530
+ name: string;
531
+ agents: {
532
+ type: string;
533
+ config?: Record<string, unknown> | undefined;
534
+ timeout_seconds?: number | undefined;
535
+ retry_policy?: {
536
+ max_attempts: number;
537
+ backoff_type: "fixed" | "exponential";
538
+ initial_delay_ms: number;
539
+ max_delay_ms?: number | undefined;
540
+ } | undefined;
541
+ }[];
542
+ description?: string | undefined;
543
+ condition?: {
544
+ type: "expression" | "previous_phase_status";
545
+ expression?: string | undefined;
546
+ required_status?: "completed" | "skipped" | undefined;
547
+ } | undefined;
548
+ on_failure?: "fail" | "skip" | "retry" | undefined;
549
+ }[];
550
+ config?: {
551
+ timeout_seconds?: number | undefined;
552
+ max_retries?: number | undefined;
553
+ checkpoint_enabled?: boolean | undefined;
554
+ parallel_phases?: boolean | undefined;
555
+ fail_fast?: boolean | undefined;
556
+ notification_channels?: string[] | undefined;
557
+ } | undefined;
558
+ description?: string | undefined;
559
+ tags?: string[] | undefined;
560
+ }, {
561
+ category: string;
562
+ name: string;
563
+ slug: string;
564
+ version: string;
565
+ phases: {
566
+ order: number;
567
+ name: string;
568
+ agents: {
569
+ type: string;
570
+ config?: Record<string, unknown> | undefined;
571
+ timeout_seconds?: number | undefined;
572
+ retry_policy?: {
573
+ max_attempts: number;
574
+ backoff_type: "fixed" | "exponential";
575
+ initial_delay_ms: number;
576
+ max_delay_ms?: number | undefined;
577
+ } | undefined;
578
+ }[];
579
+ description?: string | undefined;
580
+ condition?: {
581
+ type: "expression" | "previous_phase_status";
582
+ expression?: string | undefined;
583
+ required_status?: "completed" | "skipped" | undefined;
584
+ } | undefined;
585
+ on_failure?: "fail" | "skip" | "retry" | undefined;
586
+ }[];
587
+ config?: {
588
+ timeout_seconds?: number | undefined;
589
+ max_retries?: number | undefined;
590
+ checkpoint_enabled?: boolean | undefined;
591
+ parallel_phases?: boolean | undefined;
592
+ fail_fast?: boolean | undefined;
593
+ notification_channels?: string[] | undefined;
594
+ } | undefined;
595
+ description?: string | undefined;
596
+ tags?: string[] | undefined;
597
+ }>;
598
+ declare const ExecuteWorkflowRequestSchema: z.ZodObject<{
599
+ input_params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
600
+ trigger_type: z.ZodOptional<z.ZodEnum<["manual", "api"]>>;
601
+ idempotency_key: z.ZodOptional<z.ZodString>;
602
+ checkpoint_id: z.ZodOptional<z.ZodString>;
603
+ }, "strip", z.ZodTypeAny, {
604
+ input_params?: Record<string, unknown> | undefined;
605
+ trigger_type?: "manual" | "api" | undefined;
606
+ idempotency_key?: string | undefined;
607
+ checkpoint_id?: string | undefined;
608
+ }, {
609
+ input_params?: Record<string, unknown> | undefined;
610
+ trigger_type?: "manual" | "api" | undefined;
611
+ idempotency_key?: string | undefined;
612
+ checkpoint_id?: string | undefined;
613
+ }>;
614
+
615
+ export { type AnyWorkflowEvent, type ExecuteWorkflowRequest, ExecuteWorkflowRequestSchema, type ExecuteWorkflowResponse, type ExecutionCompletedEvent, type ExecutionFailedEvent, type ExecutionLog, type ExecutionStartedEvent, type ExecutionStatus, type ListExecutionsRequest, type ListExecutionsResponse, type PhaseCompletedEvent, type PhaseCondition, type PhaseExecutionStatus, type PhaseStartedEvent, type RetryPolicy, type WorkflowAgent, WorkflowAgentSchema, type WorkflowConfig, WorkflowConfigSchema, type WorkflowDefinition, WorkflowDefinitionSchema, type WorkflowEvent, type WorkflowExecution, type WorkflowPhase, WorkflowPhaseSchema };
package/dist/types.js ADDED
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/types.ts
21
+ var types_exports = {};
22
+ __export(types_exports, {
23
+ ExecuteWorkflowRequestSchema: () => ExecuteWorkflowRequestSchema,
24
+ WorkflowAgentSchema: () => WorkflowAgentSchema,
25
+ WorkflowConfigSchema: () => WorkflowConfigSchema,
26
+ WorkflowDefinitionSchema: () => WorkflowDefinitionSchema,
27
+ WorkflowPhaseSchema: () => WorkflowPhaseSchema
28
+ });
29
+ module.exports = __toCommonJS(types_exports);
30
+ var import_zod = require("zod");
31
+ var WorkflowAgentSchema = import_zod.z.object({
32
+ type: import_zod.z.string().min(1),
33
+ config: import_zod.z.record(import_zod.z.unknown()).optional(),
34
+ timeout_seconds: import_zod.z.number().int().positive().optional(),
35
+ retry_policy: import_zod.z.object({
36
+ max_attempts: import_zod.z.number().int().positive(),
37
+ backoff_type: import_zod.z.enum(["fixed", "exponential"]),
38
+ initial_delay_ms: import_zod.z.number().int().positive(),
39
+ max_delay_ms: import_zod.z.number().int().positive().optional()
40
+ }).optional()
41
+ });
42
+ var WorkflowPhaseSchema = import_zod.z.object({
43
+ name: import_zod.z.string().min(1).max(100),
44
+ description: import_zod.z.string().max(500).optional(),
45
+ order: import_zod.z.number().int().positive(),
46
+ agents: import_zod.z.array(WorkflowAgentSchema),
47
+ condition: import_zod.z.object({
48
+ type: import_zod.z.enum(["expression", "previous_phase_status"]),
49
+ expression: import_zod.z.string().optional(),
50
+ required_status: import_zod.z.enum(["completed", "skipped"]).optional()
51
+ }).optional(),
52
+ on_failure: import_zod.z.enum(["fail", "skip", "retry"]).optional()
53
+ });
54
+ var WorkflowConfigSchema = import_zod.z.object({
55
+ timeout_seconds: import_zod.z.number().int().positive().max(86400).optional(),
56
+ max_retries: import_zod.z.number().int().min(0).max(10).optional(),
57
+ checkpoint_enabled: import_zod.z.boolean().optional(),
58
+ parallel_phases: import_zod.z.boolean().optional(),
59
+ fail_fast: import_zod.z.boolean().optional(),
60
+ notification_channels: import_zod.z.array(import_zod.z.string()).optional()
61
+ });
62
+ var WorkflowDefinitionSchema = import_zod.z.object({
63
+ name: import_zod.z.string().min(1).max(200),
64
+ slug: import_zod.z.string().regex(/^[a-z0-9-]+$/).min(1).max(100),
65
+ description: import_zod.z.string().max(1e3).optional(),
66
+ category: import_zod.z.string().min(1).max(50),
67
+ version: import_zod.z.string().regex(/^\d+\.\d+\.\d+$/),
68
+ phases: import_zod.z.array(WorkflowPhaseSchema).min(1),
69
+ config: WorkflowConfigSchema.optional(),
70
+ tags: import_zod.z.array(import_zod.z.string().max(50)).max(10).optional()
71
+ });
72
+ var ExecuteWorkflowRequestSchema = import_zod.z.object({
73
+ input_params: import_zod.z.record(import_zod.z.unknown()).optional(),
74
+ trigger_type: import_zod.z.enum(["manual", "api"]).optional(),
75
+ idempotency_key: import_zod.z.string().max(100).optional(),
76
+ checkpoint_id: import_zod.z.string().uuid().optional()
77
+ });
78
+ // Annotate the CommonJS export names for ESM import in node:
79
+ 0 && (module.exports = {
80
+ ExecuteWorkflowRequestSchema,
81
+ WorkflowAgentSchema,
82
+ WorkflowConfigSchema,
83
+ WorkflowDefinitionSchema,
84
+ WorkflowPhaseSchema
85
+ });