services-as-software 0.1.0 → 2.0.1

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 (78) hide show
  1. package/.turbo/turbo-build.log +5 -0
  2. package/CHANGELOG.md +10 -0
  3. package/README.md +235 -225
  4. package/dist/client.d.ts +25 -0
  5. package/dist/client.d.ts.map +1 -0
  6. package/dist/client.js +103 -0
  7. package/dist/client.js.map +1 -0
  8. package/dist/endpoint.d.ts +102 -0
  9. package/dist/endpoint.d.ts.map +1 -0
  10. package/dist/endpoint.js +96 -0
  11. package/dist/endpoint.js.map +1 -0
  12. package/dist/entities/billing.d.ts +60 -0
  13. package/dist/entities/billing.d.ts.map +1 -0
  14. package/dist/entities/billing.js +954 -0
  15. package/dist/entities/billing.js.map +1 -0
  16. package/dist/entities/customers.d.ts +45 -0
  17. package/dist/entities/customers.d.ts.map +1 -0
  18. package/dist/entities/customers.js +679 -0
  19. package/dist/entities/customers.js.map +1 -0
  20. package/dist/entities/delivery.d.ts +59 -0
  21. package/dist/entities/delivery.d.ts.map +1 -0
  22. package/dist/entities/delivery.js +890 -0
  23. package/dist/entities/delivery.js.map +1 -0
  24. package/dist/entities/index.d.ts +114 -0
  25. package/dist/entities/index.d.ts.map +1 -0
  26. package/dist/entities/index.js +89 -0
  27. package/dist/entities/index.js.map +1 -0
  28. package/dist/entities/operations.d.ts +59 -0
  29. package/dist/entities/operations.d.ts.map +1 -0
  30. package/dist/entities/operations.js +1010 -0
  31. package/dist/entities/operations.js.map +1 -0
  32. package/dist/entities/orchestration.d.ts +52 -0
  33. package/dist/entities/orchestration.d.ts.map +1 -0
  34. package/dist/entities/orchestration.js +883 -0
  35. package/dist/entities/orchestration.js.map +1 -0
  36. package/dist/entities/services.d.ts +50 -0
  37. package/dist/entities/services.d.ts.map +1 -0
  38. package/dist/entities/services.js +805 -0
  39. package/dist/entities/services.js.map +1 -0
  40. package/dist/helpers.d.ts +362 -0
  41. package/dist/helpers.d.ts.map +1 -0
  42. package/dist/helpers.js +400 -0
  43. package/dist/helpers.js.map +1 -0
  44. package/dist/index.d.ts +17 -215
  45. package/dist/index.d.ts.map +1 -0
  46. package/dist/index.js +18 -172
  47. package/dist/index.js.map +1 -0
  48. package/dist/provider.d.ts +85 -0
  49. package/dist/provider.d.ts.map +1 -0
  50. package/dist/provider.js +158 -0
  51. package/dist/provider.js.map +1 -0
  52. package/dist/service.d.ts +43 -0
  53. package/dist/service.d.ts.map +1 -0
  54. package/dist/service.js +206 -0
  55. package/dist/service.js.map +1 -0
  56. package/dist/types.d.ts +469 -0
  57. package/dist/types.d.ts.map +1 -0
  58. package/dist/types.js +5 -0
  59. package/dist/types.js.map +1 -0
  60. package/examples/client-usage.ts +82 -0
  61. package/examples/translation-service.ts +227 -0
  62. package/package.json +24 -38
  63. package/src/client.ts +132 -0
  64. package/src/endpoint.ts +144 -0
  65. package/src/entities/billing.ts +1037 -0
  66. package/src/entities/customers.ts +740 -0
  67. package/src/entities/delivery.ts +974 -0
  68. package/src/entities/index.ts +157 -0
  69. package/src/entities/operations.ts +1099 -0
  70. package/src/entities/orchestration.ts +956 -0
  71. package/src/entities/services.ts +872 -0
  72. package/src/helpers.ts +474 -0
  73. package/src/index.ts +97 -0
  74. package/src/provider.ts +183 -0
  75. package/src/service.test.ts +195 -0
  76. package/src/service.ts +266 -0
  77. package/src/types.ts +543 -0
  78. package/tsconfig.json +9 -0
