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,890 @@
1
+ /**
2
+ * AI Delivery Entity Types (Nouns)
3
+ *
4
+ * AI delivery mechanics: AgentDelivery, AutonomyLevel, EscalationRule, ConfidenceThreshold, HumanHandoff, QualityGate
5
+ *
6
+ * @packageDocumentation
7
+ */
8
+ // =============================================================================
9
+ // AgentDelivery
10
+ // =============================================================================
11
+ /**
12
+ * AgentDelivery entity
13
+ *
14
+ * AI agent configuration for autonomous service delivery.
15
+ */
16
+ export const AgentDelivery = {
17
+ singular: 'agent-delivery',
18
+ plural: 'agent-deliveries',
19
+ description: 'AI agent configuration for autonomous service delivery',
20
+ properties: {
21
+ // Identity
22
+ name: {
23
+ type: 'string',
24
+ description: 'Agent name',
25
+ },
26
+ description: {
27
+ type: 'string',
28
+ optional: true,
29
+ description: 'Agent description',
30
+ },
31
+ // Model
32
+ model: {
33
+ type: 'string',
34
+ description: 'AI model identifier',
35
+ examples: ['gpt-4', 'claude-3', 'gemini-pro', 'llama-3', 'custom'],
36
+ },
37
+ modelProvider: {
38
+ type: 'string',
39
+ optional: true,
40
+ description: 'Model provider',
41
+ examples: ['openai', 'anthropic', 'google', 'meta', 'custom'],
42
+ },
43
+ modelConfig: {
44
+ type: 'json',
45
+ optional: true,
46
+ description: 'Model configuration',
47
+ },
48
+ // Prompt
49
+ systemPrompt: {
50
+ type: 'string',
51
+ optional: true,
52
+ description: 'System prompt',
53
+ },
54
+ contextTemplate: {
55
+ type: 'string',
56
+ optional: true,
57
+ description: 'Context template',
58
+ },
59
+ // Capabilities
60
+ tools: {
61
+ type: 'string',
62
+ array: true,
63
+ optional: true,
64
+ description: 'Available tools',
65
+ },
66
+ capabilities: {
67
+ type: 'string',
68
+ array: true,
69
+ optional: true,
70
+ description: 'Agent capabilities',
71
+ },
72
+ // Autonomy
73
+ autonomyLevel: {
74
+ type: 'string',
75
+ description: 'Level of autonomous operation',
76
+ examples: ['full', 'supervised', 'assisted', 'advisory'],
77
+ },
78
+ autonomyScore: {
79
+ type: 'number',
80
+ optional: true,
81
+ description: 'Autonomy score (1-5)',
82
+ },
83
+ // Confidence
84
+ confidenceThreshold: {
85
+ type: 'number',
86
+ description: 'Min confidence for autonomous action (0-1)',
87
+ },
88
+ lowConfidenceAction: {
89
+ type: 'string',
90
+ optional: true,
91
+ description: 'Action when below threshold',
92
+ examples: ['escalate', 'queue', 'retry', 'fail'],
93
+ },
94
+ // Execution
95
+ maxIterations: {
96
+ type: 'number',
97
+ optional: true,
98
+ description: 'Max iterations per execution',
99
+ },
100
+ maxTokens: {
101
+ type: 'number',
102
+ optional: true,
103
+ description: 'Max tokens per execution',
104
+ },
105
+ timeoutMs: {
106
+ type: 'number',
107
+ optional: true,
108
+ description: 'Execution timeout',
109
+ },
110
+ // Safety
111
+ guardrails: {
112
+ type: 'string',
113
+ array: true,
114
+ optional: true,
115
+ description: 'Safety guardrails',
116
+ },
117
+ prohibitedActions: {
118
+ type: 'string',
119
+ array: true,
120
+ optional: true,
121
+ description: 'Prohibited actions',
122
+ },
123
+ // Escalation
124
+ escalationTriggers: {
125
+ type: 'string',
126
+ array: true,
127
+ optional: true,
128
+ description: 'Conditions that trigger escalation',
129
+ },
130
+ // Metrics
131
+ avgConfidence: {
132
+ type: 'number',
133
+ optional: true,
134
+ description: 'Average confidence score',
135
+ },
136
+ successRate: {
137
+ type: 'number',
138
+ optional: true,
139
+ description: 'Success rate (0-1)',
140
+ },
141
+ escalationRate: {
142
+ type: 'number',
143
+ optional: true,
144
+ description: 'Escalation rate (0-1)',
145
+ },
146
+ // Status
147
+ status: {
148
+ type: 'string',
149
+ description: 'Agent status',
150
+ examples: ['active', 'paused', 'training', 'deprecated'],
151
+ },
152
+ },
153
+ relationships: {
154
+ service: {
155
+ type: 'ProductizedService',
156
+ description: 'Parent service',
157
+ },
158
+ escalationRules: {
159
+ type: 'EscalationRule[]',
160
+ description: 'Escalation rules',
161
+ },
162
+ qualityGates: {
163
+ type: 'QualityGate[]',
164
+ description: 'Quality gates',
165
+ },
166
+ confidenceThresholds: {
167
+ type: 'ConfidenceThreshold[]',
168
+ description: 'Confidence thresholds',
169
+ },
170
+ },
171
+ actions: [
172
+ 'create',
173
+ 'update',
174
+ 'activate',
175
+ 'pause',
176
+ 'train',
177
+ 'evaluate',
178
+ 'escalate',
179
+ 'deprecate',
180
+ ],
181
+ events: [
182
+ 'created',
183
+ 'updated',
184
+ 'activated',
185
+ 'paused',
186
+ 'trained',
187
+ 'evaluated',
188
+ 'escalated',
189
+ 'deprecated',
190
+ ],
191
+ };
192
+ // =============================================================================
193
+ // AutonomyLevel
194
+ // =============================================================================
195
+ /**
196
+ * AutonomyLevel entity
197
+ *
198
+ * Defines a level of autonomous operation.
199
+ */
200
+ export const AutonomyLevel = {
201
+ singular: 'autonomy-level',
202
+ plural: 'autonomy-levels',
203
+ description: 'A defined level of autonomous operation',
204
+ properties: {
205
+ // Identity
206
+ name: {
207
+ type: 'string',
208
+ description: 'Level name',
209
+ },
210
+ description: {
211
+ type: 'string',
212
+ optional: true,
213
+ description: 'Level description',
214
+ },
215
+ // Level
216
+ level: {
217
+ type: 'number',
218
+ description: 'Numeric level (1-5)',
219
+ },
220
+ code: {
221
+ type: 'string',
222
+ description: 'Level code',
223
+ examples: ['full', 'supervised', 'assisted', 'advisory', 'manual'],
224
+ },
225
+ // Permissions
226
+ allowedActions: {
227
+ type: 'string',
228
+ array: true,
229
+ optional: true,
230
+ description: 'Allowed autonomous actions',
231
+ },
232
+ restrictedActions: {
233
+ type: 'string',
234
+ array: true,
235
+ optional: true,
236
+ description: 'Actions requiring approval',
237
+ },
238
+ prohibitedActions: {
239
+ type: 'string',
240
+ array: true,
241
+ optional: true,
242
+ description: 'Prohibited actions',
243
+ },
244
+ // Thresholds
245
+ confidenceRequired: {
246
+ type: 'number',
247
+ optional: true,
248
+ description: 'Min confidence for autonomous action',
249
+ },
250
+ maxRiskTolerance: {
251
+ type: 'number',
252
+ optional: true,
253
+ description: 'Max risk score allowed',
254
+ },
255
+ maxImpactScore: {
256
+ type: 'number',
257
+ optional: true,
258
+ description: 'Max impact score allowed',
259
+ },
260
+ // Human Involvement
261
+ humanApprovalRequired: {
262
+ type: 'boolean',
263
+ optional: true,
264
+ description: 'Requires human approval',
265
+ },
266
+ humanReviewFrequency: {
267
+ type: 'string',
268
+ optional: true,
269
+ description: 'How often humans review',
270
+ examples: ['always', 'sampled', 'periodic', 'on-error', 'never'],
271
+ },
272
+ reviewSampleRate: {
273
+ type: 'number',
274
+ optional: true,
275
+ description: 'Percentage of tasks reviewed (0-100)',
276
+ },
277
+ // Status
278
+ status: {
279
+ type: 'string',
280
+ description: 'Level status',
281
+ examples: ['active', 'deprecated'],
282
+ },
283
+ },
284
+ relationships: {
285
+ agents: {
286
+ type: 'AgentDelivery[]',
287
+ description: 'Agents at this level',
288
+ },
289
+ escalationRules: {
290
+ type: 'EscalationRule[]',
291
+ description: 'Associated escalation rules',
292
+ },
293
+ },
294
+ actions: [
295
+ 'create',
296
+ 'update',
297
+ 'activate',
298
+ 'deprecate',
299
+ ],
300
+ events: [
301
+ 'created',
302
+ 'updated',
303
+ 'activated',
304
+ 'deprecated',
305
+ ],
306
+ };
307
+ // =============================================================================
308
+ // EscalationRule
309
+ // =============================================================================
310
+ /**
311
+ * EscalationRule entity
312
+ *
313
+ * Rules for escalating to human intervention.
314
+ */
315
+ export const EscalationRule = {
316
+ singular: 'escalation-rule',
317
+ plural: 'escalation-rules',
318
+ description: 'A rule defining when to escalate to human intervention',
319
+ properties: {
320
+ // Identity
321
+ name: {
322
+ type: 'string',
323
+ description: 'Rule name',
324
+ },
325
+ description: {
326
+ type: 'string',
327
+ optional: true,
328
+ description: 'Rule description',
329
+ },
330
+ // Trigger
331
+ triggerType: {
332
+ type: 'string',
333
+ description: 'Trigger type',
334
+ examples: ['confidence', 'error', 'timeout', 'risk', 'keyword', 'pattern', 'manual', 'custom'],
335
+ },
336
+ condition: {
337
+ type: 'string',
338
+ optional: true,
339
+ description: 'Trigger condition expression',
340
+ },
341
+ // Confidence Triggers
342
+ confidenceThreshold: {
343
+ type: 'number',
344
+ optional: true,
345
+ description: 'Confidence below this triggers escalation',
346
+ },
347
+ confidenceField: {
348
+ type: 'string',
349
+ optional: true,
350
+ description: 'Field to check for confidence',
351
+ },
352
+ // Error Triggers
353
+ errorTypes: {
354
+ type: 'string',
355
+ array: true,
356
+ optional: true,
357
+ description: 'Error types that trigger escalation',
358
+ },
359
+ maxRetries: {
360
+ type: 'number',
361
+ optional: true,
362
+ description: 'Retries before escalation',
363
+ },
364
+ // Risk Triggers
365
+ riskThreshold: {
366
+ type: 'number',
367
+ optional: true,
368
+ description: 'Risk score threshold',
369
+ },
370
+ sensitivePatterns: {
371
+ type: 'string',
372
+ array: true,
373
+ optional: true,
374
+ description: 'Patterns indicating sensitive content',
375
+ },
376
+ // Escalation Target
377
+ escalateTo: {
378
+ type: 'string',
379
+ description: 'Escalation target',
380
+ examples: ['queue', 'team', 'individual', 'on-call', 'manager'],
381
+ },
382
+ targetId: {
383
+ type: 'string',
384
+ optional: true,
385
+ description: 'Target team/person ID',
386
+ },
387
+ // Timing
388
+ responseTimeTarget: {
389
+ type: 'number',
390
+ optional: true,
391
+ description: 'Target response time (seconds)',
392
+ },
393
+ autoEscalateAfter: {
394
+ type: 'number',
395
+ optional: true,
396
+ description: 'Auto-escalate to next level after (seconds)',
397
+ },
398
+ // Priority
399
+ priority: {
400
+ type: 'string',
401
+ optional: true,
402
+ description: 'Escalation priority',
403
+ examples: ['low', 'medium', 'high', 'critical'],
404
+ },
405
+ // Status
406
+ status: {
407
+ type: 'string',
408
+ description: 'Rule status',
409
+ examples: ['active', 'disabled', 'testing'],
410
+ },
411
+ },
412
+ relationships: {
413
+ agent: {
414
+ type: 'AgentDelivery',
415
+ required: false,
416
+ description: 'Parent agent',
417
+ },
418
+ service: {
419
+ type: 'ProductizedService',
420
+ required: false,
421
+ description: 'Parent service',
422
+ },
423
+ handoffs: {
424
+ type: 'HumanHandoff[]',
425
+ description: 'Resulting handoffs',
426
+ },
427
+ },
428
+ actions: [
429
+ 'create',
430
+ 'update',
431
+ 'enable',
432
+ 'disable',
433
+ 'test',
434
+ 'trigger',
435
+ ],
436
+ events: [
437
+ 'created',
438
+ 'updated',
439
+ 'enabled',
440
+ 'disabled',
441
+ 'tested',
442
+ 'triggered',
443
+ ],
444
+ };
445
+ // =============================================================================
446
+ // ConfidenceThreshold
447
+ // =============================================================================
448
+ /**
449
+ * ConfidenceThreshold entity
450
+ *
451
+ * Confidence-based decision rules.
452
+ */
453
+ export const ConfidenceThreshold = {
454
+ singular: 'confidence-threshold',
455
+ plural: 'confidence-thresholds',
456
+ description: 'A confidence-based decision rule',
457
+ properties: {
458
+ // Identity
459
+ name: {
460
+ type: 'string',
461
+ description: 'Threshold name',
462
+ },
463
+ description: {
464
+ type: 'string',
465
+ optional: true,
466
+ description: 'Threshold description',
467
+ },
468
+ // Threshold
469
+ minConfidence: {
470
+ type: 'number',
471
+ description: 'Minimum confidence (0-1)',
472
+ },
473
+ maxConfidence: {
474
+ type: 'number',
475
+ optional: true,
476
+ description: 'Maximum confidence (0-1)',
477
+ },
478
+ // Context
479
+ context: {
480
+ type: 'string',
481
+ optional: true,
482
+ description: 'Application context',
483
+ examples: ['classification', 'generation', 'extraction', 'decision', 'any'],
484
+ },
485
+ taskTypes: {
486
+ type: 'string',
487
+ array: true,
488
+ optional: true,
489
+ description: 'Applicable task types',
490
+ },
491
+ // Action
492
+ action: {
493
+ type: 'string',
494
+ description: 'Action when threshold met',
495
+ examples: ['proceed', 'review', 'escalate', 'retry', 'fail'],
496
+ },
497
+ requiresHumanReview: {
498
+ type: 'boolean',
499
+ optional: true,
500
+ description: 'Requires human review',
501
+ },
502
+ allowOverride: {
503
+ type: 'boolean',
504
+ optional: true,
505
+ description: 'Allows human override',
506
+ },
507
+ // Risk Adjustment
508
+ riskMultiplier: {
509
+ type: 'number',
510
+ optional: true,
511
+ description: 'Risk-adjusted multiplier',
512
+ },
513
+ adjustForDomain: {
514
+ type: 'boolean',
515
+ optional: true,
516
+ description: 'Adjust based on domain',
517
+ },
518
+ // Learning
519
+ adaptive: {
520
+ type: 'boolean',
521
+ optional: true,
522
+ description: 'Threshold adapts over time',
523
+ },
524
+ learningRate: {
525
+ type: 'number',
526
+ optional: true,
527
+ description: 'Adaptation learning rate',
528
+ },
529
+ // Status
530
+ status: {
531
+ type: 'string',
532
+ description: 'Threshold status',
533
+ examples: ['active', 'disabled', 'testing'],
534
+ },
535
+ },
536
+ relationships: {
537
+ agent: {
538
+ type: 'AgentDelivery',
539
+ required: false,
540
+ description: 'Parent agent',
541
+ },
542
+ service: {
543
+ type: 'ProductizedService',
544
+ required: false,
545
+ description: 'Parent service',
546
+ },
547
+ },
548
+ actions: [
549
+ 'create',
550
+ 'update',
551
+ 'enable',
552
+ 'disable',
553
+ 'adjust',
554
+ 'test',
555
+ ],
556
+ events: [
557
+ 'created',
558
+ 'updated',
559
+ 'enabled',
560
+ 'disabled',
561
+ 'adjusted',
562
+ 'tested',
563
+ ],
564
+ };
565
+ // =============================================================================
566
+ // HumanHandoff
567
+ // =============================================================================
568
+ /**
569
+ * HumanHandoff entity
570
+ *
571
+ * A point where AI hands off to human.
572
+ */
573
+ export const HumanHandoff = {
574
+ singular: 'human-handoff',
575
+ plural: 'human-handoffs',
576
+ description: 'A point where AI hands off to human intervention',
577
+ properties: {
578
+ // Identity
579
+ id: {
580
+ type: 'string',
581
+ description: 'Handoff ID',
582
+ },
583
+ // Trigger
584
+ triggerReason: {
585
+ type: 'string',
586
+ description: 'Why handoff was triggered',
587
+ examples: ['low-confidence', 'error', 'escalation-rule', 'user-request', 'safety', 'complexity'],
588
+ },
589
+ triggerDetails: {
590
+ type: 'string',
591
+ optional: true,
592
+ description: 'Detailed trigger explanation',
593
+ },
594
+ // Context
595
+ context: {
596
+ type: 'json',
597
+ optional: true,
598
+ description: 'Execution context at handoff',
599
+ },
600
+ conversationHistory: {
601
+ type: 'json',
602
+ optional: true,
603
+ description: 'Conversation history',
604
+ },
605
+ agentOutput: {
606
+ type: 'json',
607
+ optional: true,
608
+ description: 'Agent output before handoff',
609
+ },
610
+ confidence: {
611
+ type: 'number',
612
+ optional: true,
613
+ description: 'Confidence at handoff',
614
+ },
615
+ // Assignment
616
+ assignedTo: {
617
+ type: 'string',
618
+ optional: true,
619
+ description: 'Assigned human/team',
620
+ },
621
+ assignedAt: {
622
+ type: 'date',
623
+ optional: true,
624
+ description: 'Assignment time',
625
+ },
626
+ // Priority
627
+ priority: {
628
+ type: 'string',
629
+ description: 'Handoff priority',
630
+ examples: ['low', 'medium', 'high', 'critical'],
631
+ },
632
+ dueBy: {
633
+ type: 'date',
634
+ optional: true,
635
+ description: 'Due date/time',
636
+ },
637
+ // Resolution
638
+ resolution: {
639
+ type: 'string',
640
+ optional: true,
641
+ description: 'Resolution type',
642
+ examples: ['completed', 'returned-to-ai', 'cancelled', 'escalated-further'],
643
+ },
644
+ resolutionNotes: {
645
+ type: 'string',
646
+ optional: true,
647
+ description: 'Resolution notes',
648
+ },
649
+ humanOutput: {
650
+ type: 'json',
651
+ optional: true,
652
+ description: 'Human-provided output',
653
+ },
654
+ // Timing
655
+ createdAt: {
656
+ type: 'date',
657
+ optional: true,
658
+ description: 'Creation time',
659
+ },
660
+ resolvedAt: {
661
+ type: 'date',
662
+ optional: true,
663
+ description: 'Resolution time',
664
+ },
665
+ waitTimeMs: {
666
+ type: 'number',
667
+ optional: true,
668
+ description: 'Wait time in ms',
669
+ },
670
+ handlingTimeMs: {
671
+ type: 'number',
672
+ optional: true,
673
+ description: 'Handling time in ms',
674
+ },
675
+ // Feedback
676
+ feedbackProvided: {
677
+ type: 'boolean',
678
+ optional: true,
679
+ description: 'Feedback was provided',
680
+ },
681
+ feedbackUsedForTraining: {
682
+ type: 'boolean',
683
+ optional: true,
684
+ description: 'Used for AI training',
685
+ },
686
+ // Status
687
+ status: {
688
+ type: 'string',
689
+ description: 'Handoff status',
690
+ examples: ['pending', 'assigned', 'in-progress', 'resolved', 'expired'],
691
+ },
692
+ },
693
+ relationships: {
694
+ execution: {
695
+ type: 'ServiceExecution',
696
+ description: 'Related execution',
697
+ },
698
+ escalationRule: {
699
+ type: 'EscalationRule',
700
+ required: false,
701
+ description: 'Triggering rule',
702
+ },
703
+ agent: {
704
+ type: 'AgentDelivery',
705
+ required: false,
706
+ description: 'Agent that handed off',
707
+ },
708
+ },
709
+ actions: [
710
+ 'create',
711
+ 'assign',
712
+ 'start',
713
+ 'resolve',
714
+ 'returnToAI',
715
+ 'escalate',
716
+ 'expire',
717
+ ],
718
+ events: [
719
+ 'created',
720
+ 'assigned',
721
+ 'started',
722
+ 'resolved',
723
+ 'returnedToAI',
724
+ 'escalated',
725
+ 'expired',
726
+ ],
727
+ };
728
+ // =============================================================================
729
+ // QualityGate
730
+ // =============================================================================
731
+ /**
732
+ * QualityGate entity
733
+ *
734
+ * Quality assurance checkpoint.
735
+ */
736
+ export const QualityGate = {
737
+ singular: 'quality-gate',
738
+ plural: 'quality-gates',
739
+ description: 'A quality assurance checkpoint in service delivery',
740
+ properties: {
741
+ // Identity
742
+ name: {
743
+ type: 'string',
744
+ description: 'Gate name',
745
+ },
746
+ description: {
747
+ type: 'string',
748
+ optional: true,
749
+ description: 'Gate description',
750
+ },
751
+ // Position
752
+ stage: {
753
+ type: 'string',
754
+ description: 'Pipeline stage',
755
+ examples: ['input', 'processing', 'output', 'delivery'],
756
+ },
757
+ order: {
758
+ type: 'number',
759
+ optional: true,
760
+ description: 'Gate order in stage',
761
+ },
762
+ // Criteria
763
+ criteriaType: {
764
+ type: 'string',
765
+ description: 'Type of criteria',
766
+ examples: ['rule', 'model', 'human', 'automated', 'hybrid'],
767
+ },
768
+ criteria: {
769
+ type: 'json',
770
+ optional: true,
771
+ description: 'Quality criteria definition',
772
+ },
773
+ // Thresholds
774
+ passThreshold: {
775
+ type: 'number',
776
+ optional: true,
777
+ description: 'Score to pass (0-1)',
778
+ },
779
+ warnThreshold: {
780
+ type: 'number',
781
+ optional: true,
782
+ description: 'Score for warning (0-1)',
783
+ },
784
+ // Actions
785
+ onPass: {
786
+ type: 'string',
787
+ optional: true,
788
+ description: 'Action on pass',
789
+ examples: ['continue', 'log', 'notify'],
790
+ },
791
+ onFail: {
792
+ type: 'string',
793
+ optional: true,
794
+ description: 'Action on fail',
795
+ examples: ['block', 'escalate', 'retry', 'warn'],
796
+ },
797
+ onWarn: {
798
+ type: 'string',
799
+ optional: true,
800
+ description: 'Action on warning',
801
+ examples: ['continue', 'flag', 'review'],
802
+ },
803
+ // Review
804
+ requiresReview: {
805
+ type: 'boolean',
806
+ optional: true,
807
+ description: 'Requires human review',
808
+ },
809
+ reviewSampleRate: {
810
+ type: 'number',
811
+ optional: true,
812
+ description: 'Sample rate for review (0-100)',
813
+ },
814
+ // Metrics
815
+ passRate: {
816
+ type: 'number',
817
+ optional: true,
818
+ description: 'Historical pass rate',
819
+ },
820
+ avgScore: {
821
+ type: 'number',
822
+ optional: true,
823
+ description: 'Average quality score',
824
+ },
825
+ evaluationsCount: {
826
+ type: 'number',
827
+ optional: true,
828
+ description: 'Total evaluations',
829
+ },
830
+ // Status
831
+ status: {
832
+ type: 'string',
833
+ description: 'Gate status',
834
+ examples: ['active', 'disabled', 'testing'],
835
+ },
836
+ },
837
+ relationships: {
838
+ agent: {
839
+ type: 'AgentDelivery',
840
+ required: false,
841
+ description: 'Parent agent',
842
+ },
843
+ service: {
844
+ type: 'ProductizedService',
845
+ required: false,
846
+ description: 'Parent service',
847
+ },
848
+ workflow: {
849
+ type: 'ServiceWorkflow',
850
+ required: false,
851
+ description: 'Parent workflow',
852
+ },
853
+ },
854
+ actions: [
855
+ 'create',
856
+ 'update',
857
+ 'enable',
858
+ 'disable',
859
+ 'evaluate',
860
+ 'adjustThreshold',
861
+ ],
862
+ events: [
863
+ 'created',
864
+ 'updated',
865
+ 'enabled',
866
+ 'disabled',
867
+ 'evaluated',
868
+ 'passed',
869
+ 'failed',
870
+ 'warned',
871
+ ],
872
+ };
873
+ // =============================================================================
874
+ // Exports
875
+ // =============================================================================
876
+ export const DeliveryEntities = {
877
+ AgentDelivery,
878
+ AutonomyLevel,
879
+ EscalationRule,
880
+ ConfidenceThreshold,
881
+ HumanHandoff,
882
+ QualityGate,
883
+ };
884
+ export const DeliveryCategories = {
885
+ agents: ['AgentDelivery'],
886
+ autonomy: ['AutonomyLevel', 'ConfidenceThreshold'],
887
+ escalation: ['EscalationRule', 'HumanHandoff'],
888
+ quality: ['QualityGate'],
889
+ };
890
+ //# sourceMappingURL=delivery.js.map