@artemiskit/sdk 0.3.0 → 0.3.3

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 (74) hide show
  1. package/CHANGELOG.md +225 -0
  2. package/README.md +44 -1
  3. package/dist/artemiskit.d.ts +149 -0
  4. package/dist/artemiskit.d.ts.map +1 -0
  5. package/dist/builders/index.d.ts +350 -0
  6. package/dist/builders/index.d.ts.map +1 -0
  7. package/dist/builders/index.js +398 -0
  8. package/dist/contracts/index.d.ts +253 -0
  9. package/dist/contracts/index.d.ts.map +1 -0
  10. package/dist/contracts/index.js +99 -0
  11. package/dist/guardian/action-validator.d.ts +92 -0
  12. package/dist/guardian/action-validator.d.ts.map +1 -0
  13. package/dist/guardian/circuit-breaker.d.ts +211 -0
  14. package/dist/guardian/circuit-breaker.d.ts.map +1 -0
  15. package/dist/guardian/guardian.d.ts +213 -0
  16. package/dist/guardian/guardian.d.ts.map +1 -0
  17. package/dist/guardian/guardrails.d.ts +107 -0
  18. package/dist/guardian/guardrails.d.ts.map +1 -0
  19. package/dist/guardian/index.d.ts +35 -0
  20. package/dist/guardian/index.d.ts.map +1 -0
  21. package/dist/guardian/intent-classifier.d.ts +81 -0
  22. package/dist/guardian/intent-classifier.d.ts.map +1 -0
  23. package/dist/guardian/interceptor.d.ts +141 -0
  24. package/dist/guardian/interceptor.d.ts.map +1 -0
  25. package/dist/guardian/policy.d.ts +52 -0
  26. package/dist/guardian/policy.d.ts.map +1 -0
  27. package/dist/guardian/semantic-validator.d.ts +61 -0
  28. package/dist/guardian/semantic-validator.d.ts.map +1 -0
  29. package/dist/guardian/types.d.ts +653 -0
  30. package/dist/guardian/types.d.ts.map +1 -0
  31. package/dist/index.d.ts +23 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +24847 -13653
  34. package/dist/matchers/core.d.ts +81 -0
  35. package/dist/matchers/core.d.ts.map +1 -0
  36. package/dist/matchers/index.d.ts +6 -0
  37. package/dist/matchers/index.d.ts.map +1 -0
  38. package/dist/matchers/jest.d.ts +46 -0
  39. package/dist/matchers/jest.d.ts.map +1 -0
  40. package/dist/matchers/vitest.d.ts +24 -0
  41. package/dist/matchers/vitest.d.ts.map +1 -0
  42. package/dist/types-only.d.ts +31 -0
  43. package/dist/types-only.d.ts.map +1 -0
  44. package/dist/types-only.js +1 -0
  45. package/dist/types.d.ts +377 -0
  46. package/dist/types.d.ts.map +1 -0
  47. package/dist/utils/index.d.ts +112 -0
  48. package/dist/utils/index.d.ts.map +1 -0
  49. package/dist/utils/index.js +104 -0
  50. package/package.json +19 -4
  51. package/src/__tests__/builders.test.ts +445 -0
  52. package/src/__tests__/circuit-breaker.test.ts +704 -0
  53. package/src/__tests__/compare.test.ts +469 -0
  54. package/src/__tests__/contracts.test.ts +354 -0
  55. package/src/__tests__/guardian-modes.test.ts +215 -0
  56. package/src/__tests__/guardrails.test.ts +404 -0
  57. package/src/__tests__/semantic-validator.test.ts +421 -0
  58. package/src/__tests__/utils.test.ts +324 -0
  59. package/src/__tests__/validate.test.ts +307 -0
  60. package/src/artemiskit.ts +478 -5
  61. package/src/builders/index.ts +698 -0
  62. package/src/contracts/index.ts +357 -0
  63. package/src/guardian/circuit-breaker.ts +74 -28
  64. package/src/guardian/guardian.ts +307 -20
  65. package/src/guardian/guardrails.ts +143 -1
  66. package/src/guardian/index.ts +35 -1
  67. package/src/guardian/interceptor.ts +87 -11
  68. package/src/guardian/semantic-validator.ts +399 -0
  69. package/src/guardian/types.ts +413 -2
  70. package/src/index.ts +258 -14
  71. package/src/types-only.ts +276 -0
  72. package/src/types.ts +183 -0
  73. package/src/utils/index.ts +225 -0
  74. package/tsconfig.json +2 -1