@@ -0,0 +1,883 @@
1
+ /**
2
+ * Orchestration Entity Types (Nouns)
3
+ *
4
+ * Service orchestration: ServiceWorkflow, WorkflowStep, ServiceTask, ServiceQueue, ServiceWorker
5
+ *
6
+ * @packageDocumentation
7
+ */
8
+ // =============================================================================
9
+ // ServiceWorkflow
10
+ // =============================================================================
11
+ /**
12
+ * ServiceWorkflow entity
13
+ *
14
+ * Multi-step service workflow.
15
+ */
16
+ export const ServiceWorkflow = {
17
+ singular: 'service-workflow',
18
+ plural: 'service-workflows',
19
+ description: 'A multi-step workflow for service delivery',
20
+ properties: {
21
+ // Identity
22
+ name: {
23
+ type: 'string',
24
+ description: 'Workflow name',
25
+ },
26
+ slug: {
27
+ type: 'string',
28
+ optional: true,
29
+ description: 'URL-friendly identifier',
30
+ },
31
+ description: {
32
+ type: 'string',
33
+ optional: true,
34
+ description: 'Workflow description',
35
+ },
36
+ // Type
37
+ type: {
38
+ type: 'string',
39
+ description: 'Workflow type',
40
+ examples: ['sequential', 'parallel', 'conditional', 'loop', 'dag'],
41
+ },
42
+ trigger: {
43
+ type: 'string',
44
+ optional: true,
45
+ description: 'What triggers workflow',
46
+ examples: ['api', 'schedule', 'event', 'manual', 'condition'],
47
+ },
48
+ // Configuration
49
+ config: {
50
+ type: 'json',
51
+ optional: true,
52
+ description: 'Workflow configuration',
53
+ },
54
+ inputSchema: {
55
+ type: 'json',
56
+ optional: true,
57
+ description: 'Input schema',
58
+ },
59
+ outputSchema: {
60
+ type: 'json',
61
+ optional: true,
62
+ description: 'Output schema',
63
+ },
64
+ // Execution
65
+ timeout: {
66
+ type: 'number',
67
+ optional: true,
68
+ description: 'Workflow timeout (ms)',
69
+ },
70
+ maxRetries: {
71
+ type: 'number',
72
+ optional: true,
73
+ description: 'Max retry attempts',
74
+ },
75
+ retryBackoff: {
76
+ type: 'string',
77
+ optional: true,
78
+ description: 'Retry backoff strategy',
79
+ examples: ['fixed', 'exponential', 'linear'],
80
+ },
81
+ // Concurrency
82
+ maxConcurrent: {
83
+ type: 'number',
84
+ optional: true,
85
+ description: 'Max concurrent executions',
86
+ },
87
+ queueBehavior: {
88
+ type: 'string',
89
+ optional: true,
90
+ description: 'Queue behavior when at limit',
91
+ examples: ['queue', 'reject', 'replace'],
92
+ },
93
+ // Versioning
94
+ version: {
95
+ type: 'string',
96
+ optional: true,
97
+ description: 'Workflow version',
98
+ },
99
+ isLatest: {
100
+ type: 'boolean',
101
+ optional: true,
102
+ description: 'Is latest version',
103
+ },
104
+ // Metrics
105
+ avgDurationMs: {
106
+ type: 'number',
107
+ optional: true,
108
+ description: 'Average duration',
109
+ },
110
+ successRate: {
111
+ type: 'number',
112
+ optional: true,
113
+ description: 'Success rate (0-1)',
114
+ },
115
+ totalExecutions: {
116
+ type: 'number',
117
+ optional: true,
118
+ description: 'Total executions',
119
+ },
120
+ // Status
121
+ status: {
122
+ type: 'string',
123
+ description: 'Workflow status',
124
+ examples: ['draft', 'active', 'paused', 'deprecated', 'archived'],
125
+ },
126
+ },
127
+ relationships: {
128
+ service: {
129
+ type: 'ProductizedService',
130
+ description: 'Parent service',
131
+ },
132
+ steps: {
133
+ type: 'WorkflowStep[]',
134
+ description: 'Workflow steps',
135
+ },
136
+ executions: {
137
+ type: 'ServiceExecution[]',
138
+ description: 'Workflow executions',
139
+ },
140
+ qualityGates: {
141
+ type: 'QualityGate[]',
142
+ description: 'Quality gates',
143
+ },
144
+ },
145
+ actions: [
146
+ 'create',
147
+ 'update',
148
+ 'publish',
149
+ 'execute',
150
+ 'pause',
151
+ 'resume',
152
+ 'deprecate',
153
+ 'archive',
154
+ ],
155
+ events: [
156
+ 'created',
157
+ 'updated',
158
+ 'published',
159
+ 'executed',
160
+ 'paused',
161
+ 'resumed',
162
+ 'deprecated',
163
+ 'archived',
164
+ ],
165
+ };
166
+ // =============================================================================
167
+ // WorkflowStep
168
+ // =============================================================================
169
+ /**
170
+ * WorkflowStep entity
171
+ *
172
+ * Individual step in a workflow.
173
+ */
174
+ export const WorkflowStep = {
175
+ singular: 'workflow-step',
176
+ plural: 'workflow-steps',
177
+ description: 'An individual step in a service workflow',
178
+ properties: {
179
+ // Identity
180
+ name: {
181
+ type: 'string',
182
+ description: 'Step name',
183
+ },
184
+ description: {
185
+ type: 'string',
186
+ optional: true,
187
+ description: 'Step description',
188
+ },
189
+ // Position
190
+ order: {
191
+ type: 'number',
192
+ description: 'Step order',
193
+ },
194
+ phase: {
195
+ type: 'string',
196
+ optional: true,
197
+ description: 'Workflow phase',
198
+ examples: ['setup', 'process', 'validate', 'deliver', 'cleanup'],
199
+ },
200
+ // Type
201
+ type: {
202
+ type: 'string',
203
+ description: 'Step type',
204
+ examples: ['action', 'decision', 'wait', 'parallel', 'loop', 'human', 'ai'],
205
+ },
206
+ actionType: {
207
+ type: 'string',
208
+ optional: true,
209
+ description: 'Type of action',
210
+ examples: ['function', 'api-call', 'ai-inference', 'human-task', 'notification', 'delay'],
211
+ },
212
+ // Configuration
213
+ config: {
214
+ type: 'json',
215
+ optional: true,
216
+ description: 'Step configuration',
217
+ },
218
+ inputMapping: {
219
+ type: 'json',
220
+ optional: true,
221
+ description: 'Input mapping from workflow',
222
+ },
223
+ outputMapping: {
224
+ type: 'json',
225
+ optional: true,
226
+ description: 'Output mapping to workflow',
227
+ },
228
+ // AI Configuration
229
+ aiEnabled: {
230
+ type: 'boolean',
231
+ optional: true,
232
+ description: 'Uses AI for execution',
233
+ },
234
+ aiModel: {
235
+ type: 'string',
236
+ optional: true,
237
+ description: 'AI model to use',
238
+ },
239
+ aiPrompt: {
240
+ type: 'string',
241
+ optional: true,
242
+ description: 'AI prompt template',
243
+ },
244
+ confidenceRequired: {
245
+ type: 'number',
246
+ optional: true,
247
+ description: 'Min confidence for auto-proceed',
248
+ },
249
+ // Execution
250
+ timeout: {
251
+ type: 'number',
252
+ optional: true,
253
+ description: 'Step timeout (ms)',
254
+ },
255
+ retryable: {
256
+ type: 'boolean',
257
+ optional: true,
258
+ description: 'Step can be retried',
259
+ },
260
+ maxRetries: {
261
+ type: 'number',
262
+ optional: true,
263
+ description: 'Max retry attempts',
264
+ },
265
+ // Conditions
266
+ condition: {
267
+ type: 'string',
268
+ optional: true,
269
+ description: 'Execution condition',
270
+ },
271
+ skipCondition: {
272
+ type: 'string',
273
+ optional: true,
274
+ description: 'Skip condition',
275
+ },
276
+ // Error Handling
277
+ onError: {
278
+ type: 'string',
279
+ optional: true,
280
+ description: 'Error handling',
281
+ examples: ['fail', 'retry', 'skip', 'fallback', 'escalate'],
282
+ },
283
+ fallbackStep: {
284
+ type: 'string',
285
+ optional: true,
286
+ description: 'Fallback step name',
287
+ },
288
+ // Human Tasks
289
+ requiresHuman: {
290
+ type: 'boolean',
291
+ optional: true,
292
+ description: 'Requires human',
293
+ },
294
+ humanTaskType: {
295
+ type: 'string',
296
+ optional: true,
297
+ description: 'Human task type',
298
+ examples: ['approval', 'review', 'input', 'decision'],
299
+ },
300
+ // Status
301
+ status: {
302
+ type: 'string',
303
+ description: 'Step status',
304
+ examples: ['active', 'disabled', 'deprecated'],
305
+ },
306
+ },
307
+ relationships: {
308
+ workflow: {
309
+ type: 'ServiceWorkflow',
310
+ description: 'Parent workflow',
311
+ },
312
+ nextSteps: {
313
+ type: 'WorkflowStep[]',
314
+ description: 'Next steps',
315
+ },
316
+ previousSteps: {
317
+ type: 'WorkflowStep[]',
318
+ description: 'Previous steps',
319
+ },
320
+ qualityGate: {
321
+ type: 'QualityGate',
322
+ required: false,
323
+ description: 'Quality gate at this step',
324
+ },
325
+ },
326
+ actions: [
327
+ 'create',
328
+ 'update',
329
+ 'enable',
330
+ 'disable',
331
+ 'execute',
332
+ 'skip',
333
+ 'retry',
334
+ ],
335
+ events: [
336
+ 'created',
337
+ 'updated',
338
+ 'enabled',
339
+ 'disabled',
340
+ 'started',
341
+ 'completed',
342
+ 'failed',
343
+ 'skipped',
344
+ 'retried',
345
+ ],
346
+ };
347
+ // =============================================================================
348
+ // ServiceTask
349
+ // =============================================================================
350
+ /**
351
+ * ServiceTask entity
352
+ *
353
+ * Task within service execution.
354
+ */
355
+ export const ServiceTask = {
356
+ singular: 'service-task',
357
+ plural: 'service-tasks',
358
+ description: 'A task within a service execution',
359
+ properties: {
360
+ // Identity
361
+ id: {
362
+ type: 'string',
363
+ description: 'Task ID',
364
+ },
365
+ name: {
366
+ type: 'string',
367
+ optional: true,
368
+ description: 'Task name',
369
+ },
370
+ // Type
371
+ type: {
372
+ type: 'string',
373
+ description: 'Task type',
374
+ examples: ['automated', 'ai', 'human', 'approval', 'review', 'external'],
375
+ },
376
+ priority: {
377
+ type: 'string',
378
+ optional: true,
379
+ description: 'Task priority',
380
+ examples: ['low', 'normal', 'high', 'urgent'],
381
+ },
382
+ // Input/Output
383
+ input: {
384
+ type: 'json',
385
+ optional: true,
386
+ description: 'Task input',
387
+ },
388
+ output: {
389
+ type: 'json',
390
+ optional: true,
391
+ description: 'Task output',
392
+ },
393
+ context: {
394
+ type: 'json',
395
+ optional: true,
396
+ description: 'Task context',
397
+ },
398
+ // Assignment
399
+ assignedTo: {
400
+ type: 'string',
401
+ optional: true,
402
+ description: 'Assigned worker/agent',
403
+ },
404
+ assignedAt: {
405
+ type: 'date',
406
+ optional: true,
407
+ description: 'Assignment time',
408
+ },
409
+ // AI Execution
410
+ aiExecuted: {
411
+ type: 'boolean',
412
+ optional: true,
413
+ description: 'Executed by AI',
414
+ },
415
+ aiConfidence: {
416
+ type: 'number',
417
+ optional: true,
418
+ description: 'AI confidence',
419
+ },
420
+ aiIterations: {
421
+ type: 'number',
422
+ optional: true,
423
+ description: 'AI iterations used',
424
+ },
425
+ // Human Execution
426
+ humanRequired: {
427
+ type: 'boolean',
428
+ optional: true,
429
+ description: 'Human required',
430
+ },
431
+ humanExecuted: {
432
+ type: 'boolean',
433
+ optional: true,
434
+ description: 'Executed by human',
435
+ },
436
+ humanNotes: {
437
+ type: 'string',
438
+ optional: true,
439
+ description: 'Human notes',
440
+ },
441
+ // Timing
442
+ scheduledAt: {
443
+ type: 'date',
444
+ optional: true,
445
+ description: 'Scheduled time',
446
+ },
447
+ startedAt: {
448
+ type: 'date',
449
+ optional: true,
450
+ description: 'Start time',
451
+ },
452
+ completedAt: {
453
+ type: 'date',
454
+ optional: true,
455
+ description: 'Completion time',
456
+ },
457
+ dueAt: {
458
+ type: 'date',
459
+ optional: true,
460
+ description: 'Due date',
461
+ },
462
+ durationMs: {
463
+ type: 'number',
464
+ optional: true,
465
+ description: 'Duration (ms)',
466
+ },
467
+ // Retries
468
+ attempt: {
469
+ type: 'number',
470
+ optional: true,
471
+ description: 'Current attempt number',
472
+ },
473
+ maxAttempts: {
474
+ type: 'number',
475
+ optional: true,
476
+ description: 'Max attempts allowed',
477
+ },
478
+ lastError: {
479
+ type: 'string',
480
+ optional: true,
481
+ description: 'Last error message',
482
+ },
483
+ // Status
484
+ status: {
485
+ type: 'string',
486
+ description: 'Task status',
487
+ examples: ['pending', 'queued', 'assigned', 'running', 'waiting', 'completed', 'failed', 'cancelled'],
488
+ },
489
+ },
490
+ relationships: {
491
+ execution: {
492
+ type: 'ServiceExecution',
493
+ description: 'Parent execution',
494
+ },
495
+ workflowStep: {
496
+ type: 'WorkflowStep',
497
+ required: false,
498
+ description: 'Workflow step',
499
+ },
500
+ queue: {
501
+ type: 'ServiceQueue',
502
+ required: false,
503
+ description: 'Task queue',
504
+ },
505
+ worker: {
506
+ type: 'ServiceWorker',
507
+ required: false,
508
+ description: 'Assigned worker',
509
+ },
510
+ parentTask: {
511
+ type: 'ServiceTask',
512
+ required: false,
513
+ description: 'Parent task',
514
+ },
515
+ subtasks: {
516
+ type: 'ServiceTask[]',
517
+ description: 'Subtasks',
518
+ },
519
+ },
520
+ actions: [
521
+ 'create',
522
+ 'queue',
523
+ 'assign',
524
+ 'start',
525
+ 'complete',
526
+ 'fail',
527
+ 'retry',
528
+ 'cancel',
529
+ 'escalate',
530
+ ],
531
+ events: [
532
+ 'created',
533
+ 'queued',
534
+ 'assigned',
535
+ 'started',
536
+ 'completed',
537
+ 'failed',
538
+ 'retried',
539
+ 'cancelled',
540
+ 'escalated',
541
+ ],
542
+ };
543
+ // =============================================================================
544
+ // ServiceQueue
545
+ // =============================================================================
546
+ /**
547
+ * ServiceQueue entity
548
+ *
549
+ * Queue for service tasks.
550
+ */
551
+ export const ServiceQueue = {
552
+ singular: 'service-queue',
553
+ plural: 'service-queues',
554
+ description: 'A queue for service tasks',
555
+ properties: {
556
+ // Identity
557
+ name: {
558
+ type: 'string',
559
+ description: 'Queue name',
560
+ },
561
+ description: {
562
+ type: 'string',
563
+ optional: true,
564
+ description: 'Queue description',
565
+ },
566
+ // Type
567
+ type: {
568
+ type: 'string',
569
+ description: 'Queue type',
570
+ examples: ['fifo', 'lifo', 'priority', 'fair', 'round-robin'],
571
+ },
572
+ taskTypes: {
573
+ type: 'string',
574
+ array: true,
575
+ optional: true,
576
+ description: 'Allowed task types',
577
+ },
578
+ // Configuration
579
+ maxSize: {
580
+ type: 'number',
581
+ optional: true,
582
+ description: 'Max queue size',
583
+ },
584
+ maxConcurrent: {
585
+ type: 'number',
586
+ optional: true,
587
+ description: 'Max concurrent processing',
588
+ },
589
+ processingTimeout: {
590
+ type: 'number',
591
+ optional: true,
592
+ description: 'Processing timeout (ms)',
593
+ },
594
+ // Behavior
595
+ onFull: {
596
+ type: 'string',
597
+ optional: true,
598
+ description: 'Behavior when full',
599
+ examples: ['reject', 'drop-oldest', 'wait'],
600
+ },
601
+ retryFailed: {
602
+ type: 'boolean',
603
+ optional: true,
604
+ description: 'Retry failed tasks',
605
+ },
606
+ deadLetterQueue: {
607
+ type: 'string',
608
+ optional: true,
609
+ description: 'Dead letter queue name',
610
+ },
611
+ // Workers
612
+ minWorkers: {
613
+ type: 'number',
614
+ optional: true,
615
+ description: 'Minimum workers',
616
+ },
617
+ maxWorkers: {
618
+ type: 'number',
619
+ optional: true,
620
+ description: 'Maximum workers',
621
+ },
622
+ autoScale: {
623
+ type: 'boolean',
624
+ optional: true,
625
+ description: 'Auto-scale workers',
626
+ },
627
+ // Current State
628
+ pendingCount: {
629
+ type: 'number',
630
+ optional: true,
631
+ description: 'Pending task count',
632
+ },
633
+ processingCount: {
634
+ type: 'number',
635
+ optional: true,
636
+ description: 'Processing task count',
637
+ },
638
+ completedCount: {
639
+ type: 'number',
640
+ optional: true,
641
+ description: 'Completed task count',
642
+ },
643
+ failedCount: {
644
+ type: 'number',
645
+ optional: true,
646
+ description: 'Failed task count',
647
+ },
648
+ // Metrics
649
+ avgWaitTime: {
650
+ type: 'number',
651
+ optional: true,
652
+ description: 'Average wait time (ms)',
653
+ },
654
+ avgProcessingTime: {
655
+ type: 'number',
656
+ optional: true,
657
+ description: 'Average processing time (ms)',
658
+ },
659
+ throughput: {
660
+ type: 'number',
661
+ optional: true,
662
+ description: 'Tasks per minute',
663
+ },
664
+ // Status
665
+ status: {
666
+ type: 'string',
667
+ description: 'Queue status',
668
+ examples: ['active', 'paused', 'draining', 'stopped'],
669
+ },
670
+ },
671
+ relationships: {
672
+ service: {
673
+ type: 'ProductizedService',
674
+ description: 'Parent service',
675
+ },
676
+ tasks: {
677
+ type: 'ServiceTask[]',
678
+ description: 'Queued tasks',
679
+ },
680
+ workers: {
681
+ type: 'ServiceWorker[]',
682
+ description: 'Queue workers',
683
+ },
684
+ },
685
+ actions: [
686
+ 'create',
687
+ 'update',
688
+ 'pause',
689
+ 'resume',
690
+ 'drain',
691
+ 'clear',
692
+ 'scale',
693
+ ],
694
+ events: [
695
+ 'created',
696
+ 'updated',
697
+ 'paused',
698
+ 'resumed',
699
+ 'draining',
700
+ 'drained',
701
+ 'cleared',
702
+ 'scaled',
703
+ ],
704
+ };
705
+ // =============================================================================
706
+ // ServiceWorker
707
+ // =============================================================================
708
+ /**
709
+ * ServiceWorker entity
710
+ *
711
+ * Worker processing tasks.
712
+ */
713
+ export const ServiceWorker = {
714
+ singular: 'service-worker',
715
+ plural: 'service-workers',
716
+ description: 'A worker processing service tasks',
717
+ properties: {
718
+ // Identity
719
+ id: {
720
+ type: 'string',
721
+ description: 'Worker ID',
722
+ },
723
+ name: {
724
+ type: 'string',
725
+ optional: true,
726
+ description: 'Worker name',
727
+ },
728
+ // Type
729
+ type: {
730
+ type: 'string',
731
+ description: 'Worker type',
732
+ examples: ['ai', 'human', 'automated', 'hybrid'],
733
+ },
734
+ // Capabilities
735
+ capabilities: {
736
+ type: 'string',
737
+ array: true,
738
+ optional: true,
739
+ description: 'Worker capabilities',
740
+ },
741
+ taskTypes: {
742
+ type: 'string',
743
+ array: true,
744
+ optional: true,
745
+ description: 'Task types handled',
746
+ },
747
+ // Configuration
748
+ concurrency: {
749
+ type: 'number',
750
+ optional: true,
751
+ description: 'Max concurrent tasks',
752
+ },
753
+ pollInterval: {
754
+ type: 'number',
755
+ optional: true,
756
+ description: 'Poll interval (ms)',
757
+ },
758
+ // AI Configuration
759
+ aiModel: {
760
+ type: 'string',
761
+ optional: true,
762
+ description: 'AI model used',
763
+ },
764
+ aiConfig: {
765
+ type: 'json',
766
+ optional: true,
767
+ description: 'AI configuration',
768
+ },
769
+ // Current State
770
+ currentTask: {
771
+ type: 'string',
772
+ optional: true,
773
+ description: 'Current task ID',
774
+ },
775
+ tasksInProgress: {
776
+ type: 'number',
777
+ optional: true,
778
+ description: 'Tasks in progress',
779
+ },
780
+ lastActiveAt: {
781
+ type: 'date',
782
+ optional: true,
783
+ description: 'Last activity time',
784
+ },
785
+ heartbeatAt: {
786
+ type: 'date',
787
+ optional: true,
788
+ description: 'Last heartbeat',
789
+ },
790
+ // Metrics
791
+ tasksCompleted: {
792
+ type: 'number',
793
+ optional: true,
794
+ description: 'Tasks completed',
795
+ },
796
+ tasksFailed: {
797
+ type: 'number',
798
+ optional: true,
799
+ description: 'Tasks failed',
800
+ },
801
+ avgProcessingTime: {
802
+ type: 'number',
803
+ optional: true,
804
+ description: 'Avg processing time (ms)',
805
+ },
806
+ successRate: {
807
+ type: 'number',
808
+ optional: true,
809
+ description: 'Success rate (0-1)',
810
+ },
811
+ // Resource
812
+ memoryUsage: {
813
+ type: 'number',
814
+ optional: true,
815
+ description: 'Memory usage (MB)',
816
+ },
817
+ cpuUsage: {
818
+ type: 'number',
819
+ optional: true,
820
+ description: 'CPU usage (%)',
821
+ },
822
+ // Status
823
+ status: {
824
+ type: 'string',
825
+ description: 'Worker status',
826
+ examples: ['idle', 'busy', 'paused', 'draining', 'offline', 'error'],
827
+ },
828
+ },
829
+ relationships: {
830
+ queue: {
831
+ type: 'ServiceQueue',
832
+ description: 'Assigned queue',
833
+ },
834
+ currentTasks: {
835
+ type: 'ServiceTask[]',
836
+ description: 'Current tasks',
837
+ },
838
+ agent: {
839
+ type: 'AgentDelivery',
840
+ required: false,
841
+ description: 'AI agent (if AI worker)',
842
+ },
843
+ },
844
+ actions: [
845
+ 'start',
846
+ 'stop',
847
+ 'pause',
848
+ 'resume',
849
+ 'drain',
850
+ 'assignTask',
851
+ 'completeTask',
852
+ 'failTask',
853
+ ],
854
+ events: [
855
+ 'started',
856
+ 'stopped',
857
+ 'paused',
858
+ 'resumed',
859
+ 'draining',
860
+ 'drained',
861
+ 'taskAssigned',
862
+ 'taskCompleted',
863
+ 'taskFailed',
864
+ 'error',
865
+ ],
866
+ };
867
+ // =============================================================================
868
+ // Exports
869
+ // =============================================================================
870
+ export const OrchestrationEntities = {
871
+ ServiceWorkflow,
872
+ WorkflowStep,
873
+ ServiceTask,
874
+ ServiceQueue,
875
+ ServiceWorker,
876
+ };
877
+ export const OrchestrationCategories = {
878
+ workflows: ['ServiceWorkflow', 'WorkflowStep'],
879
+ tasks: ['ServiceTask'],
880
+ queues: ['ServiceQueue'],
881
+ workers: ['ServiceWorker'],
882
+ };
883
+ //# sourceMappingURL=orchestration.js.map