@@ -0,0 +1,698 @@
1
+ /**
2
+ * @artemiskit/sdk
3
+ * Fluent builders for constructing scenarios and test cases
4
+ *
5
+ * Provides a type-safe, fluent API for building ArtemisKit scenarios
6
+ * programmatically without manually constructing complex objects.
7
+ */
8
+
9
+ import type {
10
+ ChatMessageType,
11
+ Expected,
12
+ Provider,
13
+ Scenario,
14
+ TestCase,
15
+ Variables,
16
+ } from '@artemiskit/core';
17
+ import type { RedactionConfig } from '@artemiskit/core';
18
+
19
+ // ============================================================================
20
+ // Test Case Builder
21
+ // ============================================================================
22
+
23
+ /**
24
+ * Fluent builder for constructing test cases
25
+ */
26
+ export class TestCaseBuilder {
27
+ private _id: string;
28
+ private _name?: string;
29
+ private _description?: string;
30
+ private _prompt: string | ChatMessageType[] = '';
31
+ private _expected?: Expected;
32
+ private _tags: string[] = [];
33
+ private _metadata: Record<string, unknown> = {};
34
+ private _timeout?: number;
35
+ private _retries = 0;
36
+ private _provider?: Provider;
37
+ private _model?: string;
38
+ private _variables?: Variables;
39
+ private _redaction?: RedactionConfig;
40
+
41
+ constructor(id: string) {
42
+ this._id = id;
43
+ }
44
+
45
+ /**
46
+ * Set the test case name (display name)
47
+ */
48
+ name(name: string): this {
49
+ this._name = name;
50
+ return this;
51
+ }
52
+
53
+ /**
54
+ * Set the test case description
55
+ */
56
+ description(description: string): this {
57
+ this._description = description;
58
+ return this;
59
+ }
60
+
61
+ /**
62
+ * Set the prompt as a simple string
63
+ */
64
+ prompt(prompt: string): this {
65
+ this._prompt = prompt;
66
+ return this;
67
+ }
68
+
69
+ /**
70
+ * Set the prompt as chat messages
71
+ */
72
+ messages(messages: ChatMessageType[]): this {
73
+ this._prompt = messages;
74
+ return this;
75
+ }
76
+
77
+ /**
78
+ * Add a system message followed by a user message
79
+ */
80
+ systemAndUser(systemPrompt: string, userPrompt: string): this {
81
+ this._prompt = [
82
+ { role: 'system', content: systemPrompt },
83
+ { role: 'user', content: userPrompt },
84
+ ];
85
+ return this;
86
+ }
87
+
88
+ /**
89
+ * Expect an exact match
90
+ */
91
+ expectExact(value: string, caseSensitive = true): this {
92
+ this._expected = { type: 'exact', value, caseSensitive };
93
+ return this;
94
+ }
95
+
96
+ /**
97
+ * Expect the response to contain specific values
98
+ */
99
+ expectContains(values: string[], mode: 'all' | 'any' = 'all'): this {
100
+ this._expected = { type: 'contains', values, mode };
101
+ return this;
102
+ }
103
+
104
+ /**
105
+ * Expect the response to NOT contain specific values
106
+ */
107
+ expectNotContains(values: string[], mode: 'all' | 'any' = 'all'): this {
108
+ this._expected = { type: 'not_contains', values, mode };
109
+ return this;
110
+ }
111
+
112
+ /**
113
+ * Expect a regex match
114
+ */
115
+ expectRegex(pattern: string, flags?: string): this {
116
+ this._expected = { type: 'regex', pattern, flags };
117
+ return this;
118
+ }
119
+
120
+ /**
121
+ * Expect a fuzzy match with similarity threshold
122
+ */
123
+ expectFuzzy(value: string, threshold = 0.8): this {
124
+ this._expected = { type: 'fuzzy', value, threshold };
125
+ return this;
126
+ }
127
+
128
+ /**
129
+ * Expect a JSON response matching a schema
130
+ */
131
+ expectJsonSchema(schema: Record<string, unknown>): this {
132
+ this._expected = { type: 'json_schema', schema };
133
+ return this;
134
+ }
135
+
136
+ /**
137
+ * Expect response to pass LLM grading with a rubric
138
+ */
139
+ expectLLMGrade(
140
+ rubric: string,
141
+ options?: { threshold?: number; model?: string; provider?: Provider }
142
+ ): this {
143
+ this._expected = {
144
+ type: 'llm_grader',
145
+ rubric,
146
+ threshold: options?.threshold ?? 0.7,
147
+ model: options?.model,
148
+ provider: options?.provider,
149
+ };
150
+ return this;
151
+ }
152
+
153
+ /**
154
+ * Expect semantic similarity
155
+ */
156
+ expectSimilarity(
157
+ value: string,
158
+ options?: {
159
+ threshold?: number;
160
+ mode?: 'embedding' | 'llm';
161
+ model?: string;
162
+ embeddingModel?: string;
163
+ }
164
+ ): this {
165
+ this._expected = {
166
+ type: 'similarity',
167
+ value,
168
+ threshold: options?.threshold ?? 0.75,
169
+ mode: options?.mode,
170
+ model: options?.model,
171
+ embeddingModel: options?.embeddingModel,
172
+ };
173
+ return this;
174
+ }
175
+
176
+ /**
177
+ * Expect an inline expression to evaluate to true
178
+ */
179
+ expectInline(expression: string, value?: string): this {
180
+ this._expected = { type: 'inline', expression, value };
181
+ return this;
182
+ }
183
+
184
+ /**
185
+ * Combine multiple expectations with AND logic
186
+ * Note: Pass base expectations (not combined) for proper type inference
187
+ */
188
+ expectAll(...expectations: Expected[]): this {
189
+ // Type assertion needed because TypeScript can't infer combined type correctly
190
+ this._expected = { type: 'combined', operator: 'and', expectations } as unknown as Expected;
191
+ return this;
192
+ }
193
+
194
+ /**
195
+ * Combine multiple expectations with OR logic
196
+ * Note: Pass base expectations (not combined) for proper type inference
197
+ */
198
+ expectAny(...expectations: Expected[]): this {
199
+ // Type assertion needed because TypeScript can't infer combined type correctly
200
+ this._expected = { type: 'combined', operator: 'or', expectations } as unknown as Expected;
201
+ return this;
202
+ }
203
+
204
+ /**
205
+ * Set a custom expectation
206
+ */
207
+ expect(expected: Expected): this {
208
+ this._expected = expected;
209
+ return this;
210
+ }
211
+
212
+ /**
213
+ * Add tags to the test case
214
+ */
215
+ tags(...tags: string[]): this {
216
+ this._tags.push(...tags);
217
+ return this;
218
+ }
219
+
220
+ /**
221
+ * Add metadata to the test case
222
+ */
223
+ metadata(data: Record<string, unknown>): this {
224
+ this._metadata = { ...this._metadata, ...data };
225
+ return this;
226
+ }
227
+
228
+ /**
229
+ * Set timeout for this test case
230
+ */
231
+ timeout(ms: number): this {
232
+ this._timeout = ms;
233
+ return this;
234
+ }
235
+
236
+ /**
237
+ * Set number of retries for this test case
238
+ */
239
+ retries(count: number): this {
240
+ this._retries = count;
241
+ return this;
242
+ }
243
+
244
+ /**
245
+ * Override provider for this test case
246
+ */
247
+ provider(provider: Provider): this {
248
+ this._provider = provider;
249
+ return this;
250
+ }
251
+
252
+ /**
253
+ * Override model for this test case
254
+ */
255
+ model(model: string): this {
256
+ this._model = model;
257
+ return this;
258
+ }
259
+
260
+ /**
261
+ * Set variables for this test case
262
+ */
263
+ variables(vars: Variables): this {
264
+ this._variables = vars;
265
+ return this;
266
+ }
267
+
268
+ /**
269
+ * Enable redaction for this test case
270
+ */
271
+ redact(config: RedactionConfig): this {
272
+ this._redaction = config;
273
+ return this;
274
+ }
275
+
276
+ /**
277
+ * Build the test case object
278
+ */
279
+ build(): TestCase {
280
+ if (!this._expected) {
281
+ throw new Error(
282
+ `TestCase "${this._id}" must have an expectation. Call one of the expect* methods.`
283
+ );
284
+ }
285
+
286
+ // Check for empty prompt: empty string or empty array
287
+ const hasEmptyPrompt =
288
+ !this._prompt ||
289
+ (typeof this._prompt === 'string' && this._prompt.length === 0) ||
290
+ (Array.isArray(this._prompt) && this._prompt.length === 0);
291
+
292
+ if (hasEmptyPrompt) {
293
+ throw new Error(`TestCase "${this._id}" must have a prompt.`);
294
+ }
295
+
296
+ return {
297
+ id: this._id,
298
+ name: this._name,
299
+ description: this._description,
300
+ prompt: this._prompt,
301
+ expected: this._expected,
302
+ tags: this._tags,
303
+ metadata: this._metadata,
304
+ timeout: this._timeout,
305
+ retries: this._retries,
306
+ provider: this._provider,
307
+ model: this._model,
308
+ variables: this._variables,
309
+ redaction: this._redaction,
310
+ };
311
+ }
312
+ }
313
+
314
+ // ============================================================================
315
+ // Scenario Builder
316
+ // ============================================================================
317
+
318
+ /**
319
+ * Fluent builder for constructing scenarios
320
+ */
321
+ export class ScenarioBuilder {
322
+ private _name: string;
323
+ private _description?: string;
324
+ private _version = '1.0';
325
+ private _provider?: Provider;
326
+ private _model?: string;
327
+ private _providerConfig?: Record<string, unknown>;
328
+ private _seed?: number;
329
+ private _temperature?: number;
330
+ private _maxTokens?: number;
331
+ private _tags: string[] = [];
332
+ private _variables?: Variables;
333
+ private _redaction?: RedactionConfig;
334
+ private _systemPrompt?: string;
335
+ private _cases: TestCase[] = [];
336
+
337
+ constructor(name: string) {
338
+ this._name = name;
339
+ }
340
+
341
+ /**
342
+ * Set the scenario description
343
+ */
344
+ description(description: string): this {
345
+ this._description = description;
346
+ return this;
347
+ }
348
+
349
+ /**
350
+ * Set the scenario version
351
+ */
352
+ version(version: string): this {
353
+ this._version = version;
354
+ return this;
355
+ }
356
+
357
+ /**
358
+ * Set the default provider
359
+ */
360
+ provider(provider: Provider): this {
361
+ this._provider = provider;
362
+ return this;
363
+ }
364
+
365
+ /**
366
+ * Set the default model
367
+ */
368
+ model(model: string): this {
369
+ this._model = model;
370
+ return this;
371
+ }
372
+
373
+ /**
374
+ * Set provider configuration
375
+ */
376
+ providerConfig(config: Record<string, unknown>): this {
377
+ this._providerConfig = config;
378
+ return this;
379
+ }
380
+
381
+ /**
382
+ * Set the random seed for reproducibility
383
+ */
384
+ seed(seed: number): this {
385
+ this._seed = seed;
386
+ return this;
387
+ }
388
+
389
+ /**
390
+ * Set the temperature
391
+ */
392
+ temperature(temp: number): this {
393
+ this._temperature = temp;
394
+ return this;
395
+ }
396
+
397
+ /**
398
+ * Set max tokens
399
+ */
400
+ maxTokens(tokens: number): this {
401
+ this._maxTokens = tokens;
402
+ return this;
403
+ }
404
+
405
+ /**
406
+ * Add tags to the scenario
407
+ */
408
+ tags(...tags: string[]): this {
409
+ this._tags.push(...tags);
410
+ return this;
411
+ }
412
+
413
+ /**
414
+ * Set variables for template substitution
415
+ */
416
+ variables(vars: Variables): this {
417
+ this._variables = vars;
418
+ return this;
419
+ }
420
+
421
+ /**
422
+ * Set redaction configuration
423
+ */
424
+ redact(config: RedactionConfig): this {
425
+ this._redaction = config;
426
+ return this;
427
+ }
428
+
429
+ /**
430
+ * Set a system prompt for all test cases
431
+ */
432
+ systemPrompt(prompt: string): this {
433
+ this._systemPrompt = prompt;
434
+ return this;
435
+ }
436
+
437
+ /**
438
+ * Add a test case using a builder
439
+ */
440
+ case(caseBuilder: TestCaseBuilder): this {
441
+ this._cases.push(caseBuilder.build());
442
+ return this;
443
+ }
444
+
445
+ /**
446
+ * Add a test case directly
447
+ */
448
+ addCase(testCase: TestCase): this {
449
+ this._cases.push(testCase);
450
+ return this;
451
+ }
452
+
453
+ /**
454
+ * Add multiple test cases
455
+ */
456
+ cases(...caseBuilders: TestCaseBuilder[]): this {
457
+ for (const builder of caseBuilders) {
458
+ this._cases.push(builder.build());
459
+ }
460
+ return this;
461
+ }
462
+
463
+ /**
464
+ * Build the scenario object
465
+ */
466
+ build(): Scenario {
467
+ if (this._cases.length === 0) {
468
+ throw new Error(`Scenario "${this._name}" must have at least one test case.`);
469
+ }
470
+
471
+ return {
472
+ name: this._name,
473
+ description: this._description,
474
+ version: this._version,
475
+ provider: this._provider,
476
+ model: this._model,
477
+ providerConfig: this._providerConfig,
478
+ seed: this._seed,
479
+ temperature: this._temperature,
480
+ maxTokens: this._maxTokens,
481
+ tags: this._tags,
482
+ variables: this._variables,
483
+ redaction: this._redaction,
484
+ setup: this._systemPrompt ? { systemPrompt: this._systemPrompt } : undefined,
485
+ cases: this._cases,
486
+ };
487
+ }
488
+ }
489
+
490
+ // ============================================================================
491
+ // Factory Functions
492
+ // ============================================================================
493
+
494
+ /**
495
+ * Create a new scenario builder
496
+ *
497
+ * @example
498
+ * ```typescript
499
+ * import { scenario, testCase } from '@artemiskit/sdk/builders'
500
+ *
501
+ * const myScenario = scenario('Math Tests')
502
+ * .provider('openai')
503
+ * .model('gpt-4')
504
+ * .description('Basic math verification tests')
505
+ * .case(
506
+ * testCase('addition')
507
+ * .prompt('What is 2 + 2?')
508
+ * .expectContains(['4'])
509
+ * )
510
+ * .case(
511
+ * testCase('multiplication')
512
+ * .prompt('What is 6 * 7?')
513
+ * .expectContains(['42'])
514
+ * )
515
+ * .build()
516
+ * ```
517
+ */
518
+ export function scenario(name: string): ScenarioBuilder {
519
+ return new ScenarioBuilder(name);
520
+ }
521
+
522
+ /**
523
+ * Create a new test case builder
524
+ *
525
+ * @example
526
+ * ```typescript
527
+ * import { testCase } from '@artemiskit/sdk/builders'
528
+ *
529
+ * const case1 = testCase('json-output')
530
+ * .prompt('Return a JSON object with name and age')
531
+ * .expectJsonSchema({
532
+ * type: 'object',
533
+ * required: ['name', 'age'],
534
+ * properties: {
535
+ * name: { type: 'string' },
536
+ * age: { type: 'number' }
537
+ * }
538
+ * })
539
+ * .tags('json', 'structured')
540
+ * .build()
541
+ * ```
542
+ */
543
+ export function testCase(id: string): TestCaseBuilder {
544
+ return new TestCaseBuilder(id);
545
+ }
546
+
547
+ // ============================================================================
548
+ // Quick Helpers
549
+ // ============================================================================
550
+
551
+ /**
552
+ * Create a simple test case with contains expectation
553
+ */
554
+ export function containsCase(
555
+ id: string,
556
+ prompt: string,
557
+ values: string[],
558
+ mode: 'all' | 'any' = 'all'
559
+ ): TestCase {
560
+ return testCase(id).prompt(prompt).expectContains(values, mode).build();
561
+ }
562
+
563
+ /**
564
+ * Create a simple test case with exact match expectation
565
+ */
566
+ export function exactCase(id: string, prompt: string, value: string): TestCase {
567
+ return testCase(id).prompt(prompt).expectExact(value).build();
568
+ }
569
+
570
+ /**
571
+ * Create a simple test case with regex expectation
572
+ */
573
+ export function regexCase(id: string, prompt: string, pattern: string, flags?: string): TestCase {
574
+ return testCase(id).prompt(prompt).expectRegex(pattern, flags).build();
575
+ }
576
+
577
+ /**
578
+ * Create a simple test case with JSON schema expectation
579
+ */
580
+ export function jsonCase(id: string, prompt: string, schema: Record<string, unknown>): TestCase {
581
+ return testCase(id).prompt(prompt).expectJsonSchema(schema).build();
582
+ }
583
+
584
+ /**
585
+ * Create a simple test case with LLM grading
586
+ */
587
+ export function gradedCase(id: string, prompt: string, rubric: string, threshold = 0.7): TestCase {
588
+ return testCase(id).prompt(prompt).expectLLMGrade(rubric, { threshold }).build();
589
+ }
590
+
591
+ // ============================================================================
592
+ // Expectation Helpers
593
+ // ============================================================================
594
+
595
+ /**
596
+ * Create an exact match expectation
597
+ */
598
+ export function exact(value: string, caseSensitive = true): Expected {
599
+ return { type: 'exact', value, caseSensitive };
600
+ }
601
+
602
+ /**
603
+ * Create a contains expectation
604
+ */
605
+ export function contains(values: string[], mode: 'all' | 'any' = 'all'): Expected {
606
+ return { type: 'contains', values, mode };
607
+ }
608
+
609
+ /**
610
+ * Create a not_contains expectation
611
+ */
612
+ export function notContains(values: string[], mode: 'all' | 'any' = 'all'): Expected {
613
+ return { type: 'not_contains', values, mode };
614
+ }
615
+
616
+ /**
617
+ * Create a regex expectation
618
+ */
619
+ export function regex(pattern: string, flags?: string): Expected {
620
+ return { type: 'regex', pattern, flags };
621
+ }
622
+
623
+ /**
624
+ * Create a fuzzy match expectation
625
+ */
626
+ export function fuzzy(value: string, threshold = 0.8): Expected {
627
+ return { type: 'fuzzy', value, threshold };
628
+ }
629
+
630
+ /**
631
+ * Create a JSON schema expectation
632
+ */
633
+ export function jsonSchema(schema: Record<string, unknown>): Expected {
634
+ return { type: 'json_schema', schema };
635
+ }
636
+
637
+ /**
638
+ * Create an LLM grader expectation
639
+ */
640
+ export function llmGrade(
641
+ rubric: string,
642
+ options?: { threshold?: number; model?: string; provider?: Provider }
643
+ ): Expected {
644
+ return {
645
+ type: 'llm_grader',
646
+ rubric,
647
+ threshold: options?.threshold ?? 0.7,
648
+ model: options?.model,
649
+ provider: options?.provider,
650
+ };
651
+ }
652
+
653
+ /**
654
+ * Create a similarity expectation
655
+ */
656
+ export function similarity(
657
+ value: string,
658
+ options?: {
659
+ threshold?: number;
660
+ mode?: 'embedding' | 'llm';
661
+ model?: string;
662
+ embeddingModel?: string;
663
+ }
664
+ ): Expected {
665
+ return {
666
+ type: 'similarity',
667
+ value,
668
+ threshold: options?.threshold ?? 0.75,
669
+ mode: options?.mode,
670
+ model: options?.model,
671
+ embeddingModel: options?.embeddingModel,
672
+ };
673
+ }
674
+
675
+ /**
676
+ * Create an inline expression expectation
677
+ */
678
+ export function inline(expression: string, value?: string): Expected {
679
+ return { type: 'inline', expression, value };
680
+ }
681
+
682
+ /**
683
+ * Combine expectations with AND logic
684
+ * Note: Pass base expectations (not combined) for proper type inference
685
+ */
686
+ export function allOf(...expectations: Expected[]): Expected {
687
+ // Type assertion needed because TypeScript can't infer combined type correctly
688
+ return { type: 'combined', operator: 'and', expectations } as unknown as Expected;
689
+ }
690
+
691
+ /**
692
+ * Combine expectations with OR logic
693
+ * Note: Pass base expectations (not combined) for proper type inference
694
+ */
695
+ export function anyOf(...expectations: Expected[]): Expected {
696
+ // Type assertion needed because TypeScript can't infer combined type correctly
697
+ return { type: 'combined', operator: 'or', expectations } as unknown as Expected;
698
+ }